You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by go...@apache.org on 2016/08/25 20:19:30 UTC

[01/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Repository: incubator-slider
Updated Branches:
  refs/heads/yarn-native-services [created] 940c087a9


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowServiceTerminatingRunnable.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowServiceTerminatingRunnable.java b/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowServiceTerminatingRunnable.java
deleted file mode 100644
index 15be1dc..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowServiceTerminatingRunnable.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import org.junit.Test;
-
-
-public class TestWorkflowServiceTerminatingRunnable extends WorkflowServiceTestBase {
-
-  @Test
-  public void testNoservice() throws Throwable {
-
-    try {
-      new ServiceTerminatingRunnable(null, new SimpleRunnable());
-      fail("unexpected ");
-    } catch (IllegalArgumentException e) {
-
-      // expected 
-    }
-  }
-
-
-  @Test
-  public void testBasicRun() throws Throwable {
-
-    WorkflowCompositeService svc = run(new WorkflowCompositeService());
-    ServiceTerminatingRunnable runnable = new ServiceTerminatingRunnable(svc,
-        new SimpleRunnable());
-
-    // synchronous in-thread execution
-    runnable.run();
-    assertStopped(svc);
-  }
-
-  @Test
-  public void testFailureRun() throws Throwable {
-
-    WorkflowCompositeService svc = run(new WorkflowCompositeService());
-    ServiceTerminatingRunnable runnable =
-        new ServiceTerminatingRunnable(svc, new SimpleRunnable(true));
-
-    // synchronous in-thread execution
-    runnable.run();
-    assertStopped(svc);
-    assertNotNull(runnable.getException());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/services/workflow/WorkflowServiceTestBase.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/services/workflow/WorkflowServiceTestBase.java b/slider-core/src/test/java/org/apache/slider/server/services/workflow/WorkflowServiceTestBase.java
deleted file mode 100644
index f38bd9d..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/services/workflow/WorkflowServiceTestBase.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.service.Service;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-import org.junit.rules.Timeout;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.Locale;
-import java.util.concurrent.Callable;
-
-/**
- * Test base for workflow service tests.
- */
-public abstract class WorkflowServiceTestBase extends Assert {
-  private static final Logger
-      log = LoggerFactory.getLogger(WorkflowServiceTestBase.class);
-
-  /**
-   * Set the timeout for every test
-   */
-  @Rule
-  public Timeout testTimeout = new Timeout(15000);
-
-  @Rule
-  public TestName name = new TestName();
-
-  @Before
-  public void nameThread() {
-    Thread.currentThread().setName("JUnit");
-  }
-
-
-  protected void assertInState(Service service, Service.STATE expected) {
-    Service.STATE actual = service.getServiceState();
-    if (actual != expected) {
-      fail("Service " + service.getName() + " in state " + actual
-           + " -expected " + expected);
-    }
-  }
-
-  protected void assertStopped(Service service) {
-    assertInState(service, Service.STATE.STOPPED);
-  }
-
-  protected void logState(ServiceParent p) {
-    logService(p);
-    for (Service s : p.getServices()) {
-      logService(s);
-    }
-  }
-
-  protected void logService(Service s) {
-    log.info(s.toString());
-    Throwable failureCause = s.getFailureCause();
-    if (failureCause != null) {
-      log.info("Failed in state {} with {}", s.getFailureState(),
-          failureCause);
-    }
-  }
-
-  /**
-   * Init and start a service
-   * @param svc the service
-   * @return the service
-   */
-  protected <S extends Service> S run(S svc) {
-    svc.init(new Configuration());
-    svc.start();
-    return svc;
-  }
-
-  /**
-   * Handler for callable events
-   */
-  public static class CallableHandler implements Callable<String> {
-    public volatile boolean notified = false;
-    public final String result;
-
-    public CallableHandler(String result) {
-      this.result = result;
-    }
-
-    @Override
-    public String call() throws Exception {
-      log.info("CallableHandler::call");
-      notified = true;
-      return result;
-    }
-  }
-
-  /**
-   * Assert that a string is in an output list. Fails fast if the output
-   * list is empty
-   * @param text text to scan for
-   * @param output list of output lines.
-   */
-  public void assertStringInOutput(String text, List<String> output) {
-    assertTrue("Empty output list", !output.isEmpty());
-    boolean found = false;
-    StringBuilder builder = new StringBuilder();
-    for (String s : output) {
-      builder.append(s.toLowerCase(Locale.ENGLISH)).append('\n');
-      if (s.contains(text)) {
-        found = true;
-        break;
-      }
-    }
-
-    if (!found) {
-      String message =
-          "Text \"" + text + "\" not found in " + output.size() + " lines\n";
-      fail(message + builder.toString());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/test/ContractTestUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/test/ContractTestUtils.java b/slider-core/src/test/java/org/apache/slider/test/ContractTestUtils.java
deleted file mode 100644
index 7eaaefe..0000000
--- a/slider-core/src/test/java/org/apache/slider/test/ContractTestUtils.java
+++ /dev/null
@@ -1,901 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.test;
-
-import org.apache.hadoop.fs.FSDataInputStream;
-import org.apache.hadoop.fs.FSDataOutputStream;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.junit.Assert;
-import org.junit.internal.AssumptionViolatedException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.EOFException;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.Properties;
-import java.util.UUID;
-
-/**
- * Utilities used across test cases to make assertions about filesystems
- * -assertions which fail with useful information.
- * This is lifted from Hadoop common Test; that JAR isn't published, so
- * we have to make do.
- */
-public class ContractTestUtils extends Assert {
-
-  private static final Logger LOG =
-      LoggerFactory.getLogger(ContractTestUtils.class);
-
-  public static final String IO_FILE_BUFFER_SIZE = "io.file.buffer.size";
-
-  // For scale testing, we can repeatedly write small chunk data to generate
-  // a large file.
-  public static final String IO_CHUNK_BUFFER_SIZE = "io.chunk.buffer.size";
-  public static final int DEFAULT_IO_CHUNK_BUFFER_SIZE = 128;
-  public static final String IO_CHUNK_MODULUS_SIZE = "io.chunk.modulus.size";
-  public static final int DEFAULT_IO_CHUNK_MODULUS_SIZE = 128;
-
-  /**
-   * Assert that a property in the property set matches the expected value
-   * @param props property set
-   * @param key property name
-   * @param expected expected value. If null, the property must not be in the set
-   */
-  public static void assertPropertyEquals(Properties props,
-                                          String key,
-                                          String expected) {
-    String val = props.getProperty(key);
-    if (expected == null) {
-      assertNull("Non null property " + key + " = " + val, val);
-    } else {
-      assertEquals("property " + key + " = " + val,
-                          expected,
-                          val);
-    }
-  }
-
-  /**
-   *
-   * Write a file and read it in, validating the result. Optional flags control
-   * whether file overwrite operations should be enabled, and whether the
-   * file should be deleted afterwards.
-   *
-   * If there is a mismatch between what was written and what was expected,
-   * a small range of bytes either side of the first error are logged to aid
-   * diagnosing what problem occurred -whether it was a previous file
-   * or a corrupting of the current file. This assumes that two
-   * sequential runs to the same path use datasets with different character
-   * moduli.
-   *
-   * @param fs filesystem
-   * @param path path to write to
-   * @param len length of data
-   * @param overwrite should the create option allow overwrites?
-   * @param delete should the file be deleted afterwards? -with a verification
-   * that it worked. Deletion is not attempted if an assertion has failed
-   * earlier -it is not in a <code>finally{}</code> block.
-   * @throws IOException IO problems
-   */
-  public static void writeAndRead(FileSystem fs,
-                                  Path path,
-                                  byte[] src,
-                                  int len,
-                                  int blocksize,
-                                  boolean overwrite,
-                                  boolean delete) throws IOException {
-    fs.mkdirs(path.getParent());
-
-    writeDataset(fs, path, src, len, blocksize, overwrite);
-
-    byte[] dest = readDataset(fs, path, len);
-
-    compareByteArrays(src, dest, len);
-
-    if (delete) {
-      rejectRootOperation(path);
-      boolean deleted = fs.delete(path, false);
-      assertTrue("Deleted", deleted);
-      assertPathDoesNotExist(fs, "Cleanup failed", path);
-    }
-  }
-
-  /**
-   * Write a file.
-   * Optional flags control
-   * whether file overwrite operations should be enabled
-   * @param fs filesystem
-   * @param path path to write to
-   * @param len length of data
-   * @param overwrite should the create option allow overwrites?
-   * @throws IOException IO problems
-   */
-  public static void writeDataset(FileSystem fs,
-                                   Path path,
-                                   byte[] src,
-                                   int len,
-                                   int buffersize,
-                                   boolean overwrite) throws IOException {
-    assertTrue(
-      "Not enough data in source array to write " + len + " bytes",
-      src.length >= len);
-    FSDataOutputStream out = fs.create(path,
-                                       overwrite,
-                                       fs.getConf()
-                                         .getInt(IO_FILE_BUFFER_SIZE,
-                                                 4096),
-                                       (short) 1,
-                                       buffersize);
-    out.write(src, 0, len);
-    out.close();
-    assertFileHasLength(fs, path, len);
-  }
-
-  /**
-   * Read the file and convert to a byte dataset.
-   * This implements readfully internally, so that it will read
-   * in the file without ever having to seek()
-   * @param fs filesystem
-   * @param path path to read from
-   * @param len length of data to read
-   * @return the bytes
-   * @throws IOException IO problems
-   */
-  public static byte[] readDataset(FileSystem fs, Path path, int len)
-      throws IOException {
-    FSDataInputStream in = fs.open(path);
-    byte[] dest = new byte[len];
-    int offset =0;
-    int nread = 0;
-    try {
-      while (nread < len) {
-        int nbytes = in.read(dest, offset + nread, len - nread);
-        if (nbytes < 0) {
-          throw new EOFException("End of file reached before reading fully.");
-        }
-        nread += nbytes;
-      }
-    } finally {
-      in.close();
-    }
-    return dest;
-  }
-
-  /**
-   * Read a file, verify its length and contents match the expected array
-   * @param fs filesystem
-   * @param path path to file
-   * @param original original dataset
-   * @throws IOException IO Problems
-   */
-  public static void verifyFileContents(FileSystem fs,
-                                        Path path,
-                                        byte[] original) throws IOException {
-    FileStatus stat = fs.getFileStatus(path);
-    String statText = stat.toString();
-    assertTrue("not a file " + statText, stat.isFile());
-    assertEquals("wrong length " + statText, original.length, stat.getLen());
-    byte[] bytes = readDataset(fs, path, original.length);
-    compareByteArrays(original,bytes,original.length);
-  }
-
-  /**
-   * Verify that the read at a specific offset in a stream
-   * matches that expected
-   * @param stm stream
-   * @param fileContents original file contents
-   * @param seekOff seek offset
-   * @param toRead number of bytes to read
-   * @throws IOException IO problems
-   */
-  public static void verifyRead(FSDataInputStream stm, byte[] fileContents,
-                                int seekOff, int toRead) throws IOException {
-    byte[] out = new byte[toRead];
-    stm.seek(seekOff);
-    stm.readFully(out);
-    byte[] expected = Arrays.copyOfRange(fileContents, seekOff,
-                                         seekOff + toRead);
-    compareByteArrays(expected, out,toRead);
-  }
-
-  /**
-   * Assert that tthe array original[0..len] and received[] are equal.
-   * A failure triggers the logging of the bytes near where the first
-   * difference surfaces.
-   * @param original source data
-   * @param received actual
-   * @param len length of bytes to compare
-   */
-  public static void compareByteArrays(byte[] original,
-                                       byte[] received,
-                                       int len) {
-    assertEquals("Number of bytes read != number written",
-                        len, received.length);
-    int errors = 0;
-    int first_error_byte = -1;
-    for (int i = 0; i < len; i++) {
-      if (original[i] != received[i]) {
-        if (errors == 0) {
-          first_error_byte = i;
-        }
-        errors++;
-      }
-    }
-
-    if (errors > 0) {
-      String message = String.format(" %d errors in file of length %d",
-                                     errors, len);
-      LOG.warn(message);
-      // the range either side of the first error to print
-      // this is a purely arbitrary number, to aid user debugging
-      final int overlap = 10;
-      for (int i = Math.max(0, first_error_byte - overlap);
-           i < Math.min(first_error_byte + overlap, len);
-           i++) {
-        byte actual = received[i];
-        byte expected = original[i];
-        String letter = toChar(actual);
-        String line = String.format("[%04d] %2x %s\n", i, actual, letter);
-        if (expected != actual) {
-          line = String.format("[%04d] %2x %s -expected %2x %s\n",
-                               i,
-                               actual,
-                               letter,
-                               expected,
-                               toChar(expected));
-        }
-        LOG.warn(line);
-      }
-      fail(message);
-    }
-  }
-
-  /**
-   * Convert a byte to a character for printing. If the
-   * byte value is < 32 -and hence unprintable- the byte is
-   * returned as a two digit hex value
-   * @param b byte
-   * @return the printable character string
-   */
-  public static String toChar(byte b) {
-    if (b >= 0x20) {
-      return Character.toString((char) b);
-    } else {
-      return String.format("%02x", b);
-    }
-  }
-
-  /**
-   * Convert a buffer to a string, character by character
-   * @param buffer input bytes
-   * @return a string conversion
-   */
-  public static String toChar(byte[] buffer) {
-    StringBuilder builder = new StringBuilder(buffer.length);
-    for (byte b : buffer) {
-      builder.append(toChar(b));
-    }
-    return builder.toString();
-  }
-
-  public static byte[] toAsciiByteArray(String s) {
-    char[] chars = s.toCharArray();
-    int len = chars.length;
-    byte[] buffer = new byte[len];
-    for (int i = 0; i < len; i++) {
-      buffer[i] = (byte) (chars[i] & 0xff);
-    }
-    return buffer;
-  }
-
-  /**
-   * Cleanup at the end of a test run
-   * @param action action triggering the operation (for use in logging)
-   * @param fileSystem filesystem to work with. May be null
-   * @param cleanupPath path to delete as a string
-   */
-  public static void cleanup(String action,
-                             FileSystem fileSystem,
-                             String cleanupPath) {
-    if (fileSystem == null) {
-      return;
-    }
-    Path path = new Path(cleanupPath).makeQualified(fileSystem.getUri(),
-        fileSystem.getWorkingDirectory());
-    cleanup(action, fileSystem, path);
-  }
-
-  /**
-   * Cleanup at the end of a test run
-   * @param action action triggering the operation (for use in logging)
-   * @param fileSystem filesystem to work with. May be null
-   * @param path path to delete
-   */
-  public static void cleanup(String action, FileSystem fileSystem, Path path) {
-    noteAction(action);
-    try {
-      rm(fileSystem, path, true, false);
-    } catch (Exception e) {
-      LOG.error("Error deleting in "+ action + " - "  + path + ": " + e, e);
-    }
-  }
-
-  /**
-   * Delete a directory. There's a safety check for operations against the
-   * root directory -these are intercepted and rejected with an IOException
-   * unless the allowRootDelete flag is true
-   * @param fileSystem filesystem to work with. May be null
-   * @param path path to delete
-   * @param recursive flag to enable recursive delete
-   * @param allowRootDelete can the root directory be deleted?
-   * @throws IOException on any problem.
-   */
-  public static boolean rm(FileSystem fileSystem,
-      Path path,
-      boolean recursive,
-      boolean allowRootDelete) throws
-      IOException {
-    if (fileSystem != null) {
-      rejectRootOperation(path, allowRootDelete);
-      if (fileSystem.exists(path)) {
-        return fileSystem.delete(path, recursive);
-      }
-    }
-    return false;
-
-  }
-
-  /**
-   * Block any operation on the root path. This is a safety check
-   * @param path path in the filesystem
-   * @param allowRootOperation can the root directory be manipulated?
-   * @throws IOException if the operation was rejected
-   */
-  public static void rejectRootOperation(Path path,
-      boolean allowRootOperation) throws IOException {
-    if (path.isRoot() && !allowRootOperation) {
-      throw new IOException("Root directory operation rejected: " + path);
-    }
-  }
-
-  /**
-   * Block any operation on the root path. This is a safety check
-   * @param path path in the filesystem
-   * @throws IOException if the operation was rejected
-   */
-  public static void rejectRootOperation(Path path) throws IOException {
-    rejectRootOperation(path, false);
-  }
-
-
-  public static void noteAction(String action) {
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("==============  "+ action +" =============");
-    }
-  }
-
-  /**
-   * downgrade a failure to a message and a warning, then an
-   * exception for the Junit test runner to mark as failed
-   * @param message text message
-   * @param failure what failed
-   * @throws AssumptionViolatedException always
-   */
-  public static void downgrade(String message, Throwable failure) {
-    LOG.warn("Downgrading test " + message, failure);
-    AssumptionViolatedException ave =
-      new AssumptionViolatedException(failure, null);
-    throw ave;
-  }
-
-  /**
-   * report an overridden test as unsupported
-   * @param message message to use in the text
-   * @throws AssumptionViolatedException always
-   */
-  public static void unsupported(String message) {
-    skip(message);
-  }
-
-  /**
-   * report a test has been skipped for some reason
-   * @param message message to use in the text
-   * @throws AssumptionViolatedException always
-   */
-  public static void skip(String message) {
-    LOG.info("Skipping: {}", message);
-    throw new AssumptionViolatedException(message);
-  }
-
-  /**
-   * Fail with an exception that was received
-   * @param text text to use in the exception
-   * @param thrown a (possibly null) throwable to init the cause with
-   * @throws AssertionError with the text and throwable -always
-   */
-  public static void fail(String text, Throwable thrown) {
-    AssertionError e = new AssertionError(text);
-    e.initCause(thrown);
-    throw e;
-  }
-
-  /**
-   * Make an assertion about the length of a file
-   * @param fs filesystem
-   * @param path path of the file
-   * @param expected expected length
-   * @throws IOException on File IO problems
-   */
-  public static void assertFileHasLength(FileSystem fs, Path path,
-                                         int expected) throws IOException {
-    FileStatus status = fs.getFileStatus(path);
-    assertEquals(
-      "Wrong file length of file " + path + " status: " + status,
-      expected,
-      status.getLen());
-  }
-
-  /**
-   * Assert that a path refers to a directory
-   * @param fs filesystem
-   * @param path path of the directory
-   * @throws IOException on File IO problems
-   */
-  public static void assertIsDirectory(FileSystem fs,
-                                       Path path) throws IOException {
-    FileStatus fileStatus = fs.getFileStatus(path);
-    assertIsDirectory(fileStatus);
-  }
-
-  /**
-   * Assert that a path refers to a directory
-   * @param fileStatus stats to check
-   */
-  public static void assertIsDirectory(FileStatus fileStatus) {
-    assertTrue("Should be a directory -but isn't: " + fileStatus,
-               fileStatus.isDirectory());
-  }
-
-  /**
-   * Write the text to a file, returning the converted byte array
-   * for use in validating the round trip
-   * @param fs filesystem
-   * @param path path of file
-   * @param text text to write
-   * @param overwrite should the operation overwrite any existing file?
-   * @return the read bytes
-   * @throws IOException on IO problems
-   */
-  public static byte[] writeTextFile(FileSystem fs,
-                                   Path path,
-                                   String text,
-                                   boolean overwrite) throws IOException {
-    byte[] bytes = new byte[0];
-    if (text != null) {
-      bytes = toAsciiByteArray(text);
-    }
-    createFile(fs, path, overwrite, bytes);
-    return bytes;
-  }
-
-  /**
-   * Create a file
-   * @param fs filesystem
-   * @param path       path to write
-   * @param overwrite overwrite flag
-   * @param data source dataset. Can be null
-   * @throws IOException on any problem
-   */
-  public static void createFile(FileSystem fs,
-                                 Path path,
-                                 boolean overwrite,
-                                 byte[] data) throws IOException {
-    FSDataOutputStream stream = fs.create(path, overwrite);
-    if (data != null && data.length > 0) {
-      stream.write(data);
-    }
-    stream.close();
-  }
-
-  /**
-   * Touch a file
-   * @param fs filesystem
-   * @param path path
-   * @throws IOException IO problems
-   */
-  public static void touch(FileSystem fs,
-                           Path path) throws IOException {
-    createFile(fs, path, true, null);
-  }
-
-  /**
-   * Delete a file/dir and assert that delete() returned true
-   * <i>and</i> that the path no longer exists. This variant rejects
-   * all operations on root directories
-   * @param fs filesystem
-   * @param file path to delete
-   * @param recursive flag to enable recursive delete
-   * @throws IOException IO problems
-   */
-  public static void assertDeleted(FileSystem fs,
-                                   Path file,
-                                   boolean recursive) throws IOException {
-    assertDeleted(fs, file, recursive, false);
-  }
-
-  /**
-   * Delete a file/dir and assert that delete() returned true
-   * <i>and</i> that the path no longer exists. This variant rejects
-   * all operations on root directories
-   * @param fs filesystem
-   * @param file path to delete
-   * @param recursive flag to enable recursive delete
-   * @param allowRootOperations can the root dir be deleted?
-   * @throws IOException IO problems
-   */
-  public static void assertDeleted(FileSystem fs,
-      Path file,
-      boolean recursive,
-      boolean allowRootOperations) throws IOException {
-    rejectRootOperation(file, allowRootOperations);
-    assertPathExists(fs, "about to be deleted file", file);
-    boolean deleted = fs.delete(file, recursive);
-    String dir = ls(fs, file.getParent());
-    assertTrue("Delete failed on " + file + ": " + dir, deleted);
-    assertPathDoesNotExist(fs, "Deleted file", file);
-  }
-
-  /**
-   * Read in "length" bytes, convert to an ascii string
-   * @param fs filesystem
-   * @param path path to read
-   * @param length #of bytes to read.
-   * @return the bytes read and converted to a string
-   * @throws IOException IO problems
-   */
-  public static String readBytesToString(FileSystem fs,
-                                  Path path,
-                                  int length) throws IOException {
-    FSDataInputStream in = fs.open(path);
-    try {
-      byte[] buf = new byte[length];
-      in.readFully(0, buf);
-      return toChar(buf);
-    } finally {
-      in.close();
-    }
-  }
-
-  /**
-   * Take an array of filestats and convert to a string (prefixed w/ a [01] counter
-   * @param stats array of stats
-   * @param separator separator after every entry
-   * @return a stringified set
-   */
-  public static String fileStatsToString(FileStatus[] stats, String separator) {
-    StringBuilder buf = new StringBuilder(stats.length * 128);
-    for (int i = 0; i < stats.length; i++) {
-      buf.append(String.format("[%02d] %s", i, stats[i])).append(separator);
-    }
-    return buf.toString();
-  }
-
-  /**
-   * List a directory
-   * @param fileSystem FS
-   * @param path path
-   * @return a directory listing or failure message
-   * @throws IOException
-   */
-  public static String ls(FileSystem fileSystem, Path path) throws IOException {
-    if (path == null) {
-      //surfaces when someone calls getParent() on something at the top of the path
-      return "/";
-    }
-    FileStatus[] stats;
-    String pathtext = "ls " + path;
-    try {
-      stats = fileSystem.listStatus(path);
-    } catch (FileNotFoundException e) {
-      return pathtext + " -file not found";
-    } catch (IOException e) {
-      return pathtext + " -failed: " + e;
-    }
-    return dumpStats(pathtext, stats);
-  }
-
-  public static String dumpStats(String pathname, FileStatus[] stats) {
-    return pathname + fileStatsToString(stats, "\n");
-  }
-
-   /**
-   * Assert that a file exists and whose {@link FileStatus} entry
-   * declares that this is a file and not a symlink or directory.
-   * @param fileSystem filesystem to resolve path against
-   * @param filename name of the file
-   * @throws IOException IO problems during file operations
-   */
-  public static void assertIsFile(FileSystem fileSystem, Path filename) throws
-                                                                 IOException {
-    assertPathExists(fileSystem, "Expected file", filename);
-    FileStatus status = fileSystem.getFileStatus(filename);
-    assertIsFile(filename, status);
-  }
-
-  /**
-   * Assert that a file exists and whose {@link FileStatus} entry
-   * declares that this is a file and not a symlink or directory.
-   * @param filename name of the file
-   * @param status file status
-   */
-  public static void assertIsFile(Path filename, FileStatus status) {
-    String fileInfo = filename + "  " + status;
-    assertFalse("File claims to be a directory " + fileInfo,
-                status.isDirectory());
-    assertFalse("File claims to be a symlink " + fileInfo,
-                       status.isSymlink());
-  }
-
-  /**
-   * Create a dataset for use in the tests; all data is in the range
-   * base to (base+modulo-1) inclusive
-   * @param len length of data
-   * @param base base of the data
-   * @param modulo the modulo
-   * @return the newly generated dataset
-   */
-  public static byte[] dataset(int len, int base, int modulo) {
-    byte[] dataset = new byte[len];
-    for (int i = 0; i < len; i++) {
-      dataset[i] = (byte) (base + (i % modulo));
-    }
-    return dataset;
-  }
-
-  /**
-   * Assert that a path exists -but make no assertions as to the
-   * type of that entry
-   *
-   * @param fileSystem filesystem to examine
-   * @param message message to include in the assertion failure message
-   * @param path path in the filesystem
-   * @throws FileNotFoundException raised if the path is missing
-   * @throws IOException IO problems
-   */
-  public static void assertPathExists(FileSystem fileSystem, String message,
-                               Path path) throws IOException {
-    if (!fileSystem.exists(path)) {
-      //failure, report it
-      String listing = ls(fileSystem, path.getParent());
-      throw new FileNotFoundException(message + ": not found " + path
-        + " in \"" + path.getParent() + "\" :\n" + listing);
-    }
-  }
-
-  /**
-   * Assert that a path does not exist
-   *
-   * @param fileSystem filesystem to examine
-   * @param message message to include in the assertion failure message
-   * @param path path in the filesystem
-   * @throws IOException IO problems
-   */
-  public static void assertPathDoesNotExist(FileSystem fileSystem,
-                                            String message,
-                                            Path path) throws IOException {
-    try {
-      FileStatus status = fileSystem.getFileStatus(path);
-      fail(message + ": unexpectedly found " + path + " as  " + status);
-    } catch (FileNotFoundException expected) {
-      //this is expected
-
-    }
-  }
-
-  /**
-   * Assert that a FileSystem.listStatus on a dir finds the subdir/child entry
-   * @param fs filesystem
-   * @param dir directory to scan
-   * @param subdir full path to look for
-   * @throws IOException IO probles
-   */
-  public static void assertListStatusFinds(FileSystem fs,
-                                           Path dir,
-                                           Path subdir) throws IOException {
-    FileStatus[] stats = fs.listStatus(dir);
-    boolean found = false;
-    StringBuilder builder = new StringBuilder();
-    for (FileStatus stat : stats) {
-      builder.append(stat.toString()).append('\n');
-      if (stat.getPath().equals(subdir)) {
-        found = true;
-      }
-    }
-    assertTrue("Path " + subdir
-                      + " not found in directory " + dir + ":" + builder,
-                      found);
-  }
-
-  /**
-   * Test for the host being an OSX machine
-   * @return true if the JVM thinks that is running on OSX
-   */
-  public static boolean isOSX() {
-    return System.getProperty("os.name").contains("OS X");
-  }
-
-  /**
-   * compare content of file operations using a double byte array
-   * @param concat concatenated files
-   * @param bytes bytes
-   */
-  public static void validateFileContent(byte[] concat, byte[][] bytes) {
-    int idx = 0;
-    boolean mismatch = false;
-
-    for (byte[] bb : bytes) {
-      for (byte b : bb) {
-        if (b != concat[idx++]) {
-          mismatch = true;
-          break;
-        }
-      }
-      if (mismatch)
-        break;
-    }
-    assertFalse("File content of file is not as expected at offset " + idx,
-                mismatch);
-  }
-
-  /**
-   * Receives test data from the given input file and checks the size of the
-   * data as well as the pattern inside the received data.
-   *
-   * @param fs FileSystem
-   * @param path Input file to be checked
-   * @param expectedSize the expected size of the data to be read from the
-   *        input file in bytes
-   * @param bufferLen Pattern length
-   * @param modulus   Pattern modulus
-   * @throws IOException
-   *         thrown if an error occurs while reading the data
-   */
-  public static void verifyReceivedData(FileSystem fs, Path path,
-                                      final long expectedSize,
-                                      final int bufferLen,
-                                      final int modulus) throws IOException {
-    final byte[] testBuffer = new byte[bufferLen];
-
-    long totalBytesRead = 0;
-    int nextExpectedNumber = 0;
-    final InputStream inputStream = fs.open(path);
-    try {
-      while (true) {
-        final int bytesRead = inputStream.read(testBuffer);
-        if (bytesRead < 0) {
-          break;
-        }
-
-        totalBytesRead += bytesRead;
-
-        for (int i = 0; i < bytesRead; ++i) {
-          if (testBuffer[i] != nextExpectedNumber) {
-            throw new IOException("Read number " + testBuffer[i]
-                + " but expected " + nextExpectedNumber);
-          }
-
-          ++nextExpectedNumber;
-
-          if (nextExpectedNumber == modulus) {
-            nextExpectedNumber = 0;
-          }
-        }
-      }
-
-      if (totalBytesRead != expectedSize) {
-        throw new IOException("Expected to read " + expectedSize +
-            " bytes but only received " + totalBytesRead);
-      }
-    } finally {
-      inputStream.close();
-    }
-  }
-
-  /**
-   * Generates test data of the given size according to some specific pattern
-   * and writes it to the provided output file.
-   *
-   * @param fs FileSystem
-   * @param path Test file to be generated
-   * @param size The size of the test data to be generated in bytes
-   * @param bufferLen Pattern length
-   * @param modulus   Pattern modulus
-   * @throws IOException
-   *         thrown if an error occurs while writing the data
-   */
-  public static long generateTestFile(FileSystem fs, Path path,
-                                      final long size,
-                                      final int bufferLen,
-                                      final int modulus) throws IOException {
-    final byte[] testBuffer = new byte[bufferLen];
-    for (int i = 0; i < testBuffer.length; ++i) {
-      testBuffer[i] = (byte) (i % modulus);
-    }
-
-    final OutputStream outputStream = fs.create(path, false);
-    long bytesWritten = 0;
-    try {
-      while (bytesWritten < size) {
-        final long diff = size - bytesWritten;
-        if (diff < testBuffer.length) {
-          outputStream.write(testBuffer, 0, (int) diff);
-          bytesWritten += diff;
-        } else {
-          outputStream.write(testBuffer);
-          bytesWritten += testBuffer.length;
-        }
-      }
-
-      return bytesWritten;
-    } finally {
-      outputStream.close();
-    }
-  }
-
-  /**
-   * Creates and reads a file with the given size. The test file is generated
-   * according to a specific pattern so it can be easily verified even if it's
-   * a multi-GB one.
-   * During the read phase the incoming data stream is also checked against
-   * this pattern.
-   *
-   * @param fs FileSystem
-   * @param parent Test file parent dir path
-   * @throws IOException
-   *    thrown if an I/O error occurs while writing or reading the test file
-   */
-  public static void createAndVerifyFile(FileSystem fs, Path parent, final long fileSize)
-      throws IOException {
-    int testBufferSize = fs.getConf()
-        .getInt(IO_CHUNK_BUFFER_SIZE, DEFAULT_IO_CHUNK_BUFFER_SIZE);
-    int modulus = fs.getConf()
-        .getInt(IO_CHUNK_MODULUS_SIZE, DEFAULT_IO_CHUNK_MODULUS_SIZE);
-
-    final String objectName = UUID.randomUUID().toString();
-    final Path objectPath = new Path(parent, objectName);
-
-    // Write test file in a specific pattern
-    assertEquals(fileSize,
-        generateTestFile(fs, objectPath, fileSize, testBufferSize, modulus));
-    assertPathExists(fs, "not created successful", objectPath);
-
-    // Now read the same file back and verify its content
-    try {
-      verifyReceivedData(fs, objectPath, fileSize, testBufferSize, modulus);
-    } finally {
-      // Delete test file
-      fs.delete(objectPath, false);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/test/MiniZooKeeperCluster.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/test/MiniZooKeeperCluster.java b/slider-core/src/test/java/org/apache/slider/test/MiniZooKeeperCluster.java
deleted file mode 100644
index d739324..0000000
--- a/slider-core/src/test/java/org/apache/slider/test/MiniZooKeeperCluster.java
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.test;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileUtil;
-import org.apache.zookeeper.server.NIOServerCnxnFactory;
-import org.apache.zookeeper.server.ZooKeeperServer;
-import org.apache.zookeeper.server.persistence.FileTxnLog;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.net.BindException;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-
-/**
- * This is a version of the HBase ZK cluster cut out to be standalone
- */
-public class MiniZooKeeperCluster {
-  private static final Logger LOG = LoggerFactory.getLogger(
-      MiniZooKeeperCluster.class);
-
-  private static final int TICK_TIME = 2000;
-  private static final int CONNECTION_TIMEOUT = 30000;
-  public static final int MAX_CLIENT_CONNECTIONS = 1000;
-
-  private boolean started;
-
-  /** The default port. If zero, we use a random port. */
-  private int defaultClientPort = 0;
-
-  private int clientPort;
-
-  private List<NIOServerCnxnFactory> standaloneServerFactoryList;
-  private List<ZooKeeperServer> zooKeeperServers;
-  private List<Integer> clientPortList;
-
-  private int activeZKServerIndex;
-  private int tickTime = 0;
-
-  private Configuration configuration;
-
-  public MiniZooKeeperCluster() {
-    this(new Configuration());
-  }
-
-  public MiniZooKeeperCluster(Configuration configuration) {
-    this.started = false;
-    this.configuration = configuration;
-    activeZKServerIndex = -1;
-    zooKeeperServers = new ArrayList<ZooKeeperServer>();
-    clientPortList = new ArrayList<Integer>();
-    standaloneServerFactoryList = new ArrayList<NIOServerCnxnFactory>();
-  }
-
-  public void setDefaultClientPort(int clientPort) {
-    if (clientPort <= 0) {
-      throw new IllegalArgumentException("Invalid default ZK client port: "
-                                         + clientPort);
-    }
-    this.defaultClientPort = clientPort;
-  }
-
-  /**
-   * Selects a ZK client port. Returns the default port if specified.
-   * Otherwise, returns a random port. The random port is selected from the
-   * range between 49152 to 65535. These ports cannot be registered with IANA
-   * and are intended for dynamic allocation (see http://bit.ly/dynports).
-   */
-  private int selectClientPort() {
-    if (defaultClientPort > 0) {
-      return defaultClientPort;
-    }
-    return 0xc000 + new Random().nextInt(0x3f00);
-  }
-
-  public void setTickTime(int tickTime) {
-    this.tickTime = tickTime;
-  }
-
-  public int getBackupZooKeeperServerNum() {
-    return zooKeeperServers.size() - 1;
-  }
-
-  public int getZooKeeperServerNum() {
-    return zooKeeperServers.size();
-  }
-
-  // / XXX: From o.a.zk.t.ClientBase
-  private static void setupTestEnv() {
-    // during the tests we run with 100K prealloc in the logs.
-    // on windows systems prealloc of 64M was seen to take ~15seconds
-    // resulting in test failure (client timeout on first session).
-    // set env and directly in order to handle static init/gc issues
-    System.setProperty("zookeeper.preAllocSize", "100");
-    FileTxnLog.setPreallocSize(100 * 1024);
-  }
-
-  public int startup(File baseDir) throws IOException, InterruptedException {
-    return startup(baseDir, 1);
-  }
-
-  /**
-   * @param baseDir
-   * @param numZooKeeperServers
-   * @return ClientPort server bound to, -1 if there was a
-   *         binding problem and we couldn't pick another port.
-   * @throws IOException
-   * @throws InterruptedException
-   */
-  public int startup(File baseDir, int numZooKeeperServers) throws IOException,
-      InterruptedException {
-    if (numZooKeeperServers <= 0)
-      return -1;
-
-    setupTestEnv();
-    shutdown();
-
-    int tentativePort = selectClientPort();
-
-    // running all the ZK servers
-    for (int i = 0; i < numZooKeeperServers; i++) {
-      File dir = new File(baseDir, "zookeeper_" + i).getAbsoluteFile();
-      recreateDir(dir);
-      int tickTimeToUse;
-      if (this.tickTime > 0) {
-        tickTimeToUse = this.tickTime;
-      } else {
-        tickTimeToUse = TICK_TIME;
-      }
-      ZooKeeperServer server = new ZooKeeperServer(dir, dir, tickTimeToUse);
-      NIOServerCnxnFactory standaloneServerFactory;
-      while (true) {
-        try {
-          standaloneServerFactory = new NIOServerCnxnFactory();
-          standaloneServerFactory.configure(
-              new InetSocketAddress(tentativePort),
-              MAX_CLIENT_CONNECTIONS
-          );
-        } catch (BindException e) {
-          LOG.debug("Failed binding ZK Server to client port: " +
-                    tentativePort, e);
-          // We're told to use some port but it's occupied, fail
-          if (defaultClientPort > 0) return -1;
-          // This port is already in use, try to use another.
-          tentativePort = selectClientPort();
-          continue;
-        }
-        break;
-      }
-
-      // Start up this ZK server
-      standaloneServerFactory.startup(server);
-      if (!waitForServerUp(tentativePort, CONNECTION_TIMEOUT)) {
-        throw new IOException("Waiting for startup of standalone server");
-      }
-
-      // We have selected this port as a client port.
-      clientPortList.add(tentativePort);
-      standaloneServerFactoryList.add(standaloneServerFactory);
-      zooKeeperServers.add(server);
-      tentativePort++; //for the next server
-    }
-
-    // set the first one to be active ZK; Others are backups
-    activeZKServerIndex = 0;
-    started = true;
-    clientPort = clientPortList.get(activeZKServerIndex);
-    LOG.info("Started MiniZK Cluster and connect 1 ZK server " +
-             "on client port: " + clientPort);
-    return clientPort;
-  }
-
-  private void recreateDir(File dir) throws IOException {
-    if (dir.exists()) {
-      if (!FileUtil.fullyDelete(dir)) {
-        throw new IOException("Could not delete zk base directory: " + dir);
-      }
-    }
-    try {
-      dir.mkdirs();
-    } catch (SecurityException e) {
-      throw new IOException("creating dir: " + dir, e);
-    }
-  }
-
-  /**
-   * @throws IOException
-   */
-  public void shutdown() throws IOException {
-    if (!started) {
-      return;
-    }
-
-    // shut down all the zk servers
-    for (int i = 0; i < standaloneServerFactoryList.size(); i++) {
-      NIOServerCnxnFactory standaloneServerFactory =
-          standaloneServerFactoryList.get(i);
-      int clientPort = clientPortList.get(i);
-
-      standaloneServerFactory.shutdown();
-      if (!waitForServerDown(clientPort, CONNECTION_TIMEOUT)) {
-        throw new IOException("Waiting for shutdown of standalone server");
-      }
-    }
-    for (ZooKeeperServer zkServer : zooKeeperServers) {
-      //explicitly close ZKDatabase since ZookeeperServer does not close them
-      zkServer.getZKDatabase().close();
-    }
-
-    // clear everything
-    started = false;
-    activeZKServerIndex = 0;
-    standaloneServerFactoryList.clear();
-    clientPortList.clear();
-    zooKeeperServers.clear();
-
-    LOG.info("Shutdown MiniZK cluster with all ZK servers");
-  }
-
-  /**@return clientPort return clientPort if there is another ZK backup can run
-   *         when killing the current active; return -1, if there is no backups.
-   * @throws IOException
-   * @throws InterruptedException
-   */
-  public int killCurrentActiveZooKeeperServer() throws IOException,
-      InterruptedException {
-    if (!started || activeZKServerIndex < 0) {
-      return -1;
-    }
-
-    // Shutdown the current active one
-    NIOServerCnxnFactory standaloneServerFactory =
-        standaloneServerFactoryList.get(activeZKServerIndex);
-    int clientPort = clientPortList.get(activeZKServerIndex);
-
-    standaloneServerFactory.shutdown();
-    if (!waitForServerDown(clientPort, CONNECTION_TIMEOUT)) {
-      throw new IOException("Waiting for shutdown of standalone server");
-    }
-
-    zooKeeperServers.get(activeZKServerIndex).getZKDatabase().close();
-
-    // remove the current active zk server
-    standaloneServerFactoryList.remove(activeZKServerIndex);
-    clientPortList.remove(activeZKServerIndex);
-    zooKeeperServers.remove(activeZKServerIndex);
-    LOG.info("Kill the current active ZK servers in the cluster " +
-             "on client port: " + clientPort);
-
-    if (standaloneServerFactoryList.size() == 0) {
-      // there is no backup servers;
-      return -1;
-    }
-    clientPort = clientPortList.get(activeZKServerIndex);
-    LOG.info("Activate a backup zk server in the cluster " +
-             "on client port: " + clientPort);
-    // return the next back zk server's port
-    return clientPort;
-  }
-
-  /**
-   * Kill one back up ZK servers
-   * @throws IOException
-   * @throws InterruptedException
-   */
-  public void killOneBackupZooKeeperServer() throws IOException,
-      InterruptedException {
-    if (!started || activeZKServerIndex < 0 ||
-        standaloneServerFactoryList.size() <= 1) {
-      return;
-    }
-
-    int backupZKServerIndex = activeZKServerIndex + 1;
-    // Shutdown the current active one
-    NIOServerCnxnFactory standaloneServerFactory =
-        standaloneServerFactoryList.get(backupZKServerIndex);
-    int clientPort = clientPortList.get(backupZKServerIndex);
-
-    standaloneServerFactory.shutdown();
-    if (!waitForServerDown(clientPort, CONNECTION_TIMEOUT)) {
-      throw new IOException("Waiting for shutdown of standalone server");
-    }
-
-    zooKeeperServers.get(backupZKServerIndex).getZKDatabase().close();
-
-    // remove this backup zk server
-    standaloneServerFactoryList.remove(backupZKServerIndex);
-    clientPortList.remove(backupZKServerIndex);
-    zooKeeperServers.remove(backupZKServerIndex);
-    LOG.info("Kill one backup ZK servers in the cluster " +
-             "on client port: " + clientPort);
-  }
-
-  // XXX: From o.a.zk.t.ClientBase
-  private static boolean waitForServerDown(int port, long timeout) {
-    long start = System.currentTimeMillis();
-    while (true) {
-      try {
-        Socket sock = new Socket("localhost", port);
-        try {
-          OutputStream outstream = sock.getOutputStream();
-          outstream.write("stat".getBytes());
-          outstream.flush();
-        } finally {
-          sock.close();
-        }
-      } catch (IOException e) {
-        return true;
-      }
-
-      if (System.currentTimeMillis() > start + timeout) {
-        break;
-      }
-      try {
-        Thread.sleep(250);
-      } catch (InterruptedException e) {
-        // ignore
-      }
-    }
-    return false;
-  }
-
-  // XXX: From o.a.zk.t.ClientBase
-  private static boolean waitForServerUp(int port, long timeout) {
-    long start = System.currentTimeMillis();
-    while (true) {
-      try {
-        Socket sock = new Socket("localhost", port);
-        BufferedReader reader = null;
-        try {
-          OutputStream outstream = sock.getOutputStream();
-          outstream.write("stat".getBytes());
-          outstream.flush();
-
-          Reader isr = new InputStreamReader(sock.getInputStream());
-          reader = new BufferedReader(isr);
-          String line = reader.readLine();
-          if (line != null && line.startsWith("Zookeeper version:")) {
-            return true;
-          }
-        } finally {
-          sock.close();
-          if (reader != null) {
-            reader.close();
-          }
-        }
-      } catch (IOException e) {
-        // ignore as this is expected
-        LOG.info("server localhost:" + port + " not up " + e);
-      }
-
-      if (System.currentTimeMillis() > start + timeout) {
-        break;
-      }
-      try {
-        Thread.sleep(250);
-      } catch (InterruptedException e) {
-        // ignore
-      }
-    }
-    return false;
-  }
-
-  public int getClientPort() {
-    return clientPort;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/tools/TestUtility.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/tools/TestUtility.java b/slider-core/src/test/java/org/apache/slider/tools/TestUtility.java
deleted file mode 100644
index 0717ca1..0000000
--- a/slider-core/src/test/java/org/apache/slider/tools/TestUtility.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.tools;
-
-import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
-import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
-import org.apache.commons.compress.utils.IOUtils;
-import org.junit.Assert;
-import org.junit.rules.TemporaryFolder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-/**
- *  Various utility methods
- *  Byte comparison methods are from
- *  <code>org.apache.hadoop.fs.contract.ContractTestUtils</code>
- */
-public class TestUtility {
-  protected static final Logger log =
-      LoggerFactory.getLogger(TestUtility.class);
-
-  public static void addDir(File dirObj, ZipArchiveOutputStream zipFile, String prefix) throws IOException {
-    for (File file : dirObj.listFiles()) {
-      if (file.isDirectory()) {
-        addDir(file, zipFile, prefix + file.getName() + File.separator);
-      } else {
-        log.info("Adding to zip - " + prefix + file.getName());
-        zipFile.putArchiveEntry(new ZipArchiveEntry(prefix + file.getName()));
-        IOUtils.copy(new FileInputStream(file), zipFile);
-        zipFile.closeArchiveEntry();
-      }
-    }
-  }
-
-  public static void zipDir(String zipFile, String dir) throws IOException {
-    File dirObj = new File(dir);
-    ZipArchiveOutputStream out = new ZipArchiveOutputStream(new FileOutputStream(zipFile));
-    log.info("Creating : {}", zipFile);
-    try {
-      addDir(dirObj, out, "");
-    } finally {
-      out.close();
-    }
-  }
-
-  public static String createAppPackage(
-      TemporaryFolder folder, String subDir, String pkgName, String srcPath) throws IOException {
-    String zipFileName;
-    File pkgPath = folder.newFolder(subDir);
-    File zipFile = new File(pkgPath, pkgName).getAbsoluteFile();
-    zipFileName = zipFile.getAbsolutePath();
-    TestUtility.zipDir(zipFileName, srcPath);
-    log.info("Created temporary zip file at {}", zipFileName);
-    return zipFileName;
-  }
-
-
-  /**
-   * Assert that tthe array original[0..len] and received[] are equal.
-   * A failure triggers the logging of the bytes near where the first
-   * difference surfaces.
-   * @param original source data
-   * @param received actual
-   * @param len length of bytes to compare
-   */
-  public static void compareByteArrays(byte[] original,
-      byte[] received,
-      int len) {
-    Assert.assertEquals("Number of bytes read != number written",
-        len, received.length);
-    int errors = 0;
-    int first_error_byte = -1;
-    for (int i = 0; i < len; i++) {
-      if (original[i] != received[i]) {
-        if (errors == 0) {
-          first_error_byte = i;
-        }
-        errors++;
-      }
-    }
-
-    if (errors > 0) {
-      String message = String.format(" %d errors in file of length %d",
-          errors, len);
-      log.warn(message);
-      // the range either side of the first error to print
-      // this is a purely arbitrary number, to aid user debugging
-      final int overlap = 10;
-      for (int i = Math.max(0, first_error_byte - overlap);
-           i < Math.min(first_error_byte + overlap, len);
-           i++) {
-        byte actual = received[i];
-        byte expected = original[i];
-        String letter = toChar(actual);
-        String line = String.format("[%04d] %2x %s\n", i, actual, letter);
-        if (expected != actual) {
-          line = String.format("[%04d] %2x %s -expected %2x %s\n",
-              i,
-              actual,
-              letter,
-              expected,
-              toChar(expected));
-        }
-        log.warn(line);
-      }
-      Assert.fail(message);
-    }
-  }
-  /**
-   * Convert a byte to a character for printing. If the
-   * byte value is < 32 -and hence unprintable- the byte is
-   * returned as a two digit hex value
-   * @param b byte
-   * @return the printable character string
-   */
-  public static String toChar(byte b) {
-    if (b >= 0x20) {
-      return Character.toString((char) b);
-    } else {
-      return String.format("%02x", b);
-    }
-  }
-  
-  /**
-   * Convert a buffer to a string, character by character
-   * @param buffer input bytes
-   * @return a string conversion
-   */
-  public static String toChar(byte[] buffer) {
-    StringBuilder builder = new StringBuilder(buffer.length);
-    for (byte b : buffer) {
-      builder.append(toChar(b));
-    }
-    return builder.toString();
-  }
-
-  public static byte[] toAsciiByteArray(String s) {
-    char[] chars = s.toCharArray();
-    int len = chars.length;
-    byte[] buffer = new byte[len];
-    for (int i = 0; i < len; i++) {
-      buffer[i] = (byte) (chars[i] & 0xff);
-    }
-    return buffer;
-  }
-
-  /**
-   * Create a dataset for use in the tests; all data is in the range
-   * base to (base+modulo-1) inclusive
-   * @param len length of data
-   * @param base base of the data
-   * @param modulo the modulo
-   * @return the newly generated dataset
-   */
-  public static byte[] dataset(int len, int base, int modulo) {
-    byte[] dataset = new byte[len];
-    for (int i = 0; i < len; i++) {
-      dataset[i] = (byte) (base + (i % modulo));
-    }
-    return dataset;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/resources/org/apache/slider/common/tools/test/metainfo.txt
----------------------------------------------------------------------
diff --git a/slider-core/src/test/resources/org/apache/slider/common/tools/test/metainfo.txt b/slider-core/src/test/resources/org/apache/slider/common/tools/test/metainfo.txt
deleted file mode 100644
index a1d7780..0000000
--- a/slider-core/src/test/resources/org/apache/slider/common/tools/test/metainfo.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/resources/org/apache/slider/common/tools/test/metainfo.xml
----------------------------------------------------------------------
diff --git a/slider-core/src/test/resources/org/apache/slider/common/tools/test/metainfo.xml b/slider-core/src/test/resources/org/apache/slider/common/tools/test/metainfo.xml
deleted file mode 100644
index cb8eab2..0000000
--- a/slider-core/src/test/resources/org/apache/slider/common/tools/test/metainfo.xml
+++ /dev/null
@@ -1,98 +0,0 @@
-<?xml version="1.0"?>
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
-
-<metainfo>
-  <schemaVersion>2.0</schemaVersion>
-  <application>
-    <name>STORM</name>
-    <comment>Apache Hadoop Stream processing framework</comment>
-    <version>0.9.1.2.1</version>
-    <components>
-
-      <component>
-        <name>NIMBUS</name>
-        <category>MASTER</category>
-        <commandScript>
-          <script>scripts/nimbus.py</script>
-          <scriptType>PYTHON</scriptType>
-          <timeout>600</timeout>
-        </commandScript>
-      </component>
-
-      <component>
-        <name>STORM_REST_API</name>
-        <category>MASTER</category>
-        <commandScript>
-          <script>scripts/rest_api.py</script>
-          <scriptType>PYTHON</scriptType>
-          <timeout>600</timeout>
-        </commandScript>
-      </component>
-
-      <component>
-        <name>SUPERVISOR</name>
-        <category>SLAVE</category>
-        <commandScript>
-          <script>scripts/supervisor.py</script>
-          <scriptType>PYTHON</scriptType>
-          <timeout>600</timeout>
-        </commandScript>
-      </component>
-
-      <component>
-        <name>STORM_UI_SERVER</name>
-        <category>MASTER</category>
-        <commandScript>
-          <script>scripts/ui_server.py</script>
-          <scriptType>PYTHON</scriptType>
-          <timeout>600</timeout>
-        </commandScript>
-      </component>
-
-      <component>
-        <name>DRPC_SERVER</name>
-        <category>MASTER</category>
-        <commandScript>
-          <script>scripts/drpc_server.py</script>
-          <scriptType>PYTHON</scriptType>
-          <timeout>600</timeout>
-        </commandScript>
-      </component>
-    </components>
-
-    <osSpecifics>
-      <osSpecific>
-        <osType>any</osType>
-        <packages>
-          <package>
-            <type>tarball</type>
-            <name>files/apache-storm-0.9.1.2.1.1.0-237.tar.gz</name>
-          </package>
-        </packages>
-      </osSpecific>
-    </osSpecifics>
-
-    <configFiles>
-      <configFile>
-        <type>xml</type>
-        <fileName>storm-site.xml</fileName>
-        <dictionaryName>storm-site</dictionaryName>
-      </configFile>
-    </configFiles>
-  </application>
-</metainfo>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/resources/org/apache/slider/common/tools/test/someOtherFile.txt
----------------------------------------------------------------------
diff --git a/slider-core/src/test/resources/org/apache/slider/common/tools/test/someOtherFile.txt b/slider-core/src/test/resources/org/apache/slider/common/tools/test/someOtherFile.txt
deleted file mode 100644
index a1d7780..0000000
--- a/slider-core/src/test/resources/org/apache/slider/common/tools/test/someOtherFile.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/resources/org/apache/slider/common/tools/test/someOtherFile.xml
----------------------------------------------------------------------
diff --git a/slider-core/src/test/resources/org/apache/slider/common/tools/test/someOtherFile.xml b/slider-core/src/test/resources/org/apache/slider/common/tools/test/someOtherFile.xml
deleted file mode 100644
index a1d7780..0000000
--- a/slider-core/src/test/resources/org/apache/slider/common/tools/test/someOtherFile.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/resources/org/apache/slider/providers/agent/application/metadata/metainfo.xml
----------------------------------------------------------------------
diff --git a/slider-core/src/test/resources/org/apache/slider/providers/agent/application/metadata/metainfo.xml b/slider-core/src/test/resources/org/apache/slider/providers/agent/application/metadata/metainfo.xml
deleted file mode 100644
index fbe9299..0000000
--- a/slider-core/src/test/resources/org/apache/slider/providers/agent/application/metadata/metainfo.xml
+++ /dev/null
@@ -1,180 +0,0 @@
-<?xml version="1.0"?>
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
-
-<metainfo>
-  <schemaVersion>2.0</schemaVersion>
-  <application>
-    <name>STORM</name>
-    <comment>Apache Hadoop Stream processing framework</comment>
-    <version>0.9.1.2.1</version>
-    <exportedConfigs>storm-site</exportedConfigs>
-
-    <exportGroups>
-      <exportGroup>
-        <name>QuickLinks</name>
-        <exports>
-          <export>
-            <name>app.jmx</name>
-            <value>http://${STORM_REST_API_HOST}:${site.global.rest_api_port}/api/cluster/summary</value>
-          </export>
-          <export>
-            <name>app.monitor</name>
-            <value>http://${STORM_UI_SERVER_HOST}:${site.storm-site.ui.port}</value>
-          </export>
-          <export>
-            <name>app.metrics</name>
-            <value>http://${site.global.ganglia_server_host}/cgi-bin/rrd.py?c=${site.global.ganglia_server_id}</value>
-          </export>
-          <export>
-            <name>ganglia.ui</name>
-            <value>http://${site.global.ganglia_server_host}/ganglia?c=${site.global.ganglia_server_id}</value>
-          </export>
-          <export>
-            <name>nimbus.url</name>
-            <value>http://${NIMBUS_HOST}:${site.storm-site.nimbus.thrift.port}</value>
-          </export>
-        </exports>
-      </exportGroup>
-    </exportGroups>
-
-    <commandOrders>
-      <commandOrder>
-        <command>NIMBUS-START</command>
-        <requires>SUPERVISOR-INSTALLED,STORM_UI_SERVER-INSTALLED,DRPC_SERVER-INSTALLED,STORM_REST_API-INSTALLED
-        </requires>
-      </commandOrder>
-      <commandOrder>
-        <command>SUPERVISOR-START</command>
-        <requires>NIMBUS-STARTED</requires>
-      </commandOrder>
-      <commandOrder>
-        <command>DRPC_SERVER-START</command>
-        <requires>NIMBUS-STARTED</requires>
-      </commandOrder>
-      <commandOrder>
-        <command>STORM_REST_API-START</command>
-        <requires>NIMBUS-STARTED,DRPC_SERVER-STARTED,STORM_UI_SERVER-STARTED</requires>
-      </commandOrder>
-      <commandOrder>
-        <command>STORM_UI_SERVER-START</command>
-        <requires>NIMBUS-STARTED</requires>
-      </commandOrder>
-    </commandOrders>
-
-    <components>
-
-      <component>
-        <name>NIMBUS</name>
-        <category>MASTER</category>
-        <autoStartOnFailure>true</autoStartOnFailure>
-        <appExports>QuickLinks-nimbus.url,QuickLinks-ganglia.ui,QuickLinks-app.metrics</appExports>
-        <commandScript>
-          <script>scripts/nimbus.py</script>
-          <scriptType>PYTHON</scriptType>
-          <timeout>600</timeout>
-        </commandScript>
-      </component>
-
-      <component>
-        <name>STORM_REST_API</name>
-        <category>MASTER</category>
-        <autoStartOnFailure>true</autoStartOnFailure>
-        <appExports>QuickLinks-app.jmx</appExports>
-        <commandScript>
-          <script>scripts/rest_api.py</script>
-          <scriptType>PYTHON</scriptType>
-          <timeout>600</timeout>
-        </commandScript>
-      </component>
-
-      <component>
-        <name>SUPERVISOR</name>
-        <category>SLAVE</category>
-        <autoStartOnFailure>true</autoStartOnFailure>
-        <componentExports>
-          <componentExport>
-            <name>log_viewer_port</name>
-            <value>${THIS_HOST}:${site.storm-site.logviewer.port}</value>
-          </componentExport>
-        </componentExports>
-        <commandScript>
-          <script>scripts/supervisor.py</script>
-          <scriptType>PYTHON</scriptType>
-          <timeout>600</timeout>
-        </commandScript>
-      </component>
-
-      <component>
-        <name>STORM_UI_SERVER</name>
-        <category>MASTER</category>
-        <publishConfig>true</publishConfig>
-        <appExports>QuickLinks-app.monitor</appExports>
-        <autoStartOnFailure>true</autoStartOnFailure>
-        <commandScript>
-          <script>scripts/ui_server.py</script>
-          <scriptType>PYTHON</scriptType>
-          <timeout>600</timeout>
-        </commandScript>
-      </component>
-
-      <component>
-        <name>DRPC_SERVER</name>
-        <category>MASTER</category>
-        <autoStartOnFailure>true</autoStartOnFailure>
-        <commandScript>
-          <script>scripts/drpc_server.py</script>
-          <scriptType>PYTHON</scriptType>
-          <timeout>600</timeout>
-        </commandScript>
-      </component>
-
-      <component>
-        <name>ANOTHER_COMPONENT</name>
-        <category>MASTER</category>
-        <commands>
-          <command>
-            <exec>start command</exec>
-          </command>
-          <command>
-            <exec>stop command</exec>
-            <name>STOP</name>
-          </command>
-        </commands>
-      </component>
-    </components>
-
-    <osSpecifics>
-      <osSpecific>
-        <osType>any</osType>
-        <packages>
-          <package>
-            <type>tarball</type>
-            <name>files/apache-storm-0.9.1.2.1.1.0-237.tar.gz</name>
-          </package>
-        </packages>
-      </osSpecific>
-    </osSpecifics>
-
-    <packages>
-      <package>
-        <type>tarball</type>
-        <name>test-tarball-name.tgz</name>
-      </package>
-    </packages>
-  </application>
-</metainfo>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-funtest/pom.xml
----------------------------------------------------------------------
diff --git a/slider-funtest/pom.xml b/slider-funtest/pom.xml
index 153f965..c1f15bf 100644
--- a/slider-funtest/pom.xml
+++ b/slider-funtest/pom.xml
@@ -25,7 +25,7 @@
   <parent>
     <groupId>org.apache.slider</groupId>
     <artifactId>slider</artifactId>
-    <version>0.92.0-incubating-SNAPSHOT</version>
+    <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
   </parent>
   <properties>
     <work.dir>package-tmp</work.dir>
@@ -205,6 +205,18 @@
 
     <dependency>
       <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-yarn-slider-core</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-yarn-slider-core</artifactId>
+      <type>test-jar</type>
+      <scope>compile</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-client</artifactId>
     </dependency>
 


[13/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/PathEntryResource.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/PathEntryResource.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/PathEntryResource.java
deleted file mode 100644
index efb09a8..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/PathEntryResource.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.registry;
-
-import org.apache.hadoop.registry.client.types.ServiceRecord;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.List;
-
-/**
- * Representation of a path entry
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class PathEntryResource {
-
-  /**
-   * Child nodes: as the short path to each element
-   */
-  public List<String> nodes;
-
-  /**
-   * Service record: if null \u2014there is no resolvable service
-   * record at this node.
-   */
-  public ServiceRecord service;
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/RegistryResource.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/RegistryResource.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/RegistryResource.java
deleted file mode 100644
index c824848..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/RegistryResource.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.registry;
-
-import com.google.inject.Singleton;
-import org.apache.hadoop.fs.PathNotFoundException;
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.hadoop.registry.client.exceptions.AuthenticationFailedException;
-import org.apache.hadoop.registry.client.exceptions.InvalidRecordException;
-import org.apache.hadoop.registry.client.exceptions.NoPathPermissionsException;
-import org.apache.hadoop.registry.client.exceptions.NoRecordException;
-import org.apache.hadoop.yarn.webapp.ForbiddenException;
-import org.apache.hadoop.yarn.webapp.NotFoundException;
-import org.apache.slider.server.appmaster.web.WebAppApi;
-import org.apache.slider.server.appmaster.web.rest.AbstractSliderResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
-import java.io.IOException;
-
-/**
- * This is the read-only view of the YARN registry.
- * 
- * Model:
- * <ol>
- *   <li>a tree of nodes</li>
- *   <li>Default view is of children + record</li>
- * </ol>
- * 
- */
-@Singleton
-public class RegistryResource extends AbstractSliderResource {
-  protected static final Logger log =
-      LoggerFactory.getLogger(RegistryResource.class);
-  public static final String SERVICE_PATH =
-      "/{path:.*}";
-
-  private final RegistryOperations registry;
-
-  /**
-   * Construct an instance bonded to a registry
-   * @param slider slider API
-   */
-  public RegistryResource(WebAppApi slider) {
-    super(slider);
-    this.registry = slider.getRegistryOperations();
-  }
-
-  
-  /**
-   * Internal init code, per request
-   * @param request incoming request 
-   * @param uriInfo URI details
-   */
-  private void init(HttpServletRequest request, UriInfo uriInfo) {
-    log.debug(uriInfo.getRequestUri().toString());
-  }
-
-  @GET
-  @Produces({MediaType.APPLICATION_JSON})
-  public PathEntryResource getRoot(@Context HttpServletRequest request,
-      @Context UriInfo uriInfo) {
-    return lookup("/", request, uriInfo);
-  }
-
-//   {path:.*}
-
-  @Path(SERVICE_PATH)
-  @GET
-  @Produces({MediaType.APPLICATION_JSON})
-  public PathEntryResource lookup(
-      @PathParam("path") String path,
-      @Context HttpServletRequest request,
-      @Context UriInfo uriInfo) {
-      init(request, uriInfo);
-      return resolvePath(path);
-  }
-
-  /**
-   * Do the actual processing of requests to responses; can be directly
-   * invoked for testing.
-   * @param path path to query
-   * @return the entry
-   * @throws WebApplicationException on any failure.
-   */
-  public PathEntryResource resolvePath(String path) throws
-      WebApplicationException {
-    try {
-      PathEntryResource pathEntry =
-          fromRegistry(path);
-      if (log.isDebugEnabled()) {
-        log.debug("Resolved:\n{}", pathEntry);
-      }
-      return pathEntry;
-   
-    } catch (Exception e) {
-      throw buildException(path, e);
-    }
-  }
-
-
-  /**
-   * Build from the registry, filling up the children and service records.
-   * If there is no service record at the end of the path, that entry is 
-   * null
-   * @param path path to query
-   * @return the built up record
-   * @throws IOException problems
-   *
-   */
-  private PathEntryResource fromRegistry(String path) throws IOException {
-    PathEntryResource entry = new PathEntryResource();
-    try {
-      entry.service = registry.resolve(path);
-    } catch (NoRecordException e) {
-      // ignoring
-      log.debug("No record at {}", path);
-    } catch (InvalidRecordException e) {
-      // swallowing this exception, the sign of "no entry present"
-      // "nothing parseable"
-        log.warn("Failed to resolve {}: {}", path, e, e);
-    }
-    entry.nodes = registry.list(path);
-    return entry;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/ClusterSpecificationBlock.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/ClusterSpecificationBlock.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/ClusterSpecificationBlock.java
deleted file mode 100644
index 2f02f27..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/ClusterSpecificationBlock.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.view;
-
-import com.google.inject.Inject;
-import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
-import org.apache.slider.server.appmaster.web.WebAppApi;
-
-/**
- * 
- */
-public class ClusterSpecificationBlock extends SliderHamletBlock {
-
-  @Inject
-  public ClusterSpecificationBlock(WebAppApi slider) {
-    super(slider);
-  }
-
-  @Override
-  protected void render(Block html) {
-    doRender(html);
-  }
-
-  // An extra method to make testing easier since you can't make an instance of Block
-  protected void doRender(Hamlet html) {
-    html.
-      div("cluster_json").
-        h2("JSON Cluster Specification").
-        pre().
-          _(getJson())._()._();
-  }
-
-  /**
-   * Get the JSON, catching any exceptions and returning error text instead
-   * @return
-   */
-  private String getJson() {
-    return appState.getClusterStatus().toString();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/ContainerStatsBlock.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/ContainerStatsBlock.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/ContainerStatsBlock.java
deleted file mode 100644
index 56285c2..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/ContainerStatsBlock.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.view;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-import com.google.inject.Inject;
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
-import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV;
-import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE;
-import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TBODY;
-import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TR;
-import org.apache.slider.api.ClusterDescription;
-import org.apache.slider.api.ClusterNode;
-import org.apache.slider.api.types.ComponentInformation;
-import org.apache.slider.server.appmaster.state.RoleInstance;
-import org.apache.slider.server.appmaster.web.WebAppApi;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * 
- */
-public class ContainerStatsBlock extends SliderHamletBlock {
-
-  private static final String EVEN = "even", ODD = "odd", BOLD = "bold", SCHEME = "http://", PATH = "/node/container/";
-
-  // Some functions that help transform the data into an object we can use to abstract presentation specifics
-  protected static final Function<Entry<String,Integer>,Entry<TableContent,Integer>> stringIntPairFunc = toTableContentFunction();
-  protected static final Function<Entry<String,Long>,Entry<TableContent,Long>> stringLongPairFunc = toTableContentFunction();
-  protected static final Function<Entry<String,String>,Entry<TableContent,String>> stringStringPairFunc = toTableContentFunction();
-
-  @Inject
-  public ContainerStatsBlock(WebAppApi slider) {
-    super(slider);
-  }
-
-  /**
-   * Sort a collection of ClusterNodes by name
-   */
-  protected static class ClusterNodeNameComparator implements Comparator<ClusterNode>,
-      Serializable {
-
-    @Override
-    public int compare(ClusterNode node1, ClusterNode node2) {
-      if (null == node1 && null != node2) {
-        return -1;
-      } else if (null != node1 && null == node2) {
-        return 1;
-      } else if (null == node1) {
-        return 0;
-      }
-
-      final String name1 = node1.name, name2 = node2.name;
-      if (null == name1 && null != name2) {
-        return -1;
-      } else if (null != name1 && null == name2) {
-        return 1;
-      } else if (null == name1) {
-        return 0;
-      }
-
-      return name1.compareTo(name2);
-    }
-
-  }
-
-  @Override
-  protected void render(Block html) {
-    final Map<String,RoleInstance> containerInstances = getContainerInstances(
-        appState.cloneOwnedContainerList());
-
-    Map<String, Map<String, ClusterNode>> clusterNodeMap =
-        appState.getRoleClusterNodeMapping();
-    Map<String, ComponentInformation> componentInfoMap = appState.getComponentInfoSnapshot();
-
-    for (Entry<String, Map<String, ClusterNode>> entry : clusterNodeMap.entrySet()) {
-      final String name = entry.getKey();
-      Map<String, ClusterNode> clusterNodesInRole = entry.getValue();
-      //final RoleStatus roleStatus = entry.getValue();
-
-      DIV<Hamlet> div = html.div("role-info ui-widget-content ui-corner-all");
-
-      List<ClusterNode> nodesInRole =
-          new ArrayList<>(clusterNodesInRole.values());
-
-      div.h2(BOLD, StringUtils.capitalize(name));
-
-      // Generate the details on this role
-      ComponentInformation componentInfo = componentInfoMap.get(name);
-      if (componentInfo != null) {
-        Iterable<Entry<String,Integer>> stats = componentInfo.buildStatistics().entrySet();
-        generateRoleDetails(div,"role-stats-wrap", "Specifications", 
-            Iterables.transform(stats, stringIntPairFunc));
-      }
-
-      // Sort the ClusterNodes by their name (containerid)
-      Collections.sort(nodesInRole, new ClusterNodeNameComparator());
-
-      // Generate the containers running this role
-      generateRoleDetails(div, "role-stats-containers", "Containers",
-          Iterables.transform(nodesInRole, new Function<ClusterNode,Entry<TableContent,String>>() {
-
-            @Override
-            public Entry<TableContent,String> apply(ClusterNode input) {
-              final String containerId = input.name;
-              
-              if (containerInstances.containsKey(containerId)) {
-                RoleInstance roleInst = containerInstances.get(containerId);
-                if (roleInst.container.getNodeHttpAddress() != null) {
-                  return Maps.<TableContent,String> immutableEntry(
-                    new TableAnchorContent(containerId,
-                        buildNodeUrlForContainer(roleInst.container.getNodeHttpAddress(), containerId)), null);
-                }
-              }
-              return Maps.immutableEntry(new TableContent(input.name), null);
-            }
-
-          }));
-
-      ClusterDescription desc = appState.getClusterStatus();
-      Map<String, String> options = desc.getRole(name);
-      Iterable<Entry<TableContent, String>> tableContent;
-      
-      // Generate the pairs of data in the expected form
-      if (null != options) {
-        tableContent = Iterables.transform(options.entrySet(), stringStringPairFunc);
-      } else {
-        // Or catch that we have no options and provide "empty"
-        tableContent = Collections.emptySet();
-      }
-      
-      // Generate the options used by this role
-      generateRoleDetails(div, "role-options-wrap", "Role Options", tableContent);
-
-      // Close the div for this role
-      div._();
-    }
-  }
-
-  protected static <T> Function<Entry<String,T>,Entry<TableContent,T>> toTableContentFunction() {
-    return new Function<Entry<String,T>,Entry<TableContent,T>>() {
-      @Override
-      public Entry<TableContent,T> apply(Entry<String,T> input) {
-        return Maps.immutableEntry(new TableContent(input.getKey()), input.getValue());
-      }
-    };
-  }
-
-  protected Map<String,RoleInstance> getContainerInstances(List<RoleInstance> roleInstances) {
-    Map<String,RoleInstance> map = Maps.newHashMapWithExpectedSize(roleInstances.size());
-    for (RoleInstance roleInstance : roleInstances) {
-      // UUID is the containerId
-      map.put(roleInstance.id, roleInstance);
-    }
-    return map;
-  }
-
-  /**
-   * Given a div, a name for this data, and some pairs of data, generate a nice HTML table. If contents is empty (of size zero), then a mesage will be printed
-   * that there were no items instead of an empty table.
-   *
-   */
-  protected <T1 extends TableContent,T2> void generateRoleDetails(DIV<Hamlet> parent, String divSelector, String detailsName, Iterable<Entry<T1,T2>> contents) {
-    final DIV<DIV<Hamlet>> div = parent.div(divSelector).h3(BOLD, detailsName);
-
-    int offset = 0;
-    TABLE<DIV<DIV<Hamlet>>> table = null;
-    TBODY<TABLE<DIV<DIV<Hamlet>>>> tbody = null;
-    for (Entry<T1,T2> content : contents) {
-      if (null == table) {
-        table = div.table("ui-widget-content ui-corner-bottom");
-        tbody = table.tbody();
-      }
-      
-      TR<TBODY<TABLE<DIV<DIV<Hamlet>>>>> row = tbody.tr(offset % 2 == 0 ? EVEN : ODD);
-      
-      // Defer to the implementation of the TableContent for what the cell should contain
-      content.getKey().printCell(row);
-
-      // Only add the second column if the element is non-null
-      // This also lets us avoid making a second method if we're only making a one-column table
-      if (null != content.getValue()) {
-        row.td(content.getValue().toString());
-      }
-
-      row._();
-
-      offset++;
-    }
-
-    // If we made a table, close it out
-    if (null != table) {
-      tbody._()._();
-    } else {
-      // Otherwise, throw in a nice "no content" message
-      div.p("no-table-contents")._("None")._();
-    }
-    
-    // Close out the initial div
-    div._();
-  }
-
-  /**
-   * Build a URL from the address:port and container ID directly to the NodeManager service
-   * @param nodeAddress
-   * @param containerId
-   * @return
-   */
-  protected String buildNodeUrlForContainer(String nodeAddress, String containerId) {
-    StringBuilder sb = new StringBuilder(SCHEME.length() + nodeAddress.length() + PATH.length() + containerId.length());
-
-    sb.append(SCHEME).append(nodeAddress).append(PATH).append(containerId);
-
-    return sb.toString();
-  }
-
-  /**
-   * Creates a table cell with the provided String as content.
-   */
-  protected static class TableContent {
-    private String cell;
-
-    public TableContent(String cell) {
-      this.cell = cell;
-    }
-
-    public String getCell() {
-      return cell;
-    }
-
-    /**
-     * Adds a td to the given tr. The tr is not closed 
-     * @param tableRow
-     */
-    public void printCell(TR<?> tableRow) {
-      tableRow.td(this.cell);
-    }
-  }
-
-  /**
-   * Creates a table cell with an anchor to the given URL with the provided String as content.
-   */
-  protected static class TableAnchorContent extends TableContent {
-    private String anchorUrl;
-
-    public TableAnchorContent(String cell, String anchorUrl) {
-      super(cell);
-      this.anchorUrl = anchorUrl;
-    }
-
-    /* (non-javadoc)
-     * @see org.apache.slider.server.appmaster.web.view.ContainerStatsBlock$TableContent#printCell()
-     */
-    @Override
-    public void printCell(TR<?> tableRow) {
-      tableRow.td().a(anchorUrl, getCell())._();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/IndexBlock.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/IndexBlock.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/IndexBlock.java
deleted file mode 100644
index c3b9b6f..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/IndexBlock.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.view;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.inject.Inject;
-import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
-import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV;
-import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.LI;
-import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.UL;
-import org.apache.slider.api.ClusterDescription;
-import org.apache.slider.api.StatusKeys;
-import org.apache.slider.api.types.ApplicationLivenessInformation;
-import org.apache.slider.api.types.RoleStatistics;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.registry.docstore.ExportEntry;
-import org.apache.slider.core.registry.docstore.PublishedExports;
-import org.apache.slider.core.registry.docstore.PublishedExportsSet;
-import org.apache.slider.providers.MonitorDetail;
-import org.apache.slider.providers.ProviderService;
-import org.apache.slider.server.appmaster.state.RoleStatus;
-import org.apache.slider.server.appmaster.web.WebAppApi;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_COMPONENTS;
-
-/**
- * The main content on the Slider AM web page
- */
-public class IndexBlock extends SliderHamletBlock {
-  private static final Logger log = LoggerFactory.getLogger(IndexBlock.class);
-
-  /**
-   * Message printed when application is at full size.
-   *
-   * {@value}
-   */
-  public static final String ALL_CONTAINERS_ALLOCATED = "all containers allocated";
-
-  @Inject
-  public IndexBlock(WebAppApi slider) {
-    super(slider);
-  }
-
-  @Override
-  protected void render(Block html) {
-    doIndex(html, getProviderName());
-  }
-
-  // An extra method to make testing easier since you can't make an instance of Block
-  @VisibleForTesting
-  protected void doIndex(Hamlet html, String providerName) {
-    ClusterDescription clusterStatus = appState.getClusterStatus();
-    String name = clusterStatus.name;
-    if (name != null && (name.startsWith(" ") || name.endsWith(" "))) {
-      name = "'" + name + "'";
-    } 
-    DIV<Hamlet> div = html.div("general_info")
-                          .h1("index_header",
-                              "Application: " + name);
-
-    ApplicationLivenessInformation liveness =
-        appState.getApplicationLivenessInformation();
-    String livestatus = liveness.allRequestsSatisfied
-        ? ALL_CONTAINERS_ALLOCATED
-        : String.format("Awaiting %d containers", liveness.requestsOutstanding);
-    Hamlet.TABLE<DIV<Hamlet>> table1 = div.table();
-    table1.tr()
-          .td("Status")
-          .td(livestatus)
-          ._();
-    table1.tr()
-          .td("Total number of containers")
-          .td(Integer.toString(appState.getNumOwnedContainers()))
-          ._();
-    table1.tr()
-          .td("Create time: ")
-          .td(getInfoAvoidingNulls(StatusKeys.INFO_CREATE_TIME_HUMAN))
-          ._();
-    table1.tr()
-          .td("Running since: ")
-          .td(getInfoAvoidingNulls(StatusKeys.INFO_LIVE_TIME_HUMAN))
-          ._();
-    table1.tr()
-          .td("Time last flexed: ")
-          .td(getInfoAvoidingNulls(StatusKeys.INFO_FLEX_TIME_HUMAN))
-          ._();
-    table1.tr()
-          .td("Application storage path: ")
-          .td(clusterStatus.dataPath)
-          ._();
-    table1.tr()
-          .td("Application configuration path: ")
-          .td(clusterStatus.originConfigurationPath)
-          ._();
-    table1._();
-    div._();
-    div = null;
-
-    DIV<Hamlet> containers = html.div("container_instances")
-      .h3("Component Instances");
-
-    int aaRoleWithNoSuitableLocations = 0;
-    int aaRoleWithOpenRequest = 0;
-    int roleWithOpenRequest = 0;
-
-    Hamlet.TABLE<DIV<Hamlet>> table = containers.table();
-    Hamlet.TR<Hamlet.THEAD<Hamlet.TABLE<DIV<Hamlet>>>> header = table.thead().tr();
-    trb(header, "Component");
-    trb(header, "Desired");
-    trb(header, "Actual");
-    trb(header, "Outstanding Requests");
-    trb(header, "Failed");
-    trb(header, "Failed to start");
-    trb(header, "Placement");
-    header._()._();  // tr & thead
-
-    List<RoleStatus> roleStatuses = appState.cloneRoleStatusList();
-    Collections.sort(roleStatuses, new RoleStatus.CompareByName());
-    for (RoleStatus status : roleStatuses) {
-      String roleName = status.getName();
-      String nameUrl = apiPath(LIVE_COMPONENTS) + "/" + roleName;
-      String aatext;
-      if (status.isAntiAffinePlacement()) {
-        boolean aaRequestOutstanding = status.isAARequestOutstanding();
-        int pending = (int)status.getPendingAntiAffineRequests();
-        aatext = buildAADetails(aaRequestOutstanding, pending);
-        if (SliderUtils.isSet(status.getLabelExpression())) {
-          aatext += " (label: " + status.getLabelExpression() + ")";
-        }
-        if (pending > 0 && !aaRequestOutstanding) {
-          aaRoleWithNoSuitableLocations ++;
-        } else if (aaRequestOutstanding) {
-          aaRoleWithOpenRequest++;
-        }
-      } else {
-        if (SliderUtils.isSet(status.getLabelExpression())) {
-          aatext = "label: " + status.getLabelExpression();
-        } else {
-          aatext = "";
-        }
-        if (status.getRequested() > 0) {
-          roleWithOpenRequest ++;
-        }
-      }
-      table.tr()
-        .td().a(nameUrl, roleName)._()
-        .td(String.format("%d", status.getDesired()))
-        .td(String.format("%d", status.getActual()))
-        .td(String.format("%d", status.getRequested()))
-        .td(String.format("%d", status.getFailed()))
-        .td(String.format("%d", status.getStartFailed()))
-        .td(aatext)
-        ._();
-    }
-
-    // empty row for some more spacing
-    table.tr()._();
-    // close table
-    table._();
-
-    containers._();
-    containers = null;
-
-    // some spacing
-    html.div()._();
-    html.div()._();
-
-    DIV<Hamlet> diagnostics = html.div("diagnostics");
-
-    List<String> statusEntries = new ArrayList<>(0);
-    if (roleWithOpenRequest > 0) {
-      statusEntries.add(String.format("%d %s with requests unsatisfiable by cluster",
-          roleWithOpenRequest, plural(roleWithOpenRequest, "component")));
-    }
-    if (aaRoleWithNoSuitableLocations > 0) {
-      statusEntries.add(String.format("%d anti-affinity %s no suitable nodes in the cluster",
-        aaRoleWithNoSuitableLocations,
-        plural(aaRoleWithNoSuitableLocations, "component has", "components have")));
-    }
-    if (aaRoleWithOpenRequest > 0) {
-      statusEntries.add(String.format("%d anti-affinity %s with requests unsatisfiable by cluster",
-        aaRoleWithOpenRequest,
-        plural(aaRoleWithOpenRequest, "component has", "components have")));
-
-    }
-    if (!statusEntries.isEmpty()) {
-      diagnostics.h3("Diagnostics");
-      Hamlet.TABLE<DIV<Hamlet>> diagnosticsTable = diagnostics.table();
-      for (String entry : statusEntries) {
-        diagnosticsTable.tr().td(entry)._();
-      }
-      diagnosticsTable._();
-    }
-    diagnostics._();
-
-    DIV<Hamlet> provider_info = html.div("provider_info");
-    provider_info.h3(providerName + " information");
-    UL<Hamlet> ul = html.ul();
-    addProviderServiceOptions(providerService, ul, clusterStatus);
-    ul._();
-    provider_info._();
-
-    DIV<Hamlet> exports = html.div("exports");
-    exports.h3("Exports");
-    ul = html.ul();
-    enumeratePublishedExports(appState.getPublishedExportsSet(), ul);
-    ul._();
-    exports._();
-  }
-
-  @VisibleForTesting
-  String buildAADetails(boolean outstanding, int pending) {
-    return String.format("Anti-affinity:%s %d pending %s",
-      (outstanding ? " 1 active request and" : ""),
-      pending, plural(pending, "request"));
-  }
-
-  private String plural(int n, String singular) {
-    return plural(n, singular, singular + "s");
-  }
-  private String plural(int n, String singular, String plural) {
-    return n == 1 ? singular : plural;
-  }
-
-  private void trb(Hamlet.TR tr,
-      String text) {
-    tr.td().b(text)._();
-  }
-
-  private String getProviderName() {
-    return providerService.getHumanName();
-  }
-
-  private String getInfoAvoidingNulls(String key) {
-    String createTime = appState.getClusterStatus().getInfo(key);
-
-    return null == createTime ? "N/A" : createTime;
-  }
-
-  protected void addProviderServiceOptions(ProviderService provider,
-      UL ul, ClusterDescription clusterStatus) {
-    Map<String, MonitorDetail> details = provider.buildMonitorDetails(
-        clusterStatus);
-    if (null == details) {
-      return;
-    }
-    // Loop over each entry, placing the text in the UL, adding an anchor when the URL is non-null/empty
-    for (Entry<String, MonitorDetail> entry : details.entrySet()) {
-      MonitorDetail detail = entry.getValue();
-      if (SliderUtils.isSet(detail.getValue()) ) {
-        LI item = ul.li();
-        item.span().$class("bold")._(entry.getKey())._();
-        item._(" - ");
-        if (detail.isUrl()) {
-          // Render an anchor if the value is a URL
-          item.a(detail.getValue(), detail.getValue())._();
-        } else {
-          item._(detail.getValue())._();
-        }
-      } else {
-        ul.li(entry.getKey());
-      }
-    }
-  }
-
-  protected void enumeratePublishedExports(PublishedExportsSet exports, UL<Hamlet> ul) {
-    for(String key : exports.keys()) {
-      PublishedExports export = exports.get(key);
-      LI<UL<Hamlet>> item = ul.li();
-      item.span().$class("bold")._(export.description)._();
-      UL sublist = item.ul();
-      for (Entry<String, List<ExportEntry>> entry : export.entries.entrySet()) {
-        LI sublistItem = sublist.li()._(entry.getKey());
-        for (ExportEntry exportEntry : entry.getValue()) {
-          sublistItem._(exportEntry.getValue());
-        }
-        sublistItem._();
-      }
-      sublist._();
-      item._();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/NavBlock.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/NavBlock.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/NavBlock.java
deleted file mode 100644
index 069d386..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/NavBlock.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.view;
-
-import com.google.inject.Inject;
-import org.apache.slider.server.appmaster.web.WebAppApi;
-
-import static org.apache.slider.server.appmaster.web.SliderAMWebApp.*;
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.*;
-
-/**
- * 
- */
-public class NavBlock extends SliderHamletBlock {
-
-  @Inject
-  public NavBlock(WebAppApi slider) {
-    super(slider);
-  }
-
-  @Override
-  protected void render(Block html) {
-    html.
-      div("#nav").
-        h3("Slider").
-        ul().
-          li().a(this.prefix(), "Overview")._().
-          li().a(relPath(CONTAINER_STATS), "Statistics")._().
-          li().a(relPath(CLUSTER_SPEC), "Specification")._().
-          li().a(rootPath(SYSTEM_METRICS_JSON), "Metrics")._().
-          li().a(rootPath(SYSTEM_HEALTHCHECK), "Health")._().
-          li().a(rootPath(SYSTEM_THREADS), "Threads")._().
-        _()
-    .h3("REST API"). 
-        ul().
-          li().a(apiPath(MODEL_DESIRED), "Specified")._().
-          li().a(apiPath(MODEL_RESOLVED), "Resolved")._().
-          li().a(apiPath(LIVE_RESOURCES), "Resources")._().
-          li().a(apiPath(LIVE_COMPONENTS), "Components")._().
-          li().a(apiPath(LIVE_CONTAINERS), "Containers")._().
-          li().a(apiPath(LIVE_NODES), "Nodes")._().
-          li().a(apiPath(LIVE_STATISTICS), "Statistics")._().
-          li().a(apiPath(LIVE_LIVENESS), "Liveness")._()
-        ._()
-      ._();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/SliderHamletBlock.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/SliderHamletBlock.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/SliderHamletBlock.java
deleted file mode 100644
index 82d7c8f..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/SliderHamletBlock.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.view;
-
-import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
-import org.apache.slider.providers.ProviderService;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-import org.apache.slider.server.appmaster.web.WebAppApi;
-import org.apache.slider.server.appmaster.web.rest.RestPaths;
-
-import static org.apache.hadoop.yarn.util.StringHelper.ujoin;
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.SLIDER_PATH_APPLICATION;
-
-/**
- * Anything we want to share across slider hamlet blocks
- */
-public abstract class SliderHamletBlock extends HtmlBlock  {
-
-  protected final StateAccessForProviders appState;
-  protected final ProviderService providerService;
-  protected final RestPaths restPaths = new RestPaths();
-  
-  public SliderHamletBlock(WebAppApi slider) {
-    this.appState = slider.getAppState();
-    this.providerService = slider.getProviderService();
-  }
-
-  protected String rootPath(String absolutePath) {
-    return root_url(absolutePath);
-  }
-
-  protected String relPath(String... args) {
-    return ujoin(this.prefix(), args);
-  }
-
-  protected String apiPath(String api) {
-    return root_url(SLIDER_PATH_APPLICATION,  api);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/avro/LoadedRoleHistory.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/avro/LoadedRoleHistory.java b/slider-core/src/main/java/org/apache/slider/server/avro/LoadedRoleHistory.java
deleted file mode 100644
index 77408a5..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/avro/LoadedRoleHistory.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.avro;
-
-import org.apache.hadoop.fs.Path;
-import org.apache.slider.common.tools.SliderUtils;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * The role history
- */
-public class LoadedRoleHistory {
-
-  private RoleHistoryHeader header;
-
-  private Path path;
-
-  public final Map<String, Integer> roleMap = new HashMap<>();
-
-  public final List<NodeEntryRecord> records = new ArrayList<>();
-
-  /**
-   * Add a record
-   * @param record
-   */
-  public void add(NodeEntryRecord record) {
-    records.add(record);
-  }
-
-  /**
-   * Number of loaded records
-   * @return
-   */
-  public int size() {
-    return records.size();
-  }
-
-  public RoleHistoryHeader getHeader() {
-    return header;
-  }
-
-  public void setHeader(RoleHistoryHeader header) {
-    this.header = header;
-  }
-
-  public Path getPath() {
-    return path;
-  }
-
-  public void setPath(Path path) {
-    this.path = path;
-  }
-
-  public void buildMapping(Map<CharSequence, Integer> source) {
-    roleMap.clear();
-    for (Map.Entry<CharSequence, Integer> entry : source.entrySet()) {
-      roleMap.put(SliderUtils.sequenceToString(entry.getKey()),
-          entry.getValue());
-    }
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb = new StringBuilder(
-      "LoadedRoleHistory{");
-    sb.append("path=").append(path);
-    sb.append("; number of roles=").append(roleMap.size());
-    sb.append("; size=").append(size());
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/avro/NewerFilesFirst.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/avro/NewerFilesFirst.java b/slider-core/src/main/java/org/apache/slider/server/avro/NewerFilesFirst.java
deleted file mode 100644
index 2e049cb..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/avro/NewerFilesFirst.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.avro;
-
-import org.apache.hadoop.fs.Path;
-
-import java.io.Serializable;
-import java.util.Comparator;
-
-/**
- * Compare two filenames by name; the more recent one comes first
- */
-public class NewerFilesFirst implements Comparator<Path>, Serializable {
-
-  /**
-   * Takes the ordering of path names from the normal string comparison
-   * and negates it, so that names that come after other names in 
-   * the string sort come before here
-   * @param o1 leftmost 
-   * @param o2 rightmost
-   * @return positive if o1 &gt; o2 
-   */
-  @Override
-  public int compare(Path o1, Path o2) {
-    return (o2.getName().compareTo(o1.getName()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/avro/OlderFilesFirst.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/avro/OlderFilesFirst.java b/slider-core/src/main/java/org/apache/slider/server/avro/OlderFilesFirst.java
deleted file mode 100644
index 407aaa6..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/avro/OlderFilesFirst.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.avro;
-
-import org.apache.hadoop.fs.Path;
-
-import java.io.Serializable;
-import java.util.Comparator;
-
-/**
- * Compare two filenames by name; the older ones comes first
- */
-public class OlderFilesFirst implements Comparator<Path>, Serializable {
-
-  /**
-   * Takes the ordering of path names from the normal string comparison
-   * and negates it, so that names that come after other names in 
-   * the string sort come before here
-   * @param o1 leftmost 
-   * @param o2 rightmost
-   * @return positive if o1 &gt; o2 
-   */
-  @Override
-  public int compare(Path o1, Path o2) {
-    return (o1.getName().compareTo(o2.getName()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/avro/RoleHistoryWriter.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/avro/RoleHistoryWriter.java b/slider-core/src/main/java/org/apache/slider/server/avro/RoleHistoryWriter.java
deleted file mode 100644
index 49d8fb2..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/avro/RoleHistoryWriter.java
+++ /dev/null
@@ -1,449 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.avro;
-
-import com.google.common.annotations.VisibleForTesting;
-import org.apache.avro.AvroTypeException;
-import org.apache.avro.Schema;
-import org.apache.avro.io.DatumReader;
-import org.apache.avro.io.DatumWriter;
-import org.apache.avro.io.Decoder;
-import org.apache.avro.io.DecoderFactory;
-import org.apache.avro.io.Encoder;
-import org.apache.avro.io.EncoderFactory;
-import org.apache.avro.specific.SpecificDatumReader;
-import org.apache.avro.specific.SpecificDatumWriter;
-import org.apache.hadoop.fs.FSDataInputStream;
-import org.apache.hadoop.fs.FSDataOutputStream;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.GlobFilter;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.PathFilter;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.server.appmaster.state.NodeEntry;
-import org.apache.slider.server.appmaster.state.NodeInstance;
-import org.apache.slider.server.appmaster.state.RoleHistory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.EOFException;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * Write out the role history to an output stream.
- */
-public class RoleHistoryWriter {
-  protected static final Logger log =
-    LoggerFactory.getLogger(RoleHistoryWriter.class);
-
-  /**
-   * Although Avro is designed to handle some changes, we still keep a version
-   * marker in the file to catch changes that are fundamentally incompatible
-   * at the semantic level -changes that require either a different
-   * parser or get rejected outright.
-   */
-  public static final int ROLE_HISTORY_VERSION = 0x01;
-  
-  /**
-   * Write out the history.
-   * This does not update the history's dirty/savetime fields
-   *
-   * @param out outstream
-   * @param history history
-   * @param savetime time in millis for the save time to go in as a record
-   * @return no of records written
-   * @throws IOException IO failures
-   */
-  public long write(OutputStream out, RoleHistory history, long savetime)
-    throws IOException {
-    try {
-      DatumWriter<RoleHistoryRecord> writer =
-        new SpecificDatumWriter<>(RoleHistoryRecord.class);
-
-      RoleHistoryRecord record = createHeaderRecord(savetime, history);
-      int roles = history.getRoleSize();
-      Schema schema = record.getSchema();
-      Encoder encoder = EncoderFactory.get().jsonEncoder(schema, out);
-      writer.write(record, encoder);
-      // now write the rolemap record
-      writer.write(createRolemapRecord(history), encoder);
-      long count = 0;
-      //now for every role history entry, write out its record
-      Collection<NodeInstance> instances = history.cloneNodemap().values();
-      for (NodeInstance instance : instances) {
-        for (int role = 0; role < roles; role++) {
-          NodeEntry nodeEntry = instance.get(role);
-
-          if (nodeEntry != null) {
-            NodeEntryRecord ner = build(nodeEntry, role, instance.hostname);
-            record = new RoleHistoryRecord(ner);
-            writer.write(record, encoder);
-            count++;
-          }
-        }
-      }
-      // footer
-      RoleHistoryFooter footer = new RoleHistoryFooter();
-      footer.setCount(count);
-      writer.write(new RoleHistoryRecord(footer), encoder);
-      encoder.flush();
-      return count;
-    } finally {
-      out.close();
-    }
-  }
-
-  /**
-   * Create the header record
-   * @param savetime time of save
-   * @param history history
-   * @return a record to place at the head of the file
-   */
-  private RoleHistoryRecord createHeaderRecord(long savetime, RoleHistory history) {
-    RoleHistoryHeader header = new RoleHistoryHeader();
-    header.setVersion(ROLE_HISTORY_VERSION);
-    header.setSaved(savetime);
-    header.setSavedx(Long.toHexString(savetime));
-    header.setSavedate(SliderUtils.toGMTString(savetime));
-    header.setRoles(history.getRoleSize());
-    return new RoleHistoryRecord(header);
-  }
-
-  /**
-   * Create the rolemap record
-   * @param history history
-   * @return a record to insert into the file
-   */
-  private RoleHistoryRecord createRolemapRecord(RoleHistory history) {
-    RoleHistoryMapping entry = new RoleHistoryMapping();
-    Map<CharSequence, Integer> mapping = history.buildMappingForHistoryFile();
-    entry.setRolemap(mapping);
-    return new RoleHistoryRecord(entry);
-  }
-
-  /**
-   * Write the history information to a file
-   *
-   * @param fs filesystem
-   * @param path path
-   * @param overwrite overwrite flag
-   * @param history history
-   * @param savetime time in millis for the save time to go in as a record
-   * @return no of records written
-   * @throws IOException IO failures
-   */
-  public long write(FileSystem fs,
-      Path path,
-      boolean overwrite,
-      RoleHistory history,
-      long savetime)
-      throws IOException {
-    FSDataOutputStream out = fs.create(path, overwrite);
-    return write(out, history, savetime);
-  }
-
-
-  /**
-   * Create the filename for a history file
-   * @param time time value
-   * @return a filename such that later filenames sort later in the directory
-   */
-  public Path createHistoryFilename(Path historyPath, long time) {
-    String filename = String.format(Locale.ENGLISH,
-                                    SliderKeys.HISTORY_FILENAME_CREATION_PATTERN,
-                                    time);
-    Path path = new Path(historyPath, filename);
-    return path;
-  }
-
-  /**
-   * Build a {@link NodeEntryRecord} from a node entry; include whether
-   * the node is in use and when it was last used.
-   * @param entry entry count
-   * @param role role index
-   * @param hostname name
-   * @return the record
-   */
-  private NodeEntryRecord build(NodeEntry entry, int role, String hostname) {
-    NodeEntryRecord record = new NodeEntryRecord(
-      hostname, role, entry.getLive() > 0, entry.getLastUsed()
-    );
-    return record;
-  }
-
-  /**
-   * Read a history, returning one that is ready to have its onThaw() 
-   * method called
-   * @param in input source
-   * @return no. of entries read
-   * @throws IOException problems
-   */
-  public LoadedRoleHistory read(InputStream in) throws
-                                                       IOException,
-                                                       BadConfigException {
-    try {
-      LoadedRoleHistory loadedRoleHistory = new LoadedRoleHistory();
-      DatumReader<RoleHistoryRecord> reader =
-        new SpecificDatumReader<>(RoleHistoryRecord.class);
-      Decoder decoder =
-        DecoderFactory.get().jsonDecoder(RoleHistoryRecord.getClassSchema(),
-            in);
-
-      //read header : no entry -> EOF
-      RoleHistoryRecord record = reader.read(null, decoder);
-      if (record == null) {
-        throw new IOException("Role History Header not found at start of file.");
-      }
-      Object entry = record.getEntry();
-      if (!(entry instanceof RoleHistoryHeader)) {
-        throw new IOException("Role History Header not found at start of file");
-      }
-      RoleHistoryHeader header = (RoleHistoryHeader) entry;
-      if (header.getVersion() != ROLE_HISTORY_VERSION) {
-        throw new IOException(
-          String.format("Can't read role file version %04x -need %04x",
-          header.getVersion(),
-          ROLE_HISTORY_VERSION));
-      }
-      loadedRoleHistory.setHeader(header);
-      RoleHistoryFooter footer = null;
-      int records = 0;
-      //go through reading data
-      try {
-        while (footer == null) {
-          record = reader.read(null, decoder);
-          if (record == null) {
-            throw new IOException("Null record after " + records + " records");
-          }
-          entry = record.getEntry();
-
-          if (entry instanceof RoleHistoryHeader) {
-            throw new IOException("Duplicate Role History Header found");
-          } else if (entry instanceof RoleHistoryMapping) {
-            // role history mapping entry
-            if (!loadedRoleHistory.roleMap.isEmpty()) {
-              // duplicate role maps are viewed as something to warn over, rather than fail
-              log.warn("Duplicate role map; ignoring");
-            } else {
-              RoleHistoryMapping historyMapping = (RoleHistoryMapping) entry;
-              loadedRoleHistory.buildMapping(historyMapping.getRolemap());
-            }
-          } else if (entry instanceof NodeEntryRecord) {
-            // normal record
-            records++;
-            NodeEntryRecord nodeEntryRecord = (NodeEntryRecord) entry;
-            loadedRoleHistory.add(nodeEntryRecord);
-          } else if (entry instanceof RoleHistoryFooter) {
-            //tail end of the file
-            footer = (RoleHistoryFooter) entry;
-          } else {
-            // this is to handle future versions, such as when rolling back
-            // from a later version of slider
-            log.warn("Discarding unknown record {}", entry);
-          }
-        }
-      } catch (EOFException e) {
-        EOFException ex = new EOFException(
-          "End of file reached after " + records + " records");
-        ex.initCause(e);
-        throw ex;
-      }
-      // at this point there should be no data left.
-      // check by reading and expecting a -1
-      if (in.read() > 0) {
-        // footer is in stream before the last record
-        throw new EOFException(
-          "File footer reached before end of file -after " + records +
-          " records");
-      }
-      if (records != footer.getCount()) {
-        log.warn("mismatch between no of records saved {} and number read {}",
-                 footer.getCount(), records);
-      }
-      return loadedRoleHistory;
-    } finally {
-      in.close();
-    }
-
-  }
-
-  /**
-   * Read a role history from a path in a filesystem
-   * @param fs filesystem
-   * @param path path to the file
-   * @return the records read
-   * @throws IOException any problem
-   */
-  public LoadedRoleHistory read(FileSystem fs, Path path)
-      throws IOException, BadConfigException {
-    FSDataInputStream instream = fs.open(path);
-    return read(instream);
-  }
-
-  /**
-   * Read from a resource in the classpath -used for testing
-   * @param resource resource
-   * @return the records read
-   * @throws IOException any problem
-   */
-  public LoadedRoleHistory read(String resource)
-      throws IOException, BadConfigException {
-
-    return read(this.getClass().getClassLoader().getResourceAsStream(resource));
-  }
-
-
-  /**
-   * Find all history entries in a dir. The dir is created if it is
-   * not already defined.
-   * 
-   * The scan uses the match pattern {@link SliderKeys#HISTORY_FILENAME_MATCH_PATTERN}
-   * while dropping empty files and directories which match the pattern.
-   * The list is then sorted with a comparator that sorts on filename,
-   * relying on the filename of newer created files being later than the old ones.
-   * 
-   * 
-   *
-   * @param fs filesystem
-   * @param dir dir to scan
-   * @param includeEmptyFiles should empty files be included in the result?
-   * @return a possibly empty list
-   * @throws IOException IO problems
-   * @throws FileNotFoundException if the target dir is actually a path
-   */
-  public List<Path> findAllHistoryEntries(FileSystem fs,
-                                          Path dir,
-                                          boolean includeEmptyFiles) throws IOException {
-    assert fs != null;
-    assert dir != null;
-    if (!fs.exists(dir)) {
-      fs.mkdirs(dir);
-    } else if (!fs.isDirectory(dir)) {
-      throw new FileNotFoundException("Not a directory " + dir.toString());
-    }
-    
-    PathFilter filter = new GlobFilter(SliderKeys.HISTORY_FILENAME_GLOB_PATTERN);
-    FileStatus[] stats = fs.listStatus(dir, filter);
-    List<Path> paths = new ArrayList<Path>(stats.length);
-    for (FileStatus stat : stats) {
-      log.debug("Possible entry: {}", stat.toString());
-      if (stat.isFile() && (includeEmptyFiles || stat.getLen() > 0)) {
-        paths.add(stat.getPath());
-      }
-    }
-    sortHistoryPaths(paths);
-    return paths;
-  }
-
-  @VisibleForTesting
-  public static void sortHistoryPaths(List<Path> paths) {
-    Collections.sort(paths, new NewerFilesFirst());
-  }
-  
-  /**
-   * Iterate through the paths until one can be loaded
-   * @param paths paths to load
-   * @return the loaded history including the path -or null if all failed to load
-   */
-  public LoadedRoleHistory attemptToReadHistory(FileSystem fileSystem,
-      List<Path> paths)
-      throws BadConfigException {
-    ListIterator<Path> pathIterator = paths.listIterator();
-    boolean success = false;
-    LoadedRoleHistory history = null;
-    while (!success && pathIterator.hasNext()) {
-      Path path = pathIterator.next();
-      try {
-        history = read(fileSystem, path);
-        //success
-        success = true;
-        history.setPath(path);
-      } catch (IOException e) {
-        log.info("Failed to read {}", path, e);
-      } catch (AvroTypeException e) {
-        log.warn("Failed to parse {}", path, e);
-      } catch (Exception e) {
-        // low level event logged @ warn level
-        log.warn("Exception while reading {}", path, e);
-      }
-    }
-    return history;
-  }
-
-  /**
-   * Try to load the history from a directory -a failure to load a specific
-   * file is downgraded to a log and the next older path attempted instead
-   * @param fs filesystem
-   * @param dir dir to load from
-   * @return the history loaded, including the path
-   * @throws IOException if indexing the history directory fails. 
-   */
-  public LoadedRoleHistory loadFromHistoryDir(FileSystem fs, Path dir)
-      throws IOException, BadConfigException {
-    assert fs != null: "null filesystem";
-    List<Path> entries = findAllHistoryEntries(fs, dir, false);
-    return attemptToReadHistory(fs, entries);
-  }
-
-  /**
-   * Delete all old history entries older than the one we want to keep. This
-   * uses the filename ordering to determine age, not timestamps
-   * @param fileSystem filesystem
-   * @param keep path to keep -used in thresholding the files
-   * @return the number of files deleted
-   * @throws FileNotFoundException if the path to keep is not present (safety
-   * check to stop the entire dir being purged)
-   * @throws IOException IO problems
-   */
-  public int purgeOlderHistoryEntries(FileSystem fileSystem, Path keep)
-      throws IOException { assert fileSystem != null : "null filesystem";
-    if (!fileSystem.exists(keep)) {
-      throw new FileNotFoundException(keep.toString());
-    }
-    Path dir = keep.getParent();
-    log.debug("Purging entries in {} up to {}", dir, keep);
-    List<Path> paths = findAllHistoryEntries(fileSystem, dir, true);
-    Collections.sort(paths, new OlderFilesFirst());
-    int deleteCount = 0;
-    for (Path path : paths) {
-      if (path.equals(keep)) {
-        break;
-      } else {
-        log.debug("Deleting {}", path);
-        deleteCount++;
-        fileSystem.delete(path, false);
-      }
-    }
-    return deleteCount;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/servicemonitor/HttpProbe.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/HttpProbe.java b/slider-core/src/main/java/org/apache/slider/server/servicemonitor/HttpProbe.java
deleted file mode 100644
index 9c14ca7..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/HttpProbe.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.servicemonitor;
-
-import org.apache.hadoop.conf.Configuration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-public class HttpProbe extends Probe {
-  protected static final Logger log = LoggerFactory.getLogger(HttpProbe.class);
-
-  private final URL url;
-  private final int timeout;
-  private final int min, max;
-
-
-  public HttpProbe(URL url, int timeout, int min, int max, Configuration conf) throws IOException {
-    super("Http probe of " + url + " [" + min + "-" + max + "]", conf);
-    this.url = url;
-    this.timeout = timeout;
-    this.min = min;
-    this.max = max;
-  }
-
-  public static HttpURLConnection getConnection(URL url, int timeout) throws IOException {
-    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-    connection.setInstanceFollowRedirects(true);
-    connection.setConnectTimeout(timeout);
-    return connection;
-  }
-  
-  @Override
-  public ProbeStatus ping(boolean livePing) {
-    ProbeStatus status = new ProbeStatus();
-    HttpURLConnection connection = null;
-    try {
-      if (log.isDebugEnabled()) {
-        // LOG.debug("Fetching " + url + " with timeout " + timeout);
-      }
-      connection = getConnection(url, this.timeout);
-      int rc = connection.getResponseCode();
-      if (rc < min || rc > max) {
-        String error = "Probe " + url + " error code: " + rc;
-        log.info(error);
-        status.fail(this,
-                    new IOException(error));
-      } else {
-        status.succeed(this);
-      }
-    } catch (IOException e) {
-      String error = "Probe " + url + " failed: " + e;
-      log.info(error, e);
-      status.fail(this,
-                  new IOException(error, e));
-    } finally {
-      if (connection != null) {
-        connection.disconnect();
-      }
-    }
-    return status;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/servicemonitor/LogEntryBuilder.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/LogEntryBuilder.java b/slider-core/src/main/java/org/apache/slider/server/servicemonitor/LogEntryBuilder.java
deleted file mode 100644
index a1ad44f..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/LogEntryBuilder.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.servicemonitor;
-
-/**
- * Build up log entries for ease of splunk
- */
-public class LogEntryBuilder {
-
-  private final StringBuilder builder = new StringBuilder();
-
-  public LogEntryBuilder() {
-  }
-
-  public LogEntryBuilder(String text) {
-    elt(text);
-  }
-
-
-  public LogEntryBuilder(String name, Object value) {
-    entry(name, value);
-  }
-
-  public LogEntryBuilder elt(String text) {
-    addComma();
-    builder.append(text);
-    return this;
-  }
-
-  public LogEntryBuilder elt(String name, Object value) {
-    addComma();
-    entry(name, value);
-    return this;
-  }
-
-  private void addComma() {
-    if (!isEmpty()) {
-      builder.append(", ");
-    }
-  }
-
-  private void entry(String name, Object value) {
-    builder.append(name).append('=');
-    if (value != null) {
-      builder.append('"').append(value.toString()).append('"');
-    } else {
-      builder.append("null");
-    }
-  }
-
-  @Override
-  public String toString() {
-    return builder.toString();
-  }
-
-  private boolean isEmpty() {
-    return builder.length() == 0;
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/servicemonitor/MonitorKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/MonitorKeys.java b/slider-core/src/main/java/org/apache/slider/server/servicemonitor/MonitorKeys.java
deleted file mode 100644
index f7bdd4a..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/MonitorKeys.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.servicemonitor;
-
-/**
- * Config keys for monitoring
- */
-public interface MonitorKeys {
-
-  /**
-   * Prefix of all other configuration options: {@value}
-   */
-  String MONITOR_KEY_PREFIX = "service.monitor.";
-
-
-  /**
-   * Classname of the reporter Key: {@value}
-   */
-  String MONITOR_REPORTER =
-    MONITOR_KEY_PREFIX + "report.classname";
-
-  /**
-   * Interval in milliseconds between reporting health status to the reporter
-   * Key: {@value}
-   */
-  String MONITOR_REPORT_INTERVAL =
-    MONITOR_KEY_PREFIX + "report.interval";
-
-  /**
-   * Time in millis between the last probing cycle ending and the new one
-   * beginning. Key: {@value}
-   */
-  String MONITOR_PROBE_INTERVAL =
-    MONITOR_KEY_PREFIX + "probe.interval";
-
-  /**
-   * How long in milliseconds does the probing loop have to be blocked before
-   * that is considered a liveness failure Key: {@value}
-   */
-  String MONITOR_PROBE_TIMEOUT =
-    MONITOR_KEY_PREFIX + "probe.timeout";
-
-  /**
-   * How long in milliseconds does the probing loop have to be blocked before
-   * that is considered a liveness failure Key: {@value}
-   */
-  String MONITOR_BOOTSTRAP_TIMEOUT =
-    MONITOR_KEY_PREFIX + "bootstrap.timeout";
-
-
-  /**
-   * does the monitor depend on DFS being live
-   */
-  String MONITOR_DEPENDENCY_DFSLIVE =
-    MONITOR_KEY_PREFIX + "dependency.dfslive";
-
-
-  /**
-   * default timeout for the entire bootstrap phase {@value}
-   */
-
-  int BOOTSTRAP_TIMEOUT_DEFAULT = 60000;
-
-
-  /**
-   * Default value if the key is not in the config file: {@value}
-   */
-  int REPORT_INTERVAL_DEFAULT = 10000;
-  /**
-   * Default value if the key is not in the config file: {@value}
-   */
-  int PROBE_INTERVAL_DEFAULT = 10000;
-  /**
-   * Default value if the key is not in the config file: {@value}
-   */
-  int PROBE_TIMEOUT_DEFAULT = 60000;
-
-  /**
-   * Port probe enabled/disabled flag Key: {@value}
-   */
-  String PORT_PROBE_ENABLED =
-    MONITOR_KEY_PREFIX + "portprobe.enabled";
-
-
-  /**
-   * Port probing key : port to attempt to create a TCP connection to {@value}
-   */
-  String PORT_PROBE_PORT =
-    MONITOR_KEY_PREFIX + "portprobe.port";
-
-  /**
-   * Port probing key : port to attempt to create a TCP connection to {@value}
-   */
-  String PORT_PROBE_HOST =
-    MONITOR_KEY_PREFIX + "portprobe.host";
-
-
-  /**
-   * Port probing key : timeout of the connection attempt {@value}
-   */
-  String PORT_PROBE_CONNECT_TIMEOUT =
-    MONITOR_KEY_PREFIX + "portprobe.connect.timeout";
-
-  /**
-   * Port probing key : bootstrap timeout -how long in milliseconds should the
-   * port probing take to connect before the failure to connect is considered a
-   * liveness failure. That is: how long should the IPC port take to come up?
-   * {@value}
-   */
-  String PORT_PROBE_BOOTSTRAP_TIMEOUT =
-    MONITOR_KEY_PREFIX + "portprobe.bootstrap.timeout";
-
-
-  /**
-   * default timeout for port probes {@value}
-   */
-  int PORT_PROBE_BOOTSTRAP_TIMEOUT_DEFAULT = 60000;
-
-  /**
-   * default value for port probe connection attempts {@value}
-   */
-
-  int PORT_PROBE_CONNECT_TIMEOUT_DEFAULT = 1000;
-
-
-  /**
-   * default port for probes {@value}
-   */
-  int DEFAULT_PROBE_PORT = 8020;
-
-
-  /**
-   * default host for probes {@value}
-   */
-  String DEFAULT_PROBE_HOST = "localhost";
-
-
-  /**
-   * Probe enabled/disabled flag Key: {@value}
-   */
-  String LS_PROBE_ENABLED =
-    MONITOR_KEY_PREFIX + "lsprobe.enabled";
-
-  /**
-   * Probe path for LS operation Key: {@value}
-   */
-  String LS_PROBE_PATH =
-    MONITOR_KEY_PREFIX + "lsprobe.path";
-
-  /**
-   * Default path for LS operation Key: {@value}
-   */
-  String LS_PROBE_DEFAULT = "/";
-
-  /**
-   * Port probing key : bootstrap timeout -how long in milliseconds should the
-   * port probing take to connect before the failure to connect is considered a
-   * liveness failure. That is: how long should the IPC port take to come up?
-   * {@value}
-   */
-  String LS_PROBE_BOOTSTRAP_TIMEOUT =
-    MONITOR_KEY_PREFIX + "lsprobe.bootstrap.timeout";
-
-
-  /**
-   * default timeout for port probes {@value}
-   */
-
-  int LS_PROBE_BOOTSTRAP_TIMEOUT_DEFAULT = PORT_PROBE_BOOTSTRAP_TIMEOUT_DEFAULT;
-
-
-  /**
-   * Probe enabled/disabled flag Key: {@value}
-   */
-  String WEB_PROBE_ENABLED =
-    MONITOR_KEY_PREFIX + "webprobe.enabled";
-
-  /**
-   * Probe URL Key: {@value}
-   */
-  String WEB_PROBE_URL =
-    MONITOR_KEY_PREFIX + "webprobe.url";
-
-  /**
-   * Default path for web probe Key: {@value}
-   */
-  String WEB_PROBE_DEFAULT_URL = "http://localhost:50070/";
-
-  /**
-   * min error code Key: {@value}
-   */
-  String WEB_PROBE_MIN =
-    MONITOR_KEY_PREFIX + "webprobe.min";
-  /**
-   * min error code Key: {@value}
-   */
-  String WEB_PROBE_MAX =
-    MONITOR_KEY_PREFIX + "webprobe.max";
-
-
-  /**
-   * Port probing key : timeout of the connection attempt {@value}
-   */
-  String WEB_PROBE_CONNECT_TIMEOUT =
-    MONITOR_KEY_PREFIX + "webprobe.connect.timeout";
-
-  /**
-   * Default HTTP response code expected from the far end for
-   * the endpoint to be considered live.
-   */
-  int WEB_PROBE_DEFAULT_CODE = 200;
-
-  /**
-   * Port probing key : bootstrap timeout -how long in milliseconds should the
-   * port probing take to connect before the failure to connect is considered a
-   * liveness failure. That is: how long should the IPC port take to come up?
-   * {@value}
-   */
-  String WEB_PROBE_BOOTSTRAP_TIMEOUT =
-    MONITOR_KEY_PREFIX + "webprobe.bootstrap.timeout";
-
-
-  /**
-   * default timeout for port probes {@value}
-   */
-
-  int WEB_PROBE_BOOTSTRAP_TIMEOUT_DEFAULT = PORT_PROBE_BOOTSTRAP_TIMEOUT_DEFAULT;
-
-  /**
-   * Probe enabled/disabled flag Key: {@value}
-   */
-  String JT_PROBE_ENABLED =
-    MONITOR_KEY_PREFIX + "jtprobe.enabled";
-
-  /**
-   * Port probing key : bootstrap timeout -how long in milliseconds should the
-   * port probing take to connect before the failure to connect is considered a
-   * liveness failure. That is: how long should the IPC port take to come up?
-   * {@value}
-   */
-  String JT_PROBE_BOOTSTRAP_TIMEOUT =
-    MONITOR_KEY_PREFIX + "jtprobe.bootstrap.timeout";
-
-
-  /**
-   * default timeout for port probes {@value}
-   */
-
-  int JT_PROBE_BOOTSTRAP_TIMEOUT_DEFAULT = PORT_PROBE_BOOTSTRAP_TIMEOUT_DEFAULT;
-
-
-  /**
-   * Probe enabled/disabled flag Key: {@value}
-   */
-  String PID_PROBE_ENABLED =
-    MONITOR_KEY_PREFIX + "pidprobe.enabled";
-
-  /**
-   * PID probing key : pid to attempt to create a TCP connection to {@value}
-   */
-  String PID_PROBE_PIDFILE =
-    MONITOR_KEY_PREFIX + "pidprobe.pidfile";
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/servicemonitor/MonitorUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/MonitorUtils.java b/slider-core/src/main/java/org/apache/slider/server/servicemonitor/MonitorUtils.java
deleted file mode 100644
index a4447e3..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/MonitorUtils.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.servicemonitor;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.URI;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Formatter;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.TreeSet;
-
-/**
- * Various utils to work with the monitor
- */
-public final class MonitorUtils {
-  protected static final Logger log = LoggerFactory.getLogger(MonitorUtils.class);
-
-  private MonitorUtils() {
-  }
-
-  public static String toPlural(int val) {
-    return val != 1 ? "s" : "";
-  }
-
-  /**
-   * Convert the arguments -including dropping any empty strings that creep in
-   * @param args arguments
-   * @return a list view with no empty strings
-   */
-  public static List<String> prepareArgs(String[] args) {
-    List<String> argsList = new ArrayList<String>(args.length);
-    StringBuilder argsStr = new StringBuilder("Arguments: [");
-    for (String arg : args) {
-      argsStr.append('"').append(arg).append("\" ");
-      if (!arg.isEmpty()) {
-        argsList.add(arg);
-      }
-    }
-    argsStr.append(']');
-    log.debug(argsStr.toString());
-    return argsList;
-  }
-
-  /**
-   * Convert milliseconds to human time -the exact format is unspecified
-   * @param milliseconds a time in milliseconds
-   * @return a time that is converted to human intervals
-   */
-  public static String millisToHumanTime(long milliseconds) {
-    StringBuilder sb = new StringBuilder();
-    // Send all output to the Appendable object sb
-    Formatter formatter = new Formatter(sb, Locale.US);
-
-    long s = Math.abs(milliseconds / 1000);
-    long m = Math.abs(milliseconds % 1000);
-    if (milliseconds > 0) {
-      formatter.format("%d.%03ds", s, m);
-    } else if (milliseconds == 0) {
-      formatter.format("0");
-    } else {
-      formatter.format("-%d.%03ds", s, m);
-    }
-    return sb.toString();
-  }
-
-  public static InetSocketAddress getURIAddress(URI uri) {
-    String host = uri.getHost();
-    int port = uri.getPort();
-    return new InetSocketAddress(host, port);
-  }
-
-
-  /**
-   * Get the localhost -may be null
-   * @return the localhost if known
-   */
-  public static InetAddress getLocalHost() {
-    InetAddress localHost;
-    try {
-      localHost = InetAddress.getLocalHost();
-    } catch (UnknownHostException e) {
-      localHost = null;
-    }
-    return localHost;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/servicemonitor/PortProbe.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/PortProbe.java b/slider-core/src/main/java/org/apache/slider/server/servicemonitor/PortProbe.java
deleted file mode 100644
index b1ff792..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/PortProbe.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.servicemonitor;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.IOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-
-/**
- * Probe for a port being open
- */
-public class PortProbe extends Probe {
-  protected static final Logger log = LoggerFactory.getLogger(PortProbe.class);
-  private final String host;
-  private final int port;
-  private final int timeout;
-
-  public PortProbe(String host, int port, int timeout, String name, Configuration conf)
-      throws IOException {
-    super("Port probe " + name + " " + host + ":" + port + " for " + timeout + "ms",
-          conf);
-    this.host = host;
-    this.port = port;
-    this.timeout = timeout;
-  }
-
-  public static PortProbe createPortProbe(Configuration conf,
-                                          String hostname,
-                                          int port) throws IOException {
-    PortProbe portProbe = new PortProbe(hostname,
-                                        port,
-                                        conf.getInt(
-                                          PORT_PROBE_CONNECT_TIMEOUT,
-                                          PORT_PROBE_CONNECT_TIMEOUT_DEFAULT),
-                                        "",
-                                        conf);
-
-    return portProbe;
-  }
-
-  @Override
-  public void init() throws IOException {
-    if (port >= 65536) {
-      throw new IOException("Port is out of range: " + port);
-    }
-    InetAddress target;
-    if (host != null) {
-      log.debug("looking up host " + host);
-      target = InetAddress.getByName(host);
-    } else {
-      log.debug("Host is null, retrieving localhost address");
-      target = InetAddress.getLocalHost();
-    }
-    log.info("Checking " + target + ":" + port);
-  }
-
-  /**
-   * Try to connect to the (host,port); a failure to connect within
-   * the specified timeout is a failure
-   * @param livePing is the ping live: true for live; false for boot time
-   * @return the outcome
-   */
-  @Override
-  public ProbeStatus ping(boolean livePing) {
-    ProbeStatus status = new ProbeStatus();
-    InetSocketAddress sockAddr = new InetSocketAddress(host, port);
-    Socket socket = new Socket();
-    try {
-      if (log.isDebugEnabled()) {
-        log.debug("Connecting to " + sockAddr.toString() + " connection-timeout=" +
-                  MonitorUtils.millisToHumanTime(timeout));
-      }
-      socket.connect(sockAddr, timeout);
-      status.succeed(this);
-    } catch (IOException e) {
-      String error = "Probe " + sockAddr + " failed: " + e;
-      log.debug(error, e);
-      status.fail(this,
-                  new IOException(error, e));
-    } finally {
-      IOUtils.closeSocket(socket);
-    }
-    return status;
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/servicemonitor/Probe.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/Probe.java b/slider-core/src/main/java/org/apache/slider/server/servicemonitor/Probe.java
deleted file mode 100644
index be4b5ef..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/Probe.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.servicemonitor;
-
-import org.apache.hadoop.conf.Configuration;
-
-import java.io.IOException;
-
-/**
- * Base class of all probes.
- */
-public abstract class Probe implements MonitorKeys {
-
-  protected final Configuration conf;
-  private String name;
-
-  // =======================================================
-  /*
-   * These fields are all used by the probe loops
-   * to maintain state. Please Leave them alone.
-   */
-  public int successCount;
-  public int failureCount;
-  public long bootstrapStarted;
-  public long bootstrapFinished;
-  private boolean booted = false;
-
-  // =======================================================
-
-  /**
-   * Create a probe of a specific name
-   *
-   * @param name probe name
-   * @param conf configuration being stored.
-   */
-  public Probe(String name, Configuration conf) {
-    this.name = name;
-    this.conf = conf;
-  }
-
-
-  protected void setName(String name) {
-    this.name = name;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-
-  @Override
-  public String toString() {
-    return getName() +
-           " {" +
-           "successCount=" + successCount +
-           ", failureCount=" + failureCount +
-           '}';
-  }
-
-  /**
-   * perform any prelaunch initialization
-   */
-  public void init() throws IOException {
-
-  }
-
-  /**
-   * Ping the endpoint. All exceptions must be caught and included in the
-   * (failure) status.
-   *
-   * @param livePing is the ping live: true for live; false for boot time
-   * @return the status
-   */
-  public abstract ProbeStatus ping(boolean livePing);
-
-  public void beginBootstrap() {
-    bootstrapStarted = System.currentTimeMillis();
-  }
-
-  public void endBootstrap() {
-    setBooted(true);
-    bootstrapFinished = System.currentTimeMillis();
-  }
-
-  public boolean isBooted() {
-    return booted;
-  }
-
-  public void setBooted(boolean booted) {
-    this.booted = booted;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeFailedException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeFailedException.java b/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeFailedException.java
deleted file mode 100644
index f09b848..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeFailedException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.servicemonitor;
-
-/**
- * An exception to raise on a probe failure
- */
-public class ProbeFailedException extends Exception {
-
-  public final ProbeStatus status;
-
-  public ProbeFailedException(String text, ProbeStatus status) {
-    super((text == null ? "Probe Failed" : (text + ": ")) + status, status.getThrown());
-    this.status = status;
-  }
-
-}



[06/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jquery/jquery-ui-1.9.1.custom.min.js
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jquery/jquery-ui-1.9.1.custom.min.js b/slider-core/src/main/resources/webapps/static/jquery/jquery-ui-1.9.1.custom.min.js
deleted file mode 100644
index aa7a923..0000000
--- a/slider-core/src/main/resources/webapps/static/jquery/jquery-ui-1.9.1.custom.min.js
+++ /dev/null
@@ -1,6 +0,0 @@
-/*! jQuery UI - v1.9.1 - 2012-10-25
-* http://jqueryui.com
-* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.effect.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.progressbar.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.slider.js, jquery.ui.sortable.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
-* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */
-
-(function(e,t){function i(t,n){var r,i,o,u=t.nodeName.toLowerCase();return"area"===u?(r=t.parentNode,i=r.name,!t.href||!i||r.nodeName.toLowerCase()!=="map"?!1:(o=e("img[usemap=#"+i+"]")[0],!!o&&s(o))):(/input|select|textarea|button|object/.test(u)?!t.disabled:"a"===u?t.href||n:n)&&s(t)}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().andSelf().filter(function(){return e.css(this,"visibility")==="hidden"}).length}var n=0,r=/^ui-id-\d+$/;e.ui=e.ui||{};if(e.ui.version)return;e.extend(e.ui,{version:"1.9.1",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({_focus:e.fn.focus,focus:function(t,n){return typeof t=="number"?this.each(function(){var r=this;setTimeout(function(){e(r).focus(),n&&n.call(r)},t)}):this._focus.apply(this,arguments)},scrollPa
 rent:function(){var t;return e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?t=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):t=this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(n){if(n!==t)return this.css("zIndex",n);if(this.length){var r=e(this[0]),i,s;while(r.length&&r[0]!==document){i=r.css("position");if(i==="absolute"||i==="relative"||i==="fixed"){s=parseInt(r.css("zIndex"),10);if(!isNaN(s)&&s!==0)return s}r=r.parent()}}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++n)})},removeUniqueId:function(){return this.each(function(){r.test(this.id)&&e(this).removeAttr("id")})}}),e("
 <a>").outerWidth(1).jquery||e.each(["Width","Height"],function(n,r){function u(t,n,r,s){return e.each(i,function(){n-=parseFloat(e.css(t,"padding"+this))||0,r&&(n-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(n-=parseFloat(e.css(t,"margin"+this))||0)}),n}var i=r==="Width"?["Left","Right"]:["Top","Bottom"],s=r.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+r]=function(n){return n===t?o["inner"+r].call(this):this.each(function(){e(this).css(s,u(this,n)+"px")})},e.fn["outer"+r]=function(t,n){return typeof t!="number"?o["outer"+r].call(this,t):this.each(function(){e(this).css(s,u(this,t,!0,n)+"px")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var n=e.attr(t,"tabindex"),r=isNaN(n);retu
 rn(r||n>=0)&&i(t,!r)}}),e(function(){var t=document.body,n=t.appendChild(n=document.createElement("div"));n.offsetHeight,e.extend(n.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),e.support.minHeight=n.offsetHeight===100,e.support.selectstart="onselectstart"in n,t.removeChild(n).style.display="none"}),function(){var t=/msie ([\w.]+)/.exec(navigator.userAgent.toLowerCase())||[];e.ui.ie=t.length?!0:!1,e.ui.ie6=parseFloat(t[1],10)===6}(),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,n,r){var i,s=e.ui[t].prototype;for(i in r)s.plugins[i]=s.plugins[i]||[],s.plugins[i].push([n,r[i]])},call:function(e,t,n){var r,i=e.plugins[t];if(!i||!e.element[0].parentNode||e.element[0].parentNode.nodeType===11)return;for(r=0;r<i.length;r++)e.options[i[r][0]]&&i
 [r][1].apply(e.element,n)}},contains:e.contains,hasScroll:function(t,n){if(e(t).css("overflow")==="hidden")return!1;var r=n&&n==="left"?"scrollLeft":"scrollTop",i=!1;return t[r]>0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)},isOverAxis:function(e,t,n){return e>t&&e<t+n},isOver:function(t,n,r,i,s,o){return e.ui.isOverAxis(t,r,s)&&e.ui.isOverAxis(n,i,o)}})})(jQuery);(function(e,t){var n=0,r=Array.prototype.slice,i=e.cleanData;e.cleanData=function(t){for(var n=0,r;(r=t[n])!=null;n++)try{e(r).triggerHandler("remove")}catch(s){}i(t)},e.widget=function(t,n,r){var i,s,o,u,a=t.split(".")[0];t=t.split(".")[1],i=a+"-"+t,r||(r=n,n=e.Widget),e.expr[":"][i.toLowerCase()]=function(t){return!!e.data(t,i)},e[a]=e[a]||{},s=e[a][t],o=e[a][t]=function(e,t){if(!this._createWidget)return new o(e,t);arguments.length&&this._createWidget(e,t)},e.extend(o,s,{version:r.version,_proto:e.extend({},r),_childConstructors:[]}),u=new n,u.options=e.widget.extend({},u.options),e.each(r,function(t,i){e.isFunction(i)&&(r[t]=functio
 n(){var e=function(){return n.prototype[t].apply(this,arguments)},r=function(e){return n.prototype[t].apply(this,e)};return function(){var t=this._super,n=this._superApply,s;return this._super=e,this._superApply=r,s=i.apply(this,arguments),this._super=t,this._superApply=n,s}}())}),o.prototype=e.widget.extend(u,{widgetEventPrefix:u.widgetEventPrefix||t},r,{constructor:o,namespace:a,widgetName:t,widgetBaseClass:i,widgetFullName:i}),s?(e.each(s._childConstructors,function(t,n){var r=n.prototype;e.widget(r.namespace+"."+r.widgetName,o,n._proto)}),delete s._childConstructors):n._childConstructors.push(o),e.widget.bridge(t,o)},e.widget.extend=function(n){var i=r.call(arguments,1),s=0,o=i.length,u,a;for(;s<o;s++)for(u in i[s])a=i[s][u],i[s].hasOwnProperty(u)&&a!==t&&(e.isPlainObject(a)?n[u]=e.isPlainObject(n[u])?e.widget.extend({},n[u],a):e.widget.extend({},a):n[u]=a);return n},e.widget.bridge=function(n,i){var s=i.prototype.widgetFullName;e.fn[n]=function(o){var u=typeof o=="string",a=r.c
 all(arguments,1),f=this;return o=!u&&a.length?e.widget.extend.apply(null,[o].concat(a)):o,u?this.each(function(){var r,i=e.data(this,s);if(!i)return e.error("cannot call methods on "+n+" prior to initialization; "+"attempted to call method '"+o+"'");if(!e.isFunction(i[o])||o.charAt(0)==="_")return e.error("no such method '"+o+"' for "+n+" widget instance");r=i[o].apply(i,a);if(r!==i&&r!==t)return f=r&&r.jquery?f.pushStack(r.get()):r,!1}):this.each(function(){var t=e.data(this,s);t?t.option(o||{})._init():new i(o,this)}),f}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,r){r=e(r||this.defaultElement||this)[0],this.element=e(r),this.uuid=n++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),r!==this&&(e.data(r,
 this.widgetName,this),e.data(r,this.widgetFullName,this),this._on(this.element,{remove:function(e){e.target===r&&this.destroy()}}),this.document=e(r.style?r.ownerDocument:r.document||r),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(n,r){var i=n,s,o,u;if(arguments.length===0)return
  e.widget.extend({},this.options);if(typeof n=="string"){i={},s=n.split("."),n=s.shift();if(s.length){o=i[n]=e.widget.extend({},this.options[n]);for(u=0;u<s.length-1;u++)o[s[u]]=o[s[u]]||{},o=o[s[u]];n=s.pop();if(r===t)return o[n]===t?null:o[n];o[n]=r}else{if(r===t)return this.options[n]===t?null:this.options[n];i[n]=r}}return this._setOptions(i),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,e==="disabled"&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(t,n){var r,i=this;n?(t=r=e(t),this.bindings=this.bindings.add(t)):(n=t,t=this.element,r=this.widget()),e.each(n,function(n,s){function o(){if(i.options.disabled===!0||
 e(this).hasClass("ui-state-disabled"))return;return(typeof s=="string"?i[s]:s).apply(i,arguments)}typeof s!="string"&&(o.guid=s.guid=s.guid||o.guid||e.guid++);var u=n.match(/^(\w+)\s*(.*)$/),a=u[1]+i.eventNamespace,f=u[2];f?r.delegate(f,a,o):t.bind(a,o)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function n(){return(typeof e=="string"?r[e]:e).apply(r,arguments)}var r=this;return setTimeout(n,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,n,r){var i,s,o=this.options[t];r=r||{},n=e.Even
 t(n),n.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),n.target=this.element[0],s=n.originalEvent;if(s)for(i in s)i in n||(n[i]=s[i]);return this.element.trigger(n,r),!(e.isFunction(o)&&o.apply(this.element[0],[n].concat(r))===!1||n.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,n){e.Widget.prototype["_"+t]=function(r,i,s){typeof i=="string"&&(i={effect:i});var o,u=i?i===!0||typeof i=="number"?n:i.effect||n:t;i=i||{},typeof i=="number"&&(i={duration:i}),o=!e.isEmptyObject(i),i.complete=s,i.delay&&r.delay(i.delay),o&&e.effects&&(e.effects.effect[u]||e.uiBackCompat!==!1&&e.effects[u])?r[t](i):u!==t&&r[u]?r[u](i.duration,i.easing,s):r.queue(function(n){e(this)[t](),s&&s.call(r[0]),n()})}}),e.uiBackCompat!==!1&&(e.Widget.prototype._getCreateOptions=function(){return e.metadata&&e.metadata.get(this.element[0])[this.widgetName]})})(jQuery);(function(e,t){var n=!1;e(document).mouseup(function(e){n=!1}),e.widget("ui.mouse",{version:"1.9.1
 ",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(n){if(!0===e.data(n.target,t.widgetName+".preventClickEvent"))return e.removeData(n.target,t.widgetName+".preventClickEvent"),n.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(n)return;this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var r=this,i=t.which===1,s=typeof this.options.cancel=="string"&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;if(!i||s||!this._mouseCapture(t))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(fu
 nction(){r.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)){this._mouseStarted=this._mouseStart(t)!==!1;if(!this._mouseStarted)return t.preventDefault(),!0}return!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return r._mouseMove(e)},this._mouseUpDelegate=function(e){return r._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),n=!0,!0},_mouseMove:function(t){return!e.ui.ie||document.documentMode>=9||!!t.button?this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted):this._mouseUp(t)},_mouseUp:function(t){return e(document).unbind("mouse
 move."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(e){return this.mouseDelayMet},_mouseStart:function(e){},_mouseDrag:function(e){},_mouseStop:function(e){},_mouseCapture:function(e){return!0}})})(jQuery);(function(e,t){function h(e,t,n){return[parseInt(e[0],10)*(l.test(e[0])?t/100:1),parseInt(e[1],10)*(l.test(e[1])?n/100:1)]}function p(t,n){return parseInt(e.css(t,n),10)||0}e.ui=e.ui||{};var n,r=Math.max,i=Math.abs,s=Math.round,o=/left|center|right/,u=/top|center|bottom/,a=/[\+\-]\d+%?/,f=/^\w+/,l=/%$/,c=e.fn.position;e.position={scrollbarWidth:function(){if(n!==t)return n;var r,i,s=e("
 <div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return e("body").append(s),r=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,r===i&&(i=s[0].clientWidth),s.remove(),n=r-i},getScrollInfo:function(t){var n=t.isWindow?"":t.element.css("overflow-x"),r=t.isWindow?"":t.element.css("overflow-y"),i=n==="scroll"||n==="auto"&&t.width<t.element[0].scrollWidth,s=r==="scroll"||r==="auto"&&t.height<t.element[0].scrollHeight;return{width:i?e.position.scrollbarWidth():0,height:s?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var n=e(t||window),r=e.isWindow(n[0]);return{element:n,isWindow:r,offset:n.offset()||{left:0,top:0},scrollLeft:n.scrollLeft(),scrollTop:n.scrollTop(),width:r?n.width():n.outerWidth(),height:r?n.height():n.outerHeight()}}},e.fn.position=function(t){if(!t||!t.of)return c.apply(this,arguments);t=e.extend({},t);var n,l,d,v,m,g=e(t.of),y=e.position.getWithinInfo(t.within),b=e
 .position.getScrollInfo(y),w=g[0],E=(t.collision||"flip").split(" "),S={};return w.nodeType===9?(l=g.width(),d=g.height(),v={top:0,left:0}):e.isWindow(w)?(l=g.width(),d=g.height(),v={top:g.scrollTop(),left:g.scrollLeft()}):w.preventDefault?(t.at="left top",l=d=0,v={top:w.pageY,left:w.pageX}):(l=g.outerWidth(),d=g.outerHeight(),v=g.offset()),m=e.extend({},v),e.each(["my","at"],function(){var e=(t[this]||"").split(" "),n,r;e.length===1&&(e=o.test(e[0])?e.concat(["center"]):u.test(e[0])?["center"].concat(e):["center","center"]),e[0]=o.test(e[0])?e[0]:"center",e[1]=u.test(e[1])?e[1]:"center",n=a.exec(e[0]),r=a.exec(e[1]),S[this]=[n?n[0]:0,r?r[0]:0],t[this]=[f.exec(e[0])[0],f.exec(e[1])[0]]}),E.length===1&&(E[1]=E[0]),t.at[0]==="right"?m.left+=l:t.at[0]==="center"&&(m.left+=l/2),t.at[1]==="bottom"?m.top+=d:t.at[1]==="center"&&(m.top+=d/2),n=h(S.at,l,d),m.left+=n[0],m.top+=n[1],this.each(function(){var o,u,a=e(this),f=a.outerWidth(),c=a.outerHeight(),w=p(this,"marginLeft"),x=p(this,"margi
 nTop"),T=f+w+p(this,"marginRight")+b.width,N=c+x+p(this,"marginBottom")+b.height,C=e.extend({},m),k=h(S.my,a.outerWidth(),a.outerHeight());t.my[0]==="right"?C.left-=f:t.my[0]==="center"&&(C.left-=f/2),t.my[1]==="bottom"?C.top-=c:t.my[1]==="center"&&(C.top-=c/2),C.left+=k[0],C.top+=k[1],e.support.offsetFractions||(C.left=s(C.left),C.top=s(C.top)),o={marginLeft:w,marginTop:x},e.each(["left","top"],function(r,i){e.ui.position[E[r]]&&e.ui.position[E[r]][i](C,{targetWidth:l,targetHeight:d,elemWidth:f,elemHeight:c,collisionPosition:o,collisionWidth:T,collisionHeight:N,offset:[n[0]+k[0],n[1]+k[1]],my:t.my,at:t.at,within:y,elem:a})}),e.fn.bgiframe&&a.bgiframe(),t.using&&(u=function(e){var n=v.left-C.left,s=n+l-f,o=v.top-C.top,u=o+d-c,h={target:{element:g,left:v.left,top:v.top,width:l,height:d},element:{element:a,left:C.left,top:C.top,width:f,height:c},horizontal:s<0?"left":n>0?"right":"center",vertical:u<0?"top":o>0?"bottom":"middle"};l<f&&i(n+s)<l&&(h.horizontal="center"),d<c&&i(o+u)<d&&(h
 .vertical="middle"),r(i(n),i(s))>r(i(o),i(u))?h.important="horizontal":h.important="vertical",t.using.call(this,e,h)}),a.offset(e.extend(C,{using:u}))})},e.ui.position={fit:{left:function(e,t){var n=t.within,i=n.isWindow?n.scrollLeft:n.offset.left,s=n.width,o=e.left-t.collisionPosition.marginLeft,u=i-o,a=o+t.collisionWidth-s-i,f;t.collisionWidth>s?u>0&&a<=0?(f=e.left+u+t.collisionWidth-s-i,e.left+=u-f):a>0&&u<=0?e.left=i:u>a?e.left=i+s-t.collisionWidth:e.left=i:u>0?e.left+=u:a>0?e.left-=a:e.left=r(e.left-o,e.left)},top:function(e,t){var n=t.within,i=n.isWindow?n.scrollTop:n.offset.top,s=t.within.height,o=e.top-t.collisionPosition.marginTop,u=i-o,a=o+t.collisionHeight-s-i,f;t.collisionHeight>s?u>0&&a<=0?(f=e.top+u+t.collisionHeight-s-i,e.top+=u-f):a>0&&u<=0?e.top=i:u>a?e.top=i+s-t.collisionHeight:e.top=i:u>0?e.top+=u:a>0?e.top-=a:e.top=r(e.top-o,e.top)}},flip:{left:function(e,t){var n=t.within,r=n.offset.left+n.scrollLeft,s=n.width,o=n.isWindow?n.scrollLeft:n.offset.left,u=e.left-t.c
 ollisionPosition.marginLeft,a=u-o,f=u+t.collisionWidth-s-o,l=t.my[0]==="left"?-t.elemWidth:t.my[0]==="right"?t.elemWidth:0,c=t.at[0]==="left"?t.targetWidth:t.at[0]==="right"?-t.targetWidth:0,h=-2*t.offset[0],p,d;if(a<0){p=e.left+l+c+h+t.collisionWidth-s-r;if(p<0||p<i(a))e.left+=l+c+h}else if(f>0){d=e.left-t.collisionPosition.marginLeft+l+c+h-o;if(d>0||i(d)<f)e.left+=l+c+h}},top:function(e,t){var n=t.within,r=n.offset.top+n.scrollTop,s=n.height,o=n.isWindow?n.scrollTop:n.offset.top,u=e.top-t.collisionPosition.marginTop,a=u-o,f=u+t.collisionHeight-s-o,l=t.my[1]==="top",c=l?-t.elemHeight:t.my[1]==="bottom"?t.elemHeight:0,h=t.at[1]==="top"?t.targetHeight:t.at[1]==="bottom"?-t.targetHeight:0,p=-2*t.offset[1],d,v;a<0?(v=e.top+c+h+p+t.collisionHeight-s-r,e.top+c+h+p>a&&(v<0||v<i(a))&&(e.top+=c+h+p)):f>0&&(d=e.top-t.collisionPosition.marginTop+c+h+p-o,e.top+c+h+p>f&&(d>0||i(d)<f)&&(e.top+=c+h+p))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left
 .apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,n,r,i,s,o=document.getElementsByTagName("body")[0],u=document.createElement("div");t=document.createElement(o?"div":"body"),r={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},o&&e.extend(r,{position:"absolute",left:"-1000px",top:"-1000px"});for(s in r)t.style[s]=r[s];t.appendChild(u),n=o||document.documentElement,n.insertBefore(t,n.firstChild),u.style.cssText="position: absolute; left: 10.7432222px;",i=e(u).offset().left,e.support.offsetFractions=i>10&&i<11,t.innerHTML="",n.removeChild(t)}(),e.uiBackCompat!==!1&&function(e){var n=e.fn.position;e.fn.position=function(r){if(!r||!r.offset)return n.call(this,r);var i=r.offset.split(" "),s=r.at.split(" ");return i.length===1&&(i[1]=i[0]),/^\d/.test(i[0])&&(i[0]="+"+i[0]),/^\d/.test(i[1])&&(i[1]="+"+i[1]),s.length===1&&(/left|center|right/.test(s[0])?s[1]="center":(s[
 1]=s[0],s[0]="center")),n.call(this,e.extend(r,{at:s[0]+i[0]+" "+s[1]+i[1],offset:t}))}}(jQuery)})(jQuery);(function(e,t){var n=0,r={},i={};r.height=r.paddingTop=r.paddingBottom=r.borderTopWidth=r.borderBottomWidth="hide",i.height=i.paddingTop=i.paddingBottom=i.borderTopWidth=i.borderBottomWidth="show",e.widget("ui.accordion",{version:"1.9.1",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},_create:function(){var t=this.accordionId="ui-accordion-"+(this.element.attr("id")||++n),r=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset"),this.headers=this.element.find(r.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"),this._hoverable(this.headers),this._focusable(this.headers),this.headers.next().addClass("ui-accordio
 n-content ui-helper-reset ui-widget-content ui-corner-bottom").hide(),!r.collapsible&&(r.active===!1||r.active==null)&&(r.active=0),r.active<0&&(r.active+=this.headers.length),this.active=this._findActive(r.active).addClass("ui-accordion-header-active ui-state-active").toggleClass("ui-corner-all ui-corner-top"),this.active.next().addClass("ui-accordion-content-active").show(),this._createIcons(),this.refresh(),this.element.attr("role","tablist"),this.headers.attr("role","tab").each(function(n){var r=e(this),i=r.attr("id"),s=r.next(),o=s.attr("id");i||(i=t+"-header-"+n,r.attr("id",i)),o||(o=t+"-panel-"+n,s.attr("id",o)),r.attr("aria-controls",o),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false",tabIndex:-1}).next().attr({"aria-expanded":"false","aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true",tabIndex:0}).next().attr({"aria-expanded":"true","aria-hidden":"false"}):this.head
 ers.eq(0).attr("tabIndex",0),this._on(this.headers,{keydown:"_keydown"}),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._setupEvents(r.event)},_getCreateEventData:function(){return{header:this.active,content:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-select
 ed").removeAttr("aria-controls").removeAttr("tabIndex").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),this._destroyIcons(),e=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),this.options.heightStyle!=="content"&&e.css("height","")},_setOption:function(e,t){if(e==="active"){this._activate(t);return}e==="event"&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),e==="collapsible"&&!t&&this.options.active===!1&&this._activate(0),e==="icons"&&(this._destroyIcons(),t&&this._createIcons()),e==="disabled"&&this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)},_keydown:function(t){if(t.altKey|
 |t.ctrlKey)return;var n=e.ui.keyCode,r=this.headers.length,i=this.headers.index(t.target),s=!1;switch(t.keyCode){case n.RIGHT:case n.DOWN:s=this.headers[(i+1)%r];break;case n.LEFT:case n.UP:s=this.headers[(i-1+r)%r];break;case n.SPACE:case n.ENTER:this._eventHandler(t);break;case n.HOME:s=this.headers[0];break;case n.END:s=this.headers[r-1]}s&&(e(t.target).attr("tabIndex",-1),e(s).attr("tabIndex",0),s.focus(),t.preventDefault())},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t,n,r=this.options.heightStyle,i=this.element.parent();r==="fill"?(e.support.minHeight||(n=i.css("overflow"),i.css("overflow","hidden")),t=i.height(),this.element.siblings(":visible").each(function(){var n=e(this),r=n.css("position");if(r==="absolute"||r==="fixed")return;t-=n.outerHeight(!0)}),n&&i.css("overflow",n),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t
 -e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):r==="auto"&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).height("").height())}).height(t))},_activate:function(t){var n=this._findActive(t)[0];if(n===this.active[0])return;n=n||this.active[0],this._eventHandler({target:n,currentTarget:n,preventDefault:e.noop})},_findActive:function(t){return typeof t=="number"?this.headers.eq(t):e()},_setupEvents:function(t){var n={};if(!t)return;e.each(t.split(" "),function(e,t){n[t]="_eventHandler"}),this._on(this.headers,n)},_eventHandler:function(t){var n=this.options,r=this.active,i=e(t.currentTarget),s=i[0]===r[0],o=s&&n.collapsible,u=o?e():i.next(),a=r.next(),f={oldHeader:r,oldPanel:a,newHeader:o?e():i,newPanel:u};t.preventDefault();if(s&&!n.collapsible||this._trigger("beforeActivate",t,f)===!1)return;n.active=o?!1:this.headers.index(i),this.active=s?e():i,this._toggle(f),r.removeClass("ui-accordion-header-active ui-state-active"),n.icons&&r.children(".ui-acc
 ordion-header-icon").removeClass(n.icons.activeHeader).addClass(n.icons.header),s||(i.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),n.icons&&i.children(".ui-accordion-header-icon").removeClass(n.icons.header).addClass(n.icons.activeHeader),i.next().addClass("ui-accordion-content-active"))},_toggle:function(t){var n=t.newPanel,r=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=n,this.prevHide=r,this.options.animate?this._animate(n,r,t):(r.hide(),n.show(),this._toggleComplete(t)),r.attr({"aria-expanded":"false","aria-hidden":"true"}),r.prev().attr("aria-selected","false"),n.length&&r.length?r.prev().attr("tabIndex",-1):n.length&&this.headers.filter(function(){return e(this).attr("tabIndex")===0}).attr("tabIndex",-1),n.attr({"aria-expanded":"true","aria-hidden":"false"}).prev().attr({"aria-selected":"true",tabIndex:0})},_animate:function(e,t,n){var s,o,u,a=this,f=0,l=e.length&&(!
 t.length||e.index()<t.index()),c=this.options.animate||{},h=l&&c.down||c,p=function(){a._toggleComplete(n)};typeof h=="number"&&(u=h),typeof h=="string"&&(o=h),o=o||h.easing||c.easing,u=u||h.duration||c.duration;if(!t.length)return e.animate(i,u,o,p);if(!e.length)return t.animate(r,u,o,p);s=e.show().outerHeight(),t.animate(r,{duration:u,easing:o,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(i,{duration:u,easing:o,complete:p,step:function(e,n){n.now=Math.round(e),n.prop!=="height"?f+=n.now:a.options.heightStyle!=="content"&&(n.now=Math.round(s-t.outerHeight()-f),f=0)}})},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),e.uiBackCompat!==!1&&(function(e,t){e.extend(t.options,{navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}
 });var n=t._create;t._create=function(){if(this.options.navigation){var t=this,r=this.element.find(this.options.header),i=r.next(),s=r.add(i).find("a").filter(this.options.navigationFilter)[0];s&&r.add(i).each(function(n){if(e.contains(this,s))return t.options.active=Math.floor(n/2),!1})}n.call(this)}}(jQuery,jQuery.ui.accordion.prototype),function(e,t){e.extend(t.options,{heightStyle:null,autoHeight:!0,clearStyle:!1,fillSpace:!1});var n=t._create,r=t._setOption;e.extend(t,{_create:function(){this.options.heightStyle=this.options.heightStyle||this._mergeHeightStyle(),n.call(this)},_setOption:function(e){if(e==="autoHeight"||e==="clearStyle"||e==="fillSpace")this.options.heightStyle=this._mergeHeightStyle();r.apply(this,arguments)},_mergeHeightStyle:function(){var e=this.options;if(e.fillSpace)return"fill";if(e.clearStyle)return"content";if(e.autoHeight)return"auto"}})}(jQuery,jQuery.ui.accordion.prototype),function(e,t){e.extend(t.options.icons,{activeHeader:null,headerSelected:"ui-
 icon-triangle-1-s"});var n=t._createIcons;t._createIcons=function(){this.options.icons&&(this.options.icons.activeHeader=this.options.icons.activeHeader||this.options.icons.headerSelected),n.call(this)}}(jQuery,jQuery.ui.accordion.prototype),function(e,t){t.activate=t._activate;var n=t._findActive;t._findActive=function(e){return e===-1&&(e=!1),e&&typeof e!="number"&&(e=this.headers.index(this.headers.filter(e)),e===-1&&(e=!1)),n.call(this,e)}}(jQuery,jQuery.ui.accordion.prototype),jQuery.ui.accordion.prototype.resize=jQuery.ui.accordion.prototype.refresh,function(e,t){e.extend(t.options,{change:null,changestart:null});var n=t._trigger;t._trigger=function(e,t,r){var i=n.apply(this,arguments);return i?(e==="beforeActivate"?i=n.call(this,"changestart",t,{oldHeader:r.oldHeader,oldContent:r.oldPanel,newHeader:r.newHeader,newContent:r.newPanel}):e==="activate"&&(i=n.call(this,"change",t,{oldHeader:r.oldHeader,oldContent:r.oldPanel,newHeader:r.newHeader,newContent:r.newPanel})),i):!1}}(jQ
 uery,jQuery.ui.accordion.prototype),function(e,t){e.extend(t.options,{animate:null,animated:"slide"});var n=t._create;t._create=function(){var e=this.options;e.animate===null&&(e.animated?e.animated==="slide"?e.animate=300:e.animated==="bounceslide"?e.animate={duration:200,down:{easing:"easeOutBounce",duration:1e3}}:e.animate=e.animated:e.animate=!1),n.call(this)}}(jQuery,jQuery.ui.accordion.prototype))})(jQuery);(function(e,t){var n=0;e.widget("ui.autocomplete",{version:"1.9.1",defaultElement:"<input>",options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var t,n,r;this.isMultiLine=this._isMultiLine(),this.valueMethod=this.element[this.element.is("input,textarea")?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydo
 wn:function(i){if(this.element.prop("readOnly")){t=!0,r=!0,n=!0;return}t=!1,r=!1,n=!1;var s=e.ui.keyCode;switch(i.keyCode){case s.PAGE_UP:t=!0,this._move("previousPage",i);break;case s.PAGE_DOWN:t=!0,this._move("nextPage",i);break;case s.UP:t=!0,this._keyEvent("previous",i);break;case s.DOWN:t=!0,this._keyEvent("next",i);break;case s.ENTER:case s.NUMPAD_ENTER:this.menu.active&&(t=!0,i.preventDefault(),this.menu.select(i));break;case s.TAB:this.menu.active&&this.menu.select(i);break;case s.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(i),i.preventDefault());break;default:n=!0,this._searchTimeout(i)}},keypress:function(r){if(t){t=!1,r.preventDefault();return}if(n)return;var i=e.ui.keyCode;switch(r.keyCode){case i.PAGE_UP:this._move("previousPage",r);break;case i.PAGE_DOWN:this._move("nextPage",r);break;case i.UP:this._keyEvent("previous",r);break;case i.DOWN:this._keyEvent("next",r)}},input:function(e){if(r){r=!1,e.preventDefault();return}this._searchTime
 out(e)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){if(this.cancelBlur){delete this.cancelBlur;return}clearTimeout(this.searching),this.close(e),this._change(e)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete").appendTo(this.document.find(this.options.appendTo||"body")[0]).menu({input:e(),role:null}).zIndex(this.element.zIndex()+1).hide().data("menu"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var n=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(r){r.target!==t.element[0]&&r.target!==n&&!e.contains(n,r.target)&&t.close()})})},menufocus:function(t,n){if(this.isNewMenu){this.isNewMenu=!1;if(t.originalEvent&&/^mouse/.test(t.originalEvent.type)){this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)});ret
 urn}}var r=n.item.data("ui-autocomplete-item")||n.item.data("item.autocomplete");!1!==this._trigger("focus",t,{item:r})?t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(r.value):this.liveRegion.text(r.value)},menuselect:function(e,t){var n=t.item.data("ui-autocomplete-item")||t.item.data("item.autocomplete"),r=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=r,this._delay(function(){this.previous=r,this.selectedItem=n})),!1!==this._trigger("select",e,{item:n})&&this._value(n.value),this.term=this._value(),this.close(e),this.selectedItem=n}}),this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("ui-helper-hidden-accessible").insertAfter(this.element),e.fn.bgiframe&&this.menu.element.bgiframe(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocom
 plete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),e==="source"&&this._initSource(),e==="appendTo"&&this.menu.element.appendTo(this.document.find(t||"body")[0]),e==="disabled"&&t&&this.xhr&&this.xhr.abort()},_isMultiLine:function(){return this.element.is("textarea")?!0:this.element.is("input")?!1:this.element.prop("isContentEditable")},_initSource:function(){var t,n,r=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(n,r){r(e.ui.autocomplete.filter(t,n.term))}):typeof this.options.source=="string"?(n=this.options.source,this.source=function(t,i){r.xhr&&r.xhr.abort(),r.xhr=e.ajax({url:n,data:t,dataType:"json",success:function(e){i(e)},error:function(){i([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){this.term!==this._value()&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){e=e
 !=null?e:this._value(),this.term=this._value();if(e.length<this.options.minLength)return this.close(t);if(this._trigger("search",t)===!1)return;return this._search(e)},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var e=this,t=++n;return function(r){t===n&&e.__response(r),e.pending--,e.pending||e.element.removeClass("ui-autocomplete-loading")}},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){retu
 rn t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return typeof t=="string"?{label:t,value:t}:e.extend({label:t.label||t.value,value:t.value||t.label},t)})},_suggest:function(t){var n=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(n,t),this.menu.refresh(),n.show(),this._resizeMenu(),n.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,n){var r=this;e.each(n,function(e,n){r._renderItemData(t,n)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,n){return e("<li>").append(e("<a>").text(n.label)).appendTo(t)},_move:function(e,t){if(!this.menu.element.is(":visible")){this.search(null,t);return}if(this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)){this._val
 ue(this.term),this.menu.blur();return}this.menu[e](t)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){if(!this.isMultiLine||this.menu.element.is(":visible"))this._move(e,t),t.preventDefault()}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,n){var r=new RegExp(e.ui.autocomplete.escapeRegex(n),"i");return e.grep(t,function(e){return r.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var t;this._superApply(arguments);if(this.options.disabled||this.cancelSearch)return;e&&e.length?t=this.options.messages.results(e.length):t=this.options.messages.noResults,this.liveRegion.text(t)}})})(jQuery);(functi
 on(e,t){var n,r,i,s,o="ui-button ui-widget ui-state-default ui-corner-all",u="ui-state-hover ui-state-active ",a="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",f=function(){var t=e(this).find(":ui-button");setTimeout(function(){t.button("refresh")},1)},l=function(t){var n=t.name,r=t.form,i=e([]);return n&&(r?i=e(r).find("[name='"+n+"']"):i=e("[name='"+n+"']",t.ownerDocument).filter(function(){return!this.form})),i};e.widget("ui.button",{version:"1.9.1",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,f),typeof this.options.disabled!="boolean"?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title
 ");var t=this,u=this.options,a=this.type==="checkbox"||this.type==="radio",c="ui-state-hover"+(a?"":" ui-state-active"),h="ui-state-focus";u.label===null&&(u.label=this.type==="input"?this.buttonElement.val():this.buttonElement.html()),this.buttonElement.addClass(o).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){if(u.disabled)return;e(this).addClass("ui-state-hover"),this===n&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){if(u.disabled)return;e(this).removeClass(c)}).bind("click"+this.eventNamespace,function(e){u.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this.element.bind("focus"+this.eventNamespace,function(){t.buttonElement.addClass(h)}).bind("blur"+this.eventNamespace,function(){t.buttonElement.removeClass(h)}),a&&(this.element.bind("change"+this.eventNamespace,function(){if(s)return;t.refresh()}),this.buttonElement.bind("mousedown"+this.eventNamespace,function(e){if(u.disabled)return;s=!1,r=e.pa
 geX,i=e.pageY}).bind("mouseup"+this.eventNamespace,function(e){if(u.disabled)return;if(r!==e.pageX||i!==e.pageY)s=!0})),this.type==="checkbox"?this.buttonElement.bind("click"+this.eventNamespace,function(){if(u.disabled||s)return!1;e(this).toggleClass("ui-state-active"),t.buttonElement.attr("aria-pressed",t.element[0].checked)}):this.type==="radio"?this.buttonElement.bind("click"+this.eventNamespace,function(){if(u.disabled||s)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var n=t.element[0];l(n).not(n).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){if(u.disabled)return!1;e(this).addClass("ui-state-active"),n=this,t.document.one("mouseup",function(){n=null})}).bind("mouseup"+this.eventNamespace,function(){if(u.disabled)return!1;e(this).removeClass("ui-state-active")}).bind("keydown"+this.eventNamespace,functi
 on(t){if(u.disabled)return!1;(t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active")}).bind("keyup"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",u.disabled),this._resetButton()},_determineButtonType:function(){var e,t,n;this.element.is("[type=checkbox]")?this.type="checkbox":this.element.is("[type=radio]")?this.type="radio":this.element.is("input")?this.type="input":this.type="button",this.type==="checkbox"||this.type==="radio"?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),n=this.element.is(":che
 cked"),n&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",n)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(o+" "+u+" "+a).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){this._super(e,t);if(e==="disabled"){t?this.element.prop("disabled",!0):this.element.prop("disabled",!1);return}this._resetButton()},refresh:function(){var t=this.element.is(":disabled")||this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),this.type==="radio"?l(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-p
 ressed","false")}):this.type==="checkbox"&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if(this.type==="input"){this.options.label&&this.element.val(this.options.label);return}var t=this.buttonElement.removeClass(a),n=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),r=this.options.icons,i=r.primary&&r.secondary,s=[];r.primary||r.secondary?(this.options.text&&s.push("ui-button-text-icon"+(i?"s":r.primary?"-primary":"-secondary")),r.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+r.primary+"'></span>"),r.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+r.secondary+"'></span>"),this.options.text||(s.push(i?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(n)))):s.push("ui-button-text-only")
 ,t.addClass(s.join(" "))}}),e.widget("ui.buttonset",{version:"1.9.1",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){e==="disabled"&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-le
 ft ui-corner-right").end().button("destroy")}})})(jQuery);(function($,undefined){function Datepicker(){this.debug=!1,this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday"
 ,"Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},$.extend(this._defaults,this.regional[""]),this.dpDiv=bindHover($('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui
 -widget-content ui-helper-clearfix ui-corner-all"></div>'))}function bindHover(e){var t="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.delegate(t,"mouseout",function(){$(this).removeClass("ui-state-hover"),this.className.indexOf("ui-datepicker-prev")!=-1&&$(this).removeClass("ui-datepicker-prev-hover"),this.className.indexOf("ui-datepicker-next")!=-1&&$(this).removeClass("ui-datepicker-next-hover")}).delegate(t,"mouseover",function(){$.datepicker._isDisabledDatepicker(instActive.inline?e.parent()[0]:instActive.input[0])||($(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),$(this).addClass("ui-state-hover"),this.className.indexOf("ui-datepicker-prev")!=-1&&$(this).addClass("ui-datepicker-prev-hover"),this.className.indexOf("ui-datepicker-next")!=-1&&$(this).addClass("ui-datepicker-next-hover"))})}function extendRemove(e,t){$.extend(e,t);for(var n in t)if(t[n]==null||t[n]==undefined)e[n]=t[n];return e}$.extend(
 $.ui,{datepicker:{version:"1.9.1"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return extendRemove(this._defaults,e||{}),this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},_newInst:
 function(e,t){var n=e[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:n,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:t,dpDiv:t?bindHover($('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')):this.dpDiv}},_connectDatepicker:function(e,t){var n=$(e);t.append=$([]),t.trigger=$([]);if(n.hasClass(this.markerClassName))return;this._attachments(n,t),n.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,n,r){t.settings[n]=r}).bind("getData.datepicker",function(e,n){return this._get(t,n)}),this._autoSize(t),$.data(e,PROP_NAME,t),t.settings.disabled&&this._disableDatepicker(e)},_attachments:function(e,t){var n=this._get(t,"appendText"),r=this._get(t,"isRTL");t.append&&t.append.remove(),n&&(t.append=$('<span class="'+this._appendClass+'">'+n+"</span>"),e[r?"before":"after"](t.append)),e.unbind("
 focus",this._showDatepicker),t.trigger&&t.trigger.remove();var i=this._get(t,"showOn");(i=="focus"||i=="both")&&e.focus(this._showDatepicker);if(i=="button"||i=="both"){var s=this._get(t,"buttonText"),o=this._get(t,"buttonImage");t.trigger=$(this._get(t,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:o,alt:s,title:s}):$('<button type="button"></button>').addClass(this._triggerClass).html(o==""?s:$("<img/>").attr({src:o,alt:s,title:s}))),e[r?"before":"after"](t.trigger),t.trigger.click(function(){return $.datepicker._datepickerShowing&&$.datepicker._lastInput==e[0]?$.datepicker._hideDatepicker():$.datepicker._datepickerShowing&&$.datepicker._lastInput!=e[0]?($.datepicker._hideDatepicker(),$.datepicker._showDatepicker(e[0])):$.datepicker._showDatepicker(e[0]),!1})}},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t=new Date(2009,11,20),n=this._get(e,"dateFormat");if(n.match(/[DM]/)){var r=function(e){var t=0,n=0;for(var r=0;r<e.length;r++)e[r].le
 ngth>t&&(t=e[r].length,n=r);return n};t.setMonth(r(this._get(e,n.match(/MM/)?"monthNames":"monthNamesShort"))),t.setDate(r(this._get(e,n.match(/DD/)?"dayNames":"dayNamesShort"))+20-t.getDay())}e.input.attr("size",this._formatDate(e,t).length)}},_inlineDatepicker:function(e,t){var n=$(e);if(n.hasClass(this.markerClassName))return;n.addClass(this.markerClassName).append(t.dpDiv).bind("setData.datepicker",function(e,n,r){t.settings[n]=r}).bind("getData.datepicker",function(e,n){return this._get(t,n)}),$.data(e,PROP_NAME,t),this._setDate(t,this._getDefaultDate(t),!0),this._updateDatepicker(t),this._updateAlternate(t),t.settings.disabled&&this._disableDatepicker(e),t.dpDiv.css("display","block")},_dialogDatepicker:function(e,t,n,r,i){var s=this._dialogInst;if(!s){this.uuid+=1;var o="dp"+this.uuid;this._dialogInput=$('<input type="text" id="'+o+'" style="position: absolute; top: -100px; width: 0px;"/>'),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),s=this.
 _dialogInst=this._newInst(this._dialogInput,!1),s.settings={},$.data(this._dialogInput[0],PROP_NAME,s)}extendRemove(s.settings,r||{}),t=t&&t.constructor==Date?this._formatDate(s,t):t,this._dialogInput.val(t),this._pos=i?i.length?i:[i.pageX,i.pageY]:null;if(!this._pos){var u=document.documentElement.clientWidth,a=document.documentElement.clientHeight,f=document.documentElement.scrollLeft||document.body.scrollLeft,l=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[u/2-100+f,a/2-150+l]}return this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),s.settings.onSelect=n,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,s),this},_destroyDatepicker:function(e){var t=$(e),n=$.data(e,PROP_NAME);if(!t.hasClass(this.markerClassName))return;var r=e.nodeName.toLowerCase();$.removeData(e,PROP_NAME),r=="input"?(n.append.remove(),n.t
 rigger.remove(),t.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(r=="div"||r=="span")&&t.removeClass(this.markerClassName).empty()},_enableDatepicker:function(e){var t=$(e),n=$.data(e,PROP_NAME);if(!t.hasClass(this.markerClassName))return;var r=e.nodeName.toLowerCase();if(r=="input")e.disabled=!1,n.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(r=="div"||r=="span"){var i=t.children("."+this._inlineClass);i.children().removeClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)}this._disabledInputs=$.map(this._disabledInputs,function(t){return t==e?null:t})},_disableDatepicker:function(e){var t=$(e),n=$.data(e,PROP_NAME);if(!t.hasClass(this.markerClassName))return;var r=e.nodeName.toLowerCase();if(r=="input")e.disabled=!0,n.trigger.fi
 lter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(r=="div"||r=="span"){var i=t.children("."+this._inlineClass);i.children().addClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)}this._disabledInputs=$.map(this._disabledInputs,function(t){return t==e?null:t}),this._disabledInputs[this._disabledInputs.length]=e},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;t<this._disabledInputs.length;t++)if(this._disabledInputs[t]==e)return!0;return!1},_getInst:function(e){try{return $.data(e,PROP_NAME)}catch(t){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,t,n){var r=this._getInst(e);if(arguments.length==2&&typeof t=="string")return t=="defaults"?$.extend({},$.datepicker._defaults):r?t=="all"?$.extend({},r.settings):this._get(r,t):null;var i=t||{};typeof t=="string"&&(i={},i[t]=n);if(r){this._curInst==r&&this._hideDatepicker(
 );var s=this._getDateDatepicker(e,!0),o=this._getMinMaxDate(r,"min"),u=this._getMinMaxDate(r,"max");extendRemove(r.settings,i),o!==null&&i.dateFormat!==undefined&&i.minDate===undefined&&(r.settings.minDate=this._formatDate(r,o)),u!==null&&i.dateFormat!==undefined&&i.maxDate===undefined&&(r.settings.maxDate=this._formatDate(r,u)),this._attachments($(e),r),this._autoSize(r),this._setDate(r,s),this._updateAlternate(r),this._updateDatepicker(r)}},_changeDatepicker:function(e,t,n){this._optionDatepicker(e,t,n)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var n=this._getInst(e);n&&(this._setDate(n,t),this._updateDatepicker(n),this._updateAlternate(n))},_getDateDatepicker:function(e,t){var n=this._getInst(e);return n&&!n.inline&&this._setDateFromField(n,t),n?this._getDate(n):null},_doKeyDown:function(e){var t=$.datepicker._getInst(e.target),n=!0,r=t.dpDiv.is(".ui-datepicker-rtl");t._keyEvent=!0;if($.datepicker._datepi
 ckerShowing)switch(e.keyCode){case 9:$.datepicker._hideDatepicker(),n=!1;break;case 13:var i=$("td."+$.datepicker._dayOverClass+":not(."+$.datepicker._currentClass+")",t.dpDiv);i[0]&&$.datepicker._selectDay(e.target,t.selectedMonth,t.selectedYear,i[0]);var s=$.datepicker._get(t,"onSelect");if(s){var o=$.datepicker._formatDate(t);s.apply(t.input?t.input[0]:null,[o,t])}else $.datepicker._hideDatepicker();return!1;case 27:$.datepicker._hideDatepicker();break;case 33:$.datepicker._adjustDate(e.target,e.ctrlKey?-$.datepicker._get(t,"stepBigMonths"):-$.datepicker._get(t,"stepMonths"),"M");break;case 34:$.datepicker._adjustDate(e.target,e.ctrlKey?+$.datepicker._get(t,"stepBigMonths"):+$.datepicker._get(t,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&$.datepicker._clearDate(e.target),n=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&$.datepicker._gotoToday(e.target),n=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&$.datepicker._adjustDate(e.target,r?1:-1,"D
 "),n=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&$.datepicker._adjustDate(e.target,e.ctrlKey?-$.datepicker._get(t,"stepBigMonths"):-$.datepicker._get(t,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&$.datepicker._adjustDate(e.target,-7,"D"),n=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&$.datepicker._adjustDate(e.target,r?-1:1,"D"),n=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&$.datepicker._adjustDate(e.target,e.ctrlKey?+$.datepicker._get(t,"stepBigMonths"):+$.datepicker._get(t,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&$.datepicker._adjustDate(e.target,7,"D"),n=e.ctrlKey||e.metaKey;break;default:n=!1}else e.keyCode==36&&e.ctrlKey?$.datepicker._showDatepicker(this):n=!1;n&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var t=$.datepicker._getInst(e.target);if($.datepicker._get(t,"constrainInput")){var n=$.datepicker._possibleChars($.datepicker._get(t,"dateFormat")),r=String.fromCharCode(e.charCode==undefined?e.keyCode:e.char
 Code);return e.ctrlKey||e.metaKey||r<" "||!n||n.indexOf(r)>-1}},_doKeyUp:function(e){var t=$.datepicker._getInst(e.target);if(t.input.val()!=t.lastVal)try{var n=$.datepicker.parseDate($.datepicker._get(t,"dateFormat"),t.input?t.input.val():null,$.datepicker._getFormatConfig(t));n&&($.datepicker._setDateFromField(t),$.datepicker._updateAlternate(t),$.datepicker._updateDatepicker(t))}catch(r){$.datepicker.log(r)}return!0},_showDatepicker:function(e){e=e.target||e,e.nodeName.toLowerCase()!="input"&&(e=$("input",e.parentNode)[0]);if($.datepicker._isDisabledDatepicker(e)||$.datepicker._lastInput==e)return;var t=$.datepicker._getInst(e);$.datepicker._curInst&&$.datepicker._curInst!=t&&($.datepicker._curInst.dpDiv.stop(!0,!0),t&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var n=$.datepicker._get(t,"beforeShow"),r=n?n.apply(e,[e,t]):{};if(r===!1)return;extendRemove(t.settings,r),t.lastVal=null,$.datepicker._lastInput=e,$.datepicker._setDate
 FromField(t),$.datepicker._inDialog&&(e.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(e),$.datepicker._pos[1]+=e.offsetHeight);var i=!1;$(e).parents().each(function(){return i|=$(this).css("position")=="fixed",!i});var s={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,t.dpDiv.empty(),t.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(t),s=$.datepicker._checkOffset(t,s,i),t.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":i?"fixed":"absolute",display:"none",left:s.left+"px",top:s.top+"px"});if(!t.inline){var o=$.datepicker._get(t,"showAnim"),u=$.datepicker._get(t,"duration"),a=function(){var e=t.dpDiv.find("iframe.ui-datepicker-cover");if(!!e.length){var n=$.datepicker._getBorders(t.dpDiv);e.css({left:-n[0],top:-n[1],width:t.dpDiv.outerWidth(),height:t.dpDiv.outerHeight()})}};t.dpDiv.zIndex($(e).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&($.effects.effect[o]||
 $.effects[o])?t.dpDiv.show(o,$.datepicker._get(t,"showOptions"),u,a):t.dpDiv[o||"show"](o?u:null,a),(!o||!u)&&a(),t.input.is(":visible")&&!t.input.is(":disabled")&&t.input.focus(),$.datepicker._curInst=t}},_updateDatepicker:function(e){this.maxRows=4;var t=$.datepicker._getBorders(e.dpDiv);instActive=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var n=e.dpDiv.find("iframe.ui-datepicker-cover");!n.length||n.css({left:-t[0],top:-t[1],width:e.dpDiv.outerWidth(),height:e.dpDiv.outerHeight()}),e.dpDiv.find("."+this._dayOverClass+" a").mouseover();var r=this._getNumberOfMonths(e),i=r[1],s=17;e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),i>1&&e.dpDiv.addClass("ui-datepicker-multi-"+i).css("width",s*i+"em"),e.dpDiv[(r[0]!=1||r[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e==$.datepicker._curInst&&$.datepicker._datepickerShowing&&
 e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&e.input[0]!=document.activeElement&&e.input.focus();if(e.yearshtml){var o=e.yearshtml;setTimeout(function(){o===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),o=e.yearshtml=null},0)}},_getBorders:function(e){var t=function(e){return{thin:1,medium:2,thick:3}[e]||e};return[parseFloat(t(e.css("border-left-width"))),parseFloat(t(e.css("border-top-width")))]},_checkOffset:function(e,t,n){var r=e.dpDiv.outerWidth(),i=e.dpDiv.outerHeight(),s=e.input?e.input.outerWidth():0,o=e.input?e.input.outerHeight():0,u=document.documentElement.clientWidth+(n?0:$(document).scrollLeft()),a=document.documentElement.clientHeight+(n?0:$(document).scrollTop());return t.left-=this._get(e,"isRTL")?r-s:0,t.left-=n&&t.left==e.input.offset().left?$(document).scrollLeft():0,t.top-=n&&t.top==e.input.offset().top+o?$(document).scrollTop():0,t.left-=Math.min(t.left,t.left+r>u&&u>r?Math.abs(t.left+r-u):0),t.
 top-=Math.min(t.top,t.top+i>a&&a>i?Math.abs(i+o):0),t},_findPos:function(e){var t=this._getInst(e),n=this._get(t,"isRTL");while(e&&(e.type=="hidden"||e.nodeType!=1||$.expr.filters.hidden(e)))e=e[n?"previousSibling":"nextSibling"];var r=$(e).offset();return[r.left,r.top]},_hideDatepicker:function(e){var t=this._curInst;if(!t||e&&t!=$.data(e,PROP_NAME))return;if(this._datepickerShowing){var n=this._get(t,"showAnim"),r=this._get(t,"duration"),i=function(){$.datepicker._tidyDialog(t)};$.effects&&($.effects.effect[n]||$.effects[n])?t.dpDiv.hide(n,$.datepicker._get(t,"showOptions"),r,i):t.dpDiv[n=="slideDown"?"slideUp":n=="fadeIn"?"fadeOut":"hide"](n?r:null,i),n||i(),this._datepickerShowing=!1;var s=this._get(t,"onClose");s&&s.apply(t.input?t.input[0]:null,[t.input?t.input.val():"",t]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1}},_tidyDialog:function(e){
 e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(!$.datepicker._curInst)return;var t=$(e.target),n=$.datepicker._getInst(t[0]);(t[0].id!=$.datepicker._mainDivId&&t.parents("#"+$.datepicker._mainDivId).length==0&&!t.hasClass($.datepicker.markerClassName)&&!t.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||t.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=n)&&$.datepicker._hideDatepicker()},_adjustDate:function(e,t,n){var r=$(e),i=this._getInst(r[0]);if(this._isDisabledDatepicker(r[0]))return;this._adjustInstDate(i,t+(n=="M"?this._get(i,"showCurrentAtPos"):0),n),this._updateDatepicker(i)},_gotoToday:function(e){var t=$(e),n=this._getInst(t[0]);if(this._get(n,"gotoCurrent")&&n.currentDay)n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear;else{var r=new Date;n.selectedDay=r.getDate(),
 n.drawMonth=n.selectedMonth=r.getMonth(),n.drawYear=n.selectedYear=r.getFullYear()}this._notifyChange(n),this._adjustDate(t)},_selectMonthYear:function(e,t,n){var r=$(e),i=this._getInst(r[0]);i["selected"+(n=="M"?"Month":"Year")]=i["draw"+(n=="M"?"Month":"Year")]=parseInt(t.options[t.selectedIndex].value,10),this._notifyChange(i),this._adjustDate(r)},_selectDay:function(e,t,n,r){var i=$(e);if($(r).hasClass(this._unselectableClass)||this._isDisabledDatepicker(i[0]))return;var s=this._getInst(i[0]);s.selectedDay=s.currentDay=$("a",r).html(),s.selectedMonth=s.currentMonth=t,s.selectedYear=s.currentYear=n,this._selectDate(e,this._formatDate(s,s.currentDay,s.currentMonth,s.currentYear))},_clearDate:function(e){var t=$(e),n=this._getInst(t[0]);this._selectDate(t,"")},_selectDate:function(e,t){var n=$(e),r=this._getInst(n[0]);t=t!=null?t:this._formatDate(r),r.input&&r.input.val(t),this._updateAlternate(r);var i=this._get(r,"onSelect");i?i.apply(r.input?r.input[0]:null,[t,r]):r.input&&r.inp
 ut.trigger("change"),r.inline?this._updateDatepicker(r):(this._hideDatepicker(),this._lastInput=r.input[0],typeof r.input[0]!="object"&&r.input.focus(),this._lastInput=null)},_updateAlternate:function(e){var t=this._get(e,"altField");if(t){var n=this._get(e,"altFormat")||this._get(e,"dateFormat"),r=this._getDate(e),i=this.formatDate(n,r,this._getFormatConfig(e));$(t).each(function(){$(this).val(i)})}},noWeekends:function(e){var t=e.getDay();return[t>0&&t<6,""]},iso8601Week:function(e){var t=new Date(e.getTime());t.setDate(t.getDate()+4-(t.getDay()||7));var n=t.getTime();return t.setMonth(0),t.setDate(1),Math.floor(Math.round((n-t)/864e5)/7)+1},parseDate:function(e,t,n){if(e==null||t==null)throw"Invalid arguments";t=typeof t=="object"?t.toString():t+"";if(t=="")return null;var r=(n?n.shortYearCutoff:null)||this._defaults.shortYearCutoff;r=typeof r!="string"?r:(new Date).getFullYear()%100+parseInt(r,10);var i=(n?n.dayNamesShort:null)||this._defaults.dayNamesShort,s=(n?n.dayNames:null)
 ||this._defaults.dayNames,o=(n?n.monthNamesShort:null)||this._defaults.monthNamesShort,u=(n?n.monthNames:null)||this._defaults.monthNames,a=-1,f=-1,l=-1,c=-1,h=!1,p=function(t){var n=y+1<e.length&&e.charAt(y+1)==t;return n&&y++,n},d=function(e){var n=p(e),r=e=="@"?14:e=="!"?20:e=="y"&&n?4:e=="o"?3:2,i=new RegExp("^\\d{1,"+r+"}"),s=t.substring(g).match(i);if(!s)throw"Missing number at position "+g;return g+=s[0].length,parseInt(s[0],10)},v=function(e,n,r){var i=$.map(p(e)?r:n,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)}),s=-1;$.each(i,function(e,n){var r=n[1];if(t.substr(g,r.length).toLowerCase()==r.toLowerCase())return s=n[0],g+=r.length,!1});if(s!=-1)return s+1;throw"Unknown name at position "+g},m=function(){if(t.charAt(g)!=e.charAt(y))throw"Unexpected literal at position "+g;g++},g=0;for(var y=0;y<e.length;y++)if(h)e.charAt(y)=="'"&&!p("'")?h=!1:m();else switch(e.charAt(y)){case"d":l=d("d");break;case"D":v("D",i,s);break;case"o":c=d("o");brea
 k;case"m":f=d("m");break;case"M":f=v("M",o,u);break;case"y":a=d("y");break;case"@":var b=new Date(d("@"));a=b.getFullYear(),f=b.getMonth()+1,l=b.getDate();break;case"!":var b=new Date((d("!")-this._ticksTo1970)/1e4);a=b.getFullYear(),f=b.getMonth()+1,l=b.getDate();break;case"'":p("'")?m():h=!0;break;default:m()}if(g<t.length){var w=t.substr(g);if(!/^\s+/.test(w))throw"Extra/unparsed characters found in date: "+w}a==-1?a=(new Date).getFullYear():a<100&&(a+=(new Date).getFullYear()-(new Date).getFullYear()%100+(a<=r?0:-100));if(c>-1){f=1,l=c;do{var E=this._getDaysInMonth(a,f-1);if(l<=E)break;f++,l-=E}while(!0)}var b=this._daylightSavingAdjust(new Date(a,f-1,l));if(b.getFullYear()!=a||b.getMonth()+1!=f||b.getDate()!=l)throw"Invalid date";return b},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floo
 r(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(e,t,n){if(!t)return"";var r=(n?n.dayNamesShort:null)||this._defaults.dayNamesShort,i=(n?n.dayNames:null)||this._defaults.dayNames,s=(n?n.monthNamesShort:null)||this._defaults.monthNamesShort,o=(n?n.monthNames:null)||this._defaults.monthNames,u=function(t){var n=h+1<e.length&&e.charAt(h+1)==t;return n&&h++,n},a=function(e,t,n){var r=""+t;if(u(e))while(r.length<n)r="0"+r;return r},f=function(e,t,n,r){return u(e)?r[t]:n[t]},l="",c=!1;if(t)for(var h=0;h<e.length;h++)if(c)e.charAt(h)=="'"&&!u("'")?c=!1:l+=e.charAt(h);else switch(e.charAt(h)){case"d":l+=a("d",t.getDate(),2);break;case"D":l+=f("D",t.getDay(),r,i);break;case"o":l+=a("o",Math.round(((new Date(t.getFullYear(),t.getMonth(),t.getDate())).getTime()-(new Date(t.getFullYear(),0,0)).getTime())/864e5),3);break;case"m":l+=a("m",t.getMonth()+1,2);break;case"M":l+=f("M",t.getMonth(),s,o);break;case"y":l+=u("y")?t.getFullYear():(t.getYear()%100<10?"0":"")+t.ge
 tYear()%100;break;case"@":l+=t.getTime();break;case"!":l+=t.getTime()*1e4+this._ticksTo1970;break;case"'":u("'")?l+="'":c=!0;break;default:l+=e.charAt(h)}return l},_possibleChars:function(e){var t="",n=!1,r=function(t){var n=i+1<e.length&&e.charAt(i+1)==t;return n&&i++,n};for(var i=0;i<e.length;i++)if(n)e.charAt(i)=="'"&&!r("'")?n=!1:t+=e.charAt(i);else switch(e.charAt(i)){case"d":case"m":case"y":case"@":t+="0123456789";break;case"D":case"M":return null;case"'":r("'")?t+="'":n=!0;break;default:t+=e.charAt(i)}return t},_get:function(e,t){return e.settings[t]!==undefined?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()==e.lastVal)return;var n=this._get(e,"dateFormat"),r=e.lastVal=e.input?e.input.val():null,i,s;i=s=this._getDefaultDate(e);var o=this._getFormatConfig(e);try{i=this.parseDate(n,r,o)||s}catch(u){this.log(u),r=t?"":r}e.selectedDay=i.getDate(),e.drawMonth=e.selectedMonth=i.getMonth(),e.drawYear=e.selectedYear=i.getFullYear(),e.currentDay=r?i.
 getDate():0,e.currentMonth=r?i.getMonth():0,e.currentYear=r?i.getFullYear():0,this._adjustInstDate(e)},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(e,t,n){var r=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},i=function(t){try{return $.datepicker.parseDate($.datepicker._get(e,"dateFormat"),t,$.datepicker._getFormatConfig(e))}catch(n){}var r=(t.toLowerCase().match(/^c/)?$.datepicker._getDate(e):null)||new Date,i=r.getFullYear(),s=r.getMonth(),o=r.getDate(),u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,a=u.exec(t);while(a){switch(a[2]||"d"){case"d":case"D":o+=parseInt(a[1],10);break;case"w":case"W":o+=parseInt(a[1],10)*7;break;case"m":case"M":s+=parseInt(a[1],10),o=Math.min(o,$.datepicker._getDaysInMonth(i,s));break;case"y":case"Y":i+=parseInt(a[1],10),o=Math.min(o,$.datepicker._getDaysInMonth(i,s))}a=u.exec(t)}return new Date(i,s,o)},s=t==null||t===""?n:typeof t=="string"?i(t):ty
 peof t=="number"?isNaN(t)?n:r(t):new Date(t.getTime());return s=s&&s.toString()=="Invalid Date"?n:s,s&&(s.setHours(0),s.setMinutes(0),s.setSeconds(0),s.setMilliseconds(0)),this._daylightSavingAdjust(s)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,n){var r=!t,i=e.selectedMonth,s=e.selectedYear,o=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=o.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=o.getMonth(),e.drawYear=e.selectedYear=e.currentYear=o.getFullYear(),(i!=e.selectedMonth||s!=e.selectedYear)&&!n&&this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(r?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&e.input.val()==""?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(e){var t=this._get(e,"stepMonths"),n="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data
 -handler]").map(function(){var e={prev:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(n,-t,"M")},next:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(n,+t,"M")},hide:function(){window["DP_jQuery_"+dpuuid].datepicker._hideDatepicker()},today:function(){window["DP_jQuery_"+dpuuid].datepicker._gotoToday(n)},selectDay:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectDay(n,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(n,this,"M"),!1},selectYear:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(n,this,"Y"),!1}};$(this).bind(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t=new Date;t=this._daylightSavingAdjust(new Date(t.getFullYear(),t.getMonth(),t.getDate()));var n=this._get(e,"isRTL"),r=this._get(e,"showButtonPanel"),i=this._get(e,"hideIfNoPrevNext"),s
 =this._get(e,"navigationAsDateFormat"),o=this._getNumberOfMonths(e),u=this._get(e,"showCurrentAtPos"),a=this._get(e,"stepMonths"),f=o[0]!=1||o[1]!=1,l=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),c=this._getMinMaxDate(e,"min"),h=this._getMinMaxDate(e,"max"),p=e.drawMonth-u,d=e.drawYear;p<0&&(p+=12,d--);if(h){var v=this._daylightSavingAdjust(new Date(h.getFullYear(),h.getMonth()-o[0]*o[1]+1,h.getDate()));v=c&&v<c?c:v;while(this._daylightSavingAdjust(new Date(d,p,1))>v)p--,p<0&&(p=11,d--)}e.drawMonth=p,e.drawYear=d;var m=this._get(e,"prevText");m=s?this.formatDate(m,this._daylightSavingAdjust(new Date(d,p-a,1)),this._getFormatConfig(e)):m;var g=this._canAdjustMonth(e,-1,d,p)?'<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click" title="'+m+'"><span class="ui-icon ui-icon-circle-triangle-'+(n?"e":"w")+'">'+m+"</span></a>":i?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" ti
 tle="'+m+'"><span class="ui-icon ui-icon-circle-triangle-'+(n?"e":"w")+'">'+m+"</span></a>",y=this._get(e,"nextText");y=s?this.formatDate(y,this._daylightSavingAdjust(new Date(d,p+a,1)),this._getFormatConfig(e)):y;var b=this._canAdjustMonth(e,1,d,p)?'<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click" title="'+y+'"><span class="ui-icon ui-icon-circle-triangle-'+(n?"w":"e")+'">'+y+"</span></a>":i?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+y+'"><span class="ui-icon ui-icon-circle-triangle-'+(n?"w":"e")+'">'+y+"</span></a>",w=this._get(e,"currentText"),E=this._get(e,"gotoCurrent")&&e.currentDay?l:t;w=s?this.formatDate(w,E,this._getFormatConfig(e)):w;var S=e.inline?"":'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">'+this._get(e,"closeText")+"</button>",x=r?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(n?S:"")+(this._is
 InRange(e,E)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click">'+w+"</button>":"")+(n?"":S)+"</div>":"",T=parseInt(this._get(e,"firstDay"),10);T=isNaN(T)?0:T;var N=this._get(e,"showWeek"),C=this._get(e,"dayNames"),k=this._get(e,"dayNamesShort"),L=this._get(e,"dayNamesMin"),A=this._get(e,"monthNames"),O=this._get(e,"monthNamesShort"),M=this._get(e,"beforeShowDay"),_=this._get(e,"showOtherMonths"),D=this._get(e,"selectOtherMonths"),P=this._get(e,"calculateWeek")||this.iso8601Week,H=this._getDefaultDate(e),B="";for(var j=0;j<o[0];j++){var F="";this.maxRows=4;for(var I=0;I<o[1];I++){var q=this._daylightSavingAdjust(new Date(d,p,e.selectedDay)),R=" ui-corner-all",U="";if(f){U+='<div class="ui-datepicker-group';if(o[1]>1)switch(I){case 0:U+=" ui-datepicker-group-first",R=" ui-corner-"+(n?"right":"left");break;case o[1]-1:U+=" ui-datepicker-group-last",R=" ui-corner-"+(n?"left":"right");break;de
 fault:U+=" ui-datepicker-group-middle",R=""}U+='">'}U+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+R+'">'+(/all|left/.test(R)&&j==0?n?b:g:"")+(/all|right/.test(R)&&j==0?n?g:b:"")+this._generateMonthYearHeader(e,p,d,c,h,j>0||I>0,A,O)+'</div><table class="ui-datepicker-calendar"><thead>'+"<tr>";var z=N?'<th class="ui-datepicker-week-col">'+this._get(e,"weekHeader")+"</th>":"";for(var W=0;W<7;W++){var X=(W+T)%7;z+="<th"+((W+T+6)%7>=5?' class="ui-datepicker-week-end"':"")+">"+'<span title="'+C[X]+'">'+L[X]+"</span></th>"}U+=z+"</tr></thead><tbody>";var V=this._getDaysInMonth(d,p);d==e.selectedYear&&p==e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,V));var J=(this._getFirstDayOfMonth(d,p)-T+7)%7,K=Math.ceil((J+V)/7),Q=f?this.maxRows>K?this.maxRows:K:K;this.maxRows=Q;var G=this._daylightSavingAdjust(new Date(d,p,1-J));for(var Y=0;Y<Q;Y++){U+="<tr>";var Z=N?'<td class="ui-datepicker-week-col">'+this._get(e,"calculateWeek")(G)+"</td>":"";for(var W=0;W<7;W+
 +){var et=M?M.apply(e.input?e.input[0]:null,[G]):[!0,""],tt=G.getMonth()!=p,nt=tt&&!D||!et[0]||c&&G<c||h&&G>h;Z+='<td class="'+((W+T+6)%7>=5?" ui-datepicker-week-end":"")+(tt?" ui-datepicker-other-month":"")+(G.getTime()==q.getTime()&&p==e.selectedMonth&&e._keyEvent||H.getTime()==G.getTime()&&H.getTime()==q.getTime()?" "+this._dayOverClass:"")+(nt?" "+this._unselectableClass+" ui-state-disabled":"")+(tt&&!_?"":" "+et[1]+(G.getTime()==l.getTime()?" "+this._currentClass:"")+(G.getTime()==t.getTime()?" ui-datepicker-today":""))+'"'+((!tt||_)&&et[2]?' title="'+et[2]+'"':"")+(nt?"":' data-handler="selectDay" data-event="click" data-month="'+G.getMonth()+'" data-year="'+G.getFullYear()+'"')+">"+(tt&&!_?"&#xa0;":nt?'<span class="ui-state-default">'+G.getDate()+"</span>":'<a class="ui-state-default'+(G.getTime()==t.getTime()?" ui-state-highlight":"")+(G.getTime()==l.getTime()?" ui-state-active":"")+(tt?" ui-priority-secondary":"")+'" href="#">'+G.getDate()+"</a>")+"</td>",G.setDate(G.getDat
 e()+1),G=this._daylightSavingAdjust(G)}U+=Z+"</tr>"}p++,p>11&&(p=0,d++),U+="</tbody></table>"+(f?"</div>"+(o[0]>0&&I==o[1]-1?'<div class="ui-datepicker-row-break"></div>':""):""),F+=U}B+=F}return B+=x+($.ui.ie6&&!e.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':""),e._keyEvent=!1,B},_generateMonthYearHeader:function(e,t,n,r,i,s,o,u){var a=this._get(e,"changeMonth"),f=this._get(e,"changeYear"),l=this._get(e,"showMonthAfterYear"),c='<div class="ui-datepicker-title">',h="";if(s||!a)h+='<span class="ui-datepicker-month">'+o[t]+"</span>";else{var p=r&&r.getFullYear()==n,d=i&&i.getFullYear()==n;h+='<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">';for(var v=0;v<12;v++)(!p||v>=r.getMonth())&&(!d||v<=i.getMonth())&&(h+='<option value="'+v+'"'+(v==t?' selected="selected"':"")+">"+u[v]+"</option>");h+="</select>"}l||(c+=h+(s||!a||!f?"&#xa0;":""));if(!e.yearshtml){e.yearshtml="";if(s||!f)c+='<span class="ui-date
 picker-year">'+n+"</span>";else{var m=this._get(e,"yearRange").split(":"),g=(new Date).getFullYear(),y=function(e){var t=e.match(/c[+-].*/)?n+parseInt(e.substring(1),10):e.match(/[+-].*/)?g+parseInt(e,10):parseInt(e,10);return isNaN(t)?g:t},b=y(m[0]),w=Math.max(b,y(m[1]||""));b=r?Math.max(b,r.getFullYear()):b,w=i?Math.min(w,i.getFullYear()):w,e.yearshtml+='<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">';for(;b<=w;b++)e.yearshtml+='<option value="'+b+'"'+(b==n?' selected="selected"':"")+">"+b+"</option>";e.yearshtml+="</select>",c+=e.yearshtml,e.yearshtml=null}}return c+=this._get(e,"yearSuffix"),l&&(c+=(s||!a||!f?"&#xa0;":"")+h),c+="</div>",c},_adjustInstDate:function(e,t,n){var r=e.drawYear+(n=="Y"?t:0),i=e.drawMonth+(n=="M"?t:0),s=Math.min(e.selectedDay,this._getDaysInMonth(r,i))+(n=="D"?t:0),o=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(r,i,s)));e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.select
 edYear=o.getFullYear(),(n=="M"||n=="Y")&&this._notifyChange(e)},_restrictMinMax:function(e,t){var n=this._getMinMaxDate(e,"min"),r=this._getMinMaxDate(e,"max"),i=n&&t<n?n:t;return i=r&&i>r?r:i,i},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return t==null?[1,1]:typeof t=="number"?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return(new Date(e,t,1)).getDay()},_canAdjustMonth:function(e,t,n,r){var i=this._getNumberOfMonths(e),s=this._daylightSavingAdjust(new Date(n,r+(t<0?t:i[0]*i[1]),1));return t<0&&s.setDate(this._getDaysInMonth(s.getFullYear(),s.getMonth())),this._isInRange(e,s)},_isInRange:function(e,t){var n=this._getMinMaxDate(e,"min"),r=this._
 getMinMaxDate(e,"max");return(!n||t.getTime()>=n.getTime())&&(!r||t.getTime()<=r.getTime())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t=typeof t!="string"?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,n,r){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var i=t?typeof t=="object"?t:this._daylightSavingAdjust(new Date(r,n,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),i,this._getFormatConfig(e))}}),$.fn.datepicker=function(e){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find(document.body).append($.datepicker.dpDiv),$.datepicker.initialized=!0);var t=Array.p
 rototype.slice.call(arguments,1);return typeof e!="string"||e!="isDisabled"&&e!="getDate"&&e!="widget"?e=="option"&&arguments.length==2&&typeof arguments[1]=="string"?$.datepicker["_"+e+"Datepicker"].apply($.datepicker,[this[0]].concat(t)):this.each(function(){typeof e=="string"?$.datepicker["_"+e+"Datepicker"].apply($.datepicker,[this].concat(t)):$.datepicker._attachDatepicker(this,e)}):$.datepicker["_"+e+"Datepicker"].apply($.datepicker,[this[0]].concat(t))},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.9.1",window["DP_jQuery_"+dpuuid]=$})(jQuery);(function(e,t){var n="ui-dialog ui-widget ui-widget-content ui-corner-all ",r={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},i={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};e.widget("ui.dialog",{version:"1.9.1",options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"aut
 o",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var n=e(this).css(t).offset().top;n<0&&e(this).css("top",t.top-n)}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title"),typeof this.originalTitle!="string"&&(this.originalTitle=""),this.oldPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.options.title=this.options.title||this.originalTitle;var t=this,r=this.options,i=r.title||"&#160;",s,o,u,a,f;s=(this.uiDialog=e("<div>")).addClass(n+r.dialogClass).css({display:"none",outline:0,zIndex:r.zIndex}).attr("tabIndex",-1).keydown(function(n){r.closeOnEscape&&!n.isDefaultPrevented()&&n.keyCode&&n.keyCode===e.ui.keyCode.ESCAPE&&(t.close(n),n.preventDefault())}).mousedown(function(e){t.moveToTop(!1,e)}).appendTo("body"),this.element.show().removeAttr("title").addClass("ui-di
 alog-content ui-widget-content").appendTo(s),o=(this.uiDialogTitlebar=e("<div>")).addClass("ui-dialog-titlebar  ui-widget-header  ui-corner-all  ui-helper-clearfix").bind("mousedown",function(){s.focus()}).prependTo(s),u=e("<a href='#'></a>").addClass("ui-dialog-titlebar-close  ui-corner-all").attr("role","button").click(function(e){e.preventDefault(),t.close(e)}).appendTo(o),(this.uiDialogTitlebarCloseText=e("<span>")).addClass("ui-icon ui-icon-closethick").text(r.closeText).appendTo(u),a=e("<span>").uniqueId().addClass("ui-dialog-title").html(i).prependTo(o),f=(this.uiDialogButtonPane=e("<div>")).addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),(this.uiButtonSet=e("<div>")).addClass("ui-dialog-buttonset").appendTo(f),s.attr({role:"dialog","aria-labelledby":a.attr("id")}),o.find("*").add(o).disableSelection(),this._hoverable(u),this._focusable(u),r.draggable&&e.fn.draggable&&this._makeDraggable(),r.resizable&&e.fn.resizable&&this._makeResizable(),this._createBu
 ttons(r.buttons),this._isOpen=!1,e.fn.bgiframe&&s.bgiframe(),this._on(s,{keydown:function(t){if(!r.modal||t.keyCode!==e.ui.keyCode.TAB)return;var n=e(":tabbable",s),i=n.filter(":first"),o=n.filter(":last");if(t.target===o[0]&&!t.shiftKey)return i.focus(1),!1;if(t.target===i[0]&&t.shiftKey)return o.focus(1),!1}})},_init:function(){this.options.autoOpen&&this.open()},_destroy:function(){var e,t=this.oldPosition;this.overlay&&this.overlay.destroy(),this.uiDialog.hide(),this.element.removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},close:function(t){var n=this,r,i;if(!this._isOpen)return;if(!1===this._trigger("beforeClose",t))return;return this._isOpen=!1,this.overlay&&this.overlay.destroy(),this.options.hide?this._h
 ide(this.uiDialog,this.options.hide,function(){n._trigger("close",t)}):(this.uiDialog.hide(),this._trigger("close",t)),e.ui.dialog.overlay.resize(),this.options.modal&&(r=0,e(".ui-dialog").each(function(){this!==n.uiDialog[0]&&(i=e(this).css("z-index"),isNaN(i)||(r=Math.max(r,i)))}),e.ui.dialog.maxZ=r),this},isOpen:function(){return this._isOpen},moveToTop:function(t,n){var r=this.options,i;return r.modal&&!t||!r.stack&&!r.modal?this._trigger("focus",n):(r.zIndex>e.ui.dialog.maxZ&&(e.ui.dialog.maxZ=r.zIndex),this.overlay&&(e.ui.dialog.maxZ+=1,e.ui.dialog.overlay.maxZ=e.ui.dialog.maxZ,this.overlay.$el.css("z-index",e.ui.dialog.overlay.maxZ)),i={scrollTop:this.element.scrollTop(),scrollLeft:this.element.scrollLeft()},e.ui.dialog.maxZ+=1,this.uiDialog.css("z-index",e.ui.dialog.maxZ),this.element.attr(i),this._trigger("focus",n),this)},open:function(){if(this._isOpen)return;var t,n=this.options,r=this.uiDialog;return this._size(),this._position(n.position),r.show(n.show),this.overlay=n.
 modal?new e.ui.dialog.overlay(this):null,this.moveToTop(!0),t=this.element.find(":tabbable"),t.length||(t=this.uiDialogButtonPane.find(":tabbable"),t.length||(t=r)),t.eq(0).focus(),this._isOpen=!0,this._trigger("open"),this},_createButtons:function(t){var n=this,r=!1;this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),typeof t=="object"&&t!==null&&e.each(t,function(){return!(r=!0)}),r?(e.each(t,function(t,r){r=e.isFunction(r)?{click:r,text:t}:r;var i=e("<button type='button'></button>").attr(r,!0).unbind("click").click(function(){r.click.apply(n.element[0],arguments)}).appendTo(n.uiButtonSet);e.fn.button&&i.button()}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog)):this.uiDialog.removeClass("ui-dialog-buttons")},_makeDraggable:function(){function r(e){return{position:e.position,offset:e.offset}}var t=this,n=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",conta
 inment:"document",start:function(n,i){e(this).addClass("ui-dialog-dragging"),t._trigger("dragStart",n,r(i))},drag:function(e,n){t._trigger("drag",e,r(n))},stop:function(i,s){n.position=[s.position

<TRUNCATED>


[03/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/yarn.css
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/yarn.css b/slider-core/src/main/resources/webapps/static/yarn.css
deleted file mode 100644
index 1e9ca94..0000000
--- a/slider-core/src/main/resources/webapps/static/yarn.css
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-/* Styles for YARN */
-* { margin: 0; border: 0 }
-html, body { height: 100% }
-body { padding: 0; font: 90% sans-serif }
-.content { padding-right: 1em }
-.content h1, .content h2, .content h3 { margin: 0 0 0.3em; }
-/*.content h1, .content h2, .content h3 { margin: 0 0 0.3em; font-weight: normal }*/
-table { border-collapse: collapse; border-spacing: 0; width: 100% }
-table br { display: none }
-table.info th { text-align: right }
-.info-wrap { margin: 0 0 1em }
-th, td { padding: 0.2em 0.5em 0 }
-td.table { padding: 0 }
-.ui-dialog, .shadow {
-  -moz-box-shadow: 0 8px 38px #000;
-  -webkit-box-shadow: 0 8px 38px #000;
-  box-shadow: 0 8px 38px #000 }
-/* styles for common objects */
-#logo { float: left; position: relative; line-height: 0.5em; top: -1.3em }
-#user { float: right; position: relative; top: -1.5em; font-size: 0.77em }
-#header { padding: 1.5em 0.5em; text-align: center }
-#nav h3 { padding: 0 0 0 1.6em }
-#nav ul {
-  padding: 0.3em 1em 0.8em 2em; line-height: 0.5em; list-style: none;
-  line-height: 1.2em; font-size: 90% }
-#themeswitcher { margin: 1em 0.25em }
-#footer { padding: 1em; text-align: center }
-.bold { font-weight: bold; }
-
-
-div.role-info { width: 700px; padding-left: 15px; padding-top: 15px; margin-bottom: 2em; }
-
-div.role-stats-containers { width: 350px; margin-left: 2em; margin-bottom: 2em; }
-div.role-stats-containers table { margin-left: 0.5em; }
-div.role-stats-wrap { margin-bottom: 2em; margin-left: 2em; width: 200px; }
-div.role-stats-wrap table { margin-left: 0.5em; width: 200px }
-div.role-options-wrap { margin-left: 2em; margin-bottom: 2em; width: 350px; }
-div.role-options-wrap table { margin-left: 0.5em; }
-
-.no-table-contents { padding-left: 0.5em; }
-
-h1.index_header { margin-bottom: 15px; }
-div.general_info { margin-bottom: 15px; }
-div.container_instances { margin-bottom: 15px; }
-div.diagnostics { margin-bottom: 15px; }
-div.provider_info { margin-bottom: 15px; }
-
-div.cluster_json pre { white-space: pre-wrap; }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/yarn.dt.plugins.js
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/yarn.dt.plugins.js b/slider-core/src/main/resources/webapps/static/yarn.dt.plugins.js
deleted file mode 100644
index 6b8d16c..0000000
--- a/slider-core/src/main/resources/webapps/static/yarn.dt.plugins.js
+++ /dev/null
@@ -1,146 +0,0 @@
-
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements.  See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-if (!jQuery.fn.dataTableExt.fnVersionCheck("1.7.5")) {
-  alert("These plugins requires dataTables 1.7.5+");
-}
-
-// don't filter on hidden html elements for an sType of title-numeric
-$.fn.dataTableExt.ofnSearch['title-numeric'] = function ( sData ) {
-   return sData.replace(/\n/g," ").replace( /<.*?>/g, "" );
-};
-
-// 'title-numeric' sort type
-jQuery.fn.dataTableExt.oSort['title-numeric-asc']  = function(a,b) {
-  var x = a.match(/title=["']?(-?\d+\.?\d*)/)[1];
-  var y = b.match(/title=["']?(-?\d+\.?\d*)/)[1];
-  x = parseFloat( x );
-  y = parseFloat( y );
-  return ((x < y) ? -1 : ((x > y) ?  1 : 0));
-};
-
-jQuery.fn.dataTableExt.oSort['title-numeric-desc'] = function(a,b) {
-  var x = a.match(/title=["']?(-?\d+\.?\d*)/)[1];
-  var y = b.match(/title=["']?(-?\d+\.?\d*)/)[1];
-  x = parseFloat( x );
-  y = parseFloat( y );
-  return ((x < y) ?  1 : ((x > y) ? -1 : 0));
-};
-
-jQuery.fn.dataTableExt.oApi.fnSetFilteringDelay = function ( oSettings, iDelay ) {
-  var
-  _that = this,
-  iDelay = (typeof iDelay == 'undefined') ? 250 : iDelay;
-
-  this.each( function ( i ) {
-    $.fn.dataTableExt.iApiIndex = i;
-    var
-    $this = this,
-    oTimerId = null,
-    sPreviousSearch = null,
-    anControl = $( 'input', _that.fnSettings().aanFeatures.f );
-
-    anControl.unbind( 'keyup' ).bind( 'keyup', function() {
-      var $$this = $this;
-
-      if (sPreviousSearch === null || sPreviousSearch != anControl.val()) {
-        window.clearTimeout(oTimerId);
-        sPreviousSearch = anControl.val();
-        oSettings.oApi._fnProcessingDisplay(oSettings, true);
-        oTimerId = window.setTimeout(function() {
-          $.fn.dataTableExt.iApiIndex = i;
-          _that.fnFilter( anControl.val() );
-          oSettings.oApi._fnProcessingDisplay(oSettings, false);
-        }, iDelay);
-      }
-    });
-    return this;
-  } );
-  return this;
-};
-
-function renderHadoopDate(data, type, full) {
-  if (type === 'display' || type === 'filter') {
-    if(data === '0') {
-      return "N/A";
-    }
-    return new Date(parseInt(data)).toUTCString();
-  }
-  // 'sort', 'type' and undefined all just use the number
-  // If date is 0, then for purposes of sorting it should be consider max_int
-  return data === '0' ? '9007199254740992' : data;  
-}
-
-function renderHadoopElapsedTime(data, type, full) {
-  if (type === 'display' || type === 'filter') {
-    var timeDiff = parseInt(data);
-    if(timeDiff < 0)
-      return "N/A";
-    
-    var hours = Math.floor(timeDiff / (60*60*1000));
-    var rem = (timeDiff % (60*60*1000));
-    var minutes =  Math.floor(rem / (60*1000));
-    rem = rem % (60*1000);
-    var seconds = Math.floor(rem / 1000);
-    
-    var toReturn = "";
-    if (hours != 0){
-      toReturn += hours;
-      toReturn += "hrs, ";
-    }
-    if (minutes != 0){
-      toReturn += minutes;
-      toReturn += "mins, ";
-    }
-    toReturn += seconds;
-    toReturn += "sec";
-    return toReturn;
-  }
-  // 'sort', 'type' and undefined all just use the number
-  return data;  
-}
-
-function parseHadoopID(data, type, full) {
-  if (type === 'display') {
-    return data;
-  }
-  //Return the visible string rather than the entire HTML tag
-  if (type === 'filter') {
-    return data.split('>')[1].split('<')[0];
-  }
-  //Parse the ID for 'sort', 'type' and undefined
-  //The number after the last '_' and before the end tag '<'
-  var splits = data.split('_');
-  return splits[parseInt(splits.length-1)].split('<')[0];
-}
-
-//JSON array element is "20000 attempt_1360183373897_0001_m_000002_0"
-function parseHadoopAttemptID(data, type, full) {
-  if (type === 'display' || type === 'filter') {
-    return data.split(' ')[1];
-  }
-  //For sorting use the order as defined in the JSON element
-  return data.split(' ')[0];
-}
-
-function parseHadoopProgress(data, type, full) {
-  if (type === 'display') {
-    return data;
-  }
-  //Return the title attribute for 'sort', 'filter', 'type' and undefined
-  return data.split("'")[1];
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/scripts/slider_keytabs.sh
----------------------------------------------------------------------
diff --git a/slider-core/src/scripts/slider_keytabs.sh b/slider-core/src/scripts/slider_keytabs.sh
deleted file mode 100644
index f0a8fc2..0000000
--- a/slider-core/src/scripts/slider_keytabs.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This script exists to create the keytab set for a node on the cluster
-# including hbase and ZK alongside then YARN cores.
-
-# usage
-# keytabs <realm> <hostname>
-# validate the args
-
-num_vars=$#
-if [[ $num_vars < 2 ]]
-then
-  echo "Usage: $0 <realm> <hostname>"
-  exit -2
-fi
-
-realm="$1"
-hostname="$2"
-dest="."
-
-kadmin=kadmin.local
-
-${kadmin} <<EOF
-addprinc -randkey hdfs/${hostname}@${realm}
-addprinc -randkey yarn/${hostname}@${realm}
-addprinc -randkey HTTP/${hostname}@${realm}
-addprinc -randkey hbase/${hostname}@${realm}
-addprinc -randkey zookeeper/${hostname}@${realm}
-
-ktadd -norandkey -k ${dest}/hdfs.keytab  \
-  hdfs/${hostname}@${realm} \
-  HTTP/${hostname}@${realm}
-
-ktadd -norandkey -k ${dest}/yarn.keytab  \
-  yarn/${hostname}@${realm} \
-  HTTP/${hostname}@${realm}
-
-ktadd -norandkey -k ${dest}/hbase.keytab  \
-  hbase/${hostname}@${realm} 
-
-ktadd -norandkey -k ${dest}/zookeeper.keytab  \
-  zookeeper/${hostname}@${realm} 
-EOF
-
-exitcode=$?
-if  [[ $exitcode != 0 ]]
-then
-  echo "keytab generation from ${kadmin} failed with exit code $exitcode"
-  exit $exitcode
-else
-  echo "keytab files for ${hostname}@${realm} created"
-fi

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/scripts/yarnservice.py
----------------------------------------------------------------------
diff --git a/slider-core/src/scripts/yarnservice.py b/slider-core/src/scripts/yarnservice.py
deleted file mode 100644
index 1208c28..0000000
--- a/slider-core/src/scripts/yarnservice.py
+++ /dev/null
@@ -1,383 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-"""Launches a yarn service
-
-WORK IN PROGRESS, IGNORE
-
-This is as work in progress project to build as new launcher script for
-any Hadoop service
-A key feature here is that the configs are defined in JSON files -
-files that are read in the order passed down, and merged into each other.
-
-The final merged file is used to define the java command to execute
--and hadoop XML files.
-
-
-It uses a JSON config file 
-  --jfile configuration file (JSON format)
-  -class classname
-  -Dname=value -arbitrary value to pass down to the JVM
-  --java: any JVM arg
-  -javaX: javaX value
-
-
- after an -- , all following commands are passed straight down to the invoked process.
-  # -xJ name=value JVM options. No: this is just another param
-  -xF file  file to load next. Files are loaded in order. 
-  -xD name=value again, values are loaded in order
-  -xU undefine
-  -xX main class, 'eXecute'
-
-  --  end of arguments
-  
-
-"""
-
-import sys
-# see : http://simplejson.readthedocs.org/en/latest/
-# and install w/ easy_install simplejson
-import simplejson
-
-KEY_JFILE = "-xF"
-KEY_DEF = "-xD"
-KEY_UNDEF = "-xU"
-KEY_EXEC = "-xX"
-KEY_ARGS = "--"
-
-COMMANDS = [KEY_JFILE, KEY_DEF, KEY_EXEC]
-
-#
-
-def debug(string) :
-  print string
-
-
-def pop_required_arg(arglist, previousArg) :
-  """
-  Pop the first element off the list and return it.
-  If the list is empty, raise an exception about a missing argument after the $previousArgument
-  """
-  if not len(arglist) :
-    raise Exception, "Missing required parameter after %s" % previousArg
-  head = arglist[0]
-  del arglist[0]
-  return head
-
-
-def parse_one_jfile(filename) :
-  """
-  read in the given config file
-  """
-  parsed = simplejson.load(open(filename, "r"))
-  return parsed
-
-# hand down sys.argv:
-def extract_jfiles(args) :
-  """ takes a list of arg strings and separates them into jfile references
-  and other arguments.
-  """
-  l = len(args)
-  stripped = []
-  jfiles = []
-  index = 0
-  while index < l :
-    elt = args[index]
-    index += 1
-    if KEY_JFILE == elt :
-      # a match
-      if index == l :
-        #overshoot
-        raise Exception("Missing filename after " + KEY_JFILE)
-      filename = args[index]
-      debug("jfile " + filename)
-      jfiles.append(filename)
-      index += 1
-    else :
-      stripped.append(elt)
-  return jfiles, stripped
-
-
-def extract_args(args) :
-  """
-  Take a list of args, parse them or fail, generating a dictionary of actions
-  Return: dictionary and all leftover arguments
-  """
-  jfiles = []
-  execs = []
-  defs = []
-  remainder = []
-  while len(args) :
-    # the next call cannot fail, because of the len(args)
-    arg = pop_required_arg(args, "")
-    if KEY_JFILE == arg :
-      jfiles.append(pop_required_arg(args, KEY_JFILE))
-    elif KEY_DEF == arg :
-      defs.append((KEY_DEF, pop_required_arg(args, KEY_DEF)))
-    elif KEY_UNDEF == arg :
-      defs.append((KEY_UNDEF, pop_required_arg(args, KEY_UNDEF)))
-    elif KEY_EXEC == arg :
-      execs.append(pop_required_arg(args, KEY_EXEC))
-    elif KEY_ARGS == arg :
-      remainder += args
-      args = []
-    else :
-      remainder.append(arg)
-      #build the action list
-  actions = {
-    KEY_JFILE : jfiles,
-    KEY_EXEC : execs,
-    KEY_DEF : defs,
-    KEY_ARGS : remainder
-  }
-  #end of the run, there's a dictionary and a list of unparsed values
-  return actions
-
-
-def get(conf, key, defVal) :
-  if conf.has_key(key) :
-    return conf[key]
-  else :
-    return defVal
-
-
-def merge_json(conf, json) :
-  """ merge in a json dict with the existing one
-  in: configuration dict, json dict
-  out: configuration'
-  """
-  for (key, val) in json.items() :
-    if key in conf :
-      #there's a match, do a more detailed merge
-      oldval = conf[key]
-      if type(oldval) == dict and type(val) == dict :
-      # two dictionary instances -merge
-        merge_json(oldval, val)
-      else :
-        conf[key] = val
-    else :
-      conf[key] = val
-  return conf
-
-
-def merge_jfile(conf, filename) :
-  json = parse_one_jfile(filename)
-  return merge_json(conf, json)
-
-
-def merge_jfile_list(conf, jfiles) :
-  """ merge a list of jfiles on top of a conf dict
-  """
-  for jfile in jfiles :
-    conf = merge_jfile(conf, jfile)
-  return conf
-
-
-def split_to_keyval_tuple(param) :
-  """
-  Split a key=value string into the (key,value) tuple
-  * an exception is raised on any string "=value"
-  * if there is no string: exception.
-  * a key only definition maps to (key, None)
-  * a "key=" definition maps to (key, "")
-  """
-  if not len(param) :
-    raise Exception, "Empty string cannot be a key=value definition"
-  equalsPos = param.find("=")
-  if equalsPos < 0 :
-    return param, None
-  elif not equalsPos :
-    raise Exception, "no key in argument %s" % param
-  else :
-    key = param[:(equalsPos - 1)]
-    value = param[(equalsPos + 1) :]
-    return key, value
-
-
-def recursive_define(conf, path, value) :
-  if not len(path) :
-    #fallen off the end of the world
-    return
-  entry = path[0]
-  if len(path) == 1 :
-    #end of list, apply it.
-    conf[entry] = value
-  else :
-    #there's 1+ elements below, yet there's a subdir here.
-    if conf.has_key(entry) and type(conf[entry]) == dict :
-      #it's a subdir, simple: recurse.
-      recursive_define(conf[entry], path[1 :], value)
-    else :
-      #either there is an entry that isn't a conf, or its not there. Same outcome.
-      subconf = {}
-      conf[entry] = subconf
-      recursive_define(subconf, path[1 :], value)
-
-def recursive_undef(conf, path) :
-  if not len(path) :
-    #fallen off the end of the world
-    return
-  entry = path[0]
-  if len(path) == 1 :
-    #end of list, apply it.
-    del conf[entry]
-  else :
-    #there's 1+ elements below, yet there's a subdir here.
-    if conf.has_key(entry) and type(conf[entry]) == dict :
-      #it's a subdir, simple: recurse.
-      recursive_undef(conf[entry], path[1 :])
-    else :
-      #either there is an entry that isn't a conf, or its not there. Same outcome.
-      pass
-
-def apply_action(conf, action, key, value) :
-  """
-  Apply either a def or undef action; splitting the key into a path and running through it.
-  """
-  keypath = key.split("/")
-  #now have a split key,
-  if KEY_DEF == action :
-    recursive_define(conf, keypath, value)
-  elif KEY_UNDEF == action :
-    recursive_undef(conf, keypath)
-
-
-def apply_local_definitions(conf, definitions) :
-  """
-  Run through the definition actions and apply them one by one
-  """
-  for defn in definitions :
-    # split into key=value; no value -> empty string
-    (action, param) = defn
-    if KEY_DEF == action :
-      (key, val) = split_to_keyval_tuple(param)
-      apply_action(conf, KEY_DEF, key, val)
-
-  return conf
-
-
-#def parse_args(conf, args) :
-#  """
-#   split an arg string, parse the jfiles & merge over the conf
-#  (configuration, args[]) -> (conf', stripped, jfiles[])
-#  """
-#  (jfiles, stripped) = extract_jfiles(args)
-#
-#  actions = extract_args(args)
-#  jfiles = actions[KEY_JFILE]
-#  conf = merge_jfile_list(conf, jfiles)
-#  return conf, actions
-
-
-def print_conf(conf) :
-  """ dump the configuration to the console
-  """
-  print "{"
-  for (key, val) in conf.items() :
-    if type(val) == dict :
-      print key
-      print_conf(val)
-    else :
-      print "" + key + " => " + str(val)
-  print "}"
-
-
-def list_to_str(l, spacer) :
-  result = ""
-  for elt in l :
-    if len(result) > 0 :
-      result += spacer
-    result += elt
-  return result
-
-
-def list_to_hxml_str(l) :
-  return list_to_str(l, ",")
-
-
-def export_kv_xml(output, key, value) :
-  line = "<property><name>" + key + "</name><value>" + str(value) + "</value>\n"
-  print line
-  output.write(line)
-
-
-def export_to_hadoop_xml(output, conf) :
-  """ export the conf to hadoop XML
-  dictionaries are skipped.
-  """
-  output.write("<configuration>\n")
-  for (key, value) in conf.items() :
-    if type(value) is list :
-      # list print
-      export_kv_xml(output, key, list_to_hxml_str(value))
-    else :
-      if type(value) is dict :
-        print "skipping dict " + key
-      else :
-        export_kv_xml(output, key, value)
-  output.write("</configuration>\n")
-
-
-def start(conf, stripped_args) :
-  """
-  start the process by grabbing exec/args for the arguments
-  """
-  ex = conf["exec"]
-  args = []
-  jsonargs = get(ex, "args", [])
-  args.extend(jsonargs)
-  args.extend(stripped_args)
-  classname = get(ex, "classname", "")
-  if not len(classname) :
-    raise Exception, "No classname supplied"
-  classname = get(ex, "classname", "")
-  commandline = ["java"]
-  classpath = []
-  jvmargs = []
-  commandline.extend(jvmargs)
-  commandline.append("-classpath")
-  commandline.append(list_to_str(classpath, ":"))
-  commandline.append("org.apache.hadoop.yarn.service.launcher.ServiceLauncher")
-  commandline.append(classname)
-  commandline.extend(args)
-  print "ready to exec : %s" % commandline
-
-
-def main() :
-#  (conf, stripped, jfiles) = parse_args({}, sys.argv[1 :])
-  actions = extract_args(sys.argv[1 :])
-  jfiles = actions[KEY_JFILE]
-  conf = merge_jfile_list({}, jfiles)
-  apply_local_definitions(conf, actions[KEY_DEF])
-  exec_args = actions[KEY_ARGS]
-
-  print_conf(conf)
-  #  if len(stripped) > 0 :
-  #got an output file
-  #    filename = stripped[0]
-  #    print "Writing XML configuration to " + filename
-  #    output = open(filename, "w")
-  #    export_to_hadoop_xml(output, conf["site"])
-  start(conf, exec_args)
-
-
-if __name__ == "__main__" :
-  main()
-
-

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/site/site.xml
----------------------------------------------------------------------
diff --git a/slider-core/src/site/site.xml b/slider-core/src/site/site.xml
deleted file mode 100644
index 8dd81d4..0000000
--- a/slider-core/src/site/site.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you under the Apache License, Version 2.0 (the
-  ~  "License"); you may not use this file except in compliance
-  ~  with the License.  You may obtain a copy of the License at
-  ~
-  ~       http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~  Unless required by applicable law or agreed to in writing, software
-  ~  distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  -->
-
-<project name="Slider">
-<!--
-
-  <skin>
-    <groupId>org.apache.maven.skins</groupId>
-    <artifactId>maven-fluido-skin</artifactId>
-    <version>1.3.0</version>
-  </skin>
--->
-<!--
-
-  <custom>
-    <fluidoSkin>
-      <topBarEnabled>true</topBarEnabled>
-      <sideBarEnabled>false</sideBarEnabled>
-    </fluidoSkin>
-  </custom>
--->
-
-  <version position="right"/>
-
-  <body>
-    <menu ref="reports"/>
-
-
-    
-  </body>
-
-
-</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneAgentAM.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneAgentAM.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneAgentAM.groovy
index ff95130..75dfcf4 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneAgentAM.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneAgentAM.groovy
@@ -32,7 +32,7 @@ import org.apache.slider.common.SliderKeys
 import org.apache.slider.common.params.ActionRegistryArgs
 import org.apache.slider.common.params.ActionDestroyArgs
 import org.apache.slider.common.tools.Duration
-import org.apache.slider.core.build.InstanceBuilder
+import org.apache.slider.core.buildutils.InstanceBuilder
 import org.apache.slider.core.conf.AggregateConf
 import org.apache.slider.core.exceptions.SliderException
 import org.apache.slider.core.launch.LaunchedApplication

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/groovy/org/apache/slider/client/TestSliderClientMethods.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/client/TestSliderClientMethods.groovy b/slider-core/src/test/groovy/org/apache/slider/client/TestSliderClientMethods.groovy
index e244923..40a5441 100644
--- a/slider-core/src/test/groovy/org/apache/slider/client/TestSliderClientMethods.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/client/TestSliderClientMethods.groovy
@@ -24,7 +24,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration
 import org.apache.hadoop.yarn.exceptions.YarnException
 import org.apache.slider.common.SliderXmlConfKeys
 import org.apache.slider.common.tools.SliderUtils
-import org.apache.slider.core.build.InstanceBuilder
+import org.apache.slider.core.buildutils.InstanceBuilder
 import org.apache.slider.core.conf.AggregateConf
 import org.apache.slider.core.exceptions.SliderException
 import org.apache.slider.core.launch.LaunchedApplication

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAMManagementWS.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAMManagementWS.groovy b/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAMManagementWS.groovy
index 7eb1d17..af6f5f3 100644
--- a/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAMManagementWS.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAMManagementWS.groovy
@@ -28,7 +28,7 @@ import org.apache.slider.api.StatusKeys
 import org.apache.slider.client.SliderClient
 import org.apache.slider.common.SliderKeys
 import static org.apache.slider.common.SliderXmlConfKeys.KEY_KEYSTORE_LOCATION
-import org.apache.slider.core.build.InstanceBuilder
+import org.apache.slider.core.buildutils.InstanceBuilder
 import org.apache.slider.core.conf.AggregateConf
 import org.apache.slider.core.conf.MapOperations
 import org.apache.slider.core.exceptions.SliderException

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/groovy/org/apache/slider/server/appmaster/TestDelayInContainerLaunch.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/TestDelayInContainerLaunch.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/TestDelayInContainerLaunch.groovy
index 51e01d5..72410db 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/TestDelayInContainerLaunch.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/TestDelayInContainerLaunch.groovy
@@ -26,7 +26,7 @@ import org.apache.slider.api.ClusterDescription
 import org.apache.slider.api.ResourceKeys
 import org.apache.slider.client.SliderClient
 import org.apache.slider.common.params.ActionKillContainerArgs
-import org.apache.slider.core.build.InstanceBuilder
+import org.apache.slider.core.buildutils.InstanceBuilder
 import org.apache.slider.core.conf.AggregateConf
 import org.apache.slider.core.exceptions.SliderException
 import org.apache.slider.core.launch.LaunchedApplication

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockContainer.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockContainer.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockContainer.groovy
index ad586cd..32cfc0f 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockContainer.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockContainer.groovy
@@ -20,6 +20,7 @@ package org.apache.slider.server.appmaster.model.mock
 
 import org.apache.hadoop.yarn.api.records.Container
 import org.apache.hadoop.yarn.api.records.ContainerId
+import org.apache.hadoop.yarn.api.records.ExecutionType
 import org.apache.hadoop.yarn.api.records.NodeId
 import org.apache.hadoop.yarn.api.records.Priority
 import org.apache.hadoop.yarn.api.records.Resource
@@ -28,6 +29,7 @@ import org.apache.hadoop.yarn.api.records.Token
 class MockContainer extends Container {
 
   ContainerId id;
+  ExecutionType executionType
   NodeId nodeId
   String nodeHttpAddress;
   Resource resource
@@ -53,4 +55,12 @@ class MockContainer extends Container {
            ", nodeHttpAddress='$nodeHttpAddress'," +
            " priority=$priority }"
   }
+
+  public ExecutionType getExecutionType() {
+    return executionType;
+  }
+
+  public void setExecutionType(ExecutionType executionType) {
+    this.executionType = executionType
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java b/slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java
deleted file mode 100644
index 20e72c0..0000000
--- a/slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.common.tools;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.YarnApplicationState;
-import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationReportPBImpl;
-import org.apache.slider.tools.TestUtility;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-/** Test slider util methods. */
-public class TestSliderUtils {
-  protected static final Logger log =
-      LoggerFactory.getLogger(TestSliderUtils.class);
-  @Rule
-  public TemporaryFolder folder = new TemporaryFolder();
-
-  @Test
-  public void testGetMetaInfoStreamFromZip() throws Exception {
-    String zipFileName = TestUtility.createAppPackage(
-        folder,
-        "testpkg",
-        "test.zip",
-        "target/test-classes/org/apache/slider/common/tools/test");
-    Configuration configuration = new Configuration();
-    FileSystem fs = FileSystem.getLocal(configuration);
-    log.info("fs working dir is {}", fs.getWorkingDirectory().toString());
-    SliderFileSystem sliderFileSystem = new SliderFileSystem(fs, configuration);
-
-    InputStream stream = SliderUtils.getApplicationResourceInputStream(
-        sliderFileSystem.getFileSystem(),
-        new Path(zipFileName),
-        "metainfo.xml");
-    Assert.assertTrue(stream != null);
-    Assert.assertTrue(stream.available() > 0);
-  }
-
-  @Test
-  public void testTruncate() {
-    Assert.assertEquals(SliderUtils.truncate(null, 5), null);
-    Assert.assertEquals(SliderUtils.truncate("323", -1), "323");
-    Assert.assertEquals(SliderUtils.truncate("3232", 5), "3232");
-    Assert.assertEquals(SliderUtils.truncate("1234567890", 0), "1234567890");
-    Assert.assertEquals(SliderUtils.truncate("123456789012345", 15), "123456789012345");
-    Assert.assertEquals(SliderUtils.truncate("123456789012345", 14), "12345678901...");
-    Assert.assertEquals(SliderUtils.truncate("1234567890", 1), "1");
-    Assert.assertEquals(SliderUtils.truncate("1234567890", 10), "1234567890");
-    Assert.assertEquals(SliderUtils.truncate("", 10), "");
-  }
-
-  @Test
-  public void testApplicationReportComparison() {
-    List<ApplicationReport> instances = getApplicationReports();
-
-    SliderUtils.sortApplicationsByMostRecent(instances);
-
-    Assert.assertEquals(1000, instances.get(0).getStartTime());
-    Assert.assertEquals(1000, instances.get(1).getStartTime());
-    Assert.assertEquals(1000, instances.get(2).getStartTime());
-    Assert.assertEquals(1000, instances.get(3).getStartTime());
-
-    instances = getApplicationReports();
-
-    SliderUtils.sortApplicationReport(instances);
-    Assert.assertEquals(1000, instances.get(0).getStartTime());
-    Assert.assertEquals(1000, instances.get(1).getStartTime());
-    Assert.assertEquals(1000, instances.get(2).getStartTime());
-    Assert.assertEquals(1000, instances.get(3).getStartTime());
-
-    Assert.assertTrue(instances.get(0).getYarnApplicationState() == YarnApplicationState.ACCEPTED ||
-                      instances.get(0).getYarnApplicationState() == YarnApplicationState.RUNNING);
-    Assert.assertTrue(instances.get(1).getYarnApplicationState() == YarnApplicationState.ACCEPTED ||
-                      instances.get(1).getYarnApplicationState() == YarnApplicationState.RUNNING);
-    Assert.assertTrue(instances.get(2).getYarnApplicationState() == YarnApplicationState.ACCEPTED ||
-                      instances.get(2).getYarnApplicationState() == YarnApplicationState.RUNNING);
-    Assert.assertTrue(instances.get(3).getYarnApplicationState() == YarnApplicationState.KILLED);
-  }
-
-  private List<ApplicationReport> getApplicationReports() {
-    List<ApplicationReport> instances = new ArrayList<ApplicationReport>();
-    instances.add(getApplicationReport(1000, 0, "app1", YarnApplicationState.ACCEPTED));
-    instances.add(getApplicationReport(900, 998, "app1", YarnApplicationState.KILLED));
-    instances.add(getApplicationReport(900, 998, "app2", YarnApplicationState.FAILED));
-    instances.add(getApplicationReport(1000, 0, "app2", YarnApplicationState.RUNNING));
-    instances.add(getApplicationReport(800, 837, "app3", YarnApplicationState.FINISHED));
-    instances.add(getApplicationReport(1000, 0, "app3", YarnApplicationState.RUNNING));
-    instances.add(getApplicationReport(900, 998, "app3", YarnApplicationState.KILLED));
-    instances.add(getApplicationReport(800, 837, "app4", YarnApplicationState.FINISHED));
-    instances.add(getApplicationReport(1000, 1050, "app4", YarnApplicationState.KILLED));
-    instances.add(getApplicationReport(900, 998, "app4", YarnApplicationState.FINISHED));
-
-    Assert.assertEquals("app1", instances.get(0).getApplicationType());
-    Assert.assertEquals("app1", instances.get(1).getApplicationType());
-    Assert.assertEquals("app2", instances.get(2).getApplicationType());
-    Assert.assertEquals("app2", instances.get(3).getApplicationType());
-    return instances;
-  }
-
-  private ApplicationReportPBImpl getApplicationReport(long startTime,
-                                                       long finishTime,
-                                                       String name,
-                                                       YarnApplicationState state) {
-    ApplicationReportPBImpl ar = new ApplicationReportPBImpl();
-    ar.setFinishTime(finishTime);
-    ar.setStartTime(startTime);
-    ar.setApplicationType(name);
-    ar.setYarnApplicationState(state);
-    return ar;
-  }
-
-
-  @Test
-  public void testGetHdpVersion() {
-    String hdpVersion = "2.3.2.0-2766";
-    Assert.assertEquals("Version should be empty", null,
-        SliderUtils.getHdpVersion());
-  }
-
-  @Test
-  public void testIsHdp() {
-    Assert.assertFalse("Should be false", SliderUtils.isHdp());
-  }
-
-  @Test
-  public void testWrite() throws IOException {
-    File testWriteFile = folder.newFile("testWrite");
-    SliderUtils.write(testWriteFile, "test".getBytes("UTF-8"), true);
-    Assert.assertTrue(FileUtils.readFileToString(testWriteFile, "UTF-8").equals("test"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/core/launch/TestAppMasterLauncher.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/core/launch/TestAppMasterLauncher.java b/slider-core/src/test/java/org/apache/slider/core/launch/TestAppMasterLauncher.java
deleted file mode 100644
index eae9658..0000000
--- a/slider-core/src/test/java/org/apache/slider/core/launch/TestAppMasterLauncher.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.launch;
-
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
-import org.apache.hadoop.yarn.api.records.LogAggregationContext;
-import org.apache.hadoop.yarn.client.api.YarnClientApplication;
-import org.apache.slider.api.ResourceKeys;
-import org.apache.slider.client.SliderYarnClientImpl;
-import org.apache.slider.common.SliderKeys;
-import org.easymock.EasyMock;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestAppMasterLauncher {
-  SliderYarnClientImpl mockYarnClient;
-  YarnClientApplication yarnClientApp;
-  ApplicationSubmissionContext appSubmissionContext;
-  Set<String> tags = Collections.emptySet();
-  AppMasterLauncher appMasterLauncher = null;
-  boolean isOldApi = true;
-  Method rolledLogsIncludeMethod = null;
-  Method rolledLogsExcludeMethod = null;
-
-  @Before
-  public void initialize() throws Exception {
-    mockYarnClient = EasyMock.createNiceMock(SliderYarnClientImpl.class);
-    yarnClientApp = EasyMock.createNiceMock(YarnClientApplication.class);
-    appSubmissionContext = EasyMock
-        .createNiceMock(ApplicationSubmissionContext.class);
-    EasyMock.expect(yarnClientApp.getApplicationSubmissionContext())
-        .andReturn(appSubmissionContext).once();
-    EasyMock.expect(mockYarnClient.createApplication())
-        .andReturn(yarnClientApp).once();
-
-    try {
-      LogAggregationContext.class.getMethod("newInstance", String.class,
-          String.class, String.class, String.class);
-      isOldApi = false;
-      rolledLogsIncludeMethod = LogAggregationContext.class
-          .getMethod("getRolledLogsIncludePattern");
-      rolledLogsExcludeMethod = LogAggregationContext.class
-          .getMethod("getRolledLogsExcludePattern");
-    } catch (Exception e) {
-      isOldApi = true;
-    }
-  }
-
-  /**
-   * These tests will probably fail when compiled against hadoop 2.7+. Please
-   * refer to SLIDER-810. It has been purposely not modified so that it fails
-   * and that someone needs to modify the code in
-   * {@code AbstractLauncher#extractLogAggregationContext(Map)}. Comments are
-   * provided in that method as to what needs to be done.
-   * 
-   * @throws Exception
-   */
-  @Test
-  public void testExtractLogAggregationContext() throws Exception {
-    Map<String, String> options = new HashMap<String, String>();
-    options.put(ResourceKeys.YARN_LOG_INCLUDE_PATTERNS,
-        " | slider*.txt  |agent.out| |");
-    options.put(ResourceKeys.YARN_LOG_EXCLUDE_PATTERNS,
-        "command*.json|  agent.log*        |     ");
-
-    EasyMock.replay(mockYarnClient, appSubmissionContext, yarnClientApp);
-    appMasterLauncher = new AppMasterLauncher("cl1", SliderKeys.APP_TYPE, null,
-        null, mockYarnClient, false, null, options, tags, null);
-
-    // Verify the include/exclude patterns
-    String expectedInclude = "slider*.txt|agent.out";
-    String expectedExclude = "command*.json|agent.log*";
-    assertPatterns(expectedInclude, expectedExclude);
-
-    EasyMock.verify(mockYarnClient, appSubmissionContext, yarnClientApp);
-
-  }
-
-  @Test
-  public void testExtractLogAggregationContextEmptyIncludePattern()
-      throws Exception {
-    Map<String, String> options = new HashMap<String, String>();
-    options.put(ResourceKeys.YARN_LOG_INCLUDE_PATTERNS, " ");
-    options.put(ResourceKeys.YARN_LOG_EXCLUDE_PATTERNS,
-        "command*.json|  agent.log*        |     ");
-
-    EasyMock.replay(mockYarnClient, appSubmissionContext, yarnClientApp);
-    appMasterLauncher = new AppMasterLauncher("cl1", SliderKeys.APP_TYPE, null,
-        null, mockYarnClient, false, null, options, tags, null);
-
-    // Verify the include/exclude patterns
-    String expectedInclude = isOldApi ? "" : ".*";
-    String expectedExclude = "command*.json|agent.log*";
-    assertPatterns(expectedInclude, expectedExclude);
-
-    EasyMock.verify(mockYarnClient, appSubmissionContext, yarnClientApp);
-  }
-
-  @Test
-  public void testExtractLogAggregationContextEmptyIncludeAndExcludePattern()
-      throws Exception {
-    Map<String, String> options = new HashMap<String, String>();
-    options.put(ResourceKeys.YARN_LOG_INCLUDE_PATTERNS, "");
-    options.put(ResourceKeys.YARN_LOG_EXCLUDE_PATTERNS, "  ");
-
-    EasyMock.replay(mockYarnClient, appSubmissionContext, yarnClientApp);
-    appMasterLauncher = new AppMasterLauncher("cl1", SliderKeys.APP_TYPE, null,
-        null, mockYarnClient, false, null, options, tags, null);
-
-    // Verify the include/exclude patterns
-    String expectedInclude = isOldApi ? "" : ".*";
-    String expectedExclude = "";
-    assertPatterns(expectedInclude, expectedExclude);
-
-    EasyMock.verify(mockYarnClient, appSubmissionContext, yarnClientApp);
-  }
-
-  private void assertPatterns(String expectedIncludePattern,
-      String expectedExcludePattern) throws Exception {
-    if (isOldApi) {
-      Assert.assertEquals(expectedIncludePattern,
-          appMasterLauncher.logAggregationContext.getIncludePattern());
-      Assert.assertEquals(expectedExcludePattern,
-          appMasterLauncher.logAggregationContext.getExcludePattern());
-    } else {
-      Assert.assertEquals(expectedIncludePattern,
-          (String) rolledLogsIncludeMethod
-              .invoke(appMasterLauncher.logAggregationContext));
-      Assert.assertEquals(expectedExcludePattern,
-          (String) rolledLogsExcludeMethod
-              .invoke(appMasterLauncher.logAggregationContext));
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/core/launch/TestAppMasterLauncherWithAmReset.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/core/launch/TestAppMasterLauncherWithAmReset.java b/slider-core/src/test/java/org/apache/slider/core/launch/TestAppMasterLauncherWithAmReset.java
deleted file mode 100644
index a8f6b26..0000000
--- a/slider-core/src/test/java/org/apache/slider/core/launch/TestAppMasterLauncherWithAmReset.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.launch;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse;
-import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
-import org.apache.hadoop.yarn.client.api.YarnClientApplication;
-import org.apache.hadoop.yarn.util.Records;
-import org.apache.slider.api.ResourceKeys;
-import org.apache.slider.client.SliderYarnClientImpl;
-import org.apache.slider.common.SliderKeys;
-import org.easymock.EasyMock;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestAppMasterLauncherWithAmReset {
-  SliderYarnClientImpl mockYarnClient;
-  YarnClientApplication yarnClientApp;
-  ApplicationSubmissionContext appSubmissionContext;
-  GetNewApplicationResponse newApp;
-  Set<String> tags = Collections.emptySet();
-  AppMasterLauncher appMasterLauncher = null;
-  boolean isOldApi = true;
-
-  @Before
-  public void initialize() throws Exception {
-    mockYarnClient = EasyMock.createNiceMock(SliderYarnClientImpl.class);
-    yarnClientApp = EasyMock.createNiceMock(YarnClientApplication.class);
-    newApp = EasyMock.createNiceMock(GetNewApplicationResponse.class);
-    EasyMock.expect(mockYarnClient.createApplication())
-        .andReturn(new YarnClientApplication(newApp,
-        Records.newRecord(ApplicationSubmissionContext.class)));
-  }
-
-  @Test
-  public void testExtractYarnResourceManagerAmRetryCountWindowMs() throws
-      Exception {
-    Map<String, String> options = new HashMap<String, String>();
-    final String expectedInterval = Integer.toString (120000);
-    options.put(ResourceKeys.YARN_RESOURCEMANAGER_AM_RETRY_COUNT_WINDOW_MS,
-        expectedInterval);
-    EasyMock.replay(mockYarnClient, yarnClientApp);
-
-    appMasterLauncher = new AppMasterLauncher("am1", SliderKeys.APP_TYPE, null,
-        null, mockYarnClient, false, null, options, tags, null);
-
-    ApplicationSubmissionContext ctx = appMasterLauncher.application
-        .getApplicationSubmissionContext();
-    String retryIntervalWindow = Long.toString(ctx
-        .getAttemptFailuresValidityInterval());
-    Assert.assertEquals(expectedInterval, retryIntervalWindow);
-  }
-
-  @Test
-  public void testExtractYarnResourceManagerAmRetryCountWindowMsDefaultValue()
-      throws Exception {
-    Map<String, String> options = new HashMap<String, String>();
-    EasyMock.replay(mockYarnClient, yarnClientApp);
-
-    appMasterLauncher = new AppMasterLauncher("am1", SliderKeys.APP_TYPE, null,
-        null, mockYarnClient, false, null, options, tags, null);
-
-    ApplicationSubmissionContext ctx = appMasterLauncher.application
-        .getApplicationSubmissionContext();
-    long retryIntervalWindow = ctx.getAttemptFailuresValidityInterval();
-    Assert.assertEquals(ResourceKeys.DEFAULT_AM_RETRY_COUNT_WINDOW_MS,
-        retryIntervalWindow);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/core/registry/docstore/TestPublishedConfigurationOutputter.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/core/registry/docstore/TestPublishedConfigurationOutputter.java b/slider-core/src/test/java/org/apache/slider/core/registry/docstore/TestPublishedConfigurationOutputter.java
deleted file mode 100644
index 63d5961..0000000
--- a/slider-core/src/test/java/org/apache/slider/core/registry/docstore/TestPublishedConfigurationOutputter.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.core.registry.docstore;
-
-import com.google.common.base.Charsets;
-import org.apache.commons.io.FileUtils;
-import org.apache.hadoop.fs.Path;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.powermock.api.easymock.PowerMock;
-import org.yaml.snakeyaml.Yaml;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.expect;
-import static org.mockito.Matchers.anyString;
-import static org.powermock.api.easymock.PowerMock.createNiceMock;
-
-public class TestPublishedConfigurationOutputter {
-  private static HashMap<String, String> config = new HashMap<>();
-
-  @Rule
-  public TemporaryFolder tmpDir = new TemporaryFolder();
-
-  @Before
-  public void setup() {
-    config.put("key1", "val1");
-  }
-
-  @Test
-  public void testJson() throws IOException {
-    PublishedConfigurationOutputter configurationOutputter =
-        PublishedConfigurationOutputter.createOutputter(ConfigFormat.JSON,
-            new PublishedConfiguration("description",
-                config.entrySet()));
-
-    String output = configurationOutputter.asString().replaceAll("( |\\r|\\n)",
-        "");
-    assert "{\"key1\":\"val1\"}".equals(output);
-
-    File file = tmpDir.newFile();
-    configurationOutputter.save(file);
-
-    ObjectMapper mapper = new ObjectMapper();
-    Map<String, String> read = mapper.readValue(file, Map.class);
-    assert 1 == read.size();
-    assert "val1".equals(read.get("key1"));
-  }
-
-  @Test
-  public void testXml() throws IOException {
-    PublishedConfigurationOutputter configurationOutputter =
-        PublishedConfigurationOutputter.createOutputter(ConfigFormat.XML,
-            new PublishedConfiguration("description",
-                config.entrySet()));
-
-    String output = configurationOutputter.asString().replaceAll("( |\\r|\\n)",
-        "");
-    assert output.contains(
-        "<configuration><property><name>key1</name><value>val1</value><source/></property></configuration>");
-
-    File file = tmpDir.newFile();
-    configurationOutputter.save(file);
-
-    assert FileUtils.readFileToString(file, Charsets.UTF_8)
-        .replaceAll("( |\\r|\\n)", "")
-        .contains(
-            "<configuration><property><name>key1</name><value>val1</value><source/></property></configuration>");
-  }
-
-  @Test
-  public void testHadoopXml() throws IOException {
-    PublishedConfigurationOutputter configurationOutputter =
-        PublishedConfigurationOutputter.createOutputter(ConfigFormat.HADOOP_XML,
-            new PublishedConfiguration("description",
-                config.entrySet()));
-
-    String output = configurationOutputter.asString().replaceAll("( |\\r|\\n)",
-        "");
-    assert output.contains("<configuration><property><name>key1</name><value>val1</value><source/></property></configuration>");
-
-    File file = tmpDir.newFile();
-    configurationOutputter.save(file);
-
-    assert FileUtils.readFileToString(file, Charsets.UTF_8)
-        .replaceAll("( |\\r|\\n)", "")
-        .contains( "<configuration><property><name>key1</name><value>val1</value><source/></property></configuration>");
-  }
-
-  @Test
-  public void testProperties() throws IOException {
-    PublishedConfigurationOutputter configurationOutputter =
-        PublishedConfigurationOutputter.createOutputter(ConfigFormat.PROPERTIES,
-            new PublishedConfiguration("description",
-                config.entrySet()));
-
-    String output = configurationOutputter.asString();
-    assert output.contains("key1=val1");
-
-    File file = tmpDir.newFile();
-    configurationOutputter.save(file);
-
-    Properties properties = new Properties();
-    FileInputStream fis = null;
-    try {
-      fis = new FileInputStream(file);
-      properties.load(fis);
-    } finally {
-      if (fis != null) {
-        fis.close();
-      }
-    }
-    assert 1 == properties.size();
-    assert "val1".equals(properties.getProperty("key1"));
-  }
-
-  @Test
-  public void testYaml() throws IOException {
-    PublishedConfigurationOutputter configurationOutputter =
-        PublishedConfigurationOutputter.createOutputter(ConfigFormat.YAML,
-            new PublishedConfiguration("description",
-                config.entrySet()));
-
-    String output = configurationOutputter.asString().replaceAll("(\\r|\\n)",
-        "");
-    assert "key1: val1".equals(output);
-
-    File file = tmpDir.newFile();
-    configurationOutputter.save(file);
-
-    Yaml yaml = new Yaml();
-    FileInputStream fis = null;
-    Map<String, String> read;
-    try {
-      fis = new FileInputStream(file);
-      read = (Map<String, String>) yaml.load(fis);
-    } finally {
-      if (fis != null) {
-        fis.close();
-      }
-    }
-    assert 1 == read.size();
-    assert "val1".equals(read.get("key1"));
-  }
-
-  @Test
-  public void testEnv() throws IOException {
-    HashMap<String, String> envConfig = new HashMap<>(config);
-    envConfig.put("content", "content {{key1}} ");
-
-    PublishedConfigurationOutputter configurationOutputter =
-        PublishedConfigurationOutputter.createOutputter(ConfigFormat.ENV,
-            new PublishedConfiguration("description",
-                envConfig.entrySet()));
-
-    String output = configurationOutputter.asString();
-    assert "content val1 ".equals(output);
-
-    File file = tmpDir.newFile();
-    configurationOutputter.save(file);
-
-    assert "content val1 ".equals(FileUtils.readFileToString(file,
-        Charsets.UTF_8));
-  }
-
-  @Test
-  public void testTemplate1() throws IOException {
-    HashMap<String, String> templateConfig = new HashMap<>(config);
-    templateConfig.put(ConfigUtils.TEMPLATE_FILE, "templateFileName");
-
-    SliderFileSystem fileSystem = createNiceMock(SliderFileSystem.class);
-    expect(fileSystem.buildResourcePath(anyString())).andReturn(new Path("path")).anyTimes();
-    expect(fileSystem.isFile(anyObject(Path.class))).andReturn(true).anyTimes();
-    expect(fileSystem.cat(anyObject(Path.class))).andReturn("content {{key1}}\n more ${key1} content").anyTimes();
-
-    PowerMock.replay(fileSystem);
-
-    ConfigUtils.prepConfigForTemplateOutputter(ConfigFormat.TEMPLATE,
-        templateConfig, fileSystem, "clusterName", null);
-    PublishedConfigurationOutputter configurationOutputter =
-        PublishedConfigurationOutputter.createOutputter(ConfigFormat.TEMPLATE,
-            new PublishedConfiguration("description",
-                templateConfig.entrySet()));
-
-    String output = configurationOutputter.asString();
-    assert "content val1\n more val1 content".equals(output);
-
-    File file = tmpDir.newFile();
-    configurationOutputter.save(file);
-
-    PowerMock.verify(fileSystem);
-
-    assert "content val1\n more val1 content".equals(
-        FileUtils.readFileToString(file, Charsets.UTF_8));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentClientProvider.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentClientProvider.java b/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentClientProvider.java
deleted file mode 100644
index 0bea8fa..0000000
--- a/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentClientProvider.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.tools.TestUtility;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Set;
-
-/**
- *
- */
-public class TestAgentClientProvider {
-  protected static final Logger log =
-      LoggerFactory.getLogger(TestAgentClientProvider.class);
-  @Rule
-  public TemporaryFolder folder = new TemporaryFolder();
-
-  @Test
-  public void testGetApplicationTags() throws Exception {
-    Configuration configuration = new Configuration();
-    FileSystem fs = FileSystem.getLocal(configuration);
-    SliderFileSystem sliderFileSystem = new SliderFileSystem(fs, configuration);
-
-    AgentClientProvider provider = new AgentClientProvider(null);
-    String zipFileName = TestUtility.createAppPackage(
-        folder,
-        "testpkg",
-        "test.zip",
-        "target/test-classes/org/apache/slider/common/tools/test");
-    Set<String> tags = provider.getApplicationTags(sliderFileSystem, zipFileName);
-    assert tags != null;
-    assert !tags.isEmpty();
-    assert tags.contains("Name: STORM");
-    assert tags.contains("Description: Apache Hadoop Stream processing framework");
-    assert tags.contains("Version: 0.9.1.2.1");
-
-  }
-
-  @Test
-  public void testValidateInstanceDefinition() throws Exception {
-    AgentClientProvider provider = new AgentClientProvider(null);
-    AggregateConf instanceDefinition = new AggregateConf();
-
-    try {
-      provider.validateInstanceDefinition(instanceDefinition, null);
-      Assert.assertFalse("Should fail with BadConfigException", true);
-    } catch (BadConfigException e) {
-      log.info(e.toString());
-      Assert.assertTrue(e.getMessage().contains("Application definition must be provided"));
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentLaunchParameter.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentLaunchParameter.java b/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentLaunchParameter.java
deleted file mode 100644
index ec62b54..0000000
--- a/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentLaunchParameter.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- *
- */
-public class TestAgentLaunchParameter {
-  protected static final Logger log =
-      LoggerFactory.getLogger(TestAgentLaunchParameter.class);
-
-  @Test
-  public void testTestAgentLaunchParameter() throws Exception {
-    AgentLaunchParameter alp = new AgentLaunchParameter("");
-    Assert.assertEquals("", alp.getNextLaunchParameter("abc"));
-    Assert.assertEquals("", alp.getNextLaunchParameter("HBASE_MASTER"));
-
-    alp = new AgentLaunchParameter("a:1:2:3|b:5:6:NONE");
-    Assert.assertEquals("1", alp.getNextLaunchParameter("a"));
-    Assert.assertEquals("2", alp.getNextLaunchParameter("a"));
-    Assert.assertEquals("3", alp.getNextLaunchParameter("a"));
-    Assert.assertEquals("3", alp.getNextLaunchParameter("a"));
-
-    Assert.assertEquals("5", alp.getNextLaunchParameter("b"));
-    Assert.assertEquals("6", alp.getNextLaunchParameter("b"));
-    Assert.assertEquals("", alp.getNextLaunchParameter("b"));
-    Assert.assertEquals("", alp.getNextLaunchParameter("b"));
-    Assert.assertEquals("", alp.getNextLaunchParameter("c"));
-
-    alp = new AgentLaunchParameter("|a:1:3|b::5:NONE:");
-    Assert.assertEquals("1", alp.getNextLaunchParameter("a"));
-    Assert.assertEquals("3", alp.getNextLaunchParameter("a"));
-    Assert.assertEquals("3", alp.getNextLaunchParameter("a"));
-
-    Assert.assertEquals("", alp.getNextLaunchParameter("b"));
-    Assert.assertEquals("5", alp.getNextLaunchParameter("b"));
-    Assert.assertEquals("", alp.getNextLaunchParameter("b"));
-    Assert.assertEquals("", alp.getNextLaunchParameter("b"));
-
-    alp = new AgentLaunchParameter("|:");
-    Assert.assertEquals("", alp.getNextLaunchParameter("b"));
-    Assert.assertEquals("", alp.getNextLaunchParameter("a"));
-
-    alp = new AgentLaunchParameter("HBASE_MASTER:a,b:DO_NOT_REGISTER:");
-    Assert.assertEquals("a,b", alp.getNextLaunchParameter("HBASE_MASTER"));
-    Assert.assertEquals("DO_NOT_REGISTER", alp.getNextLaunchParameter("HBASE_MASTER"));
-    Assert.assertEquals("DO_NOT_REGISTER", alp.getNextLaunchParameter("HBASE_MASTER"));
-
-    alp = new AgentLaunchParameter("HBASE_MASTER:a,b:DO_NOT_REGISTER::c:::");
-    Assert.assertEquals("a,b", alp.getNextLaunchParameter("HBASE_MASTER"));
-    Assert.assertEquals("DO_NOT_REGISTER", alp.getNextLaunchParameter("HBASE_MASTER"));
-    Assert.assertEquals("", alp.getNextLaunchParameter("HBASE_MASTER"));
-    Assert.assertEquals("c", alp.getNextLaunchParameter("HBASE_MASTER"));
-    Assert.assertEquals("c", alp.getNextLaunchParameter("HBASE_MASTER"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentUtils.java b/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentUtils.java
deleted file mode 100644
index 5e1dc7f..0000000
--- a/slider-core/src/test/java/org/apache/slider/providers/agent/TestAgentUtils.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers.agent;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.providers.agent.application.metadata.Metainfo;
-import org.apache.slider.tools.TestUtility;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TestAgentUtils {
-  protected static final Logger log =
-      LoggerFactory.getLogger(TestAgentUtils.class);
-  @Rule
-  public TemporaryFolder folder = new TemporaryFolder();
-  private static final String metainfo_str = "<metainfo>\n"
-      + "  <schemaVersion>2.0</schemaVersion>\n"
-      + "  <application>\n"
-      + "      <name>MYTESTAPPLICATION</name>\n"
-      + "      <comment>\n"
-      + "        My Test Application\n"
-      + "      </comment>\n"
-      + "      <version>1.0</version>\n"
-      + "      <type>YARN-APP</type>\n"
-      + "      <components>\n"
-      + "        <component>\n"
-      + "          <name>REST</name>\n"
-      + "          <category>MASTER</category>\n"
-      + "          <commandScript>\n"
-      + "            <script>scripts/rest.py</script>\n"
-      + "            <scriptType>PYTHON</scriptType>\n"
-      + "            <timeout>600</timeout>\n"
-      + "          </commandScript>\n"
-      + "        </component>\n"
-      + "      </components>\n"
-      + "  </application>\n"
-      + "</metainfo>";
-
-  @Test
-  public void testGetApplicationMetainfo() throws Exception {
-    String zipFileName = TestUtility.createAppPackage(
-        folder,
-        "testpkg",
-        "test.zip",
-        "target/test-classes/org/apache/slider/common/tools/test");
-    Configuration configuration = new Configuration();
-    FileSystem fs = FileSystem.getLocal(configuration);
-    log.info("fs working dir is {}", fs.getWorkingDirectory().toString());
-    SliderFileSystem sliderFileSystem = new SliderFileSystem(fs, configuration);
-
-    // Without accompany metainfo file, read metainfo from the zip file
-    Metainfo metainfo = AgentUtils.getApplicationMetainfo(
-        sliderFileSystem, zipFileName, false);
-    Assert.assertNotNull(metainfo.getApplication());
-    Assert.assertEquals("STORM", metainfo.getApplication().getName());
-
-    // With accompany metainfo file, read metainfo from the accompany file
-    String acompanyFileName = zipFileName + ".metainfo.xml";
-    File f = new File(acompanyFileName);
-    try (BufferedWriter writer = new BufferedWriter(new FileWriter(f))) {
-      writer.write(metainfo_str);
-    }
-    metainfo = AgentUtils.getApplicationMetainfo(
-        sliderFileSystem, zipFileName, false);
-    Assert.assertNotNull(metainfo.getApplication());
-    Assert.assertEquals("MYTESTAPPLICATION", metainfo.getApplication().getName());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/providers/agent/TestAppDefinitionPersister.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/providers/agent/TestAppDefinitionPersister.java b/slider-core/src/test/java/org/apache/slider/providers/agent/TestAppDefinitionPersister.java
deleted file mode 100644
index dedf4f6..0000000
--- a/slider-core/src/test/java/org/apache/slider/providers/agent/TestAppDefinitionPersister.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent;
-
-import com.google.common.io.Files;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.slider.common.params.ActionCreateArgs;
-import org.apache.slider.common.params.AddonArgsDelegate;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.persist.AppDefinitionPersister;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- */
-public class TestAppDefinitionPersister {
-  protected static final Logger log =
-      LoggerFactory.getLogger(TestAppDefinitionPersister.class);
-  @Rule
-  public TemporaryFolder folder = new TemporaryFolder();
-
-  /**
-   * @BeforeClass public static void initialize() { BasicConfigurator.resetConfiguration();
-   * BasicConfigurator.configure(); }*
-   */
-
-
-  @Test
-  public void testAppDefinitionPersister() throws Exception {
-    Configuration configuration = new Configuration();
-    FileSystem fs = FileSystem.getLocal(configuration);
-    log.info("fs working dir is {}", fs.getWorkingDirectory().toString());
-    SliderFileSystem sliderFileSystem = new SliderFileSystem(fs, configuration);
-
-    AppDefinitionPersister adp = new AppDefinitionPersister(sliderFileSystem);
-    String clustername = "c1";
-    ActionCreateArgs buildInfo = new ActionCreateArgs();
-    buildInfo.appMetaInfo = null;
-    buildInfo.appDef = null;
-    buildInfo.addonDelegate = new AddonArgsDelegate();
-
-    // nothing to do
-    adp.processSuppliedDefinitions(clustername, buildInfo, null);
-    adp.persistPackages();
-    List<AppDefinitionPersister.AppDefinition> appDefinitions = adp.getAppDefinitions();
-    Assert.assertTrue(appDefinitions.size() == 0);
-
-    ConfTree ct = new ConfTree();
-    ConfTreeOperations appConf = new ConfTreeOperations(ct);
-    final File tempDir = Files.createTempDir();
-    final File metainfo = new File(tempDir, "metainfo.json");
-
-    // unreadable metainfo
-    buildInfo.appMetaInfo = metainfo;
-
-    try {
-      adp.processSuppliedDefinitions(clustername, buildInfo, appConf);
-    } catch (BadConfigException bce) {
-      log.info(bce.getMessage());
-      Assert.assertTrue(bce.getMessage().contains(
-          "Path specified with "
-              + "--metainfo either cannot be read or is not a file"));
-    }
-
-    try (PrintWriter writer = new PrintWriter(metainfo.getAbsolutePath(), "UTF-8")) {
-      writer.println("{");
-      writer.println("}");
-    }
-    buildInfo.appDef = metainfo;
-
-    try {
-      adp.processSuppliedDefinitions(clustername, buildInfo, appConf);
-    } catch (BadConfigException bce) {
-      log.info(bce.getMessage());
-      Assert.assertTrue(bce.getMessage().contains(
-          "Both --metainfo and --appdef cannot be specified"));
-    }
-
-    // both --metainfojson and --appdef cannot be specified
-    buildInfo.appMetaInfo = null;
-    buildInfo.appMetaInfoJson = "{}";
-    try {
-      adp.processSuppliedDefinitions(clustername, buildInfo, appConf);
-    } catch (BadConfigException bce) {
-      log.info(bce.getMessage());
-      Assert.assertTrue(bce.getMessage().contains(
-          "Both --metainfojson and --appdef cannot be specified"));
-    }
-
-    buildInfo.appDef = null;
-
-    buildInfo.appMetaInfoJson = "";
-    try {
-      adp.processSuppliedDefinitions(clustername, buildInfo, appConf);
-    } catch (BadConfigException bce) {
-      log.info(bce.getMessage());
-      Assert.assertTrue(bce.getMessage().contains(
-          "Empty string specified with --metainfojson"));
-    }
-    buildInfo.appMetaInfo = metainfo;
-
-    // both --metainfo and --metainfojson cannot be specified
-    buildInfo.appMetaInfoJson = "{}";
-    try {
-      adp.processSuppliedDefinitions(clustername, buildInfo, appConf);
-    } catch (BadConfigException bce) {
-      log.info(bce.getMessage());
-      Assert.assertTrue(bce.getMessage().contains(
-          "Both --metainfo and --metainfojson cannot be specified"));
-    }
-    buildInfo.appMetaInfoJson = null;
-
-    appConf.getGlobalOptions().set(AgentKeys.APP_DEF, metainfo.getAbsolutePath());
-
-    try {
-      adp.processSuppliedDefinitions(clustername, buildInfo, appConf);
-    } catch (BadConfigException bce) {
-      log.info(bce.getMessage());
-      Assert.assertTrue(bce.getMessage().contains(
-          "application.def cannot "
-              + "not be set if --metainfo is specified in the cmd line"));
-    }
-
-    appConf.getGlobalOptions().remove(AgentKeys.APP_DEF);
-
-    adp.processSuppliedDefinitions(clustername, buildInfo, appConf);
-    appDefinitions = adp.getAppDefinitions();
-    Assert.assertTrue(appDefinitions.size() == 1);
-    Assert.assertTrue(appConf.getGlobalOptions().get(AgentKeys.APP_DEF).contains("appdef/appPkg.zip"));
-    log.info(appDefinitions.get(0).toString());
-    Assert.assertTrue(appDefinitions.get(0).appDefPkgOrFolder.toString().endsWith("default"));
-    Assert.assertTrue(appDefinitions.get(0).targetFolderInFs.toString().contains("cluster/c1/appdef"));
-    Assert.assertEquals("appPkg.zip", appDefinitions.get(0).pkgName);
-
-    buildInfo.appDef = tempDir;
-    buildInfo.appMetaInfo = null;
-
-    appConf.getGlobalOptions().set(AgentKeys.APP_DEF, metainfo.getAbsolutePath());
-
-    try {
-      adp.processSuppliedDefinitions(clustername, buildInfo, appConf);
-    } catch (BadConfigException bce) {
-      log.info(bce.getMessage());
-      Assert.assertTrue(bce.getMessage().contains("application.def must not be set if --appdef is provided"));
-    }
-
-    adp.getAppDefinitions().clear();
-    appConf.getGlobalOptions().remove(AgentKeys.APP_DEF);
-    adp.processSuppliedDefinitions(clustername, buildInfo, appConf);
-    appDefinitions = adp.getAppDefinitions();
-    Assert.assertTrue(appDefinitions.size() == 1);
-    Assert.assertTrue(appConf.getGlobalOptions().get(AgentKeys.APP_DEF).contains("appdef/appPkg.zip"));
-    log.info(appDefinitions.get(0).toString());
-    Assert.assertTrue(appDefinitions.get(0).appDefPkgOrFolder.toString().endsWith(tempDir.toString()));
-    Assert.assertTrue(appDefinitions.get(0).targetFolderInFs.toString().contains("cluster/c1/appdef"));
-    Assert.assertEquals("appPkg.zip", appDefinitions.get(0).pkgName);
-
-    adp.getAppDefinitions().clear();
-    buildInfo.appDef = null;
-    buildInfo.appMetaInfo = null;
-    appConf.getGlobalOptions().remove(AgentKeys.APP_DEF);
-
-    ArrayList<String> list = new ArrayList<String>() {{
-      add("addon1");
-      add("");
-      add("addon2");
-      add(metainfo.getAbsolutePath());
-    }};
-
-    buildInfo.addonDelegate.addonTuples = list;
-    try {
-      adp.processSuppliedDefinitions(clustername, buildInfo, appConf);
-    } catch (BadConfigException bce) {
-      log.info(bce.getMessage());
-      Assert.assertTrue(bce.getMessage().contains("addon package can only be specified if main app package is specified"));
-    }
-
-    buildInfo.appMetaInfo = metainfo;
-
-    try {
-      adp.processSuppliedDefinitions(clustername, buildInfo, appConf);
-    } catch (BadConfigException bce) {
-      log.info(bce.getMessage());
-      Assert.assertTrue(bce.getMessage().contains("Invalid path for addon package addon1"));
-    }
-
-    appConf.getGlobalOptions().remove(AgentKeys.APP_DEF);
-
-    list = new ArrayList<String>() {{
-      add("addon1");
-      add(tempDir.getAbsolutePath());
-      add("addon2");
-      add(metainfo.getAbsolutePath());
-    }};
-
-    buildInfo.addonDelegate.addonTuples = list;
-    adp.getAppDefinitions().clear();
-
-    adp.processSuppliedDefinitions(clustername, buildInfo, appConf);
-    appDefinitions = adp.getAppDefinitions();
-
-    Assert.assertTrue(appDefinitions.size() == 3);
-    Assert.assertTrue(appConf.getGlobalOptions().get(AgentKeys.APP_DEF).contains("appdef/appPkg.zip"));
-    Assert.assertTrue(appConf.getGlobalOptions().get("application.addon.addon1").contains(
-        "addons/addon1/addon_addon1.zip"));
-    Assert.assertTrue(appConf.getGlobalOptions().get("application.addon.addon2").contains(
-        "addons/addon2/addon_addon2.zip"));
-    log.info(appConf.getGlobalOptions().get("application.addons"));
-    Assert.assertTrue(appConf.getGlobalOptions().get("application.addons").contains(
-        "application.addon.addon2,application.addon.addon1")
-                      || appConf.getGlobalOptions().get("application.addons").contains(
-        "application.addon.addon1,application.addon.addon2"));
-    int seen = 0;
-    for (AppDefinitionPersister.AppDefinition adp_ad : appDefinitions) {
-      if (adp_ad.pkgName.equals("appPkg.zip")) {
-        log.info(adp_ad.toString());
-        Assert.assertTrue(adp_ad.appDefPkgOrFolder.toString().endsWith("default"));
-        Assert.assertTrue(adp_ad.targetFolderInFs.toString().contains("cluster/c1/appdef"));
-        seen++;
-      }
-      if (adp_ad.pkgName.equals("addon_addon1.zip")) {
-        log.info(adp_ad.toString());
-        Assert.assertTrue(adp_ad.appDefPkgOrFolder.toString().endsWith(tempDir.toString()));
-        Assert.assertTrue(adp_ad.targetFolderInFs.toString().contains("addons/addon1"));
-        seen++;
-      }
-      if (adp_ad.pkgName.equals("addon_addon2.zip")) {
-        log.info(adp_ad.toString());
-        Assert.assertTrue(adp_ad.appDefPkgOrFolder.toString().endsWith("metainfo.json"));
-        Assert.assertTrue(adp_ad.targetFolderInFs.toString().contains("addons/addon2"));
-        seen++;
-      }
-    }
-    Assert.assertEquals(3, seen);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/providers/agent/TestComponentTagProvider.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/providers/agent/TestComponentTagProvider.java b/slider-core/src/test/java/org/apache/slider/providers/agent/TestComponentTagProvider.java
deleted file mode 100644
index 7b38ee3..0000000
--- a/slider-core/src/test/java/org/apache/slider/providers/agent/TestComponentTagProvider.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers.agent;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class TestComponentTagProvider {
-  protected static final Logger log =
-      LoggerFactory.getLogger(TestComponentTagProvider.class);
-
-  @Test
-  public void testTagProvider() throws Exception {
-    ComponentTagProvider ctp = new ComponentTagProvider();
-    Assert.assertEquals("", ctp.getTag(null, null));
-    Assert.assertEquals("", ctp.getTag(null, "cid"));
-    Assert.assertEquals("", ctp.getTag("comp1", null));
-
-    Assert.assertEquals("1", ctp.getTag("comp1", "cid1"));
-    Assert.assertEquals("2", ctp.getTag("comp1", "cid2"));
-    Assert.assertEquals("3", ctp.getTag("comp1", "cid3"));
-    ctp.releaseTag("comp1", "cid2");
-    Assert.assertEquals("2", ctp.getTag("comp1", "cid22"));
-
-    ctp.releaseTag("comp1", "cid4");
-    ctp.recordAssignedTag("comp1", "cid5", "5");
-    Assert.assertEquals("4", ctp.getTag("comp1", "cid4"));
-    Assert.assertEquals("4", ctp.getTag("comp1", "cid4"));
-    Assert.assertEquals("6", ctp.getTag("comp1", "cid6"));
-
-    ctp.recordAssignedTag("comp1", "cid55", "5");
-    Assert.assertEquals("5", ctp.getTag("comp1", "cid55"));
-
-    ctp.recordAssignedTag("comp2", "cidb3", "3");
-    Assert.assertEquals("1", ctp.getTag("comp2", "cidb1"));
-    Assert.assertEquals("2", ctp.getTag("comp2", "cidb2"));
-    Assert.assertEquals("4", ctp.getTag("comp2", "cidb4"));
-
-    ctp.recordAssignedTag("comp2", "cidb5", "six");
-    ctp.recordAssignedTag("comp2", "cidb5", "-55");
-    ctp.recordAssignedTag("comp2", "cidb5", "tags");
-    ctp.recordAssignedTag("comp2", "cidb5", null);
-    ctp.recordAssignedTag("comp2", "cidb5", "");
-    ctp.recordAssignedTag("comp2", "cidb5", "5");
-    Assert.assertEquals("6", ctp.getTag("comp2", "cidb6"));
-
-    ctp.recordAssignedTag("comp2", null, "5");
-    ctp.recordAssignedTag(null, null, "5");
-    ctp.releaseTag("comp1", null);
-    ctp.releaseTag(null, "cid4");
-    ctp.releaseTag(null, null);
-  }
-
-  @Test
-  public void testTagProviderWithThread() throws Exception {
-    ComponentTagProvider ctp = new ComponentTagProvider();
-    Thread thread = new Thread(new Taggged(ctp));
-    Thread thread2 = new Thread(new Taggged(ctp));
-    Thread thread3 = new Thread(new Taggged(ctp));
-    thread.start();
-    thread2.start();
-    thread3.start();
-    ctp.getTag("comp1", "cid50");
-    thread.join();
-    thread2.join();
-    thread3.join();
-    Assert.assertEquals("101", ctp.getTag("comp1", "cid101"));
-  }
-
-  public class Taggged implements Runnable {
-    private final ComponentTagProvider ctp;
-
-    public Taggged(ComponentTagProvider ctp) {
-      this.ctp = ctp;
-    }
-
-    public void run() {
-      for (int i = 0; i < 100; i++) {
-        String containerId = "cid" + (i + 1);
-        this.ctp.getTag("comp1", containerId);
-      }
-      for (int i = 0; i < 100; i++) {
-        String containerId = "cid" + (i + 1);
-        this.ctp.getTag("comp1", containerId);
-      }
-      for (int i = 0; i < 100; i += 2) {
-        String containerId = "cid" + (i + 1);
-        this.ctp.releaseTag("comp1", containerId);
-      }
-      for (int i = 0; i < 100; i += 2) {
-        String containerId = "cid" + (i + 1);
-        this.ctp.getTag("comp1", containerId);
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/providers/agent/TestState.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/providers/agent/TestState.java b/slider-core/src/test/java/org/apache/slider/providers/agent/TestState.java
deleted file mode 100644
index 6a2e5ab..0000000
--- a/slider-core/src/test/java/org/apache/slider/providers/agent/TestState.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TestState {
-  protected static final Logger log = LoggerFactory.getLogger(TestState.class);
-
-  @Test
-  public void testState() throws Exception {
-    State state = State.STARTED;
-    Assert.assertEquals(Command.STOP, state.getSupportedCommand(false, true));
-  }
-}


[02/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/providers/agent/application/metadata/TestConfigParser.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/providers/agent/application/metadata/TestConfigParser.java b/slider-core/src/test/java/org/apache/slider/providers/agent/application/metadata/TestConfigParser.java
deleted file mode 100644
index 3aa44a1..0000000
--- a/slider-core/src/test/java/org/apache/slider/providers/agent/application/metadata/TestConfigParser.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- *
- */
-public class TestConfigParser {
-  protected static final Logger log =
-      LoggerFactory.getLogger(TestConfigParser.class);
-  private static final String config_1_str = "<configuration>\n"
-                                             + "  <property>\n"
-                                             + "    <name>security.client.protocol.acl</name>\n"
-                                             + "    <value>*</value>\n"
-                                             + "    <description>ACL for HRegionInterface protocol implementations (ie. \n"
-                                             + "    clients talking to HRegionServers)\n"
-                                             + "    The ACL is a comma-separated list of user and group names. The user and \n"
-                                             + "    group list is separated by a blank. For e.g. \"alice,bob users,wheel\". \n"
-                                             + "    A special value of \"*\" means all users are allowed.</description>\n"
-                                             + "  </property>\n"
-                                             + "\n"
-                                             + "  <property>\n"
-                                             + "    <name>security.admin.protocol.acl</name>\n"
-                                             + "    <value>*</value>\n"
-                                             + "    <description>ACL for HMasterInterface protocol implementation (ie. \n"
-                                             + "    clients talking to HMaster for admin operations).\n"
-                                             + "    The ACL is a comma-separated list of user and group names. The user and \n"
-                                             + "    group list is separated by a blank. For e.g. \"alice,bob users,wheel\". \n"
-                                             + "    A special value of \"*\" means all users are allowed.</description>\n"
-                                             + "  </property>\n"
-                                             + "\n"
-                                             + "  <property>\n"
-                                             + "    <name>security.masterregion.protocol.acl</name>\n"
-                                             + "    <value>*</value>\n"
-                                             + "    <description>ACL for HMasterRegionInterface protocol implementations\n"
-                                             + "    (for HRegionServers communicating with HMaster)\n"
-                                             + "    The ACL is a comma-separated list of user and group names. The user and \n"
-                                             + "    group list is separated by a blank. For e.g. \"alice,bob users,wheel\". \n"
-                                             + "    A special value of \"*\" means all users are allowed.</description>\n"
-                                             + "  </property>\n"
-                                             + "  <property>\n"
-                                             + "    <name>emptyVal</name>\n"
-                                             + "    <value></value>\n"
-                                             + "    <description>non-empty-desc</description>\n"
-                                             + "  </property>\n"
-                                             + "  <property>\n"
-                                             + "    <name>emptyDesc</name>\n"
-                                             + "    <value></value>\n"
-                                             + "    <description></description>\n"
-                                             + "  </property>\n"
-                                             + "  <property>\n"
-                                             + "    <name>noDesc</name>\n"
-                                             + "    <value></value>\n"
-                                             + "  </property>\n"
-                                             + "</configuration>";
-
-  @Test
-  public void testParse() throws IOException {
-
-    InputStream config_1 = new ByteArrayInputStream(config_1_str.getBytes());
-    DefaultConfig config = new DefaultConfigParser().parse(config_1);
-    Assert.assertNotNull(config);
-    Assert.assertNotNull(config.getPropertyInfos());
-    Assert.assertEquals(6, config.getPropertyInfos().size());
-    for (PropertyInfo pInfo : config.getPropertyInfos()) {
-      if (pInfo.getName().equals("security.client.protocol.acl")) {
-        Assert.assertEquals("*", pInfo.getValue());
-        Assert.assertTrue(pInfo.getDescription().startsWith("ACL for HRegionInterface "));
-      }
-      if (pInfo.getName().equals("emptyVal")) {
-        Assert.assertEquals("", pInfo.getValue());
-        Assert.assertEquals("non-empty-desc", pInfo.getDescription());
-      }
-      if (pInfo.getName().equals("emptyDesc")) {
-        Assert.assertEquals("", pInfo.getValue());
-        Assert.assertEquals("", pInfo.getDescription());
-      }
-      if (pInfo.getName().equals("noDesc")) {
-        Assert.assertEquals("", pInfo.getValue());
-        Assert.assertNull(pInfo.getDescription());
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/providers/agent/application/metadata/TestMetainfoParser.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/providers/agent/application/metadata/TestMetainfoParser.java b/slider-core/src/test/java/org/apache/slider/providers/agent/application/metadata/TestMetainfoParser.java
deleted file mode 100644
index ba1912a..0000000
--- a/slider-core/src/test/java/org/apache/slider/providers/agent/application/metadata/TestMetainfoParser.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.providers.agent.AgentProviderService;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-
-import static org.mockito.Mockito.doReturn;
-
-/**
- *
- */
-public class TestMetainfoParser {
-  protected static final Logger log =
-      LoggerFactory.getLogger(TestMetainfoParser.class);
-  public static final String METAINFO_XML =
-      "/org/apache/slider/providers/agent/application/metadata/metainfo.xml";
-
-  @Test
-  public void testParse() throws IOException {
-
-    InputStream resStream = this.getClass().getResourceAsStream(
-        METAINFO_XML);
-    MetainfoParser parser = new MetainfoParser();
-    Metainfo metainfo = parser.fromXmlStream(resStream);
-    Assert.assertNotNull(metainfo);
-    Assert.assertNotNull(metainfo.getApplication());
-    Application application = metainfo.getApplication();
-    assert "STORM".equals(application.getName());
-    assert 6 == application.getComponents().size();
-    OSPackage pkg = application.getOSSpecifics().get(0).getPackages().get(0);
-    assert "tarball".equals(pkg.getType());
-    assert "files/apache-storm-0.9.1.2.1.1.0-237.tar.gz".equals(pkg.getName());
-    boolean found = false;
-    for (Component comp : application.getComponents()) {
-      if (comp != null && comp.getName().equals("NIMBUS")) {
-        found = true;
-        Assert.assertEquals(0, comp.getComponentExports().size());
-      }
-      if (comp != null && comp.getName().equals("SUPERVISOR")) {
-        Assert.assertEquals(1, comp.getComponentExports().size());
-      }
-      if (comp != null && comp.getName().equals("ANOTHER_COMPONENT")) {
-        assert 2 == comp.getCommands().size();
-        assert "start command".equals(comp.getCommands().get(0).getExec());
-        assert "START".equals(comp.getCommands().get(0).getName());
-        assert "stop command".equals(comp.getCommands().get(1).getExec());
-        assert "STOP".equals(comp.getCommands().get(1).getName());
-      }
-    }
-    assert found;
-    Assert.assertEquals(0, application.getConfigFiles().size());
-    assert 1 == application.getPackages().size();
-    Package p = application.getPackages().get(0);
-    assert "tarball".equals(p.getType());
-    assert "test-tarball-name.tgz".equals(p.getName());
-  }
-
-  @Test
-  public void testJsonParse() throws IOException {
-    String metaInfo1_json = "{\n"
-                            + "\"schemaVersion\":\"2.2\",\n"
-                            + "\"application\":{\n"
-                            +     "\"name\": \"MEMCACHED\","
-                            +     "\"exportGroups\": ["
-                            +        "{"
-                            +          "\"name\": \"Servers\","
-                            +          "\"exports\": ["
-                            +            "{"
-                            +               "\"name\": \"host_port\","
-                            +               "\"value\": \"${MEMCACHED_HOST}:${site.global.port}\""
-                            +            "}"
-                            +          "]"
-                            +        "}"
-                            +      "],"
-                            +     "\"components\": ["
-                            +        "{"
-                            +          "\"name\": \"MEMCACHED\","
-                            +          "\"compExports\": \"Servers-host_port\","
-                            +          "\"commands\": ["
-                            +            "{"
-                            +               "\"exec\": \"java -classpath /usr/myapps/memcached/*:/usr/lib/hadoop/lib/* com.thimbleware.jmemcached.Main\""
-                            +            "}"
-                            +          "]"
-                            +        "},"
-                            +        "{"
-                            +          "\"name\": \"MEMCACHED2\","
-                            +          "\"commands\": ["
-                            +            "{"
-                            +               "\"exec\": \"scripts/config.py\","
-                            +               "\"type\": \"PYTHON\","
-                            +               "\"name\": \"CONFIGURE\""
-                            +            "}"
-                            +          "],"
-                            +          "\"dockerContainers\": ["
-                            +            "{"
-                            +               "\"name\": \"redis\","
-                            +               "\"image\": \"dockerhub/redis\","
-                            +               "\"options\": \"-net=bridge\","
-                            +               "\"mounts\": ["
-                            +                 "{"
-                            +                   "\"containerMount\": \"/tmp/conf\","
-                            +                   "\"hostMount\": \"{$conf:@//site/global/app_root}/conf\""
-                            +                 "}"
-                            +               "]"
-                            +            "}"
-                            +          "]"
-                            +        "}"
-                            +      "]"
-                            +   "}"
-                            + "}";
-
-    MetainfoParser parser = new MetainfoParser();
-    Metainfo mInfo = parser.fromJsonString(metaInfo1_json);
-    Assert.assertEquals("2.2", mInfo.getSchemaVersion());
-
-    Application app = mInfo.getApplication();
-    Assert.assertNotNull(app);
-
-    Assert.assertEquals("MEMCACHED", app.getName());
-    List<ExportGroup> egs = app.getExportGroups();
-    Assert.assertEquals(1, egs.size());
-    ExportGroup eg = egs.get(0);
-    Assert.assertEquals("Servers", eg.getName());
-    List<Export> exports = eg.getExports();
-    Assert.assertEquals(1, exports.size());
-    Export export = exports.get(0);
-    Assert.assertEquals("host_port", export.getName());
-    Assert.assertEquals("${MEMCACHED_HOST}:${site.global.port}", export.getValue());
-
-    List<Component> components = app.getComponents();
-    Assert.assertEquals(2, components.size());
-
-    Component c1 = mInfo.getApplicationComponent("MEMCACHED");
-    Assert.assertNotNull(c1);
-    Assert.assertEquals("MEMCACHED", c1.getName());
-    Assert.assertEquals("Servers-host_port", c1.getCompExports());
-    Assert.assertEquals(1, c1.getCommands().size());
-    ComponentCommand cmd = c1.getCommands().get(0);
-    Assert.assertEquals("START", cmd.getName());
-    Assert.assertEquals("SHELL", cmd.getType());
-    Assert.assertEquals("java -classpath /usr/myapps/memcached/*:/usr/lib/hadoop/lib/* com.thimbleware.jmemcached.Main",
-                        cmd.getExec());
-
-    Component c2 = mInfo.getApplicationComponent("MEMCACHED2");
-    Assert.assertNotNull(c2);
-    Assert.assertEquals("MEMCACHED2", c2.getName());
-    Assert.assertEquals(1, c2.getCommands().size());
-    cmd = c2.getCommands().get(0);
-    Assert.assertEquals("CONFIGURE", cmd.getName());
-    Assert.assertEquals("PYTHON", cmd.getType());
-    Assert.assertEquals("scripts/config.py", cmd.getExec());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/appmaster/TestServiceRecordAttributes.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/appmaster/TestServiceRecordAttributes.java b/slider-core/src/test/java/org/apache/slider/server/appmaster/TestServiceRecordAttributes.java
deleted file mode 100644
index a1986cd..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/appmaster/TestServiceRecordAttributes.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster;
-
-import org.apache.hadoop.registry.client.types.ServiceRecord;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.core.conf.MapOperations;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- *
- */
-public class TestServiceRecordAttributes extends Assert {
-
-  @Test
-  public void testAppConfigProvidedServiceRecordAttributes() throws Exception {
-    Map<String, String> options = new HashMap<>();
-    options.put("slider.some.arbitrary.option", "arbitrary value");
-    options.put("service.record.attribute.one_attribute", "one_attribute_value");
-    options.put("service.record.attribute.second_attribute", "second_attribute_value");
-    MapOperations serviceProps = new MapOperations(SliderKeys.COMPONENT_AM, options);
-    options = new HashMap<>();
-    options.put("some.component.attribute", "component_attribute_value");
-    options.put("service.record.attribute.component_attribute", "component_attribute_value");
-    MapOperations compProps = new MapOperations("TEST_COMP", options);
-
-    SliderAppMaster appMaster = new SliderAppMaster();
-
-    ServiceRecord appServiceRecord = new ServiceRecord();
-
-    appMaster.setProvidedServiceRecordAttributes(serviceProps, appServiceRecord);
-
-    assertNull("property should not be attribute",
-               appServiceRecord.get("slider.some.arbitrary.option"));
-    assertEquals("wrong value", "one_attribute_value",
-                 appServiceRecord.get("one_attribute"));
-    assertEquals("wrong value", "second_attribute_value",
-                 appServiceRecord.get("second_attribute"));
-
-    ServiceRecord compServiceRecord = new ServiceRecord();
-
-    appMaster.setProvidedServiceRecordAttributes(compProps, compServiceRecord);
-
-    assertNull("should not be attribute",
-               compServiceRecord.get("some.component.attribute"));
-    assertEquals("wrong value", "component_attribute_value",
-                 compServiceRecord.get("component_attribute"));
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/publisher/TestAgentProviderService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/publisher/TestAgentProviderService.java b/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/publisher/TestAgentProviderService.java
deleted file mode 100644
index 7fceac7..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/publisher/TestAgentProviderService.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.publisher;
-
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.providers.agent.AgentProviderService;
-import org.apache.slider.server.appmaster.actions.QueueAccess;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- *
- */
-public class TestAgentProviderService extends AgentProviderService {
-  protected static final Logger log =
-      LoggerFactory.getLogger(TestAgentProviderService.class);
-
-  public TestAgentProviderService() {
-    super();
-    log.info("TestAgentProviderService created");
-  }
-
-  @Override
-  public void bind(StateAccessForProviders stateAccessor,
-      QueueAccess queueAccess,
-      List<Container> liveContainers) {
-    super.bind(stateAccessor, queueAccess, liveContainers);
-    Map<String,String> dummyProps = new HashMap<String, String>();
-    dummyProps.put("prop1", "val1");
-    dummyProps.put("prop2", "val2");
-    log.info("publishing dummy-site.xml with values {}", dummyProps);
-    publishApplicationInstanceData("dummy-site", "dummy configuration",
-                                   dummyProps.entrySet());
-    // publishing global config for testing purposes
-    publishApplicationInstanceData("global", "global configuration",
-                                   stateAccessor.getAppConfSnapshot()
-                                       .getGlobalOptions().entrySet());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/publisher/TestSliderProviderFactory.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/publisher/TestSliderProviderFactory.java b/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/publisher/TestSliderProviderFactory.java
deleted file mode 100644
index f49e15a..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/appmaster/web/rest/publisher/TestSliderProviderFactory.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.publisher;
-
-import org.apache.slider.providers.ProviderService;
-import org.apache.slider.providers.agent.AgentProviderFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- */
-public class TestSliderProviderFactory extends AgentProviderFactory{
-  protected static final Logger log =
-      LoggerFactory.getLogger(TestSliderProviderFactory.class);
-
-  public TestSliderProviderFactory() {
-    log.info("Created TestSliderProviderFactory");
-  }
-
-  @Override
-  public ProviderService createServerProvider() {
-    log.info("Creating TestAgentProviderService");
-    return new TestAgentProviderService();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/servicemonitor/TestPortProbe.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/servicemonitor/TestPortProbe.java b/slider-core/src/test/java/org/apache/slider/server/servicemonitor/TestPortProbe.java
deleted file mode 100644
index 1b42edd..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/servicemonitor/TestPortProbe.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.servicemonitor;
-
-import junit.framework.Assert;
-import org.apache.hadoop.conf.Configuration;
-import org.junit.Test;
-
-public class TestPortProbe extends Assert {
-  /**
-   * Assert that a port probe failed if the port is closed
-   * @throws Throwable
-   */
-  @Test
-  public void testPortProbeFailsClosedPort() throws Throwable {
-    PortProbe probe = new PortProbe("127.0.0.1", 65500, 100, "", new Configuration());
-    probe.init();
-    ProbeStatus status = probe.ping(true);
-    assertFalse("Expected a failure but got successful result: " + status,
-      status.isSuccess());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/services/security/TestCertificateManager.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/services/security/TestCertificateManager.java b/slider-core/src/test/java/org/apache/slider/server/services/security/TestCertificateManager.java
deleted file mode 100644
index 7a4a586..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/services/security/TestCertificateManager.java
+++ /dev/null
@@ -1,540 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.services.security;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.security.alias.CredentialProvider;
-import org.apache.hadoop.security.alias.CredentialProviderFactory;
-import org.apache.hadoop.security.alias.JavaKeyStoreProvider;
-import org.apache.slider.Slider;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.SliderXmlConfKeys;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.SliderException;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.TrustManagerFactory;
-import javax.net.ssl.X509TrustManager;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.InetAddress;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.Principal;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- *
- */
-public class TestCertificateManager {
-  @Rule
-  public TemporaryFolder workDir = new TemporaryFolder();
-  private File secDir;
-  private CertificateManager certMan;
-
-  @Before
-  public void setup() throws Exception {
-    certMan = new CertificateManager();
-    MapOperations compOperations = new MapOperations();
-    secDir = new File(workDir.getRoot(), SliderKeys.SECURITY_DIR);
-    File keystoreFile = new File(secDir, SliderKeys.KEYSTORE_FILE_NAME);
-    compOperations.put(SliderXmlConfKeys.KEY_KEYSTORE_LOCATION,
-                       keystoreFile.getAbsolutePath());
-    certMan.initialize(compOperations, "cahost", null, null);
-  }
-
-  @Test
-  public void testServerCertificateGenerated() throws Exception {
-    File serverCrt = new File(secDir, SliderKeys.CRT_FILE_NAME);
-    Assert.assertTrue("Server CRD does not exist:" + serverCrt,
-                      serverCrt.exists());
-  }
-
-  @Test
-  public void testAMKeystoreGenerated() throws Exception {
-    File keystoreFile = new File(secDir, SliderKeys.KEYSTORE_FILE_NAME);
-    Assert.assertTrue("Keystore does not exist: " + keystoreFile,
-                      keystoreFile.exists());
-    InputStream is = null;
-    try {
-
-      is = new FileInputStream(keystoreFile);
-      KeyStore keystore = KeyStore.getInstance("pkcs12");
-      String password = SecurityUtils.getKeystorePass();
-      keystore.load(is, password.toCharArray());
-
-      Certificate certificate = keystore.getCertificate(
-          keystore.aliases().nextElement());
-      Assert.assertNotNull(certificate);
-
-      if (certificate instanceof X509Certificate) {
-        X509Certificate x509cert = (X509Certificate) certificate;
-
-        // Get subject
-        Principal principal = x509cert.getSubjectDN();
-        String subjectDn = principal.getName();
-        Assert.assertEquals("wrong DN",
-                            "CN=cahost",
-                            subjectDn);
-
-        // Get issuer
-        principal = x509cert.getIssuerDN();
-        String issuerDn = principal.getName();
-        Assert.assertEquals("wrong Issuer DN",
-                            "CN=cahost",
-                            issuerDn);
-      }
-    } finally {
-      if(null != is) {
-        is.close();
-      }
-    }
-  }
-
-  @Test
-  public void testContainerCertificateGeneration() throws Exception {
-    certMan.generateContainerCertificate("testhost", "container1");
-    Assert.assertTrue("container certificate not generated",
-                      new File(secDir, "container1.crt").exists());
-  }
-
-  @Test
-  public void testContainerKeystoreGeneration() throws Exception {
-    SecurityStore keystoreFile = certMan.generateContainerKeystore("testhost",
-                                                                   "container1",
-                                                                   "component1",
-                                                                   "password");
-    validateKeystore(keystoreFile.getFile(), "testhost", "cahost");
-  }
-
-  private void validateKeystore(File keystoreFile, String certHostname,
-                                String issuerHostname)
-      throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {
-    Assert.assertTrue("container keystore not generated",
-                      keystoreFile.exists());
-
-    InputStream is = null;
-    try {
-
-      is = new FileInputStream(keystoreFile);
-      KeyStore keystore = KeyStore.getInstance("pkcs12");
-      String password = "password";
-      keystore.load(is, password.toCharArray());
-
-      Certificate certificate = keystore.getCertificate(
-          keystore.aliases().nextElement());
-      Assert.assertNotNull(certificate);
-
-      if (certificate instanceof X509Certificate) {
-        X509Certificate x509cert = (X509Certificate) certificate;
-
-        // Get subject
-        Principal principal = x509cert.getSubjectDN();
-        String subjectDn = principal.getName();
-        Assert.assertEquals("wrong DN", "CN=" + certHostname + ", OU=container1",
-                            subjectDn);
-
-        // Get issuer
-        principal = x509cert.getIssuerDN();
-        String issuerDn = principal.getName();
-        Assert.assertEquals("wrong Issuer DN",
-                            "CN=" + issuerHostname,
-                            issuerDn);
-      }
-    } finally {
-      if(null != is) {
-        is.close();
-      }
-    }
-  }
-
-  @Test
-  public void testContainerKeystoreGenerationViaStoresGenerator() throws Exception {
-    AggregateConf instanceDefinition = new AggregateConf();
-    MapOperations compOps = new MapOperations();
-    instanceDefinition.getAppConf().components.put("component1", compOps);
-    compOps.put(SliderKeys.COMP_KEYSTORE_PASSWORD_PROPERTY_KEY,
-                "app1.component1.password.property");
-    compOps.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "true");
-    instanceDefinition.getAppConf().global.put(
-        "app1.component1.password.property", "password");
-    instanceDefinition.resolve();
-    SecurityStore[]
-        files = StoresGenerator.generateSecurityStores("testhost",
-                                                       "container1",
-                                                       "component1",
-                                                       instanceDefinition,
-                                                       compOps);
-    assertEquals("wrong number of stores", 1, files.length);
-    validateKeystore(files[0].getFile(), "testhost", "cahost");
-  }
-
-  @Test
-  public void testContainerKeystoreGenerationViaStoresGeneratorUsingGlobalProps() throws Exception {
-    AggregateConf instanceDefinition = new AggregateConf();
-    MapOperations compOps = new MapOperations();
-    instanceDefinition.getAppConf().components.put("component1", compOps);
-    compOps.put(SliderKeys.COMP_KEYSTORE_PASSWORD_PROPERTY_KEY,
-                "app1.component1.password.property");
-    instanceDefinition.getAppConf().global.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "true");
-    compOps.put(
-        "app1.component1.password.property", "password");
-    instanceDefinition.resolve();
-    SecurityStore[]
-        files = StoresGenerator.generateSecurityStores("testhost",
-                                                       "container1",
-                                                       "component1",
-                                                       instanceDefinition,
-                                                       compOps);
-    assertEquals("wrong number of stores", 1, files.length);
-    validateKeystore(files[0].getFile(), "testhost", "cahost");
-  }
-
-  @Test
-  public void testContainerKeystoreGenerationViaStoresGeneratorOverrideGlobalSetting() throws Exception {
-    AggregateConf instanceDefinition = new AggregateConf();
-    MapOperations compOps = setupComponentOptions(true, null,
-                                                  "app1.component1.password.property",
-                                                  null, null);
-    instanceDefinition.getAppConf().components.put("component1", compOps);
-    instanceDefinition.getAppConf().global.put(
-        "app1.component1.password.property", "password");
-    instanceDefinition.getAppConf().global.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "false");
-    instanceDefinition.resolve();
-    SecurityStore[]
-        files = StoresGenerator.generateSecurityStores("testhost",
-                                                       "container1",
-                                                       "component1",
-                                                       instanceDefinition,
-                                                       compOps);
-    assertEquals("wrong number of stores", 1, files.length);
-    validateKeystore(files[0].getFile(), "testhost", "cahost");
-  }
-
-  @Test
-  public void testContainerTrusttoreGeneration() throws Exception {
-    SecurityStore keystoreFile =
-        certMan.generateContainerKeystore("testhost",
-                                          "container1",
-                                          "component1",
-                                          "keypass");
-    Assert.assertTrue("container keystore not generated",
-                      keystoreFile.getFile().exists());
-    SecurityStore truststoreFile =
-        certMan.generateContainerTruststore("container1",
-                                            "component1", "trustpass"
-        );
-    Assert.assertTrue("container truststore not generated",
-                      truststoreFile.getFile().exists());
-
-    validateTruststore(keystoreFile.getFile(), truststoreFile.getFile());
-  }
-
-  @Test
-  public void testContainerGenerationUsingStoresGeneratorNoTruststore() throws Exception {
-    AggregateConf instanceDefinition = new AggregateConf();
-    MapOperations compOps = new MapOperations();
-    compOps.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "true");
-    compOps.put(SliderKeys.COMP_KEYSTORE_PASSWORD_ALIAS_KEY,
-                "test.keystore.password");
-
-    setupCredentials(instanceDefinition, "test.keystore.password", null);
-
-    SecurityStore[]
-        files = StoresGenerator.generateSecurityStores("testhost",
-                                                       "container1",
-                                                       "component1",
-                                                       instanceDefinition,
-                                                       compOps);
-    assertEquals("wrong number of stores", 1, files.length);
-    File keystoreFile = CertificateManager.getContainerKeystoreFilePath(
-        "container1", "component1");
-    Assert.assertTrue("container keystore not generated",
-                      keystoreFile.exists());
-
-    Assert.assertTrue("keystore not in returned list",
-                      Arrays.asList(files).contains(new SecurityStore(keystoreFile,
-                                                    SecurityStore.StoreType.keystore)));
-    File truststoreFile =
-        CertificateManager.getContainerTruststoreFilePath("component1",
-                                                          "container1");
-    Assert.assertFalse("container truststore generated",
-                      truststoreFile.exists());
-    Assert.assertFalse("truststore in returned list",
-                      Arrays.asList(files).contains(new SecurityStore(truststoreFile,
-                                                    SecurityStore.StoreType.truststore)));
-
-  }
-
-  @Test
-  public void testContainerGenerationUsingStoresGeneratorJustTruststoreWithDefaultAlias() throws Exception {
-    AggregateConf instanceDefinition = new AggregateConf();
-    MapOperations compOps = setupComponentOptions(true);
-
-    setupCredentials(instanceDefinition, null,
-                     SliderKeys.COMP_TRUSTSTORE_PASSWORD_ALIAS_DEFAULT);
-
-    SecurityStore[]
-        files = StoresGenerator.generateSecurityStores("testhost",
-                                                       "container1",
-                                                       "component1",
-                                                       instanceDefinition,
-                                                       compOps);
-    assertEquals("wrong number of stores", 1, files.length);
-    File keystoreFile = CertificateManager.getContainerKeystoreFilePath(
-        "container1", "component1");
-    Assert.assertFalse("container keystore generated",
-                       keystoreFile.exists());
-    Assert.assertFalse("keystore in returned list",
-                       Arrays.asList(files).contains(keystoreFile));
-    File truststoreFile =
-        CertificateManager.getContainerTruststoreFilePath("component1",
-                                                          "container1");
-    Assert.assertTrue("container truststore not generated",
-                      truststoreFile.exists());
-    Assert.assertTrue("truststore not in returned list",
-                      Arrays.asList(files).contains(new SecurityStore(truststoreFile,
-                                                                      SecurityStore.StoreType.truststore)));
-
-  }
-
-  @Test
-  public void testContainerTrusttoreGenerationUsingStoresGenerator() throws Exception {
-    AggregateConf instanceDefinition = new AggregateConf();
-    MapOperations compOps = setupComponentOptions(true,
-                                                  "test.keystore.password",
-                                                  null,
-                                                  "test.truststore.password",
-                                                  null);
-
-    setupCredentials(instanceDefinition, "test.keystore.password",
-                     "test.truststore.password");
-
-    SecurityStore[]
-        files = StoresGenerator.generateSecurityStores("testhost",
-                                                       "container1",
-                                                       "component1",
-                                                       instanceDefinition,
-                                                       compOps);
-    assertEquals("wrong number of stores", 2, files.length);
-    File keystoreFile = CertificateManager.getContainerKeystoreFilePath(
-        "container1", "component1");
-    Assert.assertTrue("container keystore not generated",
-                      keystoreFile.exists());
-    Assert.assertTrue("keystore not in returned list",
-                      Arrays.asList(files).contains(new SecurityStore(keystoreFile,
-                                                                      SecurityStore.StoreType.keystore)));
-    File truststoreFile =
-        CertificateManager.getContainerTruststoreFilePath("component1",
-                                                          "container1");
-    Assert.assertTrue("container truststore not generated",
-                      truststoreFile.exists());
-    Assert.assertTrue("truststore not in returned list",
-                      Arrays.asList(files).contains(new SecurityStore(truststoreFile,
-                                                                      SecurityStore.StoreType.truststore)));
-
-    validateTruststore(keystoreFile, truststoreFile);
-  }
-
-  private void setupCredentials(AggregateConf instanceDefinition,
-                                String keyAlias, String trustAlias)
-      throws Exception {
-    Configuration conf = new Configuration();
-    final Path jksPath = new Path(SecurityUtils.getSecurityDir(), "test.jks");
-    final String ourUrl =
-        JavaKeyStoreProvider.SCHEME_NAME + "://file" + jksPath.toUri();
-
-    File file = new File(SecurityUtils.getSecurityDir(), "test.jks");
-    file.delete();
-    conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, ourUrl);
-
-    instanceDefinition.getAppConf().credentials.put(ourUrl, new ArrayList<String>());
-
-    CredentialProvider provider =
-        CredentialProviderFactory.getProviders(conf).get(0);
-
-    // create new aliases
-    try {
-
-      if (keyAlias != null) {
-        char[] storepass = {'k', 'e', 'y', 'p', 'a', 's', 's'};
-        provider.createCredentialEntry(
-            keyAlias, storepass);
-      }
-
-      if (trustAlias != null) {
-        char[] trustpass = {'t', 'r', 'u', 's', 't', 'p', 'a', 's', 's'};
-        provider.createCredentialEntry(
-            trustAlias, trustpass);
-      }
-
-      // write out so that it can be found in checks
-      provider.flush();
-    } catch (Exception e) {
-      e.printStackTrace();
-      throw e;
-    }
-  }
-
-  private MapOperations setupComponentOptions(boolean storesRequired) {
-    return this.setupComponentOptions(storesRequired, null, null, null, null);
-  }
-
-  private MapOperations setupComponentOptions(boolean storesRequired,
-                                              String keyAlias,
-                                              String keyPwd,
-                                              String trustAlias,
-                                              String trustPwd) {
-    MapOperations compOps = new MapOperations();
-    compOps.put(SliderKeys.COMP_STORES_REQUIRED_KEY,
-                Boolean.toString(storesRequired));
-    if (keyAlias != null) {
-      compOps.put(SliderKeys.COMP_KEYSTORE_PASSWORD_ALIAS_KEY,
-                  "test.keystore.password");
-    }
-    if (trustAlias != null) {
-      compOps.put(SliderKeys.COMP_TRUSTSTORE_PASSWORD_ALIAS_KEY,
-                  "test.truststore.password");
-    }
-    if (keyPwd != null) {
-      compOps.put(SliderKeys.COMP_KEYSTORE_PASSWORD_PROPERTY_KEY,
-                  keyPwd);
-    }
-    if (trustPwd != null) {
-      compOps.put(SliderKeys.COMP_TRUSTSTORE_PASSWORD_PROPERTY_KEY,
-                  trustPwd);
-    }
-    return compOps;
-  }
-
-  @Test
-  public void testContainerStoresGenerationKeystoreOnly() throws Exception {
-    AggregateConf instanceDefinition = new AggregateConf();
-    MapOperations compOps = new MapOperations();
-    compOps.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "true");
-
-    setupCredentials(instanceDefinition,
-                     SliderKeys.COMP_KEYSTORE_PASSWORD_ALIAS_DEFAULT, null);
-
-    SecurityStore[]
-        files = StoresGenerator.generateSecurityStores("testhost",
-                                                       "container1",
-                                                       "component1",
-                                                       instanceDefinition,
-                                                       compOps);
-    assertEquals("wrong number of stores", 1, files.length);
-    File keystoreFile = CertificateManager.getContainerKeystoreFilePath(
-        "container1", "component1");
-    Assert.assertTrue("container keystore not generated",
-                      keystoreFile.exists());
-    Assert.assertTrue("keystore not in returned list",
-                      Arrays.asList(files).contains(new SecurityStore(keystoreFile,
-                                                                      SecurityStore.StoreType.keystore)));
-    File truststoreFile =
-        CertificateManager.getContainerTruststoreFilePath("component1",
-                                                          "container1");
-    Assert.assertFalse("container truststore generated",
-                       truststoreFile.exists());
-    Assert.assertFalse("truststore in returned list",
-                       Arrays.asList(files).contains(new SecurityStore(truststoreFile,
-                                                                       SecurityStore.StoreType.truststore)));
-
-  }
-
-  @Test
-  public void testContainerStoresGenerationMisconfiguration() throws Exception {
-    AggregateConf instanceDefinition = new AggregateConf();
-    MapOperations compOps = new MapOperations();
-    compOps.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "true");
-
-    setupCredentials(instanceDefinition, "cant.be.found", null);
-
-    try {
-      StoresGenerator.generateSecurityStores("testhost", "container1",
-                                                            "component1", instanceDefinition,
-                                                            compOps);
-      Assert.fail("SliderException should have been generated");
-    } catch (SliderException e) {
-      // ignore - should be thrown
-    }
-  }
-
-  private void validateTruststore(File keystoreFile, File truststoreFile)
-      throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {
-    InputStream keyis = null;
-    InputStream trustis = null;
-    try {
-
-      // create keystore
-      keyis = new FileInputStream(keystoreFile);
-      KeyStore keystore = KeyStore.getInstance("pkcs12");
-      String password = "keypass";
-      keystore.load(keyis, password.toCharArray());
-
-      // obtain server cert
-      Certificate certificate = keystore.getCertificate(
-          keystore.aliases().nextElement());
-      Assert.assertNotNull(certificate);
-
-      // create trust store from generated trust store file
-      trustis = new FileInputStream(truststoreFile);
-      KeyStore truststore = KeyStore.getInstance("pkcs12");
-      password = "trustpass";
-      truststore.load(trustis, password.toCharArray());
-
-      // validate keystore cert using trust store
-      TrustManagerFactory
-          trustManagerFactory =
-          TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
-      trustManagerFactory.init(truststore);
-
-      for (TrustManager trustManager: trustManagerFactory.getTrustManagers()) {
-        if (trustManager instanceof X509TrustManager) {
-          X509TrustManager x509TrustManager = (X509TrustManager)trustManager;
-          x509TrustManager.checkServerTrusted(
-              new X509Certificate[] {(X509Certificate) certificate},
-              "RSA_EXPORT");
-        }
-      }
-
-    } finally {
-      if(null != keyis) {
-        keyis.close();
-      }
-      if(null != trustis) {
-        trustis.close();
-      }
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/services/security/TestMultiThreadedStoreGeneration.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/services/security/TestMultiThreadedStoreGeneration.java b/slider-core/src/test/java/org/apache/slider/server/services/security/TestMultiThreadedStoreGeneration.java
deleted file mode 100644
index 2e2ffce..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/services/security/TestMultiThreadedStoreGeneration.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.services.security;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.security.alias.CredentialProvider;
-import org.apache.hadoop.security.alias.CredentialProviderFactory;
-import org.apache.hadoop.security.alias.JavaKeyStoreProvider;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.SliderXmlConfKeys;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.SliderException;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-
-import static org.junit.Assert.assertTrue;
-
-/**
- *
- */
-public class TestMultiThreadedStoreGeneration {
-
-  public static final int NUM_THREADS = 30;
-  @Rule
-  public TemporaryFolder workDir = new TemporaryFolder();;
-
-  private void setupCredentials(AggregateConf instanceDefinition,
-                                String keyAlias, String trustAlias)
-      throws Exception {
-    Configuration conf = new Configuration();
-    final Path jksPath = new Path(SecurityUtils.getSecurityDir(), "test.jks");
-    final String ourUrl =
-        JavaKeyStoreProvider.SCHEME_NAME + "://file" + jksPath.toUri();
-
-    File file = new File(SecurityUtils.getSecurityDir(), "test.jks");
-    file.delete();
-    conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, ourUrl);
-
-    instanceDefinition.getAppConf().credentials.put(ourUrl, new ArrayList<String>());
-
-    CredentialProvider provider =
-        CredentialProviderFactory.getProviders(conf).get(0);
-
-    // create new aliases
-    try {
-
-      if (keyAlias != null) {
-        char[] storepass = {'k', 'e', 'y', 'p', 'a', 's', 's'};
-        provider.createCredentialEntry(
-            keyAlias, storepass);
-      }
-
-      if (trustAlias != null) {
-        char[] trustpass = {'t', 'r', 'u', 's', 't', 'p', 'a', 's', 's'};
-        provider.createCredentialEntry(
-            trustAlias, trustpass);
-      }
-
-      // write out so that it can be found in checks
-      provider.flush();
-    } catch (Exception e) {
-      e.printStackTrace();
-      throw e;
-    }
-  }
-
-
-  @Test
-  public void testMultiThreadedStoreGeneration() throws Exception {
-
-    CertificateManager certMan = new CertificateManager();
-    MapOperations compOperations = new MapOperations();
-    File secDir = new File(workDir.getRoot(), SliderKeys.SECURITY_DIR);
-    File keystoreFile = new File(secDir, SliderKeys.KEYSTORE_FILE_NAME);
-    compOperations.put(SliderXmlConfKeys.KEY_KEYSTORE_LOCATION,
-                       keystoreFile.getAbsolutePath());
-    certMan.initialize(compOperations, "cahost", null, null);
-
-    final CountDownLatch latch = new CountDownLatch(1);
-    final List<SecurityStore> stores = new ArrayList<>();
-    List<Thread> threads = new ArrayList<>();
-    final AggregateConf instanceDefinition = new AggregateConf();
-
-    setupCredentials(instanceDefinition,
-                     SliderKeys.COMP_KEYSTORE_PASSWORD_ALIAS_DEFAULT, null);
-    final MapOperations compOps = new MapOperations();
-    compOps.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "true");
-
-    for (int i=0; i<NUM_THREADS; ++i) {
-      final int finalI = i;
-      Runnable runner = new Runnable() {
-        public void run() {
-          System.out.println ("----> In run");
-          try {
-            latch.await();
-            SecurityStore[] stores1 = StoresGenerator.generateSecurityStores(
-                "testhost",
-                "container" + finalI,
-                "component" + finalI,
-                instanceDefinition,
-                compOps);
-            System.out.println ("----> stores1" + stores1);
-            List<SecurityStore>
-                securityStores =
-                Arrays.asList(stores1);
-            stores.addAll(securityStores);
-          } catch (InterruptedException e) {
-            e.printStackTrace();
-          } catch (SliderException e) {
-            e.printStackTrace();
-          } catch (IOException e) {
-            e.printStackTrace();
-          } catch (Exception e) {
-            e.printStackTrace();
-          }
-        }
-      };
-      Thread thread = new Thread(runner, "TestThread" + i);
-      threads.add(thread);
-      thread.start();
-    }
-    latch.countDown();
-    for (Thread t : threads) {
-      t.join();
-    }
-
-    for (int i=0; i < NUM_THREADS; i++) {
-      assertTrue("keystore " + i + " not generated", stores.get(i).getFile().exists());
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/services/workflow/MockService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/services/workflow/MockService.java b/slider-core/src/test/java/org/apache/slider/server/services/workflow/MockService.java
deleted file mode 100644
index 588f621..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/services/workflow/MockService.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import org.apache.hadoop.service.AbstractService;
-import org.apache.hadoop.service.ServiceStateException;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-public class MockService extends AbstractService {
-  private final boolean fail;
-  private final int lifespan;
-  private final ExecutorService executorService =
-      Executors.newSingleThreadExecutor();
-
-  MockService() {
-    this("mock", false, -1);
-  }
-
-  MockService(String name, boolean fail, int lifespan) {
-    super(name);
-    this.fail = fail;
-    this.lifespan = lifespan;
-  }
-
-  @Override
-  protected void serviceStart() throws Exception {
-    //act on the lifespan here
-    if (lifespan > 0) {
-      executorService.submit(new Runnable() {
-        @Override
-        public void run() {
-          try {
-            Thread.sleep(lifespan);
-          } catch (InterruptedException ignored) {
-
-          }
-          finish();
-        }
-      });
-    } else {
-      if (lifespan == 0) {
-        finish();
-      } else {
-        //continue until told not to
-      }
-    }
-  }
-
-  void finish() {
-    if (fail) {
-      ServiceStateException e =
-          new ServiceStateException(getName() + " failed");
-
-      noteFailure(e);
-      stop();
-      throw e;
-    } else {
-      stop();
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/services/workflow/ParentWorkflowTestBase.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/services/workflow/ParentWorkflowTestBase.java b/slider-core/src/test/java/org/apache/slider/server/services/workflow/ParentWorkflowTestBase.java
deleted file mode 100644
index a11a1cf..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/services/workflow/ParentWorkflowTestBase.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import org.apache.hadoop.service.Service;
-
-/**
- * Extends {@link WorkflowServiceTestBase} with parent-specific operations
- * and logic to build up and run the parent service
- */
-public abstract class ParentWorkflowTestBase extends WorkflowServiceTestBase {
-
-  /**
-   * Wait a second for the service parent to stop
-   * @param parent the service to wait for
-   */
-  protected void waitForParentToStop(ServiceParent parent) {
-    waitForParentToStop(parent, 1000);
-  }
-
-  /**
-   * Wait for the service parent to stop
-   * @param parent the service to wait for
-   * @param timeout time in milliseconds
-   */
-  protected void waitForParentToStop(ServiceParent parent, int timeout) {
-    boolean stop = parent.waitForServiceToStop(timeout);
-    if (!stop) {
-      logState(parent);
-      fail("Service failed to stop : after " + timeout + " millis " + parent);
-    }
-  }
-
-  /**
-   * Subclasses are require to implement this and return an instance of a
-   * ServiceParent
-   * @param services a possibly empty list of services
-   * @return an inited -but -not-started- service parent instance
-   */
-  protected abstract ServiceParent buildService(Service... services);
-
-  /**
-   * Use {@link #buildService(Service...)} to create service and then start it
-   * @param services
-   * @return
-   */
-  protected ServiceParent startService(Service... services) {
-    ServiceParent parent = buildService(services);
-    //expect service to start and stay started
-    parent.start();
-    return parent;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/services/workflow/ProcessCommandFactory.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/services/workflow/ProcessCommandFactory.java b/slider-core/src/test/java/org/apache/slider/server/services/workflow/ProcessCommandFactory.java
deleted file mode 100644
index 4a19417..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/services/workflow/ProcessCommandFactory.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import org.apache.hadoop.util.Shell;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * A source of commands, with the goal being to allow for adding different
- * implementations for different platforms
- */
-public class ProcessCommandFactory {
-
-  protected ProcessCommandFactory() {
-  }
-
-  /**
-   * The command to list a directory
-   * @param dir directory
-   * @return commands
-   */
-  public List<String> ls(File dir) {
-    List<String> commands;
-    if (!Shell.WINDOWS) {
-      commands = Arrays.asList("ls","-1", dir.getAbsolutePath());
-    } else {
-      commands = Arrays.asList("cmd", "/c", "dir", dir.getAbsolutePath());
-    }
-    return commands;
-  }
-
-  /**
-   * Echo some text to stdout
-   * @param text text
-   * @return commands
-   */
-  public List<String> echo(String text) {
-    List<String> commands = new ArrayList<String>(5);
-    commands.add("echo");
-    commands.add(text);
-    return commands;
-  }
-
-  /**
-   * print env variables
-   * @return commands
-   */
-  public List<String> env() {
-    List<String> commands;
-    if (!Shell.WINDOWS) {
-      commands = Arrays.asList("env");
-    } else {
-      commands = Arrays.asList("cmd", "/c", "set");
-    }
-    return commands;
-  }
-
-  /**
-   * execute a command that returns with an error code that will
-   * be converted into a number
-   * @return commands
-   */
-  public List<String> exitFalse() {
-    List<String> commands = new ArrayList<String>(2);
-    commands.add("false");
-    return commands;
-  }
-
-  /**
-   * Create a process command factory for this OS
-   * @return
-   */
-  public static ProcessCommandFactory createProcessCommandFactory() {
-    return new ProcessCommandFactory();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/services/workflow/SimpleRunnable.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/services/workflow/SimpleRunnable.java b/slider-core/src/test/java/org/apache/slider/server/services/workflow/SimpleRunnable.java
deleted file mode 100644
index 1f330f4..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/services/workflow/SimpleRunnable.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-/**
- * Test runnable that can be made to exit, or throw an exception
- * during its run
- */
-class SimpleRunnable implements Runnable {
-  boolean throwException = false;
-
-
-  SimpleRunnable() {
-  }
-
-  SimpleRunnable(boolean throwException) {
-    this.throwException = throwException;
-  }
-
-  @Override
-  public synchronized void run() {
-    try {
-      if (throwException) {
-        throw new RuntimeException("SimpleRunnable");
-      }
-    } finally {
-      this.notify();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowClosingService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowClosingService.java b/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowClosingService.java
deleted file mode 100644
index 39516b7..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowClosingService.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import org.apache.hadoop.conf.Configuration;
-import org.junit.Test;
-
-import java.io.Closeable;
-import java.io.IOException;
-
-public class TestWorkflowClosingService extends WorkflowServiceTestBase {
-
-  @Test
-  public void testSimpleClose() throws Throwable {
-    ClosingService<OpenClose> svc = instance(false);
-    OpenClose openClose = svc.getCloseable();
-    assertFalse(openClose.closed);
-    svc.stop();
-    assertTrue(openClose.closed);
-  }
-
-  @Test
-  public void testNullClose() throws Throwable {
-    ClosingService<OpenClose> svc = new ClosingService<OpenClose>("", null);
-    svc.init(new Configuration());
-    svc.start();
-    assertNull(svc.getCloseable());
-    svc.stop();
-  }
-
-  @Test
-  public void testFailingClose() throws Throwable {
-    ClosingService<OpenClose> svc = instance(false);
-    OpenClose openClose = svc.getCloseable();
-    openClose.raiseExceptionOnClose = true;
-    svc.stop();
-    assertTrue(openClose.closed);
-    Throwable cause = svc.getFailureCause();
-    assertNotNull(cause);
-
-    //retry should be a no-op
-    svc.close();
-  }
-
-  @Test
-  public void testDoubleClose() throws Throwable {
-    ClosingService<OpenClose> svc = instance(false);
-    OpenClose openClose = svc.getCloseable();
-    openClose.raiseExceptionOnClose = true;
-    svc.stop();
-    assertTrue(openClose.closed);
-    Throwable cause = svc.getFailureCause();
-    assertNotNull(cause);
-    openClose.closed = false;
-    svc.stop();
-    assertEquals(cause, svc.getFailureCause());
-  }
-
-  /**
-   * This does not recurse forever, as the service has already entered the
-   * STOPPED state before the inner close tries to stop it -that operation
-   * is a no-op
-   * @throws Throwable
-   */
-  @Test
-  public void testCloseSelf() throws Throwable {
-    ClosingService<ClosingService> svc =
-        new ClosingService<ClosingService>("");
-    svc.setCloseable(svc);
-    svc.stop();
-  }
-
-
-  private ClosingService<OpenClose> instance(boolean raiseExceptionOnClose) {
-    ClosingService<OpenClose> svc = new ClosingService<OpenClose>(new OpenClose(
-        raiseExceptionOnClose));
-    svc.init(new Configuration());
-    svc.start();
-    return svc;
-  }
-
-  private static class OpenClose implements Closeable {
-    public boolean closed = false;
-    public boolean raiseExceptionOnClose;
-
-    private OpenClose(boolean raiseExceptionOnClose) {
-      this.raiseExceptionOnClose = raiseExceptionOnClose;
-    }
-
-    @Override
-    public void close() throws IOException {
-      if (!closed) {
-        closed = true;
-        if (raiseExceptionOnClose) {
-          throw new IOException("OpenClose");
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowCompositeService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowCompositeService.java b/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowCompositeService.java
deleted file mode 100644
index 5780149..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowCompositeService.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.service.Service;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TestWorkflowCompositeService extends ParentWorkflowTestBase {
-  private static final Logger
-      log = LoggerFactory.getLogger(TestWorkflowCompositeService.class);
-
-  @Test
-  public void testSingleChild() throws Throwable {
-    Service parent = startService(new MockService());
-    parent.stop();
-  }
-
-  @Test
-  public void testSingleChildTerminating() throws Throwable {
-    ServiceParent parent =
-        startService(new MockService("1", false, 100));
-    waitForParentToStop(parent);
-  }
-
-  @Test
-  public void testSingleChildFailing() throws Throwable {
-    ServiceParent parent =
-        startService(new MockService("1", true, 100));
-    waitForParentToStop(parent);
-    assert parent.getFailureCause() != null;
-  }
-
-  @Test
-  public void testTwoChildren() throws Throwable {
-    MockService one = new MockService("one", false, 100);
-    MockService two = new MockService("two", false, 100);
-    ServiceParent parent = startService(one, two);
-    waitForParentToStop(parent);
-    assertStopped(one);
-    assertStopped(two);
-  }
-
-  @Test
-  public void testCallableChild() throws Throwable {
-
-    MockService one = new MockService("one", false, 100);
-    CallableHandler handler = new CallableHandler("hello");
-    WorkflowCallbackService<String> ens =
-        new WorkflowCallbackService<String>("handler", handler, 100, true);
-    MockService two = new MockService("two", false, 100);
-    ServiceParent parent = startService(one, ens, two);
-    waitForParentToStop(parent);
-    assertStopped(one);
-    assertStopped(ens);
-    assertStopped(two);
-    assertTrue(handler.notified);
-    String s = ens.getScheduledFuture().get();
-    assertEquals("hello", s);
-  }
-
-  @Test
-  public void testNestedComposite() throws Throwable {
-    MockService one = new MockService("one", false, 100);
-    MockService two = new MockService("two", false, 100);
-    ServiceParent parent = buildService(one, two);
-    ServiceParent outer = startService(parent);
-    assertTrue(outer.waitForServiceToStop(1000));
-    assertStopped(one);
-    assertStopped(two);
-  }
-
-  @Test
-  public void testFailingComposite() throws Throwable {
-    MockService one = new MockService("one", true, 10);
-    MockService two = new MockService("two", false, 1000);
-    ServiceParent parent = startService(one, two);
-    waitForParentToStop(parent);
-    assertStopped(one);
-    assertStopped(two);
-    assertNotNull(one.getFailureCause());
-    assertNotNull(parent.getFailureCause());
-    assertEquals(one.getFailureCause(), parent.getFailureCause());
-  }
-
-  @Override
-  public ServiceParent buildService(Service... services) {
-    ServiceParent parent =
-        new WorkflowCompositeService("test", services);
-    parent.init(new Configuration());
-    return parent;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowExecutorService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowExecutorService.java b/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowExecutorService.java
deleted file mode 100644
index dc160d9..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowExecutorService.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import org.junit.Test;
-
-import java.util.concurrent.ExecutorService;
-
-
-/**
- * Basic tests for executor service
- */
-public class TestWorkflowExecutorService extends WorkflowServiceTestBase {
-
-  @Test
-  public void testAsyncRun() throws Throwable {
-
-    ExecutorSvc svc = run(new ExecutorSvc());
-    ServiceTerminatingRunnable runnable = new ServiceTerminatingRunnable(svc,
-        new SimpleRunnable());
-
-    // synchronous in-thread execution
-    svc.execute(runnable);
-    Thread.sleep(1000);
-    assertStopped(svc);
-  }
-
-  @Test
-  public void testFailureRun() throws Throwable {
-
-    ExecutorSvc svc = run(new ExecutorSvc());
-    ServiceTerminatingRunnable runnable = new ServiceTerminatingRunnable(svc,
-        new SimpleRunnable(true));
-
-    // synchronous in-thread execution
-    svc.execute(runnable);
-    Thread.sleep(1000);
-    assertStopped(svc);
-    assertNotNull(runnable.getException());
-  }
-
-  private static class ExecutorSvc
-      extends WorkflowExecutorService<ExecutorService> {
-    private ExecutorSvc() {
-      super("ExecutorService",
-          ServiceThreadFactory.singleThreadExecutor("test", true));
-    }
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowRpcService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowRpcService.java b/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowRpcService.java
deleted file mode 100644
index c7910ff..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowRpcService.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.ipc.RPC;
-import org.apache.hadoop.ipc.Server;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-
-public class TestWorkflowRpcService extends WorkflowServiceTestBase {
-
-  @Test
-  public void testCreateMockRPCService() throws Throwable {
-    MockRPC rpc = new MockRPC();
-    rpc.start();
-    assertTrue(rpc.started);
-    rpc.getListenerAddress();
-    rpc.stop();
-    assertTrue(rpc.stopped);
-  }
-
-  @Test
-  public void testLifecycle() throws Throwable {
-    MockRPC rpc = new MockRPC();
-    WorkflowRpcService svc = new WorkflowRpcService("test", rpc);
-    run(svc);
-    assertTrue(rpc.started);
-    svc.getConnectAddress();
-    svc.stop();
-    assertTrue(rpc.stopped);
-  }
-  
-  @Test
-  public void testStartFailure() throws Throwable {
-    MockRPC rpc = new MockRPC();
-    rpc.failOnStart = true;
-    WorkflowRpcService svc = new WorkflowRpcService("test", rpc);
-    svc.init(new Configuration());
-    try {
-      svc.start();
-      fail("expected an exception");
-    } catch (RuntimeException e) {
-      assertEquals("failOnStart", e.getMessage());
-    }
-    svc.stop();
-    assertTrue(rpc.stopped);
-  }
-  
-  private static class MockRPC extends Server {
-
-    public boolean stopped;
-    public boolean started;
-    public boolean failOnStart;
-
-    private MockRPC() throws IOException {
-      super("localhost", 0, null, 1, new Configuration());
-    }
-
-    @Override
-    public synchronized void start() {
-      if (failOnStart) {
-        throw new RuntimeException("failOnStart");
-      }
-      started = true;
-      super.start();
-    }
-
-    @Override
-    public synchronized void stop() {
-      stopped = true;
-      super.stop();
-    }
-
-    @Override
-    public synchronized InetSocketAddress getListenerAddress() {
-      return super.getListenerAddress();
-    }
-
-    @Override
-    public Writable call(RPC.RpcKind rpcKind,
-        String protocol,
-        Writable param,
-        long receiveTime) throws Exception {
-      return null;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowSequenceService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowSequenceService.java b/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowSequenceService.java
deleted file mode 100644
index 581e3ed..0000000
--- a/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowSequenceService.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.service.Service;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TestWorkflowSequenceService extends ParentWorkflowTestBase {
-  private static final Logger
-      log = LoggerFactory.getLogger(TestWorkflowSequenceService.class);
-
-  @Test
-  public void testSingleSequence() throws Throwable {
-    ServiceParent parent = startService(new MockService());
-    parent.stop();
-  }
-
-  @Test
-  public void testEmptySequence() throws Throwable {
-    ServiceParent parent = startService();
-    waitForParentToStop(parent);
-  }
-
-  @Test
-  public void testSequence() throws Throwable {
-    MockService one = new MockService("one", false, 100);
-    MockService two = new MockService("two", false, 100);
-    ServiceParent parent = startService(one, two);
-    waitForParentToStop(parent);
-    assertStopped(one);
-    assertStopped(two);
-    assert ((WorkflowSequenceService) parent).getPreviousService().equals(two);
-  }
-
-  @Test
-  public void testCallableChild() throws Throwable {
-
-    MockService one = new MockService("one", false, 100);
-    CallableHandler handler = new CallableHandler("hello");
-    WorkflowCallbackService<String> ens =
-        new WorkflowCallbackService<String>("handler", handler, 100, true);
-    MockService two = new MockService("two", false, 100);
-    ServiceParent parent = startService(one, ens, two);
-    waitForParentToStop(parent);
-    assertStopped(one);
-    assertStopped(ens);
-    assertStopped(two);
-    assertTrue(handler.notified);
-    String s = ens.getScheduledFuture().get();
-    assertEquals("hello", s);
-  }
-
-
-  @Test
-  public void testFailingSequence() throws Throwable {
-    MockService one = new MockService("one", true, 100);
-    MockService two = new MockService("two", false, 100);
-    WorkflowSequenceService parent =
-        (WorkflowSequenceService) startService(one, two);
-    waitForParentToStop(parent);
-    assertStopped(one);
-    assertInState(two, Service.STATE.NOTINITED);
-    assertEquals(one, parent.getPreviousService());
-  }
-
-
-  @Test
-  public void testFailInStartNext() throws Throwable {
-    MockService one = new MockService("one", false, 100);
-    MockService two = new MockService("two", true, 0);
-    MockService three = new MockService("3", false, 0);
-    ServiceParent parent = startService(one, two, three);
-    waitForParentToStop(parent);
-    assertStopped(one);
-    assertStopped(two);
-    Throwable failureCause = two.getFailureCause();
-    assertNotNull(failureCause);
-    Throwable parentFailureCause = parent.getFailureCause();
-    assertNotNull(parentFailureCause);
-    assertEquals(parentFailureCause, failureCause);
-    assertInState(three, Service.STATE.NOTINITED);
-  }
-
-  @Test
-  public void testSequenceInSequence() throws Throwable {
-    MockService one = new MockService("one", false, 100);
-    MockService two = new MockService("two", false, 100);
-    ServiceParent parent = buildService(one, two);
-    ServiceParent outer = startService(parent);
-    waitForParentToStop(parent);
-    assertStopped(one);
-    assertStopped(two);
-  }
-
-  @Test
-  public void testVarargsConstructor() throws Throwable {
-    MockService one = new MockService("one", false, 100);
-    MockService two = new MockService("two", false, 100);
-    ServiceParent parent = new WorkflowSequenceService("test", one, two);
-    parent.init(new Configuration());
-    parent.start();
-    waitForParentToStop(parent);
-    assertStopped(one);
-    assertStopped(two);
-  }
-
-
-  @Test
-  public void testAddChild() throws Throwable {
-    MockService one = new MockService("one", false, 5000);
-    MockService two = new MockService("two", false, 100);
-    ServiceParent parent = startService(one, two);
-    CallableHandler handler = new CallableHandler("hello");
-    WorkflowCallbackService<String> ens =
-        new WorkflowCallbackService<String>("handler", handler, 100, true);
-    parent.addService(ens);
-    waitForParentToStop(parent, 10000);
-    assertStopped(one);
-    assertStopped(two);
-    assertStopped(ens);
-    assertStopped(two);
-    assertEquals("hello", ens.getScheduledFuture().get());
-  }
-
-  public WorkflowSequenceService buildService(Service... services) {
-    WorkflowSequenceService parent =
-        new WorkflowSequenceService("test", services);
-    parent.init(new Configuration());
-    return parent;
-  }
-
-}



[40/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/types/ApplicationLivenessInformation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/types/ApplicationLivenessInformation.java b/slider-core/src/main/java/org/apache/slider/api/types/ApplicationLivenessInformation.java
deleted file mode 100644
index 9879d05..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/types/ApplicationLivenessInformation.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api.types;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- * Serialized information about liveness
- * <p>
- *   If true liveness probes are implemented, this
- *   datatype can be extended to publish their details.
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class ApplicationLivenessInformation {
-  /** flag set if the cluster is at size */
-  public boolean allRequestsSatisfied;
-
-  /** number of outstanding requests: those needed to satisfy */
-  public int requestsOutstanding;
-
-  /** number of requests submitted to YARN */
-  public int activeRequests;
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("ApplicationLivenessInformation{");
-    sb.append("allRequestsSatisfied=").append(allRequestsSatisfied);
-    sb.append(", requestsOutstanding=").append(requestsOutstanding);
-    sb.append('}');
-    return sb.toString();
-  }
-}
-
-

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java b/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java
deleted file mode 100644
index c46a59f..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api.types;
-
-import org.apache.slider.api.StatusKeys;
-import org.apache.slider.server.appmaster.state.RoleStatus;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Serializable version of component data.
- * <p>
- * This is sent in REST calls as a JSON object \u2014but is also marshalled into
- * a protobuf structure. Look at {@link org.apache.slider.api.proto.RestTypeMarshalling}
- * for the specifics there.
- * <p>
- * This means that if any fields are added here. they must be added to
- * <code>src/main/proto/SliderClusterMessages.proto</code> and
- * the protobuf structures rebuilt via a {@code mvn generate-sources -Pcompile-protobuf}
- *
- * See also {@link RoleStatus#serialize()}
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-
-public class ComponentInformation {
-
-  public String name;
-  public int priority;
-  public int desired, actual, releasing;
-  public int placementPolicy;
-  public int requested;
-  public int failed, started, startFailed, completed, totalRequested;
-  public int nodeFailed, failedRecently, preempted;
-  public int pendingAntiAffineRequestCount;
-  public boolean isAARequestOutstanding;
-
-  public String failureMessage;
-  public List<String> containers;
-
-  /**
-   * Build the statistics map from the current data
-   * @return a map for use in statistics reports
-   */
-  public Map<String, Integer> buildStatistics() {
-    Map<String, Integer> stats = new HashMap<>();
-    stats.put(StatusKeys.STATISTICS_CONTAINERS_ACTIVE_REQUESTS, requested);
-    stats.put(StatusKeys.STATISTICS_CONTAINERS_ANTI_AFFINE_PENDING, pendingAntiAffineRequestCount);
-    stats.put(StatusKeys.STATISTICS_CONTAINERS_COMPLETED, completed);
-    stats.put(StatusKeys.STATISTICS_CONTAINERS_DESIRED, desired);
-    stats.put(StatusKeys.STATISTICS_CONTAINERS_FAILED, failed);
-    stats.put(StatusKeys.STATISTICS_CONTAINERS_FAILED_NODE, nodeFailed);
-    stats.put(StatusKeys.STATISTICS_CONTAINERS_FAILED_RECENTLY, failedRecently);
-    stats.put(StatusKeys.STATISTICS_CONTAINERS_LIVE, actual);
-    stats.put(StatusKeys.STATISTICS_CONTAINERS_PREEMPTED, preempted);
-    stats.put(StatusKeys.STATISTICS_CONTAINERS_REQUESTED, totalRequested);
-    stats.put(StatusKeys.STATISTICS_CONTAINERS_STARTED, started);
-    stats.put(StatusKeys.STATISTICS_CONTAINERS_START_FAILED, startFailed);
-    return stats;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("ComponentInformation{");
-    sb.append(", name='").append(name).append('\'');
-    sb.append(", actual=").append(actual);
-    sb.append(", completed=").append(completed);
-    sb.append(", desired=").append(desired);
-    sb.append(", failed=").append(failed);
-    sb.append(", failureMessage='").append(failureMessage).append('\'');
-    sb.append(", placementPolicy=").append(placementPolicy);
-    sb.append(", isAARequestOutstanding=").append(isAARequestOutstanding);
-    sb.append(", pendingAntiAffineRequestCount=").append(pendingAntiAffineRequestCount);
-    sb.append(", priority=").append(priority);
-    sb.append(", releasing=").append(releasing);
-    sb.append(", requested=").append(requested);
-    sb.append(", started=").append(started);
-    sb.append(", startFailed=").append(startFailed);
-    sb.append(", totalRequested=").append(totalRequested);
-    sb.append(", container count='")
-        .append(containers == null ? 0 : containers.size())
-        .append('\'');
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/types/ContainerInformation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/types/ContainerInformation.java b/slider-core/src/main/java/org/apache/slider/api/types/ContainerInformation.java
deleted file mode 100644
index 6991340..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/types/ContainerInformation.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api.types;
-
-import org.apache.hadoop.registry.client.binding.JsonSerDeser;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- * Serializable version of component instance data
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class ContainerInformation {
-  
-  public String containerId;
-  public String component;
-  public String appVersion;
-  public Boolean released;
-  public int state;
-  public Integer exitCode;
-  public String diagnostics;
-  public long createTime;
-  public long startTime;
-
-  public String host;
-  public String hostURL;
-  public String placement;
-  /**
-   * What is the tail output from the executed process (or [] if not started
-   * or the log cannot be picked up
-   */
-  public String[] output;
-
-  @Override
-  public String toString() {
-    JsonSerDeser<ContainerInformation> serDeser =
-        new JsonSerDeser<>(
-            ContainerInformation.class);
-    return serDeser.toString(this);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/types/NodeEntryInformation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/types/NodeEntryInformation.java b/slider-core/src/main/java/org/apache/slider/api/types/NodeEntryInformation.java
deleted file mode 100644
index 8424be2..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/types/NodeEntryInformation.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api.types;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- * Serialized node entry information. Must be kept in sync with the protobuf equivalent.
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class NodeEntryInformation {
-
-  /** incrementing counter of instances that failed */
-  public int failed;
-
-  /** Counter of "failed recently" events. */
-  public int failedRecently;
-
-  /** timestamp of last use */
-  public long lastUsed;
-
-  /** Number of live nodes. */
-  public int live;
-
-  /** incrementing counter of instances that have been pre-empted. */
-  public int preempted;
-
-  /** Priority */
-  public int priority;
-
-  /** instance explicitly requested on this node */
-  public int requested;
-
-  /** number of containers being released off this node */
-  public int releasing;
-
-  /** incrementing counter of instances that failed to start */
-  public int startFailed;
-
-  /** number of starting instances */
-  public int starting;
-
-  @Override
-  public String toString() {
-    final StringBuilder sb = new StringBuilder(
-        "NodeEntryInformation{");
-    sb.append("priority=").append(priority);
-    sb.append(", live=").append(live);
-    sb.append(", requested=").append(requested);
-    sb.append(", releasing=").append(releasing);
-    sb.append(", starting=").append(starting);
-    sb.append(", failed=").append(failed);
-    sb.append(", failedRecently=").append(failedRecently);
-    sb.append(", startFailed=").append(startFailed);
-    sb.append(", preempted=").append(preempted);
-    sb.append(", lastUsed=").append(lastUsed);
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java b/slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java
deleted file mode 100644
index 4fe5b4c..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api.types;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Serialized node information. Must be kept in sync with the protobuf equivalent.
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class NodeInformation {
-
-  public String hostname;
-  public String state;
-  public String labels;
-  public String rackName;
-  public String httpAddress;
-  public String healthReport;
-  public long lastUpdated;
-  public Map<String, NodeEntryInformation> entries = new HashMap<>();
-
-  @Override
-  public String toString() {
-    final StringBuilder sb = new StringBuilder(
-      "NodeInformation{");
-    sb.append("hostname='").append(hostname).append('\'');
-    sb.append(", state='").append(state).append('\'');
-    sb.append(", labels='").append(labels).append('\'');
-    sb.append(", rackName='").append(rackName).append('\'');
-    sb.append(", httpAddress='").append(httpAddress).append('\'');
-    sb.append(", healthReport='").append(healthReport).append('\'');
-    sb.append(", lastUpdated=").append(lastUpdated);
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/types/NodeInformationList.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/types/NodeInformationList.java b/slider-core/src/main/java/org/apache/slider/api/types/NodeInformationList.java
deleted file mode 100644
index 741523e..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/types/NodeInformationList.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api.types;
-
-import org.apache.slider.core.persist.JsonSerDeser;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-public class NodeInformationList extends ArrayList<NodeInformation> {
-  public NodeInformationList() {
-  }
-
-  public NodeInformationList(Collection<? extends NodeInformation> c) {
-    super(c);
-  }
-
-  public NodeInformationList(int initialCapacity) {
-    super(initialCapacity);
-  }
-
-  public static JsonSerDeser<NodeInformationList> createSerializer() {
-    return new JsonSerDeser<>(NodeInformationList.class);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/types/PingInformation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/types/PingInformation.java b/slider-core/src/main/java/org/apache/slider/api/types/PingInformation.java
deleted file mode 100644
index 223edca..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/types/PingInformation.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api.types;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- * Serialized information to/from Ping operations
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class PingInformation {
-  public long time;
-  public String text;
-  public String verb;
-  public String body;
-
-  @Override
-  public String toString() {
-    
-    final StringBuilder sb =
-        new StringBuilder("PingResource{");
-    sb.append("time=").append(time);
-    sb.append(", verb=").append(verb);
-    sb.append(", text='").append(text).append('\'');
-    sb.append(", body='").append(body).append('\'');
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/types/RoleStatistics.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/types/RoleStatistics.java b/slider-core/src/main/java/org/apache/slider/api/types/RoleStatistics.java
deleted file mode 100644
index c926600..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/types/RoleStatistics.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api.types;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-
-/**
- * Simple role statistics for state views; can be generated by RoleStatus
- * instances, and aggregated for summary information.
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class RoleStatistics {
-  public long activeAA  = 0L;
-  public long actual = 0L;
-  public long completed = 0L;
-  public long desired = 0L;
-  public long failed = 0L;
-  public long failedRecently = 0L;
-  public long limitsExceeded = 0L;
-  public long nodeFailed = 0L;
-  public long preempted = 0L;
-  public long releasing = 0L;
-  public long requested = 0L;
-  public long started = 0L;
-  public long startFailed = 0L;
-  public long totalRequested = 0L;
-
-  /**
-   * Add another statistics instance
-   * @param that the other value
-   * @return this entry
-   */
-  public RoleStatistics add(final RoleStatistics that) {
-    activeAA += that.activeAA;
-    actual += that.actual;
-    completed += that.completed;
-    desired += that.desired;
-    failed += that.failed;
-    failedRecently += that.failedRecently;
-    limitsExceeded += that.limitsExceeded;
-    nodeFailed += that.nodeFailed;
-    preempted += that.preempted;
-    releasing += that.releasing;
-    requested += that.requested;
-    started += that.started;
-    startFailed += that.totalRequested;
-    totalRequested += that.totalRequested;
-    return this;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/types/SliderInstanceDescription.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/types/SliderInstanceDescription.java b/slider-core/src/main/java/org/apache/slider/api/types/SliderInstanceDescription.java
deleted file mode 100644
index 3b95f80..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/types/SliderInstanceDescription.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api.types;
-
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-
-/**
- * Description of a slider instance
- */
-public class SliderInstanceDescription {
-
-  public final String name;
-  public final Path path;
-  public final ApplicationReport applicationReport;
-
-  public SliderInstanceDescription(String name,
-      Path path,
-      ApplicationReport applicationReport) {
-    this.name = name;
-    this.path = path;
-    this.applicationReport = applicationReport;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("SliderInstanceDescription{");
-    sb.append("name='").append(name).append('\'');
-    sb.append(", path=").append(path);
-    sb.append(", applicationReport: ")
-      .append(applicationReport == null
-              ? "null"
-              : (" id " + applicationReport.getApplicationId()));
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/client/ClientRegistryBinder.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/ClientRegistryBinder.java b/slider-core/src/main/java/org/apache/slider/client/ClientRegistryBinder.java
deleted file mode 100644
index da37d11..0000000
--- a/slider-core/src/main/java/org/apache/slider/client/ClientRegistryBinder.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.client;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.fs.PathNotFoundException;
-import org.apache.hadoop.registry.client.api.RegistryConstants;
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.hadoop.registry.client.binding.RegistryPathUtils;
-import org.apache.hadoop.registry.client.binding.RegistryTypeUtils;
-import org.apache.hadoop.registry.client.exceptions.InvalidRecordException;
-import org.apache.hadoop.registry.client.impl.zk.RegistryInternalConstants;
-import org.apache.hadoop.registry.client.types.Endpoint;
-import org.apache.hadoop.registry.client.types.ServiceRecord;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.List;
-
-import static org.apache.hadoop.registry.client.binding.RegistryPathUtils.encodeForRegistry;
-import static org.apache.hadoop.registry.client.binding.RegistryUtils.convertUsername;
-import static org.apache.hadoop.registry.client.binding.RegistryUtils.getCurrentUsernameUnencoded;
-import static org.apache.hadoop.registry.client.binding.RegistryUtils.servicePath;
-
-/**
- * Generic code to get the URLs for clients via the registry
- */
-public class ClientRegistryBinder {
-  private static final Logger log =
-      LoggerFactory.getLogger(ClientRegistryBinder.class);
-
-  private final RegistryOperations operations;
-
-  public ClientRegistryBinder(RegistryOperations operations) {
-    this.operations = operations;
-  }
-
-  /**
-   * Buld the user path -switches to the system path if the user is "".
-   * It also cross-converts the username to ascii via punycode
-   * @param username username or ""
-   * @return the path to the user
-   */
-  public static String homePathForUser(String username) {
-    Preconditions.checkArgument(username != null, "null user");
-
-    // catch recursion
-    if (username.startsWith(RegistryConstants.PATH_USERS)) {
-      return username;
-    }
-
-    if (username.isEmpty()) {
-      return RegistryConstants.PATH_SYSTEM_SERVICES;
-    }
-
-    // convert username to registry name
-    String convertedName = convertUsername(username);
-
-    return RegistryPathUtils.join(RegistryConstants.PATH_USERS,
-        encodeForRegistry(convertedName));
-  }
-
-  /**
-   * Get the current username, before any encoding has been applied.
-   * @return the current user from the kerberos identity, falling back
-   * to the user and/or env variables.
-   */
-  public static String currentUsernameUnencoded() {
-    String env_hadoop_username = System.getenv(
-        RegistryInternalConstants.HADOOP_USER_NAME);
-    return getCurrentUsernameUnencoded(env_hadoop_username);
-  }
-
-  /**
-   * Qualify a user.
-   * <ol>
-   *   <li> <code>"~"</code> maps to user home path home</li>
-   *   <li> <code>"~user"</code> maps to <code>/users/$user</code></li>
-   *   <li> <code>"/"</code> maps to <code>/services/</code></li>
-   * </ol>
-   * @param user the username
-   * @return the base path
-   */
-  public static String qualifyUser(String user) {
-    // qualify the user
-    String t = user.trim();
-    if (t.startsWith("/")) {
-      // already resolved
-      return t;
-    } else if (t.equals("~")) {
-      // self
-      return currentUsernameUnencoded();
-    } else if (t.startsWith("~")) {
-      // another user
-      // convert username to registry name
-      String convertedName = convertUsername(t.substring(1));
-
-      return RegistryPathUtils.join(RegistryConstants.PATH_USERS,
-          encodeForRegistry(convertedName));
-    } else {
-      return "/" + t;
-    }
-  }
-
-  /**
-   * Look up an external REST API
-   * @param user user which will be qualified as per {@link #qualifyUser(String)}
-   * @param serviceClass service class
-   * @param instance instance name
-   * @param api API
-   * @return the API, or an exception is raised.
-   * @throws IOException
-   */
-  public String lookupExternalRestAPI(String user,
-      String serviceClass,
-      String instance,
-      String api)
-      throws IOException {
-    String qualified = qualifyUser(user);
-    String path = servicePath(qualified, serviceClass, instance);
-    String restAPI = resolveExternalRestAPI(api, path);
-    if (restAPI == null) {
-      throw new PathNotFoundException(path + " API " + api);
-    }
-    return restAPI;
-  }
-
-  /**
-   * Resolve a service record then return an external REST API exported it.
-   *
-   * @param api API to resolve
-   * @param path path of the service record
-   * @return null if the record exists but the API is absent or it has no
-   * REST endpoints.
-   * @throws IOException resolution problems, as covered in
-   * {@link RegistryOperations#resolve(String)}
-   */
-  protected String resolveExternalRestAPI(String api, String path) throws
-      IOException {
-    ServiceRecord record = operations.resolve(path);
-    return lookupRestAPI(record, api, true);
-  }
-
-  /**
-   * Look up an external REST API endpoint
-   * @param record service record
-   * @param api URI of api
-   * @param external flag to indicate this is an external record
-   * @return the first endpoint of the implementation, or null if there
-   * is no entry for the API, implementation or it's the wrong type.
-   */
-  public static String lookupRestAPI(ServiceRecord record,
-      String api, boolean external) throws InvalidRecordException {
-    try {
-      String url = null;
-      Endpoint endpoint = getEndpoint(record, api, external);
-      List<String> addresses =
-          RegistryTypeUtils.retrieveAddressesUriType(endpoint);
-      if (addresses != null && !addresses.isEmpty()) {
-        url = addresses.get(0);
-      }
-      return url;
-    } catch (InvalidRecordException e) {
-      log.debug("looking for API {}", api, e);
-      return null;
-    }
-  }
-
-  /**
-   * Get an endpont by API
-   * @param record service record
-   * @param api API
-   * @param external flag to indicate this is an external record
-   * @return the endpoint or null
-   */
-  public static Endpoint getEndpoint(ServiceRecord record,
-      String api,
-      boolean external) {
-    return external ? record.getExternalEndpoint(api)
-                    : record.getInternalEndpoint(api);
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/client/ClientUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/ClientUtils.java b/slider-core/src/main/java/org/apache/slider/client/ClientUtils.java
deleted file mode 100644
index c3ccb1d..0000000
--- a/slider-core/src/main/java/org/apache/slider/client/ClientUtils.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.client;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.PathNotFoundException;
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.hadoop.registry.client.binding.RegistryPathUtils;
-import org.apache.hadoop.registry.client.exceptions.NoRecordException;
-import org.apache.hadoop.registry.client.types.ServiceRecord;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.NotFoundException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.registry.docstore.ConfigFormat;
-import org.apache.slider.core.registry.docstore.PublishedConfigSet;
-import org.apache.slider.core.registry.docstore.PublishedConfiguration;
-import org.apache.slider.core.registry.docstore.PublishedConfigurationOutputter;
-import org.apache.slider.core.registry.retrieve.RegistryRetriever;
-
-import java.io.File;
-import java.io.IOException;
-
-import static org.apache.hadoop.registry.client.binding.RegistryUtils.currentUser;
-import static org.apache.hadoop.registry.client.binding.RegistryUtils.servicePath;
-
-public class ClientUtils {
-  public static ServiceRecord lookupServiceRecord(RegistryOperations rops,
-      String user, String name) throws IOException, SliderException {
-    return lookupServiceRecord(rops, user, null, name);
-  }
-
-  public static ServiceRecord lookupServiceRecord(RegistryOperations rops,
-      String user, String type, String name) throws IOException,
-      SliderException {
-    if (StringUtils.isEmpty(user)) {
-      user = currentUser();
-    } else {
-      user = RegistryPathUtils.encodeForRegistry(user);
-    }
-    if (StringUtils.isEmpty(type)) {
-      type = SliderKeys.APP_TYPE;
-    }
-
-    String path = servicePath(user, type, name);
-    return resolve(rops, path);
-  }
-
-  public static ServiceRecord resolve(RegistryOperations rops, String path)
-      throws IOException, SliderException {
-    try {
-      return rops.resolve(path);
-    } catch (PathNotFoundException | NoRecordException e) {
-      throw new NotFoundException(e.getPath().toString(), e);
-    }
-  }
-
-  public static PublishedConfiguration getConfigFromRegistry(
-      RegistryOperations rops, Configuration configuration,
-      String configName, String appName, String user, boolean external)
-      throws IOException, SliderException {
-    ServiceRecord instance = lookupServiceRecord(rops, user, appName);
-
-    RegistryRetriever retriever = new RegistryRetriever(configuration, instance);
-    PublishedConfigSet configurations = retriever.getConfigurations(external);
-
-    PublishedConfiguration published = retriever.retrieveConfiguration(
-        configurations, configName, external);
-    return published;
-  }
-
-  public static String saveOrReturnConfig(PublishedConfiguration published,
-      String format, File destPath, String fileName)
-      throws BadCommandArgumentsException, IOException {
-    ConfigFormat configFormat = ConfigFormat.resolve(format);
-    if (configFormat == null) {
-      throw new BadCommandArgumentsException(
-          "Unknown/Unsupported format %s ", format);
-    }
-    PublishedConfigurationOutputter outputter =
-        PublishedConfigurationOutputter.createOutputter(configFormat,
-            published);
-    boolean print = destPath == null;
-    if (!print) {
-      if (destPath.isDirectory()) {
-        // creating it under a directory
-        destPath = new File(destPath, fileName);
-      }
-      outputter.save(destPath);
-      return null;
-    } else {
-      return outputter.asString();
-    }
-  }
-}



[20/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
deleted file mode 100644
index b230816..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolProxy.java
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.rpc;
-
-import com.google.common.base.Preconditions;
-import com.google.protobuf.RpcController;
-import com.google.protobuf.ServiceException;
-import org.apache.hadoop.ipc.ProtobufHelper;
-import org.apache.hadoop.ipc.ProtocolSignature;
-import org.apache.hadoop.ipc.RPC;
-import org.apache.hadoop.ipc.RemoteException;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.slider.api.SliderClusterProtocol;
-import org.apache.slider.api.proto.Messages;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-
-public class SliderClusterProtocolProxy implements SliderClusterProtocol {
-
-  private static final RpcController NULL_CONTROLLER = null;
-  private final SliderClusterProtocolPB endpoint;
-  private final InetSocketAddress address;
-
-  public SliderClusterProtocolProxy(SliderClusterProtocolPB endpoint,
-      InetSocketAddress address) {
-    Preconditions.checkArgument(endpoint != null, "null endpoint");
-    Preconditions.checkNotNull(address != null, "null address");
-    this.endpoint = endpoint;
-    this.address = address;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("SliderClusterProtocolProxy{");
-    sb.append("address=").append(address);
-    sb.append('}');
-    return sb.toString();
-  }
-
-  @Override
-  public ProtocolSignature getProtocolSignature(String protocol,
-      long clientVersion,
-      int clientMethodsHash)
-      throws IOException {
-    if (!protocol.equals(RPC.getProtocolName(SliderClusterProtocolPB.class))) {
-      throw new IOException("Serverside implements " +
-                            RPC.getProtocolName(SliderClusterProtocolPB.class) +
-                            ". The following requested protocol is unknown: " +
-                            protocol);
-    }
-
-    return ProtocolSignature.getProtocolSignature(clientMethodsHash,
-        RPC.getProtocolVersion(
-            SliderClusterProtocol.class),
-        SliderClusterProtocol.class);
-  }
-
-  @Override
-  public long getProtocolVersion(String protocol, long clientVersion)
-      throws IOException {
-    return SliderClusterProtocol.versionID;
-  }
-  
-  private IOException convert(ServiceException se) {
-    IOException ioe = ProtobufHelper.getRemoteException(se);
-    if (ioe instanceof RemoteException) {
-      RemoteException remoteException = (RemoteException) ioe;
-      return remoteException.unwrapRemoteException();
-    }
-    return ioe;
-  }
-  
-  @Override
-  public Messages.StopClusterResponseProto stopCluster(Messages.StopClusterRequestProto request) throws
-                                                                                                 IOException,
-                                                                                                 YarnException {
-    try {
-      return endpoint.stopCluster(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.UpgradeContainersResponseProto upgradeContainers(
-      Messages.UpgradeContainersRequestProto request) throws IOException,
-      YarnException {
-    try {
-      return endpoint.upgradeContainers(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.FlexClusterResponseProto flexCluster(Messages.FlexClusterRequestProto request)
-      throws IOException {
-    try {
-      return endpoint.flexCluster(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.GetJSONClusterStatusResponseProto getJSONClusterStatus(
-    Messages.GetJSONClusterStatusRequestProto request) throws
-                                                       IOException,
-                                                       YarnException {
-    try {
-      return endpoint.getJSONClusterStatus(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-
-  @Override
-  public Messages.GetInstanceDefinitionResponseProto getInstanceDefinition(
-    Messages.GetInstanceDefinitionRequestProto request) throws
-                                                        IOException,
-                                                        YarnException {
-    try {
-      return endpoint.getInstanceDefinition(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.ListNodeUUIDsByRoleResponseProto listNodeUUIDsByRole(Messages.ListNodeUUIDsByRoleRequestProto request) throws
-                                                                                                                         IOException,
-                                                                                                                         YarnException {
-    try {
-      return endpoint.listNodeUUIDsByRole(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.GetNodeResponseProto getNode(Messages.GetNodeRequestProto request) throws
-                                                                                     IOException,
-                                                                                     YarnException {
-    try {
-      return endpoint.getNode(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.GetClusterNodesResponseProto getClusterNodes(Messages.GetClusterNodesRequestProto request) throws
-                                                                                                             IOException,
-                                                                                                             YarnException {
-    try {
-      return endpoint.getClusterNodes(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-
-  @Override
-  public Messages.EchoResponseProto echo(Messages.EchoRequestProto request) throws
-                                                                                                             IOException,
-                                                                                                             YarnException {
-    try {
-      return endpoint.echo(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-
-  @Override
-  public Messages.KillContainerResponseProto killContainer(Messages.KillContainerRequestProto request) throws
-                                                                                                             IOException,
-                                                                                                             YarnException {
-    try {
-      return endpoint.killContainer(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.AMSuicideResponseProto amSuicide(Messages.AMSuicideRequestProto request) throws
-                                                                                           IOException {
-    try {
-      return endpoint.amSuicide(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.ApplicationLivenessInformationProto getLivenessInformation(
-      Messages.GetApplicationLivenessRequestProto request) throws IOException {
-    try {
-      return endpoint.getLivenessInformation(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.GetLiveContainersResponseProto getLiveContainers(Messages.GetLiveContainersRequestProto request) throws
-      IOException {
-    try {
-      return endpoint.getLiveContainers(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.ContainerInformationProto getLiveContainer(Messages.GetLiveContainerRequestProto request) throws
-      IOException {
-    try {
-      return endpoint.getLiveContainer(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.GetLiveComponentsResponseProto getLiveComponents(Messages.GetLiveComponentsRequestProto request) throws
-      IOException {
-    try {
-      return endpoint.getLiveComponents(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.ComponentInformationProto getLiveComponent(Messages.GetLiveComponentRequestProto request) throws
-      IOException {
-    try {
-      return endpoint.getLiveComponent(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.GetLiveNodesResponseProto getLiveNodes(Messages.GetLiveNodesRequestProto request)
-      throws IOException {
-    try {
-      return endpoint.getLiveNodes(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.NodeInformationProto getLiveNode(Messages.GetLiveNodeRequestProto request)
-      throws IOException {
-    try {
-      return endpoint.getLiveNode(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelDesired(Messages.EmptyPayloadProto request) throws IOException {
-    try {
-      return endpoint.getModelDesired(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelDesiredAppconf(Messages.EmptyPayloadProto request) throws IOException {
-    try {
-      return endpoint.getModelDesiredAppconf(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelDesiredResources(Messages.EmptyPayloadProto request) throws IOException {
-    try {
-      return endpoint.getModelDesiredResources(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelResolved(Messages.EmptyPayloadProto request) throws IOException {
-    try {
-      return endpoint.getModelResolved(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelResolvedAppconf(Messages.EmptyPayloadProto request) throws IOException {
-    try {
-      return endpoint.getModelResolvedAppconf(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelResolvedResources(Messages.EmptyPayloadProto request) throws IOException {
-    try {
-      return endpoint.getModelResolvedResources(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getLiveResources(Messages.EmptyPayloadProto request) throws IOException {
-    try {
-      return endpoint.getLiveResources(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-
-  }
-
-  @Override
-  public Messages.GetCertificateStoreResponseProto getClientCertificateStore(Messages.GetCertificateStoreRequestProto request) throws
-      IOException {
-    try {
-      return endpoint.getClientCertificateStore(NULL_CONTROLLER, request);
-    } catch (ServiceException e) {
-      throw convert(e);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
deleted file mode 100644
index fda23aa..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
+++ /dev/null
@@ -1,551 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.rpc;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.ipc.ProtocolSignature;
-import org.apache.hadoop.service.AbstractService;
-import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
-import org.apache.slider.api.ClusterDescription;
-import org.apache.slider.api.SliderClusterProtocol;
-import org.apache.slider.api.proto.Messages;
-import org.apache.slider.api.types.ApplicationLivenessInformation;
-import org.apache.slider.api.types.ComponentInformation;
-import org.apache.slider.api.types.ContainerInformation;
-import org.apache.slider.api.types.NodeInformation;
-import org.apache.slider.api.types.NodeInformationList;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.exceptions.ServiceNotReadyException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.main.LauncherExitCodes;
-import org.apache.slider.core.persist.AggregateConfSerDeser;
-import org.apache.slider.core.persist.ConfTreeSerDeser;
-import org.apache.slider.server.appmaster.AppMasterActionOperations;
-import org.apache.slider.server.appmaster.actions.ActionFlexCluster;
-import org.apache.slider.server.appmaster.actions.ActionHalt;
-import org.apache.slider.server.appmaster.actions.ActionKillContainer;
-import org.apache.slider.server.appmaster.actions.ActionStopSlider;
-import org.apache.slider.server.appmaster.actions.ActionUpgradeContainers;
-import org.apache.slider.server.appmaster.actions.AsyncAction;
-import org.apache.slider.server.appmaster.actions.QueueAccess;
-import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
-import org.apache.slider.server.appmaster.state.RoleInstance;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-import org.apache.slider.server.appmaster.web.rest.application.resources.ContentCache;
-import org.apache.slider.server.services.security.CertificateManager;
-import org.apache.slider.server.services.security.SecurityStore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import static org.apache.slider.api.proto.RestTypeMarshalling.marshall;
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_COMPONENTS;
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_CONTAINERS;
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_NODES;
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.LIVE_RESOURCES;
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_DESIRED;
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_DESIRED_APPCONF;
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_DESIRED_RESOURCES;
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_RESOLVED;
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_RESOLVED_APPCONF;
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.MODEL_RESOLVED_RESOURCES;
-
-/**
- * Implement the {@link SliderClusterProtocol}.
- */
-@SuppressWarnings("unchecked")
-
-public class SliderIPCService extends AbstractService
-    implements SliderClusterProtocol {
-
-  protected static final Logger log =
-      LoggerFactory.getLogger(SliderIPCService.class);
-
-  private final QueueAccess actionQueues;
-  private final StateAccessForProviders state;
-  private final MetricsAndMonitoring metricsAndMonitoring;
-  private final AppMasterActionOperations amOperations;
-  private final ContentCache cache;
-  private final CertificateManager certificateManager;
-
-  /**
-   * This is the prefix used for metrics
-   */
-  public static final String METRICS_PREFIX =
-      "org.apache.slider.api.SliderIPCService.";
-
-  /**
-   * Constructor
-   * @param amOperations access to any AM operations
-   * @param state state view
-   * @param actionQueues queues for actions
-   * @param metricsAndMonitoring metrics
-   * @param cache
-   */
-  public SliderIPCService(AppMasterActionOperations amOperations,
-      CertificateManager certificateManager,
-      StateAccessForProviders state,
-      QueueAccess actionQueues,
-      MetricsAndMonitoring metricsAndMonitoring,
-      ContentCache cache) {
-    super("SliderIPCService");
-    Preconditions.checkArgument(amOperations != null, "null amOperations");
-    Preconditions.checkArgument(state != null, "null appState");
-    Preconditions.checkArgument(actionQueues != null, "null actionQueues");
-    Preconditions.checkArgument(metricsAndMonitoring != null,
-        "null metricsAndMonitoring");
-    Preconditions.checkArgument(cache != null, "null cache");
-    this.state = state;
-    this.actionQueues = actionQueues;
-    this.metricsAndMonitoring = metricsAndMonitoring;
-    this.amOperations = amOperations;
-    this.cache = cache;
-    this.certificateManager = certificateManager;
-  }
-
-  @Override   //SliderClusterProtocol
-  public ProtocolSignature getProtocolSignature(String protocol,
-      long clientVersion,
-      int clientMethodsHash) throws IOException {
-    return ProtocolSignature.getProtocolSignature(
-        this, protocol, clientVersion, clientMethodsHash);
-  }
-
-
-  @Override   //SliderClusterProtocol
-  public long getProtocolVersion(String protocol, long clientVersion)
-      throws IOException {
-    return SliderClusterProtocol.versionID;
-  }
-
-  /**
-   * General actions to perform on a slider RPC call coming in
-   * @param operation operation to log
-   * @throws IOException problems
-   * @throws ServiceNotReadyException if the RPC service is constructed
-   * but not fully initialized
-   */
-  protected void onRpcCall(String operation) throws IOException {
-    log.debug("Received call to {}", operation);
-    metricsAndMonitoring.markMeterAndCounter(METRICS_PREFIX + operation);
-  }
-
-  /**
-   * Schedule an action
-   * @param action for delayed execution
-   */
-  public void schedule(AsyncAction action) {
-    actionQueues.schedule(action);
-  }
-
-  /**
-   * Queue an action for immediate execution in the executor thread
-   * @param action action to execute
-   */
-  public void queue(AsyncAction action) {
-    actionQueues.put(action);
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.StopClusterResponseProto stopCluster(Messages.StopClusterRequestProto request)
-      throws IOException, YarnException {
-    onRpcCall("stop");
-    String message = request.getMessage();
-    if (message == null) {
-      message = "application stopped by client";
-    }
-    ActionStopSlider stopSlider =
-        new ActionStopSlider(message,
-            1000, TimeUnit.MILLISECONDS,
-            LauncherExitCodes.EXIT_SUCCESS,
-            FinalApplicationStatus.SUCCEEDED,
-            message);
-    log.info("SliderAppMasterApi.stopCluster: {}", stopSlider);
-    schedule(stopSlider);
-    return Messages.StopClusterResponseProto.getDefaultInstance();
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.UpgradeContainersResponseProto upgradeContainers(
-      Messages.UpgradeContainersRequestProto request) throws IOException,
-      YarnException {
-    onRpcCall("upgrade");
-    String message = request.getMessage();
-    if (message == null) {
-      message = "application containers upgraded by client";
-    }
-    ActionUpgradeContainers upgradeContainers =
-        new ActionUpgradeContainers(
-            "Upgrade containers",
-            1000, TimeUnit.MILLISECONDS,
-            LauncherExitCodes.EXIT_SUCCESS,
-            FinalApplicationStatus.SUCCEEDED,
-            request.getContainerList(),
-            request.getComponentList(),
-            message);
-    log.info("SliderAppMasterApi.upgradeContainers: {}", upgradeContainers);
-    schedule(upgradeContainers);
-    return Messages.UpgradeContainersResponseProto.getDefaultInstance();
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.FlexClusterResponseProto flexCluster(Messages.FlexClusterRequestProto request)
-      throws IOException {
-    onRpcCall("flex");
-    String payload = request.getClusterSpec();
-    ConfTreeSerDeser confTreeSerDeser = new ConfTreeSerDeser();
-    ConfTree updatedResources = confTreeSerDeser.fromJson(payload);
-    schedule(new ActionFlexCluster("flex", 1, TimeUnit.MILLISECONDS,
-        updatedResources));
-    return Messages.FlexClusterResponseProto.newBuilder().setResponse(
-        true).build();
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.GetJSONClusterStatusResponseProto getJSONClusterStatus(
-      Messages.GetJSONClusterStatusRequestProto request)
-      throws IOException, YarnException {
-    onRpcCall("getstatus");
-    String result;
-    //quick update
-    //query and json-ify
-    ClusterDescription cd = state.refreshClusterStatus();
-    result = cd.toJsonString();
-    String stat = result;
-    return Messages.GetJSONClusterStatusResponseProto.newBuilder()
-                                                     .setClusterSpec(stat)
-                                                     .build();
-  }
-
-  @Override
-  public Messages.GetInstanceDefinitionResponseProto getInstanceDefinition(
-      Messages.GetInstanceDefinitionRequestProto request)
-      throws IOException, YarnException {
-
-    onRpcCall("getinstancedefinition");
-    String internal;
-    String resources;
-    String app;
-    AggregateConf instanceDefinition =
-        state.getInstanceDefinitionSnapshot();
-    internal = instanceDefinition.getInternal().toJson();
-    resources = instanceDefinition.getResources().toJson();
-    app = instanceDefinition.getAppConf().toJson();
-    assert internal != null;
-    assert resources != null;
-    assert app != null;
-    log.debug("Generating getInstanceDefinition Response");
-    Messages.GetInstanceDefinitionResponseProto.Builder builder =
-        Messages.GetInstanceDefinitionResponseProto.newBuilder();
-    builder.setInternal(internal);
-    builder.setResources(resources);
-    builder.setApplication(app);
-    return builder.build();
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.ListNodeUUIDsByRoleResponseProto listNodeUUIDsByRole(Messages.ListNodeUUIDsByRoleRequestProto request)
-      throws IOException, YarnException {
-    onRpcCall("listnodes)");
-    String role = request.getRole();
-    Messages.ListNodeUUIDsByRoleResponseProto.Builder builder =
-        Messages.ListNodeUUIDsByRoleResponseProto.newBuilder();
-    List<RoleInstance> nodes = state.enumLiveInstancesInRole(role);
-    for (RoleInstance node : nodes) {
-      builder.addUuid(node.id);
-    }
-    return builder.build();
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.GetNodeResponseProto getNode(Messages.GetNodeRequestProto request)
-      throws IOException, YarnException {
-    onRpcCall("getnode");
-    RoleInstance instance = state.getLiveInstanceByContainerID(
-        request.getUuid());
-    return Messages.GetNodeResponseProto.newBuilder()
-                                        .setClusterNode(instance.toProtobuf())
-                                        .build();
-  }
-
-  @Override //SliderClusterProtocol
-  public Messages.GetClusterNodesResponseProto getClusterNodes(
-      Messages.GetClusterNodesRequestProto request)
-      throws IOException, YarnException {
-    onRpcCall("getclusternodes");
-    List<RoleInstance>
-        clusterNodes = state.getLiveInstancesByContainerIDs(
-        request.getUuidList());
-
-    Messages.GetClusterNodesResponseProto.Builder builder =
-        Messages.GetClusterNodesResponseProto.newBuilder();
-    for (RoleInstance node : clusterNodes) {
-      builder.addClusterNode(node.toProtobuf());
-    }
-    //at this point: a possibly empty list of nodes
-    return builder.build();
-  }
-
-  @Override
-  public Messages.EchoResponseProto echo(Messages.EchoRequestProto request)
-      throws IOException, YarnException {
-    onRpcCall("echo");
-    Messages.EchoResponseProto.Builder builder =
-        Messages.EchoResponseProto.newBuilder();
-    String text = request.getText();
-    log.info("Echo request size ={}", text.length());
-    log.info(text);
-    //now return it
-    builder.setText(text);
-    return builder.build();
-  }
-
-  @Override
-  public Messages.KillContainerResponseProto killContainer(Messages.KillContainerRequestProto request)
-      throws IOException, YarnException {
-    onRpcCall("killcontainer");
-    String containerID = request.getId();
-    log.info("Kill Container {}", containerID);
-    //throws NoSuchNodeException if it is missing
-    RoleInstance instance =
-        state.getLiveInstanceByContainerID(containerID);
-    queue(new ActionKillContainer(instance.getId(), 0, TimeUnit.MILLISECONDS,
-        amOperations));
-    Messages.KillContainerResponseProto.Builder builder =
-        Messages.KillContainerResponseProto.newBuilder();
-    builder.setSuccess(true);
-    return builder.build();
-  }
-
-
-  @Override
-  public Messages.AMSuicideResponseProto amSuicide(
-      Messages.AMSuicideRequestProto request)
-      throws IOException {
-    onRpcCall("amsuicide");
-    int signal = request.getSignal();
-    String text = request.getText();
-    if (text == null) {
-      text = "";
-    }
-    int delay = request.getDelay();
-    log.info("AM Suicide with signal {}, message {} delay = {}", signal, text,
-        delay);
-    ActionHalt action = new ActionHalt(signal, text, delay,
-        TimeUnit.MILLISECONDS);
-    schedule(action);
-    return Messages.AMSuicideResponseProto.getDefaultInstance();
-  }
-
-  @Override
-  public Messages.ApplicationLivenessInformationProto getLivenessInformation(
-      Messages.GetApplicationLivenessRequestProto request) throws IOException {
-    ApplicationLivenessInformation info =
-        state.getApplicationLivenessInformation();
-    return marshall(info);
-  }
-
-  @Override
-  public Messages.GetLiveContainersResponseProto getLiveContainers(
-      Messages.GetLiveContainersRequestProto request)
-      throws IOException {
-    Map<String, ContainerInformation> infoMap =
-        (Map<String, ContainerInformation>) cache.lookupWithIOE(LIVE_CONTAINERS);
-    Messages.GetLiveContainersResponseProto.Builder builder =
-        Messages.GetLiveContainersResponseProto.newBuilder();
-
-    for (Map.Entry<String, ContainerInformation> entry : infoMap.entrySet()) {
-      builder.addNames(entry.getKey());
-      builder.addContainers(marshall(entry.getValue()));
-    }
-    return builder.build();
-  }
-
-  @Override
-  public Messages.ContainerInformationProto getLiveContainer(Messages.GetLiveContainerRequestProto request)
-      throws IOException {
-    String containerId = request.getContainerId();
-    RoleInstance id = state.getLiveInstanceByContainerID(containerId);
-    ContainerInformation containerInformation = id.serialize();
-    return marshall(containerInformation);
-  }
-
-  @Override
-  public Messages.GetLiveComponentsResponseProto getLiveComponents(Messages.GetLiveComponentsRequestProto request)
-      throws IOException {
-    Map<String, ComponentInformation> infoMap =
-        (Map<String, ComponentInformation>) cache.lookupWithIOE(LIVE_COMPONENTS);
-    Messages.GetLiveComponentsResponseProto.Builder builder =
-        Messages.GetLiveComponentsResponseProto.newBuilder();
-
-    for (Map.Entry<String, ComponentInformation> entry : infoMap.entrySet()) {
-      builder.addNames(entry.getKey());
-      builder.addComponents(marshall(entry.getValue()));
-    }
-    return builder.build();
-  }
-
-
-  @Override
-  public Messages.ComponentInformationProto getLiveComponent(Messages.GetLiveComponentRequestProto request)
-      throws IOException {
-    String name = request.getName();
-    try {
-      return marshall(state.getComponentInformation(name));
-    } catch (YarnRuntimeException e) {
-      throw new FileNotFoundException("Unknown component: " + name);
-    }
-  }
-
-  @Override
-  public Messages.GetLiveNodesResponseProto getLiveNodes(Messages.GetLiveNodesRequestProto request)
-      throws IOException {
-    NodeInformationList info = (NodeInformationList) cache.lookupWithIOE(LIVE_NODES);
-    Messages.GetLiveNodesResponseProto.Builder builder =
-        Messages.GetLiveNodesResponseProto.newBuilder();
-
-    for (NodeInformation nodeInformation : info) {
-      builder.addNodes(marshall(nodeInformation));
-    }
-    return builder.build();
-  }
-
-
-  @Override
-  public Messages.NodeInformationProto getLiveNode(Messages.GetLiveNodeRequestProto request)
-      throws IOException {
-    String name = request.getName();
-    NodeInformation nodeInformation = state.getNodeInformation(name);
-    if (nodeInformation != null) {
-      return marshall(nodeInformation);
-    } else {
-      throw new FileNotFoundException("Unknown host: " + name);
-    }
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelDesired(Messages.EmptyPayloadProto request) throws IOException {
-    return lookupAggregateConf(MODEL_DESIRED);
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelDesiredAppconf(Messages.EmptyPayloadProto request) throws IOException {
-    return lookupConfTree(MODEL_DESIRED_APPCONF);
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelDesiredResources(Messages.EmptyPayloadProto request) throws IOException {
-    return lookupConfTree(MODEL_DESIRED_RESOURCES);
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelResolved(Messages.EmptyPayloadProto request) throws IOException {
-    return lookupAggregateConf(MODEL_RESOLVED);
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelResolvedAppconf(Messages.EmptyPayloadProto request) throws IOException {
-    return lookupConfTree(MODEL_RESOLVED_APPCONF);
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelResolvedResources(Messages.EmptyPayloadProto request) throws IOException {
-    return lookupConfTree(MODEL_RESOLVED_RESOURCES);
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getLiveResources(Messages.EmptyPayloadProto request) throws IOException {
-    return lookupConfTree(LIVE_RESOURCES);
-  }
-
-  /**
-   * Helper method; look up an aggregate configuration in the cache from
-   * a key, or raise an exception
-   * @param key key to resolve
-   * @return the configuration
-   * @throws IOException on a failure
-   */
-
-  protected Messages.WrappedJsonProto lookupAggregateConf(String key) throws
-      IOException {
-    AggregateConf aggregateConf = (AggregateConf) cache.lookupWithIOE(key);
-    String json = AggregateConfSerDeser.toString(aggregateConf);
-    return wrap(json);
-  }
-
-  /**
-   * Helper method; look up an conf tree in the cache from
-   * a key, or raise an exception
-   * @param key key to resolve
-   * @return the configuration
-   * @throws IOException on a failure
-   */
-  protected Messages.WrappedJsonProto lookupConfTree(String key) throws
-      IOException {
-    ConfTree conf = (ConfTree) cache.lookupWithIOE(key);
-    String json = ConfTreeSerDeser.toString(conf);
-    return wrap(json);
-  }
-
-  private Messages.WrappedJsonProto wrap(String json) {
-    Messages.WrappedJsonProto.Builder builder =
-        Messages.WrappedJsonProto.newBuilder();
-    builder.setJson(json);
-    return builder.build();
-  }
-
-  @Override
-  public Messages.GetCertificateStoreResponseProto getClientCertificateStore(Messages.GetCertificateStoreRequestProto request) throws
-      IOException {
-    String hostname = request.getHostname();
-    String clientId = request.getRequesterId();
-    String password = request.getPassword();
-    String type = request.getType();
-
-    SecurityStore store = null;
-    try {
-      if ( SecurityStore.StoreType.keystore.equals(
-          SecurityStore.StoreType.valueOf(type))) {
-        store = certificateManager.generateContainerKeystore(hostname,
-                                                             clientId,
-                                                             null,
-                                                             password);
-      } else if (SecurityStore.StoreType.truststore.equals(
-          SecurityStore.StoreType.valueOf(type))) {
-        store = certificateManager.generateContainerTruststore(clientId,
-                                                               null,
-                                                               password);
-
-      } else {
-        throw new IOException("Illegal store type");
-      }
-    } catch (SliderException e) {
-      throw new IOException(e);
-    }
-    return marshall(store);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderRPCSecurityInfo.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderRPCSecurityInfo.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderRPCSecurityInfo.java
deleted file mode 100644
index 4fd4910..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderRPCSecurityInfo.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-package org.apache.slider.server.appmaster.rpc;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.security.KerberosInfo;
-import org.apache.hadoop.security.SecurityInfo;
-import org.apache.hadoop.security.token.TokenIdentifier;
-import org.apache.hadoop.security.token.TokenInfo;
-import org.apache.hadoop.security.token.TokenSelector;
-import org.apache.hadoop.yarn.security.client.ClientToAMTokenSelector;
-import org.apache.slider.common.SliderXmlConfKeys;
-
-import java.lang.annotation.Annotation;
-
-/**
- * This is where security information goes.
- * It is referred to in the <code>META-INF/services/org.apache.hadoop.security.SecurityInfo</code>
- * resource of this JAR, which is used to find the binding info
- */
-public class SliderRPCSecurityInfo extends SecurityInfo {
-
-  @Override
-  public KerberosInfo getKerberosInfo(Class<?> protocol, Configuration conf) {
-    if (!protocol.equals(SliderClusterProtocolPB.class)) {
-      return null;
-    }
-    return new KerberosInfo() {
-
-      @Override
-      public Class<? extends Annotation> annotationType() {
-        return null;
-      }
-
-      @Override
-      public String serverPrincipal() {
-        return SliderXmlConfKeys.KEY_KERBEROS_PRINCIPAL;
-      }
-
-      @Override
-      public String clientPrincipal() {
-        return null;
-      }
-    };
-  }
-
-  @Override
-  public TokenInfo getTokenInfo(Class<?> protocol, Configuration conf) {
-    if (!protocol.equals(SliderClusterProtocolPB.class)) {
-      return null;
-    }
-    return new TokenInfo() {
-
-      @Override
-      public Class<? extends Annotation> annotationType() {
-        return null;
-      }
-
-      @Override
-      public Class<? extends TokenSelector<? extends TokenIdentifier>>
-          value() {
-        return ClientToAMTokenSelector.class;
-      }
-
-      @Override
-      public String toString() {
-        return "SliderClusterProtocolPB token info";
-      }
-    };
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/security/SecurityConfiguration.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/security/SecurityConfiguration.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/security/SecurityConfiguration.java
deleted file mode 100644
index 9a89c39..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/security/SecurityConfiguration.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.security;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.security.UserGroupInformation;
-import static org.apache.slider.core.main.LauncherExitCodes.EXIT_UNAUTHORIZED;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.SliderXmlConfKeys;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.exceptions.SliderException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Class keeping code security information
- */
-public class SecurityConfiguration {
-
-  protected static final Logger log =
-      LoggerFactory.getLogger(SecurityConfiguration.class);
-  private final Configuration configuration;
-  private final AggregateConf instanceDefinition;
-  private String clusterName;
-
-  public SecurityConfiguration(Configuration configuration,
-                               AggregateConf instanceDefinition,
-                               String clusterName) throws SliderException {
-    Preconditions.checkNotNull(configuration);
-    Preconditions.checkNotNull(instanceDefinition);
-    Preconditions.checkNotNull(clusterName);
-    this.configuration = configuration;
-    this.instanceDefinition = instanceDefinition;
-    this.clusterName = clusterName;
-    validate();
-  }
-
-  private void validate() throws SliderException {
-    if (isSecurityEnabled()) {
-      String principal = instanceDefinition.getAppConfOperations()
-          .getComponent(SliderKeys.COMPONENT_AM).get(SliderXmlConfKeys.KEY_KEYTAB_PRINCIPAL);
-      if(SliderUtils.isUnset(principal)) {
-        // if no login identity is available, fail
-        UserGroupInformation loginUser = null;
-        try {
-          loginUser = getLoginUser();
-        } catch (IOException e) {
-          throw new SliderException(EXIT_UNAUTHORIZED, e,
-                                    "No principal configured for the application and "
-                                    + "exception raised during retrieval of login user. "
-                                    + "Unable to proceed with application "
-                                    + "initialization.  Please ensure a value "
-                                    + "for %s exists in the application "
-                                    + "configuration or the login issue is addressed",
-                                    SliderXmlConfKeys.KEY_KEYTAB_PRINCIPAL);
-        }
-        if (loginUser == null) {
-          throw new SliderException(EXIT_UNAUTHORIZED,
-                                    "No principal configured for the application "
-                                    + "and no login user found. "
-                                    + "Unable to proceed with application "
-                                    + "initialization.  Please ensure a value "
-                                    + "for %s exists in the application "
-                                    + "configuration or the login issue is addressed",
-                                    SliderXmlConfKeys.KEY_KEYTAB_PRINCIPAL);
-        }
-      }
-      // ensure that either local or distributed keytab mechanism is enabled,
-      // but not both
-      String keytabFullPath = instanceDefinition.getAppConfOperations()
-          .getComponent(SliderKeys.COMPONENT_AM)
-          .get(SliderXmlConfKeys.KEY_AM_KEYTAB_LOCAL_PATH);
-      String keytabName = instanceDefinition.getAppConfOperations()
-          .getComponent(SliderKeys.COMPONENT_AM)
-          .get(SliderXmlConfKeys.KEY_AM_LOGIN_KEYTAB_NAME);
-      if (SliderUtils.isSet(keytabFullPath) && SliderUtils.isSet(keytabName)) {
-        throw new SliderException(EXIT_UNAUTHORIZED,
-                                  "Both a keytab on the cluster host (%s) and a"
-                                  + " keytab to be retrieved from HDFS (%s) are"
-                                  + " specified.  Please configure only one keytab"
-                                  + " retrieval mechanism.",
-                                  SliderXmlConfKeys.KEY_AM_KEYTAB_LOCAL_PATH,
-                                  SliderXmlConfKeys.KEY_AM_LOGIN_KEYTAB_NAME);
-
-      }
-    }
-  }
-
-  protected UserGroupInformation getLoginUser() throws IOException {
-    return UserGroupInformation.getLoginUser();
-  }
-
-  public boolean isSecurityEnabled () {
-    return SliderUtils.isHadoopClusterSecure(configuration);
-  }
-
-  public String getPrincipal () throws IOException {
-    String principal = instanceDefinition.getAppConfOperations()
-        .getComponent(SliderKeys.COMPONENT_AM).get(SliderXmlConfKeys.KEY_KEYTAB_PRINCIPAL);
-    if (SliderUtils.isUnset(principal)) {
-      principal = UserGroupInformation.getLoginUser().getShortUserName();
-      log.info("No principal set in the slider configuration.  Will use AM login"
-               + " identity {} to attempt keytab-based login", principal);
-    }
-
-    return principal;
-  }
-
-  public boolean isKeytabProvided() {
-    boolean keytabProvided = instanceDefinition.getAppConfOperations()
-                    .getComponent(SliderKeys.COMPONENT_AM)
-                    .get(SliderXmlConfKeys.KEY_AM_KEYTAB_LOCAL_PATH) != null ||
-                instanceDefinition.getAppConfOperations()
-                    .getComponent(SliderKeys.COMPONENT_AM).
-                    get(SliderXmlConfKeys.KEY_AM_LOGIN_KEYTAB_NAME) != null;
-    return keytabProvided;
-
-  }
-
-  public File getKeytabFile(AggregateConf instanceDefinition)
-      throws SliderException, IOException {
-    String keytabFullPath = instanceDefinition.getAppConfOperations()
-        .getComponent(SliderKeys.COMPONENT_AM)
-        .get(SliderXmlConfKeys.KEY_AM_KEYTAB_LOCAL_PATH);
-    File localKeytabFile;
-    if (SliderUtils.isUnset(keytabFullPath)) {
-      // get the keytab
-      String keytabName = instanceDefinition.getAppConfOperations()
-          .getComponent(SliderKeys.COMPONENT_AM).
-              get(SliderXmlConfKeys.KEY_AM_LOGIN_KEYTAB_NAME);
-      log.info("No host keytab file path specified. Will attempt to retrieve"
-               + " keytab file {} as a local resource for the container",
-               keytabName);
-      // download keytab to local, protected directory
-      localKeytabFile = new File(SliderKeys.KEYTAB_DIR, keytabName);
-    } else {
-      log.info("Using host keytab file {} for login", keytabFullPath);
-      localKeytabFile = new File(keytabFullPath);
-    }
-    return localKeytabFile;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AbstractClusterServices.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AbstractClusterServices.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AbstractClusterServices.java
deleted file mode 100644
index 54f384b..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AbstractClusterServices.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.util.resource.DefaultResourceCalculator;
-
-/**
- * Cluster services offered by the YARN infrastructure.
- */
-public abstract class AbstractClusterServices {
-
-  private final DefaultResourceCalculator
-      defaultResourceCalculator = new DefaultResourceCalculator();
-
-  /**
-   * Create a resource for requests
-   * @return a resource which can be built up.
-   */
-  public abstract Resource newResource();
-
-  public abstract Resource newResource(int memory, int cores);
-
-  /**
-   * Normalise memory, CPU and other resources according to the YARN AM-supplied
-   * values and the resource calculator in use (currently hard-coded to the
-   * {@link DefaultResourceCalculator}.
-   * Those resources which aren't normalized (currently: CPU) are left
-   * as is.
-   * @param resource resource requirements of a role
-   * @param minR minimum values of this queue
-   * @param maxR max values of this queue
-   * @return a normalized value.
-   */
-  public Resource normalize(Resource resource, Resource minR, Resource maxR) {
-    Preconditions.checkArgument(resource != null, "null resource");
-    Preconditions.checkArgument(minR != null, "null minR");
-    Preconditions.checkArgument(maxR != null, "null maxR");
-
-    Resource normalize = defaultResourceCalculator.normalize(resource, minR,
-        maxR, minR);
-    return newResource(normalize.getMemory(), resource.getVirtualCores());
-  }
-}


[33/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/tools/SliderVersionInfo.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/tools/SliderVersionInfo.java b/slider-core/src/main/java/org/apache/slider/common/tools/SliderVersionInfo.java
deleted file mode 100644
index 86025ee..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/tools/SliderVersionInfo.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.tools;
-
-import org.apache.hadoop.util.VersionInfo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Locale;
-import java.util.Properties;
-
-/**
- * Extract the version properties, which will look something like
- * <pre>
- * application.name=${pom.name}
- * application.version=${pom.version}
- * application.build=${buildNumber}
- * application.build.java.version=${java.version}
- * application.build.info=${pom.name}-${pom.version} Built against ${buildNumber} on ${java.version} by ${user.name}
- * </pre>
- * 
- * the <code>mvn process-resources</code> target will expand the properties
- * and add the resources to target/classes, which will then look something like
- * <pre>
- *   application.name=Slider Core
- *   application.version=0.7.1-SNAPSHOT
- *   application.build=1dd69
- *   application.build.java.version=1.7.0_45
- *   application.build.user=stevel
- *   application.build.info=Slider Core-0.7.1-SNAPSHOT Built against 1dd69 on 1.7.0_45 by stevel
- * </pre>
- * 
- * Note: the values will change and more properties added.
- */
-public class SliderVersionInfo {
-  private static final Logger log = LoggerFactory.getLogger(SliderVersionInfo.class);
-
-  /**
-   * Name of the resource containing the filled-in-at-runtime props
-   */
-  public static final String VERSION_RESOURCE =
-      "org/apache/slider/providers/dynamic/application.properties";
-
-  public static final String APP_NAME = "application.name";
-  public static final String APP_VERSION = "application.version";
-  public static final String APP_BUILD = "application.build";
-  public static final String APP_BUILD_JAVA_VERSION = "application.build.java.version";
-  public static final String APP_BUILD_USER = "application.build.user";
-  public static final String APP_BUILD_INFO = "application.build.info";
-  public static final String HADOOP_BUILD_INFO = "hadoop.build.info";
-  public static final String HADOOP_DEPLOYED_INFO = "hadoop.deployed.info";
-
-
-  public static Properties loadVersionProperties()  {
-    Properties props = new Properties();
-    URL resURL = SliderVersionInfo.class.getClassLoader()
-                                   .getResource(VERSION_RESOURCE);
-    assert resURL != null : "Null resource " + VERSION_RESOURCE;
-
-    try {
-      InputStream inStream = resURL.openStream();
-      assert inStream != null : "Null input stream from " + VERSION_RESOURCE;
-      props.load(inStream);
-    } catch (IOException e) {
-      log.warn("IOE loading " + VERSION_RESOURCE, e);
-    }
-    return props;
-  }
-
-  /**
-   * Load the version info and print it
-   * @param logger logger
-   */
-  public static void loadAndPrintVersionInfo(Logger logger) {
-    Properties props = loadVersionProperties();
-    logger.info(props.getProperty(APP_BUILD_INFO));
-    logger.info("Compiled against Hadoop {}",
-                props.getProperty(HADOOP_BUILD_INFO));
-    logger.info(getHadoopVersionString());
-  }
-  
-  public static String getHadoopVersionString() {
-    return String.format(Locale.ENGLISH,
-        "Hadoop runtime version %s with source checksum %s and build date %s",
-        VersionInfo.getBranch(),
-        VersionInfo.getSrcChecksum(),
-        VersionInfo.getDate());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/build/BuildHelper.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/build/BuildHelper.java b/slider-core/src/main/java/org/apache/slider/core/build/BuildHelper.java
deleted file mode 100644
index 1098e2c..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/build/BuildHelper.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.build;
-
-import org.apache.hadoop.util.VersionInfo;
-import org.apache.slider.common.tools.SliderVersionInfo;
-
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * classes to help with the build
- */
-public class BuildHelper {
-  /**
-   * Add the cluster build information; this will include Hadoop details too
-   * @param dest map to insert this too
-   * @param prefix prefix for the build info
-   */
-  public static void addBuildMetadata(Map<String, Object> dest, String prefix) {
-
-    Properties props = SliderVersionInfo.loadVersionProperties();
-    dest.put(prefix + "." + SliderVersionInfo.APP_BUILD_INFO,
-             props.getProperty(
-      SliderVersionInfo.APP_BUILD_INFO));
-    dest.put(prefix + "." + SliderVersionInfo.HADOOP_BUILD_INFO,
-             props.getProperty(SliderVersionInfo.HADOOP_BUILD_INFO));
-
-    dest.put(prefix + "." + SliderVersionInfo.HADOOP_DEPLOYED_INFO,
-             VersionInfo.getBranch() + " @" + VersionInfo.getSrcChecksum());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/build/InstanceBuilder.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/build/InstanceBuilder.java b/slider-core/src/main/java/org/apache/slider/core/build/InstanceBuilder.java
deleted file mode 100644
index 8155214..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/build/InstanceBuilder.java
+++ /dev/null
@@ -1,517 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.build;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.permission.FsPermission;
-import org.apache.slider.api.InternalKeys;
-import org.apache.slider.api.OptionKeys;
-import org.apache.slider.api.ResourceKeys;
-import org.apache.slider.api.StatusKeys;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.SliderXmlConfKeys;
-import org.apache.slider.common.tools.CoreFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.BadClusterStateException;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.exceptions.ErrorStrings;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.persist.ConfPersister;
-import org.apache.slider.core.persist.InstancePaths;
-import org.apache.slider.core.persist.LockAcquireFailedException;
-import org.apache.slider.core.persist.LockHeldAction;
-import org.apache.slider.core.zk.ZKPathBuilder;
-import org.apache.slider.core.zk.ZookeeperUtils;
-import org.apache.slider.providers.agent.AgentKeys;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.TreeSet;
-
-import static org.apache.slider.api.InternalKeys.INTERNAL_ADDONS_DIR_PATH;
-import static org.apache.slider.api.InternalKeys.INTERNAL_APPDEF_DIR_PATH;
-import static org.apache.slider.api.InternalKeys.INTERNAL_QUEUE;
-import static org.apache.slider.api.OptionKeys.INTERNAL_AM_TMP_DIR;
-import static org.apache.slider.api.OptionKeys.INTERNAL_TMP_DIR;
-import static org.apache.slider.api.OptionKeys.INTERNAL_APPLICATION_HOME;
-import static org.apache.slider.api.OptionKeys.INTERNAL_APPLICATION_IMAGE_PATH;
-import static org.apache.slider.api.OptionKeys.INTERNAL_DATA_DIR_PATH;
-import static org.apache.slider.api.OptionKeys.INTERNAL_GENERATED_CONF_PATH;
-import static org.apache.slider.api.OptionKeys.INTERNAL_SNAPSHOT_CONF_PATH;
-import static org.apache.slider.api.OptionKeys.ZOOKEEPER_HOSTS;
-import static org.apache.slider.api.OptionKeys.ZOOKEEPER_PATH;
-import static org.apache.slider.api.OptionKeys.ZOOKEEPER_QUORUM;
-import static org.apache.slider.api.RoleKeys.ROLE_PREFIX;
-import static org.apache.slider.common.SliderKeys.COMPONENT_AM;
-import static org.apache.slider.common.SliderKeys.COMPONENT_SEPARATOR;
-import static org.apache.slider.common.SliderKeys.COMPONENT_TYPE_EXTERNAL_APP;
-import static org.apache.slider.common.SliderKeys.COMPONENT_TYPE_KEY;
-import static org.apache.slider.common.tools.SliderUtils.isClusternameValid;
-
-/**
- * Build up the instance of a cluster.
- */
-public class InstanceBuilder {
-
-  private final String clustername;
-  private final Configuration conf;
-  private final CoreFileSystem coreFS;
-  private final InstancePaths instancePaths;
-  private AggregateConf instanceDescription;
-  private Map<String, Path> externalAppDefs = new HashMap<>();
-  private TreeSet<Integer> priorities = new TreeSet<>();
-
-  private static final Logger log =
-    LoggerFactory.getLogger(InstanceBuilder.class);
-
-  public InstanceBuilder(CoreFileSystem coreFileSystem,
-                         Configuration conf,
-                         String clustername) {
-    this.clustername = clustername;
-    this.conf = conf;
-    this.coreFS = coreFileSystem;
-    Path instanceDir = coreFileSystem.buildClusterDirPath(clustername);
-    instancePaths = new InstancePaths(instanceDir);
-
-  }
-
-  public AggregateConf getInstanceDescription() {
-    return instanceDescription;
-  }
-
-  public InstancePaths getInstancePaths() {
-    return instancePaths;
-  }
-
-
-  @Override
-  public String toString() {
-    return "Builder working with " + clustername + " at " +
-           getInstanceDir();
-  }
-
-  private Path getInstanceDir() {
-    return instancePaths.instanceDir;
-  }
-
-  /**
-   * Initial part of the build process
-   * @param instanceConf
-   * @param provider
-   */
-  public void init(
-    String provider,
-    AggregateConf instanceConf) {
-
-
-    this.instanceDescription = instanceConf;
-
-    //internal is extended
-    ConfTreeOperations internalOps = instanceConf.getInternalOperations();
-
-    Map<String, Object> md = internalOps.getConfTree().metadata;
-    long time = System.currentTimeMillis();
-    md.put(StatusKeys.INFO_CREATE_TIME_HUMAN, SliderUtils.toGMTString(time));
-    md.put(StatusKeys.INFO_CREATE_TIME_MILLIS, Long.toString(time));
-
-    MapOperations globalOptions = internalOps.getGlobalOptions();
-    BuildHelper.addBuildMetadata(md, "create");
-    SliderUtils.setInfoTime(md,
-        StatusKeys.INFO_CREATE_TIME_HUMAN,
-        StatusKeys.INFO_CREATE_TIME_MILLIS,
-        System.currentTimeMillis());
-
-    internalOps.set(INTERNAL_AM_TMP_DIR,
-                    instancePaths.tmpPathAM.toUri());
-    internalOps.set(INTERNAL_TMP_DIR,
-                    instancePaths.tmpPath.toUri());
-    internalOps.set(INTERNAL_SNAPSHOT_CONF_PATH,
-                    instancePaths.snapshotConfPath.toUri());
-    internalOps.set(INTERNAL_GENERATED_CONF_PATH,
-                    instancePaths.generatedConfPath.toUri());
-    internalOps.set(INTERNAL_DATA_DIR_PATH,
-                    instancePaths.dataPath.toUri());
-    internalOps.set(INTERNAL_APPDEF_DIR_PATH,
-                    instancePaths.appDefPath.toUri());
-    internalOps.set(INTERNAL_ADDONS_DIR_PATH,
-                    instancePaths.addonsPath.toUri());
-
-
-    internalOps.set(InternalKeys.INTERNAL_PROVIDER_NAME, provider);
-    internalOps.set(OptionKeys.APPLICATION_NAME, clustername);
-
-  }
-
-  /**
-   * Set the queue used to start the application
-   * @param queue
-   * @throws BadConfigException
-   */
-  public void setQueue(String queue) throws BadConfigException {
-    if(queue != null) {
-      if(SliderUtils.isUnset(queue)) {
-        throw new BadConfigException("Queue value cannot be empty.");
-      }
-
-      instanceDescription.getInternalOperations().set(INTERNAL_QUEUE, queue);
-    }
-  }
-
-  /**
-   * Set up the image/app home path
-   * @param appImage   path in the DFS to the tar file
-   * @param appHomeDir other strategy: home dir
-   * @throws BadConfigException if both are found
-   */
-  public void setImageDetailsIfAvailable(
-      Path appImage,
-      String appHomeDir) throws BadConfigException {
-    boolean appHomeUnset = SliderUtils.isUnset(appHomeDir);
-    // App home or image
-    if (appImage != null) {
-      if (!appHomeUnset) {
-        // both args have been set
-        throw new BadConfigException(
-            ErrorStrings.E_BOTH_IMAGE_AND_HOME_DIR_SPECIFIED);
-      }
-      instanceDescription.getInternalOperations().set(INTERNAL_APPLICATION_IMAGE_PATH,
-                                                      appImage.toUri());
-    } else {
-      // the alternative is app home, which now MUST be set
-      if (!appHomeUnset) {
-        instanceDescription.getInternalOperations().set(INTERNAL_APPLICATION_HOME,
-                                                        appHomeDir);
-      }
-    }
-  }
-
-
-  /**
-   * Propagate any critical principals from the current site config down to the HBase one.
-   */
-  public void propagatePrincipals() {
-    String dfsPrincipal = conf.get(SliderXmlConfKeys.DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY);
-    if (dfsPrincipal != null) {
-      String siteDfsPrincipal = OptionKeys.SITE_XML_PREFIX +
-                                SliderXmlConfKeys.DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY;
-      instanceDescription.getAppConfOperations().set(siteDfsPrincipal, dfsPrincipal);
-    }
-  }
-
-  public void propagateFilename() {
-    String fsDefaultName = conf.get(
-      CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY);
-    instanceDescription.getAppConfOperations().set(OptionKeys.SITE_XML_PREFIX +
-                                            CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY,
-                                            fsDefaultName
-                                           );
-
-    instanceDescription.getAppConfOperations().set(OptionKeys.SITE_XML_PREFIX +
-                                            SliderXmlConfKeys.FS_DEFAULT_NAME_CLASSIC,
-                                            fsDefaultName
-                                           );
-
-  }
-
-
-  public void takeSnapshotOfConfDir(Path appconfdir) throws
-                                                     IOException,
-                                                     BadConfigException,
-                                                     BadClusterStateException {
-    FileSystem srcFS = FileSystem.get(appconfdir.toUri(), conf);
-    if (!srcFS.isDirectory(appconfdir)) {
-      throw new BadConfigException(
-        "Source Configuration directory is not valid: %s",
-        appconfdir.toString());
-    }
-    // bulk copy
-    FsPermission clusterPerms = coreFS.getInstanceDirectoryPermissions();
-    // first the original from wherever to the DFS
-    SliderUtils.copyDirectory(conf, appconfdir, instancePaths.snapshotConfPath,
-        clusterPerms);
-  }
-
-
-  private Set<String> getExternalComponents(ConfTreeOperations ops)
-      throws BadConfigException {
-    Set<String> externalComponents = new HashSet<>();
-    if (ops.getGlobalOptions().containsKey(COMPONENT_TYPE_KEY)) {
-      throw new BadConfigException(COMPONENT_TYPE_KEY + " must be " +
-          "specified per-component, not in global");
-    }
-
-    for (Entry<String, Map<String, String>> entry : ops.getComponents()
-        .entrySet()) {
-      if (COMPONENT_AM.equals(entry.getKey())) {
-        continue;
-      }
-      Map<String, String> options = entry.getValue();
-      if (COMPONENT_TYPE_EXTERNAL_APP.equals(options.get(COMPONENT_TYPE_KEY))) {
-        externalComponents.add(entry.getKey());
-      }
-    }
-    return externalComponents;
-  }
-
-  private void mergeExternalComponent(ConfTreeOperations ops,
-      ConfTreeOperations externalOps, String externalComponent,
-      Integer priority) throws BadConfigException {
-    for (String subComponent : externalOps.getComponentNames()) {
-      if (COMPONENT_AM.equals(subComponent)) {
-        continue;
-      }
-      String prefix = externalComponent + COMPONENT_SEPARATOR;
-      log.debug("Merging options for {} into {}", subComponent,
-          prefix + subComponent);
-      MapOperations subComponentOps = ops.getOrAddComponent(
-          prefix + subComponent);
-      if (priority == null) {
-        SliderUtils.mergeMaps(subComponentOps,
-            ops.getComponent(externalComponent).options);
-        subComponentOps.remove(COMPONENT_TYPE_KEY);
-      }
-
-      SliderUtils.mergeMapsIgnoreDuplicateKeysAndPrefixes(subComponentOps,
-          externalOps.getComponent(subComponent),
-          SliderKeys.COMPONENT_KEYS_TO_SKIP);
-
-      // add prefix to existing prefix
-      String existingPrefix = subComponentOps.get(ROLE_PREFIX);
-      if (existingPrefix != null) {
-        if (!subComponent.startsWith(existingPrefix)) {
-          throw new BadConfigException("Bad prefix " + existingPrefix +
-              " for subcomponent " + subComponent + " of " + externalComponent);
-        }
-        prefix = prefix + existingPrefix;
-      }
-      subComponentOps.set(ROLE_PREFIX, prefix);
-
-      // adjust priority
-      if (priority != null) {
-        subComponentOps.put(ResourceKeys.COMPONENT_PRIORITY,
-            Integer.toString(priority));
-        priorities.add(priority);
-        priority++;
-      }
-    }
-  }
-
-  private int getNextPriority() {
-    if (priorities.isEmpty()) {
-      return 1;
-    } else {
-      return priorities.last() + 1;
-    }
-  }
-
-  public void resolve()
-      throws BadConfigException, IOException, BadClusterStateException {
-    ConfTreeOperations appConf = instanceDescription.getAppConfOperations();
-    ConfTreeOperations resources = instanceDescription.getResourceOperations();
-
-    for (Entry<String, Map<String, String>> entry : resources.getComponents()
-        .entrySet()) {
-      if (COMPONENT_AM.equals(entry.getKey())) {
-        continue;
-      }
-      if (entry.getValue().containsKey(ResourceKeys.COMPONENT_PRIORITY)) {
-        priorities.add(Integer.parseInt(entry.getValue().get(
-            ResourceKeys.COMPONENT_PRIORITY)));
-      }
-    }
-
-    Set<String> externalComponents = getExternalComponents(appConf);
-    if (!externalComponents.isEmpty()) {
-      log.info("Found external components {}", externalComponents);
-    }
-
-    for (String component : externalComponents) {
-      if (!isClusternameValid(component)) {
-        throw new BadConfigException(component + " is not a valid external " +
-            "component");
-      }
-      Path componentClusterDir = coreFS.buildClusterDirPath(component);
-      try {
-        coreFS.verifyPathExists(componentClusterDir);
-      } catch (IOException e) {
-        throw new BadConfigException("external component " + component +
-            " doesn't exist");
-      }
-      AggregateConf componentConf = new AggregateConf();
-      ConfPersister persister = new ConfPersister(coreFS, componentClusterDir);
-      try {
-        persister.load(componentConf);
-      } catch (Exception e) {
-        throw new BadConfigException("Couldn't read configuration for " +
-            "external component " + component);
-      }
-
-      ConfTreeOperations componentAppConf = componentConf.getAppConfOperations();
-      String externalAppDef = componentAppConf.get(AgentKeys.APP_DEF);
-      if (SliderUtils.isSet(externalAppDef)) {
-        Path newAppDef = new Path(coreFS.buildAppDefDirPath(clustername),
-            component + "_" + SliderKeys.DEFAULT_APP_PKG);
-        componentAppConf.set(AgentKeys.APP_DEF, newAppDef);
-        componentAppConf.append(AgentKeys.APP_DEF_ORIGINAL, externalAppDef);
-        log.info("Copying external appdef {} to {} for {}", externalAppDef,
-            newAppDef, component);
-        externalAppDefs.put(externalAppDef, newAppDef);
-        externalAppDef = newAppDef.toString();
-      }
-
-      for (String rcomp : componentConf.getResourceOperations()
-          .getComponentNames()) {
-        if (COMPONENT_AM.equals(rcomp)) {
-          continue;
-        }
-        log.debug("Adding component {} to appConf for {}", rcomp, component);
-        componentAppConf.getOrAddComponent(rcomp);
-      }
-      componentConf.resolve();
-
-      for (String rcomp : componentConf.getResourceOperations()
-          .getComponentNames()) {
-        if (COMPONENT_AM.equals(rcomp)) {
-          continue;
-        }
-        String componentAppDef = componentAppConf.getComponentOpt(
-            rcomp, AgentKeys.APP_DEF, null);
-        if (SliderUtils.isUnset(componentAppDef) ||
-            componentAppDef.equals(externalAppDef)) {
-          continue;
-        }
-        if (externalAppDefs.containsKey(componentAppDef)) {
-          log.info("Using external appdef {} for {}",
-              externalAppDefs.get(componentAppDef), rcomp);
-        } else {
-          String existingPrefix = componentAppConf.getComponentOpt(rcomp,
-              ROLE_PREFIX, null);
-          if (SliderUtils.isUnset(existingPrefix)) {
-            existingPrefix = "";
-          } else {
-            existingPrefix = COMPONENT_SEPARATOR + SliderUtils.trimPrefix(
-                existingPrefix);
-          }
-          Path newAppDef = new Path(coreFS.buildAppDefDirPath(clustername),
-              component + existingPrefix + "_" + SliderKeys.DEFAULT_APP_PKG);
-          externalAppDefs.put(componentAppDef, newAppDef);
-          log.info("Copying external appdef {} to {} for {}", componentAppDef,
-              newAppDef, component + COMPONENT_SEPARATOR + rcomp);
-        }
-        componentAppConf.setComponentOpt(rcomp, AgentKeys.APP_DEF,
-            externalAppDefs.get(componentAppDef).toString());
-        componentAppConf.appendComponentOpt(rcomp,
-            AgentKeys.APP_DEF_ORIGINAL, componentAppDef);
-      }
-      Set<Path> newAppDefs = new HashSet<>();
-      newAppDefs.addAll(externalAppDefs.values());
-      if (newAppDefs.size() != externalAppDefs.size()) {
-        throw new IllegalStateException("Values repeat in external appdefs "
-            + externalAppDefs);
-      }
-      log.info("External appdefs after {}: {}", component, externalAppDefs);
-
-      mergeExternalComponent(appConf, componentAppConf, component, null);
-      mergeExternalComponent(resources, componentConf.getResourceOperations(),
-          component, getNextPriority());
-    }
-  }
-
-
-  /**
-   * Persist this
-   * @param appconfdir conf dir
-   * @param overwrite if true, we don't need to create cluster dir
-   * @throws IOException
-   * @throws SliderException
-   * @throws LockAcquireFailedException
-   */
-  public void persist(Path appconfdir, boolean overwrite) throws
-      IOException,
-      SliderException,
-      LockAcquireFailedException {
-    if (!overwrite) {
-      coreFS.createClusterDirectories(instancePaths);
-    }
-    ConfPersister persister =
-      new ConfPersister(coreFS, getInstanceDir());
-    ConfDirSnapshotAction action = null;
-    if (appconfdir != null) {
-      action = new ConfDirSnapshotAction(appconfdir);
-    }
-    persister.save(instanceDescription, action);
-    for (Entry<String, Path> appDef : externalAppDefs.entrySet()) {
-      SliderUtils.copy(conf, new Path(appDef.getKey()), appDef.getValue());
-    }
-  }
-
-  /**
-   * Add the ZK paths to the application options. 
-   * 
-   * @param zkBinding ZK binding
-   */
-  public void addZKBinding(ZKPathBuilder zkBinding) throws BadConfigException {
-
-    String quorum = zkBinding.getAppQuorum();
-    if (SliderUtils.isSet(quorum)) {
-      MapOperations globalAppOptions =
-          instanceDescription.getAppConfOperations().getGlobalOptions();
-      globalAppOptions.put(ZOOKEEPER_PATH, zkBinding.getAppPath());
-      globalAppOptions.put(ZOOKEEPER_QUORUM, quorum);
-      globalAppOptions.put(ZOOKEEPER_HOSTS,
-          ZookeeperUtils.convertToHostsOnlyList(quorum));
-    }
-  }
-
-  /**
-   * Class to execute the snapshotting of the configuration directory
-   * while the persistence lock is held. 
-   * 
-   * This guarantees that there won't be an attempt to launch a cluster
-   * until the snapshot is complete -as the write lock won't be released
-   * until afterwards.
-   */
-  private class ConfDirSnapshotAction implements LockHeldAction {
-
-    private final Path appconfdir;
-
-    private ConfDirSnapshotAction(Path appconfdir) {
-      this.appconfdir = appconfdir;
-    }
-
-    @Override
-    public void execute() throws IOException, SliderException {
-
-      takeSnapshotOfConfDir(appconfdir);
-    }
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/build/InstanceIO.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/build/InstanceIO.java b/slider-core/src/main/java/org/apache/slider/core/build/InstanceIO.java
deleted file mode 100644
index 3a8f805..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/build/InstanceIO.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.build;
-
-import org.apache.hadoop.fs.Path;
-import org.apache.slider.common.tools.CoreFileSystem;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.exceptions.BadClusterStateException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.persist.ConfPersister;
-import org.apache.slider.core.persist.LockAcquireFailedException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-
-public class InstanceIO {
-  protected static final Logger log =
-    LoggerFactory.getLogger(InstanceIO.class);
-
-  /**
-   * Load in an instance definition -but do not resolve it
-   * @param sliderFileSystem filesystem
-   * @param clusterDirectory CD
-   * @return the unresolved aggregate configuration
-   * @throws IOException
-   * @throws SliderException
-   * @throws BadClusterStateException if a lock could not be acquired
-   */
-  public static AggregateConf loadInstanceDefinitionUnresolved(
-    CoreFileSystem sliderFileSystem,
-    Path clusterDirectory)
-      throws IOException, SliderException {
-    AggregateConf instanceDefinition = new AggregateConf();
-    ConfPersister persister =
-      new ConfPersister(sliderFileSystem, clusterDirectory);
-    try {
-      persister.load(instanceDefinition);
-    } catch (LockAcquireFailedException e) {
-      log.debug("Lock acquisition failure of {}", clusterDirectory, e);
-
-      throw new BadClusterStateException(
-        "Application at %s is locked for reading",
-        clusterDirectory.toString());
-    }
-    return instanceDefinition;
-  }
-
-
-  /**
-   * Update a persisted instance definition
-   * @param coreFS filesystem
-   * @param dir directory to load from
-   * @param instanceDefinition instance definition to save do
-   * @throws SliderException
-   * @throws IOException
-   * @throws LockAcquireFailedException
-   */
-  public static void saveInstanceDefinition(CoreFileSystem coreFS,
-      Path dir,
-      AggregateConf instanceDefinition)
-      throws SliderException, IOException, LockAcquireFailedException {
-    ConfPersister persister =
-      new ConfPersister(coreFS, dir);
-    persister.save(instanceDefinition, null);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/conf/AbstractInputPropertiesValidator.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/conf/AbstractInputPropertiesValidator.java b/slider-core/src/main/java/org/apache/slider/core/conf/AbstractInputPropertiesValidator.java
deleted file mode 100644
index 336b4dc..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/conf/AbstractInputPropertiesValidator.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.core.conf;
-
-import org.apache.slider.core.exceptions.BadConfigException;
-
-/**
- *
- */
-public abstract class AbstractInputPropertiesValidator implements InputPropertiesValidator{
-
-  abstract void validatePropertyNamePrefix(String key) throws BadConfigException;
-
-  public void validate(ConfTreeOperations props)
-      throws BadConfigException {
-    validateGlobalProperties(props);
-    validateComponentProperties(props);
-
-  }
-
-  protected void validateComponentProperties(ConfTreeOperations props)
-      throws BadConfigException {
-    for (String compName : props.getComponentNames()) {
-      MapOperations mo = props.getComponent(compName);
-      if (mo == null) continue;
-      for (String key : mo.keySet()) {
-        validatePropertyNamePrefix(key);
-      }
-    }
-  }
-
-  abstract void validateGlobalProperties(ConfTreeOperations props)
-      throws BadConfigException;
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/conf/AggregateConf.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/conf/AggregateConf.java b/slider-core/src/main/java/org/apache/slider/core/conf/AggregateConf.java
deleted file mode 100644
index 18c3156..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/conf/AggregateConf.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.conf;
-
-import org.apache.commons.lang.RandomStringUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.io.IOException;
-
-/**
- * Aggregate Configuration.
- *
- * It is serializable to JSON
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public final class AggregateConf {
-
-  private String name;
-  private ConfTree resources;
-  private ConfTree internal;
-  private ConfTree appConf;
-
-  private ConfTreeOperations resourceOperations;
-  private ConfTreeOperations appConfOperations;
-  private ConfTreeOperations internalOperations;
-
-  private String passphrase;
-
-  public AggregateConf() {
-    this(new ConfTree(), new ConfTree(), new ConfTree());
-  }
-
-  public AggregateConf(String name) {
-    this(new ConfTree(), new ConfTree(), new ConfTree());
-    this.name = name;
-  }
-
-  public AggregateConf(ConfTree resources,
-                       ConfTree appConf,
-                       ConfTree internal) {
-    setResources(resources);
-    setAppConf(appConf);
-    setInternal(internal);
-  }
-
-  /**
-   * Take a snapshot of the configuration
-   * @param instanceDefinition source
-   * @throws IOException marshalling/copying problems
-   */
-  public AggregateConf(AggregateConf instanceDefinition) throws IOException {
-    ConfTreeOperations resourcesSnapshot =
-        ConfTreeOperations.fromInstance(instanceDefinition.getResources());
-    ConfTreeOperations appConfSnapshot =
-        ConfTreeOperations.fromInstance(instanceDefinition.getAppConf());
-    ConfTreeOperations internalsSnapshot =
-        ConfTreeOperations.fromInstance(instanceDefinition.getInternal());
-    //build a new aggregate from the snapshots
-    setResources(resourcesSnapshot.confTree);
-    setAppConf(appConfSnapshot.confTree);
-    setInternal(internalsSnapshot.confTree);
-  }
-  
-  public void setResources(ConfTree resources) {
-    this.resources = resources;
-    resourceOperations = new ConfTreeOperations(resources);
-  }
-
-  public void setAppConf(ConfTree appConf) {
-    this.appConf = appConf;
-    appConfOperations = new ConfTreeOperations(appConf);
-  }
-
-  public ConfTree getInternal() {
-    return internal;
-  }
-
-  public void setInternal(ConfTree internal) {
-    this.internal = internal;
-    internalOperations = new ConfTreeOperations(internal);
-  }
-
-  public ConfTree getResources() {
-    return resources;
-  }
-
-  public ConfTree getAppConf() {
-    return appConf;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  @JsonIgnore
-  public ConfTreeOperations getResourceOperations() {
-    return resourceOperations;
-  }
-
-
-  @JsonIgnore
-  public ConfTreeOperations getAppConfOperations() {
-    return appConfOperations;
-  }
-
-  @JsonIgnore
-  public ConfTreeOperations getInternalOperations() {
-    return internalOperations;
-  }
-
-  /**
-   * predicate to query if all sections have data structures
-   * @return true if every section is non-null
-   */
-  @JsonIgnore
-  public boolean isComplete() {
-    return resources != null && appConf != null && internal != null;
-  }
-
-  public void validate() throws BadConfigException {
-    if (!isComplete()) {
-      throw new BadConfigException("Incomplete instance %s", this);
-    }
-    resourceOperations.validate();
-    internalOperations.validate();
-    appConfOperations.validate();
-  }
-
-  public void resolve() throws BadConfigException {
-    validate();
-    resourceOperations.resolve();
-    internalOperations.resolve();
-    appConfOperations.resolve();
-  }
-
-  @JsonIgnore
-  public String getPassphrase() {
-    if (passphrase == null) {
-      passphrase = RandomStringUtils.randomAlphanumeric(
-          Integer.valueOf(SliderKeys.PASS_LEN));
-    }
-
-    return passphrase;
-  }
-
-  /**
-   * Is this app package versioned?
-   * 
-   * @return true if {@link SliderKeys#APP_VERSION} was set in the app config
-   *         provided during creation of this app
-   * @since 0.80.0-incubating
-   */
-  public boolean isVersioned() {
-    return StringUtils.isNotEmpty(getAppConfOperations().getGlobalOptions()
-        .get(SliderKeys.APP_VERSION));
-  }
-
-  /**
-   * string operation includes all the inner conftrees
-   * @return a string description
-   */
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-      new StringBuilder("{");
-    sb.append(",\n\"internal\": ").append(internal);
-    sb.append(",\n\"resources\": ").append(resources);
-    sb.append(",\n\"appConf\" :").append(appConf);
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/conf/ConfTree.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/conf/ConfTree.java b/slider-core/src/main/java/org/apache/slider/core/conf/ConfTree.java
deleted file mode 100644
index be7c56f..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/conf/ConfTree.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.conf;
-
-import org.apache.slider.core.persist.ConfTreeSerDeser;
-import org.apache.slider.core.persist.PersistKeys;
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A conf tree represents one of the configuration trees
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public final class ConfTree {
-
-  /**
-   * Size of an initial map. This is kept low so the cost of having
-   * many conf trees in a process is low.
-   */
-  public static final int INITAL_MAP_CAPACITY = 3;
-
-  protected static final Logger
-    log = LoggerFactory.getLogger(ConfTree.class);
-
-  /**
-   * version counter
-   */
-  public String schema = PersistKeys.SCHEMA;
-
-  /**
-   * Metadata
-   */
-  public Map<String, Object> metadata = new HashMap<>(INITAL_MAP_CAPACITY);
-
-
-  /**
-   * Global options
-   */
-  public Map<String, String> global =
-    new HashMap<>(INITAL_MAP_CAPACITY);
-
-
-  /**
-   * Credentials
-   */
-  public Map<String, List<String>> credentials =
-      new HashMap<>(INITAL_MAP_CAPACITY);
-
-  /**
-   * Role options, 
-   * role -> option -> value
-   */
-  public Map<String, Map<String, String>> components =
-    new HashMap<>(INITAL_MAP_CAPACITY);
-
-
-  /**
-   * Shallow clone
-   * @return a shallow clone
-   * @throws CloneNotSupportedException
-   */
-  @Override
-  public Object clone() throws CloneNotSupportedException {
-    return super.clone();
-  }
-
-  @Override
-  public String toString() {
-    try {
-      return toJson();
-    } catch (Exception e) {
-      log.warn("Failed to convert to JSON ", e);
-      return super.toString();
-    }
-  }
-
-  /**
-   * Convert to a JSON string
-   * @return a JSON string description
-   * @throws IOException Problems mapping/writing the object
-   */
-  public String toJson() throws IOException,
-                                JsonGenerationException,
-                                JsonMappingException {
-    return ConfTreeSerDeser.toString(this);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/conf/ConfTreeOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/conf/ConfTreeOperations.java b/slider-core/src/main/java/org/apache/slider/core/conf/ConfTreeOperations.java
deleted file mode 100644
index 526e17d..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/conf/ConfTreeOperations.java
+++ /dev/null
@@ -1,527 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.conf;
-
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.persist.ConfTreeSerDeser;
-import org.apache.slider.core.persist.PersistKeys;
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-public class ConfTreeOperations {
-
-  public final ConfTree confTree;
-  private final MapOperations globalOptions;
-
-  protected static final Logger
-    log = LoggerFactory.getLogger(ConfTreeOperations.class);
-
-
-  public ConfTreeOperations(ConfTree confTree) {
-    assert confTree != null : "null tree";
-    assert confTree.components != null : "null tree components";
-    this.confTree = confTree;
-    globalOptions = new MapOperations("global", confTree.global);
-  }
-
-  /**
-   * Get the underlying conf tree
-   * @return the tree
-   */
-  public ConfTree getConfTree() {
-    return confTree;
-  }
-
-  /**
-   * Validate the configuration
-   * @throws BadConfigException
-   */
-  public void validate() throws BadConfigException {
-    validate(null);
-  }
-
-  /**
-   * Validate the configuration
-   * @param validator a provided properties validator
-   * @throws BadConfigException
-   */
-  public void validate(InputPropertiesValidator validator) throws BadConfigException {
-    String version = confTree.schema;
-    if (version == null) {
-      throw new BadConfigException("'version' undefined");
-    }
-    if (!PersistKeys.SCHEMA.equals(version)) {
-      throw new BadConfigException(
-          "version %s incompatible with supported version %s",
-          version,
-          PersistKeys.SCHEMA);
-    }
-    if (validator != null) {
-      validator.validate(this);
-    }
-  }
-
-  /**
-   * Resolve a ConfTree by mapping all global options into each component
-   * -if there is none there already
-   */
-  public void resolve() {
-    for (Map.Entry<String, Map<String, String>> comp : confTree.components.entrySet()) {
-      mergeInGlobal(comp.getValue());
-    }
-  }
-
-  /**
-   * Merge any options
-   * @param component dest values
-   */
-  public void mergeInGlobal(Map<String, String> component) {
-    SliderUtils.mergeMapsIgnoreDuplicateKeys(component, confTree.global);
-  }
-
-  /**
-   * Get operations on the global set
-   * @return a wrapped map
-   */
-  public MapOperations getGlobalOptions() {
-    return globalOptions;
-  }
-
-
-  /**
-   * look up a component and return its options
-   * @param component component name
-   * @return component mapping or null
-   */
-  public MapOperations getComponent(String component) {
-    Map<String, String> instance = confTree.components.get(component);
-    if (instance != null) {
-      return new MapOperations(component, instance);
-    }
-    return null;
-  }
-
-  /**
-   * look up a component and return its options with the specified replacements
-   * @param component component name
-   * @param replacementOptions replacement options
-   * @return component mapping or null
-   */
-  public MapOperations getComponent(String component, Map<String,String>
-      replacementOptions) {
-    Map<String, String> instance = confTree.components.get(component);
-    if (instance != null) {
-      Map<String, String> newInstance = new HashMap<>();
-      newInstance.putAll(instance);
-      newInstance.putAll(replacementOptions);
-      return new MapOperations(component, newInstance);
-    }
-    return null;
-  }
-
-  /**
-   * Get at the underlying component map
-   * @return a map of components. This is the raw ConfTree data structure
-   */
-  public Map<String, Map<String, String>> getComponents() {
-    return confTree.components;
-  }
-
-  /**
-   * Get a component -adding it to the components map if
-   * none with that name exists
-   * @param name role
-   * @return role mapping
-   */
-  public MapOperations getOrAddComponent(String name) {
-    MapOperations operations = getComponent(name);
-    if (operations != null) {
-      return operations;
-    }
-    //create a new instances
-    Map<String, String> map = new HashMap<>();
-    confTree.components.put(name, map);
-    return new MapOperations(name, map);
-  }
-
-
-  /*
-   * return the Set of names names
-   */
-  @JsonIgnore
-  public Set<String> getComponentNames() {
-    return new HashSet<String>(confTree.components.keySet());
-  }
-  
-  
-
-  /**
-   * Get a component whose presence is mandatory
-   * @param name component name
-   * @return the mapping
-   * @throws BadConfigException if the name is not there
-   */
-  public MapOperations getMandatoryComponent(String name) throws
-                                                          BadConfigException {
-    MapOperations ops = getComponent(name);
-    if (ops == null) {
-      throw new BadConfigException("Missing component " + name);
-    }
-    return ops;
-  }
-
-  /**
-   * Set a global option, converting it to a string as needed
-   * @param key key
-   * @param value non null value
-   */
-  public void set(String key, Object value) {
-    globalOptions.put(key, value.toString());
-  }
-  /**
-   * get a global option
-   * @param key key
-   * @return value or null
-   * 
-   */
-  public String get(String key) {
-    return globalOptions.get(key);
-  }
-  /**
-   * append to a global option
-   * @param key key
-   * @return value
-   *
-   */
-  public String append(String key, String value) {
-    if (SliderUtils.isUnset(value)) {
-      return null;
-    }
-    if (globalOptions.containsKey(key)) {
-      globalOptions.put(key, globalOptions.get(key) + "," + value);
-    } else {
-      globalOptions.put(key, value);
-    }
-    return globalOptions.get(key);
-  }
-
-  /**
-   * Propagate all global keys matching a prefix
-   * @param src source
-   * @param prefix prefix
-   */
-  public void propagateGlobalKeys(ConfTree src, String prefix) {
-    Map<String, String> global = src.global;
-    for (Map.Entry<String, String> entry : global.entrySet()) {
-      String key = entry.getKey();
-      if (key.startsWith(prefix)) {
-        set(key, entry.getValue());
-      }
-    }
-  }
-
-  /**
-   * Propagate all global keys matching a prefix
-   * @param src source
-   * @param prefix prefix
-   */
-  public void propagateGlobalKeys(ConfTreeOperations src, String prefix) {
-    propagateGlobalKeys(src.confTree, prefix);
-  }
-
-  /**
-   * Merge the map of a single component
-   * @param component component name
-   * @param map map to merge
-   */
-  public void mergeSingleComponentMap(String component, Map<String, String> map) {
-    MapOperations comp = getOrAddComponent(component);
-    comp.putAll(map);
-  }
-  /**
-   * Merge the map of a single component
-   * @param component component name
-   * @param map map to merge
-   */
-  public void mergeSingleComponentMapPrefix(String component,
-                                            Map<String, String> map,
-                                            String prefix,
-                                            boolean overwrite) {
-    boolean needsMerge = false;
-    for (Map.Entry<String, String> entry : map.entrySet()) {
-      String key = entry.getKey();
-      if (key.startsWith(prefix)) {
-        needsMerge = true;
-        break;
-      }
-    }
-    if (!needsMerge) {
-      return;
-    }
-    MapOperations comp = getOrAddComponent(component);
-    comp.mergeMapPrefixedKeys(map,prefix, overwrite);
-  }
-
-  /**
-   * Merge in components
-   * @param commandOptions component options on the CLI
-   */
-  public void mergeComponents(Map<String, Map<String, String>> commandOptions) {
-    for (Map.Entry<String, Map<String, String>> entry : commandOptions.entrySet()) {
-      mergeSingleComponentMap(entry.getKey(), entry.getValue());
-    }
-  }
-
-  /**
-   * Merge in components
-   * @param commandOptions component options on the CLI
-   */
-  public void mergeComponentsPrefix(Map<String,
-    Map<String, String>> commandOptions,
-                                    String prefix,
-                                    boolean overwrite) {
-    for (Map.Entry<String, Map<String, String>> entry : commandOptions.entrySet()) {
-      mergeSingleComponentMapPrefix(entry.getKey(), entry.getValue(), prefix, overwrite);
-    }
-  }
-
-  /**
-   * Merge in another tree -no overwrites of global or conf data
-   * (note that metadata does a naive putAll merge/overwrite)
-   * @param that the other tree
-   */
-  public void mergeWithoutOverwrite(ConfTree that) {
-
-    getGlobalOptions().mergeWithoutOverwrite(that.global);
-    confTree.metadata.putAll(that.metadata);
-    confTree.credentials.putAll(that.credentials);
-
-    for (Map.Entry<String, Map<String, String>> entry : that.components.entrySet()) {
-      MapOperations comp = getOrAddComponent(entry.getKey());
-      comp.mergeWithoutOverwrite(entry.getValue());
-    }
-  }
-  
-  /**
-   * Merge in another tree with overwrites
-   * @param that the other tree
-   */
-  public void merge(ConfTree that) {
-
-    getGlobalOptions().putAll(that.global);
-    confTree.metadata.putAll(that.metadata);
-    confTree.credentials.putAll(that.credentials);
-
-    for (Map.Entry<String, Map<String, String>> entry : that.components.entrySet()) {
-      MapOperations comp = getOrAddComponent(entry.getKey());
-      comp.putAll(entry.getValue());
-    }
-  }
-
-  
-  /**
-   * Load from a resource. The inner conf tree is the loaded data -unresolved
-   * @param resource resource
-   * @return loaded value
-   * @throws IOException load failure
-   */
-  public static ConfTreeOperations fromResource(String resource) throws
-                                                                 IOException {
-    ConfTreeSerDeser confTreeSerDeser = new ConfTreeSerDeser();
-    ConfTreeOperations ops = new ConfTreeOperations(
-       confTreeSerDeser.fromResource(resource) );
-    return ops;      
-  }
-  
-  /**
-   * Load from a resource. The inner conf tree is the loaded data -unresolved
-   * @param resource resource
-   * @return loaded value
-   * @throws IOException load failure
-   */
-  public static ConfTreeOperations fromFile(File resource) throws
-                                                                 IOException {
-    ConfTreeSerDeser confTreeSerDeser = new ConfTreeSerDeser();
-    ConfTreeOperations ops = new ConfTreeOperations(
-       confTreeSerDeser.fromFile(resource) );
-    return ops;
-  }
-
-  /**
-   * Build from an existing instance -which is cloned via JSON ser/deser
-   * @param instance the source instance
-   * @return loaded value
-   * @throws IOException load failure
-   */
-  public static ConfTreeOperations fromInstance(ConfTree instance) throws
-                                                                 IOException {
-    ConfTreeSerDeser confTreeSerDeser = new ConfTreeSerDeser();
-    ConfTreeOperations ops = new ConfTreeOperations(
-       confTreeSerDeser.fromJson(confTreeSerDeser.toJson(instance)) );
-    return ops;
-  }
-
-  /**
-   * Load from a file and merge it in
-   * @param file file
-   * @throws IOException any IO problem
-   * @throws BadConfigException if the file is invalid
-   */
-  public void mergeFile(File file) throws IOException, BadConfigException {
-    mergeFile(file, null);
-  }
-
-  /**
-   * Load from a file and merge it in
-   * @param file file
-   * @param validator properties validator
-   * @throws IOException any IO problem
-   * @throws BadConfigException if the file is invalid
-   */
-  public void mergeFile(File file, InputPropertiesValidator validator) throws IOException, BadConfigException {
-    ConfTreeSerDeser confTreeSerDeser = new ConfTreeSerDeser();
-    ConfTree tree = confTreeSerDeser.fromFile(file);
-    ConfTreeOperations ops = new ConfTreeOperations(tree);
-    ops.validate(validator);
-    merge(ops.confTree);
-  }
-
-  @Override
-  public String toString() {
-    return confTree.toString();
-  }
-
-  /**
-   * Convert to a JSON string
-   * @return a JSON string description
-   */
-  public String toJson() throws IOException,
-                                JsonGenerationException,
-                                JsonMappingException {
-    return confTree.toJson();
-  }
-
-  /**
-   * Get a component option
-   * @param name component name
-   * @param option option name
-   * @param defVal default value
-   * @return resolved value
-   */
-  public String getComponentOpt(String name, String option, String defVal) {
-    MapOperations roleopts = getComponent(name);
-    if (roleopts == null) {
-      return defVal;
-    }
-    return roleopts.getOption(option, defVal);
-  }
-
-  /**
-   * Get a component opt; use {@link Integer#decode(String)} so as to take hex
-   * oct and bin values too.
-   *
-   * @param name component name
-   * @param option option name
-   * @param defVal default value
-   * @return parsed value
-   * @throws NumberFormatException if the role could not be parsed.
-   */
-  public int getComponentOptInt(String name, String option, int defVal) {
-    String val = getComponentOpt(name, option, Integer.toString(defVal));
-    return Integer.decode(val);
-  }
-
-  /**
-   * Get a component opt as a boolean using {@link Boolean#valueOf(String)}.
-   *
-   * @param name component name
-   * @param option option name
-   * @param defVal default value
-   * @return parsed value
-   * @throws NumberFormatException if the role could not be parsed.
-   */
-  public boolean getComponentOptBool(String name, String option, boolean defVal) {
-    String val = getComponentOpt(name, option, Boolean.toString(defVal));
-    return Boolean.valueOf(val);
-  }
-
-  /**
-   * Set a component option, creating the component if necessary
-   * @param component component name
-   * @param option option name
-   * @param val value
-   */
-  public void setComponentOpt(String component, String option, String val) {
-    Map<String, String> roleopts = getOrAddComponent(component);
-    roleopts.put(option, val);
-  }
-
-  /**
-   * Set an integer role option, creating the role if necessary
-   * @param role role name
-   * @param option option name
-   * @param val integer value
-   */
-  public void setComponentOpt(String role, String option, int val) {
-    setComponentOpt(role, option, Integer.toString(val));
-  }
-  /**
-   * Set a long role option, creating the role if necessary
-   * @param role role name
-   * @param option option name
-   * @param val long value
-   */
-  public void setComponentOpt(String role, String option, long val) {
-    setComponentOpt(role, option, Long.toString(val));
-  }
-
-  /**
-   * append to a component option
-   * @param key key
-   * @return value
-   *
-   */
-  public String appendComponentOpt(String role, String key, String value) {
-    if (SliderUtils.isUnset(value)) {
-      return null;
-    }
-    MapOperations roleopts = getComponent(role);
-    if (roleopts == null) {
-      return null;
-    }
-
-    if (roleopts.containsKey(key)) {
-      roleopts.put(key, roleopts.get(key) + "," + value);
-    } else {
-      roleopts.put(key, value);
-    }
-    return roleopts.get(key);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/conf/InputPropertiesValidator.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/conf/InputPropertiesValidator.java b/slider-core/src/main/java/org/apache/slider/core/conf/InputPropertiesValidator.java
deleted file mode 100644
index 237c240..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/conf/InputPropertiesValidator.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.core.conf;
-
-import org.apache.slider.core.exceptions.BadConfigException;
-
-/**
- *
- */
-public interface InputPropertiesValidator {
-  void validate(ConfTreeOperations props) throws BadConfigException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/conf/MapOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/conf/MapOperations.java b/slider-core/src/main/java/org/apache/slider/core/conf/MapOperations.java
deleted file mode 100644
index 9714a0f..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/conf/MapOperations.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.conf;
-
-import com.google.common.base.Preconditions;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Standard map operations.
- *
- * This delegates the standard map interface to the map passed in,
- * so it can be used to add more actions to the map.
- */
-public class MapOperations implements Map<String, String> {
-  private static final Logger log =
-    LoggerFactory.getLogger(MapOperations.class);
-  public static final String DAYS = ".days";
-  public static final String HOURS = ".hours";
-  public static final String MINUTES = ".minutes";
-  public static final String SECONDS = ".seconds";
-
-  /**
-   * Global options
-   */
-  public final Map<String, String> options;
-
-  public final String name;
-
-  public MapOperations() {
-    options = new HashMap<String, String>();
-    name = "";
-  }
-
-  /**
-   * Create an instance
-   * @param name name
-   * @param options source of options
-   */
-  public MapOperations(String name, Map<String, String> options) {
-    Preconditions.checkArgument(options != null, "null map");
-    this.options = options;
-    this.name = name;
-  }
-
-  /**
-   * Create an instance from an iterative map entry
-   * @param entry entry to work with
-   */
-  public MapOperations(Map.Entry<String, Map<String, String>> entry) {
-    Preconditions.checkArgument(entry != null, "null entry");
-    this.name = entry.getKey();
-    this.options = entry.getValue();
-  }
-
-  /**
-   * Get an option value
-   *
-   * @param key key
-   * @param defVal default value
-   * @return option in map or the default
-   */
-  public String getOption(String key, String defVal) {
-    String val = options.get(key);
-    return val != null ? val : defVal;
-  }
-
-  /**
-   * Get a boolean option
-   *
-   * @param key option key
-   * @param defVal default value
-   * @return option true if the option equals "true", or the default value
-   * if the option was not defined at all.
-   */
-  public Boolean getOptionBool(String key, boolean defVal) {
-    String val = getOption(key, Boolean.toString(defVal));
-    return Boolean.valueOf(val);
-  }
-
-  /**
-   * Get a cluster option or value
-   *
-   * @param key option key
-   * @return the value
-   * @throws BadConfigException if the option is missing
-   */
-
-  public String getMandatoryOption(String key) throws BadConfigException {
-    String val = options.get(key);
-    if (val == null) {
-      if (log.isDebugEnabled()) {
-        log.debug("Missing key {} from config containing {}",
-                  key, this);
-      }
-      String text = "Missing option " + key;
-      if (SliderUtils.isSet(name)) {
-        text += " from set " + name;
-      }
-      throw new BadConfigException(text);
-    }
-    return val;
-  }
-
-  /**
-   * Get an integer option; use {@link Integer#decode(String)} so as to take hex
-   * oct and bin values too.
-   *
-   * @param option option name
-   * @param defVal default value
-   * @return parsed value
-   * @throws NumberFormatException if the role could not be parsed.
-   */
-  public int getOptionInt(String option, int defVal) {
-    String val = getOption(option, Integer.toString(defVal));
-    return Integer.decode(val);
-  }
-
-  /**
-   * Get a long option; use {@link Long#decode(String)} so as to take hex
-   * oct and bin values too.
-   *
-   * @param option option name
-   * @param defVal default value
-   * @return parsed value
-   * @throws NumberFormatException
-   */
-  public long getOptionLong(String option, long defVal) {
-    String val = getOption(option, Long.toString(defVal));
-    return Long.decode(val);
-  }
-
-  /**
-   * Get a mandatory integer option; use {@link Integer#decode(String)} so as to take hex
-   * oct and bin values too.
-   *
-   * @param option option name
-   * @return parsed value
-   * @throws NumberFormatException if the option could not be parsed.
-   * @throws BadConfigException if the option could not be found
-   */
-  public int getMandatoryOptionInt(String option) throws BadConfigException {
-    getMandatoryOption(option);
-    return getOptionInt(option, 0);
-  }
-
-  /**
-   * Verify that an option is set: that is defined AND non-empty
-   * @param key
-   * @throws BadConfigException
-   */
-  public void verifyOptionSet(String key) throws BadConfigException {
-    if (SliderUtils.isUnset(getOption(key, null))) {
-      throw new BadConfigException("Unset option %s", key);
-    }
-  }
-  
-  public void mergeWithoutOverwrite(Map<String, String> that) {
-    SliderUtils.mergeMapsIgnoreDuplicateKeys(options, that);
-  }
-
-  /**
-   * Merge a map by prefixed keys
-   * @param that the map to merge in
-   * @param prefix prefix to match on
-   * @param overwrite flag to enable overwrite
-   */
-  public void mergeMapPrefixedKeys(Map<String, String> that,
-                                    String prefix,
-                                    boolean overwrite) {
-    for (Map.Entry<String, String> entry : that.entrySet()) {
-      String key = entry.getKey();
-      if (key.startsWith(prefix)) {
-        if (overwrite || get(key) == null) {
-          put(key, entry.getValue());
-        }
-      }
-    }
-  }
-
-  /**
-   * Set a property if it is not already set
-   * @param key key
-   * @param value value
-   */
-  public void putIfUnset(String key, String value) {
-    if (get(key) == null) {
-      put(key, value);
-    }
-  }
-  
-  public void set(String key, Object value) {
-    assert value != null;
-    put(key, value.toString());
-  }
-
-  public int size() {
-    return options.size();
-  }
-
-  public boolean isEmpty() {
-    return options.isEmpty();
-  }
-
-  public boolean containsValue(Object value) {
-    return options.containsValue(value);
-  }
-
-  public boolean containsKey(Object key) {
-    return options.containsKey(key);
-  }
-
-  public String get(Object key) {
-    return options.get(key);
-  }
-
-  public String put(String key, String value) {
-    return options.put(key, value);
-  }
-
-  public String remove(Object key) {
-    return options.remove(key);
-  }
-
-  public void putAll(Map<? extends String, ? extends String> m) {
-    options.putAll(m);
-  }
-
-  public void clear() {
-    options.clear();
-  }
-
-  public Set<String> keySet() {
-    return options.keySet();
-  }
-
-  public Collection<String> values() {
-    return options.values();
-  }
-
-  public Set<Map.Entry<String, String>> entrySet() {
-    return options.entrySet();
-  }
-
-  @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
-  public boolean equals(Object o) {
-    return options.equals(o);
-  }
-
-  @Override
-  public int hashCode() {
-    return options.hashCode();
-  }
-
-  public boolean isSet(String key) {
-    return SliderUtils.isSet(get(key));
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder builder = new StringBuilder();
-    builder.append(name).append("=\n");
-
-    for (Entry<String, String> entry : options.entrySet()) {
-      builder.append("  ")
-             .append(entry.getKey())
-             .append('=')
-             .append(entry.getValue())
-             .append('\n');
-    }
-    return builder.toString();
-  }
-
-  /**
-   * Get the time range of a set of keys
-   * @param basekey base key to which suffix gets applied
-   * @param defDays
-   * @param defHours
-   * @param defMins
-   * @param defSecs
-   * @return the aggregate time range in seconds
-   */
-  public long getTimeRange(String basekey,
-      int defDays,
-      int defHours,
-      int defMins,
-      int defSecs) {
-    Preconditions.checkArgument(basekey != null);
-    int days = getOptionInt(basekey + DAYS, defDays);
-    int hours = getOptionInt(basekey + HOURS, defHours);
-
-    int minutes = getOptionInt(basekey + MINUTES, defMins);
-    int seconds = getOptionInt(basekey + SECONDS, defSecs);
-    // range check
-    Preconditions.checkState(days >= 0 && hours >= 0 && minutes >= 0
-                             && seconds >= 0,
-        "Time range for %s has negative time component %s:%s:%s:%s",
-        basekey, days, hours, minutes, seconds);
-
-    // calculate total time, schedule the reset if expected
-    long totalMinutes = (long) days * 24 * 60 + (long) hours * 24 + minutes;
-    return totalMinutes * 60 + seconds;
-  }
-
-  /**
-   * Get all entries with a specific prefix
-   * @param prefix prefix
-   * @return a prefixed map, possibly empty
-   */
-  public Map<String, String> prefixedWith(String prefix) {
-
-    Map<String, String> prefixed = new HashMap<>(size());
-    for (Entry<String, String> entry: entrySet()) {
-      if (entry.getKey().startsWith(prefix)) {
-        prefixed.put(entry.getKey(), entry.getValue());
-      }
-    }
-    return prefixed;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/conf/ResourcesInputPropertiesValidator.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/conf/ResourcesInputPropertiesValidator.java b/slider-core/src/main/java/org/apache/slider/core/conf/ResourcesInputPropertiesValidator.java
deleted file mode 100644
index 19f6f8d..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/conf/ResourcesInputPropertiesValidator.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.core.conf;
-
-import org.apache.slider.api.ResourceKeys;
-import org.apache.slider.core.exceptions.BadConfigException;
-
-/**
- *
- */
-public class ResourcesInputPropertiesValidator
-    extends AbstractInputPropertiesValidator {
-
-  void validatePropertyNamePrefix(String key) throws BadConfigException {
-    if (!key.startsWith("yarn.") && !key.equals(ResourceKeys.UNIQUE_NAMES)) {
-      throw new BadConfigException(
-          "argument %s does not have 'yarn.' prefix", key);
-    }
-  }
-
-  protected void validateGlobalProperties(ConfTreeOperations props)
-      throws BadConfigException {
-    for (String key : props.getGlobalOptions().keySet()) {
-      validatePropertyNamePrefix(key);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/conf/TemplateInputPropertiesValidator.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/conf/TemplateInputPropertiesValidator.java b/slider-core/src/main/java/org/apache/slider/core/conf/TemplateInputPropertiesValidator.java
deleted file mode 100644
index aad2757..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/conf/TemplateInputPropertiesValidator.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.core.conf;
-
-import org.apache.slider.core.exceptions.BadConfigException;
-
-/**
- *
- */
-public class TemplateInputPropertiesValidator
-    extends AbstractInputPropertiesValidator {
-
-  void validatePropertyNamePrefix(String key) throws BadConfigException {
-    if (key.startsWith("yarn.")) {
-      throw new BadConfigException(
-          "argument %s has 'yarn.' prefix - this is not allowed in templates", key);
-    }
-  }
-
-  @Override
-  void validateGlobalProperties(ConfTreeOperations props) {
-    // do nothing
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/exceptions/BadClusterStateException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/exceptions/BadClusterStateException.java b/slider-core/src/main/java/org/apache/slider/core/exceptions/BadClusterStateException.java
deleted file mode 100644
index e73ce57..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/exceptions/BadClusterStateException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-
-/**
- * The system is in a bad state
- */
-public class BadClusterStateException extends SliderException {
-  public BadClusterStateException(String message,
-                                  Object... args) {
-    super(EXIT_BAD_STATE, message, args);
-  }
-
-  public BadClusterStateException(Throwable throwable,
-                                  String message, Object... args) {
-    super(EXIT_BAD_STATE, throwable, message, args);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/exceptions/BadCommandArgumentsException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/exceptions/BadCommandArgumentsException.java b/slider-core/src/main/java/org/apache/slider/core/exceptions/BadCommandArgumentsException.java
deleted file mode 100644
index 0d5d686..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/exceptions/BadCommandArgumentsException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-public class BadCommandArgumentsException extends SliderException {
-  public BadCommandArgumentsException(String s, Object... args) {
-    super(EXIT_COMMAND_ARGUMENT_ERROR, s, args);
-  }
-
-  public BadCommandArgumentsException(Throwable throwable, String message,
-                                      Object... args) {
-    super(EXIT_COMMAND_ARGUMENT_ERROR, throwable, message, args);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/exceptions/BadConfigException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/exceptions/BadConfigException.java b/slider-core/src/main/java/org/apache/slider/core/exceptions/BadConfigException.java
deleted file mode 100644
index 65a8ea8..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/exceptions/BadConfigException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-/**
- * An exception to raise on a bad configuration
- */
-public class BadConfigException extends SliderException {
-
-  public BadConfigException(String s) {
-    super(EXIT_BAD_CONFIGURATION, s);
-  }
-
-  public BadConfigException(String message, Object... args) {
-    super(EXIT_BAD_CONFIGURATION, message, args);
-  }
-
-  public BadConfigException(
-                            Throwable throwable,
-                            String message, Object... args) {
-    super(EXIT_BAD_CONFIGURATION, throwable, message, args);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/exceptions/ErrorStrings.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/exceptions/ErrorStrings.java b/slider-core/src/main/java/org/apache/slider/core/exceptions/ErrorStrings.java
deleted file mode 100644
index 8b04969..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/exceptions/ErrorStrings.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-public interface ErrorStrings {
-  String E_UNSTABLE_CLUSTER = "Unstable Application Instance :";
-  String E_CLUSTER_RUNNING = "Application Instance running";
-  String E_ALREADY_EXISTS = "already exists";
-  String PRINTF_E_INSTANCE_ALREADY_EXISTS = "Application Instance \"%s\" already exists and is defined in %s";
-  String PRINTF_E_INSTANCE_DIR_ALREADY_EXISTS = "Application Instance dir already exists: %s";
-  String E_MISSING_PATH = "Missing path ";
-  String E_INCOMPLETE_CLUSTER_SPEC =
-    "Cluster specification is marked as incomplete: ";
-  String E_UNKNOWN_INSTANCE = "Unknown application instance ";
-  String E_DESTROY_CREATE_RACE_CONDITION =
-      "created while it was being destroyed";
-  String E_UNKNOWN_ROLE = "Unknown role ";
-  /**
-   * ERROR Strings
-   */
-  String ERROR_NO_ACTION = "No action specified";
-  String ERROR_UNKNOWN_ACTION = "Unknown command: ";
-  String ERROR_NOT_ENOUGH_ARGUMENTS =
-    "Not enough arguments for action: ";
-  String ERROR_PARSE_FAILURE =
-      "Failed to parse ";
-  /**
-   * All the remaining values after argument processing
-   */
-  String ERROR_TOO_MANY_ARGUMENTS =
-    "Too many arguments";
-  String ERROR_DUPLICATE_ENTRY = "Duplicate entry for ";
-  String E_APPLICATION_NOT_RUNNING = "Application not running";
-  String E_FINISHED_APPLICATION = E_APPLICATION_NOT_RUNNING + ": %s state=%s ";
-  String E_NO_IMAGE_OR_HOME_DIR_SPECIFIED =
-    "Neither an image path nor binary home directory were specified";
-  String E_BOTH_IMAGE_AND_HOME_DIR_SPECIFIED =
-    "Both application image path and home dir have been provided";
-  String E_CONFIGURATION_DIRECTORY_NOT_FOUND =
-    "Configuration directory \"%s\" not found";
-}


[09/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/dt-1.9.4/css/demo_table.css
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/dt-1.9.4/css/demo_table.css b/slider-core/src/main/resources/webapps/static/dt-1.9.4/css/demo_table.css
deleted file mode 100644
index 3bc0433..0000000
--- a/slider-core/src/main/resources/webapps/static/dt-1.9.4/css/demo_table.css
+++ /dev/null
@@ -1,538 +0,0 @@
-/*
- *  File:         demo_table.css
- *  CVS:          $Id$
- *  Description:  CSS descriptions for DataTables demo pages
- *  Author:       Allan Jardine
- *  Created:      Tue May 12 06:47:22 BST 2009
- *  Modified:     $Date$ by $Author$
- *  Language:     CSS
- *  Project:      DataTables
- *
- *  Copyright 2009 Allan Jardine. All Rights Reserved.
- *
- * ***************************************************************************
- * DESCRIPTION
- *
- * The styles given here are suitable for the demos that are used with the standard DataTables
- * distribution (see www.datatables.net). You will most likely wish to modify these styles to
- * meet the layout requirements of your site.
- *
- * Common issues:
- *   'full_numbers' pagination - I use an extra selector on the body tag to ensure that there is
- *     no conflict between the two pagination types. If you want to use full_numbers pagination
- *     ensure that you either have "example_alt_pagination" as a body class name, or better yet,
- *     modify that selector.
- *   Note that the path used for Images is relative. All images are by default located in
- *     ../images/ - relative to this CSS file.
- */
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * DataTables features
- */
-
-.dataTables_wrapper {
-	position: relative;
-	min-height: 302px;
-	clear: both;
-	_height: 302px;
-	zoom: 1; /* Feeling sorry for IE */
-}
-
-.dataTables_processing {
-	position: absolute;
-	top: 50%;
-	left: 50%;
-	width: 250px;
-	height: 30px;
-	margin-left: -125px;
-	margin-top: -15px;
-	padding: 14px 0 2px 0;
-	border: 1px solid #ddd;
-	text-align: center;
-	color: #999;
-	font-size: 14px;
-	background-color: white;
-}
-
-.dataTables_length {
-	width: 40%;
-	float: left;
-}
-
-.dataTables_filter {
-	width: 50%;
-	float: right;
-	text-align: right;
-}
-
-.dataTables_info {
-	width: 60%;
-	float: left;
-}
-
-.dataTables_paginate {
-	width: 44px;
-	* width: 50px;
-	float: right;
-	text-align: right;
-}
-
-/* Pagination nested */
-.paginate_disabled_previous, .paginate_enabled_previous, .paginate_disabled_next, .paginate_enabled_next {
-	height: 19px;
-	width: 19px;
-	margin-left: 3px;
-	float: left;
-}
-
-.paginate_disabled_previous {
-	background-image: url('../images/back_disabled.jpg');
-}
-
-.paginate_enabled_previous {
-	background-image: url('../images/back_enabled.jpg');
-}
-
-.paginate_disabled_next {
-	background-image: url('../images/forward_disabled.jpg');
-}
-
-.paginate_enabled_next {
-	background-image: url('../images/forward_enabled.jpg');
-}
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * DataTables display
- */
-table.display {
-	margin: 0 auto;
-	clear: both;
-	width: 100%;
-	
-	/* Note Firefox 3.5 and before have a bug with border-collapse
-	 * ( https://bugzilla.mozilla.org/show%5Fbug.cgi?id=155955 ) 
-	 * border-spacing: 0; is one possible option. Conditional-css.com is
-	 * useful for this kind of thing
-	 *
-	 * Further note IE 6/7 has problems when calculating widths with border width.
-	 * It subtracts one px relative to the other browsers from the first column, and
-	 * adds one to the end...
-	 *
-	 * If you want that effect I'd suggest setting a border-top/left on th/td's and 
-	 * then filling in the gaps with other borders.
-	 */
-}
-
-table.display thead th {
-	padding: 3px 18px 3px 10px;
-	border-bottom: 1px solid black;
-	font-weight: bold;
-	cursor: pointer;
-	* cursor: hand;
-}
-
-table.display tfoot th {
-	padding: 3px 18px 3px 10px;
-	border-top: 1px solid black;
-	font-weight: bold;
-}
-
-table.display tr.heading2 td {
-	border-bottom: 1px solid #aaa;
-}
-
-table.display td {
-	padding: 3px 10px;
-}
-
-table.display td.center {
-	text-align: center;
-}
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * DataTables sorting
- */
-
-.sorting_asc {
-	background: url('../images/sort_asc.png') no-repeat center right;
-}
-
-.sorting_desc {
-	background: url('../images/sort_desc.png') no-repeat center right;
-}
-
-.sorting {
-	background: url('../images/sort_both.png') no-repeat center right;
-}
-
-.sorting_asc_disabled {
-	background: url('../images/sort_asc_disabled.png') no-repeat center right;
-}
-
-.sorting_desc_disabled {
-	background: url('../images/sort_desc_disabled.png') no-repeat center right;
-}
-
-
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * DataTables row classes
- */
-table.display tr.odd.gradeA {
-	background-color: #ddffdd;
-}
-
-table.display tr.even.gradeA {
-	background-color: #eeffee;
-}
-
-table.display tr.odd.gradeC {
-	background-color: #ddddff;
-}
-
-table.display tr.even.gradeC {
-	background-color: #eeeeff;
-}
-
-table.display tr.odd.gradeX {
-	background-color: #ffdddd;
-}
-
-table.display tr.even.gradeX {
-	background-color: #ffeeee;
-}
-
-table.display tr.odd.gradeU {
-	background-color: #ddd;
-}
-
-table.display tr.even.gradeU {
-	background-color: #eee;
-}
-
-
-tr.odd {
-	background-color: #E2E4FF;
-}
-
-tr.even {
-	background-color: white;
-}
-
-
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Misc
- */
-.dataTables_scroll {
-	clear: both;
-}
-
-.dataTables_scrollBody {
-	*margin-top: -1px;
-}
-
-.top, .bottom {
-	padding: 15px;
-	background-color: #F5F5F5;
-	border: 1px solid #CCCCCC;
-}
-
-.top .dataTables_info {
-	float: none;
-}
-
-.clear {
-	clear: both;
-}
-
-.dataTables_empty {
-	text-align: center;
-}
-
-tfoot input {
-	margin: 0.5em 0;
-	width: 100%;
-	color: #444;
-}
-
-tfoot input.search_init {
-	color: #999;
-}
-
-td.group {
-	background-color: #d1cfd0;
-	border-bottom: 2px solid #A19B9E;
-	border-top: 2px solid #A19B9E;
-}
-
-td.details {
-	background-color: #d1cfd0;
-	border: 2px solid #A19B9E;
-}
-
-
-.example_alt_pagination div.dataTables_info {
-	width: 40%;
-}
-
-.paging_full_numbers {
-	width: 400px;
-	height: 22px;
-	line-height: 22px;
-}
-
-.paging_full_numbers span.paginate_button,
- 	.paging_full_numbers span.paginate_active {
-	border: 1px solid #aaa;
-	-webkit-border-radius: 5px;
-	-moz-border-radius: 5px;
-	padding: 2px 5px;
-	margin: 0 3px;
-	cursor: pointer;
-	*cursor: hand;
-}
-
-.paging_full_numbers span.paginate_button {
-	background-color: #ddd;
-}
-
-.paging_full_numbers span.paginate_button:hover {
-	background-color: #ccc;
-}
-
-.paging_full_numbers span.paginate_active {
-	background-color: #99B3FF;
-}
-
-table.display tr.even.row_selected td {
-	background-color: #B0BED9;
-}
-
-table.display tr.odd.row_selected td {
-	background-color: #9FAFD1;
-}
-
-
-/*
- * Sorting classes for columns
- */
-/* For the standard odd/even */
-tr.odd td.sorting_1 {
-	background-color: #D3D6FF;
-}
-
-tr.odd td.sorting_2 {
-	background-color: #DADCFF;
-}
-
-tr.odd td.sorting_3 {
-	background-color: #E0E2FF;
-}
-
-tr.even td.sorting_1 {
-	background-color: #EAEBFF;
-}
-
-tr.even td.sorting_2 {
-	background-color: #F2F3FF;
-}
-
-tr.even td.sorting_3 {
-	background-color: #F9F9FF;
-}
-
-
-/* For the Conditional-CSS grading rows */
-/*
- 	Colour calculations (based off the main row colours)
-  Level 1:
-		dd > c4
-		ee > d5
-	Level 2:
-	  dd > d1
-	  ee > e2
- */
-tr.odd.gradeA td.sorting_1 {
-	background-color: #c4ffc4;
-}
-
-tr.odd.gradeA td.sorting_2 {
-	background-color: #d1ffd1;
-}
-
-tr.odd.gradeA td.sorting_3 {
-	background-color: #d1ffd1;
-}
-
-tr.even.gradeA td.sorting_1 {
-	background-color: #d5ffd5;
-}
-
-tr.even.gradeA td.sorting_2 {
-	background-color: #e2ffe2;
-}
-
-tr.even.gradeA td.sorting_3 {
-	background-color: #e2ffe2;
-}
-
-tr.odd.gradeC td.sorting_1 {
-	background-color: #c4c4ff;
-}
-
-tr.odd.gradeC td.sorting_2 {
-	background-color: #d1d1ff;
-}
-
-tr.odd.gradeC td.sorting_3 {
-	background-color: #d1d1ff;
-}
-
-tr.even.gradeC td.sorting_1 {
-	background-color: #d5d5ff;
-}
-
-tr.even.gradeC td.sorting_2 {
-	background-color: #e2e2ff;
-}
-
-tr.even.gradeC td.sorting_3 {
-	background-color: #e2e2ff;
-}
-
-tr.odd.gradeX td.sorting_1 {
-	background-color: #ffc4c4;
-}
-
-tr.odd.gradeX td.sorting_2 {
-	background-color: #ffd1d1;
-}
-
-tr.odd.gradeX td.sorting_3 {
-	background-color: #ffd1d1;
-}
-
-tr.even.gradeX td.sorting_1 {
-	background-color: #ffd5d5;
-}
-
-tr.even.gradeX td.sorting_2 {
-	background-color: #ffe2e2;
-}
-
-tr.even.gradeX td.sorting_3 {
-	background-color: #ffe2e2;
-}
-
-tr.odd.gradeU td.sorting_1 {
-	background-color: #c4c4c4;
-}
-
-tr.odd.gradeU td.sorting_2 {
-	background-color: #d1d1d1;
-}
-
-tr.odd.gradeU td.sorting_3 {
-	background-color: #d1d1d1;
-}
-
-tr.even.gradeU td.sorting_1 {
-	background-color: #d5d5d5;
-}
-
-tr.even.gradeU td.sorting_2 {
-	background-color: #e2e2e2;
-}
-
-tr.even.gradeU td.sorting_3 {
-	background-color: #e2e2e2;
-}
-
-
-/*
- * Row highlighting example
- */
-.ex_highlight #example tbody tr.even:hover, #example tbody tr.even td.highlighted {
-	background-color: #ECFFB3;
-}
-
-.ex_highlight #example tbody tr.odd:hover, #example tbody tr.odd td.highlighted {
-	background-color: #E6FF99;
-}
-
-.ex_highlight_row #example tr.even:hover {
-	background-color: #ECFFB3;
-}
-
-.ex_highlight_row #example tr.even:hover td.sorting_1 {
-	background-color: #DDFF75;
-}
-
-.ex_highlight_row #example tr.even:hover td.sorting_2 {
-	background-color: #E7FF9E;
-}
-
-.ex_highlight_row #example tr.even:hover td.sorting_3 {
-	background-color: #E2FF89;
-}
-
-.ex_highlight_row #example tr.odd:hover {
-	background-color: #E6FF99;
-}
-
-.ex_highlight_row #example tr.odd:hover td.sorting_1 {
-	background-color: #D6FF5C;
-}
-
-.ex_highlight_row #example tr.odd:hover td.sorting_2 {
-	background-color: #E0FF84;
-}
-
-.ex_highlight_row #example tr.odd:hover td.sorting_3 {
-	background-color: #DBFF70;
-}
-
-
-/*
- * KeyTable
- */
-table.KeyTable td {
-	border: 3px solid transparent;
-}
-
-table.KeyTable td.focus {
-	border: 3px solid #3366FF;
-}
-
-table.display tr.gradeA {
-	background-color: #eeffee;
-}
-
-table.display tr.gradeC {
-	background-color: #ddddff;
-}
-
-table.display tr.gradeX {
-	background-color: #ffdddd;
-}
-
-table.display tr.gradeU {
-	background-color: #ddd;
-}
-
-div.box {
-	height: 100px;
-	padding: 10px;
-	overflow: auto;
-	border: 1px solid #8080FF;
-	background-color: #E5E5FF;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/dt-1.9.4/css/jui-dt.css
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/dt-1.9.4/css/jui-dt.css b/slider-core/src/main/resources/webapps/static/dt-1.9.4/css/jui-dt.css
deleted file mode 100644
index 89bd2f0..0000000
--- a/slider-core/src/main/resources/webapps/static/dt-1.9.4/css/jui-dt.css
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- *  File:         demo_table_jui.css
- *  CVS:          $Id$
- *  Description:  CSS descriptions for DataTables demo pages
- *  Author:       Allan Jardine
- *  Created:      Tue May 12 06:47:22 BST 2009
- *  Modified:     $Date$ by $Author$
- *  Language:     CSS
- *  Project:      DataTables
- *
- *  Copyright 2009 Allan Jardine. All Rights Reserved.
- *
- * ***************************************************************************
- * DESCRIPTION
- *
- * The styles given here are suitable for the demos that are used with the standard DataTables
- * distribution (see www.datatables.net). You will most likely wish to modify these styles to
- * meet the layout requirements of your site.
- *
- * Common issues:
- *   'full_numbers' pagination - I use an extra selector on the body tag to ensure that there is
- *     no conflict between the two pagination types. If you want to use full_numbers pagination
- *     ensure that you either have "example_alt_pagination" as a body class name, or better yet,
- *     modify that selector.
- *   Note that the path used for Images is relative. All images are by default located in
- *     ../images/ - relative to this CSS file.
- */
-
-
-/*
- * jQuery UI specific styling
- */
-
-.paging_two_button .ui-button {
-	float: left;
-	cursor: pointer;
-	* cursor: hand;
-}
-
-.paging_full_numbers .ui-button {
-	padding: 2px 6px;
-	margin: 0;
-	cursor: pointer;
-	* cursor: hand;
-}
-
-.ui-buttonset .ui-button {
-	margin-right: -0.1em !important;
-}
-
-.paging_full_numbers {
-	width: 350px !important;
-}
-
-.ui-toolbar {
-	padding: 5px;
-}
-
-.dataTables_paginate {
-	width: auto;
-}
-
-.dataTables_info {
-	padding-top: 3px;
-}
-
-table.display thead th {
-	padding: 3px 0px 3px 10px;
-	cursor: pointer;
-	* cursor: hand;
-}
-
-div.dataTables_wrapper .ui-widget-header {
-	font-weight: normal;
-}
-
-
-/*
- * Sort arrow icon positioning
- */
-table.display thead th div.DataTables_sort_wrapper {
-	position: relative;
-	padding-right: 20px;
-	padding-right: 20px;
-}
-
-table.display thead th div.DataTables_sort_wrapper span {
-	position: absolute;
-	top: 50%;
-	margin-top: -8px;
-	right: 0;
-}
-
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- * Everything below this line is the same as demo_table.css. This file is
- * required for 'cleanliness' of the markup
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * DataTables features
- */
-
-.dataTables_wrapper {
-	position: relative;
-	min-height: 302px;
-	_height: 302px;
-	clear: both;
-}
-
-.dataTables_processing {
-	position: absolute;
-	top: 0px;
-	left: 50%;
-	width: 250px;
-	margin-left: -125px;
-	border: 1px solid #ddd;
-	text-align: center;
-	color: #999;
-	font-size: 11px;
-	padding: 2px 0;
-}
-
-.dataTables_length {
-	width: 40%;
-	float: left;
-}
-
-.dataTables_filter {
-	width: 50%;
-	float: right;
-	text-align: right;
-}
-
-.dataTables_info {
-	width: 50%;
-	float: left;
-}
-
-.dataTables_paginate {
-	float: right;
-	text-align: right;
-}
-
-/* Pagination nested */
-.paginate_disabled_previous, .paginate_enabled_previous, .paginate_disabled_next, .paginate_enabled_next {
-	height: 19px;
-	width: 19px;
-	margin-left: 3px;
-	float: left;
-}
-
-.paginate_disabled_previous {
-	background-image: url('../images/back_disabled.jpg');
-}
-
-.paginate_enabled_previous {
-	background-image: url('../images/back_enabled.jpg');
-}
-
-.paginate_disabled_next {
-	background-image: url('../images/forward_disabled.jpg');
-}
-
-.paginate_enabled_next {
-	background-image: url('../images/forward_enabled.jpg');
-}
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * DataTables display
- */
-table.display {
-	margin: 0 auto;
-	width: 100%;
-	clear: both;
-	border-collapse: collapse;
-}
-
-table.display tfoot th {
-	padding: 3px 0px 3px 10px;
-	font-weight: bold;
-	font-weight: normal;
-}
-
-table.display tr.heading2 td {
-	border-bottom: 1px solid #aaa;
-}
-
-table.display td {
-	padding: 3px 10px;
-}
-
-table.display td.center {
-	text-align: center;
-}
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * DataTables sorting
- */
-
-.sorting_asc {
-	background: url('../images/sort_asc.jpg') no-repeat center right;
-}
-
-.sorting_desc {
-	background: url('../images/sort_desc.jpg') no-repeat center right;
-}
-
-.sorting {
-	background: url('../images/sort_both.jpg') no-repeat center right;
-}
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Misc
- */
-.dataTables_scroll {
-	clear: both;
-}
-
-.top, .bottom {
-	padding: 15px;
-	background-color: #F5F5F5;
-	border: 1px solid #CCCCCC;
-}
-
-.top .dataTables_info {
-	float: none;
-}
-
-.clear {
-	clear: both;
-}
-
-.dataTables_empty {
-	text-align: center;
-}
-
-tfoot input {
-	margin: 0.5em 0;
-	width: 100%;
-	color: #444;
-}
-
-tfoot input.search_init {
-	color: #999;
-}
-
-td.group {
-	background-color: #d1cfd0;
-	border-bottom: 2px solid #A19B9E;
-	border-top: 2px solid #A19B9E;
-}
-
-td.details {
-	background-color: #d1cfd0;
-	border: 2px solid #A19B9E;
-}
-
-
-.example_alt_pagination div.dataTables_info {
-	width: 40%;
-}
-
-.paging_full_numbers span.paginate_button,
- 	.paging_full_numbers span.paginate_active {
-	border: 1px solid #aaa;
-	-webkit-border-radius: 5px;
-	-moz-border-radius: 5px;
-	padding: 2px 5px;
-	margin: 0 3px;
-	cursor: pointer;
-	*cursor: hand;
-}
-
-.paging_full_numbers span.paginate_button {
-	background-color: #ddd;
-}
-
-.paging_full_numbers span.paginate_button:hover {
-	background-color: #ccc;
-}
-
-.paging_full_numbers span.paginate_active {
-	background-color: #99B3FF;
-}
-
-table.display tr.even.row_selected td {
-	background-color: #B0BED9;
-}
-
-table.display tr.odd.row_selected td {
-	background-color: #9FAFD1;
-}
-
-/* Striping */
-tr.odd { background: rgba(255, 255, 255, 0.1); }
-tr.even { background: rgba(0, 0, 255, 0.05); }
-
-
-/*
- * Sorting classes for columns
- */
-tr.odd td.sorting_1 { background: rgba(0, 0, 0, 0.03); }
-tr.odd td.sorting_2 { background: rgba(0, 0, 0, 0.02); } 
-tr.odd td.sorting_3 { background: rgba(0, 0, 0, 0.02); }
-tr.even td.sorting_1 { background: rgba(0, 0, 0, 0.08); }
-tr.even td.sorting_2 { background: rgba(0, 0, 0, 0.06); }
-tr.even td.sorting_3 { background: rgba(0, 0, 0, 0.06); }
-
-.css_left { position: relative; float: left; }
-.css_right { position: relative; float: right; }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/back_disabled.jpg
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/back_disabled.jpg b/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/back_disabled.jpg
deleted file mode 100644
index 1e73a54..0000000
Binary files a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/back_disabled.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/back_enabled.jpg
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/back_enabled.jpg b/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/back_enabled.jpg
deleted file mode 100644
index a6d764c..0000000
Binary files a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/back_enabled.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/favicon.ico
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/favicon.ico b/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/favicon.ico
deleted file mode 100644
index 6eeaa2a..0000000
Binary files a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/favicon.ico and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/forward_disabled.jpg
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/forward_disabled.jpg b/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/forward_disabled.jpg
deleted file mode 100644
index 28a9dc5..0000000
Binary files a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/forward_disabled.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/forward_enabled.jpg
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/forward_enabled.jpg b/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/forward_enabled.jpg
deleted file mode 100644
index 598c075..0000000
Binary files a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/forward_enabled.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_asc.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_asc.png b/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_asc.png
deleted file mode 100644
index a56d0e2..0000000
Binary files a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_asc.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_asc_disabled.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_asc_disabled.png b/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_asc_disabled.png
deleted file mode 100644
index b7e621e..0000000
Binary files a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_asc_disabled.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_both.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_both.png b/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_both.png
deleted file mode 100644
index 839ac4b..0000000
Binary files a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_both.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_desc.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_desc.png b/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_desc.png
deleted file mode 100644
index 90b2951..0000000
Binary files a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_desc.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_desc_disabled.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_desc_disabled.png b/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_desc_disabled.png
deleted file mode 100644
index 2409653..0000000
Binary files a/slider-core/src/main/resources/webapps/static/dt-1.9.4/images/sort_desc_disabled.png and /dev/null differ


[12/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeInterruptedException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeInterruptedException.java b/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeInterruptedException.java
deleted file mode 100644
index 5a02f46..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeInterruptedException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.servicemonitor;
-
-/**
- * This exception is raised when the probe loop detects that it has been requested to stop
- *
- */
-public class ProbeInterruptedException extends Exception {
-
-  public ProbeInterruptedException() {
-    super("Probe Interrupted");
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbePhase.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbePhase.java b/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbePhase.java
deleted file mode 100644
index d87c81b..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbePhase.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.servicemonitor;
-
-/**
- * Probe phases. The names are for strings; the index is the order in which things happen;
- * -any state can got to terminating directly.
- */
-public enum ProbePhase {
-  INIT("Initializing", 0),
-  DEPENDENCY_CHECKING("Dependencies", 1),
-  BOOTSTRAPPING("Bootstrapping", 2),
-  LIVE("Live", 3),
-  TERMINATING("Terminating", 4);
-
-  private final String name;
-  private final int index;
-
-  ProbePhase(String name, int index) {
-    this.name = name;
-    this.index = index;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public int getIndex() {
-    return index;
-  }
-
-  /**
-   * How many phases are there?
-   */
-  public static final int PHASE_COUNT = TERMINATING.index + 1;
-
-  @Override
-  public String toString() {
-    return name;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeReportHandler.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeReportHandler.java b/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeReportHandler.java
deleted file mode 100644
index 36c20c8..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeReportHandler.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.servicemonitor;
-
-/**
- * This interface is for use by the Poll Workers to send events to the reporters.
- *
- * It is up the reporters what to do with the specific events.
- */
-public interface ProbeReportHandler {
-
-  /**
-   * The probe process has changed state. 
-   * @param probePhase the new process phrase
-   */
-  void probeProcessStateChange(ProbePhase probePhase);
-
-  /**
-   * Report a probe outcome
-   * @param phase the current phase of probing
-   * @param status the probe status
-   */
-  void probeResult(ProbePhase phase, ProbeStatus status);
-
-  /**
-   * A probe has failed
-   */
-  void probeFailure(ProbeFailedException exception);
-
-  /**
-   * A probe has just booted
-   * @param status probe status
-   */
-  void probeBooted(ProbeStatus status);
-
-  boolean commence(String name, String description);
-
-  void unregister();
-
-  /**
-   * A heartbeat event should be raised
-   * @param status the probe status
-   */
-  void heartbeat(ProbeStatus status);
-
-  /**
-   * A probe has timed out
-   * @param currentPhase the current execution phase
-   * @param probe the probe that timed out
-   * @param lastStatus the last status that was successfully received -which is implicitly 
-   * not the status of the timed out probe
-   * @param currentTime the current time
-   */
-  void probeTimedOut(ProbePhase currentPhase,
-                     Probe probe,
-                     ProbeStatus lastStatus,
-                     long currentTime);
-
-  /**
-   * Event to say that the live probe cycle completed so the entire
-   * system can be considered functional.
-   */
-  void liveProbeCycleCompleted();
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeStatus.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeStatus.java b/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeStatus.java
deleted file mode 100644
index 653f479..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeStatus.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.servicemonitor;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * Status message of a probe. This is designed to be sent over the wire, though the exception
- * Had better be unserializable at the far end if that is to work.
- */
-public final class ProbeStatus implements Serializable {
-
-  private long timestamp;
-  private String timestampText;
-  private boolean success;
-  private boolean realOutcome;
-  private String message;
-  private Throwable thrown;
-  private transient Probe originator;
-  private ProbePhase probePhase;
-
-  public ProbeStatus() {
-  }
-
-  public ProbeStatus(long timestamp, String message, Throwable thrown) {
-    this.success = false;
-    this.message = message;
-    this.thrown = thrown;
-    setTimestamp(timestamp);
-  }
-
-  public ProbeStatus(long timestamp, String message) {
-    this.success = true;
-    setTimestamp(timestamp);
-    this.message = message;
-    this.thrown = null;
-  }
-
-  public long getTimestamp() {
-    return timestamp;
-  }
-
-  public void setTimestamp(long timestamp) {
-    this.timestamp = timestamp;
-    timestampText = new Date(timestamp).toString();
-  }
-
-  public boolean isSuccess() {
-    return success;
-  }
-
-  /**
-   * Set both the success and the real outcome bits to the same value
-   * @param success the new value
-   */
-  public void setSuccess(boolean success) {
-    this.success = success;
-    realOutcome = success;
-  }
-
-  public String getTimestampText() {
-    return timestampText;
-  }
-
-  public boolean getRealOutcome() {
-    return realOutcome;
-  }
-
-  public String getMessage() {
-    return message;
-  }
-
-  public void setMessage(String message) {
-    this.message = message;
-  }
-
-  public Throwable getThrown() {
-    return thrown;
-  }
-
-  public void setThrown(Throwable thrown) {
-    this.thrown = thrown;
-  }
-
-  public ProbePhase getProbePhase() {
-    return probePhase;
-  }
-
-  public void setProbePhase(ProbePhase probePhase) {
-    this.probePhase = probePhase;
-  }
-
-  /**
-   * Get the probe that generated this result. May be null
-   * @return a possibly null reference to a probe
-   */
-  public Probe getOriginator() {
-    return originator;
-  }
-
-  /**
-   * The probe has succeeded -capture the current timestamp, set
-   * success to true, and record any other data needed.
-   * @param probe probe
-   */
-  public void succeed(Probe probe) {
-    finish(probe, true, probe.getName(), null);
-  }
-
-  /**
-   * A probe has failed either because the test returned false, or an exception
-   * was thrown. The {@link #success} field is set to false, any exception 
-   * thrown is recorded.
-   * @param probe probe that failed
-   * @param thrown an exception that was thrown.
-   */
-  public void fail(Probe probe, Throwable thrown) {
-    finish(probe, false, "Failure in " + probe, thrown);
-  }
-
-  public void finish(Probe probe, boolean succeeded, String text, Throwable thrown) {
-    setTimestamp(System.currentTimeMillis());
-    setSuccess(succeeded);
-    originator = probe;
-    message = text;
-    this.thrown = thrown;
-  }
-
-  @Override
-  public String toString() {
-    LogEntryBuilder builder = new LogEntryBuilder("Probe Status");
-    builder.elt("time", timestampText)
-           .elt("phase", probePhase)
-           .elt("outcome", (success ? "success" : "failure"));
-
-    if (success != realOutcome) {
-      builder.elt("originaloutcome", (realOutcome ? "success" : "failure"));
-    }
-    builder.elt("message", message);
-    if (thrown != null) {
-      builder.elt("exception", thrown);
-    }
-
-    return builder.toString();
-  }
-
-  public boolean inPhase(ProbePhase phase) {
-    return getProbePhase().equals(phase);
-  }
-
-  /**
-   * Flip the success bit on while the real outcome bit is kept false
-   */
-  public void markAsSuccessful() {
-    success = true;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeWorker.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeWorker.java b/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeWorker.java
deleted file mode 100644
index f64ec8d..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeWorker.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.servicemonitor;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This is the entry point to do work. A list of probes is taken in, in order of
- * booting. Once live they go to the live probes list.
- *
- * The dependency probes are a set of probes for dependent services, all of which
- * must be live before boot probes commence.
- *
- * The boot probes are executed and are allowed to fail; failure is interpreted as "not yet live"
- *
- * Once all boot probes are live, the live list is used for probes; these must not fail.
- *
- * There is no timeout on dependency probe bootstrap time, because of the notion that
- * restarting this service will have no effect on the dependencies. 
- */
-
-public class ProbeWorker implements Runnable {
-  protected static final Logger log = LoggerFactory.getLogger(ProbeWorker.class);
-
-  public static final String FAILED_TO_BOOT = "Monitored service failed to bootstrap after ";
-  public static final String FAILURE_OF_A_LIVE_PROBE_DURING_BOOTSTRAPPING = "Failure of a live probe during bootstrapping";
-  private final List<Probe> monitorProbes;
-  private final List<Probe> dependencyProbes;
-  public final int interval;
-  protected volatile ProbeStatus lastStatus;
-  protected volatile ProbeStatus lastFailingBootstrapProbe;
-  protected volatile Probe currentProbe;
-  private volatile boolean mustExit;
-  private final int bootstrapTimeout;
-  private long bootstrapEndtime;
-
-  private ProbeReportHandler reportHandler;
-  private volatile ProbePhase probePhase = ProbePhase.INIT;
-
-  /**
-   * Create a probe worker
-   * @param monitorProbes list of probes that must boot and then go live -after which
-   * they must stay live.
-   * @param dependencyProbes the list of dependency probes that must all succeed before
-   * any attempt to probe the direct probe list is performed. Once the 
-   * dependency phase has completed, these probes are never checked again.
-   * @param interval probe interval in milliseconds.
-   * @param bootstrapTimeout timeout for bootstrap in milliseconds
-   */
-  public ProbeWorker(List<Probe> monitorProbes, List<Probe> dependencyProbes, int interval, int bootstrapTimeout) {
-    this.monitorProbes = monitorProbes;
-    this.dependencyProbes = dependencyProbes != null ? dependencyProbes : new ArrayList<Probe>(0);
-    this.interval = interval;
-    lastStatus = new ProbeStatus(now(),
-                                 "Initial status");
-    lastStatus.setProbePhase(ProbePhase.INIT);
-    this.bootstrapTimeout = bootstrapTimeout;
-  }
-
-  public void init() throws IOException {
-    for (Probe probe : monitorProbes) {
-      probe.init();
-    }
-    for (Probe probe : dependencyProbes) {
-      probe.init();
-    }
-  }
-
-  public void setReportHandler(ProbeReportHandler reportHandler) {
-    this.reportHandler = reportHandler;
-  }
-
-  public void setMustExit() {
-    this.mustExit = true;
-  }
-
-  public ProbeStatus getLastStatus() {
-    return lastStatus;
-  }
-
-  public synchronized Probe getCurrentProbe() {
-    return currentProbe;
-  }
-
-  public ProbePhase getProbePhase() {
-    return probePhase;
-  }
-
-  /**
-   * Enter the new process state, and report it to the report handler.
-   * This is synchronized just to make sure there isn't more than one
-   * invocation at the same time.
-   * @param status the new process status
-   */
-  private synchronized void enterProbePhase(ProbePhase status) {
-    this.probePhase = status;
-    if (reportHandler != null) {
-      reportHandler.probeProcessStateChange(status);
-    }
-  }
-
-  /**
-   * Report the probe status to the listener -setting the probe phase field
-   * before doing so.
-   * The value is also stored in the {@link #lastStatus} field
-   * @param status the new status
-   */
-  private void reportProbeStatus(ProbeStatus status) {
-    ProbePhase phase = getProbePhase();
-    status.setProbePhase(phase);
-    lastStatus = status;
-    reportHandler.probeResult(phase, status);
-  }
-
-  /**
-   * Ping one probe. Logs the operation at debug level; sets the field <code>currentProbe</code>
-   * to the probe for the duration of the operation -this is used when identifying the
-   * cause of a hung reporting loop
-   * @param probe probe to ping
-   * @param live flag to indicate whether or not the operation is live or bootstrapping
-   * @return the status of the ping
-   * @throws ProbeInterruptedException if the probe has been told to exit
-   */
-  private ProbeStatus ping(Probe probe, boolean live) throws ProbeInterruptedException {
-    if (log.isDebugEnabled()) {
-      log.debug("Executing " + probe);
-    }
-    checkForExitRequest();
-    currentProbe = probe;
-    try {
-      return probe.ping(live);
-    } finally {
-      currentProbe = null;
-    }
-  }
-
-  /**
-   * Check for an exit request -and convert it to an exception if made
-   * @throws ProbeInterruptedException iff {@link #mustExit} is true
-   */
-  private void checkForExitRequest() throws ProbeInterruptedException {
-    if (mustExit) {
-      throw new ProbeInterruptedException();
-    }
-  }
-
-  /**
-   * Check the dependencies. 
-   * The moment a failing test is reached the call returns without
-   * any reporting.
-   *
-   * All successful probes are reported, so as to keep the heartbeats happy.
-   *
-   * @return the status of the last dependency check. If this is a success
-   * them every probe passed.
-   */
-  private ProbeStatus checkDependencyProbes() throws ProbeInterruptedException {
-    ProbeStatus status = null;
-    for (Probe dependency : dependencyProbes) {
-      //ping them, making clear they are not to run any bootstrap logic
-      status = ping(dependency, true);
-
-      if (!status.isSuccess()) {
-        //the first failure means the rest of the list can be skipped
-        break;
-      }
-      reportProbeStatus(status);
-    }
-    //return the last status
-    return status;
-  }
-
-  /**
-   * Run through all the dependency probes and report their outcomes successes (even if they fail)
-   * @return true iff all the probes have succeeded.
-   * @throws ProbeInterruptedException if the process was interrupted.
-   */
-  public boolean checkAndReportDependencyProbes() throws ProbeInterruptedException {
-    ProbeStatus status;
-    status = checkDependencyProbes();
-    if (status != null && !status.isSuccess()) {
-      //during dependency checking, a failure is still reported as a success
-      status.markAsSuccessful();
-      reportProbeStatus(status);
-      //then return without checking anything else
-      return false;
-    }
-    //all dependencies are done.
-    return true;
-  }
-
-  /**
-   * Begin bootstrapping by telling each probe that they have started.
-   * This sets the timeouts up, as well as permits any other set-up actions
-   * to begin.
-   */
-  private void beginBootstrapProbes() {
-    synchronized (this) {
-      bootstrapEndtime = now() + bootstrapTimeout;
-    }
-    for (Probe probe : monitorProbes) {
-      probe.beginBootstrap();
-    }
-  }
-
-  private long now() {
-    return System.currentTimeMillis();
-  }
-
-
-  /**
-   * Check the bootstrap probe list. All successful probes get reported.
-   * The first unsuccessful probe will be returned and not reported (left for policy upstream).
-   * If the failing probe has timed out, that is turned into a {@link ProbeFailedException}
-   * @return the last (unsuccessful) probe, or null if they all succeeded
-   * @throws ProbeInterruptedException interrupts
-   * @throws ProbeFailedException on a boot timeout
-   */
-  private boolean checkBootstrapProbes() throws ProbeInterruptedException, ProbeFailedException {
-    verifyBootstrapHasNotTimedOut();
-
-    boolean probeFailed = false;
-    //now run through all the bootstrap probes
-    for (Probe probe : monitorProbes) {
-      //ping them
-      ProbeStatus status = ping(probe, false);
-      if (!status.isSuccess()) {
-        probeFailed = true;
-        lastFailingBootstrapProbe = status;
-        probe.failureCount++;
-        if (log.isDebugEnabled()) {
-          log.debug("Booting probe failed: " + status);
-        }
-        //at this point check to see if the timeout has occurred -and if so, force in the last probe status.
-
-        //this is a failure but not a timeout
-        //during boot, a failure of a probe that hasn't booted is still reported as a success
-        if (!probe.isBooted()) {
-          //so the success bit is flipped
-          status.markAsSuccessful();
-          reportProbeStatus(status);
-        } else {
-          //the probe had booted but then it switched to failing
-
-          //update the status unedited
-          reportProbeStatus(status);
-          //then fail
-          throw raiseProbeFailure(status, FAILURE_OF_A_LIVE_PROBE_DURING_BOOTSTRAPPING);
-        }
-      } else {
-        //this probe is working
-        if (!probe.isBooted()) {
-          //if it is new, mark it as live
-          if (log.isDebugEnabled()) {
-            log.debug("Booting probe is now live: " + probe);
-          }
-          probe.endBootstrap();
-          //tell the report handler that another probe has booted
-          reportHandler.probeBooted(status);
-        }
-        //push out its status
-        reportProbeStatus(status);
-        probe.successCount++;
-      }
-    }
-    return !probeFailed;
-  }
-
-
-  public int getBootstrapTimeout() {
-    return bootstrapTimeout;
-  }
-
-  /**
-   * This checks that bootstrap operations have not timed out
-   * @throws ProbeFailedException if the bootstrap has failed
-   */
-  public void verifyBootstrapHasNotTimedOut() throws ProbeFailedException {
-    //first step -look for a timeout
-    if (isBootstrapTimeExceeded()) {
-      String text = FAILED_TO_BOOT
-                    + MonitorUtils.millisToHumanTime(bootstrapTimeout);
-
-      ProbeStatus status;
-      if (lastFailingBootstrapProbe != null) {
-        status = lastFailingBootstrapProbe;
-        status.setSuccess(false);
-      } else {
-        status = new ProbeStatus();
-        status.finish(null, false, text, null);
-      }
-
-      throw raiseProbeFailure(status,
-                              text);
-    }
-  }
-
-  /**
-   * predicate that gets current time and checks for its time being exceeded.
-   * @return true iff the current time is > the end time
-   */
-  public synchronized boolean isBootstrapTimeExceeded() {
-    return now() > bootstrapEndtime;
-  }
-
-  /**
-   * run through all the bootstrap probes and see if they are live.
-   * @return true iff all boot probes succeeded
-   * @throws ProbeInterruptedException the probe interruption flags
-   * @throws ProbeFailedException if a probe failed.
-   */
-  public boolean checkAndReportBootstrapProbes() throws ProbeInterruptedException,
-                                                        ProbeFailedException {
-    if (bootstrapTimeout <= 0) {
-      //there is no period of grace for bootstrapping probes, so return true saying
-      //this phase is complete
-      return true;
-    }
-    //now the bootstrapping probes
-    return checkBootstrapProbes();
-  }
-
-
-  /**
-   * run through all the live probes, pinging and reporting them.
-   * A single probe failure is turned into an exception
-   * @throws ProbeFailedException a probe failed
-   * @throws ProbeInterruptedException the probe process was explicitly interrupted
-   */
-  protected void checkAndReportLiveProbes() throws ProbeFailedException, ProbeInterruptedException {
-    ProbeStatus status = null;
-    //go through the live list
-    if (log.isDebugEnabled()) {
-      log.debug("Checking live probes");
-    }
-    for (Probe probe : monitorProbes) {
-      status = ping(probe, true);
-      reportProbeStatus(status);
-      if (!status.isSuccess()) {
-        throw raiseProbeFailure(status, "Failure of probe in \"live\" monitor");
-      }
-      probe.successCount++;
-    }
-    //here all is well, so notify the reporter
-    reportHandler.liveProbeCycleCompleted();
-  }
-
-  /**
-   * Run the set of probes relevant for this phase of the probe lifecycle.
-   * @throws ProbeFailedException a probe failed
-   * @throws ProbeInterruptedException the probe process was explicitly interrupted
-   */
-  protected void executeProbePhases() throws ProbeFailedException, ProbeInterruptedException {
-    switch (probePhase) {
-      case INIT:
-        enterProbePhase(ProbePhase.DEPENDENCY_CHECKING);
-        //fall through straight into the dependency check
-      case DEPENDENCY_CHECKING:
-        if (checkAndReportDependencyProbes()) {
-          enterProbePhase(ProbePhase.BOOTSTRAPPING);
-          beginBootstrapProbes();
-        }
-        break;
-      case BOOTSTRAPPING:
-        if (checkAndReportBootstrapProbes()) {
-          enterProbePhase(ProbePhase.LIVE);
-        }
-        break;
-      case LIVE:
-        checkAndReportLiveProbes();
-        break;
-
-      case TERMINATING:
-      default:
-        //do nothing.
-        break;
-    }
-  }
-
-
-  /**
-   * Raise a probe failure; injecting the phase into the status result first
-   *
-   * @param status ping result
-   * @param text optional text -null or "" means "none"
-   * @return an exception ready to throw
-   */
-  private ProbeFailedException raiseProbeFailure(ProbeStatus status, String text) {
-    status.setProbePhase(probePhase);
-    log.info("Probe failed: " + status);
-    return new ProbeFailedException(text, status);
-  }
-
-  @Override
-  public void run() {
-    int size = monitorProbes.size();
-    log.info("Probe Worker Starting; " + size + " probe" + MonitorUtils.toPlural(size) + ":");
-    enterProbePhase(ProbePhase.DEPENDENCY_CHECKING);
-    for (Probe probe : monitorProbes) {
-      log.info(probe.getName());
-    }
-    while (!mustExit) {
-      try {
-        Thread.sleep(interval);
-        executeProbePhases();
-      } catch (ProbeFailedException e) {
-        //relay to the inner loop handler
-        probeFailed(e);
-      } catch (InterruptedException interrupted) {
-        break;
-      } catch (ProbeInterruptedException e) {
-        //exit raised.
-        //this will be true, just making extra-sure
-        break;
-      }
-    }
-    log.info("Probe Worker Exiting");
-    enterProbePhase(ProbePhase.TERMINATING);
-  }
-
-
-  protected void probeFailed(ProbeFailedException e) {
-    reportHandler.probeFailure(e);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ReportingLoop.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ReportingLoop.java b/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ReportingLoop.java
deleted file mode 100644
index 096838d..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/ReportingLoop.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.servicemonitor;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.List;
-
-/**
- * This is the monitor service
- */
-public final class ReportingLoop implements Runnable, ProbeReportHandler, MonitorKeys, Closeable {
-  protected static final Logger log = LoggerFactory.getLogger(ReportingLoop.class);
-  private final ProbeWorker worker;
-  private final Thread workerThread;
-  private final int reportInterval;
-  private final int probeTimeout;
-  private final int bootstrapTimeout;
-  private ProbeReportHandler reporter;
-  private final String name;
-  private volatile boolean mustExit;
-
-  public ReportingLoop(String name,
-                       ProbeReportHandler reporter,
-                       List<Probe> probes,
-                       List<Probe> dependencyProbes,
-                       int probeInterval,
-                       int reportInterval,
-                       int probeTimeout,
-                       int bootstrapTimeout) throws IOException {
-    this(name,
-         reporter,
-         new ProbeWorker(probes, dependencyProbes, probeInterval, bootstrapTimeout),
-         reportInterval,
-         probeTimeout);
-  }
-
-  /**
-   * Create a new reporting loop -and bond the worker's ProbeReportHandler
-   * to us
-   * @param name
-   * @param reporter
-   * @param worker
-   * @param reportInterval
-   * @param probeTimeout
-   */
-  public ReportingLoop(String name,
-                       ProbeReportHandler reporter,
-                       ProbeWorker worker,
-                       int reportInterval,
-                       int probeTimeout) throws IOException {
-    this.name = name;
-    this.reporter = reporter;
-    this.reportInterval = reportInterval;
-    this.probeTimeout = probeTimeout;
-    this.worker = worker;
-    this.bootstrapTimeout = worker.getBootstrapTimeout();
-    worker.setReportHandler(this);
-    workerThread = new Thread(worker, "probe thread - " + name);
-    worker.init();
-  }
-  
-  public int getBootstrapTimeout() {
-    return bootstrapTimeout;
-  }
-
-  public ReportingLoop withReporter(ProbeReportHandler reporter) {
-    assert this.reporter == null : "attempting to reassign reporter ";
-    assert reporter != null : "new reporter is null";
-    this.reporter = reporter;
-    return this;
-  }
-
-  /**
-   * Start the monitoring.
-   *
-   * @return false if the monitoring did not start and that the worker threads
-   *         should be run up.
-   */
-  public boolean startReporting() {
-    String description = "Service Monitor for " + name + ", probe-interval= "
-                         + MonitorUtils.millisToHumanTime(worker.interval)
-                         + ", report-interval=" + MonitorUtils.millisToHumanTime(reportInterval)
-                         + ", probe-timeout=" + timeoutToStr(probeTimeout)
-                         + ", bootstrap-timeout=" + timeoutToStr(bootstrapTimeout);
-    log.info("Starting reporting"
-             + " to " + reporter
-             + description);
-    return reporter.commence(name, description);
-  }
-
-  private String timeoutToStr(int timeout) {
-    return timeout >= 0 ? MonitorUtils.millisToHumanTime(timeout) : "not set";
-  }
-
-  private void startWorker() {
-    log.info("Starting reporting worker thread ");
-    workerThread.setDaemon(true);
-    workerThread.start();
-  }
-
-
-  /**
-   * This exits the process cleanly
-   */
-  @Override
-  public void close() {
-    log.info("Stopping reporting");
-    mustExit = true;
-    if (worker != null) {
-      worker.setMustExit();
-      workerThread.interrupt();
-    }
-    if (reporter != null) {
-      reporter.unregister();
-    }
-  }
-
-  @Override
-  public void probeFailure(ProbeFailedException exception) {
-    reporter.probeFailure(exception);
-  }
-
-  @Override
-  public void probeProcessStateChange(ProbePhase probePhase) {
-    reporter.probeProcessStateChange(probePhase);
-  }
-
-  @Override
-  public void probeBooted(ProbeStatus status) {
-    reporter.probeBooted(status);
-  }
-
-  private long now() {
-    return System.currentTimeMillis();
-  }
-
-  @Override
-  public void probeResult(ProbePhase phase, ProbeStatus status) {
-    reporter.probeResult(phase, status);
-  }
-
-  @Override
-  public boolean commence(String n, String description) {
-    return true;
-  }
-
-  @Override
-  public void unregister() {
-  }
-
-  @Override
-  public void heartbeat(ProbeStatus status) {
-  }
-
-  @Override
-  public void probeTimedOut(ProbePhase currentPhase, Probe probe, ProbeStatus lastStatus,
-      long currentTime) {
-  }
-
-  @Override
-  public void liveProbeCycleCompleted() {
-    //delegate to the reporter
-    reporter.liveProbeCycleCompleted();
-  }
-
-  /**
-   * The reporting loop
-   */
-  void reportingLoop() {
-
-    while (!mustExit) {
-      try {
-        ProbeStatus workerStatus = worker.getLastStatus();
-        long now = now();
-        long lastStatusIssued = workerStatus.getTimestamp();
-        long timeSinceLastStatusIssued = now - lastStatusIssued;
-        //two actions can occur here: a heartbeat is issued or a timeout reported. 
-        //this flag decides which
-        boolean heartbeat;
-
-        //based on phase, decide whether to heartbeat or timeout
-        ProbePhase probePhase = worker.getProbePhase();
-        switch (probePhase) {
-          case DEPENDENCY_CHECKING:
-            //no timeouts in dependency phase
-            heartbeat = true;
-            break;
-
-          case BOOTSTRAPPING:
-            //the timeout here is fairly straightforward: heartbeats are
-            //raised while the worker hasn't timed out
-            heartbeat = bootstrapTimeout < 0 || timeSinceLastStatusIssued < bootstrapTimeout;
-
-            break;
-
-          case LIVE:
-            //use the probe timeout interval between the current time
-            //and the time the last status event was received.
-            heartbeat = timeSinceLastStatusIssued < probeTimeout;
-            break;
-
-          case INIT:
-          case TERMINATING:
-          default:
-            //send a heartbeat, because this isn't the time to be failing
-            heartbeat = true;
-        }
-        if (heartbeat) {
-          //a heartbeat is sent to the reporter
-          reporter.heartbeat(workerStatus);
-        } else {
-          //no response from the worker -it is hung.
-          reporter.probeTimedOut(probePhase,
-                                 worker.getCurrentProbe(),
-                                 workerStatus,
-                                 now
-                                );
-        }
-
-        //now sleep
-        Thread.sleep(reportInterval);
-
-      } catch (InterruptedException e) {
-        //interrupted -always exit the loop.
-        break;
-      }
-    }
-    //this point is reached if and only if a clean exit was requested or something failed.
-  }
-
-  /**
-   * This can be run in a separate thread, or it can be run directly from the caller.
-   * Test runs do the latter, HAM runs multiple reporting threads.
-   */
-  @Override
-  public void run() {
-    try {
-      startWorker();
-      reportingLoop();
-    } catch (RuntimeException e) {
-      log.warn("Failure in the reporting loop: " + e, e);
-      //rethrow so that inline code can pick it up (e.g. test runs)
-      throw e;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/servicemonitor/YarnApplicationProbe.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/YarnApplicationProbe.java b/slider-core/src/main/java/org/apache/slider/server/servicemonitor/YarnApplicationProbe.java
deleted file mode 100644
index adf613c..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/servicemonitor/YarnApplicationProbe.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.servicemonitor;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.slider.client.SliderYarnClientImpl;
-import org.apache.slider.core.exceptions.UnknownApplicationInstanceException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * Probe for YARN application
- */
-public class YarnApplicationProbe extends Probe {
-  protected static final Logger log = LoggerFactory.getLogger(
-    YarnApplicationProbe.class);
-
-  /**
-   * Yarn client service
-   */
-  private SliderYarnClientImpl yarnClient;
-  private final String clustername;
-  private final String username;
-
-  public YarnApplicationProbe(String clustername,
-                              SliderYarnClientImpl yarnClient,
-                              String name,
-                              Configuration conf, String username)
-      throws IOException {
-    super("Port probe " + name + " " + clustername,
-          conf);
-    this.clustername = clustername;
-    this.yarnClient = yarnClient;
-    this.username = username;
-  }
-
-
-  @Override
-  public void init() throws IOException {
-   
-    log.info("Checking " + clustername );
-  }
-
-  /**
-   * Try to connect to the (host,port); a failure to connect within
-   * the specified timeout is a failure
-   * @param livePing is the ping live: true for live; false for boot time
-   * @return the outcome
-   */
-  @Override
-  public ProbeStatus ping(boolean livePing) {
-    
-    ProbeStatus status = new ProbeStatus();
-    try {
-
-      List<ApplicationReport> instances =
-        yarnClient.listDeployedInstances(username);
-      ApplicationReport instance =
-        yarnClient.findClusterInInstanceList(instances, clustername);
-      if (null == instance) {
-        throw UnknownApplicationInstanceException.unknownInstance(clustername);
-      }
-
-      status.succeed(this);
-    } catch (Exception e) {
-      status.fail(this, e);
-    }
-    return status;
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/security/AbstractSecurityStoreGenerator.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/security/AbstractSecurityStoreGenerator.java b/slider-core/src/main/java/org/apache/slider/server/services/security/AbstractSecurityStoreGenerator.java
deleted file mode 100644
index 11d3aa1..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/security/AbstractSecurityStoreGenerator.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.services.security;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.security.alias.CredentialProvider;
-import org.apache.hadoop.security.alias.CredentialProviderFactory;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.SliderException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-
-/**
- *
- */
-public abstract class AbstractSecurityStoreGenerator implements
-    SecurityStoreGenerator {
-  private static final Logger LOG =
-      LoggerFactory.getLogger(AbstractSecurityStoreGenerator.class);
-
-  protected CertificateManager certificateMgr;
-
-  public AbstractSecurityStoreGenerator(CertificateManager certificateMgr) {
-    this.certificateMgr = certificateMgr;
-  }
-
-  protected String getStorePassword(Map<String, List<String>> credentials,
-                                    MapOperations compOps, String role)
-      throws SliderException, IOException {
-    String password = getPassword(compOps);
-    if (password == null) {
-      // need to leverage credential provider
-      String alias = getAlias(compOps);
-      LOG.debug("Alias {} found for role {}", alias, role);
-      if (alias == null) {
-        throw new SliderException("No store password or credential provider "
-                                  + "alias found");
-      }
-      if (credentials.isEmpty()) {
-        LOG.info("Credentials can not be retrieved for store generation since "
-                 + "no CP paths are configured");
-      }
-      synchronized (this) {
-        for (Map.Entry<String, List<String>> cred : credentials.entrySet()) {
-          String provider = cred.getKey();
-          Configuration c = new Configuration();
-          c.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, provider);
-          LOG.debug("Configured provider {}", provider);
-          CredentialProvider cp =
-              CredentialProviderFactory.getProviders(c).get(0);
-          LOG.debug("Aliases: {}", cp.getAliases());
-          char[] credential = c.getPassword(alias);
-          if (credential != null) {
-            LOG.info("Credential found for role {}", role);
-            return String.valueOf(credential);
-          }
-        }
-      }
-
-      if (password == null) {
-        LOG.info("No store credential found for alias {}.  "
-                 + "Generation of store for {} is not possible.", alias, role);
-
-      }
-    }
-
-    return password;
-
-  }
-
-  @Override
-  public boolean isStoreRequested(MapOperations compOps) {
-    return compOps.getOptionBool(SliderKeys.COMP_STORES_REQUIRED_KEY, false);
-  }
-
-  abstract String getPassword(MapOperations compOps);
-
-  abstract String getAlias(MapOperations compOps);
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/security/CertificateManager.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/security/CertificateManager.java b/slider-core/src/main/java/org/apache/slider/server/services/security/CertificateManager.java
deleted file mode 100644
index e436ae9..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/security/CertificateManager.java
+++ /dev/null
@@ -1,495 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.services.security;
-
-import com.google.inject.Singleton;
-import org.apache.commons.io.FileUtils;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.SliderException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.nio.charset.Charset;
-import java.text.MessageFormat;
-
-@Singleton
-public class CertificateManager {
-
-  private static final Logger LOG =
-      LoggerFactory.getLogger(CertificateManager.class);
-
-  private static final String GEN_SRVR_KEY = "openssl genrsa -des3 " +
-      "-passout pass:{0} -out {1}" + File.separator + "{2} 4096 ";
-  private static final String GEN_SRVR_REQ = "openssl req -passin pass:{0} " +
-      "-new -key {1}" + File.separator + "{2} -out {1}" + File.separator +
-      "{5} -config {1}" + File.separator + "ca.config " +
-      "-subj {6} -batch";
-  private static final String SIGN_SRVR_CRT = "openssl ca -create_serial " +
-    "-out {1}" + File.separator + "{3} -days 365 -keyfile {1}" + File.separator
-    + "{2} -key {0} -selfsign -extensions jdk7_ca -config {1}" + File.separator
-    + "ca.config -batch -infiles {1}" + File.separator + "{5}";
-  private static final String EXPRT_KSTR = "openssl pkcs12 -export" +
-      " -in {2}" + File.separator + "{4} -inkey {2}" + File.separator +
-      "{3} -certfile {2}" + File.separator + "{4} -out {2}" + File.separator +
-      "{5} -password pass:{1} -passin pass:{0} \n";
-  private static final String REVOKE_AGENT_CRT = "openssl ca " +
-      "-config {0}" + File.separator + "ca.config -keyfile {0}" +
-      File.separator + "{4} -revoke {0}" + File.separator + "{2} -batch " +
-      "-passin pass:{3} -cert {0}" + File.separator + "{5}";
-  private static final String SIGN_AGENT_CRT = "openssl ca -config " +
-      "{0}" + File.separator + "ca.config -in {0}" + File.separator +
-      "{1} -out {0}" + File.separator + "{2} -batch -passin pass:{3} " +
-      "-keyfile {0}" + File.separator + "{4} -cert {0}" + File.separator + "{5}";
-  private static final String GEN_AGENT_KEY="openssl req -new -newkey " +
-      "rsa:1024 -nodes -keyout {0}" + File.separator +
-      "{2}.key -subj {1} -out {0}" + File.separator + "{2}.csr " +
-      "-config {3}" + File.separator + "ca.config ";
-  private String passphrase;
-  private String applicationName;
-
-
-  public void initialize(MapOperations compOperations) throws SliderException {
-    String hostname = null;
-    try {
-      hostname = InetAddress.getLocalHost().getCanonicalHostName();
-    } catch (UnknownHostException e) {
-      hostname = "localhost";
-    }
-    this.initialize(compOperations, hostname, null, null);
-  }
-
-  /**
-    * Verify that root certificate exists, generate it otherwise.
-    */
-  public void initialize(MapOperations compOperations,
-                         String hostname, String containerId,
-                         String appName) throws SliderException {
-    SecurityUtils.initializeSecurityParameters(compOperations);
-
-    LOG.info("Initialization of root certificate");
-    boolean certExists = isCertExists();
-    LOG.info("Certificate exists:" + certExists);
-
-    this.applicationName = appName;
-
-    if (!certExists) {
-      generateAMKeystore(hostname, containerId);
-    }
-
-  }
-
-  /**
-   * Checks root certificate state.
-   * @return "true" if certificate exists
-   */
-  private boolean isCertExists() {
-
-    String srvrKstrDir = SecurityUtils.getSecurityDir();
-    String srvrCrtName = SliderKeys.CRT_FILE_NAME;
-    File certFile = new File(srvrKstrDir + File.separator + srvrCrtName);
-    LOG.debug("srvrKstrDir = " + srvrKstrDir);
-    LOG.debug("srvrCrtName = " + srvrCrtName);
-    LOG.debug("certFile = " + certFile.getAbsolutePath());
-
-    return certFile.exists();
-  }
-
-  public void setPassphrase(String passphrase) {
-    this.passphrase = passphrase;
-  }
-
-  class StreamConsumer extends Thread
-  {
-    InputStream is;
-    boolean logOutput;
-
-    StreamConsumer(InputStream is, boolean logOutput)
-    {
-      this.is = is;
-      this.logOutput = logOutput;
-    }
-
-    StreamConsumer(InputStream is)
-    {
-      this(is, false);
-    }
-
-    public void run()
-    {
-      try
-      {
-        InputStreamReader isr = new InputStreamReader(is,
-                                                      Charset.forName("UTF8"));
-        BufferedReader br = new BufferedReader(isr);
-        String line;
-        while ( (line = br.readLine()) != null)
-          if (logOutput) {
-            LOG.info(line);
-          }
-      } catch (IOException e)
-      {
-        LOG.error("Error during processing of process stream", e);
-      }
-    }
-  }
-
-
-  /**
-   * Runs os command
-   *
-   * @return command execution exit code
-   */
-  private int runCommand(String command) throws SliderException {
-    int exitCode = -1;
-    String line = null;
-    Process process = null;
-    BufferedReader br= null;
-    try {
-      process = Runtime.getRuntime().exec(command);
-      StreamConsumer outputConsumer =
-          new StreamConsumer(process.getInputStream(), true);
-      StreamConsumer errorConsumer =
-          new StreamConsumer(process.getErrorStream(), true);
-
-      outputConsumer.start();
-      errorConsumer.start();
-
-      try {
-        process.waitFor();
-        SecurityUtils.logOpenSslExitCode(command, process.exitValue());
-        exitCode = process.exitValue();
-        if (exitCode != 0) {
-          throw new SliderException(exitCode, "Error running command %s", command);
-        }
-      } catch (InterruptedException e) {
-        e.printStackTrace();
-      }
-    } catch (IOException e) {
-      e.printStackTrace();
-    } finally {
-      if (br != null) {
-        try {
-          br.close();
-        } catch (IOException ioe) {
-          ioe.printStackTrace();
-        }
-      }
-    }
-
-    return exitCode;//some exception occurred
-
-  }
-
-  public synchronized void generateContainerCertificate(String hostname,
-                                                        String identifier) {
-    LOG.info("Generation of certificate for {}", hostname);
-
-    String srvrKstrDir = SecurityUtils.getSecurityDir();
-    Object[] scriptArgs = {srvrKstrDir, getSubjectDN(hostname, identifier,
-        this.applicationName), identifier, SecurityUtils.getSecurityDir()};
-
-    try {
-      String command = MessageFormat.format(GEN_AGENT_KEY, scriptArgs);
-      runCommand(command);
-
-      signAgentCertificate(identifier);
-
-    } catch (SliderException e) {
-      LOG.error("Error generating the agent certificate", e);
-    }
-  }
-
-  public synchronized SecurityStore generateContainerKeystore(String hostname,
-                                                              String requesterId,
-                                                              String role,
-                                                              String keystorePass)
-      throws SliderException {
-    LOG.info("Generation of container keystore for container {} on {}",
-             requesterId, hostname);
-
-    generateContainerCertificate(hostname, requesterId);
-
-    // come up with correct args to invoke keystore command
-    String srvrCrtPass = SecurityUtils.getKeystorePass();
-    String srvrKstrDir = SecurityUtils.getSecurityDir();
-    String containerCrtName = requesterId + ".crt";
-    String containerKeyName = requesterId + ".key";
-    String kstrName = getKeystoreFileName(requesterId, role);
-
-    Object[] scriptArgs = {srvrCrtPass, keystorePass, srvrKstrDir,
-        containerKeyName, containerCrtName, kstrName};
-
-    String command = MessageFormat.format(EXPRT_KSTR, scriptArgs);
-    runCommand(command);
-
-    return new SecurityStore(new File(srvrKstrDir, kstrName),
-                             SecurityStore.StoreType.keystore);
-  }
-
-  private static String getKeystoreFileName(String containerId,
-                                            String role) {
-    return String.format("keystore-%s-%s.p12", containerId,
-                         role != null ? role : "");
-  }
-
-  private void generateAMKeystore(String hostname, String containerId)
-      throws SliderException {
-    LOG.info("Generation of server certificate");
-
-    String srvrKstrDir = SecurityUtils.getSecurityDir();
-    String srvrCrtName = SliderKeys.CRT_FILE_NAME;
-    String srvrCsrName = SliderKeys.CSR_FILE_NAME;
-    String srvrKeyName = SliderKeys.KEY_FILE_NAME;
-    String kstrName = SliderKeys.KEYSTORE_FILE_NAME;
-    String srvrCrtPass = SecurityUtils.getKeystorePass();
-
-    Object[] scriptArgs = {srvrCrtPass, srvrKstrDir, srvrKeyName,
-        srvrCrtName, kstrName, srvrCsrName, getSubjectDN(hostname, containerId,
-        this.applicationName)};
-
-    String command = MessageFormat.format(GEN_SRVR_KEY, scriptArgs);
-    runCommand(command);
-
-    command = MessageFormat.format(GEN_SRVR_REQ, scriptArgs);
-    runCommand(command);
-
-    command = MessageFormat.format(SIGN_SRVR_CRT, scriptArgs);
-    runCommand(command);
-
-    Object[] keystoreArgs = {srvrCrtPass, srvrCrtPass, srvrKstrDir, srvrKeyName,
-        srvrCrtName, kstrName, srvrCsrName};
-    command = MessageFormat.format(EXPRT_KSTR, keystoreArgs);
-    runCommand(command);
-  }
-
-  public SecurityStore generateContainerTruststore(String containerId,
-                                                   String role,
-                                                   String truststorePass)
-      throws SliderException {
-
-    String srvrKstrDir = SecurityUtils.getSecurityDir();
-    String srvrCrtName = SliderKeys.CRT_FILE_NAME;
-    String srvrCsrName = SliderKeys.CSR_FILE_NAME;
-    String srvrKeyName = SliderKeys.KEY_FILE_NAME;
-    String kstrName = getTruststoreFileName(role, containerId);
-    String srvrCrtPass = SecurityUtils.getKeystorePass();
-
-    Object[] scriptArgs = {srvrCrtPass, truststorePass, srvrKstrDir, srvrKeyName,
-        srvrCrtName, kstrName, srvrCsrName};
-
-    String command = MessageFormat.format(EXPRT_KSTR, scriptArgs);
-    runCommand(command);
-
-    return new SecurityStore(new File(srvrKstrDir, kstrName),
-                             SecurityStore.StoreType.truststore);
-  }
-
-  private static String getTruststoreFileName(String role, String containerId) {
-    return String.format("truststore-%s-%s.p12", containerId,
-                         role != null ? role : "");
-  }
-
-  /**
-   * Returns server certificate content
-   * @return string with server certificate content
-   */
-  public String getServerCert() {
-    File certFile = getServerCertficateFilePath();
-    String srvrCrtContent = null;
-    try {
-      srvrCrtContent = FileUtils.readFileToString(certFile);
-    } catch (IOException e) {
-      LOG.error(e.getMessage());
-    }
-    return srvrCrtContent;
-  }
-
-  public static File getServerCertficateFilePath() {
-    return new File(String.format("%s%s%s",
-                                  SecurityUtils.getSecurityDir(),
-                                  File.separator,
-                                  SliderKeys.CRT_FILE_NAME));
-  }
-
-  public static File getAgentCertficateFilePath(String containerId) {
-    return new File(String.format("%s%s%s.crt",
-                                  SecurityUtils.getSecurityDir(),
-                                  File.separator,
-                                  containerId));
-  }
-
-  public static File getContainerKeystoreFilePath(String containerId,
-                                                  String role) {
-    return new File(SecurityUtils.getSecurityDir(), getKeystoreFileName(
-        containerId,
-        role
-    ));
-  }
-
-  public static File getContainerTruststoreFilePath(String role,
-                                                    String containerId) {
-    return new File(SecurityUtils.getSecurityDir(),
-                    getTruststoreFileName(role, containerId));
-  }
-
-  public static File getAgentKeyFilePath(String containerId) {
-    return new File(String.format("%s%s%s.key",
-                                  SecurityUtils.getSecurityDir(),
-                                  File.separator,
-                                  containerId));
-  }
-
-  /**
-   * Signs agent certificate
-   * Adds agent certificate to server keystore
-   * @return string with agent signed certificate content
-   */
-  public synchronized SignCertResponse signAgentCrt(String agentHostname,
-                                                    String agentCrtReqContent,
-                                                    String passphraseAgent) {
-    SignCertResponse response = new SignCertResponse();
-    LOG.info("Signing of agent certificate");
-    LOG.info("Verifying passphrase");
-
-    if (!this.passphrase.equals(passphraseAgent.trim())) {
-      LOG.warn("Incorrect passphrase from the agent");
-      response.setResult(SignCertResponse.ERROR_STATUS);
-      response.setMessage("Incorrect passphrase from the agent");
-      return response;
-    }
-
-    String srvrKstrDir = SecurityUtils.getSecurityDir();
-    String srvrCrtPass = SecurityUtils.getKeystorePass();
-    String srvrCrtName = SliderKeys.CRT_FILE_NAME;
-    String srvrKeyName = SliderKeys.KEY_FILE_NAME;
-    String agentCrtReqName = agentHostname + ".csr";
-    String agentCrtName = agentHostname + ".crt";
-
-    Object[] scriptArgs = {srvrKstrDir, agentCrtReqName, agentCrtName,
-        srvrCrtPass, srvrKeyName, srvrCrtName};
-
-    //Revoke previous agent certificate if exists
-    File agentCrtFile = new File(srvrKstrDir + File.separator + agentCrtName);
-
-    String command = null;
-    if (agentCrtFile.exists()) {
-      LOG.info("Revoking of " + agentHostname + " certificate.");
-      command = MessageFormat.format(REVOKE_AGENT_CRT, scriptArgs);
-      try {
-        runCommand(command);
-      } catch (SliderException e) {
-        int commandExitCode = e.getExitCode();
-        response.setResult(SignCertResponse.ERROR_STATUS);
-        response.setMessage(
-            SecurityUtils.getOpenSslCommandResult(command, commandExitCode));
-        return response;
-      }
-    }
-
-    File agentCrtReqFile = new File(srvrKstrDir + File.separator +
-        agentCrtReqName);
-    try {
-      FileUtils.writeStringToFile(agentCrtReqFile, agentCrtReqContent);
-    } catch (IOException e1) {
-      // TODO Auto-generated catch block
-      e1.printStackTrace();
-    }
-
-    command = MessageFormat.format(SIGN_AGENT_CRT, scriptArgs);
-
-    LOG.debug(SecurityUtils.hideOpenSslPassword(command));
-    try {
-      runCommand(command);
-    } catch (SliderException e) {
-      int commandExitCode = e.getExitCode();
-      response.setResult(SignCertResponse.ERROR_STATUS);
-      response.setMessage(
-          SecurityUtils.getOpenSslCommandResult(command, commandExitCode));
-      return response;
-    }
-
-    String agentCrtContent = "";
-    try {
-      agentCrtContent = FileUtils.readFileToString(agentCrtFile);
-    } catch (IOException e) {
-      e.printStackTrace();
-      LOG.error("Error reading signed agent certificate");
-      response.setResult(SignCertResponse.ERROR_STATUS);
-      response.setMessage("Error reading signed agent certificate");
-      return response;
-    }
-    response.setResult(SignCertResponse.OK_STATUS);
-    response.setSignedCa(agentCrtContent);
-    //LOG.info(ShellCommandUtil.getOpenSslCommandResult(command, commandExitCode));
-    return response;
-  }
-
-  private String signAgentCertificate (String containerId)
-      throws SliderException {
-    String srvrKstrDir = SecurityUtils.getSecurityDir();
-    String srvrCrtPass = SecurityUtils.getKeystorePass();
-    String srvrCrtName = SliderKeys.CRT_FILE_NAME;
-    String srvrKeyName = SliderKeys.KEY_FILE_NAME;
-    String agentCrtReqName = containerId + ".csr";
-    String agentCrtName = containerId + ".crt";
-
-    // server certificate must exist already
-    if (!(new File(srvrKstrDir, srvrCrtName).exists())) {
-      throw new SliderException("CA certificate not generated");
-    }
-
-    Object[] scriptArgs = {srvrKstrDir, agentCrtReqName, agentCrtName,
-        srvrCrtPass, srvrKeyName, srvrCrtName};
-
-    //Revoke previous agent certificate if exists
-    File agentCrtFile = new File(srvrKstrDir + File.separator + agentCrtName);
-
-    String command;
-    if (agentCrtFile.exists()) {
-      LOG.info("Revoking of " + containerId + " certificate.");
-      command = MessageFormat.format(REVOKE_AGENT_CRT, scriptArgs);
-      runCommand(command);
-    }
-
-    command = MessageFormat.format(SIGN_AGENT_CRT, scriptArgs);
-
-    LOG.debug(SecurityUtils.hideOpenSslPassword(command));
-    runCommand(command);
-
-    return agentCrtName;
-
-  }
-
-  private String getSubjectDN(String hostname, String containerId,
-                              String appName) {
-    return String.format("/CN=%s%s%s",
-                         hostname,
-                         containerId != null ? "/OU=" + containerId : "",
-                         appName != null ? "/OU=" + appName : "");
-
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/security/KeystoreGenerator.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/security/KeystoreGenerator.java b/slider-core/src/main/java/org/apache/slider/server/services/security/KeystoreGenerator.java
deleted file mode 100644
index e2339d5..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/security/KeystoreGenerator.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.services.security;
-
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.SliderException;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- *
- */
-public class KeystoreGenerator extends AbstractSecurityStoreGenerator {
-
-
-  public KeystoreGenerator(CertificateManager certificateMgr) {
-    super(certificateMgr);
-  }
-
-  @Override
-  public SecurityStore generate(String hostname, String containerId,
-                                AggregateConf instanceDefinition,
-                                MapOperations compOps, String role)
-      throws SliderException, IOException {
-    SecurityStore keystore = null;
-    String password = getStorePassword(
-        instanceDefinition.getAppConf().credentials, compOps, role);
-    if (password != null) {
-      keystore =
-          certificateMgr.generateContainerKeystore(hostname, containerId, role,
-                                                   password);
-    }
-    return keystore;
-  }
-
-  @Override
-  String getPassword(MapOperations compOps) {
-    return compOps.get(
-        compOps.get(SliderKeys.COMP_KEYSTORE_PASSWORD_PROPERTY_KEY));
-  }
-
-  @Override
-  String getAlias(MapOperations compOps) {
-    return compOps.getOption(SliderKeys.COMP_KEYSTORE_PASSWORD_ALIAS_KEY,
-                             SliderKeys.COMP_KEYSTORE_PASSWORD_ALIAS_DEFAULT);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/security/SecurityStore.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/security/SecurityStore.java b/slider-core/src/main/java/org/apache/slider/server/services/security/SecurityStore.java
deleted file mode 100644
index fc54267..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/security/SecurityStore.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.services.security;
-
-import java.io.File;
-
-/**
- *
- */
-public class SecurityStore {
-  private File file;
-
-  public enum StoreType {truststore, keystore}
-
-  private StoreType type;
-
-  public String getType() {
-    return type.name();
-  }
-
-  public File getFile() {
-    return file;
-  }
-
-  public SecurityStore(File file,
-                       StoreType type) {
-
-    this.file = file;
-    this.type = type;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (o == null || getClass() != o.getClass()) return false;
-
-    SecurityStore that = (SecurityStore) o;
-
-    if (file != null ? !file.equals(that.file) : that.file != null)
-      return false;
-    if (type != that.type) return false;
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    int result = file != null ? file.hashCode() : 0;
-    result = 31 * result + (type != null ? type.hashCode() : 0);
-    return result;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/security/SecurityStoreGenerator.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/security/SecurityStoreGenerator.java b/slider-core/src/main/java/org/apache/slider/server/services/security/SecurityStoreGenerator.java
deleted file mode 100644
index a814988..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/security/SecurityStoreGenerator.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.services.security;
-
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.SliderException;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- *
- */
-public interface SecurityStoreGenerator {
-
-  SecurityStore generate(String hostname,
-                         String containerId,
-                         AggregateConf instanceDefinition,
-                         MapOperations compOps,
-                         String role)
-      throws SliderException, IOException;
-
-  boolean isStoreRequested(MapOperations compOps);
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/security/SecurityUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/security/SecurityUtils.java b/slider-core/src/main/java/org/apache/slider/server/services/security/SecurityUtils.java
deleted file mode 100644
index e82ad84..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/security/SecurityUtils.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.services.security;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.RandomStringUtils;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.RawLocalFileSystem;
-import org.apache.hadoop.fs.permission.FsAction;
-import org.apache.hadoop.fs.permission.FsPermission;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.SliderXmlConfKeys;
-import org.apache.slider.core.conf.MapOperations;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-//import java.nio.file.Files;
-//import java.nio.file.Path;
-//import java.nio.file.Paths;
-//import java.nio.file.attribute.PosixFilePermission;
-//import java.nio.file.attribute.PosixFilePermissions;
-
-
-/**
- *
- */
-public class SecurityUtils {
-  private static final Logger LOG =
-      LoggerFactory.getLogger(SecurityUtils.class);
-
-  private static String CA_CONFIG_CONTENTS =  "HOME            = .\n"
-                                            + "RANDFILE        = $ENV::HOME/.rnd\n\n"
-                                            + "[ ca ]\n"
-                                            + "default_ca             = CA_CLIENT\n"
-                                            + "[ CA_CLIENT ]\n"
-                                            + "dir                    = ${SEC_DIR}/db\n"
-                                            + "certs                  = $dir/certs\n"
-                                            + "new_certs_dir          = $dir/newcerts\n"
-                                            + "\n"
-                                            + "database               = $dir/index.txt\n"
-                                            + "serial                 = $dir/serial\n"
-                                            + "default_days           = 365    \n"
-                                            + "\n"
-                                            + "default_crl_days       = 7  \n"
-                                            + "default_md             = sha256 \n"
-                                            + "\n"
-                                            + "policy                 = policy_anything \n"
-                                            + "\n"
-                                            + "[ policy_anything ]\n"
-                                            + "countryName            = optional\n"
-                                            + "stateOrProvinceName    = optional\n"
-                                            + "localityName           = optional\n"
-                                            + "organizationName       = optional\n"
-                                            + "organizationalUnitName = optional\n"
-                                            + "commonName             = optional\n"
-                                            + "emailAddress           = optional\n"
-                                            + "\n"
-                                            + "[req]\n"
-                                            + "distinguished_name     = req_distinguished_name\n"
-                                            + "\n"
-                                            + "[ req_distinguished_name ]\n"
-                                            + "\n"
-                                            + "[ jdk7_ca ]\n"
-                                            + "subjectKeyIdentifier = hash\n"
-                                            + "authorityKeyIdentifier = keyid:always,issuer:always\n"
-                                            + "basicConstraints = CA:true\n";
-
-  private static final String PASS_TOKEN = "pass:";
-  private static String keystorePass;
-  private static String securityDir;
-
-  public static void logOpenSslExitCode(String command, int exitCode) {
-    if (exitCode == 0) {
-      LOG.info(getOpenSslCommandResult(command, exitCode));
-    } else {
-      LOG.warn(getOpenSslCommandResult(command, exitCode));
-    }
-
-  }
-
-  public static String hideOpenSslPassword(String command){
-    int start = command.indexOf(PASS_TOKEN);
-    while (start >= 0) {
-      start += PASS_TOKEN.length();
-      CharSequence cs = command.subSequence(start, command.indexOf(" ", start));
-      command = command.replace(cs, "****");
-      start = command.indexOf(PASS_TOKEN, start + 1);
-    }
-    return command;
-  }
-
-  public static String getOpenSslCommandResult(String command, int exitCode) {
-    return new StringBuilder().append("Command ")
-        .append(hideOpenSslPassword(command))
-        .append(" was finished with exit code: ")
-        .append(exitCode).append(" - ")
-        .append(getOpenSslExitCodeDescription(exitCode)).toString();
-  }
-
-  private static String getOpenSslExitCodeDescription(int exitCode) {
-    switch (exitCode) {
-      case 0: {
-        return "the operation was completed successfully.";
-      }
-      case 1: {
-        return "an error occurred parsing the command options.";
-      }
-      case 2: {
-        return "one of the input files could not be read.";
-      }
-      case 3: {
-        return "an error occurred creating the PKCS#7 file or when reading the MIME message.";
-      }
-      case 4: {
-        return "an error occurred decrypting or verifying the message.";
-      }
-      case 5: {
-        return "the message was verified correctly but an error occurred writing out the signers certificates.";
-      }
-      default:
-        return "unsupported code";
-    }
-  }
-
-  public static void writeCaConfigFile(String path) throws IOException {
-    String contents = CA_CONFIG_CONTENTS.replace("${SEC_DIR}", path);
-    FileUtils.writeStringToFile(new File(path, "ca.config"), contents);
-  }
-
-  public static String getKeystorePass() {
-    return keystorePass;
-  }
-
-  public static String getSecurityDir() {
-    return securityDir;
-  }
-
-  public static void    initializeSecurityParameters(MapOperations configMap) {
-    initializeSecurityParameters(configMap, false);
-  }
-
-  public static void initializeSecurityParameters(MapOperations configMap,
-                                                boolean persistPassword) {
-    String keyStoreLocation = configMap.getOption(
-        SliderXmlConfKeys.KEY_KEYSTORE_LOCATION, getDefaultKeystoreLocation());
-    if (keyStoreLocation == null) {
-      LOG.error(SliderXmlConfKeys.KEY_KEYSTORE_LOCATION
-          + " is not specified. Unable to initialize security params.");
-      return;
-    }
-    File secDirFile = new File(keyStoreLocation).getParentFile();
-    if (!secDirFile.exists()) {
-      // create entire required directory structure
-      File dbDir = new File(secDirFile, "db");
-      File newCertsDir = new File(dbDir, "newcerts");
-      newCertsDir.mkdirs();
-      RawLocalFileSystem fileSystem = null;
-      try {
-        fileSystem = new RawLocalFileSystem();
-        FsPermission permissions = new FsPermission(FsAction.ALL, FsAction.NONE,
-                                                    FsAction.NONE);
-        fileSystem.setPermission(new Path(dbDir.getAbsolutePath()),
-                                 permissions);
-        fileSystem.setPermission(new Path(dbDir.getAbsolutePath()), permissions);
-        fileSystem.setPermission(new Path(newCertsDir.getAbsolutePath()),
-                                 permissions);
-        File indexFile = new File(dbDir, "index.txt");
-        indexFile.createNewFile();
-        SecurityUtils.writeCaConfigFile(secDirFile.getAbsolutePath().replace('\\', '/'));
-
-      } catch (IOException e) {
-        LOG.error("Unable to create SSL configuration directories/files", e);
-      } finally {
-        if (fileSystem != null) {
-          try {
-            fileSystem.close();
-          } catch (IOException e) {
-            LOG.warn("Unable to close fileSystem", e);
-          }
-        }
-      }
-      // need to create the password
-    }
-    keystorePass = getKeystorePassword(secDirFile, persistPassword);
-    securityDir = secDirFile.getAbsolutePath();
-  }
-
-  private static String getKeystorePassword(File secDirFile,
-                                            boolean persistPassword) {
-    File passFile = new File(secDirFile, SliderKeys.CRT_PASS_FILE_NAME);
-    String password = null;
-    if (!passFile.exists()) {
-      LOG.info("Generating keystore password");
-      password = RandomStringUtils.randomAlphanumeric(
-          Integer.valueOf(SliderKeys.PASS_LEN));
-      if (persistPassword) {
-        try {
-          FileUtils.writeStringToFile(passFile, password);
-          passFile.setWritable(true);
-          passFile.setReadable(true);
-        } catch (IOException e) {
-          e.printStackTrace();
-          throw new RuntimeException(
-              "Error creating certificate password file");
-        }
-      }
-    } else {
-      LOG.info("Reading password from existing file");
-      try {
-        password = FileUtils.readFileToString(passFile);
-        password = password.replaceAll("\\p{Cntrl}", "");
-      } catch (IOException e) {
-        e.printStackTrace();
-      }
-    }
-
-    return password;
-  }
-
-  private static String getDefaultKeystoreLocation() {
-    File workDir = null;
-    try {
-      workDir =  new File(FileUtils.getTempDirectory().getAbsolutePath()
-                          + "/sec" + System.currentTimeMillis());
-      if (!workDir.mkdirs()) {
-        throw new IOException("Unable to create temporary security directory");
-      }
-    } catch (IOException e) {
-      LOG.warn("Unable to create security directory");
-      return null;
-    }
-
-    return new StringBuilder().append(workDir.getAbsolutePath())
-        .append(File.separator)
-        .append(SliderKeys.SECURITY_DIR)
-        .append(File.separator)
-        .append(SliderKeys.KEYSTORE_FILE_NAME).toString();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/security/SignCertResponse.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/security/SignCertResponse.java b/slider-core/src/main/java/org/apache/slider/server/services/security/SignCertResponse.java
deleted file mode 100644
index 8437d88..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/security/SignCertResponse.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.security;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-/**
- *
- * Sign certificate response data model.
- *
- */
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {})
-public class SignCertResponse {
-	
-  public static final String ERROR_STATUS = "ERROR";
-  public static final String OK_STATUS = "OK";
-
-  @XmlElement
-  private String result;
-  @XmlElement
-  private String signedCa;
-  @XmlElement
-  private String message;
-
-  public String getResult() {
-    return result;
-  }
-  public void setResult(String result) {
-    this.result = result;
-  }
-  public String getSignedCa() {
-    return signedCa;
-  }
-  public void setSignedCa(String signedCa) {
-    this.signedCa = signedCa;
-  }
-
-  public String getMessage() {
-    return message;
-  }
-  public void setMessage(String message) {
-    this.message = message;
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/security/SignMessage.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/security/SignMessage.java b/slider-core/src/main/java/org/apache/slider/server/services/security/SignMessage.java
deleted file mode 100644
index 4bccb87..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/security/SignMessage.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.security;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-/**
- *
- * Sign certificate request data model.
- *
- */
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {})
-public class SignMessage {
-
-  @XmlElement
-  private String csr;
-  @XmlElement
-  private String passphrase;
-  public String getCsr() {
-    return csr;
-  }
-  public void setCsr(String csr) {
-    this.csr = csr;
-  }
-  public String getPassphrase() {
-    return passphrase;
-  }
-  public void setPassphrase(String passphrase) {
-    this.passphrase = passphrase;
-  }
-}
-


[15/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentResource.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentResource.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentResource.java
deleted file mode 100644
index 20ef068..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentResource.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-import org.apache.slider.server.appmaster.web.WebAppApi;
-import org.apache.slider.server.services.security.SignCertResponse;
-import org.apache.slider.server.services.security.SignMessage;
-import org.apache.slider.server.appmaster.web.rest.AbstractSliderResource;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-/**
- *
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class AgentResource extends AbstractSliderResource {
-
-  private String agent_name;
-
-  public AgentResource(WebAppApi slider) {
-    super(slider);
-  }
-
-  private void init(HttpServletResponse res) {
-    res.setContentType(null);
-  }
-
-  @GET
-  @Path("/agent/register")
-  public Response endpointAgentRegister() {
-    Response response = Response.status(200).entity("/agent/register").build();
-    return response;
-  }
-
-  @GET
-  @Path("/agent")
-  public Response endpointAgent() {
-    Response response = Response.status(200).entity("/agent").build();
-    return response;
-  }
-  @GET
-  @Path("/")
-  public Response endpointRoot() {
-    Response response = Response.status(200).entity("/").build();
-    return response;
-  }
-
-  @POST
-  @Path("/{agent_name: [a-zA-Z][a-zA-Z0-9_-]*}/register")
-  @Consumes({MediaType.APPLICATION_JSON})
-  @Produces({MediaType.APPLICATION_JSON})
-  public RegistrationResponse register(Register registration,
-                                       @Context HttpServletResponse res,
-                                       @PathParam("agent_name") String agent_name) {
-    init(res);
-    this.agent_name = agent_name;
-    AgentRestOperations ops = slider.getAgentRestOperations();
-    return ops.handleRegistration(registration);
-
-  }
-
-  @POST
-  @Path("/{agent_name: [a-zA-Z][a-zA-Z0-9_-]*}/heartbeat")
-  @Consumes(MediaType.APPLICATION_JSON)
-  @Produces({MediaType.APPLICATION_JSON})
-  public HeartBeatResponse heartbeat(HeartBeat message,
-                                     @Context HttpServletResponse res,
-                                     @PathParam("agent_name") String agent_name) {
-    init(res);
-    AgentRestOperations ops = slider.getAgentRestOperations();
-    return ops.handleHeartBeat(message);
-  }
-
-  @GET
-  @Path("/cert/ca")
-  @Produces({MediaType.TEXT_PLAIN})
-  public String downloadSrvrCrt() {
-    return slider.getCertificateManager().getServerCert();
-  }
-
-  @Path("/certs/{hostName}")
-  @POST
-  @Consumes(MediaType.APPLICATION_JSON)
-  @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
-  public SignCertResponse signAgentCrt(@PathParam("hostName") String hostname,
-                                       SignMessage message, @Context HttpServletRequest req) {
-    return slider.getCertificateManager().signAgentCrt(hostname,
-                                                       message.getCsr(),
-                                                       message.getPassphrase());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentRestOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentRestOperations.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentRestOperations.java
deleted file mode 100644
index 2891be8..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentRestOperations.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-/**
- *
- */
-public interface AgentRestOperations {
-
-  RegistrationResponse handleRegistration(Register registration);
-
-  HeartBeatResponse handleHeartBeat(HeartBeat heartBeat);
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentWebApp.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentWebApp.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentWebApp.java
deleted file mode 100644
index 3a3b0c0..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentWebApp.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-import com.google.common.base.Preconditions;
-import com.sun.jersey.api.core.ResourceConfig;
-import com.sun.jersey.spi.container.WebApplication;
-import com.sun.jersey.spi.container.servlet.ServletContainer;
-import com.sun.jersey.spi.container.servlet.WebConfig;
-import com.sun.jersey.spi.inject.SingletonTypeInjectableProvider;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.providers.agent.AgentKeys;
-import org.apache.slider.server.appmaster.web.WebAppApi;
-import org.apache.slider.server.services.security.SecurityUtils;
-import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.security.SslSelectChannelConnector;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.ServletHolder;
-import org.mortbay.thread.QueuedThreadPool;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.ext.Provider;
-import java.io.Closeable;
-import java.io.File;
-import java.io.IOException;
-import java.net.BindException;
-import java.util.Set;
-
-/**
- *
- */
-public class AgentWebApp implements Closeable {
-  protected static final Logger LOG = LoggerFactory.getLogger(AgentWebApp.class);
-  private int port;
-  private int securedPort;
-  private static Server agentServer;
-  public static final String BASE_PATH = "slideragent";
-
-  public static class Builder {
-    final String name;
-    final String wsName;
-    final WebAppApi application;
-    int port;
-    int securedPort;
-    MapOperations configsMap;
-
-    public Builder(String name, String wsName, WebAppApi application) {
-      this.name = name;
-      this.wsName = wsName;
-      this.application = application;
-    }
-
-    public Builder withComponentConfig(MapOperations appMasterConfig) {
-      this.configsMap = appMasterConfig;
-      return this;
-    }
-
-    public Builder withPort (int port) {
-      this.port = port;
-      return this;
-    }
-
-    public Builder withSecuredPort (int securedPort) {
-      this.securedPort = securedPort;
-      return this;
-    }
-
-    public AgentWebApp start() throws IOException {
-      if (configsMap == null) {
-        throw new IllegalStateException("No SSL Configuration Available");
-      }
-
-      agentServer = new Server();
-      agentServer.setThreadPool(
-          new QueuedThreadPool(
-              configsMap.getOptionInt("agent.threadpool.size.max", 25)));
-      agentServer.setStopAtShutdown(true);
-      agentServer.setGracefulShutdown(1000);
-
-      SslSelectChannelConnector ssl1WayConnector = createSSLConnector(false, port);
-      SslSelectChannelConnector ssl2WayConnector =
-          createSSLConnector(Boolean.valueOf(
-              configsMap.getOption(AgentKeys.KEY_AGENT_TWO_WAY_SSL_ENABLED,
-                                   "false")), securedPort);
-      agentServer.setConnectors(new Connector[]{ssl1WayConnector,
-          ssl2WayConnector});
-
-      ServletHolder agent = new ServletHolder(new AgentServletContainer());
-      Context agentRoot = new Context(agentServer, "/", Context.SESSIONS);
-
-      agent.setInitParameter("com.sun.jersey.config.property.resourceConfigClass",
-                             "com.sun.jersey.api.core.PackagesResourceConfig");
-      agent.setInitParameter("com.sun.jersey.config.property.packages",
-                             "org.apache.slider.server.appmaster.web.rest.agent");
-      agent.setInitParameter("com.sun.jersey.api.json.POJOMappingFeature",
-                             "true");
-//      agent.setInitParameter("com.sun.jersey.spi.container.ContainerRequestFilters", "com.sun.jersey.api.container.filter.LoggingFilter");
-//      agent.setInitParameter("com.sun.jersey.spi.container.ContainerResponseFilters", "com.sun.jersey.api.container.filter.LoggingFilter");
-//      agent.setInitParameter("com.sun.jersey.config.feature.Trace", "true");
-      agentRoot.addServlet(agent, "/*");
-
-      try {
-        openListeners();
-        agentServer.start();
-      } catch (IOException e) {
-        LOG.error("Unable to start agent server", e);
-        throw e;
-      } catch (Exception e) {
-        LOG.error("Unable to start agent server", e);
-        throw new IOException("Unable to start agent server: " + e, e);
-      }
-
-      AgentWebApp webApp = new AgentWebApp();
-      webApp.setPort(getConnectorPort(agentServer, 0));
-      webApp.setSecuredPort(getConnectorPort(agentServer, 1));
-      return webApp;
-
-    }
-
-    private void openListeners() throws Exception {
-      // from HttpServer2.openListeners()
-      for (Connector listener : agentServer.getConnectors()) {
-        if (listener.getLocalPort() != -1) {
-          // This listener is either started externally or has been bound
-          continue;
-        }
-        int port = listener.getPort();
-        while (true) {
-          // jetty has a bug where you can't reopen a listener that previously
-          // failed to open w/o issuing a close first, even if the port is changed
-          try {
-            listener.close();
-            listener.open();
-            LOG.info("Jetty bound to port " + listener.getLocalPort());
-            break;
-          } catch (BindException ex) {
-            if (port == 0) {
-              BindException be = new BindException("Port in use: "
-                  + listener.getHost() + ":" + listener.getPort());
-              be.initCause(ex);
-              throw be;
-            }
-          }
-          // try the next port number
-          listener.setPort(++port);
-          Thread.sleep(100);
-        }
-      }
-    }
-
-    private SslSelectChannelConnector createSSLConnector(boolean needClientAuth, int port) {
-      SslSelectChannelConnector sslConnector = new
-          SslSelectChannelConnector();
-
-      String keystore = SecurityUtils.getSecurityDir() +
-                        File.separator + "keystore.p12";
-      String srvrCrtPass = SecurityUtils.getKeystorePass();
-      sslConnector.setKeystore(keystore);
-      sslConnector.setTruststore(keystore);
-      sslConnector.setPassword(srvrCrtPass);
-      sslConnector.setKeyPassword(srvrCrtPass);
-      sslConnector.setTrustPassword(srvrCrtPass);
-      sslConnector.setKeystoreType("PKCS12");
-      sslConnector.setTruststoreType("PKCS12");
-      sslConnector.setNeedClientAuth(needClientAuth);
-
-      sslConnector.setPort(port);
-      sslConnector.setAcceptors(2);
-      return sslConnector;
-    }
-
-    @Provider
-    public class WebAppApiProvider extends
-        SingletonTypeInjectableProvider<javax.ws.rs.core.Context, WebAppApi> {
-
-      public WebAppApiProvider () {
-        super(WebAppApi.class, application);
-      }
-    }
-
-    public class AgentServletContainer extends ServletContainer {
-      public AgentServletContainer() {
-        super();
-      }
-
-      @Override
-      protected void configure(WebConfig wc,
-                               ResourceConfig rc,
-                               WebApplication wa) {
-        super.configure(wc, rc, wa);
-        Set<Object> singletons = rc.getSingletons();
-        singletons.add(new WebAppApiProvider());
-      }
-    }
-
-    private int getConnectorPort(Server webServer, int index) {
-      Preconditions.checkArgument(index >= 0);
-      if (index > webServer.getConnectors().length)
-        throw new IllegalStateException("Illegal connect index requested");
-
-      Connector c = webServer.getConnectors()[index];
-      if (c.getLocalPort() == -1) {
-        // The connector is not bounded
-        throw new IllegalStateException("The connector is not bound to a port");
-      }
-
-      return c.getLocalPort();
-    }
-  }
-
-  public static Builder $for(String name, WebAppApi app, String wsPrefix) {
-    return new Builder(name, wsPrefix, app);
-  }
-
-  public int getPort() {
-    return port;
-  }
-
-  public void setPort(int port) {
-    this.port = port;
-  }
-
-  public void setSecuredPort(int securedPort) {
-    this.securedPort = securedPort;
-  }
-
-  public int getSecuredPort() {
-    return securedPort;
-  }
-
-  public void close() throws IOException{
-    //need to stop server and reset injector
-    try {
-      agentServer.stop();
-    } catch (IOException e) {
-      throw e;
-    } catch (Exception e) {
-      throw new IOException(e.toString(), e);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentWebServices.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentWebServices.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentWebServices.java
deleted file mode 100644
index 684ce6f..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentWebServices.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-import org.apache.slider.server.appmaster.web.WebAppApi;
-import org.apache.slider.server.appmaster.web.rest.RestPaths;
-
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Context;
-
-/** The available agent REST services exposed by a slider AM. */
-@Path(RestPaths.SLIDER_AGENT_CONTEXT_ROOT)
-public class AgentWebServices {
-  /** AM/WebApp info object */
-  @Context
-  private WebAppApi slider;
-
-  public AgentWebServices() {
-  }
-
-  @Path(RestPaths.SLIDER_SUBPATH_AGENTS)
-  public AgentResource getAgentResource () {
-    return new AgentResource(slider);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/CommandReport.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/CommandReport.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/CommandReport.java
deleted file mode 100644
index a37e490..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/CommandReport.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.Map;
-
-/**
- *
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class CommandReport {
-
-  int exitCode;
-  private String role;
-  private String actionId;
-  private String stdout;
-  private String stderr;
-  private String structuredOut;
-  private String status;
-  private String clusterName;
-  private String serviceName;
-  private long taskId;
-  private String roleCommand;
-  private Map<String, String> folders;
-  private Map<String, String> allocatedPorts;
-  private Map<String, Map<String, String>> configurationTags;
-
-  @JsonProperty("taskId")
-  public long getTaskId() {
-    return taskId;
-  }
-
-  @JsonProperty("taskId")
-  public void setTaskId(long taskId) {
-    this.taskId = taskId;
-  }
-
-  @JsonProperty("clusterName")
-  public String getClusterName() {
-    return this.clusterName;
-  }
-
-  @JsonProperty("clusterName")
-  public void setClusterName(String clusterName) {
-    this.clusterName = clusterName;
-  }
-
-  @JsonProperty("actionId")
-  public String getActionId() {
-    return this.actionId;
-  }
-
-  @JsonProperty("actionId")
-  public void setActionId(String actionId) {
-    this.actionId = actionId;
-  }
-
-  @JsonProperty("stderr")
-  public String getStdErr() {
-    return this.stderr;
-  }
-
-  @JsonProperty("stderr")
-  public void setStdErr(String stderr) {
-    this.stderr = stderr;
-  }
-
-  @JsonProperty("exitcode")
-  public int getExitCode() {
-    return this.exitCode;
-  }
-
-  @JsonProperty("exitcode")
-  public void setExitCode(int exitCode) {
-    this.exitCode = exitCode;
-  }
-
-  @JsonProperty("stdout")
-  public String getStdOut() {
-    return this.stdout;
-  }
-
-  @JsonProperty("stdout")
-  public void setStdOut(String stdout) {
-    this.stdout = stdout;
-  }
-
-  @JsonProperty("structuredOut")
-  public String getStructuredOut() {
-    return this.structuredOut;
-  }
-
-  @JsonProperty("structuredOut")
-  public void setStructuredOut(String structuredOut) {
-    this.structuredOut = structuredOut;
-  }
-
-  @JsonProperty("roleCommand")
-  public String getRoleCommand() {
-    return this.roleCommand;
-  }
-
-  @JsonProperty("roleCommand")
-  public void setRoleCommand(String roleCommand) {
-    this.roleCommand = roleCommand;
-  }
-
-  @JsonProperty("role")
-  public String getRole() {
-    return role;
-  }
-
-  @JsonProperty("role")
-  public void setRole(String role) {
-    this.role = role;
-  }
-
-  @JsonProperty("status")
-  public String getStatus() {
-    return status;
-  }
-
-  @JsonProperty("status")
-  public void setStatus(String status) {
-    this.status = status;
-  }
-
-  @JsonProperty("serviceName")
-  public String getServiceName() {
-    return serviceName;
-  }
-
-  @JsonProperty("serviceName")
-  public void setServiceName(String serviceName) {
-    this.serviceName = serviceName;
-  }
-
-  /** @return the config tags that match this command, or <code>null</code> if none are present */
-  @JsonProperty("configurationTags")
-  public Map<String, Map<String, String>> getConfigurationTags() {
-    return configurationTags;
-  }
-
-  /** @param tags the config tags that match this command */
-  @JsonProperty("configurationTags")
-  public void setConfigurationTags(Map<String, Map<String, String>> tags) {
-    configurationTags = tags;
-  }
-
-  /** @return the allocated ports, or <code>null</code> if none are present */
-  @JsonProperty("allocatedPorts")
-  public Map<String, String> getAllocatedPorts() {
-    return allocatedPorts;
-  }
-
-  /** @param ports allocated ports */
-  @JsonProperty("allocatedPorts")
-  public void setAllocatedPorts(Map<String, String> ports) {
-    this.allocatedPorts = ports;
-  }
-
-  /** @return the folders, or <code>null</code> if none are present */
-  @JsonProperty("folders")
-  public Map<String, String> getFolders() {
-    return folders;
-  }
-
-  /** @param folders allocated ports */
-  @JsonProperty("folders")
-  public void setFolders(Map<String, String> folders) {
-    this.folders = folders;
-  }
-
-  @Override
-  public String toString() {
-    return "CommandReport{" +
-           "role='" + role + '\'' +
-           ", actionId='" + actionId + '\'' +
-           ", status='" + status + '\'' +
-           ", exitCode=" + exitCode +
-           ", clusterName='" + clusterName + '\'' +
-           ", serviceName='" + serviceName + '\'' +
-           ", taskId=" + taskId +
-           ", roleCommand=" + roleCommand +
-           ", configurationTags=" + configurationTags +
-           '}';
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/ComponentStatus.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/ComponentStatus.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/ComponentStatus.java
deleted file mode 100644
index acdc234..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/ComponentStatus.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.Map;
-
-/**
- *
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class ComponentStatus {
-  String componentName;
-  String msg;
-  String status;
-  String serviceName;
-  String clusterName;
-  String roleCommand;
-  String ip;
-  String hostname;
-  @JsonProperty("configurations")
-  private Map<String, Map<String, String>> configurations;
-
-  public String getRoleCommand() {
-    return roleCommand;
-  }
-
-  public void setRoleCommand(String roleCommand) {
-    this.roleCommand = roleCommand;
-  }
-
-  public String getComponentName() {
-    return this.componentName;
-  }
-
-  public void setComponentName(String componentName) {
-    this.componentName = componentName;
-  }
-
-  public String getMessage() {
-    return this.msg;
-  }
-
-  public void setMessage(String msg) {
-    this.msg = msg;
-  }
-
-  public String getStatus() {
-    return this.status;
-  }
-
-  public void setStatus(String status) {
-    this.status = status;
-  }
-
-  public String getServiceName() {
-    return serviceName;
-  }
-
-  public void setServiceName(String serviceName) {
-    this.serviceName = serviceName;
-  }
-
-  public String getClusterName() {
-    return clusterName;
-  }
-
-  public void setClusterName(String clusterName) {
-    this.clusterName = clusterName;
-  }
-
-  /** @return the config tags that match this command, or <code>null</code> if none are present */
-  public Map<String, Map<String, String>> getConfigs() {
-    return configurations;
-  }
-
-  /** @param configs the config tags that match this status */
-  public void setConfigs(Map<String, Map<String, String>> configs) {
-    this.configurations = configs;
-  }
-
-  @Override
-  public String toString() {
-    return "ComponentStatus{" +
-           "componentName='" + componentName + '\'' +
-           ", msg='" + msg + '\'' +
-           ", status='" + status + '\'' +
-           ", serviceName='" + serviceName + '\'' +
-           ", clusterName='" + clusterName + '\'' +
-           ", roleCommand='" + roleCommand + '\'' +
-           ", ip='" + ip + '\'' +
-           ", hostname='" + hostname + '\'' +
-           '}';
-  }
-
-  public String getIp() {
-    return ip;
-  }
-
-  public void setIp(String ip) {
-    this.ip = ip;
-  }
-
-  public String getHostname() {
-    return hostname;
-  }
-
-  public void setHostname(String hostname) {
-    this.hostname = hostname;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/DiskInfo.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/DiskInfo.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/DiskInfo.java
deleted file mode 100644
index 27c4d54..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/DiskInfo.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- *
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class DiskInfo {
-  String available;
-  String mountpoint;
-  String device;
-  String used;
-  String percent;
-  String size;
-  String type;
-
-  /**
-   * DiskInfo object that tracks information about a disk.
-   * @param mountpoint
-   * @param available
-   * @param used
-   * @param percent
-   * @param size
-   */
-  public DiskInfo(String device, String mountpoint, String available,
-                  String used, String percent, String size, String type) {
-    this.device = device;
-    this.mountpoint = mountpoint;
-    this.available = available;
-    this.used = used;
-    this.percent = percent;
-    this.size = size;
-    this.type = type;
-  }
-
-  /**
-   * Needed for Serialization
-   */
-  public DiskInfo() {}
-
-  @JsonProperty("available")
-  public void setAvailable(String available) {
-    this.available = available;
-  }
-
-  @JsonProperty("available")
-  public String getAvailable() {
-    return this.available;
-  }
-
-  @JsonProperty("mountpoint")
-  public String getMountPoint() {
-    return this.mountpoint;
-  }
-
-  @JsonProperty("mountpoint")
-  public void setMountPoint(String mountpoint) {
-    this.mountpoint = mountpoint;
-  }
-
-  @JsonProperty("type")
-  public String getType() {
-    return this.type;
-  }
-
-  @JsonProperty("type")
-  public void setType(String type) {
-    this.type = type;
-  }
-
-  @JsonProperty("used")
-  public String getUsed() {
-    return this.used;
-  }
-
-  @JsonProperty("used")
-  public void setUsed(String used) {
-    this.used = used;
-  }
-
-  @JsonProperty("percent")
-  public String getPercent() {
-    return this.percent;
-  }
-
-  @JsonProperty("percent")
-  public void setPercent(String percent) {
-    this.percent = percent;
-  }
-
-  @JsonProperty("size")
-  public String getSize() {
-    return this.size;
-  }
-
-  @JsonProperty("size")
-  public void setSize(String size) {
-    this.size = size;
-  }
-
-  @Override
-  public String toString() {
-    return "available=" + this.available + ",mountpoint=" + this.mountpoint
-           + ",used=" + this.used + ",percent=" + this.percent + ",size=" +
-           this.size + ",device=" + this.device +
-           ",type=" + this.type;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/ExecutionCommand.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/ExecutionCommand.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/ExecutionCommand.java
deleted file mode 100644
index d3864b8..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/ExecutionCommand.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-import org.apache.slider.providers.agent.application.metadata.Component;
-import org.apache.slider.providers.agent.application.metadata.DockerContainer;
-import org.apache.slider.providers.agent.application.metadata.DockerContainerInputFile;
-import org.apache.slider.providers.agent.application.metadata.DockerContainerMount;
-import org.apache.slider.providers.agent.application.metadata.DockerContainerPort;
-import org.apache.slider.providers.agent.application.metadata.Metainfo;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- *
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class ExecutionCommand {
-  protected static final Logger log =
-      LoggerFactory.getLogger(ExecutionCommand.class);
-  private AgentCommandType commandType = AgentCommandType.EXECUTION_COMMAND;
-  private String clusterName;
-  private long taskId;
-  private String commandId;
-  //TODO Remove hostname from being set in the command
-  private String hostname;
-  private String role;
-  private Map<String, String> hostLevelParams = new HashMap<String, String>();
-  private Map<String, String> roleParams = null;
-  private String roleCommand;
-  private Map<String, Map<String, String>> configurations;
-  private Map<String, Map<String, String>> componentConfigurations;
-  private Map<String, String> commandParams;
-  private String serviceName;
-  private String componentName;
-  private String componentType;
-  private List<DockerContainer> containers = new ArrayList<>();
-  private String pkg;
-  private boolean yarnDockerMode = false;
-
-  public ExecutionCommand(AgentCommandType commandType) {
-    this.commandType = commandType;
-  }
-
-  @JsonProperty("commandType")
-  public AgentCommandType getCommandType() {
-    return commandType;
-  }
-
-  @JsonProperty("commandType")
-  public void setCommandType(AgentCommandType commandType) {
-    this.commandType = commandType;
-  }
-
-  @JsonProperty("commandId")
-  public String getCommandId() {
-    return this.commandId;
-  }
-
-  @JsonProperty("commandId")
-  public void setCommandId(String commandId) {
-    this.commandId = commandId;
-  }
-
-  @JsonProperty("taskId")
-  public long getTaskId() {
-    return taskId;
-  }
-
-  @JsonProperty("taskId")
-  public void setTaskId(long taskId) {
-    this.taskId = taskId;
-  }
-
-  @JsonProperty("role")
-  public String getRole() {
-    return role;
-  }
-
-  @JsonProperty("role")
-  public void setRole(String role) {
-    this.role = role;
-  }
-
-  @JsonProperty("roleParams")
-  public Map<String, String> getRoleParams() {
-    return roleParams;
-  }
-
-  @JsonProperty("roleParams")
-  public void setRoleParams(Map<String, String> roleParams) {
-    this.roleParams = roleParams;
-  }
-
-  @JsonProperty("roleCommand")
-  public String getRoleCommand() {
-    return roleCommand;
-  }
-
-  @JsonProperty("roleCommand")
-  public void setRoleCommand(String cmd) {
-    this.roleCommand = cmd;
-  }
-
-  @JsonProperty("clusterName")
-  public String getClusterName() {
-    return clusterName;
-  }
-
-  @JsonProperty("clusterName")
-  public void setClusterName(String clusterName) {
-    this.clusterName = clusterName;
-  }
-
-  @JsonProperty("componentType")
-  public String getComponentType() {
-    return componentType;
-  }
-
-  @JsonProperty("componentType")
-  public void setComponentType(String componentType) {
-    this.componentType = componentType;
-  }
-
-  @JsonProperty("hostname")
-  public String getHostname() {
-    return hostname;
-  }
-
-  @JsonProperty("hostname")
-  public void setHostname(String hostname) {
-    this.hostname = hostname;
-  }
-
-  @JsonProperty("hostLevelParams")
-  public Map<String, String> getHostLevelParams() {
-    return hostLevelParams;
-  }
-
-  @JsonProperty("hostLevelParams")
-  public void setHostLevelParams(Map<String, String> params) {
-    this.hostLevelParams = params;
-  }
-
-  @JsonProperty("configurations")
-  public Map<String, Map<String, String>> getConfigurations() {
-    return configurations;
-  }
-
-  @JsonProperty("configurations")
-  public void setConfigurations(Map<String, Map<String, String>> configurations) {
-    this.configurations = configurations;
-  }
-
-  @JsonProperty("commandParams")
-  public Map<String, String> getCommandParams() {
-    return commandParams;
-  }
-
-  @JsonProperty("commandParams")
-  public void setCommandParams(Map<String, String> commandParams) {
-    this.commandParams = commandParams;
-  }
-
-  @JsonProperty("serviceName")
-  public String getServiceName() {
-    return serviceName;
-  }
-
-  @JsonProperty("serviceName")
-  public void setServiceName(String serviceName) {
-    this.serviceName = serviceName;
-  }
-
-  @JsonProperty("componentName")
-  public String getComponentName() {
-    return componentName;
-  }
-
-  @JsonProperty("componentName")
-  public void setComponentName(String componentName) {
-    this.componentName = componentName;
-  }
-
-  @JsonProperty("package")
-  public String getPkg() {
-    return pkg;
-  }
-
-  @JsonProperty("package")
-  public void setPkg(String pkg) {
-    this.pkg = pkg;
-  }
-
-  @JsonProperty("componentConfig")
-  public Map<String, Map<String, String>> getComponentConfigurations() {
-    return componentConfigurations;
-  }
-
-  @JsonProperty("componentConfig")
-  public void setComponentConfigurations(
-      Map<String, Map<String, String>> componentConfigurations) {
-    this.componentConfigurations = componentConfigurations;
-  }
-
-  @JsonProperty("containers")
-  public List<DockerContainer> getContainers() {
-    return containers;
-  }
-
-  @JsonProperty("yarnDockerMode")
-  public boolean isYarnDockerMode() {
-    return yarnDockerMode ;
-  }
-
-  @JsonProperty("yarnDockerMode")
-  public void setYarnDockerMode(boolean yarnDockerMode) {
-    this.yarnDockerMode = yarnDockerMode;
-  }
-  @Override
-  public String toString() {
-    StringBuilder builder = new StringBuilder();
-    builder.append("ExecutionCommand [commandType=").append(commandType)
-        .append(", clusterName=").append(clusterName).append(", taskId=")
-        .append(taskId).append(", commandId=").append(commandId)
-        .append(", hostname=").append(hostname).append(", role=").append(role)
-        .append(", hostLevelParams=").append(hostLevelParams)
-        .append(", roleParams=").append(roleParams).append(", roleCommand=")
-        .append(roleCommand).append(", configurations=").append(configurations)
-        .append(", commandParams=").append(commandParams)
-        .append(", serviceName=").append(serviceName)
-        .append(", componentName=").append(componentName)
-        .append(", componentType=").append(componentType)
-        .append(", yarnDockerMode=").append(yarnDockerMode).append(", pkg=")
-        .append(pkg).append("]");
-    return builder.toString();
-  }
-  
-  public void addContainerDetails(String componentGroup, Metainfo metaInfo) {
-    Component component = metaInfo.getApplicationComponent(componentGroup);
-    this.setComponentType(component.getType());
-    log.info("Adding container details for {}", componentGroup, " from ",
-        metaInfo.toString());
-    for (DockerContainer metaContainer : component.getDockerContainers()) {
-      DockerContainer container = new DockerContainer();
-      container.setImage(metaContainer.getImage());
-      container.setNetwork(metaContainer.getNetwork());
-      container.setUseNetworkScript(metaContainer.getUseNetworkScript());
-      container.setName(metaContainer.getName());
-      container.setOptions(metaContainer.getOptions());
-      container.setAdditionalParam(metaContainer.getAdditionalParam());
-      container.setCommandPath(metaContainer.getAdditionalParam());
-      container.setStatusCommand(metaContainer.getStatusCommand());
-      container.setStartCommand(metaContainer.getStartCommand());
-      if (metaContainer.getMounts().size() > 0) {
-        for (DockerContainerMount metaContMount : metaContainer.getMounts()) {
-          DockerContainerMount contMnt = new DockerContainerMount();
-          contMnt.setContainerMount(metaContMount.getContainerMount());
-          contMnt.setHostMount(metaContMount.getHostMount());
-          container.getMounts().add(contMnt);
-        }
-      }
-      if (metaContainer.getPorts().size() > 0) {
-        for (DockerContainerPort metaCntPort : metaContainer.getPorts()) {
-          DockerContainerPort cntPort = new DockerContainerPort();
-          cntPort.setContainerPort(metaCntPort.getContainerPort());
-          cntPort.setHostPort(metaCntPort.getHostPort());
-          container.getPorts().add(cntPort);
-        }
-      }
-      if (metaContainer.getInputFiles().size() > 0) {
-        for (DockerContainerInputFile metaInpFile : metaContainer
-            .getInputFiles()) {
-          DockerContainerInputFile inpFile = new DockerContainerInputFile();
-          inpFile.setContainerMount(metaInpFile.getContainerMount());
-          inpFile.setFileLocalPath(metaInpFile.getFileLocalPath());
-          container.getInputFiles().add(inpFile);
-        }
-      }
-      if (metaContainer.getConfigFiles() != null) {
-        container.setConfigFiles(metaContainer.getConfigFiles());
-      }
-      log.info("Docker container meta info ready: " + container.toString());
-      this.getContainers().add(container);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/HeartBeat.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/HeartBeat.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/HeartBeat.java
deleted file mode 100644
index d17c465..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/HeartBeat.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- *
- * Data model for agent heartbeat for server (ambari or app master).
- *
- */
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class HeartBeat {
-  private long responseId = -1;
-  private long timestamp;
-  private String hostname;
-  List<CommandReport> reports = new ArrayList<CommandReport>();
-  List<ComponentStatus> componentStatus = new ArrayList<ComponentStatus>();
-  private List<DiskInfo> mounts = new ArrayList<DiskInfo>();
-  HostStatus nodeStatus;
-  private AgentEnv agentEnv = null;
-  private String fqdn;
-  private String pkg;
-
-  public long getResponseId() {
-    return responseId;
-  }
-
-  public void setResponseId(long responseId) {
-    this.responseId=responseId;
-  }
-
-  public long getTimestamp() {
-    return timestamp;
-  }
-
-  public void setTimestamp(long timestamp) {
-    this.timestamp = timestamp;
-  }
-
-  public String getHostname() {
-    return hostname;
-  }
-
-  public void setHostname(String hostname) {
-    this.hostname = hostname;
-  }
-
-  public String getFqdn() {
-    return fqdn;
-  }
-
-  public void setFqdn(String fqdn) {
-    this.fqdn = fqdn;
-  }
-
-  @JsonProperty("reports")
-  public List<CommandReport> getReports() {
-    return this.reports;
-  }
-
-  @JsonProperty("reports")
-  public void setReports(List<CommandReport> reports) {
-    this.reports = reports;
-  }
-
-  public HostStatus getNodeStatus() {
-    return nodeStatus;
-  }
-
-  public void setNodeStatus(HostStatus nodeStatus) {
-    this.nodeStatus = nodeStatus;
-  }
-
-  public AgentEnv getAgentEnv() {
-    return agentEnv;
-  }
-
-  public void setAgentEnv(AgentEnv env) {
-    agentEnv = env;
-  }
-
-  @JsonProperty("componentStatus")
-  public List<ComponentStatus> getComponentStatus() {
-    return componentStatus;
-  }
-
-  @JsonProperty("componentStatus")
-  public void setComponentStatus(List<ComponentStatus> componentStatus) {
-    this.componentStatus = componentStatus;
-  }
-
-  @JsonProperty("mounts")
-  public List<DiskInfo> getMounts() {
-    return this.mounts;
-  }
-
-  @JsonProperty("mounts")
-  public void setMounts(List<DiskInfo> mounts) {
-    this.mounts = mounts;
-  }
-
-  @JsonProperty("package")
-  public String getPackage() {
-    return pkg;
-  }
-
-  @JsonProperty("package")
-  public void setPackage(String pkg) {
-    this.pkg = pkg;
-  }
-
-  @Override
-  public String toString() {
-    return "HeartBeat{" +
-           "responseId=" + responseId +
-           ", timestamp=" + timestamp +
-           ", hostname='" + hostname + '\'' +
-           ", reports=" + reports +
-           ", componentStatus=" + componentStatus +
-           ", package=" + pkg +
-           ", nodeStatus=" + nodeStatus +
-           '}';
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/HeartBeatResponse.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/HeartBeatResponse.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/HeartBeatResponse.java
deleted file mode 100644
index b500d67..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/HeartBeatResponse.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- * Controller to Agent response data model.
- *
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class HeartBeatResponse {
-
-  private long responseId;
-
-  List<ExecutionCommand> executionCommands = new ArrayList<ExecutionCommand>();
-  List<StatusCommand> statusCommands = new ArrayList<StatusCommand>();
-
-  RegistrationCommand registrationCommand;
-
-  boolean yarnDockerMode = false;
-  boolean restartAgent = false;
-  boolean restartEnabled = true;
-  boolean hasMappedComponents = false;
-  boolean terminateAgent = false;
-
-  @JsonProperty("responseId")
-  public long getResponseId() {
-    return responseId;
-  }
-
-  @JsonProperty("responseId")
-  public void setResponseId(long responseId) {
-    this.responseId=responseId;
-  }
-
-  @JsonProperty("executionCommands")
-  public List<ExecutionCommand> getExecutionCommands() {
-    return executionCommands;
-  }
-
-  @JsonProperty("executionCommands")
-  public void setExecutionCommands(List<ExecutionCommand> executionCommands) {
-    this.executionCommands = executionCommands;
-  }
-
-  @JsonProperty("statusCommands")
-  public List<StatusCommand> getStatusCommands() {
-    return statusCommands;
-  }
-
-  @JsonProperty("statusCommands")
-  public void setStatusCommands(List<StatusCommand> statusCommands) {
-    this.statusCommands = statusCommands;
-  }
-
-  @JsonProperty("registrationCommand")
-  public RegistrationCommand getRegistrationCommand() {
-    return registrationCommand;
-  }
-
-  @JsonProperty("registrationCommand")
-  public void setRegistrationCommand(RegistrationCommand registrationCommand) {
-    this.registrationCommand = registrationCommand;
-  }
-
-  @JsonProperty("restartAgent")
-  public boolean isRestartAgent() {
-    return restartAgent;
-  }
-
-  @JsonProperty("restartAgent")
-  public void setRestartAgent(boolean restartAgent) {
-    this.restartAgent = restartAgent;
-  }
-
-  @JsonProperty("restartEnabled")
-  public boolean getRstartEnabled() {
-    return restartEnabled;
-  }
-
-  @JsonProperty("restartEnabled")
-  public void setRestartEnabled(boolean restartEnabled) {
-    this.restartEnabled = restartEnabled;
-  }
-
-  @JsonProperty("hasMappedComponents")
-  public boolean hasMappedComponents() {
-    return hasMappedComponents;
-  }
-
-  @JsonProperty("hasMappedComponents")
-  public void setHasMappedComponents(boolean hasMappedComponents) {
-    this.hasMappedComponents = hasMappedComponents;
-  }
-
-  @JsonProperty("terminateAgent")
-  public boolean isTerminateAgent() {
-    return terminateAgent;
-  }
-
-  @JsonProperty("terminateAgent")
-  public void setTerminateAgent(boolean terminateAgent) {
-    this.terminateAgent = terminateAgent;
-  }
-
-  public void addExecutionCommand(ExecutionCommand execCmd) {
-    executionCommands.add(execCmd);
-  }
-
-  public void addStatusCommand(StatusCommand statCmd) {
-    statusCommands.add(statCmd);
-  }
-
-  @Override
-  public String toString() {
-    return "HeartBeatResponse{" +
-           "responseId=" + responseId +
-           ", executionCommands=" + executionCommands +
-           ", statusCommands=" + statusCommands +
-           ", registrationCommand=" + registrationCommand +
-           ", restartAgent=" + restartAgent +
-           ", terminateAgent=" + terminateAgent +
-           '}';
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/HostInfo.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/HostInfo.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/HostInfo.java
deleted file mode 100644
index bef7b07..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/HostInfo.java
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class HostInfo {
-  private String architecture;
-  private String domain;
-  private String fqdn;
-  private String hardwareisa;
-  private String hardwaremodel;
-  private String hostname;
-  private String id;
-  private String interfaces;
-  private String ipaddress;
-  private String kernel;
-  private String kernelmajversion;
-  private String kernelrelease;
-  private String kernelversion;
-  private String macaddress;
-  private long memoryfree;
-  private long memorysize;
-  private List<DiskInfo> mounts = new ArrayList<DiskInfo>();
-  private long memorytotal;
-  private String netmask;
-  private String operatingsystem;
-  private String operatingsystemrelease;
-  private String osfamily;
-  private int physicalprocessorcount;
-  private int processorcount;
-  private boolean selinux;
-  private String swapfree;
-  private String swapsize;
-  private String timezone;
-  private String uptime;
-  private long uptime_days;
-  private long uptime_hours;
-
-
-  @JsonProperty("architecture")
-  public String getArchitecture() {
-    return this.architecture;
-  }
-
-  @JsonProperty("architecture")
-  public void setArchitecture(String architecture) {
-    this.architecture = architecture;
-  }
-
-  @JsonProperty("domain")
-  public String getDomain() {
-    return this.domain;
-  }
-
-  @JsonProperty("domain")
-  public void setDomain(String domain) {
-    this.domain = domain;
-  }
-
-  @JsonProperty("fqdn")
-  public String getFQDN() {
-    return this.fqdn;
-  }
-
-  @JsonProperty("fqdn")
-  public void setFQDN(String fqdn) {
-    this.fqdn = fqdn;
-  }
-
-  @JsonProperty("hardwareisa")
-  public String getHardwareIsa() {
-    return hardwareisa;
-  }
-
-  @JsonProperty("hardwareisa")
-  public void setHardwareIsa(String hardwareisa) {
-    this.hardwareisa = hardwareisa;
-  }
-
-  @JsonProperty("hardwaremodel")
-  public String getHardwareModel() {
-    return this.hardwaremodel;
-  }
-
-  @JsonProperty("hardwaremodel")
-  public void setHardwareModel(String hardwaremodel) {
-    this.hardwaremodel = hardwaremodel;
-  }
-
-  @JsonProperty("hostname")
-  public String getHostName() {
-    return this.hostname;
-  }
-
-  @JsonProperty("hostname")
-  public void setHostName(String hostname) {
-    this.hostname = hostname;
-  }
-
-  @JsonProperty("id")
-  public String getAgentUserId() {
-    return id;
-  }
-
-  @JsonProperty("id")
-  public void setAgentUserId(String id) {
-    this.id = id;
-  }
-
-  @JsonProperty("interfaces")
-  public String getInterfaces() {
-    return this.interfaces;
-  }
-
-  @JsonProperty("interfaces")
-  public void setInterfaces(String interfaces) {
-    this.interfaces = interfaces;
-  }
-
-  @JsonProperty("ipaddress")
-  public String getIPAddress() {
-    return this.ipaddress;
-  }
-
-  @JsonProperty("ipaddress")
-  public void setIPAddress(String ipaddress) {
-    this.ipaddress = ipaddress;
-  }
-
-  @JsonProperty("kernel")
-  public String getKernel() {
-    return this.kernel;
-  }
-
-  @JsonProperty("kernel")
-  public void setKernel(String kernel) {
-    this.kernel = kernel;
-  }
-
-  @JsonProperty("kernelmajversion")
-  public String getKernelMajVersion() {
-    return this.kernelmajversion;
-  }
-
-  @JsonProperty("kernelmajversion")
-  public void setKernelMajVersion(String kernelmajversion) {
-    this.kernelmajversion = kernelmajversion;
-  }
-
-  @JsonProperty("kernelrelease")
-  public String getKernelRelease() {
-    return this.kernelrelease;
-  }
-
-  @JsonProperty("kernelrelease")
-  public void setKernelRelease(String kernelrelease) {
-    this.kernelrelease = kernelrelease;
-  }
-
-  @JsonProperty("kernelversion")
-  public String getKernelVersion() {
-    return this.kernelversion;
-  }
-
-  @JsonProperty("kernelversion")
-  public void setKernelVersion(String kernelversion) {
-    this.kernelversion = kernelversion;
-  }
-
-  @JsonProperty("macaddress")
-  public String getMacAddress() {
-    return this.macaddress;
-  }
-
-  @JsonProperty("macaddress")
-  public void setMacAddress(String macaddress) {
-    this.macaddress = macaddress;
-  }
-
-  @JsonProperty("memoryfree")
-  public long getFreeMemory() {
-    return this.memoryfree;
-  }
-
-  @JsonProperty("memoryfree")
-  public void setFreeMemory(long memoryfree) {
-    this.memoryfree = memoryfree;
-  }
-
-  @JsonProperty("memorysize")
-  public long getMemorySize() {
-    return this.memorysize;
-  }
-
-  @JsonProperty("memorysize")
-  public void setMemorySize(long memorysize) {
-    this.memorysize = memorysize;
-  }
-
-  @JsonProperty("mounts")
-  public List<DiskInfo> getMounts() {
-    return this.mounts;
-  }
-
-  @JsonProperty("mounts")
-  public void setMounts(List<DiskInfo> mounts) {
-    this.mounts = mounts;
-  }
-
-  @JsonProperty("memorytotal")
-  public long getMemoryTotal() {
-    return this.memorytotal;
-  }
-
-  @JsonProperty("memorytotal")
-  public void setMemoryTotal(long memorytotal) {
-    this.memorytotal = memorytotal;
-  }
-
-  @JsonProperty("netmask")
-  public String getNetMask() {
-    return this.netmask;
-  }
-
-  @JsonProperty("netmask")
-  public void setNetMask(String netmask) {
-    this.netmask = netmask;
-  }
-
-  @JsonProperty("operatingsystem")
-  public String getOS() {
-    return this.operatingsystem;
-  }
-
-  @JsonProperty("operatingsystem")
-  public void setOS(String operatingsystem) {
-    this.operatingsystem = operatingsystem;
-  }
-
-  @JsonProperty("operatingsystemrelease")
-  public String getOSRelease() {
-    return this.operatingsystemrelease;
-  }
-
-  @JsonProperty("operatingsystemrelease")
-  public void setOSRelease(String operatingsystemrelease) {
-    this.operatingsystemrelease = operatingsystemrelease;
-  }
-
-  @JsonProperty("osfamily")
-  public String getOSFamily() {
-    return this.osfamily;
-  }
-
-  @JsonProperty("osfamily")
-  public void setOSFamily(String osfamily) {
-    this.osfamily = osfamily;
-  }
-
-  @JsonProperty("physicalprocessorcount")
-  public int getPhysicalProcessorCount() {
-    return this.physicalprocessorcount;
-  }
-
-  @JsonProperty("physicalprocessorcount")
-  public void setPhysicalProcessorCount(int physicalprocessorcount) {
-    this.physicalprocessorcount = physicalprocessorcount;
-  }
-
-  @JsonProperty("processorcount")
-  public int getProcessorCount() {
-    return this.processorcount;
-  }
-
-  @JsonProperty("processorcount")
-  public void setProcessorCount(int processorcount) {
-    this.processorcount = processorcount;
-  }
-
-  @JsonProperty("selinux")
-  public boolean getSeLinux() {
-    return selinux;
-  }
-
-  @JsonProperty("selinux")
-  public void setSeLinux(boolean selinux) {
-    this.selinux = selinux;
-  }
-
-  @JsonProperty("swapfree")
-  public String getSwapFree() {
-    return this.swapfree;
-  }
-
-  @JsonProperty("swapfree")
-  public void setSwapFree(String swapfree) {
-    this.swapfree = swapfree;
-  }
-
-  @JsonProperty("swapsize")
-  public String getSwapSize() {
-    return swapsize;
-  }
-
-  @JsonProperty("swapsize")
-  public void setSwapSize(String swapsize) {
-    this.swapsize = swapsize;
-  }
-
-  @JsonProperty("timezone")
-  public String getTimeZone() {
-    return this.timezone;
-  }
-
-  @JsonProperty("timezone")
-  public void setTimeZone(String timezone) {
-    this.timezone = timezone;
-  }
-
-  @JsonProperty("uptime")
-  public String getUptime() {
-    return this.uptime;
-  }
-
-  @JsonProperty("uptime")
-  public void setUpTime(String uptime) {
-    this.uptime = uptime;
-  }
-
-  @JsonProperty("uptime_hours")
-  public long getUptimeHours() {
-    return this.uptime_hours;
-  }
-
-  @JsonProperty("uptime_hours")
-  public void setUpTimeHours(long uptime_hours) {
-    this.uptime_hours = uptime_hours;
-  }
-
-  @JsonProperty("uptime_days")
-  public long getUpTimeDays() {
-    return this.uptime_days;
-  }
-
-  @JsonProperty("uptime_days")
-  public void setUpTimeDays(long uptime_days) {
-    this.uptime_days = uptime_days;
-  }
-
-  private String getDiskString() {
-    if (mounts == null) {
-      return null;
-    }
-    StringBuilder ret = new StringBuilder();
-    for (DiskInfo diskInfo : mounts) {
-      ret.append("(").append(diskInfo.toString()).append(")");
-    }
-    return ret.toString();
-  }
-
-  public String toString() {
-    return "[" +
-           "hostname=" + this.hostname + "," +
-           "fqdn=" + this.fqdn + "," +
-           "domain=" + this.domain + "," +
-           "architecture=" + this.architecture + "," +
-           "processorcount=" + this.processorcount + "," +
-           "physicalprocessorcount=" + this.physicalprocessorcount + "," +
-           "osname=" + this.operatingsystem + "," +
-           "osversion=" + this.operatingsystemrelease + "," +
-           "osfamily=" + this.osfamily + "," +
-           "memory=" + this.memorytotal + "," +
-           "uptime_hours=" + this.uptime_hours + "," +
-           "mounts=" + getDiskString() + "]\n";
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/HostStatus.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/HostStatus.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/HostStatus.java
deleted file mode 100644
index c584149..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/HostStatus.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- *
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class HostStatus {
-  public HostStatus(Status status, String cause) {
-    super();
-    this.status = status;
-    this.cause = cause;
-  }
-  public HostStatus() {
-    super();
-  }
-
-  public enum Status {
-    HEALTHY,
-    UNHEALTHY
-  }
-  Status status;
-  String cause;
-  public Status getStatus() {
-    return status;
-  }
-  public void setStatus(Status status) {
-    this.status = status;
-  }
-  public String getCause() {
-    return cause;
-  }
-  public void setCause(String cause) {
-    this.cause = cause;
-  }
-
-  @Override
-  public String toString() {
-    return "HostStatus{" +
-           "status=" + status +
-           ", cause='" + cause + '\'' +
-           '}';
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/Register.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/Register.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/Register.java
deleted file mode 100644
index 0150079..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/Register.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-import org.apache.slider.providers.agent.State;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.Map;
-
-/** Data model for agent to send heartbeat to ambari and/or app master. */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class Register {
-  private int responseId = -1;
-  private long timestamp;
-  private String label;
-  private int currentPingPort;
-  private HostInfo hardwareProfile;
-  private String publicHostname;
-  private String tags;
-  private AgentEnv agentEnv;
-  private String agentVersion;
-  private State actualState;
-  private State expectedState;
-  private Map<String, String> allocatedPorts;
-  private Map<String, String> logFolders;
-  private String pkg;
-  private String appVersion;
-
-  @JsonProperty("responseId")
-  public int getResponseId() {
-    return responseId;
-  }
-
-  @JsonProperty("responseId")
-  public void setResponseId(int responseId) {
-    this.responseId = responseId;
-  }
-
-  public long getTimestamp() {
-    return timestamp;
-  }
-
-  public void setTimestamp(long timestamp) {
-    this.timestamp = timestamp;
-  }
-
-  public String getLabel() {
-    return label;
-  }
-
-  public void setLabel(String label) {
-    this.label = label;
-  }
-
-  public String getTags() {
-    return tags;
-  }
-
-  public void setTags(String tags) {
-    this.tags = tags;
-  }
-
-  public HostInfo getHardwareProfile() {
-    return hardwareProfile;
-  }
-
-  public void setHardwareProfile(HostInfo hardwareProfile) {
-    this.hardwareProfile = hardwareProfile;
-  }
-
-  public String getPublicHostname() {
-    return publicHostname;
-  }
-
-  public void setPublicHostname(String name) {
-    this.publicHostname = name;
-  }
-
-  public AgentEnv getAgentEnv() {
-    return agentEnv;
-  }
-
-  public void setAgentEnv(AgentEnv env) {
-    this.agentEnv = env;
-  }
-
-  public String getAgentVersion() {
-    return agentVersion;
-  }
-
-  public void setAgentVersion(String agentVersion) {
-    this.agentVersion = agentVersion;
-  }
-
-  public int getCurrentPingPort() {
-    return currentPingPort;
-  }
-
-  public void setCurrentPingPort(int currentPingPort) {
-    this.currentPingPort = currentPingPort;
-  }
-
-  public State getActualState() {
-    return actualState;
-  }
-
-  public void setActualState(State actualState) {
-    this.actualState = actualState;
-  }
-
-  public State getExpectedState() {
-    return expectedState;
-  }
-
-  public void setExpectedState(State expectedState) {
-    this.expectedState = expectedState;
-  }
-
-  /** @return the allocated ports, or <code>null</code> if none are present */
-  @JsonProperty("allocatedPorts")
-  public Map<String, String> getAllocatedPorts() {
-    return allocatedPorts;
-  }
-
-  /** @param ports allocated ports */
-  @JsonProperty("allocatedPorts")
-  public void setAllocatedPorts(Map<String, String> ports) {
-    this.allocatedPorts = ports;
-  }
-
-  /** @return the log folders, or <code>null</code> if none are present */
-  @JsonProperty("logFolders")
-  public Map<String, String> getLogFolders() {
-    return logFolders;
-  }
-
-  /** @param logFolders assigned log folders */
-  @JsonProperty("logFolders")
-  public void setLogFolders(Map<String, String> logFolders) {
-    this.logFolders = logFolders;
-  }
-
-  public String getPkg() {
-    return pkg;
-  }
-
-  public void setPkg(String pkg) {
-    this.pkg = pkg;
-  }
-
-  @JsonProperty("appVersion")
-  public String getAppVersion() {
-    return appVersion;
-  }
-
-  @JsonProperty("appVersion")
-  public void setAppVersion(String appVersion) {
-    this.appVersion = appVersion;
-  }
-
-  @Override
-  public String toString() {
-    String ret = "responseId=" + responseId + "\n" +
-                 "timestamp=" + timestamp + "\n" +
-                 "label=" + label + "\n" +
-                 "hostname=" + publicHostname + "\n" +
-                 "expectedState=" + expectedState + "\n" +
-                 "actualState=" + actualState + "\n" +
-                 "appVersion=" + appVersion + "\n";
-
-    if (hardwareProfile != null) {
-      ret = ret + "hardwareprofile=" + this.hardwareProfile.toString();
-    }
-    return ret;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/RegistrationCommand.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/RegistrationCommand.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/RegistrationCommand.java
deleted file mode 100644
index 4b87dd2..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/RegistrationCommand.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- *
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class RegistrationCommand {
-
-  private String command;
-
-  public String getCommand() {
-    return command;
-  }
-
-  public void setCommand(String command) {
-    this.command = command;
-  }
-
-  public RegistrationCommand(String command) {
-
-    this.command = command;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/RegistrationResponse.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/RegistrationResponse.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/RegistrationResponse.java
deleted file mode 100644
index 80b7a5e..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/RegistrationResponse.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.List;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class RegistrationResponse {
-
-  @JsonProperty("response")
-  private RegistrationStatus response;
-
-  /**
-   * exitstatus is a code of error which was rised on server side. exitstatus
-   * = 0 (OK - Default) exitstatus = 1 (Registration failed because different
-   * version of agent and server)
-   */
-  @JsonProperty("exitstatus")
-  private int exitstatus;
-
-  /** log - message, which will be printed to agents log */
-  @JsonProperty("log")
-  private String log;
-
-  /** tags - tags associated with the container */
-  @JsonProperty("tags")
-  private String tags;
-  
-  @JsonProperty("package")
-  private String pkg;
-
-  //Response id to start with, usually zero.
-  @JsonProperty("responseId")
-  private long responseId;
-
-  @JsonProperty("statusCommands")
-  private List<StatusCommand> statusCommands = null;
-
-  public RegistrationResponse() {
-  }
-
-  public RegistrationStatus getResponse() {
-    return response;
-  }
-
-  public void setResponse(RegistrationStatus response) {
-    this.response = response;
-  }
-
-  public int getExitstatus() {
-    return exitstatus;
-  }
-
-  public void setExitstatus(int exitstatus) {
-    this.exitstatus = exitstatus;
-  }
-
-  public RegistrationStatus getResponseStatus() {
-    return response;
-  }
-
-  public void setResponseStatus(RegistrationStatus response) {
-    this.response = response;
-  }
-
-  public List<StatusCommand> getStatusCommands() {
-    return statusCommands;
-  }
-
-  public void setStatusCommands(List<StatusCommand> statusCommands) {
-    this.statusCommands = statusCommands;
-  }
-
-  public long getResponseId() {
-    return responseId;
-  }
-
-  public void setResponseId(long responseId) {
-    this.responseId = responseId;
-  }
-
-  public String getTags() {
-    return tags;
-  }
-
-  public void setTags(String tags) {
-    this.tags = tags;
-  }
-
-  public String getLog() {
-    return log;
-  }
-
-  public void setLog(String log) {
-    this.log = log;
-  }
-
-  public String getPkg() {
-    return pkg;
-  }
-
-  public void setPkg(String pkg) {
-    this.pkg = pkg;
-  }
-
-  @Override
-  public String toString() {
-    return "RegistrationResponse{" +
-           "response=" + response +
-           ", responseId=" + responseId +
-           ", statusCommands=" + statusCommands +
-           '}';
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/RegistrationStatus.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/RegistrationStatus.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/RegistrationStatus.java
deleted file mode 100644
index 8374710..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/RegistrationStatus.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-public enum RegistrationStatus {
-    OK,
-    FAILED
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/StatusCommand.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/StatusCommand.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/StatusCommand.java
deleted file mode 100644
index 5b205b5..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/StatusCommand.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Command to report the status of a list of services in roles.
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class StatusCommand {
-  public static String STATUS_COMMAND = "STATUS";
-  public static String GET_CONFIG_COMMAND = "GET_CONFIG";
-
-  AgentCommandType agentCommandType;
-
-  private String clusterName;
-  private String serviceName;
-  private String componentName;
-  private Map<String, Map<String, String>> configurations;
-  private Map<String, String> commandParams = new HashMap<String, String>();
-  private Map<String, String> hostLevelParams = new HashMap<String, String>();
-  private String roleCommand;
-  private boolean yarnDockerMode;
-
-  public StatusCommand() {
-    this.agentCommandType = AgentCommandType.STATUS_COMMAND;
-  }
-
-  @JsonProperty("clusterName")
-  public String getClusterName() {
-    return clusterName;
-  }
-
-  @JsonProperty("clusterName")
-  public void setClusterName(String clusterName) {
-    this.clusterName = clusterName;
-  }
-
-  @JsonProperty("serviceName")
-  public String getServiceName() {
-    return serviceName;
-  }
-
-  @JsonProperty("serviceName")
-  public void setServiceName(String serviceName) {
-    this.serviceName = serviceName;
-  }
-
-  @JsonProperty("componentName")
-  public String getComponentName() {
-    return componentName;
-  }
-
-  @JsonProperty("componentName")
-  public void setComponentName(String componentName) {
-    this.componentName = componentName;
-  }
-
-  @JsonProperty("configurations")
-  public Map<String, Map<String, String>> getConfigurations() {
-    return configurations;
-  }
-
-  @JsonProperty("configurations")
-  public void setConfigurations(Map<String, Map<String, String>> configurations) {
-    this.configurations = configurations;
-  }
-
-  @JsonProperty("hostLevelParams")
-  public Map<String, String> getHostLevelParams() {
-    return hostLevelParams;
-  }
-
-  @JsonProperty("hostLevelParams")
-  public void setHostLevelParams(Map<String, String> params) {
-    this.hostLevelParams = params;
-  }
-
-  @JsonProperty("commandParams")
-  public Map<String, String> getCommandParams() {
-    return commandParams;
-  }
-
-  @JsonProperty("commandParams")
-  public void setCommandParams(Map<String, String> commandParams) {
-    this.commandParams = commandParams;
-  }
-
-  @JsonProperty("commandType")
-  public AgentCommandType getCommandType() {
-    return agentCommandType;
-  }
-
-  @JsonProperty("commandType")
-  public void setCommandType(AgentCommandType commandType) {
-    this.agentCommandType = commandType;
-  }
-
-  @JsonProperty("roleCommand")
-  public String getRoleCommand() {
-    return roleCommand;
-  }
-
-  @JsonProperty("roleCommand")
-  public void setRoleCommand(String roleCommand) {
-    this.roleCommand = roleCommand;
-  }
-  
-  @JsonProperty("yarnDockerMode")
-  public boolean isYarnDockerMode() {
-    return yarnDockerMode;
-  }
-
-  @JsonProperty("yarnDockerMode")
-  public void setYarnDockerMode(boolean yarnDockerMode) {
-    this.yarnDockerMode = yarnDockerMode;
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder builder = new StringBuilder();
-    builder.append("StatusCommand [agentCommandType=").append(agentCommandType)
-        .append(", clusterName=").append(clusterName).append(", serviceName=")
-        .append(serviceName).append(", componentName=").append(componentName)
-        .append(", configurations=").append(configurations)
-        .append(", commandParams=").append(commandParams)
-        .append(", hostLevelParams=").append(hostLevelParams)
-        .append(", roleCommand=").append(roleCommand).append("]");
-    return builder.toString();
-  }
-}


[37/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/SliderKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/SliderKeys.java b/slider-core/src/main/java/org/apache/slider/common/SliderKeys.java
deleted file mode 100644
index 120b1fc..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/SliderKeys.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.common;
-
-
-/**
- * Keys and various constants for Slider
- */
-public interface SliderKeys extends SliderXmlConfKeys {
-
-  /**
-   * This is the name of the slider appmaster in configurations :{@value}
-   */
-  String COMPONENT_AM = "slider-appmaster";
-  
-  /**
-   * Slider role is "special":{@value}
-   */
-  int ROLE_AM_PRIORITY_INDEX = 0;
-  
-  
-  /**
-   * The path under which cluster and temp data are stored
-   * {@value}
-   */
-  String SLIDER_BASE_DIRECTORY = ".slider";
-
-  /**
-   * The paths under which Slider AM dependency libraries are stored
-   */
-  String SLIDER_DEPENDENCY_LOCALIZED_DIR_LINK = "slider_dep";
-  String SLIDER_DEPENDENCY_HDP_PARENT_DIR = "/hdp";
-  String SLIDER_DEPENDENCY_DIR = "/apps/%s/slider";
-  String SLIDER_DEPENDENCY_TAR_GZ_FILE_NAME = "slider";
-  String SLIDER_DEPENDENCY_TAR_GZ_FILE_EXT = ".tar.gz";
-  String SLIDER_DEPENDENCY_DIR_PERMISSIONS = "755";
-
-  /**
-   * 
-   */
-  String HDP_VERSION_PROP_NAME = "HDP_VERSION";
-
-  /**
-   *  name of the relative path to expaned an image into:  {@value}.
-   *  The title of this path is to help people understand it when
-   *  they see it in their error messages
-   */
-  String LOCAL_TARBALL_INSTALL_SUBDIR = "expandedarchive";
-
-
-  /**
-   * Application type for YARN  {@value}
-   */
-  String APP_TYPE = "org-apache-slider";
-
-  /**
-   * Key for component type. This MUST NOT be set in app_config/global {@value}
-   */
-  String COMPONENT_TYPE_KEY = "site.global.component_type";
-  /**
-   * A component type for an external app that has been predefined using the
-   * slider build command
-   */
-  String COMPONENT_TYPE_EXTERNAL_APP = "external_app";
-  String COMPONENT_SEPARATOR = "-";
-  String[] COMPONENT_KEYS_TO_SKIP = {"zookeeper.", "env.MALLOC_ARENA_MAX",
-      "site.fs.", "site.dfs."};
-
-  /**
-   * Key for application version. This must be set in app_config/global {@value}
-   */
-  String APP_VERSION = "site.global.app_version";
-  String APP_VERSION_UNKNOWN = "awaiting heartbeat...";
-
-  /**
-   * Keys for application container specific properties, like release timeout
-   */
-  String APP_CONTAINER_RELEASE_TIMEOUT = "site.global.app_container.release_timeout_secs";
-  int APP_CONTAINER_HEARTBEAT_INTERVAL_SEC = 10; // look for HEARTBEAT_IDDLE_INTERVAL_SEC
-
-  /**
-   * JVM arg to force IPv4  {@value}
-   */
-  String JVM_ENABLE_ASSERTIONS = "-ea";
-  
-  /**
-   * JVM arg enable JVM system/runtime {@value}
-   */
-  String JVM_ENABLE_SYSTEM_ASSERTIONS = "-esa";
-
-  /**
-   * JVM arg to force IPv4  {@value}
-   */
-  String JVM_FORCE_IPV4 = "-Djava.net.preferIPv4Stack=true";
-
-  /**
-   * JVM arg to go headless  {@value}
-   */
-
-  String JVM_JAVA_HEADLESS = "-Djava.awt.headless=true";
-
-  /**
-   * This is the name of the dir/subdir containing
-   * the hbase conf that is propagated via YARN
-   *  {@value}
-   */
-  String PROPAGATED_CONF_DIR_NAME = "propagatedconf";
-  String INFRA_DIR_NAME = "infra";
-  String GENERATED_CONF_DIR_NAME = "generated";
-  String SNAPSHOT_CONF_DIR_NAME = "snapshot";
-  String DATA_DIR_NAME = "database";
-  String HISTORY_DIR_NAME = "history";
-  String HISTORY_FILENAME_SUFFIX = "json";
-  String HISTORY_FILENAME_PREFIX = "rolehistory-";
-  String KEYTAB_DIR = "keytabs";
-  String RESOURCE_DIR = "resources";
-
-  /**
-   * Filename pattern is required to save in strict temporal order.
-   * Important: older files must sort less-than newer files when using
-   * case-sensitive name sort.
-   */
-  String HISTORY_FILENAME_CREATION_PATTERN = HISTORY_FILENAME_PREFIX +"%016x."+
-                                    HISTORY_FILENAME_SUFFIX;
-  /**
-   * The posix regexp used to locate this 
-   */
-  String HISTORY_FILENAME_MATCH_PATTERN = HISTORY_FILENAME_PREFIX +"[0-9a-f]+\\."+
-                                    HISTORY_FILENAME_SUFFIX;
-    /**
-   * The posix regexp used to locate this 
-   */
-  String HISTORY_FILENAME_GLOB_PATTERN = HISTORY_FILENAME_PREFIX +"*."+
-                                    HISTORY_FILENAME_SUFFIX;
-  /**
-   * XML resource listing the standard Slider providers
-   * {@value}
-   */
-  String SLIDER_XML = "org/apache/slider/slider.xml";
-  
-  String CLUSTER_DIRECTORY = "cluster";
-
-  String PACKAGE_DIRECTORY = "package";
-
-  /**
-   * JVM property to define the slider configuration directory;
-   * this is set by the slider script: {@value}
-   */
-  String PROPERTY_CONF_DIR = "slider.confdir";
-
-  /**
-   * JVM property to define the slider lib directory;
-   * this is set by the slider script: {@value}
-   */
-  String PROPERTY_LIB_DIR = "slider.libdir";
-
-  /**
-   * name of generated dir for this conf: {@value}
-   */
-  String SUBMITTED_CONF_DIR = "confdir";
-
-  /**
-   * Slider AM log4j file name : {@value}
-   */
-  String LOG4J_SERVER_PROP_FILENAME = "log4j-server.properties";
-
-  /**
-   * Standard log4j file name  : {@value}
-   */
-  String LOG4J_PROP_FILENAME = "log4j.properties";
-
-  /**
-   * Log4j sysprop to name the resource :{@value}
-   */
-  String SYSPROP_LOG4J_CONFIGURATION = "log4j.configuration";
-
-  /**
-   * sysprop for Slider AM log4j directory :{@value}
-   */
-  String SYSPROP_LOG_DIR = "LOG_DIR";
-
-  /**
-   * name of the Slider client resource
-   * loaded when the service is loaded.
-   */
-  String SLIDER_CLIENT_XML = "slider-client.xml";
-
-  /**
-   * The name of the resource to put on the classpath
-   */
-  String SLIDER_SERVER_XML = "slider-server.xml";
-
-  String TMP_LOGDIR_PREFIX = "/tmp/slider-";
-  String TMP_DIR_PREFIX = "tmp";
-  String AM_DIR_PREFIX = "appmaster";
-
-  /**
-   * Store the default app definition, e.g. metainfo file or content of a folder
-   */
-  String APP_DEF_DIR = "appdef";
-  /**
-   * Store additional app defs - co-processors
-   */
-  String ADDONS_DIR = "addons";
-
-  String SLIDER_JAR = "slider.jar";
-  String JCOMMANDER_JAR = "jcommander.jar";
-  String GSON_JAR = "gson.jar";
-  String AGENT_TAR = "slider-agent.tar.gz";
-  String DEFAULT_APP_PKG = "appPkg.zip";
-
-  String DEFAULT_JVM_HEAP = "256M";
-  int DEFAULT_YARN_MEMORY = 256;
-  String STDOUT_AM = "slider-out.txt";
-  String STDERR_AM = "slider-err.txt";
-  String DEFAULT_GC_OPTS = "";
-
-  String HADOOP_USER_NAME = "HADOOP_USER_NAME";
-  String HADOOP_PROXY_USER = "HADOOP_PROXY_USER";
-  String SLIDER_PASSPHRASE = "SLIDER_PASSPHRASE";
-
-  boolean PROPAGATE_RESOURCE_OPTION = true;
-
-  /**
-   * Security associated keys.
-   */
-  String SECURITY_DIR = "security";
-  String CRT_FILE_NAME = "ca.crt";
-  String CSR_FILE_NAME = "ca.csr";
-  String KEY_FILE_NAME = "ca.key";
-  String KEYSTORE_FILE_NAME = "keystore.p12";
-  String CRT_PASS_FILE_NAME = "pass.txt";
-  String PASS_LEN = "50";
-
-  String COMP_STORES_REQUIRED_KEY =
-      "slider.component.security.stores.required";
-  String COMP_KEYSTORE_PASSWORD_PROPERTY_KEY =
-      "slider.component.keystore.password.property";
-  String COMP_KEYSTORE_PASSWORD_ALIAS_KEY =
-      "slider.component.keystore.credential.alias.property";
-  String COMP_KEYSTORE_PASSWORD_ALIAS_DEFAULT =
-      "component.keystore.credential.alias";
-  String COMP_TRUSTSTORE_PASSWORD_PROPERTY_KEY =
-      "slider.component.truststore.password.property";
-  String COMP_TRUSTSTORE_PASSWORD_ALIAS_KEY =
-      "slider.component.truststore.credential.alias.property";
-  String COMP_TRUSTSTORE_PASSWORD_ALIAS_DEFAULT =
-      "component.truststore.credential.alias";
-
-  /**
-   * Python specific
-   */
-  String PYTHONPATH = "PYTHONPATH";
-
-
-  /**
-   * Name of the AM filter to use: {@value}
-   */
-  String AM_FILTER_NAME =
-      "org.apache.hadoop.yarn.server.webproxy.amfilter.AmFilterInitializer";
-
-  /**
-   * Allowed port range. This MUST be set in app_conf/global.
-   * {@value}
-   */
-  String KEY_ALLOWED_PORT_RANGE = "site.global.slider.allowed.ports";
-
-  /**
-   * env var for custom JVM options.
-   */
-  String SLIDER_JVM_OPTS = "SLIDER_JVM_OPTS";
-
-  String SLIDER_CLASSPATH_EXTRA = "SLIDER_CLASSPATH_EXTRA";
-  String YARN_CONTAINER_PATH = "/node/container/";
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/SliderXMLConfKeysForTesting.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/SliderXMLConfKeysForTesting.java b/slider-core/src/main/java/org/apache/slider/common/SliderXMLConfKeysForTesting.java
deleted file mode 100644
index 61c828e..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/SliderXMLConfKeysForTesting.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common;
-
-/**
- * Keys shared across tests
- */
-public interface SliderXMLConfKeysForTesting {
-  
-  String KEY_TEST_THAW_WAIT_TIME = "slider.test.thaw.wait.seconds";
-
-  int DEFAULT_THAW_WAIT_TIME_SECONDS = 60;
-
-
-  String KEY_TEST_FREEZE_WAIT_TIME = "slider.test.freeze.wait.seconds";
-
-  int DEFAULT_TEST_FREEZE_WAIT_TIME_SECONDS = 60;
-
-  String KEY_TEST_TIMEOUT = "slider.test.timeout.seconds";
-
-  int DEFAULT_TEST_TIMEOUT_SECONDS = 30 * 60;
-
-  String KEY_ACCUMULO_LAUNCH_TIME =
-    "slider.test.accumulo.launch.wait.seconds";
-  int DEFAULT_ACCUMULO_LAUNCH_TIME_SECONDS = 60 * 3;
-
-  String KEY_ACCUMULO_GO_LIVE_TIME =
-      "slider.test.accumulo.live.wait.seconds";
-  int DEFAULT_ACCUMULO_LIVE_TIME_SECONDS = 90;
-
-  String KEY_TEST_AGENT_ENABLED = "slider.test.agent.enabled";
-  String KEY_AGENTTESTS_QUEUE_LABELED_DEFINED = "slider.test.agent.labeled.queue.enabled";
-  String KEY_AGENTTESTS_LABELS_RED_BLUE_DEFINED = "slider.test.agent.labels.defined";
-  String KEY_AGENTTESTS_AM_FAILURES_ENABLED = "slider.test.agent.am.failures.enabled";
-
-  int DEFAULT_AGENT_LAUNCH_TIME_SECONDS = 60 * 3;
-
-  String KEY_TEST_AGENT_HOME = "slider.test.agent.home";
-  String KEY_TEST_AGENT_TAR = "slider.test.agent.tar";
-
-  String KEY_TEST_TEARDOWN_KILLALL = "slider.test.teardown.killall";
-  boolean DEFAULT_TEARDOWN_KILLALL = true;
-
-
-  /**
-   * Key for amount of RAM to request
-   */
-  String KEY_TEST_YARN_RAM_REQUEST = "slider.test.yarn.ram";
-  String DEFAULT_YARN_RAM_REQUEST = "192";
-
-  /**
-   * security related keys
-   */
-  String TEST_SECURITY_DIR = "/tmp/work/security";
-
-  /**
-   * Local path to AM keytab: {@value}
-   */
-  String KEY_TEST_AM_KEYTAB = "slider.test.am.keytab.local";
-
-  /**
-   * Is the test cluster windows? Default is: same as the local system.
-   *  {@value}
-   */
-  String KEY_TEST_WINDOWS_CLUSTER = "slider.test.windows.cluster";
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java b/slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java
deleted file mode 100644
index 72dd44f..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common;
-
-import org.apache.hadoop.registry.client.api.RegistryConstants;
-
-/**
- * These are the keys that can be added to <code>conf/slider-client.xml</code>.
- */
-public interface SliderXmlConfKeys {
-  String PREFIX_PROVIDER = "slider.provider";
-  /**
-   * pattern to identify a provider
-   * {@value}
-   */
-  String KEY_PROVIDER = PREFIX_PROVIDER + ".%s";
-
-  /**
-   * conf option set to point to where the config came from
-   * {@value}
-   */
-  String KEY_TEMPLATE_ORIGIN = "slider.template.origin";
-
-  /**
-   * Original name for the default FS. This is still 
-   * expected by applications deployed
-   */
-  String FS_DEFAULT_NAME_CLASSIC = "fs.default.name";
-
-  /**
-   * Slider principal
-   */
-  String KEY_KERBEROS_PRINCIPAL = "slider.kerberos.principal";
-
-  /**
-   * Name of the property for ACLs for Slider AM.
-   * {@value}
-   */
-  String KEY_PROTOCOL_ACL = "slider.security.protocol.acl";
-
-  /**
-   * Limit on restarts for the AM
-   * {@value}
-   */
-  String KEY_AM_RESTART_LIMIT = "slider.yarn.restart.limit";
-
-  /**
-   * queue name, by default let YARN pick the queue
-   */
-  String KEY_YARN_QUEUE = "slider.yarn.queue";
-  String DEFAULT_YARN_QUEUE = null;
-
-  /**
-   * default priority
-   */
-  String KEY_YARN_QUEUE_PRIORITY = "slider.yarn.queue.priority";
-  int DEFAULT_YARN_QUEUE_PRIORITY = 1;
-
-
-  /**
-   * The slider base path: {@value}
-   * Defaults to HomeDir/.slider
-   */
-  String KEY_SLIDER_BASE_PATH = "slider.base.path";
-
-
-  /**
-   * Option for the permissions for the cluster directory itself: {@value}
-   */
-  String CLUSTER_DIRECTORY_PERMISSIONS =
-    "slider.cluster.directory.permissions";
-
-  /**
-   * Default value for the permissions :{@value}
-   */
-  String DEFAULT_CLUSTER_DIRECTORY_PERMISSIONS = "750";
-
-  /**
-   * 
-   * Option for the permissions for the data directory itself: {@value}
-   */
-  String DATA_DIRECTORY_PERMISSIONS = "slider.data.directory.permissions";
-
-  /**
-   * Default value for the data directory permissions: {@value}
-   */
-  String DEFAULT_DATA_DIRECTORY_PERMISSIONS = "750";
-
-  /**
-   *
-   * Use {@link RegistryConstants#KEY_REGISTRY_ZK_ROOT}
-   *
-   */
-  @Deprecated
-  String REGISTRY_PATH = "slider.registry.path";
-
-  /**
-   * 
-   * @Deprecated use {@link RegistryConstants#KEY_REGISTRY_ZK_QUORUM}
-   * 
-   */
-  @Deprecated
-  String REGISTRY_ZK_QUORUM = "slider.zookeeper.quorum";
-
-
-  String IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH =
-      "ipc.client.fallback-to-simple-auth-allowed";
-  String HADOOP_HTTP_FILTER_INITIALIZERS =
-      "hadoop.http.filter.initializers";
-  String KEY_KEYSTORE_LOCATION = "ssl.server.keystore.location";
-  String KEY_AM_LOGIN_KEYTAB_NAME = "slider.am.login.keytab.name";
-  /** Declare that a keytab must be provided */
-  String KEY_AM_LOGIN_KEYTAB_REQUIRED = "slider.am.login.keytab.required";
-  String KEY_HDFS_KEYTAB_DIR = "slider.hdfs.keytab.dir";
-  String KEY_AM_KEYTAB_LOCAL_PATH = "slider.am.keytab.local.path";
-  String KEY_KEYTAB_PRINCIPAL = "slider.keytab.principal.name";
-  String KEY_SECURITY_ENABLED = "site.global.security_enabled";
-
-  /**
-   * Set to disable server-side checks for python, openssl &c.
-   * This should only be set for testing
-   */
-  String KEY_SLIDER_AM_DEPENDENCY_CHECKS_DISABLED =
-      "slider.am.dependency.checks.disabled";
-
-  /**
-   * The path to the python executable utilized to launch the agent.
-   */
-  String PYTHON_EXECUTABLE_PATH = "agent.python.exec.path";
-
-  /**
-   * Flag to enable the insecure AM filter: {@value}
-   */
-  String X_DEV_INSECURE_WS = "slider.feature.ws.insecure";
-
-  /**
-   * Flag to indicate the insecure AM filter is enabled by default: {@value}.
-   */
-  boolean X_DEV_INSECURE_DEFAULT = false;
-
-
-  /**
-   * Flag to indicate the insecure AM filter is required for
-   * complex REST Verbs: {@value}.
-   * When Slider switches to being Hadoop 2.7+ only, this flag
-   * can be set to false
-   */
-  boolean X_DEV_INSECURE_REQUIRED = true;
-
-  /**
-   *
-   */
-  String KEY_IPC_CLIENT_RETRY_POLICY_ENABLED =
-      "slider.ipc.client.retry.enabled";
-  boolean IPC_CLIENT_RETRY_POLICY_ENABLED_DEFAULT = true;
-  String KEY_IPC_CLIENT_RETRY_POLICY_SPEC =
-      "slider.ipc.client.retry.policy.spec";
-  String IPC_CLIENT_RETRY_POLICY_SPEC_DEFAULT =
-      "10000,6,60000,10"; //t1,n1,t2,n2,... 
-
-  String KEY_AM_LAUNCH_ENV = "slider.am.launch.env";
-
-  /**
-   * From {@code DFSConfigKeys.DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY}
-   */
-  String DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY = "dfs.namenode.kerberos.principal";
-
-  String DFS_DATANODE_KERBEROS_PRINCIPAL_KEY = "dfs.datanode.kerberos.principal";
-
-  //Delegation token related keys
-  String DFS_NAMENODE_DELEGATION_KEY_UPDATE_INTERVAL_KEY
-      = "dfs.namenode.delegation.key.update-interval";
-  long DFS_NAMENODE_DELEGATION_KEY_UPDATE_INTERVAL_DEFAULT = 24 * 60 * 60 *
-      1000; // 1 day
-  String DFS_NAMENODE_DELEGATION_TOKEN_RENEW_INTERVAL_KEY
-      = "dfs.namenode.delegation.token.renew-interval";
-  long DFS_NAMENODE_DELEGATION_TOKEN_RENEW_INTERVAL_DEFAULT = 24 * 60 * 60 *
-      1000;  // 1 day
-  String DFS_NAMENODE_DELEGATION_TOKEN_MAX_LIFETIME_KEY
-      = "dfs.namenode.delegation.token.max-lifetime";
-  long DFS_NAMENODE_DELEGATION_TOKEN_MAX_LIFETIME_DEFAULT = 7 * 24 * 60 * 60 *
-      1000; // 7 days
-  String DFS_NAMENODE_DELEGATION_TOKEN_ALWAYS_USE_KEY
-      = "dfs.namenode.delegation.token.always-use"; // for tests
-  boolean DFS_NAMENODE_DELEGATION_TOKEN_ALWAYS_USE_DEFAULT = false;
-  String DFS_NAMENODE_KEYTAB_FILE_KEY = "dfs.namenode.keytab.file";
-  String DFS_NAMENODE_DU_RESERVED_KEY = "dfs.namenode.resource.du.reserved";
-
-  String MAPREDUCE_JOB_CREDENTIALS_BINARY = "mapreduce.job.credentials.binary";
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java
deleted file mode 100644
index e3cb288..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import org.apache.hadoop.fs.Path;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.ErrorStrings;
-import org.apache.slider.core.exceptions.UsageException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Base args for all actions
- */
-public abstract class AbstractActionArgs extends ArgOps implements Arguments {
-  protected static final Logger log =
-    LoggerFactory.getLogger(AbstractActionArgs.class);
-
-
-  protected AbstractActionArgs() {
-  }
-
-  /**
-   * URI/binding to the filesystem
-   */
-  @Parameter(names = {ARG_FILESYSTEM, ARG_FILESYSTEM_LONG},
-             description = "Filesystem Binding")
-  public String filesystemBinding;
-
-  @Parameter(names = {ARG_BASE_PATH},
-             description = "Slider base path on the filesystem",
-             converter =  PathArgumentConverter.class)
-  public Path basePath;
-
-  /**
-   * This is the default parameter
-   */
-  @Parameter
-  public final List<String> parameters = new ArrayList<>();
-
-  /**
-   * get the name: relies on arg 1 being the cluster name in all operations 
-   * @return the name argument, null if there is none
-   */
-  public String getClusterName() {
-    return (parameters.isEmpty()) ? null : parameters.get(0);
-  }
-
-  /**
-   -D name=value
-
-   Define an HBase configuration option which overrides any options in
-   the configuration XML files of the image or in the image configuration
-   directory. The values will be persisted.
-   Configuration options are only passed to the cluster when creating or reconfiguring a cluster.
-
-   */
-
-  @Parameter(names = ARG_DEFINE, arity = 1, description = "Definitions")
-  public final List<String> definitions = new ArrayList<>();
-
-  /**
-   * System properties
-   */
-  @Parameter(names = {ARG_SYSPROP}, arity = 1,
-             description = "system properties in the form name value" +
-                           " These are set after the JVM is started.")
-  public final List<String> sysprops = new ArrayList<>(0);
-
-
-  @Parameter(names = {ARG_MANAGER_SHORT, ARG_MANAGER},
-             description = "Binding (usually hostname:port) of the YARN resource manager")
-  public String manager;
-
-
-  @Parameter(names = ARG_DEBUG, description = "Debug mode")
-  public boolean debug = false;
-
-  @Parameter(names = {ARG_HELP}, description = "Help", help = true)
-  public boolean help = false;
-
-  /**
-   * Get the min #of params expected
-   * @return the min number of params in the {@link #parameters} field
-   */
-  public int getMinParams() {
-    return 1;
-  }
-
-  /**
-   * Get the name of the action
-   * @return the action name
-   */
-  public abstract String getActionName() ;
-
-  /**
-   * Get the max #of params expected
-   * @return the number of params in the {@link #parameters} field;
-   */
-  public int getMaxParams() {
-    return getMinParams();
-  }
-
-  public void validate() throws BadCommandArgumentsException, UsageException {
-    
-    int minArgs = getMinParams();
-    int actionArgSize = parameters.size();
-    if (minArgs > actionArgSize) {
-      throw new BadCommandArgumentsException(
-        ErrorStrings.ERROR_NOT_ENOUGH_ARGUMENTS + getActionName() +
-        " Expected minimum " + minArgs + " but got " + actionArgSize);
-    }
-    int maxArgs = getMaxParams();
-    if (maxArgs == -1) {
-      maxArgs = minArgs;
-    }
-    if (actionArgSize > maxArgs) {
-      String message = String.format("%s for action %s: limit is %d but saw %d: ",
-                                     ErrorStrings.ERROR_TOO_MANY_ARGUMENTS,
-                                     getActionName(), maxArgs,
-                                     actionArgSize);
-      
-      log.error(message);
-      int index = 1;
-      for (String actionArg : parameters) {
-        log.error("[{}] \"{}\"", index++, actionArg);
-        message += " \"" + actionArg + "\" ";
-      }
-      throw new BadCommandArgumentsException(message);
-    }
-  }
-
-  @Override
-  public String toString() {
-    return super.toString() + ": " + getActionName();
-  }
-
-  /**
-   * Override point: 
-   * Flag to indicate that core hadoop API services are needed (HDFS, YARN, etc)
-   * \u2014and that validation of the client state should take place.
-   * 
-   * @return a flag to indicate that the core hadoop services will be needed.
-   */
-  public boolean getHadoopServicesRequired() {
-    return true;
-  }
-
-  /**
-   * Flag to disable secure login.
-   * This MUST only be set if the action is bypassing security or setting
-   * it itself
-   * @return true if login at slider client init time is to be skipped
-   */
-  public boolean disableSecureLogin() {
-    return false;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/AbstractArgsDelegate.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/AbstractArgsDelegate.java b/slider-core/src/main/java/org/apache/slider/common/params/AbstractArgsDelegate.java
deleted file mode 100644
index 23ba414..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/AbstractArgsDelegate.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-
-/**
- * Base class for all the delegates
- */
-public class AbstractArgsDelegate extends ArgOps implements Arguments {
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java
deleted file mode 100644
index 2a5eedc..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.ParametersDelegate;
-import com.google.common.annotations.VisibleForTesting;
-import org.apache.hadoop.fs.Path;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.providers.SliderProviderFactory;
-
-import java.io.File;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Abstract Action to build things; shares args across build and
- * list
- */
-public abstract class AbstractClusterBuildingActionArgs extends
-    AbstractActionArgs {
-
-  /**
-   * Declare the image configuration directory to use when creating or
-   * reconfiguring a slider cluster. The path must be on a filesystem visible
-   * to all nodes in the YARN cluster. Only one configuration directory can
-   * be specified.
-   */
-  @Parameter(names = ARG_CONFDIR,
-      description = "Path to cluster configuration directory in HDFS",
-      converter = PathArgumentConverter.class)
-  public Path confdir;
-
-  @Parameter(names = ARG_ZKPATH,
-      description = "Zookeeper path for the application")
-  public String appZKPath;
-
-  @Parameter(names = ARG_ZKHOSTS,
-      description = "comma separated list of the Zookeeper hosts")
-  public String zkhosts;
-
-  /**
-   * --image path
-   * the full path to a .tar or .tar.gz path containing an HBase image.
-   */
-  @Parameter(names = ARG_IMAGE,
-      description = "The full path to a .tar or .tar.gz path containing the application",
-      converter = PathArgumentConverter.class)
-  public Path image;
-
-  @Parameter(names = ARG_APP_HOME,
-      description = "Home directory of a pre-installed application")
-  public String appHomeDir;
-
-  @Parameter(names = ARG_PROVIDER,
-      description = "Provider of the specific cluster application")
-  public String provider = SliderProviderFactory.DEFAULT_CLUSTER_TYPE;
-
-  @Parameter(names = {ARG_PACKAGE},
-      description = "URI to a slider package")
-  public String packageURI;
-
-  @Parameter(names = {ARG_RESOURCES},
-      description = "File defining the resources of this instance")
-  public File resources;
-
-  @Parameter(names = {ARG_TEMPLATE},
-      description = "Template application configuration")
-  public File template;
-
-  @Parameter(names = {ARG_METAINFO},
-      description = "Application meta info file")
-  public File appMetaInfo;
-
-  @Parameter(names = {ARG_METAINFO_JSON},
-      description = "Application meta info JSON blob")
-  public String appMetaInfoJson;
-
-  @Parameter(names = {ARG_APPDEF},
-      description = "Application def (folder or a zip package)")
-  public File appDef;
-
-  @Parameter(names = {ARG_QUEUE},
-             description = "Queue to submit the application")
-  public String queue;
-
-  @ParametersDelegate
-  public ComponentArgsDelegate componentDelegate = new ComponentArgsDelegate();
-
-  @ParametersDelegate
-  public AddonArgsDelegate addonDelegate = new AddonArgsDelegate();
-
-
-  @ParametersDelegate
-  public AppAndResouceOptionArgsDelegate optionsDelegate =
-      new AppAndResouceOptionArgsDelegate();
-
-
-  public Map<String, String> getOptionsMap() throws
-      BadCommandArgumentsException {
-    return optionsDelegate.getOptionsMap();
-  }
-
-  /**
-   * Get the role heap mapping (may be empty, but never null)
-   * @return role heap mapping
-   * @throws BadCommandArgumentsException parse problem
-   */
-  public Map<String, Map<String, String>> getCompOptionMap() throws
-      BadCommandArgumentsException {
-    return optionsDelegate.getCompOptionMap();
-  }
-
-
-  public Map<String, String> getResourceOptionsMap() throws
-      BadCommandArgumentsException {
-    return optionsDelegate.getResourceOptionsMap();
-  }
-
-  /**
-   * Get the role heap mapping (may be empty, but never null)
-   * @return role heap mapping
-   * @throws BadCommandArgumentsException parse problem
-   */
-  public Map<String, Map<String, String>> getResourceCompOptionMap() throws
-      BadCommandArgumentsException {
-    return optionsDelegate.getResourceCompOptionMap();
-  }
-
-  @VisibleForTesting
-  public List<String> getComponentTuples() {
-    return componentDelegate.getComponentTuples();
-  }
-
-  /**
-   * Get the role mapping (may be empty, but never null)
-   * @return role mapping
-   * @throws BadCommandArgumentsException parse problem
-   */
-  public Map<String, String> getComponentMap() throws
-      BadCommandArgumentsException {
-    return componentDelegate.getComponentMap();
-  }
-
-  @VisibleForTesting
-  public List<String> getAddonTuples() {
-    return addonDelegate.getAddonTuples();
-  }
-
-  /**
-   * Get the list of addons (may be empty, but never null)
-   */
-  public Map<String, String> getAddonMap() throws
-      BadCommandArgumentsException {
-    return addonDelegate.getAddonMap();
-  }
-
-  public Path getConfdir() {
-    return confdir;
-  }
-
-  public String getAppZKPath() {
-    return appZKPath;
-  }
-
-  public String getZKhosts() {
-    return zkhosts;
-  }
-
-  public Path getImage() {
-    return image;
-  }
-
-  public String getAppHomeDir() {
-    return appHomeDir;
-  }
-
-  public String getProvider() {
-    return provider;
-  }
-
-  public ConfTree buildAppOptionsConfTree() throws
-      BadCommandArgumentsException {
-    return buildConfTree(getOptionsMap());
-  }
-
-  public ConfTree buildResourceOptionsConfTree() throws
-      BadCommandArgumentsException {
-    return buildConfTree(getResourceOptionsMap());
-  }
-
-  protected ConfTree buildConfTree(Map<String, String> optionsMap) throws
-      BadCommandArgumentsException {
-    ConfTree confTree = new ConfTree();
-    ConfTreeOperations ops = new ConfTreeOperations(confTree);
-    confTree.global.putAll(optionsMap);
-    return confTree;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionAMSuicideArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionAMSuicideArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionAMSuicideArgs.java
deleted file mode 100644
index 5b4cfdc..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionAMSuicideArgs.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-
-@Parameters(commandNames = {SliderActions.ACTION_AM_SUICIDE},
-            commandDescription = SliderActions.DESCRIBE_ACTION_AM_SUICIDE)
-public class ActionAMSuicideArgs extends AbstractActionArgs {
-  
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_AM_SUICIDE;
-  }
-  
-  @Parameter(names = {ARG_MESSAGE},
-             description = "reason for the action")
-  public String message = "";
-  
-  @Parameter(names = {ARG_EXITCODE},
-             description = "exit code")
-  public int exitcode = 1;
-
-  @Parameter(names = {ARG_WAIT},
-             description = "time for AM to wait before exiting")
-  public int waittime = 1000;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionBuildArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionBuildArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionBuildArgs.java
deleted file mode 100644
index 1a182d1..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionBuildArgs.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameters;
-
-@Parameters(commandNames = {SliderActions.ACTION_BUILD},
-            commandDescription = SliderActions.DESCRIBE_ACTION_BUILD)
-
-public class ActionBuildArgs extends AbstractClusterBuildingActionArgs {
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_BUILD;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionClientArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionClientArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionClientArgs.java
deleted file mode 100644
index 85d39ea..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionClientArgs.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-
-import java.io.File;
-
-@Parameters(commandNames = {SliderActions.ACTION_CLIENT},
-    commandDescription = SliderActions.DESCRIBE_ACTION_CLIENT)
-
-public class ActionClientArgs extends AbstractActionArgs {
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_CLIENT;
-  }
-
-  @Parameter(names = {ARG_INSTALL},
-      description = "Install client")
-  public boolean install;
-
-  @Parameter(names = {ARG_GETCERTSTORE},
-      description = "Get a certificate store")
-  public boolean getCertStore;
-
-  @Parameter(names = {ARG_KEYSTORE},
-      description = "Retrieve keystore to specified location")
-  public File keystore;
-
-  @Parameter(names = {ARG_TRUSTSTORE},
-      description = "Retrieve truststore to specified location")
-  public File truststore;
-
-  @Parameter(names = {ARG_HOSTNAME},
-      description = "(Optional) Specify the hostname to use for generation of keystore certificate")
-  public String hostname;
-
-  @Parameter(names = {ARG_NAME},
-      description = "The name of the application")
-  public String name;
-
-  @Parameter(names = {ARG_PROVIDER},
-      description = "The credential provider in which the password is stored")
-  public String provider;
-
-  @Parameter(names = {ARG_ALIAS},
-      description = "The credential provider alias associated with the password")
-  public String alias;
-
-  @Parameter(names = {ARG_PASSWORD},
-      description = "The certificate store password (alternative to " +
-          "provider/alias; if password is specified, those will be ignored)")
-  public String password;
-
-  @Parameter(names = {ARG_PACKAGE},
-      description = "Path to app package")
-  public String packageURI;
-
-  @Parameter(names = {ARG_DEST},
-      description = "The location where to install the client")
-  public File installLocation;
-
-  @Parameter(names = {ARG_CONFIG},
-      description = "Client configuration")
-  public File clientConfig;
-
-  /**
-   * Get the min #of params expected
-   *
-   * @return the min number of params in the {@link #parameters} field
-   */
-  public int getMinParams() {
-    return 0;
-  }
-
-  @Override
-  public int getMaxParams() {
-    return 1;
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionCreateArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionCreateArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionCreateArgs.java
deleted file mode 100644
index e70f30a..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionCreateArgs.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameters;
-import com.beust.jcommander.ParametersDelegate;
-
-import java.io.File;
-
-@Parameters(commandNames = {SliderActions.ACTION_CREATE},
-            commandDescription = SliderActions.DESCRIBE_ACTION_CREATE)
-
-public class ActionCreateArgs extends AbstractClusterBuildingActionArgs
-  implements WaitTimeAccessor, LaunchArgsAccessor {
-  
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_CREATE;
-  }
-  
-  @ParametersDelegate
-  LaunchArgsDelegate launchArgs = new LaunchArgsDelegate();
-
-  @Override
-  public File getOutputFile() {
-    return launchArgs.getOutputFile();
-  }
-
-  @Override
-  public String getRmAddress() {
-    return launchArgs.getRmAddress();
-  }
-
-  @Override
-  public int getWaittime() {
-    return launchArgs.getWaittime();
-  }
-
-  @Override
-  public void setWaittime(int waittime) {
-    launchArgs.setWaittime(waittime);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionDependencyArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionDependencyArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionDependencyArgs.java
deleted file mode 100644
index 87f9f0d..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionDependencyArgs.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.common.params;
-
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.UsageException;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-
-@Parameters(commandNames = { SliderActions.ACTION_DEPENDENCY }, 
-            commandDescription = SliderActions.DESCRIBE_ACTION_DEPENDENCY)
-public class ActionDependencyArgs extends AbstractActionArgs {
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_DEPENDENCY;
-  }
-
-  @Parameter(names = { ARG_UPLOAD }, 
-             description = "Upload AM and agent libraries to HDFS for this client")
-  public boolean upload;
-
-  @Parameter(names = { ARG_OVERWRITE },
-             description = "Overwrite current uploaded dependency libs")
-  public boolean overwrite = false;
-
-  /**
-   * Get the min #of params expected
-   * 
-   * @return the min number of params in the {@link #parameters} field
-   */
-  public int getMinParams() {
-    return 0;
-  }
-
-  @Override
-  public int getMaxParams() {
-    return 1;
-  }
-
-  @Override
-  public void validate() throws BadCommandArgumentsException, UsageException {
-    super.validate();
-
-    if (!upload) {
-      throw new UsageException("Option " + ARG_UPLOAD + " is mandatory");
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionDestroyArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionDestroyArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionDestroyArgs.java
deleted file mode 100644
index 4a129ab..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionDestroyArgs.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-
-@Parameters(commandNames = {SliderActions.ACTION_DESTROY},
-            commandDescription = SliderActions.DESCRIBE_ACTION_DESTROY)
-
-public class ActionDestroyArgs extends AbstractActionArgs {
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_DESTROY;
-  }
-
-  @Parameter(names = {ARG_FORCE},
-             description = "force the operation")
-  public boolean force;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionDiagnosticArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionDiagnosticArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionDiagnosticArgs.java
deleted file mode 100644
index c891873..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionDiagnosticArgs.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-
-@Parameters(
-  commandNames = {SliderActions.ACTION_DIAGNOSTICS},
-  commandDescription = SliderActions.DESCRIBE_ACTION_DIAGNOSTIC)
-public class ActionDiagnosticArgs extends AbstractActionArgs {
-
-    @Override
-    public String getActionName() {
-      return SliderActions.ACTION_DIAGNOSTICS;
-    }
-
-    @Parameter(names = {ARG_NAME}, 
-        description = "the name of the running application")
-    public String name;
-
-	  @Parameter(names = {ARG_CLIENT}, 
-	      description = "print configuration of the slider client")
-	  public boolean client = false;
-
-	  @Parameter(names = {ARG_APPLICATION}, 
-	      description = "print configuration of the running application")
-	  public boolean application;
-
-	  @Parameter(names = {ARG_VERBOSE}, 
-	      description = "print out information in details")
-	  public boolean verbose = false;
-
-	  @Parameter(names = {ARG_YARN}, 
-	      description = "print configuration of the YARN cluster")
-	  public boolean yarn = false;
-
-	  @Parameter(names = {ARG_CREDENTIALS}, 
-	      description = "print credentials of the current user")
-	  public boolean credentials = false;
-
-	  @Parameter(names = {ARG_ALL}, 
-	      description = "print all of the information above")
-	  public boolean all;
-
-	  @Parameter(names = {ARG_LEVEL}, 
-	      description = "diagnose each slider configuration one by one")
-	  public boolean level;
-
-	  /**
-	   * Get the min #of params expected
-	   * @return the min number of params in the {@link #parameters} field
-	   */
-	  @Override
-	  public int getMinParams() {
-	    return 0;
-	  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionEchoArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionEchoArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionEchoArgs.java
deleted file mode 100644
index d05f10b..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionEchoArgs.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-
-public class ActionEchoArgs extends AbstractActionArgs {
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_ECHO;
-  }
-
-  @Parameter(names = {ARG_MESSAGE},
-             description = "message to echo")
-  public String message;
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionExistsArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionExistsArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionExistsArgs.java
deleted file mode 100644
index dd1c04b..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionExistsArgs.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-
-import java.io.File;
-
-@Parameters(commandNames = {SliderActions.ACTION_EXISTS},
-            commandDescription = SliderActions.DESCRIBE_ACTION_EXISTS)
-
-public class ActionExistsArgs extends AbstractActionArgs {
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_EXISTS;
-  }
-
-  @Parameter(names = {ARG_LIVE},
-             description = "verify that the application is running")
-  public boolean live;
-  
-  @Parameter(names = {ARG_STATE},
-             description = "verify that the application is in the specific YARN state")
-  public String state = "";
-
-  @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},
-      description = "output file for any application report")
-  public File out;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionFlexArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionFlexArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionFlexArgs.java
deleted file mode 100644
index 725973e..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionFlexArgs.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameters;
-import com.beust.jcommander.ParametersDelegate;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-
-import java.util.List;
-import java.util.Map;
-
-@Parameters(commandNames = {SliderActions.ACTION_FLEX},
-            commandDescription = SliderActions.DESCRIBE_ACTION_FLEX)
-
-public class ActionFlexArgs extends AbstractActionArgs {
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_FLEX;
-  }
-  
-  @ParametersDelegate
-  public ComponentArgsDelegate componentDelegate = new ComponentArgsDelegate();
-
-  /**
-   * Get the component mapping (may be empty, but never null)
-   * @return mapping
-   * @throws BadCommandArgumentsException parse problem
-   */
-  public Map<String, String> getComponentMap() throws BadCommandArgumentsException {
-    return componentDelegate.getComponentMap();
-  }
-
-  public List<String> getComponentTuples() {
-    return componentDelegate.getComponentTuples();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionFreezeArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionFreezeArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionFreezeArgs.java
deleted file mode 100644
index e3085d9..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionFreezeArgs.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-import com.beust.jcommander.ParametersDelegate;
-
-@Parameters(commandNames = {SliderActions.ACTION_FREEZE},
-            commandDescription = SliderActions.DESCRIBE_ACTION_FREEZE)
-
-public class ActionFreezeArgs extends AbstractActionArgs implements
-                                                         WaitTimeAccessor {
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_FREEZE;
-  }
-  
-  public static final String FREEZE_COMMAND_ISSUED = "stop command issued";
-  @ParametersDelegate
-  public WaitArgsDelegate waitDelegate = new WaitArgsDelegate();
-
-  @Override
-  public int getWaittime() {
-    return waitDelegate.getWaittime();
-  }
-
-  @Override
-  public void setWaittime(int waittime) {
-    waitDelegate.setWaittime(waittime);
-  }
-
-  @Parameter(names={ARG_MESSAGE},
-             description = "reason for the operation")
-  public String message = FREEZE_COMMAND_ISSUED;
-
-  @Parameter(names = {ARG_FORCE},
-             description = "force the operation")
-  public boolean force;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionHelpArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionHelpArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionHelpArgs.java
deleted file mode 100644
index 62773c4..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionHelpArgs.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameters;
-
-/**
- * The Help command
- */
-@Parameters(commandNames = {SliderActions.ACTION_HELP},
-            commandDescription = SliderActions.DESCRIBE_ACTION_HELP)
-public class ActionHelpArgs extends AbstractActionArgs {
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_HELP;
-  }
-
-  /**
-   * Get the min #of params expected
-   * @return the min number of params in the {@link #parameters} field
-   */
-  @Override
-  public int getMinParams() {
-    return 0;
-  }
-
-  /**
-   * This action does not need hadoop services
-   * @return false
-   */
-  @Override
-  public boolean getHadoopServicesRequired() {
-    return false;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionInstallKeytabArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionInstallKeytabArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionInstallKeytabArgs.java
deleted file mode 100644
index 4cfb889..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionInstallKeytabArgs.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-
-@Parameters(commandNames = {SliderActions.ACTION_INSTALL_KEYTAB},
-            commandDescription = SliderActions.DESCRIBE_ACTION_INSTALL_KEYTAB)
-
-public class ActionInstallKeytabArgs extends AbstractActionArgs {
-  
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_INSTALL_KEYTAB;
-  }
-
-  @Parameter(names = {ARG_KEYTAB},
-             description = "Path to keytab on local disk")
-  public String keytabUri;
-
-  @Parameter(names = {ARG_FOLDER},
-             description = "The name of the folder in which to store the keytab")
-  public String folder;
-
-  @Parameter(names = {ARG_OVERWRITE}, description = "Overwrite existing keytab")
-  public boolean overwrite = false;
-
-  /**
-   * Get the min #of params expected
-   * @return the min number of params in the {@link #parameters} field
-   */
-  public int getMinParams() {
-    return 0;
-  }
-
-  @Override
-  public int getMaxParams() {
-    return 3;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionInstallPackageArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionInstallPackageArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionInstallPackageArgs.java
deleted file mode 100644
index 646e795..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionInstallPackageArgs.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-import com.beust.jcommander.ParametersDelegate;
-
-@Parameters(commandNames = {SliderActions.ACTION_INSTALL_PACKAGE},
-            commandDescription = SliderActions.DESCRIBE_ACTION_INSTALL_PACKAGE)
-
-public class ActionInstallPackageArgs extends AbstractActionArgs {
-  
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_INSTALL_PACKAGE;
-  }
-
-  @Parameter(names = {ARG_PACKAGE},
-             description = "Path to app package on local disk")
-  public String packageURI;
-
-  @Parameter(names = {ARG_NAME},
-             description = "The type of the package")
-  public String name;
-
-  @Parameter(names = {ARG_REPLACE_PKG}, description = "Overwrite existing package")
-  public boolean replacePkg = false;
-
-  /**
-   * Get the min #of params expected
-   * @return the min number of params in the {@link #parameters} field
-   */
-  public int getMinParams() {
-    return 0;
-  }
-
-  @Override
-  public int getMaxParams() {
-    return 1;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionKDiagArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionKDiagArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionKDiagArgs.java
deleted file mode 100644
index 9fc9d2e..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionKDiagArgs.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.UsageException;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-@Parameters(commandNames = {SliderActions.ACTION_KDIAG},
-            commandDescription = SliderActions.DESCRIBE_ACTION_KDIAG)
-
-public class ActionKDiagArgs extends AbstractActionArgs {
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_KDIAG;
-  }
-
-  @Parameter(names = {ARG_SERVICES}, variableArity = true,
-    description =" list of services to check")
-  public List<String> services = new ArrayList<>();
-
-  @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},
-      description = "output file for report")
-  public File out;
-
-  @Parameter(names = {ARG_KEYTAB}, description = "keytab to use")
-  public File keytab;
-
-  @Parameter(names = {ARG_KEYLEN}, description = "minimum key length")
-  public int keylen = 256;
-
-  @Parameter(names = {ARG_PRINCIPAL}, description = "principal to log in from a keytab")
-  public String principal;
-
-  @Parameter(names = {ARG_SECURE}, description = "Is security required")
-  public boolean secure = false;
-
-  @Override
-  public int getMinParams() {
-    return 0;
-  }
-
-  @Override
-  public boolean getHadoopServicesRequired() {
-    return false;
-  }
-
-  @Override
-  public boolean disableSecureLogin() {
-    return true;
-  }
-
-  @Override
-  public void validate() throws BadCommandArgumentsException, UsageException {
-    super.validate();
-    if (keytab != null && SliderUtils.isUnset(principal)) {
-      throw new UsageException("Missing argument " + ARG_PRINCIPAL);
-    }
-    if (keytab == null && SliderUtils.isSet(principal)) {
-      throw new UsageException("Missing argument " + ARG_KEYTAB);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionKeytabArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionKeytabArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionKeytabArgs.java
deleted file mode 100644
index 32b1d2b..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionKeytabArgs.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-
-@Parameters(commandNames = {SliderActions.ACTION_KEYTAB},
-            commandDescription = SliderActions.DESCRIBE_ACTION_KEYTAB)
-
-public class ActionKeytabArgs extends AbstractActionArgs {
-
-  public ActionKeytabArgs(ActionInstallKeytabArgs installKeytabInfo) {
-    this.install = true;
-    this.overwrite = installKeytabInfo.overwrite;
-    this.keytab = installKeytabInfo.keytabUri;
-    this.folder = installKeytabInfo.folder;
-  }
-
-  public ActionKeytabArgs() {
-    super();
-  }
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_INSTALL_KEYTAB;
-  }
-
-  @Parameter(names = {ARG_KEYTABINSTALL},
-             description = "Install the keytab")
-  public boolean install;
-
-  @Parameter(names = {ARG_KEYTABDELETE},
-             description = "Delete the keytab")
-  public boolean delete;
-
-  @Parameter(names = {ARG_KEYTABLIST},
-             description = "List of installed keytabs")
-  public boolean list;
-
-  @Parameter(names = {ARG_KEYTAB},
-             description = "Path or name of the keytab")
-  public String keytab;
-
-  @Parameter(names = {ARG_FOLDER},
-             description = "The name of the folder in which to store the keytab")
-  public String folder;
-
-  @Parameter(names = {ARG_OVERWRITE}, description = "Overwrite existing keytab")
-  public boolean overwrite = false;
-
-  /**
-   * Get the min #of params expected
-   * @return the min number of params in the {@link #parameters} field
-   */
-  public int getMinParams() {
-    return 0;
-  }
-
-  @Override
-  public int getMaxParams() {
-    return 3;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionKillContainerArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionKillContainerArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionKillContainerArgs.java
deleted file mode 100644
index 8c18ad8..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionKillContainerArgs.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-
-@Parameters(commandNames = {SliderActions.ACTION_KILL_CONTAINER},
-            commandDescription = SliderActions.DESCRIBE_ACTION_KILL_CONTAINER)
-
-public class ActionKillContainerArgs extends AbstractActionArgs {
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_KILL_CONTAINER;
-  }
-
-  @Parameter(names = {ARG_ID},
-             description = "ID of the container")
-  public String id;
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionListArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionListArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionListArgs.java
deleted file mode 100644
index 739b5fc..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionListArgs.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-
-@Parameters(commandNames = {SliderActions.ACTION_LIST},
-            commandDescription = SliderActions.DESCRIBE_ACTION_LIST)
-
-public class ActionListArgs extends AbstractActionArgs {
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_LIST;
-  }
-
-  @Parameter(names = {ARG_LIVE},
-          description = "List only live application instances")
-  public boolean live;
-
-  @Parameter(names = {ARG_STATE},
-      description = "list only applications in the specific YARN state")
-  public String state = "";
-  
-  @Parameter(names = {ARG_VERBOSE},
-      description = "print out information in details")
-  public boolean verbose = false;
-
-  @Parameter(names = {ARG_CONTAINERS},
-      description = "List containers of an application instance")
-  public boolean containers;
-
-  @Parameter(names = {ARG_VERSION},
-      description = "Filter containers by app version (used with " +
-                    ARG_CONTAINERS + ")")
-  public String version;
-
-  @Parameter(names = {ARG_COMPONENTS}, variableArity = true,
-      description = "Filter containers by component names (used with " +
-                    ARG_CONTAINERS + ")")
-  public Set<String> components = new HashSet<>(0);
-
-  /**
-   * Get the min #of params expected
-   * @return the min number of params in the {@link #parameters} field
-   */
-  public int getMinParams() {
-    return 0;
-  }
-
-  @Override
-  public int getMaxParams() {
-    return 1;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionLookupArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionLookupArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionLookupArgs.java
deleted file mode 100644
index 1b73522..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionLookupArgs.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-import org.apache.commons.lang.StringUtils;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.UsageException;
-
-import java.io.File;
-
-@Parameters(commandNames = {SliderActions.ACTION_LOOKUP},
-            commandDescription = SliderActions.DESCRIBE_ACTION_LOOKUP)
-
-public class ActionLookupArgs extends AbstractActionArgs {
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_LOOKUP;
-  }
-
-  public int getMinParams() {
-    return 0;
-  }
-  public int getMaxParams() {
-    return 0;
-  }
-  
-  @Parameter(names = {ARG_ID},
-             description = "ID of the application")
-  public String id;
-
-  @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},
-      description = "output file for any application report")
-  public File outputFile;
-
-  @Override
-  public void validate() throws BadCommandArgumentsException, UsageException {
-    super.validate();
-    if (StringUtils.isEmpty(id)) {
-      throw new BadCommandArgumentsException("Missing mandatory argument "
-                                             + ARG_ID);
-    }
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder(SliderActions.ACTION_LOOKUP);
-    if (id!=null) {
-      sb.append(" ");
-      sb.append(ARG_ID).append(" ").append(id);
-    }
-    if (outputFile != null) {
-      sb.append(" ");
-      sb.append(ARG_OUTPUT).append(" ").append(outputFile.getAbsolutePath());
-    }
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionNodesArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionNodesArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionNodesArgs.java
deleted file mode 100644
index ec38c80..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionNodesArgs.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-
-import java.io.File;
-
-@Parameters(commandNames = {SliderActions.ACTION_NODES},
-            commandDescription = SliderActions.DESCRIBE_ACTION_NODES)
-public class ActionNodesArgs extends AbstractActionArgs {
-
-  /**
-   * Instance for API use; on CLI the name is derived from {@link #getClusterName()}.
-   */
-  public String instance;
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_NODES;
-  }
-
-  @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},
-             description = "Output file for the information")
-  public File outputFile;
-
-  @Parameter(names = {ARG_LABEL})
-  public String label = "";
-
-  @Parameter(names = {ARG_HEALTHY} )
-  public boolean healthy;
-
-  @Override
-  public int getMinParams() {
-    return 0;
-  }
-
-  @Override
-  public int getMaxParams() {
-    return 1;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb = new StringBuilder(
-      "ActionNodesArgs{");
-    sb.append("instance='").append(instance).append('\'');
-    sb.append(", outputFile=").append(outputFile);
-    sb.append(", label='").append(label).append('\'');
-    sb.append(", healthy=").append(healthy);
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionPackageArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionPackageArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionPackageArgs.java
deleted file mode 100644
index 4833934..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionPackageArgs.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-
-@Parameters(commandNames = {SliderActions.ACTION_PACKAGE},
-            commandDescription = SliderActions.DESCRIBE_ACTION_PACKAGE)
-
-public class ActionPackageArgs extends AbstractActionArgs {
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_PACKAGE;
-  }
-
-  @Parameter(names = {ARG_INSTALL},
-      description = "Install package in the sub-folder 'package' of the user's Slider base directory")
-  public boolean install;
-
-  @Parameter(names = {ARG_PKGDELETE},
-      description = "Delete package operation")
-  public boolean delete;
-
-  @Parameter(names = {ARG_PKGLIST},
-      description = "List of package(s) installed")
-  public boolean list;
-
-  @Parameter(names = {ARG_PKGINSTANCES},
-      description = "Lists all application instances referring to package")
-  public boolean instances;
-
-  @Parameter(names = {ARG_PACKAGE},
-             description = "Path to app package on local disk")
-  public String packageURI;
-
-  @Parameter(names = {ARG_NAME},
-             description = "Package name")
-  public String name;
-
-  @Parameter(names = {ARG_VERSION}, description = "Package version")
-  public String version;
-
-  @Parameter(names = {ARG_REPLACE_PKG}, 
-      description = "Overwrite existing package")
-  public boolean replacePkg = false;
-
-  @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},
-      description = "Output file for package data")
-  public String out;
-
-  /**
-   * Get the min #of params expected
-   * @return the min number of params in the {@link #parameters} field
-   */
-  public int getMinParams() {
-    return 0;
-  }
-
-  @Override
-  public int getMaxParams() {
-    return 1;
-  }
-}



[43/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java b/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java
deleted file mode 100644
index 373d64d..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java
+++ /dev/null
@@ -1,34473 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: SliderClusterMessages.proto
-
-package org.apache.slider.api.proto;
-
-public final class Messages {
-  private Messages() {}
-  public static void registerAllExtensions(
-      com.google.protobuf.ExtensionRegistry registry) {
-  }
-  public interface RoleInstanceStateOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-
-    // required string name = 1;
-    /**
-     * <code>required string name = 1;</code>
-     */
-    boolean hasName();
-    /**
-     * <code>required string name = 1;</code>
-     */
-    java.lang.String getName();
-    /**
-     * <code>required string name = 1;</code>
-     */
-    com.google.protobuf.ByteString
-        getNameBytes();
-
-    // optional string role = 2;
-    /**
-     * <code>optional string role = 2;</code>
-     */
-    boolean hasRole();
-    /**
-     * <code>optional string role = 2;</code>
-     */
-    java.lang.String getRole();
-    /**
-     * <code>optional string role = 2;</code>
-     */
-    com.google.protobuf.ByteString
-        getRoleBytes();
-
-    // required uint32 state = 4;
-    /**
-     * <code>required uint32 state = 4;</code>
-     */
-    boolean hasState();
-    /**
-     * <code>required uint32 state = 4;</code>
-     */
-    int getState();
-
-    // required uint32 exitCode = 5;
-    /**
-     * <code>required uint32 exitCode = 5;</code>
-     */
-    boolean hasExitCode();
-    /**
-     * <code>required uint32 exitCode = 5;</code>
-     */
-    int getExitCode();
-
-    // optional string command = 6;
-    /**
-     * <code>optional string command = 6;</code>
-     */
-    boolean hasCommand();
-    /**
-     * <code>optional string command = 6;</code>
-     */
-    java.lang.String getCommand();
-    /**
-     * <code>optional string command = 6;</code>
-     */
-    com.google.protobuf.ByteString
-        getCommandBytes();
-
-    // optional string diagnostics = 7;
-    /**
-     * <code>optional string diagnostics = 7;</code>
-     */
-    boolean hasDiagnostics();
-    /**
-     * <code>optional string diagnostics = 7;</code>
-     */
-    java.lang.String getDiagnostics();
-    /**
-     * <code>optional string diagnostics = 7;</code>
-     */
-    com.google.protobuf.ByteString
-        getDiagnosticsBytes();
-
-    // repeated string output = 8;
-    /**
-     * <code>repeated string output = 8;</code>
-     */
-    java.util.List<java.lang.String>
-    getOutputList();
-    /**
-     * <code>repeated string output = 8;</code>
-     */
-    int getOutputCount();
-    /**
-     * <code>repeated string output = 8;</code>
-     */
-    java.lang.String getOutput(int index);
-    /**
-     * <code>repeated string output = 8;</code>
-     */
-    com.google.protobuf.ByteString
-        getOutputBytes(int index);
-
-    // repeated string environment = 9;
-    /**
-     * <code>repeated string environment = 9;</code>
-     */
-    java.util.List<java.lang.String>
-    getEnvironmentList();
-    /**
-     * <code>repeated string environment = 9;</code>
-     */
-    int getEnvironmentCount();
-    /**
-     * <code>repeated string environment = 9;</code>
-     */
-    java.lang.String getEnvironment(int index);
-    /**
-     * <code>repeated string environment = 9;</code>
-     */
-    com.google.protobuf.ByteString
-        getEnvironmentBytes(int index);
-
-    // required uint32 roleId = 10;
-    /**
-     * <code>required uint32 roleId = 10;</code>
-     */
-    boolean hasRoleId();
-    /**
-     * <code>required uint32 roleId = 10;</code>
-     */
-    int getRoleId();
-
-    // required bool released = 11;
-    /**
-     * <code>required bool released = 11;</code>
-     */
-    boolean hasReleased();
-    /**
-     * <code>required bool released = 11;</code>
-     */
-    boolean getReleased();
-
-    // required int64 createTime = 12;
-    /**
-     * <code>required int64 createTime = 12;</code>
-     */
-    boolean hasCreateTime();
-    /**
-     * <code>required int64 createTime = 12;</code>
-     */
-    long getCreateTime();
-
-    // required int64 startTime = 13;
-    /**
-     * <code>required int64 startTime = 13;</code>
-     */
-    boolean hasStartTime();
-    /**
-     * <code>required int64 startTime = 13;</code>
-     */
-    long getStartTime();
-
-    // required string host = 14;
-    /**
-     * <code>required string host = 14;</code>
-     */
-    boolean hasHost();
-    /**
-     * <code>required string host = 14;</code>
-     */
-    java.lang.String getHost();
-    /**
-     * <code>required string host = 14;</code>
-     */
-    com.google.protobuf.ByteString
-        getHostBytes();
-
-    // required string hostURL = 15;
-    /**
-     * <code>required string hostURL = 15;</code>
-     */
-    boolean hasHostURL();
-    /**
-     * <code>required string hostURL = 15;</code>
-     */
-    java.lang.String getHostURL();
-    /**
-     * <code>required string hostURL = 15;</code>
-     */
-    com.google.protobuf.ByteString
-        getHostURLBytes();
-
-    // optional string appVersion = 16;
-    /**
-     * <code>optional string appVersion = 16;</code>
-     */
-    boolean hasAppVersion();
-    /**
-     * <code>optional string appVersion = 16;</code>
-     */
-    java.lang.String getAppVersion();
-    /**
-     * <code>optional string appVersion = 16;</code>
-     */
-    com.google.protobuf.ByteString
-        getAppVersionBytes();
-  }
-  /**
-   * Protobuf type {@code org.apache.slider.api.RoleInstanceState}
-   */
-  public static final class RoleInstanceState extends
-      com.google.protobuf.GeneratedMessage
-      implements RoleInstanceStateOrBuilder {
-    // Use RoleInstanceState.newBuilder() to construct.
-    private RoleInstanceState(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private RoleInstanceState(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final RoleInstanceState defaultInstance;
-    public static RoleInstanceState getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public RoleInstanceState getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private RoleInstanceState(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      initFields();
-      int mutable_bitField0_ = 0;
-      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
-          com.google.protobuf.UnknownFieldSet.newBuilder();
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 10: {
-              bitField0_ |= 0x00000001;
-              name_ = input.readBytes();
-              break;
-            }
-            case 18: {
-              bitField0_ |= 0x00000002;
-              role_ = input.readBytes();
-              break;
-            }
-            case 32: {
-              bitField0_ |= 0x00000004;
-              state_ = input.readUInt32();
-              break;
-            }
-            case 40: {
-              bitField0_ |= 0x00000008;
-              exitCode_ = input.readUInt32();
-              break;
-            }
-            case 50: {
-              bitField0_ |= 0x00000010;
-              command_ = input.readBytes();
-              break;
-            }
-            case 58: {
-              bitField0_ |= 0x00000020;
-              diagnostics_ = input.readBytes();
-              break;
-            }
-            case 66: {
-              if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
-                output_ = new com.google.protobuf.LazyStringArrayList();
-                mutable_bitField0_ |= 0x00000040;
-              }
-              output_.add(input.readBytes());
-              break;
-            }
-            case 74: {
-              if (!((mutable_bitField0_ & 0x00000080) == 0x00000080)) {
-                environment_ = new com.google.protobuf.LazyStringArrayList();
-                mutable_bitField0_ |= 0x00000080;
-              }
-              environment_.add(input.readBytes());
-              break;
-            }
-            case 80: {
-              bitField0_ |= 0x00000040;
-              roleId_ = input.readUInt32();
-              break;
-            }
-            case 88: {
-              bitField0_ |= 0x00000080;
-              released_ = input.readBool();
-              break;
-            }
-            case 96: {
-              bitField0_ |= 0x00000100;
-              createTime_ = input.readInt64();
-              break;
-            }
-            case 104: {
-              bitField0_ |= 0x00000200;
-              startTime_ = input.readInt64();
-              break;
-            }
-            case 114: {
-              bitField0_ |= 0x00000400;
-              host_ = input.readBytes();
-              break;
-            }
-            case 122: {
-              bitField0_ |= 0x00000800;
-              hostURL_ = input.readBytes();
-              break;
-            }
-            case 130: {
-              bitField0_ |= 0x00001000;
-              appVersion_ = input.readBytes();
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e.getMessage()).setUnfinishedMessage(this);
-      } finally {
-        if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
-          output_ = new com.google.protobuf.UnmodifiableLazyStringList(output_);
-        }
-        if (((mutable_bitField0_ & 0x00000080) == 0x00000080)) {
-          environment_ = new com.google.protobuf.UnmodifiableLazyStringList(environment_);
-        }
-        this.unknownFields = unknownFields.build();
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_RoleInstanceState_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_RoleInstanceState_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.apache.slider.api.proto.Messages.RoleInstanceState.class, org.apache.slider.api.proto.Messages.RoleInstanceState.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<RoleInstanceState> PARSER =
-        new com.google.protobuf.AbstractParser<RoleInstanceState>() {
-      public RoleInstanceState parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new RoleInstanceState(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<RoleInstanceState> getParserForType() {
-      return PARSER;
-    }
-
-    private int bitField0_;
-    // required string name = 1;
-    public static final int NAME_FIELD_NUMBER = 1;
-    private java.lang.Object name_;
-    /**
-     * <code>required string name = 1;</code>
-     */
-    public boolean hasName() {
-      return ((bitField0_ & 0x00000001) == 0x00000001);
-    }
-    /**
-     * <code>required string name = 1;</code>
-     */
-    public java.lang.String getName() {
-      java.lang.Object ref = name_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          name_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>required string name = 1;</code>
-     */
-    public com.google.protobuf.ByteString
-        getNameBytes() {
-      java.lang.Object ref = name_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        name_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    // optional string role = 2;
-    public static final int ROLE_FIELD_NUMBER = 2;
-    private java.lang.Object role_;
-    /**
-     * <code>optional string role = 2;</code>
-     */
-    public boolean hasRole() {
-      return ((bitField0_ & 0x00000002) == 0x00000002);
-    }
-    /**
-     * <code>optional string role = 2;</code>
-     */
-    public java.lang.String getRole() {
-      java.lang.Object ref = role_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          role_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>optional string role = 2;</code>
-     */
-    public com.google.protobuf.ByteString
-        getRoleBytes() {
-      java.lang.Object ref = role_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        role_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    // required uint32 state = 4;
-    public static final int STATE_FIELD_NUMBER = 4;
-    private int state_;
-    /**
-     * <code>required uint32 state = 4;</code>
-     */
-    public boolean hasState() {
-      return ((bitField0_ & 0x00000004) == 0x00000004);
-    }
-    /**
-     * <code>required uint32 state = 4;</code>
-     */
-    public int getState() {
-      return state_;
-    }
-
-    // required uint32 exitCode = 5;
-    public static final int EXITCODE_FIELD_NUMBER = 5;
-    private int exitCode_;
-    /**
-     * <code>required uint32 exitCode = 5;</code>
-     */
-    public boolean hasExitCode() {
-      return ((bitField0_ & 0x00000008) == 0x00000008);
-    }
-    /**
-     * <code>required uint32 exitCode = 5;</code>
-     */
-    public int getExitCode() {
-      return exitCode_;
-    }
-
-    // optional string command = 6;
-    public static final int COMMAND_FIELD_NUMBER = 6;
-    private java.lang.Object command_;
-    /**
-     * <code>optional string command = 6;</code>
-     */
-    public boolean hasCommand() {
-      return ((bitField0_ & 0x00000010) == 0x00000010);
-    }
-    /**
-     * <code>optional string command = 6;</code>
-     */
-    public java.lang.String getCommand() {
-      java.lang.Object ref = command_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          command_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>optional string command = 6;</code>
-     */
-    public com.google.protobuf.ByteString
-        getCommandBytes() {
-      java.lang.Object ref = command_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        command_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    // optional string diagnostics = 7;
-    public static final int DIAGNOSTICS_FIELD_NUMBER = 7;
-    private java.lang.Object diagnostics_;
-    /**
-     * <code>optional string diagnostics = 7;</code>
-     */
-    public boolean hasDiagnostics() {
-      return ((bitField0_ & 0x00000020) == 0x00000020);
-    }
-    /**
-     * <code>optional string diagnostics = 7;</code>
-     */
-    public java.lang.String getDiagnostics() {
-      java.lang.Object ref = diagnostics_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          diagnostics_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>optional string diagnostics = 7;</code>
-     */
-    public com.google.protobuf.ByteString
-        getDiagnosticsBytes() {
-      java.lang.Object ref = diagnostics_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        diagnostics_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    // repeated string output = 8;
-    public static final int OUTPUT_FIELD_NUMBER = 8;
-    private com.google.protobuf.LazyStringList output_;
-    /**
-     * <code>repeated string output = 8;</code>
-     */
-    public java.util.List<java.lang.String>
-        getOutputList() {
-      return output_;
-    }
-    /**
-     * <code>repeated string output = 8;</code>
-     */
-    public int getOutputCount() {
-      return output_.size();
-    }
-    /**
-     * <code>repeated string output = 8;</code>
-     */
-    public java.lang.String getOutput(int index) {
-      return output_.get(index);
-    }
-    /**
-     * <code>repeated string output = 8;</code>
-     */
-    public com.google.protobuf.ByteString
-        getOutputBytes(int index) {
-      return output_.getByteString(index);
-    }
-
-    // repeated string environment = 9;
-    public static final int ENVIRONMENT_FIELD_NUMBER = 9;
-    private com.google.protobuf.LazyStringList environment_;
-    /**
-     * <code>repeated string environment = 9;</code>
-     */
-    public java.util.List<java.lang.String>
-        getEnvironmentList() {
-      return environment_;
-    }
-    /**
-     * <code>repeated string environment = 9;</code>
-     */
-    public int getEnvironmentCount() {
-      return environment_.size();
-    }
-    /**
-     * <code>repeated string environment = 9;</code>
-     */
-    public java.lang.String getEnvironment(int index) {
-      return environment_.get(index);
-    }
-    /**
-     * <code>repeated string environment = 9;</code>
-     */
-    public com.google.protobuf.ByteString
-        getEnvironmentBytes(int index) {
-      return environment_.getByteString(index);
-    }
-
-    // required uint32 roleId = 10;
-    public static final int ROLEID_FIELD_NUMBER = 10;
-    private int roleId_;
-    /**
-     * <code>required uint32 roleId = 10;</code>
-     */
-    public boolean hasRoleId() {
-      return ((bitField0_ & 0x00000040) == 0x00000040);
-    }
-    /**
-     * <code>required uint32 roleId = 10;</code>
-     */
-    public int getRoleId() {
-      return roleId_;
-    }
-
-    // required bool released = 11;
-    public static final int RELEASED_FIELD_NUMBER = 11;
-    private boolean released_;
-    /**
-     * <code>required bool released = 11;</code>
-     */
-    public boolean hasReleased() {
-      return ((bitField0_ & 0x00000080) == 0x00000080);
-    }
-    /**
-     * <code>required bool released = 11;</code>
-     */
-    public boolean getReleased() {
-      return released_;
-    }
-
-    // required int64 createTime = 12;
-    public static final int CREATETIME_FIELD_NUMBER = 12;
-    private long createTime_;
-    /**
-     * <code>required int64 createTime = 12;</code>
-     */
-    public boolean hasCreateTime() {
-      return ((bitField0_ & 0x00000100) == 0x00000100);
-    }
-    /**
-     * <code>required int64 createTime = 12;</code>
-     */
-    public long getCreateTime() {
-      return createTime_;
-    }
-
-    // required int64 startTime = 13;
-    public static final int STARTTIME_FIELD_NUMBER = 13;
-    private long startTime_;
-    /**
-     * <code>required int64 startTime = 13;</code>
-     */
-    public boolean hasStartTime() {
-      return ((bitField0_ & 0x00000200) == 0x00000200);
-    }
-    /**
-     * <code>required int64 startTime = 13;</code>
-     */
-    public long getStartTime() {
-      return startTime_;
-    }
-
-    // required string host = 14;
-    public static final int HOST_FIELD_NUMBER = 14;
-    private java.lang.Object host_;
-    /**
-     * <code>required string host = 14;</code>
-     */
-    public boolean hasHost() {
-      return ((bitField0_ & 0x00000400) == 0x00000400);
-    }
-    /**
-     * <code>required string host = 14;</code>
-     */
-    public java.lang.String getHost() {
-      java.lang.Object ref = host_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          host_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>required string host = 14;</code>
-     */
-    public com.google.protobuf.ByteString
-        getHostBytes() {
-      java.lang.Object ref = host_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        host_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    // required string hostURL = 15;
-    public static final int HOSTURL_FIELD_NUMBER = 15;
-    private java.lang.Object hostURL_;
-    /**
-     * <code>required string hostURL = 15;</code>
-     */
-    public boolean hasHostURL() {
-      return ((bitField0_ & 0x00000800) == 0x00000800);
-    }
-    /**
-     * <code>required string hostURL = 15;</code>
-     */
-    public java.lang.String getHostURL() {
-      java.lang.Object ref = hostURL_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          hostURL_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>required string hostURL = 15;</code>
-     */
-    public com.google.protobuf.ByteString
-        getHostURLBytes() {
-      java.lang.Object ref = hostURL_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        hostURL_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    // optional string appVersion = 16;
-    public static final int APPVERSION_FIELD_NUMBER = 16;
-    private java.lang.Object appVersion_;
-    /**
-     * <code>optional string appVersion = 16;</code>
-     */
-    public boolean hasAppVersion() {
-      return ((bitField0_ & 0x00001000) == 0x00001000);
-    }
-    /**
-     * <code>optional string appVersion = 16;</code>
-     */
-    public java.lang.String getAppVersion() {
-      java.lang.Object ref = appVersion_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          appVersion_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>optional string appVersion = 16;</code>
-     */
-    public com.google.protobuf.ByteString
-        getAppVersionBytes() {
-      java.lang.Object ref = appVersion_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        appVersion_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    private void initFields() {
-      name_ = "";
-      role_ = "";
-      state_ = 0;
-      exitCode_ = 0;
-      command_ = "";
-      diagnostics_ = "";
-      output_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-      environment_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-      roleId_ = 0;
-      released_ = false;
-      createTime_ = 0L;
-      startTime_ = 0L;
-      host_ = "";
-      hostURL_ = "";
-      appVersion_ = "";
-    }
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
-
-      if (!hasName()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      if (!hasState()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      if (!hasExitCode()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      if (!hasRoleId()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      if (!hasReleased()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      if (!hasCreateTime()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      if (!hasStartTime()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      if (!hasHost()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      if (!hasHostURL()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      getSerializedSize();
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        output.writeBytes(1, getNameBytes());
-      }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        output.writeBytes(2, getRoleBytes());
-      }
-      if (((bitField0_ & 0x00000004) == 0x00000004)) {
-        output.writeUInt32(4, state_);
-      }
-      if (((bitField0_ & 0x00000008) == 0x00000008)) {
-        output.writeUInt32(5, exitCode_);
-      }
-      if (((bitField0_ & 0x00000010) == 0x00000010)) {
-        output.writeBytes(6, getCommandBytes());
-      }
-      if (((bitField0_ & 0x00000020) == 0x00000020)) {
-        output.writeBytes(7, getDiagnosticsBytes());
-      }
-      for (int i = 0; i < output_.size(); i++) {
-        output.writeBytes(8, output_.getByteString(i));
-      }
-      for (int i = 0; i < environment_.size(); i++) {
-        output.writeBytes(9, environment_.getByteString(i));
-      }
-      if (((bitField0_ & 0x00000040) == 0x00000040)) {
-        output.writeUInt32(10, roleId_);
-      }
-      if (((bitField0_ & 0x00000080) == 0x00000080)) {
-        output.writeBool(11, released_);
-      }
-      if (((bitField0_ & 0x00000100) == 0x00000100)) {
-        output.writeInt64(12, createTime_);
-      }
-      if (((bitField0_ & 0x00000200) == 0x00000200)) {
-        output.writeInt64(13, startTime_);
-      }
-      if (((bitField0_ & 0x00000400) == 0x00000400)) {
-        output.writeBytes(14, getHostBytes());
-      }
-      if (((bitField0_ & 0x00000800) == 0x00000800)) {
-        output.writeBytes(15, getHostURLBytes());
-      }
-      if (((bitField0_ & 0x00001000) == 0x00001000)) {
-        output.writeBytes(16, getAppVersionBytes());
-      }
-      getUnknownFields().writeTo(output);
-    }
-
-    private int memoizedSerializedSize = -1;
-    public int getSerializedSize() {
-      int size = memoizedSerializedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(1, getNameBytes());
-      }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(2, getRoleBytes());
-      }
-      if (((bitField0_ & 0x00000004) == 0x00000004)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeUInt32Size(4, state_);
-      }
-      if (((bitField0_ & 0x00000008) == 0x00000008)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeUInt32Size(5, exitCode_);
-      }
-      if (((bitField0_ & 0x00000010) == 0x00000010)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(6, getCommandBytes());
-      }
-      if (((bitField0_ & 0x00000020) == 0x00000020)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(7, getDiagnosticsBytes());
-      }
-      {
-        int dataSize = 0;
-        for (int i = 0; i < output_.size(); i++) {
-          dataSize += com.google.protobuf.CodedOutputStream
-            .computeBytesSizeNoTag(output_.getByteString(i));
-        }
-        size += dataSize;
-        size += 1 * getOutputList().size();
-      }
-      {
-        int dataSize = 0;
-        for (int i = 0; i < environment_.size(); i++) {
-          dataSize += com.google.protobuf.CodedOutputStream
-            .computeBytesSizeNoTag(environment_.getByteString(i));
-        }
-        size += dataSize;
-        size += 1 * getEnvironmentList().size();
-      }
-      if (((bitField0_ & 0x00000040) == 0x00000040)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeUInt32Size(10, roleId_);
-      }
-      if (((bitField0_ & 0x00000080) == 0x00000080)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBoolSize(11, released_);
-      }
-      if (((bitField0_ & 0x00000100) == 0x00000100)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeInt64Size(12, createTime_);
-      }
-      if (((bitField0_ & 0x00000200) == 0x00000200)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeInt64Size(13, startTime_);
-      }
-      if (((bitField0_ & 0x00000400) == 0x00000400)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(14, getHostBytes());
-      }
-      if (((bitField0_ & 0x00000800) == 0x00000800)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(15, getHostURLBytes());
-      }
-      if (((bitField0_ & 0x00001000) == 0x00001000)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(16, getAppVersionBytes());
-      }
-      size += getUnknownFields().getSerializedSize();
-      memoizedSerializedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    protected java.lang.Object writeReplace()
-        throws java.io.ObjectStreamException {
-      return super.writeReplace();
-    }
-
-    @java.lang.Override
-    public boolean equals(final java.lang.Object obj) {
-      if (obj == this) {
-       return true;
-      }
-      if (!(obj instanceof org.apache.slider.api.proto.Messages.RoleInstanceState)) {
-        return super.equals(obj);
-      }
-      org.apache.slider.api.proto.Messages.RoleInstanceState other = (org.apache.slider.api.proto.Messages.RoleInstanceState) obj;
-
-      boolean result = true;
-      result = result && (hasName() == other.hasName());
-      if (hasName()) {
-        result = result && getName()
-            .equals(other.getName());
-      }
-      result = result && (hasRole() == other.hasRole());
-      if (hasRole()) {
-        result = result && getRole()
-            .equals(other.getRole());
-      }
-      result = result && (hasState() == other.hasState());
-      if (hasState()) {
-        result = result && (getState()
-            == other.getState());
-      }
-      result = result && (hasExitCode() == other.hasExitCode());
-      if (hasExitCode()) {
-        result = result && (getExitCode()
-            == other.getExitCode());
-      }
-      result = result && (hasCommand() == other.hasCommand());
-      if (hasCommand()) {
-        result = result && getCommand()
-            .equals(other.getCommand());
-      }
-      result = result && (hasDiagnostics() == other.hasDiagnostics());
-      if (hasDiagnostics()) {
-        result = result && getDiagnostics()
-            .equals(other.getDiagnostics());
-      }
-      result = result && getOutputList()
-          .equals(other.getOutputList());
-      result = result && getEnvironmentList()
-          .equals(other.getEnvironmentList());
-      result = result && (hasRoleId() == other.hasRoleId());
-      if (hasRoleId()) {
-        result = result && (getRoleId()
-            == other.getRoleId());
-      }
-      result = result && (hasReleased() == other.hasReleased());
-      if (hasReleased()) {
-        result = result && (getReleased()
-            == other.getReleased());
-      }
-      result = result && (hasCreateTime() == other.hasCreateTime());
-      if (hasCreateTime()) {
-        result = result && (getCreateTime()
-            == other.getCreateTime());
-      }
-      result = result && (hasStartTime() == other.hasStartTime());
-      if (hasStartTime()) {
-        result = result && (getStartTime()
-            == other.getStartTime());
-      }
-      result = result && (hasHost() == other.hasHost());
-      if (hasHost()) {
-        result = result && getHost()
-            .equals(other.getHost());
-      }
-      result = result && (hasHostURL() == other.hasHostURL());
-      if (hasHostURL()) {
-        result = result && getHostURL()
-            .equals(other.getHostURL());
-      }
-      result = result && (hasAppVersion() == other.hasAppVersion());
-      if (hasAppVersion()) {
-        result = result && getAppVersion()
-            .equals(other.getAppVersion());
-      }
-      result = result &&
-          getUnknownFields().equals(other.getUnknownFields());
-      return result;
-    }
-
-    private int memoizedHashCode = 0;
-    @java.lang.Override
-    public int hashCode() {
-      if (memoizedHashCode != 0) {
-        return memoizedHashCode;
-      }
-      int hash = 41;
-      hash = (19 * hash) + getDescriptorForType().hashCode();
-      if (hasName()) {
-        hash = (37 * hash) + NAME_FIELD_NUMBER;
-        hash = (53 * hash) + getName().hashCode();
-      }
-      if (hasRole()) {
-        hash = (37 * hash) + ROLE_FIELD_NUMBER;
-        hash = (53 * hash) + getRole().hashCode();
-      }
-      if (hasState()) {
-        hash = (37 * hash) + STATE_FIELD_NUMBER;
-        hash = (53 * hash) + getState();
-      }
-      if (hasExitCode()) {
-        hash = (37 * hash) + EXITCODE_FIELD_NUMBER;
-        hash = (53 * hash) + getExitCode();
-      }
-      if (hasCommand()) {
-        hash = (37 * hash) + COMMAND_FIELD_NUMBER;
-        hash = (53 * hash) + getCommand().hashCode();
-      }
-      if (hasDiagnostics()) {
-        hash = (37 * hash) + DIAGNOSTICS_FIELD_NUMBER;
-        hash = (53 * hash) + getDiagnostics().hashCode();
-      }
-      if (getOutputCount() > 0) {
-        hash = (37 * hash) + OUTPUT_FIELD_NUMBER;
-        hash = (53 * hash) + getOutputList().hashCode();
-      }
-      if (getEnvironmentCount() > 0) {
-        hash = (37 * hash) + ENVIRONMENT_FIELD_NUMBER;
-        hash = (53 * hash) + getEnvironmentList().hashCode();
-      }
-      if (hasRoleId()) {
-        hash = (37 * hash) + ROLEID_FIELD_NUMBER;
-        hash = (53 * hash) + getRoleId();
-      }
-      if (hasReleased()) {
-        hash = (37 * hash) + RELEASED_FIELD_NUMBER;
-        hash = (53 * hash) + hashBoolean(getReleased());
-      }
-      if (hasCreateTime()) {
-        hash = (37 * hash) + CREATETIME_FIELD_NUMBER;
-        hash = (53 * hash) + hashLong(getCreateTime());
-      }
-      if (hasStartTime()) {
-        hash = (37 * hash) + STARTTIME_FIELD_NUMBER;
-        hash = (53 * hash) + hashLong(getStartTime());
-      }
-      if (hasHost()) {
-        hash = (37 * hash) + HOST_FIELD_NUMBER;
-        hash = (53 * hash) + getHost().hashCode();
-      }
-      if (hasHostURL()) {
-        hash = (37 * hash) + HOSTURL_FIELD_NUMBER;
-        hash = (53 * hash) + getHostURL().hashCode();
-      }
-      if (hasAppVersion()) {
-        hash = (37 * hash) + APPVERSION_FIELD_NUMBER;
-        hash = (53 * hash) + getAppVersion().hashCode();
-      }
-      hash = (29 * hash) + getUnknownFields().hashCode();
-      memoizedHashCode = hash;
-      return hash;
-    }
-
-    public static org.apache.slider.api.proto.Messages.RoleInstanceState parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.slider.api.proto.Messages.RoleInstanceState parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.slider.api.proto.Messages.RoleInstanceState parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.slider.api.proto.Messages.RoleInstanceState parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.slider.api.proto.Messages.RoleInstanceState parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.apache.slider.api.proto.Messages.RoleInstanceState parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input, extensionRegistry);
-    }
-    public static org.apache.slider.api.proto.Messages.RoleInstanceState parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static org.apache.slider.api.proto.Messages.RoleInstanceState parseDelimitedFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input, extensionRegistry);
-    }
-    public static org.apache.slider.api.proto.Messages.RoleInstanceState parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.apache.slider.api.proto.Messages.RoleInstanceState parseFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input, extensionRegistry);
-    }
-
-    public static Builder newBuilder() { return Builder.create(); }
-    public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.apache.slider.api.proto.Messages.RoleInstanceState prototype) {
-      return newBuilder().mergeFrom(prototype);
-    }
-    public Builder toBuilder() { return newBuilder(this); }
-
-    @java.lang.Override
-    protected Builder newBuilderForType(
-        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-      Builder builder = new Builder(parent);
-      return builder;
-    }
-    /**
-     * Protobuf type {@code org.apache.slider.api.RoleInstanceState}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.apache.slider.api.proto.Messages.RoleInstanceStateOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_RoleInstanceState_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_RoleInstanceState_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.apache.slider.api.proto.Messages.RoleInstanceState.class, org.apache.slider.api.proto.Messages.RoleInstanceState.Builder.class);
-      }
-
-      // Construct using org.apache.slider.api.proto.Messages.RoleInstanceState.newBuilder()
-      private Builder() {
-        maybeForceBuilderInitialization();
-      }
-
-      private Builder(
-          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-        super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
-        }
-      }
-      private static Builder create() {
-        return new Builder();
-      }
-
-      public Builder clear() {
-        super.clear();
-        name_ = "";
-        bitField0_ = (bitField0_ & ~0x00000001);
-        role_ = "";
-        bitField0_ = (bitField0_ & ~0x00000002);
-        state_ = 0;
-        bitField0_ = (bitField0_ & ~0x00000004);
-        exitCode_ = 0;
-        bitField0_ = (bitField0_ & ~0x00000008);
-        command_ = "";
-        bitField0_ = (bitField0_ & ~0x00000010);
-        diagnostics_ = "";
-        bitField0_ = (bitField0_ & ~0x00000020);
-        output_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-        bitField0_ = (bitField0_ & ~0x00000040);
-        environment_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-        bitField0_ = (bitField0_ & ~0x00000080);
-        roleId_ = 0;
-        bitField0_ = (bitField0_ & ~0x00000100);
-        released_ = false;
-        bitField0_ = (bitField0_ & ~0x00000200);
-        createTime_ = 0L;
-        bitField0_ = (bitField0_ & ~0x00000400);
-        startTime_ = 0L;
-        bitField0_ = (bitField0_ & ~0x00000800);
-        host_ = "";
-        bitField0_ = (bitField0_ & ~0x00001000);
-        hostURL_ = "";
-        bitField0_ = (bitField0_ & ~0x00002000);
-        appVersion_ = "";
-        bitField0_ = (bitField0_ & ~0x00004000);
-        return this;
-      }
-
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_RoleInstanceState_descriptor;
-      }
-
-      public org.apache.slider.api.proto.Messages.RoleInstanceState getDefaultInstanceForType() {
-        return org.apache.slider.api.proto.Messages.RoleInstanceState.getDefaultInstance();
-      }
-
-      public org.apache.slider.api.proto.Messages.RoleInstanceState build() {
-        org.apache.slider.api.proto.Messages.RoleInstanceState result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.apache.slider.api.proto.Messages.RoleInstanceState buildPartial() {
-        org.apache.slider.api.proto.Messages.RoleInstanceState result = new org.apache.slider.api.proto.Messages.RoleInstanceState(this);
-        int from_bitField0_ = bitField0_;
-        int to_bitField0_ = 0;
-        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
-          to_bitField0_ |= 0x00000001;
-        }
-        result.name_ = name_;
-        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
-          to_bitField0_ |= 0x00000002;
-        }
-        result.role_ = role_;
-        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
-          to_bitField0_ |= 0x00000004;
-        }
-        result.state_ = state_;
-        if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
-          to_bitField0_ |= 0x00000008;
-        }
-        result.exitCode_ = exitCode_;
-        if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
-          to_bitField0_ |= 0x00000010;
-        }
-        result.command_ = command_;
-        if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
-          to_bitField0_ |= 0x00000020;
-        }
-        result.diagnostics_ = diagnostics_;
-        if (((bitField0_ & 0x00000040) == 0x00000040)) {
-          output_ = new com.google.protobuf.UnmodifiableLazyStringList(
-              output_);
-          bitField0_ = (bitField0_ & ~0x00000040);
-        }
-        result.output_ = output_;
-        if (((bitField0_ & 0x00000080) == 0x00000080)) {
-          environment_ = new com.google.protobuf.UnmodifiableLazyStringList(
-              environment_);
-          bitField0_ = (bitField0_ & ~0x00000080);
-        }
-        result.environment_ = environment_;
-        if (((from_bitField0_ & 0x00000100) == 0x00000100)) {
-          to_bitField0_ |= 0x00000040;
-        }
-        result.roleId_ = roleId_;
-        if (((from_bitField0_ & 0x00000200) == 0x00000200)) {
-          to_bitField0_ |= 0x00000080;
-        }
-        result.released_ = released_;
-        if (((from_bitField0_ & 0x00000400) == 0x00000400)) {
-          to_bitField0_ |= 0x00000100;
-        }
-        result.createTime_ = createTime_;
-        if (((from_bitField0_ & 0x00000800) == 0x00000800)) {
-          to_bitField0_ |= 0x00000200;
-        }
-        result.startTime_ = startTime_;
-        if (((from_bitField0_ & 0x00001000) == 0x00001000)) {
-          to_bitField0_ |= 0x00000400;
-        }
-        result.host_ = host_;
-        if (((from_bitField0_ & 0x00002000) == 0x00002000)) {
-          to_bitField0_ |= 0x00000800;
-        }
-        result.hostURL_ = hostURL_;
-        if (((from_bitField0_ & 0x00004000) == 0x00004000)) {
-          to_bitField0_ |= 0x00001000;
-        }
-        result.appVersion_ = appVersion_;
-        result.bitField0_ = to_bitField0_;
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.apache.slider.api.proto.Messages.RoleInstanceState) {
-          return mergeFrom((org.apache.slider.api.proto.Messages.RoleInstanceState)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.apache.slider.api.proto.Messages.RoleInstanceState other) {
-        if (other == org.apache.slider.api.proto.Messages.RoleInstanceState.getDefaultInstance()) return this;
-        if (other.hasName()) {
-          bitField0_ |= 0x00000001;
-          name_ = other.name_;
-          onChanged();
-        }
-        if (other.hasRole()) {
-          bitField0_ |= 0x00000002;
-          role_ = other.role_;
-          onChanged();
-        }
-        if (other.hasState()) {
-          setState(other.getState());
-        }
-        if (other.hasExitCode()) {
-          setExitCode(other.getExitCode());
-        }
-        if (other.hasCommand()) {
-          bitField0_ |= 0x00000010;
-          command_ = other.command_;
-          onChanged();
-        }
-        if (other.hasDiagnostics()) {
-          bitField0_ |= 0x00000020;
-          diagnostics_ = other.diagnostics_;
-          onChanged();
-        }
-        if (!other.output_.isEmpty()) {
-          if (output_.isEmpty()) {
-            output_ = other.output_;
-            bitField0_ = (bitField0_ & ~0x00000040);
-          } else {
-            ensureOutputIsMutable();
-            output_.addAll(other.output_);
-          }
-          onChanged();
-        }
-        if (!other.environment_.isEmpty()) {
-          if (environment_.isEmpty()) {
-            environment_ = other.environment_;
-            bitField0_ = (bitField0_ & ~0x00000080);
-          } else {
-            ensureEnvironmentIsMutable();
-            environment_.addAll(other.environment_);
-          }
-          onChanged();
-        }
-        if (other.hasRoleId()) {
-          setRoleId(other.getRoleId());
-        }
-        if (other.hasReleased()) {
-          setReleased(other.getReleased());
-        }
-        if (other.hasCreateTime()) {
-          setCreateTime(other.getCreateTime());
-        }
-        if (other.hasStartTime()) {
-          setStartTime(other.getStartTime());
-        }
-        if (other.hasHost()) {
-          bitField0_ |= 0x00001000;
-          host_ = other.host_;
-          onChanged();
-        }
-        if (other.hasHostURL()) {
-          bitField0_ |= 0x00002000;
-          hostURL_ = other.hostURL_;
-          onChanged();
-        }
-        if (other.hasAppVersion()) {
-          bitField0_ |= 0x00004000;
-          appVersion_ = other.appVersion_;
-          onChanged();
-        }
-        this.mergeUnknownFields(other.getUnknownFields());
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        if (!hasName()) {
-          
-          return false;
-        }
-        if (!hasState()) {
-          
-          return false;
-        }
-        if (!hasExitCode()) {
-          
-          return false;
-        }
-        if (!hasRoleId()) {
-          
-          return false;
-        }
-        if (!hasReleased()) {
-          
-          return false;
-        }
-        if (!hasCreateTime()) {
-          
-          return false;
-        }
-        if (!hasStartTime()) {
-          
-          return false;
-        }
-        if (!hasHost()) {
-          
-          return false;
-        }
-        if (!hasHostURL()) {
-          
-          return false;
-        }
-        return true;
-      }
-
-      public Builder mergeFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        org.apache.slider.api.proto.Messages.RoleInstanceState parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.apache.slider.api.proto.Messages.RoleInstanceState) e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-      private int bitField0_;
-
-      // required string name = 1;
-      private java.lang.Object name_ = "";
-      /**
-       * <code>required string name = 1;</code>
-       */
-      public boolean hasName() {
-        return ((bitField0_ & 0x00000001) == 0x00000001);
-      }
-      /**
-       * <code>required string name = 1;</code>
-       */
-      public java.lang.String getName() {
-        java.lang.Object ref = name_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          name_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>required string name = 1;</code>
-       */
-      public com.google.protobuf.ByteString
-          getNameBytes() {
-        java.lang.Object ref = name_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          name_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>required string name = 1;</code>
-       */
-      public Builder setName(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        name_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string name = 1;</code>
-       */
-      public Builder clearName() {
-        bitField0_ = (bitField0_ & ~0x00000001);
-        name_ = getDefaultInstance().getName();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string name = 1;</code>
-       */
-      public Builder setNameBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        name_ = value;
-        onChanged();
-        return this;
-      }
-
-      // optional string role = 2;
-      private java.lang.Object role_ = "";
-      /**
-       * <code>optional string role = 2;</code>
-       */
-      public boolean hasRole() {
-        return ((bitField0_ & 0x00000002) == 0x00000002);
-      }
-      /**
-       * <code>optional string role = 2;</code>
-       */
-      public java.lang.String getRole() {
-        java.lang.Object ref = role_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          role_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string role = 2;</code>
-       */
-      public com.google.protobuf.ByteString
-          getRoleBytes() {
-        java.lang.Object ref = role_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          role_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string role = 2;</code>
-       */
-      public Builder setRole(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000002;
-        role_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string role = 2;</code>
-       */
-      public Builder clearRole() {
-        bitField0_ = (bitField0_ & ~0x00000002);
-        role_ = getDefaultInstance().getRole();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string role = 2;</code>
-       */
-      public Builder setRoleBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000002;
-        role_ = value;
-        onChanged();
-        return this;
-      }
-
-      // required uint32 state = 4;
-      private int state_ ;
-      /**
-       * <code>required uint32 state = 4;</code>
-       */
-      public boolean hasState() {
-        return ((bitField0_ & 0x00000004) == 0x00000004);
-      }
-      /**
-       * <code>required uint32 state = 4;</code>
-       */
-      public int getState() {
-        return state_;
-      }
-      /**
-       * <code>required uint32 state = 4;</code>
-       */
-      public Builder setState(int value) {
-        bitField0_ |= 0x00000004;
-        state_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required uint32 state = 4;</code>
-       */
-      public Builder clearState() {
-        bitField0_ = (bitField0_ & ~0x00000004);
-        state_ = 0;
-        onChanged();
-        return this;
-      }
-
-      // required uint32 exitCode = 5;
-      private int exitCode_ ;
-      /**
-       * <code>required uint32 exitCode = 5;</code>
-       */
-      public boolean hasExitCode() {
-        return ((bitField0_ & 0x00000008) == 0x00000008);
-      }
-      /**
-       * <code>required uint32 exitCode = 5;</code>
-       */
-      public int getExitCode() {
-        return exitCode_;
-      }
-      /**
-       * <code>required uint32 exitCode = 5;</code>
-       */
-      public Builder setExitCode(int value) {
-        bitField0_ |= 0x00000008;
-        exitCode_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required uint32 exitCode = 5;</code>
-       */
-      public Builder clearExitCode() {
-        bitField0_ = (bitField0_ & ~0x00000008);
-        exitCode_ = 0;
-        onChanged();
-        return this;
-      }
-
-      // optional string command = 6;
-      private java.lang.Object command_ = "";
-      /**
-       * <code>optional string command = 6;</code>
-       */
-      public boolean hasCommand() {
-        return ((bitField0_ & 0x00000010) == 0x00000010);
-      }
-      /**
-       * <code>optional string command = 6;</code>
-       */
-      public java.lang.String getCommand() {
-        java.lang.Object ref = command_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          command_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string command = 6;</code>
-       */
-      public com.google.protobuf.ByteString
-          getCommandBytes() {
-        java.lang.Object ref = command_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          command_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string command = 6;</code>
-       */
-      public Builder setCommand(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000010;
-        command_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string command = 6;</code>
-       */
-      public Builder clearCommand() {
-        bitField0_ = (bitField0_ & ~0x00000010);
-        command_ = getDefaultInstance().getCommand();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string command = 6;</code>
-       */
-      public Builder setCommandBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000010;
-        command_ = value;
-        onChanged();
-        return this;
-      }
-
-      // optional string diagnostics = 7;
-      private java.lang.Object diagnostics_ = "";
-      /**
-       * <code>optional string diagnostics = 7;</code>
-       */
-      public boolean hasDiagnostics() {
-        return ((bitField0_ & 0x00000020) == 0x00000020);
-      }
-      /**
-       * <code>optional string diagnostics = 7;</code>
-       */
-      public java.lang.String getDiagnostics() {
-        java.lang.Object ref = diagnostics_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          diagnostics_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string diagnostics = 7;</code>
-       */
-      public com.google.protobuf.ByteString
-          getDiagnosticsBytes() {
-        java.lang.Object ref = diagnostics_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          diagnostics_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string diagnostics = 7;</code>
-       */
-      public Builder setDiagnostics(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000020;
-        diagnostics_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string diagnostics = 7;</code>
-       */
-      public Builder clearDiagnostics() {
-        bitField0_ = (bitField0_ & ~0x00000020);
-        diagnostics_ = getDefaultInstance().getDiagnostics();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string diagnostics = 7;</code>
-       */
-      public Builder setDiagnosticsBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000020;
-        diagnostics_ = value;
-        onChanged();
-        return this;
-      }
-
-      // repeated string output = 8;
-      private com.google.protobuf.LazyStringList output_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-      private void ensureOutputIsMutable() {
-        if (!((bitField0_ & 0x00000040) == 0x00000040)) {
-          output_ = new com.google.protobuf.LazyStringArrayList(output_);
-          bitField0_ |= 0x00000040;
-         }
-      }
-      /**
-       * <code>repeated string output = 8;</code>
-       */
-      public java.util.List<java.lang.String>
-          getOutputList() {
-        return java.util.Collections.unmodifiableList(output_);
-      }
-      /**
-       * <code>repeated string output = 8;</code>
-       */
-      public int getOutputCount() {
-        return output_.size();
-      }
-      /**
-       * <code>repeated string output = 8;</code>
-       */
-      public java.lang.String getOutput(int index) {
-        return output_.get(index);
-      }
-      /**
-       * <code>repeated string output = 8;</code>
-       */
-      public com.google.protobuf.ByteString
-          getOutputBytes(int index) {
-        return output_.getByteString(index);
-      }
-      /**
-       * <code>repeated string output = 8;</code>
-       */
-      public Builder setOutput(
-          int index, java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureOutputIsMutable();
-        output_.set(index, value);
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>repeated string output = 8;</code>
-       */
-      public Builder addOutput(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureOutputIsMutable();
-        output_.add(value);
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>repeated string output = 8;</code>
-       */
-      public Builder addAllOutput(
-          java.lang.Iterable<java.lang.String> values) {
-        ensureOutputIsMutable();
-        super.addAll(values, output_);
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>repeated string output = 8;</code>
-       */
-      public Builder clearOutput() {
-        output_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-        bitField0_ = (bitField0_ & ~0x00000040);
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>repeated string output = 8;</code>
-       */
-      public Builder addOutputBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureOutputIsMutable();
-        output_.add(value);
-        onChanged();
-        return this;
-      }
-
-      // repeated string environment = 9;
-      private com.google.protobuf.LazyStringList environment_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-      private void ensureEnvironmentIsMutable() {
-        if (!((bitField0_ & 0x00000080) == 0x00000080)) {
-          environment_ = new com.google.protobuf.LazyStringArrayList(environment_);
-          bitField0_ |= 0x00000080;
-         }
-      }
-      /**
-       * <code>repeated string environment = 9;</code>
-       */
-      public java.util.List<java.lang.String>
-          getEnvironmentList() {
-        return java.util.Collections.unmodifiableList(environment_);
-      }
-      /**
-       * <code>repeated string environment = 9;</code>
-       */
-      public int getEnvironmentCount() {
-        return environment_.size();
-      }
-      /**
-       * <code>repeated string environment = 9;</code>
-       */
-      public java.lang.String getEnvironment(int index) {
-        return environment_.get(index);
-      }
-      /**
-       * <code>repeated string environment = 9;</code>
-       */
-      public com.google.protobuf.ByteString
-          getEnvironmentBytes(int index) {
-        return environment_.getByteString(index);
-      }
-      /**
-       * <code>repeated string environment = 9;</code>
-       */
-      public Builder setEnvironment(
-          int index, java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureEnvironmentIsMutable();
-        environment_.set(index, value);
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>repeated string environment = 9;</code>
-       */
-      public Builder addEnvironment(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureEnvironmentIsMutable();
-        environment_.add(value);
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>repeated string environment = 9;</code>
-       */
-      public Builder addAllEnvironment(
-          java.lang.Iterable<java.lang.String> values) {
-        ensureEnvironmentIsMutable();
-        super.addAll(values, environment_);
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>repeated string environment = 9;</code>
-       */
-      public Builder clearEnvironment() {
-        environment_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-        bitField0_ = (bitField0_ & ~0x00000080);
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>repeated string environment = 9;</code>
-       */
-      public Builder addEnvironmentBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureEnvironmentIsMutable();
-        environment_.add(value);
-        onChanged();
-        return this;
-      }
-
-      // required uint32 roleId = 10;
-      private int roleId_ ;
-      /**
-       * <code>required uint32 roleId = 10;</code>
-       */
-      public boolean hasRoleId() {
-        return ((bitField0_ & 0x00000100) == 0x00000100);
-      }
-      /**
-       * <code>required uint32 roleId = 10;</code>
-       */
-      public int getRoleId() {
-        return roleId_;
-      }
-      /**
-       * <code>required uint32 roleId = 10;</code>
-       */
-      public Builder setRoleId(int value) {
-        bitField0_ |= 0x00000100;
-        roleId_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required uint32 roleId = 10;</code>
-       */
-      public Builder clearRoleId() {
-        bitField0_ = (bitField0_ & ~0x00000100);
-        roleId_ = 0;
-        onChanged();
-        return this;
-      }
-
-      // required bool released = 11;
-      private boolean released_ ;
-      /**
-       * <code>required bool released = 11;</code>
-       */
-      public boolean hasReleased() {
-        return ((bitField0_ & 0x00000200) == 0x00000200);
-      }
-      /**
-       * <code>required bool released = 11;</code>
-       */
-      public boolean getReleased() {
-        return released_;
-      }
-      /**
-       * <code>required bool released = 11;</code>
-       */
-      public Builder setReleased(boolean value) {
-        bitField0_ |= 0x00000200;
-        released_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required bool released = 11;</code>
-       */
-      public Builder clearReleased() {
-        bitField0_ = (bitField0_ & ~0x00000200);
-        released_ = false;
-        onChanged();
-        return this;
-      }
-
-      // required int64 createTime = 12;
-      private long createTime_ ;
-      /**
-       * <code>required int64 createTime = 12;</code>
-       */
-      public boolean hasCreateTime() {
-        return ((bitField0_ & 0x00000400) == 0x00000400);
-      }
-      /**
-       * <code>required int64 createTime = 12;</code>
-       */
-      public long getCreateTime() {
-        return createTime_;
-      }
-      /**
-       * <code>required int64 createTime = 12;</code>
-       */
-      public Builder setCreateTime(long value) {
-        bitField0_ |= 0x00000400;
-        createTime_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required int64 createTime = 12;</code>
-       */
-      public Builder clearCreateTime() {
-        bitField0_ = (bitField0_ & ~0x00000400);
-        createTime_ = 0L;
-        onChanged();
-        return this;
-      }
-
-      // required int64 startTime = 13;
-      private long startTime_ ;
-      /**
-       * <code>required int64 startTime = 13;</code>
-       */
-      public boolean hasStartTime() {
-        return ((bitField0_ & 0x00000800) == 0x00000800);
-      }
-      /**
-       * <code>required int64 startTime = 13;</code>
-       */
-      public long getStartTime() {
-        return startTime_;
-      }
-      /**
-       * <code>required int64 startTime = 13;</code>
-       */
-      public Builder setStartTime(long value) {
-        bitField0_ |= 0x00000800;
-        startTime_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required int64 startTime = 13;</code>
-       */
-      public Builder clearStartTime() {
-        bitField0_ = (bitField0_ & ~0x00000800);
-        startTime_ = 0L;
-        onChanged();
-        return this;
-      }
-
-      // required string host = 14;
-      private java.lang.Object host_ = "";
-      /**
-       * <code>required string host = 14;</code>
-       */
-      public boolean hasHost() {
-        return ((bitField0_ & 0x00001000) == 0x00001000);
-      }
-      /**
-       * <code>required string host = 14;</code>
-       */
-      public java.lang.String getHost() {
-        java.lang.Object ref = host_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          host_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>required string host = 14;</code>
-       */
-      public com.google.protobuf.ByteString
-          getHostBytes() {
-        java.lang.Object ref = host_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          host_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>required string host = 14;</code>
-       */
-      public Builder setHost(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00001000;
-        host_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string host = 14;</code>
-       */
-      public Builder clearHost() {
-        bitField0_ = (bitField0_ & ~0x00001000);
-        host_ = getDefaultInstance().getHost();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string host = 14;</code>
-       */
-      public Builder setHostBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00001000;
-        host_ = value;
-        onChanged();
-        return this;
-      }
-
-      // required string hostURL = 15;
-      private java.lang.Object hostURL_ = "";
-      /**
-       * <code>required string hostURL = 15;</code>
-       */
-      public boolean hasHostURL() {
-        return ((bitField0_ & 0x00002000) == 0x00002000);
-      }
-      /**
-       * <code>required string hostURL = 15;</code>
-       */
-      public java.lang.String getHostURL() {
-        java.lang.Object ref = hostURL_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          hostURL_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>required string hostURL = 15;</code>
-       */
-      public com.google.protobuf.ByteString
-          getHostURLBytes() {
-        java.lang.Object ref = hostURL_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          hostURL_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>required string hostURL = 15;</code>
-       */
-      public Builder setHostURL(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00002000;
-        hostURL_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string hostURL = 15;</code>
-       */
-      public Builder clearHostURL() {
-        bitField0_ = (bitField0_ & ~0x00002000);
-        hostURL_ = getDefaultInstance().getHostURL();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string hostURL = 15;</code>
-       */
-      public Builder setHostURLBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00002000;
-        hostURL_ = value;
-        onChanged();
-        return this;
-      }
-
-      // optional string appVersion = 16;
-      private java.lang.Object appVersion_ = "";
-      /**
-       * <code>optional string appVersion = 16;</code>
-       */
-      public boolean hasAppVersion() {
-        return ((bitField0_ & 0x00004000) == 0x00004000);
-      }
-      /**
-       * <code>optional string appVersion = 16;</code>
-       */
-      public java.lang.String getAppVersion() {
-        java.lang.Object ref = appVersion_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          appVersion_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string appVersion = 16;</code>
-       */
-      public com.google.protobuf.ByteString
-          getAppVersionBytes() {
-        java.lang.Object ref = appVersion_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          appVersion_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string appVersion = 16;</code>
-       */
-      public Builder setAppVersion(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00004000;
-        appVersion_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string appVersion = 16;</code>
-       */
-      public Builder clearAppVersion() {
-        bitField0_ = (bitField0_ & ~0x00004000);
-        appVersion_ = getDefaultInstance().getAppVersion();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string appVersion = 16;</code>
-       */
-      public Builder setAppVersionBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00004000;
-        appVersion_ = value;
-        onChanged();
-        return this;
-      }
-
-      // @@protoc_insertion_point(builder_scope:org.apache.slider.api.RoleInstanceState)
-    }
-
-    static {
-      defaultInstance = new RoleInstanceState(true);
-      defaultInstance.initFields();
-    }
-
-    // @@protoc_insertion_point(class_scope:org.apache.slider.api.RoleInstanceState)
-  }
-
-  public interface StopClusterRequestProtoOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-
-    // required string message = 1;
-    /**
-     * <code>required string message = 1;</code>
-     *
-     * <pre>
-     **
-     *message to include
-     * </pre>
-     */
-    boolean hasMessage();
-    /**
-     * <code>required string message = 1;</code>
-     *
-     * <pre>
-     **
-     *message to include
-     * </pre>
-     */
-    java.lang.String getMessage();
-    /**
-     * <code>required string message = 1;</code>
-     *
-     * <pre>
-     **
-     *message to include
-     * </pre>
-     */
-    com.google.protobuf.ByteString
-        getMessageBytes();
-  }
-  /**
-   * Protobuf type {@code org.apache.slider.api.StopClusterRequestProto}
-   *
-   * <pre>
-   **
-   * stop the cluster
-   * </pre>
-   */
-  public static final class StopClusterRequestProto extends
-      com.google.protobuf.GeneratedMessage
-      implements StopClusterRequestProtoOrBuilder {
-    // Use StopClusterRequestProto.newBuilder() to construct.
-    private StopClusterRequestProto(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private StopClusterRequestProto(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final StopClusterRequestProto defaultInstance;
-    public static StopClusterRequestProto getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public StopClusterRequestProto getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private StopClusterRequestProto(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      initFields();
-      int mutable_bitField0_ = 0;
-      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
-          com.google.protobuf.UnknownFieldSet.newBuilder();
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 10: {
-              bitField0_ |= 0x00000001;
-              message_ = input.readBytes();
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e.getMessage()).setUnfinishedMessage(this);
-      } finally {
-        this.unknownFields = unknownFields.build();
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_StopClusterRequestProto_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.apache.slider.api.proto.Messages.internal_static_org_apache_slider_api_StopClusterRequestProto_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.apache.slider.api.proto.Messages.StopClusterRequestProto.class, org.apache.slider.api.proto.Messages.StopClusterRequestProto.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<StopClusterRequestProto> PARSER =
-        new com.google.protobuf.AbstractParser<StopClusterRequestProto>() {
-      public StopClusterRequestProto parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new StopClusterRequestProto(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<StopClusterRequestProto> getParserForType() {
-      return PARSER;
-    }
-
-    private int bitField0_;
-    // required string message = 1;
-    public static final int MESSAGE_FIELD_NUMBER = 1;
-    private java.lang.Object message_;
-    /**
-     * <code>required string message = 1;</code>
-     *
-     * <pre>
-     **
-     *message to include
-     * </pre>
-     */
-    public boolean hasMessage() {
-      return ((bitField0_ & 0x00000001) == 0x00000001);
-    }
-    /**
-     * <code>required string message = 1;</code>
-     *
-     * <pre>
-     **
-     *message to include
-     * </pre>
-     */
-    public java.lang.String getMessage() {
-      java.lang.Object ref = message_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          message_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>required string message = 1;</code>
-     *
-     * <pre>
-     **
-     *message to include
-     * </pre>
-     */
-    public com.google.protobuf.ByteString
-        getMessageBytes() {
-      java.lang.Object ref = message_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        message_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    private void initFields() {
-      message_ = "";
-    }
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
-
-      if (!hasMessage()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      getSerializedSize();
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        output.writeBytes(1, getMessageBytes());
-      }
-      getUnknownFields().writeTo(output);
-    }
-
-    private int memoizedSerializedSize = -1;
-    public int getSerializedSize() {
-      int size = memoizedSerializedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(1, getMessageBytes());
-      }
-      size += getUnknownFields().getSerializedSize();
-      memoizedSerializedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    protected java.lang.Object writeReplace()
-        throws java.io.ObjectStreamException {
-      return super.writeReplace();
-    }
-
-    @java.lang.Override
-    public boolean equals(final java.lang.Object obj) {
-      if (obj == this) {
-       return true;
-      }
-      if (!(obj instanceof org.apache.slider.api.proto.Messages.StopClusterRequestProto)) {
-        return super.equals(obj);
-      }
-      org.apache.slider.api.proto.Messages.StopClusterRequestProto other = (org.apache.slider.api.proto.Messages.StopClusterRequestProto) obj;
-
-      boolean result = true;
-      result = result && (hasMessage() == other.hasMessage());
-      if (hasMessage()) {
-        result = result && getMessage()
-            .equals(other.getMessage());
-      }
-      result = result &&
-          getUnknownFields().equals(other.getUnknownFields());
-      return result;
-    }
-
-    private int memoizedHashCode = 0;
-    @java.lang.Override
-    public int hashCode() {
-      if (memoizedHashCode != 0) {
-        return memoizedHashCode;
-      }
-      int hash = 41;
-      hash = (19 * hash) + getDescriptorForType().hashCode();
-      if (hasMessage()) {
-        hash = (37 * hash) + MESSAGE_FIELD_NUMBER;
-        hash = (53 * hash) + getMessage().hashCode();
-      }
-      hash = (29 * hash) + getUnknownFields().hashCode();
-      memoizedHashCode = hash;
-      return hash;
-    }
-
-    public static org.apache.slider.api.proto.Messages.StopClusterRequestProto parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.slider.api.proto.Messages.StopClusterRequestProto parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.slider.api.proto.Messages.StopClusterRequestProto parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.slider.api.proto.Messages.StopClusterRequestProto parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.slider.api.proto.Messages.StopClusterRequestProto parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.apache.slider.api.proto.Messages.StopClusterRequestProto parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      retu

<TRUNCATED>


[17/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java
deleted file mode 100644
index 37e9a7f..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
-import org.apache.slider.api.ClusterDescription;
-import org.apache.slider.api.ClusterNode;
-import org.apache.slider.api.types.ApplicationLivenessInformation;
-import org.apache.slider.api.types.ComponentInformation;
-import org.apache.slider.api.types.NodeInformation;
-import org.apache.slider.api.types.RoleStatistics;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.exceptions.NoSuchNodeException;
-import org.apache.slider.core.registry.docstore.PublishedConfigSet;
-import org.apache.slider.core.registry.docstore.PublishedExportsSet;
-import org.apache.slider.server.appmaster.web.rest.RestPaths;
-import org.apache.slider.server.services.utility.PatternValidator;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Implementation of {@link StateAccessForProviders}, which means
- * state access for providers, web UI and IPC/REST views.
- */
-public class ProviderAppState implements StateAccessForProviders {
-
-
-  private final Map<String, PublishedConfigSet> publishedConfigSets =
-      new ConcurrentHashMap<>(5);
-  private final PublishedExportsSet publishedExportsSets = new PublishedExportsSet();
-  private static final PatternValidator validator = new PatternValidator(
-      RestPaths.PUBLISHED_CONFIGURATION_SET_REGEXP);
-  private String applicationName;
-
-  private final AppState appState;
-
-  public ProviderAppState(String applicationName, AppState appState) {
-    this.appState = appState;
-    this.applicationName = applicationName;
-  }
-
-  public void setApplicationName(String applicationName) {
-    this.applicationName = applicationName;
-  }
-
-  @Override
-  public String getApplicationName() {
-    return applicationName;
-  }
-
-  @Override
-  public PublishedConfigSet getPublishedSliderConfigurations() {
-    return getOrCreatePublishedConfigSet(RestPaths.SLIDER_CONFIGSET);
-  }
-
-  @Override
-  public PublishedExportsSet getPublishedExportsSet() {
-    return publishedExportsSets;
-  }
-
-  @Override
-  public PublishedConfigSet getPublishedConfigSet(String name) {
-    return publishedConfigSets.get(name);
-  }
-
-  @Override
-  public PublishedConfigSet getOrCreatePublishedConfigSet(String name) {
-    PublishedConfigSet set = publishedConfigSets.get(name);
-    if (set == null) {
-      validator.validate(name);
-      synchronized (publishedConfigSets) {
-        // synchronized double check to ensure that there is never an overridden
-        // config set created
-        set = publishedConfigSets.get(name);
-        if (set == null) {
-          set = new PublishedConfigSet();
-          publishedConfigSets.put(name, set);
-        }
-      }
-    }
-    return set;
-  }
-
-  @Override
-  public List<String> listConfigSets() {
-
-    synchronized (publishedConfigSets) {
-      List<String> sets = new ArrayList<>(publishedConfigSets.keySet());
-      return sets;
-    }
-  }
-
-  @Override
-  public Map<Integer, RoleStatus> getRoleStatusMap() {
-    return appState.getRoleStatusMap();
-  }
-
-
-  @Override
-  public Map<ContainerId, RoleInstance> getFailedContainers() {
-    return appState.getFailedContainers();
-  }
-
-  @Override
-  public Map<ContainerId, RoleInstance> getLiveContainers() {
-    return appState.getLiveContainers();
-  }
-
-  @Override
-  public ClusterDescription getClusterStatus() {
-    return appState.getClusterStatus();
-  }
-
-  @Override
-  public ConfTreeOperations getResourcesSnapshot() {
-    return appState.getResourcesSnapshot();
-  }
-
-  @Override
-  public ConfTreeOperations getAppConfSnapshot() {
-    return appState.getAppConfSnapshot();
-  }
-
-  @Override
-  public ConfTreeOperations getInternalsSnapshot() {
-    return appState.getInternalsSnapshot();
-  }
-
-  @Override
-  public boolean isApplicationLive() {
-    return appState.isApplicationLive();
-  }
-
-  @Override
-  public long getSnapshotTime() {
-    return appState.getSnapshotTime();
-  }
-
-  @Override
-  public AggregateConf getInstanceDefinitionSnapshot() {
-    return appState.getInstanceDefinitionSnapshot();
-  }
-  
-  @Override
-  public AggregateConf getUnresolvedInstanceDefinition() {
-    return appState.getUnresolvedInstanceDefinition();
-  }
-
-  @Override
-  public RoleStatus lookupRoleStatus(int key) {
-    return appState.lookupRoleStatus(key);
-  }
-
-  @Override
-  public RoleStatus lookupRoleStatus(Container c) throws YarnRuntimeException {
-    return appState.lookupRoleStatus(c);
-  }
-
-  @Override
-  public RoleStatus lookupRoleStatus(String name) throws YarnRuntimeException {
-    return appState.lookupRoleStatus(name);
-  }
-
-  @Override
-  public List<RoleInstance> cloneOwnedContainerList() {
-    return appState.cloneOwnedContainerList();
-  }
-
-  @Override
-  public int getNumOwnedContainers() {
-    return appState.getNumOwnedContainers();
-  }
-
-  @Override
-  public RoleInstance getOwnedContainer(ContainerId id) {
-    return appState.getOwnedContainer(id);
-  }
-
-  @Override
-  public RoleInstance getOwnedContainer(String id) throws NoSuchNodeException {
-    return appState.getOwnedInstanceByContainerID(id);
-  }
-
-  @Override
-  public List<RoleInstance> cloneLiveContainerInfoList() {
-    return appState.cloneLiveContainerInfoList();
-  }
-
-  @Override
-  public RoleInstance getLiveInstanceByContainerID(String containerId) throws
-      NoSuchNodeException {
-    return appState.getLiveInstanceByContainerID(containerId);
-  }
-
-  @Override
-  public List<RoleInstance> getLiveInstancesByContainerIDs(Collection<String> containerIDs) {
-    return appState.getLiveInstancesByContainerIDs(containerIDs);
-  }
-
-  @Override
-  public ClusterDescription refreshClusterStatus() {
-    return appState.refreshClusterStatus();
-  }
-
-  @Override
-  public List<RoleStatus> cloneRoleStatusList() {
-    return appState.cloneRoleStatusList();
-  }
-
-  @Override
-  public ApplicationLivenessInformation getApplicationLivenessInformation() {
-    return appState.getApplicationLivenessInformation();
-  }
-
-  @Override
-  public Map<String, Integer> getLiveStatistics() {
-    return appState.getLiveStatistics();
-  }
-
-  @Override
-  public Map<String, ComponentInformation> getComponentInfoSnapshot() {
-    return appState.getComponentInfoSnapshot();
-  }
-
-  @Override
-  public Map<String, Map<String, ClusterNode>> getRoleClusterNodeMapping() {
-    return appState.createRoleToClusterNodeMap();
-  }
-
-  @Override
-  public List<RoleInstance> enumLiveInstancesInRole(String role) {
-    List<RoleInstance> nodes = new ArrayList<>();
-    Collection<RoleInstance> allRoleInstances = cloneLiveContainerInfoList();
-    for (RoleInstance node : allRoleInstances) {
-      if (role.isEmpty() || role.equals(node.role)) {
-        nodes.add(node);
-      }
-    }
-    return nodes;
-  }
-
-  @Override
-  public List<RoleInstance> lookupRoleContainers(String component) {
-    RoleStatus roleStatus = lookupRoleStatus(component);
-    List<RoleInstance> ownedContainerList = cloneOwnedContainerList();
-    List<RoleInstance> matching = new ArrayList<>(ownedContainerList.size());
-    int roleId = roleStatus.getPriority();
-    for (RoleInstance instance : ownedContainerList) {
-      if (instance.roleId == roleId) {
-        matching.add(instance);
-      }
-    }
-    return matching;
-  }
-  
-  @Override
-  public ComponentInformation getComponentInformation(String component) {
-    RoleStatus roleStatus = lookupRoleStatus(component);
-    ComponentInformation info = roleStatus.serialize();
-    List<RoleInstance> containers = lookupRoleContainers(component);
-    info.containers = new ArrayList<>(containers.size());
-    for (RoleInstance container : containers) {
-      info.containers.add(container.id);
-    }
-    return info;
-  }
-
-  @Override
-  public Map<String, NodeInformation> getNodeInformationSnapshot() {
-    return appState.getRoleHistory()
-      .getNodeInformationSnapshot(appState.buildNamingMap());
-  }
-
-  @Override
-  public NodeInformation getNodeInformation(String hostname) {
-    return appState.getRoleHistory()
-      .getNodeInformation(hostname, appState.buildNamingMap());
-  }
-
-  @Override
-  public RoleStatistics getRoleStatistics() {
-    return appState.getRoleStatistics();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHistory.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHistory.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHistory.java
deleted file mode 100644
index 4e8a4d7..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHistory.java
+++ /dev/null
@@ -1,1101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.NodeReport;
-import org.apache.hadoop.yarn.api.records.NodeState;
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.slider.api.types.NodeInformation;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.providers.ProviderRole;
-import org.apache.slider.server.appmaster.management.BoolMetric;
-import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
-import org.apache.slider.server.appmaster.management.Timestamp;
-import org.apache.slider.server.appmaster.operations.AbstractRMOperation;
-import org.apache.slider.server.avro.LoadedRoleHistory;
-import org.apache.slider.server.avro.NodeEntryRecord;
-import org.apache.slider.server.avro.RoleHistoryHeader;
-import org.apache.slider.server.avro.RoleHistoryWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * The Role History.
- * <p>
- * Synchronization policy: all public operations are synchronized.
- * Protected methods are in place for testing -no guarantees are made.
- * <p>
- * Inner classes have no synchronization guarantees; they should be manipulated 
- * in these classes and not externally.
- * <p>
- * Note that as well as some methods marked visible for testing, there
- * is the option for the time generator method, {@link #now()} to
- * be overridden so that a repeatable time series can be used.
- * 
- */
-public class RoleHistory {
-  protected static final Logger log =
-    LoggerFactory.getLogger(RoleHistory.class);
-  private final List<ProviderRole> providerRoles;
-  /** the roles in here are shared with App State */
-  private final Map<Integer, RoleStatus> roleStatusMap = new HashMap<>();
-  private final AbstractClusterServices recordFactory;
-
-  private long startTime;
-
-  /** Time when saved */
-  private final Timestamp saveTime = new Timestamp(0);
-
-  /** If the history was loaded, the time at which the history was saved.
-   * That is: the time the data was valid */
-  private final Timestamp thawedDataTime = new Timestamp(0);
-  
-  private NodeMap nodemap;
-  private int roleSize;
-  private final BoolMetric dirty = new BoolMetric(false);
-  private FileSystem filesystem;
-  private Path historyPath;
-  private RoleHistoryWriter historyWriter = new RoleHistoryWriter();
-
-  /**
-   * When were the nodes updated in a {@link #onNodesUpdated(List)} call?
-   * If zero: never.
-   */
-  private final Timestamp nodesUpdatedTime = new Timestamp(0);
-  private final BoolMetric nodeUpdateReceived = new BoolMetric(false);
-
-  private OutstandingRequestTracker outstandingRequests =
-    new OutstandingRequestTracker();
-
-  /**
-   * For each role, lists nodes that are available for data-local allocation,
-   * ordered by more recently released - to accelerate node selection.
-   * That is, they are "recently used nodes"
-   */
-  private Map<Integer, LinkedList<NodeInstance>> recentNodes;
-
-  /**
-   * Instantiate
-   * @param roles initial role list
-   * @param recordFactory yarn record factory
-   * @throws BadConfigException
-   */
-  public RoleHistory(Collection<RoleStatus> roles, AbstractClusterServices recordFactory) throws BadConfigException {
-    this.recordFactory = recordFactory;
-    roleSize = roles.size();
-    providerRoles = new ArrayList<>(roleSize);
-    for (RoleStatus role : roles) {
-      addNewRole(role);
-    }
-    reset();
-  }
-
-  /**
-   * Reset the variables -this does not adjust the fixed attributes
-   * of the history, but the nodemap and failed node map are cleared.
-   */
-  protected synchronized void reset() throws BadConfigException {
-
-    nodemap = new NodeMap(roleSize);
-    resetAvailableNodeLists();
-    outstandingRequests = new OutstandingRequestTracker();
-  }
-
-  /**
-   * Register all metrics with the metrics infra
-   * @param metrics metrics
-   */
-  public void register(MetricsAndMonitoring metrics) {
-    metrics.register(RoleHistory.class, dirty, "dirty");
-    metrics.register(RoleHistory.class, nodesUpdatedTime, "nodes-updated.time");
-    metrics.register(RoleHistory.class, nodeUpdateReceived, "nodes-updated.flag");
-    metrics.register(RoleHistory.class, thawedDataTime, "thawed.time");
-    metrics.register(RoleHistory.class, saveTime, "saved.time");
-  }
-
-  /**
-   * safety check: make sure the role is unique amongst
-   * the role stats...which is extended with the new role
-   * @param roleStatus role
-   * @throws ArrayIndexOutOfBoundsException
-   * @throws BadConfigException
-   */
-  protected void putRole(RoleStatus roleStatus) throws BadConfigException {
-    int index = roleStatus.getKey();
-    if (index < 0) {
-      throw new BadConfigException("Provider " + roleStatus + " id is out of range");
-    }
-    if (roleStatusMap.get(index) != null) {
-      throw new BadConfigException(
-        roleStatus.toString() + " id duplicates that of " +
-            roleStatusMap.get(index));
-    }
-    roleStatusMap.put(index, roleStatus);
-  }
-
-  /**
-   * Add a new role
-   * @param roleStatus new role
-   */
-  public void addNewRole(RoleStatus roleStatus) throws BadConfigException {
-    log.debug("Validating/adding new role to role history: {} ", roleStatus);
-    putRole(roleStatus);
-    this.providerRoles.add(roleStatus.getProviderRole());
-  }
-
-  /**
-   * Lookup a role by ID
-   * @param roleId role Id
-   * @return role or null if not found
-   */
-  public ProviderRole lookupRole(int roleId) {
-    for (ProviderRole role : providerRoles) {
-      if (role.id == roleId) {
-        return role;
-      }
-    }
-    return null;
-  }
-
-  /**
-   * Clear the lists of available nodes
-   */
-  private synchronized void resetAvailableNodeLists() {
-    recentNodes = new ConcurrentHashMap<>(roleSize);
-  }
-
-  /**
-   * Prepare the history for re-reading its state.
-   * <p>
-   * This intended for use by the RoleWriter logic.
-   * @throws BadConfigException if there is a problem rebuilding the state
-   */
-  private void prepareForReading(RoleHistoryHeader header)
-      throws BadConfigException {
-    reset();
-
-    int roleCountInSource = header.getRoles();
-    if (roleCountInSource != roleSize) {
-      log.warn("Number of roles in source {}"
-              +" does not match the expected number of {}",
-          roleCountInSource,
-          roleSize);
-    }
-    //record when the data was loaded
-    setThawedDataTime(header.getSaved());
-  }
-
-  /**
-   * rebuild the placement history from the loaded role history
-   * @param loadedRoleHistory loaded history
-   * @return the number of entries discarded
-   * @throws BadConfigException if there is a problem rebuilding the state
-   */
-  @VisibleForTesting
-  public synchronized int rebuild(LoadedRoleHistory loadedRoleHistory) throws BadConfigException {
-    RoleHistoryHeader header = loadedRoleHistory.getHeader();
-    prepareForReading(header);
-    int discarded = 0;
-    Long saved = header.getSaved();
-    for (NodeEntryRecord nodeEntryRecord : loadedRoleHistory.records) {
-      Integer roleId = nodeEntryRecord.getRole();
-      NodeEntry nodeEntry = new NodeEntry(roleId);
-      nodeEntry.setLastUsed(nodeEntryRecord.getLastUsed());
-      if (nodeEntryRecord.getActive()) {
-        //if active at the time of save, make the last used time the save time
-        nodeEntry.setLastUsed(saved);
-      }
-      String hostname = SliderUtils.sequenceToString(nodeEntryRecord.getHost());
-      ProviderRole providerRole = lookupRole(roleId);
-      if (providerRole == null) {
-        // discarding entry
-        log.info("Discarding history entry with unknown role: {} on host {}",
-            roleId, hostname);
-        discarded ++;
-      } else {
-        NodeInstance instance = getOrCreateNodeInstance(hostname);
-        instance.set(roleId, nodeEntry);
-      }
-    }
-    return discarded;
-  }
-
-  public synchronized long getStartTime() {
-    return startTime;
-  }
-
-  public synchronized long getSaveTime() {
-    return saveTime.get();
-  }
-
-  public long getThawedDataTime() {
-    return thawedDataTime.get();
-  }
-
-  public void setThawedDataTime(long thawedDataTime) {
-    this.thawedDataTime.set(thawedDataTime);
-  }
-
-  public synchronized int getRoleSize() {
-    return roleSize;
-  }
-
-  /**
-   * Get the total size of the cluster -the number of NodeInstances
-   * @return a count
-   */
-  public synchronized int getClusterSize() {
-    return nodemap.size();
-  }
-
-  public synchronized boolean isDirty() {
-    return dirty.get();
-  }
-
-  public synchronized void setDirty(boolean dirty) {
-    this.dirty.set(dirty);
-  }
-
-  /**
-   * Tell the history that it has been saved; marks itself as clean
-   * @param timestamp timestamp -updates the savetime field
-   */
-  public synchronized void saved(long timestamp) {
-    setDirty(false);
-    saveTime.set(timestamp);
-  }
-
-  /**
-   * Get a clone of the nodemap.
-   * The instances inside are not cloned
-   * @return the map
-   */
-  public synchronized NodeMap cloneNodemap() {
-    return (NodeMap) nodemap.clone();
-  }
-
-  /**
-   * Get snapshot of the node map
-   * @return a snapshot of the current node state
-   * @param naming naming map of priority to enty name; entries must be unique.
-   * It's OK to be incomplete, for those the list falls back to numbers.
-   */
-  public synchronized Map<String, NodeInformation> getNodeInformationSnapshot(
-    Map<Integer, String> naming) {
-    Map<String, NodeInformation> result = new HashMap<>(nodemap.size());
-    for (Map.Entry<String, NodeInstance> entry : nodemap.entrySet()) {
-      result.put(entry.getKey(), entry.getValue().serialize(naming));
-    }
-    return result;
-  }
-
-  /**
-   * Get the information on a node
-   * @param hostname hostname
-   * @param naming naming map of priority to enty name; entries must be unique.
-   * It's OK to be incomplete, for those the list falls back to numbers.
-   * @return the information about that host, or null if there is none
-   */
-  public synchronized NodeInformation getNodeInformation(String hostname,
-    Map<Integer, String> naming) {
-    NodeInstance nodeInstance = nodemap.get(hostname);
-    return nodeInstance != null ? nodeInstance.serialize(naming) : null;
-  }
-
-  /**
-   * Get the node instance for the specific node -creating it if needed
-   * @param hostname node address
-   * @return the instance
-   */
-  public synchronized NodeInstance getOrCreateNodeInstance(String hostname) {
-    //convert to a string
-    return nodemap.getOrCreate(hostname);
-  }
-
-  /**
-   * Insert a list of nodes into the map; overwrite any with that name.
-   * This is a bulk operation for testing.
-   * Important: this does not update the available node lists, these
-   * must be rebuilt afterwards.
-   * @param nodes collection of nodes.
-   */
-  @VisibleForTesting
-  public synchronized void insert(Collection<NodeInstance> nodes) {
-    nodemap.insert(nodes);
-  }
-
-  /**
-   * Get current time. overrideable for test subclasses
-   * @return current time in millis
-   */
-  protected long now() {
-    return System.currentTimeMillis();
-  }
-
-  /**
-   * Mark ourselves as dirty
-   */
-  public void touch() {
-    setDirty(true);
-    try {
-      saveHistoryIfDirty();
-    } catch (IOException e) {
-      log.warn("Failed to save history file ", e);
-    }
-  }
-
-  /**
-   * reset the failed recently counters
-   */
-  public synchronized void resetFailedRecently() {
-    log.info("Resetting failure history");
-    nodemap.resetFailedRecently();
-  }
-
-  /**
-   * Get the path used for history files
-   * @return the directory used for history files
-   */
-  public Path getHistoryPath() {
-    return historyPath;
-  }
-
-  /**
-   * Save the history to its location using the timestamp as part of
-   * the filename. The saveTime and dirty fields are updated
-   * @param time timestamp timestamp to use as the save time
-   * @return the path saved to
-   * @throws IOException IO problems
-   */
-  @VisibleForTesting
-  public synchronized Path saveHistory(long time) throws IOException {
-    Path filename = historyWriter.createHistoryFilename(historyPath, time);
-    historyWriter.write(filesystem, filename, true, this, time);
-    saved(time);
-    return filename;
-  }
-
-  /**
-   * Save the history with the current timestamp if it is dirty;
-   * return the path saved to if this is the case
-   * @return the path or null if the history was not saved
-   * @throws IOException failed to save for some reason
-   */
-  public synchronized Path saveHistoryIfDirty() throws IOException {
-    if (isDirty()) {
-      return saveHistory(now());
-    } else {
-      return null;
-    }
-  } 
-
-  /**
-   * Start up
-   * @param fs filesystem 
-   * @param historyDir path in FS for history
-   * @return true if the history was thawed
-   */
-  public boolean onStart(FileSystem fs, Path historyDir) throws BadConfigException {
-    assert filesystem == null;
-    filesystem = fs;
-    historyPath = historyDir;
-    startTime = now();
-    //assume the history is being thawed; this will downgrade as appropriate
-    return onThaw();
-    }
-  
-  /**
-   * Handler for bootstrap event: there was no history to thaw
-   */
-  public void onBootstrap() {
-    log.debug("Role history bootstrapped");
-  }
-
-  /**
-   * Handle the start process <i>after the history has been rebuilt</i>,
-   * and after any gc/purge
-   */
-  public synchronized boolean onThaw() throws BadConfigException {
-    assert filesystem != null;
-    assert historyPath != null;
-    boolean thawSuccessful = false;
-    //load in files from data dir
-
-    LoadedRoleHistory loadedRoleHistory = null;
-    try {
-      loadedRoleHistory = historyWriter.loadFromHistoryDir(filesystem, historyPath);
-    } catch (IOException e) {
-      log.warn("Exception trying to load history from {}", historyPath, e);
-    }
-    if (loadedRoleHistory != null) {
-      rebuild(loadedRoleHistory);
-      thawSuccessful = true;
-      Path loadPath = loadedRoleHistory.getPath();
-      log.debug("loaded history from {}", loadPath);
-      // delete any old entries
-      try {
-        int count = historyWriter.purgeOlderHistoryEntries(filesystem, loadPath);
-        log.debug("Deleted {} old history entries", count);
-      } catch (IOException e) {
-        log.info("Ignoring exception raised while trying to delete old entries",
-                 e);
-      }
-
-      //start is then completed
-      buildRecentNodeLists();
-    } else {
-      //fallback to bootstrap procedure
-      onBootstrap();
-    }
-    return thawSuccessful;
-  }
-
-
-  /**
-   * (After the start), rebuild the availability data structures
-   */
-  @VisibleForTesting
-  public synchronized void buildRecentNodeLists() {
-    resetAvailableNodeLists();
-    // build the list of available nodes
-    for (Map.Entry<String, NodeInstance> entry : nodemap.entrySet()) {
-      NodeInstance ni = entry.getValue();
-      for (int i = 0; i < roleSize; i++) {
-        NodeEntry nodeEntry = ni.get(i);
-        if (nodeEntry != null && nodeEntry.isAvailable()) {
-          log.debug("Adding {} for role {}", ni, i);
-          listRecentNodesForRoleId(i).add(ni);
-        }
-      }
-    }
-    // sort the resulting arrays
-    for (int i = 0; i < roleSize; i++) {
-      sortRecentNodeList(i);
-    }
-  }
-
-  /**
-   * Get the nodes for an ID -may be null
-   * @param id role ID
-   * @return potentially null list
-   */
-  @VisibleForTesting
-  public List<NodeInstance> getRecentNodesForRoleId(int id) {
-    return recentNodes.get(id);
-  }
-
-  /**
-   * Get a possibly empty list of suggested nodes for a role.
-   * @param id role ID
-   * @return list
-   */
-  private LinkedList<NodeInstance> listRecentNodesForRoleId(int id) {
-    LinkedList<NodeInstance> instances = recentNodes.get(id);
-    if (instances == null) {
-      synchronized (this) {
-        // recheck in the synchronized block and recreate
-        if (recentNodes.get(id) == null) {
-          recentNodes.put(id, new LinkedList<NodeInstance>());
-        }
-        instances = recentNodes.get(id);
-      }
-    }
-    return instances;
-  }
-
-  /**
-   * Sort a the recent node list for a single role
-   * @param role role to sort
-   */
-  private void sortRecentNodeList(int role) {
-    List<NodeInstance> nodesForRoleId = getRecentNodesForRoleId(role);
-    if (nodesForRoleId != null) {
-      Collections.sort(nodesForRoleId, new NodeInstance.Preferred(role));
-    }
-  }
-
-  /**
-   * Find a node for use
-   * @param role role
-   * @return the instance, or null for none
-   */
-  @VisibleForTesting
-  public synchronized NodeInstance findRecentNodeForNewInstance(RoleStatus role) {
-    if (!role.isPlacementDesired()) {
-      // no data locality policy
-      return null;
-    }
-    int roleId = role.getKey();
-    boolean strictPlacement = role.isStrictPlacement();
-    NodeInstance nodeInstance = null;
-    // Get the list of possible targets.
-    // This is a live list: changes here are preserved
-    List<NodeInstance> targets = getRecentNodesForRoleId(roleId);
-    if (targets == null) {
-      // nothing to allocate on
-      return null;
-    }
-
-    int cnt = targets.size();
-    log.debug("There are {} node(s) to consider for {}", cnt, role.getName());
-    for (int i = 0; i < cnt  && nodeInstance == null; i++) {
-      NodeInstance candidate = targets.get(i);
-      if (candidate.getActiveRoleInstances(roleId) == 0) {
-        // no active instances: check failure statistics
-        if (strictPlacement
-            || (candidate.isOnline() && !candidate.exceedsFailureThreshold(role))) {
-          targets.remove(i);
-          // exit criteria for loop is now met
-          nodeInstance = candidate;
-        } else {
-          // too many failures for this node
-          log.info("Recent node failures is higher than threshold {}. Not requesting host {}",
-              role.getNodeFailureThreshold(), candidate.hostname);
-        }
-      }
-    }
-
-    if (nodeInstance == null) {
-      log.info("No node found for {}", role.getName());
-    }
-    return nodeInstance;
-  }
-
-  /**
-   * Find a node for use
-   * @param role role
-   * @return the instance, or null for none
-   */
-  @VisibleForTesting
-  public synchronized List<NodeInstance> findNodeForNewAAInstance(RoleStatus role) {
-    // all nodes that are live and can host the role; no attempt to exclude ones
-    // considered failing
-    return nodemap.findAllNodesForRole(role.getKey(), role.getLabelExpression());
-  }
-
-  /**
-   * Request an instance on a given node.
-   * An outstanding request is created & tracked, with the 
-   * relevant node entry for that role updated.
-   *<p>
-   * The role status entries will also be tracked
-   * <p>
-   * Returns the request that is now being tracked.
-   * If the node instance is not null, it's details about the role is incremented
-   *
-   * @param node node to target or null for "any"
-   * @param role role to request
-   * @return the request
-   */
-  public synchronized OutstandingRequest requestInstanceOnNode(
-      NodeInstance node, RoleStatus role, Resource resource) {
-    OutstandingRequest outstanding = outstandingRequests.newRequest(node, role.getKey());
-    outstanding.buildContainerRequest(resource, role, now());
-    return outstanding;
-  }
-
-  /**
-   * Find a node for a role and request an instance on that (or a location-less
-   * instance)
-   * @param role role status
-   * @return a request ready to go, or null if this is an AA request and no
-   * location can be found.
-   */
-  public synchronized OutstandingRequest requestContainerForRole(RoleStatus role) {
-
-    if (role.isAntiAffinePlacement()) {
-      return requestContainerForAARole(role);
-    } else {
-      Resource resource = recordFactory.newResource();
-      role.copyResourceRequirements(resource);
-      NodeInstance node = findRecentNodeForNewInstance(role);
-      return requestInstanceOnNode(node, role, resource);
-    }
-  }
-
-  /**
-   * Find a node for an AA role and request an instance on that (or a location-less
-   * instance)
-   * @param role role status
-   * @return a request ready to go, or null if no location can be found.
-   */
-  public synchronized OutstandingRequest requestContainerForAARole(RoleStatus role) {
-    List<NodeInstance> nodes = findNodeForNewAAInstance(role);
-    if (!nodes.isEmpty()) {
-      OutstandingRequest outstanding = outstandingRequests.newAARequest(
-          role.getKey(), nodes, role.getLabelExpression());
-      Resource resource = recordFactory.newResource();
-      role.copyResourceRequirements(resource);
-      outstanding.buildContainerRequest(resource, role, now());
-      return outstanding;
-    } else {
-      log.warn("No suitable location for {}", role.getName());
-      return null;
-    }
-  }
-  /**
-   * Get the list of active nodes ... walks the node map so
-   * is {@code O(nodes)}
-   * @param role role index
-   * @return a possibly empty list of nodes with an instance of that node
-   */
-  public synchronized List<NodeInstance> listActiveNodes(int role) {
-    return nodemap.listActiveNodes(role);
-  }
-
-  /**
-   * Get the node entry of a container
-   * @param container container to look up
-   * @return the entry
-   * @throws RuntimeException if the container has no hostname
-   */
-  public NodeEntry getOrCreateNodeEntry(Container container) {
-    return getOrCreateNodeInstance(container).getOrCreate(container);
-  }
-
-  /**
-   * Get the node instance of a container -always returns something
-   * @param container container to look up
-   * @return a (possibly new) node instance
-   * @throws RuntimeException if the container has no hostname
-   */
-  public synchronized NodeInstance getOrCreateNodeInstance(Container container) {
-    return nodemap.getOrCreate(RoleHistoryUtils.hostnameOf(container));
-  }
-
-  /**
-   * Get the node instance of a host if defined
-   * @param hostname hostname to look up
-   * @return a node instance or null
-   * @throws RuntimeException if the container has no hostname
-   */
-  public synchronized NodeInstance getExistingNodeInstance(String hostname) {
-    return nodemap.get(hostname);
-  }
-
-  /**
-   * Get the node instance of a container <i>if there's an entry in the history</i>
-   * @param container container to look up
-   * @return a node instance or null
-   * @throws RuntimeException if the container has no hostname
-   */
-  public synchronized NodeInstance getExistingNodeInstance(Container container) {
-    return nodemap.get(RoleHistoryUtils.hostnameOf(container));
-  }
-
-  /**
-   * Perform any pre-allocation operations on the list of allocated containers
-   * based on knowledge of system state. 
-   * Currently this places requested hosts ahead of unrequested ones.
-   * @param allocatedContainers list of allocated containers
-   * @return list of containers potentially reordered
-   */
-  public synchronized List<Container> prepareAllocationList(List<Container> allocatedContainers) {
-
-    //partition into requested and unrequested
-    List<Container> requested =
-      new ArrayList<>(allocatedContainers.size());
-    List<Container> unrequested =
-      new ArrayList<>(allocatedContainers.size());
-    outstandingRequests.partitionRequests(this, allocatedContainers, requested, unrequested);
-
-    //give the unrequested ones lower priority
-    requested.addAll(unrequested);
-    return requested;
-  }
-
-  /**
-   * A container has been allocated on a node -update the data structures
-   * @param container container
-   * @param desiredCount desired #of instances
-   * @param actualCount current count of instances
-   * @return The allocation outcome
-   */
-  public synchronized ContainerAllocationResults onContainerAllocated(Container container,
-      long desiredCount,
-      long actualCount) {
-    int role = ContainerPriority.extractRole(container);
-
-    String hostname = RoleHistoryUtils.hostnameOf(container);
-    List<NodeInstance> nodeInstances = listRecentNodesForRoleId(role);
-    ContainerAllocationResults outcome =
-        outstandingRequests.onContainerAllocated(role, hostname, container);
-    if (desiredCount <= actualCount) {
-      // all outstanding requests have been satisfied
-      // clear all the lists, so returning nodes to the available set
-      List<NodeInstance> hosts = outstandingRequests.resetOutstandingRequests(role);
-      if (!hosts.isEmpty()) {
-        //add the list
-        log.info("Adding {} hosts for role {}", hosts.size(), role);
-        nodeInstances.addAll(hosts);
-        sortRecentNodeList(role);
-      }
-    }
-    return outcome;
-  }
-
-  /**
-   * A container has been assigned to a role instance on a node -update the data structures
-   * @param container container
-   */
-  public void onContainerAssigned(Container container) {
-    NodeInstance node = getOrCreateNodeInstance(container);
-    NodeEntry nodeEntry = node.getOrCreate(container);
-    nodeEntry.onStarting();
-    log.debug("Node {} has updated NodeEntry {}", node, nodeEntry);
-  }
-
-  /**
-   * Event: a container start has been submitted
-   * @param container container being started
-   * @param instance instance bound to the container
-   */
-  public void onContainerStartSubmitted(Container container,
-                                        RoleInstance instance) {
-    // no actions here
-  }
-
-  /**
-   * Container start event
-   * @param container container that just started
-   */
-  public void onContainerStarted(Container container) {
-    NodeEntry nodeEntry = getOrCreateNodeEntry(container);
-    nodeEntry.onStartCompleted();
-    touch();
-  }
-
-  /**
-   * A container failed to start: update the node entry state
-   * and return the container to the queue
-   * @param container container that failed
-   * @return true if the node was queued
-   */
-  public boolean onNodeManagerContainerStartFailed(Container container) {
-    return markContainerFinished(container, false, true, ContainerOutcome.Failed);
-  }
-
-  /**
-   * Does the RoleHistory have enough information about the YARN cluster
-   * to start placing AA requests? That is: has it the node map and
-   * any label information needed?
-   * @return true if the caller can start requesting AA nodes
-   */
-  public boolean canPlaceAANodes() {
-    return nodeUpdateReceived.get();
-  }
-
-  /**
-   * Get the last time the nodes were updated from YARN
-   * @return the update time or zero if never updated.
-   */
-  public long getNodesUpdatedTime() {
-    return nodesUpdatedTime.get();
-  }
-
-  /**
-   * Update failedNodes and nodemap based on the node state
-   *
-   * @param updatedNodes list of updated nodes
-   * @return true if a review should be triggered.
-   */
-  public synchronized boolean onNodesUpdated(List<NodeReport> updatedNodes) {
-    log.debug("Updating {} nodes", updatedNodes.size());
-    nodesUpdatedTime.set(now());
-    nodeUpdateReceived.set(true);
-    int printed = 0;
-    boolean triggerReview = false;
-    for (NodeReport updatedNode : updatedNodes) {
-      String hostname = updatedNode.getNodeId() == null
-          ? ""
-          : updatedNode.getNodeId().getHost();
-      NodeState nodeState = updatedNode.getNodeState();
-      if (hostname.isEmpty() || nodeState == null) {
-        log.warn("Ignoring incomplete update");
-        continue;
-      }
-      if (log.isDebugEnabled() && printed++ < 10) {
-        // log the first few, but avoid overloading the logs for a full cluster
-        // update
-        log.debug("Node \"{}\" is in state {}", hostname, nodeState);
-      }
-      // update the node; this also creates an instance if needed
-      boolean updated = nodemap.updateNode(hostname, updatedNode);
-      triggerReview |= updated;
-    }
-    return triggerReview;
-  }
-
-  /**
-   * A container release request was issued
-   * @param container container submitted
-   */
-  public void onContainerReleaseSubmitted(Container container) {
-    NodeEntry nodeEntry = getOrCreateNodeEntry(container);
-    nodeEntry.release();
-  }
-
-  /**
-   * App state notified of a container completed 
-   * @param container completed container
-   * @return true if the node was queued
-   */
-  public boolean onReleaseCompleted(Container container) {
-    return markContainerFinished(container, true, false, ContainerOutcome.Failed);
-  }
-
-  /**
-   * App state notified of a container completed -but as
-   * it wasn't being released it is marked as failed
-   *
-   * @param container completed container
-   * @param shortLived was the container short lived?
-   * @param outcome
-   * @return true if the node is considered available for work
-   */
-  public boolean onFailedContainer(Container container,
-      boolean shortLived,
-      ContainerOutcome outcome) {
-    return markContainerFinished(container, false, shortLived, outcome);
-  }
-
-  /**
-   * Mark a container finished; if it was released then that is treated
-   * differently. history is {@code touch()}-ed
-   *
-   *
-   * @param container completed container
-   * @param wasReleased was the container released?
-   * @param shortLived was the container short lived?
-   * @param outcome
-   * @return true if the node was queued
-   */
-  protected synchronized boolean markContainerFinished(Container container,
-      boolean wasReleased,
-      boolean shortLived,
-      ContainerOutcome outcome) {
-    NodeEntry nodeEntry = getOrCreateNodeEntry(container);
-    log.info("Finished container for node {}, released={}, shortlived={}",
-        nodeEntry.rolePriority, wasReleased, shortLived);
-    boolean available;
-    if (shortLived) {
-      nodeEntry.onStartFailed();
-      available = false;
-    } else {
-      available = nodeEntry.containerCompleted(wasReleased, outcome);
-      maybeQueueNodeForWork(container, nodeEntry, available);
-    }
-    touch();
-    return available;
-  }
-
-  /**
-   * If the node is marked as available; queue it for assignments.
-   * Unsynced: requires caller to be in a sync block.
-   * @param container completed container
-   * @param nodeEntry node
-   * @param available available flag
-   * @return true if the node was queued
-   */
-  private boolean maybeQueueNodeForWork(Container container,
-                                        NodeEntry nodeEntry,
-                                        boolean available) {
-    if (available) {
-      //node is free
-      nodeEntry.setLastUsed(now());
-      NodeInstance ni = getOrCreateNodeInstance(container);
-      int roleId = ContainerPriority.extractRole(container);
-      log.debug("Node {} is now available for role id {}", ni, roleId);
-      listRecentNodesForRoleId(roleId).addFirst(ni);
-    }
-    return available;
-  }
-
-  /**
-   * Print the history to the log. This is for testing and diagnostics 
-   */
-  public synchronized void dump() {
-    for (ProviderRole role : providerRoles) {
-      log.info(role.toString());
-      List<NodeInstance> instances = listRecentNodesForRoleId(role.id);
-      log.info("  available: " + instances.size()
-               + " " + SliderUtils.joinWithInnerSeparator(" ", instances));
-    }
-
-    log.info("Nodes in Cluster: {}", getClusterSize());
-    for (NodeInstance node : nodemap.values()) {
-      log.info(node.toFullString());
-    }
-  }
-
-  /**
-   * Build the mapping entry for persisting to the role history
-   * @return a mapping object
-   */
-  public synchronized Map<CharSequence, Integer> buildMappingForHistoryFile() {
-    Map<CharSequence, Integer> mapping = new HashMap<>(getRoleSize());
-    for (ProviderRole role : providerRoles) {
-      mapping.put(role.name, role.id);
-    }
-    return mapping;
-  }
-
-  /**
-   * Get a clone of the available list
-   * @param role role index
-   * @return a clone of the list
-   */
-  @VisibleForTesting
-  public List<NodeInstance> cloneRecentNodeList(int role) {
-    return new LinkedList<>(listRecentNodesForRoleId(role));
-  }
-
-  /**
-   * Get a snapshot of the outstanding placed request list
-   * @return a list of the requests outstanding at the time of requesting
-   */
-  @VisibleForTesting
-  public List<OutstandingRequest> listPlacedRequests() {
-    return outstandingRequests.listPlacedRequests();
-  }
-
-  /**
-   * Get a snapshot of the outstanding placed request list
-   * @return a list of the requests outstanding at the time of requesting
-   */
-  @VisibleForTesting
-  public List<OutstandingRequest> listOpenRequests() {
-    return outstandingRequests.listOpenRequests();
-  }
-
-  /**
-   * Escalate operation as triggered by external timer.
-   * @return a (usually empty) list of cancel/request operations.
-   */
-  public synchronized List<AbstractRMOperation> escalateOutstandingRequests() {
-    return outstandingRequests.escalateOutstandingRequests(now());
-  }
-  /**
-   * Escalate operation as triggered by external timer.
-   * @return a (usually empty) list of cancel/request operations.
-   */
-  public List<AbstractRMOperation> cancelOutstandingAARequests() {
-    return outstandingRequests.cancelOutstandingAARequests();
-  }
-
-  /**
-   * Cancel a number of outstanding requests for a role -that is, not
-   * actual containers, just requests for new ones.
-   * @param role role
-   * @param toCancel number to cancel
-   * @return a list of cancellable operations.
-   */
-  public List<AbstractRMOperation> cancelRequestsForRole(RoleStatus role, int toCancel) {
-    return role.isAntiAffinePlacement() ?
-        cancelRequestsForAARole(role, toCancel)
-        : cancelRequestsForSimpleRole(role, toCancel);
-  }
-
-  /**
-   * Build the list of requests to cancel from the outstanding list.
-   * @param role role
-   * @param toCancel number to cancel
-   * @return a list of cancellable operations.
-   */
-  private synchronized List<AbstractRMOperation> cancelRequestsForSimpleRole(RoleStatus role, int toCancel) {
-    Preconditions.checkArgument(toCancel > 0,
-        "trying to cancel invalid number of requests: " + toCancel);
-    List<AbstractRMOperation> results = new ArrayList<>(toCancel);
-    // first scan through the unplaced request list to find all of a role
-    int roleId = role.getKey();
-    List<OutstandingRequest> requests =
-        outstandingRequests.extractOpenRequestsForRole(roleId, toCancel);
-
-    // are there any left?
-    int remaining = toCancel - requests.size();
-    // ask for some placed nodes
-    requests.addAll(outstandingRequests.extractPlacedRequestsForRole(roleId, remaining));
-
-    // build cancellations
-    for (OutstandingRequest request : requests) {
-      results.add(request.createCancelOperation());
-    }
-    return results;
-  }
-
-  /**
-   * Build the list of requests to cancel for an AA role. This reduces the number
-   * of outstanding pending requests first, then cancels any active request,
-   * before finally asking for any placed containers
-   * @param role role
-   * @param toCancel number to cancel
-   * @return a list of cancellable operations.
-   */
-  private synchronized List<AbstractRMOperation> cancelRequestsForAARole(RoleStatus role, int toCancel) {
-    List<AbstractRMOperation> results = new ArrayList<>(toCancel);
-    int roleId = role.getKey();
-    List<OutstandingRequest> requests = new ArrayList<>(toCancel);
-    // there may be pending requests which can be cancelled here
-    long pending = role.getPendingAntiAffineRequests();
-    if (pending > 0) {
-      // there are some pending ones which can be cancelled first
-      long pendingToCancel = Math.min(pending, toCancel);
-      log.info("Cancelling {} pending AA allocations, leaving {}", toCancel,
-          pendingToCancel);
-      role.setPendingAntiAffineRequests(pending - pendingToCancel);
-      toCancel -= pendingToCancel;
-    }
-    if (toCancel > 0 && role.isAARequestOutstanding()) {
-      // not enough
-      log.info("Cancelling current AA request");
-      // find the single entry which may be running
-      requests = outstandingRequests.extractOpenRequestsForRole(roleId, toCancel);
-      role.cancelOutstandingAARequest();
-      toCancel--;
-    }
-
-    // ask for some excess nodes
-    if (toCancel > 0) {
-      requests.addAll(outstandingRequests.extractPlacedRequestsForRole(roleId, toCancel));
-    }
-
-    // build cancellations
-    for (OutstandingRequest request : requests) {
-      results.add(request.createCancelOperation());
-    }
-    return results;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHistoryUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHistoryUtils.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHistoryUtils.java
deleted file mode 100644
index ea6197b..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHistoryUtils.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.NodeId;
-import org.apache.slider.common.tools.SliderUtils;
-
-public class RoleHistoryUtils {
-
-  public static String hostnameOf(Container container) {
-    NodeId nodeId = container.getNodeId();
-    if (nodeId== null) {
-      throw new RuntimeException("Container has no node ID: %s" +
-         SliderUtils.containerToString(container));
-    }
-    return nodeId.getHost();
-  }
-
-  /**
-   * Decrement a value but hold it at zero. Usually a sanity check
-   * on counters tracking outstanding operations
-   * @param val value
-   * @return decremented value
-   */
-  public static int decToFloor(int val) {
-    int v = val-1;
-    if (v < 0) {
-      v = 0;
-    }
-    return v;
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHostnamePair.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHostnamePair.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHostnamePair.java
deleted file mode 100644
index 920887a..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHostnamePair.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import java.util.Objects;
-
-public class RoleHostnamePair {
-
-  /**
-   * requested role
-   */
-  public final int roleId;
-
-  /**
-   * hostname -will be null if node==null
-   */
-  public final String hostname;
-
-  public RoleHostnamePair(int roleId, String hostname) {
-    this.roleId = roleId;
-    this.hostname = hostname;
-  }
-
-  public int getRoleId() {
-    return roleId;
-  }
-
-  public String getHostname() {
-    return hostname;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (!(o instanceof RoleHostnamePair)) {
-      return false;
-    }
-    RoleHostnamePair that = (RoleHostnamePair) o;
-    return Objects.equals(roleId, that.roleId) &&
-        Objects.equals(hostname, that.hostname);
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hash(roleId, hostname);
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb = new StringBuilder(
-        "RoleHostnamePair{");
-    sb.append("roleId=").append(roleId);
-    sb.append(", hostname='").append(hostname).append('\'');
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleInstance.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleInstance.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleInstance.java
deleted file mode 100644
index 30cfec9..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleInstance.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.registry.client.binding.RegistryTypeUtils;
-import org.apache.hadoop.registry.client.types.Endpoint;
-import org.apache.hadoop.registry.client.types.ProtocolTypes;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.api.records.NodeId;
-import org.apache.slider.api.ClusterNode;
-import org.apache.slider.api.proto.Messages;
-import org.apache.slider.api.types.ContainerInformation;
-import org.apache.slider.common.tools.SliderUtils;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Tracking information about a container
- */
-public final class RoleInstance implements Cloneable {
-
-  public Container container;
-  /**
-   * Container ID
-   */
-  public final String id;
-  public long createTime;
-  public long startTime;
-  /**
-   * flag set when it is released, to know if it has
-   * already been targeted for termination
-   */
-  public boolean released;
-
-  /**
-   * Name of the role
-   */
-  public String role;
-  public String group;
-
-  /**
-   * Version of the app
-   */
-  public String appVersion;
-
-  /**
-   * Role Id; matches priority in resources.json
-   */
-  public int roleId;
-
-  /**
-   * state from StateValues
-   */
-  public int state;
-
-  /**
-   * Exit code: only valid if the state >= STOPPED
-   */
-  public int exitCode;
-
-  /**
-   * what was the command executed?
-   */
-  public String command;
-
-  /**
-   * Any diagnostics
-   */
-  public String diagnostics;
-
-  /**
-   * What is the tail output from the executed process (or [] if not started
-   * or the log cannot be picked up
-   */
-  public String[] output;
-
-  /**
-   * Any environment details
-   */
-  public String[] environment;
-  
-  public String ip;
-  public String hostname;
-  public String host;
-  public String hostURL;
-  public ContainerAllocationOutcome placement;
-
-
-  /**
-   * A list of registered endpoints.
-   */
-  private List<Endpoint> endpoints =
-      new ArrayList<>(2);
-
-  public RoleInstance(ContainerAssignment assignment) {
-    this(assignment.container);
-    placement = assignment.placement;
-  }
-  /**
-   * Create an instance to track an allocated container
-   * @param container a container which must be non null, and have a non-null Id field.
-   */
-  public RoleInstance(Container container) {
-    Preconditions.checkNotNull(container, "Null container");
-    Preconditions.checkState(container.getId() != null, 
-      "Null container ID");
-
-    this.container = container;
-    id = container.getId().toString();
-    if (container.getNodeId() != null) {
-      host = container.getNodeId().getHost();
-    }
-    if (container.getNodeHttpAddress() != null) {
-      hostURL = "http://" + container.getNodeHttpAddress();
-    }
-  }
-
-  public ContainerId getId() {
-    return container.getId();
-  }
-  
-  public NodeId getHost() {
-    return container.getNodeId();
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-      new StringBuilder("RoleInstance{");
-    sb.append("role='").append(role).append('\'');
-    sb.append(", id='").append(id).append('\'');
-    sb.append(", container=").append(SliderUtils.containerToString(container));
-    sb.append(", createTime=").append(createTime);
-    sb.append(", startTime=").append(startTime);
-    sb.append(", released=").append(released);
-    sb.append(", roleId=").append(roleId);
-    sb.append(", host=").append(host);
-    sb.append(", hostURL=").append(hostURL);
-    sb.append(", state=").append(state);
-    sb.append(", placement=").append(placement);
-    sb.append(", exitCode=").append(exitCode);
-    sb.append(", command='").append(command).append('\'');
-    sb.append(", diagnostics='").append(diagnostics).append('\'');
-    sb.append(", output=").append(Arrays.toString(output));
-    sb.append(", environment=").append(Arrays.toString(environment));
-    sb.append('}');
-    return sb.toString();
-  }
-
-  public ContainerId getContainerId() {
-    return container != null ? container.getId() : null;
-  }
-
-  /**
-   * Generate the protobuf format of a request
-   * @return protobuf format. This excludes the Container info
-   */
-  public Messages.RoleInstanceState toProtobuf() {
-    Messages.RoleInstanceState.Builder builder =
-      Messages.RoleInstanceState.newBuilder();
-    if (container != null) {
-      builder.setName(container.getId().toString());
-    } else {
-      builder.setName("unallocated instance");
-    }
-    if (command != null) {
-      builder.setCommand(command);
-    }
-    if (environment != null) {
-      builder.addAllEnvironment(Arrays.asList(environment));
-    }
-    if (diagnostics != null) {
-      builder.setDiagnostics(diagnostics);
-    }
-    builder.setExitCode(exitCode);
-
-    if (output != null) {
-      builder.addAllOutput(Arrays.asList(output));
-    }
-    if (role != null) {
-      builder.setRole(role);
-    }
-    builder.setRoleId(roleId);
-    builder.setState(state);
-
-    builder.setReleased(released);
-    builder.setCreateTime(createTime);
-    builder.setStartTime(startTime);
-    builder.setHost(host);
-    builder.setHostURL(hostURL);
-    if (appVersion != null) {
-      builder.setAppVersion(appVersion);
-    }
-    return builder.build();
-  }
-
-  /**
-   * Build a serializable ClusterNode structure from this instance.
-   * This operation is unsynchronized.
-   * @return a serialized value.
-   */
-  public ClusterNode toClusterNode() {
-    ClusterNode node;
-    if (container != null) {
-      node = new ClusterNode(container.getId());
-    } else {
-      node = new ClusterNode();
-      node.name = "unallocated instance";
-    }
-    node.command = command;
-    node.createTime = createTime;
-    node.diagnostics = diagnostics;
-    if (environment != null) {
-      node.environment = Arrays.copyOf(environment, environment.length);
-    }
-    node.exitCode = exitCode;
-    node.ip = ip;
-    node.hostname = hostname;
-    node.host = host;
-    node.hostUrl = hostURL;
-    if (output != null) {
-      node.output = Arrays.copyOf(output, output.length);
-    }
-    node.released = released;
-    node.role = role;
-    node.roleId = roleId;
-    node.startTime = startTime ;
-    node.state = state;
-    
-    return node;
-  }
-  
-  /**
-   * Clone operation clones all the simple values but shares the 
-   * Container object into the cloned copy -same with the output,
-   * diagnostics and env arrays.
-   * @return a clone of the object
-   * @throws CloneNotSupportedException
-   */
-  @Override
-  public Object clone() throws CloneNotSupportedException {
-    RoleInstance cloned = (RoleInstance) super.clone();
-    // clone the endpoint list, but not the values
-    cloned.endpoints = new ArrayList<Endpoint>(this.endpoints);
-    return cloned;
-  }
-
-  /**
-   * Get the list of endpoints. 
-   * @return the endpoint list.
-   */
-  public List<Endpoint> getEndpoints() {
-    return endpoints;
-  }
-
-  /**
-   * Add an endpoint registration
-   * @param endpoint endpoint (non-null)
-   */
-  public void addEndpoint(Endpoint endpoint) {
-    Preconditions.checkArgument(endpoint != null);
-    endpoints.add(endpoint);
-  }
-
-  /**
-   * Register a port endpoint as an inet-addr formatted endpoint, using the
-   * hostname as the first part of the address
-   * @param port port port
-   * @param api  API API name
-   */
-  public void registerPortEndpoint(int port, String api) {
-    Endpoint epr =
-        RegistryTypeUtils.inetAddrEndpoint(api,
-            ProtocolTypes.PROTOCOL_TCP, host, port);
-    addEndpoint(epr);
-  }
-
-  /**
-   * Serialize. Some data structures (e.g output)
-   * may be shared
-   * @return a serialized form for marshalling as JSON
-   */
-  public ContainerInformation serialize() {
-    ContainerInformation info = new ContainerInformation();
-    info.containerId = id;
-    info.component = role;
-    info.appVersion = appVersion;
-    info.startTime = startTime;
-    info.createTime = createTime;
-    info.diagnostics = diagnostics;
-    info.state = state;
-    info.host = host;
-    info.hostURL = hostURL;
-    info.released = released ? Boolean.TRUE : null;
-    if (placement != null) {
-      info.placement = placement.toString();
-    }
-    if (output != null) {
-      info.output = output;
-    }
-    return info;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleStatus.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleStatus.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleStatus.java
deleted file mode 100644
index 0a3a3c9..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleStatus.java
+++ /dev/null
@@ -1,563 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import com.codahale.metrics.Metric;
-import com.codahale.metrics.MetricSet;
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.slider.api.types.ComponentInformation;
-import org.apache.slider.api.types.RoleStatistics;
-import org.apache.slider.providers.PlacementPolicy;
-import org.apache.slider.providers.ProviderRole;
-import org.apache.slider.server.appmaster.management.BoolMetricPredicate;
-import org.apache.slider.server.appmaster.management.LongGauge;
-
-import java.io.Serializable;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Models the ongoing status of all nodes in an application.
- *
- * These structures are shared across the {@link AppState} and {@link RoleHistory} structures,
- * and must be designed for synchronous access. Atomic counters are preferred to anything which
- * requires synchronization. Where synchronized access is good is that it allows for
- * the whole instance to be locked, for updating multiple entries.
- */
-public final class RoleStatus implements Cloneable, MetricSet {
-
-  private final String name;
-  private final String group;
-
-  /**
-   * Role priority
-   */
-  private final int key;
-  private final ProviderRole providerRole;
-
-  private final LongGauge actual = new LongGauge();
-  private final LongGauge completed = new LongGauge();
-  private final LongGauge desired = new LongGauge();
-  private final LongGauge failed = new LongGauge();
-  private final LongGauge failedRecently = new LongGauge(0);
-  private final LongGauge limitsExceeded = new LongGauge(0);
-  private final LongGauge nodeFailed = new LongGauge(0);
-  /** Number of AA requests queued. */
-  private final LongGauge pendingAntiAffineRequests = new LongGauge(0);
-  private final LongGauge preempted = new LongGauge(0);
-  private final LongGauge releasing = new LongGauge();
-  private final LongGauge requested = new LongGauge();
-  private final LongGauge started = new LongGauge();
-  private final LongGauge startFailed = new LongGauge();
-  private final LongGauge totalRequested = new LongGauge();
-
-  /** resource requirements */
-  private Resource resourceRequirements;
-
-
-  /** any pending AA request */
-  private volatile OutstandingRequest outstandingAArequest = null;
-
-
-  private String failureMessage = "";
-
-  public RoleStatus(ProviderRole providerRole) {
-    this.providerRole = providerRole;
-    this.name = providerRole.name;
-    this.group = providerRole.group;
-    this.key = providerRole.id;
-  }
-
-  @Override
-  public Map<String, Metric> getMetrics() {
-    Map<String, Metric> metrics = new HashMap<>(15);
-    metrics.put("actual", actual);
-    metrics.put("completed", completed );
-    metrics.put("desired", desired);
-    metrics.put("failed", failed);
-    metrics.put("limitsExceeded", limitsExceeded);
-    metrics.put("nodeFailed", nodeFailed);
-    metrics.put("preempted", preempted);
-    metrics.put("pendingAntiAffineRequests", pendingAntiAffineRequests);
-    metrics.put("releasing", releasing);
-    metrics.put("requested", requested);
-    metrics.put("preempted", preempted);
-    metrics.put("releasing", releasing );
-    metrics.put("requested", requested);
-    metrics.put("started", started);
-    metrics.put("startFailed", startFailed);
-    metrics.put("totalRequested", totalRequested);
-
-    metrics.put("outstandingAArequest",
-      new BoolMetricPredicate(new BoolMetricPredicate.Eval() {
-        @Override
-        public boolean eval() {
-          return isAARequestOutstanding();
-        }
-      }));
-    return metrics;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public String getGroup() {
-    return group;
-  }
-
-  public int getKey() {
-    return key;
-  }
-
-  public int getPriority() {
-    return getKey();
-  }
-
-  /**
-   * Get the placement policy enum, from the values in
-   * {@link PlacementPolicy}
-   * @return the placement policy for this role
-   */
-  public int getPlacementPolicy() {
-    return providerRole.placementPolicy;
-  }
-
-  public long getPlacementTimeoutSeconds() {
-    return providerRole.placementTimeoutSeconds;
-  }
-  
-  /**
-   * The number of failures on a specific node that can be tolerated
-   * before selecting a different node for placement
-   * @return
-   */
-  public int getNodeFailureThreshold() {
-    return providerRole.nodeFailureThreshold;
-  }
-
-  public boolean isExcludeFromFlexing() {
-    return hasPlacementPolicy(PlacementPolicy.EXCLUDE_FROM_FLEXING);
-  }
-
-  public boolean isStrictPlacement() {
-    return hasPlacementPolicy(PlacementPolicy.STRICT);
-  }
-
-  public boolean isAntiAffinePlacement() {
-    return hasPlacementPolicy(PlacementPolicy.ANTI_AFFINITY_REQUIRED);
-  }
-
-  public boolean hasPlacementPolicy(int policy) {
-    return 0 != (getPlacementPolicy() & policy);
-  }
-
-  public boolean isPlacementDesired() {
-    return !hasPlacementPolicy(PlacementPolicy.ANYWHERE);
-  }
-
-  public long getDesired() {
-    return desired.get();
-  }
-
-  public void setDesired(long desired) {
-    this.desired.set(desired);
-  }
-
-  public long getActual() {
-    return actual.get();
-  }
-
-  public long incActual() {
-    return actual.incrementAndGet();
-  }
-
-  public long decActual() {
-    return actual.decToFloor(1);
-  }
-
-  /**
-   * Get the request count.
-   * @return a count of requested containers
-   */
-  public long getRequested() {
-    return requested.get();
-  }
-
-  public long incRequested() {
-    totalRequested.incrementAndGet();
-    return requested.incrementAndGet();
-  }
-
-  public void cancel(long count) {
-    requested.decToFloor(count);
-  }
-
-  public void decRequested() {
-    cancel(1);
-  }
-
-  public long getReleasing() {
-    return releasing.get();
-  }
-
-  public long incReleasing() {
-    return releasing.incrementAndGet();
-  }
-
-  public long decReleasing() {
-    return releasing.decToFloor(1);
-  }
-
-  public long getFailed() {
-    return failed.get();
-  }
-
-  public long getFailedRecently() {
-    return failedRecently.get();
-  }
-
-  /**
-   * Reset the recent failure
-   * @return the number of failures in the "recent" window
-   */
-  public long resetFailedRecently() {
-    return failedRecently.getAndSet(0);
-  }
-
-  public long getLimitsExceeded() {
-    return limitsExceeded.get();
-  }
-
-  public long incPendingAntiAffineRequests(long v) {
-    return pendingAntiAffineRequests.addAndGet(v);
-  }
-
-  /**
-   * Probe for an outstanding AA request being true
-   * @return true if there is an outstanding AA Request
-   */
-  public boolean isAARequestOutstanding() {
-    return outstandingAArequest != null;
-  }
-
-  /**
-   * expose the predicate {@link #isAARequestOutstanding()} as an integer,
-   * which is very convenient in tests
-   * @return 1 if there is an outstanding request; 0 if not
-   */
-  public int getOutstandingAARequestCount() {
-    return isAARequestOutstanding()? 1: 0;
-  }
-  /**
-   * Note that a role failed, text will
-   * be used in any diagnostics if an exception
-   * is later raised.
-   * @param startupFailure flag to indicate this was a startup event
-   * @param text text about the failure
-   * @param outcome outcome of the container
-   */
-  public synchronized void noteFailed(boolean startupFailure, String text,
-      ContainerOutcome outcome) {
-    if (text != null) {
-      failureMessage = text;
-    }
-    switch (outcome) {
-      case Preempted:
-        preempted.incrementAndGet();
-        break;
-
-      case Node_failure:
-        nodeFailed.incrementAndGet();
-        failed.incrementAndGet();
-        break;
-
-      case Failed_limits_exceeded: // exceeded memory or CPU; app/configuration related
-        limitsExceeded.incrementAndGet();
-        // fall through
-      case Failed: // application failure, possibly node related, possibly not
-      default: // anything else (future-proofing)
-        failed.incrementAndGet();
-        failedRecently.incrementAndGet();
-        //have a look to see if it short lived
-        if (startupFailure) {
-          incStartFailed();
-        }
-        break;
-    }
-  }
-
-  public long getStartFailed() {
-    return startFailed.get();
-  }
-
-  public synchronized void incStartFailed() {
-    startFailed.getAndIncrement();
-  }
-
-  public synchronized String getFailureMessage() {
-    return failureMessage;
-  }
-
-  public long getCompleted() {
-    return completed.get();
-  }
-
-  public synchronized void setCompleted(int completed) {
-    this.completed.set(completed);
-  }
-
-  public long incCompleted() {
-    return completed.incrementAndGet();
-  }
-  public long getStarted() {
-    return started.get();
-  }
-
-  public synchronized void incStarted() {
-    started.incrementAndGet();
-  }
-
-  public long getTotalRequested() {
-    return totalRequested.get();
-  }
-
-  public long getPreempted() {
-    return preempted.get();
-  }
-
-  public long getNodeFailed() {
-    return nodeFailed.get();
-  }
-
-  public long getPendingAntiAffineRequests() {
-    return pendingAntiAffineRequests.get();
-  }
-
-  public void setPendingAntiAffineRequests(long pendingAntiAffineRequests) {
-    this.pendingAntiAffineRequests.set(pendingAntiAffineRequests);
-  }
-
-  public long decPendingAntiAffineRequests() {
-    return pendingAntiAffineRequests.decToFloor(1);
-  }
-
-  public OutstandingRequest getOutstandingAArequest() {
-    return outstandingAArequest;
-  }
-
-  public void setOutstandingAArequest(OutstandingRequest outstandingAArequest) {
-    this.outstandingAArequest = outstandingAArequest;
-  }
-
-  /**
-   * Complete the outstanding AA request (there's no check for one in progress, caller
-   * expected to have done that).
-   */
-  public void completeOutstandingAARequest() {
-    setOutstandingAArequest(null);
-  }
-
-  /**
-   * Cancel any outstanding AA request. Harmless if the role is non-AA, or
-   * if there are no outstanding requests.
-   */
-  public void cancelOutstandingAARequest() {
-    if (outstandingAArequest != null) {
-      setOutstandingAArequest(null);
-      setPendingAntiAffineRequests(0);
-      decRequested();
-    }
-  }
-
-  /**
-   * Get the number of roles we are short of.
-   * nodes released are ignored.
-   * @return the positive or negative number of roles to add/release.
-   * 0 means "do nothing".
-   */
-  public long getDelta() {
-    long inuse = getActualAndRequested();
-    long delta = desired.get() - inuse;
-    if (delta < 0) {
-      //if we are releasing, remove the number that are already released.
-      delta += releasing.get();
-      //but never switch to a positive
-      delta = Math.min(delta, 0);
-    }
-    return delta;
-  }
-
-  /**
-   * Get count of actual and requested containers. This includes pending ones
-   * @return the size of the application when outstanding requests are included.
-   */
-  public long getActualAndRequested() {
-    return actual.get() + requested.get();
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb = new StringBuilder("RoleStatus{");
-    sb.append("name='").append(name).append('\'');
-    sb.append(", group=").append(group);
-    sb.append(", key=").append(key);
-    sb.append(", desired=").append(desired);
-    sb.append(", actual=").append(actual);
-    sb.append(", requested=").append(requested);
-    sb.append(", releasing=").append(releasing);
-    sb.append(", failed=").append(failed);
-    sb.append(", startFailed=").append(startFailed);
-    sb.append(", started=").append(started);
-    sb.append(", completed=").append(completed);
-    sb.append(", totalRequested=").append(totalRequested);
-    sb.append(", preempted=").append(preempted);
-    sb.append(", nodeFailed=").append(nodeFailed);
-    sb.append(", failedRecently=").append(failedRecently);
-    sb.append(", limitsExceeded=").append(limitsExceeded);
-    sb.append(", resourceRequirements=").append(resourceRequirements);
-    sb.append(", isAntiAffinePlacement=").append(isAntiAffinePlacement());
-    if (isAntiAffinePlacement()) {
-      sb.append(", pendingAntiAffineRequests=").append(pendingAntiAffineRequests);
-      sb.append(", outstandingAArequest=").append(outstandingAArequest);
-    }
-    sb.append(", failureMessage='").append(failureMessage).append('\'');
-    sb.append(", providerRole=").append(providerRole);
-    sb.append('}');
-    return sb.toString();
-  }
-
-  @Override
-  public synchronized  Object clone() throws CloneNotSupportedException {
-    return super.clone();
-  }
-
-  /**
-   * Get the provider role
-   * @return the provider role
-   */
-  public ProviderRole getProviderRole() {
-    return providerRole;
-  }
-
-  /**
-   * Build the statistics map from the current data
-   * @return a map for use in statistics reports
-   */
-  public Map<String, Integer> buildStatistics() {
-    ComponentInformation componentInformation = serialize();
-    return componentInformation.buildStatistics();
-  }
-
-  /**
-   * Produced a serialized form which can be served up as JSON
-   * @return a summary of the current role status.
-   */
-  public synchronized ComponentInformation serialize() {
-    ComponentInformation info = new ComponentInformation();
-    info.name = name;
-    info.priority = getPriority();
-    info.desired = desired.intValue();
-    info.actual = actual.intValue();
-    info.requested = requested.intValue();
-    info.releasing = releasing.intValue();
-    info.failed = failed.intValue();
-    info.startFailed = startFailed.intValue();
-    info.placementPolicy = getPlacementPolicy();
-    info.failureMessage = failureMessage;
-    info.totalRequested = totalRequested.intValue();
-    info.failedRecently = failedRecently.intValue();
-    info.nodeFailed = nodeFailed.intValue();
-    info.preempted = preempted.intValue();
-    info.pendingAntiAffineRequestCount = pendingAntiAffineRequests.intValue();
-    info.isAARequestOutstanding = isAARequestOutstanding();
-    return info;
-  }
-
-  /**
-   * Get the (possibly null) label expression for this role
-   * @return a string or null
-   */
-  public String getLabelExpression() {
-    return providerRole.labelExpression;
-  }
-
-  public Resource getResourceRequirements() {
-    return resourceRequirements;
-  }
-
-  public void setResourceRequirements(Resource resourceRequirements) {
-    this.resourceRequirements = resourceRequirements;
-  }
-
-  /**
-   * Compare two role status entries by name
-   */
-  public static class CompareByName implements Comparator<RoleStatus>,
-      Serializable {
-    @Override
-    public int compare(RoleStatus o1, RoleStatus o2) {
-      return o1.getName().compareTo(o2.getName());
-    }
-  }
-  
-  /**
-   * Compare two role status entries by key
-   */
-  public static class CompareByKey implements Comparator<RoleStatus>,
-      Serializable {
-    @Override
-    public int compare(RoleStatus o1, RoleStatus o2) {
-      return (o1.getKey() < o2.getKey() ? -1 : (o1.getKey() == o2.getKey() ? 0 : 1));
-    }
-  }
-
-  /**
-   * Given a resource, set its requirements to those this role needs
-   * @param resource resource to configure
-   * @return the resource
-   */
-  public Resource copyResourceRequirements(Resource resource) {
-    Preconditions.checkNotNull(resourceRequirements,
-        "Role resource requirements have not been set");
-    resource.setMemory(resourceRequirements.getMemory());
-    resource.setVirtualCores(resourceRequirements.getVirtualCores());
-    return resource;
-  }
-
-  public synchronized RoleStatistics getStatistics() {
-    RoleStatistics stats = new RoleStatistics();
-    stats.activeAA = getOutstandingAARequestCount();
-    stats.actual = actual.get();
-    stats.desired = desired.get();
-    stats.failed = failed.get();
-    stats.limitsExceeded = limitsExceeded.get();
-    stats.nodeFailed = nodeFailed.get();
-    stats.preempted = preempted.get();
-    stats.releasing = releasing.get();
-    stats.requested = requested.get();
-    stats.started = started.get();
-    stats.startFailed = startFailed.get();
-    stats.totalRequested = totalRequested.get();
-    return stats;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/SimpleReleaseSelector.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/SimpleReleaseSelector.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/SimpleReleaseSelector.java
deleted file mode 100644
index b848096..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/SimpleReleaseSelector.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import java.util.List;
-
-/**
- * Simplest release selector simply returns the list
- */
-public class SimpleReleaseSelector implements ContainerReleaseSelector {
-
-  @Override
-  public List<RoleInstance> sortCandidates(int roleId,
-      List<RoleInstance> candidates) {
-    return candidates;
-  }
-}


[08/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/dt-1.9.4/js/jquery.dataTables.min.js
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/dt-1.9.4/js/jquery.dataTables.min.js b/slider-core/src/main/resources/webapps/static/dt-1.9.4/js/jquery.dataTables.min.js
deleted file mode 100644
index a2405bf..0000000
--- a/slider-core/src/main/resources/webapps/static/dt-1.9.4/js/jquery.dataTables.min.js
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * File:        jquery.dataTables.min.js
- * Version:     1.9.4
- * Author:      Allan Jardine (www.sprymedia.co.uk)
- * Info:        www.datatables.net
- * 
- * Copyright 2008-2012 Allan Jardine, all rights reserved.
- *
- * This source file is free software, under either the GPL v2 license or a
- * BSD style license, available at:
- *   http://datatables.net/license_gpl2
- *   http://datatables.net/license_bsd
- * 
- * This source file is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
- * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
- */
-(function(la,s,p){(function(i){if(typeof define==="function"&&define.amd)define(["jquery"],i);else jQuery&&!jQuery.fn.dataTable&&i(jQuery)})(function(i){var l=function(h){function n(a,b){var c=l.defaults.columns,d=a.aoColumns.length;b=i.extend({},l.models.oColumn,c,{sSortingClass:a.oClasses.sSortable,sSortingClassJUI:a.oClasses.sSortJUI,nTh:b?b:s.createElement("th"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:"",aDataSort:c.aDataSort?c.aDataSort:[d],mData:c.mData?c.oDefaults:d});a.aoColumns.push(b);if(a.aoPreSearchCols[d]===
-p||a.aoPreSearchCols[d]===null)a.aoPreSearchCols[d]=i.extend({},l.models.oSearch);else{b=a.aoPreSearchCols[d];if(b.bRegex===p)b.bRegex=true;if(b.bSmart===p)b.bSmart=true;if(b.bCaseInsensitive===p)b.bCaseInsensitive=true}q(a,d,null)}function q(a,b,c){var d=a.aoColumns[b];if(c!==p&&c!==null){if(c.mDataProp&&!c.mData)c.mData=c.mDataProp;if(c.sType!==p){d.sType=c.sType;d._bAutoType=false}i.extend(d,c);r(d,c,"sWidth","sWidthOrig");if(c.iDataSort!==p)d.aDataSort=[c.iDataSort];r(d,c,"aDataSort")}var e=d.mRender?
-ca(d.mRender):null,f=ca(d.mData);d.fnGetData=function(g,j){var k=f(g,j);if(d.mRender&&j&&j!=="")return e(k,j,g);return k};d.fnSetData=Ja(d.mData);if(!a.oFeatures.bSort)d.bSortable=false;if(!d.bSortable||i.inArray("asc",d.asSorting)==-1&&i.inArray("desc",d.asSorting)==-1){d.sSortingClass=a.oClasses.sSortableNone;d.sSortingClassJUI=""}else if(i.inArray("asc",d.asSorting)==-1&&i.inArray("desc",d.asSorting)==-1){d.sSortingClass=a.oClasses.sSortable;d.sSortingClassJUI=a.oClasses.sSortJUI}else if(i.inArray("asc",
-d.asSorting)!=-1&&i.inArray("desc",d.asSorting)==-1){d.sSortingClass=a.oClasses.sSortableAsc;d.sSortingClassJUI=a.oClasses.sSortJUIAscAllowed}else if(i.inArray("asc",d.asSorting)==-1&&i.inArray("desc",d.asSorting)!=-1){d.sSortingClass=a.oClasses.sSortableDesc;d.sSortingClassJUI=a.oClasses.sSortJUIDescAllowed}}function o(a){if(a.oFeatures.bAutoWidth===false)return false;ta(a);for(var b=0,c=a.aoColumns.length;b<c;b++)a.aoColumns[b].nTh.style.width=a.aoColumns[b].sWidth}function v(a,b){a=A(a,"bVisible");
-return typeof a[b]==="number"?a[b]:null}function w(a,b){a=A(a,"bVisible");b=i.inArray(b,a);return b!==-1?b:null}function D(a){return A(a,"bVisible").length}function A(a,b){var c=[];i.map(a.aoColumns,function(d,e){d[b]&&c.push(e)});return c}function G(a){for(var b=l.ext.aTypes,c=b.length,d=0;d<c;d++){var e=b[d](a);if(e!==null)return e}return"string"}function E(a,b){b=b.split(",");for(var c=[],d=0,e=a.aoColumns.length;d<e;d++)for(var f=0;f<e;f++)if(a.aoColumns[d].sName==b[f]){c.push(f);break}return c}
-function Y(a){for(var b="",c=0,d=a.aoColumns.length;c<d;c++)b+=a.aoColumns[c].sName+",";if(b.length==d)return"";return b.slice(0,-1)}function ma(a,b,c,d){var e,f,g,j,k;if(b)for(e=b.length-1;e>=0;e--){var m=b[e].aTargets;i.isArray(m)||O(a,1,"aTargets must be an array of targets, not a "+typeof m);f=0;for(g=m.length;f<g;f++)if(typeof m[f]==="number"&&m[f]>=0){for(;a.aoColumns.length<=m[f];)n(a);d(m[f],b[e])}else if(typeof m[f]==="number"&&m[f]<0)d(a.aoColumns.length+m[f],b[e]);else if(typeof m[f]===
-"string"){j=0;for(k=a.aoColumns.length;j<k;j++)if(m[f]=="_all"||i(a.aoColumns[j].nTh).hasClass(m[f]))d(j,b[e])}}if(c){e=0;for(a=c.length;e<a;e++)d(e,c[e])}}function R(a,b){var c;c=i.isArray(b)?b.slice():i.extend(true,{},b);b=a.aoData.length;var d=i.extend(true,{},l.models.oRow);d._aData=c;a.aoData.push(d);var e;d=0;for(var f=a.aoColumns.length;d<f;d++){c=a.aoColumns[d];typeof c.fnRender==="function"&&c.bUseRendered&&c.mData!==null?S(a,b,d,da(a,b,d)):S(a,b,d,F(a,b,d));if(c._bAutoType&&c.sType!="string"){e=
-F(a,b,d,"type");if(e!==null&&e!==""){e=G(e);if(c.sType===null)c.sType=e;else if(c.sType!=e&&c.sType!="html")c.sType="string"}}}a.aiDisplayMaster.push(b);a.oFeatures.bDeferRender||ua(a,b);return b}function ea(a){var b,c,d,e,f,g,j;if(a.bDeferLoading||a.sAjaxSource===null)for(b=a.nTBody.firstChild;b;){if(b.nodeName.toUpperCase()=="TR"){c=a.aoData.length;b._DT_RowIndex=c;a.aoData.push(i.extend(true,{},l.models.oRow,{nTr:b}));a.aiDisplayMaster.push(c);f=b.firstChild;for(d=0;f;){g=f.nodeName.toUpperCase();
-if(g=="TD"||g=="TH"){S(a,c,d,i.trim(f.innerHTML));d++}f=f.nextSibling}}b=b.nextSibling}e=fa(a);d=[];b=0;for(c=e.length;b<c;b++)for(f=e[b].firstChild;f;){g=f.nodeName.toUpperCase();if(g=="TD"||g=="TH")d.push(f);f=f.nextSibling}c=0;for(e=a.aoColumns.length;c<e;c++){j=a.aoColumns[c];if(j.sTitle===null)j.sTitle=j.nTh.innerHTML;var k=j._bAutoType,m=typeof j.fnRender==="function",u=j.sClass!==null,x=j.bVisible,y,B;if(k||m||u||!x){g=0;for(b=a.aoData.length;g<b;g++){f=a.aoData[g];y=d[g*e+c];if(k&&j.sType!=
-"string"){B=F(a,g,c,"type");if(B!==""){B=G(B);if(j.sType===null)j.sType=B;else if(j.sType!=B&&j.sType!="html")j.sType="string"}}if(j.mRender)y.innerHTML=F(a,g,c,"display");else if(j.mData!==c)y.innerHTML=F(a,g,c,"display");if(m){B=da(a,g,c);y.innerHTML=B;j.bUseRendered&&S(a,g,c,B)}if(u)y.className+=" "+j.sClass;if(x)f._anHidden[c]=null;else{f._anHidden[c]=y;y.parentNode.removeChild(y)}j.fnCreatedCell&&j.fnCreatedCell.call(a.oInstance,y,F(a,g,c,"display"),f._aData,g,c)}}}if(a.aoRowCreatedCallback.length!==
-0){b=0;for(c=a.aoData.length;b<c;b++){f=a.aoData[b];K(a,"aoRowCreatedCallback",null,[f.nTr,f._aData,b])}}}function V(a,b){return b._DT_RowIndex!==p?b._DT_RowIndex:null}function va(a,b,c){b=W(a,b);var d=0;for(a=a.aoColumns.length;d<a;d++)if(b[d]===c)return d;return-1}function na(a,b,c,d){for(var e=[],f=0,g=d.length;f<g;f++)e.push(F(a,b,d[f],c));return e}function F(a,b,c,d){var e=a.aoColumns[c];if((c=e.fnGetData(a.aoData[b]._aData,d))===p){if(a.iDrawError!=a.iDraw&&e.sDefaultContent===null){O(a,0,"Requested unknown parameter "+
-(typeof e.mData=="function"?"{mData function}":"'"+e.mData+"'")+" from the data source for row "+b);a.iDrawError=a.iDraw}return e.sDefaultContent}if(c===null&&e.sDefaultContent!==null)c=e.sDefaultContent;else if(typeof c==="function")return c();if(d=="display"&&c===null)return"";return c}function S(a,b,c,d){a.aoColumns[c].fnSetData(a.aoData[b]._aData,d)}function ca(a){if(a===null)return function(){return null};else if(typeof a==="function")return function(c,d,e){return a(c,d,e)};else if(typeof a===
-"string"&&(a.indexOf(".")!==-1||a.indexOf("[")!==-1)){var b=function(c,d,e){var f=e.split("."),g;if(e!==""){var j=0;for(g=f.length;j<g;j++){if(e=f[j].match(ga)){f[j]=f[j].replace(ga,"");if(f[j]!=="")c=c[f[j]];g=[];f.splice(0,j+1);f=f.join(".");j=0;for(var k=c.length;j<k;j++)g.push(b(c[j],d,f));c=e[0].substring(1,e[0].length-1);c=c===""?g:g.join(c);break}if(c===null||c[f[j]]===p)return p;c=c[f[j]]}}return c};return function(c,d){return b(c,d,a)}}else return function(c){return c[a]}}function Ja(a){if(a===
-null)return function(){};else if(typeof a==="function")return function(c,d){a(c,"set",d)};else if(typeof a==="string"&&(a.indexOf(".")!==-1||a.indexOf("[")!==-1)){var b=function(c,d,e){e=e.split(".");var f,g,j=0;for(g=e.length-1;j<g;j++){if(f=e[j].match(ga)){e[j]=e[j].replace(ga,"");c[e[j]]=[];f=e.slice();f.splice(0,j+1);g=f.join(".");for(var k=0,m=d.length;k<m;k++){f={};b(f,d[k],g);c[e[j]].push(f)}return}if(c[e[j]]===null||c[e[j]]===p)c[e[j]]={};c=c[e[j]]}c[e[e.length-1].replace(ga,"")]=d};return function(c,
-d){return b(c,d,a)}}else return function(c,d){c[a]=d}}function oa(a){for(var b=[],c=a.aoData.length,d=0;d<c;d++)b.push(a.aoData[d]._aData);return b}function wa(a){a.aoData.splice(0,a.aoData.length);a.aiDisplayMaster.splice(0,a.aiDisplayMaster.length);a.aiDisplay.splice(0,a.aiDisplay.length);I(a)}function xa(a,b){for(var c=-1,d=0,e=a.length;d<e;d++)if(a[d]==b)c=d;else a[d]>b&&a[d]--;c!=-1&&a.splice(c,1)}function da(a,b,c){var d=a.aoColumns[c];return d.fnRender({iDataRow:b,iDataColumn:c,oSettings:a,
-aData:a.aoData[b]._aData,mDataProp:d.mData},F(a,b,c,"display"))}function ua(a,b){var c=a.aoData[b],d;if(c.nTr===null){c.nTr=s.createElement("tr");c.nTr._DT_RowIndex=b;if(c._aData.DT_RowId)c.nTr.id=c._aData.DT_RowId;if(c._aData.DT_RowClass)c.nTr.className=c._aData.DT_RowClass;for(var e=0,f=a.aoColumns.length;e<f;e++){var g=a.aoColumns[e];d=s.createElement(g.sCellType);d.innerHTML=typeof g.fnRender==="function"&&(!g.bUseRendered||g.mData===null)?da(a,b,e):F(a,b,e,"display");if(g.sClass!==null)d.className=
-g.sClass;if(g.bVisible){c.nTr.appendChild(d);c._anHidden[e]=null}else c._anHidden[e]=d;g.fnCreatedCell&&g.fnCreatedCell.call(a.oInstance,d,F(a,b,e,"display"),c._aData,b,e)}K(a,"aoRowCreatedCallback",null,[c.nTr,c._aData,b])}}function Ka(a){var b,c,d;if(i("th, td",a.nTHead).length!==0){b=0;for(d=a.aoColumns.length;b<d;b++){c=a.aoColumns[b].nTh;c.setAttribute("role","columnheader");if(a.aoColumns[b].bSortable){c.setAttribute("tabindex",a.iTabIndex);c.setAttribute("aria-controls",a.sTableId)}a.aoColumns[b].sClass!==
-null&&i(c).addClass(a.aoColumns[b].sClass);if(a.aoColumns[b].sTitle!=c.innerHTML)c.innerHTML=a.aoColumns[b].sTitle}}else{var e=s.createElement("tr");b=0;for(d=a.aoColumns.length;b<d;b++){c=a.aoColumns[b].nTh;c.innerHTML=a.aoColumns[b].sTitle;c.setAttribute("tabindex","0");a.aoColumns[b].sClass!==null&&i(c).addClass(a.aoColumns[b].sClass);e.appendChild(c)}i(a.nTHead).html("")[0].appendChild(e);ha(a.aoHeader,a.nTHead)}i(a.nTHead).children("tr").attr("role","row");if(a.bJUI){b=0;for(d=a.aoColumns.length;b<
-d;b++){c=a.aoColumns[b].nTh;e=s.createElement("div");e.className=a.oClasses.sSortJUIWrapper;i(c).contents().appendTo(e);var f=s.createElement("span");f.className=a.oClasses.sSortIcon;e.appendChild(f);c.appendChild(e)}}if(a.oFeatures.bSort)for(b=0;b<a.aoColumns.length;b++)a.aoColumns[b].bSortable!==false?ya(a,a.aoColumns[b].nTh,b):i(a.aoColumns[b].nTh).addClass(a.oClasses.sSortableNone);a.oClasses.sFooterTH!==""&&i(a.nTFoot).children("tr").children("th").addClass(a.oClasses.sFooterTH);if(a.nTFoot!==
-null){c=Z(a,null,a.aoFooter);b=0;for(d=a.aoColumns.length;b<d;b++)if(c[b]){a.aoColumns[b].nTf=c[b];a.aoColumns[b].sClass&&i(c[b]).addClass(a.aoColumns[b].sClass)}}}function ia(a,b,c){var d,e,f,g=[],j=[],k=a.aoColumns.length,m;if(c===p)c=false;d=0;for(e=b.length;d<e;d++){g[d]=b[d].slice();g[d].nTr=b[d].nTr;for(f=k-1;f>=0;f--)!a.aoColumns[f].bVisible&&!c&&g[d].splice(f,1);j.push([])}d=0;for(e=g.length;d<e;d++){if(a=g[d].nTr)for(;f=a.firstChild;)a.removeChild(f);f=0;for(b=g[d].length;f<b;f++){m=k=1;
-if(j[d][f]===p){a.appendChild(g[d][f].cell);for(j[d][f]=1;g[d+k]!==p&&g[d][f].cell==g[d+k][f].cell;){j[d+k][f]=1;k++}for(;g[d][f+m]!==p&&g[d][f].cell==g[d][f+m].cell;){for(c=0;c<k;c++)j[d+c][f+m]=1;m++}g[d][f].cell.rowSpan=k;g[d][f].cell.colSpan=m}}}}function H(a){var b=K(a,"aoPreDrawCallback","preDraw",[a]);if(i.inArray(false,b)!==-1)P(a,false);else{var c,d;b=[];var e=0,f=a.asStripeClasses.length;c=a.aoOpenRows.length;a.bDrawing=true;if(a.iInitDisplayStart!==p&&a.iInitDisplayStart!=-1){a._iDisplayStart=
-a.oFeatures.bServerSide?a.iInitDisplayStart:a.iInitDisplayStart>=a.fnRecordsDisplay()?0:a.iInitDisplayStart;a.iInitDisplayStart=-1;I(a)}if(a.bDeferLoading){a.bDeferLoading=false;a.iDraw++}else if(a.oFeatures.bServerSide){if(!a.bDestroying&&!La(a))return}else a.iDraw++;if(a.aiDisplay.length!==0){var g=a._iDisplayStart;d=a._iDisplayEnd;if(a.oFeatures.bServerSide){g=0;d=a.aoData.length}for(g=g;g<d;g++){var j=a.aoData[a.aiDisplay[g]];j.nTr===null&&ua(a,a.aiDisplay[g]);var k=j.nTr;if(f!==0){var m=a.asStripeClasses[e%
-f];if(j._sRowStripe!=m){i(k).removeClass(j._sRowStripe).addClass(m);j._sRowStripe=m}}K(a,"aoRowCallback",null,[k,a.aoData[a.aiDisplay[g]]._aData,e,g]);b.push(k);e++;if(c!==0)for(j=0;j<c;j++)if(k==a.aoOpenRows[j].nParent){b.push(a.aoOpenRows[j].nTr);break}}}else{b[0]=s.createElement("tr");if(a.asStripeClasses[0])b[0].className=a.asStripeClasses[0];c=a.oLanguage;f=c.sZeroRecords;if(a.iDraw==1&&a.sAjaxSource!==null&&!a.oFeatures.bServerSide)f=c.sLoadingRecords;else if(c.sEmptyTable&&a.fnRecordsTotal()===
-0)f=c.sEmptyTable;c=s.createElement("td");c.setAttribute("valign","top");c.colSpan=D(a);c.className=a.oClasses.sRowEmpty;c.innerHTML=za(a,f);b[e].appendChild(c)}K(a,"aoHeaderCallback","header",[i(a.nTHead).children("tr")[0],oa(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay]);K(a,"aoFooterCallback","footer",[i(a.nTFoot).children("tr")[0],oa(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay]);e=s.createDocumentFragment();c=s.createDocumentFragment();if(a.nTBody){f=a.nTBody.parentNode;c.appendChild(a.nTBody);
-if(!a.oScroll.bInfinite||!a._bInitComplete||a.bSorted||a.bFiltered)for(;c=a.nTBody.firstChild;)a.nTBody.removeChild(c);c=0;for(d=b.length;c<d;c++)e.appendChild(b[c]);a.nTBody.appendChild(e);f!==null&&f.appendChild(a.nTBody)}K(a,"aoDrawCallback","draw",[a]);a.bSorted=false;a.bFiltered=false;a.bDrawing=false;if(a.oFeatures.bServerSide){P(a,false);a._bInitComplete||pa(a)}}}function qa(a){if(a.oFeatures.bSort)$(a,a.oPreviousSearch);else if(a.oFeatures.bFilter)X(a,a.oPreviousSearch);else{I(a);H(a)}}function Ma(a){var b=
-i("<div></div>")[0];a.nTable.parentNode.insertBefore(b,a.nTable);a.nTableWrapper=i('<div id="'+a.sTableId+'_wrapper" class="'+a.oClasses.sWrapper+'" role="grid"></div>')[0];a.nTableReinsertBefore=a.nTable.nextSibling;for(var c=a.nTableWrapper,d=a.sDom.split(""),e,f,g,j,k,m,u,x=0;x<d.length;x++){f=0;g=d[x];if(g=="<"){j=i("<div></div>")[0];k=d[x+1];if(k=="'"||k=='"'){m="";for(u=2;d[x+u]!=k;){m+=d[x+u];u++}if(m=="H")m=a.oClasses.sJUIHeader;else if(m=="F")m=a.oClasses.sJUIFooter;if(m.indexOf(".")!=-1){k=
-m.split(".");j.id=k[0].substr(1,k[0].length-1);j.className=k[1]}else if(m.charAt(0)=="#")j.id=m.substr(1,m.length-1);else j.className=m;x+=u}c.appendChild(j);c=j}else if(g==">")c=c.parentNode;else if(g=="l"&&a.oFeatures.bPaginate&&a.oFeatures.bLengthChange){e=Na(a);f=1}else if(g=="f"&&a.oFeatures.bFilter){e=Oa(a);f=1}else if(g=="r"&&a.oFeatures.bProcessing){e=Pa(a);f=1}else if(g=="t"){e=Qa(a);f=1}else if(g=="i"&&a.oFeatures.bInfo){e=Ra(a);f=1}else if(g=="p"&&a.oFeatures.bPaginate){e=Sa(a);f=1}else if(l.ext.aoFeatures.length!==
-0){j=l.ext.aoFeatures;u=0;for(k=j.length;u<k;u++)if(g==j[u].cFeature){if(e=j[u].fnInit(a))f=1;break}}if(f==1&&e!==null){if(typeof a.aanFeatures[g]!=="object")a.aanFeatures[g]=[];a.aanFeatures[g].push(e);c.appendChild(e)}}b.parentNode.replaceChild(a.nTableWrapper,b)}function ha(a,b){b=i(b).children("tr");var c,d,e,f,g,j,k,m,u,x,y=function(B,T,M){for(B=B[T];B[M];)M++;return M};a.splice(0,a.length);e=0;for(j=b.length;e<j;e++)a.push([]);e=0;for(j=b.length;e<j;e++){c=b[e];for(d=c.firstChild;d;){if(d.nodeName.toUpperCase()==
-"TD"||d.nodeName.toUpperCase()=="TH"){m=d.getAttribute("colspan")*1;u=d.getAttribute("rowspan")*1;m=!m||m===0||m===1?1:m;u=!u||u===0||u===1?1:u;k=y(a,e,0);x=m===1?true:false;for(g=0;g<m;g++)for(f=0;f<u;f++){a[e+f][k+g]={cell:d,unique:x};a[e+f].nTr=c}}d=d.nextSibling}}}function Z(a,b,c){var d=[];if(!c){c=a.aoHeader;if(b){c=[];ha(c,b)}}b=0;for(var e=c.length;b<e;b++)for(var f=0,g=c[b].length;f<g;f++)if(c[b][f].unique&&(!d[f]||!a.bSortCellsTop))d[f]=c[b][f].cell;return d}function La(a){if(a.bAjaxDataGet){a.iDraw++;
-P(a,true);var b=Ta(a);Aa(a,b);a.fnServerData.call(a.oInstance,a.sAjaxSource,b,function(c){Ua(a,c)},a);return false}else return true}function Ta(a){var b=a.aoColumns.length,c=[],d,e,f,g;c.push({name:"sEcho",value:a.iDraw});c.push({name:"iColumns",value:b});c.push({name:"sColumns",value:Y(a)});c.push({name:"iDisplayStart",value:a._iDisplayStart});c.push({name:"iDisplayLength",value:a.oFeatures.bPaginate!==false?a._iDisplayLength:-1});for(f=0;f<b;f++){d=a.aoColumns[f].mData;c.push({name:"mDataProp_"+
-f,value:typeof d==="function"?"function":d})}if(a.oFeatures.bFilter!==false){c.push({name:"sSearch",value:a.oPreviousSearch.sSearch});c.push({name:"bRegex",value:a.oPreviousSearch.bRegex});for(f=0;f<b;f++){c.push({name:"sSearch_"+f,value:a.aoPreSearchCols[f].sSearch});c.push({name:"bRegex_"+f,value:a.aoPreSearchCols[f].bRegex});c.push({name:"bSearchable_"+f,value:a.aoColumns[f].bSearchable})}}if(a.oFeatures.bSort!==false){var j=0;d=a.aaSortingFixed!==null?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();
-for(f=0;f<d.length;f++){e=a.aoColumns[d[f][0]].aDataSort;for(g=0;g<e.length;g++){c.push({name:"iSortCol_"+j,value:e[g]});c.push({name:"sSortDir_"+j,value:d[f][1]});j++}}c.push({name:"iSortingCols",value:j});for(f=0;f<b;f++)c.push({name:"bSortable_"+f,value:a.aoColumns[f].bSortable})}return c}function Aa(a,b){K(a,"aoServerParams","serverParams",[b])}function Ua(a,b){if(b.sEcho!==p)if(b.sEcho*1<a.iDraw)return;else a.iDraw=b.sEcho*1;if(!a.oScroll.bInfinite||a.oScroll.bInfinite&&(a.bSorted||a.bFiltered))wa(a);
-a._iRecordsTotal=parseInt(b.iTotalRecords,10);a._iRecordsDisplay=parseInt(b.iTotalDisplayRecords,10);var c=Y(a);c=b.sColumns!==p&&c!==""&&b.sColumns!=c;var d;if(c)d=E(a,b.sColumns);b=ca(a.sAjaxDataProp)(b);for(var e=0,f=b.length;e<f;e++)if(c){for(var g=[],j=0,k=a.aoColumns.length;j<k;j++)g.push(b[e][d[j]]);R(a,g)}else R(a,b[e]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=false;H(a);a.bAjaxDataGet=true;P(a,false)}function Oa(a){var b=a.oPreviousSearch,c=a.oLanguage.sSearch;c=c.indexOf("_INPUT_")!==
--1?c.replace("_INPUT_",'<input type="text" />'):c===""?'<input type="text" />':c+' <input type="text" />';var d=s.createElement("div");d.className=a.oClasses.sFilter;d.innerHTML="<label>"+c+"</label>";if(!a.aanFeatures.f)d.id=a.sTableId+"_filter";c=i('input[type="text"]',d);d._DT_Input=c[0];c.val(b.sSearch.replace('"',"&quot;"));c.bind("keyup.DT",function(){for(var e=a.aanFeatures.f,f=this.value===""?"":this.value,g=0,j=e.length;g<j;g++)e[g]!=i(this).parents("div.dataTables_filter")[0]&&i(e[g]._DT_Input).val(f);
-f!=b.sSearch&&X(a,{sSearch:f,bRegex:b.bRegex,bSmart:b.bSmart,bCaseInsensitive:b.bCaseInsensitive})});c.attr("aria-controls",a.sTableId).bind("keypress.DT",function(e){if(e.keyCode==13)return false});return d}function X(a,b,c){var d=a.oPreviousSearch,e=a.aoPreSearchCols,f=function(g){d.sSearch=g.sSearch;d.bRegex=g.bRegex;d.bSmart=g.bSmart;d.bCaseInsensitive=g.bCaseInsensitive};if(a.oFeatures.bServerSide)f(b);else{Va(a,b.sSearch,c,b.bRegex,b.bSmart,b.bCaseInsensitive);f(b);for(b=0;b<a.aoPreSearchCols.length;b++)Wa(a,
-e[b].sSearch,b,e[b].bRegex,e[b].bSmart,e[b].bCaseInsensitive);Xa(a)}a.bFiltered=true;i(a.oInstance).trigger("filter",a);a._iDisplayStart=0;I(a);H(a);Ba(a,0)}function Xa(a){for(var b=l.ext.afnFiltering,c=A(a,"bSearchable"),d=0,e=b.length;d<e;d++)for(var f=0,g=0,j=a.aiDisplay.length;g<j;g++){var k=a.aiDisplay[g-f];if(!b[d](a,na(a,k,"filter",c),k)){a.aiDisplay.splice(g-f,1);f++}}}function Wa(a,b,c,d,e,f){if(b!==""){var g=0;b=Ca(b,d,e,f);for(d=a.aiDisplay.length-1;d>=0;d--){e=Ya(F(a,a.aiDisplay[d],c,
-"filter"),a.aoColumns[c].sType);if(!b.test(e)){a.aiDisplay.splice(d,1);g++}}}}function Va(a,b,c,d,e,f){d=Ca(b,d,e,f);e=a.oPreviousSearch;c||(c=0);if(l.ext.afnFiltering.length!==0)c=1;if(b.length<=0){a.aiDisplay.splice(0,a.aiDisplay.length);a.aiDisplay=a.aiDisplayMaster.slice()}else if(a.aiDisplay.length==a.aiDisplayMaster.length||e.sSearch.length>b.length||c==1||b.indexOf(e.sSearch)!==0){a.aiDisplay.splice(0,a.aiDisplay.length);Ba(a,1);for(b=0;b<a.aiDisplayMaster.length;b++)d.test(a.asDataSearch[b])&&
-a.aiDisplay.push(a.aiDisplayMaster[b])}else for(b=c=0;b<a.asDataSearch.length;b++)if(!d.test(a.asDataSearch[b])){a.aiDisplay.splice(b-c,1);c++}}function Ba(a,b){if(!a.oFeatures.bServerSide){a.asDataSearch=[];var c=A(a,"bSearchable");b=b===1?a.aiDisplayMaster:a.aiDisplay;for(var d=0,e=b.length;d<e;d++)a.asDataSearch[d]=Da(a,na(a,b[d],"filter",c))}}function Da(a,b){a=b.join("  ");if(a.indexOf("&")!==-1)a=i("<div>").html(a).text();return a.replace(/[\n\r]/g," ")}function Ca(a,b,c,d){if(c){a=b?a.split(" "):
-Ea(a).split(" ");a="^(?=.*?"+a.join(")(?=.*?")+").*$";return new RegExp(a,d?"i":"")}else{a=b?a:Ea(a);return new RegExp(a,d?"i":"")}}function Ya(a,b){if(typeof l.ext.ofnSearch[b]==="function")return l.ext.ofnSearch[b](a);else if(a===null)return"";else if(b=="html")return a.replace(/[\r\n]/g," ").replace(/<.*?>/g,"");else if(typeof a==="string")return a.replace(/[\r\n]/g," ");return a}function Ea(a){return a.replace(new RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$|\\^|\\-)","g"),
-"\\$1")}function Ra(a){var b=s.createElement("div");b.className=a.oClasses.sInfo;if(!a.aanFeatures.i){a.aoDrawCallback.push({fn:Za,sName:"information"});b.id=a.sTableId+"_info"}a.nTable.setAttribute("aria-describedby",a.sTableId+"_info");return b}function Za(a){if(!(!a.oFeatures.bInfo||a.aanFeatures.i.length===0)){var b=a.oLanguage,c=a._iDisplayStart+1,d=a.fnDisplayEnd(),e=a.fnRecordsTotal(),f=a.fnRecordsDisplay(),g;g=f===0?b.sInfoEmpty:b.sInfo;if(f!=e)g+=" "+b.sInfoFiltered;g+=b.sInfoPostFix;g=za(a,
-g);if(b.fnInfoCallback!==null)g=b.fnInfoCallback.call(a.oInstance,a,c,d,e,f,g);a=a.aanFeatures.i;b=0;for(c=a.length;b<c;b++)i(a[b]).html(g)}}function za(a,b){var c=a.fnFormatNumber(a._iDisplayStart+1),d=a.fnDisplayEnd();d=a.fnFormatNumber(d);var e=a.fnRecordsDisplay();e=a.fnFormatNumber(e);var f=a.fnRecordsTotal();f=a.fnFormatNumber(f);if(a.oScroll.bInfinite)c=a.fnFormatNumber(1);return b.replace(/_START_/g,c).replace(/_END_/g,d).replace(/_TOTAL_/g,e).replace(/_MAX_/g,f)}function ra(a){var b,c,d=
-a.iInitDisplayStart;if(a.bInitialised===false)setTimeout(function(){ra(a)},200);else{Ma(a);Ka(a);ia(a,a.aoHeader);a.nTFoot&&ia(a,a.aoFooter);P(a,true);a.oFeatures.bAutoWidth&&ta(a);b=0;for(c=a.aoColumns.length;b<c;b++)if(a.aoColumns[b].sWidth!==null)a.aoColumns[b].nTh.style.width=t(a.aoColumns[b].sWidth);if(a.oFeatures.bSort)$(a);else if(a.oFeatures.bFilter)X(a,a.oPreviousSearch);else{a.aiDisplay=a.aiDisplayMaster.slice();I(a);H(a)}if(a.sAjaxSource!==null&&!a.oFeatures.bServerSide){c=[];Aa(a,c);a.fnServerData.call(a.oInstance,
-a.sAjaxSource,c,function(e){var f=a.sAjaxDataProp!==""?ca(a.sAjaxDataProp)(e):e;for(b=0;b<f.length;b++)R(a,f[b]);a.iInitDisplayStart=d;if(a.oFeatures.bSort)$(a);else{a.aiDisplay=a.aiDisplayMaster.slice();I(a);H(a)}P(a,false);pa(a,e)},a)}else if(!a.oFeatures.bServerSide){P(a,false);pa(a)}}}function pa(a,b){a._bInitComplete=true;K(a,"aoInitComplete","init",[a,b])}function Fa(a){var b=l.defaults.oLanguage;!a.sEmptyTable&&a.sZeroRecords&&b.sEmptyTable==="No data available in table"&&r(a,a,"sZeroRecords",
-"sEmptyTable");!a.sLoadingRecords&&a.sZeroRecords&&b.sLoadingRecords==="Loading..."&&r(a,a,"sZeroRecords","sLoadingRecords")}function Na(a){if(a.oScroll.bInfinite)return null;var b='<select size="1" '+('name="'+a.sTableId+'_length"')+">",c,d,e=a.aLengthMenu;if(e.length==2&&typeof e[0]==="object"&&typeof e[1]==="object"){c=0;for(d=e[0].length;c<d;c++)b+='<option value="'+e[0][c]+'">'+e[1][c]+"</option>"}else{c=0;for(d=e.length;c<d;c++)b+='<option value="'+e[c]+'">'+e[c]+"</option>"}b+="</select>";
-e=s.createElement("div");if(!a.aanFeatures.l)e.id=a.sTableId+"_length";e.className=a.oClasses.sLength;e.innerHTML="<label>"+a.oLanguage.sLengthMenu.replace("_MENU_",b)+"</label>";i('select option[value="'+a._iDisplayLength+'"]',e).attr("selected",true);i("select",e).bind("change.DT",function(){var f=i(this).val(),g=a.aanFeatures.l;c=0;for(d=g.length;c<d;c++)g[c]!=this.parentNode&&i("select",g[c]).val(f);a._iDisplayLength=parseInt(f,10);I(a);if(a.fnDisplayEnd()==a.fnRecordsDisplay()){a._iDisplayStart=
-a.fnDisplayEnd()-a._iDisplayLength;if(a._iDisplayStart<0)a._iDisplayStart=0}if(a._iDisplayLength==-1)a._iDisplayStart=0;H(a)});i("select",e).attr("aria-controls",a.sTableId);return e}function I(a){a._iDisplayEnd=a.oFeatures.bPaginate===false?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength>a.aiDisplay.length||a._iDisplayLength==-1?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength}function Sa(a){if(a.oScroll.bInfinite)return null;var b=s.createElement("div");b.className=a.oClasses.sPaging+
-a.sPaginationType;l.ext.oPagination[a.sPaginationType].fnInit(a,b,function(c){I(c);H(c)});a.aanFeatures.p||a.aoDrawCallback.push({fn:function(c){l.ext.oPagination[c.sPaginationType].fnUpdate(c,function(d){I(d);H(d)})},sName:"pagination"});return b}function Ga(a,b){var c=a._iDisplayStart;if(typeof b==="number"){a._iDisplayStart=b*a._iDisplayLength;if(a._iDisplayStart>a.fnRecordsDisplay())a._iDisplayStart=0}else if(b=="first")a._iDisplayStart=0;else if(b=="previous"){a._iDisplayStart=a._iDisplayLength>=
-0?a._iDisplayStart-a._iDisplayLength:0;if(a._iDisplayStart<0)a._iDisplayStart=0}else if(b=="next")if(a._iDisplayLength>=0){if(a._iDisplayStart+a._iDisplayLength<a.fnRecordsDisplay())a._iDisplayStart+=a._iDisplayLength}else a._iDisplayStart=0;else if(b=="last")if(a._iDisplayLength>=0){b=parseInt((a.fnRecordsDisplay()-1)/a._iDisplayLength,10)+1;a._iDisplayStart=(b-1)*a._iDisplayLength}else a._iDisplayStart=0;else O(a,0,"Unknown paging action: "+b);i(a.oInstance).trigger("page",a);return c!=a._iDisplayStart}
-function Pa(a){var b=s.createElement("div");if(!a.aanFeatures.r)b.id=a.sTableId+"_processing";b.innerHTML=a.oLanguage.sProcessing;b.className=a.oClasses.sProcessing;a.nTable.parentNode.insertBefore(b,a.nTable);return b}function P(a,b){if(a.oFeatures.bProcessing)for(var c=a.aanFeatures.r,d=0,e=c.length;d<e;d++)c[d].style.visibility=b?"visible":"hidden";i(a.oInstance).trigger("processing",[a,b])}function Qa(a){if(a.oScroll.sX===""&&a.oScroll.sY==="")return a.nTable;var b=s.createElement("div"),c=s.createElement("div"),
-d=s.createElement("div"),e=s.createElement("div"),f=s.createElement("div"),g=s.createElement("div"),j=a.nTable.cloneNode(false),k=a.nTable.cloneNode(false),m=a.nTable.getElementsByTagName("thead")[0],u=a.nTable.getElementsByTagName("tfoot").length===0?null:a.nTable.getElementsByTagName("tfoot")[0],x=a.oClasses;c.appendChild(d);f.appendChild(g);e.appendChild(a.nTable);b.appendChild(c);b.appendChild(e);d.appendChild(j);j.appendChild(m);if(u!==null){b.appendChild(f);g.appendChild(k);k.appendChild(u)}b.className=
-x.sScrollWrapper;c.className=x.sScrollHead;d.className=x.sScrollHeadInner;e.className=x.sScrollBody;f.className=x.sScrollFoot;g.className=x.sScrollFootInner;if(a.oScroll.bAutoCss){c.style.overflow="hidden";c.style.position="relative";f.style.overflow="hidden";e.style.overflow="auto"}c.style.border="0";c.style.width="100%";f.style.border="0";d.style.width=a.oScroll.sXInner!==""?a.oScroll.sXInner:"100%";j.removeAttribute("id");j.style.marginLeft="0";a.nTable.style.marginLeft="0";if(u!==null){k.removeAttribute("id");
-k.style.marginLeft="0"}d=i(a.nTable).children("caption");if(d.length>0){d=d[0];if(d._captionSide==="top")j.appendChild(d);else d._captionSide==="bottom"&&u&&k.appendChild(d)}if(a.oScroll.sX!==""){c.style.width=t(a.oScroll.sX);e.style.width=t(a.oScroll.sX);if(u!==null)f.style.width=t(a.oScroll.sX);i(e).scroll(function(){c.scrollLeft=this.scrollLeft;if(u!==null)f.scrollLeft=this.scrollLeft})}if(a.oScroll.sY!=="")e.style.height=t(a.oScroll.sY);a.aoDrawCallback.push({fn:$a,sName:"scrolling"});a.oScroll.bInfinite&&
-i(e).scroll(function(){if(!a.bDrawing&&i(this).scrollTop()!==0)if(i(this).scrollTop()+i(this).height()>i(a.nTable).height()-a.oScroll.iLoadGap)if(a.fnDisplayEnd()<a.fnRecordsDisplay()){Ga(a,"next");I(a);H(a)}});a.nScrollHead=c;a.nScrollFoot=f;return b}function $a(a){var b=a.nScrollHead.getElementsByTagName("div")[0],c=b.getElementsByTagName("table")[0],d=a.nTable.parentNode,e,f,g,j,k,m,u,x,y=[],B=[],T=a.nTFoot!==null?a.nScrollFoot.getElementsByTagName("div")[0]:null,M=a.nTFoot!==null?T.getElementsByTagName("table")[0]:
-null,L=a.oBrowser.bScrollOversize,ja=function(z){u=z.style;u.paddingTop="0";u.paddingBottom="0";u.borderTopWidth="0";u.borderBottomWidth="0";u.height=0};i(a.nTable).children("thead, tfoot").remove();e=i(a.nTHead).clone()[0];a.nTable.insertBefore(e,a.nTable.childNodes[0]);g=a.nTHead.getElementsByTagName("tr");j=e.getElementsByTagName("tr");if(a.nTFoot!==null){k=i(a.nTFoot).clone()[0];a.nTable.insertBefore(k,a.nTable.childNodes[1]);m=a.nTFoot.getElementsByTagName("tr");k=k.getElementsByTagName("tr")}if(a.oScroll.sX===
-""){d.style.width="100%";b.parentNode.style.width="100%"}var U=Z(a,e);e=0;for(f=U.length;e<f;e++){x=v(a,e);U[e].style.width=a.aoColumns[x].sWidth}a.nTFoot!==null&&N(function(z){z.style.width=""},k);if(a.oScroll.bCollapse&&a.oScroll.sY!=="")d.style.height=d.offsetHeight+a.nTHead.offsetHeight+"px";e=i(a.nTable).outerWidth();if(a.oScroll.sX===""){a.nTable.style.width="100%";if(L&&(i("tbody",d).height()>d.offsetHeight||i(d).css("overflow-y")=="scroll"))a.nTable.style.width=t(i(a.nTable).outerWidth()-
-a.oScroll.iBarWidth)}else if(a.oScroll.sXInner!=="")a.nTable.style.width=t(a.oScroll.sXInner);else if(e==i(d).width()&&i(d).height()<i(a.nTable).height()){a.nTable.style.width=t(e-a.oScroll.iBarWidth);if(i(a.nTable).outerWidth()>e-a.oScroll.iBarWidth)a.nTable.style.width=t(e)}else a.nTable.style.width=t(e);e=i(a.nTable).outerWidth();N(ja,j);N(function(z){y.push(t(i(z).width()))},j);N(function(z,Q){z.style.width=y[Q]},g);i(j).height(0);if(a.nTFoot!==null){N(ja,k);N(function(z){B.push(t(i(z).width()))},
-k);N(function(z,Q){z.style.width=B[Q]},m);i(k).height(0)}N(function(z,Q){z.innerHTML="";z.style.width=y[Q]},j);a.nTFoot!==null&&N(function(z,Q){z.innerHTML="";z.style.width=B[Q]},k);if(i(a.nTable).outerWidth()<e){g=d.scrollHeight>d.offsetHeight||i(d).css("overflow-y")=="scroll"?e+a.oScroll.iBarWidth:e;if(L&&(d.scrollHeight>d.offsetHeight||i(d).css("overflow-y")=="scroll"))a.nTable.style.width=t(g-a.oScroll.iBarWidth);d.style.width=t(g);a.nScrollHead.style.width=t(g);if(a.nTFoot!==null)a.nScrollFoot.style.width=
-t(g);if(a.oScroll.sX==="")O(a,1,"The table cannot fit into the current element which will cause column misalignment. The table has been drawn at its minimum possible width.");else a.oScroll.sXInner!==""&&O(a,1,"The table cannot fit into the current element which will cause column misalignment. Increase the sScrollXInner value or remove it to allow automatic calculation")}else{d.style.width=t("100%");a.nScrollHead.style.width=t("100%");if(a.nTFoot!==null)a.nScrollFoot.style.width=t("100%")}if(a.oScroll.sY===
-"")if(L)d.style.height=t(a.nTable.offsetHeight+a.oScroll.iBarWidth);if(a.oScroll.sY!==""&&a.oScroll.bCollapse){d.style.height=t(a.oScroll.sY);L=a.oScroll.sX!==""&&a.nTable.offsetWidth>d.offsetWidth?a.oScroll.iBarWidth:0;if(a.nTable.offsetHeight<d.offsetHeight)d.style.height=t(a.nTable.offsetHeight+L)}L=i(a.nTable).outerWidth();c.style.width=t(L);b.style.width=t(L);c=i(a.nTable).height()>d.clientHeight||i(d).css("overflow-y")=="scroll";b.style.paddingRight=c?a.oScroll.iBarWidth+"px":"0px";if(a.nTFoot!==
-null){M.style.width=t(L);T.style.width=t(L);T.style.paddingRight=c?a.oScroll.iBarWidth+"px":"0px"}i(d).scroll();if(a.bSorted||a.bFiltered)d.scrollTop=0}function N(a,b,c){for(var d=0,e=0,f=b.length,g,j;e<f;){g=b[e].firstChild;for(j=c?c[e].firstChild:null;g;){if(g.nodeType===1){c?a(g,j,d):a(g,d);d++}g=g.nextSibling;j=c?j.nextSibling:null}e++}}function ab(a,b){if(!a||a===null||a==="")return 0;if(!b)b=s.body;var c=s.createElement("div");c.style.width=t(a);b.appendChild(c);a=c.offsetWidth;b.removeChild(c);
-return a}function ta(a){var b=0,c,d=0,e=a.aoColumns.length,f,g,j=i("th",a.nTHead),k=a.nTable.getAttribute("width");g=a.nTable.parentNode;for(f=0;f<e;f++)if(a.aoColumns[f].bVisible){d++;if(a.aoColumns[f].sWidth!==null){c=ab(a.aoColumns[f].sWidthOrig,g);if(c!==null)a.aoColumns[f].sWidth=t(c);b++}}if(e==j.length&&b===0&&d==e&&a.oScroll.sX===""&&a.oScroll.sY==="")for(f=0;f<a.aoColumns.length;f++){c=i(j[f]).width();if(c!==null)a.aoColumns[f].sWidth=t(c)}else{b=a.nTable.cloneNode(false);f=a.nTHead.cloneNode(true);
-d=s.createElement("tbody");c=s.createElement("tr");b.removeAttribute("id");b.appendChild(f);if(a.nTFoot!==null){b.appendChild(a.nTFoot.cloneNode(true));N(function(u){u.style.width=""},b.getElementsByTagName("tr"))}b.appendChild(d);d.appendChild(c);d=i("thead th",b);if(d.length===0)d=i("tbody tr:eq(0)>td",b);j=Z(a,f);for(f=d=0;f<e;f++){var m=a.aoColumns[f];if(m.bVisible&&m.sWidthOrig!==null&&m.sWidthOrig!=="")j[f-d].style.width=t(m.sWidthOrig);else if(m.bVisible)j[f-d].style.width="";else d++}for(f=
-0;f<e;f++)if(a.aoColumns[f].bVisible){d=bb(a,f);if(d!==null){d=d.cloneNode(true);if(a.aoColumns[f].sContentPadding!=="")d.innerHTML+=a.aoColumns[f].sContentPadding;c.appendChild(d)}}g.appendChild(b);if(a.oScroll.sX!==""&&a.oScroll.sXInner!=="")b.style.width=t(a.oScroll.sXInner);else if(a.oScroll.sX!==""){b.style.width="";if(i(b).width()<g.offsetWidth)b.style.width=t(g.offsetWidth)}else if(a.oScroll.sY!=="")b.style.width=t(g.offsetWidth);else if(k)b.style.width=t(k);b.style.visibility="hidden";cb(a,
-b);e=i("tbody tr:eq(0)",b).children();if(e.length===0)e=Z(a,i("thead",b)[0]);if(a.oScroll.sX!==""){for(f=d=g=0;f<a.aoColumns.length;f++)if(a.aoColumns[f].bVisible){g+=a.aoColumns[f].sWidthOrig===null?i(e[d]).outerWidth():parseInt(a.aoColumns[f].sWidth.replace("px",""),10)+(i(e[d]).outerWidth()-i(e[d]).width());d++}b.style.width=t(g);a.nTable.style.width=t(g)}for(f=d=0;f<a.aoColumns.length;f++)if(a.aoColumns[f].bVisible){g=i(e[d]).width();if(g!==null&&g>0)a.aoColumns[f].sWidth=t(g);d++}e=i(b).css("width");
-a.nTable.style.width=e.indexOf("%")!==-1?e:t(i(b).outerWidth());b.parentNode.removeChild(b)}if(k)a.nTable.style.width=t(k)}function cb(a,b){if(a.oScroll.sX===""&&a.oScroll.sY!==""){i(b).width();b.style.width=t(i(b).outerWidth()-a.oScroll.iBarWidth)}else if(a.oScroll.sX!=="")b.style.width=t(i(b).outerWidth())}function bb(a,b){var c=db(a,b);if(c<0)return null;if(a.aoData[c].nTr===null){var d=s.createElement("td");d.innerHTML=F(a,c,b,"");return d}return W(a,c)[b]}function db(a,b){for(var c=-1,d=-1,e=
-0;e<a.aoData.length;e++){var f=F(a,e,b,"display")+"";f=f.replace(/<.*?>/g,"");if(f.length>c){c=f.length;d=e}}return d}function t(a){if(a===null)return"0px";if(typeof a=="number"){if(a<0)return"0px";return a+"px"}var b=a.charCodeAt(a.length-1);if(b<48||b>57)return a;return a+"px"}function eb(){var a=s.createElement("p"),b=a.style;b.width="100%";b.height="200px";b.padding="0px";var c=s.createElement("div");b=c.style;b.position="absolute";b.top="0px";b.left="0px";b.visibility="hidden";b.width="200px";
-b.height="150px";b.padding="0px";b.overflow="hidden";c.appendChild(a);s.body.appendChild(c);b=a.offsetWidth;c.style.overflow="scroll";a=a.offsetWidth;if(b==a)a=c.clientWidth;s.body.removeChild(c);return b-a}function $(a,b){var c,d,e,f,g,j,k=[],m=[],u=l.ext.oSort,x=a.aoData,y=a.aoColumns,B=a.oLanguage.oAria;if(!a.oFeatures.bServerSide&&(a.aaSorting.length!==0||a.aaSortingFixed!==null)){k=a.aaSortingFixed!==null?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(c=0;c<k.length;c++){d=k[c][0];
-e=w(a,d);f=a.aoColumns[d].sSortDataType;if(l.ext.afnSortData[f]){g=l.ext.afnSortData[f].call(a.oInstance,a,d,e);if(g.length===x.length){e=0;for(f=x.length;e<f;e++)S(a,e,d,g[e])}else O(a,0,"Returned data sort array (col "+d+") is the wrong length")}}c=0;for(d=a.aiDisplayMaster.length;c<d;c++)m[a.aiDisplayMaster[c]]=c;var T=k.length,M;c=0;for(d=x.length;c<d;c++)for(e=0;e<T;e++){M=y[k[e][0]].aDataSort;g=0;for(j=M.length;g<j;g++){f=y[M[g]].sType;f=u[(f?f:"string")+"-pre"];x[c]._aSortData[M[g]]=f?f(F(a,
-c,M[g],"sort")):F(a,c,M[g],"sort")}}a.aiDisplayMaster.sort(function(L,ja){var U,z,Q,aa,ka;for(U=0;U<T;U++){ka=y[k[U][0]].aDataSort;z=0;for(Q=ka.length;z<Q;z++){aa=y[ka[z]].sType;aa=u[(aa?aa:"string")+"-"+k[U][1]](x[L]._aSortData[ka[z]],x[ja]._aSortData[ka[z]]);if(aa!==0)return aa}}return u["numeric-asc"](m[L],m[ja])})}if((b===p||b)&&!a.oFeatures.bDeferRender)ba(a);c=0;for(d=a.aoColumns.length;c<d;c++){e=y[c].sTitle.replace(/<.*?>/g,"");b=y[c].nTh;b.removeAttribute("aria-sort");b.removeAttribute("aria-label");
-if(y[c].bSortable)if(k.length>0&&k[0][0]==c){b.setAttribute("aria-sort",k[0][1]=="asc"?"ascending":"descending");b.setAttribute("aria-label",e+((y[c].asSorting[k[0][2]+1]?y[c].asSorting[k[0][2]+1]:y[c].asSorting[0])=="asc"?B.sSortAscending:B.sSortDescending))}else b.setAttribute("aria-label",e+(y[c].asSorting[0]=="asc"?B.sSortAscending:B.sSortDescending));else b.setAttribute("aria-label",e)}a.bSorted=true;i(a.oInstance).trigger("sort",a);if(a.oFeatures.bFilter)X(a,a.oPreviousSearch,1);else{a.aiDisplay=
-a.aiDisplayMaster.slice();a._iDisplayStart=0;I(a);H(a)}}function ya(a,b,c,d){fb(b,{},function(e){if(a.aoColumns[c].bSortable!==false){var f=function(){var g,j;if(e.shiftKey){for(var k=false,m=0;m<a.aaSorting.length;m++)if(a.aaSorting[m][0]==c){k=true;g=a.aaSorting[m][0];j=a.aaSorting[m][2]+1;if(a.aoColumns[g].asSorting[j]){a.aaSorting[m][1]=a.aoColumns[g].asSorting[j];a.aaSorting[m][2]=j}else a.aaSorting.splice(m,1);break}k===false&&a.aaSorting.push([c,a.aoColumns[c].asSorting[0],0])}else if(a.aaSorting.length==
-1&&a.aaSorting[0][0]==c){g=a.aaSorting[0][0];j=a.aaSorting[0][2]+1;a.aoColumns[g].asSorting[j]||(j=0);a.aaSorting[0][1]=a.aoColumns[g].asSorting[j];a.aaSorting[0][2]=j}else{a.aaSorting.splice(0,a.aaSorting.length);a.aaSorting.push([c,a.aoColumns[c].asSorting[0],0])}$(a)};if(a.oFeatures.bProcessing){P(a,true);setTimeout(function(){f();a.oFeatures.bServerSide||P(a,false)},0)}else f();typeof d=="function"&&d(a)}})}function ba(a){var b,c,d,e,f,g=a.aoColumns.length,j=a.oClasses;for(b=0;b<g;b++)a.aoColumns[b].bSortable&&
-i(a.aoColumns[b].nTh).removeClass(j.sSortAsc+" "+j.sSortDesc+" "+a.aoColumns[b].sSortingClass);c=a.aaSortingFixed!==null?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(b=0;b<a.aoColumns.length;b++)if(a.aoColumns[b].bSortable){f=a.aoColumns[b].sSortingClass;e=-1;for(d=0;d<c.length;d++)if(c[d][0]==b){f=c[d][1]=="asc"?j.sSortAsc:j.sSortDesc;e=d;break}i(a.aoColumns[b].nTh).addClass(f);if(a.bJUI){f=i("span."+j.sSortIcon,a.aoColumns[b].nTh);f.removeClass(j.sSortJUIAsc+" "+j.sSortJUIDesc+" "+
-j.sSortJUI+" "+j.sSortJUIAscAllowed+" "+j.sSortJUIDescAllowed);f.addClass(e==-1?a.aoColumns[b].sSortingClassJUI:c[e][1]=="asc"?j.sSortJUIAsc:j.sSortJUIDesc)}}else i(a.aoColumns[b].nTh).addClass(a.aoColumns[b].sSortingClass);f=j.sSortColumn;if(a.oFeatures.bSort&&a.oFeatures.bSortClasses){a=W(a);e=[];for(b=0;b<g;b++)e.push("");b=0;for(d=1;b<c.length;b++){j=parseInt(c[b][0],10);e[j]=f+d;d<3&&d++}f=new RegExp(f+"[123]");var k;b=0;for(c=a.length;b<c;b++){j=b%g;d=a[b].className;k=e[j];j=d.replace(f,k);
-if(j!=d)a[b].className=i.trim(j);else if(k.length>0&&d.indexOf(k)==-1)a[b].className=d+" "+k}}}function Ha(a){if(!(!a.oFeatures.bStateSave||a.bDestroying)){var b,c;b=a.oScroll.bInfinite;var d={iCreate:(new Date).getTime(),iStart:b?0:a._iDisplayStart,iEnd:b?a._iDisplayLength:a._iDisplayEnd,iLength:a._iDisplayLength,aaSorting:i.extend(true,[],a.aaSorting),oSearch:i.extend(true,{},a.oPreviousSearch),aoSearchCols:i.extend(true,[],a.aoPreSearchCols),abVisCols:[]};b=0;for(c=a.aoColumns.length;b<c;b++)d.abVisCols.push(a.aoColumns[b].bVisible);
-K(a,"aoStateSaveParams","stateSaveParams",[a,d]);a.fnStateSave.call(a.oInstance,a,d)}}function gb(a,b){if(a.oFeatures.bStateSave){var c=a.fnStateLoad.call(a.oInstance,a);if(c){var d=K(a,"aoStateLoadParams","stateLoadParams",[a,c]);if(i.inArray(false,d)===-1){a.oLoadedState=i.extend(true,{},c);a._iDisplayStart=c.iStart;a.iInitDisplayStart=c.iStart;a._iDisplayEnd=c.iEnd;a._iDisplayLength=c.iLength;a.aaSorting=c.aaSorting.slice();a.saved_aaSorting=c.aaSorting.slice();i.extend(a.oPreviousSearch,c.oSearch);
-i.extend(true,a.aoPreSearchCols,c.aoSearchCols);b.saved_aoColumns=[];for(d=0;d<c.abVisCols.length;d++){b.saved_aoColumns[d]={};b.saved_aoColumns[d].bVisible=c.abVisCols[d]}K(a,"aoStateLoaded","stateLoaded",[a,c])}}}}function lb(a,b,c,d,e){var f=new Date;f.setTime(f.getTime()+c*1E3);c=la.location.pathname.split("/");a=a+"_"+c.pop().replace(/[\/:]/g,"").toLowerCase();var g;if(e!==null){g=typeof i.parseJSON==="function"?i.parseJSON(b):eval("("+b+")");b=e(a,g,f.toGMTString(),c.join("/")+"/")}else b=a+
-"="+encodeURIComponent(b)+"; expires="+f.toGMTString()+"; path="+c.join("/")+"/";a=s.cookie.split(";");e=b.split(";")[0].length;f=[];if(e+s.cookie.length+10>4096){for(var j=0,k=a.length;j<k;j++)if(a[j].indexOf(d)!=-1){var m=a[j].split("=");try{(g=eval("("+decodeURIComponent(m[1])+")"))&&g.iCreate&&f.push({name:m[0],time:g.iCreate})}catch(u){}}for(f.sort(function(x,y){return y.time-x.time});e+s.cookie.length+10>4096;){if(f.length===0)return;d=f.pop();s.cookie=d.name+"=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path="+
-c.join("/")+"/"}}s.cookie=b}function mb(a){var b=la.location.pathname.split("/");a=a+"_"+b[b.length-1].replace(/[\/:]/g,"").toLowerCase()+"=";b=s.cookie.split(";");for(var c=0;c<b.length;c++){for(var d=b[c];d.charAt(0)==" ";)d=d.substring(1,d.length);if(d.indexOf(a)===0)return decodeURIComponent(d.substring(a.length,d.length))}return null}function C(a){for(var b=0;b<l.settings.length;b++)if(l.settings[b].nTable===a)return l.settings[b];return null}function fa(a){var b=[];a=a.aoData;for(var c=0,d=
-a.length;c<d;c++)a[c].nTr!==null&&b.push(a[c].nTr);return b}function W(a,b){var c=[],d,e,f,g,j;e=0;var k=a.aoData.length;if(b!==p){e=b;k=b+1}for(e=e;e<k;e++){j=a.aoData[e];if(j.nTr!==null){b=[];for(d=j.nTr.firstChild;d;){f=d.nodeName.toLowerCase();if(f=="td"||f=="th")b.push(d);d=d.nextSibling}f=d=0;for(g=a.aoColumns.length;f<g;f++)if(a.aoColumns[f].bVisible)c.push(b[f-d]);else{c.push(j._anHidden[f]);d++}}}return c}function O(a,b,c){a=a===null?"DataTables warning: "+c:"DataTables warning (table id = '"+
-a.sTableId+"'): "+c;if(b===0)if(l.ext.sErrMode=="alert")alert(a);else throw new Error(a);else la.console&&console.log&&console.log(a)}function r(a,b,c,d){if(d===p)d=c;if(b[c]!==p)a[d]=b[c]}function hb(a,b){var c;for(var d in b)if(b.hasOwnProperty(d)){c=b[d];if(typeof h[d]==="object"&&c!==null&&i.isArray(c)===false)i.extend(true,a[d],c);else a[d]=c}return a}function fb(a,b,c){i(a).bind("click.DT",b,function(d){a.blur();c(d)}).bind("keypress.DT",b,function(d){d.which===13&&c(d)}).bind("selectstart.DT",
-function(){return false})}function J(a,b,c,d){c&&a[b].push({fn:c,sName:d})}function K(a,b,c,d){b=a[b];for(var e=[],f=b.length-1;f>=0;f--)e.push(b[f].fn.apply(a.oInstance,d));c!==null&&i(a.oInstance).trigger(c,d);return e}function ib(a){var b=i('<div style="position:absolute; top:0; left:0; height:1px; width:1px; overflow:hidden"><div style="position:absolute; top:1px; left:1px; width:100px; overflow:scroll;"><div id="DT_BrowserTest" style="width:100%; height:10px;"></div></div></div>')[0];s.body.appendChild(b);
-a.oBrowser.bScrollOversize=i("#DT_BrowserTest",b)[0].offsetWidth===100?true:false;s.body.removeChild(b)}function jb(a){return function(){var b=[C(this[l.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return l.ext.oApi[a].apply(this,b)}}var ga=/\[.*?\]$/,kb=la.JSON?JSON.stringify:function(a){var b=typeof a;if(b!=="object"||a===null){if(b==="string")a='"'+a+'"';return a+""}var c,d,e=[],f=i.isArray(a);for(c in a){d=a[c];b=typeof d;if(b==="string")d='"'+d+'"';else if(b==="object"&&d!==
-null)d=kb(d);e.push((f?"":'"'+c+'":')+d)}return(f?"[":"{")+e+(f?"]":"}")};this.$=function(a,b){var c,d=[],e;c=C(this[l.ext.iApiIndex]);var f=c.aoData,g=c.aiDisplay,j=c.aiDisplayMaster;b||(b={});b=i.extend({},{filter:"none",order:"current",page:"all"},b);if(b.page=="current"){b=c._iDisplayStart;for(c=c.fnDisplayEnd();b<c;b++)(e=f[g[b]].nTr)&&d.push(e)}else if(b.order=="current"&&b.filter=="none"){b=0;for(c=j.length;b<c;b++)(e=f[j[b]].nTr)&&d.push(e)}else if(b.order=="current"&&b.filter=="applied"){b=
-0;for(c=g.length;b<c;b++)(e=f[g[b]].nTr)&&d.push(e)}else if(b.order=="original"&&b.filter=="none"){b=0;for(c=f.length;b<c;b++)(e=f[b].nTr)&&d.push(e)}else if(b.order=="original"&&b.filter=="applied"){b=0;for(c=f.length;b<c;b++){e=f[b].nTr;i.inArray(b,g)!==-1&&e&&d.push(e)}}else O(c,1,"Unknown selection options");f=i(d);d=f.filter(a);a=f.find(a);return i([].concat(i.makeArray(d),i.makeArray(a)))};this._=function(a,b){var c=[],d=this.$(a,b);a=0;for(b=d.length;a<b;a++)c.push(this.fnGetData(d[a]));return c};
-this.fnAddData=function(a,b){if(a.length===0)return[];var c=[],d,e=C(this[l.ext.iApiIndex]);if(typeof a[0]==="object"&&a[0]!==null)for(var f=0;f<a.length;f++){d=R(e,a[f]);if(d==-1)return c;c.push(d)}else{d=R(e,a);if(d==-1)return c;c.push(d)}e.aiDisplay=e.aiDisplayMaster.slice();if(b===p||b)qa(e);return c};this.fnAdjustColumnSizing=function(a){var b=C(this[l.ext.iApiIndex]);o(b);if(a===p||a)this.fnDraw(false);else if(b.oScroll.sX!==""||b.oScroll.sY!=="")this.oApi._fnScrollDraw(b)};this.fnClearTable=
-function(a){var b=C(this[l.ext.iApiIndex]);wa(b);if(a===p||a)H(b)};this.fnClose=function(a){for(var b=C(this[l.ext.iApiIndex]),c=0;c<b.aoOpenRows.length;c++)if(b.aoOpenRows[c].nParent==a){(a=b.aoOpenRows[c].nTr.parentNode)&&a.removeChild(b.aoOpenRows[c].nTr);b.aoOpenRows.splice(c,1);return 0}return 1};this.fnDeleteRow=function(a,b,c){var d=C(this[l.ext.iApiIndex]),e,f;a=typeof a==="object"?V(d,a):a;var g=d.aoData.splice(a,1);e=0;for(f=d.aoData.length;e<f;e++)if(d.aoData[e].nTr!==null)d.aoData[e].nTr._DT_RowIndex=
-e;e=i.inArray(a,d.aiDisplay);d.asDataSearch.splice(e,1);xa(d.aiDisplayMaster,a);xa(d.aiDisplay,a);typeof b==="function"&&b.call(this,d,g);if(d._iDisplayStart>=d.fnRecordsDisplay()){d._iDisplayStart-=d._iDisplayLength;if(d._iDisplayStart<0)d._iDisplayStart=0}if(c===p||c){I(d);H(d)}return g};this.fnDestroy=function(a){var b=C(this[l.ext.iApiIndex]),c=b.nTableWrapper.parentNode,d=b.nTBody,e,f;a=a===p?false:a;b.bDestroying=true;K(b,"aoDestroyCallback","destroy",[b]);if(!a){e=0;for(f=b.aoColumns.length;e<
-f;e++)b.aoColumns[e].bVisible===false&&this.fnSetColumnVis(e,true)}i(b.nTableWrapper).find("*").andSelf().unbind(".DT");i("tbody>tr>td."+b.oClasses.sRowEmpty,b.nTable).parent().remove();if(b.nTable!=b.nTHead.parentNode){i(b.nTable).children("thead").remove();b.nTable.appendChild(b.nTHead)}if(b.nTFoot&&b.nTable!=b.nTFoot.parentNode){i(b.nTable).children("tfoot").remove();b.nTable.appendChild(b.nTFoot)}b.nTable.parentNode.removeChild(b.nTable);i(b.nTableWrapper).remove();b.aaSorting=[];b.aaSortingFixed=
-[];ba(b);i(fa(b)).removeClass(b.asStripeClasses.join(" "));i("th, td",b.nTHead).removeClass([b.oClasses.sSortable,b.oClasses.sSortableAsc,b.oClasses.sSortableDesc,b.oClasses.sSortableNone].join(" "));if(b.bJUI){i("th span."+b.oClasses.sSortIcon+", td span."+b.oClasses.sSortIcon,b.nTHead).remove();i("th, td",b.nTHead).each(function(){var g=i("div."+b.oClasses.sSortJUIWrapper,this),j=g.contents();i(this).append(j);g.remove()})}if(!a&&b.nTableReinsertBefore)c.insertBefore(b.nTable,b.nTableReinsertBefore);
-else a||c.appendChild(b.nTable);e=0;for(f=b.aoData.length;e<f;e++)b.aoData[e].nTr!==null&&d.appendChild(b.aoData[e].nTr);if(b.oFeatures.bAutoWidth===true)b.nTable.style.width=t(b.sDestroyWidth);if(f=b.asDestroyStripes.length){a=i(d).children("tr");for(e=0;e<f;e++)a.filter(":nth-child("+f+"n + "+e+")").addClass(b.asDestroyStripes[e])}e=0;for(f=l.settings.length;e<f;e++)l.settings[e]==b&&l.settings.splice(e,1);h=b=null};this.fnDraw=function(a){var b=C(this[l.ext.iApiIndex]);if(a===false){I(b);H(b)}else qa(b)};
-this.fnFilter=function(a,b,c,d,e,f){var g=C(this[l.ext.iApiIndex]);if(g.oFeatures.bFilter){if(c===p||c===null)c=false;if(d===p||d===null)d=true;if(e===p||e===null)e=true;if(f===p||f===null)f=true;if(b===p||b===null){X(g,{sSearch:a+"",bRegex:c,bSmart:d,bCaseInsensitive:f},1);if(e&&g.aanFeatures.f){b=g.aanFeatures.f;c=0;for(d=b.length;c<d;c++)try{b[c]._DT_Input!=s.activeElement&&i(b[c]._DT_Input).val(a)}catch(j){i(b[c]._DT_Input).val(a)}}}else{i.extend(g.aoPreSearchCols[b],{sSearch:a+"",bRegex:c,bSmart:d,
-bCaseInsensitive:f});X(g,g.oPreviousSearch,1)}}};this.fnGetData=function(a,b){var c=C(this[l.ext.iApiIndex]);if(a!==p){var d=a;if(typeof a==="object"){var e=a.nodeName.toLowerCase();if(e==="tr")d=V(c,a);else if(e==="td"){d=V(c,a.parentNode);b=va(c,d,a)}}if(b!==p)return F(c,d,b,"");return c.aoData[d]!==p?c.aoData[d]._aData:null}return oa(c)};this.fnGetNodes=function(a){var b=C(this[l.ext.iApiIndex]);if(a!==p)return b.aoData[a]!==p?b.aoData[a].nTr:null;return fa(b)};this.fnGetPosition=function(a){var b=
-C(this[l.ext.iApiIndex]),c=a.nodeName.toUpperCase();if(c=="TR")return V(b,a);else if(c=="TD"||c=="TH"){c=V(b,a.parentNode);a=va(b,c,a);return[c,w(b,a),a]}return null};this.fnIsOpen=function(a){for(var b=C(this[l.ext.iApiIndex]),c=0;c<b.aoOpenRows.length;c++)if(b.aoOpenRows[c].nParent==a)return true;return false};this.fnOpen=function(a,b,c){var d=C(this[l.ext.iApiIndex]),e=fa(d);if(i.inArray(a,e)!==-1){this.fnClose(a);e=s.createElement("tr");var f=s.createElement("td");e.appendChild(f);f.className=
-c;f.colSpan=D(d);if(typeof b==="string")f.innerHTML=b;else i(f).html(b);b=i("tr",d.nTBody);i.inArray(a,b)!=-1&&i(e).insertAfter(a);d.aoOpenRows.push({nTr:e,nParent:a});return e}};this.fnPageChange=function(a,b){var c=C(this[l.ext.iApiIndex]);Ga(c,a);I(c);if(b===p||b)H(c)};this.fnSetColumnVis=function(a,b,c){var d=C(this[l.ext.iApiIndex]),e,f,g=d.aoColumns,j=d.aoData,k,m;if(g[a].bVisible!=b){if(b){for(e=f=0;e<a;e++)g[e].bVisible&&f++;m=f>=D(d);if(!m)for(e=a;e<g.length;e++)if(g[e].bVisible){k=e;break}e=
-0;for(f=j.length;e<f;e++)if(j[e].nTr!==null)m?j[e].nTr.appendChild(j[e]._anHidden[a]):j[e].nTr.insertBefore(j[e]._anHidden[a],W(d,e)[k])}else{e=0;for(f=j.length;e<f;e++)if(j[e].nTr!==null){k=W(d,e)[a];j[e]._anHidden[a]=k;k.parentNode.removeChild(k)}}g[a].bVisible=b;ia(d,d.aoHeader);d.nTFoot&&ia(d,d.aoFooter);e=0;for(f=d.aoOpenRows.length;e<f;e++)d.aoOpenRows[e].nTr.colSpan=D(d);if(c===p||c){o(d);H(d)}Ha(d)}};this.fnSettings=function(){return C(this[l.ext.iApiIndex])};this.fnSort=function(a){var b=
-C(this[l.ext.iApiIndex]);b.aaSorting=a;$(b)};this.fnSortListener=function(a,b,c){ya(C(this[l.ext.iApiIndex]),a,b,c)};this.fnUpdate=function(a,b,c,d,e){var f=C(this[l.ext.iApiIndex]);b=typeof b==="object"?V(f,b):b;if(i.isArray(a)&&c===p){f.aoData[b]._aData=a.slice();for(c=0;c<f.aoColumns.length;c++)this.fnUpdate(F(f,b,c),b,c,false,false)}else if(i.isPlainObject(a)&&c===p){f.aoData[b]._aData=i.extend(true,{},a);for(c=0;c<f.aoColumns.length;c++)this.fnUpdate(F(f,b,c),b,c,false,false)}else{S(f,b,c,a);
-a=F(f,b,c,"display");var g=f.aoColumns[c];if(g.fnRender!==null){a=da(f,b,c);g.bUseRendered&&S(f,b,c,a)}if(f.aoData[b].nTr!==null)W(f,b)[c].innerHTML=a}c=i.inArray(b,f.aiDisplay);f.asDataSearch[c]=Da(f,na(f,b,"filter",A(f,"bSearchable")));if(e===p||e)o(f);if(d===p||d)qa(f);return 0};this.fnVersionCheck=l.ext.fnVersionCheck;this.oApi={_fnExternApiFunc:jb,_fnInitialise:ra,_fnInitComplete:pa,_fnLanguageCompat:Fa,_fnAddColumn:n,_fnColumnOptions:q,_fnAddData:R,_fnCreateTr:ua,_fnGatherData:ea,_fnBuildHead:Ka,
-_fnDrawHead:ia,_fnDraw:H,_fnReDraw:qa,_fnAjaxUpdate:La,_fnAjaxParameters:Ta,_fnAjaxUpdateDraw:Ua,_fnServerParams:Aa,_fnAddOptionsHtml:Ma,_fnFeatureHtmlTable:Qa,_fnScrollDraw:$a,_fnAdjustColumnSizing:o,_fnFeatureHtmlFilter:Oa,_fnFilterComplete:X,_fnFilterCustom:Xa,_fnFilterColumn:Wa,_fnFilter:Va,_fnBuildSearchArray:Ba,_fnBuildSearchRow:Da,_fnFilterCreateSearch:Ca,_fnDataToSearch:Ya,_fnSort:$,_fnSortAttachListener:ya,_fnSortingClasses:ba,_fnFeatureHtmlPaginate:Sa,_fnPageChange:Ga,_fnFeatureHtmlInfo:Ra,
-_fnUpdateInfo:Za,_fnFeatureHtmlLength:Na,_fnFeatureHtmlProcessing:Pa,_fnProcessingDisplay:P,_fnVisibleToColumnIndex:v,_fnColumnIndexToVisible:w,_fnNodeToDataIndex:V,_fnVisbleColumns:D,_fnCalculateEnd:I,_fnConvertToWidth:ab,_fnCalculateColumnWidths:ta,_fnScrollingWidthAdjust:cb,_fnGetWidestNode:bb,_fnGetMaxLenString:db,_fnStringToCss:t,_fnDetectType:G,_fnSettingsFromNode:C,_fnGetDataMaster:oa,_fnGetTrNodes:fa,_fnGetTdNodes:W,_fnEscapeRegex:Ea,_fnDeleteIndex:xa,_fnReOrderIndex:E,_fnColumnOrdering:Y,
-_fnLog:O,_fnClearTable:wa,_fnSaveState:Ha,_fnLoadState:gb,_fnCreateCookie:lb,_fnReadCookie:mb,_fnDetectHeader:ha,_fnGetUniqueThs:Z,_fnScrollBarWidth:eb,_fnApplyToChildren:N,_fnMap:r,_fnGetRowData:na,_fnGetCellData:F,_fnSetCellData:S,_fnGetObjectDataFn:ca,_fnSetObjectDataFn:Ja,_fnApplyColumnDefs:ma,_fnBindAction:fb,_fnExtend:hb,_fnCallbackReg:J,_fnCallbackFire:K,_fnJsonString:kb,_fnRender:da,_fnNodeToColumnIndex:va,_fnInfoMacros:za,_fnBrowserDetect:ib,_fnGetColumns:A};i.extend(l.ext.oApi,this.oApi);
-for(var Ia in l.ext.oApi)if(Ia)this[Ia]=jb(Ia);var sa=this;this.each(function(){var a=0,b,c,d;c=this.getAttribute("id");var e=false,f=false;if(this.nodeName.toLowerCase()!="table")O(null,0,"Attempted to initialise DataTables on a node which is not a table: "+this.nodeName);else{a=0;for(b=l.settings.length;a<b;a++){if(l.settings[a].nTable==this)if(h===p||h.bRetrieve)return l.settings[a].oInstance;else if(h.bDestroy){l.settings[a].oInstance.fnDestroy();break}else{O(l.settings[a],0,"Cannot reinitialise DataTable.\n\nTo retrieve the DataTables object for this table, pass no arguments or see the docs for bRetrieve and bDestroy");
-return}if(l.settings[a].sTableId==this.id){l.settings.splice(a,1);break}}if(c===null||c==="")this.id=c="DataTables_Table_"+l.ext._oExternConfig.iNextUnique++;var g=i.extend(true,{},l.models.oSettings,{nTable:this,oApi:sa.oApi,oInit:h,sDestroyWidth:i(this).width(),sInstance:c,sTableId:c});l.settings.push(g);g.oInstance=sa.length===1?sa:i(this).dataTable();h||(h={});h.oLanguage&&Fa(h.oLanguage);h=hb(i.extend(true,{},l.defaults),h);r(g.oFeatures,h,"bPaginate");r(g.oFeatures,h,"bLengthChange");r(g.oFeatures,
-h,"bFilter");r(g.oFeatures,h,"bSort");r(g.oFeatures,h,"bInfo");r(g.oFeatures,h,"bProcessing");r(g.oFeatures,h,"bAutoWidth");r(g.oFeatures,h,"bSortClasses");r(g.oFeatures,h,"bServerSide");r(g.oFeatures,h,"bDeferRender");r(g.oScroll,h,"sScrollX","sX");r(g.oScroll,h,"sScrollXInner","sXInner");r(g.oScroll,h,"sScrollY","sY");r(g.oScroll,h,"bScrollCollapse","bCollapse");r(g.oScroll,h,"bScrollInfinite","bInfinite");r(g.oScroll,h,"iScrollLoadGap","iLoadGap");r(g.oScroll,h,"bScrollAutoCss","bAutoCss");r(g,
-h,"asStripeClasses");r(g,h,"asStripClasses","asStripeClasses");r(g,h,"fnServerData");r(g,h,"fnFormatNumber");r(g,h,"sServerMethod");r(g,h,"aaSorting");r(g,h,"aaSortingFixed");r(g,h,"aLengthMenu");r(g,h,"sPaginationType");r(g,h,"sAjaxSource");r(g,h,"sAjaxDataProp");r(g,h,"iCookieDuration");r(g,h,"sCookiePrefix");r(g,h,"sDom");r(g,h,"bSortCellsTop");r(g,h,"iTabIndex");r(g,h,"oSearch","oPreviousSearch");r(g,h,"aoSearchCols","aoPreSearchCols");r(g,h,"iDisplayLength","_iDisplayLength");r(g,h,"bJQueryUI",
-"bJUI");r(g,h,"fnCookieCallback");r(g,h,"fnStateLoad");r(g,h,"fnStateSave");r(g.oLanguage,h,"fnInfoCallback");J(g,"aoDrawCallback",h.fnDrawCallback,"user");J(g,"aoServerParams",h.fnServerParams,"user");J(g,"aoStateSaveParams",h.fnStateSaveParams,"user");J(g,"aoStateLoadParams",h.fnStateLoadParams,"user");J(g,"aoStateLoaded",h.fnStateLoaded,"user");J(g,"aoRowCallback",h.fnRowCallback,"user");J(g,"aoRowCreatedCallback",h.fnCreatedRow,"user");J(g,"aoHeaderCallback",h.fnHeaderCallback,"user");J(g,"aoFooterCallback",
-h.fnFooterCallback,"user");J(g,"aoInitComplete",h.fnInitComplete,"user");J(g,"aoPreDrawCallback",h.fnPreDrawCallback,"user");if(g.oFeatures.bServerSide&&g.oFeatures.bSort&&g.oFeatures.bSortClasses)J(g,"aoDrawCallback",ba,"server_side_sort_classes");else g.oFeatures.bDeferRender&&J(g,"aoDrawCallback",ba,"defer_sort_classes");if(h.bJQueryUI){i.extend(g.oClasses,l.ext.oJUIClasses);if(h.sDom===l.defaults.sDom&&l.defaults.sDom==="lfrtip")g.sDom='<"H"lfr>t<"F"ip>'}else i.extend(g.oClasses,l.ext.oStdClasses);
-i(this).addClass(g.oClasses.sTable);if(g.oScroll.sX!==""||g.oScroll.sY!=="")g.oScroll.iBarWidth=eb();if(g.iInitDisplayStart===p){g.iInitDisplayStart=h.iDisplayStart;g._iDisplayStart=h.iDisplayStart}if(h.bStateSave){g.oFeatures.bStateSave=true;gb(g,h);J(g,"aoDrawCallback",Ha,"state_save")}if(h.iDeferLoading!==null){g.bDeferLoading=true;a=i.isArray(h.iDeferLoading);g._iRecordsDisplay=a?h.iDeferLoading[0]:h.iDeferLoading;g._iRecordsTotal=a?h.iDeferLoading[1]:h.iDeferLoading}if(h.aaData!==null)f=true;
-if(h.oLanguage.sUrl!==""){g.oLanguage.sUrl=h.oLanguage.sUrl;i.getJSON(g.oLanguage.sUrl,null,function(k){Fa(k);i.extend(true,g.oLanguage,h.oLanguage,k);ra(g)});e=true}else i.extend(true,g.oLanguage,h.oLanguage);if(h.asStripeClasses===null)g.asStripeClasses=[g.oClasses.sStripeOdd,g.oClasses.sStripeEven];b=g.asStripeClasses.length;g.asDestroyStripes=[];if(b){c=false;d=i(this).children("tbody").children("tr:lt("+b+")");for(a=0;a<b;a++)if(d.hasClass(g.asStripeClasses[a])){c=true;g.asDestroyStripes.push(g.asStripeClasses[a])}c&&
-d.removeClass(g.asStripeClasses.join(" "))}c=[];a=this.getElementsByTagName("thead");if(a.length!==0){ha(g.aoHeader,a[0]);c=Z(g)}if(h.aoColumns===null){d=[];a=0;for(b=c.length;a<b;a++)d.push(null)}else d=h.aoColumns;a=0;for(b=d.length;a<b;a++){if(h.saved_aoColumns!==p&&h.saved_aoColumns.length==b){if(d[a]===null)d[a]={};d[a].bVisible=h.saved_aoColumns[a].bVisible}n(g,c?c[a]:null)}ma(g,h.aoColumnDefs,d,function(k,m){q(g,k,m)});a=0;for(b=g.aaSorting.length;a<b;a++){if(g.aaSorting[a][0]>=g.aoColumns.length)g.aaSorting[a][0]=
-0;var j=g.aoColumns[g.aaSorting[a][0]];if(g.aaSorting[a][2]===p)g.aaSorting[a][2]=0;if(h.aaSorting===p&&g.saved_aaSorting===p)g.aaSorting[a][1]=j.asSorting[0];c=0;for(d=j.asSorting.length;c<d;c++)if(g.aaSorting[a][1]==j.asSorting[c]){g.aaSorting[a][2]=c;break}}ba(g);ib(g);a=i(this).children("caption").each(function(){this._captionSide=i(this).css("caption-side")});b=i(this).children("thead");if(b.length===0){b=[s.createElement("thead")];this.appendChild(b[0])}g.nTHead=b[0];b=i(this).children("tbody");
-if(b.length===0){b=[s.createElement("tbody")];this.appendChild(b[0])}g.nTBody=b[0];g.nTBody.setAttribute("role","alert");g.nTBody.setAttribute("aria-live","polite");g.nTBody.setAttribute("aria-relevant","all");b=i(this).children("tfoot");if(b.length===0&&a.length>0&&(g.oScroll.sX!==""||g.oScroll.sY!=="")){b=[s.createElement("tfoot")];this.appendChild(b[0])}if(b.length>0){g.nTFoot=b[0];ha(g.aoFooter,g.nTFoot)}if(f)for(a=0;a<h.aaData.length;a++)R(g,h.aaData[a]);else ea(g);g.aiDisplay=g.aiDisplayMaster.slice();
-g.bInitialised=true;e===false&&ra(g)}});sa=null;return this};l.fnVersionCheck=function(h){var n=function(A,G){for(;A.length<G;)A+="0";return A},q=l.ext.sVersion.split(".");h=h.split(".");for(var o="",v="",w=0,D=h.length;w<D;w++){o+=n(q[w],3);v+=n(h[w],3)}return parseInt(o,10)>=parseInt(v,10)};l.fnIsDataTable=function(h){for(var n=l.settings,q=0;q<n.length;q++)if(n[q].nTable===h||n[q].nScrollHead===h||n[q].nScrollFoot===h)return true;return false};l.fnTables=function(h){var n=[];jQuery.each(l.settings,
-function(q,o){if(!h||h===true&&i(o.nTable).is(":visible"))n.push(o.nTable)});return n};l.version="1.9.4";l.settings=[];l.models={};l.models.ext={afnFiltering:[],afnSortData:[],aoFeatures:[],aTypes:[],fnVersionCheck:l.fnVersionCheck,iApiIndex:0,ofnSearch:{},oApi:{},oStdClasses:{},oJUIClasses:{},oPagination:{},oSort:{},sVersion:l.version,sErrMode:"alert",_oExternConfig:{iNextUnique:0}};l.models.oSearch={bCaseInsensitive:true,sSearch:"",bRegex:false,bSmart:true};l.models.oRow={nTr:null,_aData:[],_aSortData:[],
-_anHidden:[],_sRowStripe:""};l.models.oColumn={aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bUseRendered:null,bVisible:null,_bAutoType:true,fnCreatedCell:null,fnGetData:null,fnRender:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,sWidthOrig:null};l.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:null,
-aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:true,bDeferRender:false,bDestroy:false,bFilter:true,bInfo:true,bJQueryUI:false,bLengthChange:true,bPaginate:true,bProcessing:false,bRetrieve:false,bScrollAutoCss:true,bScrollCollapse:false,bScrollInfinite:false,bServerSide:false,bSort:true,bSortCellsTop:false,bSortClasses:true,bStateSave:false,fnCookieCallback:null,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(h){if(h<
-1E3)return h;var n=h+"";h=n.split("");var q="";n=n.length;for(var o=0;o<n;o++){if(o%3===0&&o!==0)q=this.oLanguage.sInfoThousands+q;q=h[n-o-1]+q}return q},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:function(h,n,q,o){o.jqXHR=i.ajax({url:h,data:n,success:function(v){v.sError&&o.oApi._fnLog(o,0,v.sError);i(o.oInstance).trigger("xhr",[o,v]);q(v)},dataType:"json",cache:false,type:o.sServerMethod,error:function(v,w){w=="parsererror"&&
-o.oApi._fnLog(o,0,"DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.")}})},fnServerParams:null,fnStateLoad:function(h){h=this.oApi._fnReadCookie(h.sCookiePrefix+h.sInstance);var n;try{n=typeof i.parseJSON==="function"?i.parseJSON(h):eval("("+h+")")}catch(q){n=null}return n},fnStateLoadParams:null,fnStateLoaded:null,fnStateSave:function(h,n){this.oApi._fnCreateCookie(h.sCookiePrefix+h.sInstance,this.oApi._fnJsonString(n),h.iCookieDuration,h.sCookiePrefix,
-h.fnCookieCallback)},fnStateSaveParams:null,iCookieDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iScrollLoadGap:100,iTabIndex:0,oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",
-sInfoPostFix:"",sInfoThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sUrl:"",sZeroRecords:"No matching records found"},oSearch:i.extend({},l.models.oSearch),sAjaxDataProp:"aaData",sAjaxSource:null,sCookiePrefix:"SpryMedia_DataTables_",sDom:"lfrtip",sPaginationType:"two_button",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET"};l.defaults.columns={aDataSort:null,asSorting:["asc","desc"],bSearchable:true,bSortable:true,
-bUseRendered:true,bVisible:true,fnCreatedCell:null,fnRender:null,iDataSort:-1,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};l.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortClasses:null,bStateSave:null},oScroll:{bAutoCss:null,bCollapse:null,bInfinite:null,iBarWidth:0,iLoadGap:null,
-sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:false},aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aoColumns:[],aoHeader:[],aoFooter:[],asDataSearch:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:null,asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],
-aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:false,bInitialised:false,aoOpenRows:[],sDom:null,sPaginationType:"two_button",iCookieDuration:0,sCookiePrefix:"",fnCookieCallback:null,aoStateSave:[],aoStateLoad:[],oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:true,jqXHR:null,fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:false,iDrawError:-1,_iDisplayLength:10,
-_iDisplayStart:0,_iDisplayEnd:10,_iRecordsTotal:0,_iRecordsDisplay:0,bJUI:null,oClasses:{},bFiltered:false,bSorted:false,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsTotal,10):this.aiDisplayMaster.length},fnRecordsDisplay:function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsDisplay,10):this.aiDisplay.length},fnDisplayEnd:function(){return this.oFeatures.bServerSide?this.oFeatures.bPaginate===false||
-this._iDisplayLength==-1?this._iDisplayStart+this.aiDisplay.length:Math.min(this._iDisplayStart+this._iDisplayLength,this._iRecordsDisplay):this._iDisplayEnd},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null};l.ext=i.extend(true,{},l.models.ext);i.extend(l.ext.oStdClasses,{sTable:"dataTable",sPagePrevEnabled:"paginate_enabled_previous",sPagePrevDisabled:"paginate_disabled_previous",sPageNextEnabled:"paginate_enabled_next",sPageNextDisabled:"paginate_disabled_next",sPageJUINext:"",
-sPageJUIPrev:"",sPageButton:"paginate_button",sPageButtonActive:"paginate_active",sPageButtonStaticDisabled:"paginate_button paginate_button_disabled",sPageFirst:"first",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",
-sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",
-sFooterTH:"",sJUIHeader:"",sJUIFooter:""});i.extend(l.ext.oJUIClasses,l.ext.oStdClasses,{sPagePrevEnabled:"fg-button ui-button ui-state-default ui-corner-left",sPagePrevDisabled:"fg-button ui-button ui-state-default ui-corner-left ui-state-disabled",sPageNextEnabled:"fg-button ui-button ui-state-default ui-corner-right",sPageNextDisabled:"fg-button ui-button ui-state-default ui-corner-right ui-state-disabled",sPageJUINext:"ui-icon ui-icon-circle-arrow-e",sPageJUIPrev:"ui-icon ui-icon-circle-arrow-w",
-sPageButton:"fg-button ui-button ui-state-default",sPageButtonActive:"fg-button ui-button ui-state-default ui-state-disabled",sPageButtonStaticDisabled:"fg-button ui-button ui-state-default ui-state-disabled",sPageFirst:"first ui-corner-tl ui-corner-bl",sPageLast:"last ui-corner-tr ui-corner-br",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sSortAsc:"ui-state-default",sSortDesc:"ui-state-default",sSortable:"ui-state-default",sSortableAsc:"ui-state-default",
-sSortableDesc:"ui-state-default",sSortableNone:"ui-state-default",sSortJUIAsc:"css_right ui-icon ui-icon-triangle-1-n",sSortJUIDesc:"css_right ui-icon ui-icon-triangle-1-s",sSortJUI:"css_right ui-icon ui-icon-carat-2-n-s",sSortJUIAscAllowed:"css_right ui-icon ui-icon-carat-1-n",sSortJUIDescAllowed:"css_right ui-icon ui-icon-carat-1-s",sSortJUIWrapper:"DataTables_sort_wrapper",sSortIcon:"DataTables_sort_icon",sScrollHead:"dataTables_scrollHead ui-state-default",sScrollFoot:"dataTables_scrollFoot ui-state-default",
-sFooterTH:"ui-state-default",sJUIHeader:"fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix",sJUIFooter:"fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"});i.extend(l.ext.oPagination,{two_button:{fnInit:function(h,n,q){var o=h.oLanguage.oPaginate,v=function(D){h.oApi._fnPageChange(h,D.data.action)&&q(h)};o=!h.bJUI?'<a class="'+h.oClasses.sPagePrevDisabled+'" tabindex="'+h.iTabIndex+'" role="button">'+o.sPrevious+'</a><a class="'+
-h.oClasses.sPageNextDisabled+'" tabindex="'+h.iTabIndex+'" role="button">'+o.sNext+"</a>":'<a class="'+h.oClasses.sPagePrevDisabled+'" tabindex="'+h.iTabIndex+'" role="button"><span class="'+h.oClasses.sPageJUIPrev+'"></span></a><a class="'+h.oClasses.sPageNextDisabled+'" tabindex="'+h.iTabIndex+'" role="button"><span class="'+h.oClasses.sPageJUINext+'"></span></a>';i(n).append(o);var w=i("a",n);o=w[0];w=w[1];h.oApi._fnBindAction(o,{action:"previous"},v);h.oApi._fnBindAction(w,{action:"next"},v);
-if(!h.aanFeatures.p){n.id=h.sTableId+"_paginate";o.id=h.sTableId+"_previous";w.id=h.sTableId+"_next";o.setAttribute("aria-controls",h.sTableId);w.setAttribute("aria-controls",h.sTableId)}},fnUpdate:function(h){if(h.aanFeatures.p)for(var n=h.oClasses,q=h.aanFeatures.p,o,v=0,w=q.length;v<w;v++)if(o=q[v].firstChild){o.className=h._iDisplayStart===0?n.sPagePrevDisabled:n.sPagePrevEnabled;o=o.nextSibling;o.className=h.fnDisplayEnd()==h.fnRecordsDisplay()?n.sPageNextDisabled:n.sPageNextEnabled}}},iFullNumbersShowPages:5,
-full_numbers:{fnInit:function(h,n,q){var o=h.oLanguage.oPaginate,v=h.oClasses,w=function(G){h.oApi._fnPageChange(h,G.data.action)&&q(h)};i(n).append('<a  tabindex="'+h.iTabIndex+'" class="'+v.sPageButton+" "+v.sPageFirst+'">'+o.sFirst+'</a><a  tabindex="'+h.iTabIndex+'" class="'+v.sPageButton+" "+v.sPagePrevious+'">'+o.sPrevious+'</a><span></span><a tabindex="'+h.iTabIndex+'" class="'+v.sPageButton+" "+v.sPageNext+'">'+o.sNext+'</a><a tabindex="'+h.iTabIndex+'" class="'+v.sPageButton+" "+v.sPageLast+
-'">'+o.sLast+"</a>");var D=i("a",n);o=D[0];v=D[1];var A=D[2];D=D[3];h.oApi._fnBindAction(o,{action:"first"},w);h.oApi._fnBindAction(v,{action:"previous"},w);h.oApi._fnBindAction(A,{action:"next"},w);h.oApi._fnBindAction(D,{action:"last"},w);if(!h.aanFeatures.p){n.id=h.sTableId+"_paginate";o.id=h.sTableId+"_first";v.id=h.sTableId+"_previous";A.id=h.sTableId+"_next";D.id=h.sTableId+"_last"}},fnUpdate:function(h,n){if(h.aanFeatures.p){var q=l.ext.oPagination.iFullNumbersShowPages,o=Math.floor(q/2),v=
-Math.ceil(h.fnRecordsDisplay()/h._iDisplayLength),w=Math.ceil(h._iDisplayStart/h._iDisplayLength)+1,D="",A,G=h.oClasses,E,Y=h.aanFeatures.p,ma=function(R){h.oApi._fnBindAction(this,{page:R+A-1},function(ea){h.oApi._fnPageChange(h,ea.data.page);n(h);ea.preventDefault()})};if(h._iDisplayLength===-1)w=o=A=1;else if(v<q){A=1;o=v}else if(w<=o){A=1;o=q}else if(w>=v-o){A=v-q+1;o=v}else{A=w-Math.ceil(q/2)+1;o=A+q-1}for(q=A;q<=o;q++)D+=w!==q?'<a tabindex="'+h.iTabIndex+'" class="'+G.sPageButton+'">'+h.fnFormatNumber(q)+
-"</a>":'<a tabindex="'+h.iTabIndex+'" class="'+G.sPageButtonActive+'">'+h.fnFormatNumber(q)+"</a>";q=0;for(o=Y.length;q<o;q++){E=Y[q];if(E.hasChildNodes()){i("span:eq(0)",E).html(D).children("a").each(ma);E=E.getElementsByTagName("a");E=[E[0],E[1],E[E.length-2],E[E.length-1]];i(E).removeClass(G.sPageButton+" "+G.sPageButtonActive+" "+G.sPageButtonStaticDisabled);i([E[0],E[1]]).addClass(w==1?G.sPageButtonStaticDisabled:G.sPageButton);i([E[2],E[3]]).addClass(v===0||w===v||h._iDisplayLength===-1?G.sPageButtonStaticDisabled:
-G.sPageButton)}}}}}});i.extend(l.ext.oSort,{"string-pre":function(h){if(typeof h!="string")h=h!==null&&h.toString?h.toString():"";return h.toLowerCase()},"string-asc":function(h,n){return h<n?-1:h>n?1:0},"string-desc":function(h,n){return h<n?1:h>n?-1:0},"html-pre":function(h){return h.replace(/<.*?>/g,"").toLowerCase()},"html-asc":function(h,n){return h<n?-1:h>n?1:0},"html-desc":function(h,n){return h<n?1:h>n?-1:0},"date-pre":function(h){h=Date.parse(h);if(isNaN(h)||h==="")h=Date.parse("01/01/1970 00:00:00");
-return h},"date-asc":function(h,n){return h-n},"date-desc":function(h,n){return n-h},"numeric-pre":function(h){return h=="-"||h===""?0:h*1},"numeric-asc":function(h,n){return h-n},"numeric-desc":function(h,n){return n-h}});i.extend(l.ext.aTypes,[function(h){if(typeof h==="number")return"numeric";else if(typeof h!=="string")return null;var n,q=false;n=h.charAt(0);if("0123456789-".indexOf(n)==-1)return null;for(var o=1;o<h.length;o++){n=h.charAt(o);if("0123456789.".indexOf(n)==-1)return null;if(n==
-"."){if(q)return null;q=true}}return"numeric"},function(h){var n=Date.parse(h);if(n!==null&&!isNaN(n)||typeof h==="string"&&h.length===0)return"date";return null},function(h){if(typeof h==="string"&&h.indexOf("<")!=-1&&h.indexOf(">")!=-1)return"html";return null}]);i.fn.DataTable=l;i.fn.dataTable=l;i.fn.dataTableSettings=l.settings;i.fn.dataTableExt=l.ext})})(window,document);


[05/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_flat_0_aaaaaa_40x100.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_flat_0_aaaaaa_40x100.png b/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_flat_0_aaaaaa_40x100.png
deleted file mode 100644
index 5b5dab2..0000000
Binary files a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_flat_0_aaaaaa_40x100.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_flat_75_ffffff_40x100.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_flat_75_ffffff_40x100.png b/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_flat_75_ffffff_40x100.png
deleted file mode 100644
index ac8b229..0000000
Binary files a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_flat_75_ffffff_40x100.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_55_fbf9ee_1x400.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_55_fbf9ee_1x400.png b/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_55_fbf9ee_1x400.png
deleted file mode 100644
index ad3d634..0000000
Binary files a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_55_fbf9ee_1x400.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_65_ffffff_1x400.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_65_ffffff_1x400.png b/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_65_ffffff_1x400.png
deleted file mode 100644
index 42ccba2..0000000
Binary files a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_65_ffffff_1x400.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_75_dadada_1x400.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_75_dadada_1x400.png b/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_75_dadada_1x400.png
deleted file mode 100644
index 5a46b47..0000000
Binary files a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_75_dadada_1x400.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_75_e6e6e6_1x400.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_75_e6e6e6_1x400.png b/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_75_e6e6e6_1x400.png
deleted file mode 100644
index 86c2baa..0000000
Binary files a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_75_e6e6e6_1x400.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_95_fef1ec_1x400.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_95_fef1ec_1x400.png b/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_95_fef1ec_1x400.png
deleted file mode 100644
index 4443fdc..0000000
Binary files a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_glass_95_fef1ec_1x400.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png
deleted file mode 100644
index 7c9fa6c..0000000
Binary files a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_222222_256x240.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_222222_256x240.png b/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_222222_256x240.png
deleted file mode 100644
index ee039dc..0000000
Binary files a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_222222_256x240.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_2e83ff_256x240.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_2e83ff_256x240.png b/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_2e83ff_256x240.png
deleted file mode 100644
index 45e8928..0000000
Binary files a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_2e83ff_256x240.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_454545_256x240.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_454545_256x240.png b/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_454545_256x240.png
deleted file mode 100644
index 7ec70d1..0000000
Binary files a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_454545_256x240.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_888888_256x240.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_888888_256x240.png b/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_888888_256x240.png
deleted file mode 100644
index 5ba708c..0000000
Binary files a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_888888_256x240.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_cd0a0a_256x240.png
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_cd0a0a_256x240.png b/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_cd0a0a_256x240.png
deleted file mode 100644
index 7930a55..0000000
Binary files a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/images/ui-icons_cd0a0a_256x240.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/jquery-ui.css
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/jquery-ui.css b/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/jquery-ui.css
deleted file mode 100644
index 02b242e..0000000
--- a/slider-core/src/main/resources/webapps/static/jquery/themes-1.9.1/base/jquery-ui.css
+++ /dev/null
@@ -1,473 +0,0 @@
-/*! jQuery UI - v1.9.1 - 2012-10-25
-* http://jqueryui.com
-* Includes: jquery.ui.core.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css, jquery.ui.theme.css
-* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
-
-/* Layout helpers
-----------------------------------*/
-.ui-helper-hidden { display: none; }
-.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
-.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
-.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
-.ui-helper-clearfix:after { clear: both; }
-.ui-helper-clearfix { zoom: 1; }
-.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
-
-
-/* Interaction Cues
-----------------------------------*/
-.ui-state-disabled { cursor: default !important; }
-
-
-/* Icons
-----------------------------------*/
-
-/* states and images */
-.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
-
-
-/* Misc visuals
-----------------------------------*/
-
-/* Overlays */
-.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
-
-.ui-accordion .ui-accordion-header { display: block; cursor: pointer; position: relative; margin-top: 2px; padding: .5em .5em .5em .7em; zoom: 1; }
-.ui-accordion .ui-accordion-icons { padding-left: 2.2em; }
-.ui-accordion .ui-accordion-noicons { padding-left: .7em; }
-.ui-accordion .ui-accordion-icons .ui-accordion-icons { padding-left: 2.2em; }
-.ui-accordion .ui-accordion-header .ui-accordion-header-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
-.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; overflow: auto; zoom: 1; }
-
-.ui-autocomplete {
-	position: absolute;
-	top: 0; /* #8656 */
-	cursor: default;
-}
-
-/* workarounds */
-* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
-
-.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
-.ui-button, .ui-button:link, .ui-button:visited, .ui-button:hover, .ui-button:active { text-decoration: none; }
-.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
-button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
-.ui-button-icons-only { width: 3.4em; } 
-button.ui-button-icons-only { width: 3.7em; } 
-
-/*button text element */
-.ui-button .ui-button-text { display: block; line-height: 1.4;  }
-.ui-button-text-only .ui-button-text { padding: .4em 1em; }
-.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
-.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
-.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
-.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
-/* no icon support for input elements, provide padding by default */
-input.ui-button { padding: .4em 1em; }
-
-/*button icon element(s) */
-.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
-.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
-.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
-.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
-.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
-
-/*button sets*/
-.ui-buttonset { margin-right: 7px; }
-.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
-
-/* workarounds */
-button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
-
-.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
-.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
-.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
-.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
-.ui-datepicker .ui-datepicker-prev { left:2px; }
-.ui-datepicker .ui-datepicker-next { right:2px; }
-.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
-.ui-datepicker .ui-datepicker-next-hover { right:1px; }
-.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px;  }
-.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
-.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
-.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
-.ui-datepicker select.ui-datepicker-month, 
-.ui-datepicker select.ui-datepicker-year { width: 49%;}
-.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
-.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0;  }
-.ui-datepicker td { border: 0; padding: 1px; }
-.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
-.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
-.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
-.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
-
-/* with multiple calendars */
-.ui-datepicker.ui-datepicker-multi { width:auto; }
-.ui-datepicker-multi .ui-datepicker-group { float:left; }
-.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
-.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
-.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
-.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
-.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
-.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
-.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
-.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
-
-/* RTL support */
-.ui-datepicker-rtl { direction: rtl; }
-.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
-.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
-.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
-.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
-.ui-datepicker-rtl .ui-datepicker-group { float:right; }
-.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
-.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
-
-/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
-.ui-datepicker-cover {
-    position: absolute; /*must have*/
-    z-index: -1; /*must have*/
-    filter: mask(); /*must have*/
-    top: -4px; /*must have*/
-    left: -4px; /*must have*/
-    width: 200px; /*must have*/
-    height: 200px; /*must have*/
-}
-.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
-.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative;  }
-.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
-.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
-.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
-.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
-.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
-.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
-.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
-.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
-.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
-.ui-draggable .ui-dialog-titlebar { cursor: move; }
-
-.ui-menu { list-style:none; padding: 2px; margin: 0; display:block; outline: none; }
-.ui-menu .ui-menu { margin-top: -3px; position: absolute; }
-.ui-menu .ui-menu-item { margin: 0; padding: 0; zoom: 1; width: 100%; }
-.ui-menu .ui-menu-divider { margin: 5px -2px 5px -2px; height: 0; font-size: 0; line-height: 0; border-width: 1px 0 0 0; }
-.ui-menu .ui-menu-item a { text-decoration: none; display: block; padding: 2px .4em; line-height: 1.5; zoom: 1; font-weight: normal; }
-.ui-menu .ui-menu-item a.ui-state-focus,
-.ui-menu .ui-menu-item a.ui-state-active { font-weight: normal; margin: -1px; }
-
-.ui-menu .ui-state-disabled { font-weight: normal; margin: .4em 0 .2em; line-height: 1.5; }
-.ui-menu .ui-state-disabled a { cursor: default; }
-
-/* icon support */
-.ui-menu-icons { position: relative; }
-.ui-menu-icons .ui-menu-item a { position: relative; padding-left: 2em; }
-
-/* left-aligned */
-.ui-menu .ui-icon { position: absolute; top: .2em; left: .2em; }
-
-/* right-aligned */
-.ui-menu .ui-menu-icon { position: static; float: right; }
-
-.ui-progressbar { height:2em; text-align: left; overflow: hidden; }
-.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
-.ui-resizable { position: relative;}
-.ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; }
-.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
-.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
-.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
-.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
-.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
-.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
-.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
-.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
-.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}
-.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
-
-.ui-slider { position: relative; text-align: left; }
-.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
-.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
-
-.ui-slider-horizontal { height: .8em; }
-.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
-.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
-.ui-slider-horizontal .ui-slider-range-min { left: 0; }
-.ui-slider-horizontal .ui-slider-range-max { right: 0; }
-
-.ui-slider-vertical { width: .8em; height: 100px; }
-.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
-.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
-.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
-.ui-slider-vertical .ui-slider-range-max { top: 0; }
-.ui-spinner { position:relative; display: inline-block; overflow: hidden; padding: 0; vertical-align: middle; }
-.ui-spinner-input { border: none; background: none; padding: 0; margin: .2em 0; vertical-align: middle; margin-left: .4em; margin-right: 22px; }
-.ui-spinner-button { width: 16px; height: 50%; font-size: .5em; padding: 0; margin: 0; text-align: center; position: absolute; cursor: default; display: block; overflow: hidden; right: 0; }
-.ui-spinner a.ui-spinner-button { border-top: none; border-bottom: none; border-right: none; } /* more specificity required here to overide default borders */
-.ui-spinner .ui-icon { position: absolute; margin-top: -8px; top: 50%; left: 0; } /* vertical centre icon */
-.ui-spinner-up { top: 0; }
-.ui-spinner-down { bottom: 0; }
-
-/* TR overrides */
-.ui-spinner .ui-icon-triangle-1-s {
-	/* need to fix icons sprite */
-	background-position:-65px -16px;
-}
-
-.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
-.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
-.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 0; margin: 1px .2em 0 0; border-bottom: 0; padding: 0; white-space: nowrap; }
-.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
-.ui-tabs .ui-tabs-nav li.ui-tabs-active { margin-bottom: -1px; padding-bottom: 1px; }
-.ui-tabs .ui-tabs-nav li.ui-tabs-active a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-tabs-loading a { cursor: text; }
-.ui-tabs .ui-tabs-nav li a, .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
-.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
-
-.ui-tooltip {
-	padding: 8px;
-	position: absolute;
-	z-index: 9999;
-	max-width: 300px;
-	-webkit-box-shadow: 0 0 5px #aaa;
-	box-shadow: 0 0 5px #aaa;
-}
-/* Fades and background-images don't work well together in IE6, drop the image */
-* html .ui-tooltip {
-	background-image: none;
-}
-body .ui-tooltip { border-width: 2px; }
-
-/* Component containers
-----------------------------------*/
-.ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; }
-.ui-widget .ui-widget { font-size: 1em; }
-.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1em; }
-.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; }
-.ui-widget-content a { color: #222222/*{fcContent}*/; }
-.ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #222222/*{fcHeader}*/; font-weight: bold; }
-.ui-widget-header a { color: #222222/*{fcHeader}*/; }
-
-/* Interaction states
-----------------------------------*/
-.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; }
-.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; }
-.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url(images/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; }
-.ui-state-hover a, .ui-state-hover a:hover, .ui-state-hover a:link, .ui-state-hover a:visited { color: #212121/*{fcHover}*/; text-decoration: none; }
-.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; }
-.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; text-decoration: none; }
-
-/* Interaction Cues
-----------------------------------*/
-.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight  {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; }
-.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636/*{fcHighlight}*/; }
-.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; }
-.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a/*{fcError}*/; }
-.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a/*{fcError}*/; }
-.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
-.ui-priority-secondary, .ui-widget-content .ui-priority-secondary,  .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
-.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
-.ui-state-disabled .ui-icon { filter:Alpha(Opacity=35); } /* For IE8 - See #6059 */
-
-/* Icons
-----------------------------------*/
-
-/* states and images */
-.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
-.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
-.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; }
-.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; }
-.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; }
-.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; }
-.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; }
-.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; }
-
-/* positioning */
-.ui-icon-carat-1-n { background-position: 0 0; }
-.ui-icon-carat-1-ne { background-position: -16px 0; }
-.ui-icon-carat-1-e { background-position: -32px 0; }
-.ui-icon-carat-1-se { background-position: -48px 0; }
-.ui-icon-carat-1-s { background-position: -64px 0; }
-.ui-icon-carat-1-sw { background-position: -80px 0; }
-.ui-icon-carat-1-w { background-position: -96px 0; }
-.ui-icon-carat-1-nw { background-position: -112px 0; }
-.ui-icon-carat-2-n-s { background-position: -128px 0; }
-.ui-icon-carat-2-e-w { background-position: -144px 0; }
-.ui-icon-triangle-1-n { background-position: 0 -16px; }
-.ui-icon-triangle-1-ne { background-position: -16px -16px; }
-.ui-icon-triangle-1-e { background-position: -32px -16px; }
-.ui-icon-triangle-1-se { background-position: -48px -16px; }
-.ui-icon-triangle-1-s { background-position: -64px -16px; }
-.ui-icon-triangle-1-sw { background-position: -80px -16px; }
-.ui-icon-triangle-1-w { background-position: -96px -16px; }
-.ui-icon-triangle-1-nw { background-position: -112px -16px; }
-.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
-.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
-.ui-icon-arrow-1-n { background-position: 0 -32px; }
-.ui-icon-arrow-1-ne { background-position: -16px -32px; }
-.ui-icon-arrow-1-e { background-position: -32px -32px; }
-.ui-icon-arrow-1-se { background-position: -48px -32px; }
-.ui-icon-arrow-1-s { background-position: -64px -32px; }
-.ui-icon-arrow-1-sw { background-position: -80px -32px; }
-.ui-icon-arrow-1-w { background-position: -96px -32px; }
-.ui-icon-arrow-1-nw { background-position: -112px -32px; }
-.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
-.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
-.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
-.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
-.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
-.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
-.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
-.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
-.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
-.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
-.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
-.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
-.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
-.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
-.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
-.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
-.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
-.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
-.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
-.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
-.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
-.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
-.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
-.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
-.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
-.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
-.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
-.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
-.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
-.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
-.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
-.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
-.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
-.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
-.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
-.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
-.ui-icon-arrow-4 { background-position: 0 -80px; }
-.ui-icon-arrow-4-diag { background-position: -16px -80px; }
-.ui-icon-extlink { background-position: -32px -80px; }
-.ui-icon-newwin { background-position: -48px -80px; }
-.ui-icon-refresh { background-position: -64px -80px; }
-.ui-icon-shuffle { background-position: -80px -80px; }
-.ui-icon-transfer-e-w { background-position: -96px -80px; }
-.ui-icon-transferthick-e-w { background-position: -112px -80px; }
-.ui-icon-folder-collapsed { background-position: 0 -96px; }
-.ui-icon-folder-open { background-position: -16px -96px; }
-.ui-icon-document { background-position: -32px -96px; }
-.ui-icon-document-b { background-position: -48px -96px; }
-.ui-icon-note { background-position: -64px -96px; }
-.ui-icon-mail-closed { background-position: -80px -96px; }
-.ui-icon-mail-open { background-position: -96px -96px; }
-.ui-icon-suitcase { background-position: -112px -96px; }
-.ui-icon-comment { background-position: -128px -96px; }
-.ui-icon-person { background-position: -144px -96px; }
-.ui-icon-print { background-position: -160px -96px; }
-.ui-icon-trash { background-position: -176px -96px; }
-.ui-icon-locked { background-position: -192px -96px; }
-.ui-icon-unlocked { background-position: -208px -96px; }
-.ui-icon-bookmark { background-position: -224px -96px; }
-.ui-icon-tag { background-position: -240px -96px; }
-.ui-icon-home { background-position: 0 -112px; }
-.ui-icon-flag { background-position: -16px -112px; }
-.ui-icon-calendar { background-position: -32px -112px; }
-.ui-icon-cart { background-position: -48px -112px; }
-.ui-icon-pencil { background-position: -64px -112px; }
-.ui-icon-clock { background-position: -80px -112px; }
-.ui-icon-disk { background-position: -96px -112px; }
-.ui-icon-calculator { background-position: -112px -112px; }
-.ui-icon-zoomin { background-position: -128px -112px; }
-.ui-icon-zoomout { background-position: -144px -112px; }
-.ui-icon-search { background-position: -160px -112px; }
-.ui-icon-wrench { background-position: -176px -112px; }
-.ui-icon-gear { background-position: -192px -112px; }
-.ui-icon-heart { background-position: -208px -112px; }
-.ui-icon-star { background-position: -224px -112px; }
-.ui-icon-link { background-position: -240px -112px; }
-.ui-icon-cancel { background-position: 0 -128px; }
-.ui-icon-plus { background-position: -16px -128px; }
-.ui-icon-plusthick { background-position: -32px -128px; }
-.ui-icon-minus { background-position: -48px -128px; }
-.ui-icon-minusthick { background-position: -64px -128px; }
-.ui-icon-close { background-position: -80px -128px; }
-.ui-icon-closethick { background-position: -96px -128px; }
-.ui-icon-key { background-position: -112px -128px; }
-.ui-icon-lightbulb { background-position: -128px -128px; }
-.ui-icon-scissors { background-position: -144px -128px; }
-.ui-icon-clipboard { background-position: -160px -128px; }
-.ui-icon-copy { background-position: -176px -128px; }
-.ui-icon-contact { background-position: -192px -128px; }
-.ui-icon-image { background-position: -208px -128px; }
-.ui-icon-video { background-position: -224px -128px; }
-.ui-icon-script { background-position: -240px -128px; }
-.ui-icon-alert { background-position: 0 -144px; }
-.ui-icon-info { background-position: -16px -144px; }
-.ui-icon-notice { background-position: -32px -144px; }
-.ui-icon-help { background-position: -48px -144px; }
-.ui-icon-check { background-position: -64px -144px; }
-.ui-icon-bullet { background-position: -80px -144px; }
-.ui-icon-radio-on { background-position: -96px -144px; }
-.ui-icon-radio-off { background-position: -112px -144px; }
-.ui-icon-pin-w { background-position: -128px -144px; }
-.ui-icon-pin-s { background-position: -144px -144px; }
-.ui-icon-play { background-position: 0 -160px; }
-.ui-icon-pause { background-position: -16px -160px; }
-.ui-icon-seek-next { background-position: -32px -160px; }
-.ui-icon-seek-prev { background-position: -48px -160px; }
-.ui-icon-seek-end { background-position: -64px -160px; }
-.ui-icon-seek-start { background-position: -80px -160px; }
-/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
-.ui-icon-seek-first { background-position: -80px -160px; }
-.ui-icon-stop { background-position: -96px -160px; }
-.ui-icon-eject { background-position: -112px -160px; }
-.ui-icon-volume-off { background-position: -128px -160px; }
-.ui-icon-volume-on { background-position: -144px -160px; }
-.ui-icon-power { background-position: 0 -176px; }
-.ui-icon-signal-diag { background-position: -16px -176px; }
-.ui-icon-signal { background-position: -32px -176px; }
-.ui-icon-battery-0 { background-position: -48px -176px; }
-.ui-icon-battery-1 { background-position: -64px -176px; }
-.ui-icon-battery-2 { background-position: -80px -176px; }
-.ui-icon-battery-3 { background-position: -96px -176px; }
-.ui-icon-circle-plus { background-position: 0 -192px; }
-.ui-icon-circle-minus { background-position: -16px -192px; }
-.ui-icon-circle-close { background-position: -32px -192px; }
-.ui-icon-circle-triangle-e { background-position: -48px -192px; }
-.ui-icon-circle-triangle-s { background-position: -64px -192px; }
-.ui-icon-circle-triangle-w { background-position: -80px -192px; }
-.ui-icon-circle-triangle-n { background-position: -96px -192px; }
-.ui-icon-circle-arrow-e { background-position: -112px -192px; }
-.ui-icon-circle-arrow-s { background-position: -128px -192px; }
-.ui-icon-circle-arrow-w { background-position: -144px -192px; }
-.ui-icon-circle-arrow-n { background-position: -160px -192px; }
-.ui-icon-circle-zoomin { background-position: -176px -192px; }
-.ui-icon-circle-zoomout { background-position: -192px -192px; }
-.ui-icon-circle-check { background-position: -208px -192px; }
-.ui-icon-circlesmall-plus { background-position: 0 -208px; }
-.ui-icon-circlesmall-minus { background-position: -16px -208px; }
-.ui-icon-circlesmall-close { background-position: -32px -208px; }
-.ui-icon-squaresmall-plus { background-position: -48px -208px; }
-.ui-icon-squaresmall-minus { background-position: -64px -208px; }
-.ui-icon-squaresmall-close { background-position: -80px -208px; }
-.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
-.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
-.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
-.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
-.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
-.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
-
-
-/* Misc visuals
-----------------------------------*/
-
-/* Corner radius */
-.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -khtml-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; }
-.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; -khtml-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; }
-.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; }
-.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
-
-/* Overlays */
-.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }
-.ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -khtml-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; }
\ No newline at end of file



[39/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
deleted file mode 100644
index fd3647d..0000000
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
+++ /dev/null
@@ -1,4572 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-package org.apache.slider.client;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.io.Files;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.ArrayUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FSDataOutputStream;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.LocatedFileStatus;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.PathNotFoundException;
-import org.apache.hadoop.fs.RemoteIterator;
-import org.apache.hadoop.fs.permission.FsAction;
-import org.apache.hadoop.fs.permission.FsPermission;
-import org.apache.hadoop.hdfs.HdfsConfiguration;
-import org.apache.hadoop.net.NetUtils;
-import org.apache.hadoop.registry.client.api.RegistryConstants;
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.hadoop.registry.client.binding.RegistryPathUtils;
-import org.apache.hadoop.registry.client.binding.RegistryUtils;
-import org.apache.hadoop.registry.client.exceptions.NoRecordException;
-import org.apache.hadoop.registry.client.types.Endpoint;
-import org.apache.hadoop.registry.client.types.RegistryPathStatus;
-import org.apache.hadoop.registry.client.types.ServiceRecord;
-import org.apache.hadoop.registry.client.types.yarn.YarnRegistryAttributes;
-import org.apache.hadoop.security.Credentials;
-import org.apache.hadoop.security.KerberosDiags;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.security.alias.CredentialProvider;
-import org.apache.hadoop.security.alias.CredentialProviderFactory;
-import org.apache.hadoop.util.Shell;
-import org.apache.hadoop.yarn.api.ApplicationConstants;
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
-import org.apache.hadoop.yarn.api.records.LocalResource;
-import org.apache.hadoop.yarn.api.records.NodeReport;
-import org.apache.hadoop.yarn.api.records.NodeState;
-import org.apache.hadoop.yarn.api.records.YarnApplicationState;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException;
-import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.hadoop.yarn.util.ConverterUtils;
-import org.apache.slider.api.ClusterDescription;
-import org.apache.slider.api.ClusterNode;
-import org.apache.slider.api.SliderApplicationApi;
-import org.apache.slider.api.SliderClusterProtocol;
-import org.apache.slider.api.StateValues;
-import org.apache.slider.api.proto.Messages;
-import org.apache.slider.api.types.ContainerInformation;
-import org.apache.slider.api.types.NodeInformationList;
-import org.apache.slider.api.types.SliderInstanceDescription;
-import org.apache.slider.client.ipc.SliderApplicationIpcClient;
-import org.apache.slider.client.ipc.SliderClusterOperations;
-import org.apache.slider.common.Constants;
-import org.apache.slider.common.SliderExitCodes;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.params.AbstractActionArgs;
-import org.apache.slider.common.params.AbstractClusterBuildingActionArgs;
-import org.apache.slider.common.params.ActionAMSuicideArgs;
-import org.apache.slider.common.params.ActionClientArgs;
-import org.apache.slider.common.params.ActionCreateArgs;
-import org.apache.slider.common.params.ActionDependencyArgs;
-import org.apache.slider.common.params.ActionDestroyArgs;
-import org.apache.slider.common.params.ActionDiagnosticArgs;
-import org.apache.slider.common.params.ActionEchoArgs;
-import org.apache.slider.common.params.ActionExistsArgs;
-import org.apache.slider.common.params.ActionFlexArgs;
-import org.apache.slider.common.params.ActionFreezeArgs;
-import org.apache.slider.common.params.ActionInstallKeytabArgs;
-import org.apache.slider.common.params.ActionInstallPackageArgs;
-import org.apache.slider.common.params.ActionKDiagArgs;
-import org.apache.slider.common.params.ActionKeytabArgs;
-import org.apache.slider.common.params.ActionKillContainerArgs;
-import org.apache.slider.common.params.ActionListArgs;
-import org.apache.slider.common.params.ActionLookupArgs;
-import org.apache.slider.common.params.ActionNodesArgs;
-import org.apache.slider.common.params.ActionPackageArgs;
-import org.apache.slider.common.params.ActionRegistryArgs;
-import org.apache.slider.common.params.ActionResolveArgs;
-import org.apache.slider.common.params.ActionResourceArgs;
-import org.apache.slider.common.params.ActionStatusArgs;
-import org.apache.slider.common.params.ActionThawArgs;
-import org.apache.slider.common.params.ActionTokensArgs;
-import org.apache.slider.common.params.ActionUpgradeArgs;
-import org.apache.slider.common.params.Arguments;
-import org.apache.slider.common.params.ClientArgs;
-import org.apache.slider.common.params.CommonArgs;
-import org.apache.slider.common.params.LaunchArgsAccessor;
-import org.apache.slider.common.tools.ConfigHelper;
-import org.apache.slider.common.tools.Duration;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.common.tools.SliderVersionInfo;
-import org.apache.slider.core.build.InstanceBuilder;
-import org.apache.slider.core.build.InstanceIO;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.conf.ResourcesInputPropertiesValidator;
-import org.apache.slider.core.conf.TemplateInputPropertiesValidator;
-import org.apache.slider.core.exceptions.BadClusterStateException;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.exceptions.ErrorStrings;
-import org.apache.slider.core.exceptions.NoSuchNodeException;
-import org.apache.slider.core.exceptions.NotFoundException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.exceptions.UnknownApplicationInstanceException;
-import org.apache.slider.core.exceptions.UsageException;
-import org.apache.slider.core.exceptions.WaitTimeoutException;
-import org.apache.slider.core.launch.AppMasterLauncher;
-import org.apache.slider.core.launch.ClasspathConstructor;
-import org.apache.slider.core.launch.CredentialUtils;
-import org.apache.slider.core.launch.JavaCommandLineBuilder;
-import org.apache.slider.core.launch.LaunchedApplication;
-import org.apache.slider.core.launch.RunningApplication;
-import org.apache.slider.core.launch.SerializedApplicationReport;
-import org.apache.slider.core.main.RunService;
-import org.apache.slider.core.persist.AppDefinitionPersister;
-import org.apache.slider.core.persist.ApplicationReportSerDeser;
-import org.apache.slider.core.persist.ConfPersister;
-import org.apache.slider.core.persist.JsonSerDeser;
-import org.apache.slider.core.persist.LockAcquireFailedException;
-import org.apache.slider.core.registry.SliderRegistryUtils;
-import org.apache.slider.core.registry.YarnAppListClient;
-import org.apache.slider.core.registry.docstore.ConfigFormat;
-import org.apache.slider.core.registry.docstore.PublishedConfigSet;
-import org.apache.slider.core.registry.docstore.PublishedConfiguration;
-import org.apache.slider.core.registry.docstore.PublishedConfigurationOutputter;
-import org.apache.slider.core.registry.docstore.PublishedExports;
-import org.apache.slider.core.registry.docstore.PublishedExportsOutputter;
-import org.apache.slider.core.registry.docstore.PublishedExportsSet;
-import org.apache.slider.core.registry.retrieve.RegistryRetriever;
-import org.apache.slider.core.zk.BlockingZKWatcher;
-import org.apache.slider.core.zk.ZKIntegration;
-import org.apache.slider.core.zk.ZKPathBuilder;
-import org.apache.slider.providers.AbstractClientProvider;
-import org.apache.slider.providers.SliderProviderFactory;
-import org.apache.slider.providers.agent.AgentKeys;
-import org.apache.slider.providers.slideram.SliderAMClientProvider;
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.rpc.RpcBinder;
-import org.apache.slider.server.services.security.SecurityStore;
-import org.apache.slider.server.services.utility.AbstractSliderLaunchedService;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.data.ACL;
-import org.codehaus.jettison.json.JSONException;
-import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.InterruptedIOException;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.URISyntaxException;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import static org.apache.hadoop.registry.client.binding.RegistryUtils.*;
-import static org.apache.slider.api.InternalKeys.*;
-import static org.apache.slider.api.OptionKeys.*;
-import static org.apache.slider.api.ResourceKeys.*;
-import static org.apache.slider.common.Constants.HADOOP_JAAS_DEBUG;
-import static org.apache.slider.common.params.SliderActions.*;
-import static org.apache.slider.common.tools.SliderUtils.*;
-
-
-/**
- * Client service for Slider
- */
-
-public class SliderClient extends AbstractSliderLaunchedService implements RunService,
-    SliderExitCodes, SliderKeys, ErrorStrings, SliderClientAPI {
-  private static final Logger log = LoggerFactory.getLogger(SliderClient.class);
-  public static final String E_MUST_BE_A_VALID_JSON_FILE
-      = "Invalid configuration. Must be a valid json file.";
-  public static final String E_INVALID_INSTALL_LOCATION
-      = "A valid install location must be provided for the client.";
-  public static final String E_UNABLE_TO_READ_SUPPLIED_PACKAGE_FILE
-      = "Unable to read supplied package file";
-  public static final String E_INVALID_APPLICATION_PACKAGE_LOCATION
-      = "A valid application package location required.";
-  public static final String E_INVALID_INSTALL_PATH = "Install path is not a valid directory";
-  public static final String E_INSTALL_PATH_DOES_NOT_EXIST = "Install path does not exist";
-  public static final String E_INVALID_APPLICATION_TYPE_NAME
-      = "A valid application type name is required (e.g. HBASE).";
-  public static final String E_USE_REPLACEPKG_TO_OVERWRITE = "Use --replacepkg to overwrite.";
-  public static final String E_PACKAGE_DOES_NOT_EXIST = "Package does not exist";
-  public static final String E_NO_ZOOKEEPER_QUORUM = "No Zookeeper quorum defined";
-  public static final String E_NO_RESOURCE_MANAGER = "No valid Resource Manager address provided";
-  public static final String E_PACKAGE_EXISTS = "Package exists";
-  private static PrintStream clientOutputStream = System.out;
-
-  // value should not be changed without updating string find in slider.py
-  private static final String PASSWORD_PROMPT = "Enter password for";
-
-  private ClientArgs serviceArgs;
-  public ApplicationId applicationId;
-  
-  private String deployedClusterName;
-  /**
-   * Cluster operations against the deployed cluster -will be null
-   * if no bonding has yet taken place
-   */
-  private SliderClusterOperations sliderClusterOperations;
-
-  protected SliderFileSystem sliderFileSystem;
-
-  /**
-   * Yarn client service
-   */
-  private SliderYarnClientImpl yarnClient;
-  private YarnAppListClient yarnAppListClient;
-  private AggregateConf launchedInstanceDefinition;
-
-  /**
-   * The YARN registry service
-   */
-  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-  private RegistryOperations registryOperations;
-
-  /**
-   * Constructor
-   */
-  public SliderClient() {
-    super("Slider Client");
-    new HdfsConfiguration();
-    new YarnConfiguration();
-  }
-
-  /**
-   * This is called <i>Before serviceInit is called</i>
-   * @param config the initial configuration build up by the
-   * service launcher.
-   * @param args argument list list of arguments passed to the command line
-   * after any launcher-specific commands have been stripped.
-   * @return the post-binding configuration to pass to the <code>init()</code>
-   * operation.
-   * @throws Exception
-   */
-  @Override
-  public Configuration bindArgs(Configuration config, String... args) throws Exception {
-    config = super.bindArgs(config, args);
-    serviceArgs = new ClientArgs(args);
-    serviceArgs.parse();
-    // add the slider XML config
-    ConfigHelper.injectSliderXMLResource();
-    // yarn-ify
-    YarnConfiguration yarnConfiguration = new YarnConfiguration(config);
-    return patchConfiguration(yarnConfiguration);
-  }
-
-  @Override
-  protected void serviceInit(Configuration conf) throws Exception {
-    Configuration clientConf = loadSliderClientXML();
-    ConfigHelper.mergeConfigurations(conf, clientConf, SLIDER_CLIENT_XML, true);
-    serviceArgs.applyDefinitions(conf);
-    serviceArgs.applyFileSystemBinding(conf);
-    AbstractActionArgs coreAction = serviceArgs.getCoreAction();
-    // init security with our conf
-    if (!coreAction.disableSecureLogin() && isHadoopClusterSecure(conf)) {
-      forceLogin();
-      initProcessSecurity(conf);
-    }
-    if (coreAction.getHadoopServicesRequired()) {
-      initHadoopBinding();
-    }
-    super.serviceInit(conf);
-  }
-
-  /**
-   * Launched service execution. This runs {@link #exec()}
-   * then catches some exceptions and converts them to exit codes
-   * @return an exit code
-   * @throws Throwable
-   */
-  @Override
-  public int runService() throws Throwable {
-    try {
-      return exec();
-    } catch (FileNotFoundException | PathNotFoundException nfe) {
-      throw new NotFoundException(nfe, nfe.toString());
-    }
-  }
-
-  /**
-   * Execute the command line
-   * @return an exit code
-   * @throws Throwable on a failure
-   */
-  public int exec() throws Throwable {
-
-    // choose the action
-    String action = serviceArgs.getAction();
-    if (isUnset(action)) {
-      throw new SliderException(EXIT_USAGE, serviceArgs.usage());
-    }
-
-    int exitCode = EXIT_SUCCESS;
-    String clusterName = serviceArgs.getClusterName();
-    // actions
-
-    switch (action) {
-      case ACTION_AM_SUICIDE:
-        exitCode = actionAmSuicide(clusterName,
-            serviceArgs.getActionAMSuicideArgs());
-        break;
-      
-      case ACTION_BUILD:
-        exitCode = actionBuild(clusterName, serviceArgs.getActionBuildArgs());
-        break;
-      
-      case ACTION_CLIENT:
-        exitCode = actionClient(serviceArgs.getActionClientArgs());
-        break;
-
-      case ACTION_CREATE:
-        exitCode = actionCreate(clusterName, serviceArgs.getActionCreateArgs());
-        break;
-
-      case ACTION_DEPENDENCY:
-        exitCode = actionDependency(serviceArgs.getActionDependencyArgs());
-        break;
-
-      case ACTION_DESTROY:
-        exitCode = actionDestroy(clusterName, serviceArgs.getActionDestroyArgs());
-        break;
-
-      case ACTION_DIAGNOSTICS:
-        exitCode = actionDiagnostic(serviceArgs.getActionDiagnosticArgs());
-        break;
-      
-      case ACTION_EXISTS:
-        exitCode = actionExists(clusterName,
-            serviceArgs.getActionExistsArgs());
-        break;
-      
-      case ACTION_FLEX:
-        exitCode = actionFlex(clusterName, serviceArgs.getActionFlexArgs());
-        break;
-      
-      case ACTION_FREEZE:
-        exitCode = actionFreeze(clusterName, serviceArgs.getActionFreezeArgs());
-        break;
-      
-      case ACTION_HELP:
-        log.info(serviceArgs.usage());
-        break;
-
-      case ACTION_KDIAG:
-        exitCode = actionKDiag(serviceArgs.getActionKDiagArgs());
-        break;
-
-      case ACTION_KILL_CONTAINER:
-        exitCode = actionKillContainer(clusterName,
-            serviceArgs.getActionKillContainerArgs());
-        break;
-
-      case ACTION_INSTALL_KEYTAB:
-        exitCode = actionInstallKeytab(serviceArgs.getActionInstallKeytabArgs());
-        break;
-      
-      case ACTION_INSTALL_PACKAGE:
-        exitCode = actionInstallPkg(serviceArgs.getActionInstallPackageArgs());
-        break;
-
-      case ACTION_KEYTAB:
-        exitCode = actionKeytab(serviceArgs.getActionKeytabArgs());
-        break;
-
-      case ACTION_LIST:
-        exitCode = actionList(clusterName, serviceArgs.getActionListArgs());
-        break;
-
-      case ACTION_LOOKUP:
-        exitCode = actionLookup(serviceArgs.getActionLookupArgs());
-        break;
-
-      case ACTION_NODES:
-        exitCode = actionNodes("", serviceArgs.getActionNodesArgs());
-        break;
-
-      case ACTION_PACKAGE:
-        exitCode = actionPackage(serviceArgs.getActionPackageArgs());
-        break;
-
-      case ACTION_REGISTRY:
-        exitCode = actionRegistry(serviceArgs.getActionRegistryArgs());
-        break;
-      
-      case ACTION_RESOLVE:
-        exitCode = actionResolve(serviceArgs.getActionResolveArgs());
-        break;
-
-      case ACTION_RESOURCE:
-        exitCode = actionResource(serviceArgs.getActionResourceArgs());
-        break;
-
-      case ACTION_STATUS:
-        exitCode = actionStatus(clusterName, serviceArgs.getActionStatusArgs());
-        break;
-
-      case ACTION_THAW:
-        exitCode = actionThaw(clusterName, serviceArgs.getActionThawArgs());
-        break;
-
-      case ACTION_TOKENS:
-        exitCode = actionTokens(serviceArgs.getActionTokenArgs());
-        break;
-
-      case ACTION_UPDATE:
-        exitCode = actionUpdate(clusterName, serviceArgs.getActionUpdateArgs());
-        break;
-
-      case ACTION_UPGRADE:
-        exitCode = actionUpgrade(clusterName, serviceArgs.getActionUpgradeArgs());
-        break;
-
-      case ACTION_VERSION:
-        exitCode = actionVersion();
-        break;
-      
-      default:
-        throw new SliderException(EXIT_UNIMPLEMENTED,
-            "Unimplemented: " + action);
-    }
-   
-    return exitCode;
-  }
-
-  /**
-   * Perform everything needed to init the hadoop binding.
-   * This assumes that the service is already  in inited or started state
-   * @throws IOException
-   * @throws SliderException
-   */
-  protected void initHadoopBinding() throws IOException, SliderException {
-    // validate the client
-    validateSliderClientEnvironment(null);
-    //create the YARN client
-    yarnClient = new SliderYarnClientImpl();
-    yarnClient.init(getConfig());
-    if (getServiceState() == STATE.STARTED) {
-      yarnClient.start();
-    }
-    addService(yarnClient);
-    yarnAppListClient =
-        new YarnAppListClient(yarnClient, getUsername(), getConfig());
-    // create the filesystem
-    sliderFileSystem = new SliderFileSystem(getConfig());
-  }
-
-  /**
-   * Delete the zookeeper node associated with the calling user and the cluster
-   * TODO: YARN registry operations
-   **/
-  @VisibleForTesting
-  public boolean deleteZookeeperNode(String clusterName) throws YarnException, IOException {
-    String user = getUsername();
-    String zkPath = ZKIntegration.mkClusterPath(user, clusterName);
-    Exception e = null;
-    try {
-      Configuration config = getConfig();
-      ZKIntegration client = getZkClient(clusterName, user);
-      if (client != null) {
-        if (client.exists(zkPath)) {
-          log.info("Deleting zookeeper path {}", zkPath);
-        }
-        client.deleteRecursive(zkPath);
-        return true;
-      }
-    } catch (InterruptedException | BadConfigException | KeeperException ex) {
-      e = ex;
-    }
-    if (e != null) {
-      log.warn("Unable to recursively delete zk node {}", zkPath, e);
-    }
-
-    return false;
-  }
-
-  /**
-   * Create the zookeeper node associated with the calling user and the cluster
-   *
-   * @param clusterName slider application name
-   * @param nameOnly should the name only be created (i.e. don't create ZK node)
-   * @return the path, using the policy implemented in
-   *   {@link ZKIntegration#mkClusterPath(String, String)}
-   * @throws YarnException
-   * @throws IOException
-   */
-  @VisibleForTesting
-  public String createZookeeperNode(String clusterName, Boolean nameOnly) throws YarnException, IOException {
-    try {
-      return createZookeeperNodeInner(clusterName, nameOnly);
-    } catch (KeeperException.NodeExistsException e) {
-      return null;
-    } catch (KeeperException e) {
-      return null;
-    } catch (InterruptedException e) {
-      throw new InterruptedIOException(e.toString());
-    }
-  }
-
-  /**
-   * Create the zookeeper node associated with the calling user and the cluster
-   * -throwing exceptions on any failure
-   * @param clusterName cluster name
-   * @param nameOnly create the path, not the node
-   * @return the path, using the policy implemented in
-   *   {@link ZKIntegration#mkClusterPath(String, String)}
-   * @throws YarnException
-   * @throws IOException
-   * @throws KeeperException
-   * @throws InterruptedException
-   */
-  @VisibleForTesting
-  public String createZookeeperNodeInner(String clusterName, Boolean nameOnly)
-      throws YarnException, IOException, KeeperException, InterruptedException {
-    String user = getUsername();
-    String zkPath = ZKIntegration.mkClusterPath(user, clusterName);
-    if (nameOnly) {
-      return zkPath;
-    }
-    ZKIntegration client = getZkClient(clusterName, user);
-    if (client != null) {
-      // set up the permissions. This must be done differently on a secure cluster from an insecure
-      // one
-      List<ACL> zkperms = new ArrayList<>();
-      if (UserGroupInformation.isSecurityEnabled()) {
-        zkperms.add(new ACL(ZooDefs.Perms.ALL, ZooDefs.Ids.AUTH_IDS));
-        zkperms.add(new ACL(ZooDefs.Perms.READ, ZooDefs.Ids.ANYONE_ID_UNSAFE));
-      } else {
-        zkperms.add(new ACL(ZooDefs.Perms.ALL, ZooDefs.Ids.ANYONE_ID_UNSAFE));
-      }
-      client.createPath(zkPath, "",
-          zkperms,
-          CreateMode.PERSISTENT);
-      return zkPath;
-    } else {
-      return null;
-    }
-  }
-
-  /**
-   * Gets a zookeeper client, returns null if it cannot connect to zookeeper
-   **/
-  protected ZKIntegration getZkClient(String clusterName, String user) throws YarnException {
-    String registryQuorum = lookupZKQuorum();
-    ZKIntegration client = null;
-    try {
-      BlockingZKWatcher watcher = new BlockingZKWatcher();
-      client = ZKIntegration.newInstance(registryQuorum, user, clusterName, true, false, watcher,
-          ZKIntegration.SESSION_TIMEOUT);
-      client.init();
-      watcher.waitForZKConnection(2 * 1000);
-    } catch (InterruptedException e) {
-      client = null;
-      log.warn("Unable to connect to zookeeper quorum {}", registryQuorum, e);
-    } catch (IOException e) {
-      log.warn("Unable to connect to zookeeper quorum {}", registryQuorum, e);
-    }
-    return client;
-  }
-
-  /**
-   * Keep this signature for backward compatibility with
-   * force=true by default.
-   */
-  @Override
-  public int actionDestroy(String clustername) throws YarnException,
-                                                      IOException {
-    ActionDestroyArgs destroyArgs = new ActionDestroyArgs();
-    destroyArgs.force = true;
-    return actionDestroy(clustername, destroyArgs);
-  }
-
-  @Override
-  public int actionDestroy(String clustername,
-      ActionDestroyArgs destroyArgs) throws YarnException, IOException {
-    // verify that a live cluster isn't there
-    validateClusterName(clustername);
-    //no=op, it is now mandatory. 
-    verifyBindingsDefined();
-    verifyNoLiveClusters(clustername, "Destroy");
-    boolean forceDestroy = destroyArgs.force;
-    log.debug("actionDestroy({}, force={})", clustername, forceDestroy);
-
-    // create the directory path
-    Path clusterDirectory = sliderFileSystem.buildClusterDirPath(clustername);
-    // delete the directory;
-    FileSystem fs = sliderFileSystem.getFileSystem();
-    boolean exists = fs.exists(clusterDirectory);
-    if (exists) {
-      log.debug("Application Instance {} found at {}: destroying", clustername, clusterDirectory);
-      if (!forceDestroy) {
-        // fail the command if --force is not explicitly specified
-        throw new UsageException("Destroy will permanently delete directories and registries. "
-            + "Reissue this command with the --force option if you want to proceed.");
-      }
-      if (!fs.delete(clusterDirectory, true)) {
-        log.warn("Filesystem returned false from delete() operation");
-      }
-
-      if(!deleteZookeeperNode(clustername)) {
-        log.warn("Unable to perform node cleanup in Zookeeper.");
-      }
-
-      if (fs.exists(clusterDirectory)) {
-        log.warn("Failed to delete {}", clusterDirectory);
-      }
-
-    } else {
-      log.debug("Application Instance {} already destroyed", clustername);
-    }
-
-    // rm the registry entry \u2014do not let this block the destroy operations
-    String registryPath = SliderRegistryUtils.registryPathForInstance(
-        clustername);
-    try {
-      getRegistryOperations().delete(registryPath, true);
-    } catch (IOException e) {
-      log.warn("Error deleting registry entry {}: {} ", registryPath, e, e);
-    } catch (SliderException e) {
-      log.warn("Error binding to registry {} ", e, e);
-    }
-
-    List<ApplicationReport> instances = findAllLiveInstances(clustername);
-    // detect any race leading to cluster creation during the check/destroy process
-    // and report a problem.
-    if (!instances.isEmpty()) {
-      throw new SliderException(EXIT_APPLICATION_IN_USE,
-                              clustername + ": "
-                              + E_DESTROY_CREATE_RACE_CONDITION
-                              + " :" +
-                              instances.get(0));
-    }
-    log.info("Destroyed cluster {}", clustername);
-    return EXIT_SUCCESS;
-  }
-  
-  @Override
-  public int actionAmSuicide(String clustername,
-      ActionAMSuicideArgs args) throws YarnException, IOException {
-    SliderClusterOperations clusterOperations =
-      createClusterOperations(clustername);
-    clusterOperations.amSuicide(args.message, args.exitcode, args.waittime);
-    return EXIT_SUCCESS;
-  }
-
-  @Override
-  public AbstractClientProvider createClientProvider(String provider)
-    throws SliderException {
-    SliderProviderFactory factory =
-      SliderProviderFactory.createSliderProviderFactory(provider);
-    return factory.createClientProvider();
-  }
-
-  /**
-   * Create the cluster -saving the arguments to a specification file first
-   * @param clustername cluster name
-   * @return the status code
-   * @throws YarnException Yarn problems
-   * @throws IOException other problems
-   * @throws BadCommandArgumentsException bad arguments.
-   */
-  public int actionCreate(String clustername, ActionCreateArgs createArgs) throws
-                                               YarnException,
-                                               IOException {
-
-    actionBuild(clustername, createArgs);
-    Path clusterDirectory = sliderFileSystem.buildClusterDirPath(clustername);
-    AggregateConf instanceDefinition = loadInstanceDefinitionUnresolved(
-        clustername, clusterDirectory);
-    try {
-      checkForCredentials(getConfig(), instanceDefinition.getAppConf(),
-          clustername);
-    } catch (IOException e) {
-      sliderFileSystem.getFileSystem().delete(clusterDirectory, true);
-      throw e;
-    }
-    return startCluster(clustername, createArgs);
-  }
-
-  @Override
-  public int actionUpgrade(String clustername, ActionUpgradeArgs upgradeArgs)
-      throws YarnException, IOException {
-    File template = upgradeArgs.template;
-    File resources = upgradeArgs.resources;
-    List<String> containers = upgradeArgs.containers;
-    List<String> components = upgradeArgs.components;
-
-    // For upgrade spec, let's be little more strict with validation. If either
-    // --template or --resources is specified, then both needs to be specified.
-    // Otherwise the internal app config and resources states of the app will be
-    // unwantedly modified and the change will take effect to the running app
-    // immediately.
-    require(!(template != null && resources == null),
-          "Option %s must be specified with option %s",
-          Arguments.ARG_RESOURCES, Arguments.ARG_TEMPLATE);
-
-    require(!(resources != null && template == null),
-          "Option %s must be specified with option %s",
-          Arguments.ARG_TEMPLATE, Arguments.ARG_RESOURCES);
-
-    // For upgrade spec, both --template and --resources should be specified
-    // and neither of --containers or --components should be used
-    if (template != null && resources != null) {
-      require(CollectionUtils.isEmpty(containers),
-            "Option %s cannot be specified with %s or %s",
-            Arguments.ARG_CONTAINERS, Arguments.ARG_TEMPLATE,
-            Arguments.ARG_RESOURCES);
-      require(CollectionUtils.isEmpty(components),
-              "Option %s cannot be specified with %s or %s",
-              Arguments.ARG_COMPONENTS, Arguments.ARG_TEMPLATE,
-              Arguments.ARG_RESOURCES);
-
-      // not an error to try to upgrade a stopped cluster, just return success
-      // code, appropriate log messages have already been dumped
-      if (!isAppInRunningState(clustername)) {
-        return EXIT_SUCCESS;
-      }
-
-      // Now initiate the upgrade spec flow
-      buildInstanceDefinition(clustername, upgradeArgs, true, true, true);
-      SliderClusterOperations clusterOperations = createClusterOperations(clustername);
-      clusterOperations.amSuicide("AM restarted for application upgrade", 1, 1000);
-      return EXIT_SUCCESS;
-    }
-
-    // Since neither --template or --resources were specified, it is upgrade
-    // containers flow. Here any one or both of --containers and --components
-    // can be specified. If a container is specified with --containers option
-    // and also belongs to a component type specified with --components, it will
-    // be upgraded only once.
-    return actionUpgradeContainers(clustername, upgradeArgs);
-  }
-
-  private int actionUpgradeContainers(String clustername,
-      ActionUpgradeArgs upgradeArgs) throws YarnException, IOException {
-    verifyBindingsDefined();
-    validateClusterName(clustername);
-    int waittime = upgradeArgs.getWaittime(); // ignored for now
-    String text = "Upgrade containers";
-    log.debug("actionUpgradeContainers({}, reason={}, wait={})", clustername,
-        text, waittime);
-
-    // not an error to try to upgrade a stopped cluster, just return success
-    // code, appropriate log messages have already been dumped
-    if (!isAppInRunningState(clustername)) {
-      return EXIT_SUCCESS;
-    }
-
-    // Create sets of containers and components to get rid of duplicates and
-    // for quick lookup during checks below
-    Set<String> containers = new HashSet<>();
-    if (upgradeArgs.containers != null) {
-      containers.addAll(new ArrayList<>(upgradeArgs.containers));
-    }
-    Set<String> components = new HashSet<>();
-    if (upgradeArgs.components != null) {
-      components.addAll(new ArrayList<>(upgradeArgs.components));
-    }
-
-    // check validity of component names and running containers here
-    List<ContainerInformation> liveContainers = getContainers(clustername);
-    Set<String> validContainers = new HashSet<>();
-    Set<String> validComponents = new HashSet<>();
-    for (ContainerInformation liveContainer : liveContainers) {
-      boolean allContainersAndComponentsAccountedFor = true;
-      if (CollectionUtils.isNotEmpty(containers)) {
-        if (containers.contains(liveContainer.containerId)) {
-          containers.remove(liveContainer.containerId);
-          validContainers.add(liveContainer.containerId);
-        }
-        allContainersAndComponentsAccountedFor = false;
-      }
-      if (CollectionUtils.isNotEmpty(components)) {
-        if (components.contains(liveContainer.component)) {
-          components.remove(liveContainer.component);
-          validComponents.add(liveContainer.component);
-        }
-        allContainersAndComponentsAccountedFor = false;
-      }
-      if (allContainersAndComponentsAccountedFor) {
-        break;
-      }
-    }
-
-    // If any item remains in containers or components then they are invalid.
-    // Log warning for them and proceed.
-    if (CollectionUtils.isNotEmpty(containers)) {
-      log.warn("Invalid set of containers provided {}", containers);
-    }
-    if (CollectionUtils.isNotEmpty(components)) {
-      log.warn("Invalid set of components provided {}", components);
-    }
-
-    // If not a single valid container or component is specified do not proceed
-    if (CollectionUtils.isEmpty(validContainers)
-        && CollectionUtils.isEmpty(validComponents)) {
-      log.error("Not a single valid container or component specified. Nothing to do.");
-      return EXIT_NOT_FOUND;
-    }
-
-    SliderClusterProtocol appMaster = connect(findInstance(clustername));
-    Messages.UpgradeContainersRequestProto r =
-      Messages.UpgradeContainersRequestProto
-              .newBuilder()
-              .setMessage(text)
-              .addAllContainer(validContainers)
-              .addAllComponent(validComponents)
-              .build();
-    appMaster.upgradeContainers(r);
-    log.info("Cluster upgrade issued for -");
-    if (CollectionUtils.isNotEmpty(validContainers)) {
-      log.info(" Containers (total {}): {}", validContainers.size(),
-          validContainers);
-    }
-    if (CollectionUtils.isNotEmpty(validComponents)) {
-      log.info(" Components (total {}): {}", validComponents.size(),
-          validComponents);
-    }
-
-    return EXIT_SUCCESS;
-  }
-
-  // returns true if and only if app is in RUNNING state
-  private boolean isAppInRunningState(String clustername) throws YarnException,
-      IOException {
-    // is this actually a known cluster?
-    sliderFileSystem.locateInstanceDefinition(clustername);
-    ApplicationReport app = findInstance(clustername);
-    if (app == null) {
-      // exit early
-      log.info("Cluster {} not running", clustername);
-      return false;
-    }
-    log.debug("App to upgrade was found: {}:\n{}", clustername,
-        new OnDemandReportStringifier(app));
-    if (app.getYarnApplicationState().ordinal() >= YarnApplicationState.FINISHED.ordinal()) {
-      log.info("Cluster {} is in a terminated state {}. Use command '{}' instead.",
-          clustername, app.getYarnApplicationState(), ACTION_UPDATE);
-      return false;
-    }
-
-    // IPC request to upgrade containers is possible if the app is running.
-    if (app.getYarnApplicationState().ordinal() < YarnApplicationState.RUNNING
-        .ordinal()) {
-      log.info("Cluster {} is in a pre-running state {}. To upgrade it needs "
-          + "to be RUNNING.", clustername, app.getYarnApplicationState());
-      return false;
-    }
-
-    return true;
-  }
-
-  protected static void checkForCredentials(Configuration conf,
-      ConfTree tree, String clusterName) throws IOException {
-    if (tree.credentials == null || tree.credentials.isEmpty()) {
-      log.info("No credentials requested");
-      return;
-    }
-
-    BufferedReader br = null;
-    try {
-      for (Entry<String, List<String>> cred : tree.credentials.entrySet()) {
-        String provider = cred.getKey()
-            .replaceAll(Pattern.quote("${CLUSTER_NAME}"), clusterName)
-            .replaceAll(Pattern.quote("${CLUSTER}"), clusterName);
-        List<String> aliases = cred.getValue();
-        if (aliases == null || aliases.isEmpty()) {
-          continue;
-        }
-        Configuration c = new Configuration(conf);
-        c.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, provider);
-        CredentialProvider credentialProvider = CredentialProviderFactory.getProviders(c).get(0);
-        Set<String> existingAliases = new HashSet<>(credentialProvider.getAliases());
-        for (String alias : aliases) {
-          if (existingAliases.contains(alias.toLowerCase(Locale.ENGLISH))) {
-            log.info("Credentials for " + alias + " found in " + provider);
-          } else {
-            if (br == null) {
-              br = new BufferedReader(new InputStreamReader(System.in));
-            }
-            char[] pass = readPassword(alias, br);
-            credentialProvider.createCredentialEntry(alias, pass);
-            credentialProvider.flush();
-            Arrays.fill(pass, ' ');
-          }
-        }
-      }
-    } finally {
-      org.apache.hadoop.io.IOUtils.closeStream(br);
-    }
-  }
-
-  private static char[] readOnePassword(String alias) throws IOException {
-    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
-      return readPassword(alias, br);
-    }
-  }
-
-  // using a normal reader instead of a secure one,
-  // because stdin is not hooked up to the command line
-  private static char[] readPassword(String alias, BufferedReader br)
-      throws IOException {
-    char[] cred = null;
-
-    boolean noMatch;
-    do {
-      log.info(String.format("%s %s: ", PASSWORD_PROMPT, alias));
-      char[] newPassword1 = br.readLine().toCharArray();
-      log.info(String.format("%s %s again: ", PASSWORD_PROMPT, alias));
-      char[] newPassword2 = br.readLine().toCharArray();
-      noMatch = !Arrays.equals(newPassword1, newPassword2);
-      if (noMatch) {
-        if (newPassword1 != null) Arrays.fill(newPassword1, ' ');
-        log.info(String.format("Passwords don't match. Try again."));
-      } else {
-        cred = newPassword1;
-      }
-      if (newPassword2 != null) Arrays.fill(newPassword2, ' ');
-    } while (noMatch);
-    if (cred == null)
-      throw new IOException("Could not read credentials for " + alias +
-          " from stdin");
-    return cred;
-  }
-
-  @Override
-  public int actionBuild(String clustername,
-      AbstractClusterBuildingActionArgs buildInfo) throws
-                                               YarnException,
-                                               IOException {
-
-    buildInstanceDefinition(clustername, buildInfo, false, false);
-    return EXIT_SUCCESS; 
-  }
-
-  @Override
-  public int actionKeytab(ActionKeytabArgs keytabInfo)
-      throws YarnException, IOException {
-    if (keytabInfo.install) {
-      return actionInstallKeytab(keytabInfo);
-    } else if (keytabInfo.delete) {
-      return actionDeleteKeytab(keytabInfo);
-    } else if (keytabInfo.list) {
-      return actionListKeytab(keytabInfo);
-    } else {
-      throw new BadCommandArgumentsException(
-          "Keytab option specified not found.\n"
-          + CommonArgs.usage(serviceArgs, ACTION_KEYTAB));
-    }
-  }
-
-  private int actionListKeytab(ActionKeytabArgs keytabInfo) throws IOException {
-    String folder = keytabInfo.folder != null ? keytabInfo.folder : StringUtils.EMPTY;
-    Path keytabPath = sliderFileSystem.buildKeytabInstallationDirPath(folder);
-    RemoteIterator<LocatedFileStatus> files =
-        sliderFileSystem.getFileSystem().listFiles(keytabPath, true);
-    log.info("Keytabs:");
-    while (files.hasNext()) {
-      log.info("\t" + files.next().getPath().toString());
-    }
-
-    return EXIT_SUCCESS;
-  }
-
-  private int actionDeleteKeytab(ActionKeytabArgs keytabInfo)
-      throws BadCommandArgumentsException, IOException {
-    if (StringUtils.isEmpty(keytabInfo.folder)) {
-      throw new BadCommandArgumentsException(
-          "A valid destination keytab sub-folder name is required (e.g. 'security').\n"
-          + CommonArgs.usage(serviceArgs, ACTION_KEYTAB));
-    }
-
-    if (StringUtils.isEmpty(keytabInfo.keytab)) {
-      throw new BadCommandArgumentsException("A keytab name is required.");
-    }
-
-    Path pkgPath = sliderFileSystem.buildKeytabInstallationDirPath(keytabInfo.folder);
-
-    Path fileInFs = new Path(pkgPath, keytabInfo.keytab );
-    log.info("Deleting keytab {}", fileInFs);
-    FileSystem sfs = sliderFileSystem.getFileSystem();
-    require(sfs.exists(fileInFs), "No keytab to delete found at %s",
-        fileInFs.toUri());
-    sfs.delete(fileInFs, false);
-
-    return EXIT_SUCCESS;
-  }
-
-  private int actionInstallKeytab(ActionKeytabArgs keytabInfo)
-      throws BadCommandArgumentsException, IOException {
-    Path srcFile = null;
-    require(isSet(keytabInfo.folder),
-        "A valid destination keytab sub-folder name is required (e.g. 'security').\n"
-        + CommonArgs.usage(serviceArgs, ACTION_KEYTAB));
-
-    requireArgumentSet(Arguments.ARG_KEYTAB, keytabInfo.keytab);
-    File keytabFile = new File(keytabInfo.keytab);
-    require(keytabFile.isFile(),
-        "Unable to access supplied keytab file at %s", keytabFile.getAbsolutePath());
-    srcFile = new Path(keytabFile.toURI());
-
-    Path pkgPath = sliderFileSystem.buildKeytabInstallationDirPath(keytabInfo.folder);
-    FileSystem sfs = sliderFileSystem.getFileSystem();
-    sfs.mkdirs(pkgPath);
-    sfs.setPermission(pkgPath, new FsPermission(
-        FsAction.ALL, FsAction.NONE, FsAction.NONE));
-
-    Path fileInFs = new Path(pkgPath, srcFile.getName());
-    log.info("Installing keytab {} at {} and overwrite is {}.",
-        srcFile, fileInFs, keytabInfo.overwrite);
-    require(!(sfs.exists(fileInFs) && !keytabInfo.overwrite),
-        "Keytab exists at %s. Use --overwrite to overwrite.", fileInFs.toUri());
-
-    sfs.copyFromLocalFile(false, keytabInfo.overwrite, srcFile, fileInFs);
-    sfs.setPermission(fileInFs,
-        new FsPermission(FsAction.READ_WRITE, FsAction.NONE, FsAction.NONE));
-
-    return EXIT_SUCCESS;
-  }
-
-  @Override
-  public int actionInstallKeytab(ActionInstallKeytabArgs installKeytabInfo)
-      throws YarnException, IOException {
-    log.warn("The 'install-keytab' option has been deprecated.  Please use 'keytab --install'.");
-    return actionKeytab(new ActionKeytabArgs(installKeytabInfo));
-  }
-
-  @Override
-  public int actionInstallPkg(ActionInstallPackageArgs installPkgInfo) throws
-      YarnException,
-      IOException {
-    log.warn("The " + ACTION_INSTALL_PACKAGE
-        + " option has been deprecated. Please use '"
-        + ACTION_PACKAGE + " " + ClientArgs.ARG_INSTALL + "'.");
-    if (StringUtils.isEmpty(installPkgInfo.name)) {
-      throw new BadCommandArgumentsException(
-          E_INVALID_APPLICATION_TYPE_NAME + "\n"
-              + CommonArgs.usage(serviceArgs, ACTION_INSTALL_PACKAGE));
-    }
-    Path srcFile = extractPackagePath(installPkgInfo.packageURI);
-
-    // Do not provide new options to install-package command as it is in
-    // deprecated mode. So version is kept null here. Use package --install.
-    Path pkgPath = sliderFileSystem.buildPackageDirPath(installPkgInfo.name,
-        null);
-    FileSystem sfs = sliderFileSystem.getFileSystem();
-    sfs.mkdirs(pkgPath);
-
-    Path fileInFs = new Path(pkgPath, srcFile.getName());
-    log.info("Installing package {} at {} and overwrite is {}.",
-        srcFile, fileInFs, installPkgInfo.replacePkg);
-    require(!(sfs.exists(fileInFs) && !installPkgInfo.replacePkg),
-          "Package exists at %s. : %s", fileInFs.toUri(), E_USE_REPLACEPKG_TO_OVERWRITE);
-    sfs.copyFromLocalFile(false, installPkgInfo.replacePkg, srcFile, fileInFs);
-    return EXIT_SUCCESS;
-  }
-
-  @Override
-  public int actionResource(ActionResourceArgs resourceInfo)
-      throws YarnException, IOException {
-    if (resourceInfo.help) {
-      actionHelp(ACTION_RESOURCE);
-      return EXIT_SUCCESS;
-    } else if (resourceInfo.install) {
-      return actionInstallResource(resourceInfo);
-    } else if (resourceInfo.delete) {
-      return actionDeleteResource(resourceInfo);
-    } else if (resourceInfo.list) {
-      return actionListResource(resourceInfo);
-    } else {
-      throw new BadCommandArgumentsException(
-          "Resource option specified not found.\n"
-              + CommonArgs.usage(serviceArgs, ACTION_RESOURCE));
-    }
-  }
-
-  private int actionListResource(ActionResourceArgs resourceInfo) throws IOException {
-    String folder = resourceInfo.folder != null ? resourceInfo.folder : StringUtils.EMPTY;
-    Path path = sliderFileSystem.buildResourcePath(folder);
-    RemoteIterator<LocatedFileStatus> files =
-        sliderFileSystem.getFileSystem().listFiles(path, true);
-    log.info("Resources:");
-    while (files.hasNext()) {
-      log.info("\t" + files.next().getPath().toString());
-    }
-
-    return EXIT_SUCCESS;
-  }
-
-  private int actionDeleteResource(ActionResourceArgs resourceInfo)
-      throws BadCommandArgumentsException, IOException {
-    if (StringUtils.isEmpty(resourceInfo.resource)) {
-      throw new BadCommandArgumentsException("A file name is required.");
-    }
-
-    Path fileInFs;
-    if (resourceInfo.folder == null) {
-      fileInFs = sliderFileSystem.buildResourcePath(resourceInfo.resource);
-    } else {
-      fileInFs = sliderFileSystem.buildResourcePath(resourceInfo.folder,
-          resourceInfo.resource);
-    }
-
-    log.info("Deleting resource {}", fileInFs);
-    FileSystem sfs = sliderFileSystem.getFileSystem();
-    require(sfs.exists(fileInFs), "No resource to delete found at %s", fileInFs.toUri());
-    sfs.delete(fileInFs, true);
-
-    return EXIT_SUCCESS;
-  }
-
-  private int actionInstallResource(ActionResourceArgs resourceInfo)
-      throws BadCommandArgumentsException, IOException {
-    Path srcFile = null;
-    String folder = resourceInfo.folder != null ? resourceInfo.folder : StringUtils.EMPTY;
-
-    requireArgumentSet(Arguments.ARG_RESOURCE, resourceInfo.resource);
-    File file = new File(resourceInfo.resource);
-    require(file.isFile() || file.isDirectory(),
-        "Unable to access supplied file at %s", file.getAbsolutePath());
-
-    File[] files;
-    if (file.isDirectory()) {
-      files = file.listFiles();
-    } else {
-      files = new File[] { file };
-    }
-
-    Path pkgPath = sliderFileSystem.buildResourcePath(folder);
-    FileSystem sfs = sliderFileSystem.getFileSystem();
-
-    if (!sfs.exists(pkgPath)) {
-      sfs.mkdirs(pkgPath);
-      sfs.setPermission(pkgPath, new FsPermission(
-          FsAction.ALL, FsAction.NONE, FsAction.NONE));
-    } else {
-      require(sfs.isDirectory(pkgPath), "Specified folder %s exists and is " +
-          "not a directory", folder);
-    }
-
-    for (File f : files) {
-      srcFile = new Path(f.toURI());
-
-      Path fileInFs = new Path(pkgPath, srcFile.getName());
-      log.info("Installing file {} at {} and overwrite is {}.",
-          srcFile, fileInFs, resourceInfo.overwrite);
-      require(!(sfs.exists(fileInFs) && !resourceInfo.overwrite),
-          "File exists at %s. Use --overwrite to overwrite.", fileInFs.toUri());
-
-      sfs.copyFromLocalFile(false, resourceInfo.overwrite, srcFile, fileInFs);
-      sfs.setPermission(fileInFs,
-          new FsPermission(FsAction.READ_WRITE, FsAction.NONE, FsAction.NONE));
-    }
-
-    return EXIT_SUCCESS;
-  }
-
-  @Override
-  public int actionClient(ActionClientArgs clientInfo) throws
-      YarnException,
-      IOException {
-    if (clientInfo.install) {
-      return doClientInstall(clientInfo);
-    } else if (clientInfo.getCertStore) {
-      return doCertificateStoreRetrieval(clientInfo);
-    } else {
-      throw new BadCommandArgumentsException(
-          "Only install, keystore, and truststore commands are supported for the client.\n"
-          + CommonArgs.usage(serviceArgs, ACTION_CLIENT));
-
-    }
-  }
-
-  private int doCertificateStoreRetrieval(ActionClientArgs clientInfo)
-      throws YarnException, IOException {
-    if (clientInfo.keystore != null && clientInfo.truststore != null) {
-      throw new BadCommandArgumentsException(
-          "Only one of either keystore or truststore can be retrieved at one time.  "
-          + "Retrieval of both should be done separately\n"
-          + CommonArgs.usage(serviceArgs, ACTION_CLIENT));
-    }
-
-    requireArgumentSet(Arguments.ARG_NAME, clientInfo.name);
-
-    File storeFile = null;
-    SecurityStore.StoreType type;
-    if (clientInfo.keystore != null) {
-      storeFile = clientInfo.keystore;
-      type = SecurityStore.StoreType.keystore;
-    } else {
-      storeFile = clientInfo.truststore;
-      type = SecurityStore.StoreType.truststore;
-    }
-
-    require (!storeFile.exists(),
-        "File %s already exists.  Please remove that file or select a different file name.",
-         storeFile.getAbsolutePath());
-    String hostname = null;
-    if (type == SecurityStore.StoreType.keystore) {
-      hostname = clientInfo.hostname;
-      if (hostname == null) {
-        hostname = InetAddress.getLocalHost().getCanonicalHostName();
-        log.info("No hostname specified via command line. Using {}", hostname);
-      }
-    }
-
-    String password = clientInfo.password;
-    if (password == null) {
-      String provider = clientInfo.provider;
-      String alias = clientInfo.alias;
-      if (provider != null && alias != null) {
-        Configuration conf = new Configuration(getConfig());
-        conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, provider);
-        char[] chars = conf.getPassword(alias);
-        if (chars == null) {
-          CredentialProvider credentialProvider =
-              CredentialProviderFactory.getProviders(conf).get(0);
-          chars = readOnePassword(alias);
-          credentialProvider.createCredentialEntry(alias, chars);
-          credentialProvider.flush();
-        }
-        password = String.valueOf(chars);
-        Arrays.fill(chars, ' ');
-      } else {
-        log.info("No password and no provider/alias pair were provided, " +
-            "prompting for password");
-        // get a password
-        password = String.valueOf(readOnePassword(type.name()));
-      }
-    }
-
-    byte[] keystore = createClusterOperations(clientInfo.name)
-        .getClientCertificateStore(hostname, "client", password, type.name());
-    // persist to file
-    FileOutputStream storeFileOutputStream = null;
-    try {
-      storeFileOutputStream = new FileOutputStream(storeFile);
-      IOUtils.write(keystore, storeFileOutputStream);
-    } catch (Exception e) {
-      log.error("Unable to persist to file {}", storeFile);
-      throw e;
-    } finally {
-      if (storeFileOutputStream != null) {
-        storeFileOutputStream.close();
-      }
-    }
-
-    return EXIT_SUCCESS;
-  }
-
-  private int doClientInstall(ActionClientArgs clientInfo)
-      throws IOException, SliderException {
-
-    require(clientInfo.installLocation != null,
-          E_INVALID_INSTALL_LOCATION +"\n"
-          + CommonArgs.usage(serviceArgs, ACTION_CLIENT));
-    require(clientInfo.installLocation.exists(),
-        E_INSTALL_PATH_DOES_NOT_EXIST + ": " + clientInfo.installLocation.getAbsolutePath());
-
-    require(clientInfo.installLocation.isDirectory(),
-        E_INVALID_INSTALL_PATH + ": " + clientInfo.installLocation.getAbsolutePath());
-
-    File pkgFile;
-    File tmpDir = null;
-
-    require(isSet(clientInfo.packageURI) || isSet(clientInfo.name),
-        E_INVALID_APPLICATION_PACKAGE_LOCATION);
-    if (isSet(clientInfo.packageURI)) {
-      pkgFile = new File(clientInfo.packageURI);
-    } else {
-      Path appDirPath = sliderFileSystem.buildAppDefDirPath(clientInfo.name);
-      Path appDefPath = new Path(appDirPath, SliderKeys.DEFAULT_APP_PKG);
-      require(sliderFileSystem.isFile(appDefPath),
-          E_INVALID_APPLICATION_PACKAGE_LOCATION);
-      tmpDir = Files.createTempDir();
-      pkgFile = new File(tmpDir, SliderKeys.DEFAULT_APP_PKG);
-      sliderFileSystem.copyHdfsFileToLocal(appDefPath, pkgFile);
-    }
-    require(pkgFile.isFile(),
-        E_UNABLE_TO_READ_SUPPLIED_PACKAGE_FILE + " at %s", pkgFile.getAbsolutePath());
-
-    JSONObject config = null;
-    if(clientInfo.clientConfig != null) {
-      try {
-        byte[] encoded = Files.toByteArray(clientInfo.clientConfig);
-        config = new JSONObject(new String(encoded, Charset.defaultCharset()));
-      } catch (JSONException jsonEx) {
-        log.error("Unable to read supplied configuration at {}: {}",
-            clientInfo.clientConfig, jsonEx);
-        log.debug("Unable to read supplied configuration at {}: {}",
-            clientInfo.clientConfig, jsonEx, jsonEx);
-        throw new BadConfigException(E_MUST_BE_A_VALID_JSON_FILE, jsonEx);
-      }
-    }
-
-    // Only INSTALL is supported
-    AbstractClientProvider
-        provider = createClientProvider(SliderProviderFactory.DEFAULT_CLUSTER_TYPE);
-    provider.processClientOperation(sliderFileSystem,
-        getRegistryOperations(),
-        getConfig(),
-        "INSTALL",
-        clientInfo.installLocation,
-        pkgFile,
-        config,
-        clientInfo.name);
-    return EXIT_SUCCESS;
-  }
-
-
-  @Override
-  public int actionPackage(ActionPackageArgs actionPackageInfo)
-      throws YarnException, IOException {
-    initializeOutputStream(actionPackageInfo.out);
-    int exitCode = -1;
-    if (actionPackageInfo.help) {
-      exitCode = actionHelp(ACTION_PACKAGE);
-    }
-    if (actionPackageInfo.install) {
-      exitCode = actionPackageInstall(actionPackageInfo);
-    }
-    if (actionPackageInfo.delete) {
-      exitCode = actionPackageDelete(actionPackageInfo);
-    }
-    if (actionPackageInfo.list) {
-      exitCode = actionPackageList();
-    }
-    if (actionPackageInfo.instances) {
-      exitCode = actionPackageInstances();
-    }
-    finalizeOutputStream(actionPackageInfo.out);
-    if (exitCode != -1) {
-      return exitCode;
-    }
-    throw new BadCommandArgumentsException(
-        "Select valid package operation option");
-  }
-
-  private void initializeOutputStream(String outFile)
-      throws FileNotFoundException {
-    if (outFile != null) {
-      clientOutputStream = new PrintStream(new FileOutputStream(outFile));
-    } else {
-      clientOutputStream = System.out;
-    }
-  }
-
-  private void finalizeOutputStream(String outFile) {
-    if (outFile != null && clientOutputStream != null) {
-      clientOutputStream.flush();
-      clientOutputStream.close();
-    }
-    clientOutputStream = System.out;
-  }
-
-  private int actionPackageInstances() throws YarnException, IOException {
-    Map<String, Path> persistentInstances = sliderFileSystem
-        .listPersistentInstances();
-    if (persistentInstances.isEmpty()) {
-      log.info("No slider cluster specification available");
-      return EXIT_SUCCESS;
-    }
-    String pkgPathValue = sliderFileSystem
-        .buildPackageDirPath(StringUtils.EMPTY, StringUtils.EMPTY).toUri()
-        .getPath();
-    FileSystem fs = sliderFileSystem.getFileSystem();
-    Iterator<Map.Entry<String, Path>> instanceItr = persistentInstances
-        .entrySet().iterator();
-    log.info("List of applications with its package name and path");
-    println("%-25s  %15s  %30s  %s", "Cluster Name", "Package Name",
-        "Package Version", "Application Location");
-    while(instanceItr.hasNext()) {
-      Map.Entry<String, Path> entry = instanceItr.next();
-      String clusterName = entry.getKey();
-      Path clusterPath = entry.getValue();
-      AggregateConf instanceDefinition = loadInstanceDefinitionUnresolved(
-          clusterName, clusterPath);
-      Path appDefPath = null;
-      try {
-        appDefPath = new Path(
-            getApplicationDefinitionPath(instanceDefinition
-                .getAppConfOperations()));
-      } catch (BadConfigException e) {
-        // Invalid cluster state, so move on to next. No need to log anything
-        // as this is just listing of instances.
-        continue;
-      }
-      if (!appDefPath.isUriPathAbsolute()) {
-        appDefPath = new Path(fs.getHomeDirectory(), appDefPath);
-      }
-      String appDefPathStr = appDefPath.toUri().toString();
-      try {
-        if (appDefPathStr.contains(pkgPathValue) && fs.isFile(appDefPath)) {
-          String packageName = appDefPath.getParent().getName();
-          String packageVersion = StringUtils.EMPTY;
-          if (instanceDefinition.isVersioned()) {
-            packageVersion = packageName;
-            packageName = appDefPath.getParent().getParent().getName();
-          }
-          println("%-25s  %15s  %30s  %s", clusterName, packageName,
-              packageVersion, appDefPathStr);
-        }
-      } catch (IOException e) {
-        log.debug("{} application definition path {} is not found.", clusterName, appDefPathStr);
-      }
-    }
-    return EXIT_SUCCESS;
-  }
-
-  private int actionPackageList() throws IOException {
-    Path pkgPath = sliderFileSystem.buildPackageDirPath(StringUtils.EMPTY,
-        StringUtils.EMPTY);
-    log.info("Package install path : {}", pkgPath);
-    FileSystem sfs = sliderFileSystem.getFileSystem();
-    if (!sfs.isDirectory(pkgPath)) {
-      log.info("No package(s) installed");
-      return EXIT_SUCCESS;
-    }
-    FileStatus[] fileStatus = sfs.listStatus(pkgPath);
-    boolean hasPackage = false;
-    StringBuilder sb = new StringBuilder();
-    sb.append("List of installed packages:\n");
-    for (FileStatus fstat : fileStatus) {
-      if (fstat.isDirectory()) {
-        sb.append("\t").append(fstat.getPath().getName());
-        sb.append("\n");
-        hasPackage = true;
-      }
-    }
-    if (hasPackage) {
-      println(sb.toString());
-    } else {
-      log.info("No package(s) installed");
-    }
-    return EXIT_SUCCESS;
-  }
-
-  private void createSummaryMetainfoFile(Path srcFile, Path destFile,
-      boolean overwrite) throws IOException {
-    FileSystem srcFs = srcFile.getFileSystem(getConfig());
-    try (InputStream inputStreamJson = SliderUtils
-        .getApplicationResourceInputStream(srcFs, srcFile, "metainfo.json");
-        InputStream inputStreamXml = SliderUtils
-            .getApplicationResourceInputStream(srcFs, srcFile, "metainfo.xml");) {
-      InputStream inputStream = null;
-      Path summaryFileInFs = null;
-      if (inputStreamJson != null) {
-        inputStream = inputStreamJson;
-        summaryFileInFs = new Path(destFile.getParent(), destFile.getName()
-            + ".metainfo.json");
-        log.info("Found JSON metainfo file in package");
-      } else if (inputStreamXml != null) {
-        inputStream = inputStreamXml;
-        summaryFileInFs = new Path(destFile.getParent(), destFile.getName()
-            + ".metainfo.xml");
-        log.info("Found XML metainfo file in package");
-      }
-      if (inputStream != null) {
-        try (FSDataOutputStream dataOutputStream = sliderFileSystem
-            .getFileSystem().create(summaryFileInFs, overwrite)) {
-          log.info("Creating summary metainfo file");
-          IOUtils.copy(inputStream, dataOutputStream);
-        }
-      }
-    }
-  }
-
-  private int actionPackageInstall(ActionPackageArgs actionPackageArgs)
-      throws YarnException, IOException {
-    requireArgumentSet(Arguments.ARG_NAME, actionPackageArgs.name);
-
-    Path srcFile = extractPackagePath(actionPackageArgs.packageURI);
-
-    Path pkgPath = sliderFileSystem.buildPackageDirPath(actionPackageArgs.name,
-        actionPackageArgs.version);
-    FileSystem fs = sliderFileSystem.getFileSystem();
-    if (!fs.exists(pkgPath)) {
-      fs.mkdirs(pkgPath);
-    }
-
-    Path fileInFs = new Path(pkgPath, srcFile.getName());
-    require(actionPackageArgs.replacePkg || !fs.exists(fileInFs),
-        E_PACKAGE_EXISTS +" at  %s. Use --replacepkg to overwrite.", fileInFs.toUri());
-
-    log.info("Installing package {} to {} (overwrite set to {})", srcFile,
-        fileInFs, actionPackageArgs.replacePkg);
-    fs.copyFromLocalFile(false, actionPackageArgs.replacePkg, srcFile, fileInFs);
-    createSummaryMetainfoFile(srcFile, fileInFs, actionPackageArgs.replacePkg);
-
-    String destPathWithHomeDir = Path
-        .getPathWithoutSchemeAndAuthority(fileInFs).toString();
-    String destHomeDir = Path.getPathWithoutSchemeAndAuthority(
-        fs.getHomeDirectory()).toString();
-    // a somewhat contrived approach to stripping out the home directory and any trailing
-    // separator; designed to work on windows and unix
-    String destPathWithoutHomeDir;
-    if (destPathWithHomeDir.startsWith(destHomeDir)) {
-      destPathWithoutHomeDir = destPathWithHomeDir.substring(destHomeDir.length());
-      if (destPathWithoutHomeDir.startsWith("/") || destPathWithoutHomeDir.startsWith("\\")) {
-        destPathWithoutHomeDir = destPathWithoutHomeDir.substring(1);
-      }
-    } else {
-      destPathWithoutHomeDir = destPathWithHomeDir;
-    }
-    log.info("Set " + AgentKeys.APP_DEF + " in your app config JSON to {}",
-        destPathWithoutHomeDir);
-
-    return EXIT_SUCCESS;
-  }
-
-  private Path extractPackagePath(String packageURI)
-      throws BadCommandArgumentsException {
-    require(isSet(packageURI), E_INVALID_APPLICATION_PACKAGE_LOCATION);
-    File pkgFile = new File(packageURI);
-    require(pkgFile.isFile(),
-        E_UNABLE_TO_READ_SUPPLIED_PACKAGE_FILE + ":  " + pkgFile.getAbsolutePath());
-    return new Path(pkgFile.toURI());
-  }
-
-  private int actionPackageDelete(ActionPackageArgs actionPackageArgs) throws
-      YarnException, IOException {
-    requireArgumentSet(Arguments.ARG_NAME, actionPackageArgs.name);
-
-    Path pkgPath = sliderFileSystem.buildPackageDirPath(actionPackageArgs.name,
-        actionPackageArgs.version);
-    FileSystem fs = sliderFileSystem.getFileSystem();
-    require(fs.exists(pkgPath), E_PACKAGE_DOES_NOT_EXIST +": %s ", pkgPath.toUri());
-    log.info("Deleting package {} at {}.", actionPackageArgs.name, pkgPath);
-
-    if(fs.delete(pkgPath, true)) {
-      log.info("Deleted package {} " + actionPackageArgs.name);
-      return EXIT_SUCCESS;
-    } else {
-      log.warn("Package deletion failed.");
-      return EXIT_NOT_FOUND;
-    }
-  }
-
-  @Override
-  public int actionUpdate(String clustername,
-      AbstractClusterBuildingActionArgs buildInfo) throws
-      YarnException, IOException {
-    buildInstanceDefinition(clustername, buildInfo, true, true);
-    return EXIT_SUCCESS; 
-  }
-
-  /**
-   * Build up the AggregateConfiguration for an application instance then
-   * persists it
-   * @param clustername name of the cluster
-   * @param buildInfo the arguments needed to build the cluster
-   * @param overwrite true if existing cluster directory can be overwritten
-   * @param liveClusterAllowed true if live cluster can be modified
-   * @throws YarnException
-   * @throws IOException
-   */
-
-  public void buildInstanceDefinition(String clustername,
-      AbstractClusterBuildingActionArgs buildInfo, boolean overwrite,
-      boolean liveClusterAllowed) throws YarnException, IOException {
-    buildInstanceDefinition(clustername, buildInfo, overwrite,
-        liveClusterAllowed, false);
-  }
-
-  public void buildInstanceDefinition(String clustername,
-      AbstractClusterBuildingActionArgs buildInfo, boolean overwrite,
-      boolean liveClusterAllowed, boolean isUpgradeFlow) throws YarnException,
-      IOException {
-    // verify that a live cluster isn't there
-    validateClusterName(clustername);
-    verifyBindingsDefined();
-    if (!liveClusterAllowed) {
-      verifyNoLiveClusters(clustername, "Create");
-    }
-
-    Configuration conf = getConfig();
-    String registryQuorum = lookupZKQuorum();
-
-    Path appconfdir = buildInfo.getConfdir();
-    // Provider
-    String providerName = buildInfo.getProvider();
-    requireArgumentSet(Arguments.ARG_PROVIDER, providerName);
-    log.debug("Provider is {}", providerName);
-    SliderAMClientProvider sliderAM = new SliderAMClientProvider(conf);
-    AbstractClientProvider provider =
-      createClientProvider(providerName);
-    InstanceBuilder builder =
-      new InstanceBuilder(sliderFileSystem, 
-                          getConfig(),
-                          clustername);
-    
-    AggregateConf instanceDefinition = new AggregateConf();
-    ConfTreeOperations appConf = instanceDefinition.getAppConfOperations();
-    ConfTreeOperations resources = instanceDefinition.getResourceOperations();
-    ConfTreeOperations internal = instanceDefinition.getInternalOperations();
-    //initial definition is set by the providers 
-    sliderAM.prepareInstanceConfiguration(instanceDefinition);
-    provider.prepareInstanceConfiguration(instanceDefinition);
-
-    //load in any specified on the command line
-    if (buildInfo.resources != null) {
-      try {
-        resources.mergeFile(buildInfo.resources,
-                            new ResourcesInputPropertiesValidator());
-
-      } catch (IOException e) {
-        throw new BadConfigException(e,
-               "incorrect argument to %s: \"%s\" : %s ", 
-                                     Arguments.ARG_RESOURCES,
-                                     buildInfo.resources,
-                                     e.toString());
-      }
-    }
-    if (buildInfo.template != null) {
-      try {
-        appConf.mergeFile(buildInfo.template,
-                          new TemplateInputPropertiesValidator());
-      } catch (IOException e) {
-        throw new BadConfigException(e,
-                                     "incorrect argument to %s: \"%s\" : %s ",
-                                     Arguments.ARG_TEMPLATE,
-                                     buildInfo.template,
-                                     e.toString());
-      }
-    }
-
-    if (isUpgradeFlow) {
-      ActionUpgradeArgs upgradeInfo = (ActionUpgradeArgs) buildInfo;
-      if (!upgradeInfo.force) {
-        validateClientAndClusterResource(clustername, resources);
-      }
-    }
-
-    //get the command line options
-    ConfTree cmdLineAppOptions = buildInfo.buildAppOptionsConfTree();
-    ConfTree cmdLineResourceOptions = buildInfo.buildResourceOptionsConfTree();
-
-    appConf.merge(cmdLineAppOptions);
-
-    AppDefinitionPersister appDefinitionPersister = new AppDefinitionPersister(sliderFileSystem);
-    appDefinitionPersister.processSuppliedDefinitions(clustername, buildInfo, appConf);
-
-    // put the role counts into the resources file
-    Map<String, String> argsRoleMap = buildInfo.getComponentMap();
-    for (Map.Entry<String, String> roleEntry : argsRoleMap.entrySet()) {
-      String count = roleEntry.getValue();
-      String key = roleEntry.getKey();
-      log.info("{} => {}", key, count);
-      resources.getOrAddComponent(key).put(COMPONENT_INSTANCES, count);
-    }
-
-    //all CLI role options
-    Map<String, Map<String, String>> appOptionMap =
-      buildInfo.getCompOptionMap();
-    appConf.mergeComponents(appOptionMap);
-
-    //internal picks up core. values only
-    internal.propagateGlobalKeys(appConf, "slider.");
-    internal.propagateGlobalKeys(appConf, "internal.");
-
-    //copy over role. and yarn. values ONLY to the resources
-    if (PROPAGATE_RESOURCE_OPTION) {
-      resources.propagateGlobalKeys(appConf, "component.");
-      resources.propagateGlobalKeys(appConf, "role.");
-      resources.propagateGlobalKeys(appConf, "yarn.");
-      resources.mergeComponentsPrefix(appOptionMap, "component.", true);
-      resources.mergeComponentsPrefix(appOptionMap, "yarn.", true);
-      resources.mergeComponentsPrefix(appOptionMap, "role.", true);
-    }
-
-    // resource component args
-    appConf.merge(cmdLineResourceOptions);
-    resources.merge(cmdLineResourceOptions);
-    resources.mergeComponents(buildInfo.getResourceCompOptionMap());
-
-    builder.init(providerName, instanceDefinition);
-    builder.resolve();
-    builder.propagateFilename();
-    builder.propagatePrincipals();
-    builder.setImageDetailsIfAvailable(buildInfo.getImage(),
-                                       buildInfo.getAppHomeDir());
-    builder.setQueue(buildInfo.queue);
-
-    String quorum = buildInfo.getZKhosts();
-    if (isUnset(quorum)) {
-      quorum = registryQuorum;
-    }
-    if (isUnset(quorum)) {
-      throw new BadConfigException(E_NO_ZOOKEEPER_QUORUM);
-    }
-    ZKPathBuilder zkPaths = new ZKPathBuilder(getAppName(),
-        getUsername(),
-        clustername,
-        registryQuorum,
-        quorum);
-    String zookeeperRoot = buildInfo.getAppZKPath();
-
-    if (isSet(zookeeperRoot)) {
-      zkPaths.setAppPath(zookeeperRoot);
-    } else {
-      String createDefaultZkNode = appConf.getGlobalOptions()
-          .getOption(AgentKeys.CREATE_DEF_ZK_NODE, "false");
-      if (createDefaultZkNode.equals("true")) {
-        String defaultZKPath = createZookeeperNode(clustername, false);
-        log.debug("ZK node created for application instance: {}", defaultZKPath);
-        if (defaultZKPath != null) {
-          zkPaths.setAppPath(defaultZKPath);
-        }
-      } else {
-        // create AppPath if default is being used
-        String defaultZKPath = createZookeeperNode(clustername, true);
-        log.debug("ZK node assigned to application instance: {}", defaultZKPath);
-        zkPaths.setAppPath(defaultZKPath);
-      }
-    }
-
-    builder.addZKBinding(zkPaths);
-
-    //then propagate any package URI
-    if (buildInfo.packageURI != null) {
-      appConf.set(AgentKeys.PACKAGE_PATH, buildInfo.packageURI);
-    }
-
-    propagatePythonExecutable(conf, instanceDefinition);
-
-    // make any substitutions needed at this stage
-    replaceTokens(appConf.getConfTree(), getUsername(), clustername);
-
-    // TODO: Refactor the validation code and persistence code
-    try {
-      persistInstanceDefinition(overwrite, appconfdir, builder);
-      appDefinitionPersister.persistPackages();
-
-    } catch (LockAcquireFailedException e) {
-      log.warn("Failed to get a Lock on {} : {}", builder, e, e);
-      throw new BadClusterStateException("Failed to save " + clustername
-                                         + ": " + e);
-    }
-
-    // providers to validate what there is
-    // TODO: Validation should be done before persistence
-    AggregateConf instanceDescription = builder.getInstanceDescription();
-    validateInstanceDefinition(sliderAM, instanceDescription, sliderFileSystem);
-    validateInstanceDefinition(provider, instanceDescription, sliderFileSystem);
-  }
-
-  private void validateClientAndClusterResource(String clustername,
-      ConfTreeOperations clientResources) throws BadClusterStateException,
-      SliderException, IOException {
-    log.info("Validating upgrade resource definition with current cluster "
-        + "state (components and instance count)");
-    Map<String, Integer> clientComponentInstances = new HashMap<>();
-    for (String componentName : clientResources.getComponentNames()) {
-      if (!SliderKeys.COMPONENT_AM.equals(componentName)) {
-        clientComponentInstances.put(componentName, clientResources
-            .getComponentOptInt(componentName,
-                COMPONENT_INSTANCES, -1));
-      }
-    }
-
-    AggregateConf clusterConf = null;
-    try {
-      clusterConf = loadPersistedClusterDescription(clustername);
-    } catch (LockAcquireFailedException e) {
-      log.warn("Failed to get a Lock on cluster resource : {}", e, e);
-      throw new BadClusterStateException(
-          "Failed to load client resource definition " + clustername + ": " + e, e);
-    }
-    Map<String, Integer> clusterComponentInstances = new HashMap<>();
-    for (Map.Entry<String, Map<String, String>> component : clusterConf
-        .getResources().components.entrySet()) {
-      if (!SliderKeys.COMPONENT_AM.equals(component.getKey())) {
-        clusterComponentInstances.put(
-            component.getKey(),
-            Integer.decode(component.getValue().get(
-                COMPONENT_INSTANCES)));
-      }
-    }
-
-    // client and cluster should be an exact match
-    Iterator<Map.Entry<String, Integer>> clientComponentInstanceIt = clientComponentInstances
-        .entrySet().iterator();
-    while (clientComponentInstanceIt.hasNext()) {
-      Map.Entry<String, Integer> clientComponentInstanceEntry = clientComponentInstanceIt.next();
-      if (clusterComponentInstances.containsKey(clientComponentInstanceEntry.getKey())) {
-        // compare instance count now and remove from both maps if they match
-        if (clusterComponentInstances
-            .get(clientComponentInstanceEntry.getKey()).intValue() == clientComponentInstanceEntry
-            .getValue().intValue()) {
-          clusterComponentInstances.remove(clientComponentInstanceEntry
-              .getKey());
-          clientComponentInstanceIt.remove();
-        }
-      }
-    }
-
-    if (!clientComponentInstances.isEmpty()
-        || !clusterComponentInstances.isEmpty()) {
-      log.error("Mismatch found in upgrade resource definition and cluster "
-          + "resource state");
-      if (!clientComponentInstances.isEmpty()) {
-        log.info("The upgrade resource definitions that do not match are:");
-        for (Map.Entry<String, Integer> clientComponentInstanceEntry : clientComponentInstances
-            .entrySet()) {
-          log.info("    Component Name: {}, Instance count: {}",
-              clientComponentInstanceEntry.getKey(),
-              clientComponentInstanceEntry.getValue());
-        }
-      }
-      if (!clusterComponentInstances.isEmpty()) {
-        log.info("The cluster resources that do not match are:");
-        for (Map.Entry<String, Integer> clusterComponentInstanceEntry : clusterComponentInstances
-            .entrySet()) {
-          log.info("    Component Name: {}, Instance count: {}",
-              clusterComponentInstanceEntry.getKey(),
-              clusterComponentInstanceEntry.getValue());
-        }
-      }
-      throw new BadConfigException("Resource definition provided for "
-          + "upgrade does not match with that of the currently running "
-          + "cluster.\nIf you are aware of what you are doing, rerun the "
-          + "command with " + Arguments.ARG_FORCE + " option.");
-    }
-  }
-
-  protected void persistInstanceDefinition(boolean overwrite,
-                                         Path appconfdir,
-                                         InstanceBuilder builder)
-      throws IOException, SliderException, LockAcquireFailedException {
-    builder.persist(appconfdir, overwrite);
-  }
-
-  @VisibleForTesting
-  public static void replaceTokens(ConfTree conf,
-      String userName, String clusterName) throws IOException {
-    Map<String,String> newglobal = new HashMap<>();
-    for (Entry<String,String> entry : conf.global.entrySet()) {
-      newglobal.put(entry.getKey(), replaceTokens(entry.getValue(),
-          userName, clusterName));
-    }
-    conf.global.putAll(newglobal);
-
-    for (String component : conf.components.keySet()) {
-      Map<String,String> newComponent = new HashMap<>();
-      for (Entry<String,String> entry : conf.components.get(component).entrySet()) {
-        newComponent.put(entry.getKey(), replaceTokens(entry.getValue(),
-            userName, clusterName));
-      }
-      conf.components.get(component).putAll(newComponent);
-    }
-
-    Map<String,List<String>> newcred = new HashMap<>();
-    for (Entry<String,List<String>> entry : conf.credentials.entrySet()) {
-      List<String> resultList = new ArrayList<>();
-      for (String v : entry.getValue()) {
-        resultList.add(replaceTokens(v, userName, clusterName));
-      }
-      newcred.put(replaceTokens(entry.getKey(), userName, clusterName),
-          resultList);
-    }
-    conf.credentials.clear();
-    conf.credentials.putAll(newcred);
-  }
-
-  private static String replaceTokens(String s, String userName,
-      String clusterName) throws IOException {
-    return s.replaceAll(Pattern.quote("${USER}"), userName)
-        .replaceAll(Pattern.quote("${USER_NAME}"), userName);
-  }
-
-  public FsPermission getClusterDirectoryPermissions(Configuration conf) {
-    String clusterDirPermsOct =
-      conf.get(CLUSTER_DIRECTORY_PERMISSIONS, DEFAULT_CLUSTER_DIRECTORY_PERMISSIONS);
-    return new FsPermission(clusterDirPermsOct);
-  }
-
-  /**
-   * Verify that the Resource Manager is configured (on a non-HA cluster).
-   * with a useful error message
-   * @throws BadCommandArgumentsException the exception raised on an invalid config
-   */
-  public void verifyBindingsDefined() throws BadCommandArgumentsException {
-    InetSocketAddress rmAddr = getRmAddress(getConfig());
-    if (!getConfig().getBoolean(YarnConfiguration.RM_HA_ENABLED, false)
-     && !isAddressDefined(rmAddr)) {
-      throw new BadCommandArgumentsException(
-        E_NO_RESOURCE_MANAGER
-        + " in the argument "
-        + Arguments.ARG_MANAGER
-        + " or the configuration property "
-        + YarnConfiguration.RM_ADDRESS 
-        + " value :" + rmAddr);
-    }
-  }
-
-  /**
-   * Load and start a cluster specification.
-   * This assumes that all validation of args and cluster state
-   * have already taken place
-   *
-   * @param clustername name of the cluster.
-   * @param launchArgs launch arguments
-   * @return the exit code
-   * @throws YarnException
-   * @throws IOException
-   */
-  protected int startCluster(String clustername,
-                           LaunchArgsAccessor launchArgs) throws
-                                                          YarnException,
-                                                          IOException {
-    Path clusterDirectory = sliderFileSystem.buildClusterDirPath(clustername);
-    AggregateConf instanceDefinition = loadInstanceDefinitionUnresolved(
-      clustername,
-      clusterDirectory);
-
-    LaunchedApplication launchedApplication =
-      launchApplication(clustername, clusterDirectory, instanceDefinition,
-                        serviceArgs.isDebug());
-
-    if (launchArgs.getOutputFile() != null) {
-      // output file has been requested. Get the app report and serialize it
-      ApplicationReport report =
-          launchedApplication.getApplicationReport();
-      SerializedApplicationReport sar = new SerializedApplicationReport(report);
-      sar.submitTime = System.currentTimeMillis();
-      ApplicationReportSerDeser serDeser = new ApplicationReportSerDeser();
-      serDeser.save(sar, launchArgs.getOutputFile());
-    }
-    int waittime = launchArgs.getWaittime();
-    if (waittime > 0) {
-      return waitForAppRunning(launchedApplication, waittime, waittime);
-    } else {
-      // no waiting
-      return EXIT_SUCCESS;
-    }
-  }
-
-  /**
-   * Load the instance definition. It is not resolved at this point
-   * @param name cluster name
-   * @param clusterDirectory cluster dir
-   * @return the loaded configuration
-   * @throws IOException
-   * @throws SliderException
-   * @throws UnknownApplicationInstanceException if the file is not found
-   */
-  public AggregateConf loadInstanceDefinitionUnresolved(String name,
-            Path clusterDirectory) throws IOException, SliderException {
-
-    try {
-      AggregateConf definition =
-        InstanceIO.loadInstanceDefinitionUnresolved(sliderFileSystem,
-                                                    clusterDirectory);
-      definition.setName(name);
-      return definition;
-    } catch (FileNotFoundException e) {
-      throw UnknownApplicationInstanceException.unknownInstance(name, e);
-    }
-  }
-
-  /**
-   * Load the instance definition. 
-   * @param name cluster name
-   * @param resolved flag to indicate the cluster should be resolved
-   * @return the loaded configuration
-   * @throws IOException IO problems
-   * @throws SliderException slider explicit issues
-   * @throws UnknownApplicationInstanceException if the file is not found
-   */
-    public AggregateConf loadInstanceDefinition(String name,
-        boolean resolved) throws
-        IOException,
-        SliderException {
-
-    Path clusterDirectory = sliderFileSystem.buildClusterDirPath(name);
-    AggregateConf instanceDefinition = loadInstanceDefinitionUnresolved(
-      name,
-      clusterDirectory);
-    if (resolved) {
-      instanceDefinition.resolve();
-    }
-    return instanceDefinition;
-
-  }
-
-  protected AppMasterLauncher setupAppMasterLauncher(String clustername,
-      Path clusterDirectory,
-      AggregateConf instanceDefinition,
-      boolean debugAM)
-    throws YarnException, IOException{
-    deployedClusterName = clustername;
-    validateClusterName(clustername);
-    verifyNoLiveClusters(clustername, "Launch");
-    Configuration config = getConfig();
-    lookupZKQuorum();
-    boolean clusterSecure = isHadoopClusterSecure(config);
-    //create the Slider AM provider -this helps set up the AM
-    SliderAMClientProvider sliderAM = new SliderAMClientProvider(config);
-
-    instanceDefinition.resolve();
-    launchedInstanceDefinition = instanceDefinition;
-
-    ConfTreeOperations internalOperations = instanceDefinition.getInternalOperations();
-    MapOperations internalOptions = internalOperations.getGlobalOptions();
-    ConfTreeOperations resourceOperations = instanceDefinition.getResourceOperations();
-    ConfTreeOperations appOperations = instanceDefinition.getAppConfOperations();
-    Path generatedConfDirPath =
-      createPathThatMustExist(internalOptions.getMandatoryOption(
-        INTERNAL_GENERATED_CONF_PATH));
-    Path snapshotConfPath =
-      createPathThatMustExist(internalOptions.getMandatoryOption(
-        INTERNAL_SNAPSHOT_CONF_PATH));
-
-
-    // cluster Provider
-    AbstractClientProvider provider = createClientProvider(
-      internalOptions.getMandatoryOption(INTERNAL_PROVIDER_NAME));
-    if (log.isDebugEnabled()) {
-      log.debug(instanceDefinition.toString());
-    }
-    MapOperations sliderAMResourceComponent =
-      resourceOperations.getOrAddComponent(SliderKeys.COMPONENT_AM);
-    MapOperations resourceGlobalOptions = resourceOperations.getGlobalOptions();
-
-    // add the tags if available
-    Set<String> applicationTags = provider.getApplicationTags(sliderFileSystem,
-        getApplicationDefinitionPath(appOperations));
-
-    Credentials credentials = null;
-    if (clusterSecure) {
-      // pick up oozie credentials
-      credentials = CredentialUtils.loadTokensFromEnvironment(System.getenv(),
-          config);
-      if (credentials == null) {
-        // nothing from oozie, so build up directly
-        credentials = new Credentials(
-            UserGroupInformation.getCurrentUser().getCredentials());
-        CredentialUtils.addRMRenewableFSDelegationTokens(config,
-            sliderFileSystem.getFileSystem(),
-            credentials);
-        CredentialUtils.addRMDelegationToken(yarnClient, credentials);
-
-      } else {
-        log.info("Using externally supplied credentials to launch AM");
-      }
-    }
-
-    AppMasterLauncher amLauncher = new AppMasterLauncher(clustername,
-        SliderKeys.APP_TYPE,
-        config,
-        sliderFileSystem,
-        yarnClient,
-        clusterSecure,
-        sliderAMResourceComponent,
-        resourceGlobalOptions,
-        applicationTags,
-        credentials);
-
-    ApplicationId appId = amLauncher.getApplicationId();
-    // set the application name;
-    amLauncher.setKeepContainersOverRestarts(true);
-
-    int maxAppAttempts = config.getInt(KEY_AM_RESTART_LIMIT, 0);
-    amLauncher.setMaxAppAttempts(maxAppAttempts);
-
-    sliderFileSystem.purgeAppInstanceTempFiles(clustername);
-    Path tempPath = sliderFileSystem.createAppInstanceTempPath(
-        clustername,
-        appId.toString() + "/am");
-    String libdir = "lib";
-    Path libPath = new Path(tempPath, libdir);
-    sliderFileSystem.getFileSystem().mkdirs(libPath);
-    log.debug("FS={}, tempPath={}, libdir={}", sliderFileSystem, tempPath, libPath);
- 
-    // set local resources for the application master
-    // local files or archives as needed
-    // In this scenario, the jar file for the application master is part of the local resources
-    Map<String, LocalResource> localResources = amLauncher.getLocalResources();
-    
-    // look for the configuration directory named on the command line
-    boolean hasServerLog4jProperties = false;
-    Path remoteConfPath = null;
-    String relativeConfDir = null;
-    String confdirProp = System.getProperty(SliderKeys.PROPERTY_CONF_DIR);
-    if (isUnset(confdirProp)) {
-      log.debug("No local configuration directory provided as system property");
-    } else {
-      File confDir = new File(confdirProp);
-      if (!confDir.exists()) {
-        throw new BadConfigException(E_CONFIGURATION_DIRECTORY_NOT_FOUND,
-                                     confDir);
-      }
-      Path localConfDirPath = createLocalPath(confDir);
-      remoteConfPath = new Path(clusterDirectory, SliderKeys.SUBMITTED_CONF_DIR);
-      log.debug("Slider configuration directory is {}; remote to be {}", 
-          localConfDirPath, remoteConfPath);
-      copyDirectory(config, localConfDirPath, remoteConfPath, null);
-
-      File log4jserver =
-          new File(confDir, SliderKeys.LOG4J_SERVER_PROP_FILENAME);
-      hasServerLog4jProperties = log4jserver.isFile();
-    }
-    // the assumption here is that minimr cluster => this is a test run
-    // and the classpath can look after itself
-
-    boolean usingMiniMRCluster = getUsingMiniMRCluster();
-    if (!usingMiniMRCluster) {
-
-      log.debug("Destination is not a MiniYARNCluster -copying full classpath");
-
-      // insert conf dir first
-      if (remoteConfPath != null) {
-        relativeConfDir = SliderKeys.SUBMITTED_CONF_DIR;
-        Map<String, LocalResource> submittedConfDir =
-          sliderFileSystem.submitDirectory(remoteConfPath,
-                                         relativeConfDir);
-        mergeMaps(localResources, submittedConfDir);
-      }
-    }
-    // build up the configuration 
-    // IMPORTANT: it is only after this call that site configurations
-    // will be valid.
-
-    propagatePrincipals(config, instanceDefinition);
-    // validate security data
-
-/*
-    // turned off until tested
-    SecurityConfiguration securityConfiguration =
-        new SecurityConfiguration(config,
-            instanceDefinition, clustername);
-    
-*/
-    Configuration clientConfExtras = new Configuration(false);
-    // then build up the generated path.
-    FsPermission clusterPerms = getClusterDirectoryPermissions(config);
-    copyDirectory(config, snapshotConfPath, generatedConfDirPath,
-        clusterPerms);
-
-
-    // standard AM resources
-    sliderAM.prepareAMAndConfigForLaunch(sliderFileSystem,
-                                       config,
-                                       amLauncher,
-                                       instanceDefinition,
-    

<TRUNCATED>


[21/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsBindingService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsBindingService.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsBindingService.java
deleted file mode 100644
index 864a1cf..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsBindingService.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.management;
-
-import com.codahale.metrics.JmxReporter;
-import com.codahale.metrics.Metric;
-import com.codahale.metrics.MetricRegistry;
-import com.codahale.metrics.MetricSet;
-import com.codahale.metrics.ScheduledReporter;
-import com.codahale.metrics.Slf4jReporter;
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.service.CompositeService;
-import org.apache.slider.server.services.workflow.ClosingService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-/**
- * YARN service which hooks up Codahale metrics to 
- * JMX, and, if enabled Ganglia and/or an SLF4J log.
- */
-public class MetricsBindingService extends CompositeService
-    implements MetricsKeys {
-  protected static final Logger log =
-      LoggerFactory.getLogger(MetricsBindingService.class);
-  private final MetricRegistry metrics;
-
-  private String reportingDetails = "not started";
-
-
-  public MetricsBindingService(String name,
-      MetricRegistry metrics) {
-    super(name);
-    Preconditions.checkArgument(metrics != null, "Null metrics");
-    this.metrics = metrics;
-  }
-
-  /**
-   * Instantiate...create a metric registry in the process
-   * @param name service name
-   */
-  public MetricsBindingService(String name) {
-    this(name, new MetricRegistry());
-  }
-
-  /**
-   * Accessor for the metrics instance
-   * @return the metrics
-   */
-  public MetricRegistry getMetrics() {
-    return metrics;
-  }
-
-  @Override
-  protected void serviceStart() throws Exception {
-    super.serviceStart();
-
-    StringBuilder summary = new StringBuilder();
-    Configuration conf = getConfig();
-
-    summary.append("Reporting to JMX");
-    // always start the JMX binding
-    JmxReporter jmxReporter;
-    jmxReporter = JmxReporter.forRegistry(metrics).build();
-    jmxReporter.start();
-    addService(new ClosingService<>(jmxReporter));
-
-
-    // Ganglia
-    if (conf.getBoolean(METRICS_GANGLIA_ENABLED, false)) {
-      log.warn("Ganglia integration is not implemented");
-/*
-      // This is all disabled due to transitive dependencies on an LGPL library
-      com.codahale.metrics.ganglia.GangliaReporter gangliaReporter;
-      String host = conf.getTrimmed(METRICS_GANGLIA_HOST, "");
-      int port = conf.getInt(METRICS_GANGLIA_PORT, DEFAULT_GANGLIA_PORT);
-      int interval = conf.getInt(METRICS_GANGLIA_REPORT_INTERVAL, 60);
-      int ttl = 1;
-      info.ganglia.gmetric4j.gmetric.GMetric.UDPAddressingMode
-          mcast = info.ganglia.gmetric4j.gmetric.GMetric.UDPAddressingMode.getModeForAddress(host);
-      boolean ganglia31 = conf.getBoolean(METRICS_GANGLIA_VERSION_31, true);
-
-      final info.ganglia.gmetric4j.gmetric.GMetric ganglia =
-          new info.ganglia.gmetric4j.gmetric.GMetric(
-              host,
-              port,
-              mcast,
-              ttl,
-              ganglia31);
-      gangliaReporter = com.codahale.metrics.ganglia.GangliaReporter.forRegistry(metrics)
-                                       .convertRatesTo(TimeUnit.SECONDS)
-                                       .convertDurationsTo(
-                                           TimeUnit.MILLISECONDS)
-                                       .build(ganglia);
-      gangliaReporter.start(interval, TimeUnit.SECONDS);
-      addService(new ClosingService<ScheduledReporter>(gangliaReporter));
-      summary.append(String.format(", Ganglia at %s:%d interval=%d",
-          host, port, interval));
-      */
-    }
-
-    // Logging
-    if (conf.getBoolean(METRICS_LOGGING_ENABLED, false)) {
-      ScheduledReporter reporter;
-      String logName =
-          conf.getTrimmed(METRICS_LOGGING_LOG, METRICS_DEFAULT_LOG);
-      int interval = conf.getInt(METRICS_LOGGING_LOG_INTERVAL,
-          METRICS_DEFAULT_LOG_INTERVAL);
-      reporter = Slf4jReporter.forRegistry(metrics)
-                              .convertRatesTo(TimeUnit.SECONDS)
-                              .outputTo(LoggerFactory.getLogger(logName))
-                              .convertDurationsTo(TimeUnit.MILLISECONDS)
-                              .build();
-      reporter.start(interval, TimeUnit.MINUTES);
-      addService(new ClosingService<>(reporter));
-      summary.append(String.format(", SLF4J to log %s interval=%d",
-          logName, interval));
-    }
-    reportingDetails = summary.toString();
-    log.info(reportingDetails);
-  }
-
-
-  @Override
-  public String toString() {
-    return super.toString() + " " + reportingDetails;
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsConstants.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsConstants.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsConstants.java
deleted file mode 100644
index fa6bfc0..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsConstants.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.management;
-
-/**
- * Constants used in slider for metrics registration and lookup
- */
-public class MetricsConstants {
-
-  /**
-   * {@value}
-   */
-  public static final String CONTAINERS_OUTSTANDING_REQUESTS = "containers.outstanding-requests";
-
-  /**
-   * {@value}
-   */
-  public static final String CONTAINERS_STARTED = "containers.started";
-
-  /**
-   * {@value}
-   */
-  public static final String CONTAINERS_SURPLUS = "containers.surplus";
-
-  /**
-   * {@value}
-   */
-  public static final String CONTAINERS_COMPLETED = "containers.completed";
-
-  /**
-   * {@value}
-   */
-  public static final String CONTAINERS_FAILED = "containers.failed";
-
-  /**
-   * {@value}
-   */
-  public static final String CONTAINERS_START_FAILED = "containers.start-failed";
-
-  public static final String PREFIX_SLIDER_ROLES = "slider.roles.";
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsKeys.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsKeys.java
deleted file mode 100644
index 13b3b6b..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsKeys.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.management;
-
-public interface MetricsKeys {
-
-  /**
-   * Prefix for metrics configuration options: {@value}
-   */
-  String METRICS_PREFIX = "slider.metrics.";
-  
-  /**
-   * Boolean to enable Ganglia metrics reporting
-   * {@value}
-   */
-  String METRICS_GANGLIA_ENABLED =
-      METRICS_PREFIX + "ganglia.enabled";
-  /**
-   * {@value}
-   */
-  String METRICS_GANGLIA_HOST = METRICS_PREFIX + "ganglia.host";
-  /**
-   * {@value}
-   */
-  String METRICS_GANGLIA_PORT = METRICS_PREFIX + "ganglia.port";
-  /**
-   * {@value}
-   */
-  String METRICS_GANGLIA_VERSION_31 = METRICS_PREFIX + "ganglia.version-31";
-  /**
-   * {@value}
-   */
-  String METRICS_GANGLIA_REPORT_INTERVAL = METRICS_PREFIX + "ganglia.report.interval";
-  /**
-   * {@value}
-   */
-  int DEFAULT_GANGLIA_PORT = 8649;
-
-
-  /**
-   * Boolean to enable Logging metrics reporting
-   * {@value}
-   */
-  String METRICS_LOGGING_ENABLED =
-      METRICS_PREFIX + "logging.enabled";
-  
-  /**
-   * String name of log to log to
-   * {@value}
-   */
-  String METRICS_LOGGING_LOG =
-      METRICS_PREFIX + "logging.log.name";
-
-  /**
-   * Default log name: {@value}
-   */
-  String METRICS_DEFAULT_LOG = 
-      "org.apache.slider.metrics.log";
-
-
-  /**
-   * Int log interval in seconds
-   * {@value}
-   */
-  String METRICS_LOGGING_LOG_INTERVAL =
-      METRICS_PREFIX + "logging.interval.minutes";
-
-
-  /**
-   * Default log interval: {@value}.
-   * This is a big interval as in a long lived service, log overflows are easy
-   * to create. 
-   */
-  int METRICS_DEFAULT_LOG_INTERVAL = 60;
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/management/PrefixedMetricsSet.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/PrefixedMetricsSet.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/PrefixedMetricsSet.java
deleted file mode 100644
index e9ad46a..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/PrefixedMetricsSet.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.management;
-
-import com.codahale.metrics.Metric;
-import com.codahale.metrics.MetricSet;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * From an existing metrics set, generate a new metrics set with the
- * prefix in front of every key.
- *
- * The prefix is added directly: if you want a '.' between prefix and metric
- * keys, include it in the prefix.
- */
-public class PrefixedMetricsSet implements MetricSet {
-
-  private final String prefix;
-  private final MetricSet source;
-
-  public PrefixedMetricsSet(String prefix, MetricSet source) {
-    this.prefix = prefix;
-    this.source = source;
-  }
-
-  @Override
-  public Map<String, Metric> getMetrics() {
-    Map<String, Metric> sourceMetrics = source.getMetrics();
-    Map<String, Metric> metrics = new HashMap<>(sourceMetrics.size());
-    for (Map.Entry<String, Metric> entry : sourceMetrics.entrySet()) {
-      metrics.put(prefix + "." + entry.getKey(), entry.getValue());
-    }
-    return metrics;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/management/RangeLimitedCounter.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/RangeLimitedCounter.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/RangeLimitedCounter.java
deleted file mode 100644
index 80e88fc..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/RangeLimitedCounter.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.management;
-
-import com.codahale.metrics.Counter;
-import com.codahale.metrics.Counting;
-import com.codahale.metrics.Metric;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * This is a counter whose range can be given a min and a max
- */
-public class RangeLimitedCounter implements Metric, Counting {
-
-  private final AtomicLong value;
-  private final long min, max;
-
-  /**
-   * Instantiate
-   * @param val current value
-   * @param min minimum value
-   * @param max max value (or 0 for no max)
-   */
-  public RangeLimitedCounter(long val, long min, long max) {
-    this.value = new AtomicLong(val);
-    this.min = min;
-    this.max = max;
-  }
-
-  /**
-   * Set to a new value. If below the min, set to the minimum. If the max is non
-   * zero and the value is above that maximum, set it to the maximum instead.
-   * @param val value
-   */
-  public synchronized void set(long val) {
-    if (val < min) {
-      val = min;
-    } else if (max > 0  && val > max) {
-      val = max;
-    }
-    value.set(val);
-  }
-
-  public void inc() {
-    inc(1);
-  }
-
-  public void dec() {
-    dec(1);
-  }
-
-  public synchronized void inc(int delta) {
-    set(value.get() + delta);
-  }
-
-  public synchronized void dec(int delta) {
-    set(value.get() - delta);
-  }
-
-  public long get() {
-    return value.get();
-  }
-
-  @Override
-  public long getCount() {
-    return value.get();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/management/RecordedEvent.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/RecordedEvent.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/RecordedEvent.java
deleted file mode 100644
index d48d337..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/RecordedEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.management;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.text.DateFormat;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class RecordedEvent {
-  private static final DateFormat dateFormat = DateFormat.getDateInstance();
-  public long id;
-  public String name;
-  public long timestamp;
-  public String time;
-  public String category;
-  public String host;
-  public int role;
-  public String text;
-
-  public RecordedEvent() {
-  }
-
-  /**
-   * Create an event. The timestamp is also converted to a time string
-   * @param id id counter
-   * @param name event name
-   * @param timestamp timestamp. If non-zero, is used to build the {@code time} text field.
-   * @param category even category
-   * @param text arbitrary text
-   */
-  public RecordedEvent(long id, String name, long timestamp, String category, String text) {
-    this.id = id;
-    this.name = name;
-    this.timestamp = timestamp;
-    this.time = timestamp > 0 ? dateFormat.format(timestamp) : "";
-    this.category = category;
-    this.text = text;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/management/Timestamp.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/Timestamp.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/Timestamp.java
deleted file mode 100644
index c30e749..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/Timestamp.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.management;
-
-/**
- * A timestamp metric
- */
-public class Timestamp extends LongGauge {
-
-  public Timestamp(long val) {
-    super(val);
-  }
-
-  public Timestamp() {
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/management/YarnServiceHealthCheck.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/YarnServiceHealthCheck.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/YarnServiceHealthCheck.java
deleted file mode 100644
index 936563c..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/YarnServiceHealthCheck.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.management;
-
-import com.codahale.metrics.health.HealthCheck;
-import org.apache.hadoop.service.Service;
-
-public class YarnServiceHealthCheck extends HealthCheck {
-  
-  private final Service service;
-
-  public YarnServiceHealthCheck(Service service) {
-    this.service = service;
-  }
-
-  @Override
-  protected Result check() throws Exception {
-    return service.isInState(Service.STATE.STARTED)
-           ? Result.healthy()
-           : Result.unhealthy("Service is not running: %s", service);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosEntry.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosEntry.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosEntry.java
deleted file mode 100644
index a397e19..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosEntry.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.monkey;
-
-import com.codahale.metrics.Counter;
-import com.codahale.metrics.MetricRegistry;
-import com.google.common.base.Preconditions;
-import org.apache.commons.lang.StringUtils;
-import org.apache.slider.api.InternalKeys;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Entry in the chaos list
- */
-public class ChaosEntry {
-
-  protected static final Logger log =
-      LoggerFactory.getLogger(ChaosEntry.class);
-  public final String name;
-  public final ChaosTarget target;
-  public final long probability;
-
-  private final Counter invocationCounter;
-
-
-  /**
-   * Constructor -includes validation of all arguments
-   * @param name entry name
-   * @param target target
-   * @param probability probability of occurring
-   */
-  public ChaosEntry(String name, ChaosTarget target, long probability,
-      MetricRegistry metrics) {
-    Preconditions.checkArgument(!StringUtils.isEmpty(name), "missing name");
-    Preconditions.checkArgument(target != null, "null target");
-    Preconditions.checkArgument(probability > 0, "negative probability");
-    Preconditions.checkArgument(probability <= InternalKeys.PROBABILITY_PERCENT_100,
-        "probability over 100%: "+ probability);
-    this.name = name;
-    this.target = target;
-    this.probability = probability;
-    invocationCounter =
-        metrics.counter(MetricRegistry.name(ChaosEntry.class, name));
-  }
-
-  /**
-   * Trigger the chaos action
-   */
-  public void invokeChaos() {
-    log.info("Invoking {}", name);
-    invocationCounter.inc();
-    target.chaosAction();
-  }
-
-  /**
-   * Invoke Chaos if the trigger value is in range of the probability
-   * @param value trigger value, 0-10K
-   * @return true if the chaos method was invoked
-   */
-  public boolean maybeInvokeChaos(long value) {
-    log.debug("Probability {} trigger={}", probability, value);
-    if (value < probability) {
-      invokeChaos();
-      return true;
-    }
-    return false;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosKillAM.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosKillAM.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosKillAM.java
deleted file mode 100644
index 3c1a914..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosKillAM.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.monkey;
-
-import org.apache.slider.server.appmaster.actions.ActionHalt;
-import org.apache.slider.server.appmaster.actions.QueueAccess;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Kill the AM
- */
-public class ChaosKillAM implements ChaosTarget {
-
-  public static final int DELAY = 1000;
-  private final QueueAccess queues;
-  private final int exitCode;
-
-  public ChaosKillAM(QueueAccess queues, int exitCode) {
-    this.queues = queues;
-    this.exitCode = exitCode;
-  }
-
-  /**
-   * Trigger a delayed halt
-   */
-  @Override
-  public void chaosAction() {
-    queues.schedule(new ActionHalt(exitCode, "Chaos invoked halt", DELAY,
-        TimeUnit.MILLISECONDS));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosKillContainer.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosKillContainer.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosKillContainer.java
deleted file mode 100644
index ae38e4c..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosKillContainer.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.monkey;
-
-import com.google.common.base.Preconditions;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.server.appmaster.actions.ActionKillContainer;
-import org.apache.slider.server.appmaster.actions.QueueAccess;
-import org.apache.slider.server.appmaster.operations.RMOperationHandler;
-import org.apache.slider.server.appmaster.state.AppState;
-import org.apache.slider.server.appmaster.state.RoleInstance;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Random;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Kill a container
- */
-public class ChaosKillContainer implements ChaosTarget {
-  protected static final Logger log =
-      LoggerFactory.getLogger(ChaosKillContainer.class);
-  public static final int DELAY = 100;
-  private final AppState appState;
-  private final QueueAccess queues;
-  private final Random random = new Random();
-  private final RMOperationHandler operationHandler;
-
-  public ChaosKillContainer(AppState appState,
-      QueueAccess queues,
-      RMOperationHandler operationHandler) {
-    Preconditions.checkNotNull(appState);
-    Preconditions.checkNotNull(queues);
-    this.appState = appState;
-    this.queues = queues;
-    this.operationHandler = operationHandler;
-  }
-
-  /**
-   * Trigger a container kill 
-   */
-  @Override
-  public void chaosAction() {
-    List<RoleInstance> liveContainers =
-        appState.cloneLiveContainerInfoList();
-    // purge any and all components which declare that they are an AM
-    ListIterator<RoleInstance> containers =
-        liveContainers.listIterator();
-    while (containers.hasNext()) {
-      RoleInstance instance = containers.next();
-      if (SliderKeys.COMPONENT_AM.equals(instance.role)) {
-        containers.remove();
-      }
-    }
-    int size = liveContainers.size();
-    if (size > 0) {
-      int target = random.nextInt(size);
-      RoleInstance roleInstance = liveContainers.get(target);
-      log.info("Killing {}", roleInstance);
-
-      queues.schedule(new ActionKillContainer(roleInstance.getId(),
-          DELAY, TimeUnit.MILLISECONDS, operationHandler));
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosMonkeyService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosMonkeyService.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosMonkeyService.java
deleted file mode 100644
index 8948f0d..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosMonkeyService.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.monkey;
-
-import com.codahale.metrics.MetricRegistry;
-import org.apache.hadoop.service.AbstractService;
-import org.apache.slider.api.InternalKeys;
-import org.apache.slider.server.appmaster.actions.QueueAccess;
-import org.apache.slider.server.appmaster.actions.RenewingAction;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-import java.util.concurrent.TimeUnit;
-
-/**
- * A chaos monkey service which will invoke ChaosTarget events 
- */
-public class ChaosMonkeyService extends AbstractService {
-  protected static final Logger log =
-      LoggerFactory.getLogger(ChaosMonkeyService.class);
-
-  private final MetricRegistry metrics;
-  private final QueueAccess queues;
-  private final Random random = new Random();
-
-  private final List<ChaosEntry> chaosEntries =
-      new ArrayList<ChaosEntry>();
-
-  public ChaosMonkeyService(MetricRegistry metrics, QueueAccess queues) {
-    super("ChaosMonkeyService");
-    this.metrics = metrics;
-    this.queues = queues;
-  }
-
-  /**
-   * Add a target ... it is only added if <code>probability &gt; 0</code>
-   * @param name name
-   * @param target chaos target
-   * @param probability probability
-   */
-  public synchronized void addTarget(String name,
-      ChaosTarget target, long probability) {
-    if (probability > 0) {
-      log.info("Adding {} with probability {}", name,
-          ((double)probability) / InternalKeys.PROBABILITY_PERCENT_1);
-      chaosEntries.add(new ChaosEntry(name, target, probability, metrics));
-    } else {
-      log.debug("Action {} not enabled", name);
-    }
-  }
-
-  /**
-   * Get the number of targets in the list
-   * @return the count of added targets
-   */
-  public int getTargetCount() {
-    return chaosEntries.size();
-  }
-  
-  /**
-   * Iterate through all the entries and invoke chaos on those wanted
-   */
-  public void play() {
-    for (ChaosEntry chaosEntry : chaosEntries) {
-      long p = randomPercentage();
-      chaosEntry.maybeInvokeChaos(p);
-    }
-  }
-
-  public int randomPercentage() {
-    return random.nextInt(InternalKeys.PROBABILITY_PERCENT_100);
-  }
-
-  /**
-   * Check for callers to see if chaos should be triggered; shares the
-   * same random number source as the rest of the monkey entries
-   * @param probability probability 
-   * @return true if the action should happen
-   */
-  public boolean chaosCheck(long probability) {
-    return randomPercentage() < probability; 
-  }
-  
-  /**
-   * Schedule the monkey
-   *
-   * @param delay initial delay
-   * @param timeUnit time unit
-   * @return true if it was scheduled (i.e. 1+ action) and interval > 0
-   */
-  public boolean schedule(long delay, long interval, TimeUnit timeUnit) {
-    if (interval > 0 && !chaosEntries.isEmpty()) {
-      queues.schedule(getChaosAction(delay, interval, timeUnit));
-      return true;
-    } else {
-      return false;
-    }
-  }
-
-  /**
-   * Get the chaos action
-   *
-   * @param delay
-   * @param timeUnit time unit
-   * @return the action to schedule
-   */
-  public RenewingAction<MonkeyPlayAction> getChaosAction(long delay,
-      long interval,
-      TimeUnit timeUnit) {
-    RenewingAction<MonkeyPlayAction> action = new RenewingAction<MonkeyPlayAction>(
-        new MonkeyPlayAction(this, 0, TimeUnit.MILLISECONDS),
-        delay,
-        interval,
-        timeUnit,
-        0
-    );
-    return action;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosTarget.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosTarget.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosTarget.java
deleted file mode 100644
index 1c3a9ac..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/ChaosTarget.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.monkey;
-
-public interface ChaosTarget {
-
-  public void chaosAction();
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/MonkeyPlayAction.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/MonkeyPlayAction.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/MonkeyPlayAction.java
deleted file mode 100644
index 20e4466..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/monkey/MonkeyPlayAction.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.monkey;
-
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.actions.AsyncAction;
-import org.apache.slider.server.appmaster.actions.QueueAccess;
-import org.apache.slider.server.appmaster.state.AppState;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Queueable action which calls {@link ChaosMonkeyService#play()} when
- * executed.
- */
-public class MonkeyPlayAction extends AsyncAction {
-
-  private final ChaosMonkeyService monkey;
-
-  public MonkeyPlayAction(ChaosMonkeyService monkey, long delay,
-      TimeUnit timeUnit) {
-    super("chaos monkey", delay, timeUnit);
-    this.monkey = monkey;
-  }
-
-  @Override
-  public void execute(SliderAppMaster appMaster,
-      QueueAccess queueService,
-      AppState appState) throws Exception {
-    monkey.play();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/AbstractRMOperation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/AbstractRMOperation.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/AbstractRMOperation.java
deleted file mode 100644
index ed3f197..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/AbstractRMOperation.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.operations;
-
-public abstract class AbstractRMOperation {
-
-  /**
-   * Execute the operation
-   * @param asyncRMClient client
-   * @param handler handler to perform the execution
-   */
-  public abstract void execute(RMOperationHandlerActions handler);
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/AsyncRMOperationHandler.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/AsyncRMOperationHandler.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/AsyncRMOperationHandler.java
deleted file mode 100644
index 03231ef..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/AsyncRMOperationHandler.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.operations;
-
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.api.records.Priority;
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.client.api.AMRMClient;
-import org.apache.hadoop.yarn.client.api.async.AMRMClientAsync;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Hands off RM operations to the Resource Manager.
- */
-public class AsyncRMOperationHandler extends RMOperationHandler {
-  protected static final Logger log =
-    LoggerFactory.getLogger(AsyncRMOperationHandler.class);
-  private final AMRMClientAsync client;
-  private final Resource maxResources;
-
-  public AsyncRMOperationHandler(AMRMClientAsync client, Resource maxResources) {
-    this.client = client;
-    this.maxResources = maxResources;
-  }
-
-  @Override
-  public int cancelContainerRequests(Priority priority1,
-      Priority priority2,
-      int count) {
-    // need to revoke a previously issued container request
-    // so enum the sets and pick some
-    int remaining = cancelSinglePriorityRequests(priority1, count);
-    if (priority2 != null) {
-      remaining = cancelSinglePriorityRequests(priority2, remaining);
-    }
-
-    return remaining;
-  }
-
-  /**
-   * Cancel just one of the priority levels
-   * @param priority priority to cancel
-   * @param count count to cancel
-   * @return number of requests cancelled
-   */
-  @SuppressWarnings("unchecked")
-  protected int cancelSinglePriorityRequests(Priority priority,
-      int count) {
-    List<Collection<AMRMClient.ContainerRequest>> requestSets =
-        client.getMatchingRequests(priority, "", maxResources);
-    if (count <= 0) {
-      return 0;
-    }
-    int remaining = count;
-    for (Collection<AMRMClient.ContainerRequest> requestSet : requestSets) {
-      if (remaining == 0) {
-        break;
-      }
-      for (AMRMClient.ContainerRequest request : requestSet) {
-        if (remaining == 0) {
-          break;
-        }
-        // a single release
-        cancelSingleRequest(request);
-        remaining --;
-      }
-    }
-    return remaining;
-  }
-
-  @Override
-  @SuppressWarnings("unchecked")
-  public void cancelSingleRequest(AMRMClient.ContainerRequest request) {
-    // a single release
-    client.removeContainerRequest(request);
-  }
-
-  @Override
-  public void releaseAssignedContainer(ContainerId containerId) {
-    log.debug("Releasing container {}", containerId);
-
-    client.releaseAssignedContainer(containerId);
-  }
-
-  @Override
-  @SuppressWarnings("unchecked")
-  public void addContainerRequest(AMRMClient.ContainerRequest req) {
-    client.addContainerRequest(req);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/CancelSingleRequest.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/CancelSingleRequest.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/CancelSingleRequest.java
deleted file mode 100644
index d7673d3..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/CancelSingleRequest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.operations;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.yarn.client.api.AMRMClient;
-import org.apache.slider.server.appmaster.state.ContainerPriority;
-
-/**
- * Cancel a container request
- */
-public class CancelSingleRequest extends AbstractRMOperation {
-
-  private final AMRMClient.ContainerRequest request;
-
-  public CancelSingleRequest(AMRMClient.ContainerRequest request) {
-    Preconditions.checkArgument(request != null, "Null container request");
-    this.request = request;
-  }
-
-  @Override
-  public void execute(RMOperationHandlerActions handler) {
-    handler.cancelSingleRequest(request);
-  }
-
-  public AMRMClient.ContainerRequest getRequest() {
-    return request;
-  }
-
-  @Override
-  public String toString() {
-    return "Cancel container request"
-        + " for :" + ContainerPriority.toString(request.getPriority())
-        + " request " + request;
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerReleaseOperation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerReleaseOperation.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerReleaseOperation.java
deleted file mode 100644
index 4271d50..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerReleaseOperation.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.operations;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.slider.server.appmaster.state.ContainerPriority;
-
-public class ContainerReleaseOperation extends AbstractRMOperation {
-
-  private final ContainerId containerId;
-
-  public ContainerReleaseOperation(ContainerId containerId) {
-    Preconditions.checkArgument(containerId != null, "Null containerId");
-    this.containerId = containerId;
-  }
-
-  public ContainerId getContainerId() {
-    return containerId;
-  }
-
-  @Override
-  public void execute(RMOperationHandlerActions handler) {
-    handler.releaseAssignedContainer(containerId);
-  }
-
-  @Override
-  public String toString() {
-    return "release container " + containerId;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerRequestOperation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerRequestOperation.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerRequestOperation.java
deleted file mode 100644
index e29ddd0..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ContainerRequestOperation.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.operations;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.yarn.api.records.Priority;
-import org.apache.hadoop.yarn.client.api.AMRMClient;
-import org.apache.slider.server.appmaster.state.ContainerPriority;
-
-/**
- * A container request operation
- */
-public class ContainerRequestOperation extends AbstractRMOperation {
-
-  private final AMRMClient.ContainerRequest request;
-
-  public ContainerRequestOperation(AMRMClient.ContainerRequest request) {
-    Preconditions.checkArgument(request != null, "Null container request");
-    this.request = request;
-  }
-
-  public AMRMClient.ContainerRequest getRequest() {
-    return request;
-  }
-
-  public Priority getPriority() {
-    return request.getPriority();
-  }
-
-  public  boolean getRelaxLocality() {
-    return request.getRelaxLocality();
-  }
-
-  @Override
-  public void execute(RMOperationHandlerActions handler) {
-    handler.addContainerRequest(request);
-  }
-
-  @Override
-  public String toString() {
-    return "request container for role "
-        + ContainerPriority.toString(getPriority())
-        + " request " + request
-        + " relaxLocality=" + getRelaxLocality();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ProviderNotifyingOperationHandler.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ProviderNotifyingOperationHandler.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ProviderNotifyingOperationHandler.java
deleted file mode 100644
index 184a36a..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/ProviderNotifyingOperationHandler.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.operations;
-
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.api.records.Priority;
-import org.apache.hadoop.yarn.client.api.AMRMClient;
-import org.apache.slider.providers.ProviderService;
-
-public class ProviderNotifyingOperationHandler extends RMOperationHandler {
-  
-  private final ProviderService providerService;
-
-  public ProviderNotifyingOperationHandler(ProviderService providerService) {
-    this.providerService = providerService;
-  }
-
-  @Override
-  public void releaseAssignedContainer(ContainerId containerId) {
-    providerService.releaseAssignedContainer(containerId);
-  }
-
-  @Override
-  public void addContainerRequest(AMRMClient.ContainerRequest req) {
-    providerService.addContainerRequest(req);
-  }
-
-  @Override
-  public int cancelContainerRequests(Priority priority1,
-      Priority priority2,
-      int count) {
-    return providerService.cancelContainerRequests(priority1, priority2, count);
-  }
-
-  @Override
-  public void cancelSingleRequest(AMRMClient.ContainerRequest request) {
-    providerService.cancelSingleRequest(request);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandler.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandler.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandler.java
deleted file mode 100644
index d0d038a..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandler.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.operations;
-
-import java.util.List;
-
-public abstract class RMOperationHandler implements RMOperationHandlerActions {
-
-  @Override
-  public void execute(List<AbstractRMOperation> operations) {
-    for (AbstractRMOperation operation : operations) {
-      operation.execute(this);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandlerActions.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandlerActions.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandlerActions.java
deleted file mode 100644
index b7794ed..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/operations/RMOperationHandlerActions.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.operations;
-
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.api.records.Priority;
-import org.apache.hadoop.yarn.client.api.AMRMClient;
-
-import java.util.List;
-
-public interface RMOperationHandlerActions {
-
-  /**
-   * Release an assigned container
-   * @param containerId container
-   */
-  void releaseAssignedContainer(ContainerId containerId);
-
-  /**
-   * Issue a container request
-   * @param request
-   */
-  void addContainerRequest(AMRMClient.ContainerRequest request);
-
-  /**
-   * Cancel a specific request
-   * @param request request to cancel
-   */
-  void cancelSingleRequest(AMRMClient.ContainerRequest request);
-
-  /**
-   * Remove a container request
-   * @param priority1 priority to remove at
-   * @param priority2 second priority to target
-   * @param count number to remove
-   */
-  int cancelContainerRequests(Priority priority1, Priority priority2, int count);
-
-  /**
-   * Execute an entire list of operations
-   * @param operations ops
-   */
-  void execute(List<AbstractRMOperation> operations);
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java
deleted file mode 100644
index dd4785d..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/RpcBinder.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.rpc;
-
-import com.google.common.base.Preconditions;
-import com.google.protobuf.BlockingService;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.retry.RetryPolicies;
-import org.apache.hadoop.io.retry.RetryPolicy;
-import org.apache.hadoop.ipc.ProtobufRpcEngine;
-import org.apache.hadoop.ipc.ProtocolProxy;
-import org.apache.hadoop.ipc.RPC;
-import org.apache.hadoop.ipc.RpcEngine;
-import org.apache.hadoop.ipc.Server;
-import org.apache.hadoop.net.NetUtils;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.security.token.SecretManager;
-import org.apache.hadoop.security.token.Token;
-import org.apache.hadoop.security.token.TokenIdentifier;
-import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
-import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest;
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.YarnApplicationState;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.hadoop.yarn.security.client.ClientToAMTokenIdentifier;
-import org.apache.hadoop.yarn.util.ConverterUtils;
-import org.apache.slider.api.SliderClusterProtocol;
-import org.apache.slider.common.SliderExitCodes;
-import org.apache.slider.common.tools.Duration;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadClusterStateException;
-import org.apache.slider.core.exceptions.ErrorStrings;
-import org.apache.slider.core.exceptions.ServiceNotReadyException;
-import org.apache.slider.core.exceptions.SliderException;
-
-import static org.apache.slider.common.SliderXmlConfKeys.*; 
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.security.PrivilegedExceptionAction;
-
-public class RpcBinder {
-  protected static final Logger log =
-    LoggerFactory.getLogger(RpcBinder.class);
-
-  /**
-   * Create a protobuf server bonded to the specific socket address
-   * @param addr address to listen to; 0.0.0.0 as hostname acceptable
-   * @param conf config
-   * @param secretManager token secret handler
-   * @param numHandlers threads to service requests
-   * @param blockingService service to handle
-   * @param portRangeConfig range of ports
-   * @return the IPC server itself
-   * @throws IOException
-   */
-  public static Server createProtobufServer(InetSocketAddress addr,
-                                            Configuration conf,
-                                            SecretManager<? extends TokenIdentifier> secretManager,
-                                            int numHandlers,
-                                            BlockingService blockingService,
-                                            String portRangeConfig) throws
-                                                      IOException {
-    Class<SliderClusterProtocolPB> sliderClusterAPIClass = registerSliderAPI(
-        conf);
-    RPC.Server server = new RPC.Builder(conf).setProtocol(sliderClusterAPIClass)
-                                             .setInstance(blockingService)
-                                             .setBindAddress(addr.getAddress()
-                                                 .getCanonicalHostName())
-                                             .setPort(addr.getPort())
-                                             .setNumHandlers(numHandlers)
-                                             .setVerbose(false)
-                                             .setSecretManager(secretManager)
-                                             .setPortRangeConfig(
-                                               portRangeConfig)
-                                             .build();
-    log.debug(
-      "Adding protocol " + sliderClusterAPIClass.getCanonicalName() + " to the server");
-    server.addProtocol(RPC.RpcKind.RPC_PROTOCOL_BUFFER, sliderClusterAPIClass,
-                       blockingService);
-    return server;
-  }
-
-  /**
-   * Add the protobuf engine to the configuration. Harmless and inexpensive
-   * if repeated.
-   * @param conf configuration to patch
-   * @return the protocol class
-   */
-  public static Class<SliderClusterProtocolPB> registerSliderAPI(
-      Configuration conf) {
-    Class<SliderClusterProtocolPB> sliderClusterAPIClass =
-      SliderClusterProtocolPB.class;
-    RPC.setProtocolEngine(conf, sliderClusterAPIClass, ProtobufRpcEngine.class);
-    
-    //quick sanity check here
-    assert verifyBondedToProtobuf(conf, sliderClusterAPIClass);
-    
-    return sliderClusterAPIClass;
-  }
-
-  /**
-   * Verify that the conf is set up for protobuf transport of Slider RPC
-   * @param conf configuration
-   * @param sliderClusterAPIClass class for the API
-   * @return true if the RPC engine is protocol buffers
-   */
-  public static boolean verifyBondedToProtobuf(Configuration conf,
-                                                Class<SliderClusterProtocolPB> sliderClusterAPIClass) {
-    return conf.getClass("rpc.engine." + sliderClusterAPIClass.getName(),
-                         RpcEngine.class) .equals(ProtobufRpcEngine.class);
-  }
-
-
-  /**
-   * Connect to a server. May include setting up retry policies
-   * @param addr
-   * @param currentUser
-   * @param conf
-   * @param rpcTimeout
-   * @return
-   * @throws IOException
-   */
-  public static SliderClusterProtocol connectToServer(InetSocketAddress addr,
-                                                    UserGroupInformation currentUser,
-                                                    Configuration conf,
-                                                    int rpcTimeout) throws IOException {
-    Class<SliderClusterProtocolPB> sliderClusterAPIClass =
-        registerSliderAPI(conf);
-
-    final RetryPolicy retryPolicy = RetryPolicies.TRY_ONCE_THEN_FAIL;
-    log.debug("Connecting to Slider AM at {}", addr);
-    ProtocolProxy<SliderClusterProtocolPB> protoProxy =
-        RPC.getProtocolProxy(sliderClusterAPIClass,
-            1,
-            addr,
-            currentUser,
-            conf,
-            NetUtils.getDefaultSocketFactory(conf),
-            rpcTimeout,
-            retryPolicy);
-    SliderClusterProtocolPB endpoint = protoProxy.getProxy();
-    return new SliderClusterProtocolProxy(endpoint, addr);
-  }
-
-
-  /**
-   * This loops for a limited period trying to get the Proxy -
-   * by doing so it handles AM failover
-   * @param conf configuration to patch and use
-   * @param rmClient client of the resource manager
-   * @param application application to work with
-   * @param connectTimeout timeout for the whole proxy operation to timeout
-   * (milliseconds). Use 0 to indicate "do not attempt to wait" -fail fast.
-   * @param rpcTimeout timeout for RPCs to block during communications
-   * @return the proxy
-   * @throws IOException IO problems
-   * @throws YarnException Slider-generated exceptions related to the binding
-   * failing. This can include the application finishing or timeouts
-   * @throws InterruptedException if a sleep operation waiting for
-   * the cluster to respond is interrupted.
-   */
-  @SuppressWarnings("NestedAssignment")
-  public static SliderClusterProtocol getProxy(final Configuration conf,
-                                      final ApplicationClientProtocol rmClient,
-                                      ApplicationReport application,
-                                      final int connectTimeout,
-                                      final int rpcTimeout)
-      throws IOException, YarnException, InterruptedException {
-    ApplicationId appId;
-    appId = application.getApplicationId();
-    Duration timeout = new Duration(connectTimeout);
-    timeout.start();
-    Exception exception = null;
-    YarnApplicationState state = null;
-    try {
-      while (application != null &&
-             (state = application.getYarnApplicationState()).equals(
-                 YarnApplicationState.RUNNING)) {
-  
-        try {
-          return getProxy(conf, application, rpcTimeout);
-        } catch (IOException e) {
-          if (connectTimeout <= 0 || timeout.getLimitExceeded()) {
-            throw e;
-          }
-          exception = e;
-        } catch (YarnException e) {
-          if (connectTimeout <= 0 || timeout.getLimitExceeded()) {
-            throw e;
-          }
-          exception = e;
-        }
-        //at this point: app failed to work
-        log.debug("Could not connect to {}. Waiting for getting the latest AM address...",
-                  appId);
-        Thread.sleep(1000);
-        //or get the app report
-        application =
-          rmClient.getApplicationReport(
-              GetApplicationReportRequest.newInstance(appId)).getApplicationReport();
-      }
-      //get here if the app is no longer running. Raise a specific
-      //exception but init it with the previous failure
-      throw new BadClusterStateException(
-                              exception,
-                              ErrorStrings.E_FINISHED_APPLICATION, appId, state );
-    } finally {
-      timeout.close();
-    }
-  }
-
-  /**
-   * Get a proxy from the application report
-   * @param conf config to use
-   * @param application app report
-   * @param rpcTimeout timeout in RPC operations
-   * @return the proxy
-   * @throws IOException
-   * @throws SliderException
-   * @throws InterruptedException
-   */
-  public static SliderClusterProtocol getProxy(final Configuration conf,
-      final ApplicationReport application,
-      final int rpcTimeout)
-      throws IOException, SliderException, InterruptedException {
-
-    String host = application.getHost();
-    int port = application.getRpcPort();
-    org.apache.hadoop.yarn.api.records.Token clientToAMToken =
-        application.getClientToAMToken();
-    return createProxy(conf, host, port, clientToAMToken, rpcTimeout);
-  }
-
-  /**
-   *
-   * @param conf config to use
-   * @param host hosname
-   * @param port port
-   * @param clientToAMToken auth token: only used in a secure cluster.
-   * converted via {@link ConverterUtils#convertFromYarn(org.apache.hadoop.yarn.api.records.Token, InetSocketAddress)}
-   * @param rpcTimeout timeout in RPC operations
-   * @return the proxy
-   * @throws SliderException
-   * @throws IOException
-   * @throws InterruptedException
-   */
-  public static SliderClusterProtocol createProxy(final Configuration conf,
-      String host,
-      int port,
-      org.apache.hadoop.yarn.api.records.Token clientToAMToken,
-      final int rpcTimeout) throws
-      SliderException,
-      IOException,
-      InterruptedException {
-    String address = host + ":" + port;
-    if (SliderUtils.isUnset(host) || 0 == port) {
-      throw new SliderException(SliderExitCodes.EXIT_CONNECTIVITY_PROBLEM,
-                              "Slider instance "
-                              + " isn't providing a valid address for the" +
-                              " Slider RPC protocol: " + address);
-    }
-
-    UserGroupInformation currentUser = UserGroupInformation.getCurrentUser();
-    final UserGroupInformation newUgi = UserGroupInformation.createRemoteUser(
-      currentUser.getUserName());
-    final InetSocketAddress serviceAddr =
-        NetUtils.createSocketAddrForHost(host, port);
-    SliderClusterProtocol realProxy;
-
-    log.debug("Connecting to {}", serviceAddr);
-    if (UserGroupInformation.isSecurityEnabled()) {
-      Preconditions.checkArgument(clientToAMToken != null,
-          "Null clientToAMToken");
-      Token<ClientToAMTokenIdentifier> token =
-        ConverterUtils.convertFromYarn(clientToAMToken, serviceAddr);
-      newUgi.addToken(token);
-      realProxy =
-        newUgi.doAs(new PrivilegedExceptionAction<SliderClusterProtocol>() {
-          @Override
-          public SliderClusterProtocol run() throws IOException {
-            return connectToServer(serviceAddr, newUgi, conf, rpcTimeout);
-          }
-        });
-    } else {
-      realProxy = connectToServer(serviceAddr, newUgi, conf, rpcTimeout);
-    }
-    return realProxy;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderAMPolicyProvider.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderAMPolicyProvider.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderAMPolicyProvider.java
deleted file mode 100644
index a40078a..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderAMPolicyProvider.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.rpc;
-
-import org.apache.hadoop.security.authorize.PolicyProvider;
-import org.apache.hadoop.security.authorize.Service;
-import org.apache.slider.common.SliderXmlConfKeys;
-
-/**
- * {@link PolicyProvider} for Slider protocols.
- */
-
-public class SliderAMPolicyProvider extends PolicyProvider {
-  
-  private static final Service[] services = 
-      new Service[] {
-    new Service(SliderXmlConfKeys.KEY_PROTOCOL_ACL, SliderClusterProtocolPB.class)
-  };
-
-  @SuppressWarnings("ReturnOfCollectionOrArrayField")
-  @Override
-  public Service[] getServices() {
-    return services;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPB.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPB.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPB.java
deleted file mode 100644
index 7d237de..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPB.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.rpc;
-
-import org.apache.slider.api.SliderClusterProtocol;
-import org.apache.slider.api.proto.SliderClusterAPI;
-
-public interface SliderClusterProtocolPB extends SliderClusterAPI.SliderClusterProtocolPB.BlockingInterface{
-
-  long versionID = SliderClusterProtocol.versionID;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
deleted file mode 100644
index f0d9063..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderClusterProtocolPBImpl.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.rpc;
-
-import com.google.protobuf.RpcController;
-import com.google.protobuf.ServiceException;
-import org.apache.slider.api.SliderClusterProtocol;
-import org.apache.slider.api.proto.Messages;
-
-import java.io.IOException;
-
-/**
- * Server-side Relay from Protobuf to internal RPC.
- *
- */
-public class SliderClusterProtocolPBImpl implements SliderClusterProtocolPB {
-
-  private SliderClusterProtocol real;
-
-  public SliderClusterProtocolPBImpl(SliderClusterProtocol real) {
-    this.real = real;
-  }
-
-  private ServiceException wrap(Exception e) {
-    if (e instanceof ServiceException) {
-      return (ServiceException) e;
-    }
-    return new ServiceException(e);
-  }
-
-  public long getProtocolVersion(String protocol, long clientVersion)
-      throws IOException {
-    return SliderClusterProtocol.versionID;
-  }
-
-  @Override
-  public Messages.StopClusterResponseProto stopCluster(RpcController controller,
-       Messages.StopClusterRequestProto request) throws ServiceException {
-    try {
-      return real.stopCluster(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.UpgradeContainersResponseProto upgradeContainers(RpcController controller,
-        Messages.UpgradeContainersRequestProto request) throws ServiceException {
-    try {
-      return real.upgradeContainers(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.FlexClusterResponseProto flexCluster(RpcController controller,
-      Messages.FlexClusterRequestProto request) throws ServiceException {
-    try {
-      return real.flexCluster(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.GetJSONClusterStatusResponseProto getJSONClusterStatus(
-    RpcController controller,
-    Messages.GetJSONClusterStatusRequestProto request) throws ServiceException {
-    try {
-      return real.getJSONClusterStatus(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-
-  @Override
-  public Messages.GetInstanceDefinitionResponseProto getInstanceDefinition(
-    RpcController controller,
-    Messages.GetInstanceDefinitionRequestProto request)
-      throws ServiceException {
-    try {
-      return real.getInstanceDefinition(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.ListNodeUUIDsByRoleResponseProto listNodeUUIDsByRole(
-    RpcController controller,
-    Messages.ListNodeUUIDsByRoleRequestProto request) throws ServiceException {
-    try {
-      return real.listNodeUUIDsByRole(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.GetNodeResponseProto getNode(RpcController controller,
-      Messages.GetNodeRequestProto request) throws ServiceException {
-    try {
-      return real.getNode(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.GetClusterNodesResponseProto getClusterNodes(RpcController controller,
-      Messages.GetClusterNodesRequestProto request) throws ServiceException {
-    try {
-      return real.getClusterNodes(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.EchoResponseProto echo(RpcController controller,
-      Messages.EchoRequestProto request) throws ServiceException {
-    try {
-      return real.echo(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.KillContainerResponseProto killContainer(RpcController controller,
-      Messages.KillContainerRequestProto request) throws ServiceException {
-    try {
-      return real.killContainer(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-  
-  @Override
-  public Messages.AMSuicideResponseProto amSuicide(RpcController controller,
-      Messages.AMSuicideRequestProto request) throws ServiceException {
-    try {
-      return real.amSuicide(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.ApplicationLivenessInformationProto getLivenessInformation(
-      RpcController controller,
-      Messages.GetApplicationLivenessRequestProto request) throws ServiceException {
-    try {
-      return real.getLivenessInformation(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-  
-  @Override
-  public Messages.GetLiveContainersResponseProto getLiveContainers(RpcController controller,
-      Messages.GetLiveContainersRequestProto request) throws ServiceException {
-    try {
-      return real.getLiveContainers(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.ContainerInformationProto getLiveContainer(RpcController controller,
-      Messages.GetLiveContainerRequestProto request) throws ServiceException {
-    try {
-      return real.getLiveContainer(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.GetLiveComponentsResponseProto getLiveComponents(RpcController controller,
-      Messages.GetLiveComponentsRequestProto request) throws ServiceException {
-    try {
-      return real.getLiveComponents(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.ComponentInformationProto getLiveComponent(RpcController controller,
-      Messages.GetLiveComponentRequestProto request) throws ServiceException {
-    try {
-      return real.getLiveComponent(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.GetLiveNodesResponseProto getLiveNodes(RpcController controller,
-      Messages.GetLiveNodesRequestProto request) throws ServiceException {
-    try {
-      return real.getLiveNodes(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.NodeInformationProto getLiveNode(RpcController controller,
-      Messages.GetLiveNodeRequestProto request) throws ServiceException {
-    try {
-      return real.getLiveNode(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelDesired(RpcController controller,
-      Messages.EmptyPayloadProto request) throws ServiceException {
-    try {
-      return real.getModelDesired(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelDesiredAppconf(RpcController controller,
-      Messages.EmptyPayloadProto request) throws ServiceException {
-    try {
-      return real.getModelDesiredAppconf(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelDesiredResources(RpcController controller,
-      Messages.EmptyPayloadProto request) throws ServiceException {
-    try {
-      return real.getModelDesiredResources(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelResolved(RpcController controller,
-      Messages.EmptyPayloadProto request) throws ServiceException {
-    try {
-      return real.getModelResolved(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelResolvedAppconf(RpcController controller,
-      Messages.EmptyPayloadProto request) throws ServiceException {
-    try {
-      return real.getModelResolvedAppconf(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getModelResolvedResources(RpcController controller,
-      Messages.EmptyPayloadProto request) throws ServiceException {
-    try {
-      return real.getModelResolvedResources(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.WrappedJsonProto getLiveResources(RpcController controller,
-      Messages.EmptyPayloadProto request) throws ServiceException {
-    try {
-      return real.getLiveResources(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-
-  @Override
-  public Messages.GetCertificateStoreResponseProto getClientCertificateStore(
-      RpcController controller,
-      Messages.GetCertificateStoreRequestProto request)
-      throws ServiceException {
-    try {
-      return real.getClientCertificateStore(request);
-    } catch (Exception e) {
-      throw wrap(e);
-    }
-  }
-}



[04/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jt/jquery.jstree.js
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jt/jquery.jstree.js b/slider-core/src/main/resources/webapps/static/jt/jquery.jstree.js
deleted file mode 100644
index 8996ac0..0000000
--- a/slider-core/src/main/resources/webapps/static/jt/jquery.jstree.js
+++ /dev/null
@@ -1,4544 +0,0 @@
-/*
- * jsTree 1.0-rc3
- * http://jstree.com/
- *
- * Copyright (c) 2010 Ivan Bozhanov (vakata.com)
- *
- * Licensed same as jquery - under the terms of either the MIT License or the GPL Version 2 License
- *   http://www.opensource.org/licenses/mit-license.php
- *   http://www.gnu.org/licenses/gpl.html
- *
- * $Date$
- * $Revision$
- */
-
-/*jslint browser: true, onevar: true, undef: true, bitwise: true, strict: true */
-/*global window : false, clearInterval: false, clearTimeout: false, document: false, setInterval: false, setTimeout: false, jQuery: false, navigator: false, XSLTProcessor: false, DOMParser: false, XMLSerializer: false*/
-
-"use strict";
-
-// top wrapper to prevent multiple inclusion (is this OK?)
-(function () { if(jQuery && jQuery.jstree) { return; }
-	var is_ie6 = false, is_ie7 = false, is_ff2 = false;
-
-/* 
- * jsTree core
- */
-(function ($) {
-	// Common functions not related to jsTree 
-	// decided to move them to a `vakata` "namespace"
-	$.vakata = {};
-	// CSS related functions
-	$.vakata.css = {
-		get_css : function(rule_name, delete_flag, sheet) {
-			rule_name = rule_name.toLowerCase();
-			var css_rules = sheet.cssRules || sheet.rules,
-				j = 0;
-			do {
-				if(css_rules.length && j > css_rules.length + 5) { return false; }
-				if(css_rules[j].selectorText && css_rules[j].selectorText.toLowerCase() == rule_name) {
-					if(delete_flag === true) {
-						if(sheet.removeRule) { sheet.removeRule(j); }
-						if(sheet.deleteRule) { sheet.deleteRule(j); }
-						return true;
-					}
-					else { return css_rules[j]; }
-				}
-			}
-			while (css_rules[++j]);
-			return false;
-		},
-		add_css : function(rule_name, sheet) {
-			if($.jstree.css.get_css(rule_name, false, sheet)) { return false; }
-			if(sheet.insertRule) { sheet.insertRule(rule_name + ' { }', 0); } else { sheet.addRule(rule_name, null, 0); }
-			return $.vakata.css.get_css(rule_name);
-		},
-		remove_css : function(rule_name, sheet) { 
-			return $.vakata.css.get_css(rule_name, true, sheet); 
-		},
-		add_sheet : function(opts) {
-			var tmp = false, is_new = true;
-			if(opts.str) {
-				if(opts.title) { tmp = $("style[id='" + opts.title + "-stylesheet']")[0]; }
-				if(tmp) { is_new = false; }
-				else {
-					tmp = document.createElement("style");
-					tmp.setAttribute('type',"text/css");
-					if(opts.title) { tmp.setAttribute("id", opts.title + "-stylesheet"); }
-				}
-				if(tmp.styleSheet) {
-					if(is_new) { 
-						document.getElementsByTagName("head")[0].appendChild(tmp); 
-						tmp.styleSheet.cssText = opts.str; 
-					}
-					else {
-						tmp.styleSheet.cssText = tmp.styleSheet.cssText + " " + opts.str; 
-					}
-				}
-				else {
-					tmp.appendChild(document.createTextNode(opts.str));
-					document.getElementsByTagName("head")[0].appendChild(tmp);
-				}
-				return tmp.sheet || tmp.styleSheet;
-			}
-			if(opts.url) {
-				if(document.createStyleSheet) {
-					try { tmp = document.createStyleSheet(opts.url); } catch (e) { }
-				}
-				else {
-					tmp			= document.createElement('link');
-					tmp.rel		= 'stylesheet';
-					tmp.type	= 'text/css';
-					tmp.media	= "all";
-					tmp.href	= opts.url;
-					document.getElementsByTagName("head")[0].appendChild(tmp);
-					return tmp.styleSheet;
-				}
-			}
-		}
-	};
-
-	// private variables 
-	var instances = [],			// instance array (used by $.jstree.reference/create/focused)
-		focused_instance = -1,	// the index in the instance array of the currently focused instance
-		plugins = {},			// list of included plugins
-		prepared_move = {};		// for the move_node function
-
-	// jQuery plugin wrapper (thanks to jquery UI widget function)
-	$.fn.jstree = function (settings) {
-		var isMethodCall = (typeof settings == 'string'), // is this a method call like $().jstree("open_node")
-			args = Array.prototype.slice.call(arguments, 1), 
-			returnValue = this;
-
-		// if a method call execute the method on all selected instances
-		if(isMethodCall) {
-			if(settings.substring(0, 1) == '_') { return returnValue; }
-			this.each(function() {
-				var instance = instances[$.data(this, "jstree-instance-id")],
-					methodValue = (instance && $.isFunction(instance[settings])) ? instance[settings].apply(instance, args) : instance;
-					if(typeof methodValue !== "undefined" && (settings.indexOf("is_") === 0 || (methodValue !== true && methodValue !== false))) { returnValue = methodValue; return false; }
-			});
-		}
-		else {
-			this.each(function() {
-				// extend settings and allow for multiple hashes and $.data
-				var instance_id = $.data(this, "jstree-instance-id"),
-					a = [],
-					b = settings ? $.extend({}, true, settings) : {},
-					c = $(this), 
-					s = false, 
-					t = [];
-				a = a.concat(args);
-				if(c.data("jstree")) { a.push(c.data("jstree")); }
-				b = a.length ? $.extend.apply(null, [true, b].concat(a)) : b;
-
-				// if an instance already exists, destroy it first
-				if(typeof instance_id !== "undefined" && instances[instance_id]) { instances[instance_id].destroy(); }
-				// push a new empty object to the instances array
-				instance_id = parseInt(instances.push({}),10) - 1;
-				// store the jstree instance id to the container element
-				$.data(this, "jstree-instance-id", instance_id);
-				// clean up all plugins
-				b.plugins = $.isArray(b.plugins) ? b.plugins : $.jstree.defaults.plugins.slice();
-				b.plugins.unshift("core");
-				// only unique plugins
-				b.plugins = b.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
-
-				// extend defaults with passed data
-				s = $.extend(true, {}, $.jstree.defaults, b);
-				s.plugins = b.plugins;
-				$.each(plugins, function (i, val) { 
-					if($.inArray(i, s.plugins) === -1) { s[i] = null; delete s[i]; } 
-					else { t.push(i); }
-				});
-				s.plugins = t;
-
-				// push the new object to the instances array (at the same time set the default classes to the container) and init
-				instances[instance_id] = new $.jstree._instance(instance_id, $(this).addClass("jstree jstree-" + instance_id), s); 
-				// init all activated plugins for this instance
-				$.each(instances[instance_id]._get_settings().plugins, function (i, val) { instances[instance_id].data[val] = {}; });
-				$.each(instances[instance_id]._get_settings().plugins, function (i, val) { if(plugins[val]) { plugins[val].__init.apply(instances[instance_id]); } });
-				// initialize the instance
-				setTimeout(function() { instances[instance_id].init(); }, 0);
-			});
-		}
-		// return the jquery selection (or if it was a method call that returned a value - the returned value)
-		return returnValue;
-	};
-	// object to store exposed functions and objects
-	$.jstree = {
-		defaults : {
-			plugins : []
-		},
-		_focused : function () { return instances[focused_instance] || null; },
-		_reference : function (needle) { 
-			// get by instance id
-			if(instances[needle]) { return instances[needle]; }
-			// get by DOM (if still no luck - return null
-			var o = $(needle); 
-			if(!o.length && typeof needle === "string") { o = $("#" + needle); }
-			if(!o.length) { return null; }
-			return instances[o.closest(".jstree").data("jstree-instance-id")] || null; 
-		},
-		_instance : function (index, container, settings) { 
-			// for plugins to store data in
-			this.data = { core : {} };
-			this.get_settings	= function () { return $.extend(true, {}, settings); };
-			this._get_settings	= function () { return settings; };
-			this.get_index		= function () { return index; };
-			this.get_container	= function () { return container; };
-			this.get_container_ul = function () { return container.children("ul:eq(0)"); };
-			this._set_settings	= function (s) { 
-				settings = $.extend(true, {}, settings, s);
-			};
-		},
-		_fn : { },
-		plugin : function (pname, pdata) {
-			pdata = $.extend({}, {
-				__init		: $.noop, 
-				__destroy	: $.noop,
-				_fn			: {},
-				defaults	: false
-			}, pdata);
-			plugins[pname] = pdata;
-
-			$.jstree.defaults[pname] = pdata.defaults;
-			$.each(pdata._fn, function (i, val) {
-				val.plugin		= pname;
-				val.old			= $.jstree._fn[i];
-				$.jstree._fn[i] = function () {
-					var rslt,
-						func = val,
-						args = Array.prototype.slice.call(arguments),
-						evnt = new $.Event("before.jstree"),
-						rlbk = false;
-
-					if(this.data.core.locked === true && i !== "unlock" && i !== "is_locked") { return; }
-
-					// Check if function belongs to the included plugins of this instance
-					do {
-						if(func && func.plugin && $.inArray(func.plugin, this._get_settings().plugins) !== -1) { break; }
-						func = func.old;
-					} while(func);
-					if(!func) { return; }
-
-					// context and function to trigger events, then finally call the function
-					if(i.indexOf("_") === 0) {
-						rslt = func.apply(this, args);
-					}
-					else {
-						rslt = this.get_container().triggerHandler(evnt, { "func" : i, "inst" : this, "args" : args, "plugin" : func.plugin });
-						if(rslt === false) { return; }
-						if(typeof rslt !== "undefined") { args = rslt; }
-
-						rslt = func.apply(
-							$.extend({}, this, { 
-								__callback : function (data) { 
-									this.get_container().triggerHandler( i + '.jstree', { "inst" : this, "args" : args, "rslt" : data, "rlbk" : rlbk });
-								},
-								__rollback : function () { 
-									rlbk = this.get_rollback();
-									return rlbk;
-								},
-								__call_old : function (replace_arguments) {
-									return func.old.apply(this, (replace_arguments ? Array.prototype.slice.call(arguments, 1) : args ) );
-								}
-							}), args);
-					}
-
-					// return the result
-					return rslt;
-				};
-				$.jstree._fn[i].old = val.old;
-				$.jstree._fn[i].plugin = pname;
-			});
-		},
-		rollback : function (rb) {
-			if(rb) {
-				if(!$.isArray(rb)) { rb = [ rb ]; }
-				$.each(rb, function (i, val) {
-					instances[val.i].set_rollback(val.h, val.d);
-				});
-			}
-		}
-	};
-	// set the prototype for all instances
-	$.jstree._fn = $.jstree._instance.prototype = {};
-
-	// load the css when DOM is ready
-	$(function() {
-		// code is copied from jQuery ($.browser is deprecated + there is a bug in IE)
-		var u = navigator.userAgent.toLowerCase(),
-			v = (u.match( /.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
-			css_string = '' + 
-				'.jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } ' + 
-				'.jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; min-width:18px; } ' + 
-				'.jstree-rtl li { margin-left:0; margin-right:18px; } ' + 
-				'.jstree > ul > li { margin-left:0px; } ' + 
-				'.jstree-rtl > ul > li { margin-right:0px; } ' + 
-				'.jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } ' + 
-				'.jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } ' + 
-				'.jstree a:focus { outline: none; } ' + 
-				'.jstree a > ins { height:16px; width:16px; } ' + 
-				'.jstree a > .jstree-icon { margin-right:3px; } ' + 
-				'.jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } ' + 
-				'li.jstree-open > ul { display:block; } ' + 
-				'li.jstree-closed > ul { display:none; } ';
-		// Correct IE 6 (does not support the > CSS selector)
-		if(/msie/.test(u) && parseInt(v, 10) == 6) { 
-			is_ie6 = true;
-
-			// fix image flicker and lack of caching
-			try {
-				document.execCommand("BackgroundImageCache", false, true);
-			} catch (err) { }
-
-			css_string += '' + 
-				'.jstree li { height:18px; margin-left:0; margin-right:0; } ' + 
-				'.jstree li li { margin-left:18px; } ' + 
-				'.jstree-rtl li li { margin-left:0px; margin-right:18px; } ' + 
-				'li.jstree-open ul { display:block; } ' + 
-				'li.jstree-closed ul { display:none !important; } ' + 
-				'.jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } ' + 
-				'.jstree li a ins { height:16px; width:16px; margin-right:3px; } ' + 
-				'.jstree-rtl li a ins { margin-right:0px; margin-left:3px; } ';
-		}
-		// Correct IE 7 (shifts anchor nodes onhover)
-		if(/msie/.test(u) && parseInt(v, 10) == 7) { 
-			is_ie7 = true;
-			css_string += '.jstree li a { border-width:0 !important; padding:0px 2px !important; } ';
-		}
-		// correct ff2 lack of display:inline-block
-		if(!/compatible/.test(u) && /mozilla/.test(u) && parseFloat(v, 10) < 1.9) {
-			is_ff2 = true;
-			css_string += '' + 
-				'.jstree ins { display:-moz-inline-box; } ' + 
-				'.jstree li { line-height:12px; } ' + // WHY??
-				'.jstree a { display:-moz-inline-box; } ' + 
-				'.jstree .jstree-no-icons .jstree-checkbox { display:-moz-inline-stack !important; } ';
-				/* this shouldn't be here as it is theme specific */
-		}
-		// the default stylesheet
-		$.vakata.css.add_sheet({ str : css_string, title : "jstree" });
-	});
-
-	// core functions (open, close, create, update, delete)
-	$.jstree.plugin("core", {
-		__init : function () {
-			this.data.core.locked = false;
-			this.data.core.to_open = this.get_settings().core.initially_open;
-			this.data.core.to_load = this.get_settings().core.initially_load;
-		},
-		defaults : { 
-			html_titles	: false,
-			animation	: 500,
-			initially_open : [],
-			initially_load : [],
-			open_parents : true,
-			notify_plugins : true,
-			rtl			: false,
-			load_open	: false,
-			strings		: {
-				loading		: "Loading ...",
-				new_node	: "New node",
-				multiple_selection : "Multiple selection"
-			}
-		},
-		_fn : { 
-			init	: function () { 
-				this.set_focus(); 
-				if(this._get_settings().core.rtl) {
-					this.get_container().addClass("jstree-rtl").css("direction", "rtl");
-				}
-				this.get_container().html("<ul><li class='jstree-last jstree-leaf'><ins>&#160;</ins><a class='jstree-loading' href='#'><ins class='jstree-icon'>&#160;</ins>" + this._get_string("loading") + "</a></li></ul>");
-				this.data.core.li_height = this.get_container_ul().find("li.jstree-closed, li.jstree-leaf").eq(0).height() || 18;
-
-				this.get_container()
-					.delegate("li > ins", "click.jstree", $.proxy(function (event) {
-							var trgt = $(event.target);
-							if(trgt.is("ins") && event.pageY - trgt.offset().top < this.data.core.li_height) { this.toggle_node(trgt); }
-						}, this))
-					.bind("mousedown.jstree", $.proxy(function () { 
-							this.set_focus(); // This used to be setTimeout(set_focus,0) - why?
-						}, this))
-					.bind("dblclick.jstree", function (event) { 
-						var sel;
-						if(document.selection && document.selection.empty) { document.selection.empty(); }
-						else {
-							if(window.getSelection) {
-								sel = window.getSelection();
-								try { 
-									sel.removeAllRanges();
-									sel.collapse();
-								} catch (err) { }
-							}
-						}
-					});
-				if(this._get_settings().core.notify_plugins) {
-					this.get_container()
-						.bind("load_node.jstree", $.proxy(function (e, data) { 
-								var o = this._get_node(data.rslt.obj),
-									t = this;
-								if(o === -1) { o = this.get_container_ul(); }
-								if(!o.length) { return; }
-								o.find("li").each(function () {
-									var th = $(this);
-									if(th.data("jstree")) {
-										$.each(th.data("jstree"), function (plugin, values) {
-											if(t.data[plugin] && $.isFunction(t["_" + plugin + "_notify"])) {
-												t["_" + plugin + "_notify"].call(t, th, values);
-											}
-										});
-									}
-								});
-							}, this));
-				}
-				if(this._get_settings().core.load_open) {
-					this.get_container()
-						.bind("load_node.jstree", $.proxy(function (e, data) { 
-								var o = this._get_node(data.rslt.obj),
-									t = this;
-								if(o === -1) { o = this.get_container_ul(); }
-								if(!o.length) { return; }
-								o.find("li.jstree-open:not(:has(ul))").each(function () {
-									t.load_node(this, $.noop, $.noop);
-								});
-							}, this));
-				}
-				this.__callback();
-				this.load_node(-1, function () { this.loaded(); this.reload_nodes(); });
-			},
-			destroy	: function () { 
-				var i,
-					n = this.get_index(),
-					s = this._get_settings(),
-					_this = this;
-
-				$.each(s.plugins, function (i, val) {
-					try { plugins[val].__destroy.apply(_this); } catch(err) { }
-				});
-				this.__callback();
-				// set focus to another instance if this one is focused
-				if(this.is_focused()) { 
-					for(i in instances) { 
-						if(instances.hasOwnProperty(i) && i != n) { 
-							instances[i].set_focus(); 
-							break; 
-						} 
-					}
-				}
-				// if no other instance found
-				if(n === focused_instance) { focused_instance = -1; }
-				// remove all traces of jstree in the DOM (only the ones set using jstree*) and cleans all events
-				this.get_container()
-					.unbind(".jstree")
-					.undelegate(".jstree")
-					.removeData("jstree-instance-id")
-					.find("[class^='jstree']")
-						.andSelf()
-						.attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); });
-				$(document)
-					.unbind(".jstree-" + n)
-					.undelegate(".jstree-" + n);
-				// remove the actual data
-				instances[n] = null;
-				delete instances[n];
-			},
-
-			_core_notify : function (n, data) {
-				if(data.opened) {
-					this.open_node(n, false, true);
-				}
-			},
-
-			lock : function () {
-				this.data.core.locked = true;
-				this.get_container().children("ul").addClass("jstree-locked").css("opacity","0.7");
-				this.__callback({});
-			},
-			unlock : function () {
-				this.data.core.locked = false;
-				this.get_container().children("ul").removeClass("jstree-locked").css("opacity","1");
-				this.__callback({});
-			},
-			is_locked : function () { return this.data.core.locked; },
-			save_opened : function () {
-				var _this = this;
-				this.data.core.to_open = [];
-				this.get_container_ul().find("li.jstree-open").each(function () { 
-					if(this.id) { _this.data.core.to_open.push("#" + this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")); }
-				});
-				this.__callback(_this.data.core.to_open);
-			},
-			save_loaded : function () { },
-			reload_nodes : function (is_callback) {
-				var _this = this,
-					done = true,
-					current = [],
-					remaining = [];
-				if(!is_callback) { 
-					this.data.core.reopen = false; 
-					this.data.core.refreshing = true; 
-					this.data.core.to_open = $.map($.makeArray(this.data.core.to_open), function (n) { return "#" + n.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"); });
-					this.data.core.to_load = $.map($.makeArray(this.data.core.to_load), function (n) { return "#" + n.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"); });
-					if(this.data.core.to_open.length) {
-						this.data.core.to_load = this.data.core.to_load.concat(this.data.core.to_open);
-					}
-				}
-				if(this.data.core.to_load.length) {
-					$.each(this.data.core.to_load, function (i, val) {
-						if(val == "#") { return true; }
-						if($(val).length) { current.push(val); }
-						else { remaining.push(val); }
-					});
-					if(current.length) {
-						this.data.core.to_load = remaining;
-						$.each(current, function (i, val) { 
-							if(!_this._is_loaded(val)) {
-								_this.load_node(val, function () { _this.reload_nodes(true); }, function () { _this.reload_nodes(true); });
-								done = false;
-							}
-						});
-					}
-				}
-				if(this.data.core.to_open.length) {
-					$.each(this.data.core.to_open, function (i, val) {
-						_this.open_node(val, false, true); 
-					});
-				}
-				if(done) { 
-					// TODO: find a more elegant approach to syncronizing returning requests
-					if(this.data.core.reopen) { clearTimeout(this.data.core.reopen); }
-					this.data.core.reopen = setTimeout(function () { _this.__callback({}, _this); }, 50);
-					this.data.core.refreshing = false;
-					this.reopen();
-				}
-			},
-			reopen : function () {
-				var _this = this;
-				if(this.data.core.to_open.length) {
-					$.each(this.data.core.to_open, function (i, val) {
-						_this.open_node(val, false, true); 
-					});
-				}
-				this.__callback({});
-			},
-			refresh : function (obj) {
-				var _this = this;
-				this.save_opened();
-				if(!obj) { obj = -1; }
-				obj = this._get_node(obj);
-				if(!obj) { obj = -1; }
-				if(obj !== -1) { obj.children("UL").remove(); }
-				else { this.get_container_ul().empty(); }
-				this.load_node(obj, function () { _this.__callback({ "obj" : obj}); _this.reload_nodes(); });
-			},
-			// Dummy function to fire after the first load (so that there is a jstree.loaded event)
-			loaded	: function () { 
-				this.__callback(); 
-			},
-			// deal with focus
-			set_focus	: function () { 
-				if(this.is_focused()) { return; }
-				var f = $.jstree._focused();
-				if(f) { f.unset_focus(); }
-
-				this.get_container().addClass("jstree-focused"); 
-				focused_instance = this.get_index(); 
-				this.__callback();
-			},
-			is_focused	: function () { 
-				return focused_instance == this.get_index(); 
-			},
-			unset_focus	: function () {
-				if(this.is_focused()) {
-					this.get_container().removeClass("jstree-focused"); 
-					focused_instance = -1; 
-				}
-				this.__callback();
-			},
-
-			// traverse
-			_get_node		: function (obj) { 
-				var $obj = $(obj, this.get_container()); 
-				if($obj.is(".jstree") || obj == -1) { return -1; } 
-				$obj = $obj.closest("li", this.get_container()); 
-				return $obj.length ? $obj : false; 
-			},
-			_get_next		: function (obj, strict) {
-				obj = this._get_node(obj);
-				if(obj === -1) { return this.get_container().find("> ul > li:first-child"); }
-				if(!obj.length) { return false; }
-				if(strict) { return (obj.nextAll("li").size() > 0) ? obj.nextAll("li:eq(0)") : false; }
-
-				if(obj.hasClass("jstree-open")) { return obj.find("li:eq(0)"); }
-				else if(obj.nextAll("li").size() > 0) { return obj.nextAll("li:eq(0)"); }
-				else { return obj.parentsUntil(".jstree","li").next("li").eq(0); }
-			},
-			_get_prev		: function (obj, strict) {
-				obj = this._get_node(obj);
-				if(obj === -1) { return this.get_container().find("> ul > li:last-child"); }
-				if(!obj.length) { return false; }
-				if(strict) { return (obj.prevAll("li").length > 0) ? obj.prevAll("li:eq(0)") : false; }
-
-				if(obj.prev("li").length) {
-					obj = obj.prev("li").eq(0);
-					while(obj.hasClass("jstree-open")) { obj = obj.children("ul:eq(0)").children("li:last"); }
-					return obj;
-				}
-				else { var o = obj.parentsUntil(".jstree","li:eq(0)"); return o.length ? o : false; }
-			},
-			_get_parent		: function (obj) {
-				obj = this._get_node(obj);
-				if(obj == -1 || !obj.length) { return false; }
-				var o = obj.parentsUntil(".jstree", "li:eq(0)");
-				return o.length ? o : -1;
-			},
-			_get_children	: function (obj) {
-				obj = this._get_node(obj);
-				if(obj === -1) { return this.get_container().children("ul:eq(0)").children("li"); }
-				if(!obj.length) { return false; }
-				return obj.children("ul:eq(0)").children("li");
-			},
-			get_path		: function (obj, id_mode) {
-				var p = [],
-					_this = this;
-				obj = this._get_node(obj);
-				if(obj === -1 || !obj || !obj.length) { return false; }
-				obj.parentsUntil(".jstree", "li").each(function () {
-					p.push( id_mode ? this.id : _this.get_text(this) );
-				});
-				p.reverse();
-				p.push( id_mode ? obj.attr("id") : this.get_text(obj) );
-				return p;
-			},
-
-			// string functions
-			_get_string : function (key) {
-				return this._get_settings().core.strings[key] || key;
-			},
-
-			is_open		: function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-open"); },
-			is_closed	: function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-closed"); },
-			is_leaf		: function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-leaf"); },
-			correct_state	: function (obj) {
-				obj = this._get_node(obj);
-				if(!obj || obj === -1) { return false; }
-				obj.removeClass("jstree-closed jstree-open").addClass("jstree-leaf").children("ul").remove();
-				this.__callback({ "obj" : obj });
-			},
-			// open/close
-			open_node	: function (obj, callback, skip_animation) {
-				obj = this._get_node(obj);
-				if(!obj.length) { return false; }
-				if(!obj.hasClass("jstree-closed")) { if(callback) { callback.call(); } return false; }
-				var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,
-					t = this;
-				if(!this._is_loaded(obj)) {
-					obj.children("a").addClass("jstree-loading");
-					this.load_node(obj, function () { t.open_node(obj, callback, skip_animation); }, callback);
-				}
-				else {
-					if(this._get_settings().core.open_parents) {
-						obj.parentsUntil(".jstree",".jstree-closed").each(function () {
-							t.open_node(this, false, true);
-						});
-					}
-					if(s) { obj.children("ul").css("display","none"); }
-					obj.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading");
-					if(s) { obj.children("ul").stop(true, true).slideDown(s, function () { this.style.display = ""; t.after_open(obj); }); }
-					else { t.after_open(obj); }
-					this.__callback({ "obj" : obj });
-					if(callback) { callback.call(); }
-				}
-			},
-			after_open	: function (obj) { this.__callback({ "obj" : obj }); },
-			close_node	: function (obj, skip_animation) {
-				obj = this._get_node(obj);
-				var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,
-					t = this;
-				if(!obj.length || !obj.hasClass("jstree-open")) { return false; }
-				if(s) { obj.children("ul").attr("style","display:block !important"); }
-				obj.removeClass("jstree-open").addClass("jstree-closed");
-				if(s) { obj.children("ul").stop(true, true).slideUp(s, function () { this.style.display = ""; t.after_close(obj); }); }
-				else { t.after_close(obj); }
-				this.__callback({ "obj" : obj });
-			},
-			after_close	: function (obj) { this.__callback({ "obj" : obj }); },
-			toggle_node	: function (obj) {
-				obj = this._get_node(obj);
-				if(obj.hasClass("jstree-closed")) { return this.open_node(obj); }
-				if(obj.hasClass("jstree-open")) { return this.close_node(obj); }
-			},
-			open_all	: function (obj, do_animation, original_obj) {
-				obj = obj ? this._get_node(obj) : -1;
-				if(!obj || obj === -1) { obj = this.get_container_ul(); }
-				if(original_obj) { 
-					obj = obj.find("li.jstree-closed");
-				}
-				else {
-					original_obj = obj;
-					if(obj.is(".jstree-closed")) { obj = obj.find("li.jstree-closed").andSelf(); }
-					else { obj = obj.find("li.jstree-closed"); }
-				}
-				var _this = this;
-				obj.each(function () { 
-					var __this = this; 
-					if(!_this._is_loaded(this)) { _this.open_node(this, function() { _this.open_all(__this, do_animation, original_obj); }, !do_animation); }
-					else { _this.open_node(this, false, !do_animation); }
-				});
-				// so that callback is fired AFTER all nodes are open
-				if(original_obj.find('li.jstree-closed').length === 0) { this.__callback({ "obj" : original_obj }); }
-			},
-			close_all	: function (obj, do_animation) {
-				var _this = this;
-				obj = obj ? this._get_node(obj) : this.get_container();
-				if(!obj || obj === -1) { obj = this.get_container_ul(); }
-				obj.find("li.jstree-open").andSelf().each(function () { _this.close_node(this, !do_animation); });
-				this.__callback({ "obj" : obj });
-			},
-			clean_node	: function (obj) {
-				obj = obj && obj != -1 ? $(obj) : this.get_container_ul();
-				obj = obj.is("li") ? obj.find("li").andSelf() : obj.find("li");
-				obj.removeClass("jstree-last")
-					.filter("li:last-child").addClass("jstree-last").end()
-					.filter(":has(li)")
-						.not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");
-				obj.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove();
-				this.__callback({ "obj" : obj });
-			},
-			// rollback
-			get_rollback : function () { 
-				this.__callback();
-				return { i : this.get_index(), h : this.get_container().children("ul").clone(true), d : this.data }; 
-			},
-			set_rollback : function (html, data) {
-				this.get_container().empty().append(html);
-				this.data = data;
-				this.__callback();
-			},
-			// Dummy functions to be overwritten by any datastore plugin included
-			load_node	: function (obj, s_call, e_call) { this.__callback({ "obj" : obj }); },
-			_is_loaded	: function (obj) { return true; },
-
-			// Basic operations: create
-			create_node	: function (obj, position, js, callback, is_loaded) {
-				obj = this._get_node(obj);
-				position = typeof position === "undefined" ? "last" : position;
-				var d = $("<li />"),
-					s = this._get_settings().core,
-					tmp;
-
-				if(obj !== -1 && !obj.length) { return false; }
-				if(!is_loaded && !this._is_loaded(obj)) { this.load_node(obj, function () { this.create_node(obj, position, js, callback, true); }); return false; }
-
-				this.__rollback();
-
-				if(typeof js === "string") { js = { "data" : js }; }
-				if(!js) { js = {}; }
-				if(js.attr) { d.attr(js.attr); }
-				if(js.metadata) { d.data(js.metadata); }
-				if(js.state) { d.addClass("jstree-" + js.state); }
-				if(!js.data) { js.data = this._get_string("new_node"); }
-				if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }
-				$.each(js.data, function (i, m) {
-					tmp = $("<a />");
-					if($.isFunction(m)) { m = m.call(this, js); }
-					if(typeof m == "string") { tmp.attr('href','#')[ s.html_titles ? "html" : "text" ](m); }
-					else {
-						if(!m.attr) { m.attr = {}; }
-						if(!m.attr.href) { m.attr.href = '#'; }
-						tmp.attr(m.attr)[ s.html_titles ? "html" : "text" ](m.title);
-						if(m.language) { tmp.addClass(m.language); }
-					}
-					tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
-					if(m.icon) { 
-						if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
-						else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
-					}
-					d.append(tmp);
-				});
-				d.prepend("<ins class='jstree-icon'>&#160;</ins>");
-				if(obj === -1) {
-					obj = this.get_container();
-					if(position === "before") { position = "first"; }
-					if(position === "after") { position = "last"; }
-				}
-				switch(position) {
-					case "before": obj.before(d); tmp = this._get_parent(obj); break;
-					case "after" : obj.after(d);  tmp = this._get_parent(obj); break;
-					case "inside":
-					case "first" :
-						if(!obj.children("ul").length) { obj.append("<ul />"); }
-						obj.children("ul").prepend(d);
-						tmp = obj;
-						break;
-					case "last":
-						if(!obj.children("ul").length) { obj.append("<ul />"); }
-						obj.children("ul").append(d);
-						tmp = obj;
-						break;
-					default:
-						if(!obj.children("ul").length) { obj.append("<ul />"); }
-						if(!position) { position = 0; }
-						tmp = obj.children("ul").children("li").eq(position);
-						if(tmp.length) { tmp.before(d); }
-						else { obj.children("ul").append(d); }
-						tmp = obj;
-						break;
-				}
-				if(tmp === -1 || tmp.get(0) === this.get_container().get(0)) { tmp = -1; }
-				this.clean_node(tmp);
-				this.__callback({ "obj" : d, "parent" : tmp });
-				if(callback) { callback.call(this, d); }
-				return d;
-			},
-			// Basic operations: rename (deal with text)
-			get_text	: function (obj) {
-				obj = this._get_node(obj);
-				if(!obj.length) { return false; }
-				var s = this._get_settings().core.html_titles;
-				obj = obj.children("a:eq(0)");
-				if(s) {
-					obj = obj.clone();
-					obj.children("INS").remove();
-					return obj.html();
-				}
-				else {
-					obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
-					return obj.nodeValue;
-				}
-			},
-			set_text	: function (obj, val) {
-				obj = this._get_node(obj);
-				if(!obj.length) { return false; }
-				obj = obj.children("a:eq(0)");
-				if(this._get_settings().core.html_titles) {
-					var tmp = obj.children("INS").clone();
-					obj.html(val).prepend(tmp);
-					this.__callback({ "obj" : obj, "name" : val });
-					return true;
-				}
-				else {
-					obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
-					this.__callback({ "obj" : obj, "name" : val });
-					return (obj.nodeValue = val);
-				}
-			},
-			rename_node : function (obj, val) {
-				obj = this._get_node(obj);
-				this.__rollback();
-				if(obj && obj.length && this.set_text.apply(this, Array.prototype.slice.call(arguments))) { this.__callback({ "obj" : obj, "name" : val }); }
-			},
-			// Basic operations: deleting nodes
-			delete_node : function (obj) {
-				obj = this._get_node(obj);
-				if(!obj.length) { return false; }
-				this.__rollback();
-				var p = this._get_parent(obj), prev = $([]), t = this;
-				obj.each(function () {
-					prev = prev.add(t._get_prev(this));
-				});
-				obj = obj.detach();
-				if(p !== -1 && p.find("> ul > li").length === 0) {
-					p.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
-				}
-				this.clean_node(p);
-				this.__callback({ "obj" : obj, "prev" : prev, "parent" : p });
-				return obj;
-			},
-			prepare_move : function (o, r, pos, cb, is_cb) {
-				var p = {};
-
-				p.ot = $.jstree._reference(o) || this;
-				p.o = p.ot._get_node(o);
-				p.r = r === - 1 ? -1 : this._get_node(r);
-				p.p = (typeof pos === "undefined" || pos === false) ? "last" : pos; // TODO: move to a setting
-				if(!is_cb && prepared_move.o && prepared_move.o[0] === p.o[0] && prepared_move.r[0] === p.r[0] && prepared_move.p === p.p) {
-					this.__callback(prepared_move);
-					if(cb) { cb.call(this, prepared_move); }
-					return;
-				}
-				p.ot = $.jstree._reference(p.o) || this;
-				p.rt = $.jstree._reference(p.r) || this; // r === -1 ? p.ot : $.jstree._reference(p.r) || this
-				if(p.r === -1 || !p.r) {
-					p.cr = -1;
-					switch(p.p) {
-						case "first":
-						case "before":
-						case "inside":
-							p.cp = 0; 
-							break;
-						case "after":
-						case "last":
-							p.cp = p.rt.get_container().find(" > ul > li").length; 
-							break;
-						default:
-							p.cp = p.p;
-							break;
-					}
-				}
-				else {
-					if(!/^(before|after)$/.test(p.p) && !this._is_loaded(p.r)) {
-						return this.load_node(p.r, function () { this.prepare_move(o, r, pos, cb, true); });
-					}
-					switch(p.p) {
-						case "before":
-							p.cp = p.r.index();
-							p.cr = p.rt._get_parent(p.r);
-							break;
-						case "after":
-							p.cp = p.r.index() + 1;
-							p.cr = p.rt._get_parent(p.r);
-							break;
-						case "inside":
-						case "first":
-							p.cp = 0;
-							p.cr = p.r;
-							break;
-						case "last":
-							p.cp = p.r.find(" > ul > li").length; 
-							p.cr = p.r;
-							break;
-						default: 
-							p.cp = p.p;
-							p.cr = p.r;
-							break;
-					}
-				}
-				p.np = p.cr == -1 ? p.rt.get_container() : p.cr;
-				p.op = p.ot._get_parent(p.o);
-				p.cop = p.o.index();
-				if(p.op === -1) { p.op = p.ot ? p.ot.get_container() : this.get_container(); }
-				if(!/^(before|after)$/.test(p.p) && p.op && p.np && p.op[0] === p.np[0] && p.o.index() < p.cp) { p.cp++; }
-				//if(p.p === "before" && p.op && p.np && p.op[0] === p.np[0] && p.o.index() < p.cp) { p.cp--; }
-				p.or = p.np.find(" > ul > li:nth-child(" + (p.cp + 1) + ")");
-				prepared_move = p;
-				this.__callback(prepared_move);
-				if(cb) { cb.call(this, prepared_move); }
-			},
-			check_move : function () {
-				var obj = prepared_move, ret = true, r = obj.r === -1 ? this.get_container() : obj.r;
-				if(!obj || !obj.o || obj.or[0] === obj.o[0]) { return false; }
-				if(obj.op && obj.np && obj.op[0] === obj.np[0] && obj.cp - 1 === obj.o.index()) { return false; }
-				obj.o.each(function () { 
-					if(r.parentsUntil(".jstree", "li").andSelf().index(this) !== -1) { ret = false; return false; }
-				});
-				return ret;
-			},
-			move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
-				if(!is_prepared) { 
-					return this.prepare_move(obj, ref, position, function (p) {
-						this.move_node(p, false, false, is_copy, true, skip_check);
-					});
-				}
-				if(is_copy) { 
-					prepared_move.cy = true;
-				}
-				if(!skip_check && !this.check_move()) { return false; }
-
-				this.__rollback();
-				var o = false;
-				if(is_copy) {
-					o = obj.o.clone(true);
-					o.find("*[id]").andSelf().each(function () {
-						if(this.id) { this.id = "copy_" + this.id; }
-					});
-				}
-				else { o = obj.o; }
-
-				if(obj.or.length) { obj.or.before(o); }
-				else { 
-					if(!obj.np.children("ul").length) { $("<ul />").appendTo(obj.np); }
-					obj.np.children("ul:eq(0)").append(o); 
-				}
-
-				try { 
-					obj.ot.clean_node(obj.op);
-					obj.rt.clean_node(obj.np);
-					if(!obj.op.find("> ul > li").length) {
-						obj.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove();
-					}
-				} catch (e) { }
-
-				if(is_copy) { 
-					prepared_move.cy = true;
-					prepared_move.oc = o; 
-				}
-				this.__callback(prepared_move);
-				return prepared_move;
-			},
-			_get_move : function () { return prepared_move; }
-		}
-	});
-})(jQuery);
-//*/
-
-/* 
- * jsTree ui plugin
- * This plugins handles selecting/deselecting/hovering/dehovering nodes
- */
-(function ($) {
-	var scrollbar_width, e1, e2;
-	$(function() {
-		if (/msie/.test(navigator.userAgent.toLowerCase())) {
-			e1 = $('<textarea cols="10" rows="2"></textarea>').css({ position: 'absolute', top: -1000, left: 0 }).appendTo('body');
-			e2 = $('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>').css({ position: 'absolute', top: -1000, left: 0 }).appendTo('body');
-			scrollbar_width = e1.width() - e2.width();
-			e1.add(e2).remove();
-		} 
-		else {
-			e1 = $('<div />').css({ width: 100, height: 100, overflow: 'auto', position: 'absolute', top: -1000, left: 0 })
-					.prependTo('body').append('<div />').find('div').css({ width: '100%', height: 200 });
-			scrollbar_width = 100 - e1.width();
-			e1.parent().remove();
-		}
-	});
-	$.jstree.plugin("ui", {
-		__init : function () { 
-			this.data.ui.selected = $(); 
-			this.data.ui.last_selected = false; 
-			this.data.ui.hovered = null;
-			this.data.ui.to_select = this.get_settings().ui.initially_select;
-
-			this.get_container()
-				.delegate("a", "click.jstree", $.proxy(function (event) {
-						event.preventDefault();
-						event.currentTarget.blur();
-						if(!$(event.currentTarget).hasClass("jstree-loading")) {
-							this.select_node(event.currentTarget, true, event);
-						}
-					}, this))
-				.delegate("a", "mouseenter.jstree", $.proxy(function (event) {
-						if(!$(event.currentTarget).hasClass("jstree-loading")) {
-							this.hover_node(event.target);
-						}
-					}, this))
-				.delegate("a", "mouseleave.jstree", $.proxy(function (event) {
-						if(!$(event.currentTarget).hasClass("jstree-loading")) {
-							this.dehover_node(event.target);
-						}
-					}, this))
-				.bind("reopen.jstree", $.proxy(function () { 
-						this.reselect();
-					}, this))
-				.bind("get_rollback.jstree", $.proxy(function () { 
-						this.dehover_node();
-						this.save_selected();
-					}, this))
-				.bind("set_rollback.jstree", $.proxy(function () { 
-						this.reselect();
-					}, this))
-				.bind("close_node.jstree", $.proxy(function (event, data) { 
-						var s = this._get_settings().ui,
-							obj = this._get_node(data.rslt.obj),
-							clk = (obj && obj.length) ? obj.children("ul").find("a.jstree-clicked") : $(),
-							_this = this;
-						if(s.selected_parent_close === false || !clk.length) { return; }
-						clk.each(function () { 
-							_this.deselect_node(this);
-							if(s.selected_parent_close === "select_parent") { _this.select_node(obj); }
-						});
-					}, this))
-				.bind("delete_node.jstree", $.proxy(function (event, data) { 
-						var s = this._get_settings().ui.select_prev_on_delete,
-							obj = this._get_node(data.rslt.obj),
-							clk = (obj && obj.length) ? obj.find("a.jstree-clicked") : [],
-							_this = this;
-						clk.each(function () { _this.deselect_node(this); });
-						if(s && clk.length) { 
-							data.rslt.prev.each(function () { 
-								if(this.parentNode) { _this.select_node(this); return false; /* if return false is removed all prev nodes will be selected */}
-							});
-						}
-					}, this))
-				.bind("move_node.jstree", $.proxy(function (event, data) { 
-						if(data.rslt.cy) { 
-							data.rslt.oc.find("a.jstree-clicked").removeClass("jstree-clicked");
-						}
-					}, this));
-		},
-		defaults : {
-			select_limit : -1, // 0, 1, 2 ... or -1 for unlimited
-			select_multiple_modifier : "ctrl", // on, or ctrl, shift, alt
-			select_range_modifier : "shift",
-			selected_parent_close : "select_parent", // false, "deselect", "select_parent"
-			selected_parent_open : true,
-			select_prev_on_delete : true,
-			disable_selecting_children : false,
-			initially_select : []
-		},
-		_fn : { 
-			_get_node : function (obj, allow_multiple) {
-				if(typeof obj === "undefined" || obj === null) { return allow_multiple ? this.data.ui.selected : this.data.ui.last_selected; }
-				var $obj = $(obj, this.get_container()); 
-				if($obj.is(".jstree") || obj == -1) { return -1; } 
-				$obj = $obj.closest("li", this.get_container()); 
-				return $obj.length ? $obj : false; 
-			},
-			_ui_notify : function (n, data) {
-				if(data.selected) {
-					this.select_node(n, false);
-				}
-			},
-			save_selected : function () {
-				var _this = this;
-				this.data.ui.to_select = [];
-				this.data.ui.selected.each(function () { if(this.id) { _this.data.ui.to_select.push("#" + this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")); } });
-				this.__callback(this.data.ui.to_select);
-			},
-			reselect : function () {
-				var _this = this,
-					s = this.data.ui.to_select;
-				s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"); });
-				// this.deselect_all(); WHY deselect, breaks plugin state notifier?
-				$.each(s, function (i, val) { if(val && val !== "#") { _this.select_node(val); } });
-				this.data.ui.selected = this.data.ui.selected.filter(function () { return this.parentNode; });
-				this.__callback();
-			},
-			refresh : function (obj) {
-				this.save_selected();
-				return this.__call_old();
-			},
-			hover_node : function (obj) {
-				obj = this._get_node(obj);
-				if(!obj.length) { return false; }
-				//if(this.data.ui.hovered && obj.get(0) === this.data.ui.hovered.get(0)) { return; }
-				if(!obj.hasClass("jstree-hovered")) { this.dehover_node(); }
-				this.data.ui.hovered = obj.children("a").addClass("jstree-hovered").parent();
-				this._fix_scroll(obj);
-				this.__callback({ "obj" : obj });
-			},
-			dehover_node : function () {
-				var obj = this.data.ui.hovered, p;
-				if(!obj || !obj.length) { return false; }
-				p = obj.children("a").removeClass("jstree-hovered").parent();
-				if(this.data.ui.hovered[0] === p[0]) { this.data.ui.hovered = null; }
-				this.__callback({ "obj" : obj });
-			},
-			select_node : function (obj, check, e) {
-				obj = this._get_node(obj);
-				if(obj == -1 || !obj || !obj.length) { return false; }
-				var s = this._get_settings().ui,
-					is_multiple = (s.select_multiple_modifier == "on" || (s.select_multiple_modifier !== false && e && e[s.select_multiple_modifier + "Key"])),
-					is_range = (s.select_range_modifier !== false && e && e[s.select_range_modifier + "Key"] && this.data.ui.last_selected && this.data.ui.last_selected[0] !== obj[0] && this.data.ui.last_selected.parent()[0] === obj.parent()[0]),
-					is_selected = this.is_selected(obj),
-					proceed = true,
-					t = this;
-				if(check) {
-					if(s.disable_selecting_children && is_multiple && 
-						(
-							(obj.parentsUntil(".jstree","li").children("a.jstree-clicked").length) ||
-							(obj.children("ul").find("a.jstree-clicked:eq(0)").length)
-						)
-					) {
-						return false;
-					}
-					proceed = false;
-					switch(!0) {
-						case (is_range):
-							this.data.ui.last_selected.addClass("jstree-last-selected");
-							obj = obj[ obj.index() < this.data.ui.last_selected.index() ? "nextUntil" : "prevUntil" ](".jstree-last-selected").andSelf();
-							if(s.select_limit == -1 || obj.length < s.select_limit) {
-								this.data.ui.last_selected.removeClass("jstree-last-selected");
-								this.data.ui.selected.each(function () {
-									if(this !== t.data.ui.last_selected[0]) { t.deselect_node(this); }
-								});
-								is_selected = false;
-								proceed = true;
-							}
-							else {
-								proceed = false;
-							}
-							break;
-						case (is_selected && !is_multiple): 
-							this.deselect_all();
-							is_selected = false;
-							proceed = true;
-							break;
-						case (!is_selected && !is_multiple): 
-							if(s.select_limit == -1 || s.select_limit > 0) {
-								this.deselect_all();
-								proceed = true;
-							}
-							break;
-						case (is_selected && is_multiple): 
-							this.deselect_node(obj);
-							break;
-						case (!is_selected && is_multiple): 
-							if(s.select_limit == -1 || this.data.ui.selected.length + 1 <= s.select_limit) { 
-								proceed = true;
-							}
-							break;
-					}
-				}
-				if(proceed && !is_selected) {
-					if(!is_range) { this.data.ui.last_selected = obj; }
-					obj.children("a").addClass("jstree-clicked");
-					if(s.selected_parent_open) {
-						obj.parents(".jstree-closed").each(function () { t.open_node(this, false, true); });
-					}
-					this.data.ui.selected = this.data.ui.selected.add(obj);
-					this._fix_scroll(obj.eq(0));
-					this.__callback({ "obj" : obj, "e" : e });
-				}
-			},
-			_fix_scroll : function (obj) {
-				var c = this.get_container()[0], t;
-				if(c.scrollHeight > c.offsetHeight) {
-					obj = this._get_node(obj);
-					if(!obj || obj === -1 || !obj.length || !obj.is(":visible")) { return; }
-					t = obj.offset().top - this.get_container().offset().top;
-					if(t < 0) { 
-						c.scrollTop = c.scrollTop + t - 1; 
-					}
-					if(t + this.data.core.li_height + (c.scrollWidth > c.offsetWidth ? scrollbar_width : 0) > c.offsetHeight) { 
-						c.scrollTop = c.scrollTop + (t - c.offsetHeight + this.data.core.li_height + 1 + (c.scrollWidth > c.offsetWidth ? scrollbar_width : 0)); 
-					}
-				}
-			},
-			deselect_node : function (obj) {
-				obj = this._get_node(obj);
-				if(!obj.length) { return false; }
-				if(this.is_selected(obj)) {
-					obj.children("a").removeClass("jstree-clicked");
-					this.data.ui.selected = this.data.ui.selected.not(obj);
-					if(this.data.ui.last_selected.get(0) === obj.get(0)) { this.data.ui.last_selected = this.data.ui.selected.eq(0); }
-					this.__callback({ "obj" : obj });
-				}
-			},
-			toggle_select : function (obj) {
-				obj = this._get_node(obj);
-				if(!obj.length) { return false; }
-				if(this.is_selected(obj)) { this.deselect_node(obj); }
-				else { this.select_node(obj); }
-			},
-			is_selected : function (obj) { return this.data.ui.selected.index(this._get_node(obj)) >= 0; },
-			get_selected : function (context) { 
-				return context ? $(context).find("a.jstree-clicked").parent() : this.data.ui.selected; 
-			},
-			deselect_all : function (context) {
-				var ret = context ? $(context).find("a.jstree-clicked").parent() : this.get_container().find("a.jstree-clicked").parent();
-				ret.children("a.jstree-clicked").removeClass("jstree-clicked");
-				this.data.ui.selected = $([]);
-				this.data.ui.last_selected = false;
-				this.__callback({ "obj" : ret });
-			}
-		}
-	});
-	// include the selection plugin by default
-	$.jstree.defaults.plugins.push("ui");
-})(jQuery);
-//*/
-
-/* 
- * jsTree CRRM plugin
- * Handles creating/renaming/removing/moving nodes by user interaction.
- */
-(function ($) {
-	$.jstree.plugin("crrm", { 
-		__init : function () {
-			this.get_container()
-				.bind("move_node.jstree", $.proxy(function (e, data) {
-					if(this._get_settings().crrm.move.open_onmove) {
-						var t = this;
-						data.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function () {
-							t.open_node(this, false, true);
-						});
-					}
-				}, this));
-		},
-		defaults : {
-			input_width_limit : 200,
-			move : {
-				always_copy			: false, // false, true or "multitree"
-				open_onmove			: true,
-				default_position	: "last",
-				check_move			: function (m) { return true; }
-			}
-		},
-		_fn : {
-			_show_input : function (obj, callback) {
-				obj = this._get_node(obj);
-				var rtl = this._get_settings().core.rtl,
-					w = this._get_settings().crrm.input_width_limit,
-					w1 = obj.children("ins").width(),
-					w2 = obj.find("> a:visible > ins").width() * obj.find("> a:visible > ins").length,
-					t = this.get_text(obj),
-					h1 = $("<div />", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo("body"),
-					h2 = obj.css("position","relative").append(
-					$("<input />", { 
-						"value" : t,
-						"class" : "jstree-rename-input",
-						// "size" : t.length,
-						"css" : {
-							"padding" : "0",
-							"border" : "1px solid silver",
-							"position" : "absolute",
-							"left"  : (rtl ? "auto" : (w1 + w2 + 4) + "px"),
-							"right" : (rtl ? (w1 + w2 + 4) + "px" : "auto"),
-							"top" : "0px",
-							"height" : (this.data.core.li_height - 2) + "px",
-							"lineHeight" : (this.data.core.li_height - 2) + "px",
-							"width" : "150px" // will be set a bit further down
-						},
-						"blur" : $.proxy(function () {
-							var i = obj.children(".jstree-rename-input"),
-								v = i.val();
-							if(v === "") { v = t; }
-							h1.remove();
-							i.remove(); // rollback purposes
-							this.set_text(obj,t); // rollback purposes
-							this.rename_node(obj, v);
-							callback.call(this, obj, v, t);
-							obj.css("position","");
-						}, this),
-						"keyup" : function (event) {
-							var key = event.keyCode || event.which;
-							if(key == 27) { this.value = t; this.blur(); return; }
-							else if(key == 13) { this.blur(); return; }
-							else {
-								h2.width(Math.min(h1.text("pW" + this.value).width(),w));
-							}
-						},
-						"keypress" : function(event) {
-							var key = event.keyCode || event.which;
-							if(key == 13) { return false; }
-						}
-					})
-				).children(".jstree-rename-input"); 
-				this.set_text(obj, "");
-				h1.css({
-						fontFamily		: h2.css('fontFamily')		|| '',
-						fontSize		: h2.css('fontSize')		|| '',
-						fontWeight		: h2.css('fontWeight')		|| '',
-						fontStyle		: h2.css('fontStyle')		|| '',
-						fontStretch		: h2.css('fontStretch')		|| '',
-						fontVariant		: h2.css('fontVariant')		|| '',
-						letterSpacing	: h2.css('letterSpacing')	|| '',
-						wordSpacing		: h2.css('wordSpacing')		|| ''
-				});
-				h2.width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select();
-			},
-			rename : function (obj) {
-				obj = this._get_node(obj);
-				this.__rollback();
-				var f = this.__callback;
-				this._show_input(obj, function (obj, new_name, old_name) { 
-					f.call(this, { "obj" : obj, "new_name" : new_name, "old_name" : old_name });
-				});
-			},
-			create : function (obj, position, js, callback, skip_rename) {
-				var t, _this = this;
-				obj = this._get_node(obj);
-				if(!obj) { obj = -1; }
-				this.__rollback();
-				t = this.create_node(obj, position, js, function (t) {
-					var p = this._get_parent(t),
-						pos = $(t).index();
-					if(callback) { callback.call(this, t); }
-					if(p.length && p.hasClass("jstree-closed")) { this.open_node(p, false, true); }
-					if(!skip_rename) { 
-						this._show_input(t, function (obj, new_name, old_name) { 
-							_this.__callback({ "obj" : obj, "name" : new_name, "parent" : p, "position" : pos });
-						});
-					}
-					else { _this.__callback({ "obj" : t, "name" : this.get_text(t), "parent" : p, "position" : pos }); }
-				});
-				return t;
-			},
-			remove : function (obj) {
-				obj = this._get_node(obj, true);
-				var p = this._get_parent(obj), prev = this._get_prev(obj);
-				this.__rollback();
-				obj = this.delete_node(obj);
-				if(obj !== false) { this.__callback({ "obj" : obj, "prev" : prev, "parent" : p }); }
-			},
-			check_move : function () {
-				if(!this.__call_old()) { return false; }
-				var s = this._get_settings().crrm.move;
-				if(!s.check_move.call(this, this._get_move())) { return false; }
-				return true;
-			},
-			move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
-				var s = this._get_settings().crrm.move;
-				if(!is_prepared) { 
-					if(typeof position === "undefined") { position = s.default_position; }
-					if(position === "inside" && !s.default_position.match(/^(before|after)$/)) { position = s.default_position; }
-					return this.__call_old(true, obj, ref, position, is_copy, false, skip_check);
-				}
-				// if the move is already prepared
-				if(s.always_copy === true || (s.always_copy === "multitree" && obj.rt.get_index() !== obj.ot.get_index() )) {
-					is_copy = true;
-				}
-				this.__call_old(true, obj, ref, position, is_copy, true, skip_check);
-			},
-
-			cut : function (obj) {
-				obj = this._get_node(obj, true);
-				if(!obj || !obj.length) { return false; }
-				this.data.crrm.cp_nodes = false;
-				this.data.crrm.ct_nodes = obj;
-				this.__callback({ "obj" : obj });
-			},
-			copy : function (obj) {
-				obj = this._get_node(obj, true);
-				if(!obj || !obj.length) { return false; }
-				this.data.crrm.ct_nodes = false;
-				this.data.crrm.cp_nodes = obj;
-				this.__callback({ "obj" : obj });
-			},
-			paste : function (obj) { 
-				obj = this._get_node(obj);
-				if(!obj || !obj.length) { return false; }
-				var nodes = this.data.crrm.ct_nodes ? this.data.crrm.ct_nodes : this.data.crrm.cp_nodes;
-				if(!this.data.crrm.ct_nodes && !this.data.crrm.cp_nodes) { return false; }
-				if(this.data.crrm.ct_nodes) { this.move_node(this.data.crrm.ct_nodes, obj); this.data.crrm.ct_nodes = false; }
-				if(this.data.crrm.cp_nodes) { this.move_node(this.data.crrm.cp_nodes, obj, false, true); }
-				this.__callback({ "obj" : obj, "nodes" : nodes });
-			}
-		}
-	});
-	// include the crr plugin by default
-	// $.jstree.defaults.plugins.push("crrm");
-})(jQuery);
-//*/
-
-/* 
- * jsTree themes plugin
- * Handles loading and setting themes, as well as detecting path to themes, etc.
- */
-(function ($) {
-	var themes_loaded = [];
-	// this variable stores the path to the themes folder - if left as false - it will be autodetected
-	$.jstree._themes = false;
-	$.jstree.plugin("themes", {
-		__init : function () { 
-			this.get_container()
-				.bind("init.jstree", $.proxy(function () {
-						var s = this._get_settings().themes;
-						this.data.themes.dots = s.dots; 
-						this.data.themes.icons = s.icons; 
-						this.set_theme(s.theme, s.url);
-					}, this))
-				.bind("loaded.jstree", $.proxy(function () {
-						// bound here too, as simple HTML tree's won't honor dots & icons otherwise
-						if(!this.data.themes.dots) { this.hide_dots(); }
-						else { this.show_dots(); }
-						if(!this.data.themes.icons) { this.hide_icons(); }
-						else { this.show_icons(); }
-					}, this));
-		},
-		defaults : { 
-			theme : "default", 
-			url : false,
-			dots : true,
-			icons : true
-		},
-		_fn : {
-			set_theme : function (theme_name, theme_url) {
-				if(!theme_name) { return false; }
-				if(!theme_url) { theme_url = $.jstree._themes + theme_name + '/style.css'; }
-				if($.inArray(theme_url, themes_loaded) == -1) {
-					$.vakata.css.add_sheet({ "url" : theme_url });
-					themes_loaded.push(theme_url);
-				}
-				if(this.data.themes.theme != theme_name) {
-					this.get_container().removeClass('jstree-' + this.data.themes.theme);
-					this.data.themes.theme = theme_name;
-				}
-				this.get_container().addClass('jstree-' + theme_name);
-				if(!this.data.themes.dots) { this.hide_dots(); }
-				else { this.show_dots(); }
-				if(!this.data.themes.icons) { this.hide_icons(); }
-				else { this.show_icons(); }
-				this.__callback();
-			},
-			get_theme	: function () { return this.data.themes.theme; },
-
-			show_dots	: function () { this.data.themes.dots = true; this.get_container().children("ul").removeClass("jstree-no-dots"); },
-			hide_dots	: function () { this.data.themes.dots = false; this.get_container().children("ul").addClass("jstree-no-dots"); },
-			toggle_dots	: function () { if(this.data.themes.dots) { this.hide_dots(); } else { this.show_dots(); } },
-
-			show_icons	: function () { this.data.themes.icons = true; this.get_container().children("ul").removeClass("jstree-no-icons"); },
-			hide_icons	: function () { this.data.themes.icons = false; this.get_container().children("ul").addClass("jstree-no-icons"); },
-			toggle_icons: function () { if(this.data.themes.icons) { this.hide_icons(); } else { this.show_icons(); } }
-		}
-	});
-	// autodetect themes path
-	$(function () {
-		if($.jstree._themes === false) {
-			$("script").each(function () { 
-				if(this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/)) { 
-					$.jstree._themes = this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/, "") + 'themes/'; 
-					return false; 
-				}
-			});
-		}
-		if($.jstree._themes === false) { $.jstree._themes = "themes/"; }
-	});
-	// include the themes plugin by default
-	$.jstree.defaults.plugins.push("themes");
-})(jQuery);
-//*/
-
-/*
- * jsTree hotkeys plugin
- * Enables keyboard navigation for all tree instances
- * Depends on the jstree ui & jquery hotkeys plugins
- */
-(function ($) {
-	var bound = [];
-	function exec(i, event) {
-		var f = $.jstree._focused(), tmp;
-		if(f && f.data && f.data.hotkeys && f.data.hotkeys.enabled) { 
-			tmp = f._get_settings().hotkeys[i];
-			if(tmp) { return tmp.call(f, event); }
-		}
-	}
-	$.jstree.plugin("hotkeys", {
-		__init : function () {
-			if(typeof $.hotkeys === "undefined") { throw "jsTree hotkeys: jQuery hotkeys plugin not included."; }
-			if(!this.data.ui) { throw "jsTree hotkeys: jsTree UI plugin not included."; }
-			$.each(this._get_settings().hotkeys, function (i, v) {
-				if(v !== false && $.inArray(i, bound) == -1) {
-					$(document).bind("keydown", i, function (event) { return exec(i, event); });
-					bound.push(i);
-				}
-			});
-			this.get_container()
-				.bind("lock.jstree", $.proxy(function () {
-						if(this.data.hotkeys.enabled) { this.data.hotkeys.enabled = false; this.data.hotkeys.revert = true; }
-					}, this))
-				.bind("unlock.jstree", $.proxy(function () {
-						if(this.data.hotkeys.revert) { this.data.hotkeys.enabled = true; }
-					}, this));
-			this.enable_hotkeys();
-		},
-		defaults : {
-			"up" : function () { 
-				var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
-				this.hover_node(this._get_prev(o));
-				return false; 
-			},
-			"ctrl+up" : function () { 
-				var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
-				this.hover_node(this._get_prev(o));
-				return false; 
-			},
-			"shift+up" : function () { 
-				var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
-				this.hover_node(this._get_prev(o));
-				return false; 
-			},
-			"down" : function () { 
-				var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
-				this.hover_node(this._get_next(o));
-				return false;
-			},
-			"ctrl+down" : function () { 
-				var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
-				this.hover_node(this._get_next(o));
-				return false;
-			},
-			"shift+down" : function () { 
-				var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
-				this.hover_node(this._get_next(o));
-				return false;
-			},
-			"left" : function () { 
-				var o = this.data.ui.hovered || this.data.ui.last_selected;
-				if(o) {
-					if(o.hasClass("jstree-open")) { this.close_node(o); }
-					else { this.hover_node(this._get_prev(o)); }
-				}
-				return false;
-			},
-			"ctrl+left" : function () { 
-				var o = this.data.ui.hovered || this.data.ui.last_selected;
-				if(o) {
-					if(o.hasClass("jstree-open")) { this.close_node(o); }
-					else { this.hover_node(this._get_prev(o)); }
-				}
-				return false;
-			},
-			"shift+left" : function () { 
-				var o = this.data.ui.hovered || this.data.ui.last_selected;
-				if(o) {
-					if(o.hasClass("jstree-open")) { this.close_node(o); }
-					else { this.hover_node(this._get_prev(o)); }
-				}
-				return false;
-			},
-			"right" : function () { 
-				var o = this.data.ui.hovered || this.data.ui.last_selected;
-				if(o && o.length) {
-					if(o.hasClass("jstree-closed")) { this.open_node(o); }
-					else { this.hover_node(this._get_next(o)); }
-				}
-				return false;
-			},
-			"ctrl+right" : function () { 
-				var o = this.data.ui.hovered || this.data.ui.last_selected;
-				if(o && o.length) {
-					if(o.hasClass("jstree-closed")) { this.open_node(o); }
-					else { this.hover_node(this._get_next(o)); }
-				}
-				return false;
-			},
-			"shift+right" : function () { 
-				var o = this.data.ui.hovered || this.data.ui.last_selected;
-				if(o && o.length) {
-					if(o.hasClass("jstree-closed")) { this.open_node(o); }
-					else { this.hover_node(this._get_next(o)); }
-				}
-				return false;
-			},
-			"space" : function () { 
-				if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").click(); } 
-				return false; 
-			},
-			"ctrl+space" : function (event) { 
-				event.type = "click";
-				if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").trigger(event); } 
-				return false; 
-			},
-			"shift+space" : function (event) { 
-				event.type = "click";
-				if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").trigger(event); } 
-				return false; 
-			},
-			"f2" : function () { this.rename(this.data.ui.hovered || this.data.ui.last_selected); },
-			"del" : function () { this.remove(this.data.ui.hovered || this._get_node(null)); }
-		},
-		_fn : {
-			enable_hotkeys : function () {
-				this.data.hotkeys.enabled = true;
-			},
-			disable_hotkeys : function () {
-				this.data.hotkeys.enabled = false;
-			}
-		}
-	});
-})(jQuery);
-//*/
-
-/* 
- * jsTree JSON plugin
- * The JSON data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.
- */
-(function ($) {
-	$.jstree.plugin("json_data", {
-		__init : function() {
-			var s = this._get_settings().json_data;
-			if(s.progressive_unload) {
-				this.get_container().bind("after_close.jstree", function (e, data) {
-					data.rslt.obj.children("ul").remove();
-				});
-			}
-		},
-		defaults : { 
-			// `data` can be a function:
-			//  * accepts two arguments - node being loaded and a callback to pass the result to
-			//  * will be executed in the current tree's scope & ajax won't be supported
-			data : false, 
-			ajax : false,
-			correct_state : true,
-			progressive_render : false,
-			progressive_unload : false
-		},
-		_fn : {
-			load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_json(obj, function () { _this.__callback({ "obj" : _this._get_node(obj) }); s_call.call(this); }, e_call); },
-			_is_loaded : function (obj) { 
-				var s = this._get_settings().json_data;
-				obj = this._get_node(obj); 
-				return obj == -1 || !obj || (!s.ajax && !s.progressive_render && !$.isFunction(s.data)) || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").length > 0;
-			},
-			refresh : function (obj) {
-				obj = this._get_node(obj);
-				var s = this._get_settings().json_data;
-				if(obj && obj !== -1 && s.progressive_unload && ($.isFunction(s.data) || !!s.ajax)) {
-					obj.removeData("jstree-children");
-				}
-				return this.__call_old();
-			},
-			load_node_json : function (obj, s_call, e_call) {
-				var s = this.get_settings().json_data, d,
-					error_func = function () {},
-					success_func = function () {};
-				obj = this._get_node(obj);
-
-				if(obj && obj !== -1 && (s.progressive_render || s.progressive_unload) && !obj.is(".jstree-open, .jstree-leaf") && obj.children("ul").children("li").length === 0 && obj.data("jstree-children")) {
-					d = this._parse_json(obj.data("jstree-children"), obj);
-					if(d) {
-						obj.append(d);
-						if(!s.progressive_unload) { obj.removeData("jstree-children"); }
-					}
-					this.clean_node(obj);
-					if(s_call) { s_call.call(this); }
-					return;
-				}
-
-				if(obj && obj !== -1) {
-					if(obj.data("jstree-is-loading")) { return; }
-					else { obj.data("jstree-is-loading",true); }
-				}
-				switch(!0) {
-					case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
-					// function option added here for easier model integration (also supporting async - see callback)
-					case ($.isFunction(s.data)):
-						s.data.call(this, obj, $.proxy(function (d) {
-							d = this._parse_json(d, obj);
-							if(!d) { 
-								if(obj === -1 || !obj) {
-									if(s.correct_state) { this.get_container().children("ul").empty(); }
-								}
-								else {
-									obj.children("a.jstree-loading").removeClass("jstree-loading");
-									obj.removeData("jstree-is-loading");
-									if(s.correct_state) { this.correct_state(obj); }
-								}
-								if(e_call) { e_call.call(this); }
-							}
-							else {
-								if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
-								else { obj.append(d).children("a.jstree-loading").removeClass("jstree-loading"); obj.removeData("jstree-is-loading"); }
-								this.clean_node(obj);
-								if(s_call) { s_call.call(this); }
-							}
-						}, this));
-						break;
-					case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
-						if(!obj || obj == -1) {
-							d = this._parse_json(s.data, obj);
-							if(d) {
-								this.get_container().children("ul").empty().append(d.children());
-								this.clean_node();
-							}
-							else { 
-								if(s.correct_state) { this.get_container().children("ul").empty(); }
-							}
-						}
-						if(s_call) { s_call.call(this); }
-						break;
-					case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
-						error_func = function (x, t, e) {
-							var ef = this.get_settings().json_data.ajax.error; 
-							if(ef) { ef.call(this, x, t, e); }
-							if(obj != -1 && obj.length) {
-								obj.children("a.jstree-loading").removeClass("jstree-loading");
-								obj.removeData("jstree-is-loading");
-								if(t === "success" && s.correct_state) { this.correct_state(obj); }
-							}
-							else {
-								if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
-							}
-							if(e_call) { e_call.call(this); }
-						};
-						success_func = function (d, t, x) {
-							var sf = this.get_settings().json_data.ajax.success; 
-							if(sf) { d = sf.call(this,d,t,x) || d; }
-							if(d === "" || (d && d.toString && d.toString().replace(/^[\s\n]+$/,"") === "") || (!$.isArray(d) && !$.isPlainObject(d))) {
-								return error_func.call(this, x, t, "");
-							}
-							d = this._parse_json(d, obj);
-							if(d) {
-								if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
-								else { obj.append(d).children("a.jstree-loading").removeClass("jstree-loading"); obj.removeData("jstree-is-loading"); }
-								this.clean_node(obj);
-								if(s_call) { s_call.call(this); }
-							}
-							else {
-								if(obj === -1 || !obj) {
-									if(s.correct_state) { 
-										this.get_container().children("ul").empty(); 
-										if(s_call) { s_call.call(this); }
-									}
-								}
-								else {
-									obj.children("a.jstree-loading").removeClass("jstree-loading");
-									obj.removeData("jstree-is-loading");
-									if(s.correct_state) { 
-										this.correct_state(obj);
-										if(s_call) { s_call.call(this); } 
-									}
-								}
-							}
-						};
-						s.ajax.context = this;
-						s.ajax.error = error_func;
-						s.ajax.success = success_func;
-						if(!s.ajax.dataType) { s.ajax.dataType = "json"; }
-						if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
-						if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
-						$.ajax(s.ajax);
-						break;
-				}
-			},
-			_parse_json : function (js, obj, is_callback) {
-				var d = false, 
-					p = this._get_settings(),
-					s = p.json_data,
-					t = p.core.html_titles,
-					tmp, i, j, ul1, ul2;
-
-				if(!js) { return d; }
-				if(s.progressive_unload && obj && obj !== -1) { 
-					obj.data("jstree-children", d);
-				}
-				if($.isArray(js)) {
-					d = $();
-					if(!js.length) { return false; }
-					for(i = 0, j = js.length; i < j; i++) {
-						tmp = this._parse_json(js[i], obj, true);
-						if(tmp.length) { d = d.add(tmp); }
-					}
-				}
-				else {
-					if(typeof js == "string") { js = { data : js }; }
-					if(!js.data && js.data !== "") { return d; }
-					d = $("<li />");
-					if(js.attr) { d.attr(js.attr); }
-					if(js.metadata) { d.data(js.metadata); }
-					if(js.state) { d.addClass("jstree-" + js.state); }
-					if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }
-					$.each(js.data, function (i, m) {
-						tmp = $("<a />");
-						if($.isFunction(m)) { m = m.call(this, js); }
-						if(typeof m == "string") { tmp.attr('href','#')[ t ? "html" : "text" ](m); }
-						else {
-							if(!m.attr) { m.attr = {}; }
-							if(!m.attr.href) { m.attr.href = '#'; }
-							tmp.attr(m.attr)[ t ? "html" : "text" ](m.title);
-							if(m.language) { tmp.addClass(m.language); }
-						}
-						tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
-						if(!m.icon && js.icon) { m.icon = js.icon; }
-						if(m.icon) { 
-							if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
-							else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
-						}
-						d.append(tmp);
-					});
-					d.prepend("<ins class='jstree-icon'>&#160;</ins>");
-					if(js.children) { 
-						if(s.progressive_render && js.state !== "open") {
-							d.addClass("jstree-closed").data("jstree-children", js.children);
-						}
-						else {
-							if(s.progressive_unload) { d.data("jstree-children", js.children); }
-							if($.isArray(js.children) && js.children.length) {
-								tmp = this._parse_json(js.children, obj, true);
-								if(tmp.length) {
-									ul2 = $("<ul />");
-									ul2.append(tmp);
-									d.append(ul2);
-								}
-							}
-						}
-					}
-				}
-				if(!is_callback) {
-					ul1 = $("<ul />");
-					ul1.append(d);
-					d = ul1;
-				}
-				return d;
-			},
-			get_json : function (obj, li_attr, a_attr, is_callback) {
-				var result = [], 
-					s = this._get_settings(), 
-					_this = this,
-					tmp1, tmp2, li, a, t, lang;
-				obj = this._get_node(obj);
-				if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }
-				li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];
-				if(!is_callback && this.data.types) { li_attr.push(s.types.type_attr); }
-				a_attr = $.isArray(a_attr) ? a_attr : [ ];
-
-				obj.each(function () {
-					li = $(this);
-					tmp1 = { data : [] };
-					if(li_attr.length) { tmp1.attr = { }; }
-					$.each(li_attr, function (i, v) { 
-						tmp2 = li.attr(v); 
-						if(tmp2 && tmp2.length && tmp2.replace(/jstree[^ ]*/ig,'').length) {
-							tmp1.attr[v] = (" " + tmp2).replace(/ jstree[^ ]*/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,""); 
-						}
-					});
-					if(li.hasClass("jstree-open")) { tmp1.state = "open"; }
-					if(li.hasClass("jstree-closed")) { tmp1.state = "closed"; }
-					if(li.data()) { tmp1.metadata = li.data(); }
-					a = li.children("a");
-					a.each(function () {
-						t = $(this);
-						if(
-							a_attr.length || 
-							$.inArray("languages", s.plugins) !== -1 || 
-							t.children("ins").get(0).style.backgroundImage.length || 
-							(t.children("ins").get(0).className && t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').length)
-						) { 
-							lang = false;
-							if($.inArray("languages", s.plugins) !== -1 && $.isArray(s.languages) && s.languages.length) {
-								$.each(s.languages, function (l, lv) {
-									if(t.hasClass(lv)) {
-										lang = lv;
-										return false;
-									}
-								});
-							}
-							tmp2 = { attr : { }, title : _this.get_text(t, lang) }; 
-							$.each(a_attr, function (k, z) {
-								tmp2.attr[z] = (" " + (t.attr(z) || "")).replace(/ jstree[^ ]*/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"");
-							});
-							if($.inArray("languages", s.plugins) !== -1 && $.isArray(s.languages) && s.languages.length) {
-								$.each(s.languages, function (k, z) {
-									if(t.hasClass(z)) { tmp2.language = z; return true; }
-								});
-							}
-							if(t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {
-								tmp2.icon = t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"");
-							}
-							if(t.children("ins").get(0).style.backgroundImage.length) {
-								tmp2.icon = t.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");
-							}
-						}
-						else {
-							tmp2 = _this.get_text(t);
-						}
-						if(a.length > 1) { tmp1.data.push(tmp2); }
-						else { tmp1.data = tmp2; }
-					});
-					li = li.find("> ul > li");
-					if(li.length) { tmp1.children = _this.get_json(li, li_attr, a_attr, true); }
-					result.push(tmp1);
-				});
-				return result;
-			}
-		}
-	});
-})(jQuery);
-//*/
-
-/* 
- * jsTree languages plugin
- * Adds support for multiple language versions in one tree
- * This basically allows for many titles coexisting in one node, but only one of them being visible at any given time
- * This is useful for maintaining the same structure in many languages (hence the name of the plugin)
- */
-(function ($) {
-	$.jstree.plugin("languages", {
-		__init : function () { this._load_css();  },
-		defaults : [],
-		_fn : {
-			set_lang : function (i) { 
-				var langs = this._get_settings().languages,
-					st = false,
-					selector = ".jstree-" + this.get_index() + ' a';
-				if(!$.isArray(langs) || langs.length === 0) { return false; }
-				if($.inArray(i,langs) == -1) {
-					if(!!langs[i]) { i = langs[i]; }
-					else { return false; }
-				}
-				if(i == this.data.languages.current_language) { return true; }
-				st = $.vakata.css.get_css(selector + "." + this.data.languages.current_language, false, this.data.languages.language_css);
-				if(st !== false) { st.style.display = "none"; }
-				st = $.vakata.css.get_css(selector + "." + i, false, this.data.languages.language_css);
-				if(st !== false) { st.style.display = ""; }
-				this.data.languages.current_language = i;
-				this.__callback(i);
-				return true;
-			},
-			get_lang : function () {
-				return this.data.languages.current_language;
-			},
-			_get_string : function (key, lang) {
-				var langs = this._get_settings().languages,
-					s = this._get_settings().core.strings;
-				if($.isArray(langs) && langs.length) {
-					lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
-				}
-				if(s[lang] && s[lang][key]) { return s[lang][key]; }
-				if(s[key]) { return s[key]; }
-				return key;
-			},
-			get_text : function (obj, lang) {
-				obj = this._get_node(obj) || this.data.ui.last_selected;
-				if(!obj.size()) { return false; }
-				var langs = this._get_settings().languages,
-					s = this._get_settings().core.html_titles;
-				if($.isArray(langs) && langs.length) {
-					lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
-					obj = obj.children("a." + lang);
-				}
-				else { obj = obj.children("a:eq(0)"); }
-				if(s) {
-					obj = obj.clone();
-					obj.children("INS").remove();
-					return obj.html();
-				}
-				else {
-					obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
-					return obj.nodeValue;
-				}
-			},
-			set_text : function (obj, val, lang) {
-				obj = this._get_node(obj) || this.data.ui.last_selected;
-				if(!obj.size()) { return false; }
-				var langs = this._get_settings().languages,
-					s = this._get_settings().core.html_titles,
-					tmp;
-				if($.isArray(langs) && langs.length) {
-					lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
-					obj = obj.children("a." + lang);
-				}
-				else { obj = obj.children("a:eq(0)"); }
-				if(s) {
-					tmp = obj.children("INS").clone();
-					obj.html(val).prepend(tmp);
-					this.__callback({ "obj" : obj, "name" : val, "lang" : lang });
-					return true;
-				}
-				else {
-					obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
-					this.__callback({ "obj" : obj, "name" : val, "lang" : lang });
-					return (obj.nodeValue = val);
-				}
-			},
-			_load_css : function () {
-				var langs = this._get_settings().languages,
-					str = "/* languages css */",
-					selector = ".jstree-" + this.get_index() + ' a',
-					ln;
-				if($.isArray(langs) && langs.length) {
-					this.data.languages.current_language = langs[0];
-					for(ln = 0; ln < langs.length; ln++) {
-						str += selector + "." + langs[ln] + " {";
-						if(langs[ln] != this.data.languages.current_language) { str += " display:none; "; }
-						str += " } ";
-					}
-					this.data.languages.language_css = $.vakata.css.add_sheet({ 'str' : str, 'title' : "jstree-languages" });
-				}
-			},
-			create_node : function (obj, position, js, callback) {
-				var t = this.__call_old(true, obj, position, js, function (t) {
-					var langs = this._get_settings().languages,
-						a = t.children("a"),
-						ln;
-					if($.isArray(langs) && langs.length) {
-						for(ln = 0; ln < langs.length; ln++) {
-							if(!a.is("." + langs[ln])) {
-								t.append(a.eq(0).clone().removeClass(langs.join(" ")).addClass(langs[ln]));
-							}
-						}
-						a.not("." + langs.join(", .")).remove();
-					}
-					if(callback) { callback.call(this, t); }
-				});
-				return t;
-			}
-		}
-	});
-})(jQuery);
-//*/
-
-/*
- * jsTree cookies plugin
- * Stores the currently opened/selected nodes in a cookie and then restores them
- * Depends on the jquery.cookie plugin
- */
-(function ($) {
-	$.jstree.plugin("cookies", {
-		__init : function () {
-			if(typeof $.cookie === "undefined") { throw "jsTree cookie: jQuery cookie plugin not included."; }
-
-			var s = this._get_settings().cookies,
-				tmp;
-			if(!!s.save_loaded) {
-				tmp = $.cookie(s.save_loaded);
-				if(tmp && tmp.length) { this.data.core.to_load = tmp.split(","); }
-			}
-			if(!!s.save_opened) {
-				tmp = $.cookie(s.save_opened);
-				if(tmp && tmp.length) { this.data.core.to_open = tmp.split(","); }
-			}
-			if(!!s.save_selected) {
-				tmp = $.cookie(s.save_selected);
-				if(tmp && tmp.length && this.data.ui) { this.data.ui.to_select = tmp.split(","); }
-			}
-			this.get_container()
-				.one( ( this.data.ui ? "reselect" : "reopen" ) + ".jstree", $.proxy(function () {
-					this.get_container()
-						.bind("open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree", $.proxy(function (e) { 
-								if(this._get_settings().cookies.auto_save) { this.save_cookie((e.handleObj.namespace + e.handleObj.type).replace("jstree","")); }
-							}, this));
-				}, this));
-		},
-		defaults : {
-			save_loaded		: "jstree_load",
-			save_opened		: "jstree_open",
-			save_selected	: "jstree_select",
-			auto_save		: true,
-			cookie_options	: {}
-		},
-		_fn : {
-			save_cookie : function (c) {
-				if(this.data.core.refreshing) { return; }
-				var s = this._get_settings().cookies;
-				if(!c) { // if called manually and not by event
-					if(s.save_loaded) {
-						this.save_loaded();
-						$.cookie(s.save_loaded, this.data.core.to_load.join(","), s.cookie_options);
-					}
-					if(s.save_opened) {
-						this.save_opened();
-						$.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options);
-					}
-					if(s.save_selected && this.data.ui) {
-						this.save_selected();
-						$.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options);
-					}
-					return;
-				}
-				switch(c) {
-					case "open_node":
-					case "close_node":
-						if(!!s.save_opened) { 
-							this.save_opened(); 
-							$.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options); 
-						}
-						if(!!s.save_loaded) { 
-							this.save_loaded(); 
-							$.cookie(s.save_loaded, this.data.core.to_load.join(","), s.cookie_options); 
-						}
-						break;
-					case "select_node":
-					case "deselect_node":
-						if(!!s.save_selected && this.data.ui) { 
-							this.save_selected(); 
-							$.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options); 
-						}
-						break;
-				}
-			}
-		}
-	});
-	// include cookies by default
-	// $.jstree.defaults.plugins.push("cookies");
-})(jQuery);
-//*/
-
-/*
- * jsTree sort plugin
- * Sorts items alphabetically (or using any other function)
- */
-(function ($) {
-	$.jstree.plugin("sort", {
-		__init : function () {
-			this.get_container()
-				.bind("load_node.jstree", $.proxy(function (e, data) {
-						var obj = this._get_node(data.rslt.obj);
-						obj = obj === -1 ? this.get_container().children("ul") : obj.children("ul");
-						this.sort(obj);
-					}, this))
-				.bind("rename_node.jstree create_node.jstree create.jstree", $.proxy(function (e, data) {
-						this.sort(data.rslt.obj.parent());
-					}, this))
-				.bind("move_node.jstree", $.proxy(function (e, data) {
-						var m = data.rslt.np == -1 ? this.get_container() : data.rslt.np;
-						this.sort(m.children("ul"));
-					}, this));
-		},
-		defaults : function (a, b) { return this.get_text(a) > this.get_text(b) ? 1 : -1; },
-		_fn : {
-			sort : function (obj) {
-				var s = this._get_settings().sort,
-					t = this;
-				obj.append($.makeArray(obj.children("li")).sort($.proxy(s, t)));
-				obj.find("> li > ul").each(function() { t.sort($(this)); });
-				this.clean_node(obj);
-			}
-		}
-	});
-})(jQuery);
-//*/
-
-/*
- * jsTree DND plugin
- * Drag and drop plugin for moving/copying nodes
- */
-(function ($) {
-	var o = false,
-		r = false,
-		m = false,
-		ml = false,
-		sli = false,
-		sti = false,
-		dir1 = false,
-		dir2 = false,
-		last_pos = false;
-	$.vakata.dnd = {
-		is_down : false,
-		is_drag : false,
-		helper : false,
-		scroll_spd : 10,
-		init_x : 0,
-		init_y : 0,
-		threshold : 5,
-		helper_left : 5,
-		helper_top : 10,
-		user_data : {},
-
-		drag_start : function (e, data, html) { 
-			if($.vakata.dnd.is_drag) { $.vakata.drag_stop({}); }
-			try {
-				e.currentTarget.unselectable = "on";
-				e.currentTarget.onselectstart = function() { return false; };
-				if(e.currentTarget.style) { e.currentTarget.style.MozUserSelect = "none"; }
-			} catch(err) { }
-			$.vakata.dnd.init_x = e.pageX;
-			$.vakata.dnd.init_y = e.pageY;
-			$.vakata.dnd.user_data = data;
-			$.vakata.dnd.is_down = true;
-			$.vakata.dnd.helper = $("<div id='vakata-dragged' />").html(html); //.fadeTo(10,0.25);
-			$(document).bind("mousemove", $.vakata.dnd.drag);
-			$(document).bind("mouseup", $.vakata.dnd.drag_stop);
-			return false;
-		},
-		drag : function (e) { 
-			if(!$.vakata.dnd.is_down) { return; }
-			if(!$.vakata.dnd.is_drag) {
-				if(Math.abs(e.pageX - $.vakata.dnd.init_x) > 5 || Math.abs(e.pageY - $.vakata.dnd.init_y) > 5) { 
-					$.vakata.dnd.helper.appendTo("body");
-					$.vakata.dnd.is_drag = true;
-					$(document).triggerHandler("drag_start.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
-				}
-				else { return; }
-			}
-
-			// maybe use a scrolling parent element instead of document?
-			if(e.type === "mousemove") { // thought of adding scroll in order to move the helper, but mouse poisition is n/a
-				var d = $(document), t = d.scrollTop(), l = d.scrollLeft();
-				if(e.pageY - t < 20) { 
-					if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
-					if(!sti) { dir1 = "up"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() - $.vakata.dnd.scroll_spd); }, 150); }
-				}
-				else { 
-					if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
-				}
-				if($(window).height() - (e.pageY - t) < 20) {
-					if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
-					if(!sti) { dir1 = "down"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() + $.vakata.dnd.scroll_spd); }, 150); }
-				}
-				else { 
-					if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
-				}
-
-				if(e.pageX - l < 20) {
-					if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
-					if(!sli) { dir2 = "left"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() - $.vakata.dnd.scroll_spd); }, 150); }
-				}
-				else { 
-					if(sli && dir2 === "left") { clearInterval(sli); sli = false; }
-				}
-				if($(window).width() - (e.pageX - l) < 20) {
-					if(sli && dir2 === "left") { clearInterval(sli); sli = false; }
-					if(!sli) { dir2 = "right"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() + $.vakata.dnd.scroll_spd); }, 150); }
-				}
-				else { 
-					if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
-				}
-			}
-
-			$.vakata.dnd.helper.css({ left : (e.pageX + $.vakata.dnd.helper_left) + "px", top : (e.pageY + $.vakata.dnd.helper_top) + "px" });
-			$(document).triggerHandler("drag.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
-		},
-		drag_stop : function (e) {
-			if(sli) { clearInterval(sli); }
-			if(sti) { clearInterval(sti); }
-			$(document).unbind("mousemove", $.vakata.dnd.drag);
-			$(document).unbind("mouseup", $.vakata.dnd.drag_stop);
-			$(document).triggerHandler("drag_stop.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
-			$.vakata.dnd.helper.remove();
-			$.vakata.dnd.init_x = 0;
-			$.vakata.dnd.init_y = 0;
-			$.vakata.dnd.user_data = {};
-			$.vakata.dnd.is_down = false;
-			$.vakata.dnd.is_drag = false;
-		}
-	};
-	$(function() {
-		var css_string = '#vakata-dragged { display:block; margin:0 0 0 0; padding:4px 4px 4px 24px; position:absolute; top:-2000px; line-height:16px; z-index:10000; } ';
-		$.vakata.css.add_sheet({ str : css_string, title : "vakata" });
-	});
-
-	$.jstree.plugin("dnd", {
-		__init : function () {
-			this.data.dnd = {
-				active : false,
-				after : false,
-				inside : false,
-				before : false,
-				off : false,
-				prepared : false,
-				w : 0,
-				to1 : false,
-				to2 : false,
-				cof : false,
-				cw : false,
-				ch : false,
-				i1 : false,
-				i2 : false,
-				mto : false
-			};
-			this.get_container()
-				.bind("mouseenter.jstree", $.proxy(function (e) {
-						if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
-							if(this.data.themes) {
-								m.attr("class", "jstree-" + this.data.themes.theme); 
-								if(ml) { ml.attr("class", "jstree-" + this.data.themes.theme); }
-								$.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
-							}
-							//if($(e.currentTarget).find("> ul > li").length === 0) {
-							if(e.currentTarget === e.target && $.vakata.dnd.user_data.obj && $($.vakata.dnd.user_data.obj).length && $($.vakata.dnd.user_data.obj).parents(".jstree:eq(0)")[0] !== e.target) { // node should not be from the same tree
-								var tr = $.jstree._reference(e.target), dc;
-								if(tr.data.dnd.foreign) {
-									dc = tr._get_settings().dnd.drag_check.call(this, { "o" : o, "r" : tr.get_container(), is_root : true });
-									if(dc === true || dc.inside === true || dc.before === true || dc.after === true) {
-										$.vakata.dnd.helper.

<TRUNCATED>


[23/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
deleted file mode 100644
index 040f12b..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
+++ /dev/null
@@ -1,2451 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.server.appmaster;
-
-import com.codahale.metrics.MetricRegistry;
-import com.codahale.metrics.health.HealthCheckRegistry;
-import com.codahale.metrics.jvm.GarbageCollectorMetricSet;
-import com.codahale.metrics.jvm.MemoryUsageGaugeSet;
-import com.codahale.metrics.jvm.ThreadStatesGaugeSet;
-import com.google.common.base.Preconditions;
-import com.google.protobuf.BlockingService;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.permission.FsAction;
-import org.apache.hadoop.fs.permission.FsPermission;
-import org.apache.hadoop.hdfs.HdfsConfiguration;
-import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier;
-import org.apache.hadoop.http.HttpConfig;
-import org.apache.hadoop.io.Text;
-import org.apache.hadoop.registry.client.binding.RegistryTypeUtils;
-import org.apache.hadoop.registry.client.binding.RegistryUtils;
-import org.apache.hadoop.security.Credentials;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.security.token.Token;
-import org.apache.hadoop.security.token.TokenIdentifier;
-import org.apache.hadoop.service.Service;
-import org.apache.hadoop.service.ServiceOperations;
-import org.apache.hadoop.service.ServiceStateChangeListener;
-import org.apache.hadoop.yarn.api.ApplicationConstants;
-import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse;
-import org.apache.hadoop.yarn.api.records.ApplicationAccessType;
-import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
-import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
-import org.apache.hadoop.yarn.api.records.ContainerState;
-import org.apache.hadoop.yarn.api.records.ContainerStatus;
-import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
-import org.apache.hadoop.yarn.api.records.NodeReport;
-import org.apache.hadoop.yarn.api.records.NodeState;
-import org.apache.hadoop.yarn.api.records.Priority;
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.client.api.AMRMClient;
-import org.apache.hadoop.yarn.client.api.async.AMRMClientAsync;
-import org.apache.hadoop.yarn.client.api.async.NMClientAsync;
-import org.apache.hadoop.yarn.client.api.async.impl.NMClientAsyncImpl;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import static org.apache.hadoop.yarn.conf.YarnConfiguration.*;
-import static org.apache.slider.common.Constants.HADOOP_JAAS_DEBUG;
-
-import org.apache.hadoop.yarn.exceptions.InvalidApplicationMasterRequestException;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.hadoop.yarn.ipc.YarnRPC;
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.hadoop.registry.client.binding.RegistryPathUtils;
-import org.apache.hadoop.registry.client.types.yarn.PersistencePolicies;
-import org.apache.hadoop.registry.client.types.ServiceRecord;
-import org.apache.hadoop.registry.client.types.yarn.YarnRegistryAttributes;
-import org.apache.hadoop.registry.server.integration.RMRegistryOperationsService;
-import org.apache.hadoop.yarn.security.AMRMTokenIdentifier;
-import org.apache.hadoop.yarn.security.client.ClientToAMTokenSecretManager;
-import org.apache.hadoop.yarn.security.client.TimelineDelegationTokenIdentifier;
-import org.apache.hadoop.yarn.util.ConverterUtils;
-import org.apache.hadoop.yarn.webapp.WebAppException;
-import org.apache.hadoop.yarn.webapp.WebApps;
-import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
-import org.apache.slider.api.ClusterDescription;
-import org.apache.slider.api.InternalKeys;
-import org.apache.slider.api.ResourceKeys;
-import org.apache.slider.api.RoleKeys;
-import org.apache.slider.api.StatusKeys;
-import org.apache.slider.api.proto.SliderClusterAPI;
-import org.apache.slider.client.SliderYarnClientImpl;
-import org.apache.slider.common.SliderExitCodes;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.params.AbstractActionArgs;
-import org.apache.slider.common.params.SliderAMArgs;
-import org.apache.slider.common.params.SliderAMCreateAction;
-import org.apache.slider.common.params.SliderActions;
-import org.apache.slider.common.tools.ConfigHelper;
-import org.apache.slider.common.tools.PortScanner;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.common.tools.SliderVersionInfo;
-import org.apache.slider.core.build.InstanceIO;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.exceptions.SliderInternalStateException;
-import org.apache.slider.core.exceptions.TriggerClusterTeardownException;
-import org.apache.slider.core.launch.CredentialUtils;
-import org.apache.slider.core.main.ExitCodeProvider;
-import org.apache.slider.core.main.LauncherExitCodes;
-import org.apache.slider.core.main.RunService;
-import org.apache.slider.core.main.ServiceLauncher;
-import org.apache.slider.core.registry.info.CustomRegistryConstants;
-import org.apache.slider.providers.ProviderCompleted;
-import org.apache.slider.providers.ProviderRole;
-import org.apache.slider.providers.ProviderService;
-import org.apache.slider.providers.SliderProviderFactory;
-import org.apache.slider.providers.agent.AgentKeys;
-import org.apache.slider.providers.agent.AgentProviderService;
-import org.apache.slider.providers.slideram.SliderAMClientProvider;
-import org.apache.slider.providers.slideram.SliderAMProviderService;
-import org.apache.slider.server.appmaster.actions.ActionRegisterServiceInstance;
-import org.apache.slider.server.appmaster.actions.EscalateOutstandingRequests;
-import org.apache.slider.server.appmaster.actions.RegisterComponentInstance;
-import org.apache.slider.server.appmaster.actions.QueueExecutor;
-import org.apache.slider.server.appmaster.actions.QueueService;
-import org.apache.slider.server.appmaster.actions.ActionStopSlider;
-import org.apache.slider.server.appmaster.actions.ActionUpgradeContainers;
-import org.apache.slider.server.appmaster.actions.AsyncAction;
-import org.apache.slider.server.appmaster.actions.RenewingAction;
-import org.apache.slider.server.appmaster.actions.ResetFailureWindow;
-import org.apache.slider.server.appmaster.actions.ReviewAndFlexApplicationSize;
-import org.apache.slider.server.appmaster.actions.UnregisterComponentInstance;
-import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
-import org.apache.slider.server.appmaster.management.YarnServiceHealthCheck;
-import org.apache.slider.server.appmaster.monkey.ChaosKillAM;
-import org.apache.slider.server.appmaster.monkey.ChaosKillContainer;
-import org.apache.slider.server.appmaster.monkey.ChaosMonkeyService;
-import org.apache.slider.server.appmaster.operations.AsyncRMOperationHandler;
-import org.apache.slider.server.appmaster.operations.ProviderNotifyingOperationHandler;
-import org.apache.slider.server.appmaster.rpc.RpcBinder;
-import org.apache.slider.server.appmaster.rpc.SliderAMPolicyProvider;
-import org.apache.slider.server.appmaster.rpc.SliderClusterProtocolPBImpl;
-import org.apache.slider.server.appmaster.operations.AbstractRMOperation;
-import org.apache.slider.server.appmaster.rpc.SliderIPCService;
-import org.apache.slider.server.appmaster.security.SecurityConfiguration;
-import org.apache.slider.server.appmaster.state.AppState;
-import org.apache.slider.server.appmaster.state.AppStateBindingInfo;
-import org.apache.slider.server.appmaster.state.ContainerAssignment;
-import org.apache.slider.server.appmaster.state.ProviderAppState;
-import org.apache.slider.server.appmaster.operations.RMOperationHandler;
-import org.apache.slider.server.appmaster.state.RoleInstance;
-import org.apache.slider.server.appmaster.web.AgentService;
-import org.apache.slider.server.appmaster.web.rest.InsecureAmFilterInitializer;
-import org.apache.slider.server.appmaster.web.rest.agent.AgentWebApp;
-import org.apache.slider.server.appmaster.web.SliderAMWebApp;
-import org.apache.slider.server.appmaster.web.WebAppApi;
-import org.apache.slider.server.appmaster.web.WebAppApiImpl;
-import org.apache.slider.server.appmaster.web.rest.RestPaths;
-import org.apache.slider.server.appmaster.web.rest.application.ApplicationResouceContentCacheFactory;
-import org.apache.slider.server.appmaster.web.rest.application.resources.ContentCache;
-import org.apache.slider.server.services.security.CertificateManager;
-import org.apache.slider.server.services.utility.AbstractSliderLaunchedService;
-import org.apache.slider.server.services.utility.WebAppService;
-import org.apache.slider.server.services.workflow.ServiceThreadFactory;
-import org.apache.slider.server.services.workflow.WorkflowExecutorService;
-import org.apache.slider.server.services.workflow.WorkflowRpcService;
-import org.apache.slider.server.services.yarnregistry.YarnRegistryViewForProviders;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.nio.ByteBuffer;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.ReentrantLock;
-
-/**
- * This is the AM, which directly implements the callbacks from the AM and NM
- */
-public class SliderAppMaster extends AbstractSliderLaunchedService 
-  implements AMRMClientAsync.CallbackHandler,
-    NMClientAsync.CallbackHandler,
-    RunService,
-    SliderExitCodes,
-    SliderKeys,
-    ServiceStateChangeListener,
-    RoleKeys,
-    ProviderCompleted,
-    AppMasterActionOperations {
-
-  protected static final Logger log =
-    LoggerFactory.getLogger(SliderAppMaster.class);
-
-  /**
-   * log for YARN events
-   */
-  protected static final Logger LOG_YARN = log;
-
-  public static final String SERVICE_CLASSNAME_SHORT = "SliderAppMaster";
-  public static final String SERVICE_CLASSNAME =
-      "org.apache.slider.server.appmaster." + SERVICE_CLASSNAME_SHORT;
-
-  public static final int HEARTBEAT_INTERVAL = 1000;
-  public static final int NUM_RPC_HANDLERS = 5;
-
-  /**
-   * Metrics and monitoring services.
-   * Deployed in {@link #serviceInit(Configuration)}
-   */
-  private final MetricsAndMonitoring metricsAndMonitoring = new MetricsAndMonitoring(); 
-
-  /**
-   * metrics registry
-   */
-  public MetricRegistry metrics;
-
-  /** Error string on chaos monkey launch failure action: {@value} */
-  public static final String E_TRIGGERED_LAUNCH_FAILURE =
-      "Chaos monkey triggered launch failure";
-
-  /** YARN RPC to communicate with the Resource Manager or Node Manager */
-  private YarnRPC yarnRPC;
-
-  /** Handle to communicate with the Resource Manager*/
-  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-  private AMRMClientAsync asyncRMClient;
-
-  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-  private RMOperationHandler rmOperationHandler;
-  
-  private RMOperationHandler providerRMOperationHandler;
-
-  /** Handle to communicate with the Node Manager*/
-  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-  public NMClientAsync nmClientAsync;
-
-  /**
-   * Credentials for propagating down to launched containers
-   */
-  private Credentials containerCredentials;
-
-  /**
-   * Slider IPC: Real service handler
-   */
-  private SliderIPCService sliderIPCService;
-  /**
-   * Slider IPC: binding
-   */
-  private WorkflowRpcService rpcService;
-
-  /**
-   * Secret manager
-   */
-  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-  private ClientToAMTokenSecretManager secretManager;
-  
-  /** Hostname of the container*/
-  private String appMasterHostname = "";
-  /* Port on which the app master listens for status updates from clients*/
-  private int appMasterRpcPort = 0;
-  /** Tracking url to which app master publishes info for clients to monitor*/
-  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-  private String appMasterTrackingUrl = "";
-
-  /** Proxied app master URL (as retrieved from AM report at launch time) */
-  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-  private String appMasterProxiedUrl = "";
-
-  /** Application Attempt Id ( combination of attemptId and fail count )*/
-  private ApplicationAttemptId appAttemptID;
-
-  /**
-   * App ACLs
-   */
-  protected Map<ApplicationAccessType, String> applicationACLs;
-
-  /**
-   * Ongoing state of the cluster: containers, nodes they
-   * live on, etc.
-   */
-  private final AppState appState =
-      new AppState(new ProtobufClusterServices(), metricsAndMonitoring);
-
-  /**
-   * App state for external objects. This is almost entirely
-   * a read-only view of the application state. To change the state,
-   * Providers (or anything else) are expected to queue async changes.
-   */
-  private final ProviderAppState stateForProviders =
-      new ProviderAppState("undefined", appState);
-
-  /**
-   * model the state using locks and conditions
-   */
-  private final ReentrantLock AMExecutionStateLock = new ReentrantLock();
-  private final Condition isAMCompleted = AMExecutionStateLock.newCondition();
-
-  /**
-   * Flag set if the AM is to be shutdown
-   */
-  private final AtomicBoolean amCompletionFlag = new AtomicBoolean(false);
-
-  /**
-   * Flag set during the init process
-   */
-  private final AtomicBoolean initCompleted = new AtomicBoolean(false);
-
-  /**
-   * Flag to set if the process exit code was set before shutdown started
-   */
-  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-  private boolean spawnedProcessExitedBeforeShutdownTriggered;
-
-
-  /** Arguments passed in : raw*/
-  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-  private SliderAMArgs serviceArgs;
-
-  /**
-   * ID of the AM container
-   */
-  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-  private ContainerId appMasterContainerID;
-
-  /**
-   * Monkey Service -may be null
-   */
-  private ChaosMonkeyService monkey;
-  
-  /**
-   * ProviderService of this cluster
-   */
-  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-  private ProviderService providerService;
-
-  /**
-   * The YARN registry service
-   */
-  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-  private RegistryOperations registryOperations;
-
-  /**
-   * The stop request received...the exit details are extracted
-   * from this
-   */
-  private volatile ActionStopSlider stopAction;
-
-  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-  private RoleLaunchService launchService;
-  
-  //username -null if it is not known/not to be set
-  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-  private String hadoop_user_name;
-  private String service_user_name;
-  
-  private SliderAMWebApp webApp;
-  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-  private InetSocketAddress rpcServiceAddress;
-  private SliderAMProviderService sliderAMProvider;
-  private CertificateManager certificateManager;
-
-  /**
-   * Executor.
-   * Assigned in {@link #serviceInit(Configuration)}
-   */
-  private WorkflowExecutorService<ExecutorService> executorService;
-
-  /**
-   * Action queues. Created at instance creation, but
-   * added as a child and inited in {@link #serviceInit(Configuration)}
-   */
-  private final QueueService actionQueues = new QueueService();
-  private String agentOpsUrl;
-  private String agentStatusUrl;
-  private YarnRegistryViewForProviders yarnRegistryOperations;
-  //private FsDelegationTokenManager fsDelegationTokenManager;
-  private RegisterApplicationMasterResponse amRegistrationData;
-  private PortScanner portScanner;
-  private SecurityConfiguration securityConfiguration;
-
-  /**
-   * Is security enabled?
-   * Set early on in the {@link #createAndRunCluster(String)} operation.
-   */
-  private boolean securityEnabled;
-  private ContentCache contentCache;
-
-  /**
-   * resource limits
-   */
-  private Resource maximumResourceCapability;
-
-  /**
-   * Service Constructor
-   */
-  public SliderAppMaster() {
-    super(SERVICE_CLASSNAME_SHORT);
-    new HdfsConfiguration();
-    new YarnConfiguration();
-  }
-
-/* =================================================================== */
-/* service lifecycle methods */
-/* =================================================================== */
-
-  @Override //AbstractService
-  public synchronized void serviceInit(Configuration conf) throws Exception {
-    // slider client if found
-    
-    Configuration customConf = SliderUtils.loadSliderClientXML();
-    // Load in the server configuration - if it is actually on the Classpath
-    URL serverXmlUrl = ConfigHelper.getResourceUrl(SLIDER_SERVER_XML);
-    if (serverXmlUrl != null) {
-      log.info("Loading {} at {}", SLIDER_SERVER_XML, serverXmlUrl);
-      Configuration serverConf = ConfigHelper.loadFromResource(SLIDER_SERVER_XML);
-      ConfigHelper.mergeConfigurations(customConf, serverConf,
-          SLIDER_SERVER_XML, true);
-    }
-    serviceArgs.applyDefinitions(customConf);
-    serviceArgs.applyFileSystemBinding(customConf);
-    // conf now contains all customizations
-
-    AbstractActionArgs action = serviceArgs.getCoreAction();
-    SliderAMCreateAction createAction = (SliderAMCreateAction) action;
-
-    // sort out the location of the AM
-    String rmAddress = createAction.getRmAddress();
-    if (rmAddress != null) {
-      log.debug("Setting RM address from the command line: {}", rmAddress);
-      SliderUtils.setRmSchedulerAddress(customConf, rmAddress);
-    }
-
-    log.info("AM configuration:\n{}",
-        ConfigHelper.dumpConfigToString(customConf));
-    for (Map.Entry<String, String> envs : System.getenv().entrySet()) {
-      log.info("System env {}={}", envs.getKey(), envs.getValue());
-    }
-
-    ConfigHelper.mergeConfigurations(conf, customConf, SLIDER_CLIENT_XML, true);
-    //init security with our conf
-    if (SliderUtils.isHadoopClusterSecure(conf)) {
-      log.info("Secure mode with kerberos realm {}",
-               SliderUtils.getKerberosRealm());
-      UserGroupInformation.setConfiguration(conf);
-      UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
-      log.debug("Authenticating as {}", ugi);
-      SliderUtils.verifyPrincipalSet(conf, DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY);
-    } else {
-      log.info("Cluster is insecure");
-    }
-    log.info("Login user is {}", UserGroupInformation.getLoginUser());
-
-    //look at settings of Hadoop Auth, to pick up a problem seen once
-    checkAndWarnForAuthTokenProblems();
-    
-    // validate server env
-    boolean dependencyChecks =
-        !conf.getBoolean(KEY_SLIDER_AM_DEPENDENCY_CHECKS_DISABLED,
-            false);
-    SliderUtils.validateSliderServerEnvironment(log, dependencyChecks);
-
-    // create and register monitoring services
-    addService(metricsAndMonitoring);
-    metrics = metricsAndMonitoring.getMetrics();
-/* TODO: turn these one once the metrics testing is more under control
-    metrics.registerAll(new ThreadStatesGaugeSet());
-    metrics.registerAll(new MemoryUsageGaugeSet());
-    metrics.registerAll(new GarbageCollectorMetricSet());
-
-*/
-    contentCache = ApplicationResouceContentCacheFactory.createContentCache(stateForProviders);
-
-    executorService = new WorkflowExecutorService<>("AmExecutor",
-        Executors.newFixedThreadPool(2,
-            new ServiceThreadFactory("AmExecutor", true)));
-    addService(executorService);
-
-    addService(actionQueues);
-
-    //init all child services
-    super.serviceInit(conf);
-  }
-
-  @Override
-  protected void serviceStart() throws Exception {
-    super.serviceStart();
-    HealthCheckRegistry health = metricsAndMonitoring.getHealth();
-    health.register("AM Health", new YarnServiceHealthCheck(this));
-  }
-
-  /**
-   * Start the queue processing
-   */
-  private void startQueueProcessing() {
-    log.info("Queue Processing started");
-    executorService.execute(actionQueues);
-    executorService.execute(new QueueExecutor(this, actionQueues));
-  }
-  
-/* =================================================================== */
-/* RunService methods called from ServiceLauncher */
-/* =================================================================== */
-
-  /**
-   * pick up the args from the service launcher
-   * @param config configuration
-   * @param args argument list
-   */
-  @Override // RunService
-  public Configuration bindArgs(Configuration config, String... args) throws Exception {
-    // let the superclass process it
-    Configuration superConf = super.bindArgs(config, args);
-    // add the slider XML config
-    ConfigHelper.injectSliderXMLResource();
-
-    //yarn-ify
-    YarnConfiguration yarnConfiguration = new YarnConfiguration(
-        superConf);
-    serviceArgs = new SliderAMArgs(args);
-    serviceArgs.parse();
-
-    return SliderUtils.patchConfiguration(yarnConfiguration);
-  }
-
-
-  /**
-   * this is called by service launcher; when it returns the application finishes
-   * @return the exit code to return by the app
-   * @throws Throwable
-   */
-  @Override
-  public int runService() throws Throwable {
-    SliderVersionInfo.loadAndPrintVersionInfo(log);
-
-    //dump the system properties if in debug mode
-    if (log.isDebugEnabled()) {
-      log.debug("System properties:\n" + SliderUtils.propertiesToString(System.getProperties()));
-    }
-
-    //choose the action
-    String action = serviceArgs.getAction();
-    List<String> actionArgs = serviceArgs.getActionArgs();
-    int exitCode;
-    switch (action) {
-      case SliderActions.ACTION_HELP:
-        log.info("{}: {}", getName(), serviceArgs.usage());
-        exitCode = SliderExitCodes.EXIT_USAGE;
-        break;
-      case SliderActions.ACTION_CREATE:
-        exitCode = createAndRunCluster(actionArgs.get(0));
-        break;
-      default:
-        throw new SliderException("Unimplemented: " + action);
-    }
-    log.info("Exiting AM; final exit code = {}", exitCode);
-    return exitCode;
-  }
-
-  /**
-   * Initialize a newly created service then add it. 
-   * Because the service is not started, this MUST be done before
-   * the AM itself starts, or it is explicitly added after
-   * @param service the service to init
-   */
-  public Service initAndAddService(Service service) {
-    service.init(getConfig());
-    addService(service);
-    return service;
-  }
-
-  /* =================================================================== */
-
-  /**
-   * Create and run the cluster.
-   * @param clustername cluster name
-   * @return exit code
-   * @throws Throwable on a failure
-   */
-  private int createAndRunCluster(String clustername) throws Throwable {
-
-    //load the cluster description from the cd argument
-    String sliderClusterDir = serviceArgs.getSliderClusterURI();
-    URI sliderClusterURI = new URI(sliderClusterDir);
-    Path clusterDirPath = new Path(sliderClusterURI);
-    log.info("Application defined at {}", sliderClusterURI);
-    SliderFileSystem fs = getClusterFS();
-
-    // build up information about the running application -this
-    // will be passed down to the cluster status
-    MapOperations appInformation = new MapOperations(); 
-
-    AggregateConf instanceDefinition =
-      InstanceIO.loadInstanceDefinitionUnresolved(fs, clusterDirPath);
-    instanceDefinition.setName(clustername);
-
-    log.info("Deploying cluster {}:", instanceDefinition);
-
-    // and resolve it
-    AggregateConf resolvedInstance = new AggregateConf( instanceDefinition);
-    resolvedInstance.resolve();
-
-    stateForProviders.setApplicationName(clustername);
-
-    Configuration serviceConf = getConfig();
-
-    // extend AM configuration with component resource
-    MapOperations amConfiguration = resolvedInstance
-      .getAppConfOperations().getComponent(COMPONENT_AM);
-    // and patch configuration with prefix
-    if (amConfiguration != null) {
-      Map<String, String> sliderAppConfKeys = amConfiguration.prefixedWith("slider.");
-      for (Map.Entry<String, String> entry : sliderAppConfKeys.entrySet()) {
-        String k = entry.getKey();
-        String v = entry.getValue();
-        boolean exists = serviceConf.get(k) != null;
-        log.info("{} {} to {}", (exists ? "Overwriting" : "Setting"), k, v);
-        serviceConf.set(k, v);
-      }
-    }
-
-    securityConfiguration = new SecurityConfiguration(serviceConf, resolvedInstance, clustername);
-    // obtain security state
-    securityEnabled = securityConfiguration.isSecurityEnabled();
-    // set the global security flag for the instance definition
-    instanceDefinition.getAppConfOperations().set(KEY_SECURITY_ENABLED, securityEnabled);
-
-    // triggers resolution and snapshotting for agent
-    appState.setInitialInstanceDefinition(instanceDefinition);
-
-    File confDir = getLocalConfDir();
-    if (!confDir.exists() || !confDir.isDirectory()) {
-      log.info("Conf dir {} does not exist.", confDir);
-      File parentFile = confDir.getParentFile();
-      log.info("Parent dir {}:\n{}", parentFile, SliderUtils.listDir(parentFile));
-    }
-    
-    //get our provider
-    MapOperations globalInternalOptions = getGlobalInternalOptions();
-    String providerType = globalInternalOptions.getMandatoryOption(
-      InternalKeys.INTERNAL_PROVIDER_NAME);
-    log.info("Cluster provider type is {}", providerType);
-    SliderProviderFactory factory =
-      SliderProviderFactory.createSliderProviderFactory(providerType);
-    providerService = factory.createServerProvider();
-    // init the provider BUT DO NOT START IT YET
-    initAndAddService(providerService);
-    providerRMOperationHandler = new ProviderNotifyingOperationHandler(providerService);
-    
-    // create a slider AM provider
-    sliderAMProvider = new SliderAMProviderService();
-    initAndAddService(sliderAMProvider);
-    
-    InetSocketAddress rmSchedulerAddress = SliderUtils.getRmSchedulerAddress(serviceConf);
-    log.info("RM is at {}", rmSchedulerAddress);
-    yarnRPC = YarnRPC.create(serviceConf);
-
-    // set up the YARN client. This may require patching in the RM client-API address if it
-    // is (somehow) unset server-side.    String clientRMaddr = serviceConf.get(YarnConfiguration.RM_ADDRESS);
-    InetSocketAddress clientRpcAddress = SliderUtils.getRmAddress(serviceConf);
-    if (!SliderUtils.isAddressDefined(clientRpcAddress)) {
-      // client addr is being unset. We can lift it from the other RM APIs
-      log.warn("Yarn RM address was unbound; attempting to fix up");
-      serviceConf.set(YarnConfiguration.RM_ADDRESS,
-          String.format("%s:%d", rmSchedulerAddress.getHostString(), clientRpcAddress.getPort() ));
-    }
-
-    /*
-     * Extract the container ID. This is then
-     * turned into an (incomplete) container
-     */
-    appMasterContainerID = ConverterUtils.toContainerId(
-      SliderUtils.mandatoryEnvVariable(ApplicationConstants.Environment.CONTAINER_ID.name()));
-    appAttemptID = appMasterContainerID.getApplicationAttemptId();
-
-    ApplicationId appid = appAttemptID.getApplicationId();
-    log.info("AM for ID {}", appid.getId());
-
-    appInformation.put(StatusKeys.INFO_AM_CONTAINER_ID, appMasterContainerID.toString());
-    appInformation.put(StatusKeys.INFO_AM_APP_ID, appid.toString());
-    appInformation.put(StatusKeys.INFO_AM_ATTEMPT_ID, appAttemptID.toString());
-
-    Map<String, String> envVars;
-    List<Container> liveContainers;
-
-    /*
-     * It is critical this section is synchronized, to stop async AM events
-     * arriving while registering a restarting AM.
-     */
-    synchronized (appState) {
-      int heartbeatInterval = HEARTBEAT_INTERVAL;
-
-      // add the RM client -this brings the callbacks in
-      asyncRMClient = AMRMClientAsync.createAMRMClientAsync(heartbeatInterval, this);
-      addService(asyncRMClient);
-      //now bring it up
-      deployChildService(asyncRMClient);
-
-
-      // nmclient relays callbacks back to this class
-      nmClientAsync = new NMClientAsyncImpl("nmclient", this);
-      deployChildService(nmClientAsync);
-
-      // set up secret manager
-      secretManager = new ClientToAMTokenSecretManager(appAttemptID, null);
-
-      if (securityEnabled) {
-        // fix up the ACLs if they are not set
-        String acls = serviceConf.get(KEY_PROTOCOL_ACL);
-        if (acls == null) {
-          getConfig().set(KEY_PROTOCOL_ACL, "*");
-        }
-      }
-
-      certificateManager = new CertificateManager();
-
-      //bring up the Slider RPC service
-      buildPortScanner(instanceDefinition);
-      startSliderRPCServer(instanceDefinition);
-
-      rpcServiceAddress = rpcService.getConnectAddress();
-      appMasterHostname = rpcServiceAddress.getAddress().getCanonicalHostName();
-      appMasterRpcPort = rpcServiceAddress.getPort();
-      appMasterTrackingUrl = null;
-      log.info("AM Server is listening at {}:{}", appMasterHostname, appMasterRpcPort);
-      appInformation.put(StatusKeys.INFO_AM_HOSTNAME, appMasterHostname);
-      appInformation.set(StatusKeys.INFO_AM_RPC_PORT, appMasterRpcPort);
-
-      log.info("Starting Yarn registry");
-      registryOperations = startRegistryOperationsService();
-      log.info(registryOperations.toString());
-
-      //build the role map
-      List<ProviderRole> providerRoles = new ArrayList<>(providerService.getRoles());
-      providerRoles.addAll(SliderAMClientProvider.ROLES);
-
-      // Start up the WebApp and track the URL for it
-      MapOperations component = instanceDefinition.getAppConfOperations()
-          .getComponent(SliderKeys.COMPONENT_AM);
-      certificateManager.initialize(component, appMasterHostname,
-                                    appMasterContainerID.toString(),
-                                    clustername);
-      certificateManager.setPassphrase(instanceDefinition.getPassphrase());
- 
-      if (component.getOptionBool(
-          AgentKeys.KEY_AGENT_TWO_WAY_SSL_ENABLED, false)) {
-        uploadServerCertForLocalization(clustername, fs);
-      }
-
-      // Web service endpoints: initialize
-      WebAppApiImpl webAppApi =
-          new WebAppApiImpl(
-              stateForProviders,
-              providerService,
-              certificateManager,
-              registryOperations,
-              metricsAndMonitoring,
-              actionQueues,
-              this,
-              contentCache);
-      initAMFilterOptions(serviceConf);
-
-      // start the agent web app
-      startAgentWebApp(appInformation, serviceConf, webAppApi);
-      int webAppPort = deployWebApplication(webAppApi);
-
-      String scheme = WebAppUtils.HTTP_PREFIX;
-      appMasterTrackingUrl = scheme + appMasterHostname + ":" + webAppPort;
-
-      appInformation.put(StatusKeys.INFO_AM_WEB_URL, appMasterTrackingUrl + "/");
-      appInformation.set(StatusKeys.INFO_AM_WEB_PORT, webAppPort);
-
-      // *****************************************************
-      // Register self with ResourceManager
-      // This will start heartbeating to the RM
-      // address = SliderUtils.getRmSchedulerAddress(asyncRMClient.getConfig());
-      // *****************************************************
-      log.info("Connecting to RM at {}; AM tracking URL={}",
-               appMasterRpcPort, appMasterTrackingUrl);
-      amRegistrationData = asyncRMClient.registerApplicationMaster(appMasterHostname,
-                                   appMasterRpcPort,
-                                   appMasterTrackingUrl);
-      maximumResourceCapability = amRegistrationData.getMaximumResourceCapability();
-
-      int minMemory = serviceConf.getInt(RM_SCHEDULER_MINIMUM_ALLOCATION_MB,
-          DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_MB);
-       // validate scheduler vcores allocation setting
-      int minCores = serviceConf.getInt(RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES,
-          DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES);
-      int maxMemory = maximumResourceCapability.getMemory();
-      int maxCores = maximumResourceCapability.getVirtualCores();
-      appState.setContainerLimits(minMemory,maxMemory, minCores, maxCores );
-
-      // build the handler for RM request/release operations; this uses
-      // the max value as part of its lookup
-      rmOperationHandler = new AsyncRMOperationHandler(asyncRMClient, maximumResourceCapability);
-
-      // set the RM-defined maximum cluster values
-      appInformation.put(ResourceKeys.YARN_CORES, Integer.toString(maxCores));
-      appInformation.put(ResourceKeys.YARN_MEMORY, Integer.toString(maxMemory));
-
-      processAMCredentials(securityConfiguration);
-
-      if (securityEnabled) {
-        secretManager.setMasterKey(
-            amRegistrationData.getClientToAMTokenMasterKey().array());
-        applicationACLs = amRegistrationData.getApplicationACLs();
-
-        //tell the server what the ACLs are
-        rpcService.getServer().refreshServiceAcl(serviceConf,
-            new SliderAMPolicyProvider());
-        if (securityConfiguration.isKeytabProvided()) {
-          // perform keytab based login to establish kerberos authenticated
-          // principal.  Can do so now since AM registration with RM above required
-          // tokens associated to principal
-          String principal = securityConfiguration.getPrincipal();
-          File localKeytabFile = securityConfiguration.getKeytabFile(instanceDefinition);
-          // Now log in...
-          login(principal, localKeytabFile);
-          // obtain new FS reference that should be kerberos based and different
-          // than the previously cached reference
-          fs = new SliderFileSystem(serviceConf);
-        }
-      }
-
-      // YARN client.
-      // Important: this is only valid at startup, and must be executed within
-      // the right UGI context. Use with care.
-      SliderYarnClientImpl yarnClient = null;
-      List<NodeReport> nodeReports;
-      try {
-        yarnClient = new SliderYarnClientImpl();
-        yarnClient.init(getConfig());
-        yarnClient.start();
-        nodeReports = getNodeReports(yarnClient);
-        log.info("Yarn node report count: {}", nodeReports.size());
-        // look up the application itself -this is needed to get the proxied
-        // URL of the AM, for registering endpoints.
-        // this call must be made after the AM has registered itself, obviously
-        ApplicationAttemptReport report = getApplicationAttemptReport(yarnClient);
-        appMasterProxiedUrl = report.getTrackingUrl();
-        if (SliderUtils.isUnset(appMasterProxiedUrl)) {
-          log.warn("Proxied URL is not set in application report");
-          appMasterProxiedUrl = appMasterTrackingUrl;
-        }
-      } finally {
-        // at this point yarnClient is no longer needed.
-        // stop it immediately
-        ServiceOperations.stop(yarnClient);
-        yarnClient = null;
-      }
-
-      // extract container list
-
-      liveContainers = amRegistrationData.getContainersFromPreviousAttempts();
-
-      //now validate the installation
-      Configuration providerConf =
-        providerService.loadProviderConfigurationInformation(confDir);
-
-      providerService.initializeApplicationConfiguration(instanceDefinition,
-          fs, null);
-
-      providerService.validateApplicationConfiguration(instanceDefinition,
-          confDir,
-          securityEnabled);
-
-      //determine the location for the role history data
-      Path historyDir = new Path(clusterDirPath, HISTORY_DIR_NAME);
-
-      //build the instance
-      AppStateBindingInfo binding = new AppStateBindingInfo();
-      binding.instanceDefinition = instanceDefinition;
-      binding.serviceConfig = serviceConf;
-      binding.publishedProviderConf = providerConf;
-      binding.roles = providerRoles;
-      binding.fs = fs.getFileSystem();
-      binding.historyPath = historyDir;
-      binding.liveContainers = liveContainers;
-      binding.applicationInfo = appInformation;
-      binding.releaseSelector = providerService.createContainerReleaseSelector();
-      binding.nodeReports = nodeReports;
-      appState.buildInstance(binding);
-
-      providerService.rebuildContainerDetails(liveContainers,
-          instanceDefinition.getName(), appState.getRolePriorityMap());
-
-      // add the AM to the list of nodes in the cluster
-
-      appState.buildAppMasterNode(appMasterContainerID,
-          appMasterHostname,
-          webAppPort,
-          appMasterHostname + ":" + webAppPort);
-
-      // build up environment variables that the AM wants set in every container
-      // irrespective of provider and role.
-      envVars = new HashMap<>();
-      if (hadoop_user_name != null) {
-        envVars.put(HADOOP_USER_NAME, hadoop_user_name);
-      }
-      String debug_kerberos = System.getenv(HADOOP_JAAS_DEBUG);
-      if (debug_kerberos != null) {
-        envVars.put(HADOOP_JAAS_DEBUG, debug_kerberos);
-      }
-    }
-    String rolesTmpSubdir = appMasterContainerID.toString() + "/roles";
-
-    String amTmpDir = globalInternalOptions.getMandatoryOption(InternalKeys.INTERNAL_AM_TMP_DIR);
-
-    Path tmpDirPath = new Path(amTmpDir);
-    Path launcherTmpDirPath = new Path(tmpDirPath, rolesTmpSubdir);
-    fs.getFileSystem().mkdirs(launcherTmpDirPath);
-
-    //launcher service
-    launchService = new RoleLaunchService(actionQueues,
-                                          providerService,
-                                          fs,
-                                          new Path(getGeneratedConfDir()),
-                                          envVars,
-                                          launcherTmpDirPath);
-
-    deployChildService(launchService);
-
-    appState.noteAMLaunched();
-
-
-    //Give the provider access to the state, and AM
-    providerService.bind(stateForProviders, actionQueues, liveContainers);
-    sliderAMProvider.bind(stateForProviders, actionQueues, liveContainers);
-
-    // chaos monkey
-    maybeStartMonkey();
-
-    // setup token renewal and expiry handling for long lived apps
-//    if (!securityConfiguration.isKeytabProvided() &&
-//        SliderUtils.isHadoopClusterSecure(getConfig())) {
-//      fsDelegationTokenManager = new FsDelegationTokenManager(actionQueues);
-//      fsDelegationTokenManager.acquireDelegationToken(getConfig());
-//    }
-
-    // if not a secure cluster, extract the username -it will be
-    // propagated to workers
-    if (!UserGroupInformation.isSecurityEnabled()) {
-      hadoop_user_name = System.getenv(HADOOP_USER_NAME);
-      log.info(HADOOP_USER_NAME + "='{}'", hadoop_user_name);
-    }
-    service_user_name = RegistryUtils.currentUser();
-    log.info("Registry service username ={}", service_user_name);
-
-
-    // declare the cluster initialized
-    log.info("Application Master Initialization Completed");
-    initCompleted.set(true);
-
-    scheduleFailureWindowResets(instanceDefinition.getResources());
-    scheduleEscalation(instanceDefinition.getInternal());
-
-    try {
-      // schedule YARN Registry registration
-      queue(new ActionRegisterServiceInstance(clustername, appid));
-
-      // log the YARN and web UIs
-      log.info("RM Webapp address {}",
-          serviceConf.get(YarnConfiguration.RM_WEBAPP_ADDRESS));
-      log.info("Slider webapp address {} proxied at {}",
-        appMasterTrackingUrl, appMasterProxiedUrl);
-
-      // Start the Slider AM provider
-      sliderAMProvider.start();
-
-      // launch the real provider; this is expected to trigger a callback that
-      // starts the node review process
-      launchProviderService(instanceDefinition, confDir);
-
-      // start handling any scheduled events
-
-      startQueueProcessing();
-
-      //now block waiting to be told to exit the process
-      waitForAMCompletionSignal();
-    } catch(Exception e) {
-      log.error("Exception : {}", e, e);
-      // call the AM stop command as if it had been queued (but without
-      // going via the queue, which may not have started
-      onAMStop(new ActionStopSlider(e));
-    }
-    //shutdown time
-    return finish();
-  }
-
-  /**
-   * Get the YARN application Attempt report as the logged in user
-   * @param yarnClient client to the RM
-   * @return the application report
-   * @throws YarnException
-   * @throws IOException
-   * @throws InterruptedException
-   */
-  private ApplicationAttemptReport getApplicationAttemptReport(
-    final SliderYarnClientImpl yarnClient)
-      throws YarnException, IOException, InterruptedException {
-    Preconditions.checkNotNull(yarnClient, "Null Yarn client");
-    ApplicationAttemptReport report;
-    if (securityEnabled) {
-      UserGroupInformation ugi = UserGroupInformation.getLoginUser();
-      report = ugi.doAs(new PrivilegedExceptionAction<ApplicationAttemptReport>() {
-        @Override
-        public ApplicationAttemptReport run() throws Exception {
-          return yarnClient.getApplicationAttemptReport(appAttemptID);
-        }
-      });
-    } else {
-      report = yarnClient.getApplicationAttemptReport(appAttemptID);
-    }
-    return report;
-  }
-
-  /**
-   * List the node reports: uses {@link SliderYarnClientImpl} as the login user
-   * @param yarnClient client to the RM
-   * @return the node reports
-   * @throws IOException
-   * @throws YarnException
-   * @throws InterruptedException
-   */
-  private List<NodeReport> getNodeReports(final SliderYarnClientImpl yarnClient)
-    throws IOException, YarnException, InterruptedException {
-    Preconditions.checkNotNull(yarnClient, "Null Yarn client");
-    List<NodeReport> nodeReports;
-    if (securityEnabled) {
-      nodeReports = UserGroupInformation.getLoginUser().doAs(
-        new PrivilegedExceptionAction<List<NodeReport>>() {
-          @Override
-          public List<NodeReport> run() throws Exception {
-            return yarnClient.getNodeReports(NodeState.RUNNING);
-          }
-        });
-    } else {
-      nodeReports = yarnClient.getNodeReports(NodeState.RUNNING);
-    }
-    log.info("Yarn node report count: {}", nodeReports.size());
-    return nodeReports;
-  }
-
-  /**
-   * Deploy the web application.
-   * <p>
-   *   Creates and starts the web application, and adds a
-   *   <code>WebAppService</code> service under the AM, to ensure
-   *   a managed web application shutdown.
-   * @param webAppApi web app API instance
-   * @return port the web application is deployed on
-   * @throws IOException general problems starting the webapp (network, etc)
-   * @throws WebAppException other issues
-   */
-  private int deployWebApplication(WebAppApiImpl webAppApi)
-      throws IOException, SliderException {
-
-    try {
-      webApp = new SliderAMWebApp(webAppApi);
-      HttpConfig.Policy policy = HttpConfig.Policy.HTTP_ONLY;
-      int port = getPortToRequest();
-      log.info("Launching web application at port {} with policy {}", port, policy);
-
-      WebApps.$for(SliderAMWebApp.BASE_PATH,
-          WebAppApi.class,
-          webAppApi,
-          RestPaths.WS_CONTEXT)
-             .withHttpPolicy(getConfig(), policy)
-             .at("0.0.0.0", port, true)
-             .inDevMode()
-             .start(webApp);
-
-      WebAppService<SliderAMWebApp> webAppService =
-        new WebAppService<>("slider", webApp);
-
-      deployChildService(webAppService);
-      return webApp.port();
-    } catch (WebAppException e) {
-      if (e.getCause() instanceof IOException) {
-        throw (IOException)e.getCause();
-      } else {
-        throw e;
-      }
-    }
-  }
-
-  /**
-   * Process the initial user to obtain the set of user
-   * supplied credentials (tokens were passed in by client).
-   * Removes the AM/RM token.
-   * If a keytab has been provided, also strip the HDFS delegation token.
-   * @param securityConfig slider security config
-   * @throws IOException
-   */
-  private void processAMCredentials(SecurityConfiguration securityConfig)
-      throws IOException {
-
-    List<Text> filteredTokens = new ArrayList<>(3);
-    filteredTokens.add(AMRMTokenIdentifier.KIND_NAME);
-    filteredTokens.add(TimelineDelegationTokenIdentifier.KIND_NAME);
-
-    boolean keytabProvided = securityConfig.isKeytabProvided();
-    log.info("Slider AM Security Mode: {}", keytabProvided ? "KEYTAB" : "TOKEN");
-    if (keytabProvided) {
-      filteredTokens.add(DelegationTokenIdentifier.HDFS_DELEGATION_KIND);
-    }
-    containerCredentials = CredentialUtils.filterTokens(
-        UserGroupInformation.getCurrentUser().getCredentials(),
-        filteredTokens);
-    log.info(CredentialUtils.dumpTokens(containerCredentials, "\n"));
-  }
-
-  /**
-   * Build up the port scanner. This may include setting a port range.
-   */
-  private void buildPortScanner(AggregateConf instanceDefinition)
-      throws BadConfigException {
-    portScanner = new PortScanner();
-    String portRange = instanceDefinition.
-        getAppConfOperations().getGlobalOptions().
-          getOption(SliderKeys.KEY_ALLOWED_PORT_RANGE, "0");
-    if (!"0".equals(portRange)) {
-        portScanner.setPortRange(portRange);
-    }
-  }
-  
-  /**
-   * Locate a port to request for a service such as RPC or web/REST.
-   * This uses port range definitions in the <code>instanceDefinition</code>
-   * to fix the port range \u2014if one is set.
-   * <p>
-   * The port returned is available at the time of the request; there are
-   * no guarantees as to how long that situation will last.
-   * @return the port to request.
-   * @throws SliderException
-   */
-  private int getPortToRequest() throws SliderException, IOException {
-    return portScanner.getAvailablePort();
-  }
-
-  private void uploadServerCertForLocalization(String clustername,
-                                               SliderFileSystem fs)
-      throws IOException {
-    Path certsDir = fs.buildClusterSecurityDirPath(clustername);
-    if (!fs.getFileSystem().exists(certsDir)) {
-      fs.getFileSystem().mkdirs(certsDir,
-        new FsPermission(FsAction.ALL, FsAction.NONE, FsAction.NONE));
-    }
-    Path destPath = new Path(certsDir, SliderKeys.CRT_FILE_NAME);
-    if (!fs.getFileSystem().exists(destPath)) {
-      fs.getFileSystem().copyFromLocalFile(
-          new Path(CertificateManager.getServerCertficateFilePath().getAbsolutePath()),
-          destPath);
-      log.info("Uploaded server cert to localization path {}", destPath);
-    }
-
-    fs.getFileSystem().setPermission(destPath,
-        new FsPermission(FsAction.READ, FsAction.NONE, FsAction.NONE));
-  }
-
-  protected void login(String principal, File localKeytabFile)
-      throws IOException, SliderException {
-    log.info("Logging in as {} with keytab {}", principal, localKeytabFile);
-    UserGroupInformation.loginUserFromKeytab(principal,
-                                             localKeytabFile.getAbsolutePath());
-    validateLoginUser(UserGroupInformation.getLoginUser());
-  }
-
-  /**
-   * Ensure that the user is generated from a keytab and has no HDFS delegation
-   * tokens.
-   *
-   * @param user user to validate
-   * @throws SliderException
-   */
-  protected void validateLoginUser(UserGroupInformation user)
-      throws SliderException {
-    if (!user.isFromKeytab()) {
-      log.error("User is not holding on a keytab in a secure deployment:" +
-          " slider will fail as tokens expire");
-    }
-    Credentials credentials = user.getCredentials();
-    Iterator<Token<? extends TokenIdentifier>> iter =
-        credentials.getAllTokens().iterator();
-    while (iter.hasNext()) {
-      Token<? extends TokenIdentifier> token = iter.next();
-      log.info("Token {}", token.getKind());
-      if (token.getKind().equals(
-          DelegationTokenIdentifier.HDFS_DELEGATION_KIND)) {
-        log.info("HDFS delegation token {}.  Removing...", token);
-        iter.remove();
-      }
-    }
-  }
-
-  /**
-   * Set up and start the agent web application 
-   * @param appInformation application information
-   * @param serviceConf service configuration
-   * @param webAppApi web app API instance to bind to
-   * @throws IOException
-   */
-  private void startAgentWebApp(MapOperations appInformation,
-      Configuration serviceConf, WebAppApiImpl webAppApi) throws IOException, SliderException {
-    URL[] urls = ((URLClassLoader) AgentWebApp.class.getClassLoader() ).getURLs();
-    StringBuilder sb = new StringBuilder("AM classpath:");
-    for (URL url : urls) {
-      sb.append("\n").append(url.toString());
-    }
-    LOG_YARN.debug(sb.append("\n").toString());
-    initAMFilterOptions(serviceConf);
-
-
-    // Start up the agent web app and track the URL for it
-    MapOperations appMasterConfig = getInstanceDefinition()
-        .getAppConfOperations().getComponent(SliderKeys.COMPONENT_AM);
-    AgentWebApp agentWebApp = AgentWebApp.$for(AgentWebApp.BASE_PATH,
-        webAppApi,
-        RestPaths.AGENT_WS_CONTEXT)
-        .withComponentConfig(appMasterConfig)
-        .withPort(getPortToRequest())
-        .withSecuredPort(getPortToRequest())
-            .start();
-    agentOpsUrl =
-        "https://" + appMasterHostname + ":" + agentWebApp.getSecuredPort();
-    agentStatusUrl =
-        "https://" + appMasterHostname + ":" + agentWebApp.getPort();
-    AgentService agentService =
-      new AgentService("slider-agent", agentWebApp);
-
-    agentService.init(serviceConf);
-    agentService.start();
-    addService(agentService);
-
-    appInformation.put(StatusKeys.INFO_AM_AGENT_OPS_URL, agentOpsUrl + "/");
-    appInformation.put(StatusKeys.INFO_AM_AGENT_STATUS_URL, agentStatusUrl + "/");
-    appInformation.set(StatusKeys.INFO_AM_AGENT_STATUS_PORT,
-                       agentWebApp.getPort());
-    appInformation.set(StatusKeys.INFO_AM_AGENT_OPS_PORT,
-                       agentWebApp.getSecuredPort());
-  }
-
-  /**
-   * Set up the AM filter 
-   * @param serviceConf configuration to patch
-   */
-  private void initAMFilterOptions(Configuration serviceConf) {
-    // IP filtering
-    String amFilterName = AM_FILTER_NAME;
-
-    // This is here until YARN supports proxy & redirect operations
-    // on verbs other than GET, and is only supported for testing
-    if (X_DEV_INSECURE_REQUIRED && serviceConf.getBoolean(X_DEV_INSECURE_WS, 
-        X_DEV_INSECURE_DEFAULT)) {
-      log.warn("Insecure filter enabled: REST operations are unauthenticated");
-      amFilterName = InsecureAmFilterInitializer.NAME;
-    }
-
-    serviceConf.set(HADOOP_HTTP_FILTER_INITIALIZERS, amFilterName);
-  }
-
-  /**
-   * This registers the service instance and its external values
-   * @param instanceName name of this instance
-   * @param appId application ID
-   * @throws IOException
-   */
-  public void registerServiceInstance(String instanceName,
-      ApplicationId appId) throws IOException {
-    
-    
-    // the registry is running, so register services
-    URL amWebURI = new URL(appMasterProxiedUrl);
-    URL agentOpsURI = new URL(agentOpsUrl);
-    URL agentStatusURI = new URL(agentStatusUrl);
-
-    //Give the provider restricted access to the state, registry
-    setupInitialRegistryPaths();
-    yarnRegistryOperations = new YarnRegistryViewForProviders(
-        registryOperations,
-        service_user_name,
-        SliderKeys.APP_TYPE,
-        instanceName,
-        appAttemptID);
-    providerService.bindToYarnRegistry(yarnRegistryOperations);
-    sliderAMProvider.bindToYarnRegistry(yarnRegistryOperations);
-
-    // Yarn registry
-    ServiceRecord serviceRecord = new ServiceRecord();
-    serviceRecord.set(YarnRegistryAttributes.YARN_ID, appId.toString());
-    serviceRecord.set(YarnRegistryAttributes.YARN_PERSISTENCE,
-        PersistencePolicies.APPLICATION);
-    serviceRecord.description = "Slider Application Master";
-
-    serviceRecord.addExternalEndpoint(
-        RegistryTypeUtils.ipcEndpoint(
-            CustomRegistryConstants.AM_IPC_PROTOCOL,
-            rpcServiceAddress));
-            
-    // internal services
-    sliderAMProvider.applyInitialRegistryDefinitions(amWebURI,
-        agentOpsURI,
-        agentStatusURI,
-        serviceRecord);
-
-    // provider service dynamic definitions.
-    providerService.applyInitialRegistryDefinitions(amWebURI,
-        agentOpsURI,
-        agentStatusURI,
-        serviceRecord);
-
-    // set any provided attributes
-    setProvidedServiceRecordAttributes(
-        getInstanceDefinition().getAppConfOperations().getComponent(
-            SliderKeys.COMPONENT_AM), serviceRecord);
-
-    // register the service's entry
-    log.info("Service Record \n{}", serviceRecord);
-    yarnRegistryOperations.registerSelf(serviceRecord, true);
-    log.info("Registered service under {}; absolute path {}",
-        yarnRegistryOperations.getSelfRegistrationPath(),
-        yarnRegistryOperations.getAbsoluteSelfRegistrationPath());
-    
-    boolean isFirstAttempt = 1 == appAttemptID.getAttemptId();
-    // delete the children in case there are any and this is an AM startup.
-    // just to make sure everything underneath is purged
-    if (isFirstAttempt) {
-      yarnRegistryOperations.deleteChildren(
-          yarnRegistryOperations.getSelfRegistrationPath(),
-          true);
-    }
-  }
-
-  /**
-   * TODO: purge this once RM is doing the work
-   * @throws IOException
-   */
-  protected void setupInitialRegistryPaths() throws IOException {
-    if (registryOperations instanceof RMRegistryOperationsService) {
-      RMRegistryOperationsService rmRegOperations =
-          (RMRegistryOperationsService) registryOperations;
-      rmRegOperations.initUserRegistryAsync(service_user_name);
-    }
-  }
-
-  /**
-   * Handler for {@link RegisterComponentInstance action}
-   * Register/re-register an ephemeral container that is already in the app state
-   * @param id the component
-   * @param description component description
-   * @param type component type
-   * @return true if the component is registered
-   */
-  public boolean registerComponent(ContainerId id, String description,
-      String type) throws IOException {
-    RoleInstance instance = appState.getOwnedContainer(id);
-    if (instance == null) {
-      return false;
-    }
-    // this is where component registrations  go
-    log.info("Registering component {}", id);
-    String cid = RegistryPathUtils.encodeYarnID(id.toString());
-    ServiceRecord container = new ServiceRecord();
-    container.set(YarnRegistryAttributes.YARN_ID, cid);
-    container.description = description;
-    container.set(YarnRegistryAttributes.YARN_PERSISTENCE,
-        PersistencePolicies.CONTAINER);
-    MapOperations compOps = getInstanceDefinition().getAppConfOperations().
-        getComponent(type);
-    setProvidedServiceRecordAttributes(compOps, container);
-    try {
-      yarnRegistryOperations.putComponent(cid, container);
-    } catch (IOException e) {
-      log.warn("Failed to register container {}/{}: {}",
-          id, description, e, e);
-      return false;
-    }
-    return true;
-  }
-
-  protected void setProvidedServiceRecordAttributes(MapOperations ops,
-                                                  ServiceRecord record) {
-    String prefix = RoleKeys.SERVICE_RECORD_ATTRIBUTE_PREFIX;
-    for (Map.Entry<String, String> entry : ops.entrySet()) {
-      if (entry.getKey().startsWith(
-          prefix)) {
-        String key = entry.getKey().substring(
-            prefix.length() + 1);
-        record.set(key, entry.getValue().trim());
-      }
-    }
-  }
-
-  /**
-   * Handler for {@link UnregisterComponentInstance}
-   * 
-   * unregister a component. At the time this message is received,
-   * the component may not have been registered
-   * @param id the component
-   */
-  public void unregisterComponent(ContainerId id) {
-    log.info("Unregistering component {}", id);
-    if (yarnRegistryOperations == null) {
-      log.warn("Processing unregister component event before initialization " +
-               "completed; init flag ={}", initCompleted);
-      return;
-    }
-    String cid = RegistryPathUtils.encodeYarnID(id.toString());
-    try {
-      yarnRegistryOperations.deleteComponent(cid);
-    } catch (IOException e) {
-      log.warn("Failed to delete container {} : {}", id, e, e);
-    }
-  }
-
-  /**
-   * looks for a specific case where a token file is provided as an environment
-   * variable, yet the file is not there.
-   * 
-   * This surfaced (once) in HBase, where its HDFS library was looking for this,
-   * and somehow the token was missing. This is a check in the AM so that
-   * if the problem re-occurs, the AM can fail with a more meaningful message.
-   * 
-   */
-  private void checkAndWarnForAuthTokenProblems() {
-    String fileLocation =
-      System.getenv(UserGroupInformation.HADOOP_TOKEN_FILE_LOCATION);
-    if (fileLocation != null) {
-      File tokenFile = new File(fileLocation);
-      if (!tokenFile.exists()) {
-        log.warn("Token file {} specified in {} not found", tokenFile,
-                 UserGroupInformation.HADOOP_TOKEN_FILE_LOCATION);
-      }
-    }
-  }
-
-  /**
-   * Build the configuration directory passed in or of the target FS
-   * @return the file
-   */
-  public File getLocalConfDir() {
-    File confdir =
-      new File(SliderKeys.PROPAGATED_CONF_DIR_NAME).getAbsoluteFile();
-    return confdir;
-  }
-
-  /**
-   * Get the path to the DFS configuration that is defined in the cluster specification 
-   * @return the generated configuration dir
-   */
-  public String getGeneratedConfDir() {
-    return getGlobalInternalOptions().get(
-        InternalKeys.INTERNAL_GENERATED_CONF_PATH);
-  }
-
-  /**
-   * Get the global internal options for the AM
-   * @return a map to access the internals
-   */
-  public MapOperations getGlobalInternalOptions() {
-    return getInstanceDefinition()
-      .getInternalOperations().
-      getGlobalOptions();
-  }
-
-  /**
-   * Get the filesystem of this cluster
-   * @return the FS of the config
-   */
-  public SliderFileSystem getClusterFS() throws IOException {
-    return new SliderFileSystem(getConfig());
-  }
-
-  /**
-   * Get the AM log
-   * @return the log of the AM
-   */
-  public static Logger getLog() {
-    return log;
-  }
-
-  /**
-   * Get the application state
-   * @return the application state
-   */
-  public AppState getAppState() {
-    return appState;
-  }
-
-  /**
-   * Block until it is signalled that the AM is done
-   */
-  private void waitForAMCompletionSignal() {
-    AMExecutionStateLock.lock();
-    try {
-      if (!amCompletionFlag.get()) {
-        log.debug("blocking until signalled to terminate");
-        isAMCompleted.awaitUninterruptibly();
-      }
-    } finally {
-      AMExecutionStateLock.unlock();
-    }
-  }
-
-  /**
-   * Signal that the AM is complete .. queues it in a separate thread
-   *
-   * @param stopActionRequest request containing shutdown details
-   */
-  public synchronized void signalAMComplete(ActionStopSlider stopActionRequest) {
-    // this is a queued action: schedule it through the queues
-    schedule(stopActionRequest);
-  }
-
-  /**
-   * Signal that the AM is complete
-   *
-   * @param stopActionRequest request containing shutdown details
-   */
-  public synchronized void onAMStop(ActionStopSlider stopActionRequest) {
-
-    AMExecutionStateLock.lock();
-    try {
-      if (amCompletionFlag.compareAndSet(false, true)) {
-        // first stop request received
-        this.stopAction = stopActionRequest;
-        isAMCompleted.signal();
-      }
-    } finally {
-      AMExecutionStateLock.unlock();
-    }
-  }
-
-  
-  /**
-   * trigger the YARN cluster termination process
-   * @return the exit code
-   * @throws Exception if the stop action contained an Exception which implements
-   * ExitCodeProvider
-   */
-  private synchronized int finish() throws Exception {
-    Preconditions.checkNotNull(stopAction, "null stop action");
-    FinalApplicationStatus appStatus;
-    log.info("Triggering shutdown of the AM: {}", stopAction);
-
-    String appMessage = stopAction.getMessage();
-    //stop the daemon & grab its exit code
-    int exitCode = stopAction.getExitCode();
-    Exception exception = stopAction.getEx();
-
-    appStatus = stopAction.getFinalApplicationStatus();
-    if (!spawnedProcessExitedBeforeShutdownTriggered) {
-      //stopped the forked process but don't worry about its exit code
-      int forkedExitCode = stopForkedProcess();
-      log.debug("Stopped forked process: exit code={}", forkedExitCode);
-    }
-
-    // make sure the AM is actually registered. If not, there's no point
-    // trying to unregister it
-    if (amRegistrationData == null) {
-      log.info("Application attempt not yet registered; skipping unregistration");
-      if (exception != null) {
-        throw exception;
-      }
-      return exitCode;
-    }
-
-    //stop any launches in progress
-    launchService.stop();
-
-    //now release all containers
-    releaseAllContainers();
-
-    // When the application completes, it should send a finish application
-    // signal to the RM
-    log.info("Application completed. Signalling finish to RM");
-
-    try {
-      log.info("Unregistering AM status={} message={}", appStatus, appMessage);
-      asyncRMClient.unregisterApplicationMaster(appStatus, appMessage, null);
-    } catch (InvalidApplicationMasterRequestException e) {
-      log.info("Application not found in YARN application list;" +
-        " it may have been terminated/YARN shutdown in progress: {}", e, e);
-    } catch (YarnException | IOException e) {
-      log.info("Failed to unregister application: " + e, e);
-    }
-    if (exception != null) {
-      throw exception;
-    }
-    return exitCode;
-  }
-
-    /**
-     * Get diagnostics info about containers
-     */
-  private String getContainerDiagnosticInfo() {
-
-    return appState.getContainerDiagnosticInfo();
-  }
-
-  public Object getProxy(Class protocol, InetSocketAddress addr) {
-    return yarnRPC.getProxy(protocol, addr, getConfig());
-  }
-
-  /**
-   * Start the slider RPC server
-   */
-  private void startSliderRPCServer(AggregateConf instanceDefinition)
-      throws IOException, SliderException {
-    verifyIPCAccess();
-
-    sliderIPCService = new SliderIPCService(
-        this,
-        certificateManager,
-        stateForProviders,
-        actionQueues,
-        metricsAndMonitoring,
-        contentCache);
-
-    deployChildService(sliderIPCService);
-    SliderClusterProtocolPBImpl protobufRelay =
-        new SliderClusterProtocolPBImpl(sliderIPCService);
-    BlockingService blockingService = SliderClusterAPI.SliderClusterProtocolPB
-        .newReflectiveBlockingService(
-            protobufRelay);
-
-    int port = getPortToRequest();
-    InetSocketAddress rpcAddress = new InetSocketAddress("0.0.0.0", port);
-    rpcService =
-        new WorkflowRpcService("SliderRPC",
-            RpcBinder.createProtobufServer(rpcAddress, getConfig(),
-                secretManager,
-            NUM_RPC_HANDLERS,
-            blockingService,
-            null));
-    deployChildService(rpcService);
-  }
-
-  /**
-   * verify that if the cluster is authed, the ACLs are set.
-   * @throws BadConfigException if Authorization is set without any ACL
-   */
-  private void verifyIPCAccess() throws BadConfigException {
-    boolean authorization = getConfig().getBoolean(
-        CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
-        false);
-    String acls = getConfig().get(KEY_PROTOCOL_ACL);
-    if (authorization && SliderUtils.isUnset(acls)) {
-      throw new BadConfigException("Application has IPC authorization enabled in " +
-          CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION +
-          " but no ACLs in " + KEY_PROTOCOL_ACL);
-    }
-  }
-
-
-/* =================================================================== */
-/* AMRMClientAsync callbacks */
-/* =================================================================== */
-
-  /**
-   * Callback event when a container is allocated.
-   * 
-   * The app state is updated with the allocation, and builds up a list
-   * of assignments and RM operations. The assignments are 
-   * handed off into the pool of service launchers to asynchronously schedule
-   * container launch operations.
-   * 
-   * The operations are run in sequence; they are expected to be 0 or more
-   * release operations (to handle over-allocations)
-   * 
-   * @param allocatedContainers list of containers that are now ready to be
-   * given work.
-   */
-  @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
-  @Override //AMRMClientAsync
-  public void onContainersAllocated(List<Container> allocatedContainers) {
-    LOG_YARN.info("onContainersAllocated({})", allocatedContainers.size());
-    List<ContainerAssignment> assignments = new ArrayList<>();
-    List<AbstractRMOperation> operations = new ArrayList<>();
-    
-    //app state makes all the decisions
-    appState.onContainersAllocated(allocatedContainers, assignments, operations);
-
-    //for each assignment: instantiate that role
-    for (ContainerAssignment assignment : assignments) {
-      try {
-        launchService.launchRole(assignment, getInstanceDefinition(),
-            buildContainerCredentials());
-      } catch (IOException e) {
-        // Can be caused by failure to renew credentials with the remote
-        // service. If so, don't launch the application. Container is retained,
-        // though YARN will take it away after a timeout.
-        log.error("Failed to build credentials to launch container: {}", e, e);
-
-      }
-    }
-
-    //for all the operations, exec them
-    execute(operations);
-    log.info("Diagnostics: {}", getContainerDiagnosticInfo());
-  }
-
-  @Override //AMRMClientAsync
-  public synchronized void onContainersCompleted(List<ContainerStatus> completedContainers) {
-    LOG_YARN.info("onContainersCompleted([{}]", completedContainers.size());
-    for (ContainerStatus status : completedContainers) {
-      ContainerId containerId = status.getContainerId();
-      LOG_YARN.info("Container Completion for" +
-                    " containerID={}," +
-                    " state={}," +
-                    " exitStatus={}," +
-                    " diagnostics={}",
-                    containerId, status.getState(),
-                    status.getExitStatus(),
-                    status.getDiagnostics());
-
-      // non complete containers should not be here
-      assert (status.getState() == ContainerState.COMPLETE);
-      AppState.NodeCompletionResult result = appState.onCompletedNode(status);
-      if (result.containerFailed) {
-        RoleInstance ri = result.roleInstance;
-        log.error("Role instance {} failed ", ri);
-      }
-
-      //  known nodes trigger notifications
-      if(!result.unknownNode) {
-        getProviderService().notifyContainerCompleted(containerId);
-        queue(new UnregisterComponentInstance(containerId, 0,
-            TimeUnit.MILLISECONDS));
-      }
-    }
-
-    reviewRequestAndReleaseNodes("onContainersCompleted");
-  }
-
-  /**
-   * Signal that containers are being upgraded. Containers specified with
-   * --containers option and all containers of all roles specified with
-   * --components option are merged and upgraded.
-   * 
-   * @param upgradeContainersRequest
-   *          request containing upgrade details
-   */
-  public synchronized void onUpgradeContainers(
-      ActionUpgradeContainers upgradeContainersRequest) throws IOException,
-      SliderException {
-    LOG_YARN.info("onUpgradeContainers({})",
-        upgradeContainersRequest.getMessage());
-    Set<String> containers = upgradeContainersRequest.getContainers() == null ? new HashSet<String>()
-        : upgradeContainersRequest.getContainers();
-    LOG_YARN.info("  Container list provided (total {}) : {}",
-        containers.size(), containers);
-    Set<String> components = upgradeContainersRequest.getComponents() == null ? new HashSet<String>()
-        : upgradeContainersRequest.getComponents();
-    LOG_YARN.info("  Component list provided (total {}) : {}",
-        components.size(), components);
-    // If components are specified as well, then grab all the containers of
-    // each of the components (roles)
-    if (CollectionUtils.isNotEmpty(components)) {
-      Map<ContainerId, RoleInstance> liveContainers = appState.getLiveContainers();
-      if (CollectionUtils.isNotEmpty(liveContainers.keySet())) {
-        Map<String, Set<String>> roleContainerMap = prepareRoleContainerMap(liveContainers);
-        for (String component : components) {
-          Set<String> roleContainers = roleContainerMap.get(component);
-          if (roleContainers != null) {
-            containers.addAll(roleContainers);
-          }
-        }
-      }
-    }
-    LOG_YARN.info("Final list of containers to be upgraded (total {}) : {}",
-        containers.size(), containers);
-    if (providerService instanceof AgentProviderService) {
-      AgentProviderService agentProviderService = (AgentProviderService) providerService;
-      agentProviderService.setInUpgradeMode(true);
-      agentProviderService.addUpgradeContainers(containers);
-    }
-  }
-
-  // create a reverse map of roles -> set of all live containers
-  private Map<String, Set<String>> prepareRoleContainerMap(
-      Map<ContainerId, RoleInstance> liveContainers) {
-    // liveContainers is ensured to be not empty
-    Map<String, Set<String>> roleContainerMap = new HashMap<>();
-    for (Map.Entry<ContainerId, RoleInstance> liveContainer : liveContainers
-        .entrySet()) {
-      RoleInstance role = liveContainer.getValue();
-      if (roleContainerMap.containsKey(role.role)) {
-        roleContainerMap.get(role.role).add(liveContainer.getKey().toString());
-      } else {
-        Set<String> containers = new HashSet<String>();
-        containers.add(liveContainer.getKey().toString());
-        roleContainerMap.put(role.role, containers);
-      }
-    }
-    return roleContainerMap;
-  }
-
-  /**
-   * Implementation of cluster flexing.
-   * It should be the only way that anything -even the AM itself on startup-
-   * asks for nodes. 
-   * @param resources the resource tree
-   * @throws SliderException slider problems, including invalid configs
-   * @throws IOException IO problems
-   */
-  public void flexCluster(ConfTree resources)
-      throws IOException, SliderException {
-
-    AggregateConf newConf =
-        new AggregateConf(appState.getInstanceDefinitionSnapshot());
-    newConf.setResources(resources);
-    // verify the new definition is valid
-    sliderAMProvider.validateInstanceDefinition(newConf);
-    providerService.validateInstanceDefinition(newConf);
-
-    appState.updateResourceDefinitions(resources);
-
-    // reset the scheduled windows...the values
-    // may have changed
-    appState.resetFailureCounts();
-
-    // ask for more containers if needed
-    reviewRequestAndReleaseNodes("flexCluster");
-  }
-
-  /**
-   * Schedule the failure window
-   * @param resources the resource tree
-   * @throws BadConfigException if the window is out of range
-   */
-  private void scheduleFailureWindowResets(ConfTree resources) throws
-      BadConfigException {
-    ResetFailureWindow reset = new ResetFailureWindow();
-    ConfTreeOperations ops = new ConfTreeOperations(resources);
-    MapOperations globals = ops.getGlobalOptions();
-    long seconds = globals.getTimeRange(ResourceKeys.CONTAINER_FAILURE_WINDOW,
-        ResourceKeys.DEFAULT_CONTAINER_FAILURE_WINDOW_DAYS,
-        ResourceKeys.DEFAULT_CONTAINER_FAILURE_WINDOW_HOURS,
-        ResourceKeys.DEFAULT_CONTAINER_FAILURE_WINDOW_MINUTES, 0);
-    if (seconds > 0) {
-      log.info(
-          "Scheduling the failure window reset interval to every {} seconds",
-          seconds);
-      RenewingAction<ResetFailureWindow> renew = new RenewingAction<>(
-          reset, seconds, seconds, TimeUnit.SECONDS, 0);
-      actionQueues.renewing("failures", renew);
-    } else {
-      log.info("Failure window reset interval is not set");
-    }
-  }
-
-  /**
-   * Schedule the escalation action
-   * @param internal
-   * @throws BadConfigException
-   */
-  private void scheduleEscalation(ConfTree internal) throws BadConfigException {
-    EscalateOutstandingRequests escalate = new EscalateOutstandingRequests();
-    ConfTreeOperations ops = new ConfTreeOperations(internal);
-    int seconds = ops.getGlobalOptions().getOptionInt(InternalKeys.ESCALATION_CHECK_INTERVAL,
-        InternalKeys.DEFAULT_ESCALATION_CHECK_INTERVAL);
-    RenewingAction<EscalateOutstandingRequests> renew = new RenewingAction<>(
-        escalate, seconds, seconds, TimeUnit.SECONDS, 0);
-    actionQueues.renewing("escalation", renew);
-  }
-  
-  /**
-   * Look at where the current node state is -and whether it should be changed
-   * @param reason reason for operation
-   */
-  private synchronized void reviewRequestAndReleaseNodes(String reason) {
-    log.debug("reviewRequestAndReleaseNodes({})", reason);
-    queue(new ReviewAndFlexApplicationSize(reason, 0, TimeUnit.SECONDS));
-  }
-
-  /**
-   * Handle the event requesting a review ... look at the queue and decide
-   * whether to act or not
-   * @param action action triggering the event. It may be put
-   * back into the queue
-   * @throws SliderInternalStateException
-   */
-  public void handleReviewAndFlexApplicationSize(ReviewAndFlexApplicationSize action)
-      throws SliderInternalStateException {
-
-    if ( actionQueues.hasQueuedActionWithAttribute(
-        AsyncAction.ATTR_REVIEWS_APP_SIZE | AsyncAction.ATTR_HALTS_APP)) {
-      // this operation isn't needed at all -existing duplicate or shutdown due
-      return;
-    }
-    // if there is an action which changes cluster size, wait
-    if (actionQueues.hasQueuedActionWithAttribute(
-        AsyncAction.ATTR_CHANGES_APP_SIZE)) {
-      // place the action at the back of the queue
-      actionQueues.put(action);
-    }
-    
-    executeNodeReview(action.name);
-  }
-  
-  /**
-   * Look at where the current node state is -and whether it should be changed
-   */
-  public synchronized void executeNodeReview(String reason)
-      throws SliderInternalStateException {
-    
-    log.debug("in executeNodeReview({})", reason);
-    if (amCompletionFlag.get()) {
-      log.info("Ignoring node review operation: shutdown in progress");
-    }
-    try {
-      List<AbstractRMOperation> allOperations = appState.reviewRequestAndReleaseNodes();
-      // tell the provider
-      providerRMOperationHandler.execute(allOperations);
-      //now apply the operations
-      execute(allOperations);
-    } catch (TriggerClusterTeardownException e) {
-      //App state has decided that it is time to exit
-      log.error("Cluster teardown triggered {}", e, e);
-      queue(new ActionStopSlider(e));
-    }
-  }
-
-  /**
-   * Escalate operation as triggered by external timer.
-   * <p>
-   * Get the list of new operations off the AM, then executest them.
-   */
-  public void escalateOutstandingRequests() {
-    List<AbstractRMOperation> operations = appState.escalateOutstandingRequests();
-    providerRMOperationHandler.execute(operations);
-    execute(operations);
-  }
-
-
-  /**
-   * Shutdown operation: release all containers
-   */
-  private void releaseAllContainers() {
-    if (providerService instanceof AgentProviderService) {
-      log.info("Setting stopInitiated flag to true");
-      AgentProviderService agentProviderService = (AgentProviderService) providerService;
-      agentProviderService.setAppStopInitiated(true);
-    }
-    // Add the sleep here (before releasing containers) so that applications get
-    // time to perform graceful shutdown
-    try {
-      long timeout = getContainerReleaseTimeout();
-      if (timeout > 0) {
-        Thread.sleep(timeout);
-      }
-    } catch (InterruptedException e) {
-      log.info("Sleep for container release interrupted");
-    } finally {
-      List<AbstractRMOperation> operations = appState.releaseAllContainers();
-      providerRMOperationHandler.execute(operations);
-      // now apply the operations
-      execute(operations);
-    }
-  }
-
-  private long getContainerReleaseTimeout() {
-    // Get container release timeout in millis or 0 if the property is not set.
-    // If non-zero then add the agent heartbeat delay time, since it can take up
-    // to that much time for agents to receive the stop command.
-    int timeout = getInstanceDefinition().getAppConfOperations()
-        .getGlobalOptions()
-        .getOptionInt(SliderKeys.APP_CONTAINER_RELEASE_TIMEOUT, 0);
-    if (timeout > 0) {
-      timeout += SliderKeys.APP_CONTAINER_HEARTBEAT_INTERVAL_SEC;
-    }
-    // convert to millis
-    long timeoutInMillis = timeout * 1000l;
-    log.info("Container release timeout in millis = {}", timeoutInMillis);
-    return timeoutInMillis;
-  }
-
-  /**
-   * RM wants to shut down the AM
-   */
-  @Override //AMRMClientAsync
-  public void onShutdownRequest() {
-    LOG_YARN.info("Shutdown Request received");
-    signalAMComplete(new ActionStopSlider("stop",
-        EXIT_SUCCESS,
-        FinalApplicationStatus.SUCCEEDED,
-        "Shutdown requested from RM"));
-  }
-
-  /**
-   * Monitored nodes have been changed
-   * @param updatedNodes list of updated nodes
-   */
-  @Override //AMRMClientAsync
-  public void onNodesUpdated(List<NodeReport> updatedNodes) {
-    LOG_YARN.info("onNodesUpdated({})", updatedNodes.size());
-    log.info("Updated nodes {}", updatedNodes);
-    // Check if any nodes are lost or revived and update state accordingly
-
-    AppState.NodeUpdatedOutcome outcome = appState.onNodesUpdated(updatedNodes);
-    if (!outcome.operations.isEmpty()) {
-      execute(outcome.operations);
-    }
-    // trigger a review if the cluster changed
-    if (outcome.clusterChanged) {
-      reviewRequestAndReleaseNodes("nodes updated");
-    }
-  }
-
-  /**
-   * heartbeat operation; return the ratio of requested
-   * to actual
-   * @return progress
-   */
-  @Override //AMRMClientAsync
-  public float getProgress() {
-    return appState.getApplicationProgressPercentage();
-  }
-
-  @Override //AMRMClientAsync
-  public void onError(Throwable e) {
-    //callback says it's time to finish
-    LOG_YARN.error("AMRMClientAsync.onError() received {}", e, e);
-    signalAMComplete(new ActionStopSlider("stop",
-        EXIT_EXCEPTION_THROWN,
-        FinalApplicationStatus.FAILED,
-        "AMRMClientAsync.onError() received " + e));
-  }
-  
-/* =================================================================== */
-/* RMOperationHandlerActions */
-/* =================================================================== */
-
- 
-  @Override
-  public void execute(List<AbstractRMOperation> operations) {
-    rmOperationHandler.execute(operations);
-  }
-
-  @Override
-  public void releaseAssignedContainer(ContainerId containerId) {
-    rmOperationHandler.releaseAssignedContainer(containerId);
-  }
-
-  @Override
-  public void addContainerRequest(AMRMClient.ContainerRequest req) {
-    rmOperationHandler.addContainerRequest(req);
-  }
-
-  @Override
-  public int cancelContainerRequests(Priority priority1,
-      Priority priority2,
-      int count) {
-    return rmOperationHandler.cancelContainerRequests(priority1, priority2, count);
-  }
-
-  @Override
-  public void cancelSingleRequest(AMRMClient.ContainerRequest request) {
-    rmOperationHandler.cancelSingleRequest(request);
-  }
-
-/* =================================================================== */
-/* END */
-/* =================================================================== */
-
-  /**
-   * Launch the provider service
-   *
-   * @param instanceDefinition definition of the service
-   * @param confDir directory of config data
-   * @throws IOException
-   * @throws SliderException
-   */
-  protected synchronized void launchProviderService(AggregateConf instanceDefinition,
-                                                    File confDir)
-    throws IOException, SliderException {
-    Map<String, String> env = new HashMap<>();
-    boolean execStarted = providerService.exec(instanceDefinition, confDir, env,
-        this);
-    if (execStarted) {
-      providerService.registerServiceListener(this);
-      providerService.start();
-    } else {
-      // didn't start, so don't register
-      providerService.start();
-      // and send the started event ourselves
-      eventCallbackEvent(null);
-    }
-  }
-
-  /* =================================================================== */
-  /* EventCallback  from the child or ourselves directly */
-  /* =================================================================== */
-
-  @Override // ProviderCompleted
-  public void eventCallbackEvent(Object parameter) {
-    // signalled that the child process is up.
-    appState.noteAMLive();
-    // now ask for the cluster nodes
-    try {
-      flexCluster(getInstanceDefinition().getResources());
-    } catch (Exception e) {
-      // cluster flex failure: log
-      log.error("Failed to flex cluster nodes: {}", e, e);
-      // then what? exit
-      queue(new ActionStopSlider(e));
-    }
-  }
-
-  /**
-   * report container loss. If this isn't already known about, react
-   *
-   * @param containerId       id of the container which has failed
-   * @throws SliderException
-   */
-  public synchronized void providerLostContainer(
-      ContainerId containerId)
-      throws SliderException {
-    log.info("containerLostContactWithProvider: container {} lost",
-        containerId);
-    RoleInstance activeContainer = appState.getOwnedContainer(containerId);
-    if (activeContainer != null) {
-      execute(appState.releaseContainer(containerId));
-      // ask for more containers if needed
-      log.info("Container released; triggering review");
-      reviewRequestAndReleaseNodes("Loss of container");
-    } else {
-      log.info("Container not in active set - ignoring");
-    }
-  }
-
-  /* =================================================================== */
-  /* ServiceStateChangeListener */
-  /* =================================================================== */
-
-  /**
-   * Received on listening service termination.
-   * @param service the service that has changed.
-   */
-  @Override //ServiceStateChangeListener
-  public void stateChanged(Service service) {
-    if (service == providerService && service.isInState(STATE.STOPPED)) {
-      //its the current master process in play
-      int exitCode = providerService.getExitCode();
-      int mappedProcessExitCode = exitCode;
-
-      boolean shouldTriggerFailure = !amCompletionFlag.get()
-         && (mappedProcessExitCode != 0);
-
-      if (shouldTriggerFailure) {
-        String reason =
-            "Spawned process failed with raw " + exitCode + " mapped to " +
-            mappedProcessExitCode;
-        ActionStopSlider stop = new ActionStopSlider("stop",
-            mappedProcessExitCode,
-            FinalApplicationStatus.FAILED,
-            reason);
-        //this wasn't expected: the process finished early
-        spawnedProcessExitedBeforeShutdownTriggered = true;
-        log.info(
-          "Process has exited with exit code {} mapped to {} -triggering termination",
-          exitCode,
-          mappedProcessExitCode);
-
-        //tell the AM the cluster is complete 
-        signalAMComplete(stop);
-      } else {
-        //we don't care
-        log.info(
-          "Process has exited with exit code {} mapped to {} -ignoring",
-          exitCode,
-          mappedProcessExitCode);
-      }
-    } else {
-      super.stateChanged(service);
-    }
-  }
-
-  /**
-   * stop forked process if it the running process var is not null
-   * @return the process exit code
-   */
-  protected synchronized Integer stopForkedProcess() {
-    providerService.stop();
-    return providerService.getExitCode();
-  }
-
-  /**
-   *  Async start container request
-   * @param container container
-   * @param ctx context
-   * @param instance node details
-   */
-  public void startContainer(Container container,
-                             ContainerLaunchContext ctx,
-                             RoleInstance instance) throws IOException {
-    appState.containerStartSubmitted(container, instance);
-        
-    nmClientAsync.startContainerAsync(container, ctx);
-  }
-
-  /**
-   * Build the credentials needed for containers. This will include
-   * getting new delegation tokens for HDFS if the AM is running
-   * with a keytab.
-   * @return a buffer of credentials
-   * @throws IOException
-   */
-
-  private Credentials buildContainerCredentials() throws IOException {
-    Credentials credentials = new Credentials(containerCredentials);
-    if (securityConfiguration.isKeytabProvided()) {
-      CredentialUtils.addSelfRenewableFSDelegationTokens(
-          getClusterFS().getFileSystem(),
-          credentials);
-    }
-    return credentials;
-  }
-
-  @Override //  NMClientAsync.CallbackHandler 
-  public void onContainerStopped(ContainerId containerId) {
-    // do nothing but log: container events from the AM
-    // are the source of container halt details to react to
-    log.info("onContainerStopped {} ", containerId);
-  }
-
-  @Override //  NMClientAsync.CallbackHandler 
-  public void onContainerStarted(ContainerId containerId,
-      Map<String, ByteBuffer> allServiceResponse) {
-    LOG_YARN.info("Started Container {} ", containerId);
-    RoleInstance cinfo = appState.onNodeManagerContainerStarted(containerId);
-    if (cinfo != null) {
-      LOG_YARN.info("Deployed instance of role {} onto {}",
-          cinfo.role, containerId);
-      //trigger an async container status
-      nmClientAsync.getContainerStatusAsync(containerId,
-                                            cinfo.container.getNodeId());
-      // push out a registration
-      queue(new RegisterComponentInstance(containerId, cinfo.role, cinfo.group,
-          0, TimeUnit.MILLISECONDS));
-      
-    } else {
-      //this is a hypothetical path not seen. We react by warning
-      log.error("Notified of started container that isn't pending {} - releasing",
-                containerId);
-      //then release it
-      asyncRMClient.releaseAssignedContainer(containerId);
-    }
-  }
-
-  @Override //  NMClientAsync.CallbackHandler 
-  public void onStartContainerError(ContainerId containerId, Throwable t) {
-   

<TRUNCATED>


[38/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java b/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
deleted file mode 100644
index 30f6ba9..0000000
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.client;
-
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.hadoop.service.Service;
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.YarnApplicationState;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.slider.api.types.NodeInformationList;
-import org.apache.slider.api.types.SliderInstanceDescription;
-import org.apache.slider.common.params.AbstractClusterBuildingActionArgs;
-import org.apache.slider.common.params.ActionAMSuicideArgs;
-import org.apache.slider.common.params.ActionClientArgs;
-import org.apache.slider.common.params.ActionDependencyArgs;
-import org.apache.slider.common.params.ActionDestroyArgs;
-import org.apache.slider.common.params.ActionDiagnosticArgs;
-import org.apache.slider.common.params.ActionEchoArgs;
-import org.apache.slider.common.params.ActionFlexArgs;
-import org.apache.slider.common.params.ActionFreezeArgs;
-import org.apache.slider.common.params.ActionInstallKeytabArgs;
-import org.apache.slider.common.params.ActionInstallPackageArgs;
-import org.apache.slider.common.params.ActionKeytabArgs;
-import org.apache.slider.common.params.ActionNodesArgs;
-import org.apache.slider.common.params.ActionPackageArgs;
-import org.apache.slider.common.params.ActionKillContainerArgs;
-import org.apache.slider.common.params.ActionListArgs;
-import org.apache.slider.common.params.ActionRegistryArgs;
-import org.apache.slider.common.params.ActionResolveArgs;
-import org.apache.slider.common.params.ActionResourceArgs;
-import org.apache.slider.common.params.ActionStatusArgs;
-import org.apache.slider.common.params.ActionThawArgs;
-import org.apache.slider.common.params.ActionUpgradeArgs;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.providers.AbstractClientProvider;
-
-import java.io.IOException;
-import java.util.Map;
-
-/**
- * Interface of those method calls in the slider API that are intended
- * for direct public invocation.
- * <p>
- * Stability: evolving
- */
-public interface SliderClientAPI extends Service {
-  /**
-   * Destroy a cluster. There's two race conditions here
-   * #1 the cluster is started between verifying that there are no live
-   * clusters of that name.
-   */
-  int actionDestroy(String clustername, ActionDestroyArgs destroyArgs)
-      throws YarnException, IOException;
-
-  int actionDestroy(String clustername) throws YarnException,
-      IOException;
-
-  /**
-   * AM to commit an asynchronous suicide
-   */
-  int actionAmSuicide(String clustername,
-      ActionAMSuicideArgs args) throws YarnException, IOException;
-
-  /**
-   * Get the provider for this cluster
-   * @param provider the name of the provider
-   * @return the provider instance
-   * @throws SliderException problems building the provider
-   */
-  AbstractClientProvider createClientProvider(String provider)
-    throws SliderException;
-
-  /**
-   * Build up the cluster specification/directory
-   *
-   * @param clustername cluster name
-   * @param buildInfo the arguments needed to build the cluster
-   * @throws YarnException Yarn problems
-   * @throws IOException other problems
-   * @throws BadCommandArgumentsException bad arguments.
-   */
-  int actionBuild(String clustername,
-      AbstractClusterBuildingActionArgs buildInfo) throws YarnException, IOException;
-
-  /**
-   * Upload keytab to a designated sub-directory of the user home directory
-   *
-   * @param installKeytabInfo the arguments needed to upload the keytab
-   * @throws YarnException Yarn problems
-   * @throws IOException other problems
-   * @throws BadCommandArgumentsException bad arguments.
-   * @deprecated use #actionKeytab
-   */
-  int actionInstallKeytab(ActionInstallKeytabArgs installKeytabInfo)
-      throws YarnException, IOException;
-
-  /**
-   * Manage keytabs leveraged by slider
-   *
-   * @param keytabInfo the arguments needed to manage the keytab
-   * @throws YarnException Yarn problems
-   * @throws IOException other problems
-   * @throws BadCommandArgumentsException bad arguments.
-   */
-  int actionKeytab(ActionKeytabArgs keytabInfo)
-      throws YarnException, IOException;
-
-  /**
-   * Upload application package to user home directory
-   *
-   * @param installPkgInfo the arguments needed to upload the package
-   * @throws YarnException Yarn problems
-   * @throws IOException other problems
-   * @throws BadCommandArgumentsException bad arguments.
-   */
-  int actionInstallPkg(ActionInstallPackageArgs installPkgInfo)
-      throws YarnException, IOException;
-
-  /**
-   * Manage file resources leveraged by slider
-   *
-   * @param resourceInfo the arguments needed to manage the resource
-   * @throws YarnException Yarn problems
-   * @throws IOException other problems
-   * @throws BadCommandArgumentsException bad arguments.
-   */
-  int actionResource(ActionResourceArgs resourceInfo)
-      throws YarnException, IOException;
-
-  /**
-   * Perform client operations such as install or configure
-   *
-   * @param clientInfo the arguments needed for client operations
-   *
-   * @throws SliderException bad arguments.
-   * @throws IOException problems related to package and destination folders
-   */
-  int actionClient(ActionClientArgs clientInfo)
-      throws IOException, YarnException;
-
-  /**
-   * Managing slider application package
-   *
-   * @param pkgInfo the arguments needed to upload, delete or list the package
-   * @throws YarnException Yarn problems
-   * @throws IOException other problems
-   * @throws BadCommandArgumentsException bad arguments.
-   */
-  int actionPackage(ActionPackageArgs pkgInfo)
-      throws YarnException, IOException;
-
-  /**
-   * Update the cluster specification
-   *
-   * @param clustername cluster name
-   * @param buildInfo the arguments needed to update the cluster
-   * @throws YarnException Yarn problems
-   * @throws IOException other problems
-   */
-  int actionUpdate(String clustername,
-      AbstractClusterBuildingActionArgs buildInfo)
-      throws YarnException, IOException; 
-
-  /**
-   * Upgrade the cluster with a newer version of the application
-   *
-   * @param clustername cluster name
-   * @param buildInfo the arguments needed to upgrade the cluster
-   * @throws YarnException Yarn problems
-   * @throws IOException other problems
-   */
-  int actionUpgrade(String clustername,
-      ActionUpgradeArgs buildInfo)
-      throws YarnException, IOException; 
-
-  /**
-   * Get the report of a this application
-   * @return the app report or null if it could not be found.
-   * @throws IOException
-   * @throws YarnException
-   */
-  ApplicationReport getApplicationReport()
-      throws IOException, YarnException;
-
-  /**
-   * Kill the submitted application via YARN
-   * @throws YarnException
-   * @throws IOException
-   */
-  boolean forceKillApplication(String reason)
-    throws YarnException, IOException;
-
-  /**
-   * Implement the list action: list all nodes
-   * @return exit code of 0 if a list was created
-   */
-  int actionList(String clustername, ActionListArgs args) throws IOException, YarnException;
-
-  /**
-   * Enumerate slider instances for the current user, and the
-   * most recent app report, where available.
-   * @param listOnlyInState boolean to indicate that the instances should
-   * only include those in a YARN state
-   * <code> minAppState &lt;= currentState &lt;= maxAppState </code>
-   *
-   * @param minAppState minimum application state to include in enumeration.
-   * @param maxAppState maximum application state to include
-   * @return a map of application instance name to description
-   * @throws IOException Any IO problem
-   * @throws YarnException YARN problems
-   */
-  Map<String, SliderInstanceDescription> enumSliderInstances(
-      boolean listOnlyInState,
-      YarnApplicationState minAppState,
-      YarnApplicationState maxAppState)
-      throws IOException, YarnException;
-
-  /**
-   * Implement the islive action: probe for a cluster of the given name existing
-   * @return exit code
-   */
-  int actionFlex(String name, ActionFlexArgs args) throws YarnException, IOException;
-
-  /**
-   * Test for a cluster existing probe for a cluster of the given name existing
-   * in the filesystem. If the live param is set, it must be a live cluster
-   * @return exit code
-   */
-  int actionExists(String name, boolean checkLive) throws YarnException, IOException;
-
-  /**
-   * Kill a specific container of the cluster
-   * @param name cluster name
-   * @param args arguments
-   * @return exit code
-   * @throws YarnException
-   * @throws IOException
-   */
-  int actionKillContainer(String name, ActionKillContainerArgs args)
-      throws YarnException, IOException;
-
-  /**
-   * Echo operation (not currently wired up to command line)
-   * @param name cluster name
-   * @param args arguments
-   * @return the echoed text
-   * @throws YarnException
-   * @throws IOException
-   */
-  String actionEcho(String name, ActionEchoArgs args)
-      throws YarnException, IOException;
-
-  /**
-   * Status operation
-   *
-   * @param clustername cluster name
-   * @param statusArgs status arguments
-   * @return 0 -for success, else an exception is thrown
-   * @throws YarnException
-   * @throws IOException
-   */
-  int actionStatus(String clustername, ActionStatusArgs statusArgs)
-      throws YarnException, IOException;
-
-  /**
-   * Version Details
-   * @return exit code
-   */
-  int actionVersion();
-
-  /**
-   * Stop the cluster
-   *
-   * @param clustername cluster name
-   * @param freezeArgs arguments to the stop
-   * @return EXIT_SUCCESS if the cluster was not running by the end of the operation
-   */
-  int actionFreeze(String clustername, ActionFreezeArgs freezeArgs)
-      throws YarnException, IOException;
-
-  /**
-   * Restore a cluster
-   */
-  int actionThaw(String clustername, ActionThawArgs thaw) throws YarnException, IOException;
-
-  /**
-   * Registry operation
-   *
-   * @param args registry Arguments
-   * @return 0 for success, -1 for some issues that aren't errors, just failures
-   * to retrieve information (e.g. no configurations for that entry)
-   * @throws YarnException YARN problems
-   * @throws IOException Network or other problems
-   */
-  int actionResolve(ActionResolveArgs args)
-      throws YarnException, IOException;
-
-  /**
-   * Registry operation
-   *
-   * @param registryArgs registry Arguments
-   * @return 0 for success, -1 for some issues that aren't errors, just failures
-   * to retrieve information (e.g. no configurations for that entry)
-   * @throws YarnException YARN problems
-   * @throws IOException Network or other problems
-   */
-  int actionRegistry(ActionRegistryArgs registryArgs)
-      throws YarnException, IOException;
-
-  /**
-   * diagnostic operation
-   *
-   * @param diagnosticArgs diagnostic Arguments
-   * @return 0 for success, -1 for some issues that aren't errors, just
-   *         failures to retrieve information (e.g. no application name
-   *         specified)
-   * @throws YarnException YARN problems
-   * @throws IOException Network or other problems
-   */
-  int actionDiagnostic(ActionDiagnosticArgs diagnosticArgs);
-
-  /**
-   * Get the registry binding. As this may start the registry, it can take time
-   * and fail
-   * @return the registry 
-   */
-  RegistryOperations getRegistryOperations()
-      throws SliderException, IOException;
-
-  /**
-   * Upload all Slider AM and agent dependency libraries to HDFS, so that they
-   * do not need to be uploaded with every create call. This operation is
-   * Slider version specific. So it needs to be invoked for every single
-   * version of slider/slider-client.
-   * 
-   * @throws SliderException
-   * @throws IOException
-   */
-  int actionDependency(ActionDependencyArgs dependencyArgs) throws IOException,
-      YarnException;
-
-  /**
-   * List the nodes
-   * @param args
-   * @return
-   * @throws YarnException
-   * @throws IOException
-   */
-  NodeInformationList listYarnClusterNodes(ActionNodesArgs args)
-    throws YarnException, IOException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java b/slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java
deleted file mode 100644
index d471cdb..0000000
--- a/slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.client;
-
-import com.google.common.base.Preconditions;
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
-import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest;
-import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationResponse;
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.NodeReport;
-import org.apache.hadoop.yarn.api.records.NodeState;
-import org.apache.hadoop.yarn.api.records.YarnApplicationState;
-import org.apache.hadoop.yarn.client.api.impl.YarnClientImpl;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.hadoop.yarn.util.ConverterUtils;
-import org.apache.hadoop.yarn.util.Records;
-import org.apache.slider.api.types.NodeInformation;
-import org.apache.slider.api.types.NodeInformationList;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.params.ActionNodesArgs;
-import org.apache.slider.common.tools.CoreFileSystem;
-import org.apache.slider.common.tools.Duration;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.net.BindException;
-import java.net.InetSocketAddress;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A class that extends visibility to some of the YarnClientImpl
- * members and data structures, and factors out pure-YARN operations
- * from the slider entry point service
- */
-public class SliderYarnClientImpl extends YarnClientImpl {
-  protected static final Logger log = LoggerFactory.getLogger(SliderYarnClientImpl.class);
-
-  /**
-   * Keyword to use in the {@link #emergencyForceKill(String)}
-   * operation to force kill <i>all</i> application instances belonging
-   * to a specific user
-   */
-  public static final String KILL_ALL = "all";
-
-  @Override
-  protected void serviceInit(Configuration conf) throws Exception {
-    InetSocketAddress clientRpcAddress = SliderUtils.getRmAddress(conf);
-    if (!SliderUtils.isAddressDefined(clientRpcAddress)) {
-      // address isn't known; fail fast
-      throw new BindException("Invalid " + YarnConfiguration.RM_ADDRESS
-          + " value:" + conf.get(YarnConfiguration.RM_ADDRESS)
-          + " - see https://wiki.apache.org/hadoop/UnsetHostnameOrPort");
-    }
-    super.serviceInit(conf);
-  }
-
-  /**
-   * Get the RM Client RPC interface
-   * @return an RPC interface valid after initialization and authentication
-   */
-  public ApplicationClientProtocol getRmClient() {
-    return rmClient;
-  }
-
-  /**
-   * List Slider <i>running</i>instances belonging to a specific user.
-   * @deprecated use {@link #listDeployedInstances(String)}
-   * @param user user: "" means all users
-   * @return a possibly empty list of Slider AMs
-   */
-  public List<ApplicationReport> listInstances(String user)
-    throws YarnException, IOException {
-    return listDeployedInstances(user);
-  }
-
-  /**
-   * List Slider <i>deployed</i>instances belonging to a specific user.
-   * <p>
-   *   Deployed means: known about in the YARN cluster; it will include
-   *   any that are in the failed/finished state, as well as those queued
-   *   for starting.
-   * @param user user: "" means all users
-   * @return a possibly empty list of Slider AMs
-   */
-  public List<ApplicationReport> listDeployedInstances(String user)
-    throws YarnException, IOException {
-    Preconditions.checkArgument(user != null, "Null User");
-    Set<String> types = new HashSet<>(1);
-    types.add(SliderKeys.APP_TYPE);
-    List<ApplicationReport> allApps = getApplications(types);
-    List<ApplicationReport> results = new ArrayList<>();
-    for (ApplicationReport report : allApps) {
-      if (StringUtils.isEmpty(user) || user.equals(report.getUser())) {
-        results.add(report);
-      }
-    }
-    return results;
-  }
-
-  /**
-   * find all instances of a specific app -if there is more than one in the
-   * YARN cluster,
-   * this returns them all
-   * @param user user; use "" for all users
-   * @param appname application name
-   * @return the list of all matching application instances
-   */
-  public List<ApplicationReport> findAllInstances(String user,
-                                                  String appname)
-      throws IOException, YarnException {
-    Preconditions.checkArgument(appname != null, "Null application name");
-
-    List<ApplicationReport> instances = listDeployedInstances(user);
-    List<ApplicationReport> results =
-      new ArrayList<>(instances.size());
-    for (ApplicationReport report : instances) {
-      if (report.getName().equals(appname)) {
-        results.add(report);
-      }
-    }
-    return results;
-  }
-  
-  /**
-   * Helper method to determine if a cluster application is running -or
-   * is earlier in the lifecycle
-   * @param app application report
-   * @return true if the application is considered live
-   */
-  public boolean isApplicationLive(ApplicationReport app) {
-    Preconditions.checkArgument(app != null, "Null app report");
-
-    return app.getYarnApplicationState().ordinal() <= YarnApplicationState.RUNNING.ordinal();
-  }
-
-
-  /**
-   * Kill a running application
-   * @param applicationId app Id
-   * @param reason reason: reason for log
-   * @return the response
-   * @throws YarnException YARN problems
-   * @throws IOException IO problems
-   */
-  public  KillApplicationResponse killRunningApplication(ApplicationId applicationId,
-                                                         String reason)
-      throws YarnException, IOException {
-    Preconditions.checkArgument(applicationId != null, "Null application Id");
-    log.info("Killing application {} - {}", applicationId.getClusterTimestamp(),
-             reason);
-    KillApplicationRequest request =
-      Records.newRecord(KillApplicationRequest.class);
-    request.setApplicationId(applicationId);
-    return getRmClient().forceKillApplication(request);
-  }
-
-  private String getUsername() throws IOException {
-    return UserGroupInformation.getCurrentUser().getShortUserName();
-  }
-  
-  /**
-   * Force kill a yarn application by ID. No niceties here
-   * @param applicationId app Id. "all" means "kill all instances of the current user
-   * 
-   */
-  public void emergencyForceKill(String applicationId)
-      throws YarnException, IOException {
-
-    Preconditions.checkArgument(StringUtils.isNotEmpty(applicationId),
-        "Null/empty application Id");
-
-    if (KILL_ALL.equals(applicationId)) {
-      // user wants all instances killed
-      String user = getUsername();
-      log.info("Killing all applications belonging to {}", user);
-      Collection<ApplicationReport> instances = listDeployedInstances(user);
-      for (ApplicationReport instance : instances) {
-        if (isApplicationLive(instance)) {
-          ApplicationId appId = instance.getApplicationId();
-          log.info("Killing Application {}", appId);
-
-          killRunningApplication(appId, "forced kill");
-        }
-      }
-    } else {
-      ApplicationId appId = ConverterUtils.toApplicationId(applicationId);
-
-      log.info("Killing Application {}", applicationId);
-
-      killRunningApplication(appId, "forced kill");
-    }
-  }
-
-  /**
-   * Monitor the submitted application for reaching the requested state.
-   * Will also report if the app reaches a later state (failed, killed, etc)
-   * Kill application if duration!= null & time expires. 
-   * @param appId Application Id of application to be monitored
-   * @param duration how long to wait -must be more than 0
-   * @param desiredState desired state.
-   * @return the application report -null on a timeout
-   * @throws YarnException
-   * @throws IOException
-   */
-  public ApplicationReport monitorAppToState(
-    ApplicationId appId, YarnApplicationState desiredState, Duration duration)
-    throws YarnException, IOException {
-
-    if (appId == null) {
-      throw new BadCommandArgumentsException("null application ID");
-    }
-    if (duration.limit <= 0) {
-      throw new BadCommandArgumentsException("Invalid monitoring duration");
-    }
-    log.debug("Waiting {} millis for app to reach state {} ",
-              duration.limit,
-              desiredState);
-    duration.start();
-    try {
-      while (true) {
-        // Get application report for the appId we are interested in
-
-        ApplicationReport r = getApplicationReport(appId);
-
-        log.debug("queried status is\n{}",
-          new SliderUtils.OnDemandReportStringifier(r));
-
-        YarnApplicationState state = r.getYarnApplicationState();
-        if (state.ordinal() >= desiredState.ordinal()) {
-          log.debug("App in desired state (or higher) :{}", state);
-          return r;
-        }
-        if (duration.getLimitExceeded()) {
-          log.debug(
-            "Wait limit of {} millis to get to state {}, exceeded; app status\n {}",
-            duration.limit,
-            desiredState,
-            new SliderUtils.OnDemandReportStringifier(r));
-          return null;
-        }
-
-        // sleep 1s.
-        try {
-          Thread.sleep(1000);
-        } catch (InterruptedException ignored) {
-          log.debug("Thread sleep in monitoring loop interrupted");
-        }
-      }
-    } finally {
-      duration.close();
-    }
-  }
-
-  /**
-   * find all live instances of a specific app -if there is >1 in the cluster,
-   * this returns them all. State should be running or less
-   * @param user user
-   * @param appname application name
-   * @return the list of all matching application instances
-   */
-  public List<ApplicationReport> findAllLiveInstances(String user,
-                                                      String appname) throws
-                                                                      YarnException,
-                                                                      IOException {
-    Preconditions.checkArgument(StringUtils.isNotEmpty(appname),
-        "Null/empty application name");
-    List<ApplicationReport> instances = listDeployedInstances(user);
-    List<ApplicationReport> results =
-      new ArrayList<ApplicationReport>(instances.size());
-    for (ApplicationReport app : instances) {
-      if (app.getName().equals(appname)
-          && isApplicationLive(app)) {
-        results.add(app);
-      }
-    }
-    return results;
-  }
-
-  /**
-   * Find a cluster in the instance list; biased towards live instances
-   * @param instances list of instances
-   * @param appname application name
-   * @return the first found instance, else a failed/finished instance, or null
-   * if there are none of those
-   */
-  public ApplicationReport findClusterInInstanceList(List<ApplicationReport> instances,
-                                                     String appname) {
-    Preconditions.checkArgument(instances != null, "Null instances list");
-    Preconditions.checkArgument(StringUtils.isNotEmpty(appname),
-        "Null/empty application name");
-    // sort by most recent
-    SliderUtils.sortApplicationsByMostRecent(instances);
-    ApplicationReport found = null;
-    for (ApplicationReport app : instances) {
-      if (app.getName().equals(appname)) {
-        if (isApplicationLive(app)) {
-          return app;
-        }
-        // set the found value if not set
-        found = found != null ? found : app;
-      }
-    }
-    return found;
-  }
-
-  /**
-   * Find an app in the instance list in the desired state 
-   * @param instances instance list
-   * @param appname application name
-   * @param desiredState yarn state desired
-   * @return the match or null for none
-   */
-  public ApplicationReport findAppInInstanceList(List<ApplicationReport> instances,
-      String appname,
-      YarnApplicationState desiredState) {
-    Preconditions.checkArgument(instances != null, "Null instances list");
-    Preconditions.checkArgument(StringUtils.isNotEmpty(appname),
-        "Null/empty application name");
-    Preconditions.checkArgument(desiredState != null, "Null desiredState");
-    log.debug("Searching {} records for instance name {} in state '{}'",
-        instances.size(), appname, desiredState);
-    for (ApplicationReport app : instances) {
-      if (app.getName().equals(appname)) {
-
-        YarnApplicationState appstate =
-            app.getYarnApplicationState();
-        log.debug("app ID {} is in state {}", app.getApplicationId(), appstate);
-        if (appstate.equals(desiredState)) {
-          log.debug("match");
-          return app;
-        }
-      }
-    }
-    // nothing found in desired state
-    log.debug("No match");
-    return null;
-  }
-
-  /**
-   * List the nodes in the cluster, possibly filtering by node state or label.
-   *
-   * @param label label to filter by -or "" for any
-   * @param live flag to request running nodes only
-   * @return a possibly empty list of nodes in the cluster
-   * @throws IOException IO problems
-   * @throws YarnException YARN problems
-   */
-  public NodeInformationList listNodes(String label, boolean live)
-    throws IOException, YarnException {
-    Preconditions.checkArgument(label != null, "null label");
-    NodeState[] states;
-    if (live) {
-      states = new NodeState[1];
-      states[0] = NodeState.RUNNING;
-    } else {
-      states = new NodeState[0];
-    }
-    List<NodeReport> reports = getNodeReports(states);
-    NodeInformationList results = new NodeInformationList(reports.size());
-    for (NodeReport report : reports) {
-      if (live && report.getNodeState() != NodeState.RUNNING) {
-        continue;
-      }
-      if (!label.isEmpty() && !report.getNodeLabels().contains(label)) {
-        continue;
-      }
-      // build node info from report
-      NodeInformation info = new NodeInformation();
-      info.hostname = report.getNodeId().getHost();
-      info.healthReport  = report.getHealthReport();
-      info.httpAddress = report.getHttpAddress();
-      info.labels = SliderUtils.extractNodeLabel(report);
-      info.rackName = report.getRackName();
-      info.state = report.getNodeState().toString();
-      results.add(info);
-    }
-    return results;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/client/TokensOperation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/TokensOperation.java b/slider-core/src/main/java/org/apache/slider/client/TokensOperation.java
deleted file mode 100644
index 9b9c141..0000000
--- a/slider-core/src/main/java/org/apache/slider/client/TokensOperation.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.client;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.security.Credentials;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.yarn.client.api.impl.YarnClientImpl;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.slider.common.params.ActionTokensArgs;
-import org.apache.slider.core.exceptions.BadClusterStateException;
-import org.apache.slider.core.exceptions.NotFoundException;
-import static org.apache.slider.core.launch.CredentialUtils.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-
-public class TokensOperation {
-
-  private static final Logger log = LoggerFactory.getLogger(TokensOperation.class);
-  public static final String E_INSECURE
-      = "Cluster is not secure -tokens cannot be acquired";
-  public static final String E_MISSING_SOURCE_FILE = "Missing source file: ";
-  public static final String E_NO_KEYTAB = "No keytab: ";
-
-  public int actionTokens(ActionTokensArgs args, FileSystem fs,
-      Configuration conf,
-      YarnClientImpl yarnClient)
-      throws IOException, YarnException {
-    Credentials credentials;
-    String footnote = "";
-    UserGroupInformation user = UserGroupInformation.getCurrentUser();
-    boolean isSecure = UserGroupInformation.isSecurityEnabled();
-    if (args.keytab != null) {
-      File keytab = args.keytab;
-      if (!keytab.isFile()) {
-        throw new NotFoundException(E_NO_KEYTAB + keytab.getAbsolutePath());
-      }
-      String principal = args.principal;
-      log.info("Logging in as {} from keytab {}", principal, keytab);
-      user = UserGroupInformation.loginUserFromKeytabAndReturnUGI(
-          principal, keytab.getCanonicalPath());
-    }
-    Credentials userCredentials = user.getCredentials();
-    File output = args.output;
-    if (output != null) {
-      if (!isSecure) {
-        throw new BadClusterStateException(E_INSECURE);
-      }
-      credentials = new Credentials(userCredentials);
-      // filesystem
-      addRMRenewableFSDelegationTokens(conf, fs, credentials);
-      addRMDelegationToken(yarnClient, credentials);
-      if (maybeAddTimelineToken(conf, credentials) != null) {
-        log.debug("Added timeline token");
-      }
-      saveTokens(output, credentials);
-      String filename = output.getCanonicalPath();
-      footnote = String.format("%d tokens saved to %s\n" +
-              "To use these in the environment:\n" +
-              "export %s=%s",
-          credentials.numberOfTokens(),
-          filename, UserGroupInformation.HADOOP_TOKEN_FILE_LOCATION, filename);
-    } else if (args.source != null) {
-      File source = args.source;
-      log.info("Reading credentials from file {}", source);
-      if (!source.isFile()) {
-        throw new NotFoundException( E_MISSING_SOURCE_FILE + source.getAbsolutePath());
-      }
-      credentials = Credentials.readTokenStorageFile(args.source, conf);
-    } else {
-      StringBuffer origin = new StringBuffer();
-      File file = locateEnvCredentials(System.getenv(), conf,
-          origin);
-      if (file != null) {
-        log.info("Credential Source {}", origin);
-      } else {
-        log.info("Credential source: logged in user");
-      }
-      credentials = userCredentials;
-    }
-    // list the tokens
-    log.info("\n{}", dumpTokens(credentials, "\n"));
-    if (!footnote.isEmpty()) {
-      log.info(footnote);
-    }
-    return 0;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
deleted file mode 100644
index a007326..0000000
--- a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.client.ipc;
-
-import com.google.common.base.Preconditions;
-import org.apache.slider.api.SliderClusterProtocol;
-import org.apache.slider.api.types.ApplicationLivenessInformation;
-import org.apache.slider.api.types.ComponentInformation;
-import org.apache.slider.api.types.ContainerInformation;
-import org.apache.slider.api.types.NodeInformation;
-import org.apache.slider.api.types.NodeInformationList;
-import org.apache.slider.api.types.PingInformation;
-import org.apache.slider.api.SliderApplicationApi;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.exceptions.NoSuchNodeException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Map;
-
-/**
- * Implementation of the Slider RESTy Application API over IPC.
- * <p>
- * Operations are executed via the {@link SliderClusterOperations}
- * instance passed in; raised exceptions may be converted into ones
- * consistent with the REST API.
- */
-public class SliderApplicationIpcClient implements SliderApplicationApi {
-
-  private static final Logger log =
-      LoggerFactory.getLogger(SliderApplicationIpcClient.class);
-
-  private final SliderClusterOperations operations;
-
-  public SliderApplicationIpcClient(SliderClusterOperations operations) {
-    Preconditions.checkArgument(operations != null, "null operations");
-    this.operations = operations;
-  }
-
-  /**
-   * Convert received (And potentially unmarshalled) local/remote
-   * exceptions into the equivalents in the REST API.
-   * Best effort. 
-   * <p>
-   * If there is no translation, the original exception is returned.
-   * <p>
-   * If a new exception was created, it will have the message of the 
-   * string value of the original exception, and that original
-   * exception will be the nested cause of this one
-   * @param exception IOException to convert
-   * @return an exception to throw
-   */
-  private IOException convert(IOException exception) {
-    IOException result = exception;
-    if (exception instanceof NoSuchNodeException) {
-      result = new FileNotFoundException(exception.toString());
-      result.initCause(exception);
-    } else {
-      // TODO: remap any other exceptions
-    }
-    return result;
-  }
-  
-  public SliderApplicationIpcClient(SliderClusterProtocol proxy) {
-    this(new SliderClusterOperations(proxy));
-  }
-
-  @Override
-  public AggregateConf getDesiredModel() throws IOException {
-    try {
-      return operations.getModelDesired();
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public ConfTreeOperations getDesiredAppconf() throws IOException {
-    try {
-      return operations.getModelDesiredAppconf();
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public ConfTreeOperations getDesiredResources() throws IOException {
-    try {
-      return operations.getModelDesiredResources();
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-
-  @Override
-  public void putDesiredResources(ConfTree updated) throws IOException {
-    try {
-      operations.flex(updated);
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-  
-  @Override
-  public AggregateConf getResolvedModel() throws IOException {
-    try {
-      return operations.getModelResolved();
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public ConfTreeOperations getResolvedAppconf() throws IOException {
-    try {
-      return operations.getModelResolvedAppconf();
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public ConfTreeOperations getResolvedResources() throws IOException {
-    try {
-      return operations.getModelResolvedResources();
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public ConfTreeOperations getLiveResources() throws IOException {
-    try {
-      return operations.getLiveResources();
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Map<String, ContainerInformation> enumContainers() throws IOException {
-    try {
-      return operations.enumContainers();
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public ContainerInformation getContainer(String containerId) throws
-      IOException {
-    try {
-      return operations.getContainer(containerId);
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public Map<String, ComponentInformation> enumComponents() throws IOException {
-    try {
-      return operations.enumComponents();
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public ComponentInformation getComponent(String componentName) throws IOException {
-    try {
-      return operations.getComponent(componentName);
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public NodeInformationList getLiveNodes() throws IOException {
-    try {
-      return operations.getLiveNodes();
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public NodeInformation getLiveNode(String hostname) throws IOException {
-    try {
-      return operations.getLiveNode(hostname);
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public PingInformation ping(String text) throws IOException {
-    return null;
-  }
-
-  @Override
-  public void stop(String text) throws IOException {
-    try {
-      operations.stop(text);
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public ApplicationLivenessInformation getApplicationLiveness() throws
-      IOException {
-    try {
-      return operations.getApplicationLiveness();
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-  @Override
-  public String toString() {
-    return "IPC implementation of SliderApplicationApi bonded to " + operations;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
deleted file mode 100644
index 392f451..0000000
--- a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
+++ /dev/null
@@ -1,529 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.client.ipc;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.yarn.api.records.NodeReport;
-import org.apache.hadoop.yarn.api.records.NodeState;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.slider.api.ClusterDescription;
-import org.apache.slider.api.ClusterNode;
-import org.apache.slider.api.SliderClusterProtocol;
-import org.apache.slider.api.StateValues;
-import org.apache.slider.api.proto.Messages;
-
-import static org.apache.slider.api.proto.RestTypeMarshalling.*;
-import org.apache.slider.api.types.ApplicationLivenessInformation;
-import org.apache.slider.api.types.ComponentInformation;
-import org.apache.slider.api.types.ContainerInformation;
-import org.apache.slider.api.types.NodeInformation;
-import org.apache.slider.api.types.NodeInformationList;
-import org.apache.slider.api.types.PingInformation;
-import org.apache.slider.common.tools.Duration;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.exceptions.NoSuchNodeException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.exceptions.WaitTimeoutException;
-import org.apache.slider.core.persist.ConfTreeSerDeser;
-import org.apache.slider.server.services.security.SecurityStore;
-import org.apache.slider.server.services.security.SignCertResponse;
-import org.codehaus.jackson.JsonParseException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Cluster operations at a slightly higher level than the RPC code
- */
-public class SliderClusterOperations {
-  protected static final Logger
-    log = LoggerFactory.getLogger(SliderClusterOperations.class);
-  
-  private final SliderClusterProtocol appMaster;
-  private static final Messages.EmptyPayloadProto EMPTY;
-  static {
-    EMPTY = Messages.EmptyPayloadProto.newBuilder().build(); 
-  }
-
-  public SliderClusterOperations(SliderClusterProtocol appMaster) {
-    this.appMaster = appMaster;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("SliderClusterOperations{");
-    sb.append("IPC binding=").append(appMaster);
-    sb.append('}');
-    return sb.toString();
-  }
-
-  /**
-   * Get a node from the AM
-   * @param uuid uuid of node
-   * @return deserialized node
-   * @throws IOException IO problems
-   * @throws NoSuchNodeException if the node isn't found
-   */
-  public ClusterNode getNode(String uuid)
-    throws IOException, NoSuchNodeException, YarnException {
-    Messages.GetNodeRequestProto req =
-      Messages.GetNodeRequestProto.newBuilder().setUuid(uuid).build();
-    Messages.GetNodeResponseProto node = appMaster.getNode(req);
-    return ClusterNode.fromProtobuf(node.getClusterNode());
-  }
-
-  /**
-   * Unmarshall a list of nodes from a protobud response
-   * @param nodes node list
-   * @return possibly empty list of cluster nodes
-   * @throws IOException
-   */
-  public List<ClusterNode> convertNodeWireToClusterNodes(List<Messages.RoleInstanceState> nodes)
-    throws IOException {
-    List<ClusterNode> nodeList = new ArrayList<>(nodes.size());
-    for (Messages.RoleInstanceState node : nodes) {
-      nodeList.add(ClusterNode.fromProtobuf(node));
-    }
-    return nodeList;
-  }
-
-  /**
-   * Echo text (debug action)
-   * @param text text
-   * @return the text, echoed back
-   * @throws YarnException
-   * @throws IOException
-   */
-  public String echo(String text) throws YarnException, IOException {
-    Messages.EchoRequestProto.Builder builder =
-      Messages.EchoRequestProto.newBuilder();
-    builder.setText(text);
-    Messages.EchoRequestProto req = builder.build();
-    Messages.EchoResponseProto response = appMaster.echo(req);
-    return response.getText();
-  }
-
-
-  /**
-   * Connect to a live cluster and get its current state
-   * @return its description
-   */
-  public ClusterDescription getClusterDescription()
-    throws YarnException, IOException {
-    
-    Messages.GetJSONClusterStatusRequestProto req =
-      Messages.GetJSONClusterStatusRequestProto.newBuilder().build();
-    Messages.GetJSONClusterStatusResponseProto resp =
-      appMaster.getJSONClusterStatus(req);
-    String statusJson = resp.getClusterSpec();
-    try {
-      return ClusterDescription.fromJson(statusJson);
-    } catch (JsonParseException e) {
-      log.error("Exception " + e + " parsing:\n" + statusJson, e);
-      throw e;
-    }
-  }
-
-  /**
-   * Get the AM instance definition.
-   * <p>
-   *   See {@link SliderClusterProtocol#getInstanceDefinition(Messages.GetInstanceDefinitionRequestProto)}
-   * @return current slider AM aggregate definition
-   * @throws YarnException
-   * @throws IOException
-   */
-  public AggregateConf getInstanceDefinition()
-    throws YarnException, IOException {
-    Messages.GetInstanceDefinitionRequestProto.Builder builder =
-      Messages.GetInstanceDefinitionRequestProto.newBuilder();
-
-    Messages.GetInstanceDefinitionRequestProto request = builder.build();
-    Messages.GetInstanceDefinitionResponseProto response =
-      appMaster.getInstanceDefinition(request);
-
-    ConfTreeSerDeser confTreeSerDeser = new ConfTreeSerDeser();
-
-    ConfTree internal = confTreeSerDeser.fromJson(response.getInternal());
-    ConfTree resources = confTreeSerDeser.fromJson(response.getResources());
-    ConfTree app = confTreeSerDeser.fromJson(response.getApplication());
-    AggregateConf instanceDefinition =
-      new AggregateConf(resources, app, internal);
-    return instanceDefinition;
-  }
-  /**
-   * Kill a container
-   * @param id container ID
-   * @return a success flag
-   * @throws YarnException
-   * @throws IOException
-   */
-  public boolean killContainer(String id) throws
-                                          YarnException,
-                                          IOException {
-    Messages.KillContainerRequestProto.Builder builder =
-      Messages.KillContainerRequestProto.newBuilder();
-    builder.setId(id);
-    Messages.KillContainerRequestProto req = builder.build();
-    Messages.KillContainerResponseProto response = appMaster.killContainer(req);
-    return response.getSuccess();
-  }
-
-  /**
-   * List all node UUIDs in a role
-   * @param role role name or "" for all
-   * @return an array of UUID strings
-   * @throws IOException
-   * @throws YarnException
-   */
-  public String[] listNodeUUIDsByRole(String role) throws IOException, YarnException {
-    Collection<String> uuidList = innerListNodeUUIDSByRole(role);
-    String[] uuids = new String[uuidList.size()];
-    return uuidList.toArray(uuids);
-  }
-
-  public List<String> innerListNodeUUIDSByRole(String role) throws IOException, YarnException {
-    Messages.ListNodeUUIDsByRoleRequestProto req =
-      Messages.ListNodeUUIDsByRoleRequestProto
-              .newBuilder()
-              .setRole(role)
-              .build();
-    Messages.ListNodeUUIDsByRoleResponseProto resp = appMaster.listNodeUUIDsByRole(req);
-    return resp.getUuidList();
-  }
-
-  /**
-   * List all nodes in a role. This is a double round trip: once to list
-   * the nodes in a role, another to get their details
-   * @param role
-   * @return an array of ContainerNode instances
-   * @throws IOException
-   * @throws YarnException
-   */
-  public List<ClusterNode> listClusterNodesInRole(String role)
-      throws IOException, YarnException {
-
-    Collection<String> uuidList = innerListNodeUUIDSByRole(role);
-    Messages.GetClusterNodesRequestProto req =
-      Messages.GetClusterNodesRequestProto
-              .newBuilder()
-              .addAllUuid(uuidList)
-              .build();
-    Messages.GetClusterNodesResponseProto resp = appMaster.getClusterNodes(req);
-    return convertNodeWireToClusterNodes(resp.getClusterNodeList());
-  }
-
-  /**
-   * Get the details on a list of uuids
-   * @param uuids instance IDs
-   * @return a possibly empty list of node details
-   * @throws IOException
-   * @throws YarnException
-   */
-  @VisibleForTesting
-  public List<ClusterNode> listClusterNodes(String[] uuids)
-      throws IOException, YarnException {
-
-    Messages.GetClusterNodesRequestProto req =
-      Messages.GetClusterNodesRequestProto
-              .newBuilder()
-              .addAllUuid(Arrays.asList(uuids))
-              .build();
-    Messages.GetClusterNodesResponseProto resp = appMaster.getClusterNodes(req);
-    return convertNodeWireToClusterNodes(resp.getClusterNodeList());
-  }
-
-  /**
-   * Wait for an instance of a named role to be live (or past it in the lifecycle)
-   * @param role role to look for
-   * @param timeout time to wait
-   * @return the state. If still in CREATED, the cluster didn't come up
-   * in the time period. If LIVE, all is well. If >LIVE, it has shut for a reason
-   * @throws IOException IO
-   * @throws SliderException Slider
-   * @throws WaitTimeoutException if the wait timed out
-   */
-  @VisibleForTesting
-  public int waitForRoleInstanceLive(String role, long timeout)
-    throws WaitTimeoutException, IOException, YarnException {
-    Duration duration = new Duration(timeout);
-    duration.start();
-    boolean live = false;
-    int state = StateValues.STATE_CREATED;
-
-    log.info("Waiting {} millis for a live node in role {}", timeout, role);
-    try {
-      while (!live) {
-        // see if there is a node in that role yet
-        List<String> uuids = innerListNodeUUIDSByRole(role);
-        String[] containers = uuids.toArray(new String[uuids.size()]);
-        int roleCount = containers.length;
-        ClusterNode roleInstance = null;
-        if (roleCount != 0) {
-  
-          // if there is, get the node
-          roleInstance = getNode(containers[0]);
-          if (roleInstance != null) {
-            state = roleInstance.state;
-            live = state >= StateValues.STATE_LIVE;
-          }
-        }
-        if (!live) {
-          if (duration.getLimitExceeded()) {
-            throw new WaitTimeoutException(
-              String.format("Timeout after %d millis" +
-                            " waiting for a live instance of type %s; " +
-                            "instances found %d %s",
-                            timeout, role, roleCount,
-                            (roleInstance != null
-                             ? (" instance -\n" + roleInstance.toString())
-                             : "")
-                           ));
-          } else {
-            try {
-              Thread.sleep(1000);
-            } catch (InterruptedException ignored) {
-              // ignored
-            }
-          }
-        }
-      }
-    } finally {
-      duration.close();
-    }
-    return state;
-  }
-
-  /**
-   * Flex operation
-   * @param resources new resources
-   * @return the response
-   * @throws IOException
-   */
-  public boolean flex(ConfTree resources) throws IOException {
-    Messages.FlexClusterRequestProto request =
-      Messages.FlexClusterRequestProto.newBuilder()
-              .setClusterSpec(resources.toJson())
-              .build();
-    Messages.FlexClusterResponseProto response = appMaster.flexCluster(request);
-    return response.getResponse();
-  }
-
-
-  /**
-   * Commit (possibly delayed) AM suicide
-   *
-   * @param signal exit code
-   * @param text text text to log
-   * @param delay delay in millis
-   * @throws YarnException
-   * @throws IOException
-   */
-  public void amSuicide(String text, int signal, int delay)
-      throws IOException {
-    Messages.AMSuicideRequestProto.Builder builder =
-      Messages.AMSuicideRequestProto.newBuilder();
-    if (text != null) {
-      builder.setText(text);
-    }
-    builder.setSignal(signal);
-    builder.setDelay(delay);
-    Messages.AMSuicideRequestProto req = builder.build();
-    appMaster.amSuicide(req);
-  }
-
-  /**
-   * Get the application liveness
-   * @return current liveness information
-   * @throws IOException
-   */
-  public ApplicationLivenessInformation getLivenessInformation() throws IOException {
-    Messages.GetApplicationLivenessRequestProto.Builder builder =
-        Messages.GetApplicationLivenessRequestProto.newBuilder();
-    Messages.ApplicationLivenessInformationProto wire =
-        appMaster.getLivenessInformation(builder.build());
-    return unmarshall(wire);
-
-  }
-
-  public AggregateConf getModelDesired() throws IOException {
-    return unmarshallToAggregateConf(appMaster.getModelDesired(EMPTY));
-  }
-
-  
-  public ConfTreeOperations getModelDesiredAppconf() throws IOException {
-    return unmarshallToCTO(appMaster.getModelDesiredAppconf(EMPTY));
-  }
-
-  
-  public ConfTreeOperations getModelDesiredResources() throws IOException {
-    return unmarshallToCTO(appMaster.getModelDesiredResources(EMPTY));
-  }
-
-  
-  public AggregateConf getModelResolved() throws IOException {
-    return unmarshallToAggregateConf(appMaster.getModelResolved(EMPTY));
-  }
-
-  
-  public ConfTreeOperations getModelResolvedAppconf() throws IOException {
-    return unmarshallToCTO(appMaster.getModelResolvedAppconf(EMPTY));
-  }
-
-  
-  public ConfTreeOperations getModelResolvedResources() throws IOException {
-    return unmarshallToCTO(appMaster.getModelDesiredResources(EMPTY));
-  }
-
-  
-  public ConfTreeOperations getLiveResources() throws IOException {
-    return unmarshallToCTO(appMaster.getLiveResources(EMPTY));
-  }
-
-  
-  public Map<String, ContainerInformation> enumContainers() throws IOException {
-    Messages.GetLiveContainersResponseProto response =
-        appMaster.getLiveContainers(
-            Messages.GetLiveContainersRequestProto.newBuilder().build());
-
-    int namesCount = response.getNamesCount();
-    int records = response.getContainersCount();
-    if (namesCount != records) {
-      throw new IOException("Number of names returned (" + namesCount
-                      + ") does not match the number of records returned: " 
-                      + records);
-    }
-    Map<String, ContainerInformation> map = new HashMap<>(namesCount);
-    for (int i = 0; i < namesCount; i++) {
-      map.put(response.getNames(i), unmarshall(response.getContainers(i)));
-    }
-    return map;
-  }
-
-  
-  public ContainerInformation getContainer(String containerId) throws
-      IOException {
-    Messages.ContainerInformationProto response =
-        appMaster.getLiveContainer(
-            Messages.GetLiveContainerRequestProto.newBuilder()
-                                                 .setContainerId(containerId)
-                                                 .build());
-    return unmarshall(response);
-  }
-
-  public List<ContainerInformation> getContainers() throws IOException {
-    Messages.GetLiveContainersResponseProto response = appMaster
-        .getLiveContainers(Messages.GetLiveContainersRequestProto.newBuilder()
-                                                                 .build());
-    return unmarshall(response);
-  }
-
-  public Map<String, ComponentInformation> enumComponents() throws IOException {
-    Messages.GetLiveComponentsResponseProto response =
-        appMaster.getLiveComponents(
-            Messages.GetLiveComponentsRequestProto.newBuilder().build());
-
-    int namesCount = response.getNamesCount();
-    int records = response.getComponentsCount();
-    if (namesCount != records) {
-      throw new IOException(
-          "Number of names returned (" + namesCount + ")" +
-          " does not match the number of records returned: " + records);
-    }
-    Map<String, ComponentInformation> map = new HashMap<>(namesCount);
-    for (int i = 0; i < namesCount; i++) {
-      map.put(response.getNames(i), unmarshall(response.getComponents(i)));
-    }
-    return map;
-  }
-
-  public ComponentInformation getComponent(String componentName)
-      throws IOException {
-    Messages.GetLiveComponentRequestProto.Builder builder =
-        Messages.GetLiveComponentRequestProto.newBuilder();
-    builder.setName(componentName);
-    Messages.ComponentInformationProto proto = appMaster.getLiveComponent(builder.build());
-    return unmarshall(proto);
-  }
-
-  public NodeInformationList getLiveNodes() throws IOException {
-    Messages.GetLiveNodesResponseProto response =
-      appMaster.getLiveNodes(Messages.GetLiveNodesRequestProto.newBuilder().build());
-
-    int records = response.getNodesCount();
-    NodeInformationList nil = new NodeInformationList(records);
-    for (int i = 0; i < records; i++) {
-      nil.add(unmarshall(response.getNodes(i)));
-    }
-    return nil;
-  }
-
-  public NodeInformation getLiveNode(String hostname) throws IOException {
-    Messages.GetLiveNodeRequestProto.Builder builder =
-        Messages.GetLiveNodeRequestProto.newBuilder();
-    builder.setName(hostname);
-    return unmarshall(appMaster.getLiveNode(builder.build()));
-  }
-
-  public PingInformation ping(String text) throws IOException {
-    return null;
-  }
-
-  public void stop(String text) throws IOException {
-    amSuicide(text, 3, 0);
-  }
-
-  public ApplicationLivenessInformation getApplicationLiveness() throws
-      IOException {
-    Messages.ApplicationLivenessInformationProto proto =
-        appMaster.getLivenessInformation(
-            Messages.GetApplicationLivenessRequestProto.newBuilder().build()
-        );
-    return unmarshall(proto);
-  }
-
-  public byte[] getClientCertificateStore(String hostname, String clientId,
-      String password, String type) throws IOException {
-    Messages.GetCertificateStoreRequestProto.Builder
-        builder = Messages.GetCertificateStoreRequestProto.newBuilder();
-    if (hostname != null) {
-      builder.setHostname(hostname);
-    }
-    Messages.GetCertificateStoreRequestProto requestProto =
-        builder.setRequesterId(clientId)
-               .setPassword(password)
-               .setType(type)
-               .build();
-    Messages.GetCertificateStoreResponseProto response =
-        appMaster.getClientCertificateStore(requestProto);
-
-    return unmarshall(response);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java b/slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java
deleted file mode 100644
index d936a22..0000000
--- a/slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.client.rest;
-
-import com.google.common.base.Preconditions;
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.GenericType;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
-import org.apache.slider.core.exceptions.ExceptionConverter;
-import org.apache.slider.core.restclient.HttpVerb;
-import org.apache.slider.core.restclient.UgiJerseyBinding;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.core.MediaType;
-import java.io.IOException;
-import java.net.URI;
-
-
-/**
- * This is a base class for Jersey REST clients in Slider.
- * It supports the execution of operations \u2014with
- * exceptions uprated to IOExceptions when needed.
- * <p>
- * Subclasses can use these operations to provide an API-like view
- * of the REST model
- */
-public class BaseRestClient  {
-  private static final Logger log =
-      LoggerFactory.getLogger(BaseRestClient.class);
-  private final Client client;
-
-  public BaseRestClient(
-      Client client) {
-    Preconditions.checkNotNull(client, "null jersey client");
-    this.client = client;
-  }
-
-  /**
-   * Get the jersey client
-   * @return jersey client
-   */
-  public Client getClient() {
-    return client;
-  }
-
-  /**
-   * Execute the operation. Failures are raised as IOException subclasses
-   * @param method method to execute
-   * @param resource resource to work against
-   * @param c class to build
-   * @param <T> type expected
-   * @return an instance of the type T
-   * @throws IOException on any failure
-   */
-  public <T> T exec(HttpVerb method, WebResource resource, Class<T> c)
-      throws IOException {
-    try {
-      Preconditions.checkArgument(c != null);
-      log.debug("{}} {}", method, resource.getURI());
-      return resource.accept(MediaType.APPLICATION_JSON_TYPE)
-              .method(method.getVerb(), c);
-    } catch (ClientHandlerException ex) {
-      throw ExceptionConverter.convertJerseyException(method.getVerb(),
-          resource.getURI().toString(),
-          ex);
-    } catch (UniformInterfaceException ex) {
-      throw UgiJerseyBinding.uprateFaults(method,
-          resource.getURI().toString(),
-          ex);
-    }
-  }
-
-  /**
-   * Execute the operation. Failures are raised as IOException subclasses
-   * @param method method to execute
-   * @param resource resource to work against
-   * @param t type to work with
-   * @param <T> type expected
-   * @return an instance of the type T
-   * @throws IOException on any failure
-   */
-  public <T> T exec(HttpVerb method, WebResource resource, GenericType<T> t)
-      throws IOException {
-    try {
-      Preconditions.checkArgument(t != null);
-      log.debug("{}} {}", method, resource.getURI());
-      resource.accept(MediaType.APPLICATION_JSON_TYPE);
-      return resource.method(method.getVerb(), t);
-    } catch (ClientHandlerException ex) {
-      throw ExceptionConverter.convertJerseyException(method.getVerb(),
-          resource.getURI().toString(),
-          ex);
-    } catch (UniformInterfaceException ex) {
-      throw UgiJerseyBinding.uprateFaults(method, resource.getURI().toString(),
-          ex);
-    }
-  }
-
-
-  /**
-   * Execute the  GET operation. Failures are raised as IOException subclasses
-   * @param resource resource to work against
-   * @param c class to build
-   * @param <T> type expected
-   * @return an instance of the type T
-   * @throws IOException on any failure
-   */
-  public <T> T get(WebResource resource, Class<T> c) throws IOException {
-    return exec(HttpVerb.GET, resource, c);
-  }
-
-  /**
-   * Create a Web resource from the client.
-   *
-   * @param u the URI of the resource.
-   * @return the Web resource.
-   */
-  public WebResource resource(URI u) {
-    return client.resource(u);
-  }
-
-  /**
-   * Create a Web resource from the client.
-   *
-   * @param u the URI of the resource.
-   * @return the Web resource.
-   */
-
-  public WebResource resource(String url) {
-    return client.resource(url);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/client/rest/RestClientFactory.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/RestClientFactory.java b/slider-core/src/main/java/org/apache/slider/client/rest/RestClientFactory.java
deleted file mode 100644
index 4286596..0000000
--- a/slider-core/src/main/java/org/apache/slider/client/rest/RestClientFactory.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.client.rest;
-
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.WebResource;
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.slider.client.ClientRegistryBinder;
-import org.apache.slider.api.SliderApplicationApi;
-import org.apache.slider.core.registry.info.CustomRegistryConstants;
-
-import java.io.IOException;
-
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.SLIDER_PATH_APPLICATION;
-
-/**
- * Factory for the Rest client; hides the lookup and instantiation.
- * <p>
- * 
- */
-public class RestClientFactory {
-
-  private final ClientRegistryBinder binder;
-  private final Client jerseyClient;
-  private final String user, serviceclass, instance;
-
-  public RestClientFactory(RegistryOperations operations,
-      Client jerseyClient,
-      String user,
-      String serviceclass,
-      String instance) {
-    this.jerseyClient = jerseyClient;
-    this.user = user;
-    this.serviceclass = serviceclass;
-    this.instance = instance;
-    binder = new ClientRegistryBinder(operations);
-  }
-
-  /**
-   * Locate the AM
-   * @return a resource to the AM
-   * @throws IOException any failure to resolve to the AM
-   */
-  private WebResource locateAppmaster() throws IOException {
-    String restAPI = binder.lookupExternalRestAPI(user, serviceclass, instance,
-        CustomRegistryConstants.AM_REST_BASE);
-    return jerseyClient.resource(restAPI);
-  }
-
-  /**
-   * Locate the slider AM then instantiate a client instance against
-   * its Application API.
-   * @return the instance
-   * @throws IOException on any failure
-   */
-  public SliderApplicationApi createSliderAppApiClient() throws IOException {
-    WebResource appmaster = locateAppmaster();
-    return createSliderAppApiClient(appmaster);
-  }
-
-   /**
-   * Create a Slider application API client instance against
-   * its Application API.
-   * @param appmaster The AM to work against.
-   * @return the instance
-   * @throws IOException on any failure
-   */
-  public SliderApplicationApi createSliderAppApiClient(WebResource appmaster) {
-    WebResource appResource = appmaster.path(SLIDER_PATH_APPLICATION);
-    return new SliderApplicationApiRestClient(jerseyClient, appResource);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
deleted file mode 100644
index 4283ee8..0000000
--- a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.client.rest;
-
-import com.google.common.base.Preconditions;
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.GenericType;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.representation.Form;
-import org.apache.commons.lang.StringUtils;
-import org.apache.slider.api.types.ApplicationLivenessInformation;
-import org.apache.slider.api.types.ComponentInformation;
-import org.apache.slider.api.types.ContainerInformation;
-import org.apache.slider.api.SliderApplicationApi;
-import org.apache.slider.api.types.NodeInformation;
-import org.apache.slider.api.types.NodeInformationList;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.exceptions.ExceptionConverter;
-import org.apache.slider.core.restclient.HttpVerb;
-import org.apache.slider.api.types.PingInformation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.core.MediaType;
-import java.io.IOException;
-import java.util.Map;
-
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.*;
-
-/**
- * Implementation of the {@link SliderApplicationApi}
- */
-public class SliderApplicationApiRestClient extends BaseRestClient
-      implements SliderApplicationApi {
-  private static final Logger log =
-      LoggerFactory.getLogger(SliderApplicationApiRestClient.class);
-  private WebResource appResource;
-
-  /**
-   * Create an instance
-   * @param jerseyClient jersey client for operations
-   * @param appResource resource of application API
-   */
-  public SliderApplicationApiRestClient(Client jerseyClient,
-      WebResource appResource) {
-    super(jerseyClient);
-    this.appResource = appResource;
-  }
-
-  /**
-   * Create an instance
-   * @param jerseyClient jersey client for operations
-   * @param appmaster URL of appmaster/proxy to AM
-   */
-  public SliderApplicationApiRestClient(Client jerseyClient, String appmaster) {
-    super(jerseyClient);
-    WebResource amResource = jerseyClient.resource(appmaster);
-    amResource.type(MediaType.APPLICATION_JSON);
-    this.appResource = amResource.path(SLIDER_PATH_APPLICATION);
-  }
-
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("SliderApplicationApiRestClient{");
-    sb.append("appResource=").append(appResource);
-    sb.append('}');
-    return sb.toString();
-  }
-
-  /**
-   * Create a resource under the application path
-   * @param subpath path under application
-   * @return a resource under the application path
-   */
-  public WebResource applicationResource(String subpath) {
-    Preconditions.checkArgument(!StringUtils.isEmpty(subpath),
-        "empty path");
-    Preconditions.checkNotNull(appResource, "Null app resource");
-    return appResource.path(subpath);
-  }
-  
-  /**
-   * Get operation against a path under the Application
-   * @param <T> type expected
-   * @param subpath path
-   * @param c class to instantiate
-   * @return instance
-   * @throws IOException on any problem
-   */
-  public <T> T getApplicationResource(String subpath, Class<T> c)
-      throws IOException {
-    return appResourceOperation(HttpVerb.GET, subpath, c);
-  } 
-  
-  /**
-   * Get operation against a path under the Application
-   * @param <T> type expected
-   * @param subpath path
-   * @param t type info
-   * @return instance
-   * @throws IOException on any problem
-   */
-  public <T> T getApplicationResource(String subpath, GenericType<T> t)
-      throws IOException {
-    return appResourceOperation(HttpVerb.GET, subpath, t);
-  }
-
-  /**
-   * 
-   * @param method method to exec
-   * @param <T> type expected
-   * @param subpath path
-   * @param c class to instantiate
-   * @return instance
-   * @throws IOException on any problem
-   */
-  public <T> T appResourceOperation(HttpVerb method, String subpath, Class<T> c)
-      throws IOException {
-    return exec(method, applicationResource(subpath), c);
-  }
-  
-  
-  /**
-   * Get operation against a path under the Application
-   * @param <T> type expected
-   * @param subpath path
-   * @param t type info
-   * @return instance
-   * @throws IOException on any problem
-   */
-  public <T> T appResourceOperation(HttpVerb method, String subpath,
-      GenericType<T> t)
-      throws IOException {
-    return exec(method, applicationResource(subpath), t);
-  }
-
-
-  @Override
-  public AggregateConf getDesiredModel() throws IOException {
-    return getApplicationResource(MODEL_DESIRED, AggregateConf.class);
-  }
-  
-  @Override
-  public ConfTreeOperations getDesiredAppconf() throws IOException {
-    ConfTree resource =
-        getApplicationResource(MODEL_DESIRED_APPCONF, ConfTree.class);
-    return new ConfTreeOperations(resource); 
-  }
-
-  @Override
-  public ConfTreeOperations getDesiredResources() throws IOException {
-    ConfTree resource =
-        getApplicationResource(MODEL_DESIRED_RESOURCES, ConfTree.class);
-    return new ConfTreeOperations(resource); 
-  }
-
-  @Override
-  public void putDesiredResources(ConfTree updated) throws IOException {
-    WebResource resource = applicationResource(MODEL_DESIRED_RESOURCES);
-    try {
-
-      // put operation. The result is discarded; it does help validate
-      // that the operation returned a JSON data structure as well as a 200
-      // response.
-
-      resource.accept(MediaType.APPLICATION_JSON_TYPE)
-              .type(MediaType.APPLICATION_JSON_TYPE)
-              .entity(updated)
-              .put(ConfTree.class);
-    } catch (ClientHandlerException ex) {
-        throw ExceptionConverter.convertJerseyException("PUT",
-            resource.getURI().toString(),
-            ex);
-      } catch (UniformInterfaceException ex) {
-      throw ExceptionConverter.convertJerseyException("PUT",
-          resource.getURI().toString(), ex);
-      }
-  }
-
-  @Override
-  public AggregateConf getResolvedModel() throws IOException {
-    return getApplicationResource(MODEL_RESOLVED, AggregateConf.class);
-  }
-
-
-  @Override
-  public ConfTreeOperations getResolvedAppconf() throws IOException {
-    ConfTree resource =
-        getApplicationResource(MODEL_RESOLVED_APPCONF, ConfTree.class);
-    return new ConfTreeOperations(resource); 
-  }
-
-  @Override
-  public ConfTreeOperations getResolvedResources() throws IOException {
-    ConfTree resource =
-        getApplicationResource(MODEL_RESOLVED_RESOURCES, ConfTree.class);
-    return new ConfTreeOperations(resource); 
-  }
-
-  @Override
-  public ConfTreeOperations getLiveResources() throws IOException {
-    ConfTree resource =
-        getApplicationResource(LIVE_RESOURCES, ConfTree.class);
-    return new ConfTreeOperations(resource); 
-  }
-
-  @Override
-  public Map<String, ContainerInformation> enumContainers() throws
-      IOException {
-    return getApplicationResource(LIVE_CONTAINERS,
-        new GenericType<Map<String, ContainerInformation>>() {
-        });
-  }
-
-  @Override
-  public ContainerInformation getContainer(String containerId) throws
-      IOException {
-    return getApplicationResource(LIVE_CONTAINERS + "/" + containerId,
-        ContainerInformation.class);
-  }
-
-  @Override
-  public Map<String, ComponentInformation> enumComponents() throws
-      IOException {
-    return getApplicationResource(LIVE_COMPONENTS,
-        new GenericType<Map<String, ComponentInformation>>() { });
-  }
-
-  @Override
-  public ComponentInformation getComponent(String componentName) throws
-      IOException {
-    return getApplicationResource(LIVE_COMPONENTS + "/" + componentName,
-        ComponentInformation.class);
-  }
-
-  @Override
-  public NodeInformationList getLiveNodes() throws IOException {
-    return getApplicationResource(LIVE_NODES, NodeInformationList.class);
-  }
-
-  @Override
-  public NodeInformation getLiveNode(String hostname) throws IOException {
-    return getApplicationResource(LIVE_NODES + "/" + hostname,
-        NodeInformation.class);
-  }
-
-  @Override
-  public PingInformation ping(String text) throws IOException {
-    return pingPost(text);
-  }
-  
-  /**
-   * Ping as a GET
-   * @param text text to include
-   * @return the response
-   * @throws IOException on any failure
-   */
-  public PingInformation pingGet(String text) throws IOException {
-    WebResource pingResource = applicationResource(ACTION_PING);
-    pingResource.getUriBuilder().queryParam("body", text);
-    return pingResource.get(PingInformation.class);
-  }
-  
-  /**
-   * Ping as a POST
-   * @param text text to include
-   * @return the response
-   * @throws IOException on any failure
-   */
-  public PingInformation pingPost(String text) throws IOException {
-    WebResource pingResource = applicationResource(ACTION_PING);
-    Form f = new Form();
-    f.add("text", text);
-    return pingResource
-        .type(MediaType.APPLICATION_JSON_TYPE)
-        .post(PingInformation.class, f);
-  }
-  
-  /**
-   * Ping as a POST
-   * @param text text to include
-   * @return the response
-   * @throws IOException on any failure
-   */
-  public PingInformation pingPut(String text) throws IOException {
-    WebResource pingResource = applicationResource(ACTION_PING);
-    Form f = new Form();
-    return pingResource
-        .type(MediaType.TEXT_PLAIN)
-        .put(PingInformation.class, text);
-  }
-
-  @Override
-  public void stop(String text) throws IOException {
-    WebResource resource = applicationResource(ACTION_STOP);
-    resource.post(text);
-  }
-
-  @Override
-  public ApplicationLivenessInformation getApplicationLiveness() throws IOException {
-    return getApplicationResource(LIVE_LIVENESS,
-        ApplicationLivenessInformation.class);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/Constants.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/Constants.java b/slider-core/src/main/java/org/apache/slider/common/Constants.java
deleted file mode 100644
index 0e3559a..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/Constants.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common;
-
-public class Constants {
-  public static final int CONNECT_TIMEOUT = 10000;
-  public static final int RPC_TIMEOUT = 15000;
-
-  public static final String HADOOP_JAAS_DEBUG = "HADOOP_JAAS_DEBUG";
-  public static final String KRB5_CCNAME = "KRB5CCNAME";
-  public static final String JAVA_SECURITY_KRB5_CONF
-    = "java.security.krb5.conf";
-  public static final String JAVA_SECURITY_KRB5_REALM
-    = "java.security.krb5.realm";
-  public static final String SUN_SECURITY_KRB5_DEBUG
-    = "sun.security.krb5.debug";
-  public static final String SUN_SECURITY_SPNEGO_DEBUG
-    = "sun.security.spnego.debug";
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/SliderExitCodes.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/SliderExitCodes.java b/slider-core/src/main/java/org/apache/slider/common/SliderExitCodes.java
deleted file mode 100644
index 5758f79..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/SliderExitCodes.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.common;
-
-import org.apache.slider.core.main.LauncherExitCodes;
-
-public interface SliderExitCodes extends LauncherExitCodes {
-
-  /**
-   * starting point for exit codes; not an exception itself
-   */
-  int _EXIT_CODE_BASE =           64;
-
-  /**
-   * service entered the failed state: {@value}
-   */
-  int EXIT_YARN_SERVICE_FAILED =  65;
-
-  /**
-   * service was killed: {@value}
-   */
-  int EXIT_YARN_SERVICE_KILLED =  66;
-
-  /**
-   * timeout on monitoring client: {@value}
-   */
-  int EXIT_TIMED_OUT =            67;
-
-  /**
-   * service finished with an error: {@value}
-   */
-  int EXIT_YARN_SERVICE_FINISHED_WITH_ERROR = 68;
-
-  /**
-   * the application instance is unknown: {@value}
-   */
-  int EXIT_UNKNOWN_INSTANCE =     69;
-
-  /**
-   * the application instance is in the wrong state for that operation: {@value}
-   */
-  int EXIT_BAD_STATE =            70;
-
-  /**
-   * A spawned master process failed 
-   */
-  int EXIT_PROCESS_FAILED =       71;
-
-  /**
-   * The instance failed -too many containers were
-   * failing or some other threshold was reached
-   */
-  int EXIT_DEPLOYMENT_FAILED =    72;
-
-  /**
-   * The application is live -and the requested operation
-   * does not work if the cluster is running
-   */
-  int EXIT_APPLICATION_IN_USE =   73;
-
-  /**
-   * There already is an application instance of that name
-   * when an attempt is made to create a new instance
-   */
-  int EXIT_INSTANCE_EXISTS =      75;
-
-  /**
-   * Exit code when the configurations in valid/incomplete: {@value}
-   */
-  int EXIT_BAD_CONFIGURATION =    77;
-
-}



[30/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/persist/JsonSerDeser.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/persist/JsonSerDeser.java b/slider-core/src/main/java/org/apache/slider/core/persist/JsonSerDeser.java
deleted file mode 100644
index 4f60c06..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/persist/JsonSerDeser.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.persist;
-
-import org.apache.hadoop.fs.FSDataInputStream;
-import org.apache.hadoop.fs.FSDataOutputStream;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.io.IOUtils;
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.DeserializationConfig;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.SerializationConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.EOFException;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * Support for marshalling objects to and from JSON.
- * This class is NOT thread safe; it constructs an object mapper
- * as an instance field.
- * @param <T>
- */
-public class JsonSerDeser<T> {
-
-  private static final Logger log = LoggerFactory.getLogger(JsonSerDeser.class);
-  private static final String UTF_8 = "UTF-8";
-
-  private final Class<T> classType;
-  private final ObjectMapper mapper;
-
-  /**
-   * Create an instance bound to a specific type
-   * @param classType class type
-   */
-  public JsonSerDeser(Class<T> classType) {
-    this.classType = classType;
-    this.mapper = new ObjectMapper();
-    mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-  }
-
-  /**
-   * Convert from JSON
-   * @param json input
-   * @return the parsed JSON
-   * @throws IOException IO
-   * @throws JsonMappingException failure to map from the JSON to this class
-   */
-  public T fromJson(String json)
-    throws IOException, JsonParseException, JsonMappingException {
-    try {
-      return mapper.readValue(json, classType);
-    } catch (IOException e) {
-      log.error("Exception while parsing json : " + e + "\n" + json, e);
-      throw e;
-    }
-  }
-
-  /**
-   * Convert from a JSON file
-   * @param jsonFile input file
-   * @return the parsed JSON
-   * @throws IOException IO problems
-   * @throws JsonMappingException failure to map from the JSON to this class
-   */
-  public T fromFile(File jsonFile)
-    throws IOException, JsonParseException, JsonMappingException {
-    File absoluteFile = jsonFile.getAbsoluteFile();
-    try {
-      return mapper.readValue(absoluteFile, classType);
-    } catch (IOException e) {
-      log.error("Exception while parsing json file {}", absoluteFile, e);
-      throw e;
-    }
-  }
-
-  /**
-   * Convert from a JSON file
-   * @param resource input file
-   * @return the parsed JSON
-   * @throws IOException IO problems
-   * @throws JsonMappingException failure to map from the JSON to this class
-   */
- public T fromResource(String resource)
-    throws IOException, JsonParseException, JsonMappingException {
-    try(InputStream resStream = this.getClass().getResourceAsStream(resource)) {
-      if (resStream == null) {
-        throw new FileNotFoundException(resource);
-      }
-      return (T) (mapper.readValue(resStream, classType));
-    } catch (IOException e) {
-      log.error("Exception while parsing json resource {}", resource, e);
-      throw e;
-    }
-  }
-
-  /**
-   * Convert from an input stream, closing the stream afterwards.
-   * @param stream
-   * @return the parsed JSON
-   * @throws IOException IO problems
-   */
-  public T fromStream(InputStream stream) throws IOException {
-    try {
-      return (T) (mapper.readValue(stream, classType));
-    } catch (IOException e) {
-      log.error("Exception while parsing json input stream", e);
-      throw e;
-    } finally {
-      IOUtils.closeStream(stream);
-    }
-  }
-
-  /**
-   * clone by converting to JSON and back again.
-   * This is much less efficient than any Java clone process.
-   * @param instance instance to duplicate
-   * @return a new instance
-   * @throws IOException problems.
-   */
-  public T fromInstance(T instance) throws IOException {
-    return fromJson(toJson(instance));
-  }
-
-  /**
-   * Deserialize from a byte array
-   * @param b
-   * @return the deserialized value
-   * @throws IOException parse problems
-   */
-  public T fromBytes(byte[] b) throws IOException {
-    String json = new String(b, 0, b.length, UTF_8);
-    return fromJson(json);
-  }
-  
-  /**
-   * Load from a Hadoop filesystem
-   * @param fs filesystem
-   * @param path path
-   * @return a loaded CD
-   * @throws IOException IO problems
-   * @throws JsonParseException parse problems
-   * @throws JsonMappingException O/J mapping problems
-   */
-  public T load(FileSystem fs, Path path)
-    throws IOException, JsonParseException, JsonMappingException {
-    FileStatus status = fs.getFileStatus(path);
-    long len = status.getLen();
-    byte[] b = new byte[(int) len];
-    FSDataInputStream dataInputStream = fs.open(path);
-    int count = dataInputStream.read(b);
-    if (count != len) {
-      throw new EOFException("Read of " + path +" finished prematurely");
-    }
-    return fromBytes(b);
-  }
-
-
-  /**
-   * Save to a hadoop filesystem
-   * @param fs filesystem
-   * @param path path
-   * @param instance instance to save
-   * @param overwrite should any existing file be overwritten
-   * @throws IOException IO exception
-   */
-  public void save(FileSystem fs, Path path, T instance,
-                   boolean overwrite) throws
-                                      IOException {
-    FSDataOutputStream dataOutputStream = fs.create(path, overwrite);
-    writeJsonAsBytes(instance, dataOutputStream);
-  }
-
-  /**
-   * Save an instance to a file
-   * @param instance instance to save
-   * @param file file
-   * @throws IOException
-   */
-  public void save(T instance, File file) throws
-      IOException {
-    writeJsonAsBytes(instance, new FileOutputStream(file.getAbsoluteFile()));
-  }
-
-  /**
-   * Write the json as bytes -then close the file
-   * @param dataOutputStream an outout stream that will always be closed
-   * @throws IOException on any failure
-   */
-  private void writeJsonAsBytes(T instance,
-      OutputStream dataOutputStream) throws IOException {
-    try {
-      String json = toJson(instance);
-      byte[] b = json.getBytes(UTF_8);
-      dataOutputStream.write(b);
-      dataOutputStream.flush();
-      dataOutputStream.close();
-    } finally {
-      IOUtils.closeStream(dataOutputStream);
-    }
-  }
-
-  /**
-   * Convert an object to a JSON string
-   * @param instance instance to convert
-   * @return a JSON string description
-   * @throws JsonParseException parse problems
-   * @throws JsonMappingException O/J mapping problems
-   */
-  public String toJson(T instance) throws IOException,
-                                               JsonGenerationException,
-                                               JsonMappingException {
-    mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
-    return mapper.writeValueAsString(instance);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/persist/LockAcquireFailedException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/persist/LockAcquireFailedException.java b/slider-core/src/main/java/org/apache/slider/core/persist/LockAcquireFailedException.java
deleted file mode 100644
index da58520..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/persist/LockAcquireFailedException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.persist;
-
-import org.apache.hadoop.fs.Path;
-
-public class LockAcquireFailedException extends Exception {
-  
-  private final Path path;
-
-  public LockAcquireFailedException(Path path) {
-    super("Failed to acquire lock " +path);
-    this.path = path;
-  }
-
-  public LockAcquireFailedException(Path path, Throwable cause) {
-    super("Failed to acquire lock " + path, cause);
-    this.path = path;
-  }
-
-  public Path getPath() {
-    return path;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/persist/LockHeldAction.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/persist/LockHeldAction.java b/slider-core/src/main/java/org/apache/slider/core/persist/LockHeldAction.java
deleted file mode 100644
index 6659687..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/persist/LockHeldAction.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.persist;
-
-import org.apache.slider.core.exceptions.SliderException;
-
-import java.io.IOException;
-
-/**
- * Optional action to add while the lock is held; this is needed to execute
- * some other persistent operations within the scope at the same lock
- * without inserting too much code into the persister
- */
-public interface LockHeldAction {
-
-  /**
-   * Execute the action
-   * @throws IOException on any failure
-   */
-  public void execute() throws IOException, SliderException;
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/persist/PersistKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/persist/PersistKeys.java b/slider-core/src/main/java/org/apache/slider/core/persist/PersistKeys.java
deleted file mode 100644
index 1964459..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/persist/PersistKeys.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.persist;
-
-public class PersistKeys {
-
-  public static final String SCHEMA =
-    "http://example.org/specification/v2.0.0";
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/registry/SliderRegistryUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/SliderRegistryUtils.java b/slider-core/src/main/java/org/apache/slider/core/registry/SliderRegistryUtils.java
deleted file mode 100644
index 37b36ea..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/registry/SliderRegistryUtils.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.registry.client.binding.RegistryUtils;
-import org.apache.slider.common.SliderKeys;
-
-/**
- * Miscellaneous methods to assist slider registry work
- * 
- */
-public class SliderRegistryUtils {
-
-
-  /**
-   * Get the registry path for an instance under the user's home node
-   * @param instanceName application instance
-   * @return a path to the registry location for this application instance.
-   */
-  public static String registryPathForInstance(String instanceName) {
-    return RegistryUtils.servicePath(
-        RegistryUtils.currentUser(), SliderKeys.APP_TYPE, instanceName
-    );
-  }
-
-  /**
-   * Process a path expanding it if needed.
-   * Validation is delegated to later as the core registry will need
-   * to do that anyway
-   * @param path path
-   * @return a path maybe with some expansion
-   */
-  public static String resolvePath(String path) {
-    Preconditions.checkArgument(path!=null, "null path");
-    Preconditions.checkArgument(!path.isEmpty(), "empty path");
-    String newpath = path;
-    if (path.startsWith("~/")) {
-      // add user expansion
-      newpath = RegistryUtils.homePathForCurrentUser() + path.substring(1);
-    } else if (path.equals("~")) {
-      newpath = RegistryUtils.homePathForCurrentUser();
-    }
-    return newpath;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/registry/YarnAppListClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/YarnAppListClient.java b/slider-core/src/main/java/org/apache/slider/core/registry/YarnAppListClient.java
deleted file mode 100644
index 1bdfb9c..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/registry/YarnAppListClient.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.YarnApplicationState;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.slider.client.SliderYarnClientImpl;
-import org.apache.slider.api.types.SliderInstanceDescription;
-import org.apache.slider.common.tools.CoreFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Client code for interacting with a list of service instances.
- * The initial logic just enumerates service instances in the YARN RM
- */
-public class YarnAppListClient {
-
-  private final SliderYarnClientImpl yarnClient;
-  private final String username;
-  private final Configuration conf;
-  private static final Logger log =
-      LoggerFactory.getLogger(YarnAppListClient.class);
-
-  public YarnAppListClient(SliderYarnClientImpl yarnClient,
-      String username,
-      Configuration conf) {
-
-    Preconditions.checkArgument(yarnClient != null,
-        "yarn client is null: is app inited?");
-    Preconditions.checkArgument(username != null,
-        "username is null");
-    Preconditions.checkArgument(conf != null,
-        "conf parameter is null");
-    this.yarnClient = yarnClient;
-    this.username = username;
-    this.conf = conf;
-  }
-
-  /**
-   * find all live instances of a specific app -if there is more than one 
-   * in the cluster, this returns them all. State should be running or earlier
-   * in the lifecycle
-   * @param appname application name
-   * @return the list of all matching application instances
-   */
-  public List<ApplicationReport> findAllLiveInstances(String appname)
-    throws YarnException, IOException {
-    return yarnClient.findAllLiveInstances(username, appname);
-  }
-
-
-  /**
-   * Find an instance of a application belong to the current user
-   * @param appname application name
-   * @return the app report or null if none is found
-   * @throws YarnException YARN issues
-   * @throws IOException IO problems
-   */
-  public ApplicationReport findInstance(String appname) throws
-                                                        YarnException,
-                                                        IOException {
-    List<ApplicationReport> instances = listInstances(null);
-    return yarnClient.findClusterInInstanceList(instances, appname);
-  }
-
-  /**
-   * List instances belonging to the specific user
-   * @return a possibly empty list of AMs
-   */
-  public List<ApplicationReport> listInstances()
-      throws YarnException, IOException {
-    return listInstances(null);
-  }
-
-  /**
-   * List instances belonging to a specific user
-   * @return a possibly empty list of AMs
-   * @param user user if not the default. null means default, "" means all users, 
-   * otherwise it is the name of a user
-   */
-  public List<ApplicationReport> listInstances(String user)
-      throws YarnException, IOException {
-    String listUser = user == null ? username : user;
-    return yarnClient.listDeployedInstances(listUser);
-  }
-
-  /**
-   * Enumerate slider instances for the current user, and the
-   * most recent app report, where available.
-   * @param listOnlyInState boolean to indicate that the instances should
-   * only include those in a YARN state
-   * <code> minAppState &lt;= currentState &lt;= maxAppState </code>
-   * 
-   * @param minAppState minimum application state to include in enumeration.
-   * @param maxAppState maximum application state to include
-   * @return a map of application instance name to description
-   * @throws IOException Any IO problem
-   * @throws YarnException YARN problems
-   */
-  public Map<String, SliderInstanceDescription> enumSliderInstances(
-      boolean listOnlyInState,
-      YarnApplicationState minAppState,
-      YarnApplicationState maxAppState)
-      throws IOException, YarnException {
-
-    CoreFileSystem sliderFileSystem = new CoreFileSystem(conf);
-    Preconditions.checkArgument(!listOnlyInState || minAppState != null,
-        "null minAppState when listOnlyInState set");
-    Preconditions.checkArgument(!listOnlyInState || maxAppState != null,
-        "null maxAppState when listOnlyInState set");
-    if (!listOnlyInState) {
-      // if there's not filtering, ask for the entire range of states
-      minAppState = YarnApplicationState.NEW;
-      maxAppState = YarnApplicationState.KILLED;
-    }
-    // get the complete list of persistent instances
-    Map<String, Path> persistentInstances =
-        sliderFileSystem.listPersistentInstances();
-    Map<String, SliderInstanceDescription> descriptions =
-        new HashMap<String, SliderInstanceDescription>(persistentInstances.size());
-
-    if (persistentInstances.isEmpty()) {
-      // an empty listing is a success if no cluster was named
-      log.debug("No application instances found");
-      return descriptions;
-    }
-
-    // enum those the RM knows about
-    List<ApplicationReport> rmInstances = listInstances();
-    SliderUtils.sortApplicationsByMostRecent(rmInstances);
-    Map<String, ApplicationReport> reportMap =
-        SliderUtils.buildApplicationReportMap(rmInstances, minAppState,
-            maxAppState);
-    log.debug("Persisted {} deployed {} filtered[{}-{}] & de-duped to {}",
-        persistentInstances.size(),
-        rmInstances.size(),
-        minAppState, maxAppState,
-        reportMap.size());
-
-    // at this point there is a list of all persistent instances, and
-    // a (possibly filtered) list of application reports
-
-    for (Map.Entry<String, Path> entry : persistentInstances.entrySet()) {
-      // loop through the persistent values
-      String name = entry.getKey();
-
-      // look up any report from the (possibly filtered) report set
-      ApplicationReport report = reportMap.get(name);
-      if (!listOnlyInState || report != null) {
-        // if the enum wants to filter in state, only add it if there is
-        // a report in that range. Otherwise: include all values
-        SliderInstanceDescription sid = new SliderInstanceDescription(
-            name, entry.getValue(), report);
-        descriptions.put(name, sid);
-      }
-    }
-
-    return descriptions;
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigFormat.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigFormat.java b/slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigFormat.java
deleted file mode 100644
index ddab606..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigFormat.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.docstore;
-
-public enum ConfigFormat {
-
-  JSON("json"),
-  PROPERTIES("properties"),
-  XML("xml"),
-  HADOOP_XML("hadoop-xml"),
-  ENV("env"),
-  TEMPLATE("template"),
-  YAML("yaml"),
-  ;
-  ConfigFormat(String suffix) {
-    this.suffix = suffix;
-  }
-
-  private final String suffix;
-
-  public String getSuffix() {
-    return suffix;
-  }
-
-
-  @Override
-  public String toString() {
-    return suffix;
-  }
-
-  /**
-   * Get a matching format or null
-   * @param type
-   * @return the format
-   */
-  public static ConfigFormat resolve(String type) {
-    for (ConfigFormat format: values()) {
-      if (format.getSuffix().equals(type)) {
-        return format;
-      }
-    }
-    return null;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigUtils.java b/slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigUtils.java
deleted file mode 100644
index 2e1615b..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigUtils.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.core.registry.docstore;
-
-import org.apache.hadoop.fs.Path;
-import org.apache.slider.common.tools.SliderFileSystem;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class ConfigUtils {
-  public static final String TEMPLATE_FILE = "template.file";
-
-  public static String replaceProps(Map<String, String> config, String content) {
-    Map<String, String> tokens = new HashMap<>();
-    for (Entry<String, String> entry : config.entrySet()) {
-      tokens.put("${" + entry.getKey() + "}", entry.getValue());
-      tokens.put("{{" + entry.getKey() + "}}", entry.getValue());
-    }
-    String value = content;
-    for (Map.Entry<String,String> token : tokens.entrySet()) {
-      value = value.replaceAll(Pattern.quote(token.getKey()),
-          Matcher.quoteReplacement(token.getValue()));
-    }
-    return value;
-  }
-
-  public static Map<String, String> replacePropsInConfig(
-      Map<String, String> config, Map<String, String> env) {
-    Map<String, String> tokens = new HashMap<>();
-    for (Entry<String, String> entry : env.entrySet()) {
-      tokens.put("${" + entry.getKey() + "}", entry.getValue());
-    }
-    Map<String, String> newConfig = new HashMap<>();
-    for (Entry<String, String> entry : config.entrySet()) {
-      String value = entry.getValue();
-      for (Map.Entry<String,String> token : tokens.entrySet()) {
-        value = value.replaceAll(Pattern.quote(token.getKey()),
-            Matcher.quoteReplacement(token.getValue()));
-      }
-      newConfig.put(entry.getKey(), entry.getValue());
-    }
-    return newConfig;
-  }
-
-  public static void prepConfigForTemplateOutputter(ConfigFormat configFormat,
-      Map<String, String> config, SliderFileSystem fileSystem,
-      String clusterName, String fileName) throws IOException {
-    if (!configFormat.equals(ConfigFormat.TEMPLATE)) {
-      return;
-    }
-    Path templateFile = null;
-    if (config.containsKey(TEMPLATE_FILE)) {
-      templateFile = fileSystem.buildResourcePath(config.get(TEMPLATE_FILE));
-      if (!fileSystem.isFile(templateFile)) {
-        templateFile = fileSystem.buildResourcePath(clusterName,
-            config.get(TEMPLATE_FILE));
-      }
-      if (!fileSystem.isFile(templateFile)) {
-        throw new IOException("config specified template file " + config
-            .get(TEMPLATE_FILE) + " but " + templateFile + " doesn't exist");
-      }
-    }
-    if (templateFile == null && fileName != null) {
-      templateFile = fileSystem.buildResourcePath(fileName);
-      if (!fileSystem.isFile(templateFile)) {
-        templateFile = fileSystem.buildResourcePath(clusterName,
-            fileName);
-      }
-    }
-    if (fileSystem.isFile(templateFile)) {
-      config.put("content", fileSystem.cat(templateFile));
-    } else {
-      config.put("content", "");
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigurationResolver.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigurationResolver.java b/slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigurationResolver.java
deleted file mode 100644
index 88bac77..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigurationResolver.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.docstore;
-
-public class ConfigurationResolver {
-  
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/registry/docstore/ExportEntry.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/ExportEntry.java b/slider-core/src/main/java/org/apache/slider/core/registry/docstore/ExportEntry.java
deleted file mode 100644
index 4bcf6c1..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/ExportEntry.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.docstore;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- * JSON-serializable description of a published key-val configuration.
- *
- * The values themselves are not serialized in the external view; they have to be served up by the far end
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class ExportEntry {
-
-  /**
-   * The value of the export
-   */
-  private String value;
-  /**
-   * The container id of the container that is responsible for the export
-   */
-  private String containerId;
-  /**
-   * Tag associated with the container - its usually an identifier different than container id
-   * that allows a soft serial id to all containers of a component - e.g. 1, 2, 3, ...
-   */
-  private String tag;
-  /**
-   * An export can be at the level of a component or an application
-   */
-  private String level;
-  /**
-   * The time when the export was updated
-   */
-  private String updatedTime;
-  /**
-   * The time when the export expires
-   */
-  private String validUntil;
-
-  public ExportEntry() {
-  }
-
-  public String getValue() {
-    return value;
-  }
-
-  public void setValue(String value) {
-    this.value = value;
-  }
-
-  public String getContainerId() {
-    return containerId;
-  }
-
-  public void setContainerId(String containerId) {
-    this.containerId = containerId;
-  }
-
-  public String getTag() {
-    return tag;
-  }
-
-  public void setTag(String tag) {
-    this.tag = tag;
-  }
-
-  public String getLevel() {
-    return level;
-  }
-
-  public void setLevel(String level) {
-    this.level = level;
-  }
-  public String getUpdatedTime() {
-    return updatedTime;
-  }
-
-  public void setUpdatedTime(String updatedTime) {
-    this.updatedTime = updatedTime;
-  }
-
-  public String getValidUntil() {
-    return validUntil;
-  }
-
-  public void setValidUntil(String validUntil) {
-    this.validUntil = validUntil;
-  }
-
-  @Override
-  public String toString() {
-    return new StringBuilder("ExportEntry{").
-        append("value='").append(value).append("',").
-        append("containerId='").append(containerId).append("',").
-        append("tag='").append(tag).append("',").
-        append("level='").append(level).append("'").
-        append("updatedTime='").append(updatedTime).append("'").
-        append("validUntil='").append(validUntil).append("'").
-        append(" }").toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfigSet.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfigSet.java b/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfigSet.java
deleted file mode 100644
index edc129e..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfigSet.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.docstore;
-
-import org.apache.slider.server.appmaster.web.rest.RestPaths;
-import org.apache.slider.server.services.utility.PatternValidator;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-/**
- * Represents a set of configurations for an application, component, etc.
- * Json serialisable; accessors are synchronized
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class PublishedConfigSet {
-
-  private static final PatternValidator validator = new PatternValidator(
-      RestPaths.PUBLISHED_CONFIGURATION_REGEXP);
-  
-  public Map<String, PublishedConfiguration> configurations =
-      new HashMap<>();
-
-  public PublishedConfigSet() {
-  }
-
-  /**
-   * Put a name -it will be converted to lower case before insertion.
-   * Any existing entry will be overwritten (that includes an entry
-   * with a different case in the original name)
-   * @param name name of entry
-   * @param conf configuration
-   * @throws IllegalArgumentException if not a valid name
-   */
-  public void put(String name, PublishedConfiguration conf) {
-    String name1 = name.toLowerCase(Locale.ENGLISH);
-    validateName(name1);
-    configurations.put(name1, conf);
-  }
-
-  /**
-   * Validate the name -restricting it to the set defined in 
-   * {@link RestPaths#PUBLISHED_CONFIGURATION_REGEXP}
-   * @param name name to validate
-   * @throws IllegalArgumentException if not a valid name
-   */
-  public static void validateName(String name) {
-    validator.validate(name);
-    
-  }
-
-  public PublishedConfiguration get(String name) {
-    return configurations.get(name);
-  }
-  
-  public boolean contains(String name) {
-    return configurations.containsKey(name);
-  }
-  
-  public int size() {
-    return configurations.size();
-  }
-  
-  public Set<String> keys() {
-    TreeSet<String> keys = new TreeSet<>();
-    keys.addAll(configurations.keySet());
-    return keys;
-  }
-
-  public PublishedConfigSet shallowCopy() {
-    PublishedConfigSet that = new PublishedConfigSet();
-    for (Map.Entry<String, PublishedConfiguration> entry :
-        configurations.entrySet()) {
-      that.put(entry.getKey(), entry.getValue().shallowCopy());
-    }
-    return that;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfiguration.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfiguration.java b/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfiguration.java
deleted file mode 100644
index 50b522f..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfiguration.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.docstore;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.slider.common.tools.ConfigHelper;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.SerializationConfig;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.io.IOException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * JSON-serializable description of a published key-val configuration.
- * 
- * The values themselves are not serialized in the external view; they have
- * to be served up by the far end
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class PublishedConfiguration {
-
-  public String description;
-  public long updated;
-  
-  public String updatedTime;
-
-  public Map<String, String> entries = new HashMap<>();
-
-  public PublishedConfiguration() {
-  }
-
-  /**
-   * build an empty published configuration 
-   * @param description configuration description
-   */
-  public PublishedConfiguration(String description) {
-    this.description = description;
-  }
-
-  /**
-   * Build a configuration from the entries
-   * @param description configuration description
-   * @param entries entries to put
-   */
-  public PublishedConfiguration(String description,
-      Iterable<Map.Entry<String, String>> entries) {
-    this.description = description;
-    putValues(entries);
-  }
-
-  /**
-   * Build a published configuration, using the keys from keysource,
-   * but resolving the values from the value source, via Configuration.get()
-   * @param description configuration description
-   * @param keysource source of keys
-   * @param valuesource source of values
-   */
-  public PublishedConfiguration(String description,
-      Iterable<Map.Entry<String, String>> keysource,
-      Configuration valuesource) {
-    this.description = description;
-    putValues(ConfigHelper.resolveConfiguration(keysource, valuesource));
-  }
-
-  
-  /**
-   * Is the configuration empty. This means either that it has not
-   * been given any values, or it is stripped down copy set down over the
-   * wire.
-   * @return true if it is empty
-   */
-  public boolean isEmpty() {
-    return entries.isEmpty();
-  }
-
-
-  public void setUpdated(long updated) {
-    this.updated = updated;
-    this.updatedTime = new Date(updated).toString();
-  }
-
-  public long getUpdated() {
-    return updated;
-  }
-
-  /**
-   * Set the values from an iterable (this includes a Hadoop Configuration
-   * and Java properties object).
-   * Any existing value set is discarded
-   * @param entries entries to put
-   */
-  public void putValues(Iterable<Map.Entry<String, String>> entries) {
-    this.entries = new HashMap<String, String>();
-    for (Map.Entry<String, String> entry : entries) {
-      this.entries.put(entry.getKey(), entry.getValue());
-    }
-    
-  }
-
-  /**
-   * Convert to Hadoop XML
-   * @return the configuration as a Hadoop Configuratin
-   */
-  public Configuration asConfiguration() {
-    Configuration conf = new Configuration(false);
-    try {
-      ConfigHelper.addConfigMap(conf, entries, "");
-    } catch (BadConfigException e) {
-      // triggered on a null value; switch to a runtime (and discard the stack)
-      throw new RuntimeException(e.toString());
-    }
-    return conf;
-  }
-  
-  public String asConfigurationXML() throws IOException {
-    return ConfigHelper.toXml(asConfiguration());
-  }
-
-  /**
-   * Convert values to properties
-   * @return a property file
-   */
-  public Properties asProperties() {
-    Properties props = new Properties();
-    props.putAll(entries);
-    return props;
-  }
-
-  /**
-   * Return the values as json string
-   * @return the JSON representation
-   * @throws IOException marshalling failure
-   */
-  public String asJson() throws IOException {
-    ObjectMapper mapper = new ObjectMapper();
-    mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
-    String json = mapper.writeValueAsString(entries);
-    return json;
-  }
-
-
-  /**
-   * This makes a copy without the nested content -so is suitable
-   * for returning as part of the list of a parent's values
-   * @return the copy
-   */
-  public PublishedConfiguration shallowCopy() {
-    PublishedConfiguration that = new PublishedConfiguration();
-    that.description = this.description;
-    that.updated = this.updated;
-    that.updatedTime = this.updatedTime;
-    return that;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("PublishedConfiguration{");
-    sb.append("description='").append(description).append('\'');
-    sb.append(" entries = ").append(entries.size());
-    sb.append('}');
-    return sb.toString();
-  }
-
-  /**
-   * Create an outputter for a given format
-   * @param format format to use
-   * @return an instance of output
-   */
-  public PublishedConfigurationOutputter createOutputter(ConfigFormat format) {
-    return PublishedConfigurationOutputter.createOutputter(format, this);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfigurationOutputter.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfigurationOutputter.java b/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfigurationOutputter.java
deleted file mode 100644
index 9bdcfcb..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfigurationOutputter.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.docstore;
-
-import com.google.common.base.Charsets;
-import com.google.common.base.Preconditions;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.slider.common.tools.ConfigHelper;
-import org.yaml.snakeyaml.DumperOptions;
-import org.yaml.snakeyaml.DumperOptions.FlowStyle;
-import org.yaml.snakeyaml.Yaml;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.StringWriter;
-import java.util.Properties;
-
-/**
- * Output a published configuration
- */
-public abstract class PublishedConfigurationOutputter {
-
-  protected final PublishedConfiguration owner;
-
-  protected PublishedConfigurationOutputter(PublishedConfiguration owner) {
-    this.owner = owner;
-  }
-
-  /**
-   * Save the config to a destination file, in the format of this outputter
-   * @param dest destination file
-   * @throws IOException
-   */
-/* JDK7
-  public void save(File dest) throws IOException {
-    try(FileOutputStream out = new FileOutputStream(dest)) {
-      save(out);
-      out.close();
-    }
-  }
-*/
-  public void save(File dest) throws IOException {
-    FileUtils.writeStringToFile(dest, asString(), Charsets.UTF_8);
-  }
-
-  /**
-   * Save the content. The default saves the asString() value
-   * to the output stream
-   * @param out output stream
-   * @throws IOException
-   */
-  public void save(OutputStream out) throws IOException {
-    IOUtils.write(asString(), out, Charsets.UTF_8);
-  }
-  /**
-   * Convert to a string
-   * @return the string form
-   * @throws IOException
-   */
-  public abstract String asString() throws IOException;
-
-  /**
-   * Create an outputter for the chosen format
-   * @param format format enumeration
-   * @param owner owning config
-   * @return the outputter
-   */
-
-  public static PublishedConfigurationOutputter createOutputter(ConfigFormat format,
-      PublishedConfiguration owner) {
-    Preconditions.checkNotNull(owner);
-    switch (format) {
-      case XML:
-      case HADOOP_XML:
-        return new XmlOutputter(owner);
-      case PROPERTIES:
-        return new PropertiesOutputter(owner);
-      case JSON:
-        return new JsonOutputter(owner);
-      case ENV:
-        return new EnvOutputter(owner);
-      case TEMPLATE:
-        return new TemplateOutputter(owner);
-      case YAML:
-        return new YamlOutputter(owner);
-      default:
-        throw new RuntimeException("Unsupported format :" + format);
-    }
-  }
-
-  public static class XmlOutputter extends PublishedConfigurationOutputter {
-
-
-    private final Configuration configuration;
-
-    public XmlOutputter(PublishedConfiguration owner) {
-      super(owner);
-      configuration = owner.asConfiguration();
-    }
-
-    @Override
-    public void save(OutputStream out) throws IOException {
-      configuration.writeXml(out);
-    }
-
-    @Override
-    public String asString() throws IOException {
-      return ConfigHelper.toXml(configuration);
-    }
-
-    public Configuration getConfiguration() {
-      return configuration;
-    }
-  }
-
-  public static class PropertiesOutputter extends PublishedConfigurationOutputter {
-
-    private final Properties properties;
-
-    public PropertiesOutputter(PublishedConfiguration owner) {
-      super(owner);
-      properties = owner.asProperties();
-    }
-
-    @Override
-    public void save(OutputStream out) throws IOException {
-      properties.store(out, "");
-    }
-
-
-    public String asString() throws IOException {
-      StringWriter sw = new StringWriter();
-      properties.store(sw, "");
-      return sw.toString();
-    }
-  }
-
-
-  public static class JsonOutputter extends PublishedConfigurationOutputter {
-
-    public JsonOutputter(PublishedConfiguration owner) {
-      super(owner);
-    }
-
-    @Override
-    public String asString() throws IOException {
-      return owner.asJson();
-    }
-  }
-
-
-  public static class EnvOutputter extends PublishedConfigurationOutputter {
-
-    public EnvOutputter(PublishedConfiguration owner) {
-      super(owner);
-    }
-
-    @Override
-    public String asString() throws IOException {
-      if (!owner.entries.containsKey("content")) {
-        throw new IOException("Configuration has no content field and cannot " +
-            "be retrieved as type 'env'");
-      }
-      String content = owner.entries.get("content");
-      return ConfigUtils.replaceProps(owner.entries, content);
-    }
-  }
-
-  public static class TemplateOutputter extends EnvOutputter {
-    public TemplateOutputter(PublishedConfiguration owner) {
-      super(owner);
-    }
-  }
-
-  public static class YamlOutputter extends PublishedConfigurationOutputter {
-
-    private final Yaml yaml;
-
-    public YamlOutputter(PublishedConfiguration owner) {
-      super(owner);
-      DumperOptions options = new DumperOptions();
-      options.setDefaultFlowStyle(FlowStyle.BLOCK);
-      yaml = new Yaml(options);
-    }
-
-    public String asString() throws IOException {
-      return yaml.dump(owner.entries);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExports.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExports.java b/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExports.java
deleted file mode 100644
index 0759b4e..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExports.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.docstore;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.SerializationConfig;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.io.IOException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * JSON-serializable description of a published key-val configuration.
- *
- * The values themselves are not serialized in the external view; they have to be served up by the far end
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class PublishedExports {
-
-  public String description;
-  public long updated;
-  public String updatedTime;
-  public Map<String, List<ExportEntry>> entries = new HashMap<>();
-
-  public PublishedExports() {
-  }
-
-  /**
-   * build an empty published configuration
-   *
-   * @param description configuration description
-   */
-  public PublishedExports(String description) {
-    this.description = description;
-  }
-
-  /**
-   * Build a configuration from the entries
-   *
-   * @param description configuration description
-   * @param entries     entries to put
-   */
-  public PublishedExports(String description,
-                          Iterable<Map.Entry<String, List<ExportEntry>>> entries) {
-    this.description = description;
-    putValues(entries);
-  }
-
-  /**
-   * Is the configuration empty. This means either that it has not been given any values,
-   * or it is stripped down copy
-   * set down over the wire.
-   *
-   * @return true if it is empty
-   */
-  public boolean isEmpty() {
-    return entries.isEmpty();
-  }
-
-  public long getUpdated() {
-    return updated;
-  }
-
-  public void setUpdated(long updated) {
-    this.updated = updated;
-    this.updatedTime = new Date(updated).toString();
-  }
-
-  /**
-   * Set the values from an iterable (this includes a Hadoop Configuration and Java properties
-   * object). Any existing value set is discarded
-   *
-   * @param entries entries to put
-   */
-  public void putValues(Iterable<Map.Entry<String, List<ExportEntry>>> entries) {
-    this.entries = new HashMap<String, List<ExportEntry>>();
-    for (Map.Entry<String, List<ExportEntry>> entry : entries) {
-      this.entries.put(entry.getKey(), entry.getValue());
-    }
-  }
-
-  /**
-   * Return the values as json string
-   *
-   * @return the JSON form
-   *
-   * @throws IOException mapping problems
-   */
-  public String asJson() throws IOException {
-    ObjectMapper mapper = new ObjectMapper();
-    mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
-    String json = mapper.writeValueAsString(entries);
-    return json;
-  }
-
-  /**
-   * This makes a copy without the nested content -so is suitable for returning as part of the list of a parent's
-   * values
-   *
-   * @return the copy
-   */
-  public PublishedExports shallowCopy() {
-    PublishedExports that = new PublishedExports();
-    that.description = this.description;
-    that.updated = this.updated;
-    that.updatedTime = this.updatedTime;
-    return that;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("PublishedConfiguration{");
-    sb.append("description='").append(description).append('\'');
-    sb.append(" entries = ").append(entries.size());
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExportsOutputter.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExportsOutputter.java b/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExportsOutputter.java
deleted file mode 100644
index 67cb094..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExportsOutputter.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.docstore;
-
-import com.google.common.base.Charsets;
-import com.google.common.base.Preconditions;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-/** Output a published configuration */
-public abstract class PublishedExportsOutputter {
-
-  protected final PublishedExports exports;
-
-  protected PublishedExportsOutputter(PublishedExports exports) {
-    this.exports = exports;
-  }
-
-  /**
-   * Create an outputter for the chosen format
-   *
-   * @param format  format enumeration
-   * @param exports owning config
-   * @return the outputter
-   */
-
-  public static PublishedExportsOutputter createOutputter(ConfigFormat format,
-                                                         PublishedExports exports) {
-    Preconditions.checkNotNull(exports);
-    switch (format) {
-      case JSON:
-        return new JsonOutputter(exports);
-      default:
-        throw new RuntimeException("Unsupported format :" + format);
-    }
-  }
-
-  public void save(File dest) throws IOException {
-    FileOutputStream out = null;
-    try {
-      out = new FileOutputStream(dest);
-      save(out);
-      out.close();
-    } finally {
-      org.apache.hadoop.io.IOUtils.closeStream(out);
-    }
-  }
-
-  /**
-   * Save the content. The default saves the asString() value to the output stream
-   *
-   * @param out output stream
-   * @throws IOException
-   */
-  public void save(OutputStream out) throws IOException {
-    IOUtils.write(asString(), out, Charsets.UTF_8);
-  }
-
-  /**
-   * Convert to a string
-   *
-   * @return the string form
-   * @throws IOException
-   */
-  public abstract String asString() throws IOException;
-
-  public static class JsonOutputter extends PublishedExportsOutputter {
-
-    public JsonOutputter(PublishedExports exports) {
-      super(exports);
-    }
-
-    @Override
-    public void save(File dest) throws IOException {
-      FileUtils.writeStringToFile(dest, asString(), Charsets.UTF_8);
-    }
-
-    @Override
-    public String asString() throws IOException {
-      return exports.asJson();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExportsSet.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExportsSet.java b/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExportsSet.java
deleted file mode 100644
index 339d3d6..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExportsSet.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.docstore;
-
-import org.apache.slider.server.appmaster.web.rest.RestPaths;
-import org.apache.slider.server.services.utility.PatternValidator;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-/**
- * Represents a set of configurations for an application, component, etc.
- * Json serialisable; accessors are synchronized
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class PublishedExportsSet {
-
-  private static final PatternValidator validator = new PatternValidator(
-      RestPaths.PUBLISHED_CONFIGURATION_REGEXP);
-  
-  public Map<String, PublishedExports> exports = new HashMap<>();
-
-  public PublishedExportsSet() {
-  }
-
-  /**
-   * Put a name -it will be converted to lower case before insertion.
-   * Any existing entry will be overwritten (that includes an entry
-   * with a different case in the original name)
-   * @param name name of entry
-   * @param export published export
-   * @throws IllegalArgumentException if not a valid name
-   */
-  public void put(String name, PublishedExports export) {
-    String name1 = name.toLowerCase(Locale.ENGLISH);
-    validateName(name1);
-    exports.put(name1, export);
-  }
-
-  /**
-   * Validate the name -restricting it to the set defined in 
-   * {@link RestPaths#PUBLISHED_CONFIGURATION_REGEXP}
-   * @param name name to validate
-   * @throws IllegalArgumentException if not a valid name
-   */
-  public static void validateName(String name) {
-    validator.validate(name);
-    
-  }
-
-  public PublishedExports get(String name) {
-    return exports.get(name);
-  }
-  
-  public boolean contains(String name) {
-    return exports.containsKey(name);
-  }
-  
-  public int size() {
-    return exports.size();
-  }
-  
-  public Set<String> keys() {
-    TreeSet<String> keys = new TreeSet<>();
-    keys.addAll(exports.keySet());
-    return keys;
-  }
-
-  public PublishedExportsSet shallowCopy() {
-    PublishedExportsSet that = new PublishedExportsSet();
-    for (Map.Entry<String, PublishedExports> entry : exports.entrySet()) {
-      that.put(entry.getKey(), entry.getValue().shallowCopy());
-    }
-    return that;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/registry/docstore/UriMap.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/UriMap.java b/slider-core/src/main/java/org/apache/slider/core/registry/docstore/UriMap.java
deleted file mode 100644
index 120966f..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/registry/docstore/UriMap.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.docstore;
-
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.HashMap;
-import java.util.Map;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class UriMap {
-
-  public Map<String, String> uris = new HashMap<>();
-  
-  @JsonIgnore
-  public void put(String key, String value) {
-    uris.put(key, value);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/registry/info/CustomRegistryConstants.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/info/CustomRegistryConstants.java b/slider-core/src/main/java/org/apache/slider/core/registry/info/CustomRegistryConstants.java
deleted file mode 100644
index 13ad5c5..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/registry/info/CustomRegistryConstants.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.info;
-
-/**
- * These are constants unique to the Slider AM
- */
-public class CustomRegistryConstants {
-
-  public static final String MANAGEMENT_REST_API =
-      "classpath:org.apache.slider.management";
-  
-  public static final String REGISTRY_REST_API =
-      "classpath:org.apache.slider.registry";
-  
-  public static final String PUBLISHER_REST_API =
-      "classpath:org.apache.slider.publisher";
-
-  public static final String PUBLISHER_CONFIGURATIONS_API =
-      "classpath:org.apache.slider.publisher.configurations";
-
-  public static final String PUBLISHER_EXPORTS_API =
-      "classpath:org.apache.slider.publisher.exports";
-
-  public static final String PUBLISHER_DOCUMENTS_API =
-      "classpath:org.apache.slider.publisher.documents";
-
-  public static final String AGENT_SECURE_REST_API =
-      "classpath:org.apache.slider.agents.secure";
-
-  public static final String AGENT_ONEWAY_REST_API =
-      "classpath:org.apache.slider.agents.oneway";
-
-  public static final String AM_IPC_PROTOCOL =
-      "classpath:org.apache.slider.appmaster.ipc";
-
-  public static final String AM_REST_BASE =
-      "classpath:org.apache.slider.client.rest";
-
-  public static final String WEB_UI = "http://";
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java b/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
deleted file mode 100644
index 40fa217..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.retrieve;
-
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.GenericType;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.api.json.JSONConfiguration;
-import com.sun.jersey.client.urlconnection.HttpURLConnectionFactory;
-import com.sun.jersey.client.urlconnection.URLConnectionClientHandler;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.security.ssl.SSLFactory;
-import org.apache.slider.client.rest.BaseRestClient;
-import org.apache.slider.core.restclient.HttpVerb;
-import org.apache.slider.core.restclient.UgiJerseyBinding;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLSocketFactory;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URI;
-import java.net.URL;
-
-/**
- * Class to retrieve artifacts from the AM's web site. This sets up
- * the redirection and security logic properly
- */
-public class AMWebClient {
-
-
-  private final BaseRestClient restClient;
-  private static final Logger
-      log = LoggerFactory.getLogger(AMWebClient.class);
-
-
-  public AMWebClient(Configuration conf) {
-    UgiJerseyBinding binding = new UgiJerseyBinding(conf);
-
-    restClient = new BaseRestClient(binding.createJerseyClient());
-
-  }
-
-
-  private static URLConnectionClientHandler getUrlConnectionClientHandler() {
-    return new URLConnectionClientHandler(new HttpURLConnectionFactory() {
-      @Override
-      public HttpURLConnection getHttpURLConnection(URL url)
-          throws IOException {
-        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-        if (connection.getResponseCode() == HttpURLConnection.HTTP_MOVED_TEMP) {
-          // is a redirect - are we changing schemes?
-          String redirectLocation = connection.getHeaderField(HttpHeaders.LOCATION);
-          String originalScheme = url.getProtocol();
-          String redirectScheme = URI.create(redirectLocation).getScheme();
-          if (!originalScheme.equals(redirectScheme)) {
-            // need to fake it out by doing redirect ourselves
-            log.info("Protocol change during redirect. Redirecting {} to URL {}",
-                     url, redirectLocation);
-            URL redirectURL = new URL(redirectLocation);
-            connection = (HttpURLConnection) redirectURL.openConnection();
-          }
-        }
-        if (connection instanceof HttpsURLConnection) {
-          log.debug("Attempting to configure HTTPS connection using client "
-                    + "configuration");
-          final SSLFactory factory;
-          final SSLSocketFactory sf;
-          final HostnameVerifier hv;
-
-          try {
-            HttpsURLConnection c = (HttpsURLConnection) connection;
-            factory = new SSLFactory(SSLFactory.Mode.CLIENT, new Configuration());
-            factory.init();
-            sf = factory.createSSLSocketFactory();
-            hv = factory.getHostnameVerifier();
-            c.setSSLSocketFactory(sf);
-            c.setHostnameVerifier(hv);
-          } catch (Exception e) {
-            log.info("Unable to configure HTTPS connection from "
-                     + "configuration.  Using JDK properties.");
-          }
-
-        }
-        return connection;
-      }
-    });
-  }
-
-  public WebResource resource(String url) {
-    return restClient.resource(url);
-  }
-
-  public BaseRestClient getRestClient() {
-    return restClient;
-  }
-
-  /**
-   * Execute the operation. Failures are raised as IOException subclasses
-   * @param method method to execute
-   * @param resource resource to work against
-   * @param c class to build
-   * @param <T> type expected
-   * @return an instance of the type T
-   * @throws IOException on any failure
-   */
-  public <T> T exec(HttpVerb method, WebResource resource, Class<T> c) throws IOException {
-    return restClient.exec(method, resource, c);
-  }
-
-  /**
-   * Execute the operation. Failures are raised as IOException subclasses
-   * @param method method to execute
-   * @param resource resource to work against
-   * @param t type to work with
-   * @param <T> type expected
-   * @return an instance of the type T
-   * @throws IOException on any failure
-   */
-  public <T> T exec(HttpVerb method, WebResource resource, GenericType<T> t)
-      throws IOException {
-    return restClient.exec(method, resource, t);
-  }
-
-  /**
-   * Execute the  GET operation. Failures are raised as IOException subclasses
-   * @param resource resource to work against
-   * @param c class to build
-   * @param <T> type expected
-   * @return an instance of the type T
-   * @throws IOException on any failure
-   */
-  public <T> T get(WebResource resource, Class<T> c) throws IOException {
-    return restClient.get(resource, c);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java b/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
deleted file mode 100644
index b0eddb8..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.retrieve;
-
-import com.beust.jcommander.Strings;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.registry.client.exceptions.RegistryIOException;
-import org.apache.hadoop.registry.client.types.ServiceRecord;
-import static org.apache.slider.client.ClientRegistryBinder.*;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.ExceptionConverter;
-import org.apache.slider.core.registry.docstore.PublishedConfigSet;
-import org.apache.slider.core.registry.docstore.PublishedConfiguration;
-import org.apache.slider.core.registry.docstore.PublishedExports;
-import org.apache.slider.core.registry.docstore.PublishedExportsSet;
-import static org.apache.slider.core.registry.info.CustomRegistryConstants.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-/**
- * Registry retriever. 
- * This hides the HTTP operations that take place to
- * get the actual content
- */
-public class RegistryRetriever extends AMWebClient {
-  private static final Logger log = LoggerFactory.getLogger(RegistryRetriever.class);
-
-  private final String externalConfigurationURL;
-  private final String internalConfigurationURL;
-  private final String externalExportsURL;
-  private final String internalExportsURL;
-
-  /**
-   * Retrieve from a service by locating the
-   * exported {@link CustomRegistryConstants.PUBLISHER_CONFIGURATIONS_API}
-   * and working off it.
-   *
-   * @param conf configuration to work from
-   * @param record service record
-   * @throws RegistryIOException the address type of the endpoint does
-   * not match that expected (i.e. not a list of URLs), missing endpoint...
-   */
-  public RegistryRetriever(Configuration conf, ServiceRecord record) throws RegistryIOException {
-    super(conf);
-    externalConfigurationURL = lookupRestAPI(record,
-        PUBLISHER_CONFIGURATIONS_API, true);
-    internalConfigurationURL = lookupRestAPI(record,
-        PUBLISHER_CONFIGURATIONS_API, false);
-    externalExportsURL = lookupRestAPI(record,
-        PUBLISHER_EXPORTS_API, true);
-    internalExportsURL = lookupRestAPI(record,
-        PUBLISHER_EXPORTS_API, false);
-  }
-
-  /**
-   * Does a bonded registry retriever have a configuration?
-   * @param external flag to indicate that it is the external entries to fetch
-   * @return true if there is a URL to the configurations defined
-   */
-  public boolean hasConfigurations(boolean external) {
-    return !Strings.isStringEmpty(
-        external ? externalConfigurationURL : internalConfigurationURL);
-  }
-  
-  /**
-   * Get the configurations of the registry
-   * @param external flag to indicate that it is the external entries to fetch
-   * @return the configuration sets
-   */
-  public PublishedConfigSet getConfigurations(boolean external) throws
-      FileNotFoundException, IOException {
-
-    String confURL = getConfigurationURL(external);
-      WebResource webResource = resource(confURL);
-    return get(webResource, PublishedConfigSet.class);
-  }
-
-  protected String getConfigurationURL(boolean external) throws FileNotFoundException {
-    String confURL = external ? externalConfigurationURL: internalConfigurationURL;
-    if (Strings.isStringEmpty(confURL)) {
-      throw new FileNotFoundException("No configuration URL");
-    }
-    return confURL;
-  }
-
-  protected String getExportURL(boolean external) throws FileNotFoundException {
-    String confURL = external ? externalExportsURL: internalExportsURL;
-    if (Strings.isStringEmpty(confURL)) {
-      throw new FileNotFoundException("No configuration URL");
-    }
-    return confURL;
-  }
-
-  /**
-   * Get the configurations of the registry
-   * @param external flag to indicate that it is the external entries to fetch
-   * @return the configuration sets
-   */
-  public PublishedExportsSet getExports(boolean external) throws
-      FileNotFoundException, IOException {
-
-    String exportsUrl = getExportURL(external);
-    WebResource webResource = resource(exportsUrl);
-    return get(webResource, PublishedExportsSet.class);
-  }
-
-
-  /**
-   * Get a complete configuration, with all values
-   * @param configSet config set to ask for
-   * @param name name of the configuration
-   * @param external flag to indicate that it is an external configuration
-   * @return the retrieved config
-   * @throws IOException IO problems
-   */
-  public PublishedConfiguration retrieveConfiguration(PublishedConfigSet configSet,
-      String name,
-      boolean external) throws IOException {
-    String confURL = getConfigurationURL(external);
-    if (!configSet.contains(name)) {
-      throw new FileNotFoundException("Unknown configuration " + name);
-    }
-    confURL = SliderUtils.appendToURL(confURL, name);
-    WebResource webResource = resource(confURL);
-    return get(webResource, PublishedConfiguration.class);
-  }
-
-  /**
-   * Get a complete export, with all values
-   * @param exportSet
-   * @param name name of the configuration
-   * @param external flag to indicate that it is an external configuration
-   * @return the retrieved config
-   * @throws IOException IO problems
-   */
-  public PublishedExports retrieveExports(PublishedExportsSet exportSet,
-                                                      String name,
-                                                      boolean external) throws IOException {
-    if (!exportSet.contains(name)) {
-      throw new FileNotFoundException("Unknown export " + name);
-    }
-    String exportsURL = getExportURL(external);
-    exportsURL = SliderUtils.appendToURL(exportsURL, name);
-    return get(resource(exportsURL), PublishedExports.class);
- }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("RegistryRetriever{");
-    sb.append("externalConfigurationURL='")
-      .append(externalConfigurationURL)
-      .append('\'');
-    sb.append(", internalConfigurationURL='")
-      .append(internalConfigurationURL)
-      .append('\'');
-    sb.append(", externalExportsURL='").append(externalExportsURL).append('\'');
-    sb.append(", internalExportsURL='").append(internalExportsURL).append('\'');
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/restclient/HttpOperationResponse.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/restclient/HttpOperationResponse.java b/slider-core/src/main/java/org/apache/slider/core/restclient/HttpOperationResponse.java
deleted file mode 100644
index 0266223..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/restclient/HttpOperationResponse.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.restclient;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * A response for use as a return value from operations
- */
-public class HttpOperationResponse {
-  
-  public int responseCode;
-  public long lastModified;
-  public String contentType;
-  public byte[] data;
-  public Map<String, List<String>> headers;
-}


[31/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/launch/LaunchedApplication.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/launch/LaunchedApplication.java b/slider-core/src/main/java/org/apache/slider/core/launch/LaunchedApplication.java
deleted file mode 100644
index 632e3fd..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/launch/LaunchedApplication.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.launch;
-
-import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationResponse;
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.YarnApplicationState;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.slider.client.SliderYarnClientImpl;
-import org.apache.slider.common.tools.Duration;
-
-import java.io.IOException;
-
-/**
- * Launched App with logic around it.
- */
-public class LaunchedApplication {
-
-  protected final ApplicationId applicationId;
-  protected final SliderYarnClientImpl yarnClient;
-
-  public LaunchedApplication(ApplicationId applicationId,
-                             SliderYarnClientImpl yarnClient) {
-    assert applicationId != null;
-    assert yarnClient != null;
-    this.applicationId = applicationId;
-    this.yarnClient = yarnClient;
-  }
-
-  public LaunchedApplication(SliderYarnClientImpl yarnClient,
-                             ApplicationReport report) {
-    this.yarnClient = yarnClient;
-    this.applicationId = report.getApplicationId();
-  }
-
-  public ApplicationId getApplicationId() {
-    return applicationId;
-  }
-
-  /**
-   * Monitor the submitted application for reaching the requested state.
-   * Will also report if the app reaches a later state (failed, killed, etc)
-   * Kill application if duration!= null & time expires. 
-   * @param duration how long to wait -must be more than 0
-   * @param desiredState desired state.
-   * @return the application report -null on a timeout
-   * @throws YarnException
-   * @throws IOException
-   */
-  public ApplicationReport monitorAppToState(YarnApplicationState desiredState, Duration duration)
-    throws YarnException, IOException {
-    return yarnClient.monitorAppToState(applicationId, desiredState, duration);
-  }
-
-  /**
-   * Kill the submitted application by sending a call to the ASM
-   * @throws YarnException
-   * @throws IOException
-   */
-  public boolean forceKill(String reason)
-    throws YarnException, IOException {
-    if (applicationId != null) {
-      yarnClient.killRunningApplication(applicationId, reason);
-      return true;
-    }
-    return false;
-  }
-
-  /**
-   * Kill the application
-   * @return the response
-   * @throws YarnException YARN problems
-   * @throws IOException IO problems
-   */
-  public KillApplicationResponse kill(String reason) throws
-                                                     YarnException,
-                                                     IOException {
-    return yarnClient.killRunningApplication(applicationId, reason);
-  }
-
-  /**
-   * Get the application report of this application
-   * @return an application report
-   * @throws YarnException
-   * @throws IOException
-   */
-  public ApplicationReport getApplicationReport()
-    throws YarnException, IOException {
-    return yarnClient.getApplicationReport(applicationId);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/launch/RunningApplication.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/launch/RunningApplication.java b/slider-core/src/main/java/org/apache/slider/core/launch/RunningApplication.java
deleted file mode 100644
index 14c522c..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/launch/RunningApplication.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.launch;
-
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.slider.api.SliderClusterProtocol;
-import org.apache.slider.client.SliderYarnClientImpl;
-import org.apache.slider.common.SliderExitCodes;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.server.appmaster.rpc.RpcBinder;
-
-import java.io.IOException;
-
-import static org.apache.slider.common.Constants.CONNECT_TIMEOUT;
-import static org.apache.slider.common.Constants.RPC_TIMEOUT;
-
-/**
- * A running application built from an app report. This one
- * can be talked to
- */
-public class RunningApplication extends LaunchedApplication {
-
-  private final ApplicationReport applicationReport;
-  public RunningApplication(SliderYarnClientImpl yarnClient,
-                            ApplicationReport applicationReport) {
-    super(yarnClient, applicationReport);
-    this.applicationReport = applicationReport;
-  }
-
-  public ApplicationReport getApplicationReport() {
-    return applicationReport;
-  }
-
-
-  /**
-   * Connect to a Slider AM
-   * @param app application report providing the details on the application
-   * @return an instance
-   * @throws YarnException
-   * @throws IOException
-   */
-  public SliderClusterProtocol connect(ApplicationReport app) throws
-                                                             YarnException,
-                                                             IOException {
-
-    try {
-      return RpcBinder.getProxy(yarnClient.getConfig(),
-                                yarnClient.getRmClient(),
-                                app,
-                                CONNECT_TIMEOUT,
-                                RPC_TIMEOUT);
-    } catch (InterruptedException e) {
-      throw new SliderException(SliderExitCodes.EXIT_TIMED_OUT,
-          e,
-          "Interrupted waiting for communications with the Application Master");
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/launch/SerializedApplicationReport.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/launch/SerializedApplicationReport.java b/slider-core/src/main/java/org/apache/slider/core/launch/SerializedApplicationReport.java
deleted file mode 100644
index 8e0ef5a..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/launch/SerializedApplicationReport.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.launch;
-
-import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
-import org.apache.slider.core.persist.ApplicationReportSerDeser;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.io.IOException;
-
-/**
- * Serialized form of an application report which can be persisted
- * and then parsed. It can not be converted back into a
- * real YARN application report
- * 
- * Useful for testing
- */
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-
-public class SerializedApplicationReport {
-
-  public String applicationId;
-  public String applicationAttemptId;
-  public String name;
-  public String applicationType;
-  public String user;
-  public String queue;
-  public String host;
-  public Integer rpcPort;
-  public String state;
-  public String diagnostics;
-  public String url;
-  /**
-   * This value is non-null only when a report is generated from a submission context.
-   * The YARN {@link ApplicationReport} structure does not propagate this value
-   * from the RM.
-   */
-  public Long submitTime;
-  public Long startTime;
-  public Long finishTime;
-  public String finalStatus;
-  public String origTrackingUrl;
-  public Float progress;
-  
-  public SerializedApplicationReport() {
-  }
-  
-  public SerializedApplicationReport(ApplicationReport report) {
-    this.applicationId = report.getApplicationId().toString();
-    ApplicationAttemptId attemptId = report.getCurrentApplicationAttemptId();
-    this.applicationAttemptId = attemptId != null ? attemptId.toString() : "N/A";
-    this.name = report.getName();
-    this.applicationType = report.getApplicationType();
-    this.user = report.getUser();
-    this.queue = report.getQueue();
-    this.host = report.getHost();
-    this.rpcPort = report.getRpcPort();
-    this.state = report.getYarnApplicationState().toString();
-    this.diagnostics = report.getDiagnostics();
-    this.startTime = report.getStartTime();
-    this.finishTime = report.getFinishTime();
-    FinalApplicationStatus appStatus = report.getFinalApplicationStatus();
-    this.finalStatus = appStatus == null ? "" : appStatus.toString();
-    this.progress = report.getProgress();
-    this.url = report.getTrackingUrl();
-    this.origTrackingUrl= report.getOriginalTrackingUrl();
-  }
-
-  @Override
-  public String toString() {
-    try {
-      return ApplicationReportSerDeser.toString(this);
-    } catch (IOException e) {
-      return super.toString();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/main/ExitCodeProvider.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/main/ExitCodeProvider.java b/slider-core/src/main/java/org/apache/slider/core/main/ExitCodeProvider.java
deleted file mode 100644
index 503b9b9..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/main/ExitCodeProvider.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.core.main;
-
-/**
- * Get the exit code of an exception. Making it an interface allows
- * us to retrofit exit codes onto existing classes
- */
-public interface ExitCodeProvider {
-
-  /**
-   * Method to get the exit code
-   * @return the exit code
-   */
-  int  getExitCode();
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/main/IrqHandler.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/main/IrqHandler.java b/slider-core/src/main/java/org/apache/slider/core/main/IrqHandler.java
deleted file mode 100644
index 42442d1..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/main/IrqHandler.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.core.main;
-
-import sun.misc.Signal;
-import sun.misc.SignalHandler;
-
-import java.io.IOException;
-
-/**
- * This class bundles up all the compiler warnings about abuse of sun.misc
- * interrupt handling code
- * into one place.
- */
-@SuppressWarnings("UseOfSunClasses")
-public final class IrqHandler implements SignalHandler {
-
-  public static final String CONTROL_C = "INT";
-  public static final String SIGTERM = "TERM";
-
-  private final String name;
-  private final Interrupted handler;
-
-  /**
-   * Create an IRQ handler bound to the specific interrupt
-   * @param name signal name
-   * @param handler handler
-   * @throws IOException
-   */
-  public IrqHandler(String name, Interrupted handler) throws IOException {
-    this.handler = handler;
-    this.name = name;
-    try {
-      Signal.handle(new Signal(name), this);
-    } catch (IllegalArgumentException e) {
-      throw new IOException(
-        "Could not set handler for signal \"" + name + "\"."
-        + "This can happen if the JVM has the -Xrs set.",
-        e);
-    }
-  }
-
-  @Override
-  public String toString() {
-    return "IrqHandler for signal " + name ;
-  }
-
-  /**
-   * Handler for the JVM API for signal handling
-   * @param signal signal raised
-   */
-//  @Override
-  public void handle(Signal signal) {
-    InterruptData data = new InterruptData(signal.getName(), signal.getNumber());
-    handler.interrupted(data);
-  }
-
-  /**
-   * Interrupt data to pass on.
-   */
-  public static class InterruptData {
-    public final String name;
-    public final int number;
-
-    public InterruptData(String name, int number) {
-      this.name = name;
-      this.number = number;
-    }
-
-    @Override
-    public String toString() {
-      return "signal " + name + '(' + number + ')';
-    }
-  }
-
-  /**
-   * Callback on interruption
-   */
-  public interface Interrupted {
-
-    /**
-     * Handle an interrupt
-     * @param interruptData data
-     */
-    void interrupted(InterruptData interruptData);
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/main/LauncherExitCodes.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/main/LauncherExitCodes.java b/slider-core/src/main/java/org/apache/slider/core/main/LauncherExitCodes.java
deleted file mode 100644
index 83e89f0..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/main/LauncherExitCodes.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.core.main;
-
-/*
- * Common Exit codes
- * <p>
- * Exit codes from 64 up are application specific.
- * <p>
- * Many of the exit codes are designed to resemble HTTP error codes,
- * squashed into a single byte. e.g 44 , "not found" is the equivalent
- * of 404
- * <pre>
- *    0-10: general command issues
- *   30-39: equivalent to the 3XX responses, where those responses are
- *          considered errors by the application.
- *   40-49: request-related errors
- *   50-59: server-side problems. These may be triggered by the request.
- *   64-  : application specific error codes
- * </pre>
- */
-public interface LauncherExitCodes {
-  
-  /**
-   * 0: success
-   */
-  int EXIT_SUCCESS                    =  0;
-
-  /**
-   * -1: generic "false" response. The operation worked but
-   * the result was not true
-   */
-  int EXIT_FALSE                      = -1;
-
-  /**
-   * Exit code when a client requested service termination: {@value}
-   */
-  int EXIT_CLIENT_INITIATED_SHUTDOWN  =  1;
-
-  /**
-   * Exit code when targets could not be launched: {@value}
-   */
-  int EXIT_TASK_LAUNCH_FAILURE        =  2;
-
-  /**
-   * Exit code when a control-C, kill -3, signal was picked up: {@value}
-   */
-  int EXIT_INTERRUPTED                = 3;
-
-  /**
-   * Exit code when a usage message was printed: {@value}
-   */
-  int EXIT_USAGE                      = 4;
-
-  /**
-   * Exit code when something happened but we can't be specific: {@value}
-   */
-  int EXIT_OTHER_FAILURE               = 5;
-
-  /**
-   * Exit code on connectivity problems: {@value}
-   */
-  int EXIT_MOVED                      = 31;
-  
-  /**
-   * found: {@value}.
-   * <p>
-   * This is low value as in HTTP it is normally a success/redirect;
-   * whereas on the command line 0 is the sole success code.
-   * <p>
-   * <code>302 Found</code>
-   */
-  int EXIT_FOUND                      = 32;
-
-  /**
-   * Exit code on a request where the destination has not changed
-   * and (somehow) the command specified that this is an error.
-   * That is, this exit code is somehow different from a "success"
-   * : {@value}
-   * <p>
-   * <code>304 Not Modified </code>
-  */
-  int EXIT_NOT_MODIFIED               = 34;
-
-  /**
-   * Exit code when the command line doesn't parse: {@value}, or
-   * when it is otherwise invalid.
-   * <p>
-   * <code>400 BAD REQUEST</code>
-   */
-  int EXIT_COMMAND_ARGUMENT_ERROR     = 40;
-
-  /**
-   * The request requires user authentication: {@value}
-   * <p>
-   * <code>401 Unauthorized</code>
-   */
-  int EXIT_UNAUTHORIZED               = 41;
-  
-  /**
-   * Forbidden action: {@value}
-   * <p>
-   * <code>403: Forbidden</code>
-   */
-  int EXIT_FORBIDDEN                  = 43;
-  
-  /**
-   * Something was not found: {@value}
-   * <p>
-   * <code>404: NOT FOUND</code>
-   */
-  int EXIT_NOT_FOUND                  = 44;
-
-  /**
-   * The operation is not allowed: {@value}
-   * <p>
-   * <code>405: NOT ALLOWED</code>
-   */
-  int EXIT_OPERATION_NOT_ALLOWED       = 45;
-
-  /**
-   * The command is somehow not acceptable: {@value}
-   * <p>
-   * <code>406: NOT ACCEPTABLE</code>
-   */
-  int EXIT_NOT_ACCEPTABLE            = 46;
-
-  /**
-   * Exit code on connectivity problems: {@value}
-   * <p>
-   * <code>408: Request Timeout</code>
-   */
-  int EXIT_CONNECTIVITY_PROBLEM       = 48;
-
-  /**
-   * The request could not be completed due to a conflict with the current
-   * state of the resource.  {@value}
-   * <p>
-   * <code>409: conflict</code>
-   */
-  int EXIT_CONFLICT                   = 49;
-
-  /**
-   * internal error: {@value}
-   * <p>
-   * <code>500 Internal Server Error</code>
-   */
-  int EXIT_INTERNAL_ERROR             = 50;
-
-  /**
-   * Unimplemented feature: {@value}
-   * <p>
-   * <code>501: Not Implemented</code>
-   */
-  int EXIT_UNIMPLEMENTED              = 51;
-
-  /**
-   * Service Unavailable; it may be available later: {@value}
-   * <p>
-   * <code>503 Service Unavailable</code>
-   */
-  int EXIT_SERVICE_UNAVAILABLE        = 53;
-
-  /**
-   * The application does not support, or refuses to support this version: {@value}.
-   * If raised, this is expected to be raised server-side and likely due
-   * to client/server version incompatibilities.
-   * <p>
-   * <code> 505: Version Not Supported</code>
-   */
-  int EXIT_UNSUPPORTED_VERSION        = 55;
-
-  /**
-   * Exit code when an exception was thrown from the service: {@value}
-   * <p>
-   * <code>5XX</code>
-   */
-  int EXIT_EXCEPTION_THROWN           = 56;
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/main/RunService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/main/RunService.java b/slider-core/src/main/java/org/apache/slider/core/main/RunService.java
deleted file mode 100644
index c3a1d0e..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/main/RunService.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.core.main;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.service.Service;
-
-/**
- * An interface which services can implement to have their
- * execution managed by the ServiceLauncher.
- * The command line options will be passed down before the 
- * {@link Service#init(Configuration)} operation is invoked via an
- * invocation of {@link RunService#bindArgs(Configuration, String...)}
- * After the service has been successfully started via {@link Service#start()}
- * the {@link RunService#runService()} method is called to execute the 
- * service. When this method returns, the service launcher will exit, using
- * the return code from the method as its exit option.
- */
-public interface RunService extends Service {
-
-  /**
-   * Propagate the command line arguments.
-   * This method is called before {@link Service#init(Configuration)};
-   * the configuration that is returned from this operation
-   * is the one that is passed on to the init operation.
-   * This permits implemenations to change the configuration before
-   * the init operation.n
-   * 
-   *
-   * @param config the initial configuration build up by the
-   * service launcher.
-   * @param args argument list list of arguments passed to the command line
-   * after any launcher-specific commands have been stripped.
-   * @return the configuration to init the service with. This MUST NOT be null.
-   * Recommended: pass down the config parameter with any changes
-   * @throws Exception any problem
-   */
-  Configuration bindArgs(Configuration config, String... args) throws Exception;
-  
-  /**
-   * Run a service. This called after {@link Service#start()}
-   * @return the exit code
-   * @throws Throwable any exception to report
-   */
-  int runService() throws Throwable ;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/main/ServiceLaunchException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/main/ServiceLaunchException.java b/slider-core/src/main/java/org/apache/slider/core/main/ServiceLaunchException.java
deleted file mode 100644
index 27813b7..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/main/ServiceLaunchException.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.core.main;
-
-
-import org.apache.hadoop.yarn.exceptions.YarnException;
-
-/**
- * A service launch exception that includes an exit code;
- * when caught by the ServiceLauncher, it will convert that
- * into a process exit code.
- */
-public class ServiceLaunchException extends YarnException
-  implements ExitCodeProvider, LauncherExitCodes {
-
-  private final int exitCode;
-
-  /**
-   * Create an exception with the specific exit code
-   * @param exitCode exit code
-   * @param cause cause of the exception
-   */
-  public ServiceLaunchException(int exitCode, Throwable cause) {
-    super(cause);
-    this.exitCode = exitCode;
-  }
-
-  /**
-   * Create an exception with the specific exit code and text
-   * @param exitCode exit code
-   * @param message message to use in exception
-   */
-  public ServiceLaunchException(int exitCode, String message) {
-    super(message);
-    this.exitCode = exitCode;
-  }
-
-  /**
-   * Create an exception with the specific exit code, text and cause
-   * @param exitCode exit code
-   * @param message message to use in exception
-   * @param cause cause of the exception
-   */
-  public ServiceLaunchException(int exitCode, String message, Throwable cause) {
-    super(message, cause);
-    this.exitCode = exitCode;
-  }
-
-  /**
-   * Get the exit code
-   * @return the exit code
-   */
-  @Override
-  public int getExitCode() {
-    return exitCode;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/main/ServiceLauncher.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/main/ServiceLauncher.java b/slider-core/src/main/java/org/apache/slider/core/main/ServiceLauncher.java
deleted file mode 100644
index f192ec8..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/main/ServiceLauncher.java
+++ /dev/null
@@ -1,642 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.main;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.net.NetUtils;
-import org.apache.hadoop.service.Service;
-import org.apache.hadoop.util.ExitUtil;
-import org.apache.hadoop.util.ShutdownHookManager;
-import org.apache.hadoop.util.VersionInfo;
-import org.apache.hadoop.yarn.YarnUncaughtExceptionHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * A class to launch any service by name.
- * 
- * It's designed to be subclassed for custom entry points.
- * 
- * 
- * Workflow
- * <ol>
- *   <li>An instance of the class is created</li>
- *   <li>If it implements RunService, it is given the binding args off the CLI</li>
- *   <li>Its service.init() and service.start() methods are called.</li>
- *   <li>If it implements RunService, runService() is called and its return
- *   code used as the exit code.</li>
- *   <li>Otherwise: it waits for the service to stop, assuming in its start() method
- *   it begins work</li>
- *   <li>If an exception returned an exit code, that becomes the exit code of the
- *   command.</li>
- * </ol>
- * Error and warning messages are logged to stderr. Why? If the classpath
- * is wrong & logger configurations not on it, then no error messages by
- * the started app will be seen and the caller is left trying to debug
- * using exit codes. 
- * 
- */
-@SuppressWarnings("UseOfSystemOutOrSystemErr")
-public class ServiceLauncher<S extends Service>
-  implements LauncherExitCodes, IrqHandler.Interrupted,
-    Thread.UncaughtExceptionHandler {
-  private static final Logger LOG = LoggerFactory.getLogger(
-      ServiceLauncher.class);
-
-  protected static final int PRIORITY = 30;
-
-  public static final String NAME = "ServiceLauncher";
-
-  /**
-   * Name of the "--conf" argument. 
-   */
-  public static final String ARG_CONF = "--conf";
-
-  public static final String USAGE_MESSAGE =
-      "Usage: " + NAME + " classname [" + ARG_CONF +
-      "<conf file>] <service arguments> | ";
-  static final int SHUTDOWN_TIME_ON_INTERRUPT = 30 * 1000;
-
-  private volatile S service;
-  private int serviceExitCode;
-  @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
-  private final List<IrqHandler> interruptHandlers = new ArrayList<>(1);
-  private Configuration configuration;
-  private String serviceClassName;
-  private static AtomicBoolean signalAlreadyReceived = new AtomicBoolean(false);
-
-
-  /**
-   * Create an instance of the launcher
-   * @param serviceClassName classname of the service
-   */
-  public ServiceLauncher(String serviceClassName) {
-    this.serviceClassName = serviceClassName;
-  }
-
-  /**
-   * Get the service. Null until and unless
-   * {@link #launchService(Configuration, String[], boolean)} has completed
-   * @return the service
-   */
-  public S getService() {
-    return service;
-  }
-
-  /**
-   * Get the configuration constructed from the command line arguments
-   * @return the configuration used to create the service
-   */
-  public Configuration getConfiguration() {
-    return configuration;
-  }
-
-  /**
-   * The exit code from a successful service execution
-   * @return the exit code. 
-   */
-  public int getServiceExitCode() {
-    return serviceExitCode;
-  }
-
-  @Override
-  public String toString() {
-    return "ServiceLauncher for " + serviceClassName;
-  }
-
-  /**
-   * Launch the service, by creating it, initing it, starting it and then
-   * maybe running it. {@link RunService#bindArgs(Configuration, String...)} is invoked
-   * on the service between creation and init.
-   *
-   * All exceptions that occur are propagated upwards.
-   *
-   * If the method returns a status code, it means that it got as far starting
-   * the service, and if it implements {@link RunService}, that the 
-   * method {@link RunService#runService()} has completed. 
-   *
-   * At this point, the service is returned by {@link #getService()}.
-   *
-   * @param conf configuration
-   * @param processedArgs arguments after the configuration parameters
-   * have been stripped out.
-   * @param addProcessHooks should process failure handlers be added to
-   * terminate this service on shutdown. Tests should set this to false.
-   * @throws ClassNotFoundException classname not on the classpath
-   * @throws IllegalAccessException not allowed at the class
-   * @throws InstantiationException not allowed to instantiate it
-   * @throws InterruptedException thread interrupted
-   * @throws Throwable any other failure
-   */
-  public int launchService(Configuration conf,
-      String[] processedArgs,
-      boolean addProcessHooks)
-    throws Throwable {
-
-    instantiateService(conf);
-
-    // add any process shutdown hooks
-    if (addProcessHooks) {
-      ServiceShutdownHook shutdownHook = new ServiceShutdownHook(service);
-      ShutdownHookManager.get().addShutdownHook(shutdownHook, PRIORITY);
-    }
-    RunService runService = null;
-
-    if (service instanceof RunService) {
-      //if its a runService, pass in the conf and arguments before init)
-      runService = (RunService) service;
-      configuration = runService.bindArgs(configuration, processedArgs);
-      Preconditions.checkNotNull(configuration,
-          "null configuration returned by bindArgs()");
-    }
-
-    //some class constructors init; here this is picked up on.
-    if (!service.isInState(Service.STATE.INITED)) {
-      service.init(configuration);
-    }
-    service.start();
-    int exitCode = EXIT_SUCCESS;
-    if (runService != null) {
-      //assume that runnable services are meant to run from here
-      exitCode = runService.runService();
-      LOG.debug("Service exited with exit code {}", exitCode);
-
-    } else {
-      //run the service until it stops or an interrupt happens on a different thread.
-      LOG.debug("waiting for service threads to terminate");
-      service.waitForServiceToStop(0);
-    }
-    //exit
-    serviceExitCode = exitCode;
-    return serviceExitCode;
-  }
-
-  /**
-   * Instantiate the service defined in <code>serviceClassName</code>
-   * . Sets the <code>configuration</code> field
-   * to the configuration, and <code>service</code> to the service.
-   *
-   * @param conf configuration to use
-   * @throws ClassNotFoundException classname not on the classpath
-   * @throws IllegalAccessException not allowed at the class
-   * @throws InstantiationException not allowed to instantiate it
-   */
-  @SuppressWarnings("unchecked")
-  public Service instantiateService(Configuration conf)
-      throws ClassNotFoundException, InstantiationException, IllegalAccessException,
-      ExitUtil.ExitException, NoSuchMethodException, InvocationTargetException {
-    Preconditions.checkArgument(conf != null, "null conf");
-    configuration = conf;
-
-    //Instantiate the class -this requires the service to have a public
-    // zero-argument constructor
-    Class<?> serviceClass =
-        this.getClass().getClassLoader().loadClass(serviceClassName);
-    Object instance = serviceClass.getConstructor().newInstance();
-    if (!(instance instanceof Service)) {
-      //not a service
-      throw new ExitUtil.ExitException(EXIT_COMMAND_ARGUMENT_ERROR,
-          "Not a Service class: " + serviceClassName);
-    }
-
-    service = (S) instance;
-    return service;
-  }
-
-  /**
-   * Register this class as the handler for the control-C interrupt.
-   * Can be overridden for testing.
-   */
-  protected void registerInterruptHandler() {
-    try {
-      interruptHandlers.add(new IrqHandler(IrqHandler.CONTROL_C, this));
-      interruptHandlers.add(new IrqHandler(IrqHandler.SIGTERM, this));
-    } catch (IOException e) {
-      error("Signal handler setup failed : {}" + e, e);
-    }
-  }
-
-  /**
-   * The service has been interrupted -try to shut down the service.
-   * Give the service time to do this before the exit operation is called 
-   * @param interruptData the interrupted data.
-   */
-  @Override
-  public void interrupted(IrqHandler.InterruptData interruptData) {
-    String message = "Service interrupted by " + interruptData.toString();
-    warn(message);
-    if (!signalAlreadyReceived.compareAndSet(false, true)) {
-      warn("Repeated interrupt: escalating to a JVM halt");
-      // signal already received. On a second request to a hard JVM
-      // halt and so bypass any blocking shutdown hooks.
-      ExitUtil.halt(EXIT_INTERRUPTED, message);
-    }
-    int shutdownTimeMillis = SHUTDOWN_TIME_ON_INTERRUPT;
-    //start an async shutdown thread with a timeout
-    ServiceForcedShutdown forcedShutdown =
-      new ServiceForcedShutdown(shutdownTimeMillis);
-    Thread thread = new Thread(forcedShutdown);
-    thread.setDaemon(true);
-    thread.start();
-    //wait for that thread to finish
-    try {
-      thread.join(shutdownTimeMillis);
-    } catch (InterruptedException ignored) {
-      //ignored
-    }
-    if (!forcedShutdown.isServiceStopped()) {
-      warn("Service did not shut down in time");
-    }
-    exit(EXIT_INTERRUPTED, message);
-  }
-
-  /**
-   * Uncaught exception handler.
-   * If an error is raised: shutdown
-   * The state of the system is unknown at this point -attempting
-   * a clean shutdown is dangerous. Instead: exit
-   * @param thread thread that failed
-   * @param exception exception
-   */
-  @Override
-  public void uncaughtException(Thread thread, Throwable exception) {
-    if (ShutdownHookManager.get().isShutdownInProgress()) {
-      LOG.error("Thread {} threw an error during shutdown: {}.",
-          thread.toString(),
-          exception,
-          exception);
-    } else if (exception instanceof Error) {
-      try {
-        LOG.error("Thread {} threw an error: {}. Shutting down",
-            thread.toString(),
-            exception,
-            exception);
-      } catch (Throwable err) {
-        // We don't want to not exit because of an issue with logging
-      }
-      if (exception instanceof OutOfMemoryError) {
-        // After catching an OOM java says it is undefined behavior, so don't
-        // even try to clean up or we can get stuck on shutdown.
-        try {
-          System.err.println("Halting due to Out Of Memory Error...");
-        } catch (Throwable err) {
-          // Again we don't want to exit because of logging issues.
-        }
-        ExitUtil.halt(EXIT_EXCEPTION_THROWN);
-      } else {
-        // error other than OutOfMemory
-        exit(convertToExitException(exception));
-      }
-    } else {
-      // simple exception in a thread. There's a policy decision here:
-      // terminate the service vs. keep going after a thread has failed
-      LOG.error("Thread {} threw an exception: {}",
-          thread.toString(),
-          exception,
-          exception);
-    }
-  }
-
-  /**
-   * Print a warning: currently this goes to stderr
-   * @param text
-   */
-  protected void warn(String text) {
-    System.err.println(text);
-  }
-
-  /**
-   * Report an error. The message is printed to stderr; the exception
-   * is logged via the current logger.
-   * @param message message for the user
-   * @param thrown the exception thrown
-   */
-  protected void error(String message, Throwable thrown) {
-    String text = "Exception: " + message;
-    warn(text);
-    LOG.error(text, thrown);
-  }
-
-  /**
-   * Exit the code.
-   * This is method can be overridden for testing, throwing an 
-   * exception instead. Any subclassed method MUST raise an 
-   * <code>ExitUtil.ExitException</code> instance.
-   * The service launcher code assumes that after this method is invoked,
-   * no other code in the same method is called.
-   * @param exitCode code to exit
-   */
-  protected void exit(int exitCode, String message) {
-    ExitUtil.terminate(exitCode, message);
-  }
-
-  /**
-   * Exit off an exception. This can be subclassed for testing
-   * @param ee exit exception
-   */
-  protected void exit(ExitUtil.ExitException ee) {
-    ExitUtil.terminate(ee.status, ee);
-  }
-
-  /**
-   * Get the service name via {@link Service#getName()}.
-   * If the service is not instantiated, the classname is returned instead.
-   * @return the service name
-   */
-  public String getServiceName() {
-    Service s = service;
-    String name = null;
-    if (s != null) {
-      try {
-        name = s.getName();
-      } catch (Exception ignored) {
-        // ignored
-      }
-    }
-    if (name != null) {
-      return "service " + name;
-    } else {
-      return "service classname " + serviceClassName;
-    }
-  }
-
-  /**
-   * Parse the command line, building a configuration from it, then
-   * launch the service and wait for it to finish. finally, exit
-   * passing the status code to the #exit(int) method.
-   * @param args arguments to the service. arg[0] is 
-   * assumed to be the service classname and is automatically
-   */
-  public void launchServiceAndExit(List<String> args) {
-
-    registerInterruptHandler();
-    //Currently the config just the default
-    Configuration conf = new Configuration();
-    String[] processedArgs = extractConfigurationArgs(conf, args);
-    ExitUtil.ExitException ee = launchServiceRobustly(conf, processedArgs);
-    System.out.flush();
-    System.err.flush();
-    exit(ee);
-  }
-
-  /**
-   * Extract the configuration arguments and apply them to the configuration,
-   * building an array of processed arguments to hand down to the service.
-   *
-   * @param conf configuration to update
-   * @param args main arguments. args[0] is assumed to be the service
-   * classname and is skipped
-   * @return the processed list.
-   */
-  public static String[] extractConfigurationArgs(Configuration conf,
-                                                  List<String> args) {
-
-    //convert args to a list
-    int argCount = args.size();
-    if (argCount <= 1 ) {
-      return new String[0];
-    }
-    List<String> argsList = new ArrayList<String>(argCount);
-    ListIterator<String> arguments = args.listIterator();
-    //skip that first entry
-    arguments.next();
-    while (arguments.hasNext()) {
-      String arg = arguments.next();
-      if (arg.equals(ARG_CONF)) {
-        //the argument is a --conf file tuple: extract the path and load
-        //it in as a configuration resource.
-
-        //increment the loop iterator
-        if (!arguments.hasNext()) {
-          //overshot the end of the file
-          exitWithMessage(EXIT_COMMAND_ARGUMENT_ERROR,
-              ARG_CONF + ": missing configuration file after ");
-        }
-        File file = new File(arguments.next());
-        if (!file.exists()) {
-          exitWithMessage(EXIT_COMMAND_ARGUMENT_ERROR,
-              ARG_CONF + ": configuration file not found: " + file);
-        }
-        try {
-          conf.addResource(file.toURI().toURL());
-        } catch (MalformedURLException e) {
-          LOG.debug("File {} cannot be converted to URL", file, e);
-          exitWithMessage(EXIT_COMMAND_ARGUMENT_ERROR,
-              ARG_CONF + ": configuration file path invalid: " + file);
-        }
-      } else {
-        argsList.add(arg);
-      }
-    }
-    String[] processedArgs = new String[argsList.size()];
-    argsList.toArray(processedArgs);
-    return processedArgs;
-  }
-
-  /**
-   * Launch a service catching all exceptions and downgrading them to exit codes
-   * after logging.
-   * @param conf configuration to use
-   * @param processedArgs command line after the launcher-specific arguments have
-   * been stripped out
-   * @return an exit exception, which will have a status code of 0 if it worked
-   */
-  public ExitUtil.ExitException launchServiceRobustly(Configuration conf,
-                                   String[] processedArgs) {
-    ExitUtil.ExitException exitException;
-    try {
-      int exitCode = launchService(conf, processedArgs, true);
-      if (service != null) {
-        Throwable failure = service.getFailureCause();
-        if (failure != null) {
-          //the service exited with a failure.
-          //check what state it is in
-          Service.STATE failureState = service.getFailureState();
-          if (failureState == Service.STATE.STOPPED) {
-            //the failure occurred during shutdown, not important enough to bother
-            //the user as it may just scare them
-            LOG.debug("Failure during shutdown:{} ", failure, failure);
-          } else {
-            //throw it for the catch handlers to deal with
-            throw failure;
-          }
-        }
-      }
-      exitException = new ExitUtil.ExitException(exitCode,
-                                     "In " + serviceClassName);
-      // either the service succeeded, or an error raised during shutdown, 
-      // which we don't worry that much about
-    } catch (ExitUtil.ExitException ee) {
-      exitException = ee;
-    } catch (Throwable thrown) {
-      exitException = convertToExitException(thrown);
-    }
-    return exitException;
-  }
-
-  /**
-   * Convert the exception to one that can be handed off to ExitUtils;
-   * if it is of the write type it is passed throw as is. If not, a 
-   * new exception with the exit code {@link #EXIT_EXCEPTION_THROWN}
-   * is created, with the argument <code>thrown</code> as the inner cause
-   * @param thrown the exception thrown
-   * @return an exception to terminate the process with
-   */
-  protected ExitUtil.ExitException convertToExitException(Throwable thrown) {
-    ExitUtil.ExitException exitException;
-    int exitCode;
-    String message = thrown.getMessage();
-    if (message == null) {
-      message = thrown.toString();
-    }
-    if (thrown instanceof ExitCodeProvider) {
-      exitCode = ((ExitCodeProvider) thrown).getExitCode();
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("While running {}: {}", getServiceName(), message, thrown);
-      }
-      LOG.error(message);
-    } else {
-      // not any of the service launcher exceptions -assume something worse
-      error(message, thrown);
-      exitCode = EXIT_EXCEPTION_THROWN;
-    }
-    exitException = new ExitUtil.ExitException(exitCode, message);
-    exitException.initCause(thrown);
-    return exitException;
-  }
-
-
-  /**
-   * Build a log message for starting up and shutting down. 
-   * This was grabbed from the ToolRunner code.
-   * @param classname the class of the server
-   * @param args arguments
-   */
-  public static String startupShutdownMessage(String classname,
-                                              List<String> args) {
-    final String hostname = NetUtils.getHostname();
-
-    return toStartupShutdownString("STARTUP_MSG: ", new String[]{
-      "Starting " + classname,
-      "  host = " + hostname,
-      "  args = " + args,
-      "  version = " + VersionInfo.getVersion(),
-      "  classpath = " + System.getProperty("java.class.path"),
-      "  build = " + VersionInfo.getUrl() + " -r "
-      + VersionInfo.getRevision()
-      + "; compiled by '" + VersionInfo.getUser()
-      + "' on " + VersionInfo.getDate(),
-      "  java = " + System.getProperty("java.version")
-    });
-  }
-
-  /**
-   * Exit with a printed message
-   * @param status status code
-   * @param message message
-   */
-  private static void exitWithMessage(int status, String message) {
-    System.err.println(message);
-    ExitUtil.terminate(status);
-  }
-
-  private static String toStartupShutdownString(String prefix, String[] msg) {
-    StringBuilder b = new StringBuilder(prefix);
-    b.append("\n/************************************************************");
-    for (String s : msg) {
-      b.append("\n").append(prefix).append(s);
-    }
-    b.append("\n************************************************************/");
-    return b.toString();
-  }
-
-  /**
-   * forced shutdown runnable.
-   */
-  protected class ServiceForcedShutdown implements Runnable {
-
-    private final int shutdownTimeMillis;
-    private boolean serviceStopped;
-
-    public ServiceForcedShutdown(int shutdownTimeoutMillis) {
-      this.shutdownTimeMillis = shutdownTimeoutMillis;
-    }
-
-    @Override
-    public void run() {
-      if (service != null) {
-        service.stop();
-        serviceStopped = service.waitForServiceToStop(shutdownTimeMillis);
-      } else {
-        serviceStopped = true;
-      }
-    }
-
-    private boolean isServiceStopped() {
-      return serviceStopped;
-    }
-  }
-
-  /**
-   * The real main function, which takes the arguments as a list
-   * arg 0 must be the service classname
-   * @param argsList the list of arguments
-   */
-  public static void serviceMain(List<String> argsList) {
-    if (argsList.isEmpty()) {
-      exitWithMessage(EXIT_USAGE, USAGE_MESSAGE);
-    } else {
-      String serviceClassName = argsList.get(0);
-
-      if (LOG.isDebugEnabled()) {
-        LOG.debug(startupShutdownMessage(serviceClassName, argsList));
-        StringBuilder builder = new StringBuilder();
-        for (String arg : argsList) {
-          builder.append('"').append(arg).append("\" ");
-        }
-        LOG.debug(builder.toString());
-      }
-      Thread.setDefaultUncaughtExceptionHandler(
-        new YarnUncaughtExceptionHandler());
-
-      ServiceLauncher serviceLauncher = new ServiceLauncher<>(serviceClassName);
-      serviceLauncher.launchServiceAndExit(argsList);
-    }
-  }
-
-  /**
-   * This is the main entry point for the service launcher.
-   * @param args command line arguments.
-   */
-  public static void main(String[] args) {
-    List<String> argsList = Arrays.asList(args);
-    serviceMain(argsList);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/main/ServiceShutdownHook.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/main/ServiceShutdownHook.java b/slider-core/src/main/java/org/apache/slider/core/main/ServiceShutdownHook.java
deleted file mode 100644
index de55789..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/main/ServiceShutdownHook.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.core.main;
-
-import org.apache.hadoop.service.Service;
-import org.apache.hadoop.util.ShutdownHookManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.lang.ref.WeakReference;
-
-/**
- * JVM Shutdown hook for Service which will stop the
- * Service gracefully in case of JVM shutdown.
- * This hook uses a weak reference to the service, so
- * does not cause services to be retained after they have
- * been stopped and deferenced elsewhere.
- */
-public class ServiceShutdownHook implements Runnable {
-  private static final Logger LOG = LoggerFactory.getLogger(
-      ServiceShutdownHook.class);
-
-  private final WeakReference<Service> serviceRef;
-  private Runnable hook;
-
-  public ServiceShutdownHook(Service service) {
-    serviceRef = new WeakReference<>(service);
-  }
-
-  public void register(int priority) {
-    unregister();
-    hook = this;
-    ShutdownHookManager.get().addShutdownHook(hook, priority);
-  }
-
-  public synchronized void unregister() {
-    if (hook != null) {
-      try {
-        ShutdownHookManager.get().removeShutdownHook(hook);
-      } catch (IllegalStateException e) {
-        LOG.info("Failed to unregister shutdown hook: {}", e, e);
-      }
-      hook = null;
-    }
-  }
-
-  @Override
-  public void run() {
-    Service service;
-    synchronized (this) {
-      service = serviceRef.get();
-      serviceRef.clear();
-    }
-    if (service == null) {
-      return;
-    }
-    try {
-      // Stop the  Service
-      service.stop();
-    } catch (Throwable t) {
-      LOG.info("Error stopping {}", service.getName(), t);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/persist/AggregateConfSerDeser.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/persist/AggregateConfSerDeser.java b/slider-core/src/main/java/org/apache/slider/core/persist/AggregateConfSerDeser.java
deleted file mode 100644
index 90537b6..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/persist/AggregateConfSerDeser.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.persist;
-
-import org.apache.slider.core.conf.AggregateConf;
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-
-import java.io.IOException;
-
-/**
- * Conf tree to JSON binding
- */
-public class AggregateConfSerDeser extends JsonSerDeser<AggregateConf> {
-  public AggregateConfSerDeser() {
-    super(AggregateConf.class);
-  }
-
-
-  private static final AggregateConfSerDeser
-      staticinstance = new AggregateConfSerDeser();
-
-  /**
-   * Convert a tree instance to a JSON string -sync access to a shared ser/deser
-   * object instance
-   * @param instance object to convert
-   * @return a JSON string description
-   * @throws JsonParseException parse problems
-   * @throws JsonMappingException O/J mapping problems
-   */
-  public static String toString(AggregateConf instance) throws IOException,
-                                                          JsonGenerationException,
-                                                          JsonMappingException {
-    synchronized (staticinstance) {
-      return staticinstance.toJson(instance);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/persist/AppDefinitionPersister.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/persist/AppDefinitionPersister.java b/slider-core/src/main/java/org/apache/slider/core/persist/AppDefinitionPersister.java
deleted file mode 100644
index 7fb3158..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/persist/AppDefinitionPersister.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.persist;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.io.Files;
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.fs.Path;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.params.AbstractClusterBuildingActionArgs;
-import org.apache.slider.common.params.Arguments;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.providers.agent.AgentKeys;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Class to prepare and persist app and add-on definitions.
- *
- * In this case, the app definition and add-on definitions are auto-inferred from the user input rather than explicit
- * inclusion of application package in the config.
- *
- * Processing an app definition involves one or more of the following: - modify appConfig - package definition into a
- * temporary folder - upload to HDFS
- *
- * This class keeps track of all the required operations and allows them to be invoked by build operation
- */
-public class AppDefinitionPersister {
-  private static final Logger log =
-      LoggerFactory.getLogger(AppDefinitionPersister.class);
-
-  private final SliderFileSystem sliderFileSystem;
-  private List<AppDefinition> appDefinitions;
-
-  public AppDefinitionPersister(SliderFileSystem sliderFileSystem) {
-    this.sliderFileSystem = sliderFileSystem;
-    appDefinitions = new ArrayList<>();
-  }
-
-
-  /**
-   * Process the application package or folder by copying it to the cluster path
-   *
-   * @param appDefinition details of application package
-   *
-   * @throws BadConfigException
-   * @throws IOException
-   */
-  private void persistDefinitionPackageOrFolder(AppDefinition appDefinition)
-      throws BadConfigException, IOException {
-    if (!appDefinition.appDefPkgOrFolder.canRead()) {
-      throw new BadConfigException("Pkg/Folder cannot be accessed - "
-                                   + appDefinition.appDefPkgOrFolder.getAbsolutePath());
-    }
-
-    File src = appDefinition.appDefPkgOrFolder;
-    String targetName = appDefinition.pkgName;
-    log.debug("Package name: " + targetName);
-    if (appDefinition.appDefPkgOrFolder.isDirectory()) {
-      log.info("Processing app package/folder {} for {}",
-               appDefinition.appDefPkgOrFolder.getAbsolutePath(),
-               appDefinition.pkgName);
-      File tmpDir = Files.createTempDir();
-      File zipFile = new File(tmpDir.getCanonicalPath(), File.separator + appDefinition.pkgName);
-      SliderUtils.zipFolder(appDefinition.appDefPkgOrFolder, zipFile);
-      src = zipFile;
-    }
-
-    sliderFileSystem.getFileSystem().copyFromLocalFile(
-        false,
-        false,
-        new Path(src.toURI()),
-        new Path(appDefinition.targetFolderInFs, targetName));
-  }
-
-  public void persistPackages() throws BadConfigException, IOException {
-    for (AppDefinition appDefinition : appDefinitions) {
-      persistDefinitionPackageOrFolder(appDefinition);
-    }
-  }
-
-  public void processSuppliedDefinitions(String clustername,
-                                         AbstractClusterBuildingActionArgs buildInfo,
-                                         ConfTreeOperations appConf)
-      throws BadConfigException, IOException, BadCommandArgumentsException {
-    // if metainfo is provided add to the app instance
-    if (buildInfo.appMetaInfo != null || buildInfo.appMetaInfoJson != null) {
-      if (buildInfo.appMetaInfo != null && buildInfo.appMetaInfoJson != null) {
-        throw new BadConfigException("Both %s and %s cannot be specified",
-            Arguments.ARG_METAINFO, Arguments.ARG_METAINFO_JSON);
-      }
-
-      // Now we know that only one of either file or JSON is used
-      boolean isFileUsed = buildInfo.appMetaInfo != null ? true : false;
-      String argUsed = isFileUsed ? Arguments.ARG_METAINFO
-          : Arguments.ARG_METAINFO_JSON;
-
-      if (buildInfo.appDef != null) {
-        throw new BadConfigException("Both %s and %s cannot be specified",
-            argUsed, Arguments.ARG_APPDEF);
-      }
-      if (SliderUtils.isSet(appConf.getGlobalOptions().get(AgentKeys.APP_DEF))) {
-        throw new BadConfigException(
-            "%s cannot not be set if %s is specified in the cmd line ",
-            AgentKeys.APP_DEF, argUsed);
-      }
-
-      if (isFileUsed) {
-        if (!buildInfo.appMetaInfo.canRead() || !buildInfo.appMetaInfo.isFile()) {
-          throw new BadConfigException(
-              "Path specified with %s either cannot be read or is not a file",
-              Arguments.ARG_METAINFO);
-        }
-      } else {
-        if (StringUtils.isEmpty(buildInfo.appMetaInfoJson.trim())) {
-          throw new BadConfigException("Empty string specified with %s",
-              Arguments.ARG_METAINFO_JSON);
-        }
-      }
-
-      File tempDir = Files.createTempDir();
-      File pkgSrcDir = new File(tempDir, "default");
-      pkgSrcDir.mkdirs();
-      File destMetaInfo = new File(pkgSrcDir, "metainfo.json");
-      if (isFileUsed) {
-        if (buildInfo.appMetaInfo.getName().endsWith(".xml")) {
-          Files.copy(buildInfo.appMetaInfo, new File(pkgSrcDir, "metainfo.xml"));
-        } else {
-          Files.copy(buildInfo.appMetaInfo, destMetaInfo);
-        }
-      } else {
-        Files.write(
-            buildInfo.appMetaInfoJson.getBytes(Charset.forName("UTF-8")),
-            destMetaInfo);
-      }
-
-      Path appDirPath = sliderFileSystem.buildAppDefDirPath(clustername);
-      log.info("Using default app def path {}", appDirPath.toString());
-
-      appDefinitions.add(new AppDefinition(appDirPath, pkgSrcDir,
-          SliderKeys.DEFAULT_APP_PKG));
-      Path appDefPath = new Path(appDirPath, SliderKeys.DEFAULT_APP_PKG);
-      appConf.getGlobalOptions().set(AgentKeys.APP_DEF, appDefPath);
-      log.info("Setting app package to {}.", appDefPath);
-    }
-
-    if (buildInfo.appDef != null) {
-      if (SliderUtils.isSet(appConf.getGlobalOptions().get(AgentKeys.APP_DEF))) {
-        throw new BadConfigException("application.def must not be set if --appdef is provided.");
-      }
-
-      if (!buildInfo.appDef.exists()) {
-        throw new BadConfigException("--appdef is not a valid path.");
-      }
-
-      Path appDirPath = sliderFileSystem.buildAppDefDirPath(clustername);
-      appDefinitions.add(new AppDefinition(appDirPath, buildInfo.appDef, SliderKeys.DEFAULT_APP_PKG));
-      Path appDefPath = new Path(appDirPath, SliderKeys.DEFAULT_APP_PKG);
-      appConf.getGlobalOptions().set(AgentKeys.APP_DEF, appDefPath);
-      log.info("Setting app package to {}.", appDefPath);
-    }
-
-    if (buildInfo.addonDelegate.getAddonMap().size() > 0) {
-      if (SliderUtils.isUnset(appConf.getGlobalOptions().get(AgentKeys.APP_DEF))) {
-        throw new BadConfigException("addon package can only be specified if main app package is specified.");
-      }
-
-      List<String> addons = new ArrayList<String>();
-      Map<String, String> addonMap = buildInfo.addonDelegate.getAddonMap();
-      for (String key : addonMap.keySet()) {
-        File defPath = new File(addonMap.get(key));
-        if (SliderUtils.isUnset(addonMap.get(key))) {
-          throw new BadConfigException("Invalid path for addon package " + key);
-        }
-
-        if (!defPath.exists()) {
-          throw new BadConfigException("addon folder or package path is not valid.");
-        }
-
-        Path addonPath = sliderFileSystem.buildAddonDirPath(clustername, key);
-        String addonPkgName = "addon_" + key + ".zip";
-
-        log.debug(
-            "addonMap.get(key): {} addonPath: {} defPath: {} addonPkgName: {}",
-            addonMap.get(key), addonPath, defPath, addonPkgName);
-
-        appDefinitions.add(new AppDefinition(addonPath, defPath, addonPkgName));
-        String addOnKey = AgentKeys.ADDON_PREFIX + key;
-        Path addonPkgPath = new Path(addonPath, addonPkgName);
-        log.info("Setting addon package {} to {}.", addOnKey, addonPkgPath);
-        appConf.getGlobalOptions().set(addOnKey, addonPkgPath);
-        addons.add(addOnKey);
-      }
-
-      String existingList = appConf.getGlobalOptions().get(AgentKeys.ADDONS);
-      if (SliderUtils.isUnset(existingList)) {
-        existingList = "";
-      }
-      appConf.getGlobalOptions().set(AgentKeys.ADDONS, existingList + StringUtils.join(addons, ","));
-    }
-  }
-
-
-  @VisibleForTesting
-  public List<AppDefinitionPersister.AppDefinition> getAppDefinitions() {
-    return appDefinitions;
-  }
-
-  // Helper class to hold details for the app and addon packages
-  public class AppDefinition {
-    // The target folder where the package will be stored
-    public Path targetFolderInFs;
-    // The on disk location of the app def package or folder
-    public File appDefPkgOrFolder;
-    // Package name
-    public String pkgName;
-
-    public AppDefinition(Path targetFolderInFs, File appDefPkgOrFolder, String pkgName) {
-      this.targetFolderInFs = targetFolderInFs;
-      this.appDefPkgOrFolder = appDefPkgOrFolder;
-      this.pkgName = pkgName;
-    }
-
-    @Override
-    public String toString() {
-      return new StringBuilder().append("targetFolderInFs").append(" : ").append(targetFolderInFs.toString())
-          .append(", ")
-          .append("appDefPkgOrFolder").append(" : ").append(appDefPkgOrFolder.toString())
-          .append(", ")
-          .append("pkgName").append(" : ").append(pkgName).toString();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/persist/ApplicationReportSerDeser.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/persist/ApplicationReportSerDeser.java b/slider-core/src/main/java/org/apache/slider/core/persist/ApplicationReportSerDeser.java
deleted file mode 100644
index a8c72ce..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/persist/ApplicationReportSerDeser.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.persist;
-
-import org.apache.slider.core.launch.SerializedApplicationReport;
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-
-import java.io.IOException;
-
-/**
- * Persistence of {@link SerializedApplicationReport}
- * 
- */
-public class ApplicationReportSerDeser
-    extends JsonSerDeser<SerializedApplicationReport> {
-  public ApplicationReportSerDeser() {
-    super(SerializedApplicationReport.class);
-  }
-
-
-  private static final ApplicationReportSerDeser
-      staticinstance = new ApplicationReportSerDeser();
-
-  /**
-   * Convert an instance to a JSON string -sync access to a shared ser/deser
-   * object instance
-   * @param instance object to convert
-   * @return a JSON string description
-   * @throws JsonParseException parse problems
-   * @throws JsonMappingException O/J mapping problems
-   */
-  public static String toString(SerializedApplicationReport instance)
-      throws IOException, JsonGenerationException, JsonMappingException {
-    synchronized (staticinstance) {
-      return staticinstance.toJson(instance);
-    }
-  }
- 
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/persist/ConfPersister.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/persist/ConfPersister.java b/slider-core/src/main/java/org/apache/slider/core/persist/ConfPersister.java
deleted file mode 100644
index 9759205..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/persist/ConfPersister.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.persist;
-
-import com.google.common.annotations.VisibleForTesting;
-import org.apache.hadoop.fs.FileAlreadyExistsException;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.slider.common.tools.CoreFileSystem;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.exceptions.SliderException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Date;
-
-/**
- * Class to implement persistence of a configuration.
- *
- * This code contains the logic to acquire and release locks.
- * # writelock MUST be acquired exclusively for writes. This is done
- * by creating the file with no overwrite
- * # shared readlock MUST be acquired for reads. This is done by creating the readlock
- * file with overwrite forbidden -but treating a failure as a sign that
- * the lock exists, and therefore the operation can continue.
- * # releaselock is only released if the client created it.
- * # after acquiring either lock, client must check for the alternate lock
- * existing. If it is, release lock and fail.
- * 
- * There's one small race here: multiple readers; first reader releases lock
- * while second is in use. 
- * 
- * Strict Fix: client checks for readlock after read completed.
- * If it is not there, problem: fail. But this massively increases the risk of
- * false negatives.
- * 
- * This isn't 100% perfect, because of the condition where the owner releases
- * a lock, a writer grabs its lock & writes to it, the reader gets slightly
- * contaminated data:
- * own-share-delete-write-own-release(shared)-delete
- * 
- * We are assuming that the rate of change is low enough that this is rare, and
- * of limited damage.
- * 
- * ONCE A CLUSTER IS RUNNING, ONLY THE AM MAY PERSIST UPDATES VIA ITS APIs
- * 
- * That is: outside the AM, a writelock MUST only be acquired after verifying there is no
- * running application.
- */
-public class ConfPersister {
-  private static final Logger log =
-    LoggerFactory.getLogger(ConfPersister.class);
-
-
-  private final ConfTreeSerDeser confTreeSerDeser = new ConfTreeSerDeser();
-
-  private final CoreFileSystem coreFS;
-  private final FileSystem fileSystem;
-  private final Path persistDir;
-  private final Path internal, resources, app_conf;
-  private final Path writelock, readlock;
-
-  public ConfPersister(CoreFileSystem coreFS, Path persistDir) {
-    this.coreFS = coreFS;
-    this.persistDir = persistDir;
-    internal = new Path(persistDir, Filenames.INTERNAL);
-    resources = new Path(persistDir, Filenames.RESOURCES);
-    app_conf = new Path(persistDir, Filenames.APPCONF);
-    writelock = new Path(persistDir, Filenames.WRITELOCK);
-    readlock = new Path(persistDir, Filenames.READLOCK);
-    fileSystem = coreFS.getFileSystem();
-  }
-
-  /**
-   * Get the target directory
-   * @return the directory for persistence
-   */
-  public Path getPersistDir() {
-    return persistDir;
-  }
-
-  /**
-   * Make the persistent directory
-   * @throws IOException IO failure
-   */
-  public void mkPersistDir() throws IOException {
-    coreFS.getFileSystem().mkdirs(persistDir);
-  }
-  
-  @Override
-  public String toString() {
-    return "Persister to " + persistDir;
-  }
-
-  /**
-   * Acquire the writelock
-   * @throws IOException IO
-   * @throws LockAcquireFailedException
-   */
-  @VisibleForTesting
-  void acquireWritelock() throws IOException,
-                                 LockAcquireFailedException {
-    mkPersistDir();
-    long now = System.currentTimeMillis();
-    try {
-      coreFS.cat(writelock, false, new Date(now).toGMTString());
-    } catch (FileAlreadyExistsException e) {
-      // filesystems should raise this (HDFS does)
-      throw new LockAcquireFailedException(writelock);
-    } catch (IOException e) {
-      // some filesystems throw a generic IOE
-      throw new LockAcquireFailedException(writelock, e);
-    }
-    //here the lock is acquired, but verify there is no readlock
-    boolean lockFailure;
-    try {
-      lockFailure = readLockExists();
-    } catch (IOException e) {
-      lockFailure = true;
-    }
-    if (lockFailure) {
-      releaseWritelock();
-      throw new LockAcquireFailedException(readlock);
-    }
-  }
-
-  @VisibleForTesting
-  boolean readLockExists() throws IOException {
-    return fileSystem.exists(readlock);
-  }
-
-  /**
-   * Release the writelock if it is present.
-   * IOExceptions are logged
-   */
-  @VisibleForTesting
-  boolean releaseWritelock() {
-    try {
-      return fileSystem.delete(writelock, false);
-    } catch (IOException e) {
-      log.warn("IOException releasing writelock {} ", writelock, e);
-    }
-    return false;
-  }
-  
-  /**
-   * Acquire the writelock
-   * @throws IOException IO
-   * @throws LockAcquireFailedException
-   * @throws FileNotFoundException if the target dir does not exist.
-   */
-  @VisibleForTesting
-  boolean acquireReadLock() throws FileNotFoundException,
-                                  IOException,
-                                  LockAcquireFailedException {
-    if (!coreFS.getFileSystem().exists(persistDir)) {
-      // the dir is not there, so the data is not there, so there
-      // is nothing to read
-      throw new FileNotFoundException(persistDir.toString());
-    }
-    long now = System.currentTimeMillis();
-    boolean owner;
-    try {
-      coreFS.cat(readlock, false, new Date(now).toGMTString());
-      owner = true;
-    } catch (IOException e) {
-      owner = false;
-    }
-    //here the lock is acquired, but verify there is no readlock
-    boolean lockFailure;
-    try {
-      lockFailure = writelockExists();
-    } catch (IOException e) {
-      lockFailure = true;
-    }
-    if (lockFailure) {
-      releaseReadlock(owner);
-      throw new LockAcquireFailedException(writelock);
-    }
-    return owner;
-  }
-
-  @VisibleForTesting
-  boolean writelockExists() throws IOException {
-    return fileSystem.exists(writelock);
-  }
-
-  /**
-   * Release the writelock if it is present.
-   * IOExceptions are downgraded to failures
-   * @return true if the lock was present and then released  
-   */
-  @VisibleForTesting
-  boolean releaseReadlock(boolean owner) {
-    if (owner) {
-      try {
-        return fileSystem.delete(readlock, false);
-      } catch (IOException e) {
-        log.warn("IOException releasing writelock {} ", readlock, e);
-      }
-    }
-    return false;
-  }
-
-  private void saveConf(AggregateConf conf) throws IOException {
-    confTreeSerDeser.save(fileSystem, internal, conf.getInternal(), true);
-    confTreeSerDeser.save(fileSystem, resources, conf.getResources(), true);
-    confTreeSerDeser.save(fileSystem, app_conf, conf.getAppConf(), true);
-  }
-
-  private void loadConf(AggregateConf conf) throws IOException {
-    conf.setInternal(confTreeSerDeser.load(fileSystem, internal));
-    conf.setResources(confTreeSerDeser.load(fileSystem, resources));
-    conf.setAppConf(confTreeSerDeser.load(fileSystem, app_conf));
-  }
-
-
-  private void maybeExecLockHeldAction(LockHeldAction action) throws
-      IOException,
-      SliderException {
-    if (action != null) {
-      action.execute();
-    }
-  }
-  
-  /**
-   * Save the configuration
-   * @param conf configuration to fill in
-   * @param action
-   * @throws IOException IO problems
-   * @throws LockAcquireFailedException the lock could not be acquired
-   */
-  public void save(AggregateConf conf, LockHeldAction action) throws
-      IOException,
-      SliderException,
-      LockAcquireFailedException {
-    acquireWritelock();
-    try {
-      saveConf(conf);
-      maybeExecLockHeldAction(action);
-    } finally {
-      releaseWritelock();
-    }
-  }
-
-  /**
-   * Load the configuration. If a lock failure is raised, the 
-   * contents of the configuration MAY have changed -lock race conditions
-   * are looked for on exit
-   * @param conf configuration to fill in
-   * @throws IOException IO problems
-   * @throws LockAcquireFailedException the lock could not be acquired
-   */
-  public void load(AggregateConf conf) throws
-      FileNotFoundException,
-      IOException,
-      SliderException,
-      LockAcquireFailedException {
-    boolean owner = acquireReadLock();
-    try {
-      loadConf(conf);
-    } finally {
-      releaseReadlock(owner);
-    }
-  }
-  
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/persist/ConfTreeSerDeser.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/persist/ConfTreeSerDeser.java b/slider-core/src/main/java/org/apache/slider/core/persist/ConfTreeSerDeser.java
deleted file mode 100644
index 8271ef1..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/persist/ConfTreeSerDeser.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.persist;
-
-import org.apache.slider.core.conf.ConfTree;
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-
-import java.io.IOException;
-
-/**
- * Conf tree to JSON binding
- */
-public class ConfTreeSerDeser extends JsonSerDeser<ConfTree> {
-  public ConfTreeSerDeser() {
-    super(ConfTree.class);
-  }
-
-
-  private static final ConfTreeSerDeser staticinstance = new ConfTreeSerDeser();
-
-  /**
-   * Convert a tree instance to a JSON string -sync access to a shared ser/deser
-   * object instance
-   * @param instance object to convert
-   * @return a JSON string description
-   * @throws JsonParseException parse problems
-   * @throws JsonMappingException O/J mapping problems
-   */
-  public static String toString(ConfTree instance) throws IOException,
-                                                          JsonGenerationException,
-                                                          JsonMappingException {
-    synchronized (staticinstance) {
-      return staticinstance.toJson(instance);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/persist/Filenames.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/persist/Filenames.java b/slider-core/src/main/java/org/apache/slider/core/persist/Filenames.java
deleted file mode 100644
index 06ecc51..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/persist/Filenames.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.persist;
-
-public interface Filenames {
-
-  String RESOURCES = "resources.json";
-  String APPCONF = "app_config.json";
-  String INTERNAL = "internal.json";
-  String WRITELOCK = "writelock";
-  String READLOCK = "readlock";
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/persist/InstancePaths.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/persist/InstancePaths.java b/slider-core/src/main/java/org/apache/slider/core/persist/InstancePaths.java
deleted file mode 100644
index 3505ac3..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/persist/InstancePaths.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.persist;
-
-import org.apache.hadoop.fs.Path;
-import org.apache.slider.common.SliderKeys;
-
-/**
- * Build up all the paths of an instance relative to the supplied instance
- * directory.
- */
-public class InstancePaths {
-
-  public final Path instanceDir;
-  public final Path snapshotConfPath;
-  public final Path generatedConfPath;
-  public final Path historyPath;
-  public final Path dataPath;
-  public final Path tmpPath;
-  public final Path tmpPathAM;
-  public final Path appDefPath;
-  public final Path addonsPath;
-
-  public InstancePaths(Path instanceDir) {
-    this.instanceDir = instanceDir;
-    snapshotConfPath =
-      new Path(instanceDir, SliderKeys.SNAPSHOT_CONF_DIR_NAME);
-    generatedConfPath =
-      new Path(instanceDir, SliderKeys.GENERATED_CONF_DIR_NAME);
-    historyPath = new Path(instanceDir, SliderKeys.HISTORY_DIR_NAME);
-    dataPath = new Path(instanceDir, SliderKeys.DATA_DIR_NAME);
-    tmpPath = new Path(instanceDir, SliderKeys.TMP_DIR_PREFIX);
-    tmpPathAM = new Path(tmpPath, SliderKeys.AM_DIR_PREFIX);
-    appDefPath = new Path(tmpPath, SliderKeys.APP_DEF_DIR);
-    addonsPath = new Path(tmpPath, SliderKeys.ADDONS_DIR);
-  }
-
-  @Override
-  public String toString() {
-    return "instance at " + instanceDir;
-  }
-}



[07/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/jquery/jquery-1.8.2.min.js
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/jquery/jquery-1.8.2.min.js b/slider-core/src/main/resources/webapps/static/jquery/jquery-1.8.2.min.js
deleted file mode 100644
index bc3fbc8..0000000
--- a/slider-core/src/main/resources/webapps/static/jquery/jquery-1.8.2.min.js
+++ /dev/null
@@ -1,2 +0,0 @@
-/*! jQuery v1.8.2 jquery.com | jquery.org/license */
-(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(
 a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)p.event.add(b,c,h[c][d])}g.data&&(g.data=p.extend({},g.data))}function bE(a,b){var c;if(b.nodeType!==1)return;b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?(b.parentNode&&(b.outerHTML=a.outerHTML),p.support.html5Clone&&a.innerHTML&&!p.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):c==="input"&&bv.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="scri
 pt"&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(p.expando)}function bF(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bG(a){bv.test(a.type)&&(a.defaultChecked=a.checked)}function bY(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=bW.length;while(e--){b=bW[e]+c;if(b in a)return b}return d}function bZ(a,b){return a=b||a,p.css(a,"display")==="none"||!p.contains(a.ownerDocument,a)}function b$(a,b){var c,d,e=[],f=0,g=a.length;for(;f<g;f++){c=a[f];if(!c.style)continue;e[f]=p._data(c,"olddisplay"),b?(!e[f]&&c.style.display==="none"&&(c.style.display=""),c.style.display===""&&bZ(c)&&(e[f]=p._data(c,"olddisplay",cc(c.nodeName)))):(d=bH(c,"display"),!e[f]&&d!=="none"&&p._data(c,"olddisplay",d))}for(f=0;f<g;f++){c=a[f];if(!c.style)continue;if(!b||c.style.display==="none"||c.style.display==="")c.style.display=b?e[f]||"":"none"}return a}function b_(a,b,c){
 var d=bP.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function ca(a,b,c,d){var e=c===(d?"border":"content")?4:b==="width"?1:0,f=0;for(;e<4;e+=2)c==="margin"&&(f+=p.css(a,c+bV[e],!0)),d?(c==="content"&&(f-=parseFloat(bH(a,"padding"+bV[e]))||0),c!=="margin"&&(f-=parseFloat(bH(a,"border"+bV[e]+"Width"))||0)):(f+=parseFloat(bH(a,"padding"+bV[e]))||0,c!=="padding"&&(f+=parseFloat(bH(a,"border"+bV[e]+"Width"))||0));return f}function cb(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=!0,f=p.support.boxSizing&&p.css(a,"boxSizing")==="border-box";if(d<=0||d==null){d=bH(a,b);if(d<0||d==null)d=a.style[b];if(bQ.test(d))return d;e=f&&(p.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+ca(a,b,c||(f?"border":"content"),e)+"px"}function cc(a){if(bS[a])return bS[a];var b=p("<"+a+">").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.
 createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write("<!doctype html><html><body>"),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bS[a]=c,c}function ci(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||ce.test(a)?d(a,e):ci(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ci(a+"["+e+"]",b[e],c,d);else d(a,b)}function cz(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h<i;h++)d=g[h],f=/^\+/.test(d),f&&(d=d.substr(1)||"*"),e=a[d]=a[d]||[],e[f?"unshift":"push"](c)}}function cA(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h,i=a[f],j=0,k=i?i.length:0,l=a===cv;for(;j<k&&(l||!h);j++)h=i[j](c,d,e),typeof h=="string"&&(!l||g[h]?h=b:(c.dataTypes.unshift(h),h=cA(a,c,d,e,h,g)));return(l||!h)&&!g["*"]&&(h=cA(a,c,d,e,"*",g)),h}function cB(a,c){var d,e,f=p.ajaxSettings.flatOptions||{};f
 or(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&p.extend(!0,a,e)}function cC(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(f in k)f in d&&(c[k[f]]=d[f]);while(j[0]==="*")j.shift(),e===b&&(e=a.mimeType||c.getResponseHeader("content-type"));if(e)for(f in i)if(i[f]&&i[f].test(e)){j.unshift(f);break}if(j[0]in d)g=j[0];else{for(f in d){if(!j[0]||a.converters[f+" "+j[0]]){g=f;break}h||(h=f)}g=g||h}if(g)return g!==j[0]&&j.unshift(g),d[g]}function cD(a,b){var c,d,e,f,g=a.dataTypes.slice(),h=g[0],i={},j=0;a.dataFilter&&(b=a.dataFilter(b,a.dataType));if(g[1])for(c in a.converters)i[c.toLowerCase()]=a.converters[c];for(;e=g[++j];)if(e!=="*"){if(h!=="*"&&h!==e){c=i[h+" "+e]||i["* "+e];if(!c)for(d in i){f=d.split(" ");if(f[1]===e){c=i[h+" "+f[0]]||i["* "+f[0]];if(c){c===!0?c=i[d]:i[d]!==!0&&(e=f[0],g.splice(j--,0,e));break}}}if(c!==!0)if(c&&a["throws"])b=c(b);else try{b=c(b)}catch(k){return{state:"parsererror",error:c?k:"No conversion from "+h+" to "+e}}}h=e}return{sta
 te:"success",data:b}}function cL(){try{return new a.XMLHttpRequest}catch(b){}}function cM(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cU(){return setTimeout(function(){cN=b},0),cN=p.now()}function cV(a,b){p.each(b,function(b,c){var d=(cT[b]||[]).concat(cT["*"]),e=0,f=d.length;for(;e<f;e++)if(d[e].call(a,b,c))return})}function cW(a,b,c){var d,e=0,f=0,g=cS.length,h=p.Deferred().always(function(){delete i.elem}),i=function(){var b=cN||cU(),c=Math.max(0,j.startTime+j.duration-b),d=1-(c/j.duration||0),e=0,f=j.tweens.length;for(;e<f;e++)j.tweens[e].run(d);return h.notifyWith(a,[j,d,c]),d<1&&f?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:p.extend({},b),opts:p.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:cN||cU(),duration:c.duration,tweens:[],createTween:function(b,c,d){var e=p.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(e),e},stop:function(b){var c=0,d=b?j.tweens.length:0;for(;c<
 d;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;cX(k,j.opts.specialEasing);for(;e<g;e++){d=cS[e].call(j,a,k,j.opts);if(d)return d}return cV(j,k),p.isFunction(j.opts.start)&&j.opts.start.call(a,j),p.fx.timer(p.extend(i,{anim:j,queue:j.opts.queue,elem:a})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function cX(a,b){var c,d,e,f,g;for(c in a){d=p.camelCase(c),e=b[d],f=a[c],p.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=p.cssHooks[d];if(g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}}function cY(a,b,c){var d,e,f,g,h,i,j,k,l=this,m=a.style,n={},o=[],q=a.nodeType&&bZ(a);c.queue||(j=p._queueHooks(a,"fx"),j.unqueued==null&&(j.unqueued=0,k=j.empty.fire,j.empty.fire=function(){j.unqueued||k()}),j.unqueued++,l.always(function(){l.always(function(){j.unqueued--,p.queue(a,"fx").length||j.empty.fire()})})),a.nodeType===1&&("heig
 ht"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],p.css(a,"display")==="inline"&&p.css(a,"float")==="none"&&(!p.support.inlineBlockNeedsLayout||cc(a.nodeName)==="inline"?m.display="inline-block":m.zoom=1)),c.overflow&&(m.overflow="hidden",p.support.shrinkWrapBlocks||l.done(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b){f=b[d];if(cP.exec(f)){delete b[d];if(f===(q?"hide":"show"))continue;o.push(d)}}g=o.length;if(g){h=p._data(a,"fxshow")||p._data(a,"fxshow",{}),q?p(a).show():l.done(function(){p(a).hide()}),l.done(function(){var b;p.removeData(a,"fxshow",!0);for(b in n)p.style(a,b,n[b])});for(d=0;d<g;d++)e=o[d],i=l.createTween(e,q?h[e]:0),n[e]=h[e]||p.style(a,e),e in h||(h[e]=i.start,q&&(i.end=i.start,i.start=e==="width"||e==="height"?1:0))}}function cZ(a,b,c,d,e){return new cZ.prototype.init(a,b,c,d,e)}function c$(a,b){var c,d={height:a},e=0;b=b?1:0;for(;e<4;e+=2-b)c=bV[e],d["margin"+c]=d["padding"+c]=a;retur
 n b&&(d.opacity=d.width=a),d}function da(a){return p.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}var c,d,e=a.document,f=a.location,g=a.navigator,h=a.jQuery,i=a.$,j=Array.prototype.push,k=Array.prototype.slice,l=Array.prototype.indexOf,m=Object.prototype.toString,n=Object.prototype.hasOwnProperty,o=String.prototype.trim,p=function(a,b){return new p.fn.init(a,b,c)},q=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,r=/\S/,s=/\s+/,t=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init
 :function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.2",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);ret
 urn d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i<j;i++)if((a=arguments[i])!=null)for(c in a){d=h[c],e=a[c];if(h===e)con
 tinue;k&&e&&(p.isPlainObject(e)||(f=p.isArray(e)))?(f?(f=!1,g=d&&p.isArray(d)?d:[]):g=d&&p.isPlainObject(d)?d:{},h[c]=p.extend(k,g,e)):e!==b&&(h[c]=e)}return h},p.extend({noConflict:function(b){return a.$===p&&(a.$=i),b&&a.jQuery===p&&(a.jQuery=h),p},isReady:!1,readyWait:1,holdReady:function(a){a?p.readyWait++:p.ready(!0)},ready:function(a){if(a===!0?--p.readyWait:p.isReady)return;if(!e.body)return setTimeout(p.ready,1);p.isReady=!0;if(a!==!0&&--p.readyWait>0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructo
 r.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error(
 "Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f<g;)if(c.apply(a[f++],d)===!1)break}else if(h){for(e in a)if(c.call(a[e],e,a[e])===!1)break}else for(;f<g;)if(c.call(a[f],f,a[f++])===!1)break;return a},trim:o&&!o.call("\ufeff�")?function(a){return a==null?"":o.call(a)}:function(a){return a==null?"":(a+"").replace(t,"")},makeArray:function(a,b){var c,d=b||[];return a!=null&&(c=p.type(a),a.length==null||c==="string"||c==="function"||c==="regexp"||p.isWindow(a)?j.call(d,a):p.merge(d,a)),d},inArray:function(a,b,c){var d;if(b){if(l)return l.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-
 1},merge:function(a,c){var d=c.length,e=a.length,f=0;if(typeof d=="number")for(;f<d;f++)a[e++]=c[f];else while(c[f]!==b)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;c=!!c;for(;f<g;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,c,d){var e,f,g=[],h=0,i=a.length,j=a instanceof p||i!==b&&typeof i=="number"&&(i>0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h<i;h++)e=c(a[h],h,d),e!=null&&(g[g.length]=e);else for(f in a)e=c(a[f],f,d),e!=null&&(g[g.length]=e);return g.concat.apply([],g)},guid:1,proxy:function(a,c){var d,e,f;return typeof c=="string"&&(d=a[c],c=a,a=d),p.isFunction(a)?(e=k.call(arguments,2),f=function(){return a.apply(c,e.concat(k.call(arguments)))},f.guid=a.guid=a.guid||p.guid++,f):b},access:function(a,c,d,e,f,g,h){var i,j=d==null,k=0,l=a.length;if(d&&typeof d=="object"){for(k in d)p.access(a,c,k,d[k],1,g,e);f=1}else if(e!==b){i=h===b&&p.isFunction(e),j&&(i?(i=c,c=function(a,b,c){return i.call(p(a),c)}):(c.call(a,e),c=nu
 ll));if(c)for(;k<l;k++)c(a[k],d,i?e.call(a[k],k,c(a[k],d)):e,h);f=1}return f?a:j?c.call(a):l?c(a[0],d):g},now:function(){return(new Date).getTime()}}),p.ready.promise=function(b){if(!d){d=p.Deferred();if(e.readyState==="complete")setTimeout(p.ready,1);else if(e.addEventListener)e.addEventListener("DOMContentLoaded",D,!1),a.addEventListener("load",p.ready,!1);else{e.attachEvent("onreadystatechange",D),a.attachEvent("onload",p.ready);var c=!1;try{c=a.frameElement==null&&e.documentElement}catch(f){}c&&c.doScroll&&function g(){if(!p.isReady){try{c.doScroll("left")}catch(a){return setTimeout(g,50)}p.ready()}}()}}return d.promise(b)},p.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){E["[object "+b+"]"]=b.toLowerCase()}),c=p(e);var F={};p.Callbacks=function(a){a=typeof a=="string"?F[a]||G(a):p.extend({},a);var c,d,e,f,g,h,i=[],j=!a.once&&[],k=function(b){c=a.memory&&b,d=!0,h=f||0,f=0,g=i.length,e=!0;for(;i&&h<g;h++)if(i[h].apply(b[0],b[1])===!1&&a.st
 opOnFalse){c=!1;break}e=!1,i&&(j?j.length&&k(j.shift()):c?i=[]:l.disable())},l={add:function(){if(i){var b=i.length;(function d(b){p.each(b,function(b,c){var e=p.type(c);e==="function"&&(!a.unique||!l.has(c))?i.push(c):c&&c.length&&e!=="string"&&d(c)})})(arguments),e?g=i.length:c&&(f=b,k(c))}return this},remove:function(){return i&&p.each(arguments,function(a,b){var c;while((c=p.inArray(b,i,c))>-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once 
 memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return a!=null?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f
 .resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b<d;b++)c[b]&&p.isFunction(c[b].promise)?c[b].promise().done(g(b,j,c)).fail(f.reject).progress(g(b,i,h)):--e}return e||f.resolveWith(j,c),f.promise()}}),p.support=function(){var b,c,d,f,g,h,i,j,k,l,m,n=e.createElement("div");n.setAttribute("className","t"),n.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelec
 ted:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.ch
 ecked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-t
 op:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="<div></div>",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquer
 y+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||p.guid++:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e<f;e++)delete d[b[e]];if(!(c?K:p.isEmp
 tyObject)(d))return}}if(!c){delete h[i].data;if(!K(h[i]))return}g?p.cleanData([a],!0):p.support.deleteExpando||h!=h.window?delete h[i]:h[i]=null},_data:function(a,b,c){return p.data(a,b,c,!0)},acceptData:function(a){var b=a.nodeName&&p.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),p.fn.extend({data:function(a,c){var d,e,f,g,h,i=this[0],j=0,k=null;if(a===b){if(this.length){k=p.data(i);if(i.nodeType===1&&!p._data(i,"parsedAttrs")){f=i.attributes;for(h=f.length;j<h;j++)g=f[j].name,g.indexOf("data-")||(g=p.camelCase(g.substring(5)),J(i,g,k[g]));p._data(i,"parsedAttrs",!0)}}return k}return typeof a=="object"?this.each(function(){p.data(this,a)}):(d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!",p.access(this,function(c){if(c===b)return k=this.triggerHandler("getData"+e,[d[0]]),k===b&&i&&(k=p.data(i,a),k=J(i,a,k)),k===b&&d[1]?this.data(d[0]):k;d[1]=c,this.each(function(){var b=p(this);b.triggerHandler("setData"+e,d),p.data(this,a,c),b.triggerHandler(
 "changeData"+e,d)})},null,c,arguments.length>1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.length,e=c.shift(),f=p._queueHooks(a,b),g=function(){p.dequeue(a,b)};e==="inprogress"&&(e=c.shift(),d--),e&&(b==="fx"&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length<d?p.queue(this[0],a):c===b?this:this.each(function(){var b=p.queue(this,a,c);p._queueHooks(this,a),a==="fx"&&b[0]!=="inprogress"&&p.dequeue(this,a)})},dequeue:function(a)
 {return this.each(function(){p.dequeue(this,a)})},delay:function(a,b){return a=p.fx?p.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=p.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};typeof a!="string"&&(c=a,a=b),a=a||"fx";while(h--)d=p._data(g[h],a+"queueHooks"),d&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var L,M,N,O=/[\t\r\n]/g,P=/\r/g,Q=/^(?:button|input)$/i,R=/^(?:button|input|object|select|textarea)$/i,S=/^a(?:rea|)$/i,T=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,U=p.support.getSetAttribute;p.fn.extend({attr:function(a,b){return p.access(this,p.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,argume
 nts.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{f=" "+e.className+" ";for(g=0,h=b.length;g<h;g++)f.indexOf(" "+b[g]+" ")<0&&(f+=b[g]+" ");e.className=p.trim(f)}}}return this},removeClass:function(a){var c,d,e,f,g,h,i;if(p.isFunction(a))return this.each(function(b){p(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(s);for(h=0,i=this.length;h<i;h++){e=this[h];if(e.nodeType===1&&e.className){d=(" "+e.className+" ").replace(O," ");for(f=0,g=c.length;f<g;f++)while(d.indexOf(" "+c[f]+" ")>=0)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function
 (a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(O," ").indexOf(b)>=0)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f=
 =null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c<d;c++){e=h[c];if(e.selected&&(p.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!p.nodeName(e.parentNode,"optgroup"))){b=p(e).val();if(i)return b;g.push(b)}}return i&&!g.length&&h.length?p(h[f]).val():g},set:function(a,b){var c=p.makeArray(b);return p(a).find("option").each(function(){this.selected=p.inArray(p(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isF
 unction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,d+""),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g<d.length;g++)e=d[g],e&&(c=p.propFix[e]||e,f=T.test(e),f||p.attr(a,e,""),a.removeAttribute(U?e:c),f&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(Q.test(a.nodeName)&&a.parentNode)p.error("type property can't be changed");else if(!p.support.radioValue&&b==="radio"&&p.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}},value:{get:function(a,b){return L&&p.nodeName(a,"button")?L.get(a,b):b in a?a.value:null},set:function(a,b,c){if(L&&p.nodeName(a,"button"))return L.set(a,b,c);a.value
 =b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(!a||h===3||h===8||h===2)return;return g=h!==1||!p.isXMLDoc(a),g&&(c=p.propFix[c]||c,f=p.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&(e=f.get(a,c))!==null?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):R.test(a.nodeName)||S.test(a.nodeName)&&a.href?0:b}}}}),M={get:function(a,c){var d,e=p.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;return b===!1?p.removeAttr(a,c):(d=p.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase())),c}},U||(N={name:!0,id:!0,coords:!
 0},L=p.valHooks.button={get:function(a,c){var d;return d=a.getAttributeNode(c),d&&(N[c]?d.value!=="":d.specified)?d.value:b},set:function(a,b,c){var d=a.getAttributeNode(c);return d||(d=e.createAttribute(c),a.setAttributeNode(d)),d.value=b+""}},p.each(["width","height"],function(a,b){p.attrHooks[b]=p.extend(p.attrHooks[b],{set:function(a,c){if(c==="")return a.setAttribute(b,"auto"),c}})}),p.attrHooks.contenteditable={get:L.get,set:function(a,b,c){b===""&&(b="false"),L.set(a,b,c)}}),p.support.hrefNormalized||p.each(["href","src","width","height"],function(a,c){p.attrHooks[c]=p.extend(p.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),p.support.style||(p.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=b+""}}),p.support.optSelected||(p.propHooks.selected=p.extend(p.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),n
 ull}})),p.support.enctype||(p.propFix.enctype="encoding"),p.support.checkOn||p.each(["radio","checkbox"],function(){p.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),p.each(["radio","checkbox"],function(){p.valHooks[this]=p.extend(p.valHooks[this],{set:function(a,b){if(p.isArray(b))return a.checked=p.inArray(p(a).val(),b)>=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h
 .elem=a),c=p.trim(_(c)).split(" ");for(j=0;j<c.length;j++){k=W.exec(c[j])||[],l=k[1],m=(k[2]||"").split(".").sort(),r=p.event.special[l]||{},l=(f?r.delegateType:r.bindType)||l,r=p.event.special[l]||{},n=p.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,needsContext:f&&p.expr.match.needsContext.test(f),namespace:m.join(".")},o),q=i[l];if(!q){q=i[l]=[],q.delegateCount=0;if(!r.setup||r.setup.call(a,e,m,h)===!1)a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h)}r.add&&(r.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,n):q.push(n),p.event.global[l]=!0}a=null},global:{},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,q,r=p.hasData(a)&&p._data(a);if(!r||!(m=r.events))return;b=p.trim(_(b||"")).split(" ");for(f=0;f<b.length;f++){g=W.exec(b[f])||[],h=i=g[1],j=g[2];if(!h){for(h in m)p.event.remove(a,h+b[f],c,d,!0);continue}n=p.event.special[h]||{},h=(d?n.delegateType:n.bindType)||h,o=m[h]||[],k=o.l
 ength,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(l=0;l<o.length;l++)q=o[l],(e||i===q.origType)&&(!c||c.guid===q.guid)&&(!j||j.test(q.namespace))&&(!d||d===q.selector||d==="**"&&q.selector)&&(o.splice(l--,1),q.selector&&o.delegateCount--,n.remove&&n.remove.call(a,q));o.length===0&&k!==o.length&&((!n.teardown||n.teardown.call(a,j,r.handle)===!1)&&p.removeEvent(a,h,r.handle),delete m[h])}p.isEmptyObject(m)&&(delete r.handle,p.removeData(a,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,f,g){if(!f||f.nodeType!==3&&f.nodeType!==8){var h,i,j,k,l,m,n,o,q,r,s=c.type||c,t=[];if($.test(s+p.event.triggered))return;s.indexOf("!")>=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c
 .namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j<q.length&&!c.isPropagationStopped();j++)k=q[j][0],c.type=q[j][1],o=(p._data(k,"events")||{})[c.type]&&p._data(k,"handle"),o&&o.apply(k,d),o=m&&k[m],o&&p.acceptData(k)&&o.apply&&o.apply(k,d)===!1&&c.preventDefault();return c.type=s,!g&&!c.isDefaultPrevented()&&(!n._default||n._default.apply(f.ownerDocument,d)===!1)&&(s!=="click"||!p.nodeName(f,"a"))&&p.acceptData(f)&&m&&f[s]&&(s!=="focus"&&s!=="blur"||c.target.
 offsetWidth!==0)&&!p.isWindow(f)&&(l=f[m],l&&(f[m]=null),p.event.triggered=s,f[s](),p.event.triggered=b,l&&(f[m]=l)),c.result}return},dispatch:function(c){c=p.event.fix(c||a.event);var d,e,f,g,h,i,j,l,m,n,o=(p._data(this,"events")||{})[c.type]||[],q=o.delegateCount,r=k.call(arguments),s=!c.exclusive&&!c.namespace,t=p.event.special[c.type]||{},u=[];r[0]=c,c.delegateTarget=this;if(t.preDispatch&&t.preDispatch.call(this,c)===!1)return;if(q&&(!c.button||c.type!=="click"))for(f=c.target;f!=this;f=f.parentNode||this)if(f.disabled!==!0||c.type!=="click"){h={},j=[];for(d=0;d<q;d++)l=o[d],m=l.selector,h[m]===b&&(h[m]=l.needsContext?p(m,this).index(f)>=0:p.find(m,this,null,[f]).length),h[m]&&j.push(l);j.length&&u.push({elem:f,matches:j})}o.length>q&&u.push({elem:this,matches:o.slice(q)});for(d=0;d<u.length&&!c.isPropagationStopped();d++){i=u[d],c.currentTarget=i.elem;for(e=0;e<i.matches.length&&!c.isImmediatePropagationStopped();e++){l=i.matches[e];if(s||!c.namespace&&!l.namespace||c.namespac
 e_re&&c.namespace_re.test(l.namespace))c.data=l.data,c.handleObj=l,g=((p.event.special[l.origType]||{}).handle||l.handler).apply(i.elem,r),g!==b&&(c.result=g,g===!1&&(c.preventDefault(),c.stopPropagation()))}}return t.postDispatch&&t.postDispatch.call(this,c),c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,f,g,h=c.button,i=c.fromElement;return a.pageX==null&&c.clientX!=null&&(d=a.target.ownerDocument||e,f=d.documentElement,g=d.body,a.pageX=c.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=
 c.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?c.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0),a}},fix:function(a){if(a[p.expando])return a;var b,c,d=a,f=p.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=p.Event(d);for(b=g.length;b;)c=g[--b],a[c]=d[c];return a.target||(a.target=d.srcElement||e),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,f.filter?f.filter(a,d):a},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){p.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=p.extend(new p.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?p.event.trigger(e,null,b):p.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},p.event.handle=p.event.d
 ispatch,p.removeEvent=e.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]=="undefined"&&(a[d]=null),a.detachEvent(d,c))},p.Event=function(a,b){if(this instanceof p.Event)a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?bb:ba):this.type=a,b&&p.extend(this,b),this.timeStamp=a&&a.timeStamp||p.now(),this[p.expando]=!0;else return new p.Event(a,b)},p.Event.prototype={preventDefault:function(){this.isDefaultPrevented=bb;var a=this.originalEvent;if(!a)return;a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=bb;var a=this.originalEvent;if(!a)return;a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()},isDefaultPrevented:ba,isPropagati
 onStopped:ba,isImmediatePropagationStopped:ba},p.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){p.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj,g=f.selector;if(!e||e!==d&&!p.contains(d,e))a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b;return c}}}),p.support.submitBubbles||(p.event.special.submit={setup:function(){if(p.nodeName(this,"form"))return!1;p.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=p.nodeName(c,"input")||p.nodeName(c,"button")?c.form:b;d&&!p._data(d,"_submit_attached")&&(p.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),p._data(d,"_submit_attached",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&p.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(p.nodeName(this,"form"))return!1;p.event.remove(this,"._submit")}}),p.support.changeBubbles||(p.event.speci
 al.change={setup:function(){if(V.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")p.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),p.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),p.event.simulate("change",this,a,!0)});return!1}p.event.add(this,"beforeactivate._change",function(a){var b=a.target;V.test(b.nodeName)&&!p._data(b,"_change_attached")&&(p.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&p.event.simulate("change",this.parentNode,a,!0)}),p._data(b,"_change_attached",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){return p.event.remove(this,"._change"),!V.test(this.nodeName)}}),p.support.focusinBubbles||p.each({focus:"focusin",blur:"focusout"},function(
 a,b){var c=0,d=function(a){p.event.simulate(b,a.target,p.event.fix(a),!0)};p.event.special[b]={setup:function(){c++===0&&e.addEventListener(a,d,!0)},teardown:function(){--c===0&&e.removeEventListener(a,d,!0)}}}),p.fn.extend({on:function(a,c,d,e,f){var g,h;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(h in a)this.on(h,c,d,a[h],f);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=ba;else if(!e)return this;return f===1&&(g=e,e=function(a){return p().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=p.guid++)),this.each(function(){p.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,p(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if(typeof a=="object"){for(f in a)this.off(f,c,a[f]);return this}if(c===!1||typeof c=="function")d=c,c=b;return d===!1&&(d=b
 a),this.each(function(){p.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){return p(this.context).on(a,this.selector,b,c),this},die:function(a,b){return p(this.context).off(a,this.selector||"**",b),this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length===1?this.off(a,"**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){p.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return p.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||p.guid++,d=0,e=function(c){var e=(p._data(this,"lastToggle"+a.guid)||0)%d;return p._data(this,"lastToggle"+a.guid,e+1),c.preventDefault(),b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),p.each("blur focus focusin focusout load resize
  scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){p.fn[b]=function(a,c){return c==null&&(c=a,a=null),arguments.length>0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bc(a,b,c,d){c=c||[],b=b||r;var e,f,i,j,k=b.nodeType;if(!a||typeof a!="string")return c;if(k!==1&&k!==9)return[];i=g(b);if(!i&&!d)if(e=P.exec(a))if(j=e[1]){if(k===9){f=b.getElementById(j);if(!f||!f.parentNode)return c;if(f.id===j)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(j))&&h(b,f)&&f.id===j)return c.push(f),c}else{if(e[2])return w.apply(c,x.call(b.getElementsByTagName(a),0)),c;if((j=e[3])&&_&&b.getElementsByClassName)return w.apply(c,x.call(b.getElementsByClassName(j),0)),c}return bp(a.replace(L,"$1"),b,c,d,i)}function bd(a){return f
 unction(b){var c=b.nodeName.toLowerCase();return c==="input"&&b.type===a}}function be(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}}function bf(a){return z(function(b){return b=+b,z(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function bg(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}function bh(a,b){var c,d,f,g,h,i,j,k=C[o][a];if(k)return b?0:k.slice(0);h=a,i=[],j=e.preFilter;while(h){if(!c||(d=M.exec(h)))d&&(h=h.slice(d[0].length)),i.push(f=[]);c=!1;if(d=N.exec(h))f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=d[0].replace(L," ");for(g in e.filter)(d=W[g].exec(h))&&(!j[g]||(d=j[g](d,r,!0)))&&(f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=g,c.matches=d);if(!c)break}return b?h.length:h?bc.error(a):C(a,i).slice(0)}function bi(a,b,d){var e=b.dir,f=d&&b.dir==="parentNode",g=u++;return b.first?function(b,c,d){while(b=b[
 e])if(f||b.nodeType===1)return a(b,c,d)}:function(b,d,h){if(!h){var i,j=t+" "+g+" ",k=j+c;while(b=b[e])if(f||b.nodeType===1){if((i=b[o])===k)return b.sizset;if(typeof i=="string"&&i.indexOf(j)===0){if(b.sizset)return b}else{b[o]=k;if(a(b,d,h))return b.sizset=!0,b;b.sizset=!1}}}else while(b=b[e])if(f||b.nodeType===1)if(a(b,d,h))return b}}function bj(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function bk(a,b,c,d,e){var f,g=[],h=0,i=a.length,j=b!=null;for(;h<i;h++)if(f=a[h])if(!c||c(f,d,e))g.push(f),j&&b.push(h);return g}function bl(a,b,c,d,e,f){return d&&!d[o]&&(d=bl(d)),e&&!e[o]&&(e=bl(e,f)),z(function(f,g,h,i){if(f&&e)return;var j,k,l,m=[],n=[],o=g.length,p=f||bo(b||"*",h.nodeType?[h]:h,[],f),q=a&&(f||!b)?bk(p,m,a,h,i):p,r=c?e||(f?a:o||d)?[]:g:q;c&&c(q,r,h,i);if(d){l=bk(r,n),d(l,[],h,i),j=l.length;while(j--)if(k=l[j])r[n[j]]=!(q[n[j]]=k)}if(f){j=a&&r.length;while(j--)if(k=r[j])f[m[j]]=!(g[m[j]]=k)}else r=bk(r===g?r.splice(o,
 r.length):r),e?e(null,g,r,i):w.apply(g,r)})}function bm(a){var b,c,d,f=a.length,g=e.relative[a[0].type],h=g||e.relative[" "],i=g?1:0,j=bi(function(a){return a===b},h,!0),k=bi(function(a){return y.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==l)||((b=c).nodeType?j(a,c,d):k(a,c,d))}];for(;i<f;i++)if(c=e.relative[a[i].type])m=[bi(bj(m),c)];else{c=e.filter[a[i].type].apply(null,a[i].matches);if(c[o]){d=++i;for(;d<f;d++)if(e.relative[a[d].type])break;return bl(i>1&&bj(m),i>1&&a.slice(0,i-1).join("").replace(L,"$1"),c,i<d&&bm(a.slice(i,d)),d<f&&bm(a=a.slice(d)),d<f&&a.join(""))}m.push(c)}return bj(m)}function bn(a,b){var d=b.length>0,f=a.length>0,g=function(h,i,j,k,m){var n,o,p,q=[],s=0,u="0",x=h&&[],y=m!=null,z=l,A=h||f&&e.find.TAG("*",m&&i.parentNode||i),B=t+=z==null?1:Math.E;y&&(l=i!==r&&i,c=g.el);for(;(n=A[u])!=null;u++){if(f&&n){for(o=0;p=a[o];o++)if(p(n,i,j)){k.push(n);break}y&&(t=B,c=++g.el)}d&&((n=!p&&n)&&s--,h&&x.push(n))}s+=u;if(d&&u!==s){for(o=0;p=b[o];o++)p(x,q,i,j)
 ;if(h){if(s>0)while(u--)!x[u]&&!q[u]&&(q[u]=v.call(k));q=bk(q)}w.apply(k,q),y&&!h&&q.length>0&&s+b.length>1&&bc.uniqueSort(k)}return y&&(t=B,l=z),x};return g.el=0,d?z(g):g}function bo(a,b,c,d){var e=0,f=b.length;for(;e<f;e++)bc(a,b[e],c,d);return c}function bp(a,b,c,d,f){var g,h,j,k,l,m=bh(a),n=m.length;if(!d&&m.length===1){h=m[0]=m[0].slice(0);if(h.length>2&&(j=h[0]).type==="ID"&&b.nodeType===9&&!f&&e.relative[h[1].type]){b=e.find.ID(j.matches[0].replace(V,""),b,f)[0];if(!b)return c;a=a.slice(h.shift().length)}for(g=W.POS.test(a)?-1:h.length-1;g>=0;g--){j=h[g];if(e.relative[k=j.type])break;if(l=e.find[k])if(d=l(j.matches[0].replace(V,""),R.test(h[0].type)&&b.parentNode||b,f)){h.splice(g,1),a=d.length&&h.join("");if(!a)return w.apply(c,x.call(d,0)),c;break}}}return i(a,m)(d,b,f,c,R.test(a)),c}function bq(){}var c,d,e,f,g,h,i,j,k,l,m=!0,n="undefined",o=("sizcache"+Math.random()).replace(".",""),q=String,r=a.document,s=r.documentElement,t=0,u=0,v=[].pop,w=[].push,x=[].slice,y=[].index
 Of||function(a){var b=0,c=this.length;for(;b<c;b++)if(this[b]===a)return b;return-1},z=function(a,b){return a[o]=b==null||b,a},A=function(){var a={},b=[];return z(function(c,d){return b.push(c)>e.cacheLength&&delete a[b.shift()],a[c]=d},a)},B=A(),C=A(),D=A(),E="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",G=F.replace("w","w#"),H="([*^$|!~]?=)",I="\\["+E+"*("+F+")"+E+"*(?:"+H+E+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+G+")|)|)"+E+"*\\]",J=":("+F+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+I+")|[^:]|\\\\.)*|.*))\\)|)",K=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+E+"*((?:-\\d)?\\d*)"+E+"*\\)|)(?=[^-]|$)",L=new RegExp("^"+E+"+|((?:^|[^\\\\])(?:\\\\.)*)"+E+"+$","g"),M=new RegExp("^"+E+"*,"+E+"*"),N=new RegExp("^"+E+"*([\\x20\\t\\r\\n\\f>+~])"+E+"*"),O=new RegExp(J),P=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,Q=/^:not/,R=/[\x20\t\r\n\f]*[+~]/,S=/:not\($/,T=/h\d/i,U=/input|select|textarea|button/i,V=/\\(?!\\)/g,W={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.
 ("+F+")"),NAME:new RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:new RegExp("^("+F.replace("w","w*")+")"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+J),POS:new RegExp(K,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+E+"*(even|odd|(([+-]|)(\\d*)n|)"+E+"*(?:([+-]|)"+E+"*(\\d+)|))"+E+"*\\)|)","i"),needsContext:new RegExp("^"+E+"*[>+~]|"+K,"i")},X=function(a){var b=r.createElement("div");try{return a(b)}catch(c){return!1}finally{b=null}},Y=X(function(a){return a.appendChild(r.createComment("")),!a.getElementsByTagName("*").length}),Z=X(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!==n&&a.firstChild.getAttribute("href")==="#"}),$=X(function(a){a.innerHTML="<select></select>";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),_=X(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!a.getElementsByClassName||!a.getElementsByClassName("e").length?!1:(a.la
 stChild.className="e",a.getElementsByClassName("e").length===2)}),ba=X(function(a){a.id=o+0,a.innerHTML="<a name='"+o+"'></a><div name='"+o+"'></div>",s.insertBefore(a,s.firstChild);var b=r.getElementsByName&&r.getElementsByName(o).length===2+r.getElementsByName(o+0).length;return d=!r.getElementById(o),s.removeChild(a),b});try{x.call(s.childNodes,0)[0].nodeType}catch(bb){x=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}bc.matches=function(a,b){return bc(a,null,null,b)},bc.matchesSelector=function(a,b){return bc(b,null,null,[a]).length>0},f=bc.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=f(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=f(b);return c},g=bc.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},h=bc.contains=s.contains?function(a,b){var c=a.nodeType===9?a.documentEl
 ement:a,d=b&&b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:s.compareDocumentPosition?function(a,b){return b&&!!(a.compareDocumentPosition(b)&16)}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},bc.attr=function(a,b){var c,d=g(a);return d||(b=b.toLowerCase()),(c=e.attrHandle[b])?c(a):d||$?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},e=bc.selectors={cacheLength:50,createPseudo:z,match:W,attrHandle:Z?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},find:{ID:d?function(a,b,c){if(typeof b.getElementById!==n&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==n&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==n&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:Y?function(a,b){if(typeof b.getElementsByTagName!==n)return b.getElementsByTagNam
 e(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c},NAME:ba&&function(a,b){if(typeof b.getElementsByName!==n)return b.getElementsByName(name)},CLASS:_&&function(a,b,c){if(typeof b.getElementsByClassName!==n&&!c)return b.getElementsByClassName(a)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(V,""),a[3]=(a[4]||a[5]||"").replace(V,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||bc.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&bc.error(a[0]),a},PSEUDO:function(a){var b,c;if(W.CHILD.test(a[0]))return null;if(a[3])a[2]=a[3];else if(b=a[4])O.test(b)&&(c=bh(b,!0))&&(c=b.indexOf(")",b.length-c)-b.length)&&(b=b.slice(0,c),a[0]=a[0].sl
 ice(0,c)),a[2]=b;return a.slice(0,3)}},filter:{ID:d?function(a){return a=a.replace(V,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(V,""),function(b){var c=typeof b.getAttributeNode!==n&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(V,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=B[o][a];return b||(b=B(a,new RegExp("(^|"+E+")"+a+"("+E+"|$)"))),function(a){return b.test(a.className||typeof a.getAttribute!==n&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return function(d,e){var f=bc.attr(d,a);return f==null?b==="!=":b?(f+="",b==="="?f===c:b==="!="?f!==c:b==="^="?c&&f.indexOf(c)===0:b==="*="?c&&f.indexOf(c)>-1:b==="$="?c&&f.substr(f.length-c.length)===c:b==="~="?(" "+f+" ").indexOf(c)>-1:b==="|="?f===c||f.substr(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d){return a==="nth"?function(a){var b,e,f=a.parentNode;if
 (c===1&&d===0)return!0;if(f){e=0;for(b=f.firstChild;b;b=b.nextSibling)if(b.nodeType===1){e++;if(a===b)break}}return e-=d,e===c||e%c===0&&e/c>=0}:function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b){var c,d=e.pseudos[a]||e.setFilters[a.toLowerCase()]||bc.error("unsupported pseudo: "+a);return d[o]?d(b):d.length>1?(c=[a,a,"",b],e.setFilters.hasOwnProperty(a.toLowerCase())?z(function(a,c){var e,f=d(a,b),g=f.length;while(g--)e=y.call(a,f[g]),a[e]=!(c[e]=f[g])}):function(a){return d(a,0,c)}):d}},pseudos:{not:z(function(a){var b=[],c=[],d=i(a.replace(L,"$1"));return d[o]?z(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)if(f=g[h])a[h]=!(b[h]=f)}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:z(function(a){return function(b){return bc(a,b).length>0}}),contains:z(function(a){return function(b
 ){return(b.textContent||b.innerText||f(b)).indexOf(a)>-1}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!e.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},header:function(a){return T.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:bd("radio"),checkbox:bd("checkbox"),file:bd("file"),password:bd("password"),image:bd("image"),submit:be("submit"),reset:be("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return U.test(a.nodeName)
 },focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement},first:bf(function(a,b,c){return[0]}),last:bf(function(a,b,c){return[b-1]}),eq:bf(function(a,b,c){return[c<0?c+b:c]}),even:bf(function(a,b,c){for(var d=0;d<b;d+=2)a.push(d);return a}),odd:bf(function(a,b,c){for(var d=1;d<b;d+=2)a.push(d);return a}),lt:bf(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:bf(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},j=s.compareDocumentPosition?function(a,b){return a===b?(k=!0,0):(!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition:a.compareDocumentPosition(b)&4)?-1:1}:function(a,b){if(a===b)return k=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,h=b.parentNode,i=g;if(g===h)return bg(a,b);if(!g)return-1;if(!h)return 1;while(i)e.unshift(i),i=i.paren
 tNode;i=h;while(i)f.unshift(i),i=i.parentNode;c=e.length,d=f.length;for(var j=0;j<c&&j<d;j++)if(e[j]!==f[j])return bg(e[j],f[j]);return j===c?bg(a,f[j],-1):bg(e[j],b,1)},[0,0].sort(j),m=!k,bc.uniqueSort=function(a){var b,c=1;k=m,a.sort(j);if(k)for(;b=a[c];c++)b===a[c-1]&&a.splice(c--,1);return a},bc.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},i=bc.compile=function(a,b){var c,d=[],e=[],f=D[o][a];if(!f){b||(b=bh(a)),c=b.length;while(c--)f=bm(b[c]),f[o]?d.push(f):e.push(f);f=D(a,bn(e,d))}return f},r.querySelectorAll&&function(){var a,b=bp,c=/'|\\/g,d=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,e=[":focus"],f=[":active",":focus"],h=s.matchesSelector||s.mozMatchesSelector||s.webkitMatchesSelector||s.oMatchesSelector||s.msMatchesSelector;X(function(a){a.innerHTML="<select><option selected=''></option></select>",a.querySelectorAll("[selected]").length||e.push("\\["+E+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll("
 :checked").length||e.push(":checked")}),X(function(a){a.innerHTML="<p test=''></p>",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+E+"*(?:\"\"|'')"),a.innerHTML="<input type='hidden'/>",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=new RegExp(e.join("|")),bp=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a))){var i,j,k=!0,l=o,m=d,n=d.nodeType===9&&a;if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){i=bh(a),(k=d.getAttribute("id"))?l=k.replace(c,"\\$&"):d.setAttribute("id",l),l="[id='"+l+"'] ",j=i.length;while(j--)i[j]=l+i[j].join("");m=R.test(a)&&d.parentNode||d,n=i.join(",")}if(n)try{return w.apply(f,x.call(m.querySelectorAll(n),0)),f}catch(p){}finally{k||d.removeAttribute("id")}}return b(a,d,f,g,h)},h&&(X(function(b){a=h.call(b,"div");try{h.call(b,"[test!='']:sizzle"),f.push("!=",J)}catch(c){}}),f=new RegExp(f.join("|")),bc.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!g(b)&&!f.test(c)&&(!e||!e.test(c)))try{var i=h.call(b,c);if(
 i||a||b.document&&b.document.nodeType!==11)return i}catch(j){}return bc(c,null,null,[b]).length>0})}(),e.pseudos.nth=e.pseudos.eq,e.filters=bq.prototype=e.pseudos,e.setFilters=new bq,bc.attr=p.attr,p.find=bc,p.expr=bc.selectors,p.expr[":"]=p.expr.pseudos,p.unique=bc.uniqueSort,p.text=bc.getText,p.isXMLDoc=bc.isXML,p.contains=bc.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b<c;b++)if(p.contains(h[b],this))return!0});g=this.pushStack("","find",a);for(b=0,c=this.length;b<c;b++){d=g.length,p.find(a,this[b],g);if(b>0)for(e=d;e<g.length;e++)for(f=0;f<d;f++)if(g[f]===g[e]){g.splice(e--,1);break}}return g},has:function(a){var b,c=p(a,this),d=c.length;return this.filter(function(){for(b=0;b<d;b++)if(p.contains(this,c[b]))return!0})},not:function(a){return th
 is.pushStack(bj(this,a,!1),"not",a)},filter:function(a){return this.pushStack(bj(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?bf.test(a)?p(a,this.context).index(this[0])>=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d<e;d++){c=this[d];while(c&&c.ownerDocument&&c!==b&&c.nodeType!==11){if(g?g.index(c)>-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSel
 f=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,
 a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/<tbody/i,br=/<|&#?\w+;/,bs=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,bu=new RegExp("<(?:"+bl+")[\\s/>]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,bz={option:
 [1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X<div>","</div>"]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.fir
 stChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(th
 is[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["
 ",""])[1].toLowerCase()]){a=a.replace(bo,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return bh(this[0])?this.length?this.pushStack(p(p.isFunction(a)?a():a),"replaceWith",a):this:p.isFunction(a)?this.each(function(b){var c=p(this),d=c.html();c.replaceWith(a.call(this,b,d))}):(typeof a!="string"&&(a=p(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;p(this).remove(),b?p(b).before(a):p(c).append(a)}))},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=[].concat.apply([],a);var e,f,g,h,i=0,j=a[0],k=[],l=this.length;if(!p.support.checkClone&&l>1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this
 ,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i<l;i++)d.call(c&&p.nodeName(this[i],"table")?bC(this[i],"tbody"):this[i],i===h?g:p.clone(g,!0,!0))}g=f=null,k.length&&p.each(k,function(a,b){b.src?p.ajax?p.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):p.error("no ajax"):p.globalEval((b.text||b.textContent||b.innerHTML||"").replace(by,"")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),p.buildFragment=function(a,c,d){var f,g,h,i=a[0];return c=c||e,c=!c.nodeType&&c[0]||c,c=c.ownerDocument||c,a.length===1&&typeof i=="string"&&i.length<512&&c===e&&i.charAt(0)==="<"&&!bt.test(i)&&(p.support.checkClone||!bw.test(i))&&(p.support.html5Clone||!bu.test(i))&&(g=!0,f=p.fragments[i],h=f!==b),f||(f=c.createDocumentFragment(),p.clean(a,c,f,d),g&&(p.fragments[i]=h&&f)),{fragment:f,cacheable:g}},p.fragments={},p.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"
 after",replaceAll:"replaceWith"},function(a,b){p.fn[a]=function(c){var d,e=0,f=[],g=p(c),h=g.length,i=this.length===1&&this[0].parentNode;if((i==null||i&&i.nodeType===11&&i.childNodes.length===1)&&h===1)return g[b](this[0]),this;for(;e<h;e++)d=(e>0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=b===e&&bA,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(f=0;(h=a[f])!=null;f++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h==
 "string")if(!br.test(h))h=b.createTextNode(h);else{s=s||bk(b),l=b.createElement("div"),s.appendChild(l),h=h.replace(bo,"<$1></$2>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]==="<table>"&&!m?l.childNodes:[];for(g=n.length-1;g>=0;--g)p.nodeName(n[g],"tbody")&&!n[g].childNodes.length&&n[g].parentNode.removeChild(n[g])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l.parentNode.removeChild(l)}h.nodeType?t.push(h):p.merge(t,h)}l&&(h=l=s=null);if(!p.support.appendChecked)for(f=0;(h=t[f])!=null;f++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(f=0;(h=t[f])!=
 null;f++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[f+1,0].concat(r)),f+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.chrome?b
 .webkit=!0:b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^(none|table(?!-c[ea]).+)/,bO=/^margin/,bP=new RegExp("^("+q+")(.*)$","i"),bQ=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bR=new RegExp("^([-+])=("+q+")","i"),bS={},bT={position:"absolute",visibility:"hidden",display:"block"},bU={letterSpacing:0,fontWeight:400},bV=["Top","Right","Bottom","Left"],bW=["Webkit","O","Moz","ms"],bX=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return b$(this,!0)},hide:function(){return b$(this)},toggle:f
 unction(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bX.apply(this,arguments):this.each(function(){(c?a:bZ(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bY(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bR.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps
 [i]||(p.cssProps[i]=bY(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bU&&(f=bU[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(b,c){var d,e,f,g,h=a.getComputedStyle(b,null),i=b.style;return h&&(d=h[c],d===""&&!p.contains(b.ownerDocument,b)&&(d=p.style(b,c)),bQ.test(d)&&bO.test(c)&&(e=i.width,f=i.minWidth,g=i.maxWidth,i.minWidth=i.maxWidth=i.width=d,d=h.width,i.width=e,i.minWidth=f,i.maxWidth=g)),d}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bQ.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}
 ),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth===0&&bN.test(bH(a,"display"))?p.swap(a,bT,function(){return cb(a,b,d)}):cb(a,b,d)},set:function(a,c,d){return b_(a,c,d?ca(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"
 ],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bQ.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bV[d]+b]=e[d]||e[d-2]||e[0];return f}},bO.test(a)||(p.cssHooks[a+b].set=b_)});var cd=/%20/g,ce=/\[\]$/,cf=/\r?\n/g,cg=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ch=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(fun
 ction(){return this.name&&!this.disabled&&(this.checked||ch.test(this.nodeName)||cg.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(cf,"\r\n")}}):{name:b.name,value:c.replace(cf,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ci(d,a[d],c,f);return e.join("&").replace(cd,"+")};var cj,ck,cl=/#.*$/,cm=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,co=/^(?:GET|HEAD)$/,cp=/^\/\//,cq=/\?/,cr=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,cs=/([?&])_=[^&]*/,ct=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,cu=p.fn.load,cv={},cw={},cx=["*/"]+["*"];try{ck=f.href
 }catch(cy){ck=e.createElement("a"),ck.href="",ck=ck.href}cj=ct.exec(ck.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&cu)return cu.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):c&&typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("<div>").append(a.replace(cr,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cB(a,p
 .ajaxSettings):(b=a,a=p.ajaxSettings),cB(a,b),a},ajaxSettings:{url:ck,isLocal:cn.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cx},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cz(cv),ajaxTransport:cz(cw),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cC(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cD(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",
 a<0&&(a=0)}x.status=a,x.statusText=(c||y)+"",k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cm.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.
 statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(cl,"").replace(cp,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=ct.exec(l.url.toLowerCase())||!1,l.crossDomain=i&&i.join(":")+(i[3]?"":i[1]==="http:"?80:443)!==cj.join(":")+(cj[3]?"":cj[1]==="http:"?80:443)),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cA(cv,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!co.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cq.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cs,"$1_="+z);l.url=A+(A===l.url?(cq.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.s
 etRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cx+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cA(cw,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cE=[],cF=/\?/,cG=/(=)\?(?=&|$)|\?\?/,cH=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cE.pop()||p.expando+"_"+cH++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cG.test(
 j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cG.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cG,"$1"+f):m?c.data=i.replace(cG,"$1"+f):k&&(c.url+=(cF.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cE.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain
 ){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cI,cJ=a.ActiveXObject?function(){for(var a in cI)cI[a](0,1)}:!1,cK=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cL()||cM()}:cL,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.m
 imeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cJ&&delete cI[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cK,cJ&&(cI||(cI={},p(a).unload(cJ)),cI[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cN,cO,cP=/^(?:toggle|show|hide)$/,cQ=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cR=/queueHooks$/,cS=[cY],cT={"*":[function(a,b){var c,d,e=this.createTween(a,b),f=cQ.exec(b),g=e.cur(),h=+g||
 0,i=1,j=20;if(f){c=+f[2],d=f[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&h){h=p.css(e.elem,a,!0)||c||1;do i=i||".5",h=h/i,p.style(e.elem,a,h+d);while(i!==(i=e.cur()/g)&&i!==1&&--j)}e.unit=d,e.start=h,e.end=f[1]?h+(f[1]+1)*c:c}return e}]};p.Animation=p.extend(cW,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d<e;d++)c=a[d],cT[c]=cT[c]||[],cT[c].unshift(b)},prefilter:function(a,b){b?cS.unshift(a):cS.push(a)}}),p.Tween=cZ,cZ.prototype={constructor:cZ,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(p.cssNumber[c]?"":"px")},cur:function(){var a=cZ.propHooks[this.prop];return a&&a.get?a.get(this):cZ.propHooks._default.get(this)},run:function(a){var b,c=cZ.propHooks[this.prop];return this.options.duration?this.pos=b=p.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this
 .options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):cZ.propHooks._default.set(this),this}},cZ.prototype.init.prototype=cZ.prototype,cZ.propHooks={_default:{get:function(a){var b;return a.elem[a.prop]==null||!!a.elem.style&&a.elem.style[a.prop]!=null?(b=p.css(a.elem,a.prop,!1,""),!b||b==="auto"?0:b):a.elem[a.prop]},set:function(a){p.fx.step[a.prop]?p.fx.step[a.prop](a):a.elem.style&&(a.elem.style[p.cssProps[a.prop]]!=null||p.cssHooks[a.prop])?p.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},cZ.propHooks.scrollTop=cZ.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},p.each(["toggle","show","hide"],function(a,b){var c=p.fn[b];p.fn[b]=function(d,e,f){return d==null||typeof d=="boolean"||!a&&p.isFunction(d)&&p.isFunction(e)?c.apply(this,arguments):this.animate(c$(b,!0),d,e,f)}}),p.fn.extend({fadeTo:function(a,b,c,d){return this.filter(bZ).css("opacity",0).show().end().animate({opacity:b},a,c,d)},a
 nimate:function(a,b,c,d){var e=p.isEmptyObject(a),f=p.speed(b,c,d),g=function(){var b=cW(this,p.extend({},a),f);e&&b.stop(!0)};return e||f.queue===!1?this.each(g):this.que

<TRUNCATED>


[29/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/restclient/HttpVerb.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/restclient/HttpVerb.java b/slider-core/src/main/java/org/apache/slider/core/restclient/HttpVerb.java
deleted file mode 100644
index c040345..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/restclient/HttpVerb.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.restclient;
-
-/**
- * Http verbs with details on what they support in terms of submit and
- * response bodies.
- * <p>
- * Those verbs which do support bodies in the response MAY NOT return it;
- * if the response code is 204 then the answer is "no body", but the operation
- * is considered a success.
- */
-public enum HttpVerb {
-  GET("GET", false, true),
-  POST("POST", true, true),
-  PUT("PUT", true, true),
-  DELETE("DELETE", false, true),
-  HEAD("HEAD", false, false);
-  
-  private final String verb;
-  private final boolean hasUploadBody;
-  private final boolean hasResponseBody;
-
-  HttpVerb(String verb, boolean hasUploadBody, boolean hasResponseBody) {
-    this.verb = verb;
-    this.hasUploadBody = hasUploadBody;
-    this.hasResponseBody = hasResponseBody;
-  }
-
-  public String getVerb() {
-    return verb;
-  }
-
-  public boolean hasUploadBody() {
-    return hasUploadBody;
-  }
-
-  public boolean hasResponseBody() {
-    return hasResponseBody;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/restclient/SliderURLConnectionFactory.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/restclient/SliderURLConnectionFactory.java b/slider-core/src/main/java/org/apache/slider/core/restclient/SliderURLConnectionFactory.java
deleted file mode 100644
index e453f52..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/restclient/SliderURLConnectionFactory.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.restclient;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hdfs.web.KerberosUgiAuthenticator;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.security.authentication.client.AuthenticatedURL;
-import org.apache.hadoop.security.authentication.client.AuthenticationException;
-import org.apache.hadoop.security.authentication.client.ConnectionConfigurator;
-import org.apache.hadoop.security.ssl.SSLFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLSocketFactory;
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLConnection;
-import java.security.GeneralSecurityException;
-
-/**
- * Factory for URL connections; used behind the scenes in the Jersey integration.
- * <p>
- * Derived from the WebHDFS implementation.
- */
-public class SliderURLConnectionFactory {
-  private static final Logger log =
-      LoggerFactory.getLogger(SliderURLConnectionFactory.class);
-
-  /**
-   * Timeout for socket connects and reads
-   */
-  public final static int DEFAULT_SOCKET_TIMEOUT = 60 * 1000; // 1 minute
-  private final ConnectionConfigurator connConfigurator;
-
-  private static final ConnectionConfigurator DEFAULT_CONFIGURATOR = new BasicConfigurator();
-
-  /**
-   * Construct a new URLConnectionFactory based on the configuration. It will
-   * try to load SSL certificates when it is specified.
-   */
-  public static SliderURLConnectionFactory newInstance(Configuration conf) {
-    ConnectionConfigurator conn;
-    try {
-      conn = newSslConnConfigurator(DEFAULT_SOCKET_TIMEOUT, conf);
-    } catch (Exception e) {
-      log.debug("Cannot load customized SSL configuration.", e);
-      conn = DEFAULT_CONFIGURATOR;
-    }
-    return new SliderURLConnectionFactory(conn);
-  }
-
-  private SliderURLConnectionFactory(ConnectionConfigurator connConfigurator) {
-    this.connConfigurator = connConfigurator;
-  }
-
-  /**
-   * Create a new ConnectionConfigurator for SSL connections
-   */
-  private static ConnectionConfigurator newSslConnConfigurator(final int timeout,
-      Configuration conf) throws IOException, GeneralSecurityException {
-    final SSLFactory factory;
-    final SSLSocketFactory sf;
-    final HostnameVerifier hv;
-
-    factory = new SSLFactory(SSLFactory.Mode.CLIENT, conf);
-    factory.init();
-    sf = factory.createSSLSocketFactory();
-    hv = factory.getHostnameVerifier();
-
-    return new ConnectionConfigurator() {
-      @Override
-      public HttpURLConnection configure(HttpURLConnection conn)
-          throws IOException {
-        if (conn instanceof HttpsURLConnection) {
-          HttpsURLConnection c = (HttpsURLConnection) conn;
-          c.setSSLSocketFactory(sf);
-          c.setHostnameVerifier(hv);
-        }
-        SliderURLConnectionFactory.setupConnection(conn, timeout);
-        return conn;
-      }
-    };
-  }
-
-  /**
-   * Opens a url with read and connect timeouts
-   *
-   * @param url
-   *          to open
-   * @return URLConnection
-   * @throws IOException
-   */
-  public URLConnection openConnection(URL url) throws IOException {
-    try {
-      return openConnection(url, false);
-    } catch (AuthenticationException e) {
-      // Unreachable
-      return null;
-    }
-  }
-
-  /**
-   * Opens a url with read and connect timeouts
-   *
-   * @param url
-   *          URL to open
-   * @param isSpnego
-   *          whether the url should be authenticated via SPNEGO
-   * @return URLConnection
-   * @throws IOException
-   * @throws AuthenticationException
-   */
-  public URLConnection openConnection(URL url, boolean isSpnego)
-      throws IOException, AuthenticationException {
-    if (isSpnego) {
-        log.debug("open AuthenticatedURL connection {}", url);
-      UserGroupInformation.getCurrentUser().checkTGTAndReloginFromKeytab();
-      final AuthenticatedURL.Token authToken = new AuthenticatedURL.Token();
-      return new AuthenticatedURL(new KerberosUgiAuthenticator(),
-          connConfigurator).openConnection(url, authToken);
-    } else {
-      log.debug("open URL connection {}", url);
-      URLConnection connection = url.openConnection();
-      if (connection instanceof HttpURLConnection) {
-        connConfigurator.configure((HttpURLConnection) connection);
-      }
-      return connection;
-    }
-  }
-
-  /**
-   * Sets connection parameters on the given URLConnection
-   * 
-   * @param connection
-   *          URLConnection to set
-   * @param socketTimeout
-   *          the connection and read timeout of the connection.
-   */
-  private static void setupConnection(URLConnection connection, int socketTimeout) {
-    connection.setConnectTimeout(socketTimeout);
-    connection.setReadTimeout(socketTimeout);
-    connection.setUseCaches(false);
-    if (connection instanceof HttpURLConnection) {
-      ((HttpURLConnection) connection).setInstanceFollowRedirects(true);
-    }
-  }
-
-  private static class BasicConfigurator implements ConnectionConfigurator {
-    @Override
-    public HttpURLConnection configure(HttpURLConnection conn)
-        throws IOException {
-      SliderURLConnectionFactory.setupConnection(conn, DEFAULT_SOCKET_TIMEOUT);
-      return conn;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java b/slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java
deleted file mode 100644
index bf71861..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.restclient;
-
-import com.google.common.base.Preconditions;
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.api.json.JSONConfiguration;
-import com.sun.jersey.client.urlconnection.HttpURLConnectionFactory;
-import com.sun.jersey.client.urlconnection.URLConnectionClientHandler;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.security.authentication.client.AuthenticationException;
-import org.apache.slider.core.exceptions.ExceptionConverter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-/**
- * Class to bond to a Jersey client, for UGI integration and SPNEGO.
- * <p>
- *   Usage: create an instance, then when creating a Jersey <code>Client</code>
- *   pass in to the constructor the handler provided by {@link #getHandler()}
- *
- * see <a href="https://jersey.java.net/apidocs/1.17/jersey/com/sun/jersey/client/urlconnection/HttpURLConnectionFactory.html">Jersey docs</a>
- */
-public class UgiJerseyBinding implements
-    HttpURLConnectionFactory {
-  private static final Logger log =
-      LoggerFactory.getLogger(UgiJerseyBinding.class);
-
-  private final UrlConnectionOperations operations;
-  private final URLConnectionClientHandler handler;
-
-  /**
-   * Construct an instance
-   * @param operations operations instance
-   */
-  @SuppressWarnings("ThisEscapedInObjectConstruction")
-  public UgiJerseyBinding(UrlConnectionOperations operations) {
-    Preconditions.checkArgument(operations != null, "Null operations");
-    this.operations = operations;
-    handler = new URLConnectionClientHandler(this);
-  }
-
-  /**
-   * Create an instance off the configuration. The SPNEGO policy
-   * is derived from the current UGI settings.
-   * @param conf config
-   */
-  public UgiJerseyBinding(Configuration conf) {
-    this(new UrlConnectionOperations(conf));
-  }
-
-  /**
-   * Get a URL connection. 
-   * @param url URL to connect to
-   * @return the connection
-   * @throws IOException any problem. {@link AuthenticationException} 
-   * errors are wrapped
-   */
-  @Override
-  public HttpURLConnection getHttpURLConnection(URL url) throws IOException {
-    try {
-      // open a connection handling status codes and so redirections
-      // but as it opens a connection, it's less useful than you think.
-
-      return operations.openConnection(url);
-    } catch (AuthenticationException e) {
-      throw new IOException(e);
-    }
-  }
-
-  public UrlConnectionOperations getOperations() {
-    return operations;
-  }
-
-  public URLConnectionClientHandler getHandler() {
-    return handler;
-  }
-  
-  /**
-   * Get the SPNEGO flag (as found in the operations instance
-   * @return the spnego policy
-   */
-  public boolean isUseSpnego() {
-    return operations.isUseSpnego();
-  }
-
-
-  /**
-   * Uprate error codes 400 and up into faults; 
-   * <p>
-   * see {@link ExceptionConverter#convertJerseyException(String, String, UniformInterfaceException)}
-   */
-  public static IOException uprateFaults(HttpVerb verb, String url,
-      UniformInterfaceException ex)
-      throws IOException {
-    return ExceptionConverter.convertJerseyException(verb.getVerb(),
-        url, ex);
-  }
-
-  /**
-   * Create the standard Jersey client Config
-   * @return the recommended Jersey Client config
-   */
-  public ClientConfig createJerseyClientConfig() {
-    ClientConfig clientConfig = new DefaultClientConfig();
-    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, true);
-    return clientConfig;
-  }
-
-  /**
-   * Create a jersey client bonded to this handler, using the
-   * supplied client config
-   * @param clientConfig client configuratin
-   * @return a new client instance to use
-   */
-  public Client createJerseyClient(ClientConfig clientConfig) {
-    return new Client(getHandler(), clientConfig);
-  }
-
-  /**
-   * Create a jersey client bonded to this handler, using the
-   * client config created with {@link #createJerseyClientConfig()}
-   * @return a new client instance to use
-   */
-  public Client createJerseyClient() {
-    return createJerseyClient(createJerseyClientConfig());
-  }
-
-}
-
-

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/restclient/UrlConnectionOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/restclient/UrlConnectionOperations.java b/slider-core/src/main/java/org/apache/slider/core/restclient/UrlConnectionOperations.java
deleted file mode 100644
index 20ef198..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/restclient/UrlConnectionOperations.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.restclient;
-
-import com.google.common.base.Preconditions;
-import org.apache.commons.io.IOUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.conf.Configured;
-import org.apache.hadoop.net.NetUtils;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.security.authentication.client.AuthenticationException;
-import org.apache.hadoop.yarn.webapp.ForbiddenException;
-import org.apache.hadoop.yarn.webapp.NotFoundException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.net.ssl.SSLException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-/**
- * Operations on the JDK UrlConnection class.
- *
- */
-public class UrlConnectionOperations extends Configured  {
-  private static final Logger log =
-      LoggerFactory.getLogger(UrlConnectionOperations.class);
-
-  private SliderURLConnectionFactory connectionFactory;
-
-  private boolean useSpnego = false;
-
-  /**
-   * Create an instance off the configuration. The SPNEGO policy
-   * is derived from the current UGI settings.
-   * @param conf config
-   */
-  public UrlConnectionOperations(Configuration conf) {
-    super(conf);
-    connectionFactory = SliderURLConnectionFactory.newInstance(conf);
-    if (UserGroupInformation.isSecurityEnabled()) {
-      log.debug("SPNEGO is enabled");
-      setUseSpnego(true);
-    }
-  }
-
-
-  public boolean isUseSpnego() {
-    return useSpnego;
-  }
-
-  public void setUseSpnego(boolean useSpnego) {
-    this.useSpnego = useSpnego;
-  }
-
-  /**
-   * Opens a url with cache disabled, redirect handled in 
-   * (JDK) implementation.
-   *
-   * @param url to open
-   * @return URLConnection
-   * @throws IOException
-   * @throws AuthenticationException authentication failure
-   */
-  public HttpURLConnection openConnection(URL url) throws
-      IOException,
-      AuthenticationException {
-    Preconditions.checkArgument(url.getPort() != 0, "no port");
-    return (HttpURLConnection) connectionFactory.openConnection(url, useSpnego);
-  }
-
-  public HttpOperationResponse execGet(URL url) throws
-      IOException,
-      AuthenticationException {
-    return execHttpOperation(HttpVerb.GET, url, null, "");
-  }
-
-  public HttpOperationResponse execHttpOperation(HttpVerb verb,
-      URL url,
-      byte[] payload,
-      String contentType)
-      throws IOException, AuthenticationException {
-    HttpURLConnection conn = null;
-    HttpOperationResponse outcome = new HttpOperationResponse();
-    int resultCode;
-    byte[] body = null;
-    log.debug("{} {} spnego={}", verb, url, useSpnego);
-
-    boolean doOutput = verb.hasUploadBody();
-    if (doOutput) {
-      Preconditions.checkArgument(payload !=null,
-          "Null payload on a verb which expects one");
-    }
-    try {
-      conn = openConnection(url);
-      conn.setRequestMethod(verb.getVerb());
-      conn.setDoOutput(doOutput);
-      if (doOutput) {
-        conn.setRequestProperty("Content-Type", contentType);
-      }
-
-      // now do the connection
-      conn.connect();
-      
-      if (doOutput) {
-        OutputStream output = conn.getOutputStream();
-        IOUtils.write(payload, output);
-        output.close();
-      }
-      
-      resultCode = conn.getResponseCode();
-      outcome.lastModified = conn.getLastModified();
-      outcome.contentType = conn.getContentType();
-      outcome.headers = conn.getHeaderFields();
-      InputStream stream = conn.getErrorStream();
-      if (stream == null) {
-        stream = conn.getInputStream();
-      }
-      if (stream != null) {
-        // read into a buffer.
-        body = IOUtils.toByteArray(stream);
-      } else {
-        // no body: 
-        log.debug("No body in response");
-
-      }
-    } catch (SSLException e) {
-      throw e;
-    } catch (IOException e) {
-      throw NetUtils.wrapException(url.toString(),
-          url.getPort(), "localhost", 0, e);
-
-    } catch (AuthenticationException e) {
-      throw new AuthenticationException("From " + url + ": " + e, e);
-
-    } finally {
-      if (conn != null) {
-        conn.disconnect();
-      }
-    }
-    uprateFaults(HttpVerb.GET, url.toString(), resultCode, "", body);
-    outcome.responseCode = resultCode;
-    outcome.data = body;
-    return outcome;
-  }
-
-  /**
-   * Uprate error codes 400 and up into faults; 
-   * 404 is converted to a {@link NotFoundException},
-   * 401 to {@link ForbiddenException}
-   *
-   * @param verb HTTP Verb used
-   * @param url URL as string
-   * @param resultCode response from the request
-   * @param bodyAsString
-   *@param body optional body of the request  @throws IOException if the result was considered a failure
-   */
-  public static void uprateFaults(HttpVerb verb, String url,
-      int resultCode, String bodyAsString, byte[] body)
-      throws IOException {
-
-    if (resultCode < 400) {
-      //success
-      return;
-    }
-    String msg = verb.toString() +" "+ url;
-    if (resultCode == 404) {
-      throw new NotFoundException(msg);
-    }
-    if (resultCode == 401) {
-      throw new ForbiddenException(msg);
-    }
-    // all other error codes
-    
-    // get a string respnse
-    if (bodyAsString == null) {
-      if (body != null && body.length > 0) {
-        bodyAsString = new String(body);
-      } else {
-        bodyAsString = "";
-      }
-    }
-    String message =  msg +
-                     " failed with exit code " + resultCode
-                     + ", body length " + bodyAsString.length()
-                     + ":\n" + bodyAsString;
-    log.error(message);
-    throw new IOException(message);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/zk/BlockingZKWatcher.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/zk/BlockingZKWatcher.java b/slider-core/src/main/java/org/apache/slider/core/zk/BlockingZKWatcher.java
deleted file mode 100644
index ca49888..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/zk/BlockingZKWatcher.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.zk;
-
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.ConnectException;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-public class BlockingZKWatcher implements Watcher {
-  
-  protected static final Logger log =
-    LoggerFactory.getLogger(BlockingZKWatcher.class);
-  private final AtomicBoolean connectedFlag = new AtomicBoolean(false);
-
-  @Override
-  public void process(WatchedEvent event) {
-    log.info("ZK binding callback received");
-    connectedFlag.set(true);
-    synchronized (connectedFlag) {
-      try {
-        connectedFlag.notify();
-      } catch (Exception e) {
-        log.warn("failed while waiting for notification", e);
-      }
-    }
-  }
-
-  /**
-   * Wait for a flag to go true
-   * @param timeout timeout in millis
-   */
-
-  public void waitForZKConnection(int timeout)
-      throws InterruptedException, ConnectException {
-    synchronized (connectedFlag) {
-      if (!connectedFlag.get()) {
-        log.info("waiting for ZK event");
-        //wait a bit
-        connectedFlag.wait(timeout);
-      }
-    }
-    if (!connectedFlag.get()) {
-      throw new ConnectException("Unable to connect to ZK quorum");
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/zk/MiniZooKeeperCluster.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/zk/MiniZooKeeperCluster.java b/slider-core/src/main/java/org/apache/slider/core/zk/MiniZooKeeperCluster.java
deleted file mode 100644
index c8b3adb..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/zk/MiniZooKeeperCluster.java
+++ /dev/null
@@ -1,423 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.zk;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileUtil;
-import org.apache.hadoop.io.IOUtils;
-import org.apache.hadoop.service.AbstractService;
-import org.apache.zookeeper.server.NIOServerCnxnFactory;
-import org.apache.zookeeper.server.ZooKeeperServer;
-import org.apache.zookeeper.server.persistence.FileTxnLog;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.net.BindException;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-
-/**
- * This is a version of the HBase ZK cluster cut out to be standalone.
- * 
- * <i>Important: keep this Java6 language level for now</i>
- */
-public class MiniZooKeeperCluster extends AbstractService {
-  private static final Logger LOG = LoggerFactory.getLogger(
-      MiniZooKeeperCluster.class);
-
-  private static final int TICK_TIME = 2000;
-  private static final int CONNECTION_TIMEOUT = 30000;
-  public static final int MAX_CLIENT_CONNECTIONS = 1000;
-
-  private boolean started;
-
-  /** The default port. If zero, we use a random port. */
-  private int defaultClientPort = 0;
-
-  private int clientPort;
-
-  private final List<NIOServerCnxnFactory> standaloneServerFactoryList;
-  private final List<ZooKeeperServer> zooKeeperServers;
-  private final List<Integer> clientPortList;
-
-  private int activeZKServerIndex;
-  private int tickTime = 0;
-  private File baseDir;
-  private final int numZooKeeperServers;
-  private String zkQuorum = "";
-
-  public MiniZooKeeperCluster(int numZooKeeperServers) {
-    super("MiniZooKeeperCluster");
-    this.numZooKeeperServers = numZooKeeperServers;
-    this.started = false;
-    activeZKServerIndex = -1;
-    zooKeeperServers = new ArrayList<ZooKeeperServer>();
-    clientPortList = new ArrayList<Integer>();
-    standaloneServerFactoryList = new ArrayList<NIOServerCnxnFactory>();
-  }
-
-
-  @Override
-  protected void serviceInit(Configuration conf) throws Exception {
-    super.serviceInit(conf);
-  }
-
-  public void setDefaultClientPort(int clientPort) {
-    if (clientPort <= 0) {
-      throw new IllegalArgumentException("Invalid default ZK client port: "
-                                         + clientPort);
-    }
-    this.defaultClientPort = clientPort;
-  }
-
-  /**
-   * Selects a ZK client port. Returns the default port if specified.
-   * Otherwise, returns a random port. The random port is selected from the
-   * range between 49152 to 65535. These ports cannot be registered with IANA
-   * and are intended for dynamic allocation (see http://bit.ly/dynports).
-   */
-  private int selectClientPort(Random r) {
-    if (defaultClientPort > 0) {
-      return defaultClientPort;
-    }
-    return 0xc000 + r.nextInt(0x3f00);
-  }
-
-  public void setTickTime(int tickTime) {
-    this.tickTime = tickTime;
-  }
-
-  public int getBackupZooKeeperServerNum() {
-    return zooKeeperServers.size() - 1;
-  }
-
-  public int getZooKeeperServerNum() {
-    return zooKeeperServers.size();
-  }
-
-  // / XXX: From o.a.zk.t.ClientBase
-  private static void setupTestEnv() {
-    // during the tests we run with 100K prealloc in the logs.
-    // on windows systems prealloc of 64M was seen to take ~15seconds
-    // resulting in test failure (client timeout on first session).
-    // set env and directly in order to handle static init/gc issues
-    System.setProperty("zookeeper.preAllocSize", "100");
-    FileTxnLog.setPreallocSize(100 * 1024);
-  }
-
-  @Override
-  protected void serviceStart() throws Exception {
-    startup();
-  }
-
-  /**
-   * @param baseDir
-   * @param numZooKeeperServers
-   * @return ClientPort server bound to, -1 if there was a
-   *         binding problem and we couldn't pick another port.
-   * @throws IOException
-   * @throws InterruptedException
-   */
-  private int startup() throws IOException,
-      InterruptedException {
-    if (numZooKeeperServers <= 0)
-      return -1;
-
-    setupTestEnv();
-    started = true;
-    baseDir = File.createTempFile("zookeeper", ".dir");
-    recreateDir(baseDir);
-
-    StringBuilder quorumList = new StringBuilder();
-    Random rnd = new Random();
-    int tentativePort = selectClientPort(rnd);
-
-    // running all the ZK servers
-    for (int i = 0; i < numZooKeeperServers; i++) {
-      File dir = new File(baseDir, "zookeeper_" + i).getAbsoluteFile();
-      recreateDir(dir);
-      int tickTimeToUse;
-      if (this.tickTime > 0) {
-        tickTimeToUse = this.tickTime;
-      } else {
-        tickTimeToUse = TICK_TIME;
-      }
-      ZooKeeperServer server = new ZooKeeperServer(dir, dir, tickTimeToUse);
-      NIOServerCnxnFactory standaloneServerFactory;
-      while (true) {
-        try {
-          standaloneServerFactory = new NIOServerCnxnFactory();
-          standaloneServerFactory.configure(
-              new InetSocketAddress(tentativePort),
-              MAX_CLIENT_CONNECTIONS
-          );
-        } catch (BindException e) {
-          LOG.debug("Failed binding ZK Server to client port: " +
-                    tentativePort, e);
-          // We're told to use some port but it's occupied, fail
-          if (defaultClientPort > 0) return -1;
-          // This port is already in use, try to use another.
-          tentativePort = selectClientPort(rnd);
-          continue;
-        }
-        break;
-      }
-
-      // Start up this ZK server
-      standaloneServerFactory.startup(server);
-      if (!waitForServerUp(tentativePort, CONNECTION_TIMEOUT)) {
-        throw new IOException("Waiting for startup of standalone server");
-      }
-
-      // We have selected this port as a client port.
-      clientPortList.add(tentativePort);
-      standaloneServerFactoryList.add(standaloneServerFactory);
-      zooKeeperServers.add(server);
-      if (quorumList.length() > 0) {
-        quorumList.append(",");
-      }
-      quorumList.append("localhost:").append(tentativePort);
-      tentativePort++; //for the next server
-    }
-
-    // set the first one to be active ZK; Others are backups
-    activeZKServerIndex = 0;
-
-    clientPort = clientPortList.get(activeZKServerIndex);
-    zkQuorum = quorumList.toString();
-    LOG.info("Started MiniZK Cluster and connect 1 ZK server " +
-             "on client port: " + clientPort);
-    return clientPort;
-  }
-
-  private void recreateDir(File dir) throws IOException {
-    if (dir.exists()) {
-      if (!FileUtil.fullyDelete(dir)) {
-        throw new IOException("Could not delete zk base directory: " + dir);
-      }
-    }
-    try {
-      dir.mkdirs();
-    } catch (SecurityException e) {
-      throw new IOException("creating dir: " + dir, e);
-    }
-  }
-
-  /**
-   * Delete the basedir
-   */
-  private void deleteBaseDir() {
-    if (baseDir != null) {
-      baseDir.delete();
-      baseDir = null;
-    }
-
-  }
-
-  @Override
-  protected void serviceStop() throws Exception {
-
-    if (!started) {
-      return;
-    }
-    started = false;
-
-    try {
-      // shut down all the zk servers
-      for (int i = 0; i < standaloneServerFactoryList.size(); i++) {
-        NIOServerCnxnFactory standaloneServerFactory =
-            standaloneServerFactoryList.get(i);
-        int clientPort = clientPortList.get(i);
-  
-        standaloneServerFactory.shutdown();
-        if (!waitForServerDown(clientPort, CONNECTION_TIMEOUT)) {
-          throw new IOException("Waiting for shutdown of standalone server");
-        }
-      }
-      for (ZooKeeperServer zkServer : zooKeeperServers) {
-        //explicitly close ZKDatabase since ZookeeperServer does not close them
-        zkServer.getZKDatabase().close();
-      }
-    } finally {
-      // clear everything
-      activeZKServerIndex = 0;
-      standaloneServerFactoryList.clear();
-      clientPortList.clear();
-      zooKeeperServers.clear();
-    }
-
-    LOG.info("Shutdown MiniZK cluster with all ZK servers");
-  }
-
-  /**@return clientPort return clientPort if there is another ZK backup can run
-   *         when killing the current active; return -1, if there is no backups.
-   * @throws IOException
-   * @throws InterruptedException
-   */
-  public int killCurrentActiveZooKeeperServer() throws IOException,
-      InterruptedException {
-    if (!started || activeZKServerIndex < 0) {
-      return -1;
-    }
-
-    // Shutdown the current active one
-    NIOServerCnxnFactory standaloneServerFactory =
-        standaloneServerFactoryList.get(activeZKServerIndex);
-    int clientPort = clientPortList.get(activeZKServerIndex);
-
-    standaloneServerFactory.shutdown();
-    if (!waitForServerDown(clientPort, CONNECTION_TIMEOUT)) {
-      throw new IOException("Waiting for shutdown of standalone server");
-    }
-
-    zooKeeperServers.get(activeZKServerIndex).getZKDatabase().close();
-
-    // remove the current active zk server
-    standaloneServerFactoryList.remove(activeZKServerIndex);
-    clientPortList.remove(activeZKServerIndex);
-    zooKeeperServers.remove(activeZKServerIndex);
-    LOG.info("Kill the current active ZK servers in the cluster " +
-             "on client port: " + clientPort);
-
-    if (standaloneServerFactoryList.size() == 0) {
-      // there is no backup servers;
-      return -1;
-    }
-    clientPort = clientPortList.get(activeZKServerIndex);
-    LOG.info("Activate a backup zk server in the cluster " +
-             "on client port: " + clientPort);
-    // return the next back zk server's port
-    return clientPort;
-  }
-
-  /**
-   * Kill one back up ZK servers
-   * @throws IOException
-   * @throws InterruptedException
-   */
-  public void killOneBackupZooKeeperServer() throws IOException,
-      InterruptedException {
-    if (!started || activeZKServerIndex < 0 ||
-        standaloneServerFactoryList.size() <= 1) {
-      return;
-    }
-
-    int backupZKServerIndex = activeZKServerIndex + 1;
-    // Shutdown the current active one
-    NIOServerCnxnFactory standaloneServerFactory =
-        standaloneServerFactoryList.get(backupZKServerIndex);
-    int clientPort = clientPortList.get(backupZKServerIndex);
-
-    standaloneServerFactory.shutdown();
-    if (!waitForServerDown(clientPort, CONNECTION_TIMEOUT)) {
-      throw new IOException("Waiting for shutdown of standalone server");
-    }
-
-    zooKeeperServers.get(backupZKServerIndex).getZKDatabase().close();
-
-    // remove this backup zk server
-    standaloneServerFactoryList.remove(backupZKServerIndex);
-    clientPortList.remove(backupZKServerIndex);
-    zooKeeperServers.remove(backupZKServerIndex);
-    LOG.info("Kill one backup ZK servers in the cluster " +
-             "on client port: " + clientPort);
-  }
-
-  // XXX: From o.a.zk.t.ClientBase
-  private static boolean waitForServerDown(int port, long timeout) throws
-      InterruptedException {
-    long start = System.currentTimeMillis();
-    while (true) {
-      try {
-        Socket sock = null;
-        try {
-          sock = new Socket("localhost", port);
-          OutputStream outstream = sock.getOutputStream();
-          outstream.write("stat".getBytes());
-          outstream.flush();
-        } finally {
-          IOUtils.closeSocket(sock);
-        }
-      } catch (IOException e) {
-        return true;
-      }
-
-      if (System.currentTimeMillis() > start + timeout) {
-        break;
-      }
-      Thread.sleep(250);
-    }
-    return false;
-  }
-
-  // XXX: From o.a.zk.t.ClientBase
-  private static boolean waitForServerUp(int port, long timeout) throws
-      InterruptedException {
-    long start = System.currentTimeMillis();
-    while (true) {
-      try {
-        Socket sock = null;
-        sock = new Socket("localhost", port);
-        BufferedReader reader = null;
-        try {
-          OutputStream outstream = sock.getOutputStream();
-          outstream.write("stat".getBytes());
-          outstream.flush();
-
-          Reader isr = new InputStreamReader(sock.getInputStream());
-          reader = new BufferedReader(isr);
-          String line = reader.readLine();
-          if (line != null && line.startsWith("Zookeeper version:")) {
-            return true;
-          }
-        } finally {
-          IOUtils.closeSocket(sock);
-          IOUtils.closeStream(reader);
-        }
-      } catch (IOException e) {
-        // ignore as this is expected
-        LOG.debug("server localhost:" + port + " not up " + e);
-      }
-
-      if (System.currentTimeMillis() > start + timeout) {
-        break;
-      }
-      Thread.sleep(250);
-    }
-    return false;
-  }
-
-  public int getClientPort() {
-    return clientPort;
-  }
-
-  public String getZkQuorum() {
-    return zkQuorum;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/zk/ZKCallback.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/zk/ZKCallback.java b/slider-core/src/main/java/org/apache/slider/core/zk/ZKCallback.java
deleted file mode 100644
index 045b72c..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/zk/ZKCallback.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.core.zk;
-
-import org.apache.zookeeper.Watcher;
-
-/**
- * Relays ZK watcher events to a closure
- */
-public abstract class ZKCallback implements Watcher {
-
-  public ZKCallback() {
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/zk/ZKIntegration.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/zk/ZKIntegration.java b/slider-core/src/main/java/org/apache/slider/core/zk/ZKIntegration.java
deleted file mode 100644
index ca41e4b..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/zk/ZKIntegration.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.core.zk;
-
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.data.ACL;
-import org.apache.zookeeper.data.Stat;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-
-public class ZKIntegration implements Watcher, Closeable {
-
-/**
- * Base path for services
- */
-  public static String ZK_SERVICES = "services";
-  /**
-   * Base path for all Slider references
-   */
-  public static String ZK_SLIDER = "slider";
-  public static String ZK_USERS = "users";
-  public static String SVC_SLIDER = "/" + ZK_SERVICES + "/" + ZK_SLIDER;
-  public static String SVC_SLIDER_USERS = SVC_SLIDER + "/" + ZK_USERS;
-
-  public static final List<String> ZK_USERS_PATH_LIST = new ArrayList<String>();
-  static {
-    ZK_USERS_PATH_LIST.add(ZK_SERVICES);
-    ZK_USERS_PATH_LIST.add(ZK_SLIDER);
-    ZK_USERS_PATH_LIST.add(ZK_USERS);
-  }
-
-  public static int SESSION_TIMEOUT = 30000;
-  protected static final Logger log =
-    LoggerFactory.getLogger(ZKIntegration.class);
-  private ZooKeeper zookeeper;
-  private final String username;
-  private final String clustername;
-  private final String userPath;
-  private int sessionTimeout = SESSION_TIMEOUT;
-/**
- flag to set to indicate that the user path should be created if
- it is not already there
- */
-  private final AtomicBoolean toInit = new AtomicBoolean(false);
-  private final boolean createClusterPath;
-  private final Watcher watchEventHandler;
-  private final String zkConnection;
-  private final boolean canBeReadOnly;
-
-  protected ZKIntegration(String zkConnection,
-                          String username,
-                          String clustername,
-                          boolean canBeReadOnly,
-                          boolean createClusterPath,
-                          Watcher watchEventHandler,
-                          int sessionTimeout
-  ) throws IOException {
-    this.username = username;
-    this.clustername = clustername;
-    this.watchEventHandler = watchEventHandler;
-    this.zkConnection = zkConnection;
-    this.canBeReadOnly = canBeReadOnly;
-    this.createClusterPath = createClusterPath;
-    this.sessionTimeout = sessionTimeout;
-    this.userPath = mkSliderUserPath(username);
-  }
-
-  public void init() throws IOException {
-    assert zookeeper == null;
-    log.debug("Binding ZK client to {}", zkConnection);
-    zookeeper = new ZooKeeper(zkConnection, sessionTimeout, this, canBeReadOnly);
-  }
-
-  /**
-   * Create an instance bonded to the specific closure
-   * @param zkConnection
-   * @param username
-   * @param clustername
-   * @param canBeReadOnly
-   * @param watchEventHandler
-   * @return the new instance
-   * @throws IOException
-   */
-  public static ZKIntegration newInstance(String zkConnection,
-      String username,
-      String clustername,
-      boolean createClusterPath,
-      boolean canBeReadOnly,
-      Watcher watchEventHandler,
-      int sessionTimeout) throws IOException {
-
-    return new ZKIntegration(zkConnection,
-                             username,
-                             clustername,
-                             canBeReadOnly,
-                             createClusterPath,
-                             watchEventHandler,
-                             sessionTimeout);
-  }
-
-
-  @Override
-  public synchronized void close() throws IOException {
-    if (zookeeper != null) {
-      try {
-        zookeeper.close();
-      } catch (InterruptedException ignored) {
-
-      }
-      zookeeper = null;
-    }
-  }
-
-  public String getConnectionString() {
-    return zkConnection;
-  }
-
-  public String getClusterPath() {
-    return mkClusterPath(username, clustername);
-  }
-
-  public boolean getConnected() {
-    return zookeeper.getState().isConnected();
-  }
-
-  public boolean getAlive() {
-    return zookeeper.getState().isAlive();
-  }
-
-  public ZooKeeper.States getState() {
-    return zookeeper.getState();
-  }
-
-  public Stat getClusterStat() throws KeeperException, InterruptedException {
-    return stat(getClusterPath());
-  }
-
-  public boolean exists(String path) throws
-                                     KeeperException,
-                                     InterruptedException {
-    return stat(path) != null;
-  }
-
-  public Stat stat(String path) throws KeeperException, InterruptedException {
-    return zookeeper.exists(path, false);
-  }
-
-  @Override
-  public String toString() {
-    return "ZK integration bound @  " + zkConnection + ": " + zookeeper;
-  }
-  
-/**
- * Event handler to notify of state events
- * @param event
- */
-  @Override
-  public void process(WatchedEvent event) {
-    log.debug("{}", event);
-    try {
-      maybeInit();
-    } catch (Exception e) {
-      log.error("Failed to init", e);
-    }
-    if (watchEventHandler != null) {
-      watchEventHandler.process(event);
-    }
-  }
-
-  private void maybeInit() throws KeeperException, InterruptedException {
-    if (!toInit.getAndSet(true) && createClusterPath) {
-      log.debug("initing");
-      //create the user path
-      mkPath(ZK_USERS_PATH_LIST, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-      //create the specific user
-      createPath(userPath, null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-    }
-  }
-
-  /**
-   * Create a path under a parent, don't care if it already exists
-   * As the path isn't returned, this isn't the way to create sequentially
-   * numbered nodes.
-   * @param parent parent dir. Must have a trailing / if entry!=null||empty 
-   * @param entry entry -can be null or "", in which case it is not appended
-   * @param acl
-   * @param createMode
-   * @return the path if created; null if not
-   */
-  public String createPath(String parent,
-                           String entry,
-                           List<ACL> acl,
-                           CreateMode createMode) throws KeeperException, InterruptedException {
-    //initial create of full path
-    assert acl != null;
-    assert !acl.isEmpty();
-    assert parent != null;
-    String path = parent;
-    if (entry != null) {
-      path = path + entry;
-    }
-    try {
-      log.debug("Creating ZK path {}", path);
-      return zookeeper.create(path, null, acl, createMode);
-    } catch (KeeperException.NodeExistsException ignored) {
-      //node already there
-      log.debug("node already present:{}",path);
-      return null;
-    }
-  }
-
-  /**
-   * Recursive path create
-   * @param paths path list
-   * @param acl acl list
-   * @param createMode create modes
-   */
-  public void mkPath(List<String> paths,
-                     List<ACL> acl,
-                     CreateMode createMode) throws KeeperException, InterruptedException {
-    String history = "/";
-    for (String entry : paths) {
-      createPath(history, entry, acl, createMode);
-      history = history + entry + "/";
-    }
-  }
-
-/**
- * Blocking enum of users
- * @return an unordered list of clusters under a user
- */
-  public List<String> getClusters() throws KeeperException, InterruptedException {
-    return zookeeper.getChildren(userPath, null);
-  }
-
-  /**
-   * Delete a node, does not throw an exception if the path is not fond
-   * @param path path to delete
-   * @return true if the path could be deleted, false if there was no node to delete 
-   *
-   */
-  public boolean delete(String path) throws
-                                     InterruptedException,
-                                     KeeperException {
-    try {
-      zookeeper.delete(path, -1);
-      log.debug("Deleting {}", path);
-      return true;
-    } catch (KeeperException.NoNodeException ignored) {
-      return false;
-    }
-  }
-
-  /**
-   * Recursively delete a node, does not throw exception if any node does not exist.
-   * @param path
-   * @return true if delete was successful
-   */
-  public boolean deleteRecursive(String path) throws KeeperException, InterruptedException {
-
-    try {
-      List<String> children = zookeeper.getChildren(path, false);
-      for (String child : children) {
-        deleteRecursive(path + "/" + child);
-      }
-      delete(path);
-    } catch (KeeperException.NoNodeException ignored) {
-      return false;
-    }
-
-    return true;
-  }
-
-  /**
- * Build the path to a cluster; exists once the cluster has come up.
- * Even before that, a ZK watcher could wait for it.
- * @param username user
- * @param clustername name of the cluster
- * @return a strin
- */
-  public static String mkClusterPath(String username, String clustername) {
-    return mkSliderUserPath(username) + "/" + clustername;
-  }
-/**
- * Build the path to a cluster; exists once the cluster has come up.
- * Even before that, a ZK watcher could wait for it.
- * @param username user
- * @return a string
- */
-  public static String mkSliderUserPath(String username) {
-    return SVC_SLIDER_USERS + "/" + username;
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/zk/ZKPathBuilder.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/zk/ZKPathBuilder.java b/slider-core/src/main/java/org/apache/slider/core/zk/ZKPathBuilder.java
deleted file mode 100644
index b088568..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/zk/ZKPathBuilder.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.zk;
-
-import java.util.Locale;
-
-public final class ZKPathBuilder {
-
-  private final String username, appname, clustername;
-  private final String quorum;
-
-  private String appPath;
-  private String registryPath;
-  private final String appQuorum;
-  
-  public ZKPathBuilder(String username,
-    String appname,
-    String clustername,
-    String quorum,
-      String appQuorum) {
-    this.username = username;
-    this.appname = appname;
-    this.clustername = clustername;
-    this.quorum = quorum;
-    appPath = buildAppPath();
-    registryPath = buildRegistryPath();
-    this.appQuorum = appQuorum;
-  }
-
-  public String buildAppPath() {
-    return String.format(Locale.ENGLISH, "/yarnapps_%s_%s_%s", appname,
-                         username, clustername);
-
-  }
-
-  public String buildRegistryPath() {
-    return String.format(Locale.ENGLISH, "/services_%s_%s_%s", appname,
-                         username, clustername);
-
-  }
-
-  public String getQuorum() {
-    return quorum;
-  }
-
-  public String getAppQuorum() {
-    return appQuorum;
-  }
-
-  public String getAppPath() {
-    return appPath;
-  }
-
-  public void setAppPath(String appPath) {
-    this.appPath = appPath;
-  }
-
-  public String getRegistryPath() {
-    return registryPath;
-  }
-
-  public void setRegistryPath(String registryPath) {
-    this.registryPath = registryPath;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/zk/ZookeeperUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/zk/ZookeeperUtils.java b/slider-core/src/main/java/org/apache/slider/core/zk/ZookeeperUtils.java
deleted file mode 100644
index cc1b2c9..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/zk/ZookeeperUtils.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.zk;
-
-import com.google.common.net.HostAndPort;
-import org.apache.hadoop.util.StringUtils;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadConfigException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ZookeeperUtils {
-  public static final int DEFAULT_PORT = 2181;
-
-  public static String buildConnectionString(String zkHosts, int port) {
-    String zkPort = Integer.toString(port);
-    //parse the hosts
-    String[] hostlist = zkHosts.split(",", 0);
-    String quorum = SliderUtils.join(hostlist, ":" + zkPort + ",", false);
-    return quorum;
-  }
-
-  /**
-   * Take a quorum list and split it to (trimmed) pairs
-   * @param hostPortQuorumList list of form h1:port, h2:port2,...
-   * @return a possibly empty list of values between commas. They may not be
-   * valid hostname:port pairs
-   */
-  public static List<String> splitToPairs(String hostPortQuorumList) {
-    // split an address hot
-    String[] strings = StringUtils.getStrings(hostPortQuorumList);
-    int len = 0;
-    if (strings != null) {
-      len = strings.length;
-    }
-    List<String> tuples = new ArrayList<String>(len);
-    if (strings != null) {
-      for (String s : strings) {
-        tuples.add(s.trim());
-      }
-    }
-    return tuples;
-  }
-
-  /**
-   * Split a quorum list into a list of hostnames and ports
-   * @param hostPortQuorumList split to a list of hosts and ports
-   * @return a list of values
-   */
-  public static List<HostAndPort> splitToHostsAndPorts(String hostPortQuorumList) {
-    // split an address hot
-    String[] strings = StringUtils.getStrings(hostPortQuorumList);
-    int len = 0;
-    if (strings != null) {
-      len = strings.length;
-    }
-    List<HostAndPort> list = new ArrayList<HostAndPort>(len);
-    if (strings != null) {
-      for (String s : strings) {
-        list.add(HostAndPort.fromString(s.trim()).withDefaultPort(DEFAULT_PORT));
-      }
-    }
-    return list;
-  }
-
-  /**
-   * Build up to a hosts only list
-   * @param hostAndPorts
-   * @return a list of the hosts only
-   */
-  public static String buildHostsOnlyList(List<HostAndPort> hostAndPorts) {
-    StringBuilder sb = new StringBuilder();
-    for (HostAndPort hostAndPort : hostAndPorts) {
-      sb.append(hostAndPort.getHostText()).append(",");
-    }
-    if (sb.length() > 0) {
-      sb.delete(sb.length() - 1, sb.length());
-    }
-    return sb.toString();
-  }
-
-  public static String buildQuorumEntry(HostAndPort hostAndPort,
-    int defaultPort) {
-    String s = hostAndPort.toString();
-    if (hostAndPort.hasPort()) {
-      return s;
-    } else {
-      return s + ":" + defaultPort;
-    }
-  }
-
-  /**
-   * Build a quorum list, injecting a ":defaultPort" ref if needed on
-   * any entry without one
-   * @param hostAndPorts
-   * @param defaultPort
-   * @return
-   */
-  public static String buildQuorum(List<HostAndPort> hostAndPorts, int defaultPort) {
-    List<String> entries = new ArrayList<String>(hostAndPorts.size());
-    for (HostAndPort hostAndPort : hostAndPorts) {
-      entries.add(buildQuorumEntry(hostAndPort, defaultPort));
-    }
-    return SliderUtils.join(entries, ",", false);
-  }
-  
-  public static String convertToHostsOnlyList(String quorum) throws
-      BadConfigException {
-    List<HostAndPort> hostAndPorts = splitToHostsAndPortsStrictly(quorum);
-    return ZookeeperUtils.buildHostsOnlyList(hostAndPorts);
-  }
-
-  public static List<HostAndPort> splitToHostsAndPortsStrictly(String quorum) throws
-      BadConfigException {
-    List<HostAndPort> hostAndPorts =
-        ZookeeperUtils.splitToHostsAndPorts(quorum);
-    if (hostAndPorts.isEmpty()) {
-      throw new BadConfigException("empty zookeeper quorum");
-    }
-    return hostAndPorts;
-  }
-  
-  public static int getFirstPort(String quorum, int defVal) throws
-      BadConfigException {
-    List<HostAndPort> hostAndPorts = splitToHostsAndPortsStrictly(quorum);
-    int port = hostAndPorts.get(0).getPortOrDefault(defVal);
-    return port;
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/AbstractClientProvider.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/AbstractClientProvider.java b/slider-core/src/main/java/org/apache/slider/providers/AbstractClientProvider.java
deleted file mode 100644
index 510de5d..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/AbstractClientProvider.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.conf.Configured;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.BadClusterStateException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.launch.AbstractLauncher;
-import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import static org.apache.slider.api.ResourceKeys.COMPONENT_INSTANCES;
-import static org.apache.slider.api.ResourceKeys.DEF_YARN_CORES;
-import static org.apache.slider.api.ResourceKeys.DEF_YARN_MEMORY;
-import static org.apache.slider.api.ResourceKeys.YARN_CORES;
-import static org.apache.slider.api.ResourceKeys.YARN_MEMORY;
-
-public abstract class AbstractClientProvider extends Configured {
-  private static final Logger log =
-    LoggerFactory.getLogger(AbstractClientProvider.class);
-  protected static final ProviderUtils providerUtils =
-    new ProviderUtils(log);
-
-  public static final String PROVIDER_RESOURCE_BASE =
-    "org/apache/slider/providers/";
-  public static final String PROVIDER_RESOURCE_BASE_ROOT =
-    "/" + PROVIDER_RESOURCE_BASE;
-
-  public AbstractClientProvider(Configuration conf) {
-    super(conf);
-  }
-
-  public abstract String getName();
-
-  public abstract List<ProviderRole> getRoles();
-
-  /**
-   * Verify that an instance definition is considered valid by the provider
-   * @param instanceDefinition instance definition
-   * @throws SliderException if the configuration is not valid
-   */
-  public void validateInstanceDefinition(AggregateConf instanceDefinition, SliderFileSystem fs) throws
-      SliderException {
-
-    List<ProviderRole> roles = getRoles();
-    ConfTreeOperations resources =
-      instanceDefinition.getResourceOperations();
-    for (ProviderRole role : roles) {
-      String name = role.name;
-      MapOperations component = resources.getComponent(role.group);
-      if (component != null) {
-        String instances = component.get(COMPONENT_INSTANCES);
-        if (instances == null) {
-          String message = "No instance count provided for " + name;
-          log.error("{} with \n{}", message, resources.toString());
-          throw new BadClusterStateException(message);
-        }
-        String ram = component.get(YARN_MEMORY);
-        String cores = component.get(YARN_CORES);
-
-
-        providerUtils.getRoleResourceRequirement(ram,
-                                                 DEF_YARN_MEMORY,
-                                                 Integer.MAX_VALUE);
-        providerUtils.getRoleResourceRequirement(cores,
-                                                 DEF_YARN_CORES,
-                                                 Integer.MAX_VALUE);
-      }
-    }
-  }
-
-
-  /**
-   * Any provider-side alteration of a configuration can take place here.
-   * @param aggregateConf config to patch
-   * @throws IOException IO problems
-   * @throws SliderException Slider-specific issues
-   */
-  public void prepareInstanceConfiguration(AggregateConf aggregateConf) throws
-      SliderException,
-                                                                    IOException {
-    //default: do nothing
-  }
-
-
-  /**
-   * Prepare the AM settings for launch
-   * @param fileSystem filesystem
-   * @param serviceConf configuration of the client
-   * @param launcher launcher to set up
-   * @param instanceDescription instance description being launched
-   * @param snapshotConfDirPath
-   * @param generatedConfDirPath
-   * @param clientConfExtras
-   * @param libdir
-   * @param tempPath
-   * @param miniClusterTestRun flag set to true on a mini cluster run
-   * @throws IOException
-   * @throws SliderException
-   */
-  public void prepareAMAndConfigForLaunch(SliderFileSystem fileSystem,
-      Configuration serviceConf,
-      AbstractLauncher launcher,
-      AggregateConf instanceDescription,
-      Path snapshotConfDirPath,
-      Path generatedConfDirPath,
-      Configuration clientConfExtras,
-      String libdir,
-      Path tempPath,
-      boolean miniClusterTestRun)
-    throws IOException, SliderException {
-    
-  }
-  
-  /**
-   * Load in and merge in templates. Null arguments means "no such template"
-   * @param instanceConf instance to patch 
-   * @param internalTemplate patch to internal.json
-   * @param resourceTemplate path to resources.json
-   * @param appConfTemplate path to app_conf.json
-   * @throws IOException any IO problems
-   */
-  protected void mergeTemplates(AggregateConf instanceConf,
-                                String internalTemplate,
-                                String resourceTemplate,
-                                String appConfTemplate) throws IOException {
-    if (internalTemplate != null) {
-      ConfTreeOperations template =
-        ConfTreeOperations.fromResource(internalTemplate);
-      instanceConf.getInternalOperations()
-                  .mergeWithoutOverwrite(template.confTree);
-    }
-
-    if (resourceTemplate != null) {
-      ConfTreeOperations resTemplate =
-        ConfTreeOperations.fromResource(resourceTemplate);
-      instanceConf.getResourceOperations()
-                   .mergeWithoutOverwrite(resTemplate.confTree);
-    }
-   
-    if (appConfTemplate != null) {
-      ConfTreeOperations template =
-        ConfTreeOperations.fromResource(appConfTemplate);
-      instanceConf.getAppConfOperations()
-                   .mergeWithoutOverwrite(template.confTree);
-    }
-    
-  }
-
-  /**
-   * This is called pre-launch to validate that the cluster specification
-   * is valid. This can include checking that the security options
-   * are in the site files prior to launch, that there are no conflicting operations
-   * etc.
-   *
-   * This check is made prior to every launch of the cluster -so can 
-   * pick up problems which manually edited cluster files have added,
-   * or from specification files from previous versions.
-   *
-   * The provider MUST NOT change the remote specification. This is
-   * purely a pre-launch validation of options.
-   *
-   *
-   * @param sliderFileSystem filesystem
-   * @param clustername name of the cluster
-   * @param configuration cluster configuration
-   * @param instanceDefinition cluster specification
-   * @param clusterDirPath directory of the cluster
-   * @param generatedConfDirPath path to place generated artifacts
-   * @param secure flag to indicate that the cluster is secure
-   * @throws SliderException on any validation issue
-   * @throws IOException on any IO problem
-   */
-  public void preflightValidateClusterConfiguration(SliderFileSystem sliderFileSystem,
-                                                      String clustername,
-                                                      Configuration configuration,
-                                                      AggregateConf instanceDefinition,
-                                                      Path clusterDirPath,
-                                                      Path generatedConfDirPath,
-                                                      boolean secure)
-      throws SliderException, IOException {
-    validateInstanceDefinition(instanceDefinition, sliderFileSystem);
-  }
-
-  /**
-   * Return a set of application specific string tags.
-   * @return the set of tags.
-   */
-  public Set<String> getApplicationTags (SliderFileSystem fileSystem,
-                                         String appDef) throws SliderException {
-    return Collections.emptySet();
-  }
-
-  /**
-   * Process client operations for applications such as install, configure
-   * @param fileSystem
-   * @param registryOperations
-   * @param configuration
-   * @param operation
-   * @param clientInstallPath
-   * @param clientPackage
-   * @param clientConfig
-   * @param name
-   * @throws SliderException
-   */
-  public void processClientOperation(SliderFileSystem fileSystem,
-                                     RegistryOperations registryOperations,
-                                     Configuration configuration,
-                                     String operation,
-                                     File clientInstallPath,
-                                     File clientPackage,
-                                     JSONObject clientConfig,
-                                     String name)
-      throws SliderException {
-    throw new SliderException("Provider does not support client operations.");
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java b/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
deleted file mode 100644
index 92766f5..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.service.Service;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.api.records.Priority;
-import org.apache.hadoop.yarn.client.api.AMRMClient;
-import org.apache.hadoop.registry.client.binding.RegistryTypeUtils;
-import org.apache.hadoop.registry.client.exceptions.InvalidRecordException;
-import org.apache.hadoop.registry.client.types.AddressTypes;
-import org.apache.hadoop.registry.client.types.Endpoint;
-import org.apache.hadoop.registry.client.types.ServiceRecord;
-import org.apache.slider.api.ClusterDescription;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.tools.ConfigHelper;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.main.ExitCodeProvider;
-import org.apache.slider.server.appmaster.actions.QueueAccess;
-import org.apache.slider.server.appmaster.operations.AbstractRMOperation;
-import org.apache.slider.server.appmaster.state.ContainerReleaseSelector;
-import org.apache.slider.server.appmaster.state.MostRecentContainerReleaseSelector;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-import org.apache.slider.server.appmaster.web.rest.agent.AgentRestOperations;
-import org.apache.slider.server.services.workflow.ForkedProcessService;
-import org.apache.slider.server.services.workflow.ServiceParent;
-import org.apache.slider.server.services.workflow.WorkflowSequenceService;
-import org.apache.slider.server.services.yarnregistry.YarnRegistryViewForProviders;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * The base class for provider services. It lets the implementations
- * add sequences of operations, and propagates service failures
- * upstream
- */
-public abstract class AbstractProviderService
-    extends WorkflowSequenceService
-    implements
-    ProviderCore,
-    SliderKeys,
-    ProviderService {
-  private static final Logger log =
-    LoggerFactory.getLogger(AbstractProviderService.class);
-  protected StateAccessForProviders amState;
-  protected AgentRestOperations restOps;
-  protected URL amWebAPI;
-  protected YarnRegistryViewForProviders yarnRegistry;
-  protected QueueAccess queueAccess;
-
-  protected AbstractProviderService(String name) {
-    super(name);
-    setStopIfNoChildServicesAtStartup(false);
-  }
-
-  @Override
-  public Configuration getConf() {
-    return getConfig();
-  }
-
-  public StateAccessForProviders getAmState() {
-    return amState;
-  }
-
-  public QueueAccess getQueueAccess() {
-    return queueAccess;
-  }
-
-  public void setAmState(StateAccessForProviders amState) {
-    this.amState = amState;
-  }
-
-  @Override
-  public String getHumanName() {
-    return getName().toLowerCase(Locale.ENGLISH);
-  }
-  
-  @Override
-  public void bind(StateAccessForProviders stateAccessor,
-      QueueAccess queueAccess,
-      List<Container> liveContainers) {
-    this.amState = stateAccessor;
-    this.queueAccess = queueAccess;
-  }
-
-  @Override
-  public void bindToYarnRegistry(YarnRegistryViewForProviders yarnRegistry) {
-    this.yarnRegistry = yarnRegistry;
-  }
-
-  public YarnRegistryViewForProviders getYarnRegistry() {
-    return yarnRegistry;
-  }
-
-  @Override
-  public AgentRestOperations getAgentRestOperations() {
-    return restOps;
-  }
-
-  @Override
-  public void notifyContainerCompleted(ContainerId containerId) {
-  }
-
-  public void setAgentRestOperations(AgentRestOperations agentRestOperations) {
-    this.restOps = agentRestOperations;
-  }
-
-  /**
-   * Load a specific XML configuration file for the provider config
-   * @param confDir configuration directory
-   * @param siteXMLFilename provider-specific filename
-   * @return a configuration to be included in status
-   * @throws BadCommandArgumentsException argument problems
-   * @throws IOException IO problems
-   */
-  protected Configuration loadProviderConfigurationInformation(File confDir,
-                                                               String siteXMLFilename)
-    throws BadCommandArgumentsException, IOException {
-    Configuration siteConf;
-    File siteXML = new File(confDir, siteXMLFilename);
-    if (!siteXML.exists()) {
-      throw new BadCommandArgumentsException(
-        "Configuration directory %s doesn't contain %s - listing is %s",
-        confDir, siteXMLFilename, SliderUtils.listDir(confDir));
-    }
-
-    //now read it in
-    siteConf = ConfigHelper.loadConfFromFile(siteXML);
-    log.info("{} file is at {}", siteXMLFilename, siteXML);
-    log.info(ConfigHelper.dumpConfigToString(siteConf));
-    return siteConf;
-  }
-
-  /**
-   * No-op implementation of this method.
-   */
-  @Override
-  public void initializeApplicationConfiguration(
-      AggregateConf instanceDefinition, SliderFileSystem fileSystem,
-      String roleGroup)
-      throws IOException, SliderException {
-  }
-
-  /**
-   * No-op implementation of this method.
-   *
-   * {@inheritDoc}
-   */
-  @Override
-  public void validateApplicationConfiguration(AggregateConf instance,
-                                               File confDir,
-                                               boolean secure)
-      throws IOException, SliderException {
-
-  }
-
-  /**
-   * Scan through the roles and see if it is supported.
-   * @param role role to look for
-   * @return true if the role is known about -and therefore
-   * that a launcher thread can be deployed to launch it
-   */
-  @Override
-  public boolean isSupportedRole(String role) {
-    Collection<ProviderRole> roles = getRoles();
-    for (ProviderRole providedRole : roles) {
-      if (providedRole.name.equals(role)) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  /**
-   * override point to allow a process to start executing in this container
-   * @param instanceDefinition cluster description
-   * @param confDir configuration directory
-   * @param env environment
-   * @param execInProgress the callback for the exec events
-   * @return false
-   * @throws IOException
-   * @throws SliderException
-   */
-  @Override
-  public boolean exec(AggregateConf instanceDefinition,
-      File confDir,
-      Map<String, String> env,
-      ProviderCompleted execInProgress) throws IOException, SliderException {
-    return false;
-  }
-
-  @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
-  @Override // ExitCodeProvider
-  public int getExitCode() {
-    Throwable cause = getFailureCause();
-    if (cause != null) {
-      //failed for some reason
-      if (cause instanceof ExitCodeProvider) {
-        return ((ExitCodeProvider) cause).getExitCode();
-      }
-    }
-    ForkedProcessService lastProc = latestProcess();
-    if (lastProc == null || !lastProc.isProcessTerminated()) {
-      return 0;
-    } else {
-      return lastProc.getExitCode();
-    }
-  }
-
-  /**
-   * Return the latest forked process service that ran
-   * @return the forkes service
-   */
-  protected ForkedProcessService latestProcess() {
-    Service current = getActiveService();
-    Service prev = getPreviousService();
-
-    Service latest = current != null ? current : prev;
-    if (latest instanceof ForkedProcessService) {
-      return (ForkedProcessService) latest;
-    } else {
-      //its a composite object, so look inside it for a process
-      if (latest instanceof ServiceParent) {
-        return getFPSFromParentService((ServiceParent) latest);
-      } else {
-        //no match
-        return null;
-      }
-    }
-  }
-
-
-  /**
-   * Given a parent service, find the one that is a forked process
-   * @param serviceParent parent
-   * @return the forked process service or null if there is none
-   */
-  protected ForkedProcessService getFPSFromParentService(ServiceParent serviceParent) {
-    List<Service> services = serviceParent.getServices();
-    for (Service s : services) {
-      if (s instanceof ForkedProcessService) {
-        return (ForkedProcessService) s;
-      }
-    }
-    return null;
-  }
-
-  /**
-   * if we are already running, start this service
-   */
-  protected void maybeStartCommandSequence() {
-    if (isInState(STATE.STARTED)) {
-      startNextService();
-    }
-  }
-
-  /**
-   * Create a new forked process service with the given
-   * name, environment and command list -then add it as a child
-   * for execution in the sequence.
-   *
-   * @param name command name
-   * @param env environment
-   * @param commands command line
-   * @throws IOException
-   * @throws SliderException
-   */
-  protected ForkedProcessService queueCommand(String name,
-                              Map<String, String> env,
-                              List<String> commands) throws
-                                                     IOException,
-      SliderException {
-    ForkedProcessService process = buildProcess(name, env, commands);
-    //register the service for lifecycle management; when this service
-    //is terminated, so is the master process
-    addService(process);
-    return process;
-  }
-
-  public ForkedProcessService buildProcess(String name,
-                                           Map<String, String> env,
-                                           List<String> commands) throws
-                                                                  IOException,
-      SliderException {
-    ForkedProcessService process;
-    process = new ForkedProcessService(name);
-    process.init(getConfig());
-    process.build(env, commands);
-    return process;
-  }
-
-  /*
-   * Build the provider status, can be empty
-   * @return the provider status - map of entries to add to the info section
-   */
-  @Override
-  public Map<String, String> buildProviderStatus() {
-    return new HashMap<String, String>();
-  }
-
-  /*
-  Build the monitor details. The base implementation includes all the external URL endpoints
-  in the external view
-   */
-  @Override
-  public Map<String, MonitorDetail> buildMonitorDetails(ClusterDescription clusterDesc) {
-    Map<String, MonitorDetail> details = new LinkedHashMap<String, MonitorDetail>();
-
-    // add in all the endpoints
-    buildEndpointDetails(details);
-
-    return details;
-  }
-
-  @Override
-  public void buildEndpointDetails(Map<String, MonitorDetail> details) {
-    ServiceRecord self = yarnRegistry.getSelfRegistration();
-
-    List<Endpoint> externals = self.external;
-    for (Endpoint endpoint : externals) {
-      String addressType = endpoint.addressType;
-      if (AddressTypes.ADDRESS_URI.equals(addressType)) {
-        try {
-          List<URL> urls = RegistryTypeUtils.retrieveAddressURLs(endpoint);
-          if (!urls.isEmpty()) {
-            details.put(endpoint.api, new MonitorDetail(urls.get(0).toString(), true));
-          }
-        } catch (InvalidRecordException  | MalformedURLException ignored) {
-          // Ignored
-        }
-
-      }
-
-    }
-  }
-
-  @Override
-  public void applyInitialRegistryDefinitions(URL amWebURI,
-      URL agentOpsURI,
-      URL agentStatusURI,
-      ServiceRecord serviceRecord)
-    throws IOException {
-      this.amWebAPI = amWebURI;
-  }
-
-  /**
-   * {@inheritDoc}
-   * 
-   * 
-   * @return The base implementation returns the most recent containers first.
-   */
-  @Override
-  public ContainerReleaseSelector createContainerReleaseSelector() {
-    return new MostRecentContainerReleaseSelector();
-  }
-
-  @Override
-  public void releaseAssignedContainer(ContainerId containerId) {
-    // no-op
-  }
-
-  @Override
-  public void addContainerRequest(AMRMClient.ContainerRequest req) {
-    // no-op
-  }
-
-  @Override
-  public void cancelSingleRequest(AMRMClient.ContainerRequest request) {
-    // no-op
-  }
-
-  @Override
-  public int cancelContainerRequests(Priority priority1,
-      Priority priority2,
-      int count) {
-    return 0;
-  }
-
-  @Override
-  public void execute(List<AbstractRMOperation> operations) {
-    for (AbstractRMOperation operation : operations) {
-      operation.execute(this);
-    }
-  }
-  /**
-   * No-op implementation of this method.
-   */
-  @Override
-  public void rebuildContainerDetails(List<Container> liveContainers,
-      String applicationId, Map<Integer, ProviderRole> providerRoles) {
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/MonitorDetail.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/MonitorDetail.java b/slider-core/src/main/java/org/apache/slider/providers/MonitorDetail.java
deleted file mode 100644
index 27d3415..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/MonitorDetail.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers;
-
-/**
- * Details about some exported information from a provider to the AM web UI.
- */
-public class MonitorDetail {
-
-  private final String value;
-  private final boolean isUrl;
-
-  public MonitorDetail(String value, boolean isUrl) {
-    this.value = value;
-    this.isUrl = isUrl;
-  }
-
-  public String getValue() {
-    return value;
-  }
-
-  public boolean isUrl() {
-    return isUrl;
-  }
-
-  public String toString() {
-    return "MonitorDetail[" + value + " isUrl=" + isUrl + "]";
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/PlacementPolicy.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/PlacementPolicy.java b/slider-core/src/main/java/org/apache/slider/providers/PlacementPolicy.java
deleted file mode 100644
index 128dd5d..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/PlacementPolicy.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers;
-
-/**
- * Placement values.
- * This is nominally a bitmask, though not all values make sense
- */
-public class PlacementPolicy {
-
-  /**
-   * Default value: history used, anti-affinity hinted at on rebuild/flex up
-   */
-  public static final int NONE = 0;
-
-  /**
-   * Default value: history used, anti-affinity hinted at on rebuild/flex up
-   */
-  public static final int DEFAULT = NONE;
-
-  /**
-   * Strict placement: when asking for an instance for which there is
-   * history, mandate that it is strict
-   */
-  public static final int STRICT = 1;
-
-  /**
-   * No data locality; do not use placement history
-   */
-  public static final int ANYWHERE = 2;
-
-  /**
-   * @Deprecated: use {@link #ANYWHERE}
-   */
-  @Deprecated
-  public static final int NO_DATA_LOCALITY = ANYWHERE;
-
-  /**
-   * Anti-affinity is mandatory.
-   */
-  public static final int ANTI_AFFINITY_REQUIRED = 4;
-  
-  /**
-   * Exclude from flexing; used internally to mark AMs.
-   */
-  public static final int EXCLUDE_FROM_FLEXING = 16;
-
-}



[44/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/ClusterDescription.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/ClusterDescription.java b/slider-core/src/main/java/org/apache/slider/api/ClusterDescription.java
deleted file mode 100644
index f8e5e7c..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/ClusterDescription.java
+++ /dev/null
@@ -1,795 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.api;
-
-import org.apache.hadoop.fs.FSDataInputStream;
-import org.apache.hadoop.fs.FSDataOutputStream;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.slider.api.types.ApplicationLivenessInformation;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.providers.SliderProviderFactory;
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.SerializationConfig;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import static org.apache.slider.api.OptionKeys.INTERNAL_APPLICATION_HOME;
-import static org.apache.slider.api.OptionKeys.INTERNAL_APPLICATION_IMAGE_PATH;
-import static org.apache.slider.api.OptionKeys.ZOOKEEPER_PATH;
-import static org.apache.slider.api.OptionKeys.ZOOKEEPER_QUORUM;
-
-/**
- * Represents a cluster specification; designed to be sendable over the wire
- * and persisted in JSON by way of Jackson.
- * 
- * When used in cluster status operations the <code>info</code>
- * and <code>statistics</code> maps contain information about the cluster.
- * 
- * As a wire format it is less efficient in both xfer and ser/deser than 
- * a binary format, but by having one unified format for wire and persistence,
- * the code paths are simplified.
- *
- * This was the original single-file specification/model used in the Hoya
- * precursor to Slider. Its now retained primarily as a way to publish
- * the current state of the application, or at least a fraction thereof ...
- * the larger set of information from the REST API is beyond the scope of
- * this structure.
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-
-public class ClusterDescription implements Cloneable {
-  protected static final Logger
-    log = LoggerFactory.getLogger(ClusterDescription.class);
-
-  private static final String UTF_8 = "UTF-8";
-
-  /**
-   * version counter
-   */
-  public String version = "1.0";
-
-  /**
-   * Name of the cluster
-   */
-  public String name;
-
-  /**
-   * Type of cluster
-   */
-  public String type = SliderProviderFactory.DEFAULT_CLUSTER_TYPE;
-
-  /**
-   * State of the cluster
-   */
-  public int state;
-  
-  /*
-   State list for both clusters and nodes in them. Ordered so that destroyed follows
-   stopped.
-   
-   Some of the states are only used for recording
-   the persistent state of the cluster and are not
-   seen in node descriptions
-   */
-
-  /**
-   * Specification is incomplete & cannot
-   * be used: {@value}
-   */
-  public static final int STATE_INCOMPLETE = StateValues.STATE_INCOMPLETE;
-
-  /**
-   * Spec has been submitted: {@value}
-   */
-  public static final int STATE_SUBMITTED = StateValues.STATE_SUBMITTED;
-  /**
-   * Cluster created: {@value}
-   */
-  public static final int STATE_CREATED = StateValues.STATE_CREATED;
-  /**
-   * Live: {@value}
-   */
-  public static final int STATE_LIVE = StateValues.STATE_LIVE;
-  /**
-   * Stopped
-   */
-  public static final int STATE_STOPPED = StateValues.STATE_STOPPED;
-  /**
-   * destroyed
-   */
-  public static final int STATE_DESTROYED = StateValues.STATE_DESTROYED;
-  
-  /**
-   * When was the cluster specification created?
-   * This is not the time a cluster was thawed; that will
-   * be in the <code>info</code> section.
-   */
-  public long createTime;
-
-  /**
-   * When was the cluster specification last updated
-   */
-  public long updateTime;
-
-  /**
-   * URL path to the original configuration
-   * files; these are re-read when 
-   * restoring a cluster
-   */
-
-  public String originConfigurationPath;
-
-  /**
-   * URL path to the generated configuration
-   */
-  public String generatedConfigurationPath;
-
-  /**
-   * This is where the data goes
-   */
-  public String dataPath;
-
-  /**
-   * cluster-specific options -to control both
-   * the Slider AM and the application that it deploys
-   */
-  public Map<String, String> options = new HashMap<>();
-
-  /**
-   * cluster information
-   * This is only valid when querying the cluster status.
-   */
-  public Map<String, String> info = new HashMap<>();
-
-  /**
-   * Statistics. This is only relevant when querying the cluster status
-   */
-  public Map<String, Map<String, Integer>> statistics = new HashMap<>();
-
-  /**
-   * Instances: role->count
-   */
-  public Map<String, List<String>> instances = new HashMap<>();
-
-  /**
-   * Role options, 
-   * role -> option -> value
-   */
-  public Map<String, Map<String, String>> roles = new HashMap<>();
-
-
-  /**
-   * List of key-value pairs to add to a client config to set up the client
-   */
-  public Map<String, String> clientProperties = new HashMap<>();
-
-  /**
-   * Status information
-   */
-  public Map<String, Object> status;
-
-  /**
-   * Liveness information; the same as returned
-   * on the <code>live/liveness/</code> URL
-   */
-  public ApplicationLivenessInformation liveness;
-
-  /**
-   * Creator.
-   */
-  public ClusterDescription() {
-  }
-
-  @Override
-  public String toString() {
-    try {
-      return toJsonString();
-    } catch (Exception e) {
-      log.debug("Failed to convert CD to JSON ", e);
-      return super.toString();
-    }
-  }
-
-  /**
-   * Shallow clone
-   * @return a shallow clone
-   * @throws CloneNotSupportedException
-   */
-  @Override
-  public Object clone() throws CloneNotSupportedException {
-    return super.clone();
-  }
-
-  /**
-   * A deep clone of the spec. This is done inefficiently with a ser/derser
-   * @return the cluster description
-   */
-  public ClusterDescription deepClone() {
-    try {
-      return fromJson(toJsonString());
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-
-  /**
-   * Save a cluster description to a hadoop filesystem
-   * @param fs filesystem
-   * @param path path
-   * @param overwrite should any existing file be overwritten
-   * @throws IOException IO exception
-   */
-  public void save(FileSystem fs, Path path, boolean overwrite) throws
-                                                                IOException {
-    FSDataOutputStream dataOutputStream = fs.create(path, overwrite);
-    writeJsonAsBytes(dataOutputStream);
-  }
-  
-  /**
-   * Save a cluster description to the local filesystem
-   * @param file file
-   * @throws IOException IO excpetion
-   */
-  public void save(File file) throws IOException {
-    log.debug("Saving to {}", file.getAbsolutePath());
-    if (!file.getParentFile().mkdirs()) {
-      log.warn("Failed to mkdirs for {}", file.getParentFile());
-    }
-    DataOutputStream dataOutputStream = new DataOutputStream(new FileOutputStream(file));
-    writeJsonAsBytes(dataOutputStream);
-  }
-
-  /**
-   * Write the json as bytes -then close the file
-   * @param dataOutputStream an outout stream that will always be closed
-   * @throws IOException any failure
-   */
-  private void writeJsonAsBytes(DataOutputStream dataOutputStream)
-      throws IOException {
-    try {
-      String json = toJsonString();
-      byte[] b = json.getBytes(UTF_8);
-      dataOutputStream.write(b);
-    } finally {
-      dataOutputStream.close();
-    }
-  }
-
-  /**
-   * Load from the filesystem
-   * @param fs filesystem
-   * @param path path
-   * @return a loaded CD
-   * @throws IOException IO problems
-   */
-  public static ClusterDescription load(FileSystem fs, Path path)
-      throws IOException, JsonParseException, JsonMappingException {
-    FileStatus status = fs.getFileStatus(path);
-    byte[] b = new byte[(int) status.getLen()];
-    FSDataInputStream dataInputStream = fs.open(path);
-    int count = dataInputStream.read(b);
-    String json = new String(b, 0, count, UTF_8);
-    return fromJson(json);
-  }
-
-  /**
-   * Make a deep copy of the class
-   * @param source source
-   * @return the copy
-   */
-  public static ClusterDescription copy(ClusterDescription source) {
-    //currently the copy is done by a generate/save. Inefficient but it goes
-    //down the tree nicely
-    try {
-      return fromJson(source.toJsonString());
-    } catch (IOException e) {
-      throw new RuntimeException("ClusterDescription copy failed " + e, e);
-    }
-  }
-
-  /**
-   * Convert to a JSON string
-   * @return a JSON string description
-   * @throws IOException Problems mapping/writing the object
-   */
-  public String toJsonString() throws IOException,
-                                      JsonGenerationException,
-                                      JsonMappingException {
-    ObjectMapper mapper = new ObjectMapper();
-    mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
-    return mapper.writeValueAsString(this);
-  }
-
-  /**
-   * Convert from JSON
-   * @param json input
-   * @return the parsed JSON
-   * @throws IOException IO
-   * @throws JsonMappingException failure to map from the JSON to this class
-   */
-  public static ClusterDescription fromJson(String json)
-    throws IOException, JsonParseException, JsonMappingException {
-    ObjectMapper mapper = new ObjectMapper();
-    try {
-      return mapper.readValue(json, ClusterDescription.class);
-    } catch (IOException e) {
-      log.error("Exception while parsing json : " + e + "\n" + json, e);
-      throw e;
-    }
-  }
-
-    /**
-     * Convert from input stream
-     * @param is input stream of cluster description
-     * @return the parsed JSON
-     * @throws IOException IO
-     * @throws JsonMappingException failure to map from the JSON to this class
-     */
-    public static ClusterDescription fromStream(InputStream is)
-            throws IOException, JsonParseException, JsonMappingException {
-        if (is==null) {
-          throw new FileNotFoundException("Empty Stream");
-        }
-        ObjectMapper mapper = new ObjectMapper();
-        try {
-            return mapper.readValue(is, ClusterDescription.class);
-        } catch (IOException e) {
-            log.error("Exception while parsing input stream : {}", e, e);
-      throw e;
-    }
-  }
-
-  /**
-   * Convert from a JSON file
-   * @param jsonFile input file
-   * @return the parsed JSON
-   * @throws IOException IO problems
-   * @throws JsonMappingException failure to map from the JSON to this class
-   */
-  public static ClusterDescription fromFile(File jsonFile)
-    throws IOException, JsonParseException, JsonMappingException {
-    ObjectMapper mapper = new ObjectMapper();
-    try {
-      return mapper.readValue(jsonFile, ClusterDescription.class);
-    } catch (IOException e) {
-      log.error("Exception while parsing json file {}" , jsonFile, e);
-      throw e;
-    }
-  }
-
-  /**
-   * Set a cluster option: a key val pair in the options {} section
-   * @param key key option name
-   * @param val value option value
-   */
-  public void setOption(String key, String val) {
-    options.put(key, val);
-  }
-
-  /**
-   * Set a cluster option if it is unset. If it is already set,
-   * in the Cluster Description, it is left alone
-   * @param key key key to query/set
-   * @param val value value
-   */
-
-  public void setOptionifUnset(String key, String val) {
-    if (options.get(key) == null) {
-      options.put(key, val);
-    }
-  }
-
-  /**
-   * Set an integer option -it's converted to a string before saving
-   * @param option option name
-   * @param val integer value
-   */
-  public void setOption(String option, int val) {
-    setOption(option, Integer.toString(val));
-  }
-
-  /**
-   * Set a boolean option
-   * @param option option name
-   * @param val bool value
-   */
-  public void setOption(String option, boolean val) {
-    setOption(option, Boolean.toString(val));
-  }
-
-  /**
-   * Get a cluster option or value
-   *
-   * @param key option key
-   * @param defVal option val
-   * @return resolved value or default
-   */
-  public String getOption(String key, String defVal) {
-    String val = options.get(key);
-    return val != null ? val : defVal;
-  }
-
-  /**
-   * Get a cluster option or value
-   *
-   * @param key mandatory key
-   * @return the value
-   * @throws BadConfigException if the option is missing
-   */
-  public String getMandatoryOption(String key) throws BadConfigException {
-    String val = options.get(key);
-    if (val == null) {
-      throw new BadConfigException("Missing option " + key);
-    }
-    return val;
-  }
-
-  /**
-   * Get an integer option; use {@link Integer#decode(String)} so as to take hex
-   * oct and bin values too.
-   *
-   * @param option option name
-   * @param defVal default value
-   * @return parsed value
-   * @throws NumberFormatException if the role could not be parsed.
-   */
-  public int getOptionInt(String option, int defVal) {
-    String val = getOption(option, Integer.toString(defVal));
-    return Integer.decode(val);
-  }
-
-  /**
-   * Verify that an option is set: that is defined AND non-empty
-   * @param key key to verify
-   * @throws BadConfigException
-   */
-  public void verifyOptionSet(String key) throws BadConfigException {
-    if (SliderUtils.isUnset(getOption(key, null))) {
-      throw new BadConfigException("Unset cluster option %s", key);
-    }
-  }
-
-  /**
-   * Get an option as a boolean. Note that {@link Boolean#valueOf(String)}
-   * is used for parsing -its policy of what is true vs false applies.
-   * @param option name
-   * @param defVal default
-   * @return the option.
-   */
-  public boolean getOptionBool(String option, boolean defVal) {
-    return Boolean.valueOf(getOption(option, Boolean.toString(defVal)));
-  }
-
-  /**
-   * Get a role option
-   * @param role role to get from
-   * @param option option name
-   * @param defVal default value
-   * @return resolved value
-   */
-  public String getRoleOpt(String role, String option, String defVal) {
-    Map<String, String> roleopts = getRole(role);
-    if (roleopts == null) {
-      return defVal;
-    }
-    String val = roleopts.get(option);
-    return val != null ? val : defVal;
-  }
-
-  /**
-   * Get a mandatory role option
-   * @param role role to get from
-   * @param option option name
-   * @return resolved value
-   * @throws BadConfigException if the option is not defined
-   */
-  public String getMandatoryRoleOpt(String role, String option) throws
-                                                                BadConfigException {
-    Map<String, String> roleopts = getRole(role);
-    if (roleopts == null) {
-      throw new BadConfigException("Missing role %s ", role);
-    }
-    String val = roleopts.get(option);
-    if (val == null) {
-      throw new BadConfigException("Missing option '%s' in role %s ", option, role);
-    }
-    return val;
-  }
-
-  /**
-   * Get a mandatory integer role option
-   * @param role role to get from
-   * @param option option name
-   * @return resolved value
-   * @throws BadConfigException if the option is not defined
-   */
-  public int getMandatoryRoleOptInt(String role, String option)
-      throws BadConfigException {
-    getMandatoryRoleOpt(role, option);
-    return getRoleOptInt(role, option, 0);
-  }
-  
-  /**
-   * look up a role and return its options
-   * @param role role
-   * @return role mapping or null
-   */
-  public Map<String, String> getRole(String role) {
-    return roles.get(role);
-  }
-
-  /**
-   * Get a role -adding it to the roleopts map if
-   * none with that name exists
-   * @param role role
-   * @return role mapping
-   */
-  public Map<String, String> getOrAddRole(String role) {
-    Map<String, String> map = getRole(role);
-    if (map == null) {
-      map = new HashMap<>();
-    }
-    roles.put(role, map);
-    return map;
-  }
-  
-  /*
-   * return the Set of role names
-   */
-  @JsonIgnore
-  public Set<String> getRoleNames() {
-    return new HashSet<>(roles.keySet());
-  }
-
-  /**
-   * Get a role whose presence is mandatory
-   * @param role role name
-   * @return the mapping
-   * @throws BadConfigException if the role is not there
-   */
-  public Map<String, String> getMandatoryRole(String role) throws
-                                                           BadConfigException {
-    Map<String, String> roleOptions = getRole(role);
-    if (roleOptions == null) {
-      throw new BadConfigException("Missing role " + role);
-    }
-    return roleOptions;
-  }
-
-  /**
-   * Get an integer role option; use {@link Integer#decode(String)} so as to take hex
-   * oct and bin values too.
-   *
-   * @param role role to get from
-   * @param option option name
-   * @param defVal default value
-   * @return parsed value
-   * @throws NumberFormatException if the role could not be parsed.
-   */
-  public int getRoleOptInt(String role, String option, int defVal) {
-    String val = getRoleOpt(role, option, Integer.toString(defVal));
-    return Integer.decode(val);
-  }
-
-  /**
-   * Get an integer role option; use {@link Integer#decode(String)} so as to take hex
-   * oct and bin values too.
-   *
-   * @param role role to get from
-   * @param option option name
-   * @param defVal default value
-   * @return parsed value
-   * @throws NumberFormatException if the role could not be parsed.
-   */
-  public long getRoleOptLong(String role, String option, long defVal) {
-    String val = getRoleOpt(role, option, Long.toString(defVal));
-    return Long.decode(val);
-  }
-
-  /**
-   * Set a role option, creating the role if necessary
-   * @param role role name
-   * @param option option name
-   * @param val value
-   */
-  public void setRoleOpt(String role, String option, String val) {
-    Map<String, String> roleopts = getOrAddRole(role);
-    roleopts.put(option, val);
-  }
-
-  /**
-   * Set an integer role option, creating the role if necessary
-   * @param role role name
-   * @param option option name
-   * @param val integer value
-   */
-  public void setRoleOpt(String role, String option, int val) {
-    setRoleOpt(role, option, Integer.toString(val));
-  }
-
-  /**
-   * Set a role option of any object, using its string value.
-   * This works for (Boxed) numeric values as well as other objects
-   * @param role role name
-   * @param option option name
-   * @param val non-null value
-   */
-  public void setRoleOpt(String role, String option, Object val) {
-    setRoleOpt(role, option, val.toString());
-  }
-
-  /**
-   * Get the value of a role requirement (cores, RAM, etc).
-   * These are returned as integers, but there is special handling of the 
-   * string {@link ResourceKeys#YARN_RESOURCE_MAX}, which triggers
-   * the return of the maximum value.
-   * @param role role to get from
-   * @param option option name
-   * @param defVal default value
-   * @param maxVal value to return if the max val is requested
-   * @return parsed value
-   * @throws NumberFormatException if the role could not be parsed.
-   */
-  public int getRoleResourceRequirement(String role, String option, int defVal, int maxVal) {
-    String val = getRoleOpt(role, option, Integer.toString(defVal));
-    Integer intVal;
-    if (ResourceKeys.YARN_RESOURCE_MAX.equals(val)) {
-      intVal = maxVal;
-    } else {
-      intVal = Integer.decode(val);
-    }
-    return intVal;
-  }
-
-
-  /**
-   * Set the time for an information (human, machine) timestamp pair of fields.
-   * The human time is the time in millis converted via the {@link Date} class.
-   * @param keyHumanTime name of human time key
-   * @param keyMachineTime name of machine time
-   * @param time timestamp
-   */
-  
-  public void setInfoTime(String keyHumanTime, String keyMachineTime, long time) {
-    SliderUtils.setInfoTime(info, keyHumanTime, keyMachineTime, time);
-  }
-
-  /**
-   * Set an information string. This is content that is only valid in status
-   * reports.
-   * @param key key
-   * @param value string value
-   */
-  @JsonIgnore
-  public void setInfo(String key, String value) {
-    info.put(key, value);
-  }
-
-  /**
-   * Get an information string. This is content that is only valid in status
-   * reports.
-   * @param key key
-   * @return the value or null
-   */
-  @JsonIgnore
-  public String getInfo(String key) {
-    return info.get(key);
-  }
-
-  /**
-   * Get an information string. This is content that is only valid in status
-   * reports.
-   * @param key key
-   * @return the value or null
-   */
-  @JsonIgnore
-  public boolean getInfoBool(String key) {
-    String val = info.get(key);
-    if (val != null) {
-      return Boolean.valueOf(val);
-    }
-    return false;
-  }
-
-  @JsonIgnore
-  public String getZkHosts() throws BadConfigException {
-    return getMandatoryOption(ZOOKEEPER_QUORUM);
-  }
-
-  /**
-   * Set the hosts for the ZK quorum
-   * @param zkHosts a comma separated list of hosts
-   */
-  @JsonIgnore
-  public void setZkHosts(String zkHosts) {
-    setOption(ZOOKEEPER_QUORUM, zkHosts);
-  }
-
-  @JsonIgnore
-  public String getZkPath() throws BadConfigException {
-    return getMandatoryOption(ZOOKEEPER_PATH);
-  }
-
-  @JsonIgnore
-  public void setZkPath(String zkPath) {
-    setOption(ZOOKEEPER_PATH, zkPath);
-  }
-
-  /**
-   * HBase home: if non-empty defines where a copy of HBase is preinstalled
-   */
-  @JsonIgnore
-  public String getApplicationHome() {
-    return getOption(INTERNAL_APPLICATION_HOME, "");
-  }
-
-  @JsonIgnore
-  public void setApplicationHome(String applicationHome) {
-    setOption(INTERNAL_APPLICATION_HOME, applicationHome);
-  }
-
-  /**
-   * The path in HDFS where the HBase image is
-   */
-  @JsonIgnore
-  public String getImagePath() {
-    return getOption(INTERNAL_APPLICATION_IMAGE_PATH, "");
-  }
-
-  /**
-   * Set the path in HDFS where the HBase image is
-   */
-  @JsonIgnore
-  public void setImagePath(String imagePath) {
-    setOption(INTERNAL_APPLICATION_IMAGE_PATH, imagePath);
-  }
-
-  /**
-   * Query for the image path being set (non null/non empty)
-   * @return true if there is a path in the image path option
-   */
-  @JsonIgnore
-  public boolean isImagePathSet() {
-    return SliderUtils.isSet(getImagePath());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/ClusterDescriptionKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/ClusterDescriptionKeys.java b/slider-core/src/main/java/org/apache/slider/api/ClusterDescriptionKeys.java
deleted file mode 100644
index 5b7a92a..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/ClusterDescriptionKeys.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api;
-
-public class ClusterDescriptionKeys {
-
-  public static final String KEY_CLUSTER_LIVE = "live"; 
-  public static final String KEY_CLUSTER_FAILED = "failed"; 
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/ClusterDescriptionOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/ClusterDescriptionOperations.java b/slider-core/src/main/java/org/apache/slider/api/ClusterDescriptionOperations.java
deleted file mode 100644
index 5b95414..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/ClusterDescriptionOperations.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api;
-
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.providers.SliderProviderFactory;
-
-import java.util.Map;
-
-import static org.apache.slider.api.OptionKeys.ZOOKEEPER_PATH;
-import static org.apache.slider.api.OptionKeys.ZOOKEEPER_QUORUM;
-
-/**
- * Operations on Cluster Descriptions
- */
-public class ClusterDescriptionOperations {
-
-
-  public static ClusterDescription buildFromInstanceDefinition(AggregateConf aggregateConf) throws
-                                                                                       BadConfigException {
-
-    ClusterDescription cd = new ClusterDescription();
-    
-    aggregateConf.resolve();
-
-    //options are a merge of all globals
-    Map<String, String> options = cd.options;
-    SliderUtils.mergeMapsIgnoreDuplicateKeys(options,
-        aggregateConf.getInternal().global);
-    SliderUtils.mergeMapsIgnoreDuplicateKeys(options,
-        aggregateConf.getAppConf().global);
-    SliderUtils.mergeMapsIgnoreDuplicateKeys(options,
-        aggregateConf.getResources().global);
-
-    //roles are the role values merged in the same order
-    mergeInComponentMap(cd, aggregateConf.getInternal());
-    mergeInComponentMap(cd, aggregateConf.getAppConf());
-    mergeInComponentMap(cd, aggregateConf.getResources());
-
-    //now add the extra bits
-    cd.state = ClusterDescription.STATE_LIVE;
-    MapOperations internalOptions =
-      aggregateConf.getInternalOperations().getGlobalOptions();
-    MapOperations appOptions =
-      aggregateConf.getAppConfOperations().getGlobalOptions();
-
-    cd.type = internalOptions.getOption(InternalKeys.INTERNAL_PROVIDER_NAME,
-                                SliderProviderFactory.DEFAULT_CLUSTER_TYPE);
-
-    cd.dataPath = internalOptions.get(InternalKeys.INTERNAL_DATA_DIR_PATH);
-    cd.name = internalOptions.get(OptionKeys.APPLICATION_NAME);
-    cd.originConfigurationPath = internalOptions.get(InternalKeys.INTERNAL_SNAPSHOT_CONF_PATH);
-    cd.generatedConfigurationPath = internalOptions.get(InternalKeys.INTERNAL_GENERATED_CONF_PATH);
-    cd.setImagePath(internalOptions.get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH));
-    cd.setApplicationHome(internalOptions.get(InternalKeys.INTERNAL_APPLICATION_HOME));
-    cd.setZkPath(appOptions.get(ZOOKEEPER_PATH));
-    cd.setZkHosts(appOptions.get(ZOOKEEPER_QUORUM));
-    
-    return cd;
-  }
-
-  private static void mergeInComponentMap(ClusterDescription cd,
-                                          ConfTree confTree) {
-
-    Map<String, Map<String, String>> components = confTree.components;
-    for (Map.Entry<String, Map<String, String>> compEntry : components.entrySet()) {
-      String name = compEntry.getKey();
-      Map<String, String> destRole = cd.getOrAddRole(name);
-      Map<String, String> sourceComponent = compEntry.getValue();
-      SliderUtils.mergeMapsIgnoreDuplicateKeys(destRole, sourceComponent);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/ClusterNode.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/ClusterNode.java b/slider-core/src/main/java/org/apache/slider/api/ClusterNode.java
deleted file mode 100644
index 8b0a563..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/ClusterNode.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.api;
-
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.slider.api.proto.Messages;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-
-/**
- * Describe a specific node in the cluster
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL )
-public final class ClusterNode implements Cloneable {
-  protected static final Logger
-    LOG = LoggerFactory.getLogger(ClusterNode.class);
-  
-  @JsonIgnore
-  public ContainerId containerId;
-
-  /**
-   * server name
-   */
-  public String name;
-
-
-  /**
-   * UUID of container used in Slider RPC to refer to instances
-   */
-  public String id;
-  
-  public String role;
-  
-  public int roleId;
-
-  public long createTime;
-  public long startTime;
-  /**
-   * flag set when it is released, to know if it has
-   * already been targeted for termination
-   */
-  public boolean released;
-  public String host;
-  public String ip;
-  public String hostname;
-  public String hostUrl;
-
-  /**
-   * state from {@link ClusterDescription}
-   */
-  public int state;
-
-  /**
-   * Exit code: only valid if the state >= STOPPED
-   */
-  public int exitCode;
-
-  /**
-   * what was the command executed?
-   */
-  public String command;
-
-  /**
-   * Any diagnostics
-   */
-  public String diagnostics;
-
-  /**
-   * What is the tail output from the executed process (or [] if not started
-   * or the log cannot be picked up
-   */
-  public String[] output;
-
-  /**
-   * Any environment details
-   */
-  public String[] environment;
-
-  /**
-   * server-side ctor takes the container ID and builds the name from it
-   * @param containerId container ID; can be null
-   */
-  public ClusterNode(ContainerId containerId) {
-    if (containerId != null) {
-      this.containerId = containerId;
-      this.name = containerId.toString();
-    }
-  }
-
-  /**
-   * ctor for deserialization
-   */
-  public ClusterNode() {
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder builder = new StringBuilder();
-    builder.append(name).append(": ");
-    builder.append(state).append("\n");
-    builder.append("state: ").append(state).append("\n");
-    builder.append("role: ").append(role).append("\n");
-    append(builder, "host", host);
-    append(builder, "hostURL", hostUrl);
-    append(builder, "command", command);
-    if (output != null) {
-      for (String line : output) {
-        builder.append(line).append("\n");
-      }
-    }
-    append(builder, "diagnostics", diagnostics);
-    return builder.toString();
-  }
-
-  private void append(StringBuilder builder, String key, Object val) {
-    if (val != null) {
-      builder.append(key).append(": ").append(val.toString()).append("\n");
-    }
-  }
-  
-  /**
-   * Convert to a JSON string
-   * @return a JSON string description
-   * @throws IOException Problems mapping/writing the object
-   */
-  public String toJsonString() throws IOException {
-    ObjectMapper mapper = new ObjectMapper();
-    return mapper.writeValueAsString(this);
-  }
-
-
-  /**
-   * Convert from JSON
-   * @param json input
-   * @return the parsed JSON
-   * @throws IOException IO
-   */
-  public static ClusterNode fromJson(String json)
-    throws IOException, JsonParseException, JsonMappingException {
-    ObjectMapper mapper = new ObjectMapper();
-    try {
-      return mapper.readValue(json, ClusterNode.class);
-    } catch (IOException e) {
-      LOG.error("Exception while parsing json : {}\n{}", e , json, e);
-      throw e;
-    }
-  }
-
-  /**
-   * Build from a protobuf response
-   * @param message
-   * @return the deserialized node
-   */
-  public static ClusterNode fromProtobuf(Messages.RoleInstanceState message) {
-    ClusterNode node = new ClusterNode();
-    node.name = message.getName();
-    node.command = message.getCommand();
-    node.diagnostics = message.getDiagnostics();
-    String[] arr;
-    int environmentCount = message.getEnvironmentCount();
-    if (environmentCount > 0) {
-      arr = new String[environmentCount];
-      node.environment = message.getEnvironmentList().toArray(arr);
-    }
-    node.exitCode = message.getExitCode();
-    int outputCount = message.getOutputCount();
-    if (outputCount > 0) {
-      arr = new String[outputCount];
-      node.output = message.getOutputList().toArray(arr);
-    }
-    node.role = message.getRole();
-    node.roleId = message.getRoleId();
-    node.state = message.getState();
-    node.host = message.getHost();
-    node.hostUrl = message.getHostURL();
-    node.createTime = message.getCreateTime();
-    node.startTime = message.getStartTime();
-    node.released = message.getReleased();
-    return node;
-  }
-
-  @Override
-  public Object clone() throws CloneNotSupportedException {
-    return super.clone();
-  }
-  
-  public ClusterNode doClone() {
-    try {
-      return (ClusterNode)clone();
-    } catch (CloneNotSupportedException e) {
-      //not going to happen. This is a final class
-      return null;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/InternalKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/InternalKeys.java b/slider-core/src/main/java/org/apache/slider/api/InternalKeys.java
deleted file mode 100644
index fcaaf0e..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/InternalKeys.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api;
-
-/**
- * Keys for internal use, go into `internal.json` and not intended for normal
- * use except when tuning Slider AM operations
- */
-public interface InternalKeys {
-
-
-  /**
-   * Home dir of the app: {@value}
-   * If set, implies there is a home dir to use
-   */
-  String INTERNAL_APPLICATION_HOME = "internal.application.home";
-  /**
-   * Path to an image file containing the app: {@value}
-   */
-  String INTERNAL_APPLICATION_IMAGE_PATH = "internal.application.image.path";
-  /**
-   * Time in milliseconds to wait after forking any in-AM 
-   * process before attempting to start up the containers: {@value}
-   * 
-   * A shorter value brings the cluster up faster, but means that if the
-   * in AM process fails (due to a bad configuration), then time
-   * is wasted starting containers on a cluster that isn't going to come
-   * up
-   */
-  String INTERNAL_CONTAINER_STARTUP_DELAY = "internal.container.startup.delay";
-  /**
-   * internal temp directory: {@value}
-   */
-  String INTERNAL_AM_TMP_DIR = "internal.am.tmp.dir";
-  /**
-   * internal temp directory: {@value}
-   */
-  String INTERNAL_TMP_DIR = "internal.tmp.dir";
-  /**
-   * where a snapshot of the original conf dir is: {@value}
-   */
-  String INTERNAL_SNAPSHOT_CONF_PATH = "internal.snapshot.conf.path";
-  /**
-   * where a snapshot of the original conf dir is: {@value}
-   */
-  String INTERNAL_GENERATED_CONF_PATH = "internal.generated.conf.path";
-  /**
-   * where a snapshot of the original conf dir is: {@value}
-   */
-  String INTERNAL_PROVIDER_NAME = "internal.provider.name";
-  /**
-   * where a snapshot of the original conf dir is: {@value}
-   */
-  String INTERNAL_DATA_DIR_PATH = "internal.data.dir.path";
-  /**
-   * where the app def is stored
-   */
-  String INTERNAL_APPDEF_DIR_PATH = "internal.appdef.dir.path";
-  /**
-   * where addons for the app are stored
-   */
-  String INTERNAL_ADDONS_DIR_PATH = "internal.addons.dir.path";
-  /**
-   * Time in milliseconds to wait after forking any in-AM 
-   * process before attempting to start up the containers: {@value}
-   *
-   * A shorter value brings the cluster up faster, but means that if the
-   * in AM process fails (due to a bad configuration), then time
-   * is wasted starting containers on a cluster that isn't going to come
-   * up
-   */
-  int DEFAULT_INTERNAL_CONTAINER_STARTUP_DELAY = 5000;
-  /**
-   * Time in seconds before a container is considered long-lived.
-   * Shortlived containers are interpreted as a problem with the role
-   * and/or the host: {@value}
-   */
-  String INTERNAL_CONTAINER_FAILURE_SHORTLIFE =
-      "internal.container.failure.shortlife";
-  /**
-   * Default short life threshold: {@value}
-   */
-  int DEFAULT_INTERNAL_CONTAINER_FAILURE_SHORTLIFE = 60;
-  
-  /**
-   * Version of the app: {@value}
-   */
-  String KEYTAB_LOCATION = "internal.keytab.location";
-
-  /**
-   * Queue used to deploy the app: {@value}
-   */
-  String INTERNAL_QUEUE = "internal.queue";
-
-  /**
-   * Flag to indicate whether or not the chaos monkey is enabled:
-   * {@value}
-   */
-  String CHAOS_MONKEY_ENABLED = "internal.chaos.monkey.enabled";
-  boolean DEFAULT_CHAOS_MONKEY_ENABLED = false;
-
-
-  /**
-   * Rate
-   */
-
-  String CHAOS_MONKEY_INTERVAL = "internal.chaos.monkey.interval";
-  String CHAOS_MONKEY_INTERVAL_DAYS = CHAOS_MONKEY_INTERVAL + ".days";
-  String CHAOS_MONKEY_INTERVAL_HOURS = CHAOS_MONKEY_INTERVAL + ".hours";
-  String CHAOS_MONKEY_INTERVAL_MINUTES = CHAOS_MONKEY_INTERVAL + ".minutes";
-  String CHAOS_MONKEY_INTERVAL_SECONDS = CHAOS_MONKEY_INTERVAL + ".seconds";
-  
-  int DEFAULT_CHAOS_MONKEY_INTERVAL_DAYS = 0;
-  int DEFAULT_CHAOS_MONKEY_INTERVAL_HOURS = 0;
-  int DEFAULT_CHAOS_MONKEY_INTERVAL_MINUTES = 0;
-
-  String CHAOS_MONKEY_DELAY = "internal.chaos.monkey.delay";
-  String CHAOS_MONKEY_DELAY_DAYS = CHAOS_MONKEY_DELAY + ".days";
-  String CHAOS_MONKEY_DELAY_HOURS = CHAOS_MONKEY_DELAY + ".hours";
-  String CHAOS_MONKEY_DELAY_MINUTES = CHAOS_MONKEY_DELAY + ".minutes";
-  String CHAOS_MONKEY_DELAY_SECONDS = CHAOS_MONKEY_DELAY + ".seconds";
-  
-  int DEFAULT_CHAOS_MONKEY_STARTUP_DELAY = 0;
-
-  /**
-   * Prefix for all chaos monkey probabilities
-   */
-  String CHAOS_MONKEY_PROBABILITY =
-      "internal.chaos.monkey.probability";
-  /**
-   * Probabilies are out of 10000 ; 100==1%
-   */
-
-  /**
-   * Probability of a monkey check killing the AM:  {@value}
-   */
-  String CHAOS_MONKEY_PROBABILITY_AM_FAILURE =
-      CHAOS_MONKEY_PROBABILITY + ".amfailure";
-
-  /**
-   * Default probability of a monkey check killing the AM:  {@value}
-   */
-  int DEFAULT_CHAOS_MONKEY_PROBABILITY_AM_FAILURE = 0;
-
-  /**
-   * Probability of a monkey check killing the AM:  {@value}
-   */
-  String CHAOS_MONKEY_PROBABILITY_AM_LAUNCH_FAILURE =
-      CHAOS_MONKEY_PROBABILITY + ".amlaunchfailure";
-
-  /**
-   * Probability of a monkey check killing a container:  {@value}
-   */
-
-  String CHAOS_MONKEY_PROBABILITY_CONTAINER_FAILURE =
-      CHAOS_MONKEY_PROBABILITY + ".containerfailure";
-
-  /**
-   * Default probability of a monkey check killing the a container:  {@value}
-   */
-  int DEFAULT_CHAOS_MONKEY_PROBABILITY_CONTAINER_FAILURE = 0;
-
-
-  /**
-   * 1% of chaos
-   */
-  int PROBABILITY_PERCENT_1 = 100;
-  
-  /**
-   * 100% for chaos values
-   */
-  int PROBABILITY_PERCENT_100 = 100 * PROBABILITY_PERCENT_1;
-
-  /**
-   * interval between checks for escalation: {@value}
-   */
-  String ESCALATION_CHECK_INTERVAL = "escalation.check.interval.seconds";
-
-  /**
-   * default value: {@value}
-   */
-  int DEFAULT_ESCALATION_CHECK_INTERVAL = 30;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/OptionKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/OptionKeys.java b/slider-core/src/main/java/org/apache/slider/api/OptionKeys.java
deleted file mode 100644
index a035a99..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/OptionKeys.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api;
-
-/**
- *  Keys for entries in the <code>options</code> section
- *  of a cluster description.
- */
-public interface OptionKeys extends InternalKeys {
-
-  /**
-   * Time in milliseconds to wait after forking any in-AM 
-   * process before attempting to start up the containers: {@value}
-   * 
-   * A shorter value brings the cluster up faster, but means that if the
-   * in AM process fails (due to a bad configuration), then time
-   * is wasted starting containers on a cluster that isn't going to come
-   * up
-   */
-  String APPLICATION_TYPE = "application.type";
-  
-  String APPLICATION_NAME = "application.name";
-
-  /**
-   * Prefix for site.xml options: {@value}
-   */
-  String SITE_XML_PREFIX = "site.";
-
-
-  /**
-   * Zookeeper quorum host list: {@value}
-   */
-  String ZOOKEEPER_QUORUM = "zookeeper.quorum";
-  String ZOOKEEPER_HOSTS = "zookeeper.hosts";
-  String ZOOKEEPER_PORT = "zookeeper.port";
-
-  /**
-   * Zookeeper path value (string): {@value}
-   */
-  String ZOOKEEPER_PATH = "zookeeper.path";
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/ResourceKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/ResourceKeys.java b/slider-core/src/main/java/org/apache/slider/api/ResourceKeys.java
deleted file mode 100644
index 92890be..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/ResourceKeys.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api;
-
-/**
- * These are the keys valid in resource options
- *
- /*
-
- Container failure window.
-
- The window is calculated in minutes as as (days * 24 *60 + hours* 24 + minutes)
-
- Every interval of this period after the AM is started/restarted becomes
- the time period in which the CONTAINER_FAILURE_THRESHOLD value is calculated.
- 
- After the window limit is reached, the failure counts are reset. This
- is not a sliding window/moving average policy, simply a rule such as
- "every six hours the failure count is reset"
-
-
- <pre>
- ===========================================================================
- </pre>
-
- */
-public interface ResourceKeys {
-
-
-  /**
-   * #of instances of a component: {@value}
-   *
-  */
-  String COMPONENT_INSTANCES = "yarn.component.instances";
-
-  /**
-   * Whether to use unique names for each instance of a component: {@value}
-   */
-  String UNIQUE_NAMES = "component.unique.names";
-
-  /**
-   *  Amount of memory to ask YARN for in MB.
-   *  <i>Important:</i> this may be a hard limit on the
-   *  amount of RAM that the service can use
-   *  {@value}
-   */
-  String YARN_MEMORY = "yarn.memory";
-  
-  /** {@value} */
-  int DEF_YARN_MEMORY = 256;
-  
-  /**
-   * Number of cores/virtual cores to ask YARN for
-   *  {@value}
-   */
-  String YARN_CORES = "yarn.vcores";
-
-  /**
-   * Number of disks per instance to ask YARN for
-   *  {@value}
-   */
-  String YARN_DISKS = "yarn.disks.count-per-instance";
-
-  /**
-   * Disk size per disk to ask YARN for
-   *  {@value}
-   */
-  String YARN_DISK_SIZE = "yarn.disk.size";
-
-  /** {@value} */
-  int DEF_YARN_CORES = 1;
-
-
-  /**
-   * Label expression that this container must satisfy
-   *  {@value}
-   */
-  String YARN_LABEL_EXPRESSION = "yarn.label.expression";
-
-  /** default label expression: */
-  String DEF_YARN_LABEL_EXPRESSION = null;
-
-
-  /**
-   * Constant to indicate that the requirements of a YARN resource limit
-   * (cores, memory, ...) should be set to the maximum allowed by
-   * the queue into which the YARN container requests are placed.
-   */
-  String YARN_RESOURCE_MAX = "max";
-  
-  /**
-   * Mandatory property for all roles
-   * 1. this must be defined.
-   * 2. this must be >= 1
-   * 3. this must not match any other role priority in the cluster.
-   */
-  String COMPONENT_PRIORITY = "yarn.role.priority";
-  
-  /**
-   * placement policy
-   */
-  String COMPONENT_PLACEMENT_POLICY = "yarn.component.placement.policy";
-
-  /**
-   * Maximum number of node failures that can be tolerated by a component on a specific node
-   */
-  String NODE_FAILURE_THRESHOLD =
-      "yarn.node.failure.threshold";
-
-  /**
-   * maximum number of failed containers (in a single role)
-   * before the cluster is deemed to have failed {@value}
-   */
-  String CONTAINER_FAILURE_THRESHOLD =
-      "yarn.container.failure.threshold";
-
-  /**
-   * prefix for the time of the container failure reset window.
-   * {@value}
-   */
-
-  String CONTAINER_FAILURE_WINDOW =
-      "yarn.container.failure.window";
-
-
-
-  int DEFAULT_CONTAINER_FAILURE_WINDOW_DAYS = 0;
-  int DEFAULT_CONTAINER_FAILURE_WINDOW_HOURS = 6;
-  int DEFAULT_CONTAINER_FAILURE_WINDOW_MINUTES = 0;
-
-
-  /**
-   * Default failure threshold: {@value}
-   */
-  int DEFAULT_CONTAINER_FAILURE_THRESHOLD = 5;
-
-  /**
-   * Default node failure threshold for a component instance: {@value}
-   * Should to be lower than default component failure threshold to allow
-   * the component to start elsewhere
-   */
-  int DEFAULT_NODE_FAILURE_THRESHOLD = 3;
-
-  /**
-   * Failure threshold is unlimited: {@value}
-   */
-  int NODE_FAILURE_THRESHOLD_UNLIMITED = -1;
-
-  /**
-   * Time in seconds to escalate placement delay
-   */
-  String PLACEMENT_ESCALATE_DELAY =
-      "yarn.placement.escalate.seconds";
-
-  /**
-   * Time to have a strict placement policy outstanding before 
-   * downgrading to a lax placement (for those components which permit that).
-   * <ol>
-   *   <li>For strictly placed components, there's no relaxation.</li>
-   *   <li>For components with no locality, there's no need to relax</li>
-   * </ol>
-   * 
-   */
-  int DEFAULT_PLACEMENT_ESCALATE_DELAY_SECONDS = 30;
-
-  /**
-   * Log aggregation include, exclude patterns
-   */
-  String YARN_LOG_INCLUDE_PATTERNS = "yarn.log.include.patterns";
-  String YARN_LOG_EXCLUDE_PATTERNS = "yarn.log.exclude.patterns";
-
-  String YARN_PROFILE_NAME = "yarn.resource-profile-name";
-
-  /**
-   * Window of time where application master's failure count
-   * can be reset to 0.
-   */
-  String YARN_RESOURCEMANAGER_AM_RETRY_COUNT_WINDOW_MS  =
-      "yarn.resourcemanager.am.retry-count-window-ms";
-
-  /**
-   * The default window for Slider.
-   */
-  long DEFAULT_AM_RETRY_COUNT_WINDOW_MS = 300000;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/RoleKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/RoleKeys.java b/slider-core/src/main/java/org/apache/slider/api/RoleKeys.java
deleted file mode 100644
index ce413ff..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/RoleKeys.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api;
-
-/**
- * Standard options for roles
- */
-public interface RoleKeys {
-
-
-  /**
-   * The name of a role: {@value}
-   */
-  String ROLE_NAME = "role.name";
-
-  /**
-   * The group of a role: {@value}
-   */
-  String ROLE_GROUP = "role.group";
-
-  /**
-   * The prefix of a role: {@value}
-   */
-  String ROLE_PREFIX = "role.prefix";
-
-  /**
-   * Status report: number actually granted : {@value} 
-   */
-  String ROLE_ACTUAL_INSTANCES = "role.actual.instances";
-
-  /**
-   * Status report: number currently requested: {@value} 
-   */
-  String ROLE_REQUESTED_INSTANCES = "role.requested.instances";
-
-  /**
-   * Status report: number currently being released: {@value} 
-   */
-  String ROLE_RELEASING_INSTANCES = "role.releasing.instances";
-
-  /**
-   * Status report: total number that have failed: {@value}
-   */
-  String ROLE_FAILED_INSTANCES = "role.failed.instances";
-
-  /**
-   * Status report: number that have failed recently: {@value}
-   */
-  String ROLE_FAILED_RECENTLY_INSTANCES = "role.failed.recently.instances";
-
-  /**
-   * Status report: number that have failed for node-related issues: {@value}
-   */
-  String ROLE_NODE_FAILED_INSTANCES = "role.failed.node.instances";
-
-  /**
-   * Status report: number that been pre-empted: {@value}
-   */
-  String ROLE_PREEMPTED_INSTANCES = "role.failed.preempted.instances";
-
-  /**
-   * Number of pending anti-affine instances: {@value}
-   */
-  String ROLE_PENDING_AA_INSTANCES = "role.pending.aa.instances";
-
-  /**
-   * Status report: number currently being released: {@value} 
-   */
-  String ROLE_FAILED_STARTING_INSTANCES = "role.failed.starting.instances";
-
-  /**
-   * Extra arguments (non-JVM) to use when starting this role
-   */
-  String ROLE_ADDITIONAL_ARGS = "role.additional.args";
-
-  /**
-   *  JVM heap size for Java applications in MB.  Only relevant for Java applications.
-   *  This MUST be less than or equal to the {@link ResourceKeys#YARN_MEMORY} option
-   *  {@value}
-   */
-  String JVM_HEAP = "jvm.heapsize";
-  
-  /*
-   * GC options for Java applications.
-   */
-  String GC_OPTS = "gc.opts";
-
-  /**
-   * JVM options other than heap size. Only relevant for Java applications.
-   *  {@value}
-   */
-  String JVM_OPTS = "jvm.opts";
-
-
-  /**
-   * All keys w/ env. are converted into env variables and passed down
-   */
-  String ENV_PREFIX = "env.";
-
-  /**
-   * Container service record attribute prefix.
-   */
-  String SERVICE_RECORD_ATTRIBUTE_PREFIX = "service.record.attribute";
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java b/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java
deleted file mode 100644
index d21785f..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api;
-
-import org.apache.slider.api.types.ApplicationLivenessInformation;
-import org.apache.slider.api.types.ComponentInformation;
-import org.apache.slider.api.types.ContainerInformation;
-import org.apache.slider.api.types.NodeInformation;
-import org.apache.slider.api.types.NodeInformationList;
-import org.apache.slider.api.types.PingInformation;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.conf.ConfTreeOperations;
-
-import java.io.IOException;
-import java.util.Map;
-
-/**
- * API exported by the slider remote REST/IPC endpoints.
- */
-public interface SliderApplicationApi {
-  /**
-   * Get the aggregate desired model
-   * @return the aggregate configuration of what was asked for
-   * -before resolution has taken place
-   * @throws IOException on any failure
-   */
-  AggregateConf getDesiredModel() throws IOException;
-
-  /**
-   * Get the desired application configuration
-   * @return the application configuration asked for
-   * -before resolution has taken place
-   * @throws IOException on any failure
-   */
-  ConfTreeOperations getDesiredAppconf() throws IOException;
-
-  /**
-   * Get the desired YARN resources
-   * @return the resources asked for
-   * -before resolution has taken place
-   * @throws IOException on any failure
-   */
-  ConfTreeOperations getDesiredResources() throws IOException;
-
-  /**
-   * Put an updated resources structure. This triggers a cluster flex
-   * operation
-   * @param updated updated resources
-   * @throws IOException on any problem.
-   */
-  void putDesiredResources(ConfTree updated) throws IOException;
-
-  /**
-   * Get the aggregate resolved model
-   * @return the aggregate configuration of what was asked for
-   * -after resolution has taken place
-   * @throws IOException on any failure
-   */
-  AggregateConf getResolvedModel() throws IOException;
-
-  /**
-   * Get the resolved application configuration
-   * @return the application configuration asked for
-   * -after resolution has taken place
-   * @throws IOException on any failure
-   */
-  ConfTreeOperations getResolvedAppconf() throws IOException;
-
-  /**
-   * Get the resolved YARN resources
-   * @return the resources asked for
-   * -after resolution has taken place
-   * @throws IOException on any failure
-   */
-  ConfTreeOperations getResolvedResources() throws IOException;
-
-  /**
-   * Get the live YARN resources
-   * @return the live set of resources in the cluster
-   * @throws IOException on any failure
-   */
-  ConfTreeOperations getLiveResources() throws IOException;
-
-  /**
-   * Get a map of live containers [containerId:info]
-   * @return a possibly empty list of serialized containers
-   * @throws IOException on any failure
-   */
-  Map<String, ContainerInformation> enumContainers() throws IOException;
-
-  /**
-   * Get a container from the container Id
-   * @param containerId YARN container ID
-   * @return the container information
-   * @throws IOException on any failure
-   */
-  ContainerInformation getContainer(String containerId) throws IOException;
-
-  /**
-   * List all components into a map of [name:info]
-   * @return a possibly empty map of components
-   * @throws IOException on any failure
-   */
-  Map<String, ComponentInformation> enumComponents() throws IOException;
-
-  /**
-   * Get information about a component
-   * @param componentName name of the component
-   * @return the component details
-   * @throws IOException on any failure
-   */
-  ComponentInformation getComponent(String componentName) throws IOException;
-
-  /**
-   * List all nodes into a map of [name:info]
-   * @return a possibly empty list of nodes
-   * @throws IOException on any failure
-   */
-  NodeInformationList getLiveNodes() throws IOException;
-
-  /**
-   * Get information about a node
-   * @param hostname name of the node
-   * @return the node details
-   * @throws IOException on any failure
-   */
-  NodeInformation getLiveNode(String hostname) throws IOException;
-
-  /**
-   * Ping as a GET
-   * @param text text to include
-   * @return the response
-   * @throws IOException on any failure
-   */
-  PingInformation ping(String text) throws IOException;
-
-  /**
-   * Stop the AM (async operation)
-   * @param text text to include
-   * @throws IOException on any failure
-   */
-  void stop(String text) throws IOException;
-
-  /**
-   * Get the application liveness
-   * @return current liveness information
-   * @throws IOException
-   */
-  ApplicationLivenessInformation getApplicationLiveness() throws IOException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java b/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java
deleted file mode 100644
index 33fce22..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") throws IOException, YarnException; you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api;
-
-import org.apache.hadoop.ipc.VersionedProtocol;
-import org.apache.hadoop.security.KerberosInfo;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.slider.api.proto.Messages;
-import org.apache.slider.common.SliderXmlConfKeys;
-
-import java.io.IOException;
-
-/**
- * Cluster protocol. This can currently act as a versioned IPC
- * endpoint or be relayed via protobuf
- */
-@KerberosInfo(serverPrincipal = SliderXmlConfKeys.KEY_KERBEROS_PRINCIPAL)
-public interface SliderClusterProtocol extends VersionedProtocol {
-  long versionID = 0x01;
-
-  /**
-   * Stop the cluster
-   */
-
-  Messages.StopClusterResponseProto stopCluster(Messages.StopClusterRequestProto request) throws
-                                                                                          IOException, YarnException;
-  /**
-   * Upgrade the application containers
-   * 
-   * @param request upgrade containers request object
-   * @return upgrade containers response object
-   * @throws IOException
-   * @throws YarnException
-   */
-  Messages.UpgradeContainersResponseProto upgradeContainers(
-      Messages.UpgradeContainersRequestProto request) throws IOException,
-      YarnException;
-
-  /**
-   * Flex the cluster. 
-   */
-  Messages.FlexClusterResponseProto flexCluster(Messages.FlexClusterRequestProto request)
-      throws IOException;
-
-
-  /**
-   * Get the current cluster status
-   */
-  Messages.GetJSONClusterStatusResponseProto getJSONClusterStatus(Messages.GetJSONClusterStatusRequestProto request)
-      throws IOException, YarnException;
-
-
-  /**
-   * List all running nodes in a role
-   */
-  Messages.ListNodeUUIDsByRoleResponseProto listNodeUUIDsByRole(Messages.ListNodeUUIDsByRoleRequestProto request)
-      throws IOException, YarnException;
-
-
-  /**
-   * Get the details on a node
-   */
-  Messages.GetNodeResponseProto getNode(Messages.GetNodeRequestProto request)
-      throws IOException, YarnException;
-
-  /**
-   * Get the 
-   * details on a list of nodes.
-   * Unknown nodes are not returned
-   * <i>Important: the order of the results are undefined</i>
-   */
-  Messages.GetClusterNodesResponseProto getClusterNodes(Messages.GetClusterNodesRequestProto request)
-      throws IOException, YarnException;
-
-  /**
-   * Echo back the submitted text (after logging it).
-   * Useful for adding information to the log, and for testing round trip
-   * operations of the protocol
-   * @param request request
-   * @return response
-   * @throws IOException
-   * @throws YarnException
-   */
-  Messages.EchoResponseProto echo(Messages.EchoRequestProto request) throws IOException, YarnException;
-
-  /**
-   * Kill an identified container
-   * @param request request containing the container to kill
-   * @return the response
-   * @throws IOException
-   * @throws YarnException
-   */
-  Messages.KillContainerResponseProto killContainer(Messages.KillContainerRequestProto request)
-      throws IOException, YarnException;
-
-  /**
-   * AM to commit suicide. If the Hadoop halt entry point has not been disabled,
-   * this will fail rather than return with a response.
-   * @param request request
-   * @return response (this is not the expected outcome)
-   * @throws IOException
-   * @throws YarnException
-   */
-  Messages.AMSuicideResponseProto amSuicide(Messages.AMSuicideRequestProto request)
-      throws IOException;
-
-  /**
-   * Get the instance definition
-   */
-  Messages.GetInstanceDefinitionResponseProto getInstanceDefinition(
-    Messages.GetInstanceDefinitionRequestProto request)
-    throws IOException, YarnException;
-
-  /**
-   * Get the application liveness
-   * @return current liveness information
-   * @throws IOException
-   */
-  Messages.ApplicationLivenessInformationProto getLivenessInformation(
-      Messages.GetApplicationLivenessRequestProto request
-  ) throws IOException;
-
-  Messages.GetLiveContainersResponseProto getLiveContainers(
-      Messages.GetLiveContainersRequestProto request
-  ) throws IOException;
-
-  Messages.ContainerInformationProto getLiveContainer(
-      Messages.GetLiveContainerRequestProto request
-  ) throws IOException;
-
-  Messages.GetLiveComponentsResponseProto getLiveComponents(
-      Messages.GetLiveComponentsRequestProto request
-  ) throws IOException;
-
-  Messages.ComponentInformationProto getLiveComponent(
-      Messages.GetLiveComponentRequestProto request
-  ) throws IOException;
-
-  Messages.GetLiveNodesResponseProto getLiveNodes(
-      Messages.GetLiveNodesRequestProto request
-  ) throws IOException;
-
-  Messages.NodeInformationProto getLiveNode(
-      Messages.GetLiveNodeRequestProto request
-  ) throws IOException;
-
-  Messages.WrappedJsonProto getModelDesired(Messages.EmptyPayloadProto request) throws IOException;
-
-  Messages.WrappedJsonProto getModelDesiredAppconf(Messages.EmptyPayloadProto request) throws IOException;
-
-  Messages.WrappedJsonProto getModelDesiredResources(Messages.EmptyPayloadProto request) throws IOException;
-
-  Messages.WrappedJsonProto getModelResolved(Messages.EmptyPayloadProto request) throws IOException;
-
-  Messages.WrappedJsonProto getModelResolvedAppconf(Messages.EmptyPayloadProto request) throws IOException;
-
-  Messages.WrappedJsonProto getModelResolvedResources(Messages.EmptyPayloadProto request) throws IOException;
-
-  Messages.WrappedJsonProto getLiveResources(Messages.EmptyPayloadProto request) throws IOException;
-
-  Messages.GetCertificateStoreResponseProto getClientCertificateStore(Messages.GetCertificateStoreRequestProto request)
-      throws IOException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/StateValues.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/StateValues.java b/slider-core/src/main/java/org/apache/slider/api/StateValues.java
deleted file mode 100644
index 03751e1..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/StateValues.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api;
-
-/**
- * Enumeration of state values
- */
-public class StateValues {
-
-  /**
-   * Specification is incomplete & cannot
-   * be used: {@value}
-   */
-  public static final int STATE_INCOMPLETE = 0;
-
-  /**
-   * Spec has been submitted: {@value}
-   */
-  public static final int STATE_SUBMITTED = 1;
-  /**
-   * Cluster created: {@value}
-   */
-  public static final int STATE_CREATED = 2;
-  /**
-   * Live: {@value}
-   */
-  public static final int STATE_LIVE = 3;
-  /**
-   * Stopped
-   */
-  public static final int STATE_STOPPED = 4;
-  /**
-   * destroyed
-   */
-  public static final int STATE_DESTROYED = 5;
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/StatusKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/StatusKeys.java b/slider-core/src/main/java/org/apache/slider/api/StatusKeys.java
deleted file mode 100644
index 8a2c4bb..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/StatusKeys.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api;
-import static org.apache.slider.api.ResourceKeys.COMPONENT_INSTANCES;
-/**
- * Contains status and statistics keys
- */
-public interface StatusKeys {
-
-  String STATISTICS_CONTAINERS_ACTIVE_REQUESTS = "containers.active.requests";
-  String STATISTICS_CONTAINERS_COMPLETED = "containers.completed";
-  String STATISTICS_CONTAINERS_DESIRED = "containers.desired";
-  String STATISTICS_CONTAINERS_FAILED = "containers.failed";
-  String STATISTICS_CONTAINERS_FAILED_RECENTLY = "containers.failed.recently";
-  String STATISTICS_CONTAINERS_FAILED_NODE = "containers.failed.node";
-  String STATISTICS_CONTAINERS_PREEMPTED = "containers.failed.preempted";
-  String STATISTICS_CONTAINERS_LIVE = "containers.live";
-  String STATISTICS_CONTAINERS_REQUESTED = "containers.requested";
-  String STATISTICS_CONTAINERS_ANTI_AFFINE_PENDING = "containers.anti-affine.pending";
-  String STATISTICS_CONTAINERS_STARTED = "containers.start.started";
-  String STATISTICS_CONTAINERS_START_FAILED =
-      "containers.start.failed";
-  String STATISTICS_CONTAINERS_SURPLUS =
-      "containers.surplus";
-  String STATISTICS_CONTAINERS_UNKNOWN_COMPLETED =
-      "containers.unknown.completed";
-  /**
-   * No of containers provided on AM restart
-   */
-  String INFO_CONTAINERS_AM_RESTART = "containers.at.am-restart";
-
-  String INFO_CREATE_TIME_MILLIS = "create.time.millis";
-  String INFO_CREATE_TIME_HUMAN = "create.time";
-  String INFO_LIVE_TIME_MILLIS = "live.time.millis";
-  String INFO_LIVE_TIME_HUMAN = "live.time";
-  String INFO_FLEX_TIME_MILLIS = "flex.time.millis";
-  String INFO_FLEX_TIME_HUMAN = "flex.time";
-
-  String INFO_MASTER_ADDRESS = "info.master.address";
-
-  /**
-   * System time in millis when the status report was generated
-   */
-  String INFO_STATUS_TIME_MILLIS = "status.time.millis";
-
-  /**
-   * System time in human form when the status report was generated
-   */
-  String INFO_STATUS_TIME_HUMAN = "status.time";
-
-  String INFO_AM_APP_ID = "info.am.app.id";
-  String INFO_AM_ATTEMPT_ID = "info.am.attempt.id";
-  String INFO_AM_CONTAINER_ID = "info.am.container.id";
-  String INFO_AM_HOSTNAME = "info.am.hostname";
-  String INFO_AM_RPC_PORT = "info.am.rpc.port";
-  String INFO_AM_WEB_PORT = "info.am.web.port";
-  String INFO_AM_WEB_URL = "info.am.web.url";
-  String INFO_AM_AGENT_STATUS_PORT = "info.am.agent.status.port";
-  String INFO_AM_AGENT_OPS_PORT = "info.am.agent.ops.port";
-  String INFO_AM_AGENT_OPS_URL = "info.am.agent.ops.url";
-  String INFO_AM_AGENT_STATUS_URL = "info.am.agent.status.url";
-
-      /**
-       * info: #of instances of a component requested: {@value}
-       *
-       */
-  String COMPONENT_INSTANCES_ACTUAL = COMPONENT_INSTANCES + ".actual";
-
-  /**
-   * info: #of instances of a component requested: {@value}
-   *
-   */
-  String COMPONENT_INSTANCES_REQUESTING = COMPONENT_INSTANCES + ".requesting";
-
-  /**
-   * info: #of instances of a component being released: {@value}
-   *
-   */
-  String COMPONENT_INSTANCES_RELEASING = COMPONENT_INSTANCES + ".releasing";
-
-  /**
-   * info: #of instances of a component failed: {@value}
-   *
-   */
-  String COMPONENT_INSTANCES_FAILED = COMPONENT_INSTANCES + ".failed";
-
-  /**
-   * info: #of instances of a component started: {@value}
-   *
-   */
-  String COMPONENT_INSTANCES_STARTED = COMPONENT_INSTANCES + ".started";
-
-
-  /**
-   * info: #of instances of a component completed: {@value}
-   *
-   */
-  String COMPONENT_INSTANCES_COMPLETED = COMPONENT_INSTANCES + ".completed";
-
-
-}


[42/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java b/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
deleted file mode 100644
index 17fd965..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/proto/RestTypeMarshalling.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api.proto;
-
-import com.google.protobuf.ByteString;
-import org.apache.commons.io.IOUtils;
-import org.apache.slider.api.types.ApplicationLivenessInformation;
-import org.apache.slider.api.types.ComponentInformation;
-import org.apache.slider.api.types.ContainerInformation;
-import org.apache.slider.api.types.NodeEntryInformation;
-import org.apache.slider.api.types.NodeInformation;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.persist.AggregateConfSerDeser;
-import org.apache.slider.core.persist.ConfTreeSerDeser;
-import org.apache.slider.server.services.security.SecurityStore;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Class to handle marshalling of REST
- * types to/from Protobuf records.
- */
-public class RestTypeMarshalling {
-
-  public static Messages.ApplicationLivenessInformationProto
-  marshall(ApplicationLivenessInformation info) {
-
-    Messages.ApplicationLivenessInformationProto.Builder builder =
-        Messages.ApplicationLivenessInformationProto.newBuilder();
-    builder.setAllRequestsSatisfied(info.allRequestsSatisfied);
-    builder.setRequestsOutstanding(info.requestsOutstanding);
-    return builder.build();
-  }
-
-  public static ApplicationLivenessInformation
-  unmarshall(Messages.ApplicationLivenessInformationProto wire) {
-    ApplicationLivenessInformation info = new ApplicationLivenessInformation();
-    info.allRequestsSatisfied = wire.getAllRequestsSatisfied();
-    info.requestsOutstanding = wire.getRequestsOutstanding();
-    return info;
-  }
-
-  public static ComponentInformation
-  unmarshall(Messages.ComponentInformationProto wire) {
-    ComponentInformation info = new ComponentInformation();
-    info.name = wire.getName();
-    info.priority = wire.getPriority();
-    info.placementPolicy = wire.getPlacementPolicy();
-    
-    info.actual = wire.getActual();
-    info.completed = wire.getCompleted();
-    info.desired = wire.getDesired();
-    info.failed = wire.getFailed();
-    info.releasing = wire.getReleasing();
-    info.requested = wire.getRequested();
-    info.started = wire.getStarted();
-    info.startFailed = wire.getStartFailed();
-    info.totalRequested = wire.getTotalRequested();
-    info.containers = new ArrayList<>(wire.getContainersList());
-    if (wire.hasFailureMessage()) {
-      info.failureMessage = wire.getFailureMessage();
-    }
-    if (wire.hasPendingAntiAffineRequestCount()) {
-      info.pendingAntiAffineRequestCount = wire.getPendingAntiAffineRequestCount();
-    }
-    if (wire.hasIsAARequestOutstanding()) {
-      info.isAARequestOutstanding = wire.getIsAARequestOutstanding();
-    }
-    return info;
-  }
-
-  public static Messages.GetCertificateStoreResponseProto marshall(
-      SecurityStore securityStore) throws IOException {
-    Messages.GetCertificateStoreResponseProto.Builder builder =
-        Messages.GetCertificateStoreResponseProto.newBuilder();
-    builder.setStore(ByteString.copyFrom(getStoreBytes(securityStore)));
-
-    return builder.build();
-  }
-
-  private static byte[] getStoreBytes(SecurityStore securityStore)
-      throws IOException {
-    InputStream is = null;
-    byte[] storeBytes;
-    try {
-      is = new FileInputStream(securityStore.getFile());
-      storeBytes = IOUtils.toByteArray(is);
-    } finally {
-      if (is != null) {
-        is.close();
-      }
-    }
-    return storeBytes;
-  }
-
-  public static byte[] unmarshall(Messages.GetCertificateStoreResponseProto response) {
-    return response.getStore().toByteArray();
-  }
-
-  public static Messages.ComponentInformationProto marshall(ComponentInformation info) {
-
-    Messages.ComponentInformationProto.Builder builder =
-        Messages.ComponentInformationProto.newBuilder();
-    builder.setName(info.name);
-    builder.setPriority(info.priority);
-    builder.setPlacementPolicy(info.placementPolicy);
-    
-    builder.setActual(info.actual);
-    builder.setCompleted(info.completed);
-    builder.setDesired(info.desired);
-    builder.setFailed(info.failed);
-    builder.setReleasing(info.releasing);
-    builder.setRequested(info.requested);
-    builder.setStarted(info.started);
-    builder.setStartFailed(info.startFailed);
-    builder.setTotalRequested(info.totalRequested);
-    builder.setNodeFailed(info.nodeFailed);
-    builder.setPreempted(info.preempted);
-    builder.setFailedRecently(info.failedRecently);
-    if (info.failureMessage != null) {
-      builder.setFailureMessage(info.failureMessage);
-    }
-    if (info.containers != null) {
-      builder.addAllContainers(info.containers);
-    }
-    builder.setPendingAntiAffineRequestCount(info.pendingAntiAffineRequestCount);
-    builder.setIsAARequestOutstanding(info.isAARequestOutstanding);
-    return builder.build();
-  }
-
-  public static Messages.NodeInformationProto marshall(NodeInformation info) {
-
-    Messages.NodeInformationProto.Builder builder =
-        Messages.NodeInformationProto.newBuilder();
-    builder.setHostname(info.hostname);
-    builder.setLastUpdated(info.lastUpdated);
-    builder.setState(info.state != null? info.state : "unknown");
-    builder.setRackName(info.rackName != null ? info.rackName : "");
-    builder.setHealthReport(info.healthReport != null ? info.healthReport : "");
-    builder.setHttpAddress(info.httpAddress != null ? info.httpAddress : "");
-    builder.setLabels(info.labels != null ? info.labels: "");
-
-
-    if (info.entries != null) {
-      for (Map.Entry<String, NodeEntryInformation> elt : info.entries.entrySet()) {
-        NodeEntryInformation entry = elt.getValue();
-        Messages.NodeEntryInformationProto.Builder node =
-            Messages.NodeEntryInformationProto.newBuilder();
-        node.setPriority(entry.priority);
-        node.setName(elt.getKey());
-        node.setFailed(entry.failed);
-        node.setFailedRecently(entry.failedRecently);
-        node.setLive(entry.live);
-        node.setLastUsed(entry.lastUsed);
-        node.setPreempted(entry.preempted);
-        node.setRequested(entry.requested);
-        node.setReleasing(entry.releasing);
-        node.setStartFailed(entry.startFailed);
-        node.setStarting(entry.starting);
-        builder.addEntries(node.build());
-      }
-    }
-    return builder.build();
-  }
-
-  public static NodeInformation unmarshall(Messages.NodeInformationProto wire) {
-    NodeInformation info = new NodeInformation();
-    info.healthReport = wire.getHealthReport();
-    info.hostname = wire.getHostname();
-    info.httpAddress = wire.getHttpAddress();
-    info.labels = wire.getLabels();
-    info.lastUpdated = wire.getLastUpdated();
-    info.rackName = wire.getRackName();
-    info.state = wire.getState();
-    List<Messages.NodeEntryInformationProto> entriesList = wire.getEntriesList();
-    if (entriesList != null) {
-      info.entries = new HashMap<>(entriesList.size());
-      for (Messages.NodeEntryInformationProto entry : entriesList) {
-        NodeEntryInformation nei = new NodeEntryInformation();
-        nei.failed = entry.getFailed();
-        nei.failedRecently = entry.getFailedRecently();
-        nei.lastUsed = entry.getLastUsed();
-        nei.live = entry.getLive();
-        nei.preempted = entry.getPreempted();
-        nei.priority = entry.getPriority();
-        nei.requested = entry.getRequested();
-        nei.releasing = entry.getReleasing();
-        nei.startFailed = entry.getStartFailed();
-        nei.starting = entry.getStarting();
-        info.entries.put(entry.getName(), nei);
-      }
-    }
-    return info;
-  }
-
-  public static ContainerInformation unmarshall(Messages.ContainerInformationProto wire) {
-    ContainerInformation info = new ContainerInformation();
-    info.containerId = wire.getContainerId();
-    info.component = wire.getComponent();
-    info.appVersion = wire.getAppVersion();
-    info.state = wire.getState();
-    if (wire.hasReleased()) {
-      info.released = wire.getReleased();
-    }
-    if (wire.hasExitCode()) {
-      info.exitCode = wire.getExitCode();
-    }
-    if (wire.hasDiagnostics()) {
-      info.diagnostics = wire.getDiagnostics();
-    }
-    if (wire.hasHost()) {
-      info.host = wire.getHost();
-    }
-    if (wire.hasHostURL()) {
-      info.host = wire.getHostURL();
-    }
-    info.createTime = wire.getCreateTime();
-    info.startTime = wire.getStartTime();
-    info.output = wire.getOutputList().toArray(
-        new String[wire.getOutputCount()]
-        );
-    if (wire.hasPlacement()) {
-      info.placement = wire.getPlacement();
-    }
-    return info;
-  }
-
-  public static List<ContainerInformation> unmarshall(Messages.GetLiveContainersResponseProto wire) {
-    List<ContainerInformation> infoList = new ArrayList<>(wire.getContainersList().size());
-    for (Messages.ContainerInformationProto container : wire.getContainersList()) {
-      infoList.add(unmarshall(container));
-    }
-    return infoList;
-  }
-
-  public static Messages.ContainerInformationProto marshall(ContainerInformation info) {
-
-    Messages.ContainerInformationProto.Builder builder =
-        Messages.ContainerInformationProto.newBuilder();
-    if (info.containerId != null) {
-      builder.setContainerId(info.containerId);
-    }
-    if (info.component != null) {
-      builder.setComponent(info.component);
-    }
-    if (info.appVersion != null) {
-      builder.setAppVersion(info.appVersion);
-    }
-    builder.setCreateTime(info.createTime);
-    if (info.diagnostics != null) {
-      builder.setDiagnostics(info.diagnostics);
-    }
-    if (info.host != null) {
-      builder.setHost(info.host);
-    }
-    if (info.hostURL != null) {
-      builder.setHostURL(info.hostURL);
-    }
-    if (info.output != null) {
-      builder.addAllOutput(Arrays.asList(info.output));
-    }
-    if (info.released != null) {
-      builder.setReleased(info.released);
-    }
-    if (info.placement != null) {
-      builder.setPlacement(info.placement);
-    }
-    builder.setStartTime(info.startTime);
-    builder.setState(info.state);
-    return builder.build();
-  }
-
-  public static String unmarshall(Messages.WrappedJsonProto wire) {
-    return wire.getJson();
-  }
-
-  public static ConfTree unmarshallToConfTree(Messages.WrappedJsonProto wire) throws
-      IOException {
-    return new ConfTreeSerDeser().fromJson(wire.getJson());
-  }
-  
-  public static ConfTreeOperations unmarshallToCTO(Messages.WrappedJsonProto wire) throws
-      IOException {
-    return new ConfTreeOperations(new ConfTreeSerDeser().fromJson(wire.getJson()));
-  }
-
-  public static AggregateConf unmarshallToAggregateConf(Messages.WrappedJsonProto wire) throws
-      IOException {
-    return new AggregateConfSerDeser().fromJson(wire.getJson());
-  }
-
-}


[34/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java b/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
deleted file mode 100644
index e9f65ba..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
+++ /dev/null
@@ -1,2636 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.tools;
-
-import com.google.common.base.Preconditions;
-
-import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
-import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
-import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
-import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
-import org.apache.commons.io.output.ByteArrayOutputStream;
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
-import org.apache.hadoop.fs.FSDataInputStream;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.FileUtil;
-import org.apache.hadoop.fs.GlobFilter;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.permission.FsPermission;
-import org.apache.hadoop.io.IOUtils;
-import org.apache.hadoop.io.nativeio.NativeIO;
-import org.apache.hadoop.net.NetUtils;
-import org.apache.hadoop.security.SecurityUtil;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.util.ExitUtil;
-import org.apache.hadoop.util.Shell;
-import org.apache.hadoop.util.VersionInfo;
-import org.apache.hadoop.yarn.api.ApplicationConstants;
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.LocalResource;
-import org.apache.hadoop.yarn.api.records.NodeReport;
-import org.apache.hadoop.yarn.api.records.YarnApplicationState;
-import org.apache.hadoop.yarn.client.api.AMRMClient;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.slider.Slider;
-import org.apache.slider.api.InternalKeys;
-import org.apache.slider.api.RoleKeys;
-import org.apache.slider.api.types.ContainerInformation;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.SliderXmlConfKeys;
-import org.apache.slider.common.params.Arguments;
-import org.apache.slider.common.params.SliderActions;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.BadClusterStateException;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.exceptions.ErrorStrings;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.launch.ClasspathConstructor;
-import org.apache.slider.core.main.LauncherExitCodes;
-import org.apache.slider.providers.agent.AgentKeys;
-import org.apache.slider.providers.agent.application.metadata.Component;
-import org.apache.slider.server.services.utility.PatternValidator;
-import org.apache.slider.server.services.workflow.ForkedProcessService;
-import org.apache.zookeeper.server.util.KerberosUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.io.Serializable;
-import java.io.StringWriter;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TimeZone;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.TreeMap;
-import java.util.TreeSet;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.regex.Pattern;
-import java.util.zip.GZIPOutputStream;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import static org.apache.slider.common.SliderKeys.COMPONENT_SEPARATOR;
-
-/**
- * These are slider-specific Util methods
- */
-public final class SliderUtils {
-
-  private static final Logger log = LoggerFactory.getLogger(SliderUtils.class);
-
-  /**
-   * Atomic bool to track whether or not process security has already been
-   * turned on (prevents re-entrancy)
-   */
-  private static final AtomicBoolean processSecurityAlreadyInitialized =
-      new AtomicBoolean(false);
-  public static final String JAVA_SECURITY_KRB5_REALM =
-      "java.security.krb5.realm";
-  public static final String JAVA_SECURITY_KRB5_KDC = "java.security.krb5.kdc";
-
-  /**
-   * Winutils
-   */
-  public static final String WINUTILS = "WINUTILS.EXE";
-  /**
-   * name of openssl program
-   */
-  public static final String OPENSSL = "openssl";
-
-  /**
-   * name of python program
-   */
-  public static final String PYTHON = "python";
-
-  /**
-   * type of docker standalone application
-   */
-  public static final String DOCKER = "docker";
-  /**
-   * type of docker on yarn application
-   */
-  public static final String DOCKER_YARN = "yarn_docker";
-
-  public static final int NODE_LIST_LIMIT = 10;
-
-  private SliderUtils() {
-  }
-
-  /**
-   * Implementation of set-ness, groovy definition of true/false for a string
-   * @param s string
-   * @return true iff the string is neither null nor empty
-   */
-  public static boolean isUnset(String s) {
-    return s == null || s.isEmpty();
-  }
-
-  public static boolean isSet(String s) {
-    return !isUnset(s);
-  }
-
-  /**
-   * Probe for a list existing and not being empty
-   * @param l list
-   * @return true if the reference is valid and it contains entries
-   */
-
-  public static boolean isNotEmpty(List l) {
-    return l != null && !l.isEmpty();
-  }
-
-  /**
-   * Probe for a map existing and not being empty
-   * @param m map
-   * @return true if the reference is valid and it contains map entries
-   */
-  public static boolean isNotEmpty(Map m) {
-    return m != null && !m.isEmpty();
-  }
-  
-  /*
-   * Validates whether num is an integer
-   * @param num
-   * @param msg the message to be shown in exception
-   */
-  @SuppressWarnings("ResultOfMethodCallIgnored")
-  private static void validateNumber(String num, String msg) throws
-      BadConfigException {
-    try {
-      Integer.parseInt(num);
-    } catch (NumberFormatException nfe) {
-      throw new BadConfigException(msg + num);
-    }
-  }
-
-  /*
-   * Translates the trailing JVM heapsize unit: g, G, m, M
-   * This assumes designated unit of 'm'
-   * @param heapsize
-   * @return heapsize in MB
-   */
-  public static String translateTrailingHeapUnit(String heapsize) throws
-      BadConfigException {
-    String errMsg = "Bad heapsize: ";
-    if (heapsize.endsWith("m") || heapsize.endsWith("M")) {
-      String num = heapsize.substring(0, heapsize.length() - 1);
-      validateNumber(num, errMsg);
-      return num;
-    }
-    if (heapsize.endsWith("g") || heapsize.endsWith("G")) {
-      String num = heapsize.substring(0, heapsize.length() - 1) + "000";
-      validateNumber(num, errMsg);
-      return num;
-    }
-    // check if specified heap size is a number
-    validateNumber(heapsize, errMsg);
-    return heapsize;
-  }
-
-  /**
-   * recursive directory delete
-   * @param dir dir to delete
-   * @throws IOException on any problem
-   */
-  public static void deleteDirectoryTree(File dir) throws IOException {
-    if (dir.exists()) {
-      if (dir.isDirectory()) {
-        log.info("Cleaning up {}", dir);
-        //delete the children
-        File[] files = dir.listFiles();
-        if (files == null) {
-          throw new IOException("listfiles() failed for " + dir);
-        }
-        for (File file : files) {
-          log.info("deleting {}", file);
-          if (!file.delete()) {
-            log.warn("Unable to delete " + file);
-          }
-        }
-        if (!dir.delete()) {
-          log.warn("Unable to delete " + dir);
-        }
-      } else {
-        throw new IOException("Not a directory " + dir);
-      }
-    } else {
-      //not found, do nothing
-      log.debug("No output dir yet");
-    }
-  }
-
-  /**
-   * Find a containing JAR
-   * @param clazz class to find
-   * @return the file
-   * @throws IOException any IO problem, including the class not having a
-   * classloader
-   * @throws FileNotFoundException if the class did not resolve to a file
-   */
-  public static File findContainingJarOrFail(Class clazz) throws IOException {
-    File localFile = SliderUtils.findContainingJar(clazz);
-    if (null == localFile) {
-      throw new FileNotFoundException("Could not find JAR containing " + clazz);
-    }
-    return localFile;
-  }
-
-
-  /**
-   * Find a containing JAR
-   * @param my_class class to find
-   * @return the file or null if it is not found
-   * @throws IOException any IO problem, including the class not having a
-   * classloader
-   */
-  public static File findContainingJar(Class my_class) throws IOException {
-    ClassLoader loader = my_class.getClassLoader();
-    if (loader == null) {
-      throw new IOException(
-          "Class " + my_class + " does not have a classloader!");
-    }
-    String class_file = my_class.getName().replaceAll("\\.", "/") + ".class";
-    Enumeration<URL> urlEnumeration = loader.getResources(class_file);
-    if (urlEnumeration == null) {
-      throw new IOException("Unable to find resources for class " + my_class);
-    }
-
-    for (; urlEnumeration.hasMoreElements(); ) {
-      URL url = urlEnumeration.nextElement();
-      if ("jar".equals(url.getProtocol())) {
-        String toReturn = url.getPath();
-        if (toReturn.startsWith("file:")) {
-          toReturn = toReturn.substring("file:".length());
-        }
-        // URLDecoder is a misnamed class, since it actually decodes
-        // x-www-form-urlencoded MIME type rather than actual
-        // URL encoding (which the file path has). Therefore it would
-        // decode +s to ' 's which is incorrect (spaces are actually
-        // either unencoded or encoded as "%20"). Replace +s first, so
-        // that they are kept sacred during the decoding process.
-        toReturn = toReturn.replaceAll("\\+", "%2B");
-        toReturn = URLDecoder.decode(toReturn, "UTF-8");
-        String jarFilePath = toReturn.replaceAll("!.*$", "");
-        return new File(jarFilePath);
-      } else {
-        log.info("could not locate JAR containing {} URL={}", my_class, url);
-      }
-    }
-    return null;
-  }
-
-  public static void checkPort(String hostname, int port, int connectTimeout)
-      throws IOException {
-    InetSocketAddress addr = new InetSocketAddress(hostname, port);
-    checkPort(hostname, addr, connectTimeout);
-  }
-
-  @SuppressWarnings("SocketOpenedButNotSafelyClosed")
-  public static void checkPort(String name,
-      InetSocketAddress address,
-      int connectTimeout)
-      throws IOException {
-    try(Socket socket = new Socket()) {
-      socket.connect(address, connectTimeout);
-    } catch (Exception e) {
-      throw new IOException("Failed to connect to " + name
-                            + " at " + address
-                            + " after " + connectTimeout + "milliseconds"
-                            + ": " + e,
-          e);
-    }
-  }
-
-  public static void checkURL(String name, String url, int timeout) throws
-      IOException {
-    InetSocketAddress address = NetUtils.createSocketAddr(url);
-    checkPort(name, address, timeout);
-  }
-
-  /**
-   * A required file
-   * @param role role of the file (for errors)
-   * @param filename the filename
-   * @throws ExitUtil.ExitException if the file is missing
-   * @return the file
-   */
-  public static File requiredFile(String filename, String role) throws
-      IOException {
-    if (filename.isEmpty()) {
-      throw new ExitUtil.ExitException(-1, role + " file not defined");
-    }
-    File file = new File(filename);
-    if (!file.exists()) {
-      throw new ExitUtil.ExitException(-1,
-          role + " file not found: " +
-          file.getCanonicalPath());
-    }
-    return file;
-  }
-
-  private static final PatternValidator clusternamePattern
-      = new PatternValidator("[a-z][a-z0-9_-]*");
-
-  /**
-   * Normalize a cluster name then verify that it is valid
-   * @param name proposed cluster name
-   * @return true iff it is valid
-   */
-  public static boolean isClusternameValid(String name) {
-    return name != null && clusternamePattern.matches(name);
-  }
-
-  public static boolean oldIsClusternameValid(String name) {
-    if (name == null || name.isEmpty()) {
-      return false;
-    }
-    int first = name.charAt(0);
-    if (0 == (Character.getType(first) & Character.LOWERCASE_LETTER)) {
-      return false;
-    }
-
-    for (int i = 0; i < name.length(); i++) {
-      int elt = (int) name.charAt(i);
-      int t = Character.getType(elt);
-      if (0 == (t & Character.LOWERCASE_LETTER)
-          && 0 == (t & Character.DECIMAL_DIGIT_NUMBER)
-          && elt != '-'
-          && elt != '_') {
-        return false;
-      }
-      if (!Character.isLetterOrDigit(elt) && elt != '-' && elt != '_') {
-        return false;
-      }
-    }
-    return true;
-  }
-
-  /**
-   * Copy a directory to a new FS -both paths must be qualified. If
-   * a directory needs to be created, supplied permissions can override
-   * the default values. Existing directories are not touched
-   * @param conf conf file
-   * @param srcDirPath src dir
-   * @param destDirPath dest dir
-   * @param permission permission for the dest directory; null means "default"
-   * @return # of files copies
-   */
-  public static int copyDirectory(Configuration conf,
-      Path srcDirPath,
-      Path destDirPath,
-      FsPermission permission) throws
-      IOException,
-      BadClusterStateException {
-    FileSystem srcFS = FileSystem.get(srcDirPath.toUri(), conf);
-    FileSystem destFS = FileSystem.get(destDirPath.toUri(), conf);
-    //list all paths in the src.
-    if (!srcFS.exists(srcDirPath)) {
-      throw new FileNotFoundException("Source dir not found " + srcDirPath);
-    }
-    if (!srcFS.isDirectory(srcDirPath)) {
-      throw new FileNotFoundException(
-          "Source dir not a directory " + srcDirPath);
-    }
-    GlobFilter dotFilter = new GlobFilter("[!.]*");
-    FileStatus[] entries = srcFS.listStatus(srcDirPath, dotFilter);
-    int srcFileCount = entries.length;
-    if (srcFileCount == 0) {
-      return 0;
-    }
-    if (permission == null) {
-      permission = FsPermission.getDirDefault();
-    }
-    if (!destFS.exists(destDirPath)) {
-      new SliderFileSystem(destFS, conf).createWithPermissions(destDirPath,
-          permission);
-    }
-    Path[] sourcePaths = new Path[srcFileCount];
-    for (int i = 0; i < srcFileCount; i++) {
-      FileStatus e = entries[i];
-      Path srcFile = e.getPath();
-      if (srcFS.isDirectory(srcFile)) {
-        String msg = "Configuration dir " + srcDirPath
-                     + " contains a directory " + srcFile;
-        log.warn(msg);
-        throw new IOException(msg);
-      }
-      log.debug("copying src conf file {}", srcFile);
-      sourcePaths[i] = srcFile;
-    }
-    log.debug("Copying {} files from {} to dest {}", srcFileCount,
-        srcDirPath,
-        destDirPath);
-    FileUtil.copy(srcFS, sourcePaths, destFS, destDirPath, false, true, conf);
-    return srcFileCount;
-  }
-
-  /**
-   * Copy a file to a new FS -both paths must be qualified.
-   * @param conf conf file
-   * @param srcFile src file
-   * @param destFile dest file
-   */
-  public static void copy(Configuration conf,
-      Path srcFile,
-      Path destFile) throws
-      IOException,
-      BadClusterStateException {
-    FileSystem srcFS = FileSystem.get(srcFile.toUri(), conf);
-    //list all paths in the src.
-    if (!srcFS.exists(srcFile)) {
-      throw new FileNotFoundException("Source file not found " + srcFile);
-    }
-    if (!srcFS.isFile(srcFile)) {
-      throw new FileNotFoundException(
-          "Source file not a file " + srcFile);
-    }
-    FileSystem destFS = FileSystem.get(destFile.toUri(), conf);
-    if (destFS.exists(destFile)) {
-      throw new IOException("Dest file already exists " + destFile);
-    }
-    FileUtil.copy(srcFS, srcFile, destFS, destFile, false, true, conf);
-  }
-
-  public static String stringify(Throwable t) {
-    StringWriter sw = new StringWriter();
-    sw.append(t.toString()).append('\n');
-    t.printStackTrace(new PrintWriter(sw));
-    return sw.toString();
-  }
-
-  /**
-   * Create a configuration with Slider-specific tuning.
-   * This is done rather than doing custom configs.
-   * @return the config
-   */
-  public static YarnConfiguration createConfiguration() {
-    YarnConfiguration conf = new YarnConfiguration();
-    patchConfiguration(conf);
-    return conf;
-  }
-
-  /**
-   * Take an existing conf and patch it for Slider's needs. Useful
-   * in Service.init & RunService methods where a shared config is being
-   * passed in
-   * @param conf configuration
-   * @return the patched configuration
-   */
-  public static Configuration patchConfiguration(Configuration conf) {
-
-    //if the fallback option is NOT set, enable it.
-    //if it is explicitly set to anything -leave alone
-    if (conf.get(SliderXmlConfKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH) == null) {
-      conf.set(SliderXmlConfKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH, "true");
-    }
-    return conf;
-  }
-
-  /**
-   * Take a collection, return a list containing the string value of every
-   * element in the collection.
-   * @param c collection
-   * @return a stringified list
-   */
-  public static List<String> collectionToStringList(Collection c) {
-    List<String> l = new ArrayList<>(c.size());
-    for (Object o : c) {
-      l.add(o.toString());
-    }
-    return l;
-  }
-
-  /**
-   * Join an collection of objects with a separator that appears after every
-   * instance in the list -including at the end
-   * @param collection collection to call toString() on each element
-   * @param separator separator string
-   * @return the joined entries
-   */
-  public static String join(Collection collection, String separator) {
-    return join(collection, separator, true);
-  }
-
-  /**
-   * Join an collection of objects with a separator that appears after every
-   * instance in the list -optionally at the end
-   * @param collection collection to call toString() on each element
-   * @param separator separator string
-   * @param trailing add a trailing entry or not
-   * @return the joined entries
-   */
-  public static String join(Collection collection,
-      String separator,
-      boolean trailing) {
-    StringBuilder b = new StringBuilder();
-    // fast return on empty collection
-    if (collection.isEmpty()) {
-      return trailing ? separator : "";
-    }
-    for (Object o : collection) {
-      b.append(o);
-      b.append(separator);
-    }
-    int length = separator.length();
-    String s = b.toString();
-    return (trailing || s.isEmpty()) ?
-           s : (b.substring(0, b.length() - length));
-  }
-
-  /**
-   * Join an array of strings with a separator that appears after every
-   * instance in the list -including at the end
-   * @param collection strings
-   * @param separator separator string
-   * @return the joined entries
-   */
-  public static String join(String[] collection, String separator) {
-    return join(collection, separator, true);
-
-
-  }
-
-  /**
-   * Join an array of strings with a separator that appears after every
-   * instance in the list -optionally at the end
-   * @param collection strings
-   * @param separator separator string
-   * @param trailing add a trailing entry or not
-   * @return the joined entries
-   */
-  public static String join(String[] collection, String separator,
-      boolean trailing) {
-    return join(Arrays.asList(collection), separator, trailing);
-  }
-
-  /**
-   * Join an array of strings with a separator that appears after every
-   * instance in the list -except at the end
-   * @param collection strings
-   * @param separator separator string
-   * @return the list
-   */
-  public static String joinWithInnerSeparator(String separator,
-      Object... collection) {
-    StringBuilder b = new StringBuilder();
-    boolean first = true;
-
-    for (Object o : collection) {
-      if (first) {
-        first = false;
-      } else {
-        b.append(separator);
-      }
-      b.append(o.toString());
-      b.append(separator);
-    }
-    return b.toString();
-  }
-
-  /**
-   * Resolve a mandatory environment variable
-   * @param key env var
-   * @return the resolved value
-   * @throws BadClusterStateException
-   */
-  public static String mandatoryEnvVariable(String key) throws
-      BadClusterStateException {
-    String v = System.getenv(key);
-    if (v == null) {
-      throw new BadClusterStateException("Missing Environment variable " + key);
-    }
-    return v;
-  }
-
-  public static String appReportToString(ApplicationReport r,
-      String separator) {
-    StringBuilder builder = new StringBuilder(512);
-    builder.append("application ")
-           .append(
-               r.getName())
-           .append("/")
-           .append(r.getApplicationType())
-           .append(separator);
-    Set<String> tags = r.getApplicationTags();
-    if (!tags.isEmpty()) {
-      for (String tag : tags) {
-        builder.append(tag).append(separator);
-      }
-    }
-    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
-    dateFormat.setTimeZone(TimeZone.getDefault());
-    builder.append("state: ").append(r.getYarnApplicationState());
-    String trackingUrl = r.getTrackingUrl();
-    if (isSet(trackingUrl)) {
-      builder.append(separator).append("URL: ").append(trackingUrl);
-    }
-    builder.append(separator)
-           .append("Started: ")
-           .append(dateFormat.format(new Date(r.getStartTime())));
-    long finishTime = r.getFinishTime();
-    if (finishTime > 0) {
-      builder.append(separator)
-             .append("Finished: ")
-             .append(dateFormat.format(new Date(finishTime)));
-    }
-    String rpcHost = r.getHost();
-    if (!isSet(rpcHost)) {
-      builder.append(separator)
-             .append("RPC :")
-             .append(rpcHost)
-             .append(':')
-             .append(r.getRpcPort());
-    }
-    String diagnostics = r.getDiagnostics();
-    if (!isSet(diagnostics)) {
-      builder.append(separator).append("Diagnostics :").append(diagnostics);
-    }
-    return builder.toString();
-  }
-
-  /**
-   * Convert the instance details of an application to a string
-   * @param name instance name
-   * @param report the application report
-   * @param verbose verbose output
-   * @return a string
-   */
-  public static String instanceDetailsToString(String name,
-      ApplicationReport report,
-      List<ContainerInformation> containers,
-      String version,
-      Set<String> components,
-      boolean verbose) {
-    // format strings
-    String staticf = "%-30s";
-    String reportedf = staticf + "  %10s  %-42s";
-    String livef = reportedf + "  %s";
-    StringBuilder builder = new StringBuilder(200);
-    if (report == null) {
-      builder.append(String.format(staticf, name));
-    } else {
-      // there's a report to look at
-      String appId = report.getApplicationId().toString();
-      String state = report.getYarnApplicationState().toString();
-      if (report.getYarnApplicationState() == YarnApplicationState.RUNNING) {
-        // running: there's a URL
-        builder.append(
-            String.format(livef, name, state, appId, report.getTrackingUrl()));
-      } else {
-        builder.append(String.format(reportedf, name, state, appId));
-      }
-      if (verbose) {
-        builder.append('\n');
-        builder.append(SliderUtils.appReportToString(report, "\n  "));
-      }
-      if (containers != null) {
-        builder.append('\n');
-        builder.append(SliderUtils.containersToString(containers, version,
-            components));
-      }
-    }
-
-    builder.append('\n');
-    return builder.toString();
-  }
-
-  public static String containersToString(
-      List<ContainerInformation> containers, String version,
-      Set<String> components) {
-    String containerf = "  %-28s  %30s  %45s  %s\n";
-    StringBuilder builder = new StringBuilder(512);
-    builder.append("Containers:\n");
-    builder.append(String.format("  %-28s  %30s  %45s  %s\n", "Component Name",
-        "App Version", "Container Id", "Container Info/Logs"));
-    for (ContainerInformation container : containers) {
-      if (filter(container.appVersion, version)
-          || filter(container.component, components)) {
-        continue;
-      }
-      builder.append(String.format(containerf, container.component,
-          container.appVersion, container.containerId, container.host
-              + SliderKeys.YARN_CONTAINER_PATH + container.containerId));
-    }
-    return builder.toString();
-  }
-
-  /**
-   * Filter a string value given a single filter
-   * 
-   * @param value
-   *          the string value to check
-   * @param filter
-   *          a single string filter
-   * @return return true if value should be trapped, false if it should be let
-   *         through
-   */
-  public static boolean filter(String value, String filter) {
-    return !(StringUtils.isEmpty(filter) || filter.equals(value));
-  }
-
-  /**
-   * Filter a string value given a set of filters
-   * 
-   * @param value
-   *          the string value to check
-   * @param filters
-   *          a set of string filters
-   * @return return true if value should be trapped, false if it should be let
-   *         through
-   */
-  public static boolean filter(String value, Set<String> filters) {
-    return !(filters.isEmpty() || filters.contains(value));
-  }
-
-  /**
-   * Sorts the given list of application reports, most recently started 
-   * or finished instance first.
-   *
-   * @param instances list of instances
-   */
-  public static void sortApplicationsByMostRecent(List<ApplicationReport> instances) {
-    Collections.sort(instances, new MostRecentlyStartedOrFinishedFirst());
-  }
-
-  /**
-   * Sorts the given list of application reports
-   * Finished instances are ordered by finished time and running/accepted instances are
-   * ordered by start time
-   * Finally Instance are order by finished instances coming after running instances
-   *
-   * @param instances list of instances
-   */
-  public static void sortApplicationReport(List<ApplicationReport> instances) {
-    if (instances.size() <= 1) {
-      return;
-    }
-    List<ApplicationReport> nonLiveInstance =
-        new ArrayList<>(instances.size());
-    List<ApplicationReport> liveInstance =
-        new ArrayList<>(instances.size());
-
-    for (ApplicationReport report : instances) {
-      if (report.getYarnApplicationState() == YarnApplicationState.RUNNING
-          ||
-          report.getYarnApplicationState() == YarnApplicationState.ACCEPTED) {
-        liveInstance.add(report);
-      } else {
-        nonLiveInstance.add(report);
-      }
-    }
-
-    if (liveInstance.size() > 1) {
-      Collections.sort(liveInstance, new MostRecentlyStartedAppFirst());
-    }
-    if (nonLiveInstance.size() > 1) {
-      Collections.sort(nonLiveInstance, new MostRecentAppFinishFirst());
-    }
-    instances.clear();
-    instances.addAll(liveInstance);
-    instances.addAll(nonLiveInstance);
-  }
-
-  /**
-   * Built a (sorted) map of application reports, mapped to the instance name
-   * The list is sorted, and the addition process does not add a report
-   * if there is already one that exists. If the list handed in is sorted,
-   * those that are listed first form the entries returned
-   * @param instances list of intances
-   * @param minState minimum YARN state to be included
-   * @param maxState maximum YARN state to be included
-   * @return all reports in the list whose state &gt;= minimum and &lt;= maximum
-   */
-  public static Map<String, ApplicationReport> buildApplicationReportMap(
-      List<ApplicationReport> instances,
-      YarnApplicationState minState, YarnApplicationState maxState) {
-    TreeMap<String, ApplicationReport> map = new TreeMap<>();
-    for (ApplicationReport report : instances) {
-      YarnApplicationState state = report.getYarnApplicationState();
-      if (state.ordinal() >= minState.ordinal() &&
-          state.ordinal() <= maxState.ordinal() &&
-          map.get(report.getName()) == null) {
-        map.put(report.getName(), report);
-      }
-    }
-    return map;
-  }
-
-  /**
-   * Take a map and produce a sorted equivalent
-   * @param source source map
-   * @return a map whose iterator returns the string-sorted ordering of entries
-   */
-  public static Map<String, String> sortedMap(Map<String, String> source) {
-    Map<String, String> out = new TreeMap<>(source);
-    return out;
-  }
-
-  /**
-   * Convert a properties instance to a string map.
-   * @param properties source property object
-   * @return a string map
-   */
-  public static Map<String, String> toMap(Properties properties) {
-    Map<String, String> out = new HashMap<>(properties.size());
-    for (Map.Entry<Object, Object> entry : properties.entrySet()) {
-      out.put(entry.getKey().toString(), entry.getValue().toString());
-    }
-    return out;
-  }
-
-  /**
-   * Merge in one map to another -all entries in the second map are
-   * merged into the first -overwriting any duplicate keys.
-   * @param first first map -the updated one.
-   * @param second the map that is merged in
-   * @return the first map
-   */
-  public static Map<String, String> mergeMap(Map<String, String> first,
-      Map<String, String> second) {
-    first.putAll(second);
-    return first;
-  }
-
-  /**
-   * Merge a set of entries into a map. This will take the entryset of
-   * a map, or a Hadoop collection itself
-   * @param dest destination
-   * @param entries entries
-   * @return dest -with the entries merged in
-   */
-  public static Map<String, String> mergeEntries(Map<String, String> dest,
-      Iterable<Map.Entry<String, String>> entries) {
-    for (Map.Entry<String, String> entry : entries) {
-      dest.put(entry.getKey(), entry.getValue());
-    }
-    return dest;
-  }
-
-  /**
-   * Generic map merge logic
-   * @param first first map
-   * @param second second map
-   * @param <T1> key type
-   * @param <T2> value type
-   * @return 'first' merged with the second
-   */
-  public static <T1, T2> Map<T1, T2> mergeMaps(Map<T1, T2> first,
-      Map<T1, T2> second) {
-    first.putAll(second);
-    return first;
-  }
-
-  /**
-   * Generic map merge logic
-   * @param first first map
-   * @param second second map
-   * @param <T1> key type
-   * @param <T2> value type
-   * @return 'first' merged with the second
-   */
-  public static <T1, T2> Map<T1, T2> mergeMapsIgnoreDuplicateKeys(Map<T1, T2> first,
-      Map<T1, T2> second) {
-    Preconditions.checkArgument(first != null, "Null 'first' value");
-    Preconditions.checkArgument(second != null, "Null 'second' value");
-    for (Map.Entry<T1, T2> entry : second.entrySet()) {
-      T1 key = entry.getKey();
-      if (!first.containsKey(key)) {
-        first.put(key, entry.getValue());
-      }
-    }
-    return first;
-  }
-
-  /**
-   * Merge string maps excluding prefixes
-   * @param first first map
-   * @param second second map
-   * @param  prefixes prefixes to ignore
-   * @return 'first' merged with the second
-   */
-  public static Map<String, String> mergeMapsIgnoreDuplicateKeysAndPrefixes(
-      Map<String, String> first, Map<String, String> second,
-      String... prefixes) {
-    Preconditions.checkArgument(first != null, "Null 'first' value");
-    Preconditions.checkArgument(second != null, "Null 'second' value");
-    Preconditions.checkArgument(prefixes != null, "Null 'prefixes' value");
-    for (Map.Entry<String, String> entry : second.entrySet()) {
-      String key = entry.getKey();
-      boolean hasPrefix = false;
-      for (String prefix : prefixes) {
-        if (key.startsWith(prefix)) {
-          hasPrefix = true;
-          break;
-        }
-      }
-      if (hasPrefix) {
-        continue;
-      }
-      if (!first.containsKey(key)) {
-        first.put(key, entry.getValue());
-      }
-    }
-    return first;
-  }
-
-  /**
-   * Convert a map to a multi-line string for printing
-   * @param map map to stringify
-   * @return a string representation of the map
-   */
-  public static String stringifyMap(Map<String, String> map) {
-    StringBuilder builder = new StringBuilder();
-    for (Map.Entry<String, String> entry : map.entrySet()) {
-      builder.append(entry.getKey())
-             .append("=\"")
-             .append(entry.getValue())
-             .append("\"\n");
-
-    }
-    return builder.toString();
-  }
-
-  /**
-   * Get the int value of a role
-   * @param roleMap map of role key->val entries
-   * @param key key the key to look for
-   * @param defVal default value to use if the key is not in the map
-   * @param min min value or -1 for do not check
-   * @param max max value or -1 for do not check
-   * @return the int value the integer value
-   * @throws BadConfigException if the value could not be parsed
-   */
-  public static int getIntValue(Map<String, String> roleMap,
-      String key,
-      int defVal,
-      int min,
-      int max
-  ) throws BadConfigException {
-    String valS = roleMap.get(key);
-    return parseAndValidate(key, valS, defVal, min, max);
-
-  }
-
-  /**
-   * Parse an int value, replacing it with defval if undefined;
-   * @param errorKey key to use in exceptions
-   * @param defVal default value to use if the key is not in the map
-   * @param min min value or -1 for do not check
-   * @param max max value or -1 for do not check
-   * @return the int value the integer value
-   * @throws BadConfigException if the value could not be parsed
-   */
-  public static int parseAndValidate(String errorKey,
-      String valS,
-      int defVal,
-      int min, int max) throws
-      BadConfigException {
-    if (valS == null) {
-      valS = Integer.toString(defVal);
-    }
-    String trim = valS.trim();
-    int val;
-    try {
-      val = Integer.decode(trim);
-    } catch (NumberFormatException e) {
-      throw new BadConfigException("Failed to parse value of "
-                                   + errorKey + ": \"" + trim + "\"");
-    }
-    if (min >= 0 && val < min) {
-      throw new BadConfigException("Value of "
-                                   + errorKey + ": " + val + ""
-                                   + "is less than the minimum of " + min);
-    }
-    if (max >= 0 && val > max) {
-      throw new BadConfigException("Value of "
-                                   + errorKey + ": " + val + ""
-                                   + "is more than the maximum of " + max);
-    }
-    return val;
-  }
-
-  public static InetSocketAddress getRmAddress(Configuration conf) {
-    return conf.getSocketAddr(YarnConfiguration.RM_ADDRESS,
-        YarnConfiguration.DEFAULT_RM_ADDRESS,
-        YarnConfiguration.DEFAULT_RM_PORT);
-  }
-
-  public static InetSocketAddress getRmSchedulerAddress(Configuration conf) {
-    return conf.getSocketAddr(YarnConfiguration.RM_SCHEDULER_ADDRESS,
-        YarnConfiguration.DEFAULT_RM_SCHEDULER_ADDRESS,
-        YarnConfiguration.DEFAULT_RM_SCHEDULER_PORT);
-  }
-
-  /**
-   * probe to see if the RM scheduler is defined
-   * @param conf config
-   * @return true if the RM scheduler address is set to
-   * something other than 0.0.0.0
-   */
-  public static boolean isRmSchedulerAddressDefined(Configuration conf) {
-    InetSocketAddress address = getRmSchedulerAddress(conf);
-    return isAddressDefined(address);
-  }
-
-  /**
-   * probe to see if the address
-   * @param address network address
-   * @return true if the scheduler address is set to
-   * something other than 0.0.0.0
-   */
-  public static boolean isAddressDefined(InetSocketAddress address) {
-    if (address == null || address.getHostString() == null) {
-      return false;
-    }
-    return !(address.getHostString().equals("0.0.0.0"));
-  }
-
-  public static void setRmAddress(Configuration conf, String rmAddr) {
-    conf.set(YarnConfiguration.RM_ADDRESS, rmAddr);
-  }
-
-  public static void setRmSchedulerAddress(Configuration conf, String rmAddr) {
-    conf.set(YarnConfiguration.RM_SCHEDULER_ADDRESS, rmAddr);
-  }
-
-  public static boolean hasAppFinished(ApplicationReport report) {
-    return report == null ||
-           report.getYarnApplicationState().ordinal() >=
-           YarnApplicationState.FINISHED.ordinal();
-  }
-
-  public static String containerToString(Container container) {
-    if (container == null) {
-      return "null container";
-    }
-    return String.format(Locale.ENGLISH,
-        "ContainerID=%s nodeID=%s http=%s priority=%s resource=%s",
-        container.getId(),
-        container.getNodeId(),
-        container.getNodeHttpAddress(),
-        container.getPriority(),
-        container.getResource());
-  }
-
-  /**
-   * convert an AM report to a string for diagnostics
-   * @param report the report
-   * @return the string value
-   */
-  public static String reportToString(ApplicationReport report) {
-    if (report == null) {
-      return "Null application report";
-    }
-
-    return "App " + report.getName() + "/" + report.getApplicationType() +
-           "# " +
-           report.getApplicationId() + " user " + report.getUser() +
-           " is in state " + report.getYarnApplicationState() +
-           " RPC: " + report.getHost() + ":" + report.getRpcPort() +
-           " URL: " + report.getOriginalTrackingUrl();
-  }
-
-  /**
-   * Convert a YARN URL into a string value of a normal URL
-   * @param url URL
-   * @return string representatin
-   */
-  public static String stringify(org.apache.hadoop.yarn.api.records.URL url) {
-    StringBuilder builder = new StringBuilder();
-    builder.append(url.getScheme()).append("://");
-    if (url.getHost() != null) {
-      builder.append(url.getHost()).append(":").append(url.getPort());
-    }
-    builder.append(url.getFile());
-    return builder.toString();
-  }
-
-  public static int findFreePort(int start, int limit) {
-    if (start == 0) {
-      //bail out if the default is "dont care"
-      return 0;
-    }
-    int found = 0;
-    int port = start;
-    int finish = start + limit;
-    while (found == 0 && port < finish) {
-      if (isPortAvailable(port)) {
-        found = port;
-      } else {
-        port++;
-      }
-    }
-    return found;
-  }
-
-  /**
-   * Get a random open port
-   * @return true if the port was available for listening on
-   */
-  public static int getOpenPort() throws IOException {
-    ServerSocket socket = null;
-    try {
-      socket = new ServerSocket(0);
-      return socket.getLocalPort();
-    } finally {
-      if (socket != null) {
-        socket.close();
-      }
-    }
-  }
-
-  /**
-   * See if a port is available for listening on by trying to listen
-   * on it and seeing if that works or fails.
-   * @param port port to listen to
-   * @return true if the port was available for listening on
-   */
-  public static boolean isPortAvailable(int port) {
-    try {
-      ServerSocket socket = new ServerSocket(port);
-      socket.close();
-      return true;
-    } catch (IOException e) {
-      return false;
-    }
-  }
-
-  /**
-   * Build the environment map from a role option map, finding all entries
-   * beginning with "env.", adding them to a map of (prefix-removed)
-   * env vars
-   * @param roleOpts role options. This can be null, meaning the
-   * role is undefined
-   * @return a possibly empty map of environment variables.
-   */
-  public static Map<String, String> buildEnvMap(Map<String, String> roleOpts) {
-    return buildEnvMap(roleOpts, null);
-  }
-
-  public static Map<String, String> buildEnvMap(Map<String, String> roleOpts,
-      Map<String,String> tokenMap) {
-    Map<String, String> env = new HashMap<>();
-    if (roleOpts != null) {
-      for (Map.Entry<String, String> entry : roleOpts.entrySet()) {
-        String key = entry.getKey();
-        if (key.startsWith(RoleKeys.ENV_PREFIX)) {
-          String envName = key.substring(RoleKeys.ENV_PREFIX.length());
-          if (!envName.isEmpty()) {
-            String value = entry.getValue();
-            if (tokenMap != null) {
-              for (Map.Entry<String,String> token : tokenMap.entrySet()) {
-                value = value.replaceAll(Pattern.quote(token.getKey()),
-                    token.getValue());
-              }
-            }
-            env.put(envName, value);
-          }
-        }
-      }
-    }
-    return env;
-  }
-
-  /**
-   * Apply a set of command line options to a cluster role map
-   * @param clusterRoleMap cluster role map to merge onto
-   * @param commandOptions command opts
-   */
-  public static void applyCommandLineRoleOptsToRoleMap(
-      Map<String, Map<String, String>> clusterRoleMap,
-      Map<String, Map<String, String>> commandOptions) {
-    for (Map.Entry<String, Map<String, String>> entry : commandOptions.entrySet()) {
-      String key = entry.getKey();
-      Map<String, String> optionMap = entry.getValue();
-      Map<String, String> existingMap = clusterRoleMap.get(key);
-      if (existingMap == null) {
-        existingMap = new HashMap<String, String>();
-      }
-      log.debug("Overwriting role options with command line values {}",
-          stringifyMap(optionMap));
-      mergeMap(existingMap, optionMap);
-      //set or overwrite the role
-      clusterRoleMap.put(key, existingMap);
-    }
-  }
-
-  /**
-   * verify that the supplied cluster name is valid
-   * @param clustername cluster name
-   * @throws BadCommandArgumentsException if it is invalid
-   */
-  public static void validateClusterName(String clustername) throws
-      BadCommandArgumentsException {
-    if (!isClusternameValid(clustername)) {
-      throw new BadCommandArgumentsException(
-          "Illegal cluster name: " + clustername);
-    }
-  }
-
-  /**
-   * Verify that a Kerberos principal has been set -if not fail
-   * with an error message that actually tells you what is missing
-   * @param conf configuration to look at
-   * @param principal key of principal
-   * @throws BadConfigException if the key is not set
-   */
-  public static void verifyPrincipalSet(Configuration conf,
-      String principal) throws
-      BadConfigException {
-    String principalName = conf.get(principal);
-    if (principalName == null) {
-      throw new BadConfigException("Unset Kerberos principal : %s",
-          principal);
-    }
-    log.debug("Kerberos princial {}={}", principal, principalName);
-  }
-
-  /**
-   * Flag to indicate whether the cluster is in secure mode
-   * @param conf configuration to look at
-   * @return true if the slider client/service should be in secure mode
-   */
-  public static boolean isHadoopClusterSecure(Configuration conf) {
-    return SecurityUtil.getAuthenticationMethod(conf) !=
-           UserGroupInformation.AuthenticationMethod.SIMPLE;
-  }
-
-  /**
-   * Init security if the cluster configuration declares the cluster is secure
-   * @param conf configuration to look at
-   * @return true if the cluster is secure
-   * @throws IOException cluster is secure
-   * @throws SliderException the configuration/process is invalid
-   */
-  public static boolean maybeInitSecurity(Configuration conf) throws
-      IOException,
-      SliderException {
-    boolean clusterSecure = isHadoopClusterSecure(conf);
-    if (clusterSecure) {
-      log.debug("Enabling security");
-      initProcessSecurity(conf);
-    }
-    return clusterSecure;
-  }
-
-  /**
-   * Turn on security. This is setup to only run once.
-   * @param conf configuration to build up security
-   * @return true if security was initialized in this call
-   * @throws IOException IO/Net problems
-   * @throws BadConfigException the configuration and system state are inconsistent
-   */
-  public static boolean initProcessSecurity(Configuration conf) throws
-      IOException,
-      SliderException {
-
-    if (processSecurityAlreadyInitialized.compareAndSet(true, true)) {
-      //security is already inited
-      return false;
-    }
-
-    log.info("JVM initialized into secure mode with kerberos realm {}",
-        SliderUtils.getKerberosRealm());
-    //this gets UGI to reset its previous world view (i.e simple auth)
-    //security
-    log.debug("java.security.krb5.realm={}",
-        System.getProperty(JAVA_SECURITY_KRB5_REALM, ""));
-    log.debug("java.security.krb5.kdc={}",
-        System.getProperty(JAVA_SECURITY_KRB5_KDC, ""));
-    log.debug("hadoop.security.authentication={}",
-        conf.get(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION));
-    log.debug("hadoop.security.authorization={}",
-        conf.get(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION));
-    UserGroupInformation.setConfiguration(conf);
-    UserGroupInformation authUser = UserGroupInformation.getCurrentUser();
-    log.debug("Authenticating as {}", authUser);
-    log.debug("Login user is {}", UserGroupInformation.getLoginUser());
-    if (!UserGroupInformation.isSecurityEnabled()) {
-      throw new SliderException(LauncherExitCodes.EXIT_UNAUTHORIZED,
-          "Although secure mode is enabled," +
-         "the application has already set up its user as an insecure entity %s",
-          authUser);
-    }
-    if (authUser.getAuthenticationMethod() ==
-        UserGroupInformation.AuthenticationMethod.SIMPLE) {
-      throw new BadConfigException("Auth User is not Kerberized %s" +
-         " -security has already been set up with the wrong authentication method. "
-         + "This can occur if a file system has already been created prior to the loading of "
-         + "the security configuration.",
-          authUser);
-
-    }
-
-    SliderUtils.verifyPrincipalSet(conf, YarnConfiguration.RM_PRINCIPAL);
-    SliderUtils.verifyPrincipalSet(conf, SliderXmlConfKeys.DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY);
-    return true;
-  }
-
-  /**
-   * Force an early login: This catches any auth problems early rather than
-   * in RPC operations
-   * @throws IOException if the login fails
-   */
-  public static void forceLogin() throws IOException {
-    if (UserGroupInformation.isSecurityEnabled()) {
-      if (UserGroupInformation.isLoginKeytabBased()) {
-        UserGroupInformation.getLoginUser().reloginFromKeytab();
-      } else {
-        UserGroupInformation.getLoginUser().reloginFromTicketCache();
-      }
-    }
-  }
-
-  /**
-   * Submit a JAR containing a specific class and map it
-   * @param providerResources provider map to build up
-   * @param sliderFileSystem remote fs
-   * @param clazz class to look for
-   * @param libdir lib directory
-   * @param jarName <i>At the destination</i>
-   * @return the local resource ref
-   * @throws IOException trouble copying to HDFS
-   */
-  public static LocalResource putJar(Map<String, LocalResource> providerResources,
-      SliderFileSystem sliderFileSystem,
-      Class clazz,
-      Path tempPath,
-      String libdir,
-      String jarName
-  )
-      throws IOException, SliderException {
-    LocalResource res = sliderFileSystem.submitJarWithClass(
-        clazz,
-        tempPath,
-        libdir,
-        jarName);
-    providerResources.put(libdir + "/" + jarName, res);
-    return res;
-  }
-
-  /**
-   * Submit a JAR containing and map it
-   * @param providerResources provider map to build up
-   * @param sliderFileSystem remote fs
-   * @param libDir lib directory
-   * @param srcPath copy jars from
-   * @throws IOException, SliderException trouble copying to HDFS
-   */
-  public static void putAllJars(Map<String, LocalResource> providerResources,
-                                SliderFileSystem sliderFileSystem,
-                                Path tempPath,
-                                String libDir,
-                                String srcPath) throws IOException, SliderException {
-    log.info("Loading all dependencies from {}", srcPath);
-    if (SliderUtils.isSet(srcPath)) {
-      File srcFolder = new File(srcPath);
-      FilenameFilter jarFilter = createJarFilter();
-      File[] listOfJars = srcFolder.listFiles(jarFilter);
-      if (listOfJars == null || listOfJars.length == 0) {
-        return;
-      }
-      for (File jarFile : listOfJars) {
-        LocalResource res = sliderFileSystem.submitFile(jarFile, tempPath, libDir, jarFile.getName());
-        providerResources.put(libDir + "/" + jarFile.getName(), res);
-      }
-    }
-  }
-
-  /**
-   * Accept all filenames ending with {@code .jar}
-   * @return a filename filter
-   */
-  public static FilenameFilter createJarFilter() {
-    return new FilenameFilter() {
-      public boolean accept(File dir, String name) {
-        return name.toLowerCase(Locale.ENGLISH).endsWith(".jar");
-      }
-    };
-  }
-
-  /**
-   * Submit the AM tar.gz containing all dependencies and map it
-   * @param providerResources provider map to build up
-   * @param sliderFileSystem remote fs
-   * @throws IOException, SliderException trouble copying to HDFS
-   */
-  public static void putAmTarGzipAndUpdate(
-      Map<String, LocalResource> providerResources,
-      SliderFileSystem sliderFileSystem
-  ) throws IOException, SliderException {
-    log.info("Loading all dependencies from {}{}",
-        SliderKeys.SLIDER_DEPENDENCY_TAR_GZ_FILE_NAME,
-        SliderKeys.SLIDER_DEPENDENCY_TAR_GZ_FILE_EXT);
-    sliderFileSystem.submitTarGzipAndUpdate(providerResources);
-  }
-
-  public static Map<String, Map<String, String>> deepClone(Map<String, Map<String, String>> src) {
-    Map<String, Map<String, String>> dest = new HashMap<>();
-    for (Map.Entry<String, Map<String, String>> entry : src.entrySet()) {
-      dest.put(entry.getKey(), stringMapClone(entry.getValue()));
-    }
-    return dest;
-  }
-
-  public static Map<String, String> stringMapClone(Map<String, String> src) {
-    Map<String, String> dest = new HashMap<>();
-    return mergeEntries(dest, src.entrySet());
-  }
-
-  /**
-   * List a directory in the local filesystem
-   * @param dir directory
-   * @return a listing, one to a line
-   */
-  public static String listDir(File dir) {
-    if (dir == null) {
-      return "";
-    }
-    String[] confDirEntries = dir.list();
-    if (confDirEntries == null) {
-      return "";
-    }
-    StringBuilder builder = new StringBuilder();
-    for (String entry : confDirEntries) {
-      builder.append(entry).append("\n");
-    }
-    return builder.toString();
-  }
-
-  /**
-   * Create a file:// path from a local file
-   * @param file file to point the path
-   * @return a new Path
-   */
-  public static Path createLocalPath(File file) {
-    return new Path(file.toURI());
-  }
-
-  /**
-   * Get the current user -relays to
-   * {@link UserGroupInformation#getCurrentUser()}
-   * with any Slider-specific post processing and exception handling
-   * @return user info
-   * @throws IOException on a failure to get the credentials
-   */
-  public static UserGroupInformation getCurrentUser() throws IOException {
-
-    try {
-      UserGroupInformation currentUser = UserGroupInformation.getCurrentUser();
-      return currentUser;
-    } catch (IOException e) {
-      log.info("Failed to get user info", e);
-      throw e;
-    }
-  }
-
-  public static String getKerberosRealm() {
-    try {
-      return KerberosUtil.getDefaultRealm();
-    } catch (Exception e) {
-      log.debug("introspection into JVM internals failed", e);
-      return "(unknown)";
-
-    }
-  }
-
-  /**
-   * Register the client resource in
-   * {@link SliderKeys#SLIDER_CLIENT_XML}
-   * for Configuration instances.
-   *
-   * @return true if the resource could be loaded
-   */
-  public static URL registerClientResource() {
-    return ConfigHelper.registerDefaultResource(SliderKeys.SLIDER_CLIENT_XML);
-  }
-  
-  /**
-   * Attempt to load the slider client resource. If the
-   * resource is not on the CP an empty config is returned.
-   * @return a config
-   */
-  public static Configuration loadSliderClientXML() {
-    return ConfigHelper.loadFromResource(SliderKeys.SLIDER_CLIENT_XML);
-  }
-
-  /**
-   * Convert a char sequence to a string.
-   * This ensures that comparisons work
-   * @param charSequence source
-   * @return the string equivalent
-   */
-  public static String sequenceToString(CharSequence charSequence) {
-    StringBuilder stringBuilder = new StringBuilder(charSequence);
-    return stringBuilder.toString();
-  }
-
-  /**
-   * Build up the classpath for execution
-   * -behaves very differently on a mini test cluster vs a production
-   * production one.
-   *
-   * @param sliderConfDir relative path to the dir containing slider config
-   *                      options to put on the classpath -or null
-   * @param libdir directory containing the JAR files
-   * @param config the configuration
-   * @param usingMiniMRCluster flag to indicate the MiniMR cluster is in use
-   * (and hence the current classpath should be used, not anything built up)
-   * @return a classpath
-   */
-  public static ClasspathConstructor buildClasspath(String sliderConfDir,
-      String libdir,
-      Configuration config,
-      SliderFileSystem sliderFileSystem,
-      boolean usingMiniMRCluster) {
-
-    ClasspathConstructor classpath = new ClasspathConstructor();
-
-    // add the runtime classpath needed for tests to work
-    if (usingMiniMRCluster) {
-      // for mini cluster we pass down the java CP properties
-      // and nothing else
-      classpath.appendAll(classpath.localJVMClasspath());
-    } else {
-      if (sliderConfDir != null) {
-        classpath.addClassDirectory(sliderConfDir);
-      }
-      classpath.addLibDir(libdir);
-      if (sliderFileSystem.isFile(sliderFileSystem.getDependencyTarGzip())) {
-        classpath.addLibDir(SliderKeys.SLIDER_DEPENDENCY_LOCALIZED_DIR_LINK);
-      } else {
-        log.info(
-            "For faster submission of apps, upload dependencies using cmd {} {}",
-            SliderActions.ACTION_DEPENDENCY, Arguments.ARG_UPLOAD);
-      }
-      classpath.addRemoteClasspathEnvVar();
-      classpath.append(ApplicationConstants.Environment.HADOOP_CONF_DIR.$$());
-    }
-    return classpath;
-  }
-
-  /**
-   * Verify that a path refers to a directory. If not
-   * logs the parent dir then throws an exception
-   * @param dir the directory
-   * @param errorlog log for output on an error
-   * @throws FileNotFoundException if it is not a directory
-   */
-  public static void verifyIsDir(File dir, Logger errorlog) throws
-      FileNotFoundException {
-    if (!dir.exists()) {
-      errorlog.warn("contents of {}: {}", dir,
-          listDir(dir.getParentFile()));
-      throw new FileNotFoundException(dir.toString());
-    }
-    if (!dir.isDirectory()) {
-      errorlog.info("contents of {}: {}", dir,
-          listDir(dir.getParentFile()));
-      throw new FileNotFoundException(
-          "Not a directory: " + dir);
-    }
-  }
-
-  /**
-   * Verify that a file exists
-   * @param file file
-   * @param errorlog log for output on an error
-   * @throws FileNotFoundException
-   */
-  public static void verifyFileExists(File file, Logger errorlog) throws
-      FileNotFoundException {
-    if (!file.exists()) {
-      errorlog.warn("contents of {}: {}", file,
-          listDir(file.getParentFile()));
-      throw new FileNotFoundException(file.toString());
-    }
-    if (!file.isFile()) {
-      throw new FileNotFoundException("Not a file: " + file.toString());
-    }
-  }
-
-  /**
-   * verify that a config option is set
-   * @param configuration config
-   * @param key key
-   * @return the value, in case it needs to be verified too
-   * @throws BadConfigException if the key is missing
-   */
-  public static String verifyOptionSet(Configuration configuration, String key,
-      boolean allowEmpty) throws BadConfigException {
-    String val = configuration.get(key);
-    if (val == null) {
-      throw new BadConfigException(
-          "Required configuration option \"%s\" not defined ", key);
-    }
-    if (!allowEmpty && val.isEmpty()) {
-      throw new BadConfigException(
-          "Configuration option \"%s\" must not be empty", key);
-    }
-    return val;
-  }
-
-  /**
-   * Verify that a keytab property is defined and refers to a non-empty file
-   *
-   * @param siteConf configuration
-   * @param prop property to look for
-   * @return the file referenced
-   * @throws BadConfigException on a failure
-   */
-  public static File verifyKeytabExists(Configuration siteConf,
-      String prop) throws
-      BadConfigException {
-    String keytab = siteConf.get(prop);
-    if (keytab == null) {
-      throw new BadConfigException("Missing keytab property %s",
-          prop);
-
-    }
-    File keytabFile = new File(keytab);
-    if (!keytabFile.exists()) {
-      throw new BadConfigException("Missing keytab file %s defined in %s",
-          keytabFile,
-          prop);
-    }
-    if (keytabFile.length() == 0 || !keytabFile.isFile()) {
-      throw new BadConfigException("Invalid keytab file %s defined in %s",
-          keytabFile,
-          prop);
-    }
-    return keytabFile;
-  }
-
-  /**
-   * Convert an epoch time to a GMT time. This
-   * uses the deprecated Date.toString() operation,
-   * so is in one place to reduce the number of deprecation warnings.
-   * @param time timestamp
-   * @return string value as ISO-9601
-   */
-  @SuppressWarnings({"CallToDateToString", "deprecation"})
-  public static String toGMTString(long time) {
-    return new Date(time).toGMTString();
-  }
-
-  /**
-   * Add the cluster build information; this will include Hadoop details too
-   * @param info cluster info
-   * @param prefix prefix for the build info
-   */
-  public static void addBuildInfo(Map<String, String> info, String prefix) {
-
-    Properties props = SliderVersionInfo.loadVersionProperties();
-    info.put(prefix + "." + SliderVersionInfo.APP_BUILD_INFO, props.getProperty(
-        SliderVersionInfo.APP_BUILD_INFO));
-    info.put(prefix + "." + SliderVersionInfo.HADOOP_BUILD_INFO,
-        props.getProperty(SliderVersionInfo.HADOOP_BUILD_INFO));
-
-    info.put(prefix + "." + SliderVersionInfo.HADOOP_DEPLOYED_INFO,
-        VersionInfo.getBranch() + " @" + VersionInfo.getSrcChecksum());
-  }
-
-  /**
-   * Set the time for an information (human, machine) timestamp pair of fields.
-   * The human time is the time in millis converted via the {@link Date} class.
-   * @param info info fields
-   * @param keyHumanTime name of human time key
-   * @param keyMachineTime name of machine time
-   * @param time timestamp
-   */
-  public static void setInfoTime(Map info,
-      String keyHumanTime,
-      String keyMachineTime,
-      long time) {
-    info.put(keyHumanTime, SliderUtils.toGMTString(time));
-    info.put(keyMachineTime, Long.toString(time));
-  }
-
-  public static Path extractImagePath(CoreFileSystem fs,
-      MapOperations internalOptions) throws
-      SliderException, IOException {
-    Path imagePath;
-    String imagePathOption =
-        internalOptions.get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH);
-    String appHomeOption =
-        internalOptions.get(InternalKeys.INTERNAL_APPLICATION_HOME);
-    if (!isUnset(imagePathOption)) {
-      if (!isUnset(appHomeOption)) {
-        throw new BadClusterStateException(
-            ErrorStrings.E_BOTH_IMAGE_AND_HOME_DIR_SPECIFIED);
-      }
-      imagePath = fs.createPathThatMustExist(imagePathOption);
-    } else {
-      imagePath = null;
-      if (isUnset(appHomeOption)) {
-        throw new BadClusterStateException(
-            ErrorStrings.E_NO_IMAGE_OR_HOME_DIR_SPECIFIED);
-      }
-    }
-    return imagePath;
-  }
-
-  /**
-   * trigger a  JVM halt with no clean shutdown at all
-   * @param status status code for exit
-   * @param text text message
-   * @param delay delay in millis
-   * @return the timer (assuming the JVM hasn't halted yet)
-   *
-   */
-  public static Timer haltAM(int status, String text, int delay) {
-
-    Timer timer = new Timer("halt timer", false);
-    timer.schedule(new DelayedHalt(status, text), delay);
-    return timer;
-  }
-
-  public static String propertiesToString(Properties props) {
-    TreeSet<String> keys = new TreeSet<>(props.stringPropertyNames());
-    StringBuilder builder = new StringBuilder();
-    for (String key : keys) {
-      builder.append(key)
-             .append("=")
-             .append(props.getProperty(key))
-             .append("\n");
-    }
-    return builder.toString();
-  }
-
-  /**
-   * Add a subpath to an existing URL. This extends
-   * the path, inserting a / between all entries
-   * if needed.
-   * @param base base path/URL
-   * @param path subpath
-   * @return base+"/"+subpath
-   */
-  public static String appendToURL(String base, String path) {
-    StringBuilder fullpath = new StringBuilder(base);
-    if (!base.endsWith("/")) {
-      fullpath.append("/");
-    }
-    if (path.startsWith("/")) {
-      fullpath.append(path.substring(1));
-    } else {
-      fullpath.append(path);
-    }
-    return fullpath.toString();
-  }
-
-  /**
-   * Append a list of paths, inserting "/" signs as appropriate
-   * @param base base path/URL
-   * @param paths subpaths
-   * @return base+"/"+paths[0]+"/"+paths[1]...
-   */
-  public static String appendToURL(String base, String... paths) {
-    String result = base;
-    for (String path : paths) {
-      result = appendToURL(result, path);
-    }
-    return result;
-  }
-
-
-  /**
-   * Truncate the given string to a maximum length provided
-   * with a pad (...) added to the end if expected size if more than 10.
-   * @param toTruncate string to truncate; may be null
-   * @param maxSize maximum size
-   * @return the truncated/padded string. 
-   */
-  public static String truncate(String toTruncate, int maxSize) {
-    if (toTruncate == null || maxSize < 1
-        || toTruncate.length() <= maxSize) {
-      return toTruncate;
-    }
-
-    String pad = "...";
-    if (maxSize < 10) {
-      pad = "";
-    }
-    return toTruncate.substring(0, maxSize - pad.length()).concat(pad);
-  }
-
-  /**
-   * Get a string node label value from a node report
-   * @param report node report
-   * @return a single trimmed label or ""
-   */
-  public static String extractNodeLabel(NodeReport report) {
-    Set<String> newlabels = report.getNodeLabels();
-    if (newlabels != null && !newlabels.isEmpty()) {
-      return newlabels.iterator().next().trim();
-    } else {
-      return "";
-    }
-  }
-
-  /**
-   * Callable for async/scheduled halt
-   */
-  public static class DelayedHalt extends TimerTask {
-    private final int status;
-    private final String text;
-
-    public DelayedHalt(int status, String text) {
-      this.status = status;
-      this.text = text;
-    }
-
-    @Override
-    public void run() {
-      try {
-        ExitUtil.halt(status, text);
-        //this should never be reached
-      } catch (ExitUtil.HaltException e) {
-        log.info("Halt failed");
-      }
-    }
-  }
-
-  /**
-   * A compareTo function that converts the result of a long
-   * comparision into the integer that <code>Comparable</code>
-   * expects.
-   * @param left left side
-   * @param right right side
-   * @return -1, 0, 1 depending on the diff
-   */
-  public static int compareTo(long left, long right) {
-    long diff = left - right;
-    if (diff < 0) {
-      return -1;
-    }
-    if (diff > 0) {
-      return 1;
-    }
-    return 0;
-  }
-
-  /**
-   * Given a source folder create zipped file
-   *
-   * @param srcFolder
-   * @param zipFile
-   *
-   * @throws IOException
-   */
-  public static void zipFolder(File srcFolder, File zipFile) throws IOException {
-    log.info("Zipping folder {} to {}", srcFolder.getAbsolutePath(), zipFile.getAbsolutePath());
-    List<String> files = new ArrayList<>();
-    generateFileList(files, srcFolder, srcFolder, true);
-
-    byte[] buffer = new byte[1024];
-
-    try (FileOutputStream fos = new FileOutputStream(zipFile)) {
-      try (ZipOutputStream zos = new ZipOutputStream(fos)) {
-
-        for (String file : files) {
-          ZipEntry ze = new ZipEntry(file);
-          zos.putNextEntry(ze);
-          try (FileInputStream in = new FileInputStream(srcFolder + File.separator + file)) {
-            int len;
-            while ((len = in.read(buffer)) > 0) {
-              zos.write(buffer, 0, len);
-            }
-          }
-        }
-      }
-    }
-  }
-
-  /**
-   * Given a source folder create a tar.gz file
-   * 
-   * @param srcFolder
-   * @param tarGzipFile
-   * 
-   * @throws IOException
-   */
-  public static void tarGzipFolder(File srcFolder, File tarGzipFile,
-      FilenameFilter filter) throws IOException {
-    log.info("Tar-gzipping folder {} to {}", srcFolder.getAbsolutePath(),
-        tarGzipFile.getAbsolutePath());
-    List<String> files = new ArrayList<>();
-    generateFileList(files, srcFolder, srcFolder, true, filter);
-
-    try(TarArchiveOutputStream taos =
-            new TarArchiveOutputStream(new GZIPOutputStream(
-        new BufferedOutputStream(new FileOutputStream(tarGzipFile))))) {
-      for (String file : files) {
-        File srcFile = new File(srcFolder, file);
-        TarArchiveEntry tarEntry = new TarArchiveEntry(
-            srcFile, file);
-        taos.putArchiveEntry(tarEntry);
-        try(FileInputStream in = new FileInputStream(srcFile)) {
-          org.apache.commons.io.IOUtils.copy(in, taos);
-        }
-        taos.flush();
-        taos.closeArchiveEntry();
-      }
-    }
-  }
-
-  /**
-   * Retrieve the HDP version if it is an HDP cluster, or null otherwise. It
-   * first checks if system property HDP_VERSION is defined. If not it checks if
-   * system env HDP_VERSION is defined.
-   * 
-   * @return HDP version (if defined) or null otherwise
-   */
-  public static String getHdpVersion() {
-    String hdpVersion = System
-        .getProperty(SliderKeys.HDP_VERSION_PROP_NAME);
-    if (StringUtils.isEmpty(hdpVersion)) {
-      hdpVersion = System.getenv(SliderKeys.HDP_VERSION_PROP_NAME);
-    }
-    return hdpVersion;
-  }
-
-  /**
-   * Query to find if it is an HDP cluster
-   * 
-   * @return true if this is invoked in an HDP cluster or false otherwise
-   */
-  public static boolean isHdp() {
-    return StringUtils.isNotEmpty(getHdpVersion());
-  }
-
-  /**
-   * Retrieve the version of the current Slider install
-   * 
-   * @return the version string of the Slider release
-   */
-  public static String getSliderVersion() {
-    if (isHdp()) {
-      return getHdpVersion();
-    } else {
-      Properties props = SliderVersionInfo.loadVersionProperties();
-      return props.getProperty(SliderVersionInfo.APP_VERSION);
-    }
-  }
-
-  private static void generateFileList(List<String> fileList, File node,
-      File rootFolder, Boolean relative) {
-    generateFileList(fileList, node, rootFolder, relative, null);
-  }
-
-  private static void generateFileList(List<String> fileList, File node,
-      File rootFolder, Boolean relative, FilenameFilter filter) {
-    if (node.isFile()) {
-      String fileFullPath = node.toString();
-      if (relative) {
-        fileList.add(fileFullPath.substring(rootFolder.toString().length() + 1,
-            fileFullPath.length()));
-      } else {
-        fileList.add(fileFullPath);
-      }
-    }
-
-    if (node.isDirectory()) {
-      String[] subNode = node.list(filter);
-      if (subNode == null || subNode.length == 0) {
-          return;
-      }
-      for (String filename : subNode) {
-        generateFileList(fileList, new File(node, filename), rootFolder,
-            relative, filter);
-      }
-    }
-  }
-
-  /**
-   * This wraps ApplicationReports and generates a string version
-   * iff the toString() operator is invoked
-   */
-  public static class OnDemandReportStringifier {
-    private final ApplicationReport report;
-
-    public OnDemandReportStringifier(ApplicationReport report) {
-      this.report = report;
-    }
-
-    @Override
-    public String toString() {
-      return appReportToString(report, "\n");
-    }
-  }
-
-  public static InputStream getApplicationResourceInputStream(FileSystem fs,
-      Path appPath,
-      String entry)
-      throws IOException {
-    InputStream is = null;
-    try(FSDataInputStream appStream = fs.open(appPath)) {
-      ZipArchiveInputStream zis = new ZipArchiveInputStream(appStream);
-      ZipArchiveEntry zipEntry;
-      boolean done = false;
-      while (!done && (zipEntry = zis.getNextZipEntry()) != null) {
-        if (entry.equals(zipEntry.getName())) {
-          int size = (int) zipEntry.getSize();
-          if (size != -1) {
-            log.info("Reading {} of size {}", zipEntry.getName(),
-                zipEntry.getSize());
-            byte[] content = new byte[size];
-            int offset = 0;
-            while (offset < size) {
-              offset += zis.read(content, offset, size - offset);
-            }
-            is = new ByteArrayInputStream(content);
-          } else {
-            log.debug("Size unknown. Reading {}", zipEntry.getName());
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            while (true) {
-              int byteRead = zis.read();
-              if (byteRead == -1) {
-                break;
-              }
-              baos.write(byteRead);
-            }
-            is = new ByteArrayInputStream(baos.toByteArray());
-          }
-          done = true;
-        }
-      }
-    }
-
-    return is;
-  }
-
-  /**
-   * Check for any needed libraries being present. On Unix none are needed;
-   * on windows they must be present
-   * @return true if all is well
-   */
-  public static String checkForRequiredNativeLibraries() {
-
-    if (!Shell.WINDOWS) {
-      return "";
-    }
-    StringBuilder errorText = new StringBuilder("");
-    if (!NativeIO.isAvailable()) {
-      errorText.append("No native IO library. ");
-    }
-    try {
-      String path = Shell.getQualifiedBinPath(WINUTILS);
-      log.debug("winutils is at {}", path);
-    } catch (IOException e) {
-      errorText.append("No " + WINUTILS);
-      log.warn("No winutils: {}", e, e);
-    }
-    try {
-      File target = new File("target");
-      FileUtil.canRead(target);
-    } catch (UnsatisfiedLinkError e) {
-      log.warn("Failing to link to native IO methods: {}", e, e);
-      errorText.append("No native IO methods");
-    }
-    return errorText.toString();
-  }
-
-  /**
-   * Strictly verify that windows utils is present.
-   * Checks go as far as opening the file and looking for
-   * the headers. 
-   * @throws IOException on any problem reading the file
-   * @throws FileNotFoundException if the file is not considered valid
-   */
-  public static void maybeVerifyWinUtilsValid() throws
-      IOException,
-      SliderException {
-    String errorText = SliderUtils.checkForRequiredNativeLibraries();
-    if (!errorText.isEmpty()) {
-      throw new BadClusterStateException(errorText);
-    }
-  }
-
-  public static void verifyIsFile(String program, File exe) throws
-      FileNotFoundException {
-    if (!exe.isFile()) {
-      throw new FileNotFoundException(program
-                                      + " at " + exe
-                                      + " is not a file");
-
-    }
-  }
-
-  public static void verifyFileSize(String program,
-      File exe,
-      int minFileSize) throws FileNotFoundException {
-    if (exe.length() < minFileSize) {
-      throw new FileNotFoundException(program
-                                      + " at " + exe
-                                      + " is too short to be an executable");
-    }
-  }
-
-  /**
-   * Look for the windows executable and check it has the right headers.
-   * <code>File.canRead()</code> doesn't work on windows, so the reading
-   * is mandatory.
-   *
-   * @param program program name for errors
-   * @param exe executable
-   * @throws IOException IOE
-   */
-  public static void verifyWindowsExe(String program, File exe)
-      throws IOException {
-    verifyIsFile(program, exe);
-
-    verifyFileSize(program, exe, 0x100);
-
-    // now read two bytes and verify the header.
-    try(FileReader reader = new FileReader(exe)) {
-      int[] header = new int[2];
-      header[0] = reader.read();
-      header[1] = reader.read();
-      if ((header[0] != 'M' || header[1] != 'Z')) {
-        throw new FileNotFoundException(program
-                                        + " at " + exe
-                                        + " is not a windows executable file");
-      }
-    }
-  }
-
-  /**
-   * Verify that a Unix exe works
-   * @param program program name for errors
-   * @param exe executable
-   * @throws IOException IOE
-
-   */
-  public static void verifyUnixExe(String program, File exe)
-      throws IOException {
-    verifyIsFile(program, exe);
-
-    // read flag
-    if (!exe.canRead()) {
-      throw new IOException("Cannot read " + program + " at " + exe);
-    }
-    // exe flag
-    if (!exe.canExecute()) {
-      throw new IOException("Cannot execute " + program + " at " + exe);
-    }
-  }
-
-  /**
-   * Validate an executable
-   * @param program program name for errors
-   * @param exe program to look at
-   * @throws IOException
-   */
-  public static void validateExe(String program, File exe) throws IOException {
-    if (!Shell.WINDOWS) {
-      verifyWindowsExe(program, exe);
-    } else {
-      verifyUnixExe(program, exe);
-    }
-  }
-
-  /**
-   * Write bytes to a file
-   * @param outfile output file
-   * @param data data to write
-   * @param createParent flag to indicate that the parent dir should
-   * be created
-   * @throws IOException on any IO problem
-   */
-  public static void write(File outfile, byte[] data, boolean createParent)
-      throws IOException {
-    File parentDir = outfile.getCanonicalFile().getParentFile();
-    if (parentDir == null) {
-      throw new IOException(outfile.getPath() + " has no parent dir");
-    }
-    if (createParent) {
-      parentDir.mkdirs();
-    }
-    SliderUtils.verifyIsDir(parentDir, log);
-    try(FileOutputStream out = new FileOutputStream(outfile)) {
-      out.write(data);
-    }
-
-  }
-
-  /**
-   * Execute a command for a test operation
-   * @param name name in error
-   * @param status status code expected
-   * @param timeoutMillis timeout in millis for process to finish
-   * @param logger
-   * @param outputString optional string to grep for (must not span a line)
-   * @param commands commands   @return the process
-   * @throws IOException on any failure.
-   */
-  public static ForkedProcessService execCommand(String name,
-      int status,
-      long timeoutMillis,
-      Logger logger,
-      String outputString,
-      String... commands) throws IOException, SliderException {
-    Preconditions.checkArgument(isSet(name), "no name");
-    Preconditions.checkArgument(commands.length > 0, "no commands");
-    Preconditions.checkArgument(isSet(commands[0]), "empty command");
-
-    ForkedProcessService process;
-
-
-    process = new ForkedProcessService(
-        name,
-        new HashMap<String, String>(),
-        Arrays.asList(commands));
-    process.setProcessLog(logger);
-    process.init(new Configuration());
-    String errorText = null;
-    process.start();
-    try {
-      if (!process.waitForServiceToStop(timeoutMillis)) {
-        throw new TimeoutException(
-            "Process did not stop in " + timeoutMillis + "mS");
-      }
-      int exitCode = process.getExitCode();
-      List<String> recentOutput = process.getRecentOutput();
-      if (status != exitCode) {
-        // error condition
-        errorText = "Expected exit code={" + status + "}, "
-                    + "actual exit code={" + exitCode + "}";
-      } else {
-        if (isSet(outputString)) {
-          boolean found = false;
-          for (String line : recentOutput) {
-            if (line.contains(outputString)) {
-              found = true;
-              break;
-            }
-          }
-          if (!found) {
-            errorText = "Did not find \"" + outputString + "\""
-                        + " in output";
-          }
-        }
-      }
-      if (errorText == null) {
-        return process;
-      }
-
-    } catch (TimeoutException e) {
-      errorText = e.toString();
-    }
-    // error text: non null ==> operation failed
-    log.warn(errorText);
-    List<String> recentOutput = process.getRecentOutput();
-    for (String line : recentOutput) {
-      log.info(line);
-    }
-    throw new SliderException(LauncherExitCodes.EXIT_OTHER_FAILURE,
-        "Process %s failed: %s", name, errorText);
-
-  }
-
-
-  /**
-   * Validate the slider client-side execution environment.
-   * This looks for everything felt to be critical for execution, including
-   * native binaries and other essential dependencies.
-   * @param logger logger to log to on normal execution
-   * @throws IOException on IO failures
-   * @throws SliderException on validation failures
-   */
-  public static void validateSliderClientEnvironment(Logger logger) throws
-      IOException,
-      SliderException {
-    maybeVerifyWinUtilsValid();
-  }
-
-  /**
-   * Validate the slider server-side execution environment.
-   * This looks for everything felt to be critical for execution, including
-   * native binaries and other essential dependencies.
-   * @param logger logger to log to on normal execution
-   * @param dependencyChecks flag to indicate checks for agent dependencies
-   * @throws IOException on IO failures
-   * @throws SliderException on validation failures
-   */
-  public static void validateSliderServerEnvironment(Logger logger,
-      boolean dependencyChecks) throws
-      IOException,
-      SliderException {
-    maybeVerifyWinUtilsValid();
-    if (dependencyChecks) {
-      validatePythonEnv(logger);
-      validateOpenSSLEnv(logger);
-    }
-  }
-
-  public static void validateOpenSSLEnv(Logger logger) throws
-      IOException,
-      SliderException {
-    execCommand(OPENSSL, 0, 5000, logger, "OpenSSL", OPENSSL, "version");
-  }
-
-  public static void validatePythonEnv(Logger logger) throws
-      IOException,
-      SliderException {
-    execCommand(PYTHON, 0, 5000, logger, "Python", PYTHON, "-V");
-  }
-
-  /**
-   * return the path to the currently running slider command
-   *
-   * @throws NullPointerException
-   *             - If the pathname argument is null
-   * @throws SecurityException
-   *             - if a security manager exists and its checkPermission method
-   *             doesn't allow getting the ProtectionDomain
-   */
-  public static String getCurrentCommandPath() {
-    File f = new File(Slider.class.getProtectionDomain().getCodeSource()
-                                  .getLocation().getPath());
-    return f.getAbsolutePath();
-  }
-
-  /**
-   * return the HDFS path where the application package has been uploaded
-   * manually or by using slider client (install package command)
-   * 
-   * @param conf configuration
-   * @return
-   */
-  public static String getApplicationDefinitionPath(ConfTreeOperations conf)
-      throws BadConfigException {
-    return getApplicationDefinitionPath(conf, null);
-  }
-
-  /**
-   * return the HDFS path where the application package has been uploaded
-   * manually or by using slider client (install package command)
-   *
-   * @param conf configuration
-   * @param roleGroup name of component
-   * @return
-   */
-  public static String getApplicationDefinitionPath(ConfTreeOperations conf,
-      String roleGroup)
-      throws BadConfigException {
-    String appDefPath = conf.getGlobalOptions().getMandatoryOption(
-        AgentKeys.APP_DEF);
-    if (roleGroup != null) {
-      MapOperations component = conf.getComponent(roleGroup);
-      if (component != null) {
-        appDefPath = component.getOption(AgentKeys.APP_DEF, appDefPath);
-      }
-    }
-    return appDefPath;
-  }
-
-  /**
-   * return the path to the slider-client.xml used by the current running
-   * slider command
-   *
-   * @throws SecurityException
-   *             - if a security manager exists and its checkPermission method
-   *             denies access to the class loader for the class
-   */
-  public static String getClientConfigPath() {
-    URL path = ConfigHelper.class.getClassLoader().getResource(
-        SliderKeys.SLIDER_CLIENT_XML);
-    Preconditions.checkNotNull(path, "Failed to locate resource " + SliderKeys.SLIDER_CLIENT_XML);
-    return path.toString();
-  }
-
-  /**
-   * validate if slider-client.xml under the path can be opened
-   *
-   * @throws IOException
-   *             : the file can't be found or open
-   */
-  public static void validateClientConfigFile() throws IOException {
-    URL resURL = SliderVersionInfo.class.getClassLoader().getResource(
-        SliderKeys.SLIDER_CLIENT_XML);
-    if (resURL == null) {
-      throw new IOException(
-          "slider-client.xml doesn't exist on the path: "
-          + getClientConfigPath());
-    }
-
-    try {
-      InputStream inStream = resURL.openStream();
-      if (inStream == null) {
-        throw new IOException("slider-client.xml can't be opened");
-      }
-    } catch (IOException e) {
-      throw new IOException("slider-client.xml can't be opened: "
-                            + e.toString());
-    }
-  }
-
-  /**
-   * validate if a file on HDFS can be open
-   *
-   * @throws IOException the file can't be found or opened
-   * @throws URISyntaxException
-   */
-  public static void validateHDFSFile(SliderFileSystem sliderFileSystem,
-      String pathStr)
-      throws IOException, URISyntaxException {
-    try(InputStream inputStream =
-            sliderFileSystem.getFileSystem().open(new Path(new URI(pathStr)))) {
-      if (inputStream == null) {
-        throw new IOException("HDFS file " + pathStr + " can't be opened");
-      }
-    }
-  }
-
-  /**
-   * return the version and path of the JDK invoking the current running
-   * slider command
-   *
-   * @throws SecurityException
-   *             - if a security manager exists and its checkPropertyAccess
-   *             method doesn't allow access to the specified system property.
-   */
-  public static String getJDKInfo() {
-    String version = System.getProperty("java.version");
-    String javaHome = System.getProperty("java.home");
-    return
-        "The version of the JDK invoking the current running slider command: "
-        + version + "; The path to it is: " + javaHome;
-  }
-
-  /**
-   * return a description of whether the current user has created credential
-   * cache files from kerberos servers
-   *
-   * @throws IOException
-   * @throws BadConfigException
-   * @throws SecurityException
-   *             - if a security manager exists and its checkPropertyAccess
-   *             method doesn't allow access to the specified system property.
-   */
-  public static String checkCredentialCacheFile() throws IOException,
-      BadConfigException {
-    String result = null;
-    if (!Shell.WINDOWS) {
-      result = Shell.execCommand("klist");
-    }
-    return result;
-  }
-
-  /**
-   * Compare the times of two applications: most recent app comes first
-   * Specifically: the one whose start time value is greater.
-   */
-  private static class MostRecentlyStartedAppFirst
-      implements Comparator<ApplicationReport>, Serializable {
-    @Override
-    public int compare(ApplicationReport r1, ApplicationReport r2) {
-      long x = r1.getStartTime();
-      long y = r2.getStartTime();
-      return compareTwoLongsReverse(x, y);
-    }
-  }
-  
-  /**
-   * Compare the times of two applications: most recent app comes first.
-   * "Recent"== the app whose start time <i>or finish time</i> is the greatest.
-   */
-  private static class MostRecentlyStartedOrFinishedFirst
-      implements Comparator<ApplicationReport>, Serializable {
-    @Override
-    public int compare(ApplicationReport r1, ApplicationReport r2) {
-      long started1 = r1.getStartTime();
-      long started2 = r2.getStartTime();
-      long finished1 = r1.getFinishTime();
-      long finished2 = r2.getFinishTime();
-      long lastEvent1 = Math.max(started1, finished1);
-      long lastEvent2 = Math.max(started2, finished2);
-      return compareTwoLongsReverse(lastEvent1, lastEvent2);
-    }
-  }
-
-  /**
-   * Compare the times of two applications: most recently finished app comes first
-   * Specifically: the one whose finish time value is greater.
-   */
-  private static class MostRecentAppFinishFirst
-      implements Comparator<ApplicationReport>, Serializable {
-    @Override
-    public int compare(ApplicationReport r1, ApplicationReport r2) {
-      long x = r1.getFinishTime();
-      long y = r2.getFinishTime();
-      return compareTwoLongsReverse(x, y);
-    }
-  }
-
-  /**
-   * Compare two long values for sorting. As the return value for 
-   * comparators must be int, the simple value of <code>x-y</code>
-   * is inapplicable
-   * @param x x value
-   * @param y y value
-   * @return +ve if x is less than y, -ve if y is greater than x; 0 for equality
-   */
-  public static int compareTwoLongsReverse(long x, long y) {
-    return (x < y) ? 1 : ((x == y) ? 0 : -1);
-  }
-
-  public static String getSystemEnv(String property) {
-    return System.getenv(property);
-  }
-
-  public static Map<String, String> getSystemEnv() {
-    return System.getenv();
-  }
-
-  public static String requestToString(AMRMClient.ContainerRequest request) {
-    Preconditions.checkArgument(request != null, "Null request");
-    StringBuilder buffer = new StringBuilder(request.toString());
-    buffer.append("; ");
-    buffer.append("relaxLocality=").append(request.getRelaxLocality()).append("; ");
-    String labels = request.getNodeLabelExpression();
-    if (labels != null) {
-      buffer.append("nodeLabels=").append(labels).append("; ");
-    }
-    List<String> nodes = request.getNodes();
-    if (nodes != null) {
-      buffer.append("Nodes = [ ");
-      int size = nodes.size();
-      for (int i = 0; i < Math.min(NODE_LIST_LIMIT, size); i++) {
-        buffer.append(nodes.get(i)).append(' ');
-      }
-      if (size > NODE_LIST_LIMIT) {
-        buffer.append(String.format("...(total %d entries)", size));
-      }
-      buffer.append("]; ");
-    }
-    List<String> racks = request.getRacks();
-    if (racks != null) {
-      buffer.append("racks = [")
-          .append(join(racks, ", ", false))
-          .append("]; ");
-    }
-    return buffer.toString();
-  }
-
-  public static String trimPrefix(String prefix) {
-    if (prefix != null && prefix.endsWith(COMPONENT_SEPARATOR)) {
-      return prefix.substring(0, prefix.length()-

<TRUNCATED>


[22/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionFlexCluster.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionFlexCluster.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionFlexCluster.java
deleted file mode 100644
index 6b61681..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionFlexCluster.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-
-import java.util.concurrent.TimeUnit;
-
-public class ActionFlexCluster extends AsyncAction {
-
-  public final ConfTree resources;
-  
-  public ActionFlexCluster(String name,
-      long delay,
-      TimeUnit timeUnit, ConfTree resources) {
-    super(name, delay, timeUnit, ATTR_CHANGES_APP_SIZE);
-    this.resources = resources;
-  }
-
-  @Override
-  public void execute(SliderAppMaster appMaster,
-      QueueAccess queueService,
-      AppState appState) throws Exception {
-    appMaster.flexCluster(resources);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionHalt.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionHalt.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionHalt.java
deleted file mode 100644
index e2ad559..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionHalt.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import org.apache.hadoop.util.ExitUtil;
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Exit an emergency JVM halt.
- * @see ExitUtil#halt(int, String) 
- */
-public class ActionHalt extends AsyncAction {
-
-  private final int status;
-  private final String text;
-
-  public ActionHalt(
-      int status,
-      String text,
-      long delay, TimeUnit timeUnit) {
-    
-    // do not declare that this action halts the cluster ... keep it a surprise
-    super("Halt", delay, timeUnit);
-    this.status = status;
-    this.text = text;
-  }
-
-  @Override
-  public void execute(SliderAppMaster appMaster,
-      QueueAccess queueService,
-      AppState appState) throws Exception {
-    ExitUtil.halt(status, text);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionKillContainer.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionKillContainer.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionKillContainer.java
deleted file mode 100644
index 7446e82..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionKillContainer.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.operations.AbstractRMOperation;
-import org.apache.slider.server.appmaster.operations.ContainerReleaseOperation;
-import org.apache.slider.server.appmaster.operations.RMOperationHandler;
-import org.apache.slider.server.appmaster.operations.RMOperationHandlerActions;
-import org.apache.slider.server.appmaster.state.AppState;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Kill a specific container
- */
-public class ActionKillContainer extends AsyncAction {
-
-  /**
-   *  container to kill
-   */
-  private final ContainerId containerId;
-
-  /**
-   *  handler for the operation
-   */
-  private final RMOperationHandlerActions operationHandler;
-
-  /**
-   * Kill a container
-   * @param containerId container to kill
-   * @param delay
-   * @param timeUnit
-   * @param operationHandler
-   */
-  public ActionKillContainer(
-      ContainerId containerId,
-      long delay,
-      TimeUnit timeUnit,
-      RMOperationHandlerActions operationHandler) {
-    super("kill container", delay, timeUnit, ATTR_CHANGES_APP_SIZE);
-    this.operationHandler = operationHandler;
-    Preconditions.checkArgument(containerId != null);
-    
-    this.containerId = containerId;
-  }
-
-  /**
-   * Get the container ID to kill
-   * @return
-   */
-  public ContainerId getContainerId() {
-    return containerId;
-  }
-
-  @Override
-  public void execute(SliderAppMaster appMaster,
-      QueueAccess queueService,
-      AppState appState) throws Exception {
-      List<AbstractRMOperation> opsList = new LinkedList<>();
-    ContainerReleaseOperation release = new ContainerReleaseOperation(containerId);
-    opsList.add(release);
-    //now apply the operations
-    operationHandler.execute(opsList);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionRegisterServiceInstance.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionRegisterServiceInstance.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionRegisterServiceInstance.java
deleted file mode 100644
index ca330af..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionRegisterServiceInstance.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Asynchronous registration operation
- */
-public class ActionRegisterServiceInstance extends AsyncAction {
-
-  private final String instanceName;
-  private final ApplicationId appId;
-
-  public ActionRegisterServiceInstance(String instanceName,
-      ApplicationId appId) {
-    super("ActionRegisterServiceInstance");
-    this.instanceName = instanceName;
-    this.appId = appId;
-  }
-
-  public ActionRegisterServiceInstance(String instanceName,
-      ApplicationId appId,
-      long delay,
-      TimeUnit timeUnit) {
-    super("ActionRegisterServiceInstance", delay, timeUnit);
-    this.instanceName = instanceName;
-    this.appId = appId;
-  }
-
-  @Override
-  public void execute(SliderAppMaster appMaster,
-      QueueAccess queueService,
-      AppState appState) throws Exception {
-
-    // YARN Registry do the registration
-    appMaster.registerServiceInstance(instanceName, appId);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionStartContainer.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionStartContainer.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionStartContainer.java
deleted file mode 100644
index 358c844..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionStartContainer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-import org.apache.slider.server.appmaster.state.RoleInstance;
-
-import java.util.Locale;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Start a container
- * @see SliderAppMaster#startContainer(Container, ContainerLaunchContext, RoleInstance) 
- */
-public class ActionStartContainer extends AsyncAction {
-
-  private final Container container;
-  private final ContainerLaunchContext ctx;
-  private final RoleInstance instance;
-
-  public ActionStartContainer(String name,
-      Container container,
-      ContainerLaunchContext ctx,
-      RoleInstance instance,
-      long delay, TimeUnit timeUnit) {
-    super(
-        String.format(Locale.ENGLISH,
-            "%s %s: /",
-            name , container.getId().toString()), 
-        delay, 
-        timeUnit);
-    this.container = container;
-    this.ctx = ctx;
-    this.instance = instance;
-  }
-
-  @Override
-  public void execute(SliderAppMaster appMaster,
-      QueueAccess queueService,
-      AppState appState) throws Exception {
-    appMaster.startContainer(container, ctx, instance);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionStopQueue.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionStopQueue.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionStopQueue.java
deleted file mode 100644
index 08e8086..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionStopQueue.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Action to tell a queue executor to stop -after handing this on/executing it
- */
-public class ActionStopQueue extends AsyncAction {
-  private static final Logger log =
-      LoggerFactory.getLogger(ActionStopQueue.class);
-  
-  public ActionStopQueue(long delay) {
-    super("stop queue", delay);
-  }
-
-  public ActionStopQueue(long delay,
-      TimeUnit timeUnit) {
-    super("stop queue", delay, timeUnit);
-  }
-
-  public ActionStopQueue(String name,
-      long delay,
-      TimeUnit timeUnit) {
-    super(name, delay, timeUnit);
-  }
-
-  @Override
-  public void execute(SliderAppMaster appMaster,
-      QueueAccess queueService,
-      AppState appState) throws Exception {
-    log.warn("STOP");
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionStopSlider.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionStopSlider.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionStopSlider.java
deleted file mode 100644
index 055cea5..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionStopSlider.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
-import org.apache.slider.core.exceptions.ExceptionConverter;
-import org.apache.slider.core.exceptions.TriggerClusterTeardownException;
-import org.apache.slider.core.main.ExitCodeProvider;
-import org.apache.slider.core.main.LauncherExitCodes;
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Trigger an AM exit. This is used to build the exit status message for YARN
- */
-public class ActionStopSlider extends AsyncAction {
-
-  private int exitCode;
-  private FinalApplicationStatus finalApplicationStatus;
-  private String message;
-  private final Exception ex;
-
-  /**
-   * Simple constructor
-   * @param name action name
-   */
-  public ActionStopSlider(String name) {
-    super(name);
-    this.ex = null;
-  }
-
-  /**
-   * Stop slider
-   * @param name action name
-   * @param delay execution delay
-   * @param timeUnit delay time unit
-   * @param exitCode process exit code
-   * @param finalApplicationStatus yarn status
-   * @param message message for AM
-   */
-  public ActionStopSlider(String name,
-      long delay,
-      TimeUnit timeUnit,
-      int exitCode,
-      FinalApplicationStatus finalApplicationStatus,
-      String message) {
-    super(name, delay, timeUnit, ATTR_HALTS_APP);
-    this.exitCode = exitCode;
-    this.finalApplicationStatus = finalApplicationStatus;
-    this.message = message;
-    this.ex = null;
-  }
-
-  /**
-   * Stop slider
-   * @param name action name
-   * @param exitCode process exit code
-   * @param finalApplicationStatus yarn status
-   * @param message message for AM
-   */
-  public ActionStopSlider(String name,
-      int exitCode,
-      FinalApplicationStatus finalApplicationStatus,
-    String message) {
-    super(name);
-    this.exitCode = exitCode;
-    this.finalApplicationStatus = finalApplicationStatus;
-    this.message = message;
-    this.ex = null;
-  }
-
-  /**
-   * Simple constructor
-   * @param ex teardown exception
-   */
-  public ActionStopSlider(TriggerClusterTeardownException ex) {
-    this("stop",
-        ex.getExitCode(),
-        ex.getFinalApplicationStatus(),
-        ex.getMessage());
-  }
-  
-  /**
-   * Build from an exception.
-   * <p>
-   * If the exception implements
-   * {@link ExitCodeProvider} then the exit code is extracted from that
-   * @param ex exception.
-   */
-  public ActionStopSlider(Exception ex) {
-    super("stop");
-    if (ex instanceof ExitCodeProvider) {
-      setExitCode(((ExitCodeProvider)ex).getExitCode());
-    } else {
-      setExitCode(LauncherExitCodes.EXIT_EXCEPTION_THROWN);
-    }
-    setFinalApplicationStatus(FinalApplicationStatus.FAILED);
-    setMessage(ex.getMessage());
-    this.ex = ex;
-  }
-  
-  @Override
-  public void execute(SliderAppMaster appMaster,
-      QueueAccess queueService,
-      AppState appState) throws Exception {
-    SliderAppMaster.getLog().info("SliderAppMasterApi.stopCluster: {}",
-        message);
-    appMaster.onAMStop(this);
-  }
-
-  @Override
-  public String toString() {
-    return String.format("%s:  exit code = %d, %s: %s;",
-        name, exitCode, finalApplicationStatus, message) ;
-  }
-
-  public int getExitCode() {
-    return exitCode;
-  }
-
-  public void setExitCode(int exitCode) {
-    this.exitCode = exitCode;
-  }
-
-  public FinalApplicationStatus getFinalApplicationStatus() {
-    return finalApplicationStatus;
-  }
-
-  public void setFinalApplicationStatus(FinalApplicationStatus finalApplicationStatus) {
-    this.finalApplicationStatus = finalApplicationStatus;
-  }
-
-  public String getMessage() {
-    return message;
-  }
-
-  public void setMessage(String message) {
-    this.message = message;
-  }
-
-  public Exception getEx() {
-    return ex;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionUpgradeContainers.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionUpgradeContainers.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionUpgradeContainers.java
deleted file mode 100644
index 05fcbcc..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionUpgradeContainers.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-
-public class ActionUpgradeContainers extends AsyncAction {
-  private int exitCode;
-  private FinalApplicationStatus finalApplicationStatus;
-  private String message;
-  private Set<String> containers = new HashSet<>();
-  private Set<String> components = new HashSet<>();
-
-  public ActionUpgradeContainers(String name,
-      long delay,
-      TimeUnit timeUnit,
-      int exitCode,
-      FinalApplicationStatus finalApplicationStatus,
-      List<String> containers,
-      List<String> components,
-      String message) {
-    super(name, delay, timeUnit);
-    this.exitCode = exitCode;
-    this.finalApplicationStatus = finalApplicationStatus;
-    this.containers.addAll(containers);
-    this.components.addAll(components);
-    this.message = message;
-  }
-
-  @Override
-  public void execute(SliderAppMaster appMaster, QueueAccess queueService,
-      AppState appState) throws Exception {
-    if (CollectionUtils.isNotEmpty(this.containers)
-        || CollectionUtils.isNotEmpty(this.components)) {
-      SliderAppMaster.getLog().info("SliderAppMaster.upgradeContainers: {}",
-          message);
-      appMaster.onUpgradeContainers(this);
-    }
-  }
-
-  public int getExitCode() {
-    return exitCode;
-  }
-
-  public void setExitCode(int exitCode) {
-    this.exitCode = exitCode;
-  }
-
-  public FinalApplicationStatus getFinalApplicationStatus() {
-    return finalApplicationStatus;
-  }
-
-  public void setFinalApplicationStatus(
-      FinalApplicationStatus finalApplicationStatus) {
-    this.finalApplicationStatus = finalApplicationStatus;
-  }
-
-  public String getMessage() {
-    return message;
-  }
-
-  public void setMessage(String message) {
-    this.message = message;
-  }
-
-  public Set<String> getContainers() {
-    return containers;
-  }
-
-  public void setContainers(Set<String> containers) {
-    this.containers = containers;
-  }
-
-  public Set<String> getComponents() {
-    return components;
-  }
-
-  public void setComponents(Set<String> components) {
-    this.components = components;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/AsyncAction.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/AsyncAction.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/AsyncAction.java
deleted file mode 100644
index f9a1fd5..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/AsyncAction.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-
-import java.io.IOException;
-import java.util.concurrent.Delayed;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
-
-public abstract class AsyncAction implements Delayed {
-
-  private static final AtomicLong sequencer = new AtomicLong(0);
-
-  public final String name;
-  private long nanos;
-  public final int attrs;
-  private final long sequenceNumber = sequencer.incrementAndGet();
-
-
-  protected AsyncAction(String name) {
-    this(name, 0);
-  }
-
-  protected AsyncAction(String name,
-      long delayMillis) {
-    this(name, delayMillis, TimeUnit.MILLISECONDS);
-  }
-
-  protected AsyncAction(String name,
-      long delay,
-      TimeUnit timeUnit) {
-    this(name, delay, timeUnit, 0);
-  }
-
-  protected AsyncAction(String name,
-      long delay,
-      TimeUnit timeUnit,
-      int attrs) {
-    this.name = name;
-    this.setNanos(convertAndOffset(delay, timeUnit));
-    this.attrs = attrs;
-  }
-
-  protected long convertAndOffset(long delay, TimeUnit timeUnit) {
-    return now() + TimeUnit.NANOSECONDS.convert(delay, timeUnit);
-  }
-
-  /**
-   * The current time in nanos
-   * @return now
-   */
-  protected long now() {
-    return System.nanoTime();
-  }
-
-  @Override
-  public long getDelay(TimeUnit unit) {
-    return unit.convert(getNanos() - now(), TimeUnit.NANOSECONDS);
-  }
-
-  @Override
-  public int compareTo(Delayed that) {
-    if (this == that) {
-      return 0;
-    }
-    return SliderUtils.compareTo(
-        getDelay(TimeUnit.NANOSECONDS),
-        that.getDelay(TimeUnit.NANOSECONDS));
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder(super.toString());
-    sb.append(" name='").append(name).append('\'');
-    sb.append(", delay=").append(getDelay(TimeUnit.SECONDS));
-    sb.append(", attrs=").append(attrs);
-    sb.append(", sequenceNumber=").append(sequenceNumber);
-    sb.append('}');
-    return sb.toString();
-  }
-
-  protected int getAttrs() {
-    return attrs;
-  }
-
-  /**
-   * Ask if an action has an of the specified bits set. 
-   * This is not an equality test.
-   * @param attr attribute
-   * @return true iff the action has any of the bits in the attr arg set
-   */
-  public boolean hasAttr(int attr) {
-    return (attrs & attr) != 0;
-  }
-
-  /**
-   * Actual application
-   * @param appMaster
-   * @param queueService
-   * @param appState
-   * @throws IOException
-   */
-  public abstract void execute(SliderAppMaster appMaster,
-      QueueAccess queueService, AppState appState) throws Exception;
-
-  public long getNanos() {
-    return nanos;
-  }
-
-  public void setNanos(long nanos) {
-    this.nanos = nanos;
-  }
-  
-  public static final int ATTR_CHANGES_APP_SIZE = 1;
-  public static final int ATTR_HALTS_APP = 2;
-  public static final int ATTR_REVIEWS_APP_SIZE = 4;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/EscalateOutstandingRequests.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/EscalateOutstandingRequests.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/EscalateOutstandingRequests.java
deleted file mode 100644
index 2c545ea..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/EscalateOutstandingRequests.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Escalate outstanding requests by asking AM
- */
-public class EscalateOutstandingRequests extends AsyncAction {
-
-  public EscalateOutstandingRequests() {
-    super("EscalateOutstandingRequests");
-  }
-
-  public EscalateOutstandingRequests(long delay,
-      TimeUnit timeUnit) {
-    super("EscalateOutstandingRequests", delay, timeUnit, ATTR_REVIEWS_APP_SIZE);
-  }
-
-  @Override
-  public void execute(SliderAppMaster appMaster, QueueAccess queueService, AppState appState) throws
-      Exception {
-    appMaster.escalateOutstandingRequests();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ProviderReportedContainerLoss.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ProviderReportedContainerLoss.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ProviderReportedContainerLoss.java
deleted file mode 100644
index 41fe494..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ProviderReportedContainerLoss.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Report container loss to the AM
- * {@link SliderAppMaster#providerLostContainer(ContainerId)}
- */
-public class ProviderReportedContainerLoss extends AsyncAction {
-
-  private final ContainerId containerId;
-  
-  public ProviderReportedContainerLoss(ContainerId containerId) {
-    this("lost container", 0, TimeUnit.MILLISECONDS, containerId);
-  }
-
-  public ProviderReportedContainerLoss(String name,
-      long delay,
-      TimeUnit timeUnit,
-      ContainerId containerId) {
-    super(name, delay, timeUnit);
-    this.containerId = containerId;
-  }
-
-  @Override
-  public void execute(SliderAppMaster appMaster,
-      QueueAccess queueService,
-      AppState appState) throws Exception {
-    appMaster.providerLostContainer(containerId);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ProviderStartupCompleted.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ProviderStartupCompleted.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ProviderStartupCompleted.java
deleted file mode 100644
index 957a35f..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ProviderStartupCompleted.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-
-public class ProviderStartupCompleted extends AsyncAction {
-
-  public ProviderStartupCompleted() {
-    super("ProviderStartupCompleted");
-  }
-
-  @Override
-  public void execute(SliderAppMaster appMaster,
-      QueueAccess queueService,
-      AppState appState) throws Exception {
-    appMaster.eventCallbackEvent(null);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/QueueAccess.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/QueueAccess.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/QueueAccess.java
deleted file mode 100644
index 0396891..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/QueueAccess.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-/**
- * Access for queue operations
- */
-public interface QueueAccess {
-  /**
-   * Put an action on the immediate queue -to be executed when the queue
-   * reaches it.
-   * @param action action to queue
-   */
-  void put(AsyncAction action);
-
-  /**
-   * Put a delayed action: this will only be added to the main queue
-   * after its action time has been reached
-   * @param action action to queue
-   */
-  void schedule(AsyncAction action);
-
-  /**
-   * Remove an action from the queues.
-   * @param action action to remove
-   * @return true if the action was removed
-   */
-  boolean remove(AsyncAction action);
-
-  /**
-   * Add a named renewing action
-   * @param name name
-   * @param renewingAction wrapped action
-   */
-  void renewing(String name,
-      RenewingAction<? extends AsyncAction> renewingAction);
-
-  /**
-   * Look up a renewing action
-   * @param name name of the action
-   * @return the action or null if none was found
-   */
-  RenewingAction<? extends AsyncAction> lookupRenewingAction(String name);
-
-  /**
-   * Remove a renewing action
-   * @param name action name name of the action
-   * @return true if the action was found and removed.
-   */
-  boolean removeRenewingAction(String name);
-
-  /**
-   * Look in the immediate queue for any actions of a specific attribute
-   */
-  boolean hasQueuedActionWithAttribute(int attr);
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/QueueExecutor.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/QueueExecutor.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/QueueExecutor.java
deleted file mode 100644
index d0fc2cf..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/QueueExecutor.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * Executor for async actions - hands them off to the AM as 
- * appropriate
- */
-public class QueueExecutor implements Runnable {
-  private static final Logger log =
-      LoggerFactory.getLogger(QueueExecutor.class);
-
-  private final SliderAppMaster appMaster;
-  private final QueueService actionQueues;
-  private final AppState appState;
-
-
-  public QueueExecutor(SliderAppMaster appMaster,
-      QueueService actionQueues) {
-    Preconditions.checkNotNull(appMaster);
-    Preconditions.checkNotNull(actionQueues);
-
-    this.appMaster = appMaster;
-    this.actionQueues = actionQueues;
-    this.appState = appMaster.getAppState();
-  }
-
-  @VisibleForTesting
-  public QueueExecutor(QueueService actionQueues) {
-    Preconditions.checkNotNull(actionQueues);
-    this.appMaster = null;
-    this.appState = null;
-    this.actionQueues = actionQueues;
-  }
-
-  /**
-   * Run until the queue has been told to stop
-   */
-  @Override
-  public void run() {
-    AsyncAction take = null;
-    try {
-      log.info("Queue Executor run() started");
-      do {
-        take = actionQueues.actionQueue.take();
-        log.debug("Executing {}", take);
-        
-        take.execute(appMaster, actionQueues, appState);
-        log.debug("Completed {}", take);
-
-      } while (!(take instanceof ActionStopQueue));
-      log.info("Queue Executor run() stopped");
-    } catch (InterruptedException e) {
-      // interrupted: exit
-    } catch (Throwable e) {
-      log.error("Exception processing {}: {}", take, e, e);
-      if (appMaster != null) {
-        appMaster.onExceptionInThread(Thread.currentThread(), e);
-      }
-    }
-    // tag completed
-    actionQueues.complete();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/QueueService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/QueueService.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/QueueService.java
deleted file mode 100644
index 34acade..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/QueueService.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-
-import org.apache.slider.server.services.workflow.ServiceThreadFactory;
-import org.apache.slider.server.services.workflow.WorkflowExecutorService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.concurrent.BlockingDeque;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.DelayQueue;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.LinkedBlockingDeque;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * The Queue service provides immediate and scheduled queues, as well
- * as an executor thread that moves queued actions from the scheduled
- * queue to the immediate one.
- * 
- * <p>
- * This code to be revisited to see if all that was needed is the single scheduled
- * queue, implicitly making actions immediate by giving them an execution
- * time of "now". It would force having a sequence number to all actions, one 
- * which the queue would have to set from its (monotonic, thread-safe) counter
- * on every submission, with a modified comparison operator. This would guarantee
- * that earlier submissions were picked before later ones.
- */
-public class QueueService extends WorkflowExecutorService<ExecutorService>
-implements Runnable, QueueAccess {
-  private static final Logger log =
-      LoggerFactory.getLogger(QueueService.class);
-  public static final String NAME = "Action Queue";
-  private final AtomicBoolean completed = new AtomicBoolean(false);
-
-  /**
-   * Immediate actions.
-   */
-  public final BlockingDeque<AsyncAction> actionQueue =
-      new LinkedBlockingDeque<>();
-
-  /**
-   * Actions to be scheduled in the future
-   */
-  public final DelayQueue<AsyncAction> scheduledActions = new DelayQueue<>();
-
-  /**
-   * Map of renewing actions by name ... this is to allow them to 
-   * be cancelled by name
-   */
-  private final Map<String, RenewingAction<? extends AsyncAction>> renewingActions
-      = new ConcurrentHashMap<>();
-
-  /**
-   * Create a queue instance with a single thread executor
-   */
-  public QueueService() {
-    super(NAME,
-        ServiceThreadFactory.singleThreadExecutor(NAME, true));
-  }
-
-  @Override
-  public void put(AsyncAction action) {
-    log.debug("Queueing {}", action);
-    actionQueue.add(action);
-  }
-
-  @Override
-  public void schedule(AsyncAction action) {
-    log.debug("Scheduling {}", action);
-    scheduledActions.add(action);
-  }
-
-  @Override
-  public boolean remove(AsyncAction action) {
-    boolean removedFromDelayQueue = scheduledActions.remove(action);
-    boolean removedFromActions = actionQueue.remove(action);
-    return removedFromActions || removedFromDelayQueue;
-  }
-  
-  @Override
-  public void renewing(String name,
-      RenewingAction<? extends AsyncAction> renewingAction) {
-    log.debug("Adding renewing Action \"{}\": {}", name,
-        renewingAction.getAction());
-    if (removeRenewingAction(name)) {
-      log.debug("Removed predecessor action");
-    }
-    renewingActions.put(name, renewingAction);
-    schedule(renewingAction);
-  } 
-
-  @Override
-  public RenewingAction<? extends AsyncAction> lookupRenewingAction(String name) {
-    return renewingActions.get(name);
-  }
-
-  @Override
-  public boolean removeRenewingAction(String name) {
-    RenewingAction<? extends AsyncAction> action = renewingActions.remove(name);
-     return action != null && remove(action);
-  }
-  
-  /**
-   * Stop the service by scheduling an {@link ActionStopQueue} action
-   * ..if the processor thread is working this will propagate through
-   * and stop the queue handling after all other actions complete.
-   * @throws Exception
-   */
-  @Override
-  protected void serviceStop() throws Exception {
-    ActionStopQueue stopQueue = new ActionStopQueue("serviceStop: "+ this,
-        0, TimeUnit.MILLISECONDS);
-    schedule(stopQueue);
-    super.serviceStop();
-  }
-
-  /**
-   * Flush an action queue of all types of a specific action
-   * @param clazz 
-   */
-  protected void flushActionQueue(Class<? extends AsyncAction> clazz) {
-    Iterator<AsyncAction> iterator =
-        actionQueue.descendingIterator();
-    while (iterator.hasNext()) {
-      AsyncAction next = iterator.next();
-      if (next.getClass().equals(clazz)) {
-        iterator.remove();
-      }
-    }
-  }
-
-  @Override
-  public boolean hasQueuedActionWithAttribute(int attr) {
-    for (AsyncAction action : actionQueue) {
-      if (action.hasAttr(attr)) {
-        return true;
-      }
-    }
-    return false;
-  }
-  
-  /**
-   * Run until the queue has been told to stop
-   */
-  @Override
-  public void run() {
-    try {
-
-      log.info("QueueService processor started");
-
-      AsyncAction take;
-      do {
-        take = scheduledActions.take();
-        log.debug("Propagating {}", take);
-        actionQueue.put(take);
-      } while (!(take instanceof ActionStopQueue));
-      log.info("QueueService processor terminated");
-    } catch (InterruptedException e) {
-      // interrupted during actions
-    }
-    // the thread exits, but does not tag the service as complete. That's expected
-    // to be done by the stop queue
-  }
-
-
-  /**
-   * Check to see if the queue executor has completed
-   * @return the status
-   */
-  public boolean isCompleted() {
-    return completed.get();
-  }
-
-  /**
-   * Package scoped method to mark the queue service as finished
-   */
-  void complete() {
-    completed.set(true);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/RegisterComponentInstance.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/RegisterComponentInstance.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/RegisterComponentInstance.java
deleted file mode 100644
index 4cf4981..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/RegisterComponentInstance.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Notify the app master that it should register a component instance
- * in the registry
- * {@link SliderAppMaster#registerComponent(ContainerId)}
- */
-public class RegisterComponentInstance extends AsyncAction {
-
-  public final ContainerId containerId;
-  public final String description;
-  public final String type;
-
-  public RegisterComponentInstance(ContainerId containerId,
-      String description,
-      String type,
-      long delay,
-      TimeUnit timeUnit) {
-    super("RegisterComponentInstance :" + containerId,
-        delay, timeUnit);
-    this.description = description;
-    this.type = type;
-    Preconditions.checkArgument(containerId != null);
-    this.containerId = containerId;
-  }
-
-  @Override
-  public void execute(SliderAppMaster appMaster,
-      QueueAccess queueService,
-      AppState appState) throws Exception {
-
-    appMaster.registerComponent(containerId, description, type);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/RenewingAction.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/RenewingAction.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/RenewingAction.java
deleted file mode 100644
index f3143ea..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/RenewingAction.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import com.google.common.base.Preconditions;
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-/**
- * This action executes then reschedules an inner action; a limit
- * can specify the number of times to run
- */
-
-public class RenewingAction<A extends AsyncAction> extends AsyncAction {
-  private static final Logger log =
-      LoggerFactory.getLogger(RenewingAction.class);
-  private final A action;
-  private long interval;
-  private TimeUnit timeUnit;
-  public final AtomicInteger executionCount = new AtomicInteger();
-  private final ReentrantReadWriteLock intervalLock = new ReentrantReadWriteLock();
-  private final Lock intervalReadLock = intervalLock.readLock();
-  private final Lock intervalWriteLock = intervalLock.writeLock();
-  public final int limit;
-
-
-  /**
-   * Rescheduling action
-   * @param action action to execute
-   * @param initialDelay initial delay
-   * @param interval interval for later delays
-   * @param timeUnit time unit for all times
-   * @param limit limit on the no. of executions. If 0 or less: no limit
-   */
-  public RenewingAction(A action,
-      long initialDelay,
-      long interval,
-      TimeUnit timeUnit,
-      int limit) {
-    super("renewing " + action.name, initialDelay, timeUnit, action.getAttrs());
-    Preconditions.checkArgument(interval > 0, "invalid interval: " + interval);
-    this.action = action;
-    this.interval = interval;
-    this.timeUnit = timeUnit;
-    this.limit = limit;
-  }
-
-  /**
-   * Execute the inner action then reschedule ourselves
-   * @param appMaster
-   * @param queueService
-   * @param appState
-   * @throws Exception
-   */
-  @Override
-  public void execute(SliderAppMaster appMaster,
-      QueueAccess queueService,
-      AppState appState)
-      throws Exception {
-    long exCount = executionCount.incrementAndGet();
-    log.debug("{}: Executing inner action count # {}", this, exCount);
-    action.execute(appMaster, queueService, appState);
-    boolean reschedule = true;
-    if (limit > 0) {
-      reschedule = limit > exCount;
-    }
-    if (reschedule) {
-      this.setNanos(convertAndOffset(getInterval(), getTimeUnit()));
-      log.debug("{}: rescheduling, new offset {} mS ", this,
-          getDelay(TimeUnit.MILLISECONDS));
-      queueService.schedule(this);
-    }
-  }
-
-  /**
-   * Get the action
-   * @return
-   */
-  public A getAction() {
-    return action;
-  }
-
-  public long getInterval() {
-    intervalReadLock.lock();
-    try {
-      return interval;
-    } finally {
-      intervalReadLock.unlock();
-    }
-  }
-
-  public void updateInterval(long delay, TimeUnit timeUnit) {
-    intervalWriteLock.lock();
-    try {
-      interval = delay;
-      this.timeUnit = timeUnit;
-    } finally {
-      intervalWriteLock.unlock();
-    }
-  }
-
-  public TimeUnit getTimeUnit() {
-    intervalReadLock.lock();
-    try {
-      return timeUnit;
-    } finally {
-      intervalReadLock.unlock();
-    }
-  }
-
-  public int getExecutionCount() {
-    return executionCount.get();
-  }
-
-  public int getLimit() {
-    return limit;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ResetFailureWindow.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ResetFailureWindow.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ResetFailureWindow.java
deleted file mode 100644
index 28bcf55..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ResetFailureWindow.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-
-/**
- * Requests the AM to reset the failure window
- */
-public class ResetFailureWindow extends AsyncAction {
-
-  public ResetFailureWindow() {
-    super("ResetFailureWindow");
-  }
-
-  @Override
-  public void execute(SliderAppMaster appMaster,
-      QueueAccess queueService,
-      AppState appState) throws Exception {
-    appState.resetFailureCounts();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ReviewAndFlexApplicationSize.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ReviewAndFlexApplicationSize.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ReviewAndFlexApplicationSize.java
deleted file mode 100644
index bf7edf9..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ReviewAndFlexApplicationSize.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Tell the AM to execute the full flex review operation
- */
-public class ReviewAndFlexApplicationSize extends AsyncAction {
-
-  public ReviewAndFlexApplicationSize(String name,
-      long delay,
-      TimeUnit timeUnit) {
-    super(name, delay, timeUnit, ATTR_REVIEWS_APP_SIZE);
-  }
-
-  @Override
-  public void execute(SliderAppMaster appMaster,
-      QueueAccess queueService,
-      AppState appState) throws Exception {
-    appMaster.handleReviewAndFlexApplicationSize(this);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/UnregisterComponentInstance.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/UnregisterComponentInstance.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/UnregisterComponentInstance.java
deleted file mode 100644
index 575fe8f..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/actions/UnregisterComponentInstance.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.actions;
-
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.slider.server.appmaster.SliderAppMaster;
-import org.apache.slider.server.appmaster.state.AppState;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Tell AM to unregister this component instance
- * {@link SliderAppMaster#unregisterComponent(ContainerId)}
- */
-public class UnregisterComponentInstance extends AsyncAction {
-  
-
-  public final ContainerId containerId;
-
-  public UnregisterComponentInstance(ContainerId containerId,
-      long delay,
-      TimeUnit timeUnit) {
-    super("UnregisterComponentInstance :" + containerId.toString(),
-        delay, timeUnit);
-    this.containerId = containerId;
-  }
-
-  @Override
-  public void execute(SliderAppMaster appMaster,
-      QueueAccess queueService,
-      AppState appState) throws Exception {
-    appMaster.unregisterComponent(containerId);
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/management/BoolMetric.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/BoolMetric.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/BoolMetric.java
deleted file mode 100644
index 33f8d85..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/BoolMetric.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.management;
-
-import com.codahale.metrics.Gauge;
-import com.codahale.metrics.Metric;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * A bool metric, mapped to an integer. true maps to 1,  false to zero,
- */
-public class BoolMetric implements Metric, Gauge<Integer> {
-
-  private final AtomicBoolean value;
-
-  public BoolMetric(boolean b) {
-    value = new AtomicBoolean(b);
-  }
-
-  public void set(boolean b) {
-    value.set(b);
-  }
-
-  public boolean get() {
-    return value.get();
-  }
-
-  @Override
-  public Integer getValue() {
-    return value.get() ? 1 : 0;
-  }
-
-  /**
-   * Evaluate from a string. Returns true if the string is considered to match 'true',
-   * false otherwise.
-   * @param s source
-   * @return true if the input parses to an integer other than 0. False if it doesn't parse
-   * or parses to 0.
-   */
-  public static boolean fromString(String s) {
-    try {
-      return Integer.valueOf(s) != 0;
-    } catch (NumberFormatException e) {
-      return false;
-    }
-  }
-
-  @Override
-  public String toString() {
-    return value.toString();
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    BoolMetric that = (BoolMetric) o;
-    return get() == that.get();
-  }
-
-  @Override
-  public int hashCode() {
-    return value.hashCode();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/management/BoolMetricPredicate.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/BoolMetricPredicate.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/BoolMetricPredicate.java
deleted file mode 100644
index 82bcd3a..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/BoolMetricPredicate.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.management;
-
-import com.codahale.metrics.Gauge;
-import com.codahale.metrics.Metric;
-
-/**
- * A metric which takes a predicate and returns 1 if the predicate evaluates
- * to true. The predicate is evaluated whenever the metric is read.
- */
-public class BoolMetricPredicate implements Metric, Gauge<Integer> {
-
-  private final Eval predicate;
-
-  public BoolMetricPredicate(Eval predicate) {
-    this.predicate = predicate;
-  }
-
-  @Override
-  public Integer getValue() {
-    return predicate.eval() ? 1: 0;
-  }
-
-  public interface Eval {
-    boolean eval();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/management/LongGauge.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/LongGauge.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/LongGauge.java
deleted file mode 100644
index c93467b..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/LongGauge.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.management;
-
-import com.codahale.metrics.Gauge;
-import com.codahale.metrics.Metric;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * This is a {@link AtomicLong} which acts as a metrics gauge: its state can be exposed as
- * a metrics.
- * It also exposes some of the same method names as the Codahale Counter class, so that
- * it's easy to swap in.
- *
- */
-public class LongGauge extends AtomicLong implements Metric, Gauge<Long> {
-
-  /**
-   * Instantiate
-   * @param val current value
-   */
-  public LongGauge(long val) {
-    super(val);
-  }
-
-  /**
-   * Instantiate with value 0
-   */
-  public LongGauge() {
-    this(0);
-  }
-
-  /**
-   * Get the value as a metric
-   * @return current value
-   */
-  @Override
-  public Long getValue() {
-    return get();
-  }
-
-  /**
-   * Method from {@Code counter}; used here for drop-in replacement
-   * without any recompile
-   * @return current value
-   */
-  public Long getCount() {
-    return get();
-  }
-
-  /**
-   * {@code ++}
-   */
-  public void inc() {
-    incrementAndGet();
-  }
-
-  /**
-   * {@code --}
-   */
-  public void dec() {
-    decrementAndGet();
-  }
-
-  /**
-   * Decrement to the floor of 0. Operations in parallel may cause confusion here,
-   * but it will still never go below zero
-   * @param delta delta
-   * @return the current value
-   */
-  public long decToFloor(long delta) {
-    long l = get();
-    long r = l - delta;
-    if (r < 0) {
-      r = 0;
-    }
-    // if this fails, the decrement has been lost
-    compareAndSet(l, r);
-    return get();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/management/LongMetricFunction.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/LongMetricFunction.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/LongMetricFunction.java
deleted file mode 100644
index 1de7345..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/LongMetricFunction.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.management;
-
-import com.codahale.metrics.Gauge;
-import com.codahale.metrics.Metric;
-
-/**
- * A metric which takes a function to generate a long value.
- * The function is evaluated whenever the metric is read.
- */
-public class LongMetricFunction implements Metric, Gauge<Long> {
-
-  private final Eval function;
-
-  public LongMetricFunction(Eval function) {
-    this.function = function;
-  }
-
-  @Override
-  public Long getValue() {
-    return function.eval();
-  }
-
-  public interface Eval {
-    long eval();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MeterAndCounter.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MeterAndCounter.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MeterAndCounter.java
deleted file mode 100644
index 02ab7bc..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MeterAndCounter.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.management;
-
-import com.codahale.metrics.Counter;
-import com.codahale.metrics.Meter;
-import com.codahale.metrics.MetricRegistry;
-
-/**
- * A combined meter and counter that can be used to measure load.
- * Hash and equality are derived from the name
- */
-public class MeterAndCounter {
-
-  /**
-   * suffix for counters: {@value}
-   */
-  public static final String COUNTER = ".counter";
-
-  /**
-   * suffix for meters: {@value}
-   */
-  public static final String METER = ".meter";
-
-  final Meter meter;
-  final Counter counter;
-  final String name;
-
-  /**
-   * Construct an instance
-   * @param metrics metrics to bond to
-   * @param name name before suffixes are appended
-   */
-  public MeterAndCounter(MetricRegistry metrics, String name) {
-    this.name = name;
-    counter = metrics.counter(name + COUNTER);
-    meter = metrics.meter(name + METER);
-  }
-
-  /**
-   * Construct an instance
-   * @param metrics metrics to bond to
-   * @param clazz class to use to derive name
-   * @param name name before suffixes are appended
-   */
-
-  public MeterAndCounter(MetricRegistry metrics, Class clazz, String name) {
-    this.name = name;
-    counter = metrics.counter(MetricRegistry.name(clazz, name + COUNTER));
-    meter = metrics.meter(MetricRegistry.name(clazz, name + METER));
-  }
-
-  /**
-   * Increment the counter, mark the meter
-   */
-  public void mark() {
-    counter.inc();
-    meter.mark();
-  }
-
-  public void inc() {
-    mark();
-  }
-
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    MeterAndCounter that = (MeterAndCounter) o;
-
-    return name.equals(that.name);
-
-  }
-
-  @Override
-  public int hashCode() {
-    return name.hashCode();
-  }
-
-  /**
-   * Get the count.
-   * @return the current count
-   */
-  public long getCount() {
-    return counter.getCount();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsAndMonitoring.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsAndMonitoring.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsAndMonitoring.java
deleted file mode 100644
index 37a8935..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/management/MetricsAndMonitoring.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.management;
-
-import com.codahale.metrics.Metric;
-import com.codahale.metrics.MetricRegistry;
-import com.codahale.metrics.MetricSet;
-import com.codahale.metrics.health.HealthCheckRegistry;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.service.CompositeService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Class for all metrics and monitoring
- */
-public class MetricsAndMonitoring extends CompositeService {
-  protected static final Logger log =
-    LoggerFactory.getLogger(MetricsAndMonitoring.class);
-  public MetricsAndMonitoring(String name) {
-    super(name);
-  }
-  
-  public MetricsAndMonitoring() {
-    super("MetricsAndMonitoring");
-  }
-  
-  /**
-   * Singleton of metrics registry
-   */
-  final MetricRegistry metrics = new MetricRegistry();
-
-  final HealthCheckRegistry health = new HealthCheckRegistry();
-
-  private final Map<String, MeterAndCounter> meterAndCounterMap
-      = new ConcurrentHashMap<>();
-
-  private final List<MetricSet> metricSets = new ArrayList<>();
-
-  /**
-   * List of recorded events
-   */
-  private final List<RecordedEvent> eventHistory = new ArrayList<>(100);
-
-  public static final int EVENT_LIMIT = 1000;
-
-  public MetricRegistry getMetrics() {
-    return metrics;
-  }
-
-  public HealthCheckRegistry getHealth() {
-    return health;
-  }
-
-  @Override
-  protected void serviceInit(Configuration conf) throws Exception {
-    addService(new MetricsBindingService("MetricsBindingService",
-        metrics));
-    super.serviceInit(conf);
-  }
-
-  @Override
-  protected void serviceStop() throws Exception {
-    super.serviceStop();
-    for (MetricSet set : metricSets) {
-      unregister(set);
-    }
-  }
-
-  public MeterAndCounter getMeterAndCounter(String name) {
-    return meterAndCounterMap.get(name);
-  }
-
-  /**
-   * Get or create the meter/counter pair
-   * @param name name of instance
-   * @return an instance
-   */
-  public MeterAndCounter getOrCreateMeterAndCounter(String name) {
-    MeterAndCounter instance = meterAndCounterMap.get(name);
-    if (instance == null) {
-      synchronized (this) {
-        // check in a sync block
-        instance = meterAndCounterMap.get(name);
-        if (instance == null) {
-          instance = new MeterAndCounter(metrics, name);
-          meterAndCounterMap.put(name, instance);
-        }
-      }
-    }
-    return instance;
-  }
-
-  /**
-   * Get a specific meter and mark it. This will create and register it on demand.
-   * @param name name of meter/counter
-   */
-  public void markMeterAndCounter(String name) {
-    MeterAndCounter meter = getOrCreateMeterAndCounter(name);
-    meter.mark();
-  }
-
-  /**
-   * Given a {@link Metric}, registers it under the given name.
-   *
-   * @param name   the name of the metric
-   * @param metric the metric
-   * @param <T>    the type of the metric
-   * @return {@code metric}
-   * @throws IllegalArgumentException if the name is already registered
-   */
-  public <T extends Metric> T register(String name, T metric) throws IllegalArgumentException {
-    return metrics.register(name, metric);
-  }
-
-  public <T extends Metric> T register(Class<?> klass, T metric, String... names)
-      throws IllegalArgumentException {
-    return register(MetricRegistry.name(klass, names), metric);
-  }
-
-
-  /**
-   * Add an event (synchronized)
-   * @param event event
-   */
-  public synchronized void noteEvent(RecordedEvent event) {
-    if (eventHistory.size() > EVENT_LIMIT) {
-      eventHistory.remove(0);
-    }
-    eventHistory.add(event);
-  }
-
-  /**
-   * Clone the event history; blocks for the duration of the copy operation.
-   * @return a new list
-   */
-  public synchronized List<RecordedEvent> cloneEventHistory() {
-    return new ArrayList<>(eventHistory);
-  }
-
-  /**
-   * Add a metric set for registering and deregistration on service stop
-   * @param metricSet metric set
-   */
-  public void addMetricSet(MetricSet metricSet) {
-    metricSets.add(metricSet);
-    metrics.registerAll(metricSet);
-  }
-
-  /**
-   * add a metric set, giving each entry a prefix
-   * @param prefix prefix (a trailing "." is automatically added)
-   * @param metricSet the metric set to register
-   */
-  public void addMetricSet(String prefix, MetricSet metricSet) {
-    addMetricSet(new PrefixedMetricsSet(prefix, metricSet));
-  }
-
-  /**
-   * Unregister a metric set; robust
-   * @param metricSet metric set to unregister
-   */
-  public void unregister(MetricSet metricSet) {
-    for (String s : metricSet.getMetrics().keySet()) {
-      try {
-        metrics.remove(s);
-      } catch (IllegalArgumentException e) {
-        // log but continue
-        log.info("Exception when trying to unregister {}", s, e);
-      }
-    }
-  }
-}
-


[26/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/AgentRoles.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentRoles.java b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentRoles.java
deleted file mode 100644
index 281895a..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentRoles.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers.agent;
-
-import org.apache.slider.providers.ProviderRole;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class AgentRoles {
-
-  /**
-   * List of roles Agent provider does not have any roles by default. All roles are read from the application
-   * specification.
-   */
-  protected static final List<ProviderRole> ROLES =
-      new ArrayList<ProviderRole>();
-
-  public static List<ProviderRole> getRoles() {
-    return ROLES;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/AgentUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentUtils.java b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentUtils.java
deleted file mode 100644
index 23e05a3..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentUtils.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent;
-
-import org.apache.hadoop.fs.FSDataInputStream;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.providers.agent.application.metadata.AbstractMetainfoParser;
-import org.apache.slider.providers.agent.application.metadata.AddonPackageMetainfoParser;
-import org.apache.slider.providers.agent.application.metadata.DefaultConfig;
-import org.apache.slider.providers.agent.application.metadata.DefaultConfigParser;
-import org.apache.slider.providers.agent.application.metadata.Metainfo;
-import org.apache.slider.providers.agent.application.metadata.MetainfoParser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-
-import static org.apache.slider.api.RoleKeys.ROLE_PREFIX;
-
-/**
- *
- */
-public class AgentUtils {
-  private static final Logger log = LoggerFactory.getLogger(AgentUtils.class);
-
-  public static Metainfo getApplicationMetainfoFromSummaryFile(
-      SliderFileSystem fileSystem, String metainfoPath, boolean metainfoForAddon) {
-    FileSystem fs = fileSystem.getFileSystem();
-    Path appPathXML = new Path(metainfoPath + ".metainfo.xml");
-    Path appPathJson = new Path(metainfoPath + ".metainfo.json");
-    Path appPathUsed = null;
-    try {
-      FSDataInputStream appStream = null;
-      if (fs.exists(appPathXML)) {
-        appPathUsed = appPathXML;
-        appStream = fs.open(appPathXML);
-        return parseMetainfo(appStream, metainfoForAddon, "xml");
-      } else if (fs.exists(appPathJson)) {
-        appPathUsed = appPathJson;
-        appStream = fs.open(appPathJson);
-        return parseMetainfo(appStream, metainfoForAddon, "json");
-      }
-    } catch (IOException e) {
-      log.info("Failed to get metainfo from summary file {} - {}", appPathUsed,
-          e.getMessage());
-      log.debug("Failed to get metainfo", e);
-    }
-    return null;
-  }
-
-  public static Metainfo getApplicationMetainfo(SliderFileSystem fileSystem,
-      String metainfoPath, boolean metainfoForAddon) throws IOException,
-      BadConfigException {
-    log.info("Reading metainfo at {}", metainfoPath);
-    Metainfo metainfo = getApplicationMetainfoFromSummaryFile(fileSystem,
-        metainfoPath, metainfoForAddon);
-    if (metainfo != null) {
-      log.info("Got metainfo from summary file");
-      return metainfo;
-    }
-
-    FileSystem fs = fileSystem.getFileSystem();
-    Path appPath = new Path(metainfoPath);
-
-    InputStream metainfoJsonStream = SliderUtils.getApplicationResourceInputStream(
-        fs, appPath, "metainfo.json");
-    if (metainfoJsonStream == null) {
-      InputStream metainfoXMLStream = SliderUtils.getApplicationResourceInputStream(
-          fs, appPath, "metainfo.xml");
-      if (metainfoXMLStream != null) {
-        metainfo = parseMetainfo(metainfoXMLStream, metainfoForAddon, "xml");
-      }
-    } else {
-      metainfo = parseMetainfo(metainfoJsonStream, metainfoForAddon, "json");
-    }
-
-    if (metainfo == null) {
-      log.error("metainfo is unavailable at {}.", metainfoPath);
-      throw new FileNotFoundException("metainfo.xml/json is required in app package. " +
-                                      appPath);
-    }
-    return metainfo;
-  }
-
-  private static Metainfo parseMetainfo(InputStream stream,
-      boolean metainfoForAddon, String type) throws IOException {
-    AbstractMetainfoParser metainfoParser = null;
-    if (metainfoForAddon) {
-      metainfoParser = new AddonPackageMetainfoParser();
-    } else {
-      metainfoParser = new MetainfoParser();
-    }
-    if (type.equals("xml")) {
-      return metainfoParser.fromXmlStream(stream);
-    } else if (type.equals("json")) {
-      return metainfoParser.fromJsonStream(stream);
-    }
-    return null;
-  }
-
-  static DefaultConfig getDefaultConfig(SliderFileSystem fileSystem,
-                                        String appDef, String configFileName)
-      throws IOException {
-    // this is the path inside the zip file
-    String fileToRead = "configuration/" + configFileName;
-    log.info("Reading default config file {} at {}", fileToRead, appDef);
-    InputStream configStream = SliderUtils.getApplicationResourceInputStream(
-        fileSystem.getFileSystem(), new Path(appDef), fileToRead);
-    if (configStream == null) {
-      log.error("{} is unavailable at {}.", fileToRead, appDef);
-      throw new IOException("Expected config file " + fileToRead + " is not available.");
-    }
-
-    return new DefaultConfigParser().parse(configStream);
-  }
-
-  static String getMetainfoComponentName(String roleGroup,
-      ConfTreeOperations appConf) throws BadConfigException {
-    String prefix = appConf.getComponentOpt(roleGroup, ROLE_PREFIX, null);
-    if (prefix == null) {
-      return roleGroup;
-    }
-    if (!roleGroup.startsWith(prefix)) {
-      throw new BadConfigException("Component " + roleGroup + " doesn't start" +
-          " with prefix " + prefix);
-    }
-    return roleGroup.substring(prefix.length());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/Command.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/Command.java b/slider-core/src/main/java/org/apache/slider/providers/agent/Command.java
deleted file mode 100644
index 647cb86..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/Command.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers.agent;
-
-/** The states a component instance can be. */
-public enum Command {
-  NOP,           // do nothing
-  INSTALL,       // Install the component
-  INSTALL_ADDON, // Install add on packages if any
-  START,         // Start the component
-  STOP,          // Stop the component
-  UPGRADE,       // The component will undergo upgrade
-  TERMINATE;     // Send terminate signal to agent
-
-  public static Command getCommand(String commandVal) {
-    if (commandVal.equals(Command.START.toString())) {
-      return Command.START;
-    }
-    if (commandVal.equals(Command.INSTALL.toString())) {
-      return Command.INSTALL;
-    }
-    if (commandVal.equals(Command.STOP.toString())) {
-      return Command.STOP;
-    }
-    if (commandVal.equals(Command.UPGRADE.toString())) {
-      return Command.UPGRADE;
-    }
-    if (commandVal.equals(Command.TERMINATE.toString())) {
-      return Command.TERMINATE;
-    }
-
-    return Command.NOP;
-  }
-
-  public static String transform(Command command, boolean isUpgrade) {
-    switch (command) {
-    case STOP:
-      return isUpgrade ? "UPGRADE_STOP" : command.name();
-    default:
-      return command.name();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/CommandResult.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/CommandResult.java b/slider-core/src/main/java/org/apache/slider/providers/agent/CommandResult.java
deleted file mode 100644
index 35d9116..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/CommandResult.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers.agent;
-
-/** Command results. */
-public enum CommandResult {
-  IN_PROGRESS,  // Command is in progress
-  COMPLETED,    // Command has successfully completed
-  FAILED;        // Command has failed
-
-  public static CommandResult getCommandResult(String commandResVal) {
-    if (commandResVal.equals(CommandResult.COMPLETED.toString())) {
-      return CommandResult.COMPLETED;
-    }
-    if (commandResVal.equals(CommandResult.FAILED.toString())) {
-      return CommandResult.FAILED;
-    }
-    if (commandResVal.equals(CommandResult.IN_PROGRESS.toString())) {
-      return CommandResult.IN_PROGRESS;
-    }
-
-    throw new IllegalArgumentException("Unrecognized value " + commandResVal);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentCommandOrder.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentCommandOrder.java b/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentCommandOrder.java
deleted file mode 100644
index 4abac7a..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentCommandOrder.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers.agent;
-
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.providers.agent.application.metadata.CommandOrder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-
-import static org.apache.slider.api.RoleKeys.ROLE_PREFIX;
-
-/**
- * Stores the command dependency order for all components in a service. <commandOrder>
- * <command>SUPERVISOR-START</command> <requires>NIMBUS-STARTED</requires> </commandOrder> Means, SUPERVISOR START
- * requires NIMBUS to be STARTED
- */
-public class ComponentCommandOrder {
-  public static final Logger log =
-      LoggerFactory.getLogger(ComponentCommandOrder.class);
-  private static char SPLIT_CHAR = '-';
-  Map<Command, Map<String, List<ComponentState>>> dependencies =
-      new HashMap<Command, Map<String, List<ComponentState>>>();
-  Map<String, Collection<String>> prefixRoleMap = new HashMap<>();
-  Map<String, String> rolePrefixMap = new HashMap<>();
-
-  public ComponentCommandOrder() {}
-
-  public ComponentCommandOrder(List<CommandOrder> commandOrders,
-      ConfTreeOperations resources) {
-    mergeCommandOrders(commandOrders, resources);
-  }
-
-  void mergeCommandOrders(List<CommandOrder> commandOrders,
-      ConfTreeOperations resources) {
-    for (String component : resources.getComponentNames()) {
-      String prefix = SliderUtils.trimPrefix(
-          resources.getComponentOpt(component, ROLE_PREFIX, null));
-      if (prefix != null) {
-        rolePrefixMap.put(component, prefix);
-        if (!prefixRoleMap.containsKey(prefix)) {
-          prefixRoleMap.put(prefix, new HashSet<String>());
-        }
-        prefixRoleMap.get(prefix).add(component);
-      }
-    }
-    if (commandOrders != null && commandOrders.size() > 0) {
-      for (CommandOrder commandOrder : commandOrders) {
-        ComponentCommand componentCmd = getComponentCommand(
-            commandOrder.getCommand(), resources);
-        String requires = commandOrder.getRequires();
-        List<ComponentState> requiredStates = parseRequiredStates(requires,
-            resources);
-        if (requiredStates.size() > 0) {
-          Map<String, List<ComponentState>> compDep = dependencies.get(componentCmd.command);
-          if (compDep == null) {
-            compDep = new HashMap<>();
-            dependencies.put(componentCmd.command, compDep);
-          }
-
-          List<ComponentState> requirements = compDep.get(componentCmd.componentName);
-          if (requirements == null) {
-            requirements = new ArrayList<>();
-            compDep.put(componentCmd.componentName, requirements);
-          }
-
-          requirements.addAll(requiredStates);
-        }
-      }
-    }
-  }
-
-  private List<ComponentState> parseRequiredStates(String requires,
-      ConfTreeOperations resources) {
-    if (requires == null || requires.length() < 2) {
-      throw new IllegalArgumentException("Input cannot be null and must contain component and state.");
-    }
-
-    String[] componentStates = requires.split(",");
-    List<ComponentState> retList = new ArrayList<ComponentState>();
-    for (String componentStateStr : componentStates) {
-      retList.add(getComponentState(componentStateStr, resources));
-    }
-
-    return retList;
-  }
-
-  private ComponentCommand getComponentCommand(String compCmdStr,
-      ConfTreeOperations resources) {
-    if (compCmdStr == null || compCmdStr.trim().length() < 2) {
-      throw new IllegalArgumentException("Input cannot be null and must contain component and command.");
-    }
-
-    compCmdStr = compCmdStr.trim();
-    int splitIndex = compCmdStr.lastIndexOf(SPLIT_CHAR);
-    if (splitIndex == -1 || splitIndex == 0 || splitIndex == compCmdStr.length() - 1) {
-      throw new IllegalArgumentException("Input does not appear to be well-formed.");
-    }
-    String compStr = compCmdStr.substring(0, splitIndex);
-    String cmdStr = compCmdStr.substring(splitIndex + 1);
-
-    if (resources.getComponent(compStr) == null && !prefixRoleMap.containsKey(compStr)) {
-      throw new IllegalArgumentException("Component " + compStr + " specified" +
-          " in command order does not exist");
-    }
-
-    Command cmd = Command.valueOf(cmdStr);
-
-    if (cmd != Command.START) {
-      throw new IllegalArgumentException("Dependency order can only be specified for START.");
-    }
-    return new ComponentCommand(compStr, cmd);
-  }
-
-  private ComponentState getComponentState(String compStStr,
-      ConfTreeOperations resources) {
-    if (compStStr == null || compStStr.trim().length() < 2) {
-      throw new IllegalArgumentException("Input cannot be null.");
-    }
-
-    compStStr = compStStr.trim();
-    int splitIndex = compStStr.lastIndexOf(SPLIT_CHAR);
-    if (splitIndex == -1 || splitIndex == 0 || splitIndex == compStStr.length() - 1) {
-      throw new IllegalArgumentException("Input does not appear to be well-formed.");
-    }
-    String compStr = compStStr.substring(0, splitIndex);
-    String stateStr = compStStr.substring(splitIndex + 1);
-
-    if (resources.getComponent(compStr) == null && !prefixRoleMap.containsKey(compStr)) {
-      throw new IllegalArgumentException("Component " + compStr + " specified" +
-          " in command order does not exist");
-    }
-
-    State state = State.valueOf(stateStr);
-    if (state != State.STARTED && state != State.INSTALLED) {
-      throw new IllegalArgumentException("Dependency order can only be specified against STARTED/INSTALLED.");
-    }
-    return new ComponentState(compStr, state);
-  }
-
-  // dependency is still on component level, but not package level
-  // so use component name to check dependency, not component-package
-  public boolean canExecute(String component, Command command, Collection<ComponentInstanceState> currentStates) {
-    if (!dependencies.containsKey(command)) {
-      return true;
-    }
-    List<ComponentState> required = new ArrayList<>();
-    if (dependencies.get(command).containsKey(component)) {
-      required.addAll(dependencies.get(command).get(component));
-    }
-    String prefix = rolePrefixMap.get(component);
-    if (prefix != null && dependencies.get(command).containsKey(prefix)) {
-      required.addAll(dependencies.get(command).get(prefix));
-    }
-
-    for (ComponentState stateToMatch : required) {
-      for (ComponentInstanceState currState : currentStates) {
-        log.debug("Checking schedule {} {} against dependency {} is {}",
-            component, command, currState.getComponentName(), currState.getState());
-        if (currState.getComponentName().equals(stateToMatch.componentName) ||
-            (prefixRoleMap.containsKey(stateToMatch.componentName) &&
-                prefixRoleMap.get(stateToMatch.componentName).contains(currState.getComponentName()))) {
-          if (currState.getState() != stateToMatch.state) {
-            if (stateToMatch.state == State.STARTED) {
-              log.info("Cannot schedule {} {} as dependency {} is {}",
-                  component, command, currState.getComponentName(), currState.getState());
-              return false;
-            } else {
-              //state is INSTALLED
-              if (currState.getState() != State.STARTING && currState.getState() != State.STARTED) {
-                log.info("Cannot schedule {} {} as dependency {} is {}",
-                    component, command, currState.getComponentName(), currState.getState());
-                return false;
-              }
-            }
-          }
-        }
-      }
-    }
-    return true;
-  }
-
-  static class ComponentState {
-    public String componentName;
-    public State state;
-
-    public ComponentState(String componentName, State state) {
-      this.componentName = componentName;
-      this.state = state;
-    }
-  }
-
-  static class ComponentCommand {
-    public String componentName;
-    public Command command;
-
-    public ComponentCommand(String componentName, Command command) {
-      this.componentName = componentName;
-      this.command = command;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentInstanceState.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentInstanceState.java b/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentInstanceState.java
deleted file mode 100644
index 6ee0ebb..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentInstanceState.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers.agent;
-
-import java.util.Map;
-import java.util.TreeMap;
-
-import com.google.common.annotations.VisibleForTesting;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.slider.providers.agent.application.metadata.Component;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** This class implements a simple state machine for component instances. */
-public class ComponentInstanceState {
-  public static final Logger log =
-      LoggerFactory.getLogger(ComponentInstanceState.class);
-  private static int MAX_FAILURE_TOLERATED = 3;
-  private static String INVALID_TRANSITION_ERROR =
-      "Result %s for command %s is not expected for component %s in state %s.";
-
-  private final String componentName;
-  private final ContainerId containerId;
-  private final String containerIdAsString;
-  private final String applicationId;
-  private State state = State.INIT;
-  private State targetState = State.STARTED;
-  private int failuresSeen = 0;
-  private Boolean configReported = false;
-  private long lastHeartbeat = 0;
-  private String ip;
-  private String hostname;
-  private ContainerState containerState;
-
-  private Map<String, State> pkgStatuses;
-  private String nextPkgToInstall;
-
-  private boolean stopInitiated;
-
-  public ComponentInstanceState(String componentName,
-      ContainerId containerId,
-      String applicationId) {
-    this(componentName, containerId, applicationId,
-        new TreeMap<String, State>());
-  }
-
-  public ComponentInstanceState(String componentName,
-      ContainerId containerId,
-      String applicationId, Map<String, State> pkgStatuses) {
-    this.componentName = componentName;
-    this.containerId = containerId;
-    this.containerIdAsString = containerId.toString();
-    this.applicationId = applicationId;
-    this.containerState = ContainerState.INIT;
-    this.lastHeartbeat = System.currentTimeMillis();
-    this.pkgStatuses = pkgStatuses;
-  }
-  
-  public String getComponentName() {
-    return componentName;
-  }
-
-  public Boolean getConfigReported() {
-    return configReported;
-  }
-
-  public void setConfigReported(Boolean configReported) {
-    this.configReported = configReported;
-  }
-
-  public ContainerState getContainerState() {
-    return containerState;
-  }
-
-  public void setContainerState(ContainerState containerState) {
-    this.containerState = containerState;
-  }
-
-  public long getLastHeartbeat() {
-    return lastHeartbeat;
-  }
-
-  /**
-   * Update the heartbeat, and change container state
-   * to mark as healthy if appropriate
-   * @param heartbeatTime last time the heartbeat was seen
-   * @return the current container state
-   */
-  public ContainerState heartbeat(long heartbeatTime) {
-    this.lastHeartbeat = heartbeatTime;
-    if(containerState == ContainerState.UNHEALTHY ||
-       containerState == ContainerState.INIT) {
-      containerState = ContainerState.HEALTHY;
-    }
-    return containerState;
-  }
-  
-
-  public ContainerId getContainerId() {
-    return containerId;
-  }
-
-  public void commandIssued(Command command) {
-    commandIssued(command, false);
-  }
-
-  public void commandIssued(Command command, boolean isInUpgradeMode) {
-    Command expected = getNextCommand(isInUpgradeMode);
-    if (expected != command) {
-      throw new IllegalArgumentException("Command " + command + " is not allowed in state " + state);
-    }
-    if (expected == Command.INSTALL_ADDON) {
-      // for add on packages, the pkg must be nextPkgToInstall
-      State currentState = pkgStatuses.get(nextPkgToInstall);
-      log.debug("Command issued: component: {} is in {}", componentName,
-          currentState);
-      State nextState = currentState.getNextState(command);
-      pkgStatuses.put(nextPkgToInstall, nextState);
-      log.debug("Command issued: component: {} is now in {}", componentName,
-          nextState);
-    } else {
-      // for master package
-      state = state.getNextState(command);
-    }
-  }
-
-  public void applyCommandResult(CommandResult result, Command command,
-      String pkg) {
-    // if the heartbeat is for a package
-    // update that package's state in the component status
-    // and don't bother with the master pkg
-    if (StringUtils.isNotEmpty(pkg)
-        && !Component.MASTER_PACKAGE_NAME.equals(pkg)) {
-      log.debug("This result is for component: {} pkg: {}", componentName, pkg);
-      State previousPkgState = pkgStatuses.get(pkg);
-      log.debug("Currently component: {} pkg: {} is in state: {}",
-          componentName, pkg, previousPkgState.toString());
-      State nextPkgState = previousPkgState.getNextState(result);
-      pkgStatuses.put(pkg, nextPkgState);
-      log.debug("Component: {} pkg: {} next state: {}", componentName, pkg,
-          nextPkgState);
-    } else {
-      log.debug("This result is for component: {} master package",
-          componentName);
-      applyCommandResult(result, command);
-    }
-  }
-
-  public void applyCommandResult(CommandResult result, Command command) {
-    if (!this.state.couldHaveIssued(command)) {
-      throw new IllegalStateException("Invalid command " + command + " for state " + this.state);
-    }
-
-    try {
-      if (result == CommandResult.FAILED) {
-        failuresSeen++;
-      } else if (result == CommandResult.COMPLETED) {
-        failuresSeen = 0;
-      }
-      state = state.getNextState(result);
-    } catch (IllegalArgumentException e) {
-      String message = String.format(INVALID_TRANSITION_ERROR,
-                                     result.toString(),
-                                     command.toString(),
-                                     componentName,
-                                     state.toString());
-      log.warn(message);
-      throw new IllegalStateException(message);
-    }
-  }
-
-  public boolean hasPendingCommand() {
-    if (state.canIssueCommands() &&
-        state != targetState &&
-        failuresSeen < MAX_FAILURE_TOLERATED) {
-      return true;
-    }
-
-    return false;
-  }
-
-  public Command getNextCommand() {
-    return getNextCommand(false);
-  }
-
-  public Command getNextCommand(boolean isInUpgradeMode) {
-    if (!hasPendingCommand()) {
-      nextPkgToInstall = null;
-      return Command.NOP;
-    }
-
-    log.debug("In getNextCommand, checking for component: {} ", componentName);
-    // if the master pkg is just installed, check if any add on pkg need to be
-    // installed
-    nextPkgToInstall = null;
-    if (state == State.INSTALLED) {
-      for (Map.Entry<String, State> pkgStatus : pkgStatuses.entrySet()) {
-        String pkg = pkgStatus.getKey();
-        State pkgState = pkgStatus.getValue();
-        log.debug("In getNextCommand, pkg: {} is in {}", pkg, pkgState);
-        if (pkgState == State.INSTALLING) {
-          // first check if any pkg is install in progress, if so, wait
-          // so we don't need to do anything, just return NOP
-          log.debug("In getNextCommand, pkg: {} we are issuing NOP", pkg);
-          nextPkgToInstall = pkg;
-          return Command.NOP;
-        } else if (pkgState == State.INIT) {
-          // temporarily storing pkg here
-          // in case no pkg in 'installing' state
-          // will return the package to install
-          nextPkgToInstall = pkg;
-        }
-      }
-      // when we reach here, no pkg is in 'installing' state
-      if (nextPkgToInstall != null) {
-        // nextPkgToInstall != null means some pkg is in INIT state 
-        // issue 'install' to the pkg we have stored in nextPkgToInstall
-        log.debug("In getNextCommand, pkg: {} we are issuing install addon",
-            nextPkgToInstall);
-        return Command.INSTALL_ADDON;
-      }
-    }
-    return this.state.getSupportedCommand(isInUpgradeMode, stopInitiated);
-  }
-
-  public State getState() {
-    return state;
-  }
-
-  @VisibleForTesting
-  protected void setState(State state) {
-    this.state = state;
-  }
-
-  public State getTargetState() {
-    return targetState;
-  }
-
-  public void setTargetState(State targetState) {
-    this.targetState = targetState;
-  }
-
-  public String getNextPkgToInstall() {
-    return nextPkgToInstall;
-  }
-
-  public boolean isStopInitiated() {
-    return stopInitiated;
-  }
-
-  public void setStopInitiated(boolean stopInitiated) {
-    this.stopInitiated = stopInitiated;
-  }
-
-  @Override
-  public int hashCode() {
-    int hashCode = 1;
-
-    hashCode = hashCode ^ (componentName != null ? componentName.hashCode() : 0);
-    hashCode = hashCode ^ (containerIdAsString != null ? containerIdAsString.hashCode() : 0);
-    hashCode = hashCode ^ (applicationId != null ? applicationId.hashCode() : 0);
-    return hashCode;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) return true;
-
-    if (o == null || getClass() != o.getClass()) return false;
-
-    ComponentInstanceState that = (ComponentInstanceState) o;
-
-    if (this.componentName != null ?
-        !this.componentName.equals(that.componentName) : this.componentName != null) {
-      return false;
-    }
-
-    if (this.containerIdAsString != null ?
-        !this.containerIdAsString.equals(that.containerIdAsString) : this.containerIdAsString != null) {
-      return false;
-    }
-
-    if (this.applicationId != null ?
-        !this.applicationId.equals(that.applicationId) : this.applicationId != null) {
-      return false;
-    }
-
-    return true;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("ComponentInstanceState{");
-    sb.append("containerIdAsString='").append(containerIdAsString).append('\'');
-    sb.append(", state=").append(state);
-    sb.append(", failuresSeen=").append(failuresSeen);
-    sb.append(", lastHeartbeat=").append(lastHeartbeat);
-    sb.append(", containerState=").append(containerState);
-    sb.append(", componentName='").append(componentName).append('\'');
-    sb.append(", ip=").append(ip);
-    sb.append(", hostname='").append(hostname).append('\'');
-    sb.append('}');
-    return sb.toString();
-  }
-
-  public String getIp() {
-    return ip;
-  }
-
-  public void setIp(String ip) {
-    this.ip = ip;
-  }
-
-  public String getHostname() {
-    return hostname;
-  }
-
-  public void setHostname(String hostname) {
-    this.hostname = hostname;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentTagProvider.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentTagProvider.java b/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentTagProvider.java
deleted file mode 100644
index 68f63fa..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/ComponentTagProvider.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent;
-
-import org.apache.slider.common.tools.SliderUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.ConcurrentHashMap;
-
-/** A simple tag provider that attempts to associate tags from 1-N to all container of a component */
-public class ComponentTagProvider {
-  private static final Logger log = LoggerFactory.getLogger(ComponentTagProvider.class);
-  private static String FREE = "free";
-  private final ConcurrentHashMap<String, ConcurrentHashMap<String, String>> allTags;
-
-  public ComponentTagProvider() {
-    allTags = new ConcurrentHashMap<String, ConcurrentHashMap<String, String>>();
-  }
-
-  /**
-   * Record an assigned tag to a container
-   *
-   * @param component
-   * @param containerId
-   * @param tag
-   */
-  public void recordAssignedTag(String component, String containerId, String tag) {
-    if (SliderUtils.isSet(component) && SliderUtils.isSet(containerId)) {
-      Integer key = null;
-      try {
-        key = Integer.valueOf(tag);
-      } catch (NumberFormatException nfe) {
-        //ignore
-      }
-      if (key != null && key > 0) {
-        ConcurrentHashMap<String, String> compTags = getComponentSpecificTags(component);
-        synchronized (compTags) {
-          for (int index = 1; index <= key.intValue(); index++) {
-            String tempKey = new Integer(index).toString();
-            if (!compTags.containsKey(tempKey)) {
-              compTags.put(tempKey, FREE);
-            }
-          }
-          compTags.put(key.toString(), containerId);
-        }
-      }
-    }
-  }
-
-  /**
-   * Get a tag for container
-   *
-   * @param component
-   * @param containerId
-   *
-   * @return
-   */
-  public String getTag(String component, String containerId) {
-    if (SliderUtils.isSet(component) && SliderUtils.isSet(containerId)) {
-      ConcurrentHashMap<String, String> compTags = getComponentSpecificTags(component);
-      synchronized (compTags) {
-        for (String key : compTags.keySet()) {
-          if (compTags.get(key).equals(containerId)) {
-            return key;
-          }
-        }
-        for (String key : compTags.keySet()) {
-          if (compTags.get(key).equals(FREE)) {
-            compTags.put(key, containerId);
-            return key;
-          }
-        }
-        String newKey = new Integer(compTags.size() + 1).toString();
-        compTags.put(newKey, containerId);
-        return newKey;
-      }
-    }
-    return "";
-  }
-
-  /**
-   * Release a tag associated with a container
-   *
-   * @param component
-   * @param containerId
-   */
-  public void releaseTag(String component, String containerId) {
-    if (SliderUtils.isSet(component) && SliderUtils.isSet(containerId)) {
-      ConcurrentHashMap<String, String> compTags = allTags.get(component);
-      if (compTags != null) {
-        synchronized (compTags) {
-          for (String key : compTags.keySet()) {
-            if (compTags.get(key).equals(containerId)) {
-              compTags.put(key, FREE);
-            }
-          }
-        }
-      }
-    }
-  }
-
-  private ConcurrentHashMap<String, String> getComponentSpecificTags(String component) {
-    if (!allTags.containsKey(component)) {
-      synchronized (allTags) {
-        if (!allTags.containsKey(component)) {
-          allTags.put(component, new ConcurrentHashMap<String, String>());
-        }
-      }
-    }
-    return allTags.get(component);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/ContainerState.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/ContainerState.java b/slider-core/src/main/java/org/apache/slider/providers/agent/ContainerState.java
deleted file mode 100644
index 0394ba2..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/ContainerState.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers.agent;
-
-/** The states a component instance can be. */
-public enum ContainerState {
-  INIT,           // Container is not net activated
-  HEALTHY,     // Agent is heartbeating
-  UNHEALTHY,      // Container is unhealthy - no heartbeat for some interval
-  HEARTBEAT_LOST;  // Container is lost - request a new instance
-
-  /**
-   * Indicates whether or not it is a valid state to produce a command.
-   *
-   * @return true if command can be issued for this state.
-   */
-  public boolean canIssueCommands() {
-    switch (this) {
-      case HEALTHY:
-        return true;
-      default:
-        return false;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/HeartbeatMonitor.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/HeartbeatMonitor.java b/slider-core/src/main/java/org/apache/slider/providers/agent/HeartbeatMonitor.java
deleted file mode 100644
index 4293916..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/HeartbeatMonitor.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent;
-
-import com.google.common.annotations.VisibleForTesting;
-
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Map;
-
-/** Monitors the container state and heartbeats. */
-public class HeartbeatMonitor implements Runnable {
-  protected static final Logger log =
-      LoggerFactory.getLogger(HeartbeatMonitor.class);
-  private final int threadWakeupInterval; //1 minute
-  private final AgentProviderService provider;
-  private volatile boolean shouldRun = true;
-  private Thread monitorThread = null;
-
-  public HeartbeatMonitor(AgentProviderService provider, int threadWakeupInterval) {
-    this.provider = provider;
-    this.threadWakeupInterval = threadWakeupInterval;
-  }
-
-  public void shutdown() {
-    shouldRun = false;
-  }
-
-  public void start() {
-    log.info("Starting heartbeat monitor with interval {}", threadWakeupInterval);
-    monitorThread = new Thread(this);
-    monitorThread.start();
-  }
-
-  void join(long millis) throws InterruptedException {
-    if (isAlive()) {
-      monitorThread.join(millis);
-    }
-  }
-
-  public boolean isAlive() {
-    return monitorThread != null && monitorThread.isAlive();
-  }
-
-  @Override
-  public void run() {
-    while (shouldRun) {
-      try {
-        log.debug("Putting monitor to sleep for " + threadWakeupInterval + " " +
-                  "milliseconds");
-        Thread.sleep(threadWakeupInterval);
-        doWork(System.currentTimeMillis());
-      } catch (InterruptedException ex) {
-        log.warn("Scheduler thread is interrupted going to stop", ex);
-        shouldRun = false;
-      } catch (Exception ex) {
-        log.warn("Exception received", ex);
-      } catch (Throwable t) {
-        log.warn("ERROR", t);
-      }
-    }
-  }
-
-  /**
-   * Every interval the current state of the container are checked. If the state is INIT or HEALTHY and no HB are
-   * received in last check interval they are marked as UNHEALTHY. INIT is when the agent is started but it did not
-   * communicate at all. HEALTHY being the AM has received heartbeats. After an interval as UNHEALTHY the container is
-   * declared unavailable
-   * @param now current time in milliseconds ... tests can set this explicitly
-   */
-  @VisibleForTesting
-  public void doWork(long now) {
-    Map<String, ComponentInstanceState> componentStatuses = provider.getComponentStatuses();
-    if (componentStatuses != null) {
-      for (String containerLabel : componentStatuses.keySet()) {
-        ComponentInstanceState componentInstanceState = componentStatuses.get(containerLabel);
-        long timeSinceLastHeartbeat = now - componentInstanceState.getLastHeartbeat();
-
-        if (timeSinceLastHeartbeat > threadWakeupInterval) {
-          switch (componentInstanceState.getContainerState()) {
-            case INIT:
-            case HEALTHY:
-              componentInstanceState.setContainerState(ContainerState.UNHEALTHY);
-              log.warn(
-                  "Component {} marked UNHEALTHY. Last heartbeat received at {} approx. {} ms. back.",
-                  componentInstanceState,
-                  componentInstanceState.getLastHeartbeat(),
-                  timeSinceLastHeartbeat);
-              break;
-            case UNHEALTHY:
-              if (timeSinceLastHeartbeat > threadWakeupInterval * 2) {
-                componentInstanceState.setContainerState(
-                    ContainerState.HEARTBEAT_LOST);
-                log.warn(
-                    "Component {} marked HEARTBEAT_LOST. Last heartbeat received at {} approx. {} ms. back.",
-                    componentInstanceState, componentInstanceState.getLastHeartbeat(),
-                    timeSinceLastHeartbeat);
-                ContainerId containerId =
-                    componentInstanceState.getContainerId();
-                provider.lostContainer(containerLabel, containerId);
-              }
-              break;
-            case HEARTBEAT_LOST:
-              // unexpected case
-              log.warn("Heartbeat from lost component: {}", componentInstanceState);
-              break;
-          }
-            
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/State.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/State.java b/slider-core/src/main/java/org/apache/slider/providers/agent/State.java
deleted file mode 100644
index 5603f8d..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/State.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers.agent;
-
-/** The states a component instance can be. */
-public enum State {
-  INIT,           // Not installed
-  INSTALLING,     // Being installed
-  INSTALLED,      // Installed (or stopped)
-  STARTING,       // Starting
-  STARTED,        // Started
-  INSTALL_FAILED, // Install failed, start failure in INSTALLED
-  UPGRADING,      // Undergoing upgrade, perform necessary pre-upgrade steps
-  UPGRADED,       // Pre-upgrade steps completed
-  STOPPING,       // Stop has been issued
-  STOPPED,        // Agent has stopped
-  TERMINATING;    // Terminate signal to ask the agent to kill itself
-                  // No need for state TERMINATED (as the agent is dead by then)
-
-  /**
-   * Indicates whether or not it is a valid state to produce a command.
-   *
-   * @return true if command can be issued for this state.
-   */
-  public boolean canIssueCommands() {
-    switch (this) {
-      case INSTALLING:
-      case STARTING:
-      case UPGRADING:
-      case STOPPING:
-      case TERMINATING:
-        return false;
-      default:
-        return true;
-    }
-  }
-
-  /**
-   * Returns valid command in this state.
-   *
-   * @return command allowed in this state.
-   */
-  public Command getSupportedCommand() {
-    return getSupportedCommand(false);
-  }
-
-  public Command getSupportedCommand(boolean isInUpgradeMode) {
-    return getSupportedCommand(isInUpgradeMode, false);
-  }
-
-  public Command getSupportedCommand(boolean isInUpgradeMode,
-      boolean stopInitiated) {
-    switch (this) {
-      case INIT:
-      case INSTALL_FAILED:
-        return Command.INSTALL;
-      case INSTALLED:
-        return Command.START;
-      case STARTED:
-      return isInUpgradeMode ? Command.UPGRADE : (stopInitiated) ? Command.STOP
-          : Command.NOP;
-      case UPGRADED:
-        return Command.STOP;
-      case STOPPED:
-        return Command.TERMINATE;
-      default:
-        return Command.NOP;
-    }
-  }
-
-  /**
-   * Returns next state based on the command result.
-   *
-   * @return next state.
-   */
-  public State getNextState(CommandResult result) throws IllegalArgumentException {
-    switch (result) {
-      case IN_PROGRESS:
-        if (this == State.INSTALLING || this == State.STARTING
-            || this == State.UPGRADING || this == State.STOPPING
-            || this == State.TERMINATING) {
-          return this;
-        } else {
-          throw new IllegalArgumentException(result + " is not valid for " + this);
-        }
-      case COMPLETED:
-        if (this == State.INSTALLING) {
-          return State.INSTALLED;
-        } else if (this == State.STARTING) {
-          return State.STARTED;
-        } else if (this == State.UPGRADING) {
-          return State.UPGRADED;
-        } else if (this == State.STOPPING) {
-          return State.STOPPED;
-        } else {
-          throw new IllegalArgumentException(result + " is not valid for " + this);
-        }
-      case FAILED:
-        if (this == State.INSTALLING) {
-          return State.INSTALL_FAILED;
-        } else if (this == State.STARTING) {
-          return State.INSTALLED;
-        } else if (this == State.UPGRADING) {
-          // if pre-upgrade failed, force stop now, so mark it upgraded
-          // what other options can be exposed to app owner?
-          return State.UPGRADED;
-        } else if (this == State.STOPPING) {
-          // if stop fails, force mark it stopped (and let container terminate)
-          return State.STOPPED;
-        } else if (this == State.STOPPED) {
-          // if in stopped state, force mark it as terminating
-          return State.TERMINATING;
-        } else {
-          throw new IllegalArgumentException(result + " is not valid for " + this);
-        }
-      default:
-        throw new IllegalArgumentException("Bad command result " + result);
-    }
-  }
-
-  /**
-   * Returns next state based on the command.
-   *
-   * @return next state.
-   */
-  public State getNextState(Command command) throws IllegalArgumentException {
-    switch (command) {
-      case INSTALL:
-        if (this == State.INIT || this == State.INSTALL_FAILED) {
-          return State.INSTALLING;
-        } else {
-          throw new IllegalArgumentException(command + " is not valid for " + this);
-        }
-      case INSTALL_ADDON:
-          if (this == State.INIT || this == State.INSTALL_FAILED) {
-            return State.INSTALLING;
-          } else {
-            throw new IllegalArgumentException(command + " is not valid for " + this);
-          }
-      case START:
-        if (this == State.INSTALLED) {
-          return State.STARTING;
-        } else {
-          throw new IllegalArgumentException(command + " is not valid for " + this);
-        }
-      case UPGRADE:
-        if (this == State.STARTED) {
-          return State.UPGRADING;
-        } else {
-          throw new IllegalArgumentException(command + " is not valid for " + this);
-        }
-      case STOP:
-        if (this == State.STARTED || this == State.UPGRADED) {
-          return State.STOPPING;
-        } else {
-          throw new IllegalArgumentException(command + " is not valid for " + this);
-        }
-      case TERMINATE:
-        if (this == State.STOPPED) {
-          return State.TERMINATING;
-        } else {
-          throw new IllegalArgumentException(command + " is not valid for " + this);
-        }
-      case NOP:
-        return this;
-      default:
-        throw new IllegalArgumentException("Bad command " + command);
-    }
-  }
-
-  public boolean couldHaveIssued(Command command) {
-    if ((this == State.INSTALLING && command == Command.INSTALL)
-        || (this == State.STARTING && command == Command.START)
-        || (this == State.UPGRADING && command == Command.UPGRADE)
-        || (this == State.STOPPING 
-           && (command == Command.STOP || command == Command.NOP))
-        || (this == State.TERMINATING && command == Command.TERMINATE)
-       ) {
-      return true;
-    }
-    return false;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/AbstractComponent.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/AbstractComponent.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/AbstractComponent.java
deleted file mode 100644
index b6ae4de..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/AbstractComponent.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- *  Component defined in master package metainfo.json
- */
-public abstract class AbstractComponent implements Validate {
-  public static final String TYPE_STANDARD = "STANDARD";
-  public static final String TYPE_DOCKER = "DOCKER";
-  public static final String TYPE_PYTHON = "PYTHON";
-  public static final String CATEGORY_MASTER = "MASTER";
-  public static final String CATEGORY_SLAVE = "SLAVE";
-  public static final String CATEGORY_CLIENT = "CLIENT";
-  public static final String MASTER_PACKAGE_NAME = "MASTER";
-
-  protected String name;
-  protected CommandScript commandScript;
-  protected List<ComponentCommand> commands = new ArrayList<>();
-
-  public AbstractComponent() {
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public CommandScript getCommandScript() {
-    return commandScript;
-  }
-
-  public void addCommandScript(CommandScript commandScript) {
-    this.commandScript = commandScript;
-  }
-
-  @JsonProperty("commands")
-  public List<ComponentCommand> getCommands() {
-    return commands;
-  }
-
-  public void setCommands(List<ComponentCommand> commands) {
-    this.commands = commands;
-  }
-
-  public void addCommand(ComponentCommand command) {
-    commands.add(command);
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb = new StringBuilder("{");
-    sb.append("\n\"name\": ").append(name);
-    sb.append(",\n\"commandScript\" :").append(commandScript);
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/AbstractMetainfoParser.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/AbstractMetainfoParser.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/AbstractMetainfoParser.java
deleted file mode 100644
index 67d1f15..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/AbstractMetainfoParser.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-import org.apache.commons.digester.Digester;
-import org.apache.commons.io.IOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xml.sax.SAXException;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-
-/**
- * This abstract class provide common functionality to parse metainfo.json for
- * either master package or add on packages.
- */
-public abstract class AbstractMetainfoParser {
-  protected final GsonBuilder gsonBuilder = new GsonBuilder();
-  protected final Gson gson;
-  private static final Logger log = LoggerFactory
-      .getLogger(AbstractMetainfoParser.class);
-
-  public AbstractMetainfoParser() {
-    gson = gsonBuilder.create();
-  }
-
-  /**
-   * Convert to a JSON string
-   *
-   * @return a JSON string description
-   *
-   * @throws IOException Problems mapping/writing the object
-   */
-  public String toJsonString(Metainfo metaInfo) throws IOException {
-    return gson.toJson(metaInfo);
-  }
-
-  /**
-   * Convert from JSON
-   *
-   * @param json input
-   *
-   * @return the parsed JSON
-   *
-   * @throws IOException IO
-   */
-  public Metainfo fromJsonString(String json)
-      throws IOException {
-    return gson.fromJson(json, Metainfo.class);
-  }
-
-  /**
-   * Parse metainfo from an IOStream
-   *
-   * @param is
-   *
-   * @return
-   *
-   * @throws IOException
-   */
-  public Metainfo fromJsonStream(InputStream is) throws IOException {
-    log.debug("loading from xml stream");
-    StringWriter writer = new StringWriter();
-    IOUtils.copy(is, writer);
-    return fromJsonString(writer.toString());
-  }
-
-  /**
-   * Parse metainfo from an XML formatted IOStream
-   *
-   * @param metainfoStream
-   *
-   * @return
-   *
-   * @throws IOException
-   */
-  public Metainfo fromXmlStream(InputStream metainfoStream) throws IOException {
-    log.debug("loading from xml stream");
-    Digester digester = new Digester();
-    digester.setValidating(false);
-
-    composeSchema(digester);
-
-    try {
-      return (Metainfo) digester.parse(metainfoStream);
-    } catch (IOException e) {
-      log.debug("IOException in metainfoparser during fromXmlStream: "
-          + e.getMessage());
-    } catch (SAXException e) {
-      log.debug("SAXException in metainfoparser during fromXmlStream: "
-          + e.getMessage());
-    } finally {
-      if (metainfoStream != null) {
-        metainfoStream.close();
-      }
-    }
-
-    return null;
-  }
-
-  /**
-   * Compose the schema for the metainfo
-   *
-   * @param Digester - The Digester object we passed in to compose the schema
-   *
-   * @return
-   *
-   * @throws IOException
-   */
-  abstract protected void composeSchema(Digester digester);
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/AbstractMetainfoSchema.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/AbstractMetainfoSchema.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/AbstractMetainfoSchema.java
deleted file mode 100644
index cfa2895..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/AbstractMetainfoSchema.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Application type defined in the metainfo
- */
-public abstract class AbstractMetainfoSchema implements Validate {
-  protected String name;
-  protected String comment;
-  protected String version;
-  protected List<ConfigFile> configFiles = new ArrayList<>();
-
-  public AbstractMetainfoSchema() {
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public String getComment() {
-    return comment;
-  }
-
-  public void setComment(String comment) {
-    this.comment = comment;
-  }
-
-  public String getVersion() {
-    return version;
-  }
-
-  public void setVersion(String version) {
-    this.version = version;
-  }
-
-  public void addConfigFile(ConfigFile configFile) {
-    this.configFiles.add(configFile);
-  }
-
-  @JsonProperty("configFiles")
-  public List<ConfigFile> getConfigFiles() {
-    return configFiles;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/AddonPackageMetainfoParser.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/AddonPackageMetainfoParser.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/AddonPackageMetainfoParser.java
deleted file mode 100644
index c75837f..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/AddonPackageMetainfoParser.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.commons.digester.Digester;
-
-/**
- *
- */
-public class AddonPackageMetainfoParser extends AbstractMetainfoParser {
-
-  protected void composeSchema(Digester digester) {
-    digester.addObjectCreate("metainfo", Metainfo.class);
-    digester.addBeanPropertySetter("metainfo/schemaVersion");
-
-    digester.addObjectCreate("*/applicationPackage", ApplicationPackage.class);
-    digester.addBeanPropertySetter("*/applicationPackage/name");
-    digester.addBeanPropertySetter("*/applicationPackage/comment");
-    digester.addBeanPropertySetter("*/applicationPackage/version");
-
-    digester.addObjectCreate("*/component", ComponentsInAddonPackage.class);
-    digester.addBeanPropertySetter("*/component/name");
-    digester.addSetNext("*/component", "addComponent");
-
-    digester.addObjectCreate("*/commandScript", CommandScript.class);
-    digester.addBeanPropertySetter("*/commandScript/script");
-    digester.addBeanPropertySetter("*/commandScript/scriptType");
-    digester.addBeanPropertySetter("*/commandScript/timeout");
-    digester.addSetNext("*/commandScript", "addCommandScript");
-
-    digester.addObjectCreate("*/configFile", ConfigFile.class);
-    digester.addBeanPropertySetter("*/configFile/type");
-    digester.addBeanPropertySetter("*/configFile/fileName");
-    digester.addBeanPropertySetter("*/configFile/dictionaryName");
-    digester.addSetNext("*/configFile", "addConfigFile");
-
-    digester.addSetRoot("*/applicationPackage", "setApplicationPackage");
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Application.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Application.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Application.java
deleted file mode 100644
index 5556c7f..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Application.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Application type defined in the metainfo
- */
-public class Application extends AbstractMetainfoSchema {
-  String exportedConfigs;
-  List<ExportGroup> exportGroups = new ArrayList<>();
-  List<OSSpecific> osSpecifics = new ArrayList<>();
-  List<CommandOrder> commandOrders = new ArrayList<>();
-  List<Package> packages = new ArrayList<>();
-  private List<Component> components = new ArrayList<>();
-
-  public Application() {
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public String getComment() {
-    return comment;
-  }
-
-  public void setComment(String comment) {
-    this.comment = comment;
-  }
-
-  public String getVersion() {
-    return version;
-  }
-
-  public void setVersion(String version) {
-    this.version = version;
-  }
-
-  public String getExportedConfigs() {
-    return exportedConfigs;
-  }
-
-  public void setExportedConfigs(String exportedConfigs) {
-    this.exportedConfigs = exportedConfigs;
-  }
-
-  public void addConfigFile(ConfigFile configFile) {
-    this.configFiles.add(configFile);
-  }
-
-  @JsonProperty("configFiles")
-  public List<ConfigFile> getConfigFiles() {
-    return configFiles;
-  }
-
-  public void addComponent(Component component) {
-    components.add(component);
-  }
-
-  @JsonProperty("components")
-  public List<Component> getComponents() {
-    return components;
-  }
-
-  public void addExportGroup(ExportGroup exportGroup) {
-    exportGroups.add(exportGroup);
-  }
-
-  @JsonProperty("exportGroups")
-  public List<ExportGroup> getExportGroups() {
-    return exportGroups;
-  }
-
-  public void addOSSpecific(OSSpecific osSpecific) {
-    osSpecifics.add(osSpecific);
-  }
-
-  @JsonIgnore
-  public List<OSSpecific> getOSSpecifics() {
-    return osSpecifics;
-  }
-
-  public void addCommandOrder(CommandOrder commandOrder) {
-    commandOrders.add(commandOrder);
-  }
-
-  @JsonProperty("commandOrders")
-  public List<CommandOrder> getCommandOrders() {
-    return commandOrders;
-  }
-
-  public void addPackage(Package pkg) {
-    packages.add(pkg);
-  }
-
-  @JsonProperty("packages")
-  public List<Package> getPackages() {
-    return packages;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("{");
-    sb.append(",\n\"name\": ").append(name);
-    sb.append(",\n\"comment\": ").append(comment);
-    sb.append(",\n\"version\" :").append(version);
-    sb.append(",\n\"components\" : {");
-    for (Component component : components) {
-      sb.append("\n").append(component.toString());
-    }
-    sb.append("\n},");
-    sb.append('}');
-    return sb.toString();
-  }
-
-  public void validate(String version) throws SliderException {
-    if(SliderUtils.isUnset(version)) {
-      throw new BadCommandArgumentsException("schema version cannot be null");
-    }
-
-    Metainfo.checkNonNull(getName(), "name", "application");
-
-    Metainfo.checkNonNull(getVersion(), "version", "application");
-
-    if(getComponents().size() == 0) {
-      throw new SliderException("application must contain at least one component");
-    }
-
-    if(version.equals(Metainfo.VERSION_TWO_ZERO)) {
-      if(getPackages().size() > 0) {
-        throw new SliderException("packages is not supported in version " + version);
-      }
-    }
-
-    if(version.equals(Metainfo.VERSION_TWO_ONE)) {
-      if(getOSSpecifics().size() > 0) {
-        throw new SliderException("osSpecifics is not supported in version " + version);
-      }
-    }
-
-    for(CommandOrder co : getCommandOrders()) {
-      co.validate(version);
-    }
-
-    for(Component comp : getComponents()) {
-      comp.validate(version);
-    }
-
-    for(ConfigFile cf : getConfigFiles()) {
-      cf.validate(version);
-    }
-
-    for(ExportGroup eg : getExportGroups()) {
-      eg.validate(version);
-    }
-
-    for(Package pkg : getPackages()) {
-      pkg.validate(version);
-    }
-
-    for(OSSpecific os : getOSSpecifics()) {
-      os.validate(version);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ApplicationPackage.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ApplicationPackage.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ApplicationPackage.java
deleted file mode 100644
index a94a213..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ApplicationPackage.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.slider.core.exceptions.SliderException;
-
-public class ApplicationPackage extends AbstractMetainfoSchema{
-  private List<ComponentsInAddonPackage> components = new ArrayList<ComponentsInAddonPackage>();
-
-  public void addComponent(ComponentsInAddonPackage component) {
-    components.add(component);
-  }
-
-  // we must override getcomponent() as well. otherwise it is pointing to the
-  // overriden components of type List<Component>
-  public List<ComponentsInAddonPackage> getComponents(){
-    return this.components;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb = new StringBuilder("{");
-    sb.append("\n\"name\": ").append(name);
-    sb.append(",\n\"comment\": ").append(comment);
-    sb.append(",\n\"version\" :").append(version);
-    sb.append(",\n\"components\" : {");
-    for (ComponentsInAddonPackage component : components) {
-      sb.append("\n").append(component);
-    }
-    sb.append("\n},");
-    sb.append('}');
-    return sb.toString();
-  }
-
-  @Override
-  public void validate(String version) throws SliderException {
-    if (name == null || name.isEmpty()) {
-      throw new SliderException(
-          "Missing name in metainfo.json for add on packages");
-    }
-    if (components.isEmpty()) {
-      throw new SliderException(
-          "Missing components in metainfo.json for add on packages");
-    }
-    for (ComponentsInAddonPackage component : components) {
-      if (component.name == null || component.name.isEmpty()) {
-        throw new SliderException(
-            "Missing name of components in metainfo.json for add on packages");
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/CommandOrder.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/CommandOrder.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/CommandOrder.java
deleted file mode 100644
index 40d8cc6..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/CommandOrder.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.core.exceptions.SliderException;
-
-/**
- *
- */
-public class CommandOrder implements Validate {
-  String command;
-  String requires;
-
-  public CommandOrder() {
-  }
-
-  public String getCommand() {
-    return command;
-  }
-
-  public void setCommand(String command) {
-    this.command = command;
-  }
-
-  public String getRequires() {
-    return requires;
-  }
-
-  public void setRequires(String requires) {
-    this.requires = requires;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("{");
-    sb.append(",\n\"command\": ").append(command);
-    sb.append(",\n\"requires\": ").append(requires);
-    sb.append('}');
-    return sb.toString();
-  }
-
-  public void validate(String version) throws SliderException {
-    Metainfo.checkNonNull(getCommand(), "command", "package");
-    Metainfo.checkNonNull(getRequires(), "requires", "package");
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/CommandScript.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/CommandScript.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/CommandScript.java
deleted file mode 100644
index 9915ba1..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/CommandScript.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.core.exceptions.SliderException;
-
-/**
- * CommandScript that implements all component commands
- */
-public class CommandScript implements Validate {
-  String script;
-  String scriptType;
-  long timeout;
-
-  public CommandScript() {
-
-  }
-
-  public String getScript() {
-    return script;
-  }
-
-  public void setScript(String script) {
-    this.script = script;
-  }
-
-  public String getScriptType() {
-    return scriptType;
-  }
-
-  public void setScriptType(String scriptType) {
-    this.scriptType = scriptType;
-  }
-
-  public long getTimeout() {
-    return timeout;
-  }
-
-  public void setTimeout(long timeout) {
-    this.timeout = timeout;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("{");
-    sb.append(",\n\"script\": ").append(script);
-    sb.append(",\n\"scriptType\": ").append(scriptType);
-    sb.append(",\n\"timeout\" :").append(timeout);
-    sb.append('}');
-    return sb.toString();
-  }
-
-  public void validate(String version) throws SliderException {
-    Metainfo.checkNonNull(getScript(), "script", "commandScript");
-    Metainfo.checkNonNull(getScriptType(), "scriptType", "commandScript");
-  }
-}


[35/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java b/slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java
deleted file mode 100644
index 204ad9a..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-/**
- * Actions.
- * Only some of these are supported by specific Slider Services; they
- * are listed here to ensure the names are consistent
- */
-public interface SliderActions {
-  String ACTION_AM_SUICIDE = "am-suicide";
-  String ACTION_BUILD = "build";
-  String ACTION_CLIENT = "client";
-  String ACTION_CREATE = "create";
-  String ACTION_DIAGNOSTICS = "diagnostics";
-  String ACTION_DEPENDENCY = "dependency";
-  String ACTION_UPDATE = "update";
-  String ACTION_UPGRADE = "upgrade";
-  String ACTION_DESTROY = "destroy";
-  String ACTION_ECHO = "echo";
-  String ACTION_EXISTS = "exists";
-  String ACTION_FLEX = "flex";
-  String ACTION_FREEZE = "stop";
-  String ACTION_HELP = "help";
-  String ACTION_INSTALL_KEYTAB = "install-keytab";
-  String ACTION_INSTALL_PACKAGE = "install-package";
-  String ACTION_KDIAG = "kdiag";
-  String ACTION_KEYTAB = "keytab";
-  String ACTION_KILL_CONTAINER = "kill-container";
-  String ACTION_LIST = "list";
-  String ACTION_LOOKUP = "lookup";
-  String ACTION_NODES = "nodes";
-  String ACTION_PACKAGE = "package";
-  String ACTION_PREFLIGHT = "preflight";
-  String ACTION_RECONFIGURE = "reconfigure";
-  String ACTION_REGISTRY = "registry";
-  String ACTION_RESOLVE = "resolve";
-  String ACTION_RESOURCE = "resource";
-  String ACTION_STATUS = "status";
-  String ACTION_THAW = "start";
-  String ACTION_TOKENS = "tokens";
-
-  String ACTION_VERSION = "version";
-  String DESCRIBE_ACTION_AM_SUICIDE =
-      "Tell the Slider Application Master to simulate a process failure by terminating itself";
-  String DESCRIBE_ACTION_BUILD =
-    "Build a Slider cluster specification, but do not start it";
-  String DESCRIBE_ACTION_CREATE =
-      "Create a live Slider application";
-  String DESCRIBE_ACTION_DEPENDENCY =
-      "Slider AM and agent dependency (libraries) management";
-  String DESCRIBE_ACTION_UPDATE =
-      "Update template for a Slider application";
-  String DESCRIBE_ACTION_UPGRADE =
-      "Rolling upgrade/downgrade the application to a newer/previous version";
-  String DESCRIBE_ACTION_DESTROY =
-        "Destroy a stopped Slider application";
-  String DESCRIBE_ACTION_EXISTS =
-            "Probe for an application running";
-  String DESCRIBE_ACTION_FLEX = "Flex a Slider application";
-  String DESCRIBE_ACTION_FREEZE =
-              "Stop a running application";
-  String DESCRIBE_ACTION_GETCONF =
-                "Get the configuration of an application";
-  String DESCRIBE_ACTION_KDIAG = "Diagnose Kerberos problems";
-  String DESCRIBE_ACTION_KILL_CONTAINER =
-    "Kill a container in the application";
-  String DESCRIBE_ACTION_HELP = "Print help information";
-  String DESCRIBE_ACTION_LIST =
-                  "List running Slider applications";
-  String DESCRIBE_ACTION_LOOKUP =
-                  "look up a YARN application";
-  String DESCRIBE_ACTION_NODES = "List the node information for the YARN cluster or a running application";
-  String DESCRIBE_ACTION_MONITOR =
-                    "Monitor a running application";
-  String DESCRIBE_ACTION_REGISTRY =
-                      "Query the registry of a YARN application";
-  String DESCRIBE_ACTION_RESOLVE =
-                      "Resolve or list records in the YARN registry";
-  String DESCRIBE_ACTION_STATUS =
-                      "Get the status of an application";
-  String DESCRIBE_ACTION_THAW =
-                        "Start a stopped application";
-  String DESCRIBE_ACTION_VERSION =
-                        "Print the Slider version information";
-  String DESCRIBE_ACTION_INSTALL_PACKAGE = "Install application package." +
-  		" Deprecated, use '" + ACTION_PACKAGE + " " + ClientArgs.ARG_INSTALL + "'.";
-  String DESCRIBE_ACTION_PACKAGE = "Install/list/delete application packages and list app instances that use the packages";
-  String DESCRIBE_ACTION_CLIENT = "Install the application client in the specified directory or obtain a client keystore or truststore";
-  String DESCRIBE_ACTION_INSTALL_KEYTAB = "Install the Kerberos keytab." +
-  		" Deprecated, use '" + ACTION_KEYTAB + " " + ClientArgs.ARG_INSTALL + "'.";
-  String DESCRIBE_ACTION_KEYTAB = "Manage a Kerberos keytab file (install, delete, list) in the sub-folder 'keytabs' of the user's Slider base directory";
-  String DESCRIBE_ACTION_DIAGNOSTIC = "Diagnose the configuration of the running slider application and slider client";
-  String DESCRIBE_ACTION_RESOURCE = "Manage a file (install, delete, list) in the 'resources' sub-folder of the user's Slider base directory";
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/URIArgumentConverter.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/URIArgumentConverter.java b/slider-core/src/main/java/org/apache/slider/common/params/URIArgumentConverter.java
deleted file mode 100644
index b0d1ebf..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/URIArgumentConverter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.converters.BaseConverter;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-public class URIArgumentConverter extends BaseConverter<URI> {
-
-  public URIArgumentConverter(String optionName) {
-    super(optionName);
-  }
-
-  @Override
-  public URI convert(String value) {
-    try {
-      return new URI(value);
-    } catch (URISyntaxException e) {
-      throw new RuntimeException("Cannot make a URI from " + value);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/URLArgumentConverter.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/URLArgumentConverter.java b/slider-core/src/main/java/org/apache/slider/common/params/URLArgumentConverter.java
deleted file mode 100644
index 8894309..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/URLArgumentConverter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.converters.BaseConverter;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-public class URLArgumentConverter extends BaseConverter<URL> {
-  public URLArgumentConverter(String optionName) {
-    super(optionName);
-  }
-
-  @Override
-  public URL convert(String value) {
-    try {
-      return new URL(value);
-    } catch (MalformedURLException e) {
-      throw new RuntimeException("Cannot make a URL from " + value);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/WaitArgsDelegate.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/WaitArgsDelegate.java b/slider-core/src/main/java/org/apache/slider/common/params/WaitArgsDelegate.java
deleted file mode 100644
index 1c27c01..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/WaitArgsDelegate.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-
-public class WaitArgsDelegate extends AbstractArgsDelegate implements
-                                                           WaitTimeAccessor {
-
-
-  //--wait [timeout]
-  @Parameter(names = {ARG_WAIT},
-             description = "time to wait for an action to complete")
-  public int waittime = 0;
-
-
-  @Override
-  public int getWaittime() {
-    return waittime;
-  }
-
-  @Override
-  public void setWaittime(int waittime) {
-    this.waittime = waittime;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/WaitTimeAccessor.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/WaitTimeAccessor.java b/slider-core/src/main/java/org/apache/slider/common/params/WaitTimeAccessor.java
deleted file mode 100644
index 13d4d5a..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/WaitTimeAccessor.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-public interface WaitTimeAccessor {
-  int getWaittime();
-  void setWaittime(int waittime);
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/tools/Comparators.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/tools/Comparators.java b/slider-core/src/main/java/org/apache/slider/common/tools/Comparators.java
deleted file mode 100644
index 6380d0c..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/tools/Comparators.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.tools;
-
-import java.io.Serializable;
-import java.util.Comparator;
-
-/**
- * Some general comparators
- */
-public class Comparators {
-
-  public static class LongComparator implements Comparator<Long>, Serializable {
-    @Override
-    public int compare(Long o1, Long o2) {
-      long result = o1 - o2;
-      // need to comparisons with a diff greater than integer size
-      if (result < 0 ) {
-        return -1;
-      } else if (result > 0) {
-        return 1;
-      }
-      return 0;
-    }
-  }
-public static class InvertedLongComparator implements Comparator<Long>, Serializable {
-  private static final LongComparator inner = new LongComparator();
-    @Override
-    public int compare(Long o1, Long o2) {
-      return -inner.compare(o1, o2);
-    }
-  }
-
-
-  /**
-   * Little template class to reverse any comparitor
-   * @param <CompareType> the type that is being compared
-   */
-  public static class ComparatorReverser<CompareType> implements Comparator<CompareType>,
-      Serializable {
-
-    final Comparator<CompareType> instance;
-
-    public ComparatorReverser(Comparator<CompareType> instance) {
-      this.instance = instance;
-    }
-
-    @Override
-    public int compare(CompareType first, CompareType second) {
-      return instance.compare(second, first);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/tools/ConfigHelper.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/tools/ConfigHelper.java b/slider-core/src/main/java/org/apache/slider/common/tools/ConfigHelper.java
deleted file mode 100644
index 9db241d..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/tools/ConfigHelper.java
+++ /dev/null
@@ -1,658 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.tools;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FSDataInputStream;
-import org.apache.hadoop.fs.FSDataOutputStream;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.io.IOUtils;
-import org.apache.hadoop.registry.client.api.RegistryConstants;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.SliderXmlConfKeys;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.StringWriter;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * Methods to aid in config, both in the Configuration class and
- * with other parts of setting up Slider-initated processes.
- * 
- * Some of the methods take an argument of a map iterable for their sources; this allows
- * the same method
- */
-public class ConfigHelper {
-  private static final Logger log = LoggerFactory.getLogger(ConfigHelper.class);
-
-  private static AtomicBoolean sliderResourceInjected =
-      new AtomicBoolean(false);
-  private static AtomicBoolean sliderResourceInjectionAttempted =
-      new AtomicBoolean(false);
-  
-  /**
-   * Dump the (sorted) configuration
-   * @param conf config
-   * @return the sorted keyset
-   */
-  public static Set<String> dumpConf(Configuration conf) {
-    Set<String> keys = sortedConfigKeys(conf);
-    for (String key : keys) {
-      log.info("{}={}", key, conf.get(key));
-    }
-    return keys;
-  }
-
-  /**
-   * Take a configuration and return a sorted set
-   * @param conf config
-   * @return the sorted keyset
-
-   */
-  public static Set<String> sortedConfigKeys(Iterable<Map.Entry<String, String>> conf) {
-    TreeSet<String> sorted = new TreeSet<String>();
-    for (Map.Entry<String, String> entry : conf) {
-      sorted.add(entry.getKey());
-    }
-    return sorted;
-  }
-
-  /**
-   * Set an entire map full of values
-   *
-   * @param config config to patch
-   * @param map map of data
-   * @param origin origin data
-   */
-  public static void addConfigMap(Configuration config,
-                                  Map<String, String> map,
-                                  String origin) throws BadConfigException {
-    addConfigMap(config, map.entrySet(), origin);
-  }
-  
-  /**
-   * Set an entire map full of values
-   *
-   * @param config config to patch
-   * @param map map of data
-   * @param origin origin data
-   */
-  public static void addConfigMap(Configuration config,
-                                  Iterable<Map.Entry<String, String>> map,
-                                  String origin) throws BadConfigException {
-    for (Map.Entry<String, String> mapEntry : map) {
-      String key = mapEntry.getKey();
-      String value = mapEntry.getValue();
-      if (value == null) {
-        throw new BadConfigException("Null value for property " + key);
-      }
-      config.set(key, value, origin);
-    }
-  }
-
-
-  /**
-   * Save a config file in a destination directory on a given filesystem
-   * @param systemConf system conf used for creating filesystems
-   * @param confToSave config to save
-   * @param confdir the directory path where the file is to go
-   * @param filename the filename
-   * @return the destination path where the file was saved
-   * @throws IOException IO problems
-   */
-  public static Path saveConfig(Configuration systemConf,
-                                Configuration confToSave,
-                                Path confdir,
-                                String filename) throws IOException {
-    FileSystem fs = FileSystem.get(confdir.toUri(), systemConf);
-    Path destPath = new Path(confdir, filename);
-    saveConfig(fs, destPath, confToSave);
-    return destPath;
-  }
-
-  /**
-   * Save a config
-   * @param fs filesystem
-   * @param destPath dest to save
-   * @param confToSave  config to save
-   * @throws IOException IO problems
-   */
-  public static void saveConfig(FileSystem fs,
-                                Path destPath,
-                                Configuration confToSave) throws
-                                                              IOException {
-    FSDataOutputStream fos = fs.create(destPath);
-    try {
-      confToSave.writeXml(fos);
-    } finally {
-      IOUtils.closeStream(fos);
-    }
-  }
-
-  /**
-   * Convert to an XML string
-   * @param conf configuration
-   * @return conf
-   * @throws IOException
-   */
-  public static String toXml(Configuration conf) throws IOException {
-    StringWriter writer = new StringWriter();
-    conf.writeXml(writer);
-    return writer.toString();
-  }
-  
-  /**
-   * This will load and parse a configuration to an XML document
-   * @param fs filesystem
-   * @param path path
-   * @return an XML document
-   * @throws IOException IO failure
-   */
-  public Document parseConfiguration(FileSystem fs,
-                                     Path path) throws
-                                                IOException {
-
-
-    byte[] data = loadBytes(fs, path);
-    //this is here to track down a parse issue
-    //related to configurations
-    String s = new String(data, 0, data.length);
-    log.debug("XML resource {} is \"{}\"", path, s);
-/* JDK7
-    try (ByteArrayInputStream in = new ByteArrayInputStream(data)) {
-      Document document = parseConfigXML(in);
-      return document;
-    } catch (ParserConfigurationException | SAXException e) {
-      throw new IOException(e);
-    }
-*/
-    ByteArrayInputStream in= null;
-    try {
-      in = new ByteArrayInputStream(data);
-      Document document = parseConfigXML(in);
-      return document;
-    } catch (ParserConfigurationException e) {
-      throw new IOException(e);
-    } catch (SAXException e) {
-      throw new IOException(e);
-    } finally {
-      IOUtils.closeStream(in);
-    }
-  }
-
-  public static byte[] loadBytes(FileSystem fs, Path path) throws IOException {
-    int len = (int) fs.getLength(path);
-    byte[] data = new byte[len];
-    /* JDK7
-    try(FSDataInputStream in = fs.open(path)) {
-      in.readFully(0, data);
-    }
-*/
-    FSDataInputStream in = null;
-    in = fs.open(path);
-    try {
-      in.readFully(0, data);
-    } finally {
-      IOUtils.closeStream(in);
-    }
-    return data;
-  }
-
-  /**
-   * Load a configuration from ANY FS path. The normal Configuration
-   * loader only works with file:// URIs
-   * @param fs filesystem
-   * @param path path
-   * @return a loaded resource
-   * @throws IOException
-   */
-  public static Configuration loadConfiguration(FileSystem fs,
-                                                Path path) throws IOException {
-    byte[] data = loadBytes(fs, path);
-
-    ByteArrayInputStream in2;
-
-    in2 = new ByteArrayInputStream(data);
-    Configuration conf1 = new Configuration(false);
-    conf1.addResource(in2);
-    //now clone it while dropping all its sources
-    Configuration conf2   = new Configuration(false);
-    String src = path.toString();
-    for (Map.Entry<String, String> entry : conf1) {
-      String key = entry.getKey();
-      String value = entry.getValue();
-      conf2.set(key, value, src);
-    }
-    return conf2;
-  }
-
-
-  /**
-   * Generate a config file in a destination directory on the local filesystem
-   * @param confdir the directory path where the file is to go
-   * @param filename the filename
-   * @return the destination path
-   */
-  public static File saveConfig(Configuration generatingConf,
-                                    File confdir,
-                                    String filename) throws IOException {
-
-
-    File destPath = new File(confdir, filename);
-    OutputStream fos = new FileOutputStream(destPath);
-    try {
-      generatingConf.writeXml(fos);
-    } finally {
-      IOUtils.closeStream(fos);
-    }
-    return destPath;
-  }
-
-  /**
-   * Parse an XML Hadoop configuration into an XML document. x-include
-   * is supported, but as the location isn't passed in, relative
-   * URIs are out.
-   * @param in instream
-   * @return a document
-   * @throws ParserConfigurationException parser feature problems
-   * @throws IOException IO problems
-   * @throws SAXException XML is invalid
-   */
-  public static Document parseConfigXML(InputStream in) throws
-                                               ParserConfigurationException,
-                                               IOException,
-                                               SAXException {
-    DocumentBuilderFactory docBuilderFactory
-      = DocumentBuilderFactory.newInstance();
-    //ignore all comments inside the xml file
-    docBuilderFactory.setIgnoringComments(true);
-
-    //allow includes in the xml file
-    docBuilderFactory.setNamespaceAware(true);
-    docBuilderFactory.setXIncludeAware(true);
-    DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();
-    return builder.parse(in);
-  }
-
-  /**
-   * Load a Hadoop configuration from a local file.
-   * @param file file to load
-   * @return a configuration which hasn't actually had the load triggered
-   * yet.
-   * @throws FileNotFoundException file is not there
-   * @throws IOException any other IO problem
-   */
-  public static Configuration loadConfFromFile(File file) throws
-                                                          IOException {
-    return loadConfFromFile(file, false);
-  }
-
-  /**
-   *
-   * Load a Hadoop configuration from a local file.
-   * @param file file to load
-   * @param loadDefaults flag to indicate if the defaults should be loaded yet
-   * @return a configuration which hasn't actually had the load triggered
-   * yet.
-   * @throws FileNotFoundException file is not there
-   * @throws IOException any other IO problem
-   */
-  public static Configuration loadConfFromFile(File file,
-      boolean loadDefaults) throws IOException {
-    if (!file.exists()) {
-      throw new FileNotFoundException("File not found :"
-                                          + file.getAbsoluteFile());
-    }
-    Configuration conf = new Configuration(loadDefaults);
-    try {
-      conf.addResource(file.toURI().toURL());
-    } catch (MalformedURLException e) {
-      // should never happen...
-      throw new IOException(
-        "File " + file.toURI() + " doesn't have a valid URL");
-    }
-    return conf;
-  }
-
-  /**
-   * Add a configuration from a file to an existing configuration
-   * @param conf existing configuration
-   * @param file file to load
-   * @param overwrite flag to indicate new values should overwrite the predecessor
-   * @return the merged configuration
-   * @throws IOException
-   */
-  public static Configuration addConfigurationFile(Configuration conf,
-      File file, boolean overwrite)
-      throws IOException {
-    Configuration c2 = loadConfFromFile(file, false);
-    mergeConfigurations(conf, c2, file.getAbsolutePath(), overwrite);
-    return conf;
-  }
-
-  /**
-   * Add the system env variables with the given prefix (by convention, env.)
-   * @param conf existing configuration
-   * @param prefix prefix
-   */
-  public static void addEnvironmentVariables(Configuration conf, String prefix) {
-    Map<String, String> env = System.getenv();
-    for (Map.Entry<String, String> entry : env.entrySet()) {
-      conf.set(prefix + entry.getKey(),entry.getValue(), "env");
-    }
-  }
-  
-  /**
-   * looks for the config under $confdir/$templateFilename; if not there
-   * loads it from /conf/templateFile.
-   * The property {@link SliderKeys#KEY_TEMPLATE_ORIGIN} is set to the
-   * origin to help debug what's happening
-   * @param systemConf system conf
-   * @param confdir conf dir in FS
-   * @param templateFilename filename in the confdir
-   * @param fallbackResource resource to fall back on
-   * @return loaded conf
-   * @throws IOException IO problems
-   */
-  public static Configuration loadTemplateConfiguration(Configuration systemConf,
-                                                        Path confdir,
-                                                        String templateFilename,
-                                                        String fallbackResource) throws
-                                                                         IOException {
-    FileSystem fs = FileSystem.get(confdir.toUri(), systemConf);
-
-    Path templatePath = new Path(confdir, templateFilename);
-    return loadTemplateConfiguration(fs, templatePath, fallbackResource);
-  }
-
-  /**
-   * looks for the config under $confdir/$templateFilename; if not there
-   * loads it from /conf/templateFile.
-   * The property {@link SliderKeys#KEY_TEMPLATE_ORIGIN} is set to the
-   * origin to help debug what's happening.
-   * @param fs Filesystem
-   * @param templatePath HDFS path for template
-   * @param fallbackResource resource to fall back on, or "" for no fallback
-   * @return loaded conf
-   * @throws IOException IO problems
-   * @throws FileNotFoundException if the path doesn't have a file and there
-   * was no fallback.
-   */
-  public static Configuration loadTemplateConfiguration(FileSystem fs,
-                                                        Path templatePath,
-                                                        String fallbackResource)
-      throws IOException {
-    Configuration conf;
-    String origin;
-    if (fs.exists(templatePath)) {
-      log.debug("Loading template configuration {}", templatePath);
-      conf = loadConfiguration(fs, templatePath);
-      origin = templatePath.toString();
-    } else {
-      if (fallbackResource.isEmpty()) {
-        throw new FileNotFoundException("No config file found at " + templatePath);
-      }
-      log.debug("Template {} not found" +
-                " -reverting to classpath resource {}", templatePath, fallbackResource);
-      conf = new Configuration(false);
-      conf.addResource(fallbackResource);
-      origin = "Resource " + fallbackResource;
-    }
-    //force a get
-    conf.get(SliderXmlConfKeys.KEY_TEMPLATE_ORIGIN);
-    //now set the origin
-    conf.set(SliderXmlConfKeys.KEY_TEMPLATE_ORIGIN, origin);
-    return conf;
-  }
-
-
-  /**
-   * For testing: dump a configuration
-   * @param conf configuration
-   * @return listing in key=value style
-   */
-  public static String dumpConfigToString(Configuration conf) {
-    Set<String> sorted = sortedConfigKeys(conf);
-
-    StringBuilder builder = new StringBuilder();
-    for (String key : sorted) {
-
-      builder.append(key)
-             .append("=")
-             .append(conf.get(key))
-             .append("\n");
-    }
-    return builder.toString();
-  }
-
-  /**
-   * Merge in one configuration above another
-   * @param base base config
-   * @param merge one to merge. This MUST be a non-default-load config to avoid
-   * merge origin confusion
-   * @param origin description of the origin for the put operation
-   * @param overwrite flag to indicate new values should overwrite the predecessor
-   * @return the base with the merged values
-   */
-  public static Configuration mergeConfigurations(Configuration base,
-      Iterable<Map.Entry<String, String>> merge,
-      String origin,
-      boolean overwrite) {
-    for (Map.Entry<String, String> entry : merge) {
-      String key = entry.getKey();
-      if (overwrite || base.get(key) == null) {
-        base.set(key, entry.getValue(), origin);
-      }
-    }
-    return base;
-  }
-
-  /**
-   * Register a resource as a default resource.
-   * Do not attempt to use this unless you understand that the
-   * order in which default resources are loaded affects the outcome,
-   * and that subclasses of Configuration often register new default
-   * resources
-   * @param resource the resource name
-   * @return the URL or null
-   */
-  public static URL registerDefaultResource(String resource) {
-    URL resURL = getResourceUrl(resource);
-    if (resURL != null) {
-      Configuration.addDefaultResource(resource);
-    }
-    return resURL;
-  }
-
-  /**
-   * Load a configuration from a resource on this classpath.
-   * If the resource is not found, an empty configuration is returned
-   * @param resource the resource name
-   * @return the loaded configuration.
-   */
-  public static Configuration loadFromResource(String resource) {
-    Configuration conf = new Configuration(false);
-    URL resURL = getResourceUrl(resource);
-    if (resURL != null) {
-      log.debug("loaded resources from {}", resURL);
-      conf.addResource(resource);
-    } else{
-      log.debug("failed to find {} on the classpath", resource);
-    }
-    return conf;
-    
-  }
-
-  /**
-   * Get the URL to a resource, null if not on the CP
-   * @param resource resource to look for
-   * @return the URL or null
-   */
-  public static URL getResourceUrl(String resource) {
-    return ConfigHelper.class.getClassLoader()
-                                  .getResource(resource);
-  }
-
-  /**
-   * Load a resource that must be on the classpath
-   * @param resource the resource name
-   * @return the loaded configuration
-   * @throws FileNotFoundException if the resource is missing
-   */
-  public static Configuration loadMandatoryResource(String resource)
-      throws FileNotFoundException {
-    Configuration conf = new Configuration(false);
-    URL resURL = getResourceUrl(resource);
-    if (resURL != null) {
-      log.debug("loaded resources from {}", resURL);
-      conf.addResource(resource);
-    } else {
-      throw new FileNotFoundException(resource);
-    }
-    return conf;
-  }
-
-  /**
-   * Propagate a property from a source to a dest config, with a best-effort
-   * attempt at propagating the origin.
-   * If the 
-   * @param dest destination
-   * @param src source
-   * @param key key to try to copy
-   * @return true if the key was found and propagated
-   */
-  public static boolean propagate(Configuration dest,
-                                  Configuration src,
-                                  String key) {
-    String val = src.get(key);
-    if (val != null) {
-      String[] origin = src.getPropertySources(key);
-      if (origin != null && origin.length > 0) {
-        dest.set(key, val, origin[0]);
-      } else {
-        dest.set(key, val);
-        return true;
-      }
-    }
-    return false;
-  }
-
-
-  /**
-   * Take a configuration, return a hash map
-   * @param conf conf
-   * @return hash map
-   */
-  public static Map<String, String> buildMapFromConfiguration(Configuration conf) {
-    Map<String, String> map = new HashMap<String, String>();
-    return SliderUtils.mergeEntries(map, conf);
-  }
-
-  /**
-   * This goes through the keyset of one configuration and retrieves each value
-   * from a value source -a different or the same configuration. This triggers
-   * the property resolution process of the value, resolving any variables against
-   * in-config or inherited configurations
-   * @param keysource source of keys
-   * @param valuesource the source of values
-   * @return a new configuration where <code>foreach key in keysource, get(key)==valuesource.get(key)</code>
-   */
-  public static Configuration resolveConfiguration(
-      Iterable<Map.Entry<String, String>> keysource,
-      Configuration valuesource) {
-    Configuration result = new Configuration(false);
-    for (Map.Entry<String, String> entry : keysource) {
-      String key = entry.getKey();
-      String value = valuesource.get(key);
-      Preconditions.checkState(value != null,
-          "no reference for \"%s\" in values", key);
-      result.set(key, value);
-    }
-    return result;
-  }
-
-  /**
-   * Register anything we consider deprecated
-   */
-  public static void registerDeprecatedConfigItems() {
-    Configuration.addDeprecation(
-        SliderXmlConfKeys.REGISTRY_ZK_QUORUM,
-        RegistryConstants.KEY_REGISTRY_ZK_QUORUM);
-    Configuration.addDeprecation(
-        SliderXmlConfKeys.REGISTRY_PATH,
-        RegistryConstants.KEY_REGISTRY_ZK_ROOT);
-    
-  }
-
-  /**
-   * Load a configuration with the {@link SliderKeys#SLIDER_XML} resource
-   * included
-   * @return a configuration instance
-   */
-  public static Configuration loadSliderConfiguration() {
-    Configuration conf = new Configuration();
-    conf.addResource(SliderKeys.SLIDER_XML);
-    return conf;
-  }
-
-  /**
-   * Inject the {@link SliderKeys#SLIDER_XML} resource
-   * into the configuration resources <i>of all configurations</i>.
-   * <p>
-   *   This operation is idempotent.
-   * <p>
-   * If the resource is not on the classpath, downgrades, rather than
-   * fails.
-   * @return true if the resource was found and loaded.
-   */
-  public static synchronized boolean injectSliderXMLResource() {
-    if (sliderResourceInjectionAttempted.getAndSet(true)) {
-      return sliderResourceInjected.get();
-    }
-    URL resourceUrl = getResourceUrl(SliderKeys.SLIDER_XML);
-    if (resourceUrl != null) {
-      Configuration.addDefaultResource(SliderKeys.SLIDER_XML);
-      sliderResourceInjected.set(true);
-    }
-    return sliderResourceInjected.get();
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java b/slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java
deleted file mode 100644
index aa5edf1..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java
+++ /dev/null
@@ -1,915 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.tools;
-
-import com.google.common.base.Preconditions;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.CommonConfigurationKeys;
-import org.apache.hadoop.fs.FSDataInputStream;
-import org.apache.hadoop.fs.FSDataOutputStream;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.permission.FsPermission;
-import org.apache.hadoop.io.IOUtils;
-import org.apache.hadoop.yarn.api.records.LocalResource;
-import org.apache.hadoop.yarn.api.records.LocalResourceType;
-import org.apache.hadoop.yarn.api.records.LocalResourceVisibility;
-import org.apache.hadoop.yarn.util.ConverterUtils;
-import org.apache.hadoop.yarn.util.Records;
-import org.apache.slider.common.SliderExitCodes;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.SliderXmlConfKeys;
-import org.apache.slider.core.exceptions.BadClusterStateException;
-import org.apache.slider.core.exceptions.ErrorStrings;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.exceptions.UnknownApplicationInstanceException;
-import org.apache.slider.core.persist.Filenames;
-import org.apache.slider.core.persist.InstancePaths;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Enumeration;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import static org.apache.slider.common.SliderXmlConfKeys.CLUSTER_DIRECTORY_PERMISSIONS;
-import static org.apache.slider.common.SliderXmlConfKeys.DEFAULT_CLUSTER_DIRECTORY_PERMISSIONS;
-
-public class CoreFileSystem {
-  private static final Logger
-    log = LoggerFactory.getLogger(CoreFileSystem.class);
-
-  private static final String UTF_8 = "UTF-8";
-
-  protected final FileSystem fileSystem;
-  protected final Configuration configuration;
-
-  public CoreFileSystem(FileSystem fileSystem, Configuration configuration) {
-    Preconditions.checkNotNull(fileSystem,
-                               "Cannot create a CoreFileSystem with a null FileSystem");
-    Preconditions.checkNotNull(configuration,
-                               "Cannot create a CoreFileSystem with a null Configuration");
-    this.fileSystem = fileSystem;
-    this.configuration = configuration;
-  }
-
-  public CoreFileSystem(Configuration configuration) throws IOException {
-    Preconditions.checkNotNull(configuration,
-                               "Cannot create a CoreFileSystem with a null Configuration");
-    this.fileSystem = FileSystem.get(configuration);
-    this.configuration = fileSystem.getConf();
-  }
-  
-  /**
-   * Get the temp path for this cluster
-   * @param clustername name of the cluster
-   * @return path for temp files (is not purged)
-   */
-  public Path getTempPathForCluster(String clustername) {
-    Path clusterDir = buildClusterDirPath(clustername);
-    return new Path(clusterDir, SliderKeys.TMP_DIR_PREFIX);
-  }
-
-  /**
-   * Returns the underlying FileSystem for this object.
-   *
-   * @return filesystem
-   */
-  public FileSystem getFileSystem() {
-    return fileSystem;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-      new StringBuilder("CoreFileSystem{");
-    sb.append("fileSystem=").append(fileSystem.getUri());
-    sb.append('}');
-    return sb.toString();
-  }
-
-  /**
-   * Build up the path string for a cluster instance -no attempt to
-   * create the directory is made
-   *
-   * @param clustername name of the cluster
-   * @return the path for persistent data
-   */
-  public Path buildClusterDirPath(String clustername) {
-    Preconditions.checkNotNull(clustername);
-    Path path = getBaseApplicationPath();
-    return new Path(path, SliderKeys.CLUSTER_DIRECTORY + "/" + clustername);
-  }
-
-  /**
-   * Build up the path string for app def folder -no attempt to
-   * create the directory is made
-   *
-   * @param clustername name of the cluster
-   * @return the path for persistent data
-   */
-  public Path buildAppDefDirPath(String clustername) {
-    Path path = buildClusterDirPath(clustername);
-    return new Path(path, SliderKeys.APP_DEF_DIR);
-  }
-
-  /**
-   * Build up the path string for addon folder -no attempt to
-   * create the directory is made
-   *
-   * @param clustername name of the cluster
-   * @return the path for persistent data
-   */
-  public Path buildAddonDirPath(String clustername, String addonId) {
-    Preconditions.checkNotNull(addonId);
-    Path path = buildClusterDirPath(clustername);
-    return new Path(path, SliderKeys.ADDONS_DIR + "/" + addonId);
-  }
-
-  /**
-   * Build up the path string for package install location -no attempt to
-   * create the directory is made
-   *
-   * @return the path for persistent app package
-   */
-  public Path buildPackageDirPath(String packageName, String packageVersion) {
-    Preconditions.checkNotNull(packageName);
-    Path path = getBaseApplicationPath();
-    path = new Path(path, SliderKeys.PACKAGE_DIRECTORY + "/" + packageName);
-    if (SliderUtils.isSet(packageVersion)) {
-      path = new Path(path, packageVersion);
-    }
-    return path;
-  }
-
-  /**
-   * Build up the path string for package install location -no attempt to
-   * create the directory is made
-   *
-   * @return the path for persistent app package
-   */
-  public Path buildClusterSecurityDirPath(String clusterName) {
-    Preconditions.checkNotNull(clusterName);
-    Path path = buildClusterDirPath(clusterName);
-    return new Path(path, SliderKeys.SECURITY_DIR);
-  }
-
-  /**
-   * Build up the path string for keytab install location -no attempt to
-   * create the directory is made
-   *
-   * @return the path for keytab
-   */
-  public Path buildKeytabInstallationDirPath(String keytabFolder) {
-    Preconditions.checkNotNull(keytabFolder);
-    Path path = getBaseApplicationPath();
-    return new Path(path, SliderKeys.KEYTAB_DIR + "/" + keytabFolder);
-  }
-
-  /**
-   * Build up the path string for keytab install location -no attempt to
-   * create the directory is made
-   *
-   * @return the path for keytab installation location
-   */
-  public Path buildKeytabPath(String keytabDir, String keytabName, String clusterName) {
-    Path homePath = getHomeDirectory();
-    Path baseKeytabDir;
-    if (keytabDir != null) {
-      baseKeytabDir = new Path(homePath, keytabDir);
-    } else {
-      baseKeytabDir = new Path(buildClusterDirPath(clusterName),
-                               SliderKeys.KEYTAB_DIR);
-    }
-    return keytabName == null ? baseKeytabDir :
-        new Path(baseKeytabDir, keytabName);
-  }
-
-  /**
-   * Build up the path string for resource install location -no attempt to
-   * create the directory is made
-   *
-   * @return the path for resource
-   */
-  public Path buildResourcePath(String resourceFolder) {
-    Preconditions.checkNotNull(resourceFolder);
-    Path path = getBaseApplicationPath();
-    return new Path(path, SliderKeys.RESOURCE_DIR + "/" + resourceFolder);
-  }
-
-  /**
-   * Build up the path string for resource install location -no attempt to
-   * create the directory is made
-   *
-   * @return the path for resource
-   */
-  public Path buildResourcePath(String dirName, String fileName) {
-    Preconditions.checkNotNull(dirName);
-    Preconditions.checkNotNull(fileName);
-    Path path = getBaseApplicationPath();
-    return new Path(path, SliderKeys.RESOURCE_DIR + "/" + dirName + "/" + fileName);
-  }
-
-  /**
-   * Build up the path string for cluster resource install location -no
-   * attempt to create the directory is made
-   *
-   * @return the path for resource
-   */
-  public Path buildClusterResourcePath(String clusterName, String component) {
-    Preconditions.checkNotNull(clusterName);
-    Path path = buildClusterDirPath(clusterName);
-    return new Path(path, SliderKeys.RESOURCE_DIR + "/" + component);
-  }
-
-  /**
-   * Build up the path string for cluster resource install location -no
-   * attempt to create the directory is made
-   *
-   * @return the path for resource
-   */
-  public Path buildClusterResourcePath(String clusterName) {
-    Preconditions.checkNotNull(clusterName);
-    Path path = buildClusterDirPath(clusterName);
-    return new Path(path, SliderKeys.RESOURCE_DIR);
-  }
-
-  /**
-   * Create the Slider cluster path for a named cluster and all its subdirs
-   * This is a directory; a mkdirs() operation is executed
-   * to ensure that it is there.
-   *
-   * @param clustername name of the cluster
-   * @return the path to the cluster directory
-   * @throws java.io.IOException                      trouble
-   * @throws SliderException slider-specific exceptions
-   */
-  public Path createClusterDirectories(String clustername, Configuration conf)
-      throws IOException, SliderException {
-
-
-    Path clusterDirectory = buildClusterDirPath(clustername);
-    InstancePaths instancePaths = new InstancePaths(clusterDirectory);
-    createClusterDirectories(instancePaths);
-    return clusterDirectory;
-  }
-  
-  /**
-   * Create the Slider cluster path for a named cluster and all its subdirs
-   * This is a directory; a mkdirs() operation is executed
-   * to ensure that it is there.
-   *
-   * @param instancePaths instance paths
-   * @throws IOException trouble
-   * @throws SliderException slider-specific exceptions
-   */
-  public void createClusterDirectories(InstancePaths instancePaths) throws
-      IOException, SliderException {
-    Path instanceDir = instancePaths.instanceDir;
-
-    verifyDirectoryNonexistent(instanceDir);
-    FsPermission clusterPerms = getInstanceDirectoryPermissions();
-    createWithPermissions(instanceDir, clusterPerms);
-    createWithPermissions(instancePaths.snapshotConfPath, clusterPerms);
-    createWithPermissions(instancePaths.generatedConfPath, clusterPerms);
-    createWithPermissions(instancePaths.historyPath, clusterPerms);
-    createWithPermissions(instancePaths.tmpPathAM, clusterPerms);
-
-    // Data Directory
-    String dataOpts =
-      configuration.get(SliderXmlConfKeys.DATA_DIRECTORY_PERMISSIONS,
-               SliderXmlConfKeys.DEFAULT_DATA_DIRECTORY_PERMISSIONS);
-    log.debug("Setting data directory permissions to {}", dataOpts);
-    createWithPermissions(instancePaths.dataPath, new FsPermission(dataOpts));
-
-  }
-
-  /**
-   * Create a directory with the given permissions.
-   *
-   * @param dir          directory
-   * @param clusterPerms cluster permissions
-   * @throws IOException  IO problem
-   * @throws BadClusterStateException any cluster state problem
-   */
-  public void createWithPermissions(Path dir, FsPermission clusterPerms) throws
-          IOException,
-          BadClusterStateException {
-    if (fileSystem.isFile(dir)) {
-      // HADOOP-9361 shows some filesystems don't correctly fail here
-      throw new BadClusterStateException(
-              "Cannot create a directory over a file %s", dir);
-    }
-    log.debug("mkdir {} with perms {}", dir, clusterPerms);
-    //no mask whatoever
-    fileSystem.getConf().set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY, "000");
-    fileSystem.mkdirs(dir, clusterPerms);
-    //and force set it anyway just to make sure
-    fileSystem.setPermission(dir, clusterPerms);
-  }
-
-  /**
-   * Get the permissions of a path
-   *
-   * @param path path to check
-   * @return the permissions
-   * @throws IOException any IO problem (including file not found)
-   */
-  public FsPermission getPathPermissions(Path path) throws IOException {
-    FileStatus status = fileSystem.getFileStatus(path);
-    return status.getPermission();
-  }
-
-  public FsPermission getInstanceDirectoryPermissions() {
-    String clusterDirPermsOct =
-      configuration.get(CLUSTER_DIRECTORY_PERMISSIONS,
-                        DEFAULT_CLUSTER_DIRECTORY_PERMISSIONS);
-    return new FsPermission(clusterDirPermsOct);
-  }
-
-  /**
-   * Verify that the cluster directory is not present
-   *
-   * @param clustername      name of the cluster
-   * @param clusterDirectory actual directory to look for
-   * @throws IOException trouble with FS
-   * @throws SliderException If the directory exists
-   */
-  public void verifyClusterDirectoryNonexistent(String clustername,
-                                                Path clusterDirectory)
-      throws IOException, SliderException {
-    if (fileSystem.exists(clusterDirectory)) {
-      throw new SliderException(SliderExitCodes.EXIT_INSTANCE_EXISTS,
-              ErrorStrings.PRINTF_E_INSTANCE_ALREADY_EXISTS, clustername,
-              clusterDirectory);
-    }
-  }
-  /**
-   * Verify that the given directory is not present
-   *
-   * @param clusterDirectory actual directory to look for
-   * @throws IOException    trouble with FS
-   * @throws SliderException If the directory exists
-   */
-  public void verifyDirectoryNonexistent(Path clusterDirectory) throws
-          IOException,
-      SliderException {
-    if (fileSystem.exists(clusterDirectory)) {
-      
-      log.error("Dir {} exists: {}",
-                clusterDirectory,
-                listFSDir(clusterDirectory));
-      throw new SliderException(SliderExitCodes.EXIT_INSTANCE_EXISTS,
-              ErrorStrings.PRINTF_E_INSTANCE_DIR_ALREADY_EXISTS,
-              clusterDirectory);
-    }
-  }
-
-  /**
-   * Verify that a user has write access to a directory.
-   * It does this by creating then deleting a temp file
-   *
-   * @param dirPath actual directory to look for
-   * @throws FileNotFoundException file not found
-   * @throws IOException  trouble with FS
-   * @throws BadClusterStateException if the directory is not writeable
-   */
-  public void verifyDirectoryWriteAccess(Path dirPath) throws IOException,
-      SliderException {
-    verifyPathExists(dirPath);
-    Path tempFile = new Path(dirPath, "tmp-file-for-checks");
-    try {
-      FSDataOutputStream out ;
-      out = fileSystem.create(tempFile, true);
-      IOUtils.closeStream(out);
-      fileSystem.delete(tempFile, false);
-    } catch (IOException e) {
-      log.warn("Failed to create file {}: {}", tempFile, e);
-      throw new BadClusterStateException(e,
-              "Unable to write to directory %s : %s", dirPath, e.toString());
-    }
-  }
-
-  /**
-   * Verify that a path exists
-   * @param path path to check
-   * @throws FileNotFoundException file not found
-   * @throws IOException  trouble with FS
-   */
-  public void verifyPathExists(Path path) throws IOException {
-    if (!fileSystem.exists(path)) {
-      throw new FileNotFoundException(path.toString());
-    }
-  }
-
-  /**
-   * Verify that a path exists
-   * @param path path to check
-   * @throws FileNotFoundException file not found or is not a file
-   * @throws IOException  trouble with FS
-   */
-  public void verifyFileExists(Path path) throws IOException {
-    FileStatus status = fileSystem.getFileStatus(path);
-
-    if (!status.isFile()) {
-      throw new FileNotFoundException("Not a file: " + path.toString());
-    }
-  }
-
-  /**
-   * Given a path, check if it exists and is a file
-   * 
-   * @param path
-   *          absolute path to the file to check
-   * @returns true if and only if path exists and is a file, false for all other
-   *          reasons including if file check throws IOException
-   */
-  public boolean isFile(Path path) {
-    boolean isFile = false;
-    try {
-      FileStatus status = fileSystem.getFileStatus(path);
-      if (status.isFile()) {
-        isFile = true;
-      }
-    } catch (IOException e) {
-      // ignore, isFile is already set to false
-    }
-    return isFile;
-  }
-
-  /**
-   * Verify that a file exists in the zip file given by path
-   * @param path path to zip file
-   * @param file file expected to be in zip
-   * @throws FileNotFoundException file not found or is not a zip file
-   * @throws IOException  trouble with FS
-   */
-  public void verifyFileExistsInZip(Path path, String file) throws IOException {
-    fileSystem.copyToLocalFile(path, new Path("/tmp"));
-    File dst = new File((new Path("/tmp", path.getName())).toString());
-    Enumeration<? extends ZipEntry> entries;
-    ZipFile zipFile = new ZipFile(dst);
-    boolean found = false;
-
-    try {
-      entries = zipFile.entries();
-      while (entries.hasMoreElements()) {
-        ZipEntry entry = entries.nextElement();
-        String nm = entry.getName();
-        if (nm.endsWith(file)) {
-          found = true;
-          break;
-        }
-      }
-    } finally {
-      zipFile.close();
-    }
-    dst.delete();
-    if (!found) throw new FileNotFoundException("file: " + file + " not found in " + path);
-    log.info("Verification of " + path + " passed");
-  }
-  /**
-   * Create the application-instance specific temporary directory
-   * in the DFS
-   *
-   * @param clustername name of the cluster
-   * @param subdir       application ID
-   * @return the path; this directory will already have been created
-   */
-  public Path createAppInstanceTempPath(String clustername, String subdir)
-      throws IOException {
-    Path tmp = getTempPathForCluster(clustername);
-    Path instancePath = new Path(tmp, subdir);
-    fileSystem.mkdirs(instancePath);
-    return instancePath;
-  }
-
-  /**
-   * Create the application-instance specific temporary directory
-   * in the DFS
-   *
-   * @param clustername name of the cluster
-   * @return the path; this directory will already have been deleted
-   */
-  public Path purgeAppInstanceTempFiles(String clustername) throws
-          IOException {
-    Path tmp = getTempPathForCluster(clustername);
-    fileSystem.delete(tmp, true);
-    return tmp;
-  }
-
-  /**
-   * Get the base path
-   *
-   * @return the base path optionally configured by 
-   * {@link SliderXmlConfKeys#KEY_SLIDER_BASE_PATH}
-   */
-  public Path getBaseApplicationPath() {
-    String configuredBasePath = configuration.get(SliderXmlConfKeys.KEY_SLIDER_BASE_PATH);
-    return configuredBasePath != null ? new Path(configuredBasePath) :
-           new Path(getHomeDirectory(), SliderKeys.SLIDER_BASE_DIRECTORY);
-  }
-
-  /**
-   * Get slider dependency parent dir in HDFS
-   * 
-   * @return the parent dir path of slider.tar.gz in HDFS
-   */
-  public Path getDependencyPath() {
-    String parentDir = (SliderUtils.isHdp()) ? SliderKeys.SLIDER_DEPENDENCY_HDP_PARENT_DIR
-        + SliderKeys.SLIDER_DEPENDENCY_DIR
-        : SliderKeys.SLIDER_DEPENDENCY_DIR;
-    Path dependencyPath = new Path(String.format(parentDir,
-        SliderUtils.getSliderVersion()));
-    return dependencyPath;
-  }
-
-  /**
-   * Get slider.tar.gz absolute filepath in HDFS
-   * 
-   * @return the absolute path to slider.tar.gz in HDFS
-   */
-  public Path getDependencyTarGzip() {
-    Path dependencyLibAmPath = getDependencyPath();
-    Path dependencyLibTarGzip = new Path(
-        dependencyLibAmPath.toUri().toString(),
-        SliderKeys.SLIDER_DEPENDENCY_TAR_GZ_FILE_NAME
-            + SliderKeys.SLIDER_DEPENDENCY_TAR_GZ_FILE_EXT);
-    return dependencyLibTarGzip;
-  }
-
-  public Path getHomeDirectory() {
-    return fileSystem.getHomeDirectory();
-  }
-
-  public boolean maybeAddImagePath(Map<String, LocalResource> localResources,
-                                   Path imagePath) throws IOException {
-    if (imagePath != null) {
-      LocalResource resource = createAmResource(imagePath,
-          LocalResourceType.ARCHIVE);
-      localResources.put(SliderKeys.LOCAL_TARBALL_INSTALL_SUBDIR, resource);
-      return true;
-    } else {
-      return false;
-    }
-  }
-
-  public boolean maybeAddImagePath(Map<String, LocalResource> localResources,
-                                   String imagePath) throws IOException {
-    
-    return imagePath != null &&
-           maybeAddImagePath(localResources, new Path(imagePath));
-  }
-  
-  
-  
-
-  /**
-   * Create an AM resource from the
-   *
-   * @param destPath     dest path in filesystem
-   * @param resourceType resource type
-   * @return the resource set up wih application-level visibility and the
-   * timestamp & size set from the file stats.
-   */
-  public LocalResource createAmResource(Path destPath, LocalResourceType resourceType) throws IOException {
-    FileStatus destStatus = fileSystem.getFileStatus(destPath);
-    LocalResource amResource = Records.newRecord(LocalResource.class);
-    amResource.setType(resourceType);
-    // Set visibility of the resource
-    // Setting to most private option
-    amResource.setVisibility(LocalResourceVisibility.APPLICATION);
-    // Set the resource to be copied over
-    amResource.setResource(ConverterUtils.getYarnUrlFromPath(fileSystem
-        .resolvePath(destStatus.getPath())));
-    // Set timestamp and length of file so that the framework
-    // can do basic sanity checks for the local resource
-    // after it has been copied over to ensure it is the same
-    // resource the client intended to use with the application
-    amResource.setTimestamp(destStatus.getModificationTime());
-    amResource.setSize(destStatus.getLen());
-    return amResource;
-  }
-
-  /**
-   * Register all files under a fs path as a directory to push out
-   *
-   * @param srcDir          src dir
-   * @param destRelativeDir dest dir (no trailing /)
-   * @return the map of entries
-   */
-  public Map<String, LocalResource> submitDirectory(Path srcDir, String destRelativeDir) throws IOException {
-    //now register each of the files in the directory to be
-    //copied to the destination
-    FileStatus[] fileset = fileSystem.listStatus(srcDir);
-    Map<String, LocalResource> localResources =
-            new HashMap<String, LocalResource>(fileset.length);
-    for (FileStatus entry : fileset) {
-
-      LocalResource resource = createAmResource(entry.getPath(),
-              LocalResourceType.FILE);
-      String relativePath = destRelativeDir + "/" + entry.getPath().getName();
-      localResources.put(relativePath, resource);
-    }
-    return localResources;
-  }
-
-  /**
-   * Submit a JAR containing a specific class, returning
-   * the resource to be mapped in
-   *
-   * @param clazz   class to look for
-   * @param subdir  subdirectory (expected to end in a "/")
-   * @param jarName <i>At the destination</i>
-   * @return the local resource ref
-   * @throws IOException trouble copying to HDFS
-   */
-  public LocalResource submitJarWithClass(Class clazz, Path tempPath, String subdir, String jarName)
-          throws IOException, SliderException {
-    File localFile = SliderUtils.findContainingJarOrFail(clazz);
-    return submitFile(localFile, tempPath, subdir, jarName);
-  }
-
-  /**
-   * Submit a local file to the filesystem references by the instance's cluster
-   * filesystem
-   *
-   * @param localFile    filename
-   * @param subdir       subdirectory (expected to end in a "/")
-   * @param destFileName destination filename
-   * @return the local resource ref
-   * @throws IOException trouble copying to HDFS
-   */
-  public LocalResource submitFile(File localFile, Path tempPath, String subdir, String destFileName)
-      throws IOException {
-    Path src = new Path(localFile.toString());
-    Path subdirPath = new Path(tempPath, subdir);
-    fileSystem.mkdirs(subdirPath);
-    Path destPath = new Path(subdirPath, destFileName);
-    log.debug("Copying {} (size={} bytes) to {}", localFile, localFile.length(), destPath);
-
-    fileSystem.copyFromLocalFile(false, true, src, destPath);
-
-    // Set the type of resource - file or archive
-    // archives are untarred at destination
-    // we don't need the jar file to be untarred for now
-    return createAmResource(destPath, LocalResourceType.FILE);
-  }
-
-  /**
-   * Submit the AM tar.gz resource referenced by the instance's cluster
-   * filesystem. Also, update the providerResources object with the new
-   * resource.
-   * 
-   * @param providerResources
-   *          the provider resource map to be updated
-   * @throws IOException
-   *           trouble copying to HDFS
-   */
-  public void submitTarGzipAndUpdate(
-      Map<String, LocalResource> providerResources) throws IOException,
-      BadClusterStateException {
-    Path dependencyLibTarGzip = getDependencyTarGzip();
-    LocalResource lc = createAmResource(dependencyLibTarGzip,
-        LocalResourceType.ARCHIVE);
-    providerResources.put(SliderKeys.SLIDER_DEPENDENCY_LOCALIZED_DIR_LINK, lc);
-  }
-
-  /**
-   * Copy local file(s) to destination HDFS directory. If {@code localPath} is a
-   * local directory then all files matching the {@code filenameFilter}
-   * (optional) are copied, otherwise {@code filenameFilter} is ignored.
-   * 
-   * @param localPath
-   *          a local file or directory path
-   * @param filenameFilter
-   *          if {@code localPath} is a directory then filenameFilter is used as
-   *          a filter (if specified)
-   * @param destDir
-   *          the destination HDFS directory where the file(s) should be copied
-   * @param fp
-   *          file permissions of all the directories and files that will be
-   *          created in this api
-   * @throws IOException
-   */
-  public void copyLocalFilesToHdfs(File localPath,
-      FilenameFilter filenameFilter, Path destDir, FsPermission fp)
-      throws IOException {
-    if (localPath == null || destDir == null) {
-      throw new IOException("Either localPath or destDir is null");
-    }
-    fileSystem.getConf().set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY,
-        "000");
-    fileSystem.mkdirs(destDir, fp);
-    if (localPath.isDirectory()) {
-      // copy all local files under localPath to destDir (honoring filename
-      // filter if provided
-      File[] localFiles = localPath.listFiles(filenameFilter);
-      Path[] localFilePaths = new Path[localFiles.length];
-      int i = 0;
-      for (File localFile : localFiles) {
-        localFilePaths[i++] = new Path(localFile.getPath());
-      }
-      log.info("Copying {} files from {} to {}", i, localPath.toURI(),
-          destDir.toUri());
-      fileSystem.copyFromLocalFile(false, true, localFilePaths, destDir);
-    } else {
-      log.info("Copying file {} to {}", localPath.toURI(), destDir.toUri());
-      fileSystem.copyFromLocalFile(false, true, new Path(localPath.getPath()),
-          destDir);
-    }
-    // set permissions for all the files created in the destDir
-    fileSystem.setPermission(destDir, fp);
-  }
-
-  public void copyLocalFileToHdfs(File localPath,
-      Path destPath, FsPermission fp)
-      throws IOException {
-    if (localPath == null || destPath == null) {
-      throw new IOException("Either localPath or destPath is null");
-    }
-    fileSystem.getConf().set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY,
-        "000");
-    fileSystem.mkdirs(destPath.getParent(), fp);
-    log.info("Copying file {} to {}", localPath.toURI(), destPath.toUri());
-    
-    fileSystem.copyFromLocalFile(false, true, new Path(localPath.getPath()),
-        destPath);
-    // set file permissions of the destPath
-    fileSystem.setPermission(destPath, fp);
-  }
-
-  public void copyHdfsFileToLocal(Path hdfsPath, File destFile)
-      throws IOException {
-    if (hdfsPath == null || destFile == null) {
-      throw new IOException("Either hdfsPath or destPath is null");
-    }
-    log.info("Copying file {} to {}", hdfsPath.toUri(), destFile.toURI());
-
-    Path destPath = new Path(destFile.getPath());
-    fileSystem.copyToLocalFile(hdfsPath, destPath);
-  }
-
-  /**
-   * list entries in a filesystem directory
-   *
-   * @param path directory
-   * @return a listing, one to a line
-   * @throws IOException
-   */
-  public String listFSDir(Path path) throws IOException {
-    FileStatus[] stats = fileSystem.listStatus(path);
-    StringBuilder builder = new StringBuilder();
-    for (FileStatus stat : stats) {
-      builder.append(stat.getPath().toString())
-              .append("\t")
-              .append(stat.getLen())
-              .append("\n");
-    }
-    return builder.toString();
-  }
-
-  /**
-   * List all application instances persisted for this user, giving the 
-   * path. The instance name is the last element in the path
-   * @return a possibly empty map of application instance names to paths
-   */
-  public Map<String, Path> listPersistentInstances() throws IOException {
-    FileSystem fs = getFileSystem();
-    Path path = new Path(getBaseApplicationPath(), SliderKeys.CLUSTER_DIRECTORY);
-    log.debug("Looking for all persisted application at {}", path.toString());
-    if (!fs.exists(path)) {
-      // special case: no instances have ever been created
-      return new HashMap<String, Path>(0);
-    }
-    FileStatus[] statuses = fs.listStatus(path);
-    Map<String, Path> instances = new HashMap<String, Path>(statuses.length);
-
-    // enum the child entries
-    for (FileStatus status : statuses) {
-      if (status.isDirectory()) {
-        // for directories, look for an internal.json underneath
-        Path child = status.getPath();
-        Path internalJson = new Path(child, Filenames.INTERNAL);
-        if (fs.exists(internalJson)) {
-          // success => this is an instance
-          instances.put(child.getName(), child);
-        } else {
-          log.info("Malformed cluster found at {}. It does not appear to be a valid persisted instance.",
-                   child.toString());
-        }
-      }
-    }
-    return instances;
-  }
-
-  public void touch(Path path, boolean overwrite) throws IOException {
-    FSDataOutputStream out = null;
-    try {
-      out = fileSystem.create(path, overwrite);
-    } finally {
-      IOUtils.closeStream(out);
-    }
-  }
-
-  public void cat(Path path, boolean overwrite, String data) throws IOException {
-    FSDataOutputStream out = null;
-    try {
-      out = fileSystem.create(path, overwrite);
-      byte[] bytes = data.getBytes(Charset.forName("UTF-8"));
-      out.write(bytes);
-    } finally {
-      IOUtils.closeStream(out);
-    }
-  }
-
-  public String cat(Path path) throws IOException {
-    FileStatus status = fileSystem.getFileStatus(path);
-    byte[] b = new byte[(int) status.getLen()];
-    FSDataInputStream in = null;
-    try {
-      in = fileSystem.open(path);
-      int count = in.read(b);
-      return new String(b, 0, count, UTF_8);
-    } finally {
-      IOUtils.closeStream(in);
-    }
-  }
-
-  /**
-   * Create a path that must exist in the cluster fs
-   * @param uri uri to create
-   * @return the path
-   * @throws SliderException if the path does not exist
-   */
-  public Path createPathThatMustExist(String uri) throws
-      SliderException, IOException {
-    Preconditions.checkNotNull(uri);
-    Path path = new Path(uri);
-    verifyPathExists(path);
-    return path;
-  }
-
-  /**
-   * Locate an application conf json in the FS. This includes a check to verify
-   * that the file is there.
-   *
-   * @param clustername name of the cluster
-   * @return the path to the spec.
-   * @throws IOException IO problems
-   * @throws SliderException if the path isn't there
-   */
-  public Path locateInstanceDefinition(String clustername) throws IOException,
-      SliderException {
-    Path clusterDirectory = buildClusterDirPath(clustername);
-    Path appConfPath =
-            new Path(clusterDirectory, Filenames.APPCONF);
-    verifyClusterSpecExists(clustername, appConfPath);
-    return appConfPath;
-  }
-
-  /**
-   * Verify that a cluster specification exists
-   * @param clustername name of the cluster (For errors only)
-   * @param clusterSpecPath cluster specification path
-   * @throws IOException IO problems
-   * @throws SliderException if the cluster specification is not present
-   */
-  public void verifyClusterSpecExists(String clustername, Path clusterSpecPath)
-      throws IOException,
-      SliderException {
-    if (!fileSystem.isFile(clusterSpecPath)) {
-      log.debug("Missing specification file {}", clusterSpecPath);
-      throw UnknownApplicationInstanceException.unknownInstance(
-          clustername + "\n (definition not found at " + clusterSpecPath);
-    }
-  }
-
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/tools/Duration.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/tools/Duration.java b/slider-core/src/main/java/org/apache/slider/common/tools/Duration.java
deleted file mode 100644
index e5fa424..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/tools/Duration.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.common.tools;
-
-import java.io.Closeable;
-
-/**
- * A duration in milliseconds. This class can be used
- * to count time, and to be polled to see if a time limit has
- * passed.
- */
-public class Duration implements Closeable {
-  public long start, finish;
-  public final long limit;
-
-  /**
-   * Create a duration instance with a limit of 0
-   */
-  public Duration() {
-    this(0);
-  }
-
-  /**
-   * Create a duration with a limit specified in millis
-   * @param limit duration in milliseconds
-   */
-  public Duration(long limit) {
-    this.limit = limit;
-  }
-
-  /**
-   * Start
-   * @return self
-   */
-  public Duration start() {
-    start = now();
-    return this;
-  }
-
-  /**
-   * The close operation relays to {@link #finish()}.
-   * Implementing it allows Duration instances to be automatically
-   * finish()'d in Java7 try blocks for when used in measuring durations.
-   */
-  @Override
-  public final void close() {
-    finish();
-  }
-
-  public void finish() {
-    finish = now();
-  }
-
-  protected long now() {
-    return System.nanoTime()/1000000;
-  }
-
-  public long getInterval() {
-    return finish - start;
-  }
-
-  /**
-   * return true if the limit has been exceeded
-   * @return true if a limit was set and the current time
-   * exceeds it.
-   */
-  public boolean getLimitExceeded() {
-    return limit >= 0 && ((now() - start) > limit);
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder builder = new StringBuilder();
-    builder.append("Duration");
-     if (finish >= start) {
-       builder.append(" finished at ").append(getInterval()).append(" millis;");
-     } else {
-       if (start > 0) {
-         builder.append(" started but not yet finished;");
-       } else {
-         builder.append(" unstarted;");
-       }
-     }
-    if (limit > 0) {
-      builder.append(" limit: ").append(limit).append(" millis");
-      if (getLimitExceeded()) {
-        builder.append(" -  exceeded");
-      }
-    }
-    return  builder.toString();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/tools/PortScanner.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/tools/PortScanner.java b/slider-core/src/main/java/org/apache/slider/common/tools/PortScanner.java
deleted file mode 100644
index 64783b6..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/tools/PortScanner.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.common.tools;
-
-import org.apache.slider.common.SliderExitCodes;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.exceptions.SliderException;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * a scanner which can take an input string for a range or scan the lot.
- */
-public class PortScanner {
-  private static Pattern NUMBER_RANGE = Pattern.compile("^(\\d+)\\s*-\\s*(\\d+)$");
-  private static Pattern SINGLE_NUMBER = Pattern.compile("^\\d+$");
-
-  private List<Integer> remainingPortsToCheck;
-
-  public PortScanner() {
-  }
-
-  public void setPortRange(String input) throws BadConfigException {
-    // first split based on commas
-    Set<Integer> inputPorts= new TreeSet<Integer>();
-    String[] ranges = input.split(",");
-    for ( String range : ranges ) {
-      if (range.trim().isEmpty()) {
-        continue;
-      }
-      Matcher m = SINGLE_NUMBER.matcher(range.trim());
-      if (m.find()) {
-        inputPorts.add(Integer.parseInt(m.group()));
-        continue;
-      }
-      m = NUMBER_RANGE.matcher(range.trim());
-      if (m.find()) {
-        String[] boundaryValues = m.group(0).split("-");
-        int start = Integer.parseInt(boundaryValues[0].trim());
-        int end = Integer.parseInt(boundaryValues[1].trim());
-        if (end < start) {
-          throw new BadConfigException("End of port range is before start: "
-              + range + " in input: " + input);
-        }
-        for (int i = start; i < end + 1; i++) {
-          inputPorts.add(i);
-        }
-        continue;
-      }
-      throw new BadConfigException("Bad port range: " + range + " in input: "
-          + input);
-    }
-    if (inputPorts.size() == 0) {
-      throw new BadConfigException("No ports found in range: " + input);
-    }
-    this.remainingPortsToCheck = new ArrayList<Integer>(inputPorts);
-  }
-
-  public List<Integer> getRemainingPortsToCheck() {
-    return remainingPortsToCheck;
-  }
-
-  public int getAvailablePort() throws SliderException, IOException {
-    if (remainingPortsToCheck != null) {
-      return getAvailablePortViaPortArray();
-    } else {
-      return SliderUtils.getOpenPort();
-    }
-  }
-
-  private int getAvailablePortViaPortArray() throws SliderException {
-    boolean found = false;
-    int availablePort = -1;
-    Iterator<Integer> portsToCheck = this.remainingPortsToCheck.iterator();
-    while (portsToCheck.hasNext() && !found) {
-      int portToCheck = portsToCheck.next();
-      found = SliderUtils.isPortAvailable(portToCheck);
-      if (found) {
-        availablePort = portToCheck;
-        portsToCheck.remove();
-      }
-    }
-
-    if (availablePort < 0) {
-      throw new SliderException(SliderExitCodes.EXIT_BAD_CONFIGURATION,
-        "No available ports found in configured range {}",
-        remainingPortsToCheck);
-    }
-
-    return availablePort;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/tools/SliderFileSystem.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/tools/SliderFileSystem.java b/slider-core/src/main/java/org/apache/slider/common/tools/SliderFileSystem.java
deleted file mode 100644
index 294f37e..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/tools/SliderFileSystem.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.tools;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-
-import java.io.IOException;
-
-/**
- * Extends Core Filesystem with operations to manipulate ClusterDescription
- * persistent state
- */
-public class SliderFileSystem extends CoreFileSystem {
-
-  public SliderFileSystem(FileSystem fileSystem,
-      Configuration configuration) {
-    super(fileSystem, configuration);
-  }
-
-  public SliderFileSystem(Configuration configuration) throws IOException {
-    super(configuration);
-  }
-
-
-}


[45/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/51c2b92c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/51c2b92c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/51c2b92c

Branch: refs/heads/yarn-native-services
Commit: 51c2b92c953ab8533ff8d17900f890649066db4e
Parents: 50db94c
Author: Gour Saha <go...@apache.org>
Authored: Thu Aug 25 10:23:33 2016 -0700
Committer: Gour Saha <go...@apache.org>
Committed: Thu Aug 25 10:23:33 2016 -0700

----------------------------------------------------------------------
 app-packages/accumulo/pom.xml                   |     2 +-
 .../command-logger/application-pkg/pom.xml      |     2 +-
 app-packages/command-logger/slider-pkg/pom.xml  |     2 +-
 app-packages/hbase-nopkg/pom.xml                |     2 +-
 app-packages/hbase-win/pom.xml                  |     2 +-
 app-packages/hbase/pom.xml                      |     2 +-
 app-packages/kafka/pom.xml                      |     2 +-
 app-packages/pom.xml                            |     2 +-
 app-packages/storm-win/pom.xml                  |     2 +-
 app-packages/storm/pom.xml                      |     2 +-
 app-packages/tomcat-test-war/pom.xml            |     2 +-
 app-packages/tomcat/pom.xml                     |     2 +-
 pom.xml                                         |    29 +-
 slider-agent/pom.xml                            |     2 +-
 slider-assembly/pom.xml                         |     8 +-
 slider-core/pom.xml                             |    37 +-
 .../slider/server/avro/RoleHistoryRecord.avsc   |   114 -
 .../apache/hadoop/security/KerberosDiags.java   |   676 -
 .../src/main/java/org/apache/slider/Slider.java |    52 -
 .../apache/slider/api/ClusterDescription.java   |   795 -
 .../slider/api/ClusterDescriptionKeys.java      |    25 -
 .../api/ClusterDescriptionOperations.java       |    93 -
 .../java/org/apache/slider/api/ClusterNode.java |   220 -
 .../org/apache/slider/api/InternalKeys.java     |   199 -
 .../java/org/apache/slider/api/OptionKeys.java  |    58 -
 .../org/apache/slider/api/ResourceKeys.java     |   201 -
 .../java/org/apache/slider/api/RoleKeys.java    |   121 -
 .../apache/slider/api/SliderApplicationApi.java |   167 -
 .../slider/api/SliderClusterProtocol.java       |   179 -
 .../java/org/apache/slider/api/StateValues.java |    53 -
 .../java/org/apache/slider/api/StatusKeys.java  |   117 -
 .../org/apache/slider/api/proto/Messages.java   | 34473 -----------------
 .../slider/api/proto/RestTypeMarshalling.java   |   319 -
 .../slider/api/proto/SliderClusterAPI.java      |  2293 --
 .../types/ApplicationLivenessInformation.java   |    53 -
 .../slider/api/types/ComponentInformation.java  |   107 -
 .../slider/api/types/ContainerInformation.java  |    58 -
 .../slider/api/types/NodeEntryInformation.java  |    78 -
 .../slider/api/types/NodeInformation.java       |    59 -
 .../slider/api/types/NodeInformationList.java   |    41 -
 .../slider/api/types/PingInformation.java       |    47 -
 .../apache/slider/api/types/RoleStatistics.java |    66 -
 .../api/types/SliderInstanceDescription.java    |    54 -
 .../slider/client/ClientRegistryBinder.java     |   201 -
 .../org/apache/slider/client/ClientUtils.java   |   111 -
 .../org/apache/slider/client/SliderClient.java  |  4572 ---
 .../apache/slider/client/SliderClientAPI.java   |   368 -
 .../slider/client/SliderYarnClientImpl.java     |   410 -
 .../apache/slider/client/TokensOperation.java   |   109 -
 .../client/ipc/SliderApplicationIpcClient.java  |   245 -
 .../client/ipc/SliderClusterOperations.java     |   529 -
 .../slider/client/rest/BaseRestClient.java      |   152 -
 .../slider/client/rest/RestClientFactory.java   |    89 -
 .../rest/SliderApplicationApiRestClient.java    |   326 -
 .../org/apache/slider/common/Constants.java     |    35 -
 .../apache/slider/common/SliderExitCodes.java   |    88 -
 .../org/apache/slider/common/SliderKeys.java    |   291 -
 .../common/SliderXMLConfKeysForTesting.java     |    83 -
 .../apache/slider/common/SliderXmlConfKeys.java |   206 -
 .../common/params/AbstractActionArgs.java       |   178 -
 .../common/params/AbstractArgsDelegate.java     |    26 -
 .../AbstractClusterBuildingActionArgs.java      |   217 -
 .../common/params/ActionAMSuicideArgs.java      |    44 -
 .../slider/common/params/ActionBuildArgs.java   |    32 -
 .../slider/common/params/ActionClientArgs.java  |    98 -
 .../slider/common/params/ActionCreateArgs.java  |    59 -
 .../common/params/ActionDependencyArgs.java     |    65 -
 .../slider/common/params/ActionDestroyArgs.java |    37 -
 .../common/params/ActionDiagnosticArgs.java     |    73 -
 .../slider/common/params/ActionEchoArgs.java    |    33 -
 .../slider/common/params/ActionExistsArgs.java  |    47 -
 .../slider/common/params/ActionFlexArgs.java    |    54 -
 .../slider/common/params/ActionFreezeArgs.java  |    56 -
 .../slider/common/params/ActionHelpArgs.java    |    51 -
 .../common/params/ActionInstallKeytabArgs.java  |    57 -
 .../common/params/ActionInstallPackageArgs.java |    58 -
 .../slider/common/params/ActionKDiagArgs.java   |    86 -
 .../slider/common/params/ActionKeytabArgs.java  |    81 -
 .../common/params/ActionKillContainerArgs.java  |    37 -
 .../slider/common/params/ActionListArgs.java    |    74 -
 .../slider/common/params/ActionLookupArgs.java  |    76 -
 .../slider/common/params/ActionNodesArgs.java   |    71 -
 .../slider/common/params/ActionPackageArgs.java |    81 -
 .../common/params/ActionRegistryArgs.java       |   218 -
 .../slider/common/params/ActionResolveArgs.java |   153 -
 .../common/params/ActionResourceArgs.java       |    68 -
 .../slider/common/params/ActionStatusArgs.java  |    45 -
 .../slider/common/params/ActionThawArgs.java    |    61 -
 .../slider/common/params/ActionTokensArgs.java  |    78 -
 .../slider/common/params/ActionUpdateArgs.java  |    32 -
 .../slider/common/params/ActionUpgradeArgs.java |    73 -
 .../slider/common/params/ActionVersionArgs.java |    46 -
 .../slider/common/params/AddonArgsDelegate.java |    54 -
 .../params/AppAndResouceOptionArgsDelegate.java |   111 -
 .../org/apache/slider/common/params/ArgOps.java |   157 -
 .../apache/slider/common/params/Arguments.java  |   162 -
 .../apache/slider/common/params/ClientArgs.java |   385 -
 .../apache/slider/common/params/CommonArgs.java |   303 -
 .../common/params/ComponentArgsDelegate.java    |    52 -
 .../common/params/DontSplitArguments.java       |    34 -
 .../common/params/LaunchArgsAccessor.java       |    30 -
 .../common/params/LaunchArgsDelegate.java       |    51 -
 .../common/params/PathArgumentConverter.java    |    34 -
 .../slider/common/params/SliderAMArgs.java      |    57 -
 .../common/params/SliderAMCreateAction.java     |    74 -
 .../slider/common/params/SliderActions.java     |   113 -
 .../common/params/URIArgumentConverter.java     |    40 -
 .../common/params/URLArgumentConverter.java     |    40 -
 .../slider/common/params/WaitArgsDelegate.java  |    42 -
 .../slider/common/params/WaitTimeAccessor.java  |    24 -
 .../apache/slider/common/tools/Comparators.java |    69 -
 .../slider/common/tools/ConfigHelper.java       |   658 -
 .../slider/common/tools/CoreFileSystem.java     |   915 -
 .../apache/slider/common/tools/Duration.java    |   109 -
 .../apache/slider/common/tools/PortScanner.java |   113 -
 .../slider/common/tools/SliderFileSystem.java   |    42 -
 .../apache/slider/common/tools/SliderUtils.java |  2636 --
 .../slider/common/tools/SliderVersionInfo.java  |   108 -
 .../apache/slider/core/build/BuildHelper.java   |    48 -
 .../slider/core/build/InstanceBuilder.java      |   517 -
 .../apache/slider/core/build/InstanceIO.java    |    83 -
 .../conf/AbstractInputPropertiesValidator.java  |    49 -
 .../apache/slider/core/conf/AggregateConf.java  |   198 -
 .../org/apache/slider/core/conf/ConfTree.java   |   114 -
 .../slider/core/conf/ConfTreeOperations.java    |   527 -
 .../core/conf/InputPropertiesValidator.java     |    27 -
 .../apache/slider/core/conf/MapOperations.java  |   344 -
 .../conf/ResourcesInputPropertiesValidator.java |    41 -
 .../conf/TemplateInputPropertiesValidator.java  |    38 -
 .../exceptions/BadClusterStateException.java    |    35 -
 .../BadCommandArgumentsException.java           |    30 -
 .../core/exceptions/BadConfigException.java     |    39 -
 .../slider/core/exceptions/ErrorStrings.java    |    57 -
 .../core/exceptions/ExceptionConverter.java     |   128 -
 .../core/exceptions/NoSuchNodeException.java    |    32 -
 .../core/exceptions/NotFoundException.java      |    35 -
 .../exceptions/ServiceNotReadyException.java    |    43 -
 .../slider/core/exceptions/SliderException.java |    67 -
 .../SliderInternalStateException.java           |    34 -
 .../TriggerClusterTeardownException.java        |    41 -
 .../UnknownApplicationInstanceException.java    |    51 -
 .../slider/core/exceptions/UsageException.java  |    34 -
 .../core/exceptions/WaitTimeoutException.java   |    34 -
 .../slider/core/launch/AbstractLauncher.java    |   528 -
 .../slider/core/launch/AppMasterLauncher.java   |   233 -
 .../core/launch/ClasspathConstructor.java       |   172 -
 .../slider/core/launch/CommandLineBuilder.java  |   104 -
 .../slider/core/launch/ContainerLauncher.java   |    72 -
 .../slider/core/launch/CredentialUtils.java     |   379 -
 .../core/launch/JavaCommandLineBuilder.java     |   182 -
 .../slider/core/launch/LaunchedApplication.java |   108 -
 .../slider/core/launch/RunningApplication.java  |    76 -
 .../launch/SerializedApplicationReport.java     |    98 -
 .../slider/core/main/ExitCodeProvider.java      |    32 -
 .../org/apache/slider/core/main/IrqHandler.java |   103 -
 .../slider/core/main/LauncherExitCodes.java     |   196 -
 .../org/apache/slider/core/main/RunService.java |    62 -
 .../core/main/ServiceLaunchException.java       |    73 -
 .../slider/core/main/ServiceLauncher.java       |   642 -
 .../slider/core/main/ServiceShutdownHook.java   |    80 -
 .../core/persist/AggregateConfSerDeser.java     |    55 -
 .../core/persist/AppDefinitionPersister.java    |   260 -
 .../core/persist/ApplicationReportSerDeser.java |    57 -
 .../slider/core/persist/ConfPersister.java      |   286 -
 .../slider/core/persist/ConfTreeSerDeser.java   |    54 -
 .../apache/slider/core/persist/Filenames.java   |    28 -
 .../slider/core/persist/InstancePaths.java      |    58 -
 .../slider/core/persist/JsonSerDeser.java       |   243 -
 .../persist/LockAcquireFailedException.java     |    40 -
 .../slider/core/persist/LockHeldAction.java     |    38 -
 .../apache/slider/core/persist/PersistKeys.java |    25 -
 .../core/registry/SliderRegistryUtils.java      |    62 -
 .../slider/core/registry/YarnAppListClient.java |   189 -
 .../core/registry/docstore/ConfigFormat.java    |    60 -
 .../core/registry/docstore/ConfigUtils.java     |    96 -
 .../docstore/ConfigurationResolver.java         |    24 -
 .../core/registry/docstore/ExportEntry.java     |   120 -
 .../registry/docstore/PublishedConfigSet.java   |   100 -
 .../docstore/PublishedConfiguration.java        |   196 -
 .../PublishedConfigurationOutputter.java        |   210 -
 .../registry/docstore/PublishedExports.java     |   140 -
 .../docstore/PublishedExportsOutputter.java     |   104 -
 .../registry/docstore/PublishedExportsSet.java  |    98 -
 .../slider/core/registry/docstore/UriMap.java   |    38 -
 .../registry/info/CustomRegistryConstants.java  |    57 -
 .../core/registry/retrieve/AMWebClient.java     |   158 -
 .../registry/retrieve/RegistryRetriever.java    |   183 -
 .../core/restclient/HttpOperationResponse.java  |    34 -
 .../apache/slider/core/restclient/HttpVerb.java |    57 -
 .../restclient/SliderURLConnectionFactory.java  |   176 -
 .../core/restclient/UgiJerseyBinding.java       |   154 -
 .../restclient/UrlConnectionOperations.java     |   210 -
 .../slider/core/zk/BlockingZKWatcher.java       |    67 -
 .../slider/core/zk/MiniZooKeeperCluster.java    |   423 -
 .../org/apache/slider/core/zk/ZKCallback.java   |    31 -
 .../apache/slider/core/zk/ZKIntegration.java    |   323 -
 .../apache/slider/core/zk/ZKPathBuilder.java    |    82 -
 .../apache/slider/core/zk/ZookeeperUtils.java   |   147 -
 .../providers/AbstractClientProvider.java       |   248 -
 .../providers/AbstractProviderService.java      |   425 -
 .../apache/slider/providers/MonitorDetail.java  |    43 -
 .../slider/providers/PlacementPolicy.java       |    64 -
 .../providers/PlacementPolicyOptions.java       |    26 -
 .../slider/providers/ProviderCompleted.java     |    29 -
 .../providers/ProviderCompletedCallable.java    |    38 -
 .../apache/slider/providers/ProviderCore.java   |    43 -
 .../apache/slider/providers/ProviderRole.java   |   135 -
 .../slider/providers/ProviderService.java       |   219 -
 .../apache/slider/providers/ProviderUtils.java  |   530 -
 .../slider/providers/SliderProviderFactory.java |   110 -
 .../providers/agent/AgentClientProvider.java    |   706 -
 .../slider/providers/agent/AgentKeys.java       |   112 -
 .../providers/agent/AgentLaunchParameter.java   |   130 -
 .../providers/agent/AgentProviderFactory.java   |    47 -
 .../providers/agent/AgentProviderService.java   |  3320 --
 .../slider/providers/agent/AgentRoles.java      |    38 -
 .../slider/providers/agent/AgentUtils.java      |   150 -
 .../apache/slider/providers/agent/Command.java  |    59 -
 .../slider/providers/agent/CommandResult.java   |    40 -
 .../providers/agent/ComponentCommandOrder.java  |   225 -
 .../providers/agent/ComponentInstanceState.java |   340 -
 .../providers/agent/ComponentTagProvider.java   |   127 -
 .../slider/providers/agent/ContainerState.java  |    41 -
 .../providers/agent/HeartbeatMonitor.java       |   130 -
 .../apache/slider/providers/agent/State.java    |   199 -
 .../application/metadata/AbstractComponent.java |    80 -
 .../metadata/AbstractMetainfoParser.java        |   130 -
 .../metadata/AbstractMetainfoSchema.java        |    69 -
 .../metadata/AddonPackageMetainfoParser.java    |    53 -
 .../agent/application/metadata/Application.java |   193 -
 .../metadata/ApplicationPackage.java            |    69 -
 .../application/metadata/CommandOrder.java      |    61 -
 .../application/metadata/CommandScript.java     |    72 -
 .../agent/application/metadata/Component.java   |   217 -
 .../application/metadata/ComponentCommand.java  |    85 -
 .../application/metadata/ComponentExport.java   |    54 -
 .../metadata/ComponentsInAddonPackage.java      |    26 -
 .../agent/application/metadata/ConfigFile.java  |    59 -
 .../application/metadata/DefaultConfig.java     |    39 -
 .../metadata/DefaultConfigParser.java           |    54 -
 .../application/metadata/DockerContainer.java   |   187 -
 .../metadata/DockerContainerInputFile.java      |    50 -
 .../metadata/DockerContainerMount.java          |    60 -
 .../metadata/DockerContainerPort.java           |    66 -
 .../agent/application/metadata/Export.java      |    61 -
 .../agent/application/metadata/ExportGroup.java |    71 -
 .../agent/application/metadata/Metainfo.java    |   118 -
 .../application/metadata/MetainfoParser.java    |    97 -
 .../agent/application/metadata/OSPackage.java   |    51 -
 .../agent/application/metadata/OSSpecific.java  |    57 -
 .../agent/application/metadata/Package.java     |    60 -
 .../application/metadata/PropertyInfo.java      |    54 -
 .../agent/application/metadata/Validate.java    |    27 -
 .../org/apache/slider/providers/agent/todo.md   |    22 -
 .../slideram/SliderAMClientProvider.java        |   304 -
 .../slideram/SliderAMProviderService.java       |   189 -
 .../appmaster/AppMasterActionOperations.java    |    29 -
 .../server/appmaster/PrivilegedConnectToCM.java |    48 -
 .../appmaster/ProtobufClusterServices.java      |    36 -
 .../server/appmaster/PublishedArtifacts.java    |    31 -
 .../server/appmaster/RoleLaunchService.java     |   257 -
 .../server/appmaster/SliderAppMaster.java       |  2451 --
 .../appmaster/actions/ActionFlexCluster.java    |    44 -
 .../server/appmaster/actions/ActionHalt.java    |    53 -
 .../appmaster/actions/ActionKillContainer.java  |    86 -
 .../actions/ActionRegisterServiceInstance.java  |    59 -
 .../appmaster/actions/ActionStartContainer.java |    62 -
 .../appmaster/actions/ActionStopQueue.java      |    56 -
 .../appmaster/actions/ActionStopSlider.java     |   162 -
 .../actions/ActionUpgradeContainers.java        |   106 -
 .../server/appmaster/actions/AsyncAction.java   |   138 -
 .../actions/EscalateOutstandingRequests.java    |    45 -
 .../actions/ProviderReportedContainerLoss.java  |    53 -
 .../actions/ProviderStartupCompleted.java       |    36 -
 .../server/appmaster/actions/QueueAccess.java   |    72 -
 .../server/appmaster/actions/QueueExecutor.java |    90 -
 .../server/appmaster/actions/QueueService.java  |   202 -
 .../actions/RegisterComponentInstance.java      |    59 -
 .../appmaster/actions/RenewingAction.java       |   141 -
 .../appmaster/actions/ResetFailureWindow.java   |    39 -
 .../actions/ReviewAndFlexApplicationSize.java   |    43 -
 .../actions/UnregisterComponentInstance.java    |    51 -
 .../server/appmaster/management/BoolMetric.java |    87 -
 .../management/BoolMetricPredicate.java         |    44 -
 .../server/appmaster/management/LongGauge.java  |    98 -
 .../management/LongMetricFunction.java          |    44 -
 .../appmaster/management/MeterAndCounter.java   |   109 -
 .../management/MetricsAndMonitoring.java        |   195 -
 .../management/MetricsBindingService.java       |   151 -
 .../appmaster/management/MetricsConstants.java  |    58 -
 .../appmaster/management/MetricsKeys.java       |    92 -
 .../management/PrefixedMetricsSet.java          |    53 -
 .../management/RangeLimitedCounter.java         |    85 -
 .../appmaster/management/RecordedEvent.java     |    58 -
 .../server/appmaster/management/Timestamp.java  |    33 -
 .../management/YarnServiceHealthCheck.java      |    38 -
 .../server/appmaster/monkey/ChaosEntry.java     |    85 -
 .../server/appmaster/monkey/ChaosKillAM.java    |    48 -
 .../appmaster/monkey/ChaosKillContainer.java    |    84 -
 .../appmaster/monkey/ChaosMonkeyService.java    |   138 -
 .../server/appmaster/monkey/ChaosTarget.java    |    24 -
 .../appmaster/monkey/MonkeyPlayAction.java      |    48 -
 .../operations/AbstractRMOperation.java         |    30 -
 .../operations/AsyncRMOperationHandler.java     |   110 -
 .../operations/CancelSingleRequest.java         |    54 -
 .../operations/ContainerReleaseOperation.java   |    47 -
 .../operations/ContainerRequestOperation.java   |    62 -
 .../ProviderNotifyingOperationHandler.java      |    55 -
 .../operations/RMOperationHandler.java          |    32 -
 .../operations/RMOperationHandlerActions.java   |    60 -
 .../slider/server/appmaster/rpc/RpcBinder.java  |   310 -
 .../appmaster/rpc/SliderAMPolicyProvider.java   |    41 -
 .../appmaster/rpc/SliderClusterProtocolPB.java  |    27 -
 .../rpc/SliderClusterProtocolPBImpl.java        |   318 -
 .../rpc/SliderClusterProtocolProxy.java         |   358 -
 .../server/appmaster/rpc/SliderIPCService.java  |   551 -
 .../appmaster/rpc/SliderRPCSecurityInfo.java    |    87 -
 .../security/SecurityConfiguration.java         |   162 -
 .../state/AbstractClusterServices.java          |    61 -
 .../slider/server/appmaster/state/AppState.java |  2494 --
 .../appmaster/state/AppStateBindingInfo.java    |    63 -
 .../state/ContainerAllocationOutcome.java       |    44 -
 .../state/ContainerAllocationResults.java       |    50 -
 .../appmaster/state/ContainerAssignment.java    |    60 -
 .../appmaster/state/ContainerOutcome.java       |    61 -
 .../appmaster/state/ContainerPriority.java      |   109 -
 .../state/ContainerReleaseSelector.java         |    37 -
 .../MostRecentContainerReleaseSelector.java     |    51 -
 .../server/appmaster/state/NodeEntry.java       |   325 -
 .../server/appmaster/state/NodeInstance.java    |   409 -
 .../slider/server/appmaster/state/NodeMap.java  |   174 -
 .../appmaster/state/OutstandingRequest.java     |   428 -
 .../state/OutstandingRequestTracker.java        |   482 -
 .../appmaster/state/ProviderAppState.java       |   307 -
 .../server/appmaster/state/RoleHistory.java     |  1101 -
 .../appmaster/state/RoleHistoryUtils.java       |    50 -
 .../appmaster/state/RoleHostnamePair.java       |    75 -
 .../server/appmaster/state/RoleInstance.java    |   323 -
 .../server/appmaster/state/RoleStatus.java      |   563 -
 .../appmaster/state/SimpleReleaseSelector.java  |    33 -
 .../state/StateAccessForProviders.java          |   313 -
 .../server/appmaster/web/AgentService.java      |    37 -
 .../server/appmaster/web/HttpCacheHeaders.java  |    35 -
 .../appmaster/web/SliderAMController.java       |    69 -
 .../server/appmaster/web/SliderAMWebApp.java    |   108 -
 .../web/SliderDefaultWrapperServlet.java        |    48 -
 .../slider/server/appmaster/web/WebAppApi.java  |    95 -
 .../server/appmaster/web/WebAppApiImpl.java     |   128 -
 .../server/appmaster/web/layout/AppLayout.java  |    32 -
 .../web/layout/ClusterSpecificationView.java    |    32 -
 .../web/layout/ContainerStatsView.java          |    33 -
 .../appmaster/web/layout/WebUILayout.java       |    43 -
 .../appmaster/web/rest/AMWadlGenerator.java     |    72 -
 .../web/rest/AMWadlGeneratorConfig.java         |    34 -
 .../appmaster/web/rest/AMWebServices.java       |    72 -
 .../web/rest/AbstractSliderResource.java        |   157 -
 .../appmaster/web/rest/InsecureAmFilter.java    |   105 -
 .../web/rest/InsecureAmFilterInitializer.java   |   102 -
 .../server/appmaster/web/rest/RestPaths.java    |   172 -
 .../web/rest/SliderJacksonJaxbJsonProvider.java |    58 -
 .../web/rest/agent/AgentCommandType.java        |    23 -
 .../appmaster/web/rest/agent/AgentEnv.java      |   376 -
 .../appmaster/web/rest/agent/AgentResource.java |   118 -
 .../web/rest/agent/AgentRestOperations.java     |    28 -
 .../appmaster/web/rest/agent/AgentWebApp.java   |   258 -
 .../web/rest/agent/AgentWebServices.java        |    40 -
 .../appmaster/web/rest/agent/CommandReport.java |   207 -
 .../web/rest/agent/ComponentStatus.java         |   129 -
 .../appmaster/web/rest/agent/DiskInfo.java      |   128 -
 .../web/rest/agent/ExecutionCommand.java        |   310 -
 .../appmaster/web/rest/agent/HeartBeat.java     |   149 -
 .../web/rest/agent/HeartBeatResponse.java       |   147 -
 .../appmaster/web/rest/agent/HostInfo.java      |   398 -
 .../appmaster/web/rest/agent/HostStatus.java    |    63 -
 .../appmaster/web/rest/agent/Register.java      |   193 -
 .../web/rest/agent/RegistrationCommand.java     |    43 -
 .../web/rest/agent/RegistrationResponse.java    |   133 -
 .../web/rest/agent/RegistrationStatus.java      |    22 -
 .../appmaster/web/rest/agent/StatusCommand.java |   152 -
 .../ApplicationResouceContentCacheFactory.java  |    63 -
 .../rest/application/ApplicationResource.java   |   516 -
 .../application/actions/RestActionPing.java     |    50 -
 .../application/actions/RestActionStop.java     |    67 -
 .../rest/application/actions/StopResponse.java  |    29 -
 .../web/rest/application/package-info.java      |    24 -
 .../resources/AggregateModelRefresher.java      |    47 -
 .../application/resources/AppconfRefresher.java |    55 -
 .../application/resources/CachedContent.java    |   121 -
 .../application/resources/ContentCache.java     |    67 -
 .../resources/LiveComponentsRefresher.java      |    39 -
 .../resources/LiveContainersRefresher.java      |    52 -
 .../resources/LiveNodesRefresher.java           |    41 -
 .../resources/LiveResourcesRefresher.java       |    68 -
 .../resources/LiveStatisticsRefresher.java      |    39 -
 .../resources/ResourceRefresher.java            |    31 -
 .../resources/ResourceSnapshotRefresher.java    |    40 -
 .../web/rest/management/ManagementResource.java |    93 -
 .../management/resources/ActionsResource.java   |    22 -
 .../resources/AggregateConfResource.java        |    90 -
 .../management/resources/ComponentResource.java |    53 -
 .../management/resources/ConfTreeResource.java  |    69 -
 .../management/resources/ResourceFactory.java   |    47 -
 .../web/rest/publisher/PublisherResource.java   |   273 -
 .../web/rest/registry/PathEntryResource.java    |    45 -
 .../web/rest/registry/RegistryResource.java     |   151 -
 .../web/view/ClusterSpecificationBlock.java     |    55 -
 .../appmaster/web/view/ContainerStatsBlock.java |   282 -
 .../server/appmaster/web/view/IndexBlock.java   |   305 -
 .../server/appmaster/web/view/NavBlock.java     |    62 -
 .../appmaster/web/view/SliderHamletBlock.java   |    56 -
 .../slider/server/avro/LoadedRoleHistory.java   |    92 -
 .../slider/server/avro/NewerFilesFirst.java     |    43 -
 .../slider/server/avro/OlderFilesFirst.java     |    43 -
 .../slider/server/avro/RoleHistoryWriter.java   |   449 -
 .../slider/server/servicemonitor/HttpProbe.java |    82 -
 .../server/servicemonitor/LogEntryBuilder.java  |    76 -
 .../server/servicemonitor/MonitorKeys.java      |   279 -
 .../server/servicemonitor/MonitorUtils.java     |   109 -
 .../slider/server/servicemonitor/PortProbe.java |   107 -
 .../slider/server/servicemonitor/Probe.java     |   107 -
 .../servicemonitor/ProbeFailedException.java    |    32 -
 .../ProbeInterruptedException.java              |    29 -
 .../server/servicemonitor/ProbePhase.java       |    56 -
 .../servicemonitor/ProbeReportHandler.java      |    79 -
 .../server/servicemonitor/ProbeStatus.java      |   173 -
 .../server/servicemonitor/ProbeWorker.java      |   446 -
 .../server/servicemonitor/ReportingLoop.java    |   265 -
 .../servicemonitor/YarnApplicationProbe.java    |    90 -
 .../AbstractSecurityStoreGenerator.java         |    98 -
 .../services/security/CertificateManager.java   |   495 -
 .../services/security/KeystoreGenerator.java    |    64 -
 .../server/services/security/SecurityStore.java |    66 -
 .../security/SecurityStoreGenerator.java        |    40 -
 .../server/services/security/SecurityUtils.java |   256 -
 .../services/security/SignCertResponse.java     |    67 -
 .../server/services/security/SignMessage.java   |    54 -
 .../services/security/StoresGenerator.java      |    68 -
 .../services/security/TruststoreGenerator.java  |    62 -
 .../utility/AbstractSliderLaunchedService.java  |   120 -
 .../services/utility/EndOfServiceWaiter.java    |    87 -
 .../LaunchedWorkflowCompositeService.java       |   117 -
 .../services/utility/PatternValidator.java      |    61 -
 .../server/services/utility/WebAppService.java  |    69 -
 .../services/workflow/ClosingService.java       |    94 -
 .../services/workflow/ForkedProcessService.java |   301 -
 .../services/workflow/LongLivedProcess.java     |   598 -
 .../LongLivedProcessLifecycleEvent.java         |    41 -
 .../server/services/workflow/ServiceParent.java |    44 -
 .../workflow/ServiceTerminatingCallable.java    |    92 -
 .../workflow/ServiceTerminatingRunnable.java    |    72 -
 .../services/workflow/ServiceThreadFactory.java |   102 -
 .../workflow/WorkflowCallbackService.java       |   113 -
 .../workflow/WorkflowCompositeService.java      |   167 -
 .../workflow/WorkflowExecutorService.java       |   113 -
 .../services/workflow/WorkflowRpcService.java   |    76 -
 .../WorkflowScheduledExecutorService.java       |    38 -
 .../workflow/WorkflowSequenceService.java       |   306 -
 .../server/services/workflow/package-info.java  |   172 -
 .../YarnRegistryViewForProviders.java           |   270 -
 .../src/main/proto/SliderClusterMessages.proto  |   396 -
 .../src/main/proto/SliderClusterProtocol.proto  |   184 -
 .../org.apache.hadoop.security.SecurityInfo     |    15 -
 .../org/apache/slider/log4j.properties          |    52 -
 .../slider/providers/agent/conf/agent.txt       |    19 -
 .../slider/providers/agent/conf/command.json    |   168 -
 .../providers/agent/conf/command_template.json  |   168 -
 .../apache/slider/providers/agent/role-node.xml |    65 -
 .../providers/dynamic/application.properties    |    25 -
 .../providers/slideram/instance/appconf.json    |    19 -
 .../providers/slideram/instance/internal.json   |    17 -
 .../providers/slideram/instance/resources.json  |    18 -
 .../main/resources/org/apache/slider/slider.xml |    30 -
 .../main/resources/webapps/slideragent/.keep    |     0
 .../src/main/resources/webapps/slideram/.keep   |     0
 .../webapps/static/dt-1.9.4/css/demo_page.css   |    93 -
 .../webapps/static/dt-1.9.4/css/demo_table.css  |   538 -
 .../webapps/static/dt-1.9.4/css/jui-dt.css      |   322 -
 .../static/dt-1.9.4/images/back_disabled.jpg    |   Bin 612 -> 0 bytes
 .../static/dt-1.9.4/images/back_enabled.jpg     |   Bin 807 -> 0 bytes
 .../webapps/static/dt-1.9.4/images/favicon.ico  |   Bin 894 -> 0 bytes
 .../static/dt-1.9.4/images/forward_disabled.jpg |   Bin 635 -> 0 bytes
 .../static/dt-1.9.4/images/forward_enabled.jpg  |   Bin 852 -> 0 bytes
 .../webapps/static/dt-1.9.4/images/sort_asc.png |   Bin 263 -> 0 bytes
 .../dt-1.9.4/images/sort_asc_disabled.png       |   Bin 252 -> 0 bytes
 .../static/dt-1.9.4/images/sort_both.png        |   Bin 282 -> 0 bytes
 .../static/dt-1.9.4/images/sort_desc.png        |   Bin 260 -> 0 bytes
 .../dt-1.9.4/images/sort_desc_disabled.png      |   Bin 251 -> 0 bytes
 .../static/dt-1.9.4/js/jquery.dataTables.min.js |   157 -
 .../webapps/static/jquery/jquery-1.8.2.min.js   |     2 -
 .../static/jquery/jquery-ui-1.9.1.custom.min.js |     6 -
 .../base/images/ui-bg_flat_0_aaaaaa_40x100.png  |   Bin 180 -> 0 bytes
 .../base/images/ui-bg_flat_75_ffffff_40x100.png |   Bin 178 -> 0 bytes
 .../base/images/ui-bg_glass_55_fbf9ee_1x400.png |   Bin 120 -> 0 bytes
 .../base/images/ui-bg_glass_65_ffffff_1x400.png |   Bin 105 -> 0 bytes
 .../base/images/ui-bg_glass_75_dadada_1x400.png |   Bin 111 -> 0 bytes
 .../base/images/ui-bg_glass_75_e6e6e6_1x400.png |   Bin 110 -> 0 bytes
 .../base/images/ui-bg_glass_95_fef1ec_1x400.png |   Bin 119 -> 0 bytes
 .../ui-bg_highlight-soft_75_cccccc_1x100.png    |   Bin 101 -> 0 bytes
 .../base/images/ui-icons_222222_256x240.png     |   Bin 4369 -> 0 bytes
 .../base/images/ui-icons_2e83ff_256x240.png     |   Bin 4369 -> 0 bytes
 .../base/images/ui-icons_454545_256x240.png     |   Bin 4369 -> 0 bytes
 .../base/images/ui-icons_888888_256x240.png     |   Bin 4369 -> 0 bytes
 .../base/images/ui-icons_cd0a0a_256x240.png     |   Bin 4369 -> 0 bytes
 .../jquery/themes-1.9.1/base/jquery-ui.css      |   473 -
 .../webapps/static/jt/jquery.jstree.js          |  4544 ---
 .../src/main/resources/webapps/static/yarn.css  |    65 -
 .../resources/webapps/static/yarn.dt.plugins.js |   146 -
 slider-core/src/scripts/slider_keytabs.sh       |    67 -
 slider-core/src/scripts/yarnservice.py          |   383 -
 slider-core/src/site/site.xml                   |    49 -
 .../standalone/TestStandaloneAgentAM.groovy     |     2 +-
 .../client/TestSliderClientMethods.groovy       |     2 +-
 .../agent/TestAgentAMManagementWS.groovy        |     2 +-
 .../appmaster/TestDelayInContainerLaunch.groovy |     2 +-
 .../appmaster/model/mock/MockContainer.groovy   |    10 +
 .../slider/common/tools/TestSliderUtils.java    |   159 -
 .../core/launch/TestAppMasterLauncher.java      |   157 -
 .../TestAppMasterLauncherWithAmReset.java       |    92 -
 .../TestPublishedConfigurationOutputter.java    |   221 -
 .../agent/TestAgentClientProvider.java          |    77 -
 .../agent/TestAgentLaunchParameter.java         |    76 -
 .../slider/providers/agent/TestAgentUtils.java  |    94 -
 .../agent/TestAppDefinitionPersister.java       |   264 -
 .../agent/TestComponentTagProvider.java         |   115 -
 .../slider/providers/agent/TestState.java       |    33 -
 .../application/metadata/TestConfigParser.java  |   107 -
 .../metadata/TestMetainfoParser.java            |   177 -
 .../appmaster/TestServiceRecordAttributes.java  |    68 -
 .../publisher/TestAgentProviderService.java     |    60 -
 .../publisher/TestSliderProviderFactory.java    |    40 -
 .../server/servicemonitor/TestPortProbe.java    |    37 -
 .../security/TestCertificateManager.java        |   540 -
 .../TestMultiThreadedStoreGeneration.java       |   156 -
 .../server/services/workflow/MockService.java   |    80 -
 .../workflow/ParentWorkflowTestBase.java        |    70 -
 .../workflow/ProcessCommandFactory.java         |    96 -
 .../services/workflow/SimpleRunnable.java       |    46 -
 .../workflow/TestWorkflowClosingService.java    |   116 -
 .../workflow/TestWorkflowCompositeService.java  |   113 -
 .../workflow/TestWorkflowExecutorService.java   |    66 -
 .../workflow/TestWorkflowRpcService.java        |   107 -
 .../workflow/TestWorkflowSequenceService.java   |   151 -
 .../TestWorkflowServiceTerminatingRunnable.java |    64 -
 .../workflow/WorkflowServiceTestBase.java       |   139 -
 .../apache/slider/test/ContractTestUtils.java   |   901 -
 .../slider/test/MiniZooKeeperCluster.java       |   395 -
 .../org/apache/slider/tools/TestUtility.java    |   181 -
 .../slider/common/tools/test/metainfo.txt       |    16 -
 .../slider/common/tools/test/metainfo.xml       |    98 -
 .../slider/common/tools/test/someOtherFile.txt  |    16 -
 .../slider/common/tools/test/someOtherFile.xml  |    16 -
 .../agent/application/metadata/metainfo.xml     |   180 -
 slider-funtest/pom.xml                          |    14 +-
 553 files changed, 81 insertions(+), 121704 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/app-packages/accumulo/pom.xml
----------------------------------------------------------------------
diff --git a/app-packages/accumulo/pom.xml b/app-packages/accumulo/pom.xml
index 5f81e1c..0756c71 100644
--- a/app-packages/accumulo/pom.xml
+++ b/app-packages/accumulo/pom.xml
@@ -19,7 +19,7 @@
   <parent>
     <groupId>org.apache.slider.packages</groupId>
     <artifactId>slider-app-packages</artifactId>
-    <version>0.92.0-incubating-SNAPSHOT</version>
+    <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
     <relativePath>../pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/app-packages/command-logger/application-pkg/pom.xml
----------------------------------------------------------------------
diff --git a/app-packages/command-logger/application-pkg/pom.xml b/app-packages/command-logger/application-pkg/pom.xml
index f95f2b2..5d22f48 100644
--- a/app-packages/command-logger/application-pkg/pom.xml
+++ b/app-packages/command-logger/application-pkg/pom.xml
@@ -19,7 +19,7 @@
   <parent>
     <groupId>org.apache.slider</groupId>
     <artifactId>slider</artifactId>
-    <version>0.92.0-incubating-SNAPSHOT</version>
+    <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
     <relativePath>../../../pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/app-packages/command-logger/slider-pkg/pom.xml
----------------------------------------------------------------------
diff --git a/app-packages/command-logger/slider-pkg/pom.xml b/app-packages/command-logger/slider-pkg/pom.xml
index 4ea77d5..34d70dd 100644
--- a/app-packages/command-logger/slider-pkg/pom.xml
+++ b/app-packages/command-logger/slider-pkg/pom.xml
@@ -20,7 +20,7 @@
   <parent>
     <groupId>org.apache.slider</groupId>
     <artifactId>slider</artifactId>
-    <version>0.92.0-incubating-SNAPSHOT</version>
+    <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
     <relativePath>../../../pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/app-packages/hbase-nopkg/pom.xml
----------------------------------------------------------------------
diff --git a/app-packages/hbase-nopkg/pom.xml b/app-packages/hbase-nopkg/pom.xml
index fcba6f2..c91c1ff 100644
--- a/app-packages/hbase-nopkg/pom.xml
+++ b/app-packages/hbase-nopkg/pom.xml
@@ -20,7 +20,7 @@
   <parent>
     <groupId>org.apache.slider.packages</groupId>
     <artifactId>slider-app-packages</artifactId>
-    <version>0.91.0-incubating-SNAPSHOT</version>
+    <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
     <relativePath>../pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/app-packages/hbase-win/pom.xml
----------------------------------------------------------------------
diff --git a/app-packages/hbase-win/pom.xml b/app-packages/hbase-win/pom.xml
index 52f3242..2f0f2a0 100644
--- a/app-packages/hbase-win/pom.xml
+++ b/app-packages/hbase-win/pom.xml
@@ -20,7 +20,7 @@
   <parent>
     <groupId>org.apache.slider.packages</groupId>
     <artifactId>slider-app-packages</artifactId>
-    <version>0.92.0-incubating-SNAPSHOT</version>
+    <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
     <relativePath>../pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/app-packages/hbase/pom.xml
----------------------------------------------------------------------
diff --git a/app-packages/hbase/pom.xml b/app-packages/hbase/pom.xml
index c149d77..0fca6df 100644
--- a/app-packages/hbase/pom.xml
+++ b/app-packages/hbase/pom.xml
@@ -20,7 +20,7 @@
   <parent>
     <groupId>org.apache.slider.packages</groupId>
     <artifactId>slider-app-packages</artifactId>
-    <version>0.92.0-incubating-SNAPSHOT</version>
+    <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
     <relativePath>../pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/app-packages/kafka/pom.xml
----------------------------------------------------------------------
diff --git a/app-packages/kafka/pom.xml b/app-packages/kafka/pom.xml
index c1e9604..8ac81b8 100644
--- a/app-packages/kafka/pom.xml
+++ b/app-packages/kafka/pom.xml
@@ -19,7 +19,7 @@
   <parent>
     <groupId>org.apache.slider.packages</groupId>
     <artifactId>slider-app-packages</artifactId>
-    <version>0.92.0-incubating-SNAPSHOT</version>
+    <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
     <relativePath>../pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/app-packages/pom.xml
----------------------------------------------------------------------
diff --git a/app-packages/pom.xml b/app-packages/pom.xml
index 016bdaa..02f07b0 100644
--- a/app-packages/pom.xml
+++ b/app-packages/pom.xml
@@ -20,7 +20,7 @@
   <parent>
     <groupId>org.apache.slider</groupId>
     <artifactId>slider</artifactId>
-    <version>0.92.0-incubating-SNAPSHOT</version>
+    <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
     <relativePath>../pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/app-packages/storm-win/pom.xml
----------------------------------------------------------------------
diff --git a/app-packages/storm-win/pom.xml b/app-packages/storm-win/pom.xml
index a52fe4c..fa93d30 100644
--- a/app-packages/storm-win/pom.xml
+++ b/app-packages/storm-win/pom.xml
@@ -20,7 +20,7 @@
   <parent>
     <groupId>org.apache.slider.packages</groupId>
     <artifactId>slider-app-packages</artifactId>
-    <version>0.92.0-incubating-SNAPSHOT</version>
+    <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
     <relativePath>../pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/app-packages/storm/pom.xml
----------------------------------------------------------------------
diff --git a/app-packages/storm/pom.xml b/app-packages/storm/pom.xml
index 73ceefa..9be6400 100644
--- a/app-packages/storm/pom.xml
+++ b/app-packages/storm/pom.xml
@@ -20,7 +20,7 @@
   <parent>
     <groupId>org.apache.slider.packages</groupId>
     <artifactId>slider-app-packages</artifactId>
-    <version>0.92.0-incubating-SNAPSHOT</version>
+    <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
     <relativePath>../pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/app-packages/tomcat-test-war/pom.xml
----------------------------------------------------------------------
diff --git a/app-packages/tomcat-test-war/pom.xml b/app-packages/tomcat-test-war/pom.xml
index f89eab2..c72360f 100644
--- a/app-packages/tomcat-test-war/pom.xml
+++ b/app-packages/tomcat-test-war/pom.xml
@@ -19,7 +19,7 @@
   <parent>
     <groupId>org.apache.slider.packages</groupId>
     <artifactId>slider-app-packages</artifactId>
-    <version>0.92.0-incubating-SNAPSHOT</version>
+    <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
     <relativePath>../pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/app-packages/tomcat/pom.xml
----------------------------------------------------------------------
diff --git a/app-packages/tomcat/pom.xml b/app-packages/tomcat/pom.xml
index 7b943ee..bb150b5 100644
--- a/app-packages/tomcat/pom.xml
+++ b/app-packages/tomcat/pom.xml
@@ -19,7 +19,7 @@
   <parent>
     <groupId>org.apache.slider.packages</groupId>
     <artifactId>slider-app-packages</artifactId>
-    <version>0.92.0-incubating-SNAPSHOT</version>
+    <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
     <relativePath>../pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7c21e07..0caafb6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,7 +19,7 @@
   <groupId>org.apache.slider</groupId>
   <artifactId>slider</artifactId>
   <name>Slider</name>
-  <version>0.92.0-incubating-SNAPSHOT</version>
+  <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
   <packaging>pom</packaging>
 
   <description>
@@ -131,7 +131,7 @@
     <!--
     core artifacts
     -->
-    <hadoop.version>2.7.1</hadoop.version>
+    <hadoop.version>3.0.0-alpha2-SNAPSHOT</hadoop.version>
 
     <hbase.version>0.99.0</hbase.version>
     <accumulo.version>1.7.0</accumulo.version>
@@ -150,14 +150,14 @@
     <curator.version>2.7.1</curator.version>
     <easymock.version>3.1</easymock.version>
     <guava.version>11.0.2</guava.version>
-    <gson.version>2.2.2</gson.version>
-    <guice.version>3.0</guice.version>
+    <gson.version>2.2.4</gson.version>
+    <guice.version>4.0</guice.version>
 
     <jackson.version>1.9.13</jackson.version>
     <jcommander.version>1.30</jcommander.version>
 
     <jetty.version>6.1.26</jetty.version>
-    <jersey.version>1.9</jersey.version>
+    <jersey.version>1.19</jersey.version>
     <servlet-api.version>2.5</servlet-api.version>
     <jsr311-api.version>1.1.1</jsr311-api.version>
     <jaxb-api.version>2.2.7</jaxb-api.version>
@@ -172,7 +172,7 @@
     <!-- define the protobuf JAR version                               -->
     <protobuf.version>2.5.0</protobuf.version>
 
-    <slf4j.version>1.7.5</slf4j.version>
+    <slf4j.version>1.7.10</slf4j.version>
     <snakeyaml.version>1.16</snakeyaml.version>
     <storm.version>0.9.3</storm.version>
     <stringtemplate.version>2.4.1</stringtemplate.version>
@@ -474,6 +474,19 @@
       </dependency>
 
       <dependency>
+        <groupId>org.apache.hadoop</groupId>
+        <artifactId>hadoop-yarn-slider-core</artifactId>
+        <version>${hadoop.version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.hadoop</groupId>
+        <artifactId>hadoop-yarn-slider-core</artifactId>
+        <version>${hadoop.version}</version>
+        <type>test-jar</type>
+      </dependency>
+
+      <dependency>
         <groupId>org.apache.slider</groupId>
         <artifactId>slider-agent</artifactId>
         <version>${project.version}</version>
@@ -1025,6 +1038,10 @@
             <groupId>org.jboss.netty</groupId>
             <artifactId>netty</artifactId>
           </exclusion>
+          <exclusion>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+          </exclusion>
         </exclusions>
       </dependency>
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-agent/pom.xml
----------------------------------------------------------------------
diff --git a/slider-agent/pom.xml b/slider-agent/pom.xml
index 3f695d5..d345e7b 100644
--- a/slider-agent/pom.xml
+++ b/slider-agent/pom.xml
@@ -19,7 +19,7 @@
   <parent>
     <groupId>org.apache.slider</groupId>
     <artifactId>slider</artifactId>
-    <version>0.92.0-incubating-SNAPSHOT</version>
+    <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>slider-agent</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/slider-assembly/pom.xml b/slider-assembly/pom.xml
index 0b2f077..1f75803 100644
--- a/slider-assembly/pom.xml
+++ b/slider-assembly/pom.xml
@@ -23,7 +23,7 @@
   <parent>
     <groupId>org.apache.slider</groupId>
     <artifactId>slider</artifactId>
-    <version>0.92.0-incubating-SNAPSHOT</version>
+    <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
   </parent>
 
 
@@ -544,6 +544,12 @@
     </dependency>
 
     <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-yarn-slider-core</artifactId>
+      <type>test-jar</type>
+    </dependency>
+
+    <dependency>
       <groupId>com.beust</groupId>
       <artifactId>jcommander</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/pom.xml
----------------------------------------------------------------------
diff --git a/slider-core/pom.xml b/slider-core/pom.xml
index 30d1283..c44289c 100644
--- a/slider-core/pom.xml
+++ b/slider-core/pom.xml
@@ -23,7 +23,7 @@
   <parent>
     <groupId>org.apache.slider</groupId>
     <artifactId>slider</artifactId>
-    <version>0.92.0-incubating-SNAPSHOT</version>
+    <version>0.92.0-incubating-alpha1-SNAPSHOT</version>
   </parent>
 
   <build>
@@ -133,26 +133,6 @@
       </plugin>
 
       <plugin>
-        <groupId>org.apache.avro</groupId>
-        <artifactId>avro-maven-plugin</artifactId>
-        <version>${avro.version}</version>
-        <executions>
-          <execution>
-            <phase>generate-sources</phase>
-            <goals>
-              <goal>schema</goal>
-            </goals>
-            <configuration>
-              <sourceDirectory>${project.basedir}/src/main/avro/
-              </sourceDirectory>
-              <outputDirectory>${project.build.directory}/generated-sources/java
-              </outputDirectory>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-
-      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-site-plugin</artifactId>
         <version>${maven-site-plugin.version}</version>
@@ -200,6 +180,16 @@
 
   <dependencies>
 
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-yarn-slider-core</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-yarn-slider-core</artifactId>
+      <type>test-jar</type>
+    </dependency>
 
     <dependency>
       <groupId>com.beust</groupId>
@@ -314,11 +304,6 @@
     </dependency>
 
     <dependency>
-      <groupId>org.apache.avro</groupId>
-      <artifactId>avro</artifactId>
-    </dependency>
-
-    <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-compress</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/avro/org/apache/slider/server/avro/RoleHistoryRecord.avsc
----------------------------------------------------------------------
diff --git a/slider-core/src/main/avro/org/apache/slider/server/avro/RoleHistoryRecord.avsc b/slider-core/src/main/avro/org/apache/slider/server/avro/RoleHistoryRecord.avsc
deleted file mode 100644
index 3667c01..0000000
--- a/slider-core/src/main/avro/org/apache/slider/server/avro/RoleHistoryRecord.avsc
+++ /dev/null
@@ -1,114 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-[
-
-  {
-    "type": "record",
-    "name": "NodeEntryRecord",
-    "namespace": "org.apache.slider.server.avro",
-    "fields": [
-      {
-        "name": "host",
-        "type": "string"
-      },
-      {
-        "name": "role",
-        "type": "int"
-      },
-      {
-        "name": "active",
-        "type": "boolean"
-      },
-      {
-        "name": "last_used",
-        "type": "long"
-      }
-    ]
-  },
-
-  {
-    "type": "record",
-    "name": "RoleHistoryHeader",
-    "namespace": "org.apache.slider.server.avro",
-    "fields": [
-      {
-        "name": "version",
-        "type": "int"
-      },
-      {
-        "name": "saved",
-        "type": "long"
-      },
-      {
-        "name": "savedx",
-        "type": "string"
-      },
-      {
-        "name": "savedate",
-        "type": "string",
-        "default": ""
-      },
-      {
-        "name": "roles",
-        "type": "int"
-      }
-    ]
-  },
-  {
-    "type": "record",
-    "name": "RoleHistoryMapping",
-    "namespace": "org.apache.slider.server.avro",
-    "fields": [
-      {
-        "name": "rolemap",
-        "type": {
-          "type": "map",
-          "values": "int"
-         }
-      }
-    ]
-  },
-  {
-    "type": "record",
-    "name": "RoleHistoryFooter",
-    "namespace": "org.apache.slider.server.avro",
-    "fields": [
-      {
-        "name": "count",
-        "type": "long"
-      }
-    ]
-  },
-
-  {
-    "type": "record",
-    "name": "RoleHistoryRecord",
-    "namespace": "org.apache.slider.server.avro",
-    "fields": [
-      {
-        "name": "entry",
-        "type": [
-          "org.apache.slider.server.avro.NodeEntryRecord",
-          "org.apache.slider.server.avro.RoleHistoryHeader",
-          "org.apache.slider.server.avro.RoleHistoryFooter",
-          "org.apache.slider.server.avro.RoleHistoryMapping"
-        ]
-      }
-    ]
-  }
-
-]

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/hadoop/security/KerberosDiags.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/hadoop/security/KerberosDiags.java b/slider-core/src/main/java/org/apache/hadoop/security/KerberosDiags.java
deleted file mode 100644
index 8c572b3..0000000
--- a/slider-core/src/main/java/org/apache/hadoop/security/KerberosDiags.java
+++ /dev/null
@@ -1,676 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.security;
-
-import com.google.common.annotations.VisibleForTesting;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.Text;
-import org.apache.hadoop.security.token.Token;
-import org.apache.hadoop.security.token.TokenIdentifier;
-import org.apache.hadoop.util.ExitUtil;
-import org.apache.hadoop.util.Shell;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.crypto.Cipher;
-import java.io.Closeable;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.lang.reflect.InvocationTargetException;
-import java.net.InetAddress;
-import java.security.NoSuchAlgorithmException;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.regex.Pattern;
-
-import static org.apache.hadoop.security.UserGroupInformation.*;
-import static org.apache.hadoop.security.authentication.util.KerberosUtil.*;
-import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.*;
-
-/**
- * Kerberos diagnostics
- * At some point this may move to hadoop core, so please keep use of slider
- * methods and classes to ~0.
- *
- * This operation expands some of the diagnostic output of the security code,
- * but not all. For completeness
- *
- * Set the environment variable {@code HADOOP_JAAS_DEBUG=true}
- * Set the log level for {@code org.apache.hadoop.security=DEBUG}
- */
-public class KerberosDiags implements Closeable {
-
-  private static final Logger LOG = LoggerFactory.getLogger(KerberosDiags.class);
-  public static final String KRB5_CCNAME = "KRB5CCNAME";
-  public static final String JAVA_SECURITY_KRB5_CONF
-    = "java.security.krb5.conf";
-  public static final String JAVA_SECURITY_KRB5_REALM
-    = "java.security.krb5.realm";
-  public static final String SUN_SECURITY_KRB5_DEBUG
-    = "sun.security.krb5.debug";
-  public static final String SUN_SECURITY_SPNEGO_DEBUG
-    = "sun.security.spnego.debug";
-  public static final String SUN_SECURITY_JAAS_FILE
-    = "java.security.auth.login.config";
-  public static final String KERBEROS_KINIT_COMMAND
-    = "hadoop.kerberos.kinit.command";
-  public static final String HADOOP_AUTHENTICATION_IS_DISABLED
-      = "Hadoop authentication is disabled";
-  public static final String UNSET = "(unset)";
-  public static final String NO_DEFAULT_REALM = "Cannot locate default realm";
-
-  private final Configuration conf;
-  private final List<String> services;
-  private final PrintWriter out;
-  private final File keytab;
-  private final String principal;
-  private final long minKeyLength;
-  private final boolean securityRequired;
-
-  public static final String CAT_JVM = "JVM";
-  public static final String CAT_JAAS = "JAAS";
-  public static final String CAT_CONFIG = "CONFIG";
-  public static final String CAT_LOGIN = "LOGIN";
-  public static final String CAT_KERBEROS = "KERBEROS";
-  public static final String CAT_SASL = "SASL";
-
-  @SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
-  public KerberosDiags(Configuration conf,
-      PrintWriter out,
-      List<String> services,
-      File keytab,
-      String principal,
-      long minKeyLength,
-      boolean securityRequired) {
-    this.conf = conf;
-    this.services = services;
-    this.keytab = keytab;
-    this.principal = principal;
-    this.out = out;
-    this.minKeyLength = minKeyLength;
-    this.securityRequired = securityRequired;
-  }
-
-  @Override
-  public void close() throws IOException {
-    flush();
-  }
-
-  /**
-   * Execute diagnostics.
-   * <p>
-   * Things it would be nice if UGI made accessible
-   * <ol>
-   *   <li>A way to enable JAAS debug programatically</li>
-   *   <li>Access to the TGT</li>
-   * </ol>
-   * @return true if security was enabled and all probes were successful
-   * @throws KerberosDiagsFailure explicitly raised failure
-   * @throws Exception other security problems
-   */
-  @SuppressWarnings("deprecation")
-  public boolean execute() throws Exception {
-
-    title("Kerberos Diagnostics scan at %s",
-        new Date(System.currentTimeMillis()));
-
-    // check that the machine has a name
-    println("Hostname: %s",
-        InetAddress.getLocalHost().getCanonicalHostName());
-
-    // Fail fast on a JVM without JCE installed.
-    validateKeyLength();
-
-    // look at realm
-    println("JVM Kerberos Login Module = %s", getKrb5LoginModuleName());
-    printDefaultRealm();
-
-    title("System Properties");
-    for (String prop : new String[]{
-      JAVA_SECURITY_KRB5_CONF,
-      JAVA_SECURITY_KRB5_REALM,
-      SUN_SECURITY_KRB5_DEBUG,
-      SUN_SECURITY_SPNEGO_DEBUG,
-      SUN_SECURITY_JAAS_FILE
-    }) {
-      printSysprop(prop);
-    }
-
-    title("Environment Variables");
-    for (String env : new String[]{
-      "HADOOP_JAAS_DEBUG",
-      KRB5_CCNAME,
-      HADOOP_USER_NAME,
-      HADOOP_PROXY_USER,
-      HADOOP_TOKEN_FILE_LOCATION,
-    }) {
-      printEnv(env);
-    }
-
-    for (String prop : new String[]{
-      KERBEROS_KINIT_COMMAND,
-      HADOOP_SECURITY_AUTHENTICATION,
-      HADOOP_SECURITY_AUTHORIZATION,
-      "hadoop.kerberos.min.seconds.before.relogin",    // not in 2.6
-      "hadoop.security.dns.interface",   // not in 2.6
-      "hadoop.security.dns.nameserver",  // not in 2.6
-      HADOOP_RPC_PROTECTION,
-      HADOOP_SECURITY_SASL_PROPS_RESOLVER_CLASS,
-      HADOOP_SECURITY_CRYPTO_CODEC_CLASSES_KEY_PREFIX,
-      HADOOP_SECURITY_GROUP_MAPPING,
-      "hadoop.security.impersonation.provider.class",    // not in 2.6
-      "dfs.data.transfer.protection" // HDFS
-    }) {
-      printConfOpt(prop);
-    }
-
-    // check that authentication is enabled
-    if (SecurityUtil.getAuthenticationMethod(conf)
-        .equals(AuthenticationMethod.SIMPLE)) {
-      println(HADOOP_AUTHENTICATION_IS_DISABLED);
-      failif(securityRequired, CAT_CONFIG, HADOOP_AUTHENTICATION_IS_DISABLED);
-      // no security, skip rest of test
-      return false;
-    }
-
-    validateKrb5File();
-    validateSasl(HADOOP_SECURITY_SASL_PROPS_RESOLVER_CLASS);
-    validateSasl("dfs.data.transfer.saslproperties.resolver.class");
-    validateKinitExecutable();
-    validateJAAS();
-    // now the big test: login, then try again
-    boolean krb5Debug = getAndSet(SUN_SECURITY_KRB5_DEBUG);
-    boolean spnegoDebug = getAndSet(SUN_SECURITY_SPNEGO_DEBUG);
-    try {
-      title("Logging in");
-
-      if (keytab != null) {
-        dumpKeytab(keytab);
-        loginFromKeytab();
-      } else {
-        UserGroupInformation loginUser = getLoginUser();
-        dumpUGI("Log in user", loginUser);
-        validateUGI("Login user", loginUser);
-        println("Ticket based login: %b", isLoginTicketBased());
-        println("Keytab based login: %b", isLoginKeytabBased());
-      }
-
-      return true;
-    } finally {
-      // restore original system properties
-      System.setProperty(SUN_SECURITY_KRB5_DEBUG,
-        Boolean.toString(krb5Debug));
-      System.setProperty(SUN_SECURITY_SPNEGO_DEBUG,
-        Boolean.toString(spnegoDebug));
-    }
-  }
-
-  /**
-   * Fail fast on a JVM without JCE installed.
-   *
-   * This is a recurrent problem
-   * (that is: it keeps creeping back with JVM updates);
-   * a fast failure is the best tactic
-   * @throws NoSuchAlgorithmException
-   */
-
-  protected void validateKeyLength() throws NoSuchAlgorithmException {
-    int aesLen = Cipher.getMaxAllowedKeyLength("AES");
-    println("Maximum AES encryption key length %d bits", aesLen);
-    failif (aesLen < minKeyLength,
-        CAT_JVM,
-        "Java Cryptography Extensions are not installed on this JVM."
-        +" Maximum supported key length %s - minimum required %d",
-        aesLen, minKeyLength);
-  }
-
-  /**
-   * Get the default realm.
-   * <p>
-   * Not having a default realm may be harmless, so is noted at info.
-   * All other invocation failures are downgraded to warn, as
-   * follow-on actions may still work.
-   * failure to invoke the method via introspection is rejected,
-   * as it's a sign of JVM compatibility issues that may have other
-   * consequences
-   */
-  protected void printDefaultRealm() {
-    try {
-      println("Default Realm = %s",
-          getDefaultRealm());
-    } catch (ClassNotFoundException
-        | IllegalAccessException
-        | NoSuchMethodException e) {
-
-      throw new KerberosDiagsFailure(CAT_JVM, e,
-          "Failed to invoke krb5.Config.getDefaultRealm: %s", e);
-    } catch (InvocationTargetException e) {
-      Throwable cause = e.getCause() != null ? e.getCause() : e;
-      if (cause.toString().contains(NO_DEFAULT_REALM)) {
-        // exception raised if there is no default realm. This is not
-        // always a problem, so downgrade to a message.
-        println("Host has no default realm");
-        LOG.debug(cause.toString(), cause);
-      } else {
-        println("Kerberos.getDefaultRealm() failed: %s\n%s",
-            cause,
-            org.apache.hadoop.util.StringUtils.stringifyException(cause));
-      }
-    }
-  }
-
-  /**
-   * Locate the krb5.conf file and dump it.
-   * No-op on windows.
-   * @throws IOException
-   */
-  private void validateKrb5File() throws IOException {
-    if (!Shell.WINDOWS) {
-      title("Locating Kerberos configuration file");
-      String krbPath = "/etc/krb5.conf";
-      String jvmKrbPath = System.getProperty(JAVA_SECURITY_KRB5_CONF);
-      if (jvmKrbPath != null) {
-        println("Setting kerberos path from sysprop %s: %s",
-          JAVA_SECURITY_KRB5_CONF, jvmKrbPath);
-        krbPath = jvmKrbPath;
-      }
-
-      String krb5name = System.getenv(KRB5_CCNAME);
-      if (krb5name != null) {
-        println("Setting kerberos path from environment variable %s: %s",
-          KRB5_CCNAME, krb5name);
-        krbPath = krb5name;
-        if (jvmKrbPath != null) {
-          println("Warning - both %s and %s were set - %s takes priority",
-            JAVA_SECURITY_KRB5_CONF, KRB5_CCNAME, KRB5_CCNAME);
-        }
-      }
-
-      File krbFile = new File(krbPath);
-      println("Kerberos configuration file = %s", krbFile);
-      failif(!krbFile.exists(),
-          CAT_KERBEROS,
-          "Kerberos configuration file %s not found", krbFile);
-      dump(krbFile);
-    }
-  }
-
-  /**
-   * Dump a keytab: list all principals.
-   * @param keytabFile the keytab file
-   * @throws IOException IO problems
-   */
-  public void dumpKeytab(File keytabFile) throws IOException {
-    title("Examining keytab %s", keytabFile);
-    File kt = keytabFile.getCanonicalFile();
-    failif(!kt.exists(), CAT_CONFIG, "Keytab not found: %s", kt);
-    failif(!kt.isFile(), CAT_CONFIG, "Keytab is not a valid file: %s", kt);
-
-    String[] names = getPrincipalNames(keytabFile.getCanonicalPath(),
-        Pattern.compile(".*"));
-    println("keytab entry count: %d", names.length);
-    for (String name : names) {
-      println("    %s", name);
-    }
-    println("-----");
-  }
-
-  /**
-   * Log in from a keytab, dump the UGI, validate it, then try and log in again.
-   * That second-time login catches JVM/Hadoop compatibility problems.
-   * @throws IOException
-   */
-  private void loginFromKeytab() throws IOException {
-    UserGroupInformation ugi;
-    String identity;
-    if (keytab != null) {
-      File kt = keytab.getCanonicalFile();
-      println("Using keytab %s principal %s", kt, principal);
-      identity = principal;
-
-      failif(StringUtils.isEmpty(principal), CAT_KERBEROS,
-          "No principal defined");
-      ugi = loginUserFromKeytabAndReturnUGI(principal, kt.getPath());
-      dumpUGI(identity, ugi);
-      validateUGI(principal, ugi);
-
-      title("Attempting to log in from keytab again");
-      // package scoped -hence the reason why this class must be in the
-      // hadoop.security package
-      setShouldRenewImmediatelyForTests(true);
-      // attempt a new login
-      ugi.reloginFromKeytab();
-    } else {
-      println("No keytab: logging is as current user");
-    }
-  }
-
-  /**
-   * Dump a UGI.
-   * @param title title of this section
-   * @param ugi UGI to dump
-   * @throws IOException
-   */
-  private void dumpUGI(String title, UserGroupInformation ugi)
-    throws IOException {
-    title(title);
-    println("UGI instance = %s", ugi);
-    println("Has kerberos credentials: %b", ugi.hasKerberosCredentials());
-    println("Authentication method: %s", ugi.getAuthenticationMethod());
-    println("Real Authentication method: %s",
-      ugi.getRealAuthenticationMethod());
-    title("Group names");
-    for (String name : ugi.getGroupNames()) {
-      println(name);
-    }
-    title("Credentials");
-    Credentials credentials = ugi.getCredentials();
-    List<Text> secretKeys = credentials.getAllSecretKeys();
-    title("Secret keys");
-    if (!secretKeys.isEmpty()) {
-      for (Text secret: secretKeys) {
-        println("%s", secret);
-      }
-    } else {
-      println("(none)");
-    }
-
-    dumpTokens(ugi);
-  }
-
-  /**
-   * Validate the UGI: verify it is kerberized.
-   * @param messagePrefix message in exceptions
-   * @param user user to validate
-   */
-  private void validateUGI(String messagePrefix, UserGroupInformation user) {
-    failif(!user.hasKerberosCredentials(),
-        CAT_LOGIN, "%s: No kerberos credentials for %s", messagePrefix, user);
-    failif(user.getAuthenticationMethod() == null,
-        CAT_LOGIN, "%s: Null AuthenticationMethod for %s", messagePrefix, user);
-  }
-
-  /**
-   * A cursory look at the {@code kinit} executable.
-   * If it is an absolute path: it must exist with a size > 0.
-   * If it is just a command, it has to be on the path. There's no check
-   * for that -but the PATH is printed out.
-   */
-  private void validateKinitExecutable() {
-    String kinit = conf.getTrimmed(KERBEROS_KINIT_COMMAND, "");
-    if (!kinit.isEmpty()) {
-      File kinitPath = new File(kinit);
-      println("%s = %s", KERBEROS_KINIT_COMMAND, kinitPath);
-      if (kinitPath.isAbsolute()) {
-        failif(!kinitPath.exists(), CAT_KERBEROS,
-            "%s executable does not exist: %s",
-            KERBEROS_KINIT_COMMAND, kinitPath);
-        failif(!kinitPath.isFile(), CAT_KERBEROS,
-            "%s path does not refer to a file: %s",
-            KERBEROS_KINIT_COMMAND, kinitPath);
-        failif(kinitPath.length() == 0, CAT_KERBEROS,
-            "%s file is empty: %s",
-            KERBEROS_KINIT_COMMAND, kinitPath);
-      } else {
-        println("Executable %s is relative -must be on the PATH", kinit);
-        printEnv("PATH");
-      }
-    }
-  }
-
-  /**
-   * Try to load the SASL resolver.
-   * @param saslPropsResolverKey key for the SASL resolver
-   */
-  private void validateSasl(String saslPropsResolverKey) {
-    title("Resolving SASL property %s", saslPropsResolverKey);
-    String saslPropsResolver = conf.getTrimmed(saslPropsResolverKey);
-    try {
-      Class<? extends SaslPropertiesResolver> resolverClass = conf.getClass(
-          saslPropsResolverKey,
-          SaslPropertiesResolver.class, SaslPropertiesResolver.class);
-      println("Resolver is %s", resolverClass);
-    } catch (RuntimeException e) {
-      throw new KerberosDiagsFailure(CAT_SASL, e,
-          "Failed to load %s class %s",
-          saslPropsResolverKey, saslPropsResolver);
-    }
-  }
-
-  /**
-   * Validate any JAAS entry referenced in the {@link #SUN_SECURITY_JAAS_FILE}
-   * property.
-   */
-  private void validateJAAS() {
-    String jaasFilename = System.getProperty(SUN_SECURITY_JAAS_FILE);
-    if (jaasFilename != null) {
-      title("JAAS");
-      File jaasFile = new File(jaasFilename);
-      println("JAAS file is defined in %s: %s",
-          SUN_SECURITY_JAAS_FILE, jaasFile);
-      failif(!jaasFile.exists(), CAT_JAAS,
-          "JAAS file does not exist: %s", jaasFile);
-      failif(!jaasFile.isFile(), CAT_JAAS,
-          "Specified JAAS file is not a file: %s", jaasFile);
-    }
-  }
-
-  /**
-   * Dump all tokens of a user
-   * @param user user
-   */
-  public void dumpTokens(UserGroupInformation user) {
-    Collection<Token<? extends TokenIdentifier>> tokens
-      = user.getCredentials().getAllTokens();
-    title("Token Count: %d", tokens.size());
-    for (Token<? extends TokenIdentifier> token : tokens) {
-      println("Token %s", token.getKind());
-    }
-  }
-
-  /**
-   * Set the System property to true; return the old value for caching
-   * @param sysprop property
-   * @return the previous value
-   */
-  private boolean getAndSet(String sysprop) {
-    boolean old = Boolean.getBoolean(sysprop);
-    System.setProperty(sysprop, "true");
-    return old;
-  }
-
-  /**
-   * Flush all active output channels, including {@Code System.err},
-   * so as to stay in sync with any JRE log messages.
-   */
-  private void flush() {
-    if (out != null) {
-      out.flush();
-    } else {
-      System.out.flush();
-    }
-    System.err.flush();
-  }
-
-  /**
-   * Format and print a line of output.
-   * This goes to any output file, or
-   * is logged at info. The output is flushed before and after, to
-   * try and stay in sync with JRE logging.
-   * @param format format string
-   * @param args any arguments
-   */
-  @VisibleForTesting
-  public void println(String format, Object... args) {
-    println(format(format, args));
-  }
-
-  /**
-   * Print a line of output. This goes to any output file, or
-   * is logged at info. The output is flushed before and after, to
-   * try and stay in sync with JRE logging.
-   * @param msg message string
-   */
-  @VisibleForTesting
-  private void println(String msg) {
-    flush();
-    if (out != null) {
-      out.println(msg);
-    } else {
-      LOG.info(msg);
-    }
-    flush();
-  }
-
-  /**
-   * Print a title entry
-   * @param format format string
-   * @param args any arguments
-   */
-  private void title(String format, Object... args) {
-    println("");
-    println("");
-    String msg = "== " + format(format, args) + " ==";
-    println(msg);
-    println("");
-  }
-
-  /**
-   * Print a system property, or {@link #UNSET} if unset.
-   * @param property property to print
-   */
-  private void printSysprop(String property) {
-    println("%s = \"%s\"", property,
-        System.getProperty(property, UNSET));
-  }
-
-  /**
-   * Print a configuration option, or {@link #UNSET} if unset.
-   * @param option option to print
-   */
-  private void printConfOpt(String option) {
-    println("%s = \"%s\"", option, conf.get(option, UNSET));
-  }
-
-  /**
-   * Print an environment variable's name and value; printing
-   * {@link #UNSET} if it is not set
-   * @param variable environment variable
-   */
-  private void printEnv(String variable) {
-    String env = System.getenv(variable);
-    println("%s = \"%s\"", variable, env != null ? env : UNSET);
-  }
-
-  /**
-   * Dump any file to standard out; add a trailing newline
-   * @param file file to dump
-   * @throws IOException IO problems
-   */
-  public void dump(File file) throws IOException {
-    try (FileInputStream in = new FileInputStream(file)) {
-      for (String line : IOUtils.readLines(in)) {
-        println("%s", line);
-      }
-    }
-    println("");
-  }
-
-  /**
-   * Format and raise a failure
-   *
-   * @param category category for exception
-   * @param message string formatting message
-   * @param args any arguments for the formatting
-   * @throws KerberosDiagsFailure containing the formatted text
-   */
-  private void fail(String category, String message, Object... args)
-    throws KerberosDiagsFailure {
-    throw new KerberosDiagsFailure(category, message, args);
-  }
-
-  /**
-   * Conditional failure with string formatted arguments
-   * @param condition failure condition
-   * @param category category for exception
-   * @param message string formatting message
-   * @param args any arguments for the formatting
-   * @throws KerberosDiagsFailure containing the formatted text
-   *         if the condition was met
-   */
-  private void failif(boolean condition,
-      String category,
-      String message,
-      Object... args)
-    throws KerberosDiagsFailure {
-    if (condition) {
-      fail(category, message, args);
-    }
-  }
-
-  /**
-   * Format a string, treating a call where there are no varags values
-   * as a string to pass through unformatted.
-   * @param message message, which is either a format string + args, or
-   * a general string
-   * @param args argument array
-   * @return a string for printing.
-   */
-  public static String format(String message, Object... args) {
-    if (args.length == 0) {
-      return message;
-    } else {
-      return String.format(message, args);
-    }
-  }
-
-  /**
-   * Diagnostics failures return the exit code 41, "unauthorized".
-   *
-   * They have a category, initially for testing: the category can be
-   * validated without having to match on the entire string.
-   */
-  public static class KerberosDiagsFailure extends ExitUtil.ExitException {
-    private final String category;
-
-    public KerberosDiagsFailure(String category, String message) {
-      super(41, category + ": " + message);
-      this.category = category;
-    }
-
-    public KerberosDiagsFailure(String category, String message, Object... args) {
-      this(category, format(message, args));
-    }
-
-    public KerberosDiagsFailure(String category, Throwable throwable,
-        String message, Object... args) {
-      this(category, message, args);
-      initCause(throwable);
-    }
-
-    public String getCategory() {
-      return category;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/Slider.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/Slider.java b/slider-core/src/main/java/org/apache/slider/Slider.java
deleted file mode 100644
index 5fc8618..0000000
--- a/slider-core/src/main/java/org/apache/slider/Slider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider;
-
-import org.apache.slider.client.SliderClient;
-import org.apache.slider.core.main.ServiceLauncher;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * This is just the entry point class
- */
-public class Slider extends SliderClient {
-
-
-  public static final String SERVICE_CLASSNAME = "org.apache.slider.Slider";
-
-  /**
-   * This is the main entry point for the service launcher.
-   * @param args command line arguments.
-   */
-  public static void main(String[] args) {
-    
-    //turn the args to a list
-    List<String> argsList = Arrays.asList(args);
-    //create a new list, as the ArrayList type doesn't push() on an insert
-    List<String> extendedArgs = new ArrayList<String>(argsList);
-    //insert the service name
-    extendedArgs.add(0, SERVICE_CLASSNAME);
-    //now have the service launcher do its work
-    ServiceLauncher.serviceMain(extendedArgs);
-  }
-
-}


[24/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/PublishedArtifacts.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/PublishedArtifacts.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/PublishedArtifacts.java
deleted file mode 100644
index fdc386f..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/PublishedArtifacts.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster;
-
-/**
- * This is the name of YARN artifacts that are published
- */
-public interface PublishedArtifacts {
-
-  String COMPLETE_CONFIG = "complete-config";
-  String CORE_SITE_CONFIG = "core-site";
-  String HDFS_SITE_CONFIG = "hdfs-site";
-  String YARN_SITE_CONFIG = "yarn-site";
-  String LOG4J = "log4j";
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/RoleLaunchService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/RoleLaunchService.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/RoleLaunchService.java
deleted file mode 100644
index 3cfe167..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/RoleLaunchService.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.security.Credentials;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.launch.ContainerLauncher;
-import org.apache.slider.providers.ProviderRole;
-import org.apache.slider.providers.ProviderService;
-import org.apache.slider.providers.agent.AgentKeys;
-import org.apache.slider.server.appmaster.actions.ActionStartContainer;
-import org.apache.slider.server.appmaster.actions.QueueAccess;
-import org.apache.slider.server.appmaster.state.ContainerAssignment;
-import org.apache.slider.server.appmaster.state.RoleInstance;
-import org.apache.slider.server.appmaster.state.RoleStatus;
-import org.apache.slider.server.services.workflow.WorkflowExecutorService;
-import org.apache.slider.server.services.workflow.ServiceThreadFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-/**
- * A service for launching containers
- */
-public class RoleLaunchService
-    extends WorkflowExecutorService<ExecutorService> {
-  protected static final Logger log =
-    LoggerFactory.getLogger(RoleLaunchService.class);
-
-  public static final String ROLE_LAUNCH_SERVICE = "RoleLaunchService";
-
-
-  /**
-   * Queue submission API
-   */
-  private final QueueAccess actionQueue;
-
-  /**
-   * Provider building up the command
-   */
-  private final ProviderService provider;
-  
-  /**
-   * Filesystem to use for the launch
-   */
-  private final SliderFileSystem fs;
-
-  /**
-   * Path in the launch filesystem that refers to a configuration directory
-   * -the interpretation of it is left to the Provider
-   */
-  private final Path generatedConfDirPath;
-  /**
-   * Path in the launch filesystem that refers to a temp directory
-   * which will be cleaned up at (some) time in the future
-   */
-  private final Path launcherTmpDirPath;
-
-  private Map<String, String> envVars;
-
-  /**
-   * Construct an instance of the launcher
-   * @param queueAccess
-   * @param provider the provider
-   * @param fs filesystem
-   * @param generatedConfDirPath path in the FS for the generated dir
-   * @param envVars environment variables
-   * @param launcherTmpDirPath path for a temporary data in the launch process
-   */
-  public RoleLaunchService(QueueAccess queueAccess,
-      ProviderService provider,
-      SliderFileSystem fs,
-      Path generatedConfDirPath,
-      Map<String, String> envVars,
-      Path launcherTmpDirPath) {
-    super(ROLE_LAUNCH_SERVICE);
-    this.actionQueue = queueAccess;
-    this.fs = fs;
-    this.generatedConfDirPath = generatedConfDirPath;
-    this.launcherTmpDirPath = launcherTmpDirPath;
-    this.provider = provider;
-    this.envVars = envVars;
-  }
-
-  @Override
-  public void init(Configuration conf) {
-    super.init(conf);
-    setExecutor(Executors.newCachedThreadPool(
-        new ServiceThreadFactory(ROLE_LAUNCH_SERVICE, true)));
-  }
-
-  /**
-   * Start an asychronous launch operation
-   * @param assignment container assignment
-   * @param clusterSpec cluster spec to use for template
-   * @param credentials credentials to use
-   */
-  public void launchRole(ContainerAssignment assignment,
-      AggregateConf clusterSpec,
-      Credentials credentials) {
-    RoleStatus role = assignment.role;
-    String roleName = role.getName();
-    String roleGroup = role.getGroup();
-    // prelaunch safety check
-    Preconditions.checkArgument(provider.isSupportedRole(roleName));
-    RoleLaunchService.RoleLauncher launcher =
-      new RoleLaunchService.RoleLauncher(assignment,
-         clusterSpec,
-         clusterSpec.getResourceOperations().getOrAddComponent(roleGroup),
-         clusterSpec.getAppConfOperations().getOrAddComponent(roleGroup),
-         credentials);
-    execute(launcher);
-  }
-
-  /**
-   * Thread that runs on the AM to launch a container
-   */
-  private class RoleLauncher implements Runnable {
-
-    private final ContainerAssignment assignment;
-    // Allocated container
-    public final Container container;
-    private final MapOperations resourceComponent;
-    private final MapOperations appComponent;
-    private final AggregateConf instanceDefinition;
-    public final ProviderRole role;
-    private final Credentials credentials;
-    private Exception raisedException;
-
-    public RoleLauncher(ContainerAssignment assignment,
-        AggregateConf instanceDefinition,
-        MapOperations resourceComponent,
-        MapOperations appComponent,
-        Credentials credentials) {
-      this.assignment = assignment;
-      this.credentials = credentials;
-      this.container = assignment.container;
-      RoleStatus roleStatus = assignment.role;
-
-      assert resourceComponent != null;
-      assert appComponent != null;
-      ProviderRole providerRole = roleStatus.getProviderRole();
-      assert providerRole != null;
-      this.role = providerRole;
-      this.resourceComponent = resourceComponent;
-      this.appComponent = appComponent;
-      this.instanceDefinition = instanceDefinition;
-    }
-
-    public Exception getRaisedException() {
-      return raisedException;
-    }
-
-    @Override
-    public String toString() {
-      return "RoleLauncher{" +
-             "container=" + container.getId() +
-             ", containerRole='" + role.name + '\'' +
-             ", containerGroup='" + role.group + '\'' +
-             '}';
-    }
-
-    @Override
-    public void run() {
-      try {
-        ContainerLauncher containerLauncher =
-            new ContainerLauncher(getConfig(), fs, container, credentials);
-        containerLauncher.setupUGI();
-        containerLauncher.putEnv(envVars);
-
-        log.debug("Launching container {} into role {}",
-                  container.getId(),
-                  role.name);
-
-        //now build up the configuration data
-        Path containerTmpDirPath =
-          new Path(launcherTmpDirPath, container.getId().toString());
-        provider.buildContainerLaunchContext(containerLauncher,
-            instanceDefinition,
-            container,
-            role,
-            fs,
-            generatedConfDirPath,
-            resourceComponent,
-            appComponent,
-            containerTmpDirPath);
-
-        RoleInstance instance = new RoleInstance(container);
-        String[] envDescription = containerLauncher.dumpEnvToString();
-
-        String commandsAsString = containerLauncher.getCommandsAsString();
-        log.info("Starting container with command: {}",
-                 commandsAsString);
-
-        instance.command = commandsAsString;
-        instance.role = role.name;
-        instance.group = role.group;
-        instance.roleId = role.id;
-        instance.appVersion = instanceDefinition.getAppConfOperations()
-            .getGlobalOptions().get(SliderKeys.APP_VERSION);
-        instance.environment = envDescription;
-        int delay = appComponent.getOptionInt(
-            AgentKeys.KEY_CONTAINER_LAUNCH_DELAY, 0);
-        int maxDelay =
-            getConfig().getInt(YarnConfiguration.RM_CONTAINER_ALLOC_EXPIRY_INTERVAL_MS,
-                               YarnConfiguration.DEFAULT_RM_CONTAINER_ALLOC_EXPIRY_INTERVAL_MS);
-        if (delay > maxDelay/1000) {
-          log.warn("Container launch delay of {} exceeds the maximum allowed of"
-                   + " {} seconds.  Delay will not be utilized.",
-                   delay, maxDelay/1000);
-          delay = 0;
-        }
-        log.info("Container launch delay for {} set to {} seconds",
-                 role.name, delay);
-        actionQueue.schedule(new ActionStartContainer("starting " + role.name,
-                                                      container,
-                                                      containerLauncher.completeContainerLaunch(),
-                                                      instance,
-                                                      delay,
-                                                      TimeUnit.SECONDS));
-      } catch (Exception e) {
-        log.error("Exception thrown while trying to start {}: {}",
-            role.name, e, e);
-        raisedException = e;
-      }
-    }
-
-  }
-}


[36/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionRegistryArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionRegistryArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionRegistryArgs.java
deleted file mode 100644
index da1b0e5..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionRegistryArgs.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.UsageException;
-import org.apache.slider.core.registry.docstore.ConfigFormat;
-
-import static org.apache.slider.common.params.SliderActions.ACTION_REGISTRY;
-import static org.apache.slider.common.params.SliderActions.DESCRIBE_ACTION_REGISTRY;
-import java.io.File;
-
-/**
- * Registry actions
- * 
- * --instance {app name}, if  a / is in it, refers underneath?
- * --dest {destfile}
- * --list : list instances of slider service
- * --listfiles 
- */
-@Parameters(commandNames = {ACTION_REGISTRY},
-            commandDescription = DESCRIBE_ACTION_REGISTRY)
-
-public class ActionRegistryArgs extends AbstractActionArgs {
-
-  public static final String USAGE =
-      "Usage: " + SliderActions.ACTION_REGISTRY
-      + " ("
-      + Arguments.ARG_LIST + "|"
-      + Arguments.ARG_LISTCONF + "|"
-      + Arguments.ARG_LISTEXP + "|"
-      + Arguments.ARG_LISTFILES + "|"
-      + Arguments.ARG_GETCONF + "|"
-      + Arguments.ARG_GETEXP + "> "
-      + Arguments.ARG_NAME + " <name> "
-      + " )"
-      + "[" + Arguments.ARG_VERBOSE + "] "
-      + "[" + Arguments.ARG_USER + "] "
-      + "[" + Arguments.ARG_OUTPUT + " <filename> ] "
-      + "[" + Arguments.ARG_SERVICETYPE + " <servicetype> ] "
-      + "[" + Arguments.ARG_FORMAT + " <xml|json|properties>] "
-      + System.getProperty("line.separator")
-      + "Arguments.ARG_GETEXP only supports " + Arguments.ARG_FORMAT + " json"
-      ;
-  public ActionRegistryArgs() {
-  }
-
-  public ActionRegistryArgs(String name) {
-    this.name = name;
-  }
-
-  @Override
-  public String getActionName() {
-    return ACTION_REGISTRY;
-  }
-
-  /**
-   * Get the min #of params expected
-   * @return the min number of params in the {@link #parameters} field
-   */
-  @Override
-  public int getMinParams() {
-    return 0;
-  }
-  
-  @Parameter(names = {ARG_LIST}, 
-      description = "list services")
-  public boolean list;
-
-  @Parameter(names = {ARG_LISTCONF}, 
-      description = "list configurations")
-  public boolean listConf;
-
-  @Parameter(names = {ARG_GETCONF},
-      description = "get configuration")
-  public String getConf;
-
-  @Parameter(names = {ARG_LISTEXP},
-             description = "list exports")
-  public boolean listExports;
-
-  @Parameter(names = {ARG_GETEXP},
-             description = "get export")
-  public String getExport;
-
-  @Parameter(names = {ARG_LISTFILES},
-      description = "list files")
-  public String listFiles;
-
-  @Parameter(names = {ARG_GETFILES},
-      description = "get files")
-  public String getFiles;
-
-  //--format 
-  @Parameter(names = ARG_FORMAT,
-      description = "Format for a response: <xml|json|properties>")
-  public String format = ConfigFormat.XML.toString() ;
-
-  @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT, ARG_DEST},
-      description = "Output destination")
-  public File out;
-
-  @Parameter(names = {ARG_NAME},
-      description = "name of an instance")
-  public String name;
-
-  @Parameter(names = {ARG_SERVICETYPE},
-      description = "optional service type")
-  public String serviceType = SliderKeys.APP_TYPE;
-
-  @Parameter(names = {ARG_VERBOSE},
-      description = "verbose output")
-  public boolean verbose;
-
-  @Parameter(names = {ARG_INTERNAL},
-      description = "fetch internal registry entries")
-  public boolean internal;
-
-  @Parameter(names = {ARG_USER},
-      description = "the name of the user whose application is being resolved")
-  public String user;
-
-  /**
-   * validate health of all the different operations
-   * @throws BadCommandArgumentsException
-   */
-  @Override
-  public void validate() throws BadCommandArgumentsException, UsageException {
-    super.validate();
-
-    //verify that at most one of the operations is set
-    int gets = s(getConf) + s(getFiles) + s(getExport);
-    int lists = s(list) + s(listConf) + s(listFiles) + s(listExports);
-    int set = lists + gets;
-    if (set > 1) {
-      throw new UsageException(USAGE);
-    }
-
-    if (out != null && ( set == 0)) {
-      throw new UsageException("output path"
-           + " is only supported on 'get' operations: ");
-    }
-    if (!list && !is(name)) {
-      throw new UsageException("Argument " + ARG_NAME
-           +" missing: ");
-
-    }
-  }
-  
-  private int s(String arg) {
-    return is(arg) ? 1 : 0;
-  }
-
-  private boolean is(String arg) {
-    return arg != null;
-  }
-
-  private int s(boolean arg) {
-    return arg ? 1 : 0;
-  }
-
-  private String ifdef(String arg, boolean val) {
-    return val ? (arg + " "): "";
-  }
-
-  private String ifdef(String arg, String val) {
-    if (is(val)) {
-      return arg + " " + val + " ";
-    } else {
-      return "";
-    }
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder(ACTION_REGISTRY);
-    sb.append(' ');
-    sb.append(ifdef(ARG_LIST, list));
-    sb.append(ifdef(ARG_LISTCONF, listConf));
-    sb.append(ifdef(ARG_LISTFILES, listFiles));
-    sb.append(ifdef(ARG_GETCONF, getConf));
-    sb.append(ifdef(ARG_GETFILES, getFiles));
-
-    sb.append(ifdef(ARG_NAME, name));
-    sb.append(ifdef(ARG_SERVICETYPE, serviceType));
-
-
-    sb.append(ifdef(ARG_VERBOSE, verbose));
-    sb.append(ifdef(ARG_INTERNAL, internal));
-
-    if (out != null) {
-      sb.append(ifdef(ARG_OUTPUT, out.toString()));
-    }
-    sb.append(ifdef(ARG_FORMAT, format));
-
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionResolveArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionResolveArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionResolveArgs.java
deleted file mode 100644
index 2ee075a..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionResolveArgs.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-import org.apache.commons.lang.StringUtils;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.UsageException;
-
-import java.io.File;
-
-import static org.apache.slider.common.params.SliderActions.ACTION_RESOLVE;
-import static org.apache.slider.common.params.SliderActions.DESCRIBE_ACTION_REGISTRY;
-
-/**
- * Resolve registry entries
- * 
- * --path {path}
- * --out {destfile}
- * --verbose
- * --list
- */
-@Parameters(commandNames = {ACTION_RESOLVE},
-            commandDescription = DESCRIBE_ACTION_REGISTRY)
-public class ActionResolveArgs extends AbstractActionArgs {
-
-  public static final String USAGE =
-      "Usage: " + SliderActions.ACTION_RESOLVE
-      + " "
-      + ARG_PATH + " <path> "
-      + "[" + ARG_LIST + "] "
-      + "[" + ARG_OUTPUT + " <filename> ] "
-      + "[" + ARG_DESTDIR + " <directory> ] "
-      ;
-  public ActionResolveArgs() {
-  }
-
-  @Override
-  public String getActionName() {
-    return ACTION_RESOLVE;
-  }
-
-  /**
-   * Get the min #of params expected
-   * @return the min number of params in the {@link #parameters} field
-   */
-  @Override
-  public int getMinParams() {
-    return 0;
-  }
-  
-  @Parameter(names = {ARG_LIST}, 
-      description = "list services")
-  public boolean list;
-
-  @Parameter(names = {ARG_PATH},
-      description = "resolve a path")
-  public String path;
-
-  @Parameter(names = {ARG_DESTDIR},
-      description = "destination directory for operations")
-  public File destdir;
-
-  @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},
-      description = "dest file")
-  public File out;
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder(ACTION_RESOLVE).append(" ");
-    sb.append(ARG_PATH).append(" ").append(path).append(" ");
-    if (list) {
-      sb.append(ARG_LIST).append(" ");
-    }
-    if (destdir != null) {
-      sb.append(ARG_DESTDIR).append(" ").append(destdir).append(" ");
-    }
-    if (out != null) {
-      sb.append(ARG_OUTPUT).append(" ").append(out).append(" ");
-    }
-    return sb.toString();
-  }
-
-  @Override
-  public void validate() throws BadCommandArgumentsException, UsageException {
-    super.validate();
-    if (StringUtils.isEmpty(path)) {
-      throw new BadCommandArgumentsException("Missing mandatory argument "
-                                             + ARG_PATH);
-    }
-    if (list && out != null) {
-      throw new BadCommandArgumentsException("Argument "
-                                             + ARG_OUTPUT +
-                                             " not supported for " + ARG_LIST);
-    }
-    if (out != null && destdir != null) {
-      throw new BadCommandArgumentsException(
-          ARG_OUTPUT + " and " + ARG_DESTDIR + " cannot be used together"
-      );
-    }
-  }
-
-  public String getPath() {
-    return path;
-  }
-
-  public void setPath(String path) {
-    this.path = path;
-  }
-
-  public boolean isList() {
-    return list;
-  }
-
-  public void setList(boolean list) {
-    this.list = list;
-  }
-
-  public File getDestdir() {
-    return destdir;
-  }
-
-  public void setDestdir(File destdir) {
-    this.destdir = destdir;
-  }
-
-  public File getOut() {
-    return out;
-  }
-
-  public void setOut(File out) {
-    this.out = out;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionResourceArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionResourceArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionResourceArgs.java
deleted file mode 100644
index 60fcc87..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionResourceArgs.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-
-@Parameters(commandNames = {SliderActions.ACTION_RESOURCE},
-    commandDescription = SliderActions.DESCRIBE_ACTION_RESOURCE)
-
-public class ActionResourceArgs  extends AbstractActionArgs {
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_RESOURCE;
-  }
-
-  @Parameter(names = {ARG_INSTALL},
-      description = "Install the resource(s)")
-  public boolean install;
-
-  @Parameter(names = {ARG_DELETE},
-      description = "Delete the file")
-  public boolean delete;
-
-  @Parameter(names = {ARG_LIST},
-      description = "List of installed files")
-  public boolean list;
-
-  @Parameter(names = {ARG_RESOURCE},
-      description = "Name of the file or directory")
-  public String resource;
-
-  @Parameter(names = {ARG_DESTDIR},
-      description = "The name of the folder in which to store the resources")
-  public String folder;
-
-  @Parameter(names = {ARG_OVERWRITE}, description = "Overwrite existing resource(s)")
-  public boolean overwrite = false;
-
-  /**
-   * Get the min #of params expected
-   * @return the min number of params in the {@link #parameters} field
-   */
-  public int getMinParams() {
-    return 0;
-  }
-
-  @Override
-  public int getMaxParams() {
-    return 3;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionStatusArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionStatusArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionStatusArgs.java
deleted file mode 100644
index 00178df..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionStatusArgs.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-
-@Parameters(commandNames = {SliderActions.ACTION_STATUS},
-            commandDescription = SliderActions.DESCRIBE_ACTION_STATUS)
-
-public class ActionStatusArgs extends AbstractActionArgs {
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_STATUS;
-  }
-
-  @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},
-             description = "Output file for the status information")
-  public String output;
-
-  public String getOutput() {
-    return output;
-  }
-
-  public void setOutput(String output) {
-    this.output = output;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionThawArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionThawArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionThawArgs.java
deleted file mode 100644
index b43a14e..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionThawArgs.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameters;
-import com.beust.jcommander.ParametersDelegate;
-
-import java.io.File;
-
-@Parameters(commandNames = {SliderActions.ACTION_THAW},
-            commandDescription = SliderActions.DESCRIBE_ACTION_THAW)
-public class ActionThawArgs extends AbstractActionArgs implements
-                                                       WaitTimeAccessor,
-                                                       LaunchArgsAccessor {
-
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_THAW;
-  }
-
-  @Override
-  public int getWaittime() {
-    return launchArgs.getWaittime();
-  }
-
-  @ParametersDelegate
-  LaunchArgsDelegate launchArgs = new LaunchArgsDelegate();
-
-  @Override
-  public String getRmAddress() {
-    return launchArgs.getRmAddress();
-  }
-
-  @Override
-  public void setWaittime(int waittime) {
-    launchArgs.setWaittime(waittime);
-  }
-
-
-  @Override
-  public File getOutputFile() {
-    return launchArgs.getOutputFile();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionTokensArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionTokensArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionTokensArgs.java
deleted file mode 100644
index 9f93c4e..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionTokensArgs.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.UsageException;
-
-import java.io.File;
-
-@Parameters(commandNames = {SliderActions.ACTION_TOKENS},
-            commandDescription = "save tokens to a file or list tokens in a file")
-public class ActionTokensArgs extends AbstractActionArgs {
-
-  public static final String DUPLICATE_ARGS = "Only one of " +
-      ARG_SOURCE + " and " + ARG_OUTPUT + " allowed";
-
-  public static final String MISSING_KT_PROVIDER =
-      "Both " + ARG_KEYTAB + " and " + ARG_PRINCIPAL
-      + " must be provided";
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_TOKENS;
-  }
-
-  @Parameter(names = {ARG_OUTPUT},
-             description = "File to write")
-  public File output;
-
-  @Parameter(names = {ARG_SOURCE},
-             description = "source file")
-  public File source;
-
-  @Parameter(names = {ARG_KEYTAB}, description = "keytab to use")
-  public File keytab;
-
-  @Parameter(names = {ARG_PRINCIPAL}, description = "principal to log in from a keytab")
-  public String principal="";
-
-  /**
-   * Get the min #of params expected
-   * @return the min number of params in the {@link #parameters} field
-   */
-  public int getMinParams() {
-    return 0;
-  }
-
-  @Override
-  public void validate() throws BadCommandArgumentsException, UsageException {
-    super.validate();
-    if (output != null && source != null) {
-      throw new BadCommandArgumentsException(DUPLICATE_ARGS);
-    }
-
-    // this is actually a !xor
-    if (keytab != null ^ !principal.isEmpty()) {
-      throw new BadCommandArgumentsException(MISSING_KT_PROVIDER);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionUpdateArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionUpdateArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionUpdateArgs.java
deleted file mode 100644
index 9d76bd8..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionUpdateArgs.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameters;
-
-@Parameters(commandNames = {SliderActions.ACTION_UPDATE},
-            commandDescription = SliderActions.DESCRIBE_ACTION_UPDATE)
-
-public class ActionUpdateArgs extends AbstractClusterBuildingActionArgs {
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_UPDATE;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionUpgradeArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionUpgradeArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionUpgradeArgs.java
deleted file mode 100644
index 6ef51b2..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionUpgradeArgs.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-import com.beust.jcommander.ParametersDelegate;
-
-@Parameters(commandNames = { SliderActions.ACTION_UPGRADE },
-            commandDescription = SliderActions.DESCRIBE_ACTION_UPGRADE)
-public class ActionUpgradeArgs extends AbstractClusterBuildingActionArgs
-    implements WaitTimeAccessor, LaunchArgsAccessor {
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_UPGRADE;
-  }
-
-  @ParametersDelegate
-  LaunchArgsDelegate launchArgs = new LaunchArgsDelegate();
-
-  @Override
-  public File getOutputFile() {
-    return launchArgs.getOutputFile();
-  }
-
-  @Override
-  public String getRmAddress() {
-    return launchArgs.getRmAddress();
-  }
-
-  @Override
-  public int getWaittime() {
-    return launchArgs.getWaittime();
-  }
-
-  @Override
-  public void setWaittime(int waittime) {
-    launchArgs.setWaittime(waittime);
-  }
-
-  @Parameter(names={ARG_CONTAINERS}, variableArity = true,
-             description = "stop specific containers")
-  public List<String> containers = new ArrayList<>(0);
-
-  @Parameter(names={ARG_COMPONENTS}, variableArity = true,
-      description = "stop all containers of specific components")
-  public List<String> components = new ArrayList<>(0);
-
-  @Parameter(names = {ARG_FORCE},
-      description = "force spec upgrade operation")
-  public boolean force;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ActionVersionArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionVersionArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionVersionArgs.java
deleted file mode 100644
index b9d212b..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionVersionArgs.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameters;
-
-/**
- * The version command
- */
-@Parameters(commandNames = {SliderActions.ACTION_VERSION},
-            commandDescription = SliderActions.DESCRIBE_ACTION_VERSION)
-public class ActionVersionArgs extends AbstractActionArgs {
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_VERSION;
-  }
-
-  public int getMinParams() {
-    return 0;
-  }
-
-  /**
-   * This action does not need hadoop services
-   * @return false
-   */
-  @Override
-  public boolean getHadoopServicesRequired() {
-    return false;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/AddonArgsDelegate.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/AddonArgsDelegate.java b/slider-core/src/main/java/org/apache/slider/common/params/AddonArgsDelegate.java
deleted file mode 100644
index 3ef8e19..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/AddonArgsDelegate.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public class AddonArgsDelegate extends AbstractArgsDelegate {
-
-  /**
-   * This is a listing of addon packages
-   */
-  @Parameter(names = {ARG_ADDON},
-      arity = 2,
-      description = "--addon <name> <folder or package>",
-      splitter = DontSplitArguments.class)
-  public List<String> addonTuples = new ArrayList<>(0);
-
-
-  /**
-   * Get the list of addons (may be empty, but never null)
-   *
-   * @return map of named addons
-   *
-   * @throws BadCommandArgumentsException parse problem
-   */
-  public Map<String, String> getAddonMap() throws BadCommandArgumentsException {
-    return convertTupleListToMap("addon", addonTuples);
-  }
-
-  public List<String> getAddonTuples() {
-    return addonTuples;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/AppAndResouceOptionArgsDelegate.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/AppAndResouceOptionArgsDelegate.java b/slider-core/src/main/java/org/apache/slider/common/params/AppAndResouceOptionArgsDelegate.java
deleted file mode 100644
index f171708..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/AppAndResouceOptionArgsDelegate.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Delegate for application and resource options
- */
-public class AppAndResouceOptionArgsDelegate extends AbstractArgsDelegate {
-
-
-  /**
-   * Options key value
-   */
-  @Parameter(names = {ARG_OPTION, ARG_OPTION_SHORT}, arity = 2,
-             description = ARG_OPTION + "<name> <value>",
-             splitter = DontSplitArguments.class)
-  public List<String> optionTuples = new ArrayList<>(0);
-
-
-  /**
-   * All the app component option triples
-   */
-  @Parameter(names = {ARG_COMP_OPT,  ARG_COMP_OPT_SHORT,  ARG_ROLEOPT}, arity = 3,
-             description = "Component option " + ARG_COMP_OPT +
-                           " <component> <name> <option>",
-             splitter = DontSplitArguments.class)
-  public List<String> compOptTriples = new ArrayList<>(0);
-
-  /**
-   * Resource Options
-   */
-  @Parameter(names = {ARG_RESOURCE_OPT, ARG_RESOURCE_OPT_SHORT}, arity = 2,
-             description = "Resource option "+ ARG_RESOURCE_OPT + "<name> <value>",
-             splitter = DontSplitArguments.class)
-  public List<String> resOptionTuples = new ArrayList<>(0);
-
-
-  /**
-   * All the resource component option triples
-   */
-  @Parameter(names = {ARG_RES_COMP_OPT, ARG_RES_COMP_OPT_SHORT,}, arity = 3,
-             description = "Component resource option " + ARG_RES_COMP_OPT +
-                           " <component> <name> <option>",
-             splitter = DontSplitArguments.class)
-  public List<String> resCompOptTriples = new ArrayList<>(0);
-
-
-  public Map<String, String> getOptionsMap() throws
-                                             BadCommandArgumentsException {
-    return convertTupleListToMap(ARG_OPTION, optionTuples);
-  }
-
-  /**
-   * Get the role heap mapping (may be empty, but never null)
-   * @return role heap mapping
-   * @throws BadCommandArgumentsException parse problem
-   */
-  public Map<String, Map<String, String>> getCompOptionMap() throws
-                                                             BadCommandArgumentsException {
-    return convertTripleListToMaps(ARG_COMP_OPT, compOptTriples);
-  }
-
-  public Map<String, String> getResourceOptionsMap() throws
-                                             BadCommandArgumentsException {
-    return convertTupleListToMap(ARG_RESOURCE_OPT, resOptionTuples);
-  }
-
-  /**
-   * Get the role heap mapping (may be empty, but never null)
-   * @return role heap mapping
-   * @throws BadCommandArgumentsException parse problem
-   */
-  public Map<String, Map<String, String>> getResourceCompOptionMap() throws
-                                                             BadCommandArgumentsException {
-    return convertTripleListToMaps(ARG_RES_COMP_OPT, resCompOptTriples);
-  }
-
-  public void setOption(String key, String value) {
-    optionTuples.add(key);
-    optionTuples.add(value);
-  }
-
-  public void setResourceOption(String key, String value) {
-    resOptionTuples.add(key);
-    resOptionTuples.add(value);
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ArgOps.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ArgOps.java b/slider-core/src/main/java/org/apache/slider/common/params/ArgOps.java
deleted file mode 100644
index 12a2032..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ArgOps.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.ErrorStrings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Static argument manipulation operations
- */
-public class ArgOps {
-
-  private static final Logger
-    log = LoggerFactory.getLogger(ArgOps.class);
-
-  /**
-   * create a 3-tuple
-   */
-  public static List<Object> triple(String msg, int min, int max) {
-    List<Object> l = new ArrayList<>(3);
-    l.add(msg);
-    l.add(min);
-    l.add(max);
-    return l;
-  }
-
-  public static void applyFileSystemBinding(String filesystemBinding,
-      Configuration conf) {
-    if (filesystemBinding != null) {
-      //filesystem argument was set -this overwrites any defaults in the
-      //configuration
-      FileSystem.setDefaultUri(conf, filesystemBinding);
-    }
-  }
-
-  public static void splitPairs(Collection<String> pairs,
-                                Map<String, String> dest) {
-    for (String prop : pairs) {
-      String[] keyval = prop.split("=", 2);
-      if (keyval.length == 2) {
-        dest.put(keyval[0], keyval[1]);
-      }
-    }
-  }
-
-
-  public static void applyDefinitions(Map<String, String> definitionMap,
-                                      Configuration conf) {
-    for (Map.Entry<String, String> entry : definitionMap.entrySet()) {
-      String key = entry.getKey();
-      String val = entry.getValue();
-      log.debug("configuration[{}]<=\"{}\"", key, val);
-      conf.set(key, val, "command line");
-    }
-  }
-
-  /**
-   * Create a map from a tuple list like ['worker','2','master','1] into a map
-   * ['worker':'2',"master":'1'];
-   * Duplicate entries also trigger errors
-   * @param description description for errors
-   * @param list list to conver to tuples
-   * @return the map of key value pairs -unordered.
-   * @throws BadCommandArgumentsException odd #of arguments received
-   */
-  public static Map<String, String> convertTupleListToMap(String description,
-                                                          List<String> list) throws
-                                                                             BadCommandArgumentsException {
-    Map<String, String> results = new HashMap<>();
-    if (list != null && !list.isEmpty()) {
-      int size = list.size();
-      if (size % 2 != 0) {
-        //odd number of elements, not permitted
-        throw new BadCommandArgumentsException(
-          ErrorStrings.ERROR_PARSE_FAILURE + description);
-      }
-      for (int count = 0; count < size; count += 2) {
-        String key = list.get(count);
-        String val = list.get(count + 1);
-        if (results.get(key) != null) {
-          throw new BadCommandArgumentsException(
-            ErrorStrings.ERROR_DUPLICATE_ENTRY + description
-            + ": " + key);
-        }
-        results.put(key, val);
-      }
-    }
-    return results;
-  }
-
-  /**
-   * Create a map from a tuple list like
-   * ['worker','heapsize','5G','master','heapsize','2M'] into a map
-   * ['worker':'2',"master":'1'];
-   * Duplicate entries also trigger errors
-
-   * @throws BadCommandArgumentsException odd #of arguments received
-   */
-  public static Map<String, Map<String, String>> convertTripleListToMaps(String description,
-         List<String> list) throws BadCommandArgumentsException {
-
-    Map<String, Map<String, String>> results = new HashMap<>();
-    if (list != null && !list.isEmpty()) {
-      int size = list.size();
-      if (size % 3 != 0) {
-        //wrong number of elements, not permitted
-        throw new BadCommandArgumentsException(
-          ErrorStrings.ERROR_PARSE_FAILURE + description);
-      }
-      for (int count = 0; count < size; count += 3) {
-        String role = list.get(count);
-        String key = list.get(count + 1);
-        String val = list.get(count + 2);
-        Map<String, String> roleMap = results.get(role);
-        if (roleMap == null) {
-          //demand create new role map
-          roleMap = new HashMap<>();
-          results.put(role, roleMap);
-        }
-        if (roleMap.get(key) != null) {
-          throw new BadCommandArgumentsException(
-            ErrorStrings.ERROR_DUPLICATE_ENTRY + description
-            + ": for key " + key + " under " + role);
-        }
-        roleMap.put(key, val);
-      }
-    }
-    return results;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java b/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java
deleted file mode 100644
index aec4e26..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-/**
- * Here are all the arguments that may be parsed by the client or server
- * command lines. 
- * 
- * Important: Please keep the main list in alphabetical order
- * so it is easier to see what arguments are there
- */
-public interface Arguments {
-  String ARG_ADDON = "--addon";
-  String ARG_ALL = "--all";
-  String ARG_ALIAS = "--alias";
-  String ARG_APPLICATION = "--application";
-  String ARG_APPDEF = "--appdef";
-  String ARG_APP_HOME = "--apphome";
-  String ARG_BASE_PATH = "--basepath";
-  String ARG_CLIENT = "--client";
-  String ARG_CONFDIR = "--appconf";
-  String ARG_COMPONENT = "--component";
-  String ARG_COMPONENT_SHORT = "--comp";
-  String ARG_COMPONENTS = "--components";
-  String ARG_COMP_OPT= "--compopt";
-  String ARG_COMP_OPT_SHORT = "--co";
-  String ARG_CONFIG = "--config";
-  String ARG_CONTAINERS = "--containers";
-  String ARG_CREDENTIALS = "--credentials";
-  String ARG_DEBUG = "--debug";
-  String ARG_DEFINE = "-D";
-  String ARG_DELETE = "--delete";
-  String ARG_DEST = "--dest";
-  String ARG_DESTDIR = "--destdir";
-  String ARG_DESTFILE = "--destfile";
-  String ARG_EXITCODE = "--exitcode";
-  String ARG_FAIL = "--fail";
-  /**
-   filesystem-uri: {@value}
-   */
-  String ARG_FILESYSTEM = "--fs";
-  String ARG_FILESYSTEM_LONG = "--filesystem";
-  String ARG_FOLDER = "--folder";
-  String ARG_FORCE = "--force";
-  String ARG_FORMAT = "--format";
-  String ARG_GETCERTSTORE = "--getcertstore";
-  String ARG_GETCONF = "--getconf";
-  String ARG_GETEXP = "--getexp";
-  String ARG_GETFILES = "--getfiles";
-  String ARG_HEALTHY= "--healthy";
-  String ARG_HELP = "--help";
-  String ARG_HOSTNAME = "--hostname";
-  String ARG_ID = "--id";
-  String ARG_IMAGE = "--image";
-  String ARG_INSTALL = "--install";
-  String ARG_INTERNAL = "--internal";
-  String ARG_KEYLEN = "--keylen";
-  String ARG_KEYTAB = "--keytab";
-  String ARG_KEYSTORE = "--keystore";
-  String ARG_KEYTABINSTALL = ARG_INSTALL;
-  String ARG_KEYTABDELETE = ARG_DELETE;
-  String ARG_KEYTABLIST = "--list";
-  String ARG_LABEL = "--label";
-  String ARG_LEVEL = "--level";
-  String ARG_LIST = "--list";
-  String ARG_LISTCONF = "--listconf";
-  String ARG_LISTEXP = "--listexp";
-  String ARG_LISTFILES = "--listfiles";
-  String ARG_LIVE = "--live";
-  String ARG_MANAGER = "--manager";
-  String ARG_MANAGER_SHORT = "--m";
-  String ARG_MESSAGE = "--message";
-  String ARG_METAINFO = "--metainfo";
-  String ARG_METAINFO_JSON = "--metainfojson";
-  String ARG_NAME = "--name";
-  String ARG_OPTION = "--option";
-  String ARG_OPTION_SHORT = "-O";
-  String ARG_OUTPUT = "--out";
-  String ARG_OUTPUT_SHORT = "-o";
-  String ARG_OVERWRITE = "--overwrite";
-  String ARG_PACKAGE = "--package";
-  String ARG_PASSWORD = "--password";
-  String ARG_PATH = "--path";
-  String ARG_PKGDELETE = ARG_DELETE;
-  String ARG_PKGINSTANCES = "--instances";
-  String ARG_PKGLIST = ARG_LIST;
-  String ARG_PRINCIPAL = "--principal";
-  String ARG_PROVIDER = "--provider";
-  String ARG_QUEUE = "--queue";
-  String ARG_REPLACE_PKG = "--replacepkg";
-  String ARG_RESOURCE = "--resource";
-  String ARG_RESOURCES = "--resources";
-  String ARG_RES_COMP_OPT = "--rescompopt";
-  String ARG_RES_COMP_OPT_SHORT = "--rco";
-  String ARG_RESOURCE_MANAGER = "--rm";
-  String ARG_RESOURCE_OPT = "--resopt";
-  String ARG_RESOURCE_OPT_SHORT = "-ro";
-  String ARG_SECURE = "--secure";
-  String ARG_SERVICETYPE = "--servicetype";
-  String ARG_SERVICES = "--services";
-  String ARG_SLIDER = "--slider";
-  String ARG_SOURCE = "--source";
-  String ARG_STATE = "--state";
-  String ARG_SYSPROP = "-S";
-  String ARG_TEMPLATE = "--template";
-  String ARG_TRUSTSTORE = "--truststore";
-  String ARG_USER = "--user";
-  String ARG_UPLOAD = "--upload";
-  String ARG_VERBOSE = "--verbose";
-  String ARG_VERSION = "--version";
-  String ARG_WAIT = "--wait";
-  String ARG_YARN = "--yarn";
-  String ARG_ZKHOSTS = "--zkhosts";
-  String ARG_ZKPATH = "--zkpath";
-  String ARG_ZKPORT = "--zkport";
-/*
- STOP: DO NOT ADD YOUR ARGUMENTS HERE. GO BACK AND INSERT THEM IN THE
- RIGHT PLACE IN THE LIST
- */
-
-
-  /**
-   * Deprecated: use ARG_COMPONENT
-   */
-  @Deprecated
-  String ARG_ROLE = "--role";
-
-  /**
-   * Deprecated: use ARG_COMP_OPT
-   */
-  @Deprecated
-  String ARG_ROLEOPT = "--roleopt";
-
-  /**
-   * server: URI for the cluster
-   */
-  String ARG_CLUSTER_URI = "-cluster-uri";
-
-
-  /**
-   * server: Path for the resource manager instance (required)
-   */
-  String ARG_RM_ADDR = "--rm";
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ClientArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ClientArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ClientArgs.java
deleted file mode 100644
index 4016cc9..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ClientArgs.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.slider.common.SliderXmlConfKeys;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.ErrorStrings;
-import org.apache.slider.core.exceptions.SliderException;
-
-import java.util.Collection;
-
-/**
- * Slider Client CLI Args
- */
-
-public class ClientArgs extends CommonArgs {
-
-  /*
-   
-   All the arguments for specific actions
-  
-   */
-  /**
-   * This is not bonded to jcommander, it is set up
-   * after the construction to point to the relevant
-   * entry
-   * 
-   * KEEP IN ALPHABETICAL ORDER
-   */
-  private AbstractClusterBuildingActionArgs buildingActionArgs;
-
-  // =========================================================
-  // Keep all of these in alphabetical order. Thanks.
-  // =========================================================
-
-  private final ActionAMSuicideArgs actionAMSuicideArgs = new ActionAMSuicideArgs();
-  private final ActionBuildArgs actionBuildArgs = new ActionBuildArgs();
-  private final ActionClientArgs actionClientArgs = new ActionClientArgs();
-  private final ActionCreateArgs actionCreateArgs = new ActionCreateArgs();
-  private final ActionDependencyArgs actionDependencyArgs = new ActionDependencyArgs();
-  private final ActionDestroyArgs actionDestroyArgs = new ActionDestroyArgs();
-  private final ActionDiagnosticArgs actionDiagnosticArgs = new ActionDiagnosticArgs();
-  private final ActionExistsArgs actionExistsArgs = new ActionExistsArgs();
-  private final ActionFlexArgs actionFlexArgs = new ActionFlexArgs();
-  private final ActionFreezeArgs actionFreezeArgs = new ActionFreezeArgs();
-  private final ActionHelpArgs actionHelpArgs = new ActionHelpArgs();
-  private final ActionInstallPackageArgs actionInstallPackageArgs = new ActionInstallPackageArgs();
-  private final ActionInstallKeytabArgs actionInstallKeytabArgs = new ActionInstallKeytabArgs();
-  private final ActionKDiagArgs actionKDiagArgs = new ActionKDiagArgs();
-  private final ActionKeytabArgs actionKeytabArgs = new ActionKeytabArgs();
-  private final ActionKillContainerArgs actionKillContainerArgs =
-    new ActionKillContainerArgs();
-  private final ActionListArgs actionListArgs = new ActionListArgs();
-  private final ActionLookupArgs actionLookupArgs = new ActionLookupArgs();
-  private final ActionNodesArgs actionNodesArgs = new ActionNodesArgs();
-  private final ActionPackageArgs actionPackageArgs = new ActionPackageArgs();
-  private final ActionRegistryArgs actionRegistryArgs = new ActionRegistryArgs();
-  private final ActionResolveArgs actionResolveArgs = new ActionResolveArgs();
-  private final ActionResourceArgs actionResourceArgs = new ActionResourceArgs();
-  private final ActionStatusArgs actionStatusArgs = new ActionStatusArgs();
-  private final ActionThawArgs actionThawArgs = new ActionThawArgs();
-  private final ActionTokensArgs actionTokenArgs = new ActionTokensArgs();
-  private final ActionUpdateArgs actionUpdateArgs = new ActionUpdateArgs();
-  private final ActionUpgradeArgs actionUpgradeArgs = new ActionUpgradeArgs();
-  private final ActionVersionArgs actionVersionArgs = new ActionVersionArgs();
-
-  public ClientArgs(String[] args) {
-    super(args);
-  }
-
-  public ClientArgs(Collection args) {
-    super(args);
-  }
-
-  @Override
-  protected void addActionArguments() {
-
-    addActions(
-        actionAMSuicideArgs,
-        actionBuildArgs,
-        actionClientArgs,
-        actionCreateArgs,
-        actionDependencyArgs,
-        actionDestroyArgs,
-        actionDiagnosticArgs,
-        actionExistsArgs,
-        actionFlexArgs,
-        actionFreezeArgs,
-        actionHelpArgs,
-        actionInstallKeytabArgs,
-        actionInstallPackageArgs,
-        actionKDiagArgs,
-        actionKeytabArgs,
-        actionKillContainerArgs,
-        actionListArgs,
-        actionLookupArgs,
-        actionNodesArgs,
-        actionPackageArgs,
-        actionRegistryArgs,
-        actionResolveArgs,
-        actionResourceArgs,
-        actionStatusArgs,
-        actionThawArgs,
-        actionTokenArgs,
-        actionUpdateArgs,
-        actionUpgradeArgs,
-        actionVersionArgs
-    );
-  }
-
-  @Override
-  public void applyDefinitions(Configuration conf) throws
-                                                   BadCommandArgumentsException {
-    super.applyDefinitions(conf);
-    //RM
-    if (getManager() != null) {
-      log.debug("Setting RM to {}", getManager());
-      conf.set(YarnConfiguration.RM_ADDRESS, getManager());
-    }
-    if (getBasePath() != null) {
-      log.debug("Setting basePath to {}", getBasePath());
-      conf.set(SliderXmlConfKeys.KEY_SLIDER_BASE_PATH,
-          getBasePath().toString());
-    }
-  }
-
-  public ActionDiagnosticArgs getActionDiagnosticArgs() {
-	  return actionDiagnosticArgs;
-  }
-
-  public AbstractClusterBuildingActionArgs getBuildingActionArgs() {
-    return buildingActionArgs;
-  }
-
-  public ActionAMSuicideArgs getActionAMSuicideArgs() {
-    return actionAMSuicideArgs;
-  }
-
-  public ActionBuildArgs getActionBuildArgs() {
-    return actionBuildArgs;
-  }
-
-  public ActionInstallPackageArgs getActionInstallPackageArgs() { return actionInstallPackageArgs; }
-
-  public ActionClientArgs getActionClientArgs() { return actionClientArgs; }
-
-  public ActionPackageArgs getActionPackageArgs() { return actionPackageArgs; }
-
-  public ActionInstallKeytabArgs getActionInstallKeytabArgs() { return actionInstallKeytabArgs; }
-
-  public ActionKDiagArgs getActionKDiagArgs() {
-    return actionKDiagArgs;
-  }
-
-  public ActionKeytabArgs getActionKeytabArgs() { return actionKeytabArgs; }
-
-  public ActionUpdateArgs getActionUpdateArgs() {
-    return actionUpdateArgs;
-  }
-
-  public ActionUpgradeArgs getActionUpgradeArgs() {
-    return actionUpgradeArgs;
-  }
-
-  public ActionCreateArgs getActionCreateArgs() {
-    return actionCreateArgs;
-  }
-
-  public ActionDependencyArgs getActionDependencyArgs() {
-    return actionDependencyArgs;
-  }
-
-  public ActionDestroyArgs getActionDestroyArgs() {
-    return actionDestroyArgs;
-  }
-
-  public ActionExistsArgs getActionExistsArgs() {
-    return actionExistsArgs;
-  }
-
-  public ActionFlexArgs getActionFlexArgs() {
-    return actionFlexArgs;
-  }
-
-  public ActionFreezeArgs getActionFreezeArgs() {
-    return actionFreezeArgs;
-  }
-
-  public ActionKillContainerArgs getActionKillContainerArgs() {
-    return actionKillContainerArgs;
-  }
-
-  public ActionListArgs getActionListArgs() {
-    return actionListArgs;
-  }
-
-  public ActionNodesArgs getActionNodesArgs() {
-    return actionNodesArgs;
-  }
-
-  public ActionLookupArgs getActionLookupArgs() {
-    return actionLookupArgs;
-  }
-
-  public ActionRegistryArgs getActionRegistryArgs() {
-    return actionRegistryArgs;
-  }
-
-  public ActionResolveArgs getActionResolveArgs() {
-    return actionResolveArgs;
-  }
-
-  public ActionResourceArgs getActionResourceArgs() {
-    return actionResourceArgs;
-  }
-
-  public ActionStatusArgs getActionStatusArgs() {
-    return actionStatusArgs;
-  }
-
-  public ActionThawArgs getActionThawArgs() {
-    return actionThawArgs;
-  }
-
-  public ActionTokensArgs getActionTokenArgs() {
-    return actionTokenArgs;
-  }
-
-  /**
-   * Look at the chosen action and bind it as the core action for the operation.
-   * @throws SliderException bad argument or similar
-   */
-  @Override
-  public void applyAction() throws SliderException {
-    String action = getAction();
-    if (SliderUtils.isUnset(action)) {
-      action = ACTION_HELP;
-    }
-    switch (action) {
-      case ACTION_BUILD:
-        bindCoreAction(actionBuildArgs);
-        //its a builder, so set those actions too
-        buildingActionArgs = actionBuildArgs;
-        break;
-
-      case ACTION_CREATE:
-        bindCoreAction(actionCreateArgs);
-        //its a builder, so set those actions too
-        buildingActionArgs = actionCreateArgs;
-        break;
-
-      case ACTION_FREEZE:
-        bindCoreAction(actionFreezeArgs);
-        break;
-
-      case ACTION_THAW:
-        bindCoreAction(actionThawArgs);
-        break;
-
-      case ACTION_AM_SUICIDE:
-        bindCoreAction(actionAMSuicideArgs);
-        break;
-
-      case ACTION_CLIENT:
-        bindCoreAction(actionClientArgs);
-        break;
-
-      case ACTION_DEPENDENCY:
-        bindCoreAction(actionDependencyArgs);
-        break;
-
-      case ACTION_DESTROY:
-        bindCoreAction(actionDestroyArgs);
-        break;
-
-      case ACTION_DIAGNOSTICS:
-        bindCoreAction(actionDiagnosticArgs);
-        break;
-
-      case ACTION_EXISTS:
-        bindCoreAction(actionExistsArgs);
-        break;
-
-      case ACTION_FLEX:
-        bindCoreAction(actionFlexArgs);
-        break;
-
-      case ACTION_HELP:
-        bindCoreAction(actionHelpArgs);
-        break;
-
-      case ACTION_INSTALL_KEYTAB:
-        bindCoreAction(actionInstallKeytabArgs);
-        break;
-
-      case ACTION_INSTALL_PACKAGE:
-        bindCoreAction(actionInstallPackageArgs);
-        break;
-
-      case ACTION_KDIAG:
-        bindCoreAction(actionKDiagArgs);
-        break;
-
-      case ACTION_KEYTAB:
-        bindCoreAction(actionKeytabArgs);
-        break;
-
-      case ACTION_KILL_CONTAINER:
-        bindCoreAction(actionKillContainerArgs);
-        break;
-
-      case ACTION_LIST:
-        bindCoreAction(actionListArgs);
-        break;
-
-      case ACTION_LOOKUP:
-        bindCoreAction(actionLookupArgs);
-        break;
-
-      case ACTION_NODES:
-        bindCoreAction(actionNodesArgs);
-        break;
-
-      case ACTION_PACKAGE:
-        bindCoreAction(actionPackageArgs);
-        break;
-
-      case ACTION_REGISTRY:
-        bindCoreAction(actionRegistryArgs);
-        break;
-
-      case ACTION_RESOLVE:
-        bindCoreAction(actionResolveArgs);
-        break;
-
-      case ACTION_RESOURCE:
-        bindCoreAction(actionResourceArgs);
-        break;
-
-      case ACTION_STATUS:
-        bindCoreAction(actionStatusArgs);
-        break;
-
-      case ACTION_TOKENS:
-        bindCoreAction(actionTokenArgs);
-        break;
-
-      case ACTION_UPDATE:
-        bindCoreAction(actionUpdateArgs);
-        break;
-
-      case ACTION_UPGRADE:
-        bindCoreAction(actionUpgradeArgs);
-        break;
-
-      case ACTION_VERSION:
-        bindCoreAction(actionVersionArgs);
-        break;
-
-      default:
-        throw new BadCommandArgumentsException(ErrorStrings.ERROR_UNKNOWN_ACTION
-        + " " + action);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/CommonArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/CommonArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/CommonArgs.java
deleted file mode 100644
index 162a87d..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/CommonArgs.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.JCommander;
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.ParameterDescription;
-import com.beust.jcommander.ParameterException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.ErrorStrings;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.exceptions.UsageException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * This class contains the common argument set for all tne entry points,
- * and the core parsing logic to verify that the action is on the list
- * of allowed actions -and that the remaining number of arguments is
- * in the range allowed
- */
-
-public abstract class CommonArgs extends ArgOps implements SliderActions,
-                                                           Arguments {
-
-  protected static final Logger log = LoggerFactory.getLogger(CommonArgs.class);
-
-
-  private static final int DIFF_BETWEEN_DESCIPTION_AND_COMMAND_NAME = 30;
-
-
-  @Parameter(names = ARG_HELP, help = true)
-  public boolean help;
-
-
-  /**
-   -D name=value
-
-   Define an HBase configuration option which overrides any options in
-   the configuration XML files of the image or in the image configuration
-   directory. The values will be persisted.
-   Configuration options are only passed to the cluster when creating or reconfiguring a cluster.
-
-   */
-
-  public Map<String, String> definitionMap = new HashMap<String, String>();
-  /**
-   * System properties
-   */
-  public Map<String, String> syspropsMap = new HashMap<String, String>();
-
-
-  /**
-   * fields
-   */
-  public final JCommander commander;
-  private final String[] args;
-
-  private AbstractActionArgs coreAction;
-
-  /**
-   * get the name: relies on arg 1 being the cluster name in all operations 
-   * @return the name argument, null if there is none
-   */
-  public String getClusterName() {
-    return coreAction.getClusterName();
-  }
-
-  protected CommonArgs(String[] args) {
-    this.args = args;
-    commander = new JCommander(this);
-  }
-
-  protected CommonArgs(Collection args) {
-    List<String> argsAsStrings = SliderUtils.collectionToStringList(args);
-    this.args = argsAsStrings.toArray(new String[argsAsStrings.size()]);
-    commander = new JCommander(this);
-  }
-
-  public String usage() {
-    return usage(this, null);
-  }
-
-  public static String usage(CommonArgs serviceArgs, String commandOfInterest) {
-    String result = null;
-    StringBuilder helperMessage = new StringBuilder();
-    if (commandOfInterest == null) {
-      // JCommander.usage is too verbose for a command with many options like
-      // slider no short version of that is found Instead, we compose our msg by
-      helperMessage.append("\nUsage: slider COMMAND [options]\n");
-      helperMessage.append("where COMMAND is one of\n");
-      for (String jcommand : serviceArgs.commander.getCommands().keySet()) {
-        helperMessage.append(String.format("\t%-"
-            + DIFF_BETWEEN_DESCIPTION_AND_COMMAND_NAME + "s%s", jcommand,
-            serviceArgs.commander.getCommandDescription(jcommand) + "\n"));
-      }
-      helperMessage
-          .append("Most commands print help when invoked without parameters or with --help");
-      result = helperMessage.toString();
-    } else {
-      helperMessage.append("\nUsage: slider ").append(commandOfInterest);
-      helperMessage.append(serviceArgs.coreAction.getMinParams() > 0 ? " <application>" : "");
-      helperMessage.append("\n");
-      for (ParameterDescription paramDesc : serviceArgs.commander.getCommands()
-          .get(commandOfInterest).getParameters()) {
-        String optional = paramDesc.getParameter().required() ? "  (required)"
-            : "  (optional)";
-        String paramName = paramDesc.getParameterized().getType() == Boolean.TYPE ? paramDesc
-            .getLongestName() : paramDesc.getLongestName() + " <"
-            + paramDesc.getParameterized().getName() + ">";
-        helperMessage.append(String.format("\t%-"
-            + DIFF_BETWEEN_DESCIPTION_AND_COMMAND_NAME + "s%s", paramName,
-            paramDesc.getDescription() + optional + "\n"));
-        result = helperMessage.toString();
-      }
-    }
-    return result;
-  }
-
-  public static String usage(CommonArgs serviceArgs) {
-    return usage(serviceArgs, null);
-  }
-
-  /**
-   * Parse routine -includes registering the action-specific argument classes
-   * and postprocess it
-   * @throws SliderException on any problem
-   */
-  public void parse() throws SliderException {
-    addActionArguments();
-    try {
-      commander.parse(getArgs());
-    } catch (ParameterException e) {
-      throw new BadCommandArgumentsException(e, "%s in %s",
-                                             e.toString(),
-                                             (getArgs() != null
-                                              ? (SliderUtils.join(getArgs(),
-                                                 " ", false))
-                                              : "[]"));
-    }
-    //now copy back to this class some of the attributes that are common to all
-    //actions
-    postProcess();
-  }
-
-  /**
-   * Add a command
-   * @param name action
-   * @param arg value
-   */
-  protected void addAction(String name, Object arg) {
-    commander.addCommand(name, arg);
-  }
-
-  protected void addActions(Object... actions) {
-    for (Object action : actions) {
-      commander.addCommand(action);
-    }
-  }
-
-  /**
-   * Override point to add a set of actions
-   */
-  protected void addActionArguments() {
-
-  }
-
-  /**
-   * validate args via {@link #validate()}
-   * then postprocess the arguments
-   */
-  public void postProcess() throws SliderException {
-    applyAction();
-    validate();
-
-    //apply entry set
-    for (Map.Entry<String, String> entry : syspropsMap.entrySet()) {
-      System.setProperty(entry.getKey(), entry.getValue());
-    }
-  }
-
-
-  /**
-   * Implementors must implement their action apply routine here
-   */
-  public abstract void applyAction() throws SliderException;
-
-
-  /**
-   * Bind the core action; this extracts any attributes that are used
-   * across routines
-   * @param action action to bind
-   */
-  protected void bindCoreAction(AbstractActionArgs action) {
-    coreAction = action;
-
-    splitPairs(coreAction.definitions, definitionMap);
-    splitPairs(coreAction.sysprops, syspropsMap);
-  }
-
-  /**
-   * Get the core action -type depends on the action
-   * @return the action class
-   */
-  public AbstractActionArgs getCoreAction() {
-    return coreAction;
-  }
-
-  /**
-   * Validate the arguments against the action requested
-   */
-  public void validate() throws BadCommandArgumentsException, UsageException {
-    if (coreAction == null) {
-      throw new UsageException(ErrorStrings.ERROR_NO_ACTION + usage());
-    }
-    log.debug("action={}", getAction());
-    // let the action validate itself
-    try {
-      coreAction.validate();
-    } catch (BadCommandArgumentsException e) {
-      StringBuilder badArgMsgBuilder = new StringBuilder();
-      badArgMsgBuilder.append(e.toString()).append("\n");
-      badArgMsgBuilder.append(usage(this, coreAction.getActionName()));
-      throw new BadCommandArgumentsException(badArgMsgBuilder.toString());
-    } catch (UsageException e) {
-      StringBuilder badArgMsgBuilder = new StringBuilder();
-      badArgMsgBuilder.append(e.toString()).append("\n");
-      badArgMsgBuilder.append(usage(this, coreAction.getActionName()));
-      throw new UsageException(badArgMsgBuilder.toString());
-    }
-  }
-
-  /**
-   * Apply all the definitions on the command line to the configuration
-   * @param conf config
-   */
-  public void applyDefinitions(Configuration conf) throws
-                                                   BadCommandArgumentsException {
-    applyDefinitions(definitionMap, conf);
-  }
-
-
-  /**
-   * If the Filesystem binding was provided, it overrides anything in
-   * the configuration
-   * @param conf configuration
-   */
-  public void applyFileSystemBinding(Configuration conf) {
-    ArgOps.applyFileSystemBinding(getFilesystemBinding(), conf);
-  }
-
-  public boolean isDebug() {
-    return coreAction.debug;
-  }
-
-
-  public String getFilesystemBinding() {
-    return coreAction.filesystemBinding;
-  }
-
-  public Path getBasePath() { return coreAction.basePath; }
-
-  public String getManager() {
-    return coreAction.manager;
-  }
-
-  public String getAction() {
-    return commander.getParsedCommand();
-  }
-
-  public List<String> getActionArgs() {
-    return coreAction.parameters;
-  }
-
-  public String[] getArgs() {
-    return args;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/ComponentArgsDelegate.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ComponentArgsDelegate.java b/slider-core/src/main/java/org/apache/slider/common/params/ComponentArgsDelegate.java
deleted file mode 100644
index 5140059..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/ComponentArgsDelegate.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public class ComponentArgsDelegate extends AbstractArgsDelegate {
-
-  /**
-   * This is a listing of the roles to create
-   */
-  @Parameter(names = {ARG_COMPONENT,  ARG_COMPONENT_SHORT, ARG_ROLE},
-             arity = 2,
-             description = "--component <name> <count> e.g. +1 incr by 1, -2 decr by 2, and 3 makes final count 3",
-             splitter = DontSplitArguments.class)
-  public List<String> componentTuples = new ArrayList<>(0);
-
-
-  /**
-   * Get the role mapping (may be empty, but never null)
-   * @return role mapping
-   * @throws BadCommandArgumentsException parse problem
-   */
-  public Map<String, String> getComponentMap() throws BadCommandArgumentsException {
-    return convertTupleListToMap("component", componentTuples);
-  }
-
-  public List<String> getComponentTuples() {
-    return componentTuples;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/DontSplitArguments.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/DontSplitArguments.java b/slider-core/src/main/java/org/apache/slider/common/params/DontSplitArguments.java
deleted file mode 100644
index 0344305..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/DontSplitArguments.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.converters.IParameterSplitter;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class DontSplitArguments implements IParameterSplitter {
-
-  @Override
-  public List<String> split(String value) {
-    List<String> list = new ArrayList<>(1);
-    list.add(value);
-    return list;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/LaunchArgsAccessor.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/LaunchArgsAccessor.java b/slider-core/src/main/java/org/apache/slider/common/params/LaunchArgsAccessor.java
deleted file mode 100644
index 7524053..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/LaunchArgsAccessor.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import java.io.File;
-
-/**
- * Launch args for create and start and anything else that can start something
- */
-public interface LaunchArgsAccessor extends WaitTimeAccessor {
-  String getRmAddress();
-
-  File getOutputFile();
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/LaunchArgsDelegate.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/LaunchArgsDelegate.java b/slider-core/src/main/java/org/apache/slider/common/params/LaunchArgsDelegate.java
deleted file mode 100644
index bc7e94c..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/LaunchArgsDelegate.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-
-import java.io.File;
-
-/**
- * Any launch-time args
- */
-public class LaunchArgsDelegate extends WaitArgsDelegate implements
-                                                         LaunchArgsAccessor {
-
-
-  //TODO: do we need this?
-  @Parameter(names = ARG_RESOURCE_MANAGER,
-             description = "Resource manager hostname:port ",
-             required = false)
-  private String rmAddress;
-
-  @Override
-  public String getRmAddress() {
-    return rmAddress;
-  }
-
-  @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},
-      description = "output file for any application report")
-  public File outputFile;
-
-  @Override
-  public File getOutputFile() {
-    return outputFile;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/PathArgumentConverter.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/PathArgumentConverter.java b/slider-core/src/main/java/org/apache/slider/common/params/PathArgumentConverter.java
deleted file mode 100644
index ccb526c..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/PathArgumentConverter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.converters.BaseConverter;
-import org.apache.hadoop.fs.Path;
-
-public class PathArgumentConverter extends BaseConverter<Path> {
-
-  public PathArgumentConverter(String optionName) {
-    super(optionName);
-  }
-
-  @Override
-  public Path convert(String value) {
-    return new Path(value);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/SliderAMArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/SliderAMArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/SliderAMArgs.java
deleted file mode 100644
index f9516d1..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/SliderAMArgs.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-
-package org.apache.slider.common.params;
-
-/**
- * Parameters sent by the Client to the AM
- */
-public class SliderAMArgs extends CommonArgs {
-
-  SliderAMCreateAction createAction = new SliderAMCreateAction();
-
-  public SliderAMArgs(String[] args) {
-    super(args);
-  }
-
-  @Override
-  protected void addActionArguments() {
-    addActions(createAction);
-  }
-
-  public String getImage() {
-    return createAction.image;
-  }
-
-  /**
-   * This is the URI in the FS to the Slider cluster; the conf file (and any
-   * other cluster-specifics) can be picked up here
-   */
-  public String getSliderClusterURI() {
-    return createAction.sliderClusterURI;
-  }
-
-  /**
-   * Am binding is simple: there is only one action
-   */
-  @Override
-  public void applyAction() {
-    bindCoreAction(createAction);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/common/params/SliderAMCreateAction.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/SliderAMCreateAction.java b/slider-core/src/main/java/org/apache/slider/common/params/SliderAMCreateAction.java
deleted file mode 100644
index 197c22b..0000000
--- a/slider-core/src/main/java/org/apache/slider/common/params/SliderAMCreateAction.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-import com.beust.jcommander.ParametersDelegate;
-
-import java.io.File;
-
-
-@Parameters(commandNames = {SliderActions.ACTION_CREATE},
-            commandDescription = SliderActions.DESCRIBE_ACTION_CREATE)
-
-public class SliderAMCreateAction extends AbstractActionArgs implements
-                                                           LaunchArgsAccessor {
-
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_CREATE;
-  }
-
-  @Parameter(names = ARG_IMAGE, description = "image", required = false)
-  public String image;
-
-  /**
-   * This is the URI in the FS to the Slider cluster; the conf file (and any
-   * other cluster-specifics) can be picked up here
-   */
-  @Parameter(names = ARG_CLUSTER_URI,
-             description = "URI to the Slider cluster", required = true)
-  public String sliderClusterURI;
-
-  @ParametersDelegate
-  LaunchArgsDelegate launchArgs = new LaunchArgsDelegate();
-
-  @Override
-  public String getRmAddress() {
-    return launchArgs.getRmAddress();
-  }
-
-  @Override
-  public int getWaittime() {
-    return launchArgs.getWaittime();
-  }
-
-  @Override
-  public void setWaittime(int waittime) {
-    launchArgs.setWaittime(waittime);
-  }
-
-  @Override
-  public File getOutputFile() {
-    return launchArgs.getOutputFile();
-  }
-  
-}


[11/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/security/StoresGenerator.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/security/StoresGenerator.java b/slider-core/src/main/java/org/apache/slider/server/services/security/StoresGenerator.java
deleted file mode 100644
index 226250f..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/security/StoresGenerator.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.services.security;
-
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.SliderException;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- */
-public class StoresGenerator {
-
-  static CertificateManager certMgr = new CertificateManager();
-  private static SecurityStoreGenerator[] GENERATORS = {
-      new KeystoreGenerator(certMgr), new TruststoreGenerator(certMgr)
-  };
-
-  public static SecurityStore[] generateSecurityStores(String hostname,
-                                                       String containerId,
-                                                       String role,
-                                                       AggregateConf instanceDefinition,
-                                                       MapOperations compOps)
-      throws SliderException, IOException {
-    //discover which stores need generation based on the passwords configured
-    List<SecurityStore> files = new ArrayList<SecurityStore>();
-    for (SecurityStoreGenerator generator : GENERATORS) {
-      if (generator.isStoreRequested(compOps)) {
-        SecurityStore store = generator.generate(hostname,
-                                                 containerId,
-                                                 instanceDefinition,
-                                                 compOps,
-                                                 role);
-        if (store != null) {
-          files.add(store);
-        }
-      }
-    }
-
-    if (files.isEmpty()) {
-      throw new SliderException("Security stores were requested but none were "
-                                + "generated. Check the AM logs and ensure "
-                                + "passwords are configured for the components "
-                                + "requiring the stores.");
-    }
-    return files.toArray(new SecurityStore[files.size()]);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/security/TruststoreGenerator.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/security/TruststoreGenerator.java b/slider-core/src/main/java/org/apache/slider/server/services/security/TruststoreGenerator.java
deleted file mode 100644
index d16dcbd..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/security/TruststoreGenerator.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.services.security;
-
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.SliderException;
-
-import java.io.IOException;
-
-/**
- *
- */
-public class TruststoreGenerator extends AbstractSecurityStoreGenerator {
-
-
-  public TruststoreGenerator(CertificateManager certificateMgr) {
-    super(certificateMgr);
-  }
-
-  @Override
-  public SecurityStore generate(String hostname, String containerId,
-                                AggregateConf instanceDefinition,
-                                MapOperations compOps, String role)
-      throws SliderException, IOException {
-    SecurityStore truststore = null;
-    String password = getStorePassword(
-        instanceDefinition.getAppConf().credentials, compOps, role);
-    if (password != null) {
-      truststore = certificateMgr.generateContainerTruststore(containerId,
-                                                              role, password);
-    }
-    return truststore;
-  }
-
-  @Override
-  String getPassword(MapOperations compOps) {
-    return compOps.get(
-        compOps.get(SliderKeys.COMP_TRUSTSTORE_PASSWORD_PROPERTY_KEY));
-  }
-
-  @Override
-  String getAlias(MapOperations compOps) {
-    return compOps.getOption(SliderKeys.COMP_TRUSTSTORE_PASSWORD_ALIAS_KEY,
-                             SliderKeys.COMP_TRUSTSTORE_PASSWORD_ALIAS_DEFAULT);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/utility/AbstractSliderLaunchedService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/utility/AbstractSliderLaunchedService.java b/slider-core/src/main/java/org/apache/slider/server/services/utility/AbstractSliderLaunchedService.java
deleted file mode 100644
index 1622309..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/utility/AbstractSliderLaunchedService.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.utility;
-
-import org.apache.hadoop.registry.client.api.RegistryConstants;
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.hadoop.registry.client.api.RegistryOperationsFactory;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.slider.common.tools.ConfigHelper;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.zk.ZookeeperUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Base service for the standard slider client/server services
- */
-public abstract class AbstractSliderLaunchedService extends
-    LaunchedWorkflowCompositeService {
-  private static final Logger log =
-    LoggerFactory.getLogger(AbstractSliderLaunchedService.class);
-
-  protected AbstractSliderLaunchedService(String name) {
-    super(name);
-    // make sure all the yarn configs get loaded
-    YarnConfiguration conf = new YarnConfiguration();
-    ConfigHelper.registerDeprecatedConfigItems();
-  }
-
-  /**
-   * look up the registry quorum from the config
-   * @return the quorum string
-   * @throws BadConfigException if it is not there or invalid
-   */
-  public String lookupZKQuorum() throws BadConfigException {
- 
-    String registryQuorum = getConfig().get(RegistryConstants.KEY_REGISTRY_ZK_QUORUM);
-    
-    // though if neither is set: trouble
-    if (SliderUtils.isUnset(registryQuorum)) {
-      throw new BadConfigException(
-          "No Zookeeper quorum provided in the"
-          + " configuration property " + RegistryConstants.KEY_REGISTRY_ZK_QUORUM
-      );
-    }
-    ZookeeperUtils.splitToHostsAndPortsStrictly(registryQuorum);
-    return registryQuorum;
-  }
-
-  /**
-   * Create, adopt ,and start the YARN registration service
-   * @return the registry operations service, already deployed as a child
-   * of the AbstractSliderLaunchedService instance.
-   */
-  public RegistryOperations startRegistryOperationsService()
-      throws BadConfigException {
-
-    // push back the slider registry entry if needed
-    String quorum = lookupZKQuorum();
-    RegistryOperations registryWriterService =
-        createRegistryOperationsInstance();
-    deployChildService(registryWriterService);
-    return registryWriterService;
-  }
-
-  /**
-   * Create the registry operations instance. This is to allow
-   * subclasses to instantiate a subclass service
-   * @return an instance to match to the lifecycle of this service
-   */
-  protected RegistryOperations createRegistryOperationsInstance() {
-    return RegistryOperationsFactory.createInstance("YarnRegistry", getConfig());
-  }
-
-  /**
-   * Utility method to require an argument to be set (non null, non-empty)
-   * @param argname argument name
-   * @param value value
-   * @throws BadCommandArgumentsException if the condition is not met
-   */
-  protected static void requireArgumentSet(String argname, String value)
-      throws BadCommandArgumentsException {
-    require(isSet(value), "Required argument %s missing", argname );
-  }
-
-  /**
-   * Require a condition to hold; throw {@link BadCommandArgumentsException} if not.
-   * The exception text is the formatted message.
-   * @param condition condition
-   * @param message string to format
-   * @param args list of arguments to format.
-   * @throws BadCommandArgumentsException
-   */
-  protected static void require(boolean condition, String message,
-      Object... args)
-      throws BadCommandArgumentsException {
-    if (!condition) {
-      throw new BadCommandArgumentsException(message, args);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/utility/EndOfServiceWaiter.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/utility/EndOfServiceWaiter.java b/slider-core/src/main/java/org/apache/slider/server/services/utility/EndOfServiceWaiter.java
deleted file mode 100644
index 40ceab8..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/utility/EndOfServiceWaiter.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.utility;
-
-import org.apache.hadoop.service.Service;
-import org.apache.hadoop.service.ServiceStateChangeListener;
-
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * Wait for a service to stop.
- * 
- * WARNING: the notification may come in as soon as the service enters
- * the stopped state: it may take some time for the actual stop operation
- * to complete.
- */
-public class EndOfServiceWaiter implements ServiceStateChangeListener {
-
-  private final AtomicBoolean finished = new AtomicBoolean(false);
-  private final String name;
-  private Service service;
-
-  /**
-   * Wait for a service; use the service name as this instance's name
-   * @param service service
-   */
-  public EndOfServiceWaiter(Service service) {
-    this(service.getName(), service);
-  }
-
-
-  /**
-   * Wait for a service
-   * @param name name for messages
-   * @param service service
-   */
-  public EndOfServiceWaiter(String name, Service service) {
-    this.name = name;
-    this.service = service;
-    service.registerServiceListener(this);
-  }
-
-  public synchronized void waitForServiceToStop(long timeout) throws
-      InterruptedException, TimeoutException {
-    service.waitForServiceToStop(timeout);
-    if (!finished.get()) {
-      wait(timeout);
-      if (!finished.get()) {
-        throw new TimeoutException(name
-                                   + " did not finish after " + timeout +
-                                   " milliseconds");
-      }
-    }
-  }
-
-  /**
-   * Wait for service state change callbacks; notify self if the service has
-   * now stopped
-   * @param service service
-   */
-  @Override
-  public synchronized void stateChanged(Service service) {
-    if (service.isInState(Service.STATE.STOPPED)) {
-      finished.set(true);
-      notify();
-    }
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/utility/LaunchedWorkflowCompositeService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/utility/LaunchedWorkflowCompositeService.java b/slider-core/src/main/java/org/apache/slider/server/services/utility/LaunchedWorkflowCompositeService.java
deleted file mode 100644
index bcd1969..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/utility/LaunchedWorkflowCompositeService.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.utility;
-
-import com.google.common.base.Preconditions;
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.service.Service;
-import org.apache.slider.core.main.LauncherExitCodes;
-import org.apache.slider.core.main.RunService;
-import org.apache.slider.server.services.workflow.WorkflowCompositeService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This is a workflow compositoe service which can be launched from the CLI
- * ... catches the arguments and implements a stub runService operation.
- */
-public class LaunchedWorkflowCompositeService extends WorkflowCompositeService
-    implements RunService {
-  private static final Logger log = LoggerFactory.getLogger(
-      LaunchedWorkflowCompositeService.class);
-  private String[] argv;
-  
-  public LaunchedWorkflowCompositeService(String name) {
-    super(name);
-  }
-
-  public LaunchedWorkflowCompositeService(String name, Service... children) {
-    super(name, children);
-  }
-
-  /**
-   * Implementation of set-ness, groovy definition of true/false for a string
-   * @param s
-   * @return true iff the string is non-null and non-empty
-   */
-  protected static boolean isUnset(String s) {
-    return StringUtils.isEmpty(s);
-  }
-
-  protected static boolean isSet(String s) {
-    return StringUtils.isNotEmpty(s);
-  }
-
-  protected String[] getArgv() {
-    return argv;
-  }
-
-  /**
-   * Pre-init argument binding
-   * @param config the initial configuration build up by the
-   * service launcher.
-   * @param args argument list list of arguments passed to the command line
-   * after any launcher-specific commands have been stripped.
-   * @return the configuration
-   * @throws Exception
-   */
-  @Override
-  public Configuration bindArgs(Configuration config, String... args) throws
-                                                                      Exception {
-    this.argv = args;
-    if (log.isDebugEnabled()) {
-      log.debug("Binding {} Arguments:", args.length);
-
-      StringBuilder builder = new StringBuilder();
-      for (String arg : args) {
-        builder.append('"').append(arg).append("\" ");
-      }
-      log.debug(builder.toString());
-    }
-    return config;
-  }
-
-  @Override
-  public int runService() throws Throwable {
-    return LauncherExitCodes.EXIT_SUCCESS;
-  }
-
-  @Override
-  public synchronized void addService(Service service) {
-    Preconditions.checkArgument(service != null, "null service argument");
-    super.addService(service);
-  }
-
-  /**
-   * Run a child service -initing and starting it if this
-   * service has already passed those parts of its own lifecycle
-   * @param service the service to start
-   */
-  protected boolean deployChildService(Service service) {
-    service.init(getConfig());
-    addService(service);
-    if (isInState(STATE.STARTED)) {
-      service.start();
-      return true;
-    }
-    return false;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/utility/PatternValidator.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/utility/PatternValidator.java b/slider-core/src/main/java/org/apache/slider/server/services/utility/PatternValidator.java
deleted file mode 100644
index 6ab9de6..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/utility/PatternValidator.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.utility;
-
-import org.apache.slider.server.appmaster.web.rest.RestPaths;
-
-import java.util.regex.Pattern;
-
-/**
- * Utility class to validate strings against a predefined pattern.
- */
-public class PatternValidator {
-
-  public static final String E_INVALID_NAME =
-      "Invalid name %s does not match the pattern pattern %s ";
-  private final Pattern valid;
-  private final String pattern;
-
-  public PatternValidator(String pattern) {
-    this.pattern = pattern;
-    valid = Pattern.compile(pattern);
-  }
-
-  /**
-   * Validate the name -restricting it to the set defined in 
-   * {@link RestPaths#PUBLISHED_CONFIGURATION_REGEXP}
-   * @param name name to validate
-   * @throws IllegalArgumentException if not a valid name
-   */
-  public void validate(String name) {
-    if (!matches(name)) {
-      throw new IllegalArgumentException(
-          String.format(E_INVALID_NAME, name, pattern));
-    }
-  }
-
-  /**
-   * Query to see if the pattern matches
-   * @param name name to validate
-   * @return true if the string matches the pattern
-   */
-  public boolean matches(String name) {
-    return valid.matcher(name).matches();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/utility/WebAppService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/utility/WebAppService.java b/slider-core/src/main/java/org/apache/slider/server/services/utility/WebAppService.java
deleted file mode 100644
index ebfcb99..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/utility/WebAppService.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.utility;
-
-import org.apache.hadoop.service.AbstractService;
-import org.apache.hadoop.yarn.webapp.WebApp;
-
-/**
- * Contains a webapp reference and stops it in teardown if non-null
- * <p>
- * It does not start the application.
- * Access to the field is not synchronized across threads; it is the
- * responsibility of the caller.
- */
-public class WebAppService<T extends WebApp> extends AbstractService {
-
-  private volatile T webApp;
-
-  public WebAppService(String name) {
-    super(name);
-  }
-
-  public WebAppService(String name, T app) {
-    super(name);
-    webApp = app;
-  }
-
-  public T getWebApp() {
-    return webApp;
-  }
-
-  public void setWebApp(T webApp) {
-    this.webApp = webApp;
-  }
-
-
-  @Override
-  protected void serviceStart() throws Exception {
-
-  }
-
-  /**
-   * Stop operation stops the webapp; sets the reference to null
-   * @throws Exception
-   */
-  @Override
-  protected void serviceStop() throws Exception {
-    if (webApp != null) {
-      webApp.stop();
-      webApp = null;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/workflow/ClosingService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/ClosingService.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/ClosingService.java
deleted file mode 100644
index 8b711aa..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/ClosingService.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import org.apache.hadoop.service.AbstractService;
-
-import java.io.Closeable;
-import java.io.IOException;
-
-/**
- * Service that closes the closeable supplied during shutdown, if not null.
- * 
- * As the Service interface itself extends Closeable, this service
- * can be used to shut down other services if desired.
- */
-public class ClosingService<C extends Closeable> extends AbstractService {
-
-  private C closeable;
-
-  public ClosingService(String name) {
-    super(name);
-  }
-
-  /**
-   * Construct an instance of the service
-   * @param name service name
-   * @param closeable closeable to close (may be null)
-   */
-  public ClosingService(String name,
-      C closeable) {
-    super(name);
-    this.closeable = closeable;
-  }
-
-  /**
-   * Construct an instance of the service, using the default name
-   * @param closeable closeable to close (may be null)
-   */
-  public ClosingService(C closeable) {
-    this("ClosingService", closeable);
-  }
-
-
-  /**
-   * Get the closeable
-   * @return the closeable
-   */
-  public synchronized C getCloseable() {
-    return closeable;
-  }
-
-  /**
-   * Set or update the closeable.
-   * @param closeable
-   */
-  public synchronized void setCloseable(C closeable) {
-    this.closeable = closeable;
-  }
-
-  /**
-   * Stop routine will close the closeable -if not null - and set the
-   * reference to null afterwards
-   * This operation does raise any exception on the close, though it does
-   * record it
-   */
-  @Override
-  protected void serviceStop() {
-    C target = getCloseable();
-    if (target != null) {
-      try {
-        target.close();
-      } catch (IOException ioe) {
-        noteFailure(ioe);
-      }
-      setCloseable(null);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/workflow/ForkedProcessService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/ForkedProcessService.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/ForkedProcessService.java
deleted file mode 100644
index 352be49..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/ForkedProcessService.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import org.apache.hadoop.service.ServiceStateException;
-import org.apache.slider.core.main.ServiceLaunchException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * Service wrapper for an external program that is launched and can/will terminate.
- * This service is notified when the subprocess terminates, and stops itself 
- * and converts a non-zero exit code into a failure exception.
- * 
- * <p>
- * Key Features:
- * <ol>
- *   <li>The property {@link #executionTimeout} can be set to set a limit
- *   on the duration of a process</li>
- *   <li>Output is streamed to the output logger provided</li>.
- *   <li>The most recent lines of output are saved to a linked list</li>.
- *   <li>A synchronous callback, {@link LongLivedProcessLifecycleEvent}, is raised on the start
- *   and finish of a process.</li>
- * </ol>
- *
- * Usage:
- * <p></p>
- * The service can be built in the constructor, {@link #ForkedProcessService(String, Map, List)},
- * or have its simple constructor used to instantiate the service, then the 
- * {@link #build(Map, List)} command used to define the environment variables
- * and list of commands to execute. One of these two options MUST be exercised
- * before calling the services's {@link #start()} method.
- * <p></p>
- * The forked process is executed in the service's {@link #serviceStart()} method;
- * if still running when the service is stopped, {@link #serviceStop()} will
- * attempt to stop it.
- * <p></p>
- * 
- * The service delegates process execution to {@link LongLivedProcess},
- * receiving callbacks via the {@link LongLivedProcessLifecycleEvent}.
- * When the service receives a callback notifying that the process has completed,
- * it calls its {@link #stop()} method. If the error code was non-zero, 
- * the service is logged as having failed.
- */
-public class ForkedProcessService
-    extends WorkflowExecutorService<ExecutorService>
-    implements LongLivedProcessLifecycleEvent, Runnable {
-
-  /**
-   * Log for the forked master process
-   */
-  private static final Logger LOG =
-    LoggerFactory.getLogger(ForkedProcessService.class);
-
-  private final AtomicBoolean processTerminated = new AtomicBoolean(false);
-  private boolean processStarted = false;
-  private LongLivedProcess process;
-  private int executionTimeout = -1;
-  private int timeoutCode = 1;
-  /** 
-  log to log to; defaults to this service log
-   */
-  private Logger processLog = LOG;
-  
-  /**
-   * Exit code set when the spawned process exits
-   */
-  private AtomicInteger exitCode = new AtomicInteger(0);
-
-  /**
-   * Create an instance of the service
-   * @param name a name
-   */
-  public ForkedProcessService(String name) {
-    super(name);
-  }
-
-  /**
-   * Create an instance of the service,  set up the process
-   * @param name a name
-   * @param commandList list of commands is inserted on the front
-   * @param env environment variables above those generated by
-   * @throws IOException IO problems
-   */
-  public ForkedProcessService(String name,
-      Map<String, String> env,
-      List<String> commandList) throws IOException {
-    super(name);
-    build(env, commandList);
-  }
-
-  @Override //AbstractService
-  protected void serviceStart() throws Exception {
-    if (process == null) {
-      throw new ServiceStateException("Process not yet configured");
-    }
-    //now spawn the process -expect updates via callbacks
-    process.start();
-  }
-
-  @Override //AbstractService
-  protected void serviceStop() throws Exception {
-    completed();
-    stopForkedProcess();
-  }
-
-  private void stopForkedProcess() {
-    if (process != null) {
-      process.stop();
-    }
-  }
-
-  /**
-   * Set the process log. This may be null for "do not log"
-   * @param processLog process log
-   */
-  public void setProcessLog(Logger processLog) {
-    this.processLog = processLog;
-    process.setProcessLog(processLog);
-  }
-
-  /**
-   * Set the timeout by which time a process must have finished -or -1 for forever
-   * @param timeout timeout in milliseconds
-   */
-  public void setTimeout(int timeout, int code) {
-    this.executionTimeout = timeout;
-    this.timeoutCode = code;
-  }
-
-  /**
-   * Build the process to execute when the service is started
-   * @param commandList list of commands is inserted on the front
-   * @param env environment variables above those generated by
-   * @throws IOException IO problems
-   */
-  public void build(Map<String, String> env,
-                    List<String> commandList)
-      throws IOException {
-    assert process == null;
-
-    process = new LongLivedProcess(getName(), processLog, commandList);
-    process.setLifecycleCallback(this);
-    //set the env variable mapping
-    process.putEnvMap(env);
-  }
-
-  @Override // notification from executed process
-  public synchronized void onProcessStarted(LongLivedProcess process) {
-    LOG.debug("Process has started");
-    processStarted = true;
-    if (executionTimeout > 0) {
-      setExecutor(ServiceThreadFactory.singleThreadExecutor(getName(), true));
-      execute(this);
-    }
-  }
-
-  @Override  // notification from executed process
-  public void onProcessExited(LongLivedProcess process,
-      int uncorrected,
-      int code) {
-    try {
-      synchronized (this) {
-        completed();
-        //note whether or not the service had already stopped
-        LOG.debug("Process has exited with exit code {}", code);
-        if (code != 0) {
-          reportFailure(code, getName() + " failed with code " + code);
-        }
-      }
-    } finally {
-      stop();
-    }
-  }
-
-  private void reportFailure(int code, String text) {
-    //error
-    ServiceLaunchException execEx = new ServiceLaunchException(code, text);
-    LOG.debug("Noting failure", execEx);
-    noteFailure(execEx);
-  }
-
-  /**
-   * handle timeout response by escalating it to a failure
-   */
-  @Override
-  public void run() {
-    try {
-      synchronized (processTerminated) {
-        if (!processTerminated.get()) {
-          processTerminated.wait(executionTimeout);
-        }
-      }
-
-    } catch (InterruptedException e) {
-      //assume signalled; exit
-    }
-    //check the status; if the marker isn't true, bail
-    if (!processTerminated.getAndSet(true)) {
-      LOG.info("process timeout: reporting error code {}", timeoutCode);
-
-      //timeout
-      if (isInState(STATE.STARTED)) {
-        //trigger a failure
-        stopForkedProcess();
-      }
-      reportFailure(timeoutCode, getName() + ": timeout after " + executionTimeout
-                   + " millis: exit code =" + timeoutCode);
-    }
-  }
-
-  /**
-   * Note the process as having completed.
-   * The process marked as terminated
-   * -and anything synchronized on <code>processTerminated</code>
-   * is notified
-   */
-  protected void completed() {
-    processTerminated.set(true);
-    synchronized (processTerminated) {
-      processTerminated.notify();
-    }
-  }
-
-  public boolean isProcessTerminated() {
-    return processTerminated.get();
-  }
-
-  public synchronized boolean isProcessStarted() {
-    return processStarted;
-  }
-
-  /**
-   * Is a process running: between started and terminated
-   * @return true if the process is up.
-   */
-  public synchronized boolean isProcessRunning() {
-    return processStarted && !isProcessTerminated();
-  }
-
-
-  public Integer getExitCode() {
-    return process.getExitCode();
-  }
-  
-  public int getExitCodeSignCorrected() {
-    Integer exitCode = process.getExitCodeSignCorrected();
-    if (exitCode == null) return -1;
-    return exitCode;
-  }
-
-  /**
-   * Get the recent output from the process, or [] if not defined
-   * @return a possibly empty list
-   */
-  public List<String> getRecentOutput() {
-    return process != null
-           ? process.getRecentOutput()
-           : new LinkedList<String>();
-  }
-
-  /**
-   * Get the recent output from the process, or [] if not defined
-   *
-   * @param finalOutput flag to indicate "wait for the final output of the process"
-   * @param duration the duration, in ms, 
-   * to wait for recent output to become non-empty
-   * @return a possibly empty list
-   */
-  public List<String> getRecentOutput(boolean finalOutput, int duration) {
-    if (process == null) {
-      return new LinkedList<>();
-    }
-    return process.getRecentOutput(finalOutput, duration);
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/workflow/LongLivedProcess.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/LongLivedProcess.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/LongLivedProcess.java
deleted file mode 100644
index 9e9e7ac..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/LongLivedProcess.java
+++ /dev/null
@@ -1,598 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.io.IOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * Execute a long-lived process.
- *
- * <p>
- * Hadoop's {@link org.apache.hadoop.util.Shell} class assumes it is executing
- * a short lived application; this class allows for the process to run for the
- * life of the Java process that forked it.
- * It is designed to be embedded inside a YARN service, though this is not
- * the sole way that it can be used
- * <p>
- * Key Features:
- * <ol>
- *   <li>Output is streamed to the output logger provided</li>.
- *   <li>the input stream is closed as soon as the process starts.</li>
- *   <li>The most recent lines of output are saved to a linked list</li>.
- *   <li>A synchronous callback, {@link LongLivedProcessLifecycleEvent},
- *   is raised on the start and finish of a process.</li>
- * </ol>
- * 
- */
-public class LongLivedProcess implements Runnable {
-  /**
-   * Limit on number of lines to retain in the "recent" line list:{@value}
-   */
-  public static final int RECENT_LINE_LOG_LIMIT = 64;
-
-  /**
-   * Const defining the time in millis between polling for new text.
-   */
-  private static final int STREAM_READER_SLEEP_TIME = 200;
-  
-  /**
-   * limit on the length of a stream before it triggers an automatic newline.
-   */
-  private static final int LINE_LENGTH = 256;
-  private final ProcessBuilder processBuilder;
-  private Process process;
-  private Integer exitCode = null;
-  private final String name;
-  private final ExecutorService processExecutor;
-  private final ExecutorService logExecutor;
-  
-  private ProcessStreamReader processStreamReader;
-  //list of recent lines, recorded for extraction into reports
-  private final List<String> recentLines = new LinkedList<>();
-  private int recentLineLimit = RECENT_LINE_LOG_LIMIT;
-  private LongLivedProcessLifecycleEvent lifecycleCallback;
-  private final AtomicBoolean finalOutputProcessed = new AtomicBoolean(false);
-
-  /**
-   * Log supplied in the constructor for the spawned process -accessible
-   * to inner classes
-   */
-  private Logger processLog;
-  
-  /**
-   * Class log -accessible to inner classes
-   */
-  private static final Logger LOG = LoggerFactory.getLogger(LongLivedProcess.class);
-
-  /**
-   *  flag to indicate that the process is done
-   */
-  private final AtomicBoolean finished = new AtomicBoolean(false);
-
-  /**
-   * Create an instance
-   * @param name process name
-   * @param processLog log for output (or null)
-   * @param commands command list
-   */
-  public LongLivedProcess(String name,
-      Logger processLog,
-      List<String> commands) {
-    Preconditions.checkArgument(commands != null, "commands");
-
-    this.name = name;
-    this.processLog = processLog;
-    ServiceThreadFactory factory = new ServiceThreadFactory(name, true);
-    processExecutor = Executors.newSingleThreadExecutor(factory);
-    logExecutor = Executors.newSingleThreadExecutor(factory);
-    processBuilder = new ProcessBuilder(commands);
-    processBuilder.redirectErrorStream(false);
-  }
-
-  /**
-   * Set the limit on recent lines to retain
-   * @param recentLineLimit size of rolling list of recent lines.
-   */
-  public void setRecentLineLimit(int recentLineLimit) {
-    this.recentLineLimit = recentLineLimit;
-  }
-
-  /**
-   * Set an optional application exit callback
-   * @param lifecycleCallback callback to notify on application exit
-   */
-  public void setLifecycleCallback(LongLivedProcessLifecycleEvent lifecycleCallback) {
-    this.lifecycleCallback = lifecycleCallback;
-  }
-
-  /**
-   * Add an entry to the environment
-   * @param envVar envVar -must not be null
-   * @param val value 
-   */
-  public void setEnv(String envVar, String val) {
-    Preconditions.checkArgument(envVar != null, "envVar");
-    Preconditions.checkArgument(val != null, "val");
-    processBuilder.environment().put(envVar, val);
-  }
-
-  /**
-   * Bulk set the environment from a map. This does
-   * not replace the existing environment, just extend it/overwrite single
-   * entries.
-   * @param map map to add
-   */
-  public void putEnvMap(Map<String, String> map) {
-    for (Map.Entry<String, String> entry : map.entrySet()) {
-      String val = entry.getValue();
-      String key = entry.getKey();
-      setEnv(key, val);
-    }
-  }
-
-  /**
-   * Get the process environment
-   * @param variable environment variable
-   * @return the value or null if there is no match
-   */
-  public String getEnv(String variable) {
-    return processBuilder.environment().get(variable);
-  }
-
-  /**
-   * Set the process log. Ignored once the process starts
-   * @param processLog new log ... may be null
-   */
-  public void setProcessLog(Logger processLog) {
-    this.processLog = processLog;
-  }
-
-  /**
-   * Get the process reference
-   * @return the process -null if the process is  not started
-   */
-  public Process getProcess() {
-    return process;
-  }
-
-  /**
-   * Get the process builder -this can be manipulated
-   * up to the start() operation. As there is no synchronization
-   * around it, it must only be used in the same thread setting up the commmand.
-   * @return the process builder
-   */
-  public ProcessBuilder getProcessBuilder() {
-    return processBuilder;
-  }
-
-  /**
-   * Get the command list
-   * @return the comands
-   */
-  public List<String> getCommands() {
-    return processBuilder.command();
-  }
-
-  public String getCommand() {
-    return getCommands().get(0);
-  }
-
-  /**
-   * probe to see if the process is running
-   * @return true iff the process has been started and is not yet finished
-   */
-  public boolean isRunning() {
-    return process != null && !finished.get();
-  }
-
-  /**
-   * Get the exit code: null until the process has finished
-   * @return the exit code or null
-   */
-  public Integer getExitCode() {
-    return exitCode;
-  }
-  
-    /**
-   * Get the exit code sign corrected: null until the process has finished
-   * @return the exit code or null
-   */
-  public Integer getExitCodeSignCorrected() {
-    Integer result;
-    if (exitCode != null) {
-      result = (exitCode << 24) >> 24;
-    } else {
-      result = null;
-    }
-    return result;
-  }
-
-  /**
-   * Stop the process if it is running.
-   * This will trigger an application completion event with the given exit code
-   */
-  public void stop() {
-    if (!isRunning()) {
-      return;
-    }
-    process.destroy();
-  }
-
-  /**
-   * Get a text description of the builder suitable for log output
-   * @return a multiline string 
-   */
-  protected String describeBuilder() {
-    StringBuilder buffer = new StringBuilder();
-    for (String arg : processBuilder.command()) {
-      buffer.append('"').append(arg).append("\" ");
-    }
-    return buffer.toString();
-  }
-
-  /**
-   * Dump the environment to a string builder
-   * @param buffer the buffer to append to
-   */
-  public void dumpEnv(StringBuilder buffer) {
-    buffer.append("\nEnvironment\n-----------");
-    Map<String, String> env = processBuilder.environment();
-    Set<String> keys = env.keySet();
-    List<String> sortedKeys = new ArrayList<String>(keys);
-    Collections.sort(sortedKeys);
-    for (String key : sortedKeys) {
-      buffer.append(key).append("=").append(env.get(key)).append('\n');
-    }
-  }
-
-  /**
-   * Exec the process
-   * @return the process
-   * @throws IOException on aany failure to start the process
-   * @throws FileNotFoundException if the process could not be found
-   */
-  private Process spawnChildProcess() throws IOException {
-    if (process != null) {
-      throw new IOException("Process already started");
-    }
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("Spawning process:\n " + describeBuilder());
-    }
-    try {
-      process = processBuilder.start();
-    } catch (IOException e) {
-      // on windows, upconvert DOS error 2 from ::CreateProcess()
-      // to its real meaning: FileNotFound
-      if (e.toString().contains("CreateProcess error=2")) {
-        FileNotFoundException fnfe =
-            new FileNotFoundException(e.toString());
-        fnfe.initCause(e);
-        throw fnfe;
-      } else {
-        throw e;
-      }
-    }
-    return process;
-  }
-
-  /**
-   * Entry point for waiting for the program to finish
-   */
-  @Override // Runnable
-  public void run() {
-    Preconditions.checkNotNull(process, "null process");
-    LOG.debug("Lifecycle callback thread running");
-    //notify the callback that the process has started
-    if (lifecycleCallback != null) {
-      lifecycleCallback.onProcessStarted(this);
-    }
-    try {
-      //close stdin for the process
-      IOUtils.closeStream(process.getOutputStream());
-      exitCode = process.waitFor();
-    } catch (InterruptedException e) {
-      LOG.debug("Process wait interrupted -exiting thread", e);
-    } finally {
-      //here the process has finished
-      LOG.debug("process {} has finished", name);
-      //tell the logger it has to finish too
-      finished.set(true);
-
-      // shut down the threads
-      logExecutor.shutdown();
-      try {
-        logExecutor.awaitTermination(60, TimeUnit.SECONDS);
-      } catch (InterruptedException ignored) {
-        //ignored
-      }
-
-      //now call the callback if it is set
-      if (lifecycleCallback != null) {
-        lifecycleCallback.onProcessExited(this, exitCode,
-            getExitCodeSignCorrected());
-      }
-    }
-  }
-
-  /**
-   * Spawn the application
-   * @throws IOException IO problems
-   */
-  public void start() throws IOException {
-
-    spawnChildProcess();
-    processStreamReader =
-        new ProcessStreamReader(processLog, STREAM_READER_SLEEP_TIME);
-    logExecutor.submit(processStreamReader);
-    processExecutor.submit(this);
-  }
-
-  /**
-   * Get the lines of recent output
-   * @return the last few lines of output; an empty list if there are none
-   * or the process is not actually running
-   */
-  public synchronized List<String> getRecentOutput() {
-    return new ArrayList<String>(recentLines);
-  }
-
-  /**
-   * @return whether lines of recent output are empty
-   */
-  public synchronized boolean isRecentOutputEmpty() {
-    return recentLines.isEmpty();
-  }
-
-  /**
-   * Query to see if the final output has been processed
-   * @return
-   */
-  public boolean isFinalOutputProcessed() {
-    return finalOutputProcessed.get();
-  }
-
-  /**
-   * Get the recent output from the process, or [] if not defined
-   *
-   * @param finalOutput flag to indicate "wait for the final output of the process"
-   * @param duration the duration, in ms, 
-   * ro wait for recent output to become non-empty
-   * @return a possibly empty list
-   */
-  public List<String> getRecentOutput(boolean finalOutput, int duration) {
-    long start = System.currentTimeMillis();
-    while (System.currentTimeMillis() - start <= duration) {
-      boolean finishedOutput;
-      if (finalOutput) {
-        // final flag means block until all data is done
-        finishedOutput = isFinalOutputProcessed();
-      } else {
-        // there is some output
-        finishedOutput = !isRecentOutputEmpty();
-      }
-      if (finishedOutput) {
-        break;
-      }
-      try {
-        Thread.sleep(100);
-      } catch (InterruptedException ie) {
-        Thread.currentThread().interrupt();
-        break;
-      }
-    }
-    return getRecentOutput();
-  }
-
-  /**
-   * add the recent line to the list of recent lines; deleting
-   * an earlier on if the limit is reached.
-   *
-   * Implementation note: yes, a circular array would be more
-   * efficient, especially with some power of two as the modulo,
-   * but is it worth the complexity and risk of errors for
-   * something that is only called once per line of IO?
-   * @param line line to record
-   * @param isErrorStream is the line from the error stream
-   * @param logger logger to log to - null for no logging
-   */
-  private synchronized void recordRecentLine(String line,
-      boolean isErrorStream,
-      Logger logger) {
-    if (line == null) {
-      return;
-    }
-    String entry = (isErrorStream ? "[ERR] " : "[OUT] ") + line;
-    recentLines.add(entry);
-    if (recentLines.size() > recentLineLimit) {
-      recentLines.remove(0);
-    }
-    if (logger != null) {
-      if (isErrorStream) {
-        logger.warn(line);
-      } else {
-        logger.info(line);
-      }
-    }
-  }
-
-  /**
-   * Class to read data from the two process streams, and, when run in a thread
-   * to keep running until the <code>done</code> flag is set. 
-   * Lines are fetched from stdout and stderr and logged at info and error
-   * respectively.
-   */
-
-  private class ProcessStreamReader implements Runnable {
-    private final Logger streamLog;
-    private final int sleepTime;
-
-    /**
-     * Create an instance
-     * @param streamLog log -or null to disable logging (recent entries
-     * will still be retained)
-     * @param sleepTime time to sleep when stopping
-     */
-    private ProcessStreamReader(Logger streamLog, int sleepTime) {
-      this.streamLog = streamLog;
-      this.sleepTime = sleepTime;
-    }
-
-    /**
-     * Return a character if there is one, -1 if nothing is ready yet
-     * @param reader reader
-     * @return the value from the reader, or -1 if it is not ready
-     * @throws IOException IO problems
-     */
-    private int readCharNonBlocking(BufferedReader reader) throws IOException {
-      if (reader.ready()) {
-        return reader.read();
-      } else {
-        return -1;
-      }
-    }
-
-    /**
-     * Read in a line, or, if the limit has been reached, the buffer
-     * so far
-     * @param reader source of data
-     * @param line line to build
-     * @param limit limit of line length
-     * @return true if the line can be printed
-     * @throws IOException IO trouble
-     */
-    @SuppressWarnings("NestedAssignment")
-    private boolean readAnyLine(BufferedReader reader,
-                                StringBuilder line,
-                                int limit)
-      throws IOException {
-      int next;
-      while ((-1 != (next = readCharNonBlocking(reader)))) {
-        if (next != '\n') {
-          line.append((char) next);
-          limit--;
-          if (line.length() > limit) {
-            //enough has been read in to print it any
-            return true;
-          }
-        } else {
-          //line end return flag to say so
-          return true;
-        }
-      }
-      //here the end of the stream is hit, or the limit
-      return false;
-    }
-
-
-    @Override //Runnable
-    @SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
-    public void run() {
-      BufferedReader errReader = null;
-      BufferedReader outReader = null;
-      StringBuilder outLine = new StringBuilder(LINE_LENGTH);
-      StringBuilder errorLine = new StringBuilder(LINE_LENGTH);
-      try {
-        errReader = new BufferedReader(
-            new InputStreamReader(process.getErrorStream()));
-        outReader = new BufferedReader(
-            new InputStreamReader(process.getInputStream()));
-        while (!finished.get()) {
-          boolean processed = false;
-          if (readAnyLine(errReader, errorLine, LINE_LENGTH)) {
-            recordRecentLine(errorLine.toString(), true, streamLog);
-            errorLine.setLength(0);
-            processed = true;
-          }
-          if (readAnyLine(outReader, outLine, LINE_LENGTH)) {
-            recordRecentLine(outLine.toString(), false, streamLog);
-            outLine.setLength(0);
-            processed |= true;
-          }
-          if (!processed && !finished.get()) {
-            //nothing processed: wait a bit for data.
-            try {
-              Thread.sleep(sleepTime);
-            } catch (InterruptedException e) {
-              //ignore this, rely on the done flag
-              LOG.debug("Ignoring ", e);
-            }
-          }
-        }
-        // finished: cleanup
-
-        //print the current error line then stream through the rest
-        recordFinalOutput(errReader, errorLine, true, streamLog);
-        //now do the info line
-        recordFinalOutput(outReader, outLine, false, streamLog);
-
-      } catch (Exception ignored) {
-        LOG.warn("encountered {}", ignored, ignored);
-        //process connection has been torn down
-      } finally {
-        // close streams
-        IOUtils.closeStream(errReader);
-        IOUtils.closeStream(outReader);
-        //mark output as done
-        finalOutputProcessed.set(true);
-      }
-    }
-
-    /**
-     * Record the final output of a process stream
-     * @param reader reader of output
-     * @param lineBuilder string builder into which line is built
-     * @param isErrorStream flag to indicate whether or not this is the
-     * is the line from the error stream
-     * @param logger logger to log to
-     * @throws IOException
-     */
-    protected void recordFinalOutput(BufferedReader reader,
-        StringBuilder lineBuilder, boolean isErrorStream, Logger logger) throws
-        IOException {
-      String line = lineBuilder.toString();
-      recordRecentLine(line, isErrorStream, logger);
-      line = reader.readLine();
-      while (line != null) {
-        recordRecentLine(line, isErrorStream, logger);
-        line = reader.readLine();
-        if (Thread.interrupted()) {
-          break;
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/workflow/LongLivedProcessLifecycleEvent.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/LongLivedProcessLifecycleEvent.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/LongLivedProcessLifecycleEvent.java
deleted file mode 100644
index a13b508..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/LongLivedProcessLifecycleEvent.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-/**
- * Callback when a long-lived application exits
- */
-public interface LongLivedProcessLifecycleEvent {
-
-  /**
-   * Callback when a process is started
-   * @param process the process invoking the callback
-   */
-  void onProcessStarted(LongLivedProcess process);
-
-  /**
-   * Callback when a process has finished
-   * @param process the process invoking the callback
-   * @param exitCode exit code from the process
-   * @param signCorrectedCode the code- as sign corrected
-   */
-  void onProcessExited(LongLivedProcess process,
-      int exitCode,
-      int signCorrectedCode);
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/workflow/ServiceParent.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/ServiceParent.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/ServiceParent.java
deleted file mode 100644
index a123584..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/ServiceParent.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import org.apache.hadoop.service.Service;
-
-import java.util.List;
-
-/**
- * Interface for accessing services that contain one or more child
- * services. 
- */
-public interface ServiceParent extends Service {
-
-  /**
-   * Add a child service. It must be in a consistent state with the
-   * service to which it is being added.
-   * @param service the service to add.
-   */
-  void addService(Service service);
-
-  /**
-   * Get an unmodifiable list of services
-   * @return a list of child services at the time of invocation -
-   * added services will not be picked up.
-   */
-  List<Service> getServices();
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/workflow/ServiceTerminatingCallable.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/ServiceTerminatingCallable.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/ServiceTerminatingCallable.java
deleted file mode 100644
index 5ebf77c..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/ServiceTerminatingCallable.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.service.Service;
-
-import java.util.concurrent.Callable;
-
-/**
- * A runnable which terminates its owner; it also catches any
- * exception raised and can serve it back.  
- * 
- */
-public class ServiceTerminatingCallable<V> implements Callable<V> {
-
-  private final Service owner;
-  private Exception exception;
-  /**
-   * This is the callback
-   */
-  private final Callable<V> callable;
-
-
-  /**
-   * Create an instance. If the owner is null, the owning service
-   * is not terminated.
-   * @param owner owning service -can be null
-   * @param callable callback.
-   */
-  public ServiceTerminatingCallable(Service owner,
-      Callable<V> callable) {
-    Preconditions.checkArgument(callable != null, "null callable");
-    this.owner = owner;
-    this.callable = callable;
-  }
-
-
-  /**
-   * Get the owning service
-   * @return the service to receive notification when
-   * the runnable completes.
-   */
-  public Service getOwner() {
-    return owner;
-  }
-
-  /**
-   * Any exception raised by inner <code>action's</code> run.
-   * @return an exception or null.
-   */
-  public Exception getException() {
-    return exception;
-  }
-
-  /**
-   * Delegates the call to the callable supplied in the constructor,
-   * then calls the stop() operation on its owner. Any exception
-   * is caught, noted and rethrown
-   * @return the outcome of the delegated call operation
-   * @throws Exception if one was raised.
-   */
-  @Override
-  public V call() throws Exception {
-    try {
-      return callable.call();
-    } catch (Exception e) {
-      exception = e;
-      throw e;
-    } finally {
-      if (owner != null) {
-        owner.stop();
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/workflow/ServiceTerminatingRunnable.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/ServiceTerminatingRunnable.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/ServiceTerminatingRunnable.java
deleted file mode 100644
index dc591df..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/ServiceTerminatingRunnable.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.service.Service;
-
-/**
- * A runnable which terminates its after running; it also catches any
- * exception raised and can serve it back. 
- */
-public class ServiceTerminatingRunnable implements Runnable {
-
-  private final Service owner;
-  private final Runnable action;
-  private Exception exception;
-
-  /**
-   * Create an instance.
-   * @param owner owning service
-   * @param action action to execute before terminating the service
-   */
-  public ServiceTerminatingRunnable(Service owner, Runnable action) {
-    Preconditions.checkArgument(owner != null, "null owner");
-    Preconditions.checkArgument(action != null, "null action");
-    this.owner = owner;
-    this.action = action;
-  }
-
-  /**
-   * Get the owning service.
-   * @return the service to receive notification when
-   * the runnable completes.
-   */
-  public Service getOwner() {
-    return owner;
-  }
-
-  /**
-   * Any exception raised by inner <code>action's</code> run.
-   * @return an exception or null.
-   */
-  public Exception getException() {
-    return exception;
-  }
-
-  @Override
-  public void run() {
-    try {
-      action.run();
-    } catch (Exception e) {
-      exception = e;
-    }
-    owner.stop();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/workflow/ServiceThreadFactory.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/ServiceThreadFactory.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/ServiceThreadFactory.java
deleted file mode 100644
index 737197b..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/ServiceThreadFactory.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import com.google.common.base.Preconditions;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * A thread factory that creates threads (possibly daemon threads)
- * using the name and naming policy supplied.
- * The thread counter starts at 1, increments atomically, 
- * and is supplied as the second argument in the format string.
- * 
- * A static method, {@link #singleThreadExecutor(String, boolean)},
- * exists to simplify the construction of an executor with a single well-named
- * threads. 
- * 
- * Example
- * <pre>
- *  ExecutorService exec = ServiceThreadFactory.newSingleThreadExecutor("live", true)
- * </pre>
- */
-public class ServiceThreadFactory implements ThreadFactory {
-
-  private static final AtomicInteger counter = new AtomicInteger(1);
-
-  /**
-   * Default format for thread names: {@value}.
-   */
-  public static final String DEFAULT_NAMING_FORMAT = "%s-%03d";
-  private final String name;
-  private final boolean daemons;
-  private final String namingFormat;
-
-  /**
-   * Create an instance
-   * @param name base thread name
-   * @param daemons flag to indicate the threads should be marked as daemons
-   * @param namingFormat format string to generate thread names from
-   */
-  public ServiceThreadFactory(String name,
-      boolean daemons,
-      String namingFormat) {
-    Preconditions.checkArgument(name != null, "null name");
-    Preconditions.checkArgument(namingFormat != null, "null naming format");
-    this.name = name;
-    this.daemons = daemons;
-    this.namingFormat = namingFormat;
-  }
-
-  /**
-   * Create an instance with the default naming format.
-   * @param name base thread name
-   * @param daemons flag to indicate the threads should be marked as daemons
-   */
-  public ServiceThreadFactory(String name,
-      boolean daemons) {
-    this(name, daemons, DEFAULT_NAMING_FORMAT);
-  }
-
-  @Override
-  public Thread newThread(Runnable r) {
-    Preconditions.checkArgument(r != null, "null runnable");
-    String threadName =
-        String.format(namingFormat, name, counter.getAndIncrement());
-    Thread thread = new Thread(r, threadName);
-    thread.setDaemon(daemons);
-    return thread;
-  }
-
-  /**
-   * Create a single thread executor using this naming policy.
-   * @param name base thread name
-   * @param daemons flag to indicate the threads should be marked as daemons
-   * @return an executor
-   */
-  public static ExecutorService singleThreadExecutor(String name,
-      boolean daemons) {
-    return Executors.newSingleThreadExecutor(
-        new ServiceThreadFactory(name, daemons));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowCallbackService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowCallbackService.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowCallbackService.java
deleted file mode 100644
index 65d14b7..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowCallbackService.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import com.google.common.base.Preconditions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-
-/**
- * A service that calls the supplied callback when it is started -after the 
- * given delay.
- *
- * It can be configured to stop itself after the callback has
- * completed, marking any exception raised as the exception of this service.
- * The notifications come in on a callback thread -a thread that is only
- * started in this service's <code>start()</code> operation.
- */
-public class WorkflowCallbackService<V> extends
-    WorkflowScheduledExecutorService<ScheduledExecutorService> {
-  protected static final Logger LOG =
-      LoggerFactory.getLogger(WorkflowCallbackService.class);
-
-  /**
-   * This is the callback.
-   */
-  private final Callable<V> callback;
-  private final int delay;
-  private final ServiceTerminatingCallable<V> command;
-
-  private ScheduledFuture<V> scheduledFuture;
-
-  /**
-   * Create an instance of the service
-   * @param name service name
-   * @param callback callback to invoke
-   * @param delay delay -or 0 for no delay
-   * @param terminate terminate this service after the callback?
-   */
-  public WorkflowCallbackService(String name,
-      Callable<V> callback,
-      int delay,
-      boolean terminate) {
-    super(name);
-    Preconditions.checkNotNull(callback, "Null callback argument");
-    this.callback = callback;
-    this.delay = delay;
-    command = new ServiceTerminatingCallable<V>(
-        terminate ? this : null,
-        callback);
-  }
-
-  public ScheduledFuture<V> getScheduledFuture() {
-    return scheduledFuture;
-  }
-
-  @Override
-  protected void serviceStart() throws Exception {
-    LOG.debug("Notifying {} after a delay of {} millis", callback, delay);
-    ScheduledExecutorService executorService =
-        Executors.newSingleThreadScheduledExecutor(
-            new ServiceThreadFactory(getName(), true));
-    setExecutor(executorService);
-    scheduledFuture =
-        executorService.schedule(command, delay, TimeUnit.MILLISECONDS);
-  }
-
-  /**
-   * Stop the service.
-   * If there is any exception noted from any executed notification,
-   * note the exception in this class
-   * @throws Exception exception.
-   */
-  @Override
-  protected void serviceStop() throws Exception {
-    super.serviceStop();
-    // propagate any failure
-    if (getCallbackException() != null) {
-      throw getCallbackException();
-    }
-  }
-
-  /**
-   * Get the exception raised by a callback. Will always be null if the 
-   * callback has not been executed; will only be non-null after any success.
-   * @return a callback
-   */
-  public Exception getCallbackException() {
-    return command.getException();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowCompositeService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowCompositeService.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowCompositeService.java
deleted file mode 100644
index 9c653f3..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowCompositeService.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.service.CompositeService;
-import org.apache.hadoop.service.Service;
-import org.apache.hadoop.service.ServiceStateChangeListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-/**
- * An extended composite service which stops itself if any child service
- * fails, or when all its children have successfully stopped without failure.
- *
- * Lifecycle
- * <ol>
- *   <li>If any child exits with a failure: this service stops, propagating
- *   the exception.</li>
- *   <li>When all child services has stopped, this service stops itself</li>
- * </ol>
- *
- */
-public class WorkflowCompositeService extends CompositeService
-    implements ServiceParent, ServiceStateChangeListener {
-
-  private static final Logger LOG =
-    LoggerFactory.getLogger(WorkflowCompositeService.class);
-
-  /**
-   * Deadlock-avoiding overridden config for slider services; see SLIDER-1052
-   */
-  private volatile Configuration configuration;
-
-  /**
-   * Construct an instance
-   * @param name name of this service instance
-   */
-  public WorkflowCompositeService(String name) {
-    super(name);
-  }
-
-  @Override
-  public Configuration getConfig() {
-    return configuration;
-  }
-
-  @Override
-  protected void setConfig(Configuration conf) {
-    super.setConfig(conf);
-    configuration = conf;
-  }
-
-  /**
-   * Construct an instance with the default name.
-   */
-  public WorkflowCompositeService() {
-    this("WorkflowCompositeService");
-  }
-
-  /**
-   * Varargs constructor
-   * @param name name of this service instance
-   * @param children children
-   */
-  public WorkflowCompositeService(String name, Service... children) {
-    this(name);
-    for (Service child : children) {
-      addService(child);
-    }
-  }
-
-  /**
-   * Construct with a list of children
-   * @param name name of this service instance
-   * @param children children to add
-   */
-  public WorkflowCompositeService(String name, List<Service> children) {
-    this(name);
-    for (Service child : children) {
-      addService(child);
-    }
-  }
-
-  /**
-   * Add a service, and register it
-   * @param service the {@link Service} to be added.
-   * Important: do not add a service to a parent during your own serviceInit/start,
-   * in Hadoop 2.2; you will trigger a ConcurrentModificationException.
-   */
-  @Override
-  public synchronized void addService(Service service) {
-    Preconditions.checkArgument(service != null, "null service argument");
-    service.registerServiceListener(this);
-    super.addService(service);
-  }
-
-  /**
-   * When this service is started, any service stopping with a failure
-   * exception is converted immediately into a failure of this service, 
-   * storing the failure and stopping ourselves.
-   * @param child the service that has changed.
-   */
-  @Override
-  public void stateChanged(Service child) {
-    //if that child stopped while we are running:
-    if (isInState(STATE.STARTED) && child.isInState(STATE.STOPPED)) {
-      // a child service has stopped
-      //did the child fail? if so: propagate
-      Throwable failureCause = child.getFailureCause();
-      if (failureCause != null) {
-        LOG.info("Child service " + child + " failed", failureCause);
-        //failure. Convert to an exception
-        Exception e = (failureCause instanceof Exception) ?
-            (Exception) failureCause : new Exception(failureCause);
-        //flip ourselves into the failed state
-        noteFailure(e);
-        stop();
-      } else {
-        LOG.info("Child service completed {}", child);
-        if (areAllChildrenStopped()) {
-          LOG.info("All children are halted: stopping");
-          stop();
-        }
-      }
-    }
-  }
-
-  /**
-   * Probe to query if all children are stopped -simply
-   * by taking a snapshot of the child service list and enumerating
-   * their state. 
-   * The state of the children may change during this operation -that will
-   * not get picked up.
-   * @return true if all the children are stopped.
-   */
-  private boolean areAllChildrenStopped() {
-    List<Service> children = getServices();
-    boolean stopped = true;
-    for (Service child : children) {
-      if (!child.isInState(STATE.STOPPED)) {
-        stopped = false;
-        break;
-      }
-    }
-    return stopped;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowExecutorService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowExecutorService.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowExecutorService.java
deleted file mode 100644
index 7409d32..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowExecutorService.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.service.AbstractService;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-
-/**
- * A service that hosts an executor -when the service is stopped,
- * {@link ExecutorService#shutdownNow()} is invoked.
- */
-public class WorkflowExecutorService<E extends ExecutorService> extends AbstractService {
-
-  private E executor;
-
-  /**
-   * Construct an instance with the given name -but
-   * no executor
-   * @param name service name
-   */
-  public WorkflowExecutorService(String name) {
-    this(name, null);
-  }
-
-  /**
-   * Construct an instance with the given name and executor
-   * @param name service name
-   * @param executor exectuor
-   */
-  public WorkflowExecutorService(String name,
-      E executor) {
-    super(name);
-    this.executor = executor;
-  }
-
-  /**
-   * Get the executor
-   * @return the executor
-   */
-  public synchronized E getExecutor() {
-    return executor;
-  }
-
-  /**
-   * Set the executor. Only valid if the current one is null
-   * @param executor executor
-   */
-  public synchronized void setExecutor(E executor) {
-    Preconditions.checkState(this.executor == null,
-        "Executor already set");
-    this.executor = executor;
-  }
-
-  /**
-   * Execute the runnable with the executor (which 
-   * must have been created already)
-   * @param runnable runnable to execute
-   */
-  public void execute(Runnable runnable) {
-    getExecutor().execute(runnable);
-  }
-
-  /**
-   * Submit a callable
-   * @param callable callable
-   * @param <V> type of the final get
-   * @return a future to wait on
-   */
-  public <V> Future<V> submit(Callable<V> callable) {
-    return getExecutor().submit(callable);
-  }
-
-  /**
-   * Stop the service: halt the executor. 
-   * @throws Exception exception.
-   */
-  @Override
-  protected void serviceStop() throws Exception {
-    stopExecutor();
-    super.serviceStop();
-  }
-
-  /**
-   * Stop the executor if it is not null.
-   * This uses {@link ExecutorService#shutdownNow()}
-   * and so does not block until they have completed.
-   */
-  protected synchronized void stopExecutor() {
-    if (executor != null) {
-      executor.shutdownNow();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowRpcService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowRpcService.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowRpcService.java
deleted file mode 100644
index b71530f..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowRpcService.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.ipc.Server;
-import org.apache.hadoop.net.NetUtils;
-import org.apache.hadoop.service.AbstractService;
-
-import java.net.InetSocketAddress;
-
-/**
- * A YARN service that maps the start/stop lifecycle of an RPC server
- * to the YARN service lifecycle. 
- */
-public class WorkflowRpcService extends AbstractService {
-
-  /** RPC server*/
-  private final Server server;
-
-  /**
-   * Construct an instance
-   * @param name service name
-   * @param server service to stop
-   */
-  public WorkflowRpcService(String name, Server server) {
-    super(name);
-    Preconditions.checkArgument(server != null, "Null server");
-    this.server = server;
-  }
-
-  /**
-   * Get the server
-   * @return the server
-   */
-  public Server getServer() {
-    return server;
-  }
-
-  /**
-   * Get the socket address of this server
-   * @return the address this server is listening on
-   */
-  public InetSocketAddress getConnectAddress() {
-    return NetUtils.getConnectAddress(server);
-  }
-
-  @Override
-  protected void serviceStart() throws Exception {
-    super.serviceStart();
-    server.start();
-  }
-
-  @Override
-  protected void serviceStop() throws Exception {
-    if (server != null) {
-      server.stop();
-    }
-  }
-}



[16/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/StateAccessForProviders.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/StateAccessForProviders.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/StateAccessForProviders.java
deleted file mode 100644
index ad91183..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/StateAccessForProviders.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
-import org.apache.slider.api.ClusterDescription;
-import org.apache.slider.api.ClusterNode;
-import org.apache.slider.api.StatusKeys;
-import org.apache.slider.api.types.ApplicationLivenessInformation;
-import org.apache.slider.api.types.ComponentInformation;
-import org.apache.slider.api.types.NodeInformation;
-import org.apache.slider.api.types.RoleStatistics;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.exceptions.NoSuchNodeException;
-import org.apache.slider.core.registry.docstore.PublishedConfigSet;
-import org.apache.slider.core.registry.docstore.PublishedExportsSet;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-/**
- * The methods to offer state access to the providers and other parts of
- * the system which want read-only access to the state.
- */
-public interface StateAccessForProviders {
-
-  /**
-   * Get a map of role status entries by role Id
-   * @return the map of currently defined roles.
-   */
-  Map<Integer, RoleStatus> getRoleStatusMap();
-
-  /**
-   * Get the name of the application
-   * @return the name
-   */
-  String getApplicationName();
-
-  /**
-   * Get the published configurations
-   * @return the configuration set
-   */
-  PublishedConfigSet getPublishedSliderConfigurations();
-
-  /**
-   * Get the published exports set
-   * @return
-   */
-  PublishedExportsSet getPublishedExportsSet();
-
-  /**
-   * Get a named published config set
-   * @param name name to look up
-   * @return the instance or null
-   */
-  PublishedConfigSet getPublishedConfigSet(String name);
-
-  /**
-   * Get a named published config set, creating it if need be.
-   * @param name name to look up
-   * @return the instance -possibly a new one
-   */
-  PublishedConfigSet getOrCreatePublishedConfigSet(String name);
-
-  /**
-   * List the config sets -this takes a clone of the current set
-   * @return a list of config sets
-   */
-  List<String> listConfigSets();
-
-  /**
-   * Get a map of all the failed containers
-   * @return map of recorded failed containers
-   */
-  Map<ContainerId, RoleInstance> getFailedContainers();
-
-  /**
-   * Get the live containers.
-   * 
-   * @return the live nodes
-   */
-  Map<ContainerId, RoleInstance> getLiveContainers();
-
-  /**
-   * Get the current cluster description 
-   * @return the actual state of the cluster
-   */
-  ClusterDescription getClusterStatus();
-
-  /**
-   * Get at the snapshot of the resource config
-   * Changes here do not affect the application state.
-   * @return the most recent settings
-   */
-  ConfTreeOperations getResourcesSnapshot();
-
-  /**
-   * Get at the snapshot of the appconf config
-   * Changes here do not affect the application state.
-   * @return the most recent settings
-   */
-  ConfTreeOperations getAppConfSnapshot();
-
-  /**
-   * Get at the snapshot of the internals config.
-   * Changes here do not affect the application state.
-   * @return the internals settings
-   */
-
-  ConfTreeOperations getInternalsSnapshot();
-
-  /**
-   * Flag set to indicate the application is live -this only happens
-   * after the buildInstance operation
-   */
-  boolean isApplicationLive();
-
-  long getSnapshotTime();
-
-  /**
-   * Get a snapshot of the entire aggregate configuration
-   * @return the aggregate configuration
-   */
-  AggregateConf getInstanceDefinitionSnapshot();
-
-  /**
-   * Get the desired/unresolved value
-   * @return unresolved
-   */
-  AggregateConf getUnresolvedInstanceDefinition();
-
-  /**
-   * Look up a role from its key -or fail 
-   *
-   * @param key key to resolve
-   * @return the status
-   * @throws YarnRuntimeException on no match
-   */
-  RoleStatus lookupRoleStatus(int key);
-
-  /**
-   * Look up a role from its key -or fail 
-   *
-   * @param c container in a role
-   * @return the status
-   * @throws YarnRuntimeException on no match
-   */
-  RoleStatus lookupRoleStatus(Container c) throws YarnRuntimeException;
-
-  /**
-   * Look up a role from its key -or fail 
-   *
-   * @param name container in a role
-   * @return the status
-   * @throws YarnRuntimeException on no match
-   */
-  RoleStatus lookupRoleStatus(String name) throws YarnRuntimeException;
-
-  /**
-   * Clone a list of active containers
-   * @return the active containers at the time
-   * the call was made
-   */
-  List<RoleInstance> cloneOwnedContainerList();
-
-  /**
-   * Get the number of active containers
-   * @return the number of active containers the time the call was made
-   */
-  int getNumOwnedContainers();
-
-  /**
-   * Get any active container with the given ID
-   * @param id container Id
-   * @return the active container or null if it is not found
-   */
-  RoleInstance getOwnedContainer(ContainerId id);
-
-  /**
-   * Get any active container with the given ID
-   * @param id container Id
-   * @return the active container or null if it is not found
-   */
-  RoleInstance getOwnedContainer(String id) throws NoSuchNodeException;
-
-  /**
-   * Create a clone of the list of live cluster nodes.
-   * @return the list of nodes, may be empty
-   */
-  List<RoleInstance> cloneLiveContainerInfoList();
-
-  /**
-   * Get the {@link RoleInstance} details on a container.
-   * This is an O(n) operation
-   * @param containerId the container ID
-   * @return null if there is no such node
-   * @throws NoSuchNodeException if the node cannot be found
-   */
-  RoleInstance getLiveInstanceByContainerID(String containerId)
-    throws NoSuchNodeException;
-
-  /**
-   * Get the details on a list of instaces referred to by ID.
-   * Unknown nodes are not returned
-   * <i>Important: the order of the results are undefined</i>
-   * @param containerIDs the containers
-   * @return list of instances
-   */
-  List<RoleInstance> getLiveInstancesByContainerIDs(
-    Collection<String> containerIDs);
-
-  /**
-   * Update the cluster description with anything interesting
-   */
-  ClusterDescription refreshClusterStatus();
-
-  /**
-   * Get a deep clone of the role status list. Concurrent events may mean this
-   * list (or indeed, some of the role status entries) may be inconsistent
-   * @return a snapshot of the role status entries
-   */
-  List<RoleStatus> cloneRoleStatusList();
-
-  /**
-   * get application liveness information
-   * @return a snapshot of the current liveness information
-   */
-  ApplicationLivenessInformation getApplicationLivenessInformation();
-
-  /**
-   * Get the live statistics map
-   * @return a map of statistics values, defined in the {@link StatusKeys}
-   * keylist.
-   */
-  Map<String, Integer> getLiveStatistics();
-
-  /**
-   * Get a snapshot of component information.
-   * <p>
-   *   This does <i>not</i> include any container list, which 
-   *   is more expensive to create.
-   * @return a map of current role status values.
-   */
-  Map<String, ComponentInformation> getComponentInfoSnapshot();
-
-  /**
-   * Find out about the nodes for specific roles
-   * @return 
-   */
-  Map<String, Map<String, ClusterNode>> getRoleClusterNodeMapping();
-
-  /**
-   * Enum all role instances by role.
-   * @param role role, or "" for all roles
-   * @return a list of instances, may be empty
-   */
-  List<RoleInstance> enumLiveInstancesInRole(String role);
-
-  /**
-   * Look up all containers of a specific component name 
-   * @param component component/role name
-   * @return list of instances. This is a snapshot
-   */
-  List<RoleInstance> lookupRoleContainers(String component);
-
-  /**
-   * Get the JSON serializable information about a component
-   * @param component component to look up
-   * @return a structure describing the component.
-   */
-  ComponentInformation getComponentInformation(String component);
-
-
-  /**
-   * Get a clone of the nodemap.
-   * The instances inside are not cloned
-   * @return a possibly empty map of hostname top info
-   */
-  Map<String, NodeInformation> getNodeInformationSnapshot();
-
-  /**
-   * get information on a node
-   * @param hostname hostname to look up
-   * @return the information, or null if there is no information held.
-   */
-  NodeInformation getNodeInformation(String hostname);
-
-  /**
-   * Get the aggregate statistics across all roles
-   * @return role statistics
-   */
-  RoleStatistics getRoleStatistics();
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/AgentService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/AgentService.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/AgentService.java
deleted file mode 100644
index f840035..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/AgentService.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web;
-
-import org.apache.slider.server.appmaster.web.rest.agent.AgentWebApp;
-import org.apache.slider.server.services.workflow.ClosingService;
-import org.apache.slider.server.services.workflow.WorkflowCompositeService;
-
-/**
- * agent service gives the agent webapp lifecycle integration
- */
-public class AgentService extends ClosingService<AgentWebApp> {
-
-
-  public AgentService(String name) {
-    super(name);
-  }
-
-  public AgentService(String name, AgentWebApp app) {
-    super(name, app);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/HttpCacheHeaders.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/HttpCacheHeaders.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/HttpCacheHeaders.java
deleted file mode 100644
index be8960d..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/HttpCacheHeaders.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web;
-
-/*
-
-
-  ,  );
-  long now = System.currentTimeMillis();
-  httpRes.addDateHeader ( "Expires", now );
-  httpRes.addDateHeader ( "Date", now );
-  httpRes.addHeader ( "Pragma", "no-cache" );
- */
-public interface HttpCacheHeaders {
-  String HTTP_HEADER_CACHE_CONTROL = "Cache-Control";
-  String HTTP_HEADER_CACHE_CONTROL_NONE = "no-cache";
-  String HTTP_HEADER_PRAGMA = "Pragma";
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/SliderAMController.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/SliderAMController.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/SliderAMController.java
deleted file mode 100644
index c3c6e60..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/SliderAMController.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web;
-
-import com.google.inject.Inject;
-import org.apache.hadoop.yarn.webapp.Controller;
-import org.apache.slider.server.appmaster.web.layout.AppLayout;
-import org.apache.slider.server.appmaster.web.layout.ClusterSpecificationView;
-import org.apache.slider.server.appmaster.web.layout.ContainerStatsView;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * 
- */
-public class SliderAMController extends Controller {
-  private static final Logger log = LoggerFactory.getLogger(SliderAMController.class);
-
-  private final WebAppApi slider;
-  
-  @Inject
-  public SliderAMController(WebAppApi slider, RequestContext ctx) {
-    super(ctx);
-    this.slider = slider;
-  }
-  
-  @Override
-  public void index() {
-    setTitle("Slider App Master");
-    
-    updateAppState();
-    
-    render(AppLayout.class);
-  }
-  
-  public void containerStats() {
-    setTitle("Container Statistics");
-    
-    updateAppState();
-    
-    render(ContainerStatsView.class);
-  }
-  
-  public void specification() {
-    setTitle("Cluster Specification");
-    
-    render(ClusterSpecificationView.class);
-  }
-
-  private void updateAppState() {
-    //TODO don't do this on every request?
-    slider.getAppState().refreshClusterStatus();
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/SliderAMWebApp.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/SliderAMWebApp.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/SliderAMWebApp.java
deleted file mode 100644
index 7ecc00c..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/SliderAMWebApp.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web;
-
-import com.codahale.metrics.servlets.HealthCheckServlet;
-import com.codahale.metrics.servlets.MetricsServlet;
-import com.codahale.metrics.servlets.PingServlet;
-import com.codahale.metrics.servlets.ThreadDumpServlet;
-import com.google.common.base.Preconditions;
-import com.sun.jersey.api.container.filter.GZIPContentEncodingFilter;
-import com.sun.jersey.api.core.ResourceConfig;
-import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;
-import com.sun.jersey.spi.container.servlet.ServletContainer;
-import org.apache.hadoop.yarn.webapp.Dispatcher;
-import org.apache.hadoop.yarn.webapp.GenericExceptionHandler;
-import org.apache.hadoop.yarn.webapp.WebApp;
-import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
-import org.apache.slider.server.appmaster.web.rest.AMWadlGeneratorConfig;
-import org.apache.slider.server.appmaster.web.rest.AMWebServices;
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.*;
-import org.apache.slider.server.appmaster.web.rest.SliderJacksonJaxbJsonProvider;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * 
- */
-public class SliderAMWebApp extends WebApp {
-  public static final String BASE_PATH = "slideram";
-  public static final String CONTAINER_STATS = "/stats";
-  public static final String CLUSTER_SPEC = "/spec";
-
-  private final WebAppApi webAppApi;
-
-  public SliderAMWebApp(WebAppApi webAppApi) {
-    Preconditions.checkArgument(webAppApi != null, "webAppApi null");
-    this.webAppApi = webAppApi;
-  }
-
-  @Override
-  public void setup() {
-    Logger.getLogger("com.sun.jersey").setLevel(Level.FINEST);
-    // Make one of these to ensure that the jax-b annotations
-    // are properly picked up.
-    bind(SliderJacksonJaxbJsonProvider.class);
-    
-    // Get exceptions printed to the screen
-    bind(GenericExceptionHandler.class);
-    // bind the REST interface
-    bind(AMWebServices.class);
-    //bind(AMAgentWebServices.class);
-    route("/", SliderAMController.class);
-    route(CONTAINER_STATS, SliderAMController.class, "containerStats");
-    route(CLUSTER_SPEC, SliderAMController.class, "specification");
-  }
-
-  @Override
-  public void configureServlets() {
-    setup();
-
-    serve("/", "/__stop").with(Dispatcher.class);
-
-    for (String path : this.getServePathSpecs()) {
-      serve(path).with(Dispatcher.class);
-    }
-
-    // metrics
-    MetricsAndMonitoring monitoring =
-        webAppApi.getMetricsAndMonitoring();
-    serve(SYSTEM_HEALTHCHECK).with(new HealthCheckServlet(monitoring.getHealth()));
-    serve(SYSTEM_METRICS).with(new MetricsServlet(monitoring.getMetrics()));
-    serve(SYSTEM_PING).with(new PingServlet());
-    serve(SYSTEM_THREADS).with(new ThreadDumpServlet());
-
-    String regex = "(?!/ws)";
-    serveRegex(regex).with(SliderDefaultWrapperServlet.class); 
-
-    Map<String, String> params = new HashMap<>();
-    params.put(ResourceConfig.FEATURE_IMPLICIT_VIEWABLES, "true");
-    params.put(ServletContainer.FEATURE_FILTER_FORWARD_ON_404, "true");
-    params.put(ResourceConfig.FEATURE_XMLROOTELEMENT_PROCESSING, "true");
-    params.put(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS, GZIPContentEncodingFilter.class.getName());
-    params.put(ResourceConfig.PROPERTY_CONTAINER_RESPONSE_FILTERS, GZIPContentEncodingFilter.class.getName());
-    //params.put("com.sun.jersey.spi.container.ContainerRequestFilters", "com.sun.jersey.api.container.filter.LoggingFilter");
-    //params.put("com.sun.jersey.spi.container.ContainerResponseFilters", "com.sun.jersey.api.container.filter.LoggingFilter");
-    //params.put("com.sun.jersey.config.feature.Trace", "true");
-    params.put("com.sun.jersey.config.property.WadlGeneratorConfig",
-        AMWadlGeneratorConfig.CLASSNAME);
-    filter("/*").through(GuiceContainer.class, params);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/SliderDefaultWrapperServlet.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/SliderDefaultWrapperServlet.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/SliderDefaultWrapperServlet.java
deleted file mode 100644
index 12c41ac..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/SliderDefaultWrapperServlet.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-  * Licensed to the Apache Software Foundation (ASF) under one or more
-  * contributor license agreements.  See the NOTICE file distributed with
-  * this work for additional information regarding copyright ownership.
-  * The ASF licenses this file to You under the Apache License, Version 2.0
-  * (the "License"); you may not use this file except in compliance with
-  * the License.  You may obtain a copy of the License at
-  *
-  *     http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
-package org.apache.slider.server.appmaster.web;
-
-import com.google.inject.Singleton;
-import org.apache.hadoop.yarn.webapp.DefaultWrapperServlet;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
-  *
-  */
-@Singleton
-public class SliderDefaultWrapperServlet extends DefaultWrapperServlet {
-  @Override
-  protected void doPost(HttpServletRequest req, HttpServletResponse resp)
-      throws ServletException, IOException {
-    RequestDispatcher rd = getServletContext().getNamedDispatcher("default");
-
-    HttpServletRequest wrapped = new HttpServletRequestWrapper(req) {
-      public String getServletPath() {
-        return "";
-      }
-    };
-
-    rd.forward(wrapped, resp);
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java
deleted file mode 100644
index 0f99d6d..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApi.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web;
-
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.slider.api.SliderClusterProtocol;
-import org.apache.slider.providers.ProviderService;
-import org.apache.slider.server.appmaster.AppMasterActionOperations;
-import org.apache.slider.server.appmaster.actions.QueueAccess;
-import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
-import org.apache.slider.server.appmaster.state.AppState;
-import org.apache.slider.server.appmaster.state.RoleStatus;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-import org.apache.slider.server.appmaster.web.rest.agent.AgentRestOperations;
-import org.apache.slider.server.appmaster.web.rest.application.resources.ContentCache;
-import org.apache.slider.server.services.security.CertificateManager;
-
-import java.util.Map;
-
-/**
- * Interface to pass information from the Slider AppMaster to the WebApp
- */
-public interface WebAppApi {
-
-  /**
-   * The {@link AppState} for the current cluster
-   */
-  StateAccessForProviders getAppState();
-  
-  /**
-   * The {@link ProviderService} for the current cluster
-   */
-  ProviderService getProviderService();
-
-
-  /**
-   * The {@link CertificateManager} for the current cluster
-   */
-  CertificateManager getCertificateManager();
-
-  /**
-   * Generate a mapping from role name to its {@link RoleStatus}. Be aware that this
-   * is a computed value and not just a getter
-   */
-  Map<String, RoleStatus> getRoleStatusByName();
-
-  /**
-   * Returns an interface that can support the agent-based REST operations.
-   */
-  AgentRestOperations getAgentRestOperations();
-  
-  /**
-   * Registry operations accessor
-   * @return registry access
-   */
-  RegistryOperations getRegistryOperations();
-
-  /**
-   * Metrics and monitoring service
-   * @return the (singleton) instance
-   */
-  MetricsAndMonitoring getMetricsAndMonitoring();
-
-  /**
-   * Get the queue accessor
-   * @return the immediate and scheduled queues
-   */
-  QueueAccess getQueues();
-
-  /**
-   * API for AM operations
-   * @return current operations implementation
-   */
-  AppMasterActionOperations getAMOperations();
-
-  /**
-   * Local cache of content
-   * @return the cache
-   */
-  ContentCache getContentCache();
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java
deleted file mode 100644
index a0fe310..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/WebAppApiImpl.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web;
-
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.slider.providers.ProviderService;
-import org.apache.slider.server.appmaster.AppMasterActionOperations;
-import org.apache.slider.server.appmaster.actions.QueueAccess;
-import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
-import org.apache.slider.server.appmaster.state.RoleStatus;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-import org.apache.slider.server.appmaster.web.rest.agent.AgentRestOperations;
-import org.apache.slider.server.appmaster.web.rest.application.resources.ContentCache;
-import org.apache.slider.server.services.security.CertificateManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * 
- */
-public class WebAppApiImpl implements WebAppApi {
-  private static final Logger log = LoggerFactory.getLogger(WebAppApiImpl.class);
-
-  protected final StateAccessForProviders appState;
-  protected final ProviderService provider;
-  protected final CertificateManager certificateManager;
-  private final RegistryOperations registryOperations;
-  private final MetricsAndMonitoring metricsAndMonitoring;
-  private final QueueAccess queues;
-  private final AppMasterActionOperations appMasterOperations;
-  private final ContentCache contentCache;
-
-  public WebAppApiImpl(StateAccessForProviders appState,
-      ProviderService provider,
-      CertificateManager certificateManager,
-      RegistryOperations registryOperations,
-      MetricsAndMonitoring metricsAndMonitoring,
-      QueueAccess queues,
-      AppMasterActionOperations appMasterOperations,
-      ContentCache contentCache) {
-    this.appMasterOperations = appMasterOperations;
-    this.contentCache = contentCache;
-    checkNotNull(appState);
-    checkNotNull(provider);
-    this.queues = queues;
-
-    this.registryOperations = registryOperations;
-    this.appState = appState;
-    this.provider = provider;
-    this.certificateManager = certificateManager;
-    this.metricsAndMonitoring = metricsAndMonitoring;
-  }
-
-  @Override
-  public StateAccessForProviders getAppState() {
-    return appState;
-  }
-
-  @Override
-  public ProviderService getProviderService() {
-    return provider;
-  }
-
-  @Override
-  public CertificateManager getCertificateManager() {
-    return certificateManager;
-  }
-
-  @Override
-  public Map<String,RoleStatus> getRoleStatusByName() {
-    List<RoleStatus> roleStatuses = appState.cloneRoleStatusList();
-    Map<String, RoleStatus> map = new TreeMap<>();
-    for (RoleStatus status : roleStatuses) {
-      map.put(status.getName(), status);
-    }
-    return map;
-  }
-
-  @Override
-  public AgentRestOperations getAgentRestOperations() {
-    return provider.getAgentRestOperations();
-  }
-
-  @Override
-  public RegistryOperations getRegistryOperations() {
-    return registryOperations;
-  }
-
-  @Override
-  public MetricsAndMonitoring getMetricsAndMonitoring() {
-    return metricsAndMonitoring;
-  }
-
-  @Override
-  public QueueAccess getQueues() {
-    return queues;
-  }
-
-  @Override
-  public AppMasterActionOperations getAMOperations() {
-    return appMasterOperations;
-  }
-
-  @Override
-  public ContentCache getContentCache() {
-    return contentCache;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/layout/AppLayout.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/layout/AppLayout.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/layout/AppLayout.java
deleted file mode 100644
index d9a2cda..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/layout/AppLayout.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.layout;
-
-import org.apache.hadoop.yarn.webapp.SubView;
-import org.apache.slider.server.appmaster.web.view.IndexBlock;
-
-/**
- * 
- */
-public class AppLayout extends WebUILayout {
-
-  @Override
-  protected Class<? extends SubView> content() {
-    return IndexBlock.class;
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/layout/ClusterSpecificationView.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/layout/ClusterSpecificationView.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/layout/ClusterSpecificationView.java
deleted file mode 100644
index b54ca71..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/layout/ClusterSpecificationView.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.layout;
-
-import org.apache.hadoop.yarn.webapp.SubView;
-import org.apache.slider.server.appmaster.web.view.ClusterSpecificationBlock;
-
-/**
- * 
- */
-public class ClusterSpecificationView extends WebUILayout {
-
-  @Override
-  protected Class<? extends SubView> content() {
-    return ClusterSpecificationBlock.class;
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/layout/ContainerStatsView.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/layout/ContainerStatsView.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/layout/ContainerStatsView.java
deleted file mode 100644
index 39ba0ad..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/layout/ContainerStatsView.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.layout;
-
-import org.apache.hadoop.yarn.webapp.SubView;
-import org.apache.slider.server.appmaster.web.view.ContainerStatsBlock;
-
-
-
-/**
- * 
- */
-public class ContainerStatsView extends WebUILayout {
-
-  @Override
-  protected Class<? extends SubView> content() {
-    return ContainerStatsBlock.class;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/layout/WebUILayout.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/layout/WebUILayout.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/layout/WebUILayout.java
deleted file mode 100644
index 1681f59..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/layout/WebUILayout.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.layout;
-
-import org.apache.hadoop.yarn.webapp.SubView;
-import org.apache.hadoop.yarn.webapp.view.TwoColumnLayout;
-import org.apache.slider.server.appmaster.web.view.NavBlock;
-
-import static org.apache.hadoop.yarn.webapp.view.JQueryUI.ACCORDION;
-import static org.apache.hadoop.yarn.webapp.view.JQueryUI.ACCORDION_ID;
-import static org.apache.hadoop.yarn.webapp.view.JQueryUI.initID;
-
-/**
- * 
- */
-public class WebUILayout extends TwoColumnLayout {
-  
-  @Override 
-  protected void preHead(Page.HTML<_> html) {
-    set(ACCORDION_ID, "nav");
-    set(initID(ACCORDION, "nav"), "{autoHeight:false, active:0}");
-  }
-  
-  @Override
-  protected Class<? extends SubView> nav() {
-    return NavBlock.class;
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/AMWadlGenerator.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/AMWadlGenerator.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/AMWadlGenerator.java
deleted file mode 100644
index 05aaa5b..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/AMWadlGenerator.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest;
-
-import com.sun.jersey.server.wadl.ApplicationDescription;
-import com.sun.jersey.server.wadl.WadlGenerator;
-import com.sun.jersey.server.wadl.WadlGeneratorImpl;
-import com.sun.research.ws.wadl.Application;
-import com.sun.research.ws.wadl.Resource;
-import com.sun.research.ws.wadl.Resources;
-
-import java.util.Iterator;
-import java.util.List;
-
-/**
- *
- */
-public class AMWadlGenerator extends WadlGeneratorImpl {
-  @Override
-  /**
-   * This method is called once the WADL application has been assembled, so it
-   * affords an opportunity to edit the resources presented by the WADL.  In
-   * this case, we're removing the internal "/agents" resources.
-   */
-  public void attachTypes(ApplicationDescription egd) {
-    super.attachTypes(egd);
-
-    Application application = egd.getApplication();
-    List<Resources> resources = application.getResources();
-
-    for (Resources appResources : resources) {
-      List<Resource> resourceList = appResources.getResource();
-      for (Resource appResource : resourceList) {
-        String path = appResource.getPath();
-        if (RestPaths.SLIDER_CONTEXT_ROOT.equals(path)) {
-          List<Object> sliderResources = appResource.getMethodOrResource();
-          Iterator<Object> itor = sliderResources.iterator();
-          while (itor.hasNext()) {
-            Object sliderRes = itor.next();
-            if (sliderRes instanceof Resource) {
-              Resource res = (Resource) sliderRes;
-              if (RestPaths.SLIDER_SUBPATH_AGENTS.equals(res.getPath())) {
-                // assuming I'll get a list modification issue if I remove at this
-                // point
-                itor.remove();
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-
-  @Override
-  public void setWadlGeneratorDelegate(WadlGenerator delegate) {
-    // do nothing
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/AMWadlGeneratorConfig.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/AMWadlGeneratorConfig.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/AMWadlGeneratorConfig.java
deleted file mode 100644
index ea9f22b..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/AMWadlGeneratorConfig.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest;
-
-import com.sun.jersey.api.wadl.config.WadlGeneratorConfig;
-import com.sun.jersey.api.wadl.config.WadlGeneratorDescription;
-
-import java.util.List;
-
-/**
- * App master's WADL generation support
- */
-public class AMWadlGeneratorConfig extends WadlGeneratorConfig {
-
-  public static final String CLASSNAME = "org.apache.slider.server.appmaster.web.rest.AMWadlGeneratorConfig";
-  @Override
-  public List<WadlGeneratorDescription> configure() {
-    return generator(AMWadlGenerator.class).descriptions();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/AMWebServices.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/AMWebServices.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/AMWebServices.java
deleted file mode 100644
index 03bf703..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/AMWebServices.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import org.apache.slider.server.appmaster.web.WebAppApi;
-import org.apache.slider.server.appmaster.web.rest.agent.AgentResource;
-import org.apache.slider.server.appmaster.web.rest.application.ApplicationResource;
-import org.apache.slider.server.appmaster.web.rest.management.ManagementResource;
-import org.apache.slider.server.appmaster.web.rest.publisher.PublisherResource;
-import org.apache.slider.server.appmaster.web.rest.registry.RegistryResource;
-
-import javax.ws.rs.Path;
-
-/**
- *  The available REST services exposed by a slider AM. 
- */
-@Singleton
-@Path(RestPaths.SLIDER_CONTEXT_ROOT)
-public class AMWebServices {
-  
-  /** AM/WebApp info object */
-  private WebAppApi slider;
-  private final ManagementResource managementResource;
-  private final PublisherResource publisherResource;
-  private final RegistryResource registryResource;
-  private final ApplicationResource applicationResource;
-
-  @Inject
-  public AMWebServices(WebAppApi slider) {
-    this.slider = slider;
-    managementResource = new ManagementResource(slider);
-    publisherResource = new PublisherResource(slider);
-    registryResource = new RegistryResource(slider);
-    applicationResource = new ApplicationResource(slider);
-  }
-
-  @Path(RestPaths.SLIDER_SUBPATH_MANAGEMENT)
-  public ManagementResource getManagementResource() {
-    return managementResource;
-  }
-
-  @Path(RestPaths.SLIDER_SUBPATH_PUBLISHER)
-  public PublisherResource getPublisherResource() {
-    return publisherResource;
-  }
- 
-  @Path(RestPaths.SLIDER_SUBPATH_REGISTRY)
-  public RegistryResource getRegistryResource() {
-    return registryResource;
-  }
-  
-  @Path(RestPaths.SLIDER_SUBPATH_APPLICATION)
-  public ApplicationResource getApplicationResource() {
-    return applicationResource;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/AbstractSliderResource.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/AbstractSliderResource.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/AbstractSliderResource.java
deleted file mode 100644
index 7ff83b6..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/AbstractSliderResource.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest;
-
-import org.apache.hadoop.fs.PathNotFoundException;
-import org.apache.hadoop.registry.client.exceptions.AuthenticationFailedException;
-import org.apache.hadoop.registry.client.exceptions.NoPathPermissionsException;
-import org.apache.hadoop.yarn.webapp.ForbiddenException;
-import org.apache.hadoop.yarn.webapp.NotFoundException;
-import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
-import org.apache.slider.server.appmaster.web.WebAppApi;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-import java.io.FileNotFoundException;
-import java.net.URI;
-import java.net.URL;
-
-/**
- * Abstract resource base class for REST resources
- * that use the slider WebAppApi
- */
-public abstract class AbstractSliderResource {
-  private static final Logger log =
-      LoggerFactory.getLogger(AbstractSliderResource.class);
-  protected final WebAppApi slider;
-  protected final MetricsAndMonitoring metricsAndMonitoring;
-
-  protected AbstractSliderResource(WebAppApi slider) {
-    this.slider = slider;
-    metricsAndMonitoring = slider.getMetricsAndMonitoring();
-  }
-
-  /**
-   * Generate a redirect to the WASL
-   * @param request to base the URL on
-   * @return a 302 response
-   */
-  protected Response redirectToAppWadl(HttpServletRequest request) {
-    try {
-      URI location = new URL(request.getScheme(),
-          request.getServerName(),
-          request.getServerPort(),
-          RestPaths.APPLICATION_WADL).toURI();
-      return Response.temporaryRedirect(location).build();
-    } catch (Exception e) {
-      log.error("Error during redirect to WADL", e);
-      throw new WebApplicationException(Response.serverError().build());
-    }
-  }
-
-  /**
-   * Convert any exception caught into a web application
-   * exception for rethrowing
-   * @param path path of request
-   * @param ex exception
-   * @return an exception to throw
-   */
-  public WebApplicationException buildException(String path,
-      Exception ex) {
-    try {
-      throw ex;
-    } catch (WebApplicationException e) {
-      // rethrow direct
-      throw e;
-    } catch (FileNotFoundException e) {
-      return new NotFoundException("Not found: " + path);
-    } catch (PathNotFoundException e) {
-      return new NotFoundException("Not found: " + path);
-    } catch (AuthenticationFailedException e) {
-      return new ForbiddenException(path);
-    } catch (NoPathPermissionsException e) {
-      return new ForbiddenException(path);
-    } catch (Exception e) {
-      log.error("Error during generation of response: {}", e, e);
-      return new WebApplicationException(e);
-    }
-  }
-
-  /**
-   * Mark an GET operation on a path
-   * @param verb HTTP Verb
-   * @param path path relative to slider API
-   */
-  protected void mark(String verb, String path) {
-    metricsAndMonitoring.markMeterAndCounter(verb + "-" + path);
-  }
-
-  /**
-   * Mark an GET operation on a path
-   * @param verb HTTP Verb
-   * @param path path relative to slider API
-   */
-  protected void mark(String verb, String path, String subpath) {
-    metricsAndMonitoring.markMeterAndCounter(verb + "-" + path + subpath);
-  }
-
-  /**
-   * Mark a GET operation on a path
-   * @param path path relative to slider API
-   */
-  protected void markGet(String path) {
-    mark("GET", path);
-  }
-
-  /**
-   * Mark a GET operation on a path
-   * @param path path relative to slider API
-   */
-  protected void markGet(String path, String subpath) {
-    mark("GET", path, subpath);
-  }
-
-  /**
-   * Mark a GET operation on a path
-   * @param path path relative to slider API
-   */
-  protected void markPost(String path, String subpath) {
-    mark("POST", path, subpath);
-  }
-
-  /**
-   * Mark a GET operation on a path
-   * @param path path relative to slider API
-   */
-  protected void markPut(String path, String subpath) {
-    mark("PUT", path, subpath);
-  }
-
-  /**
-   * Mark a GET operation on a path
-   * @param path path relative to slider API
-   */
-  protected void markDelete(String path, String subpath) {
-    mark("DELETE", path, subpath);
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/InsecureAmFilter.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/InsecureAmFilter.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/InsecureAmFilter.java
deleted file mode 100644
index d5b6b36..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/InsecureAmFilter.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest;
-
-import org.apache.hadoop.yarn.server.webproxy.WebAppProxyServlet;
-import org.apache.hadoop.yarn.server.webproxy.amfilter.AmIpFilter;
-import org.apache.hadoop.yarn.server.webproxy.amfilter.AmIpPrincipal;
-import org.apache.hadoop.yarn.server.webproxy.amfilter.AmIpServletRequestWrapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * This is a filter which is used to forward insecure operations
- * There's some metrics to track all operations too
- */
-public class InsecureAmFilter extends AmIpFilter {
-  public static final String WS_CONTEXT_ROOT = "slider.rest.context.root";
-  protected static final Logger log =
-      LoggerFactory.getLogger(InsecureAmFilter.class);
-
-  private String wsContextRoot;
-
-
-  @Override
-  public void init(FilterConfig conf) throws ServletException {
-    super.init(conf);
-    wsContextRoot = conf.getInitParameter(WS_CONTEXT_ROOT);
-    if (wsContextRoot == null) {
-      throw new ServletException("No value set for " + WS_CONTEXT_ROOT);
-    }
-  }
-
-  private void rejectNonHttpRequests(ServletRequest req) throws
-      ServletException {
-    if (!(req instanceof HttpServletRequest)) {
-      throw new ServletException("This filter only works for HTTP/HTTPS");
-    }
-  }  
-
-  @Override
-  public void doFilter(ServletRequest req,
-      ServletResponse resp,
-      FilterChain chain) throws IOException, ServletException {
-    rejectNonHttpRequests(req);
-    HttpServletRequest httpReq = (HttpServletRequest) req;
-    HttpServletResponse httpResp = (HttpServletResponse) resp;
-
-
-    String requestURI = httpReq.getRequestURI();
-    if (requestURI == null || !requestURI.startsWith(wsContextRoot)) {
-      // hand off to the AM filter if it is not the context root
-      super.doFilter(req, resp, chain);
-      return;
-    }
-
-    String user = null;
-
-    if (httpReq.getCookies() != null) {
-      for (Cookie c : httpReq.getCookies()) {
-        if (WebAppProxyServlet.PROXY_USER_COOKIE_NAME.equals(c.getName())) {
-          user = c.getValue();
-          break;
-        }
-      }
-    }
-    
-    if (user == null) {
-      log.debug("Could not find " + WebAppProxyServlet.PROXY_USER_COOKIE_NAME
-               + " cookie, so user will not be set");
-      chain.doFilter(req, resp);
-    } else {
-      final AmIpPrincipal principal = new AmIpPrincipal(user);
-      ServletRequest requestWrapper = new AmIpServletRequestWrapper(httpReq,
-          principal);
-      chain.doFilter(requestWrapper, resp);
-    }
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/InsecureAmFilterInitializer.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/InsecureAmFilterInitializer.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/InsecureAmFilterInitializer.java
deleted file mode 100644
index 42a5bdd..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/InsecureAmFilterInitializer.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest;
-
-import com.google.common.annotations.VisibleForTesting;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.http.FilterContainer;
-import org.apache.hadoop.http.FilterInitializer;
-import org.apache.hadoop.http.HttpConfig;
-import org.apache.hadoop.yarn.api.ApplicationConstants;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class InsecureAmFilterInitializer extends FilterInitializer {
-  private static final String FILTER_NAME = "AM_PROXY_FILTER";
-  private static final String FILTER_CLASS =
-      InsecureAmFilter.class.getCanonicalName();
-  private static final String HTTPS_PREFIX = "https://";
-  private static final String HTTP_PREFIX = "http://";
-
-  static final String PROXY_HOSTS = "PROXY_HOSTS";
-  static final String PROXY_HOSTS_DELIMITER = ",";
-  static final String PROXY_URI_BASES = "PROXY_URI_BASES";
-  static final String PROXY_URI_BASES_DELIMITER = ",";
-
-  private Configuration configuration;
-
-  public static final String NAME =
-      "org.apache.slider.server.appmaster.web.rest.InsecureAmFilterInitializer";
-
-  @Override
-  public void initFilter(FilterContainer container, Configuration conf) {
-    configuration = conf;
-    Map<String, String> params = new HashMap<String, String>();
-    String proxy = WebAppUtils.getProxyHostAndPort(conf);
-    String[] parts = proxy.split(":");
-    params.put(InsecureAmFilter.PROXY_HOST, parts[0]);
-    // todo:  eventually call WebAppUtils.getHttpSchemePrefix
-    params.put(InsecureAmFilter.PROXY_URI_BASE, getHttpSchemePrefix()
-                                                + proxy +
-                                                getApplicationWebProxyBase());
-    params.put(InsecureAmFilter.WS_CONTEXT_ROOT, RestPaths.WS_CONTEXT_ROOT);
-    container.addFilter(FILTER_NAME, FILTER_CLASS, params);
-  }
-
-  private void classicAmFilterInitializerInit(FilterContainer container,
-      Configuration conf) {
-    Map<String, String> params = new HashMap<String, String>();
-    List<String> proxies = WebAppUtils.getProxyHostsAndPortsForAmFilter(conf);
-    StringBuilder sb = new StringBuilder();
-    for (String proxy : proxies) {
-      sb.append(proxy.split(":")[0]).append(PROXY_HOSTS_DELIMITER);
-    }
-    sb.setLength(sb.length() - 1);
-    params.put(PROXY_HOSTS, sb.toString());
-
-    String prefix = WebAppUtils.getHttpSchemePrefix(conf);
-    String proxyBase = getApplicationWebProxyBase();
-    sb = new StringBuilder();
-    for (String proxy : proxies) {
-      sb.append(prefix).append(proxy).append(proxyBase)
-        .append(PROXY_HOSTS_DELIMITER);
-    }
-    sb.setLength(sb.length() - 1);
-    params.put(PROXY_URI_BASES, sb.toString());
-
-  }
-
-  @VisibleForTesting
-  protected String getApplicationWebProxyBase() {
-    return System.getenv(ApplicationConstants.APPLICATION_WEB_PROXY_BASE_ENV);
-  }
-
-  private String getHttpSchemePrefix() {
-    return HttpConfig.Policy.HTTPS_ONLY ==
-           HttpConfig.Policy.fromString(configuration
-               .get(
-                   YarnConfiguration.YARN_HTTP_POLICY_KEY,
-                   YarnConfiguration.YARN_HTTP_POLICY_DEFAULT))
-           ? HTTPS_PREFIX : HTTP_PREFIX;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/RestPaths.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/RestPaths.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/RestPaths.java
deleted file mode 100644
index ae9eb0f..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/RestPaths.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest;
-
-/**
- * Paths in the REST App
- */
-public class RestPaths {
-
-  public static final String WS_CONTEXT = "ws";
-  public static final String AGENT_WS_CONTEXT = "ws";
-
-  /**
-   * Root path for the web services context: {@value}
-   */
-  public static final String WS_CONTEXT_ROOT = "/" + WS_CONTEXT;
-
-  /**
-   * agent content root: {@value}
-   */
-  public static final String WS_AGENT_CONTEXT_ROOT = "/" + AGENT_WS_CONTEXT;
-  public static final String V1_SLIDER = "/v1/slider";
-  public static final String SLIDER_CONTEXT_ROOT = WS_CONTEXT_ROOT + V1_SLIDER;
-  public static final String RELATIVE_API = WS_CONTEXT + V1_SLIDER;
-  public static final String SLIDER_AGENT_CONTEXT_ROOT = WS_AGENT_CONTEXT_ROOT + V1_SLIDER;
-  public static final String MANAGEMENT = "mgmt";
-  public static final String SLIDER_SUBPATH_MANAGEMENT = "/" + MANAGEMENT;
-  public static final String SLIDER_SUBPATH_AGENTS = "/agents";
-  public static final String SLIDER_SUBPATH_PUBLISHER = "/publisher";
-
-
-  /**
-   * management path: {@value}
-   */
-  public static final String SLIDER_PATH_MANAGEMENT = SLIDER_CONTEXT_ROOT
-                                      + SLIDER_SUBPATH_MANAGEMENT;
-
-  public static final String RELATIVE_PATH_MANAGEMENT = RELATIVE_API
-                                      + SLIDER_SUBPATH_MANAGEMENT;
-
-  /**
-   * Agents: {@value}
-   */
-  public static final String SLIDER_PATH_AGENTS = SLIDER_AGENT_CONTEXT_ROOT
-                                      + SLIDER_SUBPATH_AGENTS;
-  
-  /**
-   * Publisher: {@value}
-   */
-  public static final String SLIDER_PATH_PUBLISHER = SLIDER_CONTEXT_ROOT
-                                      + SLIDER_SUBPATH_PUBLISHER;
-
-  public static final String RELATIVE_PATH_PUBLISHER = RELATIVE_API
-                                      + SLIDER_SUBPATH_PUBLISHER;
-
-  /**
-   * Registry subpath: {@value} 
-   */
-  public static final String SLIDER_SUBPATH_REGISTRY = "/registry";
-
-  /**
-   * Registry: {@value}
-   */
-  public static final String SLIDER_PATH_REGISTRY = SLIDER_CONTEXT_ROOT
-                                                    + SLIDER_SUBPATH_REGISTRY;
-  public static final String RELATIVE_PATH_REGISTRY = RELATIVE_API
-                                                    + SLIDER_SUBPATH_REGISTRY;
-
-
-  /**
-   * The regular expressions used to define valid configuration names/url path
-   * fragments: {@value}
-   */
-  public static final String PUBLISHED_CONFIGURATION_REGEXP
-      = "[a-z0-9][a-z0-9_\\+-]*";
-
-  public static final String PUBLISHED_CONFIGURATION_SET_REGEXP
-      = "[a-z0-9][a-z0-9_.\\+-]*";
-
-  public static final String SLIDER_CONFIGSET = "slider";
-  public static final String SLIDER_EXPORTS = "exports";
-
-  public static final String SLIDER_CLASSPATH = "classpath";
-
-  /**
-   * Codahale Metrics - base path: {@value}
-   */
-
-  public static final String SYSTEM = "/system";
-
-
-  /**
-   * Codahale Metrics - health: {@value}
-   */
-  public static final String SYSTEM_HEALTHCHECK = SYSTEM + "/health";
-  /**
-   * Codahale Metrics - metrics: {@value}
-   */
-  public static final String SYSTEM_METRICS = SYSTEM + "/metrics";
-  /**
-   * Codahale Metrics - metrics as JSON: {@value}
-   */
-  public static final String SYSTEM_METRICS_JSON = SYSTEM_METRICS + "?format=json";
-  /**
-   * Codahale Metrics - ping: {@value}
-   */
-  public static final String SYSTEM_PING = SYSTEM + "/ping";
-  /**
-   * Codahale Metrics - thread dump: {@value}
-   */
-  public static final String SYSTEM_THREADS = SYSTEM + "/threads";
-
-  /**
-   * application subpath
-   */
-  public static final String SLIDER_SUBPATH_APPLICATION = "/application";
-  
-  /**
-   * management path: {@value}
-   */
-  public static final String SLIDER_PATH_APPLICATION =
-      SLIDER_CONTEXT_ROOT + SLIDER_SUBPATH_APPLICATION;
-
-
-  public static final String APPLICATION_WADL = "/application.wadl";
-  public static final String LIVE = "/live";
-  public static final String LIVE_RESOURCES = "/live/resources";
-  public static final String LIVE_CONTAINERS = "/live/containers";
-  public static final String LIVE_COMPONENTS = "/live/components";
-  public static final String LIVE_NODES = "/live/nodes";
-  public static final String LIVE_LIVENESS = "/live/liveness";
-  public static final String LIVE_STATISTICS = "/live/statistics";
-  public static final String MODEL = "/model";
-  public static final String MODEL_DESIRED = MODEL +"/desired";
-  public static final String MODEL_DESIRED_APPCONF = MODEL_DESIRED +"/appconf";
-  public static final String MODEL_DESIRED_RESOURCES = MODEL_DESIRED +"/resources";
-  public static final String MODEL_RESOLVED = "/model/resolved";
-  public static final String MODEL_RESOLVED_APPCONF = MODEL_RESOLVED +"/appconf";
-  public static final String MODEL_RESOLVED_RESOURCES = MODEL_RESOLVED +"/resources";
-  public static final String MODEL_INTERNAL = "/model/internal";
-
-  public static final String ACTION = "/action";
-  public static final String ACTION_PING = ACTION + "/ping";
-  public static final String ACTION_STOP = ACTION + "/stop";
-
-  /**
-   * Path to a role
-   * @param name role name
-   * @return a path to it
-   */
-  public String pathToRole(String name) {
-
-    // ws/v1/slider/application/live/components/$name
-    return SLIDER_PATH_APPLICATION + LIVE_COMPONENTS + "/" + name;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/SliderJacksonJaxbJsonProvider.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/SliderJacksonJaxbJsonProvider.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/SliderJacksonJaxbJsonProvider.java
deleted file mode 100644
index 86d68a8..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/SliderJacksonJaxbJsonProvider.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest;
-
-import com.google.inject.Singleton;
-import org.apache.hadoop.classification.InterfaceAudience.Private;
-import org.apache.hadoop.classification.InterfaceStability.Unstable;
-import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
-import org.codehaus.jackson.map.AnnotationIntrospector;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector;
-import org.codehaus.jackson.xc.JaxbAnnotationIntrospector;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.ext.Provider;
-
-/**
- * Implementation of JAX-RS abstractions based on {@link
- * JacksonJaxbJsonProvider} needed to deserialize JSON content to, or serialize
- * it from, POJO objects.
- */
-@Singleton
-@Provider
-@Unstable
-@Private
-public class SliderJacksonJaxbJsonProvider extends JacksonJaxbJsonProvider {
-
-  public SliderJacksonJaxbJsonProvider() {
-  }
-
-  @Override
-  public ObjectMapper locateMapper(Class<?> type, MediaType mediaType) {
-    ObjectMapper mapper = super.locateMapper(type, mediaType);
-    AnnotationIntrospector introspector = new AnnotationIntrospector.Pair(
-        new JaxbAnnotationIntrospector(),
-        new JacksonAnnotationIntrospector()
-    );
-    mapper.setAnnotationIntrospector(introspector);
-    //mapper.setSerializationInclusion(Inclusion.NON_NULL);
-    return mapper;
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentCommandType.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentCommandType.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentCommandType.java
deleted file mode 100644
index 17cd8f2..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentCommandType.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-public enum AgentCommandType {
-  EXECUTION_COMMAND,
-  STATUS_COMMAND,
-  REGISTRATION_COMMAND
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentEnv.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentEnv.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentEnv.java
deleted file mode 100644
index 781ae00..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/agent/AgentEnv.java
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.agent;
-
-import com.google.gson.annotations.SerializedName;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class AgentEnv {
-
-  /**
-   * Various directories, configurable in <code>ambari-agent.ini</code>
-   */
-  private Directory[] stackFoldersAndFiles = new Directory[0];
-
-  /**
-   * Directories that match name <code>/etc/alternatives/*conf</code>
-   */
-  private Alternative[] alternatives = new Alternative[0];
-
-  /**
-   * List of existing users
-   */
-  private ExistingUser[] existingUsers = new ExistingUser[0];
-
-  /**
-   * List of repos
-   */
-  private String[] existingRepos = new String[0];
-
-  /**
-   * List of packages
-   */
-  private PackageDetail[] installedPackages = new PackageDetail[0];
-
-  /**
-   * The host health report
-   */
-  private HostHealth hostHealth = new HostHealth();
-
-  private Integer umask;
-
-  private Boolean iptablesIsRunning;
-
-  public Integer getUmask() {
-    return umask;
-  }
-
-  public void setUmask(Integer umask) {
-    this.umask = umask;
-  }
-
-  public Directory[] getStackFoldersAndFiles() {
-    return stackFoldersAndFiles;
-  }
-
-  public void setStackFoldersAndFiles(Directory[] dirs) {
-    stackFoldersAndFiles = dirs;
-  }
-
-  public void setExistingUsers(ExistingUser[] users) {
-    existingUsers = users;
-  }
-
-  public ExistingUser[] getExistingUsers() {
-    return existingUsers;
-  }
-
-  public void setAlternatives(Alternative[] dirs) {
-    alternatives = dirs;
-  }
-
-  public Alternative[] getAlternatives() {
-    return alternatives;
-  }
-
-  public void setExistingRepos(String[] repos) {
-    existingRepos = repos;
-  }
-
-  public String[] getExistingRepos() {
-    return existingRepos;
-  }
-
-  public void setInstalledPackages(PackageDetail[] packages) {
-    installedPackages = packages;
-  }
-
-  public PackageDetail[] getInstalledPackages() {
-    return installedPackages;
-  }
-
-  public void setHostHealth(HostHealth healthReport) {
-    hostHealth = healthReport;
-  }
-
-  public HostHealth getHostHealth() {
-    return hostHealth;
-  }
-
-  public Boolean getIptablesIsRunning() {
-    return iptablesIsRunning;
-  }
-
-  public void setIptablesIsRunning(Boolean iptablesIsRunning) {
-    this.iptablesIsRunning = iptablesIsRunning;
-  }
-
-  public static class HostHealth {
-    /**
-     * Java processes running on the system.  Default empty array.
-     */
-    @SerializedName("activeJavaProcs")
-    private JavaProc[] activeJavaProcs = new JavaProc[0];
-
-    /**
-     * The current time when agent send the host check report
-     */
-    @SerializedName("agentTimeStampAtReporting")
-    private long agentTimeStampAtReporting = 0;
-
-    /**
-     * The current time when host check report was received
-     */
-    @SerializedName("serverTimeStampAtReporting")
-    private long serverTimeStampAtReporting = 0;
-
-    /**
-     * Live services running on the agent
-     */
-    @SerializedName("liveServices")
-    private LiveService[] liveServices = new LiveService[0];
-
-    public void setAgentTimeStampAtReporting(long currentTime) {
-      agentTimeStampAtReporting = currentTime;
-    }
-
-    public long getAgentTimeStampAtReporting() {
-      return agentTimeStampAtReporting;
-    }
-
-    public void setServerTimeStampAtReporting(long currentTime) {
-      serverTimeStampAtReporting = currentTime;
-    }
-
-    public long getServerTimeStampAtReporting() {
-      return serverTimeStampAtReporting;
-    }
-
-    public void setActiveJavaProcs(JavaProc[] procs) {
-      activeJavaProcs = procs;
-    }
-
-    public JavaProc[] getActiveJavaProcs() {
-      return activeJavaProcs;
-    }
-
-    public void setLiveServices(LiveService[] services) {
-      liveServices = services;
-    }
-
-    public LiveService[] getLiveServices() {
-      return liveServices;
-    }
-  }
-
-  public static class PackageDetail {
-    @SerializedName("name")
-    private String pkgName;
-    @SerializedName("version")
-    private String pkgVersion;
-    @SerializedName("repoName")
-    private String pkgRepoName;
-
-    public void setName(String name) {
-      pkgName = name;
-    }
-
-    public String getName() {
-      return pkgName;
-    }
-
-    public void setVersion(String version) {
-      pkgVersion = version;
-    }
-
-    public String getVersion() {
-      return pkgVersion;
-    }
-
-    public void setRepoName(String repoName) {
-      pkgRepoName = repoName;
-    }
-
-    public String getRepoName() {
-      return pkgRepoName;
-    }
-  }
-
-  /**
-   * Represents information about a directory of interest.
-   */
-  public static class Directory {
-    @SerializedName("name")
-    private String dirName;
-    @SerializedName("type")
-    private String dirType;
-
-    public void setName(String name) {
-      dirName = name;
-    }
-
-    public String getName() {
-      return dirName;
-    }
-
-    public void setType(String type) {
-      dirType = type;
-    }
-
-    public String getType() {
-      return dirType;
-    }
-  }
-
-  /**
-   * Represents information about running java processes.
-   */
-  public static class JavaProc {
-    @SerializedName("user")
-    private String user;
-    @SerializedName("pid")
-    private int pid = 0;
-    @SerializedName("hadoop")
-    private boolean is_hadoop = false;
-    @SerializedName("command")
-    private String command;
-
-    public void setUser(String user) {
-      this.user = user;
-    }
-
-    public String getUser() {
-      return user;
-    }
-
-    public void setPid(int pid) {
-      this.pid = pid;
-    }
-
-    public int getPid() {
-      return pid;
-    }
-
-    public void setHadoop(boolean hadoop) {
-      is_hadoop = hadoop;
-    }
-
-    public boolean isHadoop() {
-      return is_hadoop;
-    }
-
-    public void setCommand(String cmd) {
-      command = cmd;
-    }
-
-    public String getCommand() {
-      return command;
-    }
-  }
-
-  public static class Alternative {
-    @SerializedName("name")
-    private String altName;
-    @SerializedName("target")
-    private String altTarget;
-
-    public void setName(String name) {
-      altName = name;
-    }
-
-    public String getName() {
-      return altName;
-    }
-
-    public void setTarget(String target) {
-      altTarget = target;
-    }
-
-    public String getTarget() {
-      return altTarget;
-    }
-  }
-
-  public static class LiveService {
-    @SerializedName("name")
-    private String svcName;
-    @SerializedName("status")
-    private String svcStatus;
-    @SerializedName("desc")
-    private String svcDesc;
-
-    public void setName(String name) {
-      svcName = name;
-    }
-
-    public String getName() {
-      return svcName;
-    }
-
-    public void setStatus(String status) {
-      svcStatus = status;
-    }
-
-    public String getStatus() {
-      return svcStatus;
-    }
-
-    public void setDesc(String desc) {
-      svcDesc = desc;
-    }
-
-    public String getDesc() {
-      return svcDesc;
-    }
-  }
-
-  public static class ExistingUser {
-    @SerializedName("name")
-    private String name;
-    @SerializedName("homeDir")
-    private String homeDir;
-    @SerializedName("status")
-    private String status;
-
-    public void setUserName(String userName) {
-      name = userName;
-    }
-
-    public String getUserName() {
-      return name;
-    }
-
-    public void setUserHomeDir(String userHomeDir) {
-      homeDir = userHomeDir;
-    }
-
-    public String getUserHomeDir() {
-      return homeDir;
-    }
-
-    public void setUserStatus(String userStatus) {
-      status = userStatus;
-    }
-
-    public String getUserStatus() {
-      return status;
-    }
-  }
-}


[41/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java b/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java
deleted file mode 100644
index 081b7fa..0000000
--- a/slider-core/src/main/java/org/apache/slider/api/proto/SliderClusterAPI.java
+++ /dev/null
@@ -1,2293 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: SliderClusterProtocol.proto
-
-package org.apache.slider.api.proto;
-
-public final class SliderClusterAPI {
-  private SliderClusterAPI() {}
-  public static void registerAllExtensions(
-      com.google.protobuf.ExtensionRegistry registry) {
-  }
-  /**
-   * Protobuf service {@code org.apache.slider.api.SliderClusterProtocolPB}
-   *
-   * <pre>
-   **
-   * Protocol used from between Slider Client and AM
-   * </pre>
-   */
-  public static abstract class SliderClusterProtocolPB
-      implements com.google.protobuf.Service {
-    protected SliderClusterProtocolPB() {}
-
-    public interface Interface {
-      /**
-       * <code>rpc stopCluster(.org.apache.slider.api.StopClusterRequestProto) returns (.org.apache.slider.api.StopClusterResponseProto);</code>
-       */
-      public abstract void stopCluster(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.StopClusterRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.StopClusterResponseProto> done);
-
-      /**
-       * <code>rpc upgradeContainers(.org.apache.slider.api.UpgradeContainersRequestProto) returns (.org.apache.slider.api.UpgradeContainersResponseProto);</code>
-       *
-       * <pre>
-       **
-       * Upgrade containers 
-       * </pre>
-       */
-      public abstract void upgradeContainers(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.UpgradeContainersRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.UpgradeContainersResponseProto> done);
-
-      /**
-       * <code>rpc flexCluster(.org.apache.slider.api.FlexClusterRequestProto) returns (.org.apache.slider.api.FlexClusterResponseProto);</code>
-       *
-       * <pre>
-       **
-       * Flex the cluster. 
-       * </pre>
-       */
-      public abstract void flexCluster(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.FlexClusterRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.FlexClusterResponseProto> done);
-
-      /**
-       * <code>rpc getJSONClusterStatus(.org.apache.slider.api.GetJSONClusterStatusRequestProto) returns (.org.apache.slider.api.GetJSONClusterStatusResponseProto);</code>
-       *
-       * <pre>
-       **
-       * Get the current cluster status
-       * </pre>
-       */
-      public abstract void getJSONClusterStatus(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetJSONClusterStatusRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetJSONClusterStatusResponseProto> done);
-
-      /**
-       * <code>rpc getInstanceDefinition(.org.apache.slider.api.GetInstanceDefinitionRequestProto) returns (.org.apache.slider.api.GetInstanceDefinitionResponseProto);</code>
-       *
-       * <pre>
-       **
-       * Get the instance definition
-       * </pre>
-       */
-      public abstract void getInstanceDefinition(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetInstanceDefinitionRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetInstanceDefinitionResponseProto> done);
-
-      /**
-       * <code>rpc listNodeUUIDsByRole(.org.apache.slider.api.ListNodeUUIDsByRoleRequestProto) returns (.org.apache.slider.api.ListNodeUUIDsByRoleResponseProto);</code>
-       *
-       * <pre>
-       **
-       * List all running nodes in a role
-       * </pre>
-       */
-      public abstract void listNodeUUIDsByRole(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleResponseProto> done);
-
-      /**
-       * <code>rpc getNode(.org.apache.slider.api.GetNodeRequestProto) returns (.org.apache.slider.api.GetNodeResponseProto);</code>
-       *
-       * <pre>
-       **
-       * Get the details on a node
-       * </pre>
-       */
-      public abstract void getNode(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetNodeRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetNodeResponseProto> done);
-
-      /**
-       * <code>rpc getClusterNodes(.org.apache.slider.api.GetClusterNodesRequestProto) returns (.org.apache.slider.api.GetClusterNodesResponseProto);</code>
-       *
-       * <pre>
-       **
-       * Get the 
-       * details on a list of nodes.
-       * Unknown nodes are not returned
-       * &lt;i&gt;Important: the order of the results are undefined&lt;/i&gt;
-       * </pre>
-       */
-      public abstract void getClusterNodes(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetClusterNodesRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetClusterNodesResponseProto> done);
-
-      /**
-       * <code>rpc echo(.org.apache.slider.api.EchoRequestProto) returns (.org.apache.slider.api.EchoResponseProto);</code>
-       *
-       * <pre>
-       **
-       * echo some text
-       * </pre>
-       */
-      public abstract void echo(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.EchoRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.EchoResponseProto> done);
-
-      /**
-       * <code>rpc killContainer(.org.apache.slider.api.KillContainerRequestProto) returns (.org.apache.slider.api.KillContainerResponseProto);</code>
-       *
-       * <pre>
-       **
-       * kill a container
-       * </pre>
-       */
-      public abstract void killContainer(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.KillContainerRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.KillContainerResponseProto> done);
-
-      /**
-       * <code>rpc amSuicide(.org.apache.slider.api.AMSuicideRequestProto) returns (.org.apache.slider.api.AMSuicideResponseProto);</code>
-       *
-       * <pre>
-       **
-       * kill the AM
-       * </pre>
-       */
-      public abstract void amSuicide(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.AMSuicideRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.AMSuicideResponseProto> done);
-
-      /**
-       * <code>rpc getLivenessInformation(.org.apache.slider.api.GetApplicationLivenessRequestProto) returns (.org.apache.slider.api.ApplicationLivenessInformationProto);</code>
-       */
-      public abstract void getLivenessInformation(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto> done);
-
-      /**
-       * <code>rpc getLiveContainers(.org.apache.slider.api.GetLiveContainersRequestProto) returns (.org.apache.slider.api.GetLiveContainersResponseProto);</code>
-       */
-      public abstract void getLiveContainers(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto> done);
-
-      /**
-       * <code>rpc getLiveContainer(.org.apache.slider.api.GetLiveContainerRequestProto) returns (.org.apache.slider.api.ContainerInformationProto);</code>
-       */
-      public abstract void getLiveContainer(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ContainerInformationProto> done);
-
-      /**
-       * <code>rpc getLiveComponents(.org.apache.slider.api.GetLiveComponentsRequestProto) returns (.org.apache.slider.api.GetLiveComponentsResponseProto);</code>
-       */
-      public abstract void getLiveComponents(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto> done);
-
-      /**
-       * <code>rpc getLiveComponent(.org.apache.slider.api.GetLiveComponentRequestProto) returns (.org.apache.slider.api.ComponentInformationProto);</code>
-       */
-      public abstract void getLiveComponent(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ComponentInformationProto> done);
-
-      /**
-       * <code>rpc getLiveNodes(.org.apache.slider.api.GetLiveNodesRequestProto) returns (.org.apache.slider.api.GetLiveNodesResponseProto);</code>
-       */
-      public abstract void getLiveNodes(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto> done);
-
-      /**
-       * <code>rpc getLiveNode(.org.apache.slider.api.GetLiveNodeRequestProto) returns (.org.apache.slider.api.NodeInformationProto);</code>
-       */
-      public abstract void getLiveNode(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.NodeInformationProto> done);
-
-      /**
-       * <code>rpc getModelDesired(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
-       *
-       * <pre>
-       * AggregateConf getModelDesired()
-       * </pre>
-       */
-      public abstract void getModelDesired(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
-
-      /**
-       * <code>rpc getModelDesiredAppconf(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
-       *
-       * <pre>
-       * ConfTree getModelDesiredAppconf
-       * </pre>
-       */
-      public abstract void getModelDesiredAppconf(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
-
-      /**
-       * <code>rpc getModelDesiredResources(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
-       *
-       * <pre>
-       * ConfTree getModelDesiredResources
-       * </pre>
-       */
-      public abstract void getModelDesiredResources(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
-
-      /**
-       * <code>rpc getModelResolved(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
-       *
-       * <pre>
-       * AggregateConf getModelResolved()
-       * </pre>
-       */
-      public abstract void getModelResolved(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
-
-      /**
-       * <code>rpc getModelResolvedAppconf(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
-       *
-       * <pre>
-       * ConfTree getModelResolvedAppconf
-       * </pre>
-       */
-      public abstract void getModelResolvedAppconf(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
-
-      /**
-       * <code>rpc getModelResolvedResources(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
-       *
-       * <pre>
-       * ConfTree getModelResolvedResources
-       * </pre>
-       */
-      public abstract void getModelResolvedResources(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
-
-      /**
-       * <code>rpc getLiveResources(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
-       *
-       * <pre>
-       * ConfTree getLiveResources
-       * </pre>
-       */
-      public abstract void getLiveResources(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
-
-      /**
-       * <code>rpc getClientCertificateStore(.org.apache.slider.api.GetCertificateStoreRequestProto) returns (.org.apache.slider.api.GetCertificateStoreResponseProto);</code>
-       */
-      public abstract void getClientCertificateStore(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetCertificateStoreRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto> done);
-
-    }
-
-    public static com.google.protobuf.Service newReflectiveService(
-        final Interface impl) {
-      return new SliderClusterProtocolPB() {
-        @java.lang.Override
-        public  void stopCluster(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.StopClusterRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.StopClusterResponseProto> done) {
-          impl.stopCluster(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void upgradeContainers(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.UpgradeContainersRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.UpgradeContainersResponseProto> done) {
-          impl.upgradeContainers(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void flexCluster(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.FlexClusterRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.FlexClusterResponseProto> done) {
-          impl.flexCluster(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getJSONClusterStatus(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.GetJSONClusterStatusRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetJSONClusterStatusResponseProto> done) {
-          impl.getJSONClusterStatus(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getInstanceDefinition(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.GetInstanceDefinitionRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetInstanceDefinitionResponseProto> done) {
-          impl.getInstanceDefinition(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void listNodeUUIDsByRole(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleResponseProto> done) {
-          impl.listNodeUUIDsByRole(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getNode(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.GetNodeRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetNodeResponseProto> done) {
-          impl.getNode(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getClusterNodes(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.GetClusterNodesRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetClusterNodesResponseProto> done) {
-          impl.getClusterNodes(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void echo(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.EchoRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.EchoResponseProto> done) {
-          impl.echo(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void killContainer(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.KillContainerRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.KillContainerResponseProto> done) {
-          impl.killContainer(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void amSuicide(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.AMSuicideRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.AMSuicideResponseProto> done) {
-          impl.amSuicide(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getLivenessInformation(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto> done) {
-          impl.getLivenessInformation(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getLiveContainers(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto> done) {
-          impl.getLiveContainers(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getLiveContainer(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ContainerInformationProto> done) {
-          impl.getLiveContainer(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getLiveComponents(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto> done) {
-          impl.getLiveComponents(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getLiveComponent(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ComponentInformationProto> done) {
-          impl.getLiveComponent(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getLiveNodes(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto> done) {
-          impl.getLiveNodes(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getLiveNode(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.NodeInformationProto> done) {
-          impl.getLiveNode(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getModelDesired(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
-          impl.getModelDesired(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getModelDesiredAppconf(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
-          impl.getModelDesiredAppconf(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getModelDesiredResources(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
-          impl.getModelDesiredResources(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getModelResolved(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
-          impl.getModelResolved(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getModelResolvedAppconf(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
-          impl.getModelResolvedAppconf(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getModelResolvedResources(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
-          impl.getModelResolvedResources(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getLiveResources(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
-          impl.getLiveResources(controller, request, done);
-        }
-
-        @java.lang.Override
-        public  void getClientCertificateStore(
-            com.google.protobuf.RpcController controller,
-            org.apache.slider.api.proto.Messages.GetCertificateStoreRequestProto request,
-            com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto> done) {
-          impl.getClientCertificateStore(controller, request, done);
-        }
-
-      };
-    }
-
-    public static com.google.protobuf.BlockingService
-        newReflectiveBlockingService(final BlockingInterface impl) {
-      return new com.google.protobuf.BlockingService() {
-        public final com.google.protobuf.Descriptors.ServiceDescriptor
-            getDescriptorForType() {
-          return getDescriptor();
-        }
-
-        public final com.google.protobuf.Message callBlockingMethod(
-            com.google.protobuf.Descriptors.MethodDescriptor method,
-            com.google.protobuf.RpcController controller,
-            com.google.protobuf.Message request)
-            throws com.google.protobuf.ServiceException {
-          if (method.getService() != getDescriptor()) {
-            throw new java.lang.IllegalArgumentException(
-              "Service.callBlockingMethod() given method descriptor for " +
-              "wrong service type.");
-          }
-          switch(method.getIndex()) {
-            case 0:
-              return impl.stopCluster(controller, (org.apache.slider.api.proto.Messages.StopClusterRequestProto)request);
-            case 1:
-              return impl.upgradeContainers(controller, (org.apache.slider.api.proto.Messages.UpgradeContainersRequestProto)request);
-            case 2:
-              return impl.flexCluster(controller, (org.apache.slider.api.proto.Messages.FlexClusterRequestProto)request);
-            case 3:
-              return impl.getJSONClusterStatus(controller, (org.apache.slider.api.proto.Messages.GetJSONClusterStatusRequestProto)request);
-            case 4:
-              return impl.getInstanceDefinition(controller, (org.apache.slider.api.proto.Messages.GetInstanceDefinitionRequestProto)request);
-            case 5:
-              return impl.listNodeUUIDsByRole(controller, (org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleRequestProto)request);
-            case 6:
-              return impl.getNode(controller, (org.apache.slider.api.proto.Messages.GetNodeRequestProto)request);
-            case 7:
-              return impl.getClusterNodes(controller, (org.apache.slider.api.proto.Messages.GetClusterNodesRequestProto)request);
-            case 8:
-              return impl.echo(controller, (org.apache.slider.api.proto.Messages.EchoRequestProto)request);
-            case 9:
-              return impl.killContainer(controller, (org.apache.slider.api.proto.Messages.KillContainerRequestProto)request);
-            case 10:
-              return impl.amSuicide(controller, (org.apache.slider.api.proto.Messages.AMSuicideRequestProto)request);
-            case 11:
-              return impl.getLivenessInformation(controller, (org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto)request);
-            case 12:
-              return impl.getLiveContainers(controller, (org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto)request);
-            case 13:
-              return impl.getLiveContainer(controller, (org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto)request);
-            case 14:
-              return impl.getLiveComponents(controller, (org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto)request);
-            case 15:
-              return impl.getLiveComponent(controller, (org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto)request);
-            case 16:
-              return impl.getLiveNodes(controller, (org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto)request);
-            case 17:
-              return impl.getLiveNode(controller, (org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto)request);
-            case 18:
-              return impl.getModelDesired(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
-            case 19:
-              return impl.getModelDesiredAppconf(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
-            case 20:
-              return impl.getModelDesiredResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
-            case 21:
-              return impl.getModelResolved(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
-            case 22:
-              return impl.getModelResolvedAppconf(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
-            case 23:
-              return impl.getModelResolvedResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
-            case 24:
-              return impl.getLiveResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request);
-            case 25:
-              return impl.getClientCertificateStore(controller, (org.apache.slider.api.proto.Messages.GetCertificateStoreRequestProto)request);
-            default:
-              throw new java.lang.AssertionError("Can't get here.");
-          }
-        }
-
-        public final com.google.protobuf.Message
-            getRequestPrototype(
-            com.google.protobuf.Descriptors.MethodDescriptor method) {
-          if (method.getService() != getDescriptor()) {
-            throw new java.lang.IllegalArgumentException(
-              "Service.getRequestPrototype() given method " +
-              "descriptor for wrong service type.");
-          }
-          switch(method.getIndex()) {
-            case 0:
-              return org.apache.slider.api.proto.Messages.StopClusterRequestProto.getDefaultInstance();
-            case 1:
-              return org.apache.slider.api.proto.Messages.UpgradeContainersRequestProto.getDefaultInstance();
-            case 2:
-              return org.apache.slider.api.proto.Messages.FlexClusterRequestProto.getDefaultInstance();
-            case 3:
-              return org.apache.slider.api.proto.Messages.GetJSONClusterStatusRequestProto.getDefaultInstance();
-            case 4:
-              return org.apache.slider.api.proto.Messages.GetInstanceDefinitionRequestProto.getDefaultInstance();
-            case 5:
-              return org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleRequestProto.getDefaultInstance();
-            case 6:
-              return org.apache.slider.api.proto.Messages.GetNodeRequestProto.getDefaultInstance();
-            case 7:
-              return org.apache.slider.api.proto.Messages.GetClusterNodesRequestProto.getDefaultInstance();
-            case 8:
-              return org.apache.slider.api.proto.Messages.EchoRequestProto.getDefaultInstance();
-            case 9:
-              return org.apache.slider.api.proto.Messages.KillContainerRequestProto.getDefaultInstance();
-            case 10:
-              return org.apache.slider.api.proto.Messages.AMSuicideRequestProto.getDefaultInstance();
-            case 11:
-              return org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto.getDefaultInstance();
-            case 12:
-              return org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto.getDefaultInstance();
-            case 13:
-              return org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto.getDefaultInstance();
-            case 14:
-              return org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto.getDefaultInstance();
-            case 15:
-              return org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto.getDefaultInstance();
-            case 16:
-              return org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto.getDefaultInstance();
-            case 17:
-              return org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto.getDefaultInstance();
-            case 18:
-              return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
-            case 19:
-              return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
-            case 20:
-              return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
-            case 21:
-              return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
-            case 22:
-              return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
-            case 23:
-              return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
-            case 24:
-              return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
-            case 25:
-              return org.apache.slider.api.proto.Messages.GetCertificateStoreRequestProto.getDefaultInstance();
-            default:
-              throw new java.lang.AssertionError("Can't get here.");
-          }
-        }
-
-        public final com.google.protobuf.Message
-            getResponsePrototype(
-            com.google.protobuf.Descriptors.MethodDescriptor method) {
-          if (method.getService() != getDescriptor()) {
-            throw new java.lang.IllegalArgumentException(
-              "Service.getResponsePrototype() given method " +
-              "descriptor for wrong service type.");
-          }
-          switch(method.getIndex()) {
-            case 0:
-              return org.apache.slider.api.proto.Messages.StopClusterResponseProto.getDefaultInstance();
-            case 1:
-              return org.apache.slider.api.proto.Messages.UpgradeContainersResponseProto.getDefaultInstance();
-            case 2:
-              return org.apache.slider.api.proto.Messages.FlexClusterResponseProto.getDefaultInstance();
-            case 3:
-              return org.apache.slider.api.proto.Messages.GetJSONClusterStatusResponseProto.getDefaultInstance();
-            case 4:
-              return org.apache.slider.api.proto.Messages.GetInstanceDefinitionResponseProto.getDefaultInstance();
-            case 5:
-              return org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleResponseProto.getDefaultInstance();
-            case 6:
-              return org.apache.slider.api.proto.Messages.GetNodeResponseProto.getDefaultInstance();
-            case 7:
-              return org.apache.slider.api.proto.Messages.GetClusterNodesResponseProto.getDefaultInstance();
-            case 8:
-              return org.apache.slider.api.proto.Messages.EchoResponseProto.getDefaultInstance();
-            case 9:
-              return org.apache.slider.api.proto.Messages.KillContainerResponseProto.getDefaultInstance();
-            case 10:
-              return org.apache.slider.api.proto.Messages.AMSuicideResponseProto.getDefaultInstance();
-            case 11:
-              return org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.getDefaultInstance();
-            case 12:
-              return org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto.getDefaultInstance();
-            case 13:
-              return org.apache.slider.api.proto.Messages.ContainerInformationProto.getDefaultInstance();
-            case 14:
-              return org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto.getDefaultInstance();
-            case 15:
-              return org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance();
-            case 16:
-              return org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto.getDefaultInstance();
-            case 17:
-              return org.apache.slider.api.proto.Messages.NodeInformationProto.getDefaultInstance();
-            case 18:
-              return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
-            case 19:
-              return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
-            case 20:
-              return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
-            case 21:
-              return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
-            case 22:
-              return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
-            case 23:
-              return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
-            case 24:
-              return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
-            case 25:
-              return org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto.getDefaultInstance();
-            default:
-              throw new java.lang.AssertionError("Can't get here.");
-          }
-        }
-
-      };
-    }
-
-    /**
-     * <code>rpc stopCluster(.org.apache.slider.api.StopClusterRequestProto) returns (.org.apache.slider.api.StopClusterResponseProto);</code>
-     */
-    public abstract void stopCluster(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.StopClusterRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.StopClusterResponseProto> done);
-
-    /**
-     * <code>rpc upgradeContainers(.org.apache.slider.api.UpgradeContainersRequestProto) returns (.org.apache.slider.api.UpgradeContainersResponseProto);</code>
-     *
-     * <pre>
-     **
-     * Upgrade containers 
-     * </pre>
-     */
-    public abstract void upgradeContainers(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.UpgradeContainersRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.UpgradeContainersResponseProto> done);
-
-    /**
-     * <code>rpc flexCluster(.org.apache.slider.api.FlexClusterRequestProto) returns (.org.apache.slider.api.FlexClusterResponseProto);</code>
-     *
-     * <pre>
-     **
-     * Flex the cluster. 
-     * </pre>
-     */
-    public abstract void flexCluster(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.FlexClusterRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.FlexClusterResponseProto> done);
-
-    /**
-     * <code>rpc getJSONClusterStatus(.org.apache.slider.api.GetJSONClusterStatusRequestProto) returns (.org.apache.slider.api.GetJSONClusterStatusResponseProto);</code>
-     *
-     * <pre>
-     **
-     * Get the current cluster status
-     * </pre>
-     */
-    public abstract void getJSONClusterStatus(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.GetJSONClusterStatusRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetJSONClusterStatusResponseProto> done);
-
-    /**
-     * <code>rpc getInstanceDefinition(.org.apache.slider.api.GetInstanceDefinitionRequestProto) returns (.org.apache.slider.api.GetInstanceDefinitionResponseProto);</code>
-     *
-     * <pre>
-     **
-     * Get the instance definition
-     * </pre>
-     */
-    public abstract void getInstanceDefinition(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.GetInstanceDefinitionRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetInstanceDefinitionResponseProto> done);
-
-    /**
-     * <code>rpc listNodeUUIDsByRole(.org.apache.slider.api.ListNodeUUIDsByRoleRequestProto) returns (.org.apache.slider.api.ListNodeUUIDsByRoleResponseProto);</code>
-     *
-     * <pre>
-     **
-     * List all running nodes in a role
-     * </pre>
-     */
-    public abstract void listNodeUUIDsByRole(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleResponseProto> done);
-
-    /**
-     * <code>rpc getNode(.org.apache.slider.api.GetNodeRequestProto) returns (.org.apache.slider.api.GetNodeResponseProto);</code>
-     *
-     * <pre>
-     **
-     * Get the details on a node
-     * </pre>
-     */
-    public abstract void getNode(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.GetNodeRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetNodeResponseProto> done);
-
-    /**
-     * <code>rpc getClusterNodes(.org.apache.slider.api.GetClusterNodesRequestProto) returns (.org.apache.slider.api.GetClusterNodesResponseProto);</code>
-     *
-     * <pre>
-     **
-     * Get the 
-     * details on a list of nodes.
-     * Unknown nodes are not returned
-     * &lt;i&gt;Important: the order of the results are undefined&lt;/i&gt;
-     * </pre>
-     */
-    public abstract void getClusterNodes(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.GetClusterNodesRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetClusterNodesResponseProto> done);
-
-    /**
-     * <code>rpc echo(.org.apache.slider.api.EchoRequestProto) returns (.org.apache.slider.api.EchoResponseProto);</code>
-     *
-     * <pre>
-     **
-     * echo some text
-     * </pre>
-     */
-    public abstract void echo(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.EchoRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.EchoResponseProto> done);
-
-    /**
-     * <code>rpc killContainer(.org.apache.slider.api.KillContainerRequestProto) returns (.org.apache.slider.api.KillContainerResponseProto);</code>
-     *
-     * <pre>
-     **
-     * kill a container
-     * </pre>
-     */
-    public abstract void killContainer(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.KillContainerRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.KillContainerResponseProto> done);
-
-    /**
-     * <code>rpc amSuicide(.org.apache.slider.api.AMSuicideRequestProto) returns (.org.apache.slider.api.AMSuicideResponseProto);</code>
-     *
-     * <pre>
-     **
-     * kill the AM
-     * </pre>
-     */
-    public abstract void amSuicide(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.AMSuicideRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.AMSuicideResponseProto> done);
-
-    /**
-     * <code>rpc getLivenessInformation(.org.apache.slider.api.GetApplicationLivenessRequestProto) returns (.org.apache.slider.api.ApplicationLivenessInformationProto);</code>
-     */
-    public abstract void getLivenessInformation(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto> done);
-
-    /**
-     * <code>rpc getLiveContainers(.org.apache.slider.api.GetLiveContainersRequestProto) returns (.org.apache.slider.api.GetLiveContainersResponseProto);</code>
-     */
-    public abstract void getLiveContainers(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto> done);
-
-    /**
-     * <code>rpc getLiveContainer(.org.apache.slider.api.GetLiveContainerRequestProto) returns (.org.apache.slider.api.ContainerInformationProto);</code>
-     */
-    public abstract void getLiveContainer(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ContainerInformationProto> done);
-
-    /**
-     * <code>rpc getLiveComponents(.org.apache.slider.api.GetLiveComponentsRequestProto) returns (.org.apache.slider.api.GetLiveComponentsResponseProto);</code>
-     */
-    public abstract void getLiveComponents(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto> done);
-
-    /**
-     * <code>rpc getLiveComponent(.org.apache.slider.api.GetLiveComponentRequestProto) returns (.org.apache.slider.api.ComponentInformationProto);</code>
-     */
-    public abstract void getLiveComponent(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ComponentInformationProto> done);
-
-    /**
-     * <code>rpc getLiveNodes(.org.apache.slider.api.GetLiveNodesRequestProto) returns (.org.apache.slider.api.GetLiveNodesResponseProto);</code>
-     */
-    public abstract void getLiveNodes(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto> done);
-
-    /**
-     * <code>rpc getLiveNode(.org.apache.slider.api.GetLiveNodeRequestProto) returns (.org.apache.slider.api.NodeInformationProto);</code>
-     */
-    public abstract void getLiveNode(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.NodeInformationProto> done);
-
-    /**
-     * <code>rpc getModelDesired(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
-     *
-     * <pre>
-     * AggregateConf getModelDesired()
-     * </pre>
-     */
-    public abstract void getModelDesired(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
-
-    /**
-     * <code>rpc getModelDesiredAppconf(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
-     *
-     * <pre>
-     * ConfTree getModelDesiredAppconf
-     * </pre>
-     */
-    public abstract void getModelDesiredAppconf(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
-
-    /**
-     * <code>rpc getModelDesiredResources(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
-     *
-     * <pre>
-     * ConfTree getModelDesiredResources
-     * </pre>
-     */
-    public abstract void getModelDesiredResources(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
-
-    /**
-     * <code>rpc getModelResolved(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
-     *
-     * <pre>
-     * AggregateConf getModelResolved()
-     * </pre>
-     */
-    public abstract void getModelResolved(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
-
-    /**
-     * <code>rpc getModelResolvedAppconf(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
-     *
-     * <pre>
-     * ConfTree getModelResolvedAppconf
-     * </pre>
-     */
-    public abstract void getModelResolvedAppconf(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
-
-    /**
-     * <code>rpc getModelResolvedResources(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
-     *
-     * <pre>
-     * ConfTree getModelResolvedResources
-     * </pre>
-     */
-    public abstract void getModelResolvedResources(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
-
-    /**
-     * <code>rpc getLiveResources(.org.apache.slider.api.EmptyPayloadProto) returns (.org.apache.slider.api.WrappedJsonProto);</code>
-     *
-     * <pre>
-     * ConfTree getLiveResources
-     * </pre>
-     */
-    public abstract void getLiveResources(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done);
-
-    /**
-     * <code>rpc getClientCertificateStore(.org.apache.slider.api.GetCertificateStoreRequestProto) returns (.org.apache.slider.api.GetCertificateStoreResponseProto);</code>
-     */
-    public abstract void getClientCertificateStore(
-        com.google.protobuf.RpcController controller,
-        org.apache.slider.api.proto.Messages.GetCertificateStoreRequestProto request,
-        com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto> done);
-
-    public static final
-        com.google.protobuf.Descriptors.ServiceDescriptor
-        getDescriptor() {
-      return org.apache.slider.api.proto.SliderClusterAPI.getDescriptor().getServices().get(0);
-    }
-    public final com.google.protobuf.Descriptors.ServiceDescriptor
-        getDescriptorForType() {
-      return getDescriptor();
-    }
-
-    public final void callMethod(
-        com.google.protobuf.Descriptors.MethodDescriptor method,
-        com.google.protobuf.RpcController controller,
-        com.google.protobuf.Message request,
-        com.google.protobuf.RpcCallback<
-          com.google.protobuf.Message> done) {
-      if (method.getService() != getDescriptor()) {
-        throw new java.lang.IllegalArgumentException(
-          "Service.callMethod() given method descriptor for wrong " +
-          "service type.");
-      }
-      switch(method.getIndex()) {
-        case 0:
-          this.stopCluster(controller, (org.apache.slider.api.proto.Messages.StopClusterRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.StopClusterResponseProto>specializeCallback(
-              done));
-          return;
-        case 1:
-          this.upgradeContainers(controller, (org.apache.slider.api.proto.Messages.UpgradeContainersRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.UpgradeContainersResponseProto>specializeCallback(
-              done));
-          return;
-        case 2:
-          this.flexCluster(controller, (org.apache.slider.api.proto.Messages.FlexClusterRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.FlexClusterResponseProto>specializeCallback(
-              done));
-          return;
-        case 3:
-          this.getJSONClusterStatus(controller, (org.apache.slider.api.proto.Messages.GetJSONClusterStatusRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.GetJSONClusterStatusResponseProto>specializeCallback(
-              done));
-          return;
-        case 4:
-          this.getInstanceDefinition(controller, (org.apache.slider.api.proto.Messages.GetInstanceDefinitionRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.GetInstanceDefinitionResponseProto>specializeCallback(
-              done));
-          return;
-        case 5:
-          this.listNodeUUIDsByRole(controller, (org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleResponseProto>specializeCallback(
-              done));
-          return;
-        case 6:
-          this.getNode(controller, (org.apache.slider.api.proto.Messages.GetNodeRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.GetNodeResponseProto>specializeCallback(
-              done));
-          return;
-        case 7:
-          this.getClusterNodes(controller, (org.apache.slider.api.proto.Messages.GetClusterNodesRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.GetClusterNodesResponseProto>specializeCallback(
-              done));
-          return;
-        case 8:
-          this.echo(controller, (org.apache.slider.api.proto.Messages.EchoRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.EchoResponseProto>specializeCallback(
-              done));
-          return;
-        case 9:
-          this.killContainer(controller, (org.apache.slider.api.proto.Messages.KillContainerRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.KillContainerResponseProto>specializeCallback(
-              done));
-          return;
-        case 10:
-          this.amSuicide(controller, (org.apache.slider.api.proto.Messages.AMSuicideRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.AMSuicideResponseProto>specializeCallback(
-              done));
-          return;
-        case 11:
-          this.getLivenessInformation(controller, (org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto>specializeCallback(
-              done));
-          return;
-        case 12:
-          this.getLiveContainers(controller, (org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto>specializeCallback(
-              done));
-          return;
-        case 13:
-          this.getLiveContainer(controller, (org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.ContainerInformationProto>specializeCallback(
-              done));
-          return;
-        case 14:
-          this.getLiveComponents(controller, (org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto>specializeCallback(
-              done));
-          return;
-        case 15:
-          this.getLiveComponent(controller, (org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.ComponentInformationProto>specializeCallback(
-              done));
-          return;
-        case 16:
-          this.getLiveNodes(controller, (org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto>specializeCallback(
-              done));
-          return;
-        case 17:
-          this.getLiveNode(controller, (org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.NodeInformationProto>specializeCallback(
-              done));
-          return;
-        case 18:
-          this.getModelDesired(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
-              done));
-          return;
-        case 19:
-          this.getModelDesiredAppconf(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
-              done));
-          return;
-        case 20:
-          this.getModelDesiredResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
-              done));
-          return;
-        case 21:
-          this.getModelResolved(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
-              done));
-          return;
-        case 22:
-          this.getModelResolvedAppconf(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
-              done));
-          return;
-        case 23:
-          this.getModelResolvedResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
-              done));
-          return;
-        case 24:
-          this.getLiveResources(controller, (org.apache.slider.api.proto.Messages.EmptyPayloadProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.WrappedJsonProto>specializeCallback(
-              done));
-          return;
-        case 25:
-          this.getClientCertificateStore(controller, (org.apache.slider.api.proto.Messages.GetCertificateStoreRequestProto)request,
-            com.google.protobuf.RpcUtil.<org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto>specializeCallback(
-              done));
-          return;
-        default:
-          throw new java.lang.AssertionError("Can't get here.");
-      }
-    }
-
-    public final com.google.protobuf.Message
-        getRequestPrototype(
-        com.google.protobuf.Descriptors.MethodDescriptor method) {
-      if (method.getService() != getDescriptor()) {
-        throw new java.lang.IllegalArgumentException(
-          "Service.getRequestPrototype() given method " +
-          "descriptor for wrong service type.");
-      }
-      switch(method.getIndex()) {
-        case 0:
-          return org.apache.slider.api.proto.Messages.StopClusterRequestProto.getDefaultInstance();
-        case 1:
-          return org.apache.slider.api.proto.Messages.UpgradeContainersRequestProto.getDefaultInstance();
-        case 2:
-          return org.apache.slider.api.proto.Messages.FlexClusterRequestProto.getDefaultInstance();
-        case 3:
-          return org.apache.slider.api.proto.Messages.GetJSONClusterStatusRequestProto.getDefaultInstance();
-        case 4:
-          return org.apache.slider.api.proto.Messages.GetInstanceDefinitionRequestProto.getDefaultInstance();
-        case 5:
-          return org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleRequestProto.getDefaultInstance();
-        case 6:
-          return org.apache.slider.api.proto.Messages.GetNodeRequestProto.getDefaultInstance();
-        case 7:
-          return org.apache.slider.api.proto.Messages.GetClusterNodesRequestProto.getDefaultInstance();
-        case 8:
-          return org.apache.slider.api.proto.Messages.EchoRequestProto.getDefaultInstance();
-        case 9:
-          return org.apache.slider.api.proto.Messages.KillContainerRequestProto.getDefaultInstance();
-        case 10:
-          return org.apache.slider.api.proto.Messages.AMSuicideRequestProto.getDefaultInstance();
-        case 11:
-          return org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto.getDefaultInstance();
-        case 12:
-          return org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto.getDefaultInstance();
-        case 13:
-          return org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto.getDefaultInstance();
-        case 14:
-          return org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto.getDefaultInstance();
-        case 15:
-          return org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto.getDefaultInstance();
-        case 16:
-          return org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto.getDefaultInstance();
-        case 17:
-          return org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto.getDefaultInstance();
-        case 18:
-          return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
-        case 19:
-          return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
-        case 20:
-          return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
-        case 21:
-          return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
-        case 22:
-          return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
-        case 23:
-          return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
-        case 24:
-          return org.apache.slider.api.proto.Messages.EmptyPayloadProto.getDefaultInstance();
-        case 25:
-          return org.apache.slider.api.proto.Messages.GetCertificateStoreRequestProto.getDefaultInstance();
-        default:
-          throw new java.lang.AssertionError("Can't get here.");
-      }
-    }
-
-    public final com.google.protobuf.Message
-        getResponsePrototype(
-        com.google.protobuf.Descriptors.MethodDescriptor method) {
-      if (method.getService() != getDescriptor()) {
-        throw new java.lang.IllegalArgumentException(
-          "Service.getResponsePrototype() given method " +
-          "descriptor for wrong service type.");
-      }
-      switch(method.getIndex()) {
-        case 0:
-          return org.apache.slider.api.proto.Messages.StopClusterResponseProto.getDefaultInstance();
-        case 1:
-          return org.apache.slider.api.proto.Messages.UpgradeContainersResponseProto.getDefaultInstance();
-        case 2:
-          return org.apache.slider.api.proto.Messages.FlexClusterResponseProto.getDefaultInstance();
-        case 3:
-          return org.apache.slider.api.proto.Messages.GetJSONClusterStatusResponseProto.getDefaultInstance();
-        case 4:
-          return org.apache.slider.api.proto.Messages.GetInstanceDefinitionResponseProto.getDefaultInstance();
-        case 5:
-          return org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleResponseProto.getDefaultInstance();
-        case 6:
-          return org.apache.slider.api.proto.Messages.GetNodeResponseProto.getDefaultInstance();
-        case 7:
-          return org.apache.slider.api.proto.Messages.GetClusterNodesResponseProto.getDefaultInstance();
-        case 8:
-          return org.apache.slider.api.proto.Messages.EchoResponseProto.getDefaultInstance();
-        case 9:
-          return org.apache.slider.api.proto.Messages.KillContainerResponseProto.getDefaultInstance();
-        case 10:
-          return org.apache.slider.api.proto.Messages.AMSuicideResponseProto.getDefaultInstance();
-        case 11:
-          return org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.getDefaultInstance();
-        case 12:
-          return org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto.getDefaultInstance();
-        case 13:
-          return org.apache.slider.api.proto.Messages.ContainerInformationProto.getDefaultInstance();
-        case 14:
-          return org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto.getDefaultInstance();
-        case 15:
-          return org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance();
-        case 16:
-          return org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto.getDefaultInstance();
-        case 17:
-          return org.apache.slider.api.proto.Messages.NodeInformationProto.getDefaultInstance();
-        case 18:
-          return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
-        case 19:
-          return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
-        case 20:
-          return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
-        case 21:
-          return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
-        case 22:
-          return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
-        case 23:
-          return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
-        case 24:
-          return org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance();
-        case 25:
-          return org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto.getDefaultInstance();
-        default:
-          throw new java.lang.AssertionError("Can't get here.");
-      }
-    }
-
-    public static Stub newStub(
-        com.google.protobuf.RpcChannel channel) {
-      return new Stub(channel);
-    }
-
-    public static final class Stub extends org.apache.slider.api.proto.SliderClusterAPI.SliderClusterProtocolPB implements Interface {
-      private Stub(com.google.protobuf.RpcChannel channel) {
-        this.channel = channel;
-      }
-
-      private final com.google.protobuf.RpcChannel channel;
-
-      public com.google.protobuf.RpcChannel getChannel() {
-        return channel;
-      }
-
-      public  void stopCluster(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.StopClusterRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.StopClusterResponseProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(0),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.StopClusterResponseProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.StopClusterResponseProto.class,
-            org.apache.slider.api.proto.Messages.StopClusterResponseProto.getDefaultInstance()));
-      }
-
-      public  void upgradeContainers(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.UpgradeContainersRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.UpgradeContainersResponseProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(1),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.UpgradeContainersResponseProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.UpgradeContainersResponseProto.class,
-            org.apache.slider.api.proto.Messages.UpgradeContainersResponseProto.getDefaultInstance()));
-      }
-
-      public  void flexCluster(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.FlexClusterRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.FlexClusterResponseProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(2),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.FlexClusterResponseProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.FlexClusterResponseProto.class,
-            org.apache.slider.api.proto.Messages.FlexClusterResponseProto.getDefaultInstance()));
-      }
-
-      public  void getJSONClusterStatus(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetJSONClusterStatusRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetJSONClusterStatusResponseProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(3),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.GetJSONClusterStatusResponseProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.GetJSONClusterStatusResponseProto.class,
-            org.apache.slider.api.proto.Messages.GetJSONClusterStatusResponseProto.getDefaultInstance()));
-      }
-
-      public  void getInstanceDefinition(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetInstanceDefinitionRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetInstanceDefinitionResponseProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(4),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.GetInstanceDefinitionResponseProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.GetInstanceDefinitionResponseProto.class,
-            org.apache.slider.api.proto.Messages.GetInstanceDefinitionResponseProto.getDefaultInstance()));
-      }
-
-      public  void listNodeUUIDsByRole(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleResponseProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(5),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleResponseProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleResponseProto.class,
-            org.apache.slider.api.proto.Messages.ListNodeUUIDsByRoleResponseProto.getDefaultInstance()));
-      }
-
-      public  void getNode(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetNodeRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetNodeResponseProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(6),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.GetNodeResponseProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.GetNodeResponseProto.class,
-            org.apache.slider.api.proto.Messages.GetNodeResponseProto.getDefaultInstance()));
-      }
-
-      public  void getClusterNodes(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetClusterNodesRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetClusterNodesResponseProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(7),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.GetClusterNodesResponseProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.GetClusterNodesResponseProto.class,
-            org.apache.slider.api.proto.Messages.GetClusterNodesResponseProto.getDefaultInstance()));
-      }
-
-      public  void echo(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.EchoRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.EchoResponseProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(8),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.EchoResponseProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.EchoResponseProto.class,
-            org.apache.slider.api.proto.Messages.EchoResponseProto.getDefaultInstance()));
-      }
-
-      public  void killContainer(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.KillContainerRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.KillContainerResponseProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(9),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.KillContainerResponseProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.KillContainerResponseProto.class,
-            org.apache.slider.api.proto.Messages.KillContainerResponseProto.getDefaultInstance()));
-      }
-
-      public  void amSuicide(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.AMSuicideRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.AMSuicideResponseProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(10),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.AMSuicideResponseProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.AMSuicideResponseProto.class,
-            org.apache.slider.api.proto.Messages.AMSuicideResponseProto.getDefaultInstance()));
-      }
-
-      public  void getLivenessInformation(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetApplicationLivenessRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(11),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.class,
-            org.apache.slider.api.proto.Messages.ApplicationLivenessInformationProto.getDefaultInstance()));
-      }
-
-      public  void getLiveContainers(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetLiveContainersRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(12),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto.class,
-            org.apache.slider.api.proto.Messages.GetLiveContainersResponseProto.getDefaultInstance()));
-      }
-
-      public  void getLiveContainer(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetLiveContainerRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ContainerInformationProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(13),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.ContainerInformationProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.ContainerInformationProto.class,
-            org.apache.slider.api.proto.Messages.ContainerInformationProto.getDefaultInstance()));
-      }
-
-      public  void getLiveComponents(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetLiveComponentsRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(14),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto.class,
-            org.apache.slider.api.proto.Messages.GetLiveComponentsResponseProto.getDefaultInstance()));
-      }
-
-      public  void getLiveComponent(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetLiveComponentRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.ComponentInformationProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(15),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.ComponentInformationProto.class,
-            org.apache.slider.api.proto.Messages.ComponentInformationProto.getDefaultInstance()));
-      }
-
-      public  void getLiveNodes(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetLiveNodesRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(16),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto.class,
-            org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto.getDefaultInstance()));
-      }
-
-      public  void getLiveNode(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetLiveNodeRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.NodeInformationProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(17),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.NodeInformationProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.NodeInformationProto.class,
-            org.apache.slider.api.proto.Messages.NodeInformationProto.getDefaultInstance()));
-      }
-
-      public  void getModelDesired(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(18),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.WrappedJsonProto.class,
-            org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance()));
-      }
-
-      public  void getModelDesiredAppconf(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(19),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.WrappedJsonProto.class,
-            org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance()));
-      }
-
-      public  void getModelDesiredResources(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(20),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.WrappedJsonProto.class,
-            org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance()));
-      }
-
-      public  void getModelResolved(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(21),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.WrappedJsonProto.class,
-            org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance()));
-      }
-
-      public  void getModelResolvedAppconf(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(22),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.WrappedJsonProto.class,
-            org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance()));
-      }
-
-      public  void getModelResolvedResources(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(23),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.WrappedJsonProto.class,
-            org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance()));
-      }
-
-      public  void getLiveResources(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.EmptyPayloadProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.WrappedJsonProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(24),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.WrappedJsonProto.class,
-            org.apache.slider.api.proto.Messages.WrappedJsonProto.getDefaultInstance()));
-      }
-
-      public  void getClientCertificateStore(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.GetCertificateStoreRequestProto request,
-          com.google.protobuf.RpcCallback<org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto> done) {
-        channel.callMethod(
-          getDescriptor().getMethods().get(25),
-          controller,
-          request,
-          org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto.getDefaultInstance(),
-          com.google.protobuf.RpcUtil.generalizeCallback(
-            done,
-            org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto.class,
-            org.apache.slider.api.proto.Messages.GetCertificateStoreResponseProto.getDefaultInstance()));
-      }
-    }
-
-    public static BlockingInterface newBlockingStub(
-        com.google.protobuf.BlockingRpcChannel channel) {
-      return new BlockingStub(channel);
-    }
-
-    public interface BlockingInterface {
-      public org.apache.slider.api.proto.Messages.StopClusterResponseProto stopCluster(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.StopClusterRequestProto request)
-          throws com.google.protobuf.ServiceException;
-
-      public org.apache.slider.api.proto.Messages.UpgradeContainersResponseProto upgradeContainers(
-          com.google.protobuf.RpcController controller,
-          org.apache.slider.api.proto.Messages.Upg

<TRUNCATED>


[46/46] incubator-slider git commit: SLIDER-1165 bring back few files required by tests

Posted by go...@apache.org.
SLIDER-1165 bring back few files required by tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/940c087a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/940c087a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/940c087a

Branch: refs/heads/yarn-native-services
Commit: 940c087a90e808375474308592e40e60105d3ea9
Parents: 51c2b92
Author: Gour Saha <go...@apache.org>
Authored: Thu Aug 25 13:03:04 2016 -0700
Committer: Gour Saha <go...@apache.org>
Committed: Thu Aug 25 13:03:04 2016 -0700

----------------------------------------------------------------------
 .../slider/providers/agent/conf/agent.txt       |  19 +++
 .../slider/providers/agent/conf/command.json    | 168 +++++++++++++++++++
 .../providers/agent/conf/command_template.json  | 168 +++++++++++++++++++
 3 files changed, 355 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/940c087a/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/agent.txt
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/agent.txt b/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/agent.txt
new file mode 100644
index 0000000..79c1972
--- /dev/null
+++ b/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/agent.txt
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+This is the conf directory for the python agent
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/940c087a/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/command.json
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/command.json b/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/command.json
new file mode 100644
index 0000000..197a046
--- /dev/null
+++ b/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/command.json
@@ -0,0 +1,168 @@
+{
+  "roleCommand": "START",
+  "clusterName": "c1",
+  "hostname": "c6402.ambari.apache.org",
+  "hostLevelParams": {
+    "java_home": "/usr/jdk64/jdk1.7.0_45"
+  },
+  "commandType": "EXECUTION_COMMAND",
+  "roleParams": {},
+  "serviceName": "HBASE",
+  "role": "HBASE_MASTER",
+  "commandParams": {},
+  "taskId": 24,
+  "public_hostname": "c6402.ambari.apache.org",
+  "configurations": {
+    "hbase-log4j": {
+      "log4j.threshold": "ALL",
+      "log4j.rootLogger": "${hbase.root.logger}",
+      "log4j.logger.org.apache.zookeeper": "INFO",
+      "log4j.logger.org.apache.hadoop.hbase": "DEBUG",
+      "log4j.logger.org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher": "INFO",
+      "log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil": "INFO",
+      "log4j.category.SecurityLogger": "${hbase.security.logger}",
+      "log4j.appender.console": "org.apache.log4j.ConsoleAppender",
+      "log4j.appender.console.target": "System.err",
+      "log4j.appender.console.layout": "org.apache.log4j.PatternLayout",
+      "log4j.appender.console.layout.ConversionPattern": "%d{ISO8601} %-5p [%t] %c{2}: %m%n",
+      "log4j.appender.RFAS": "org.apache.log4j.RollingFileAppender",
+      "log4j.appender.RFAS.layout": "org.apache.log4j.PatternLayout",
+      "log4j.appender.RFAS.layout.ConversionPattern": "%d{ISO8601} %p %c: %m%n",
+      "log4j.appender.RFAS.MaxFileSize": "${hbase.security.log.maxfilesize}",
+      "log4j.appender.RFAS.MaxBackupIndex": "${hbase.security.log.maxbackupindex}",
+      "log4j.appender.RFAS.File": "${hbase.log.dir}/${hbase.security.log.file}",
+      "log4j.appender.RFA": "org.apache.log4j.RollingFileAppender",
+      "log4j.appender.RFA.layout": "org.apache.log4j.PatternLayout",
+      "log4j.appender.RFA.layout.ConversionPattern": "%d{ISO8601} %-5p [%t] %c{2}: %m%n",
+      "log4j.appender.RFA.MaxFileSize": "${hbase.log.maxfilesize}",
+      "log4j.appender.RFA.MaxBackupIndex": "${hbase.log.maxbackupindex}",
+      "log4j.appender.RFA.File": "${hbase.log.dir}/${hbase.log.file}",
+      "log4j.appender.NullAppender": "org.apache.log4j.varia.NullAppender",
+      "log4j.appender.DRFA": "org.apache.log4j.DailyRollingFileAppender",
+      "log4j.appender.DRFA.layout": "org.apache.log4j.PatternLayout",
+      "log4j.appender.DRFA.layout.ConversionPattern": "%d{ISO8601} %-5p [%t] %c{2}: %m%n",
+      "log4j.appender.DRFA.File": "${hbase.log.dir}/${hbase.log.file}",
+      "log4j.appender.DRFA.DatePattern": ".yyyy-MM-dd",
+      "log4j.additivity.SecurityLogger": "false",
+      "hbase.security.logger": "INFO,console",
+      "hbase.security.log.maxfilesize": "256MB",
+      "hbase.security.log.maxbackupindex": "20",
+      "hbase.security.log.file": "SecurityAuth.audit",
+      "hbase.root.logger": "INFO,console",
+      "hbase.log.maxfilesize": "256MB",
+      "hbase.log.maxbackupindex": "20",
+      "hbase.log.file": "hbase.log",
+      "hbase.log.dir": "."
+    },
+    "global": {
+      "hbase_root": "/share/hbase/hbase-0.96.1-hadoop2",
+      "hbase_pid_dir": "/var/run/hbase",
+      "proxyuser_group": "users",
+      "syncLimit": "5",
+      "hbase_regionserver_heapsize": "1024m",
+      "rca_enabled": "false",
+      "tickTime": "2000",
+      "hbase_master_heapsize": "1024m",
+      "initLimit": "10",
+      "user_group": "hadoop",
+      "hbase_user": "hbase",
+      "hbase_log_dir": "/var/log/hbase"
+    },
+    "hdfs-site": {
+      "dfs.namenode.checkpoint.period": "21600",
+      "dfs.namenode.avoid.write.stale.datanode": "true",
+      "dfs.namenode.checkpoint.txns": "1000000",
+      "dfs.block.access.token.enable": "true",
+      "dfs.support.append": "true",
+      "dfs.datanode.address": "0.0.0.0:${ambari.dfs.datanode.port}",
+      "dfs.cluster.administrators": " hdfs",
+      "dfs.replication": "3",
+      "ambari.dfs.datanode.http.port": "50075",
+      "dfs.datanode.balance.bandwidthPerSec": "6250000",
+      "dfs.namenode.safemode.threshold-pct": "1.0f",
+      "dfs.namenode.checkpoint.edits.dir": "${dfs.namenode.checkpoint.dir}",
+      "dfs.permissions.enabled": "true",
+      "dfs.client.read.shortcircuit": "true",
+      "dfs.namenode.https-address": "c6402.ambari.apache.org:50470",
+      "dfs.journalnode.edits.dir": "/grid/0/hdfs/journal",
+      "dfs.blocksize": "134217728",
+      "dfs.datanode.max.transfer.threads": "1024",
+      "dfs.datanode.du.reserved": "1073741824",
+      "dfs.webhdfs.enabled": "true",
+      "dfs.namenode.handler.count": "100",
+      "dfs.namenode.checkpoint.dir": "/hadoop/hdfs/namesecondary",
+      "fs.permissions.umask-mode": "022",
+      "dfs.datanode.http.address": "0.0.0.0:${ambari.dfs.datanode.http.port}",
+      "dfs.datanode.ipc.address": "0.0.0.0:8010",
+      "dfs.datanode.data.dir": "/hadoop/hdfs/data",
+      "dfs.namenode.http-address": "c6402.ambari.apache.org:50070",
+      "dfs.blockreport.initialDelay": "120",
+      "dfs.datanode.failed.volumes.tolerated": "0",
+      "dfs.namenode.accesstime.precision": "0",
+      "ambari.dfs.datanode.port": "50010",
+      "dfs.namenode.avoid.read.stale.datanode": "true",
+      "dfs.namenode.secondary.http-address": "c6402.ambari.apache.org:50090",
+      "dfs.namenode.stale.datanode.interval": "30000",
+      "dfs.heartbeat.interval": "3",
+      "dfs.client.read.shortcircuit.streams.cache.size": "4096",
+      "dfs.permissions.superusergroup": "hdfs",
+      "dfs.https.port": "50470",
+      "dfs.journalnode.http-address": "0.0.0.0:8480",
+      "dfs.domain.socket.path": "/var/lib/hadoop-hdfs/dn_socket",
+      "dfs.namenode.write.stale.datanode.ratio": "1.0f",
+      "dfs.hosts.exclude": "/etc/hadoop/conf/dfs.exclude",
+      "dfs.datanode.data.dir.perm": "750",
+      "dfs.namenode.name.dir.restore": "true",
+      "dfs.replication.max": "50",
+      "dfs.namenode.name.dir": "/hadoop/hdfs/namenode"
+    },
+    "hbase-site": {
+      "hbase.hstore.flush.retries.number": "120",
+      "hbase.client.keyvalue.maxsize": "10485760",
+      "hbase.hstore.compactionThreshold": "3",
+      "hbase.rootdir": "hdfs://c6402.ambari.apache.org:8020/apps/hbase/data",
+      "hbase.stagingdir": "hdfs://c6402.ambari.apache.org:8020/apps/hbase/staging",
+      "hbase.regionserver.handler.count": "60",
+      "hbase.regionserver.global.memstore.lowerLimit": "0.38",
+      "hbase.hregion.memstore.block.multiplier": "2",
+      "hbase.hregion.memstore.flush.size": "134217728",
+      "hbase.superuser": "hbase",
+      "hbase.zookeeper.property.clientPort": "2181",
+      "hbase.regionserver.global.memstore.upperLimit": "0.4",
+      "zookeeper.session.timeout": "30000",
+      "hbase.tmp.dir": "/hadoop/hbase",
+      "hbase.hregion.max.filesize": "10737418240",
+      "hfile.block.cache.size": "0.40",
+      "hbase.security.authentication": "simple",
+      "hbase.defaults.for.version.skip": "true",
+      "hbase.zookeeper.quorum": "c6402.ambari.apache.org",
+      "zookeeper.znode.parent": "/hbase-unsecure",
+      "hbase.hstore.blockingStoreFiles": "10",
+      "hbase.hregion.majorcompaction": "86400000",
+      "hbase.security.authorization": "false",
+      "hbase.cluster.distributed": "true",
+      "hbase.hregion.memstore.mslab.enabled": "true",
+      "hbase.client.scanner.caching": "100",
+      "hbase.zookeeper.useMulti": "true",
+      "hbase.regionserver.info.port": "0",
+      "hbase.master.info.port": "60010"
+    },
+    "core-site": {
+      "io.serializations": "org.apache.hadoop.io.serializer.WritableSerialization",
+      "gluster.daemon.user": "null",
+      "fs.trash.interval": "360",
+      "hadoop.security.authentication": "simple",
+      "io.compression.codecs": "org.apache.hadoop.io.compress.GzipCodec,org.apache.hadoop.io.compress.DefaultCodec",
+      "mapreduce.jobtracker.webinterface.trusted": "false",
+      "fs.AbstractFileSystem.glusterfs.impl": "null",
+      "fs.defaultFS": "hdfs://c6402.ambari.apache.org:8020",
+      "ipc.client.connect.max.retries": "50",
+      "ipc.client.idlethreshold": "8000",
+      "io.file.buffer.size": "131072",
+      "hadoop.security.authorization": "false",
+      "hadoop.security.auth_to_local": "\n        RULE:[2:$1@$0]([rn]m@.*)s/.*/yarn/\n        RULE:[2:$1@$0](jhs@.*)s/.*/mapred/\n        RULE:[2:$1@$0]([nd]n@.*)s/.*/hdfs/\n        RULE:[2:$1@$0](hm@.*)s/.*/hbase/\n        RULE:[2:$1@$0](rs@.*)s/.*/hbase/\n        DEFAULT",
+      "ipc.client.connection.maxidletime": "30000"
+    }
+  },
+  "commandId": "2-2"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/940c087a/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/command_template.json
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/command_template.json b/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/command_template.json
new file mode 100644
index 0000000..da06c13
--- /dev/null
+++ b/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/command_template.json
@@ -0,0 +1,168 @@
+{
+  "roleCommand": "{{COMMAND}}",
+  "clusterName": "{{CLUSTER_NAME}}",
+  "hostname": "{{HOST_NAME}}",
+  "hostLevelParams": {
+    "java_home": "/usr/jdk64/jdk1.7.0_45"
+  },
+  "commandType": "EXECUTION_COMMAND",
+  "roleParams": {},
+  "serviceName": "{{SERVICE_NAME}}",
+  "role": "{{ROLE_NAME}}",
+  "commandParams": {},
+  "taskId": "{{TASK_ID}}",
+  "public_hostname": "{{HOST_NAME}}",
+  "configurations": {
+    "hbase-log4j": {
+      "log4j.threshold": "ALL",
+      "log4j.rootLogger": "${hbase.root.logger}",
+      "log4j.logger.org.apache.zookeeper": "INFO",
+      "log4j.logger.org.apache.hadoop.hbase": "DEBUG",
+      "log4j.logger.org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher": "INFO",
+      "log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil": "INFO",
+      "log4j.category.SecurityLogger": "${hbase.security.logger}",
+      "log4j.appender.console": "org.apache.log4j.ConsoleAppender",
+      "log4j.appender.console.target": "System.err",
+      "log4j.appender.console.layout": "org.apache.log4j.PatternLayout",
+      "log4j.appender.console.layout.ConversionPattern": "%d{ISO8601} %-5p [%t] %c{2}: %m%n",
+      "log4j.appender.RFAS": "org.apache.log4j.RollingFileAppender",
+      "log4j.appender.RFAS.layout": "org.apache.log4j.PatternLayout",
+      "log4j.appender.RFAS.layout.ConversionPattern": "%d{ISO8601} %p %c: %m%n",
+      "log4j.appender.RFAS.MaxFileSize": "${hbase.security.log.maxfilesize}",
+      "log4j.appender.RFAS.MaxBackupIndex": "${hbase.security.log.maxbackupindex}",
+      "log4j.appender.RFAS.File": "${hbase.log.dir}/${hbase.security.log.file}",
+      "log4j.appender.RFA": "org.apache.log4j.RollingFileAppender",
+      "log4j.appender.RFA.layout": "org.apache.log4j.PatternLayout",
+      "log4j.appender.RFA.layout.ConversionPattern": "%d{ISO8601} %-5p [%t] %c{2}: %m%n",
+      "log4j.appender.RFA.MaxFileSize": "${hbase.log.maxfilesize}",
+      "log4j.appender.RFA.MaxBackupIndex": "${hbase.log.maxbackupindex}",
+      "log4j.appender.RFA.File": "${hbase.log.dir}/${hbase.log.file}",
+      "log4j.appender.NullAppender": "org.apache.log4j.varia.NullAppender",
+      "log4j.appender.DRFA": "org.apache.log4j.DailyRollingFileAppender",
+      "log4j.appender.DRFA.layout": "org.apache.log4j.PatternLayout",
+      "log4j.appender.DRFA.layout.ConversionPattern": "%d{ISO8601} %-5p [%t] %c{2}: %m%n",
+      "log4j.appender.DRFA.File": "${hbase.log.dir}/${hbase.log.file}",
+      "log4j.appender.DRFA.DatePattern": ".yyyy-MM-dd",
+      "log4j.additivity.SecurityLogger": "false",
+      "hbase.security.logger": "INFO,console",
+      "hbase.security.log.maxfilesize": "256MB",
+      "hbase.security.log.maxbackupindex": "20",
+      "hbase.security.log.file": "SecurityAuth.audit",
+      "hbase.root.logger": "INFO,console",
+      "hbase.log.maxfilesize": "256MB",
+      "hbase.log.maxbackupindex": "20",
+      "hbase.log.file": "hbase.log",
+      "hbase.log.dir": "."
+    },
+    "global": {
+      "hbase_root": "{{HBASE_HOME}}",
+      "hbase_pid_dir": "{{PID_DIR}}",
+      "proxyuser_group": "users",
+      "syncLimit": "5",
+      "hbase_regionserver_heapsize": "{{REGION_SERVER_HEAP_SIZE}}",
+      "rca_enabled": "false",
+      "tickTime": "2000",
+      "hbase_master_heapsize": "{{MASTER_HEAP_SIZE}}",
+      "initLimit": "10",
+      "user_group": "{{GROUP_NAME}}",
+      "hbase_user": "{{USER_NAME}}",
+      "hbase_log_dir": "{{LOG_DIR}}"
+    },
+    "hdfs-site": {
+      "dfs.namenode.checkpoint.period": "21600",
+      "dfs.namenode.avoid.write.stale.datanode": "true",
+      "dfs.namenode.checkpoint.txns": "1000000",
+      "dfs.block.access.token.enable": "true",
+      "dfs.support.append": "true",
+      "dfs.datanode.address": "0.0.0.0:${ambari.dfs.datanode.port}",
+      "dfs.cluster.administrators": " hdfs",
+      "dfs.replication": "3",
+      "ambari.dfs.datanode.http.port": "50075",
+      "dfs.datanode.balance.bandwidthPerSec": "6250000",
+      "dfs.namenode.safemode.threshold-pct": "1.0f",
+      "dfs.namenode.checkpoint.edits.dir": "${dfs.namenode.checkpoint.dir}",
+      "dfs.permissions.enabled": "true",
+      "dfs.client.read.shortcircuit": "true",
+      "dfs.namenode.https-address": "{{NAMENODE_HTTPS_ADDRESS}}",
+      "dfs.journalnode.edits.dir": "/grid/0/hdfs/journal",
+      "dfs.blocksize": "134217728",
+      "dfs.datanode.max.transfer.threads": "1024",
+      "dfs.datanode.du.reserved": "1073741824",
+      "dfs.webhdfs.enabled": "true",
+      "dfs.namenode.handler.count": "100",
+      "dfs.namenode.checkpoint.dir": "/hadoop/hdfs/namesecondary",
+      "fs.permissions.umask-mode": "022",
+      "dfs.datanode.http.address": "0.0.0.0:${ambari.dfs.datanode.http.port}",
+      "dfs.datanode.ipc.address": "0.0.0.0:8010",
+      "dfs.datanode.data.dir": "/hadoop/hdfs/data",
+      "dfs.namenode.http-address": "{{NAMENODE_HTTP_ADDRESS}}",
+      "dfs.blockreport.initialDelay": "120",
+      "dfs.datanode.failed.volumes.tolerated": "0",
+      "dfs.namenode.accesstime.precision": "0",
+      "ambari.dfs.datanode.port": "50010",
+      "dfs.namenode.avoid.read.stale.datanode": "true",
+      "dfs.namenode.secondary.http-address": "c6402.ambari.apache.org:50090",
+      "dfs.namenode.stale.datanode.interval": "30000",
+      "dfs.heartbeat.interval": "3",
+      "dfs.client.read.shortcircuit.streams.cache.size": "4096",
+      "dfs.permissions.superusergroup": "hdfs",
+      "dfs.https.port": "50470",
+      "dfs.journalnode.http-address": "0.0.0.0:8480",
+      "dfs.domain.socket.path": "/var/lib/hadoop-hdfs/dn_socket",
+      "dfs.namenode.write.stale.datanode.ratio": "1.0f",
+      "dfs.hosts.exclude": "/etc/hadoop/conf/dfs.exclude",
+      "dfs.datanode.data.dir.perm": "750",
+      "dfs.namenode.name.dir.restore": "true",
+      "dfs.replication.max": "50",
+      "dfs.namenode.name.dir": "/hadoop/hdfs/namenode"
+    },
+    "hbase-site": {
+      "hbase.hstore.flush.retries.number": "120",
+      "hbase.client.keyvalue.maxsize": "10485760",
+      "hbase.hstore.compactionThreshold": "3",
+      "hbase.rootdir": "{{HBASE_ROOT_DIR}}",
+      "hbase.stagingdir": "{{HBASE_STAGING_DIR}}",
+      "hbase.regionserver.handler.count": "60",
+      "hbase.regionserver.global.memstore.lowerLimit": "0.38",
+      "hbase.hregion.memstore.block.multiplier": "2",
+      "hbase.hregion.memstore.flush.size": "134217728",
+      "hbase.superuser": "{{HBASE_SUPERUSER}}",
+      "hbase.zookeeper.property.clientPort": "{{ZK_CLIENT_PORT}}",
+      "hbase.regionserver.global.memstore.upperLimit": "0.4",
+      "zookeeper.session.timeout": "30000",
+      "hbase.tmp.dir": "/hadoop/hbase",
+      "hbase.hregion.max.filesize": "10737418240",
+      "hfile.block.cache.size": "0.40",
+      "hbase.security.authentication": "simple",
+      "hbase.defaults.for.version.skip": "true",
+      "hbase.zookeeper.quorum": "{{ZK_HOSTS}}",
+      "zookeeper.znode.parent": "{{ZK_NODE_PARENT}}",
+      "hbase.hstore.blockingStoreFiles": "10",
+      "hbase.hregion.majorcompaction": "86400000",
+      "hbase.security.authorization": "false",
+      "hbase.cluster.distributed": "true",
+      "hbase.hregion.memstore.mslab.enabled": "true",
+      "hbase.client.scanner.caching": "100",
+      "hbase.zookeeper.useMulti": "true",
+      "hbase.regionserver.info.port": "{{REGION_SERVER_INFO_PORT}}",
+      "hbase.master.info.port": "{{MASTER_INFO_PORT}}"
+    },
+    "core-site": {
+      "io.serializations": "org.apache.hadoop.io.serializer.WritableSerialization",
+      "gluster.daemon.user": "null",
+      "fs.trash.interval": "360",
+      "hadoop.security.authentication": "simple",
+      "io.compression.codecs": "org.apache.hadoop.io.compress.GzipCodec,org.apache.hadoop.io.compress.DefaultCodec",
+      "mapreduce.jobtracker.webinterface.trusted": "false",
+      "fs.AbstractFileSystem.glusterfs.impl": "null",
+      "fs.defaultFS": "{{DEFAULT_FS}}",
+      "ipc.client.connect.max.retries": "50",
+      "ipc.client.idlethreshold": "8000",
+      "io.file.buffer.size": "131072",
+      "hadoop.security.authorization": "false",
+      "hadoop.security.auth_to_local": "\n        RULE:[2:$1@$0]([rn]m@.*)s/.*/yarn/\n        RULE:[2:$1@$0](jhs@.*)s/.*/mapred/\n        RULE:[2:$1@$0]([nd]n@.*)s/.*/hdfs/\n        RULE:[2:$1@$0](hm@.*)s/.*/hbase/\n        RULE:[2:$1@$0](rs@.*)s/.*/hbase/\n        DEFAULT",
+      "ipc.client.connection.maxidletime": "30000"
+    }
+  },
+  "commandId": "{{COMMAND_ID}}"
+}
\ No newline at end of file


[14/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResouceContentCacheFactory.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResouceContentCacheFactory.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResouceContentCacheFactory.java
deleted file mode 100644
index 2facf16..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResouceContentCacheFactory.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.application;
-
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-import org.apache.slider.server.appmaster.web.rest.application.resources.AggregateModelRefresher;
-import org.apache.slider.server.appmaster.web.rest.application.resources.AppconfRefresher;
-import org.apache.slider.server.appmaster.web.rest.application.resources.CachedContent;
-import org.apache.slider.server.appmaster.web.rest.application.resources.ContentCache;
-import org.apache.slider.server.appmaster.web.rest.application.resources.LiveComponentsRefresher;
-import org.apache.slider.server.appmaster.web.rest.application.resources.LiveContainersRefresher;
-import org.apache.slider.server.appmaster.web.rest.application.resources.LiveNodesRefresher;
-import org.apache.slider.server.appmaster.web.rest.application.resources.LiveResourcesRefresher;
-import org.apache.slider.server.appmaster.web.rest.application.resources.LiveStatisticsRefresher;
-
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.*;
-
-public class ApplicationResouceContentCacheFactory {
-  public static final int LIFESPAN = 500;
-
-  /**
-   * Build the content cache
-   * @param state state view
-   */
-  public static ContentCache createContentCache(
-      StateAccessForProviders state) {
-    ContentCache cache = new ContentCache();
-    cache.put(LIVE_RESOURCES, new CachedContent<>(LIFESPAN, new LiveResourcesRefresher(state)));
-    cache.put(LIVE_CONTAINERS, new CachedContent<>(LIFESPAN, new LiveContainersRefresher(state)));
-    cache.put(LIVE_COMPONENTS, new CachedContent<>(LIFESPAN, new LiveComponentsRefresher(state)));
-    cache.put(LIVE_NODES, new CachedContent<>(LIFESPAN, new LiveNodesRefresher(state)));
-    cache.put(MODEL_DESIRED,
-        new CachedContent<>(LIFESPAN, new AggregateModelRefresher(state, false)));
-    cache.put(MODEL_RESOLVED,
-        new CachedContent<>(LIFESPAN, new AggregateModelRefresher(state, true)));
-    cache.put(MODEL_RESOLVED_APPCONF,
-        new CachedContent<>(LIFESPAN, new AppconfRefresher(state, false, false)));
-    cache.put(MODEL_RESOLVED_RESOURCES,
-        new CachedContent<>(LIFESPAN, new AppconfRefresher(state, false, true)));
-    cache.put(MODEL_DESIRED_APPCONF,
-        new CachedContent<>(LIFESPAN, new AppconfRefresher(state, true, false)));
-    cache.put(MODEL_DESIRED_RESOURCES,
-        new CachedContent<>(LIFESPAN, new AppconfRefresher(state, true, true)));
-    cache.put(LIVE_STATISTICS, new CachedContent<>(LIFESPAN, new LiveStatisticsRefresher(state)));
-    return cache;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java
deleted file mode 100644
index 52068d6..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.application;
-
-import com.google.common.collect.Lists;
-import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
-import org.apache.hadoop.yarn.webapp.BadRequestException;
-import org.apache.hadoop.yarn.webapp.NotFoundException;
-import org.apache.slider.api.types.ApplicationLivenessInformation;
-import org.apache.slider.api.types.ComponentInformation;
-import org.apache.slider.api.types.ContainerInformation;
-import org.apache.slider.api.types.NodeInformation;
-import org.apache.slider.api.types.NodeInformationList;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.exceptions.NoSuchNodeException;
-import org.apache.slider.core.persist.ConfTreeSerDeser;
-import org.apache.slider.server.appmaster.actions.ActionFlexCluster;
-import org.apache.slider.server.appmaster.actions.AsyncAction;
-import org.apache.slider.server.appmaster.actions.QueueAccess;
-import org.apache.slider.server.appmaster.state.RoleInstance;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-import org.apache.slider.server.appmaster.web.WebAppApi;
-import org.apache.slider.server.appmaster.web.rest.AbstractSliderResource;
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.*;
-
-import org.apache.slider.server.appmaster.web.rest.application.actions.RestActionStop;
-import org.apache.slider.server.appmaster.web.rest.application.actions.StopResponse;
-import org.apache.slider.server.appmaster.web.rest.application.resources.ContentCache;
-import org.apache.slider.server.appmaster.web.rest.application.actions.RestActionPing;
-import org.apache.slider.api.types.PingInformation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.inject.Singleton;
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Context;
-
-import static javax.ws.rs.core.MediaType.*;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-@Singleton
-@SuppressWarnings("unchecked")
-public class ApplicationResource extends AbstractSliderResource {
-  private static final Logger log =
-      LoggerFactory.getLogger(ApplicationResource.class);
-
-  public static final List<String> LIVE_ENTRIES = toJsonList("resources",
-      "containers",
-      "components",
-      "nodes",
-      "statistics",
-      "internal");
-
-  public static final List<String> ROOT_ENTRIES =
-      toJsonList("model", "live", "actions");
-
-  public static final List<String> MODEL_ENTRIES =
-      toJsonList("desired", "resolved");
-
-  /**
-   * This is the cache of all content ... each entry is
-   * designed to be self-refreshing on get operations, 
-   * so is never very out of date, yet many GETs don't
-   * overload the rest of the system.
-   */
-  private final ContentCache cache;
-  private final StateAccessForProviders state;
-  private final QueueAccess actionQueues;
-
-  public ApplicationResource(WebAppApi slider) {
-    super(slider);
-    state = slider.getAppState();
-    cache = slider.getContentCache();
-    actionQueues = slider.getQueues();
-  }
-
-  /**
-   * Build a new JSON-marshallable list of string elements
-   * @param elements elements
-   * @return something that can be returned
-   */
-  private static List<String> toJsonList(String... elements) {
-    return Lists.newArrayList(elements);
-  }
-
-  @GET
-  @Path("/")
-  @Produces({APPLICATION_JSON})
-  public List<String> getRoot() {
-    markGet(SLIDER_SUBPATH_APPLICATION);
-    return ROOT_ENTRIES;
-  }
-
-  /**
-   * Enum model values: desired and resolved
-   * @return the desired and resolved model
-   */
-  @GET
-  @Path(MODEL)
-  @Produces({APPLICATION_JSON})
-  public List<String> getModel() {
-    markGet(SLIDER_SUBPATH_APPLICATION, MODEL);
-    return MODEL_ENTRIES;
-  }
-
-  @GET
-  @Path(MODEL_DESIRED)
-  @Produces({APPLICATION_JSON})
-  public AggregateConf getModelDesired() {
-    markGet(SLIDER_SUBPATH_APPLICATION, MODEL_DESIRED);
-    return lookupAggregateConf(MODEL_DESIRED);
-  }
-  
-  @GET
-  @Path(MODEL_DESIRED_APPCONF)
-  @Produces({APPLICATION_JSON})
-  public ConfTree getModelDesiredAppconf() {
-    markGet(SLIDER_SUBPATH_APPLICATION, MODEL_DESIRED_APPCONF);
-    return lookupConfTree(MODEL_DESIRED_APPCONF);
-  }
-
-  @GET
-  @Path(MODEL_DESIRED_RESOURCES)
-  @Produces({APPLICATION_JSON})
-  public ConfTree getModelDesiredResources() {
-    markGet(SLIDER_SUBPATH_APPLICATION, MODEL_DESIRED_RESOURCES);
-    return lookupConfTree(MODEL_DESIRED_RESOURCES);
-  }
-
-/*
-  @PUT
-  @Path(MODEL_DESIRED_RESOURCES)
-//  @Consumes({APPLICATION_JSON, TEXT_PLAIN})
-  @Consumes({TEXT_PLAIN})
-  @Produces({APPLICATION_JSON})
-*/
-  public ConfTree setModelDesiredResources(
-      String json) {
-    markPut(SLIDER_SUBPATH_APPLICATION, MODEL_DESIRED_RESOURCES);
-    int size = json != null ? json.length() : 0;
-    log.info("PUT {} {} bytes:\n{}", MODEL_DESIRED_RESOURCES,
-        size,
-        json);
-    if (size == 0) {
-      log.warn("No JSON in PUT request; rejecting");
-      throw new BadRequestException("No JSON in PUT");
-    }
-    
-    try {
-      ConfTreeSerDeser serDeser = new ConfTreeSerDeser();
-      ConfTree updated = serDeser.fromJson(json);
-      queue(new ActionFlexCluster("flex",
-          1, TimeUnit.MILLISECONDS,
-          updated));
-      // return the updated value, even though it potentially hasn't yet
-      // been executed
-      return updated;
-    } catch (Exception e) {
-      throw buildException("PUT to "+ MODEL_DESIRED_RESOURCES , e);
-    }
-  }
-  @PUT
-  @Path(MODEL_DESIRED_RESOURCES)
-  @Consumes({APPLICATION_JSON})
-  @Produces({APPLICATION_JSON})
-  public ConfTree setModelDesiredResources(
-      ConfTree updated) {
-    try {
-      queue(new ActionFlexCluster("flex",
-          1, TimeUnit.MILLISECONDS,
-          updated));
-      // return the updated value, even though it potentially hasn't yet
-      // been executed
-      return updated;
-    } catch (Exception e) {
-      throw buildException("PUT to "+ MODEL_DESIRED_RESOURCES , e);
-    }
-  }
-  
-  
-
-  @GET
-  @Path(MODEL_RESOLVED)
-  @Produces({APPLICATION_JSON})
-  public AggregateConf getModelResolved() {
-    markGet(SLIDER_SUBPATH_APPLICATION, MODEL_RESOLVED);
-    return lookupAggregateConf(MODEL_RESOLVED);
-  }
-
-  @GET
-  @Path(MODEL_RESOLVED_APPCONF)
-  @Produces({APPLICATION_JSON})
-  public ConfTree getModelResolvedAppconf() {
-    markGet(SLIDER_SUBPATH_APPLICATION, MODEL_RESOLVED_APPCONF);
-    return lookupConfTree(MODEL_RESOLVED_APPCONF);
-  }
-
-  @GET
-  @Path(MODEL_RESOLVED_RESOURCES)
-  @Produces({APPLICATION_JSON})
-  public ConfTree getModelResolvedResources() {
-    markGet(SLIDER_SUBPATH_APPLICATION, MODEL_RESOLVED_RESOURCES);
-    return lookupConfTree(MODEL_RESOLVED_RESOURCES);
-  }
-  
-  @GET
-  @Path(LIVE)
-  @Produces({APPLICATION_JSON})
-  public List<String> getLive() {
-    markGet(SLIDER_SUBPATH_APPLICATION, LIVE);
-    return LIVE_ENTRIES;
-  }
-
-  @GET
-  @Path(LIVE_RESOURCES)
-  @Produces({APPLICATION_JSON})
-  public ConfTree getLiveResources() {
-    markGet(SLIDER_SUBPATH_APPLICATION, LIVE_RESOURCES);
-    return lookupConfTree(LIVE_RESOURCES);
-  }
-  
-  @GET
-  @Path(LIVE_CONTAINERS)
-  @Produces({APPLICATION_JSON})
-  public Map<String, ContainerInformation> getLiveContainers() {
-    markGet(SLIDER_SUBPATH_APPLICATION, LIVE_CONTAINERS);
-    try {
-      return (Map<String, ContainerInformation>)cache.lookup(
-          LIVE_CONTAINERS);
-    } catch (Exception e) {
-      throw buildException(LIVE_CONTAINERS, e);
-    }
-  }
-
-  @GET
-  @Path(LIVE_CONTAINERS + "/{containerId}")
-  @Produces({APPLICATION_JSON})
-  public ContainerInformation getLiveContainer(
-      @PathParam("containerId") String containerId) {
-    markGet(SLIDER_SUBPATH_APPLICATION, LIVE_CONTAINERS);
-    try {
-      RoleInstance id = state.getLiveInstanceByContainerID(containerId);
-      return id.serialize();
-    } catch (NoSuchNodeException e) {
-      throw new NotFoundException("Unknown container: " + containerId);
-    } catch (Exception e) {
-      throw buildException(LIVE_CONTAINERS + "/"+ containerId, e);
-    }
-  }
-
-  @GET
-  @Path(LIVE_COMPONENTS)
-  @Produces({APPLICATION_JSON})
-  public Map<String, ComponentInformation> getLiveComponents() {
-    markGet(SLIDER_SUBPATH_APPLICATION, LIVE_COMPONENTS);
-    try {
-      return (Map<String, ComponentInformation>) cache.lookup(LIVE_COMPONENTS);
-    } catch (Exception e) {
-      throw buildException(LIVE_COMPONENTS, e);
-    }
-  }
-  
-  @GET
-  @Path(LIVE_COMPONENTS + "/{component}")
-  @Produces({APPLICATION_JSON})
-  public ComponentInformation getLiveComponent(
-      @PathParam("component") String component) {
-    markGet(SLIDER_SUBPATH_APPLICATION, LIVE_COMPONENTS);
-    try {
-      return state.getComponentInformation(component);
-    } catch (YarnRuntimeException e) {
-      throw new NotFoundException("Unknown component: " + component);
-    } catch (Exception e) {
-      throw buildException(LIVE_CONTAINERS +"/" + component, e);
-    }
-  }
-
-  /**
-   * Liveness information for the application as a whole
-   * @return snapshot of liveness
-   */
-  @GET
-  @Path(LIVE_LIVENESS)
-  @Produces({APPLICATION_JSON})
-  public ApplicationLivenessInformation getLivenessInformation() {
-    markGet(SLIDER_SUBPATH_APPLICATION, LIVE_LIVENESS);
-    try {
-      return state.getApplicationLivenessInformation();
-    } catch (Exception e) {
-      throw buildException(LIVE_CONTAINERS, e);
-    }
-  }
-
-/*
-TODO: decide what structure to return here, then implement
-
-  @GET
-  @Path(LIVE_LIVENESS + "/{component}")
-  @Produces({APPLICATION_JSON})
-  public ApplicationLivenessInformation getLivenessForComponent(
-      @PathParam("component") String component) {
-    markGet(SLIDER_SUBPATH_APPLICATION, LIVE_COMPONENTS);
-    try {
-      RoleStatus roleStatus = state.lookupRoleStatus(component);
-      ApplicationLivenessInformation info = new ApplicationLivenessInformation();
-      info.requested = roleStatus.getRequested();
-      info.allRequestsSatisfied = info.requested == 0;
-      return info;
-    } catch (YarnRuntimeException e) {
-      throw new NotFoundException("Unknown component: " + component);
-    } catch (Exception e) {
-      throw buildException(LIVE_LIVENESS + "/" + component, e);
-    }
-  }
-*/
-
-
-  @GET
-  @Path(LIVE_NODES)
-  @Produces({APPLICATION_JSON})
-  public NodeInformationList getLiveNodes() {
-    markGet(SLIDER_SUBPATH_APPLICATION, LIVE_COMPONENTS);
-    try {
-      return (NodeInformationList) cache.lookup(LIVE_NODES);
-    } catch (Exception e) {
-      throw buildException(LIVE_COMPONENTS, e);
-    }
-  }
-
-  @GET
-  @Path(LIVE_NODES + "/{hostname}")
-  @Produces({APPLICATION_JSON})
-  public NodeInformation getLiveNode(@PathParam("hostname") String hostname) {
-    markGet(SLIDER_SUBPATH_APPLICATION, LIVE_COMPONENTS);
-    try {
-      NodeInformation ni = state.getNodeInformation(hostname);
-      if (ni != null) {
-        return ni;
-      } else {
-        throw new NotFoundException("Unknown node: " + hostname);
-      }
-    } catch (NotFoundException e) {
-      throw e;
-    } catch (Exception e) {
-      throw buildException(LIVE_COMPONENTS + "/" + hostname, e);
-    }
-  }
-
-  /**
-   * Statistics of the application
-   * @return snapshot statistics
-   */
-  @GET
-  @Path(LIVE_STATISTICS)
-  @Produces({APPLICATION_JSON})
-  public Map<String, Integer> getLiveStatistics() {
-    markGet(SLIDER_SUBPATH_APPLICATION, LIVE_LIVENESS);
-    try {
-      return (Map<String, Integer>) cache.lookup(LIVE_STATISTICS);
-    } catch (Exception e) {
-      throw buildException(LIVE_STATISTICS, e);
-    }
-  }
-
-  /**
-   * Helper method; look up an aggregate configuration in the cache from
-   * a key, or raise an exception
-   * @param key key to resolve
-   * @return the configuration
-   * @throws WebApplicationException on a failure
-   */
-  protected AggregateConf lookupAggregateConf(String key) {
-    try {
-      return (AggregateConf) cache.lookup(key);
-    } catch (Exception e) {
-      throw buildException(key, e);
-    }
-  }
-
-
-  /**
-   * Helper method; look up an conf tree in the cache from
-   * a key, or raise an exception
-   * @param key key to resolve
-   * @return the configuration
-   * @throws WebApplicationException on a failure
-   */
-  protected ConfTree lookupConfTree(String key) {
-    try {
-      return (ConfTree) cache.lookup(key);
-    } catch (Exception e) {
-      throw buildException(key, e);
-    }
-  }
-
-  /* ************************************************************************
-  
-  ACTION PING
-  
-  **************************************************************************/
-  
-  @GET
-  @Path(ACTION_PING)
-  @Produces({APPLICATION_JSON})
-  public PingInformation actionPingGet(@Context HttpServletRequest request,
-      @Context UriInfo uriInfo) {
-    markGet(SLIDER_SUBPATH_APPLICATION, ACTION_PING);
-    return new RestActionPing().ping(request, uriInfo, "");
-  }
-  
-  @POST
-  @Path(ACTION_PING)
-  @Produces({APPLICATION_JSON})
-  public PingInformation actionPingPost(@Context HttpServletRequest request,
-      @Context UriInfo uriInfo,
-      String body) {
-    markPost(SLIDER_SUBPATH_APPLICATION, ACTION_PING);
-    return new RestActionPing().ping(request, uriInfo, body);
-  }
-  
-  @PUT
-  @Path(ACTION_PING)
-  @Consumes({TEXT_PLAIN})
-  @Produces({APPLICATION_JSON})
-  public PingInformation actionPingPut(@Context HttpServletRequest request,
-      @Context UriInfo uriInfo,
-      String body) {
-    markPut(SLIDER_SUBPATH_APPLICATION, ACTION_PING);
-    return new RestActionPing().ping(request, uriInfo, body);
-  }
-  
-  @DELETE
-  @Path(ACTION_PING)
-  @Consumes({APPLICATION_JSON})
-  @Produces({APPLICATION_JSON})
-  public PingInformation actionPingDelete(@Context HttpServletRequest request,
-      @Context UriInfo uriInfo) {
-    markDelete(SLIDER_SUBPATH_APPLICATION, ACTION_PING);
-    return new RestActionPing().ping(request, uriInfo, "");
-  }
-  
-  @HEAD
-  @Path(ACTION_PING)
-  public Object actionPingHead(@Context HttpServletRequest request,
-      @Context UriInfo uriInfo) {
-    mark("HEAD", SLIDER_SUBPATH_APPLICATION, ACTION_PING);
-    return new RestActionPing().ping(request, uriInfo, "");
-  }
-  
-  /* ************************************************************************
-  
-  ACTION STOP
-  
-  **************************************************************************/
-
-
-  @POST
-  @Path(ACTION_STOP)
-  @Produces({APPLICATION_JSON})
-  public StopResponse actionStop(@Context HttpServletRequest request,
-      @Context UriInfo uriInfo,
-      String body) {
-    markPost(SLIDER_SUBPATH_APPLICATION, ACTION_STOP);
-    return new RestActionStop(slider).stop(request, uriInfo, body);
-  }
-
-  /**
-   * Schedule an action
-   * @param action for delayed execution
-   */
-  public void schedule(AsyncAction action) {
-    actionQueues.schedule(action);
-  }
-
-  /**
-   * Put an action on the immediate queue -to be executed when the queue
-   * reaches it.
-   * @param action action to queue
-   */
-  public void queue(AsyncAction action) {
-    actionQueues.put(action);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/RestActionPing.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/RestActionPing.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/RestActionPing.java
deleted file mode 100644
index 96b4f75..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/RestActionPing.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.application.actions;
-
-import org.apache.slider.api.types.PingInformation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.core.UriInfo;
-import java.util.Locale;
-
-public class RestActionPing {
-  private static final Logger log =
-      LoggerFactory.getLogger(RestActionPing.class);
-
-  public RestActionPing() {
-  }
-  
-  public PingInformation ping(HttpServletRequest request, UriInfo uriInfo, String body) {
-    String verb = request.getMethod();
-    log.info("Ping {}", verb);
-    PingInformation pingInformation = new PingInformation();
-    pingInformation.time = System.currentTimeMillis();
-    pingInformation.verb = verb;
-    pingInformation.body = body;
-    String text = 
-        String.format(Locale.ENGLISH,
-            "Ping verb %s received at %tc",
-            verb, pingInformation.time);
-    pingInformation.text = text;
-    return pingInformation;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/RestActionStop.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/RestActionStop.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/RestActionStop.java
deleted file mode 100644
index 544f589..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/RestActionStop.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.application.actions;
-
-import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
-import org.apache.slider.core.main.LauncherExitCodes;
-import org.apache.slider.server.appmaster.actions.ActionStopSlider;
-import org.apache.slider.server.appmaster.web.WebAppApi;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.core.UriInfo;
-import java.util.Locale;
-import java.util.concurrent.TimeUnit;
-
-public class RestActionStop {
-  private static final Logger log =
-      LoggerFactory.getLogger(RestActionStop.class);
-
-  private final WebAppApi slider;
-  
-  public RestActionStop(WebAppApi slider) {
-    this.slider = slider;
-  }
-  
-  public StopResponse stop(HttpServletRequest request, UriInfo uriInfo, String body) {
-    String verb = request.getMethod();
-    log.info("Ping {}", verb);
-    StopResponse response = new StopResponse();
-    response.verb = verb;
-    long time = System.currentTimeMillis();
-    String text = 
-        String.format(Locale.ENGLISH,
-            "Stopping action %s received at %tc",
-            verb, time);
-    response.text = text;
-    log.info(text);
-    ActionStopSlider stopSlider =
-        new ActionStopSlider(text,
-            1000,
-            TimeUnit.MILLISECONDS,
-            LauncherExitCodes.EXIT_SUCCESS,
-            FinalApplicationStatus.SUCCEEDED,
-            text);
-    log.info("SliderAppMasterApi.stopCluster: {}", stopSlider);
-    slider.getQueues().schedule(stopSlider);
-    
-    return response;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/StopResponse.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/StopResponse.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/StopResponse.java
deleted file mode 100644
index 9af6a22..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/actions/StopResponse.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.application.actions;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class StopResponse {
-  String verb;
-  public String text;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/package-info.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/package-info.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/package-info.java
deleted file mode 100644
index 34eb82c..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/**
- * This package contains resources related to the application
- * REST API
- */
-package org.apache.slider.server.appmaster.web.rest.application;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/AggregateModelRefresher.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/AggregateModelRefresher.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/AggregateModelRefresher.java
deleted file mode 100644
index ee28abf..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/AggregateModelRefresher.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.application.resources;
-
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-
-/**
- * Refresh the aggregate desired model via
- * {@link StateAccessForProviders#getInstanceDefinitionSnapshot()}
- */
-public class AggregateModelRefresher
-    implements ResourceRefresher<AggregateConf> {
-
-  private final StateAccessForProviders state;
-  private final boolean resolved;
-
-  public AggregateModelRefresher(StateAccessForProviders state,
-      boolean resolved) {
-    this.state = state;
-    this.resolved = resolved;
-  }
-
-  @Override
-  public AggregateConf refresh() throws Exception {
-    return
-        resolved ?
-          state.getInstanceDefinitionSnapshot()
-          : state.getUnresolvedInstanceDefinition();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/AppconfRefresher.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/AppconfRefresher.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/AppconfRefresher.java
deleted file mode 100644
index 06460cc..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/AppconfRefresher.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.application.resources;
-
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.persist.ConfTreeSerDeser;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-
-/**
- * refresher for resources and application configuration
- */
-public class AppconfRefresher
-    implements ResourceRefresher<ConfTree> {
-
-  private final StateAccessForProviders state;
-  private final boolean unresolved;
-  private final boolean resources;
-
-  public AppconfRefresher(StateAccessForProviders state,
-      boolean unresolved,
-      boolean resources) {
-    this.state = state;
-    this.unresolved = unresolved;
-    this.resources = resources;
-  }
-
-
-  @Override
-  public ConfTree refresh() throws Exception {
-    AggregateConf aggregateConf =
-        unresolved ?
-        state.getUnresolvedInstanceDefinition():
-        state.getInstanceDefinitionSnapshot();
-    ConfTree ct = resources ? aggregateConf.getResources() 
-                            : aggregateConf.getAppConf();
-    return new ConfTreeSerDeser().fromInstance(ct);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/CachedContent.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/CachedContent.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/CachedContent.java
deleted file mode 100644
index 22fd0fe..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/CachedContent.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.application.resources;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.util.Time;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A cached resource is one that can be stored and served up, with a refresh 
- * only taking place when the expiry happens.
- * 
- * The refresh check/refresh is synchronized.
- * @param <T> type to return
- */
-public class CachedContent<T> {
-  private static final Logger log =
-      LoggerFactory.getLogger(CachedContent.class);
-  private T cachedValue;
-  private long expires;
-  private final long lifespan;
-  private final ResourceRefresher<T> refresh;
-  private int refreshCounter;
-
-  public CachedContent(long lifespan,
-      ResourceRefresher<T> refresh) {
-    this.lifespan = lifespan;
-    this.refresh = refresh;
-  }
-
-  /**
-   * Get the value, triggering a refresh if needed
-   * @return the cached or latest value.
-   */
-  public T get() throws Exception {
-    maybeRefresh();
-    return getCachedValue();
-  }
-
-  /**
-   * Get the cached value without any expiry check
-   * @return the last value set. May be null.
-   */
-  public synchronized T getCachedValue() {
-    return cachedValue;
-  }
-
-  public synchronized int getRefreshCounter() {
-    return refreshCounter;
-  }
-
-  /**
-   * Get the lifespan in millis of the cached value
-   * @return the lifespan
-   */
-  public long getLifespan() {
-    return lifespan;
-  }
-
-  /**
-   * Maybe refresh the content
-   * @return true if a refresh took place.
-   */
-  public synchronized boolean maybeRefresh() throws Exception {
-    long now = now();
-    if (cachedValue == null || now >= expires) {
-      log.debug("Refreshing at time {}", now);
-      forceRefresh();
-      log.debug("Refreshed value now {}", cachedValue);
-      return true;
-    }
-    return false;
-  }
-
-  protected long now() {
-    return Time.monotonicNow();
-  }
-
-  /**
-   * Force a refresh and reset the expiry counter
-   * @return the new value
-   */
-  protected synchronized T forceRefresh() throws Exception {
-    refreshCounter ++;
-    T updated = refresh.refresh();
-    Preconditions.checkNotNull(updated);
-    cachedValue = updated;
-    expires = now() + lifespan;
-    return cachedValue;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("CachedContent{");
-    sb.append("  expires=").append(expires);
-    sb.append(", lifespan=").append(lifespan);
-    sb.append(", refresh=").append(refresh);
-    sb.append(", refreshCounter=").append(refreshCounter);
-    sb.append(", cached=").append(cachedValue);
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ContentCache.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ContentCache.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ContentCache.java
deleted file mode 100644
index 8f026a1..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ContentCache.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.application.resources;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Cache of content
- */
-public class ContentCache extends ConcurrentHashMap<String, CachedContent> {
-
-  public ContentCache(int initialCapacity) {
-    super(initialCapacity);
-  }
-
-  public ContentCache() {
-  }
-
-
-  public Object lookup(String key) throws Exception {
-    CachedContent content = get(key);
-    if (content == null) {
-      throw new FileNotFoundException("no content for path " + key);
-    }
-    return content.get();
-  }
-
-
-  /**
-   * Lookup a cached item. If an exception is raised on the refresh...
-   * <ol>
-   *   <li>IOExceptions are thrown directly</li>
-   *   <li>Other exceptions are wrapped with an IOExceptions</li>
-   * </ol>
-   * @param key
-   * @return
-   * @throws IOException
-   */
-  public Object lookupWithIOE(String key) throws IOException {
-    try {
-      return lookup(key);
-    } catch (IOException e) {
-      throw e;
-    } catch (Exception e) {
-      throw new IOException("Looking up " + key + ": " + e, e);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveComponentsRefresher.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveComponentsRefresher.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveComponentsRefresher.java
deleted file mode 100644
index b6627a7..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveComponentsRefresher.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.application.resources;
-
-import org.apache.slider.api.types.ComponentInformation;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-
-import java.util.Map;
-
-public class LiveComponentsRefresher
-    implements ResourceRefresher<Map<String, ComponentInformation>> {
-
-  private final StateAccessForProviders state;
-
-  public LiveComponentsRefresher(StateAccessForProviders state) {
-    this.state = state;
-  }
-
-  @Override
-  public Map<String, ComponentInformation> refresh() {
-    return state.getComponentInfoSnapshot();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveContainersRefresher.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveContainersRefresher.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveContainersRefresher.java
deleted file mode 100644
index 68bd8a2..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveContainersRefresher.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.application.resources;
-
-import org.apache.slider.api.types.ContainerInformation;
-import org.apache.slider.server.appmaster.state.RoleInstance;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Refresh the container list.
- */
-public class LiveContainersRefresher implements ResourceRefresher<Map<String, ContainerInformation>> {
-
-  private final StateAccessForProviders state;
-
-  public LiveContainersRefresher(StateAccessForProviders state) {
-    this.state = state;
-  }
-
-  @Override
-  public Map<String, ContainerInformation> refresh() throws
-      Exception {
-    List<RoleInstance> containerList = state.cloneOwnedContainerList();
-
-    Map<String, ContainerInformation> map = new HashMap<>();
-    for (RoleInstance instance : containerList) {
-      ContainerInformation serialized = instance.serialize();
-      map.put(serialized.containerId, serialized);
-    }
-    return map;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveNodesRefresher.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveNodesRefresher.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveNodesRefresher.java
deleted file mode 100644
index aeb7a11..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveNodesRefresher.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.application.resources;
-
-import org.apache.slider.api.types.NodeInformationList;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-
-/**
- * Update the live nodes map
- */
-public class LiveNodesRefresher
-    implements ResourceRefresher<NodeInformationList> {
-
-  private final StateAccessForProviders state;
-
-  public LiveNodesRefresher(StateAccessForProviders state) {
-    this.state = state;
-  }
-
-  @Override
-  public NodeInformationList refresh() {
-
-    return new NodeInformationList(state.getNodeInformationSnapshot().values());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveResourcesRefresher.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveResourcesRefresher.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveResourcesRefresher.java
deleted file mode 100644
index f988297..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveResourcesRefresher.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.application.resources;
-
-import org.apache.slider.api.StatusKeys;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.server.appmaster.state.RoleStatus;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-
-import java.util.Map;
-
-public class LiveResourcesRefresher implements ResourceRefresher<ConfTree> {
-
-  private final StateAccessForProviders state;
-
-  public LiveResourcesRefresher(StateAccessForProviders state) {
-    this.state = state;
-  }
-
-  @Override
-  public ConfTree refresh() throws Exception {
-
-    // snapshot resources
-    ConfTreeOperations resources = state.getResourcesSnapshot();
-    // then add actual values
-    Map<Integer, RoleStatus> roleStatusMap = state.getRoleStatusMap();
-    
-    for (RoleStatus status : roleStatusMap.values()) {
-      String name = status.getName();
-      resources.setComponentOpt(name,
-          StatusKeys.COMPONENT_INSTANCES_REQUESTING,
-          status.getRequested());
-      resources.setComponentOpt(name,
-          StatusKeys.COMPONENT_INSTANCES_ACTUAL,
-          status.getActual());
-      resources.setComponentOpt(name,
-          StatusKeys.COMPONENT_INSTANCES_RELEASING,
-          status.getReleasing());
-      resources.setComponentOpt(name,
-          StatusKeys.COMPONENT_INSTANCES_FAILED,
-          status.getFailed());
-      resources.setComponentOpt(name,
-          StatusKeys.COMPONENT_INSTANCES_COMPLETED,
-          status.getCompleted());
-      resources.setComponentOpt(name,
-          StatusKeys.COMPONENT_INSTANCES_STARTED,
-          status.getStarted());
-    }
-    return resources.getConfTree();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveStatisticsRefresher.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveStatisticsRefresher.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveStatisticsRefresher.java
deleted file mode 100644
index d31b455..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveStatisticsRefresher.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.application.resources;
-
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-
-import java.util.Map;
-
-public class LiveStatisticsRefresher implements ResourceRefresher<Map<String,Integer>> {
-
-  private final StateAccessForProviders state;
-
-  public LiveStatisticsRefresher(StateAccessForProviders state) {
-    this.state = state;
-  }
-
-  @Override
-  public Map<String, Integer> refresh() throws Exception {
-
-    // snapshot resources
-    return state.getLiveStatistics();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ResourceRefresher.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ResourceRefresher.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ResourceRefresher.java
deleted file mode 100644
index 35f0367..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ResourceRefresher.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.application.resources;
-
-/**
- * Interface which must be implemented to act as a source for cached content.
- * @param <T> type to return
- */
-public interface ResourceRefresher<T> {
-  /**
-   * Build an up to date version of the data
-   * @return a new instance of the (JSON serializable) data
-   */
-  T refresh() throws Exception;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ResourceSnapshotRefresher.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ResourceSnapshotRefresher.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ResourceSnapshotRefresher.java
deleted file mode 100644
index c16912a..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/ResourceSnapshotRefresher.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.application.resources;
-
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-
-public class ResourceSnapshotRefresher implements ResourceRefresher<ConfTree> {
-
-  private final StateAccessForProviders state;
-
-  public ResourceSnapshotRefresher(StateAccessForProviders state) {
-    this.state = state;
-  }
-
-  @Override
-  public ConfTree refresh() throws Exception {
-
-    // snapshot resources
-    ConfTreeOperations resources = state.getResourcesSnapshot();
-      return resources.getConfTree();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/ManagementResource.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/ManagementResource.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/ManagementResource.java
deleted file mode 100644
index f27711a..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/ManagementResource.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.management;
-
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.server.appmaster.web.WebAppApi;
-import org.apache.slider.server.appmaster.web.rest.AbstractSliderResource;
-import org.apache.slider.server.appmaster.web.rest.RestPaths;
-import org.apache.slider.server.appmaster.web.rest.management.resources.AggregateConfResource;
-import org.apache.slider.server.appmaster.web.rest.management.resources.ConfTreeResource;
-import org.apache.slider.server.appmaster.web.rest.management.resources.ResourceFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-import java.net.URI;
-import java.net.URL;
-
-/**
- *
- */
-public class ManagementResource extends AbstractSliderResource {
-  protected static final Logger log =
-      LoggerFactory.getLogger(ManagementResource.class);
-  public static final String CONFIG = "config";
-  public static final String APP_UNDER_MANAGEMENT = "/app";
-
-  public ManagementResource(WebAppApi slider) {
-    super(slider);
-  }
-
-  private void init(HttpServletResponse res) {
-    res.setContentType(null);
-  }
-
-  @GET
-  public Response getWadl (@Context HttpServletRequest request) {
-    return redirectToAppWadl(request);
-  }
-
-  @GET
-  @Path("/app")
-  @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
-  public AggregateConfResource getAggregateConfiguration(@Context UriInfo uriInfo,
-                                                         @Context HttpServletResponse res) {
-    init(res);
-    return ResourceFactory.createAggregateConfResource(getAggregateConf(),
-                                                       uriInfo.getAbsolutePathBuilder());
-  }
-
-  @GET
-  @Path(APP_UNDER_MANAGEMENT+"/configurations/{config}")
-  @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
-  public ConfTreeResource getConfTreeResource(@PathParam(CONFIG) String config,
-                                              @Context UriInfo uriInfo,
-                                              @Context HttpServletResponse res) {
-    init(res);
-    AggregateConfResource aggregateConf =
-        ResourceFactory.createAggregateConfResource(getAggregateConf(),
-      uriInfo.getBaseUriBuilder()
-      .path(RestPaths.SLIDER_CONTEXT_ROOT)
-      .path(RestPaths.MANAGEMENT + APP_UNDER_MANAGEMENT));
-    return aggregateConf.getConfTree(config);
-  }
-
-  protected AggregateConf getAggregateConf() {
-    return slider.getAppState().getInstanceDefinitionSnapshot();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/ActionsResource.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/ActionsResource.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/ActionsResource.java
deleted file mode 100644
index 9b340fa..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/ActionsResource.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.management.resources;
-
-public class ActionsResource {
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/AggregateConfResource.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/AggregateConfResource.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/AggregateConfResource.java
deleted file mode 100644
index 794daf9..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/AggregateConfResource.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.management.resources;
-
-import org.apache.slider.core.conf.AggregateConf;
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import javax.ws.rs.core.UriBuilder;
-import java.util.HashMap;
-import java.util.Map;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class AggregateConfResource {
-  private String href;
-  private final ConfTreeResource resources;
-  private final ConfTreeResource internal;
-  private final ConfTreeResource appConf;
-  @JsonIgnore
-  private Map<String, ConfTreeResource> confMap;
-
-  public AggregateConfResource(AggregateConf conf, UriBuilder uriBuilder) {
-    if (uriBuilder != null) {
-      this.href = uriBuilder.build().toASCIIString();
-      resources = ResourceFactory.createConfTreeResource(conf.getResources(),
-                   uriBuilder.clone().path("configurations").path("resources"));
-      internal = ResourceFactory.createConfTreeResource(conf.getInternal(),
-                   uriBuilder.clone().path("configurations").path("internal"));
-      appConf = ResourceFactory.createConfTreeResource(conf.getAppConf(),
-                   uriBuilder.clone().path("configurations").path("appConf"));
-      initConfMap();
-    } else {
-      resources = null;
-      internal = null;
-      appConf = null;
-    }
-  }
-
-  private void initConfMap() {
-    confMap = new HashMap<>();
-    confMap.put("internal", internal);
-    confMap.put("resources", resources);
-    confMap.put("appConf", appConf);
-  }
-
-  public AggregateConfResource() {
-    this(null, null);
-  }
-
-  public ConfTreeResource getConfTree(String name) {
-    return confMap.get(name);
-  }
-
-  public String getHref() {
-    return href;
-  }
-
-  public void setHref(String href) {
-    this.href = href;
-  }
-
-  public ConfTreeResource getResources() {
-    return resources;
-  }
-
-  public ConfTreeResource getInternal() {
-    return internal;
-  }
-
-  public ConfTreeResource getAppConf() {
-    return appConf;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/ComponentResource.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/ComponentResource.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/ComponentResource.java
deleted file mode 100644
index a44448e..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/ComponentResource.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.management.resources;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import javax.ws.rs.core.UriBuilder;
-import java.util.Map;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class ComponentResource {
-  private final Map<String, String> props;
-  private String href;
-
-  public ComponentResource() {
-    this(null, null, null, null);
-  }
-
-  public ComponentResource(String name,
-                           Map<String, String> props,
-                           UriBuilder uriBuilder,
-                           Map<String, Object> pathElems) {
-    this.props = props;
-  }
-
-  public Map<String, String> getProps() {
-    return props;
-  }
-
-  public String getHref() {
-    return href;
-  }
-
-  public void setHref(String href) {
-    this.href = href;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/ConfTreeResource.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/ConfTreeResource.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/ConfTreeResource.java
deleted file mode 100644
index 407bab6..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/ConfTreeResource.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.management.resources;
-
-import org.apache.slider.core.conf.ConfTree;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import javax.ws.rs.core.UriBuilder;
-import java.util.Map;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class ConfTreeResource {
-
-  private final String href;
-  private final Map<String, Object> metadata;
-  private final Map<String, String> global;
-  private final Map<String, Map<String, String>> components;
-
-  public ConfTreeResource() {
-    this(null, null);
-  }
-
-  public ConfTreeResource(ConfTree confTree,
-                          UriBuilder uriBuilder) {
-    if (uriBuilder != null && confTree != null) {
-      metadata = confTree.metadata;
-      global = confTree.global;
-      components = confTree.components;
-      this.href = uriBuilder.build().toASCIIString();
-    } else {
-      this.href = null;
-      this.metadata = null;
-      this.global = null;
-      this.components = null;
-    }
-  }
-
-  public Map<String, Object> getMetadata() {
-    return metadata;
-  }
-
-  public Map<String, String> getGlobal() {
-    return global;
-  }
-
-  public Map<String, Map<String, String>> getComponents() {
-    return components;
-  }
-
-  public String getHref() {
-    return href;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/ResourceFactory.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/ResourceFactory.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/ResourceFactory.java
deleted file mode 100644
index 9876412..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/management/resources/ResourceFactory.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.server.appmaster.web.rest.management.resources;
-
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import javax.ws.rs.core.UriBuilder;
-import java.util.Map;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class ResourceFactory {
-
-  public static AggregateConfResource createAggregateConfResource(AggregateConf conf,
-                                                                  UriBuilder uriBuilder) {
-    return new AggregateConfResource(conf, uriBuilder);
-  }
-
-  public static ConfTreeResource createConfTreeResource(ConfTree confTree,
-                                                        UriBuilder uriBuilder) {
-    return new ConfTreeResource(confTree, uriBuilder);
-  }
-
-  public static ComponentResource createComponentResource(String name,
-                                                          Map<String, String> props,
-                                                          UriBuilder uriBuilder,
-                                                          Map<String, Object> pathElems) {
-    return new ComponentResource(name, props, uriBuilder, pathElems);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java
deleted file mode 100644
index c727581..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/publisher/PublisherResource.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.web.rest.publisher;
-
-import org.apache.hadoop.yarn.webapp.NotFoundException;
-import org.apache.slider.core.registry.docstore.ConfigFormat;
-import org.apache.slider.core.registry.docstore.PublishedConfigSet;
-import org.apache.slider.core.registry.docstore.PublishedConfiguration;
-import org.apache.slider.core.registry.docstore.PublishedConfigurationOutputter;
-import org.apache.slider.core.registry.docstore.PublishedExports;
-import org.apache.slider.core.registry.docstore.PublishedExportsSet;
-import org.apache.slider.core.registry.docstore.UriMap;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-import org.apache.slider.server.appmaster.web.WebAppApi;
-import org.apache.slider.server.appmaster.web.rest.AbstractSliderResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import static  org.apache.slider.server.appmaster.web.rest.RestPaths.*;
-
-/**
- * This publishes configuration sets
- */
-public class PublisherResource extends AbstractSliderResource {
-  protected static final Logger log =
-      LoggerFactory.getLogger(PublisherResource.class);
-  public static final String EXPORTS_NAME = "exports";
-  public static final String EXPORTS_RESOURCES_PATH = "/" + EXPORTS_NAME;
-  public static final String EXPORT_RESOURCE_PATH = EXPORTS_RESOURCES_PATH + "/{exportname}" ;
-  public static final String SET_NAME =
-      "{setname: " + PUBLISHED_CONFIGURATION_SET_REGEXP + "}";
-  public static final String SETNAME = "setname";
-  public static final String CLASSPATH = "/classpath";
-  public static final String CONFIG = "config";
-  
-  public static final String SETNAME_PATTERN = 
-      "{"+ SETNAME+": " + PUBLISHED_CONFIGURATION_SET_REGEXP + "}";
-  private static final String CONFIG_PATTERN =
-      SETNAME_PATTERN + "/{"+ CONFIG +": " + PUBLISHED_CONFIGURATION_REGEXP + "}";
-  private final StateAccessForProviders appState;
-
-  public PublisherResource(WebAppApi slider) {
-    super(slider);
-    appState = slider.getAppState();
-  }
-
-  private void init(HttpServletResponse res, UriInfo uriInfo) {
-    res.setContentType(null);
-    log.debug(uriInfo.getRequestUri().toString());
-  }
- 
-  /**
-   * Get a named config set 
-   * @param setname name of the config set
-   * @return the config set
-   * @throws NotFoundException if there was no matching set
-   */
-  private PublishedConfigSet getConfigSet(String setname) {
-    PublishedConfigSet configSet =
-        appState.getPublishedConfigSet(setname);
-    if (configSet == null) {
-      throw new NotFoundException("Not found: " + setname);
-    }
-    return configSet;
-  }
-
-  @GET
-  @Path("/")
-  @Produces({MediaType.APPLICATION_JSON})
-  public UriMap enumConfigSets(
-      @Context UriInfo uriInfo,
-      @Context HttpServletResponse res) {
-    init(res, uriInfo);
-    String baseURL = uriInfo.getRequestUri().toString();
-    if (!baseURL.endsWith("/")) {
-      baseURL += "/";
-    }
-    UriMap uriMap = new UriMap();
-    for (String name : appState.listConfigSets()) {
-      uriMap.put(name, baseURL + name);
-      log.info("registering config set {} at {}", name, baseURL);
-    }
-    uriMap.put(EXPORTS_NAME, baseURL + EXPORTS_NAME);
-    return uriMap;
-  }
-
-  @GET
-  @Path(CLASSPATH)
-  @Produces({MediaType.APPLICATION_JSON})
-  public Set<URL> getAMClassPath() {
-    URL[] urls = ((URLClassLoader) getClass().getClassLoader()).getURLs();
-    return new LinkedHashSet<URL>(Arrays.asList(urls));
-  }
-
-  @GET
-  @Path(EXPORTS_RESOURCES_PATH)
-  @Produces({MediaType.APPLICATION_JSON})
-  public PublishedExportsSet gePublishedExports() {
-
-    return appState.getPublishedExportsSet();
-  }
-
-  @GET
-  @Path(EXPORT_RESOURCE_PATH)
-  @Produces({MediaType.APPLICATION_JSON})
-  public PublishedExports getAMExports2(@PathParam("exportname") String exportname,
-                              @Context UriInfo uriInfo,
-                              @Context HttpServletResponse res) {
-    init(res, uriInfo);
-    PublishedExportsSet set = appState.getPublishedExportsSet();
-    return set.get(exportname);
-  }
-
-  @GET
-  @Path("/"+ SETNAME_PATTERN)
-  @Produces({MediaType.APPLICATION_JSON})
-  public PublishedConfigSet getPublishedConfiguration(
-      @PathParam(SETNAME) String setname,
-      @Context UriInfo uriInfo,
-      @Context HttpServletResponse res) {
-    init(res, uriInfo);
-
-    logRequest(uriInfo);
-    PublishedConfigSet publishedConfigSet = getConfigSet(setname);
-    log.debug("Number of configurations: {}", publishedConfigSet.size());
-    return publishedConfigSet.shallowCopy();
-  }
-
-  private void logRequest(UriInfo uriInfo) {
-    log.info(uriInfo.getRequestUri().toString());
-  }
-
-  @GET
-  @Path("/" + CONFIG_PATTERN)
-  @Produces({MediaType.APPLICATION_JSON})
-  public PublishedConfiguration getConfigurationInstance(
-      @PathParam(SETNAME) String setname,
-      @PathParam(CONFIG) String config,
-      @Context UriInfo uriInfo,
-      @Context HttpServletResponse res) {
-    init(res, uriInfo);
-
-    PublishedConfiguration publishedConfig =
-        getPublishedConfiguration(setname, config);
-    if (publishedConfig == null) {
-      log.info("Configuration {} not found", config);
-      throw new NotFoundException("Not found: " + uriInfo.getAbsolutePath());
-    }
-    return publishedConfig;
-  }
-
-  /**
-   * Get a configuration
-   * @param setname name of the config set
-   * @param config config
-   * @return null if there was a config, but not a set
-   * @throws NotFoundException if there was no matching set
-   */
-  public PublishedConfiguration getPublishedConfiguration(String setname,
-      String config) {
-    return getConfigSet(setname).get(config);
-  }
-
-  @GET
-  @Path("/" + CONFIG_PATTERN + ".json")
-  @Produces({MediaType.APPLICATION_JSON})
-  public String getConfigurationContentJson(
-      @PathParam(SETNAME) String setname,
-
-      @PathParam(CONFIG) String config,
-      @Context UriInfo uriInfo,
-      @Context HttpServletResponse res) throws IOException {
-    return getStringRepresentation(setname, config, uriInfo, res,
-        ConfigFormat.JSON);
-  }
-
-  @GET
-  @Path("/" + CONFIG_PATTERN + ".xml")
-  @Produces({MediaType.APPLICATION_XML})
-  public String getConfigurationContentXML(
-      @PathParam(SETNAME) String setname,
-      @PathParam(CONFIG) String config,
-      @Context UriInfo uriInfo,
-      @Context HttpServletResponse res) throws IOException {
-    return getStringRepresentation(setname, config, uriInfo, res,
-        ConfigFormat.XML);
-  }
-  
-  @GET
-  @Path("/" + CONFIG_PATTERN + ".properties")
-  @Produces({MediaType.APPLICATION_XML})
-  public String getConfigurationContentProperties(
-      @PathParam(SETNAME) String setname,
-
-      @PathParam(CONFIG) String config,
-      @Context UriInfo uriInfo,
-      @Context HttpServletResponse res) throws IOException {
-
-    return getStringRepresentation(setname, config, uriInfo, res,
-        ConfigFormat.PROPERTIES);
-  }
-
-  public String getStringRepresentation(String setname,
-      String config,
-      UriInfo uriInfo,
-      HttpServletResponse res, ConfigFormat format) throws IOException {
-    // delegate (including init)
-    PublishedConfiguration publishedConfig =
-        getConfigurationInstance(setname, config, uriInfo, res);
-    PublishedConfigurationOutputter outputter =
-        publishedConfig.createOutputter(format);
-    return outputter.asString();
-  }
-
-  @GET
-  @Path("/" + CONFIG_PATTERN +"/{propertyName}")
-  @Produces({MediaType.APPLICATION_JSON})
-  public Map<String,String> getConfigurationProperty(
-      @PathParam(SETNAME) String setname,
-      @PathParam(CONFIG) String config,
-      @PathParam("propertyName") String propertyName,
-      @Context UriInfo uriInfo,
-      @Context HttpServletResponse res) {
-    PublishedConfiguration publishedConfig =
-        getConfigurationInstance(setname, config, uriInfo, res);
-    String propVal = publishedConfig.entries.get(propertyName);
-    if (propVal == null) {
-      log.debug("Configuration property {} not found in configuration {}",
-          propertyName, config);
-      throw new NotFoundException("Property not found: " + propertyName);
-    }
-    Map<String, String> rtnVal = new HashMap<>();
-    rtnVal.put(propertyName, propVal);
-
-    return rtnVal;
-  }
-  
-}


[27/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
deleted file mode 100644
index 7594d51..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java
+++ /dev/null
@@ -1,3320 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers.agent;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FSDataOutputStream;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.permission.FsAction;
-import org.apache.hadoop.fs.permission.FsPermission;
-import org.apache.hadoop.io.IOUtils;
-import org.apache.hadoop.registry.client.binding.RegistryPathUtils;
-import org.apache.hadoop.registry.client.types.Endpoint;
-import org.apache.hadoop.registry.client.types.ProtocolTypes;
-import org.apache.hadoop.registry.client.types.ServiceRecord;
-import org.apache.hadoop.registry.client.types.yarn.PersistencePolicies;
-import org.apache.hadoop.registry.client.types.yarn.YarnRegistryAttributes;
-import org.apache.hadoop.util.StringUtils;
-import org.apache.hadoop.yarn.api.ApplicationConstants;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.api.records.LocalResource;
-import org.apache.hadoop.yarn.api.records.LocalResourceType;
-import org.apache.slider.api.ClusterDescription;
-import org.apache.slider.api.ClusterNode;
-import org.apache.slider.api.InternalKeys;
-import org.apache.slider.api.OptionKeys;
-import org.apache.slider.api.ResourceKeys;
-import org.apache.slider.api.StatusKeys;
-import org.apache.slider.common.SliderExitCodes;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.SliderXmlConfKeys;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.exceptions.NoSuchNodeException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.launch.CommandLineBuilder;
-import org.apache.slider.core.launch.ContainerLauncher;
-import org.apache.slider.core.registry.docstore.ConfigFormat;
-import org.apache.slider.core.registry.docstore.ConfigUtils;
-import org.apache.slider.core.registry.docstore.ExportEntry;
-import org.apache.slider.core.registry.docstore.PublishedConfiguration;
-import org.apache.slider.core.registry.docstore.PublishedConfigurationOutputter;
-import org.apache.slider.core.registry.docstore.PublishedExports;
-import org.apache.slider.core.registry.info.CustomRegistryConstants;
-import org.apache.slider.providers.AbstractProviderService;
-import org.apache.slider.providers.MonitorDetail;
-import org.apache.slider.providers.ProviderCore;
-import org.apache.slider.providers.ProviderRole;
-import org.apache.slider.providers.ProviderUtils;
-import org.apache.slider.providers.agent.application.metadata.AbstractComponent;
-import org.apache.slider.providers.agent.application.metadata.Application;
-import org.apache.slider.providers.agent.application.metadata.CommandOrder;
-import org.apache.slider.providers.agent.application.metadata.CommandScript;
-import org.apache.slider.providers.agent.application.metadata.Component;
-import org.apache.slider.providers.agent.application.metadata.ComponentCommand;
-import org.apache.slider.providers.agent.application.metadata.ComponentExport;
-import org.apache.slider.providers.agent.application.metadata.ComponentsInAddonPackage;
-import org.apache.slider.providers.agent.application.metadata.ConfigFile;
-import org.apache.slider.providers.agent.application.metadata.DefaultConfig;
-import org.apache.slider.providers.agent.application.metadata.DockerContainer;
-import org.apache.slider.providers.agent.application.metadata.Export;
-import org.apache.slider.providers.agent.application.metadata.ExportGroup;
-import org.apache.slider.providers.agent.application.metadata.Metainfo;
-import org.apache.slider.providers.agent.application.metadata.OSPackage;
-import org.apache.slider.providers.agent.application.metadata.OSSpecific;
-import org.apache.slider.providers.agent.application.metadata.Package;
-import org.apache.slider.providers.agent.application.metadata.PropertyInfo;
-import org.apache.slider.server.appmaster.actions.ProviderReportedContainerLoss;
-import org.apache.slider.server.appmaster.actions.RegisterComponentInstance;
-import org.apache.slider.server.appmaster.state.ContainerPriority;
-import org.apache.slider.server.appmaster.state.RoleInstance;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-import org.apache.slider.server.appmaster.web.rest.agent.AgentCommandType;
-import org.apache.slider.server.appmaster.web.rest.agent.AgentRestOperations;
-import org.apache.slider.server.appmaster.web.rest.agent.CommandReport;
-import org.apache.slider.server.appmaster.web.rest.agent.ComponentStatus;
-import org.apache.slider.server.appmaster.web.rest.agent.ExecutionCommand;
-import org.apache.slider.server.appmaster.web.rest.agent.HeartBeat;
-import org.apache.slider.server.appmaster.web.rest.agent.HeartBeatResponse;
-import org.apache.slider.server.appmaster.web.rest.agent.Register;
-import org.apache.slider.server.appmaster.web.rest.agent.RegistrationResponse;
-import org.apache.slider.server.appmaster.web.rest.agent.RegistrationStatus;
-import org.apache.slider.server.appmaster.web.rest.agent.StatusCommand;
-import org.apache.slider.server.services.security.CertificateManager;
-import org.apache.slider.server.services.security.SecurityStore;
-import org.apache.slider.server.services.security.StoresGenerator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Scanner;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.regex.Pattern;
-
-import static org.apache.slider.api.RoleKeys.ROLE_PREFIX;
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.SLIDER_PATH_AGENTS;
-
-/**
- * This class implements the server-side logic for application deployment through Slider application package
- */
-public class AgentProviderService extends AbstractProviderService implements
-    ProviderCore,
-    AgentKeys,
-    SliderKeys, AgentRestOperations {
-
-
-  protected static final Logger log =
-      LoggerFactory.getLogger(AgentProviderService.class);
-  private static final ProviderUtils providerUtils = new ProviderUtils(log);
-  private static final String LABEL_MAKER = "___";
-  private static final String CONTAINER_ID = "container_id";
-  private static final String GLOBAL_CONFIG_TAG = "global";
-  private static final String LOG_FOLDERS_TAG = "LogFolders";
-  private static final String HOST_FOLDER_FORMAT = "%s:%s";
-  private static final String CONTAINER_LOGS_TAG = "container_log_dirs";
-  private static final String CONTAINER_PWDS_TAG = "container_work_dirs";
-  private static final String COMPONENT_TAG = "component";
-  private static final String APPLICATION_TAG = "application";
-  private static final String COMPONENT_DATA_TAG = "ComponentInstanceData";
-  private static final String SHARED_PORT_TAG = "SHARED";
-  private static final String PER_CONTAINER_TAG = "{PER_CONTAINER}";
-  private static final int MAX_LOG_ENTRIES = 40;
-  private static final int DEFAULT_HEARTBEAT_MONITOR_INTERVAL = 60 * 1000;
-
-  private final Object syncLock = new Object();
-  private final ComponentTagProvider tags = new ComponentTagProvider();
-  private int heartbeatMonitorInterval = 0;
-  private AgentClientProvider clientProvider;
-  private AtomicInteger taskId = new AtomicInteger(0);
-  private volatile Map<String, MetainfoHolder> metaInfoMap = new HashMap<>();
-  private SliderFileSystem fileSystem = null;
-  private Map<String, DefaultConfig> defaultConfigs = null;
-  private ComponentCommandOrder commandOrder = new ComponentCommandOrder();
-  private HeartbeatMonitor monitor;
-  private Boolean canAnyMasterPublish = null;
-  private AgentLaunchParameter agentLaunchParameter = null;
-  private String clusterName = null;
-  private boolean isInUpgradeMode;
-  private Set<String> upgradeContainers = new HashSet<String>();
-  private boolean appStopInitiated;
-
-  private final Map<String, ComponentInstanceState> componentStatuses =
-      new ConcurrentHashMap<String, ComponentInstanceState>();
-  private final Map<String, Map<String, String>> componentInstanceData =
-      new ConcurrentHashMap<String, Map<String, String>>();
-  private final Map<String, Map<String, List<ExportEntry>>> exportGroups =
-      new ConcurrentHashMap<String, Map<String, List<ExportEntry>>>();
-  private final Map<String, Map<String, String>> allocatedPorts =
-      new ConcurrentHashMap<String, Map<String, String>>();
-  private final Map<String, Metainfo> packageMetainfo = 
-      new ConcurrentHashMap<String, Metainfo>();
-
-  private final Map<String, ExportEntry> logFolderExports =
-      Collections.synchronizedMap(new LinkedHashMap<String, ExportEntry>(MAX_LOG_ENTRIES, 0.75f, false) {
-        protected boolean removeEldestEntry(Map.Entry eldest) {
-          return size() > MAX_LOG_ENTRIES;
-        }
-      });
-  private final Map<String, ExportEntry> workFolderExports =
-      Collections.synchronizedMap(new LinkedHashMap<String, ExportEntry>(MAX_LOG_ENTRIES, 0.75f, false) {
-        protected boolean removeEldestEntry(Map.Entry eldest) {
-          return size() > MAX_LOG_ENTRIES;
-        }
-      });
-  private final Map<String, Set<String>> containerExportsMap =
-      new HashMap<String, Set<String>>();
-
-  private static class MetainfoHolder {
-    Metainfo metaInfo;
-    private Map<String, DefaultConfig> defaultConfigs = null;
-
-    public MetainfoHolder(Metainfo metaInfo,
-        Map<String, DefaultConfig> defaultConfigs) {
-      this.metaInfo = metaInfo;
-      this.defaultConfigs = defaultConfigs;
-    }
-  }
-
-  /**
-   * Create an instance of AgentProviderService
-   */
-  public AgentProviderService() {
-    super("AgentProviderService");
-    setAgentRestOperations(this);
-    setHeartbeatMonitorInterval(DEFAULT_HEARTBEAT_MONITOR_INTERVAL);
-  }
-
-  @Override
-  public String getHumanName() {
-    return "Slider Agent";
-  }
-
-  @Override
-  public List<ProviderRole> getRoles() {
-    return AgentRoles.getRoles();
-  }
-
-  @Override
-  protected void serviceInit(Configuration conf) throws Exception {
-    super.serviceInit(conf);
-    clientProvider = new AgentClientProvider(conf);
-  }
-
-  @Override
-  public Configuration loadProviderConfigurationInformation(File confDir) throws
-      BadCommandArgumentsException,
-      IOException {
-    return new Configuration(false);
-  }
-
-  @Override
-  public void validateInstanceDefinition(AggregateConf instanceDefinition)
-      throws
-      SliderException {
-    clientProvider.validateInstanceDefinition(instanceDefinition, null);
-
-    ConfTreeOperations resources =
-        instanceDefinition.getResourceOperations();
-
-    Set<String> names = resources.getComponentNames();
-    names.remove(SliderKeys.COMPONENT_AM);
-    for (String name : names) {
-      Component componentDef = getApplicationComponent(name);
-      if (componentDef == null) {
-        // component member is validated elsewhere, so we don't need to throw
-        // an exception here
-        continue;
-      }
-
-      MapOperations componentConfig = resources.getMandatoryComponent(name);
-      int count =
-          componentConfig.getMandatoryOptionInt(ResourceKeys.COMPONENT_INSTANCES);
-      int definedMinCount = componentDef.getMinInstanceCountInt();
-      int definedMaxCount = componentDef.getMaxInstanceCountInt();
-      if (count < definedMinCount || count > definedMaxCount) {
-        throw new BadConfigException("Component %s, %s value %d out of range. "
-                                     + "Expected minimum is %d and maximum is %d",
-                                     name,
-                                     ResourceKeys.COMPONENT_INSTANCES,
-                                     count,
-                                     definedMinCount,
-                                     definedMaxCount);
-      }
-    }
-  }
-
-  // Reads the metainfo.xml in the application package and loads it
-  private void buildMetainfo(AggregateConf instanceDefinition,
-                             SliderFileSystem fileSystem,
-                             String roleGroup)
-      throws IOException, SliderException {
-    String mapKey = instanceDefinition.getAppConfOperations()
-        .getComponentOpt(roleGroup, ROLE_PREFIX, DEFAULT_METAINFO_MAP_KEY);
-    String appDef = SliderUtils.getApplicationDefinitionPath(
-        instanceDefinition.getAppConfOperations(), roleGroup);
-    MapOperations component = null;
-    if (roleGroup != null) {
-      component = instanceDefinition.getAppConfOperations().getComponent(roleGroup);
-    }
-
-    MetainfoHolder metaInfoHolder = metaInfoMap.get(mapKey);
-    if (metaInfoHolder == null) {
-      synchronized (syncLock) {
-        if (this.fileSystem == null) {
-          this.fileSystem = fileSystem;
-        }
-        metaInfoHolder = metaInfoMap.get(mapKey);
-        if (metaInfoHolder == null) {
-          readAndSetHeartbeatMonitoringInterval(instanceDefinition);
-          initializeAgentDebugCommands(instanceDefinition);
-
-          Metainfo metaInfo = getApplicationMetainfo(fileSystem, appDef, false);
-          log.info("Master package metainfo: {}", metaInfo.toString());
-          if (metaInfo == null || metaInfo.getApplication() == null) {
-            log.error("metainfo.xml is unavailable or malformed at {}.", appDef);
-            throw new SliderException(
-                "metainfo.xml is required in app package.");
-          }
-          List<CommandOrder> commandOrders = metaInfo.getApplication()
-              .getCommandOrders();
-          if (!DEFAULT_METAINFO_MAP_KEY.equals(mapKey)) {
-            for (Component comp : metaInfo.getApplication().getComponents()) {
-              comp.setName(mapKey + comp.getName());
-              log.info("Modifying external metainfo component name to {}",
-                  comp.getName());
-            }
-            for (CommandOrder co : commandOrders) {
-              log.info("Adding prefix {} to command order {}",
-                  mapKey, co);
-              co.setCommand(mapKey + co.getCommand());
-              co.setRequires(mapKey + co.getRequires());
-            }
-          }
-          log.debug("Merging command orders {} for {}", commandOrders,
-              roleGroup);
-          commandOrder.mergeCommandOrders(commandOrders,
-              instanceDefinition.getResourceOperations());
-          Map<String, DefaultConfig> defaultConfigs =
-              initializeDefaultConfigs(fileSystem, appDef, metaInfo);
-          metaInfoMap.put(mapKey, new MetainfoHolder(metaInfo, defaultConfigs));
-          monitor = new HeartbeatMonitor(this, getHeartbeatMonitorInterval());
-          monitor.start();
-
-          // build a map from component to metainfo
-          String addonAppDefString = instanceDefinition.getAppConfOperations()
-              .getGlobalOptions().getOption(AgentKeys.ADDONS, null);
-          if (component != null) {
-            addonAppDefString = component.getOption(AgentKeys.ADDONS, addonAppDefString);
-          }
-          log.debug("All addon appdefs: {}", addonAppDefString);
-          if (addonAppDefString != null) {
-            Scanner scanner = new Scanner(addonAppDefString).useDelimiter(",");
-            while (scanner.hasNext()) {
-              String addonAppDef = scanner.next();
-              String addonAppDefPath = instanceDefinition
-                  .getAppConfOperations().getGlobalOptions().get(addonAppDef);
-              if (component != null) {
-                addonAppDefPath = component.getOption(addonAppDef, addonAppDefPath);
-              }
-              log.debug("Addon package {} is stored at: {}", addonAppDef
-                  + addonAppDefPath);
-              Metainfo addonMetaInfo = getApplicationMetainfo(fileSystem,
-                  addonAppDefPath, true);
-              addonMetaInfo.validate();
-              packageMetainfo.put(addonMetaInfo.getApplicationPackage()
-                  .getName(), addonMetaInfo);
-            }
-            log.info("Metainfo map for master and addon: {}",
-                packageMetainfo.toString());
-          }
-        }
-      }
-    }
-  }
-
-  @Override
-  public void initializeApplicationConfiguration(
-      AggregateConf instanceDefinition, SliderFileSystem fileSystem,
-      String roleGroup)
-      throws IOException, SliderException {
-    buildMetainfo(instanceDefinition, fileSystem, roleGroup);
-  }
-
-  @Override
-  public void buildContainerLaunchContext(ContainerLauncher launcher,
-                                          AggregateConf instanceDefinition,
-                                          Container container,
-                                          ProviderRole providerRole,
-                                          SliderFileSystem fileSystem,
-                                          Path generatedConfPath,
-                                          MapOperations resourceComponent,
-                                          MapOperations appComponent,
-                                          Path containerTmpDirPath) throws
-      IOException,
-      SliderException {
-    
-    String roleName = providerRole.name;
-    String roleGroup = providerRole.group;
-    String appDef = SliderUtils.getApplicationDefinitionPath(instanceDefinition
-        .getAppConfOperations(), roleGroup);
-
-    initializeApplicationConfiguration(instanceDefinition, fileSystem, roleGroup);
-
-    log.info("Build launch context for Agent");
-    log.debug(instanceDefinition.toString());
-    
-    //if we are launching docker based app on yarn, then we need to pass docker image
-    if (isYarnDockerContainer(roleGroup)) {
-      launcher.setYarnDockerMode(true);
-      launcher.setDockerImage(getConfigFromMetaInfo(roleGroup, "image"));
-      launcher.setRunPrivilegedContainer(getConfigFromMetaInfo(roleGroup, "runPriviledgedContainer"));
-      launcher
-          .setYarnContainerMountPoints(getConfigFromMetaInfoWithAppConfigOverriding(
-              roleGroup, "yarn.container.mount.points"));
-    }
-
-    // Set the environment
-    launcher.putEnv(SliderUtils.buildEnvMap(appComponent,
-        getStandardTokenMap(getAmState().getAppConfSnapshot(), roleName, roleGroup)));
-
-    String workDir = ApplicationConstants.Environment.PWD.$();
-    launcher.setEnv("AGENT_WORK_ROOT", workDir);
-    log.info("AGENT_WORK_ROOT set to {}", workDir);
-    String logDir = ApplicationConstants.LOG_DIR_EXPANSION_VAR;
-    launcher.setEnv("AGENT_LOG_ROOT", logDir);
-    log.info("AGENT_LOG_ROOT set to {}", logDir);
-    if (System.getenv(HADOOP_USER_NAME) != null) {
-      launcher.setEnv(HADOOP_USER_NAME, System.getenv(HADOOP_USER_NAME));
-    }
-    // for 2-Way SSL
-    launcher.setEnv(SLIDER_PASSPHRASE, instanceDefinition.getPassphrase());
-    //add english env
-    launcher.setEnv("LANG", "en_US.UTF-8");
-    launcher.setEnv("LC_ALL", "en_US.UTF-8");
-    launcher.setEnv("LANGUAGE", "en_US.UTF-8");
-
-    //local resources
-
-    // TODO: Should agent need to support App Home
-    String scriptPath = new File(AgentKeys.AGENT_MAIN_SCRIPT_ROOT, AgentKeys.AGENT_MAIN_SCRIPT).getPath();
-    String appHome = instanceDefinition.getAppConfOperations().
-        getGlobalOptions().get(AgentKeys.PACKAGE_PATH);
-    if (SliderUtils.isSet(appHome)) {
-      scriptPath = new File(appHome, AgentKeys.AGENT_MAIN_SCRIPT).getPath();
-    }
-
-    // set PYTHONPATH
-    List<String> pythonPaths = new ArrayList<String>();
-    pythonPaths.add(AgentKeys.AGENT_MAIN_SCRIPT_ROOT);
-    pythonPaths.add(AgentKeys.AGENT_JINJA2_ROOT);
-    String pythonPath = StringUtils.join(File.pathSeparator, pythonPaths);
-    launcher.setEnv(PYTHONPATH, pythonPath);
-    log.info("PYTHONPATH set to {}", pythonPath);
-
-    Path agentImagePath = null;
-    String agentImage = instanceDefinition.getInternalOperations().
-        get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH);
-    if (SliderUtils.isUnset(agentImage)) {
-      agentImagePath =
-          new Path(new Path(new Path(instanceDefinition.getInternalOperations().get(InternalKeys.INTERNAL_TMP_DIR),
-                                     container.getId().getApplicationAttemptId().getApplicationId().toString()),
-                            AgentKeys.PROVIDER_AGENT),
-                   SliderKeys.AGENT_TAR);
-    } else {
-       agentImagePath = new Path(agentImage);
-    }
-
-    if (fileSystem.getFileSystem().exists(agentImagePath)) {
-      LocalResource agentImageRes = fileSystem.createAmResource(agentImagePath, LocalResourceType.ARCHIVE);
-      launcher.addLocalResource(AgentKeys.AGENT_INSTALL_DIR, agentImageRes);
-    } else {
-      String msg =
-          String.format("Required agent image slider-agent.tar.gz is unavailable at %s", agentImagePath.toString());
-      MapOperations compOps = appComponent;
-      boolean relaxVerificationForTest = compOps != null ? Boolean.valueOf(compOps.
-          getOptionBool(AgentKeys.TEST_RELAX_VERIFICATION, false)) : false;
-      log.error(msg);
-
-      if (!relaxVerificationForTest) {
-        throw new SliderException(SliderExitCodes.EXIT_DEPLOYMENT_FAILED, msg);
-      }
-    }
-
-    log.info("Using {} for agent.", scriptPath);
-    LocalResource appDefRes = fileSystem.createAmResource(
-        fileSystem.getFileSystem().resolvePath(new Path(appDef)),
-        LocalResourceType.ARCHIVE);
-    launcher.addLocalResource(AgentKeys.APP_DEFINITION_DIR, appDefRes);
-
-    for (Package pkg : getMetaInfo(roleGroup).getApplication().getPackages()) {
-      Path pkgPath = fileSystem.buildResourcePath(pkg.getName());
-      if (!fileSystem.isFile(pkgPath)) {
-        pkgPath = fileSystem.buildResourcePath(getClusterName(),
-            pkg.getName());
-      }
-      if (!fileSystem.isFile(pkgPath)) {
-        throw new IOException("Package doesn't exist as a resource: " +
-            pkg.getName());
-      }
-      log.info("Adding resource {}", pkg.getName());
-      LocalResourceType type = LocalResourceType.FILE;
-      if ("archive".equals(pkg.getType())) {
-        type = LocalResourceType.ARCHIVE;
-      }
-      LocalResource packageResource = fileSystem.createAmResource(
-          pkgPath, type);
-      launcher.addLocalResource(AgentKeys.APP_PACKAGES_DIR, packageResource);
-    }
-
-    String agentConf = instanceDefinition.getAppConfOperations().
-        getGlobalOptions().getOption(AgentKeys.AGENT_CONF, "");
-    if (SliderUtils.isSet(agentConf)) {
-      LocalResource agentConfRes = fileSystem.createAmResource(fileSystem
-                                                                   .getFileSystem().resolvePath(new Path(agentConf)),
-                                                               LocalResourceType.FILE);
-      launcher.addLocalResource(AgentKeys.AGENT_CONFIG_FILE, agentConfRes);
-    }
-
-    String agentVer = instanceDefinition.getAppConfOperations().
-        getGlobalOptions().getOption(AgentKeys.AGENT_VERSION, null);
-    if (agentVer != null) {
-      LocalResource agentVerRes = fileSystem.createAmResource(
-          fileSystem.getFileSystem().resolvePath(new Path(agentVer)),
-          LocalResourceType.FILE);
-      launcher.addLocalResource(AgentKeys.AGENT_VERSION_FILE, agentVerRes);
-    }
-
-    if (SliderUtils.isHadoopClusterSecure(getConfig())) {
-      localizeServiceKeytabs(launcher, instanceDefinition, fileSystem);
-    }
-
-    MapOperations amComponent = instanceDefinition.
-        getAppConfOperations().getComponent(SliderKeys.COMPONENT_AM);
-    boolean twoWayEnabled = amComponent != null ? Boolean.valueOf(amComponent.
-        getOptionBool(AgentKeys.KEY_AGENT_TWO_WAY_SSL_ENABLED, false)) : false;
-    if (twoWayEnabled) {
-      localizeContainerSSLResources(launcher, container, fileSystem);
-    }
-
-    MapOperations compOps = appComponent;
-    if (areStoresRequested(compOps)) {
-      localizeContainerSecurityStores(launcher, container, roleName, fileSystem,
-                                      instanceDefinition, compOps);
-    }
-
-    //add the configuration resources
-    launcher.addLocalResources(fileSystem.submitDirectory(
-        generatedConfPath,
-        SliderKeys.PROPAGATED_CONF_DIR_NAME));
-
-    if (appComponent.getOptionBool(AgentKeys.AM_CONFIG_GENERATION, false)) {
-      // build and localize configuration files
-      Map<String, Map<String, String>> configurations =
-          buildCommandConfigurations(instanceDefinition.getAppConfOperations(),
-              container.getId().toString(), roleName, roleGroup);
-      localizeConfigFiles(launcher, roleName, roleGroup, getMetaInfo(roleGroup),
-          configurations, launcher.getEnv(), fileSystem);
-    }
-
-    String label = getContainerLabel(container, roleName, roleGroup);
-    CommandLineBuilder operation = new CommandLineBuilder();
-
-    String pythonExec = instanceDefinition.getAppConfOperations()
-        .getGlobalOptions().getOption(SliderXmlConfKeys.PYTHON_EXECUTABLE_PATH,
-                                      AgentKeys.PYTHON_EXE);
-
-    operation.add(pythonExec);
-
-    operation.add(scriptPath);
-    operation.add(ARG_LABEL, label);
-    operation.add(ARG_ZOOKEEPER_QUORUM);
-    operation.add(getClusterOptionPropertyValue(OptionKeys.ZOOKEEPER_QUORUM));
-    operation.add(ARG_ZOOKEEPER_REGISTRY_PATH);
-    operation.add(getZkRegistryPath());
-
-    String debugCmd = agentLaunchParameter.getNextLaunchParameter(roleGroup);
-    if (SliderUtils.isSet(debugCmd)) {
-      operation.add(ARG_DEBUG);
-      operation.add(debugCmd);
-    }
-
-    operation.add("> " + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/"
-        + AgentKeys.AGENT_OUT_FILE + " 2>&1");
-
-    launcher.addCommand(operation.build());
-
-    // localize addon package
-    String addonAppDefString = instanceDefinition.getAppConfOperations()
-        .getGlobalOptions().getOption(AgentKeys.ADDONS, null);
-    log.debug("All addon appdefs: {}", addonAppDefString);
-    if (addonAppDefString != null) {
-      Scanner scanner = new Scanner(addonAppDefString).useDelimiter(",");
-      while (scanner.hasNext()) {
-        String addonAppDef = scanner.next();
-        String addonAppDefPath = instanceDefinition
-            .getAppConfOperations().getGlobalOptions().get(addonAppDef);
-        log.debug("Addon package {} is stored at: {}", addonAppDef, addonAppDefPath);
-        LocalResource addonPkgRes = fileSystem.createAmResource(
-            fileSystem.getFileSystem().resolvePath(new Path(addonAppDefPath)),
-            LocalResourceType.ARCHIVE);
-        launcher.addLocalResource(AgentKeys.ADDON_DEFINITION_DIR + "/" + addonAppDef, addonPkgRes);
-      }
-      log.debug("Metainfo map for master and addon: {}",
-          packageMetainfo.toString());
-    }    
-
-    // Additional files to localize in addition to the application def
-    String appResourcesString = instanceDefinition.getAppConfOperations()
-        .getGlobalOptions().getOption(AgentKeys.APP_RESOURCES, null);
-    log.info("Configuration value for extra resources to localize: {}", appResourcesString);
-    if (null != appResourcesString) {
-      try (Scanner scanner = new Scanner(appResourcesString).useDelimiter(",")) {
-        while (scanner.hasNext()) {
-          String resource = scanner.next();
-          Path resourcePath = new Path(resource);
-          LocalResource extraResource = fileSystem.createAmResource(
-              fileSystem.getFileSystem().resolvePath(resourcePath),
-              LocalResourceType.FILE);
-          String destination = AgentKeys.APP_RESOURCES_DIR + "/" + resourcePath.getName();
-          log.info("Localizing {} to {}", resourcePath, destination);
-          // TODO Can we try harder to avoid collisions?
-          launcher.addLocalResource(destination, extraResource);
-        }
-      }
-    }
-
-    // initialize addon pkg states for all componentInstanceStatus
-    Map<String, State> pkgStatuses = new TreeMap<>();
-    for (Metainfo appPkg : packageMetainfo.values()) {
-      // check each component of that addon to see if they apply to this
-      // component 'role'
-      for (ComponentsInAddonPackage comp : appPkg.getApplicationPackage()
-          .getComponents()) {
-        log.debug("Current component: {} component in metainfo: {}", roleName,
-            comp.getName());
-        if (comp.getName().equals(roleGroup)
-            || comp.getName().equals(AgentKeys.ADDON_FOR_ALL_COMPONENTS)) {
-          pkgStatuses.put(appPkg.getApplicationPackage().getName(), State.INIT);
-        }
-      }
-    }
-    log.debug("For component: {} pkg status map: {}", roleName,
-        pkgStatuses.toString());
-    
-    // initialize the component instance state
-    getComponentStatuses().put(label,
-                               new ComponentInstanceState(
-                                   roleGroup,
-                                   container.getId(),
-                                   getClusterInfoPropertyValue(OptionKeys.APPLICATION_NAME),
-                                   pkgStatuses));
-  }
-
-  private void localizeContainerSecurityStores(ContainerLauncher launcher,
-                                               Container container,
-                                               String role,
-                                               SliderFileSystem fileSystem,
-                                               AggregateConf instanceDefinition,
-                                               MapOperations compOps)
-      throws SliderException, IOException {
-    // substitute CLUSTER_NAME into credentials
-    Map<String,List<String>> newcred = new HashMap<>();
-    for (Entry<String,List<String>> entry : instanceDefinition.getAppConf().credentials.entrySet()) {
-      List<String> resultList = new ArrayList<>();
-      for (String v : entry.getValue()) {
-        resultList.add(v.replaceAll(Pattern.quote("${CLUSTER_NAME}"),
-            clusterName).replaceAll(Pattern.quote("${CLUSTER}"),
-            clusterName));
-      }
-      newcred.put(entry.getKey().replaceAll(Pattern.quote("${CLUSTER_NAME}"),
-          clusterName).replaceAll(Pattern.quote("${CLUSTER}"),
-          clusterName),
-          resultList);
-    }
-    instanceDefinition.getAppConf().credentials = newcred;
-
-    // generate and localize security stores
-    SecurityStore[] stores = generateSecurityStores(container, role,
-                                                    instanceDefinition, compOps);
-    for (SecurityStore store : stores) {
-      LocalResource keystoreResource = fileSystem.createAmResource(
-          uploadSecurityResource(store.getFile(), fileSystem), LocalResourceType.FILE);
-      launcher.addLocalResource(String.format("secstores/%s-%s.p12",
-                                              store.getType(), role),
-                                keystoreResource);
-    }
-  }
-
-  private SecurityStore[] generateSecurityStores(Container container,
-                                                 String role,
-                                                 AggregateConf instanceDefinition,
-                                                 MapOperations compOps)
-      throws SliderException, IOException {
-    return StoresGenerator.generateSecurityStores(container.getNodeId().getHost(),
-                                           container.getId().toString(), role,
-                                           instanceDefinition, compOps);
-  }
-
-  private boolean areStoresRequested(MapOperations compOps) {
-    return compOps != null ? compOps.
-        getOptionBool(SliderKeys.COMP_STORES_REQUIRED_KEY, false) : false;
-  }
-
-  private void localizeContainerSSLResources(ContainerLauncher launcher,
-                                             Container container,
-                                             SliderFileSystem fileSystem)
-      throws SliderException {
-    try {
-      // localize server cert
-      Path certsDir = fileSystem.buildClusterSecurityDirPath(getClusterName());
-      LocalResource certResource = fileSystem.createAmResource(
-          new Path(certsDir, SliderKeys.CRT_FILE_NAME),
-            LocalResourceType.FILE);
-      launcher.addLocalResource(AgentKeys.CERT_FILE_LOCALIZATION_PATH,
-                                certResource);
-
-      // generate and localize agent cert
-      CertificateManager certMgr = new CertificateManager();
-      String hostname = container.getNodeId().getHost();
-      String containerId = container.getId().toString();
-      certMgr.generateContainerCertificate(hostname, containerId);
-      LocalResource agentCertResource = fileSystem.createAmResource(
-          uploadSecurityResource(
-            CertificateManager.getAgentCertficateFilePath(containerId),
-            fileSystem), LocalResourceType.FILE);
-      // still using hostname as file name on the agent side, but the files
-      // do end up under the specific container's file space
-      launcher.addLocalResource(AgentKeys.INFRA_RUN_SECURITY_DIR + hostname +
-                                ".crt", agentCertResource);
-      LocalResource agentKeyResource = fileSystem.createAmResource(
-          uploadSecurityResource(
-              CertificateManager.getAgentKeyFilePath(containerId), fileSystem),
-            LocalResourceType.FILE);
-      launcher.addLocalResource(AgentKeys.INFRA_RUN_SECURITY_DIR + hostname +
-                                ".key", agentKeyResource);
-
-    } catch (Exception e) {
-      throw new SliderException(SliderExitCodes.EXIT_DEPLOYMENT_FAILED, e,
-          "Unable to localize certificates.  Two-way SSL cannot be enabled");
-    }
-  }
-
-  private Path uploadSecurityResource(File resource, SliderFileSystem fileSystem)
-      throws IOException {
-    Path certsDir = fileSystem.buildClusterSecurityDirPath(getClusterName());
-    return uploadResource(resource, fileSystem, certsDir);
-  }
-
-  private Path uploadResource(File resource, SliderFileSystem fileSystem,
-      String roleName) throws IOException {
-    Path dir;
-    if (roleName == null) {
-      dir = fileSystem.buildClusterResourcePath(getClusterName());
-    } else {
-      dir = fileSystem.buildClusterResourcePath(getClusterName(), roleName);
-    }
-    return uploadResource(resource, fileSystem, dir);
-  }
-
-  private static synchronized Path uploadResource(File resource,
-      SliderFileSystem fileSystem, Path parentDir) throws IOException {
-    if (!fileSystem.getFileSystem().exists(parentDir)) {
-      fileSystem.getFileSystem().mkdirs(parentDir,
-        new FsPermission(FsAction.ALL, FsAction.NONE, FsAction.NONE));
-    }
-    Path destPath = new Path(parentDir, resource.getName());
-    if (!fileSystem.getFileSystem().exists(destPath)) {
-      FSDataOutputStream os = null;
-      try {
-        os = fileSystem.getFileSystem().create(destPath);
-        byte[] contents = FileUtils.readFileToByteArray(resource);
-        os.write(contents, 0, contents.length);
-        os.flush();
-      } finally {
-        IOUtils.closeStream(os);
-      }
-      log.info("Uploaded {} to localization path {}", resource, destPath);
-    } else {
-      log.info("Resource {} already existed at localization path {}", resource,
-          destPath);
-    }
-
-    while (!fileSystem.getFileSystem().exists(destPath)) {
-      try {
-        Thread.sleep(500);
-      } catch (InterruptedException e) {
-        // ignore
-      }
-    }
-
-    fileSystem.getFileSystem().setPermission(destPath,
-      new FsPermission(FsAction.READ, FsAction.NONE, FsAction.NONE));
-
-    return destPath;
-  }
-
-  private void localizeServiceKeytabs(ContainerLauncher launcher,
-                                      AggregateConf instanceDefinition,
-                                      SliderFileSystem fileSystem)
-      throws IOException {
-    String keytabPathOnHost = instanceDefinition.getAppConfOperations()
-        .getComponent(SliderKeys.COMPONENT_AM).get(
-            SliderXmlConfKeys.KEY_AM_KEYTAB_LOCAL_PATH);
-    if (SliderUtils.isUnset(keytabPathOnHost)) {
-      String amKeytabName = instanceDefinition.getAppConfOperations()
-          .getComponent(SliderKeys.COMPONENT_AM).get(
-              SliderXmlConfKeys.KEY_AM_LOGIN_KEYTAB_NAME);
-      String keytabDir = instanceDefinition.getAppConfOperations()
-          .getComponent(SliderKeys.COMPONENT_AM).get(
-              SliderXmlConfKeys.KEY_HDFS_KEYTAB_DIR);
-      // we need to localize the keytab files in the directory
-      Path keytabDirPath = fileSystem.buildKeytabPath(keytabDir, null,
-                                                      getClusterName());
-      boolean serviceKeytabsDeployed = false;
-      if (fileSystem.getFileSystem().exists(keytabDirPath)) {
-        FileStatus[] keytabs = fileSystem.getFileSystem().listStatus(keytabDirPath);
-        LocalResource keytabRes;
-        for (FileStatus keytab : keytabs) {
-          if (!amKeytabName.equals(keytab.getPath().getName())
-              && keytab.getPath().getName().endsWith(".keytab")) {
-            serviceKeytabsDeployed = true;
-            log.info("Localizing keytab {}", keytab.getPath().getName());
-            keytabRes = fileSystem.createAmResource(keytab.getPath(),
-              LocalResourceType.FILE);
-            launcher.addLocalResource(SliderKeys.KEYTAB_DIR + "/" +
-                                    keytab.getPath().getName(),
-                                    keytabRes);
-          }
-        }
-      }
-      if (!serviceKeytabsDeployed) {
-        log.warn("No service keytabs for the application have been localized.  "
-                 + "If the application requires keytabs for secure operation, "
-                 + "please ensure that the required keytabs have been uploaded "
-                 + "to the folder {}", keytabDirPath);
-      }
-    }
-  }
-
-  private void createConfigFile(SliderFileSystem fileSystem, File file,
-      ConfigFile configFile, Map<String, String> config)
-      throws IOException {
-    ConfigFormat configFormat = ConfigFormat.resolve(configFile.getType());
-    log.info("Writing {} file {}", configFormat, file);
-
-    ConfigUtils.prepConfigForTemplateOutputter(configFormat, config,
-        fileSystem, getClusterName(), file.getName());
-    PublishedConfiguration publishedConfiguration =
-        new PublishedConfiguration(configFile.getDictionaryName(),
-            config.entrySet());
-    PublishedConfigurationOutputter configurationOutputter =
-      PublishedConfigurationOutputter.createOutputter(configFormat,
-          publishedConfiguration);
-    configurationOutputter.save(file);
-  }
-
-  @VisibleForTesting
-  protected void localizeConfigFiles(ContainerLauncher launcher,
-                                     String roleName, String roleGroup,
-                                     Metainfo metainfo,
-                                     Map<String, Map<String, String>> configs,
-                                     MapOperations env,
-                                     SliderFileSystem fileSystem)
-      throws IOException {
-    for (ConfigFile configFile : metainfo.getComponentConfigFiles(roleGroup)) {
-      Map<String, String> config = ConfigUtils.replacePropsInConfig(
-          configs.get(configFile.getDictionaryName()), env.options);
-      String fileName = ConfigUtils.replaceProps(config,
-          configFile.getFileName());
-      File localFile = new File(SliderKeys.RESOURCE_DIR);
-      if (!localFile.exists()) {
-        localFile.mkdir();
-      }
-      localFile = new File(localFile, new File(fileName).getName());
-
-      String folder = null;
-      if ("true".equals(config.get(PER_COMPONENT))) {
-        folder = roleName;
-      } else if ("true".equals(config.get(PER_GROUP))) {
-        folder = roleGroup;
-      }
-
-      log.info("Localizing {} configs to config file {} (destination {}) " +
-          "based on {} configs", config.size(), localFile, fileName,
-          configFile.getDictionaryName());
-      createConfigFile(fileSystem, localFile, configFile, config);
-      Path destPath = uploadResource(localFile, fileSystem, folder);
-      LocalResource configResource = fileSystem.createAmResource(destPath,
-          LocalResourceType.FILE);
-
-      File destFile = new File(fileName);
-      if (destFile.isAbsolute()) {
-        launcher.addLocalResource(
-            SliderKeys.RESOURCE_DIR + "/" + destFile.getName(),
-            configResource, fileName);
-      } else {
-        launcher.addLocalResource(AgentKeys.APP_CONF_DIR + "/" + fileName,
-            configResource);
-      }
-    }
-  }
-
-  /**
-   * build the zookeeper registry path.
-   * 
-   * @return the path the service registered at
-   * @throws NullPointerException if the service has not yet registered
-   */
-  private String getZkRegistryPath() {
-    Preconditions.checkNotNull(yarnRegistry, "Yarn registry not bound");
-    String path = yarnRegistry.getAbsoluteSelfRegistrationPath();
-    Preconditions.checkNotNull(path, "Service record path not defined");
-    return path;
-  }
-
-  @Override
-  public void rebuildContainerDetails(List<Container> liveContainers,
-                                      String applicationId, Map<Integer, ProviderRole> providerRoleMap) {
-    for (Container container : liveContainers) {
-      // get the role name and label
-      ProviderRole role = providerRoleMap.get(ContainerPriority
-                                                  .extractRole(container));
-      if (role != null) {
-        String roleName = role.name;
-        String roleGroup = role.group;
-        String label = getContainerLabel(container, roleName, roleGroup);
-        log.info("Rebuilding in-memory: container {} in role {} in cluster {}",
-                 container.getId(), roleName, applicationId);
-        getComponentStatuses().put(label,
-            new ComponentInstanceState(roleGroup, container.getId(),
-                                       applicationId));
-      } else {
-        log.warn("Role not found for container {} in cluster {}",
-                 container.getId(), applicationId);
-      }
-    }
-  }
-
-  @Override
-  public boolean isSupportedRole(String role) {
-    return true;
-  }
-
-  /**
-   * Handle registration calls from the agents
-   *
-   * @param registration registration entry
-   *
-   * @return response
-   */
-  @Override
-  public RegistrationResponse handleRegistration(Register registration) {
-    log.info("Handling registration: {}", registration);
-    RegistrationResponse response = new RegistrationResponse();
-    String label = registration.getLabel();
-    String pkg = registration.getPkg();
-    State agentState = registration.getActualState();
-    String appVersion = registration.getAppVersion();
-
-    log.info("label: {} pkg: {}", label, pkg);
-
-    if (getComponentStatuses().containsKey(label)) {
-      response.setResponseStatus(RegistrationStatus.OK);
-      ComponentInstanceState componentStatus = getComponentStatuses().get(label);
-      componentStatus.heartbeat(System.currentTimeMillis());
-      updateComponentStatusWithAgentState(componentStatus, agentState);
-
-      String roleName = getRoleName(label);
-      String roleGroup = getRoleGroup(label);
-      String containerId = getContainerId(label);
-
-      if (SliderUtils.isSet(registration.getTags())) {
-        tags.recordAssignedTag(roleName, containerId, registration.getTags());
-      } else {
-        response.setTags(tags.getTag(roleName, containerId));
-      }
-
-      String hostFqdn = registration.getPublicHostname();
-      Map<String, String> ports = registration.getAllocatedPorts();
-      if (ports != null && !ports.isEmpty()) {
-        processAllocatedPorts(hostFqdn, roleName, roleGroup, containerId, ports);
-      }
-
-      Map<String, String> folders = registration.getLogFolders();
-      if (folders != null && !folders.isEmpty()) {
-        publishFolderPaths(folders, containerId, roleName, hostFqdn);
-      }
-
-      // Set app version if empty. It gets unset during upgrade - why?
-      checkAndSetContainerAppVersion(containerId, appVersion);
-    } else {
-      response.setResponseStatus(RegistrationStatus.FAILED);
-      response.setLog("Label not recognized.");
-      log.warn("Received registration request from unknown label {}", label);
-    }
-    log.info("Registration response: {}", response);
-    return response;
-  }
-
-  // Checks if app version is empty. Sets it to the version as reported by the
-  // container during registration phase.
-  private void checkAndSetContainerAppVersion(String containerId,
-      String appVersion) {
-    StateAccessForProviders amState = getAmState();
-    try {
-      RoleInstance role = amState.getOwnedContainer(containerId);
-      if (role != null) {
-        String currentAppVersion = role.appVersion;
-        log.debug("Container = {}, app version current = {} new = {}",
-            containerId, currentAppVersion, appVersion);
-        if (currentAppVersion == null
-            || currentAppVersion.equals(APP_VERSION_UNKNOWN)) {
-          amState.getOwnedContainer(containerId).appVersion = appVersion;
-        }
-      }
-    } catch (NoSuchNodeException e) {
-      // ignore - there is nothing to do if we don't find a container
-      log.warn("Owned container {} not found - {}", containerId, e);
-    }
-  }
-
-  /**
-   * Handle heartbeat response from agents
-   *
-   * @param heartBeat incoming heartbeat from Agent
-   *
-   * @return response to send back
-   */
-  @Override
-  public HeartBeatResponse handleHeartBeat(HeartBeat heartBeat) {
-    log.debug("Handling heartbeat: {}", heartBeat);
-    HeartBeatResponse response = new HeartBeatResponse();
-    long id = heartBeat.getResponseId();
-    response.setResponseId(id + 1L);
-
-    String label = heartBeat.getHostname();
-    String pkg = heartBeat.getPackage();
-
-    log.debug("package received: " + pkg);
-    
-    String roleName = getRoleName(label);
-    String roleGroup = getRoleGroup(label);
-    String containerId = getContainerId(label);
-    boolean doUpgrade = false;
-    if (isInUpgradeMode && upgradeContainers.contains(containerId)) {
-      doUpgrade = true;
-    }
-
-    StateAccessForProviders accessor = getAmState();
-    CommandScript cmdScript = getScriptPathForMasterPackage(roleGroup);
-    List<ComponentCommand> commands = getApplicationComponent(roleGroup).getCommands();
-
-    if (!isDockerContainer(roleGroup) && !isYarnDockerContainer(roleGroup)
-        && (cmdScript == null || cmdScript.getScript() == null)
-        && commands.size() == 0) {
-      log.error(
-          "role.script is unavailable for {}. Commands will not be sent.",
-          roleName);
-      return response;
-    }
-
-    String scriptPath = null;
-    long timeout = 600L;
-    if (cmdScript != null) {
-      scriptPath = cmdScript.getScript();
-      timeout = cmdScript.getTimeout();
-    }
-
-    if (timeout == 0L) {
-      timeout = 600L;
-    }
-
-    if (!getComponentStatuses().containsKey(label)) {
-      // container is completed but still heart-beating, send terminate signal
-      log.info(
-          "Sending terminate signal to completed container (still heartbeating): {}",
-          label);
-      response.setTerminateAgent(true);
-      return response;
-    }
-
-    List<ComponentStatus> statuses = heartBeat.getComponentStatus();
-    if (statuses != null && !statuses.isEmpty()) {
-      log.info("status from agent: " + statuses.toString());
-      try {
-        for(ComponentStatus status : statuses){
-          RoleInstance role = null;
-          if(status.getIp() != null && !status.getIp().isEmpty()){
-            role = amState.getOwnedContainer(containerId);
-            role.ip = status.getIp();
-          }
-          if(status.getHostname() != null && !status.getHostname().isEmpty()){
-            role = amState.getOwnedContainer(containerId);
-            role.hostname = status.getHostname();
-          }
-          if (role != null) {
-            // create an updated service record (including hostname and ip) and publish...
-            ServiceRecord record = new ServiceRecord();
-            record.set(YarnRegistryAttributes.YARN_ID, containerId);
-            record.description = roleName;
-            record.set(YarnRegistryAttributes.YARN_PERSISTENCE,
-                       PersistencePolicies.CONTAINER);
-            // TODO:  switch record attributes to use constants from YarnRegistryAttributes
-            // when it's been updated.
-            if (role.ip != null) {
-              record.set("yarn:ip", role.ip);
-            }
-            if (role.hostname != null) {
-              record.set("yarn:hostname", role.hostname);
-            }
-            yarnRegistry.putComponent(
-                RegistryPathUtils.encodeYarnID(containerId), record);
-
-          }
-        }
-
-
-      } catch (NoSuchNodeException e) {
-        // ignore - there is nothing to do if we don't find a container
-        log.warn("Owned container {} not found - {}", containerId, e);
-      } catch (IOException e) {
-        log.warn("Error updating container {} service record in registry",
-                 containerId, e);
-      }
-    }
-
-    Boolean isMaster = isMaster(roleGroup);
-    ComponentInstanceState componentStatus = getComponentStatuses().get(label);
-    componentStatus.heartbeat(System.currentTimeMillis());
-    if (doUpgrade) {
-      switch (componentStatus.getState()) {
-      case STARTED:
-        componentStatus.setTargetState(State.UPGRADED);
-        break;
-      case UPGRADED:
-        componentStatus.setTargetState(State.STOPPED);
-        break;
-      case STOPPED:
-        componentStatus.setTargetState(State.TERMINATING);
-        break;
-      default:
-        break;
-      }
-      log.info("Current state = {} target state {}",
-          componentStatus.getState(), componentStatus.getTargetState());
-    }
-
-    if (appStopInitiated && !componentStatus.isStopInitiated()) {
-      log.info("Stop initiated for label {}", label);
-      componentStatus.setTargetState(State.STOPPED);
-      componentStatus.setStopInitiated(true);
-    }
-
-    publishConfigAndExportGroups(heartBeat, componentStatus, roleGroup);
-    CommandResult result = null;
-    List<CommandReport> reports = heartBeat.getReports();
-    if (SliderUtils.isNotEmpty(reports)) {
-      CommandReport report = reports.get(0);
-      Map<String, String> ports = report.getAllocatedPorts();
-      if (SliderUtils.isNotEmpty(ports)) {
-        processAllocatedPorts(heartBeat.getFqdn(), roleName, roleGroup, containerId, ports);
-      }
-      result = CommandResult.getCommandResult(report.getStatus());
-      Command command = Command.getCommand(report.getRoleCommand());
-      componentStatus.applyCommandResult(result, command, pkg);
-      log.info("Component operation. Status: {}; new container state: {};"
-          + " new component state: {}", result,
-          componentStatus.getContainerState(), componentStatus.getState());
-
-      if (command == Command.INSTALL && SliderUtils.isNotEmpty(report.getFolders())) {
-        publishFolderPaths(report.getFolders(), containerId, roleName, heartBeat.getFqdn());
-      }
-    }
-
-    int waitForCount = accessor.getInstanceDefinitionSnapshot().
-        getAppConfOperations().getComponentOptInt(roleGroup, AgentKeys.WAIT_HEARTBEAT, 0);
-
-    if (id < waitForCount) {
-      log.info("Waiting until heartbeat count {}. Current val: {}", waitForCount, id);
-      getComponentStatuses().put(label, componentStatus);
-      return response;
-    }
-
-    Command command = componentStatus.getNextCommand(doUpgrade);
-    try {
-      if (Command.NOP != command) {
-        log.debug("For comp {} pkg {} issuing {}", roleName,
-            componentStatus.getNextPkgToInstall(), command.toString());
-        if (command == Command.INSTALL) {
-          log.info("Installing {} on {}.", roleName, containerId);
-          if (isDockerContainer(roleGroup) || isYarnDockerContainer(roleGroup)){
-            addInstallDockerCommand(roleName, roleGroup, containerId,
-                response, null, timeout);
-          } else if (scriptPath != null) {
-            addInstallCommand(roleName, roleGroup, containerId, response,
-                scriptPath, null, timeout, null);
-          } else {
-            // commands
-            ComponentCommand installCmd = null;
-            for (ComponentCommand compCmd : commands) {
-              if (compCmd.getName().equals("INSTALL")) {
-                installCmd = compCmd;
-              }
-            }
-            addInstallCommand(roleName, roleGroup, containerId, response, null,
-                installCmd, timeout, null);
-          }
-          componentStatus.commandIssued(command);
-        } else if (command == Command.INSTALL_ADDON) {
-          String nextPkgToInstall = componentStatus.getNextPkgToInstall();
-          // retrieve scriptPath or command of that package for the component
-          for (ComponentsInAddonPackage comp : packageMetainfo
-              .get(nextPkgToInstall).getApplicationPackage().getComponents()) {
-            // given nextPkgToInstall and roleName is determined, the if below
-            // should only execute once per heartbeat
-            log.debug("Addon component: {} pkg: {} script: {}", comp.getName(),
-                nextPkgToInstall, comp.getCommandScript().getScript());
-            if (comp.getName().equals(roleGroup)
-                || comp.getName().equals(AgentKeys.ADDON_FOR_ALL_COMPONENTS)) {
-              scriptPath = comp.getCommandScript().getScript();
-              if (scriptPath != null) {
-                addInstallCommand(roleName, roleGroup, containerId, response,
-                    scriptPath, null, timeout, nextPkgToInstall);
-              } else {
-                ComponentCommand installCmd = null;
-                for (ComponentCommand compCmd : comp.getCommands()) {
-                  if (compCmd.getName().equals("INSTALL")) {
-                    installCmd = compCmd;
-                  }
-                }
-                addInstallCommand(roleName, roleGroup, containerId, response,
-                    null, installCmd, timeout, nextPkgToInstall);
-              }
-            }
-          }
-          componentStatus.commandIssued(command);
-        } else if (command == Command.START) {
-          // check against dependencies
-          boolean canExecute = commandOrder.canExecute(roleGroup, command, getComponentStatuses().values());
-          if (canExecute) {
-            log.info("Starting {} on {}.", roleName, containerId);
-            if (isDockerContainer(roleGroup) || isYarnDockerContainer(roleGroup)){
-              addStartDockerCommand(roleName, roleGroup, containerId,
-                  response, null, timeout, false);
-            } else if (scriptPath != null) {
-              addStartCommand(roleName,
-                              roleGroup,
-                              containerId,
-                              response,
-                              scriptPath,
-                              null,
-                              null,
-                              timeout,
-                              isMarkedAutoRestart(roleGroup));
-            } else {
-              ComponentCommand startCmd = null;
-              for (ComponentCommand compCmd : commands) {
-                if (compCmd.getName().equals("START")) {
-                  startCmd = compCmd;
-                }
-              }
-              ComponentCommand stopCmd = null;
-              for (ComponentCommand compCmd : commands) {
-                if (compCmd.getName().equals("STOP")) {
-                  stopCmd = compCmd;
-                }
-              }
-              addStartCommand(roleName, roleGroup, containerId, response, null,
-                  startCmd, stopCmd, timeout, false);
-            }
-            componentStatus.commandIssued(command);
-          } else {
-            log.info("Start of {} on {} delayed as dependencies have not started.", roleName, containerId);
-          }
-        } else if (command == Command.UPGRADE) {
-          addUpgradeCommand(roleName, roleGroup, containerId, response,
-              scriptPath, timeout);
-          componentStatus.commandIssued(command, true);
-        } else if (command == Command.STOP) {
-          log.info("Stop command being sent to container with id {}",
-              containerId);
-          addStopCommand(roleName, roleGroup, containerId, response, scriptPath,
-              timeout, doUpgrade);
-          componentStatus.commandIssued(command);
-        } else if (command == Command.TERMINATE) {
-          log.info("A formal terminate command is being sent to container {}"
-              + " in state {}", label, componentStatus.getState());
-          response.setTerminateAgent(true);
-        }
-      }
-
-      // if there is no outstanding command then retrieve config
-      if (isMaster && componentStatus.getState() == State.STARTED
-          && command == Command.NOP) {
-        if (!componentStatus.getConfigReported()) {
-          log.info("Requesting applied config for {} on {}.", roleName, containerId);
-          if (isDockerContainer(roleGroup) || isYarnDockerContainer(roleGroup)){
-            addGetConfigDockerCommand(roleName, roleGroup, containerId, response);
-          } else {
-            addGetConfigCommand(roleName, roleGroup, containerId, response);
-          }
-        }
-      }
-      
-      // if restart is required then signal
-      response.setRestartEnabled(false);
-      if (componentStatus.getState() == State.STARTED
-          && command == Command.NOP && isMarkedAutoRestart(roleGroup)) {
-        response.setRestartEnabled(true);
-      }
-
-      //If INSTALL_FAILED and no INSTALL is scheduled let the agent fail
-      if (componentStatus.getState() == State.INSTALL_FAILED
-         && command == Command.NOP) {
-        log.warn("Sending terminate signal to container that failed installation: {}", label);
-        response.setTerminateAgent(true);
-      }
-
-    } catch (SliderException e) {
-      log.warn("Component instance failed operation.", e);
-      componentStatus.applyCommandResult(CommandResult.FAILED, command, null);
-    }
-
-    log.debug("Heartbeat response: " + response);
-    return response;
-  }
-
-  private boolean isDockerContainer(String roleGroup) {
-    String type = getApplicationComponent(roleGroup).getType();
-    if (SliderUtils.isSet(type)) {
-      return type.toLowerCase().equals(SliderUtils.DOCKER) || type.toLowerCase().equals(SliderUtils.DOCKER_YARN);
-    }
-    return false;
-  }
-
-  private boolean isYarnDockerContainer(String roleGroup) {
-    String type = getApplicationComponent(roleGroup).getType();
-    if (SliderUtils.isSet(type)) {
-      return type.toLowerCase().equals(SliderUtils.DOCKER_YARN);
-    }
-    return false;
-  }
-
-  protected void processAllocatedPorts(String fqdn,
-                                       String roleName,
-                                       String roleGroup,
-                                       String containerId,
-                                       Map<String, String> ports) {
-    RoleInstance instance;
-    try {
-      instance = getAmState().getOwnedContainer(containerId);
-    } catch (NoSuchNodeException e) {
-      log.warn("Failed to locate instance of container {}", containerId, e);
-      instance = null;
-    }
-    for (Map.Entry<String, String> port : ports.entrySet()) {
-      String portname = port.getKey();
-      String portNo = port.getValue();
-      log.info("Recording allocated port for {} as {}", portname, portNo);
-
-      // add the allocated ports to the global list as well as per container list
-      // per container allocation will over-write each other in the global
-      this.getAllocatedPorts().put(portname, portNo);
-      this.getAllocatedPorts(containerId).put(portname, portNo);
-      if (instance != null) {
-        try {
-          // if the returned value is not a single port number then there are no
-          // meaningful way for Slider to use it during export
-          // No need to error out as it may not be the responsibility of the component
-          // to allocate port or the component may need an array of ports
-          instance.registerPortEndpoint(Integer.valueOf(portNo), portname);
-        } catch (NumberFormatException e) {
-          log.warn("Failed to parse {}", portNo, e);
-        }
-      }
-    }
-
-    processAndPublishComponentSpecificData(ports, containerId, fqdn, roleGroup);
-    processAndPublishComponentSpecificExports(ports, containerId, fqdn, roleName, roleGroup);
-
-    // and update registration entries
-    if (instance != null) {
-      queueAccess.put(new RegisterComponentInstance(instance.getId(),
-          roleName, roleGroup, 0, TimeUnit.MILLISECONDS));
-    }
-  }
-
-  private void updateComponentStatusWithAgentState(
-      ComponentInstanceState componentStatus, State agentState) {
-    if (agentState != null) {
-      componentStatus.setState(agentState);
-    }
-  }
-
-  @Override
-  public Map<String, MonitorDetail> buildMonitorDetails(ClusterDescription clusterDesc) {
-    Map<String, MonitorDetail> details = super.buildMonitorDetails(clusterDesc);
-    buildRoleHostDetails(details);
-    return details;
-  }
-
-  @Override
-  public void applyInitialRegistryDefinitions(URL amWebURI,
-      URL agentOpsURI,
-      URL agentStatusURI,
-      ServiceRecord serviceRecord)
-    throws IOException {
-    super.applyInitialRegistryDefinitions(amWebURI,
-                                          agentOpsURI,
-                                          agentStatusURI,
-                                          serviceRecord);
-
-    try {
-      URL restURL = new URL(agentOpsURI, SLIDER_PATH_AGENTS);
-      URL agentStatusURL = new URL(agentStatusURI, SLIDER_PATH_AGENTS);
-
-      serviceRecord.addInternalEndpoint(
-          new Endpoint(CustomRegistryConstants.AGENT_SECURE_REST_API,
-                       ProtocolTypes.PROTOCOL_REST,
-                       restURL.toURI()));
-      serviceRecord.addInternalEndpoint(
-          new Endpoint(CustomRegistryConstants.AGENT_ONEWAY_REST_API,
-                       ProtocolTypes.PROTOCOL_REST,
-                       agentStatusURL.toURI()));
-    } catch (URISyntaxException e) {
-      throw new IOException(e);
-    }
-
-    // identify client component
-    Component client = null;
-    for (Component component : getMetaInfo(null).getApplication()
-        .getComponents()) {
-      if (component.getCategory().equals("CLIENT")) {
-        client = component;
-        break;
-      }
-    }
-    if (client == null) {
-      log.info("No client component specified, not publishing client configs");
-      return;
-    }
-
-    // register AM-generated client configs
-    ConfTreeOperations appConf = getAmState().getAppConfSnapshot();
-    MapOperations clientOperations = appConf.getOrAddComponent(client.getName());
-    appConf.resolve();
-    if (!clientOperations.getOptionBool(AgentKeys.AM_CONFIG_GENERATION,
-        false)) {
-      log.info("AM config generation is false, not publishing client configs");
-      return;
-    }
-
-    // build and localize configuration files
-    Map<String, Map<String, String>> configurations = new TreeMap<String, Map<String, String>>();
-    Map<String, String> tokens = null;
-    try {
-      tokens = getStandardTokenMap(appConf, client.getName(), client.getName());
-    } catch (SliderException e) {
-      throw new IOException(e);
-    }
-
-    for (ConfigFile configFile : getMetaInfo(null)
-        .getComponentConfigFiles(client.getName())) {
-      addNamedConfiguration(configFile.getDictionaryName(),
-          appConf.getGlobalOptions().options, configurations, tokens, null,
-          client.getName(), client.getName());
-      if (appConf.getComponent(client.getName()) != null) {
-        addNamedConfiguration(configFile.getDictionaryName(),
-            appConf.getComponent(client.getName()).options, configurations,
-            tokens, null, client.getName(), client.getName());
-      }
-    }
-
-    //do a final replacement of re-used configs
-    dereferenceAllConfigs(configurations);
-
-    for (ConfigFile configFile : getMetaInfo(null)
-        .getComponentConfigFiles(client.getName())) {
-      ConfigFormat configFormat = ConfigFormat.resolve(configFile.getType());
-
-      Map<String, String> config = configurations.get(configFile.getDictionaryName());
-      ConfigUtils.prepConfigForTemplateOutputter(configFormat, config,
-          fileSystem, getClusterName(),
-          new File(configFile.getFileName()).getName());
-      PublishedConfiguration publishedConfiguration =
-          new PublishedConfiguration(configFile.getDictionaryName(),
-              config.entrySet());
-      getAmState().getPublishedSliderConfigurations().put(
-          configFile.getDictionaryName(), publishedConfiguration);
-      log.info("Publishing AM configuration {}", configFile.getDictionaryName());
-    }
-  }
-
-  @Override
-  public void notifyContainerCompleted(ContainerId containerId) {
-    // containers get allocated and free'ed without being assigned to any
-    // component - so many of the data structures may not be initialized
-    if (containerId != null) {
-      String containerIdStr = containerId.toString();
-      if (getComponentInstanceData().containsKey(containerIdStr)) {
-        getComponentInstanceData().remove(containerIdStr);
-        log.info("Removing container specific data for {}", containerIdStr);
-        publishComponentInstanceData();
-      }
-
-      if (this.allocatedPorts.containsKey(containerIdStr)) {
-        Map<String, String> portsByContainerId = getAllocatedPorts(containerIdStr);
-        this.allocatedPorts.remove(containerIdStr);
-        // free up the allocations from global as well
-        // if multiple containers allocate global ports then last one
-        // wins and similarly first one removes it - its not supported anyway
-        for(String portName : portsByContainerId.keySet()) {
-          getAllocatedPorts().remove(portName);
-        }
-
-      }
-
-      String componentName = null;
-      synchronized (this.componentStatuses) {
-        for (String label : getComponentStatuses().keySet()) {
-          if (label.startsWith(containerIdStr)) {
-            componentName = getRoleName(label);
-            log.info("Removing component status for label {}", label);
-            getComponentStatuses().remove(label);
-          }
-        }
-      }
-
-      tags.releaseTag(componentName, containerIdStr);
-
-      synchronized (this.containerExportsMap) {
-        Set<String> containerExportSets = containerExportsMap.get(containerIdStr);
-        if (containerExportSets != null) {
-          for (String containerExportStr : containerExportSets) {
-            String[] parts = containerExportStr.split(":");
-            Map<String, List<ExportEntry>> exportGroup = getCurrentExports(parts[0]);
-            List<ExportEntry> exports = exportGroup.get(parts[1]);
-            List<ExportEntry> exportToRemove = new ArrayList<ExportEntry>();
-            for (ExportEntry export : exports) {
-              if (containerIdStr.equals(export.getContainerId())) {
-                exportToRemove.add(export);
-              }
-            }
-            exports.removeAll(exportToRemove);
-          }
-          log.info("Removing container exports for {}", containerIdStr);
-          containerExportsMap.remove(containerIdStr);
-        }
-      }
-    }
-  }
-
-  /**
-   * Reads and sets the heartbeat monitoring interval. If bad value is provided then log it and set to default.
-   *
-   * @param instanceDefinition
-   */
-  private void readAndSetHeartbeatMonitoringInterval(AggregateConf instanceDefinition) {
-    String hbMonitorInterval = instanceDefinition.getAppConfOperations().
-        getGlobalOptions().getOption(AgentKeys.HEARTBEAT_MONITOR_INTERVAL,
-                                     Integer.toString(DEFAULT_HEARTBEAT_MONITOR_INTERVAL));
-    try {
-      setHeartbeatMonitorInterval(Integer.parseInt(hbMonitorInterval));
-    } catch (NumberFormatException e) {
-      log.warn(
-          "Bad value {} for {}. Defaulting to ",
-          hbMonitorInterval,
-          HEARTBEAT_MONITOR_INTERVAL,
-          DEFAULT_HEARTBEAT_MONITOR_INTERVAL);
-    }
-  }
-
-  /**
-   * Reads and sets the heartbeat monitoring interval. If bad value is provided then log it and set to default.
-   *
-   * @param instanceDefinition
-   */
-  private void initializeAgentDebugCommands(AggregateConf instanceDefinition) {
-    String launchParameterStr = instanceDefinition.getAppConfOperations().
-        getGlobalOptions().getOption(AgentKeys.AGENT_INSTANCE_DEBUG_DATA, "");
-    agentLaunchParameter = new AgentLaunchParameter(launchParameterStr);
-  }
-
-  @VisibleForTesting
-  protected Map<String, ExportEntry> getLogFolderExports() {
-    return logFolderExports;
-  }
-
-  @VisibleForTesting
-  protected Map<String, ExportEntry> getWorkFolderExports() {
-    return workFolderExports;
-  }
-
-  @VisibleForTesting
-  protected Metainfo getMetaInfo(String roleGroup) {
-    String mapKey = DEFAULT_METAINFO_MAP_KEY;
-    if (roleGroup != null) {
-      ConfTreeOperations appConf = getAmState().getAppConfSnapshot();
-      mapKey = appConf.getComponentOpt(roleGroup, ROLE_PREFIX,
-          DEFAULT_METAINFO_MAP_KEY);
-    }
-    MetainfoHolder mh = this.metaInfoMap.get(mapKey);
-    if (mh == null) {
-      return null;
-    }
-    return mh.metaInfo;
-  }
-
-  @VisibleForTesting
-  protected Map<String, ComponentInstanceState> getComponentStatuses() {
-    return componentStatuses;
-  }
-
-  @VisibleForTesting
-  protected Metainfo getApplicationMetainfo(SliderFileSystem fileSystem,
-      String appDef, boolean addonPackage) throws IOException,
-      BadConfigException {
-    return AgentUtils.getApplicationMetainfo(fileSystem, appDef, addonPackage);
-  }
-
-  @VisibleForTesting
-  protected Metainfo getApplicationMetainfo(SliderFileSystem fileSystem,
-      String appDef) throws IOException, BadConfigException {
-    return getApplicationMetainfo(fileSystem, appDef, false);
-  }
-
-  @VisibleForTesting
-  protected void setHeartbeatMonitorInterval(int heartbeatMonitorInterval) {
-    this.heartbeatMonitorInterval = heartbeatMonitorInterval;
-  }
-
-  public void setInUpgradeMode(boolean inUpgradeMode) {
-    this.isInUpgradeMode = inUpgradeMode;
-  }
-
-  public void addUpgradeContainers(Set<String> upgradeContainers) {
-    this.upgradeContainers.addAll(upgradeContainers);
-  }
-
-  public void setAppStopInitiated(boolean appStopInitiated) {
-    this.appStopInitiated = appStopInitiated;
-  }
-
-  /**
-   * Read all default configs
-   *
-   * @param fileSystem fs
-   * @param appDef app default path
-   * @param metainfo metadata
-   *
-   * @return configuration maps
-   * 
-   * @throws IOException
-   */
-  protected Map<String, DefaultConfig> initializeDefaultConfigs(SliderFileSystem fileSystem,
-                                                                String appDef, Metainfo metainfo) throws IOException {
-    Map<String, DefaultConfig> defaultConfigMap = new HashMap<>();
-    if (SliderUtils.isNotEmpty(metainfo.getApplication().getConfigFiles())) {
-      for (ConfigFile configFile : metainfo.getApplication().getConfigFiles()) {
-        DefaultConfig config = null;
-        try {
-          config = AgentUtils.getDefaultConfig(fileSystem, appDef, configFile.getDictionaryName() + ".xml");
-        } catch (IOException e) {
-          log.warn("Default config file not found. Only the config as input during create will be applied for {}",
-                   configFile.getDictionaryName());
-        }
-        if (config != null) {
-          defaultConfigMap.put(configFile.getDictionaryName(), config);
-        }
-      }
-    }
-
-    return defaultConfigMap;
-  }
-
-  protected Map<String, DefaultConfig> getDefaultConfigs(String roleGroup) {
-    ConfTreeOperations appConf = getAmState().getAppConfSnapshot();
-    String mapKey = appConf.getComponentOpt(roleGroup, ROLE_PREFIX,
-        DEFAULT_METAINFO_MAP_KEY);
-    return metaInfoMap.get(mapKey).defaultConfigs;
-  }
-
-  private int getHeartbeatMonitorInterval() {
-    return this.heartbeatMonitorInterval;
-  }
-
-  private String getClusterName() {
-    if (SliderUtils.isUnset(clusterName)) {
-      clusterName = getAmState().getInternalsSnapshot().get(OptionKeys.APPLICATION_NAME);
-    }
-    return clusterName;
-  }
-
-  /**
-   * Publish a named property bag that may contain name-value pairs for app configurations such as hbase-site
-   *
-   * @param name
-   * @param description
-   * @param entries
-   */
-  protected void publishApplicationInstanceData(String name, String description,
-                                                Iterable<Map.Entry<String, String>> entries) {
-    PublishedConfiguration pubconf = new PublishedConfiguration();
-    pubconf.description = description;
-    pubconf.putValues(entries);
-    log.info("publishing {}", pubconf);
-    getAmState().getPublishedSliderConfigurations().put(name, pubconf);
-  }
-
-  /**
-   * Get a list of all hosts for all role/container per role
-   *
-   * @return the map of role->node
-   */
-  protected Map<String, Map<String, ClusterNode>> getRoleClusterNodeMapping() {
-    return amState.getRoleClusterNodeMapping();
-  }
-
-  private String getContainerLabel(Container container, String role, String group) {
-    if (role.equals(group)) {
-      return container.getId().toString() + LABEL_MAKER + role;
-    } else {
-      return container.getId().toString() + LABEL_MAKER + role + LABEL_MAKER +
-          group;
-    }
-  }
-
-  protected String getClusterInfoPropertyValue(String name) {
-    StateAccessForProviders accessor = getAmState();
-    assert accessor.isApplicationLive();
-    ClusterDescription description = accessor.getClusterStatus();
-    return description.getInfo(name);
-  }
-
-  protected String getClusterOptionPropertyValue(String name)
-      throws BadConfigException {
-    StateAccessForProviders accessor = getAmState();
-    assert accessor.isApplicationLive();
-    ClusterDescription description = accessor.getClusterStatus();
-    return description.getMandatoryOption(name);
-  }
-
-  /**
-   * Lost heartbeat from the container - release it and ask for a replacement (async operation)
-   *
-   * @param label
-   * @param containerId
-   */
-  protected void lostContainer(
-      String label,
-      ContainerId containerId) {
-    getComponentStatuses().remove(label);
-    getQueueAccess().put(new ProviderReportedContainerLoss(containerId));
-  }
-
-  /**
-   * Build the provider status, can be empty
-   *
-   * @return the provider status - map of entries to add to the info section
-   */
-  public Map<String, String> buildProviderStatus() {
-    Map<String, String> stats = new HashMap<String, String>();
-    return stats;
-  }
-
-
-  /**
-   * Format the folder locations and publish in the registry service
-   *
-   * @param folders
-   * @param containerId
-   * @param hostFqdn
-   * @param componentName
-   */
-  protected void publishFolderPaths(
-      Map<String, String> folders, String containerId, String componentName, String hostFqdn) {
-    Date now = new Date();
-    for (Map.Entry<String, String> entry : folders.entrySet()) {
-      ExportEntry exportEntry = new ExportEntry();
-      exportEntry.setValue(String.format(HOST_FOLDER_FORMAT, hostFqdn, entry.getValue()));
-      exportEntry.setContainerId(containerId);
-      exportEntry.setLevel(COMPONENT_TAG);
-      exportEntry.setTag(componentName);
-      exportEntry.setUpdatedTime(now.toString());
-      if (entry.getKey().equals("AGENT_LOG_ROOT")) {
-        synchronized (logFolderExports) {
-          getLogFolderExports().put(containerId, exportEntry);
-        }
-      } else {
-        synchronized (workFolderExports) {
-          getWorkFolderExports().put(containerId, exportEntry);
-        }
-      }
-      log.info("Updating log and pwd folders for container {}", containerId);
-    }
-
-    PublishedExports exports = new PublishedExports(CONTAINER_LOGS_TAG);
-    exports.setUpdated(now.getTime());
-    synchronized (logFolderExports) {
-      updateExportsFromList(exports, getLogFolderExports());
-    }
-    getAmState().getPublishedExportsSet().put(CONTAINER_LOGS_TAG, exports);
-
-    exports = new PublishedExports(CONTAINER_PWDS_TAG);
-    exports.setUpdated(now.getTime());
-    synchronized (workFolderExports) {
-      updateExportsFromList(exports, getWorkFolderExports());
-    }
-    getAmState().getPublishedExportsSet().put(CONTAINER_PWDS_TAG, exports);
-  }
-
-  /**
-   * Update the export data from the map
-   * @param exports
-   * @param folderExports
-   */
-  private void updateExportsFromList(PublishedExports exports, Map<String, ExportEntry> folderExports) {
-    Map<String, List<ExportEntry>> perComponentList = new HashMap<String, List<ExportEntry>>();
-    for(Map.Entry<String, ExportEntry> logEntry : folderExports.entrySet())
-    {
-      String componentName = logEntry.getValue().getTag();
-      if (!perComponentList.containsKey(componentName)) {
-        perComponentList.put(componentName, new ArrayList<ExportEntry>());
-      }
-      perComponentList.get(componentName).add(logEntry.getValue());
-    }
-    exports.putValues(perComponentList.entrySet());
-  }
-
-
-  /**
-   * Process return status for component instances
-   *
-   * @param heartBeat
-   * @param componentStatus
-   */
-  protected void publishConfigAndExportGroups(HeartBeat heartBeat,
-      ComponentInstanceState componentStatus, String componentGroup) {
-    List<ComponentStatus> statuses = heartBeat.getComponentStatus();
-    if (statuses != null && !statuses.isEmpty()) {
-      log.info("Processing {} status reports.", statuses.size());
-      for (ComponentStatus status : statuses) {
-        log.info("Status report: {}", status.toString());
-
-        if (status.getConfigs() != null) {
-          Application application = getMetaInfo(componentGroup).getApplication();
-
-          if ((!canAnyMasterPublishConfig(componentGroup) || canPublishConfig(componentGroup)) &&
-              !getAmState().getAppConfSnapshot().getComponentOptBool(
-                  componentGroup, AgentKeys.AM_CONFIG_GENERATION, false)) {
-            // If no Master can explicitly publish then publish if its a master
-            // Otherwise, wait till the master that can publish is ready
-
-            Set<String> exportedConfigs = new HashSet();
-            String exportedConfigsStr = application.getExportedConfigs();
-            boolean exportedAllConfigs = exportedConfigsStr == null || exportedConfigsStr.isEmpty();
-            if (!exportedAllConfigs) {
-              for (String exportedConfig : exportedConfigsStr.split(",")) {
-                if (exportedConfig.trim().length() > 0) {
-                  exportedConfigs.add(exportedConfig.trim());
-                }
-              }
-            }
-
-            for (String key : status.getConfigs().keySet()) {
-              if ((!exportedAllConfigs && exportedConfigs.contains(key)) ||
-                  exportedAllConfigs) {
-                Map<String, String> configs = status.getConfigs().get(key);
-                publishApplicationInstanceData(key, key, configs.entrySet());
-              }
-            }
-          }
-
-          List<ExportGroup> appExportGroups = application.getExportGroups();
-          boolean hasExportGroups = SliderUtils.isNotEmpty(appExportGroups);
-
-          Set<String> appExports = new HashSet();
-          String appExportsStr = getApplicationComponent(componentGroup).getAppExports();
-          if (SliderUtils.isSet(appExportsStr)) {
-            for (String appExport : appExportsStr.split(",")) {
-              if (!appExport.trim().isEmpty()) {
-                appExports.add(appExport.trim());
-              }
-            }
-          }
-
-          if (hasExportGroups && !appExports.isEmpty()) {
-            String configKeyFormat = "${site.%s.%s}";
-            String hostKeyFormat = "${%s_HOST}";
-
-            // publish export groups if any
-            Map<String, String> replaceTokens = new HashMap<String, String>();
-            for (Map.Entry<String, Map<String, ClusterNode>> entry : getRoleClusterNodeMapping().entrySet()) {
-              String hostName = getHostsList(entry.getValue().values(), true).iterator().next();
-              replaceTokens.put(String.format(hostKeyFormat, entry.getKey().toUpperCase(Locale.ENGLISH)), hostName);
-            }
-
-            for (String key : status.getConfigs().keySet()) {
-              Map<String, String> configs = status.getConfigs().get(key);
-              for (String configKey : configs.keySet()) {
-                String lookupKey = String.format(configKeyFormat, key, configKey);
-                replaceTokens.put(lookupKey, configs.get(configKey));
-              }
-            }
-
-            Set<String> modifiedGroups = new HashSet<String>();
-            for (ExportGroup exportGroup : appExportGroups) {
-              List<Export> exports = exportGroup.getExports();
-              if (SliderUtils.isNotEmpty(exports)) {
-                String exportGroupName = exportGroup.getName();
-                ConcurrentHashMap<String, List<ExportEntry>> map =
-                    (ConcurrentHashMap<String, List<ExportEntry>>)getCurrentExports(exportGroupName);
-                for (Export export : exports) {
-                  if (canBeExported(exportGroupName, export.getName(), appExports)) {
-                    String value = export.getValue();
-                    // replace host names
-                    for (String token : replaceTokens.keySet()) {
-                      if (value.contains(token)) {
-                        value = value.replace(token, replaceTokens.get(token));
-                      }
-                    }
-                    ExportEntry entry = new ExportEntry();
-                    entry.setLevel(APPLICATION_TAG);
-                    entry.setValue(value);
-                    entry.setUpdatedTime(new Date().toString());
-                    // over-write, app exports are singletons
-                    map.put(export.getName(), new ArrayList(Arrays.asList(entry)));
-                    log.info("Preparing to publish. Key {} and Value {}", export.getName(), value);
-                  }
-                }
-                modifiedGroups.add(exportGroupName);
-              }
-            }
-            publishModifiedExportGroups(modifiedGroups);
-          }
-
-          log.info("Received and processed config for {}", heartBeat.getHostname());
-          componentStatus.setConfigReported(true);
-
-        }
-      }
-    }
-  }
-
-  private boolean canBeExported(String exportGroupName, String name, Set<String> appExports) {
-    return appExports.contains(String.format("%s-%s", exportGroupName, name));
-  }
-
-  protected Map<String, List<ExportEntry>> getCurrentExports(String groupName) {
-    if (!this.exportGroups.containsKey(groupName)) {
-      synchronized (this.exportGroups) {
-        if (!this.exportGroups.containsKey(groupName)) {
-          this.exportGroups.put(groupName, new ConcurrentHashMap<String, List<ExportEntry>>());
-        }
-      }
-    }
-
-    return this.exportGroups.get(groupName);
-  }
-
-  private void publishModifiedExportGroups(Set<String> modifiedGroups) {
-    for (String groupName : modifiedGroups) {
-      Map<String, List<ExportEntry>> entries = this.exportGroups.get(groupName);
-
-      // Publish in old format for the time being
-      Map<String, String> simpleEntries = new HashMap<String, String>();
-      for (Map.Entry<String, List<ExportEntry>> entry : entries.entrySet()) {
-        List<ExportEntry> exports = entry.getValue();
-        if (SliderUtils.isNotEmpty(exports)) {
-          // there is no support for multiple exports per name - so extract only the first one
-          simpleEntries.put(entry.getKey(), entry.getValue().get(0).getValue());
-        }
-      }
-      if (!getAmState().getAppConfSnapshot().getComponentOptBool(
-          groupName, AgentKeys.AM_CONFIG_GENERATION, false)) {
-        publishApplicationInstanceData(groupName, groupName,
-            simpleEntries.entrySet());
-      }
-
-      PublishedExports exports = new PublishedExports(groupName);
-      exports.setUpdated(new Date().getTime());
-      exports.putValues(entries.entrySet());
-      getAmState().getPublishedExportsSet().put(groupName, exports);
-    }
-  }
-
-  /** Publish component instance specific data if the component demands it */
-  protected void processAndPublishComponentSpecificData(Map<String, String> ports,
-                                                        String containerId,
-                                                        String hostFqdn,
-                                                        String componentGroup) {
-    String portVarFormat = "${site.%s}";
-    String hostNamePattern = "${THIS_HOST}";
-    Map<String, String> toPublish = new HashMap<String, String>();
-
-    Application application = getMetaInfo(componentGroup).getApplication();
-    for (Component component : application.getComponents()) {
-      if (component.getName().equals(componentGroup)) {
-        if (component.getComponentExports().size() > 0) {
-
-          for (ComponentExport export : component.getComponentExports()) {
-            String templateToExport = export.getValue();
-            for (String portName : ports.keySet()) {
-              boolean publishData = false;
-              String portValPattern = String.format(portVarFormat, portName);
-              if (templateToExport.contains(portValPattern)) {
-                templateToExport = templateToExport.replace(portValPattern, ports.get(portName));
-                publishData = true;
-              }
-              if (templateToExport.contains(hostNamePattern)) {
-                templateToExport = templateToExport.replace(hostNamePattern, hostFqdn);
-                publishData = true;
-              }
-              if (publishData) {
-                toPublish.put(export.getName(), templateToExport);
-                log.info("Publishing {} for name {} and container {}",
-                         templateToExport, export.getName(), containerId);
-              }
-            }
-          }
-        }
-      }
-    }
-
-    if (toPublish.size() > 0) {
-      Map<String, String> perContainerData 

<TRUNCATED>


[32/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/exceptions/ExceptionConverter.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/exceptions/ExceptionConverter.java b/slider-core/src/main/java/org/apache/slider/core/exceptions/ExceptionConverter.java
deleted file mode 100644
index efec676..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/exceptions/ExceptionConverter.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import org.apache.hadoop.fs.InvalidRequestException;
-import org.apache.hadoop.fs.PathAccessDeniedException;
-import org.apache.hadoop.fs.PathIOException;
-import org.apache.hadoop.yarn.webapp.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-/**
- * static methods to convert exceptions into different types, including
- * extraction of details and finer-grained conversions.
- */
-public class ExceptionConverter {
-  private static final Logger
-      log = LoggerFactory.getLogger(ExceptionConverter.class);
-
-  /**
-   * Uprate error codes 400 and up into faults; 
-   * 404 is converted to a {@link FileNotFoundException},
-   * 401 to {@link ForbiddenException}
-   * FileNotFoundException for an unknown resource
-   * PathAccessDeniedException for access denied
-   * PathIOException for anything else
-   * @param verb HTTP Verb used
-   * @param targetURL URL being targeted 
-   * @param exception original exception
-   * @return a new exception, the original one nested as a cause
-   */
-  public static IOException convertJerseyException(String verb,
-      String targetURL,
-      UniformInterfaceException exception) {
-
-    IOException ioe = null;
-    ClientResponse response = exception.getResponse();
-    if (response != null) {
-      int status = response.getStatus();
-      String body = "";
-      try {
-        if (response.hasEntity()) {
-          body = response.getEntity(String.class);
-          log.error("{} {} returned status {} and body\n{}",
-              verb, targetURL, status, body);
-        } else {
-          log.error("{} {} returned status {} and empty body",
-              verb, targetURL, status);
-        }
-      } catch (Exception e) {
-        log.warn("Failed to extract body from client response", e);
-      }
-      
-      if (status == HttpServletResponse.SC_UNAUTHORIZED
-          || status == HttpServletResponse.SC_FORBIDDEN) {
-        ioe = new PathAccessDeniedException(targetURL);
-      } else if (status == HttpServletResponse.SC_BAD_REQUEST
-          || status == HttpServletResponse.SC_NOT_ACCEPTABLE
-          || status == HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE) {
-        // bad request
-        ioe = new InvalidRequestException(
-            String.format("Bad %s request: status code %d against %s",
-                verb, status, targetURL));
-      } else if (status > 400 && status < 500) {
-        ioe =  new FileNotFoundException(targetURL);
-      }
-      if (ioe == null) {
-        ioe = new PathIOException(targetURL,
-            verb + " " + targetURL
-            + " failed with status code : " + status
-            + ":" + exception);
-      }
-    } else {
-      ioe = new PathIOException(targetURL, 
-          verb + " " + targetURL + " failed: " + exception);
-    }
-    ioe.initCause(exception);
-    return ioe; 
-  }
-
-  /**
-   * Handle a client-side Jersey exception.
-   * <p>
-   * If there's an inner IOException, return that.
-   * <p>
-   * Otherwise: create a new wrapper IOE including verb and target details
-   * @param verb HTTP Verb used
-   * @param targetURL URL being targeted 
-   * @param exception original exception
-   * @return an exception to throw
-   */
-  public static IOException convertJerseyException(String verb,
-      String targetURL,
-      ClientHandlerException exception) {
-    if (exception.getCause() instanceof IOException) {
-      return (IOException)exception.getCause();
-    } else {
-      IOException ioe = new IOException(
-          verb + " " + targetURL + " failed: " + exception);
-      ioe.initCause(exception);
-      return ioe;
-    } 
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/exceptions/NoSuchNodeException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/exceptions/NoSuchNodeException.java b/slider-core/src/main/java/org/apache/slider/core/exceptions/NoSuchNodeException.java
deleted file mode 100644
index ad2f1a4..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/exceptions/NoSuchNodeException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-import java.io.IOException;
-
-/**
- * Exception raised when a node cannot be found in the structure
- * that is being examined.
- */
-public class NoSuchNodeException extends IOException {
-
-  public NoSuchNodeException(String uuid) {
-    super(uuid);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/exceptions/NotFoundException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/exceptions/NotFoundException.java b/slider-core/src/main/java/org/apache/slider/core/exceptions/NotFoundException.java
deleted file mode 100644
index 40cb94d..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/exceptions/NotFoundException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-
-/**
- * Whatever was being resolved: it was not found
- */
-public class NotFoundException extends SliderException {
-  public NotFoundException(String message,
-      Object... args) {
-    super(EXIT_NOT_FOUND, message, args);
-  }
-
-  public NotFoundException(Throwable throwable,
-      String message, Object... args) {
-    super(EXIT_NOT_FOUND, throwable, message, args);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/exceptions/ServiceNotReadyException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/exceptions/ServiceNotReadyException.java b/slider-core/src/main/java/org/apache/slider/core/exceptions/ServiceNotReadyException.java
deleted file mode 100644
index 435bc1a..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/exceptions/ServiceNotReadyException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-import java.io.IOException;
-
-/**
- * This is an exception raised when the service does not consider itself
- * live (yet)
- */
-public class ServiceNotReadyException extends IOException {
-
-  public static final String E_NOT_READY =
-      "Service not ready for access: please retry";
-
-  public ServiceNotReadyException(String message) {
-    super(message);
-  }
-
-  public ServiceNotReadyException(String message, Throwable cause) {
-    super(message, cause);
-  }
-
-  public ServiceNotReadyException(Throwable cause) {
-    super(cause);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/exceptions/SliderException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/exceptions/SliderException.java b/slider-core/src/main/java/org/apache/slider/core/exceptions/SliderException.java
deleted file mode 100644
index 7f3134a..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/exceptions/SliderException.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-import org.apache.slider.common.SliderExitCodes;
-import org.apache.slider.core.main.ServiceLaunchException;
-
-public class SliderException extends ServiceLaunchException implements
-    SliderExitCodes {
-  public SliderException() {
-    super(EXIT_EXCEPTION_THROWN, "SliderException");
-  }
-
-  public SliderException(int code, String message) {
-    super(code, message);
-  }
-
-  public SliderException(String s) {
-    super(EXIT_EXCEPTION_THROWN, s);
-  }
-
-  public SliderException(String s, Throwable throwable) {
-    super(EXIT_EXCEPTION_THROWN, s, throwable);
-  }
-
-  /**
-   * Format the exception as you create it
-   * @param code exit code
-   * @param message exception message -sprintf formatted
-   * @param args arguments for the formatting
-   */
-  public SliderException(int code, String message, Object... args) {
-    super(code, String.format(message, args));
-  }
-
-  /**
-   * Format the exception, include a throwable. 
-   * The throwable comes before the message so that it is out of the varargs
-   * @param code exit code
-   * @param throwable thrown
-   * @param message message
-   * @param args arguments
-   */
-  public SliderException(int code,
-      Throwable throwable,
-      String message,
-      Object... args) {
-    super(code, String.format(message, args), throwable);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/exceptions/SliderInternalStateException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/exceptions/SliderInternalStateException.java b/slider-core/src/main/java/org/apache/slider/core/exceptions/SliderInternalStateException.java
deleted file mode 100644
index deddbbc..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/exceptions/SliderInternalStateException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-public class SliderInternalStateException extends SliderException {
-  public SliderInternalStateException(String s) {
-    super(EXIT_INTERNAL_ERROR, s);
-  }
-
-  public SliderInternalStateException(String s, Throwable throwable) {
-    super(EXIT_INTERNAL_ERROR, throwable, s);
-  }
-
-  public SliderInternalStateException(String message,
-      Object... args) {
-    super(EXIT_INTERNAL_ERROR, message, args);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/exceptions/TriggerClusterTeardownException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/exceptions/TriggerClusterTeardownException.java b/slider-core/src/main/java/org/apache/slider/core/exceptions/TriggerClusterTeardownException.java
deleted file mode 100644
index bb9f430..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/exceptions/TriggerClusterTeardownException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
-
-/**
- * An Exception to be thrown for an explicit "shut down the cluster" operation
- * raised by the application state or other parts of the AM
- */
-public class TriggerClusterTeardownException extends SliderException {
-
-  private final FinalApplicationStatus finalApplicationStatus;
-  
-  public TriggerClusterTeardownException(int code,
-      FinalApplicationStatus finalApplicationStatus, String message,
-      Object... args) {
-    super(code, message, args);
-    this.finalApplicationStatus = finalApplicationStatus;
-  }
-
-  public FinalApplicationStatus getFinalApplicationStatus() {
-    return finalApplicationStatus;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/exceptions/UnknownApplicationInstanceException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/exceptions/UnknownApplicationInstanceException.java b/slider-core/src/main/java/org/apache/slider/core/exceptions/UnknownApplicationInstanceException.java
deleted file mode 100644
index a1f8ae9..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/exceptions/UnknownApplicationInstanceException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-public class UnknownApplicationInstanceException extends SliderException {
-  public UnknownApplicationInstanceException(String s) {
-    super(EXIT_UNKNOWN_INSTANCE, s);
-  }
-
-  public UnknownApplicationInstanceException(String s, Throwable throwable) {
-    super(EXIT_UNKNOWN_INSTANCE, throwable, s);
-  }
-
-  public UnknownApplicationInstanceException(String message,
-      Object... args) {
-    super(EXIT_UNKNOWN_INSTANCE, message, args);
-  }
-
-  /**
-   * Create an instance with the standard exception name
-   * @param name name
-   * @return an instance to throw
-   */
-  public static UnknownApplicationInstanceException unknownInstance(String name) {
-    return new UnknownApplicationInstanceException(ErrorStrings.E_UNKNOWN_INSTANCE
-                                   + ": " + name);
-  }
-  public static UnknownApplicationInstanceException unknownInstance(String name,
-      Throwable throwable) {
-    UnknownApplicationInstanceException exception =
-      unknownInstance(name);
-    exception.initCause(throwable);
-    return exception;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/exceptions/UsageException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/exceptions/UsageException.java b/slider-core/src/main/java/org/apache/slider/core/exceptions/UsageException.java
deleted file mode 100644
index 8684294..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/exceptions/UsageException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-/**
- * Used to raise a usage exception ... this has the exit code
- * {@link #EXIT_USAGE}
- */
-public class UsageException extends SliderException {
-  public UsageException(String s, Object... args) {
-    super(EXIT_USAGE, s, args);
-  }
-
-  public UsageException(Throwable throwable, String message,
-      Object... args) {
-    super(EXIT_USAGE, throwable, message, args);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/exceptions/WaitTimeoutException.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/exceptions/WaitTimeoutException.java b/slider-core/src/main/java/org/apache/slider/core/exceptions/WaitTimeoutException.java
deleted file mode 100644
index 5ad3fdc..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/exceptions/WaitTimeoutException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-import java.io.IOException;
-
-/**
- * Called when some spinning operation timed out
- */
-public class WaitTimeoutException extends IOException {
-  public WaitTimeoutException(String message) {
-    super(message);
-  }
-
-  public WaitTimeoutException(String message, Throwable cause) {
-    super(message, cause);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/launch/AbstractLauncher.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/launch/AbstractLauncher.java b/slider-core/src/main/java/org/apache/slider/core/launch/AbstractLauncher.java
deleted file mode 100644
index 5a3eb3d..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/launch/AbstractLauncher.java
+++ /dev/null
@@ -1,528 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.launch;
-
-import com.google.common.base.Preconditions;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.conf.Configured;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.security.Credentials;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
-import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
-import org.apache.hadoop.yarn.api.records.LocalResource;
-import org.apache.hadoop.yarn.api.records.LogAggregationContext;
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.util.Records;
-import org.apache.slider.api.ResourceKeys;
-import org.apache.slider.api.RoleKeys;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.tools.CoreFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.conf.MapOperations;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-import java.io.File;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * Launcher of applications: base class
- */
-public abstract class AbstractLauncher extends Configured {
-  private static final Logger log =
-    LoggerFactory.getLogger(AbstractLauncher.class);
-  public static final String CLASSPATH = "CLASSPATH";
-  /**
-   * Filesystem to use for the launch
-   */
-  protected final CoreFileSystem coreFileSystem;
-  /**
-   * Env vars; set up at final launch stage
-   */
-  protected final Map<String, String> envVars = new HashMap<>();
-  protected final MapOperations env = new MapOperations("env", envVars);
-  protected final ContainerLaunchContext containerLaunchContext =
-    Records.newRecord(ContainerLaunchContext.class);
-  protected final List<String> commands = new ArrayList<>(20);
-  protected final Map<String, LocalResource> localResources = new HashMap<>();
-  protected final Map<String, String> mountPaths = new HashMap<>();
-  private final Map<String, ByteBuffer> serviceData = new HashMap<>();
-  // security
-  protected final Credentials credentials;
-  protected LogAggregationContext logAggregationContext;
-  protected boolean yarnDockerMode = false;
-  protected String dockerImage;
-  protected String yarnContainerMountPoints;
-  protected String runPrivilegedContainer;
-
-
-  /**
-   * Create instance.
-   * @param conf configuration
-   * @param coreFileSystem filesystem
-   * @param credentials initial set of credentials -null is permitted
-   */
-  protected AbstractLauncher(Configuration conf,
-      CoreFileSystem coreFileSystem,
-      Credentials credentials) {
-    super(conf);
-    this.coreFileSystem = coreFileSystem;
-    this.credentials = credentials != null ? credentials: new Credentials();
-  }
-
-  /**
-   * Get the container. Until "completed", this isn't valid to launch.
-   * @return the container to launch
-   */
-  public ContainerLaunchContext getContainerLaunchContext() {
-    return containerLaunchContext;
-  }
-  
-  public void setYarnDockerMode(boolean yarnDockerMode){
-    this.yarnDockerMode = yarnDockerMode;
-  }
-
-  /**
-   * Get the env vars to work on
-   * @return env vars
-   */
-  public MapOperations getEnv() {
-    return env;
-  }
-
-  /**
-   * Get the launch commands.
-   * @return the live list of commands 
-   */
-  public List<String> getCommands() {
-    return commands;
-  }
-
-  /**
-   * Get the map of local resources.
-   * @return the live map of local resources.
-   */
-  public Map<String, LocalResource> getLocalResources() {
-    return localResources;
-  }
-
-  public void addLocalResource(String subPath, LocalResource resource) {
-    localResources.put(subPath, resource);
-  }
-
-  public void addLocalResource(String subPath, LocalResource resource, String mountPath) {
-    localResources.put(subPath, resource);
-    mountPaths.put(subPath, mountPath);
-  }
-
-  /**
-   * Add a set of local resources
-   * @param resourceMap map of name:resource to add
-   */
-  public void addLocalResources(Map<String, LocalResource> resourceMap) {
-    localResources.putAll(resourceMap);
-  }
-
-  public Map<String, ByteBuffer> getServiceData() {
-    return serviceData;
-  }
-
-  /**
-   * Accessor to the credentials
-   * @return the credentials associated with this launcher
-   */
-  public Credentials getCredentials() {
-    return credentials;
-  }
-
-  /**
-   * Add a command line. It is converted to a single command before being
-   * added.
-   * @param cmd
-   */
-  public void addCommandLine(CommandLineBuilder cmd) {
-    commands.add(cmd.build());
-  }
-
-  public void addCommand(String cmd) {
-    commands.add(cmd);
-  }
-
-  /**
-   * Add a list of commands. Each element in the list becomes a single command
-   * @param commandList list of commands
-   */
-  public void addCommands(List<String> commandList) {
-    commands.addAll(commandList);
-  }
-
-  /**
-   * Get all commands as a string, separated by ";". This is for diagnostics
-   * @return a string description of the commands
-   */
-  public String getCommandsAsString() {
-    return SliderUtils.join(getCommands(), "; ");
-  }
-
-  /**
-   * Complete the launch context (copy in env vars, etc).
-   * @return the container to launch
-   */
-  public ContainerLaunchContext completeContainerLaunch() throws IOException {
-    
-    String cmdStr = SliderUtils.join(commands, " ", false);
-    log.debug("Completed setting up container command {}", cmdStr);
-    containerLaunchContext.setCommands(commands);
-
-    //env variables
-    if (log.isDebugEnabled()) {
-      log.debug("Environment variables");
-      for (Map.Entry<String, String> envPair : envVars.entrySet()) {
-        log.debug("    \"{}\"=\"{}\"", envPair.getKey(), envPair.getValue());
-      }
-    }    
-    containerLaunchContext.setEnvironment(env);
-
-    //service data
-    if (log.isDebugEnabled()) {
-      log.debug("Service Data size");
-      for (Map.Entry<String, ByteBuffer> entry : serviceData.entrySet()) {
-        log.debug("\"{}\"=> {} bytes of data", entry.getKey(),
-            entry.getValue().array().length);
-      }
-    }
-    containerLaunchContext.setServiceData(serviceData);
-
-    // resources
-    dumpLocalResources();
-    containerLaunchContext.setLocalResources(localResources);
-
-    //tokens
-    log.debug("{} tokens", credentials.numberOfTokens());
-    containerLaunchContext.setTokens(CredentialUtils.marshallCredentials(
-        credentials));
-
-    if(yarnDockerMode){
-      Map<String, String> env = containerLaunchContext.getEnvironment();
-      env.put("YARN_CONTAINER_RUNTIME_TYPE", "docker");
-      env.put("YARN_CONTAINER_RUNTIME_DOCKER_IMAGE", dockerImage);//if yarnDockerMode, then dockerImage is set
-      env.put("YARN_CONTAINER_RUNTIME_DOCKER_RUN_PRIVILEGED_CONTAINER", runPrivilegedContainer);
-      StringBuilder sb = new StringBuilder();
-      for (Entry<String,String> mount : mountPaths.entrySet()) {
-        if (sb.length() > 0) {
-          sb.append(",");
-        }
-        sb.append(mount.getKey());
-        sb.append(":");
-        sb.append(mount.getValue());
-      }
-      env.put("YARN_CONTAINER_RUNTIME_DOCKER_LOCAL_RESOURCE_MOUNTS", sb.toString());
-      log.info("yarn docker env var has been set {}", containerLaunchContext.getEnvironment().toString());
-    }
-
-    return containerLaunchContext;
-  }
-
-  /**
-   * Dump local resources at debug level
-   */
-  private void dumpLocalResources() {
-    if (log.isDebugEnabled()) {
-      log.debug("{} resources: ", localResources.size());
-      for (Map.Entry<String, LocalResource> entry : localResources.entrySet()) {
-
-        String key = entry.getKey();
-        LocalResource val = entry.getValue();
-        log.debug(key + "=" + SliderUtils.stringify(val.getResource()));
-      }
-    }
-  }
-
-  /**
-   * This is critical for an insecure cluster -it passes
-   * down the username to YARN, and so gives the code running
-   * in containers the rights it needs to work with
-   * data.
-   * @throws IOException problems working with current user
-   */
-  protected void propagateUsernameInInsecureCluster() throws IOException {
-    //insecure cluster: propagate user name via env variable
-    String userName = UserGroupInformation.getCurrentUser().getUserName();
-    env.put(SliderKeys.HADOOP_USER_NAME, userName);
-  }
-
-  /**
-   * Extract any resource requirements from this component's settings.
-   * All fields that are set will override the existing values -if
-   * unset that resource field will be left unchanged.
-   *
-   * Important: the configuration must already be fully resolved 
-   * in order to pick up global options.
-   * @param resource resource to configure
-   * @param map map of options
-   */
-  public void extractResourceRequirements(Resource resource,
-                                          Map<String, String> map) {
-
-    if (map != null) {
-      MapOperations options = new MapOperations("", map);
-      resource.setMemory(options.getOptionInt(ResourceKeys.YARN_MEMORY,
-                                              resource.getMemory()));
-      resource.setVirtualCores(options.getOptionInt(ResourceKeys.YARN_CORES,
-                                                    resource.getVirtualCores()));
-    }
-  }
-
-  /**
-   * Extract the value for option
-   * {@code yarn.resourcemanager.am.retry-count-window-ms}
-   * and set it on the ApplicationSubmissionContext. Use the default value
-   * if option is not set.
-   *
-   * @param submissionContext
-   * @param map
-   */
-  public void extractAmRetryCount(ApplicationSubmissionContext submissionContext,
-                                  Map<String, String> map) {
-
-    if (map != null) {
-      MapOperations options = new MapOperations("", map);
-      long amRetryCountWindow = options.getOptionLong(ResourceKeys
-          .YARN_RESOURCEMANAGER_AM_RETRY_COUNT_WINDOW_MS,
-          ResourceKeys.DEFAULT_AM_RETRY_COUNT_WINDOW_MS);
-      log.info("Setting {} to {}",
-          ResourceKeys.YARN_RESOURCEMANAGER_AM_RETRY_COUNT_WINDOW_MS,
-          amRetryCountWindow);
-      submissionContext.setAttemptFailuresValidityInterval(amRetryCountWindow);
-    }
-  }
-
-  public void extractLogAggregationContext(Map<String, String> map) {
-    if (map != null) {
-      String logPatternSepStr = "\\|";
-      String logPatternJoinStr = "|";
-      MapOperations options = new MapOperations("", map);
-
-      List<String> logIncludePatterns = new ArrayList<>();
-      String includePatternExpression = options.getOption(
-          ResourceKeys.YARN_LOG_INCLUDE_PATTERNS, "").trim();
-      if (!includePatternExpression.isEmpty()) {
-        String[] includePatterns = includePatternExpression
-            .split(logPatternSepStr);
-        for (String includePattern : includePatterns) {
-          String trimmedIncludePattern = includePattern.trim();
-          if (!trimmedIncludePattern.isEmpty()) {
-            logIncludePatterns.add(trimmedIncludePattern);
-          }
-        }
-      }
-      String logIncludePattern = StringUtils.join(logIncludePatterns,
-          logPatternJoinStr);
-      log.info("Log include patterns: {}", logIncludePattern);
-
-      List<String> logExcludePatterns = new ArrayList<>();
-      String excludePatternExpression = options.getOption(
-          ResourceKeys.YARN_LOG_EXCLUDE_PATTERNS, "").trim();
-      if (!excludePatternExpression.isEmpty()) {
-        String[] excludePatterns = excludePatternExpression
-            .split(logPatternSepStr);
-        for (String excludePattern : excludePatterns) {
-          String trimmedExcludePattern = excludePattern.trim();
-          if (!trimmedExcludePattern.isEmpty()) {
-            logExcludePatterns.add(trimmedExcludePattern);
-          }
-        }
-      }
-      String logExcludePattern = StringUtils.join(logExcludePatterns,
-          logPatternJoinStr);
-      log.info("Log exclude patterns: {}", logExcludePattern);
-
-      // SLIDER-810/YARN-3154 - hadoop 2.7.0 onwards a new instance method has
-      // been added for log aggregation for LRS. Existing newInstance method's
-      // behavior has changed and is used for log aggregation only after the
-      // application has finished. This forces Slider users to move to hadoop
-      // 2.7.0+ just for log aggregation, which is not very desirable. So we
-      // decided to use reflection here to find out if the new 2.7.0 newInstance
-      // method is available. If yes, then we use it, so log aggregation will
-      // work in hadoop 2.7.0+ env. If no, then we fallback to the pre-2.7.0
-      // newInstance method, which means log aggregation will work as expected
-      // in hadoop 2.6 as well.
-      // TODO: At some point, say 2-3 Slider releases down, when most users are
-      // running hadoop 2.7.0, we should get rid of the reflection code here.
-      try {
-        Method logAggregationContextMethod = LogAggregationContext.class
-            .getMethod("newInstance", String.class, String.class, String.class,
-                String.class);
-        // Need to set include/exclude patterns appropriately since by default
-        // rolled log aggregation is not done for any files, so defaults are
-        // - include pattern set to ""
-        // - exclude pattern set to "*"
-        // For Slider we want all logs to be uploaded if include/exclude
-        // patterns are left empty by the app owner in resources file
-        if (StringUtils.isEmpty(logIncludePattern)
-            && StringUtils.isEmpty(logExcludePattern)) {
-          logIncludePattern = ".*";
-          logExcludePattern = "";
-        } else if (StringUtils.isEmpty(logIncludePattern)
-            && StringUtils.isNotEmpty(logExcludePattern)) {
-          logIncludePattern = ".*";
-        } else if (StringUtils.isNotEmpty(logIncludePattern)
-            && StringUtils.isEmpty(logExcludePattern)) {
-          logExcludePattern = "";
-        }
-        log.debug("LogAggregationContext newInstance method for rolled logs "
-            + "include/exclude patterns is available");
-        log.info("Modified log include patterns: {}", logIncludePattern);
-        log.info("Modified log exclude patterns: {}", logExcludePattern);
-        logAggregationContext = (LogAggregationContext) logAggregationContextMethod
-            .invoke(null, null, null, logIncludePattern, logExcludePattern);
-      } catch (NoSuchMethodException | SecurityException
-          | IllegalAccessException | IllegalArgumentException
-          | InvocationTargetException e) {
-        log.debug("LogAggregationContext newInstance method for rolled logs "
-            + "include/exclude patterns is not available - fallback to old one");
-        log.debug(e.toString());
-        logAggregationContext = LogAggregationContext.newInstance(
-            logIncludePattern, logExcludePattern);
-      }
-    }
-  }
-
-  /**
-   * Utility method to set up the classpath
-   * @param classpath classpath to use
-   */
-  public void setClasspath(ClasspathConstructor classpath) {
-    setEnv(CLASSPATH, classpath.buildClasspath());
-  }
-
-  /**
-   * Set an environment variable in the launch context
-   * @param var variable name
-   * @param value value (must be non null)
-   */
-  public void setEnv(String var, String value) {
-    Preconditions.checkArgument(var != null, "null variable name");
-    Preconditions.checkArgument(value != null, "null value");
-    env.put(var, value);
-  }
-
-  /**
-   * Set an environment variable if its value is non-null.
-   * @param var variable name
-   * @param value value (may be null)
-   */
-  public void maybeSetEnv(String var, String value) {
-    if (value != null) {
-      setEnv(var, value);
-    }
-  }
-
-  public void putEnv(Map<String, String> map) {
-    env.putAll(map);
-  }
-
-  /**
-   * Important: the configuration must already be fully resolved 
-   * in order to pick up global options
-   * Copy env vars into the launch context.
-   */
-  public boolean copyEnvVars(MapOperations options) {
-    if (options == null) {
-      return false;
-    }
-    for (Map.Entry<String, String> entry : options.entrySet()) {
-      String key = entry.getKey();
-      if (key.startsWith(RoleKeys.ENV_PREFIX)) {
-        key = key.substring(RoleKeys.ENV_PREFIX.length());
-        env.put(key, entry.getValue());
-      }
-    }
-    return true;
-  }
-
-  public String[] dumpEnvToString() {
-
-    List<String> nodeEnv = new ArrayList<>();
-
-    for (Map.Entry<String, String> entry : env.entrySet()) {
-      String envElt = String.format("%s=\"%s\"",
-                                    entry.getKey(),
-                                    entry.getValue());
-      log.debug(envElt);
-      nodeEnv.add(envElt);
-    }
-    String[] envDescription = nodeEnv.toArray(new String[nodeEnv.size()]);
-
-    return envDescription;
-  }
-
-  /**
-   * Submit an entire directory
-   * @param srcDir src path in filesystem
-   * @param destRelativeDir relative path under destination local dir
-   * @throws IOException IO problems
-   */
-  public void submitDirectory(Path srcDir, String destRelativeDir)
-      throws IOException {
-    //add the configuration resources
-    Map<String, LocalResource> confResources;
-    confResources = coreFileSystem.submitDirectory(
-      srcDir,
-      destRelativeDir);
-    addLocalResources(confResources);
-  }
-
-  /**
-   * Return the label expression and if not set null
-   * @param map map to look up
-   * @return extracted label or null
-   */
-  public String extractLabelExpression(Map<String, String> map) {
-    if (map != null) {
-      MapOperations options = new MapOperations("", map);
-      return options.getOption(ResourceKeys.YARN_LABEL_EXPRESSION, null);
-    }
-    return null;
-  }
-
-  public void setDockerImage(String dockerImage) {
-    this.dockerImage = dockerImage;
-  }
-
-  public void setYarnContainerMountPoints(String yarnContainerMountPoints) {
-    this.yarnContainerMountPoints = yarnContainerMountPoints;
-  }
-
-  public void setRunPrivilegedContainer(String runPrivilegedContainer) {
-    this.runPrivilegedContainer = runPrivilegedContainer;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/launch/AppMasterLauncher.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/launch/AppMasterLauncher.java b/slider-core/src/main/java/org/apache/slider/core/launch/AppMasterLauncher.java
deleted file mode 100644
index 7190c3a..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/launch/AppMasterLauncher.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.launch;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.security.Credentials;
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
-import org.apache.hadoop.yarn.api.records.Priority;
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.client.api.YarnClientApplication;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.hadoop.yarn.util.Records;
-import org.apache.slider.client.SliderYarnClientImpl;
-import org.apache.slider.common.tools.CoreFileSystem;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.Set;
-
-public class AppMasterLauncher extends AbstractLauncher {
-
-
-  private static final Logger log =
-    LoggerFactory.getLogger(AppMasterLauncher.class);
-
-  public final YarnClientApplication application;
-  public final String name;
-  public final String type;
-  public final ApplicationSubmissionContext submissionContext;
-  public final ApplicationId appId;
-  public final boolean secureCluster;
-  private int maxAppAttempts = 0;
-  private boolean keepContainersOverRestarts = true;
-  private String queue = YarnConfiguration.DEFAULT_QUEUE_NAME;
-  private int priority = 1;
-  private final Resource resource = Records.newRecord(Resource.class);
-  private final SliderYarnClientImpl yarnClient;
-  private Long submitTime;
-
-  /**
-   * Build the AM Launcher
-   * @param name app name
-   * @param type application type
-   * @param conf hadoop config
-   * @param fs filesystem binding
-   * @param yarnClient yarn client
-   * @param secureCluster flag to indicate secure cluster
-   * @param options map of options. All values are extracted in this constructor only
-   * @param resourceGlobalOptions global options
-   * @param applicationTags any app tags
-   * @param credentials initial set of credentials
-   * @throws IOException
-   * @throws YarnException
-   */
-  public AppMasterLauncher(String name,
-      String type,
-      Configuration conf,
-      CoreFileSystem fs,
-      SliderYarnClientImpl yarnClient,
-      boolean secureCluster,
-      Map<String, String> options,
-      Map<String, String> resourceGlobalOptions,
-      Set<String> applicationTags,
-      Credentials credentials) throws IOException, YarnException {
-    super(conf, fs, credentials);
-    this.yarnClient = yarnClient;
-    this.application = yarnClient.createApplication();
-    this.name = name;
-    this.type = type;
-    this.secureCluster = secureCluster;
-
-    submissionContext = application.getApplicationSubmissionContext();
-    appId = submissionContext.getApplicationId();
-    // set the application name;
-    submissionContext.setApplicationName(name);
-    // app type used in service enum;
-    submissionContext.setApplicationType(type);
-    if (!applicationTags.isEmpty()) {
-      submissionContext.setApplicationTags(applicationTags);
-    }
-    submissionContext.setNodeLabelExpression(extractLabelExpression(options));
-
-    extractAmRetryCount(submissionContext, resourceGlobalOptions);
-    extractResourceRequirements(resource, options);
-    extractLogAggregationContext(resourceGlobalOptions);
-  }
-
-  public void setMaxAppAttempts(int maxAppAttempts) {
-    this.maxAppAttempts = maxAppAttempts;
-  }
-
-  public void setKeepContainersOverRestarts(boolean keepContainersOverRestarts) {
-    this.keepContainersOverRestarts = keepContainersOverRestarts;
-  }
-
-
-  public Resource getResource() {
-    return resource;
-  }
-
-  public void setMemory(int memory) {
-    resource.setMemory(memory);
-  }
-
-  public void setVirtualCores(int cores) {
-    resource.setVirtualCores(cores);
-  }
-
-  public ApplicationId getApplicationId() {
-    return appId;
-  }
-
-  public int getMaxAppAttempts() {
-    return maxAppAttempts;
-  }
-
-  public boolean isKeepContainersOverRestarts() {
-    return keepContainersOverRestarts;
-  }
-
-  public String getQueue() {
-    return queue;
-  }
-
-  public int getPriority() {
-    return priority;
-  }
-
-  public void setQueue(String queue) {
-    this.queue = queue;
-  }
-
-  public void setPriority(int priority) {
-    this.priority = priority;
-  }
-
-  /**
-   * Complete the launch context (copy in env vars, etc).
-   * @return the container to launch
-   */
-  public ApplicationSubmissionContext completeAppMasterLaunch()
-      throws IOException {
-
-    //queue priority
-    Priority pri = Records.newRecord(Priority.class);
-    pri.setPriority(priority);
-    submissionContext.setPriority(pri);
-
-    // Set the queue to which this application is to be submitted in the RM
-    // Queue for App master
-
-    submissionContext.setQueue(queue);
-
-
-    //container requirements
-    submissionContext.setResource(resource);
-    submissionContext.setLogAggregationContext(logAggregationContext);
-
-    if (keepContainersOverRestarts) {
-      log.debug("Requesting cluster stays running over AM failure");
-      submissionContext.setKeepContainersAcrossApplicationAttempts(true);
-    }
-
-    if (maxAppAttempts > 0) {
-      log.debug("Setting max AM attempts to {}", maxAppAttempts);
-      submissionContext.setMaxAppAttempts(maxAppAttempts);
-    }
-
-    if (secureCluster) {
-      //tokens
-      log.debug("Credentials: {}",
-          CredentialUtils.dumpTokens(getCredentials(), "\n"));
-
-    } else {
-      propagateUsernameInInsecureCluster();
-    }
-    completeContainerLaunch();
-    submissionContext.setAMContainerSpec(containerLaunchContext);
-    return submissionContext;
-  }
-
-  /**
-   * Submit the application. 
-   * @return a launched application representing the submitted application
-   * @throws IOException
-   * @throws YarnException
-   */
-  public LaunchedApplication submitApplication() throws IOException, YarnException {
-    completeAppMasterLaunch();
-    log.info("Submitting application to Resource Manager");
-    ApplicationId applicationId =
-      yarnClient.submitApplication(submissionContext);
-    // implicit success; record the time
-    submitTime = System.currentTimeMillis();
-    return new LaunchedApplication(applicationId, yarnClient);
-  }
-
-  /**
-   * Build a serializable application report. This is a very minimal
-   * report that contains the application Id, name and type \u2014the information
-   * available
-   * @return a data structure which can be persisted
-   */
-  public SerializedApplicationReport createSerializedApplicationReport() {
-    SerializedApplicationReport sar = new SerializedApplicationReport();
-    sar.applicationId = appId.toString();
-    sar.name = name;
-    sar.applicationType = type;
-    sar.queue = queue;
-    sar.submitTime = submitTime;
-    return sar;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/launch/ClasspathConstructor.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/launch/ClasspathConstructor.java b/slider-core/src/main/java/org/apache/slider/core/launch/ClasspathConstructor.java
deleted file mode 100644
index 6eb4058..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/launch/ClasspathConstructor.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.launch;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.util.StringUtils;
-import org.apache.hadoop.yarn.api.ApplicationConstants;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.slider.common.tools.SliderUtils;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * build a classpath -allows for entries to be injected in front of
- * YARN classpath as well as behind, adds appropriate separators, 
- * extraction of local classpath, etc.
- */
-public class ClasspathConstructor {
-
-    public static final String CLASS_PATH_SEPARATOR = ApplicationConstants.CLASS_PATH_SEPARATOR;
-  private final List<String> pathElements = new ArrayList<>();
-
-  public ClasspathConstructor() {
-  }
-
-
-  /**
-   * Get the list of JARs from the YARN settings
-   * @param config configuration
-   */
-  public List<String> yarnApplicationClasspath(Configuration config) {
-    String[] cp = config.getTrimmedStrings(
-      YarnConfiguration.YARN_APPLICATION_CLASSPATH,
-      YarnConfiguration.DEFAULT_YARN_CROSS_PLATFORM_APPLICATION_CLASSPATH);
-    return cp != null ? Arrays.asList(cp) : new ArrayList<String>(0);
-
-  }
-
-
-  @Override
-  public String toString() {
-    return buildClasspath();
-  }
-
-  public String buildClasspath() {
-    return SliderUtils.join(pathElements,
-        CLASS_PATH_SEPARATOR,
-        false);
-  }
-
-  /**
-   * Get a copy of the path list
-   * @return the JARs
-   */
-  public List<String> getPathElements() {
-    return Collections.unmodifiableList(pathElements);
-  }
-
-  /**
-   * Append an entry
-   * @param path path
-   */
-  public void append(String path) {
-    pathElements.add(path);
-  }
-
-  /**
-   * Insert a path at the front of the list. This places it ahead of
-   * the standard YARN artifacts
-   * @param path path to the JAR. Absolute or relative -on the target
-   * system
-   */
-  public void insert(String path) {
-    pathElements.add(0, path);
-  }
-
-  public void appendAll(Collection<String> paths) {
-    pathElements.addAll(paths);
-  }
-
-  public void insertAll(Collection<String> paths) {
-    pathElements.addAll(0, paths);
-  }
-
-
-  public void addLibDir(String pathToLibDir) {
-    append(buildLibDir(pathToLibDir));
-  }
-
-  public void insertLibDir(String pathToLibDir) {
-    insert(buildLibDir(pathToLibDir));
-  }
-
-  public void addClassDirectory(String pathToDir) {
-    append(appendDirectoryTerminator(pathToDir));
-  }
-
-  public void insertClassDirectory(String pathToDir) {
-    insert(buildLibDir(appendDirectoryTerminator(pathToDir)));
-  }
-
-
-  public void addRemoteClasspathEnvVar() {
-    append(ApplicationConstants.Environment.CLASSPATH.$$());
-  }
-
-
-  public void insertRemoteClasspathEnvVar() {
-    append(ApplicationConstants.Environment.CLASSPATH.$$());
-  }
-
-
-  /**
-   * Build a lib dir path
-   * @param pathToLibDir path to the directory; may or may not end with a
-   * trailing space
-   * @return a path to a lib dir that is compatible with the java classpath
-   */
-  public String buildLibDir(String pathToLibDir) {
-    String dir = appendDirectoryTerminator(pathToLibDir);
-    dir += "*";
-    return dir;
-  }
-
-  private String appendDirectoryTerminator(String pathToLibDir) {
-    String dir = pathToLibDir.trim();
-    if (!dir.endsWith("/")) {
-      dir += "/";
-    }
-    return dir;
-  }
-
-  /**
-   * Split a classpath. This uses the local path separator so MUST NOT
-   * be used to work with remote classpaths
-   * @param localpath local path
-   * @return a splite
-   */
-  public Collection<String> splitClasspath(String localpath) {
-    String separator = System.getProperty("path.separator");
-    return StringUtils.getStringCollection(localpath, separator);
-  }
-
-  /**
-   * Get the local JVM classpath split up
-   * @return the list of entries on the JVM classpath env var
-   */
-  public Collection<String> localJVMClasspath() {
-    return splitClasspath(System.getProperty("java.class.path"));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/launch/CommandLineBuilder.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/launch/CommandLineBuilder.java b/slider-core/src/main/java/org/apache/slider/core/launch/CommandLineBuilder.java
deleted file mode 100644
index dbaa981..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/launch/CommandLineBuilder.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.launch;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.yarn.api.ApplicationConstants;
-import org.apache.slider.common.tools.SliderUtils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Build a single command line to include in the container commands;
- * Special support for JVM command buildup.
- */
-public class CommandLineBuilder {
-  protected final List<String> argumentList = new ArrayList<>(20);
-
-
-  /**
-   * Add an entry to the command list
-   * @param args arguments -these will be converted strings
-   */
-  public void add(Object... args) {
-    for (Object arg : args) {
-      argumentList.add(arg.toString());
-    }
-  }
-
-  /**
-   * Get the value at an offset
-   * @param offset offset
-   * @return the value at that point
-   */
-  public String elt(int offset) {
-    return argumentList.get(offset);
-  }
-
-  /**
-   * Get the number of arguments
-   * @return an integer >= 0
-   */
-  public int size() {
-    return argumentList.size();
-  }
-  
-  /**
-   * Append the output and error files to the tail of the command
-   * @param stdout out
-   * @param stderr error. Set this to null to append into stdout
-   */
-  public void addOutAndErrFiles(String stdout, String stderr) {
-    Preconditions.checkNotNull(stdout, "Null output file");
-    Preconditions.checkState(!stdout.isEmpty(), "output filename invalid");
-    // write out the path output
-    argumentList.add("1>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/" +
-             stdout);
-    if (stderr != null) {
-      argumentList.add("2>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/" +
-               stderr);
-    } else {
-      argumentList.add("2>&1");
-    }
-  }
-
-  /**
-   * This just returns the command line
-   * @see #build()
-   * @return the command line
-   */
-  @Override
-  public String toString() {
-    return build();
-  }
-
-  /**
-   * Build the command line
-   * @return the command line
-   */
-  public String build() {
-    return SliderUtils.join(argumentList, " ");
-  }
-
-  public List<String> getArgumentList() {
-    return argumentList;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/launch/ContainerLauncher.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/launch/ContainerLauncher.java b/slider-core/src/main/java/org/apache/slider/core/launch/ContainerLauncher.java
deleted file mode 100644
index d220928..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/launch/ContainerLauncher.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.launch;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.net.NetUtils;
-import org.apache.hadoop.security.Credentials;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.security.token.Token;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.security.ContainerTokenIdentifier;
-import org.apache.hadoop.yarn.util.ConverterUtils;
-import org.apache.slider.common.tools.CoreFileSystem;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.InetSocketAddress;
-
-/**
- * Code to ease launching of any container
- */
-public class ContainerLauncher extends AbstractLauncher {
-  private static final Logger log =
-    LoggerFactory.getLogger(ContainerLauncher.class);
-  // Allocated container
-  public final Container container;
-
-  public ContainerLauncher(Configuration conf,
-      CoreFileSystem coreFileSystem,
-      Container container,
-      Credentials credentials) {
-    super(conf, coreFileSystem, credentials);
-    this.container = container;
-  }
-
-  /**
-   * This code is in the dist shell examples -it's been moved here
-   * so that if it is needed, it's still here
-   * @return a remote user with a token to access the container.
-   */
-  public UserGroupInformation setupUGI() {
-    UserGroupInformation user =
-      UserGroupInformation.createRemoteUser(container.getId().toString());
-    String cmIpPortStr = container.getNodeId().getHost() + ":" + container.getNodeId().getPort();
-    final InetSocketAddress cmAddress = NetUtils.createSocketAddr(cmIpPortStr);
-
-    org.apache.hadoop.yarn.api.records.Token containerToken = container.getContainerToken();
-    if (containerToken != null) {
-      Token<ContainerTokenIdentifier> token =
-        ConverterUtils.convertFromYarn(containerToken, cmAddress);
-      user.addToken(token);
-    }
-    return user;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/launch/CredentialUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/launch/CredentialUtils.java b/slider-core/src/main/java/org/apache/slider/core/launch/CredentialUtils.java
deleted file mode 100644
index 5357cc4..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/launch/CredentialUtils.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.launch;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.io.DataOutputBuffer;
-import org.apache.hadoop.io.Text;
-import org.apache.hadoop.security.Credentials;
-import org.apache.hadoop.security.SecurityUtil;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.security.token.Token;
-import org.apache.hadoop.security.token.TokenIdentifier;
-import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier;
-import org.apache.hadoop.yarn.client.ClientRMProxy;
-import org.apache.hadoop.yarn.client.api.TimelineClient;
-import org.apache.hadoop.yarn.client.api.YarnClient;
-import org.apache.hadoop.yarn.conf.HAUtil;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.hadoop.yarn.security.client.TimelineDelegationTokenIdentifier;
-import org.apache.hadoop.yarn.util.ConverterUtils;
-import org.apache.slider.common.SliderXmlConfKeys;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.Serializable;
-import java.nio.ByteBuffer;
-import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import static org.apache.hadoop.security.UserGroupInformation.HADOOP_TOKEN_FILE_LOCATION;
-import static org.apache.hadoop.yarn.conf.YarnConfiguration.*;
-
-/**
- * Utils to work with credentials and tokens.
- *
- * Designed to be movable to Hadoop core
- */
-public final class CredentialUtils {
-
-  public static final String JOB_CREDENTIALS_BINARY
-      = SliderXmlConfKeys.MAPREDUCE_JOB_CREDENTIALS_BINARY;
-
-  private CredentialUtils() {
-  }
-
-  private static final Logger LOG =
-      LoggerFactory.getLogger(CredentialUtils.class);
-
-  /**
-   * Save credentials to a byte buffer. Returns null if there were no
-   * credentials to save
-   * @param credentials credential set
-   * @return a byte buffer of serialized tokens
-   * @throws IOException if the credentials could not be written to the stream
-   */
-  public static ByteBuffer marshallCredentials(Credentials credentials) throws IOException {
-    ByteBuffer buffer = null;
-    if (!credentials.getAllTokens().isEmpty()) {
-      DataOutputBuffer dob = new DataOutputBuffer();
-      try {
-        credentials.writeTokenStorageToStream(dob);
-      } finally {
-        dob.close();
-      }
-      buffer = ByteBuffer.wrap(dob.getData(), 0, dob.getLength());
-    }
-    return buffer;
-  }
-
-  public static File locateEnvCredentials(Map<String, String> env,
-      Configuration conf,
-      StringBuffer sourceTextOut) throws FileNotFoundException {
-    String tokenFilename = env.get(HADOOP_TOKEN_FILE_LOCATION);
-    String source = "environment variable " + HADOOP_TOKEN_FILE_LOCATION;
-    if (tokenFilename == null) {
-      tokenFilename = conf.get(JOB_CREDENTIALS_BINARY);
-      source = "configuration option " + JOB_CREDENTIALS_BINARY;
-    }
-    if (tokenFilename != null) {
-      // use delegation tokens, i.e. from Oozie
-      File file = new File(tokenFilename.trim());
-      String details = String.format(
-          "Token File %s from %s",
-          file,
-          source);
-      if (!file.exists()) {
-        throw new FileNotFoundException("No " + details);
-      }
-      if (!file.isFile() && !file.canRead()) {
-        throw new FileNotFoundException("Cannot read " + details);
-      }
-      sourceTextOut.append(details);
-      return file;
-    } else {
-      return null;
-    }
-  }
-
-  /**
-   * Load the credentials from the environment. This looks at
-   * the value of {@link UserGroupInformation#HADOOP_TOKEN_FILE_LOCATION}
-   * and attempts to read in the value
-   * @param env environment to resolve the variable from
-   * @param conf configuration use when reading the tokens
-   * @return a set of credentials, or null if the environment did not
-   * specify any
-   * @throws IOException if a location for credentials was defined, but
-   * the credentials could not be loaded.
-   */
-  public static Credentials loadTokensFromEnvironment(Map<String, String> env,
-      Configuration conf)
-      throws IOException {
-    StringBuffer origin = new StringBuffer();
-    File file = locateEnvCredentials(env, conf, origin);
-    if (file != null) {
-      LOG.debug("Using {}", origin);
-      return Credentials.readTokenStorageFile(file, conf);
-    } else {
-      return null;
-    }
-  }
-
-  /**
-   * Save credentials to a file
-   * @param file file to save to (will be overwritten)
-   * @param credentials credentials to write
-   * @throws IOException
-   */
-  public static void saveTokens(File file,
-      Credentials credentials) throws IOException {
-    try(DataOutputStream daos = new DataOutputStream(
-        new FileOutputStream(file))) {
-      credentials.writeTokenStorageToStream(daos);
-    }
-  }
-
-  /**
-   * Look up and return the resource manager's principal. This method
-   * automatically does the <code>_HOST</code> replacement in the principal and
-   * correctly handles HA resource manager configurations.
-   *
-   * From: YARN-4629
-   * @param conf the {@link Configuration} file from which to read the
-   * principal
-   * @return the resource manager's principal string
-   * @throws IOException thrown if there's an error replacing the host name
-   */
-  public static String getRMPrincipal(Configuration conf) throws IOException {
-    String principal = conf.get(RM_PRINCIPAL, "");
-    String hostname;
-    Preconditions.checkState(!principal.isEmpty(), "Not set: " + RM_PRINCIPAL);
-
-    if (HAUtil.isHAEnabled(conf)) {
-      YarnConfiguration yarnConf = new YarnConfiguration(conf);
-      if (yarnConf.get(RM_HA_ID) == null) {
-        // If RM_HA_ID is not configured, use the first of RM_HA_IDS.
-        // Any valid RM HA ID should work.
-        String[] rmIds = yarnConf.getStrings(RM_HA_IDS);
-        Preconditions.checkState((rmIds != null) && (rmIds.length > 0),
-            "Not set " + RM_HA_IDS);
-        yarnConf.set(RM_HA_ID, rmIds[0]);
-      }
-
-      hostname = yarnConf.getSocketAddr(
-          RM_ADDRESS,
-          DEFAULT_RM_ADDRESS,
-          DEFAULT_RM_PORT).getHostName();
-    } else {
-      hostname = conf.getSocketAddr(
-          RM_ADDRESS,
-          DEFAULT_RM_ADDRESS,
-          DEFAULT_RM_PORT).getHostName();
-    }
-    return SecurityUtil.getServerPrincipal(principal, hostname);
-  }
-
-  /**
-   * Create and add any filesystem delegation tokens with
-   * the RM(s) configured to be able to renew them. Returns null
-   * on an insecure cluster (i.e. harmless)
-   * @param conf configuration
-   * @param fs filesystem
-   * @param credentials credentials to update
-   * @return a list of all added tokens.
-   * @throws IOException
-   */
-  public static Token<?>[] addRMRenewableFSDelegationTokens(Configuration conf,
-      FileSystem fs,
-      Credentials credentials) throws IOException {
-    Preconditions.checkArgument(conf != null);
-    Preconditions.checkArgument(credentials != null);
-    if (UserGroupInformation.isSecurityEnabled()) {
-      return fs.addDelegationTokens(CredentialUtils.getRMPrincipal(conf),
-          credentials);
-    }
-    return null;
-  }
-
-  /**
-   * Add an FS delegation token which can be renewed by the current user
-   * @param fs filesystem
-   * @param credentials credentials to update
-   * @throws IOException problems.
-   */
-  public static void addSelfRenewableFSDelegationTokens(
-      FileSystem fs,
-      Credentials credentials) throws IOException {
-    Preconditions.checkArgument(fs != null);
-    Preconditions.checkArgument(credentials != null);
-    fs.addDelegationTokens(
-        getSelfRenewer(),
-        credentials);
-  }
-
-  public static String getSelfRenewer() throws IOException {
-    return UserGroupInformation.getLoginUser().getShortUserName();
-  }
-
-  /**
-   * Create and add an RM delegation token to the credentials
-   * @param yarnClient Yarn Client
-   * @param credentials to add token to
-   * @return the token which was added
-   * @throws IOException
-   * @throws YarnException
-   */
-  public static Token<TokenIdentifier> addRMDelegationToken(YarnClient yarnClient,
-      Credentials credentials)
-      throws IOException, YarnException {
-    Configuration conf = yarnClient.getConfig();
-    Text rmPrincipal = new Text(CredentialUtils.getRMPrincipal(conf));
-    Text rmDTService = ClientRMProxy.getRMDelegationTokenService(conf);
-    Token<TokenIdentifier> rmDelegationToken =
-        ConverterUtils.convertFromYarn(
-            yarnClient.getRMDelegationToken(rmPrincipal),
-            rmDTService);
-    credentials.addToken(rmDelegationToken.getService(), rmDelegationToken);
-    return rmDelegationToken;
-  }
-
-  public static Token<TimelineDelegationTokenIdentifier> maybeAddTimelineToken(
-      Configuration conf,
-      Credentials credentials)
-      throws IOException, YarnException {
-    if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, false)) {
-      LOG.debug("Timeline service enabled -fetching token");
-
-      try(TimelineClient timelineClient = TimelineClient.createTimelineClient()) {
-        timelineClient.init(conf);
-        timelineClient.start();
-        Token<TimelineDelegationTokenIdentifier> token =
-            timelineClient.getDelegationToken(
-                CredentialUtils.getRMPrincipal(conf));
-        credentials.addToken(token.getService(), token);
-        return token;
-      }
-    } else {
-      LOG.debug("Timeline service is disabled");
-      return null;
-    }
-  }
-
-  /**
-   * Filter a list of tokens from a set of credentials
-   * @param credentials credential source (a new credential set os re
-   * @param filter List of tokens to strip out
-   * @return a new, filtered, set of credentials
-   */
-  public static Credentials filterTokens(Credentials credentials,
-      List<Text> filter) {
-    Credentials result = new Credentials(credentials);
-    Iterator<Token<? extends TokenIdentifier>> iter =
-        result.getAllTokens().iterator();
-    while (iter.hasNext()) {
-      Token<? extends TokenIdentifier> token = iter.next();
-      LOG.debug("Token {}", token.getKind());
-      if (filter.contains(token.getKind())) {
-        LOG.debug("Filtering token {}", token.getKind());
-        iter.remove();
-      }
-    }
-    return result;
-  }
-
-  public static String dumpTokens(Credentials credentials, String separator) {
-    ArrayList<Token<? extends TokenIdentifier>> sorted =
-        new ArrayList<>(credentials.getAllTokens());
-    Collections.sort(sorted, new TokenComparator());
-    StringBuilder buffer = new StringBuilder(sorted.size()* 128);
-    for (Token<? extends TokenIdentifier> token : sorted) {
-      buffer.append(tokenToString(token)).append(separator);
-    }
-    return buffer.toString();
-  }
-
-  /**
-   * Create a string for people to look at
-   * @param token token to convert to a string form
-   * @return a printable view of the token
-   */
-  public static String tokenToString(Token<? extends TokenIdentifier> token) {
-    DateFormat df = DateFormat.getDateTimeInstance(
-        DateFormat.SHORT, DateFormat.SHORT);
-    StringBuilder buffer = new StringBuilder(128);
-    buffer.append(token.toString());
-    try {
-      TokenIdentifier ti = token.decodeIdentifier();
-      buffer.append("; ").append(ti);
-      if (ti instanceof AbstractDelegationTokenIdentifier) {
-        // details in human readable form, and compensate for information HDFS DT omits
-        AbstractDelegationTokenIdentifier dt = (AbstractDelegationTokenIdentifier) ti;
-        buffer.append("; Renewer: ").append(dt.getRenewer());
-        buffer.append("; Issued: ")
-            .append(df.format(new Date(dt.getIssueDate())));
-        buffer.append("; Max Date: ")
-            .append(df.format(new Date(dt.getMaxDate())));
-      }
-    } catch (IOException e) {
-      //marshall problem; not ours
-      LOG.debug("Failed to decode {}: {}", token, e, e);
-    }
-    return buffer.toString();
-  }
-
-  /**
-   * Get the expiry time of a token.
-   * @param token token to examine
-   * @return the time in milliseconds after which the token is invalid.
-   * @throws IOException
-   */
-  public static long getTokenExpiryTime(Token token) throws IOException {
-    TokenIdentifier identifier = token.decodeIdentifier();
-    Preconditions.checkState(identifier instanceof AbstractDelegationTokenIdentifier,
-        "Token %s of type: %s has an identifier which cannot be examined: %s",
-        token, token.getClass(), identifier);
-    AbstractDelegationTokenIdentifier id =
-        (AbstractDelegationTokenIdentifier) identifier;
-    return id.getMaxDate();
-  }
-
-  private static class TokenComparator
-      implements Comparator<Token<? extends TokenIdentifier>>, Serializable {
-    @Override
-    public int compare(Token<? extends TokenIdentifier> left,
-        Token<? extends TokenIdentifier> right) {
-      return left.getKind().toString().compareTo(right.getKind().toString());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/core/launch/JavaCommandLineBuilder.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/launch/JavaCommandLineBuilder.java b/slider-core/src/main/java/org/apache/slider/core/launch/JavaCommandLineBuilder.java
deleted file mode 100644
index b8aa4c6..0000000
--- a/slider-core/src/main/java/org/apache/slider/core/launch/JavaCommandLineBuilder.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.launch;
-
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.yarn.api.ApplicationConstants;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadConfigException;
-
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * Command line builder purely for the Java CLI.
- * Some of the <code>define</code> methods are designed to work with Hadoop tool and
- * Slider launcher applications.
- */
-public class JavaCommandLineBuilder extends CommandLineBuilder {
-
-  public JavaCommandLineBuilder() {
-    add(getJavaBinary());
-  }
-
-  /**
-   * Get the java binary. This is called in the constructor so don't try and
-   * do anything other than return a constant.
-   * @return the path to the Java binary
-   */
-  protected String getJavaBinary() {
-    return ApplicationConstants.Environment.JAVA_HOME.$$() + "/bin/java";
-  }
-
-  /**
-   * Set the size of the heap if a non-empty heap is passed in. 
-   * @param heap empty string or something like "128M" ,"1G" etc. The value is
-   * trimmed.
-   */
-  public void setJVMHeap(String heap) {
-    if (SliderUtils.isSet(heap)) {
-      add("-Xmx" + heap.trim());
-    }
-  }
-
-  /**
-   * Turn Java assertions on
-   */
-  public void enableJavaAssertions() {
-    add("-ea");
-    add("-esa");
-  }
-
-  /**
-   * Add a system property definition -must be used before setting the main entry point
-   * @param property
-   * @param value
-   */
-  public void sysprop(String property, String value) {
-    Preconditions.checkArgument(property != null, "null property name");
-    Preconditions.checkArgument(value != null, "null value");
-    add("-D" + property + "=" + value);
-  }
-  
-  public JavaCommandLineBuilder forceIPv4() {
-    sysprop("java.net.preferIPv4Stack", "true");
-    return this;
-  }
-  
-  public JavaCommandLineBuilder headless() {
-    sysprop("java.awt.headless", "true");
-    return this;
-  }
-
-  public boolean addConfOption(Configuration conf, String key) {
-    return defineIfSet(key, conf.get(key));
-  }
-
-  /**
-   * Add a varargs list of configuration parameters \u2014if they are present
-   * @param conf configuration source
-   * @param keys keys
-   */
-  public void addConfOptions(Configuration conf, String... keys) {
-    for (String key : keys) {
-      addConfOption(conf, key);
-    }
-  }
-
-  /**
-   * Add all configuration options which match the prefix
-   * @param conf configuration
-   * @param prefix prefix, e.g {@code "slider."}
-   * @return the number of entries copied
-   */
-  public int addPrefixedConfOptions(Configuration conf, String prefix) {
-    int copied = 0;
-    for (Map.Entry<String, String> entry : conf) {
-      if (entry.getKey().startsWith(prefix)) {
-        define(entry.getKey(), entry.getValue());
-        copied++;
-      }
-    }
-    return copied;
-  }
-
-  /**
-   * Ass a configuration option to the command line of  the application
-   * @param conf configuration
-   * @param key key
-   * @param defVal default value
-   * @return the resolved configuration option
-   * @throws IllegalArgumentException if key is null or the looked up value
-   * is null (that is: the argument is missing and devVal was null.
-   */
-  public String addConfOptionToCLI(Configuration conf,
-      String key,
-      String defVal) {
-    Preconditions.checkArgument(key != null, "null key");
-    String val = conf.get(key, defVal);
-    define(key, val);
-    return val;
-  }
-
-  /**
-   * Add a <code>-D key=val</code> command to the CLI. This is very Hadoop API
-   * @param key key
-   * @param val value
-   * @throws IllegalArgumentException if either argument is null
-   */
-  public void define(String key, String val) {
-    Preconditions.checkArgument(key != null, "null key");
-    Preconditions.checkArgument(val != null, "null value");
-    add("-D", key + "=" + val);
-  }
-
-  /**
-   * Add a <code>-D key=val</code> command to the CLI if <code>val</code>
-   * is not null
-   * @param key key
-   * @param val value
-   */
-  public boolean defineIfSet(String key, String val) {
-    Preconditions.checkArgument(key != null, "null key");
-    if (val != null) {
-      define(key, val);
-      return true;
-    } else {
-      return false;
-    }
-  }
-
-  /**
-   * Add a mandatory config option
-   * @param conf configuration
-   * @param key key
-   * @throws BadConfigException if the key is missing
-   */
-  public void addMandatoryConfOption(Configuration conf,
-      String key) throws BadConfigException {
-    if (!addConfOption(conf, key)) {
-      throw new BadConfigException("Missing configuration option: " + key);
-    }
-  }
-
-}


[25/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Component.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Component.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Component.java
deleted file mode 100644
index 78bb8c1..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Component.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.codehaus.jackson.annotate.JsonProperty;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Component defined in master package metainfo.json
- */
-public class Component extends AbstractComponent {
-
-  String category = CATEGORY_MASTER;
-  String publishConfig = Boolean.FALSE.toString();
-  String minInstanceCount = "0";
-  String maxInstanceCount;
-  String autoStartOnFailure = Boolean.FALSE.toString();
-  String appExports;
-  String compExports;
-  String type = TYPE_STANDARD;
-  List<ComponentExport> componentExports = new ArrayList<>();
-  List<DockerContainer> dockerContainers = new ArrayList<>();
-  List<ConfigFile> configFiles = new ArrayList<>();
-
-  public Component() {
-  }
-
-  public String getType() {
-    return type;
-  }
-
-  public void setType(String type) {
-    this.type = type;
-  }
-
-  public String getCategory() {
-    return category;
-  }
-
-  public void setCategory(String category) {
-    this.category = category;
-  }
-
-  public String getPublishConfig() {
-    return publishConfig;
-  }
-
-  public void setPublishConfig(String publishConfig) {
-    this.publishConfig = publishConfig;
-  }
-
-  public String getAutoStartOnFailure() {
-    return autoStartOnFailure;
-  }
-
-  public void setAutoStartOnFailure(String autoStartOnFailure) {
-    this.autoStartOnFailure = autoStartOnFailure;
-  }
-
-  public String getAppExports() {
-    return appExports;
-  }
-
-  public void setAppExports(String appExports) {
-    this.appExports = appExports;
-  }
-
-  public String getCompExports() {
-    return compExports;
-  }
-
-  public void setCompExports(String compExports) {
-    this.compExports = compExports;
-  }
-
-  public String getMinInstanceCount() {
-    return minInstanceCount;
-  }
-  
-  @JsonProperty("dockerContainers")
-  public List<DockerContainer> getDockerContainers() {
-     return this.dockerContainers;
-  }
-  
-  public Boolean getAutoStartOnFailureBoolean() {
-    if (SliderUtils.isUnset(getAutoStartOnFailure())) {
-      return Boolean.FALSE;
-    }
-
-    return Boolean.parseBoolean(getAutoStartOnFailure());
-  }
-
-  public int getMinInstanceCountInt() throws BadConfigException {
-    if (SliderUtils.isUnset(minInstanceCount)) {
-      return 0;
-    }
-
-    try {
-      return Integer.parseInt(minInstanceCount);
-    } catch (NumberFormatException nfe) {
-      throw new BadConfigException(nfe, "Invalid value for minInstanceCount for %s", name);
-    }
-  }
-
-  public int getMaxInstanceCountInt() throws BadConfigException {
-    if (SliderUtils.isUnset(maxInstanceCount)) {
-      return Integer.MAX_VALUE;
-    }
-
-    try {
-      return Integer.parseInt(maxInstanceCount);
-    } catch (NumberFormatException nfe) {
-      throw new BadConfigException(nfe, "Invalid value for maxInstanceCount for %s", name);
-    }
-  }
-
-  public void setMinInstanceCount(String minInstanceCount) {
-    this.minInstanceCount = minInstanceCount;
-  }
-
-  public String getMaxInstanceCount() {
-    return maxInstanceCount;
-  }
-
-  public void setMaxInstanceCount(String maxInstanceCount) {
-    this.maxInstanceCount = maxInstanceCount;
-  }
-
-  public void addComponentExport(ComponentExport export) {
-    componentExports.add(export);
-  }
-
-  public List<ComponentExport> getComponentExports() {
-    return componentExports;
-  }
-
-  public Boolean getRequiresAutoRestart() {
-    return Boolean.parseBoolean(this.autoStartOnFailure);
-  }
-
-  public void addConfigFile(ConfigFile configFile) {
-    this.configFiles.add(configFile);
-  }
-
-  @JsonProperty("configFiles")
-  public List<ConfigFile> getConfigFiles() {
-    return configFiles;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("{");
-    sb.append("\n\"name\": ").append(name);
-    sb.append(",\n\"category\": ").append(category);
-    sb.append(",\n\"commandScript\" :").append(commandScript);
-    for(DockerContainer dc : dockerContainers){
-      sb.append(",\n\"container\" :").append(dc.toString());
-    }    
-    sb.append('}');
-    return sb.toString();
-  }
-
-  public void validate(String version) throws SliderException {
-    Metainfo.checkNonNull(getName(), "name", "component");
-    Metainfo.checkNonNull(getCategory(), "category", "component");
-    if (!getCategory().equals(CATEGORY_MASTER)
-        && !getCategory().equals(CATEGORY_SLAVE)
-        && !getCategory().equals(CATEGORY_CLIENT)) {
-      throw new SliderException("Invalid category for the component " + getCategory());
-    }
-
-    Metainfo.checkNonNull(getType(), "type", "component");
-    if (!getType().equals(TYPE_DOCKER)
-        && !getType().equals(TYPE_STANDARD)) {
-      throw new SliderException("Invalid type for the component " + getType());
-    }
-
-    if (version.equals(Metainfo.VERSION_TWO_ZERO)) {
-      if (getType().equals(TYPE_DOCKER)) {
-        throw new SliderException(TYPE_DOCKER + " is not supported in version " + Metainfo.VERSION_TWO_ZERO);
-      }
-
-      if (getCommands().size() > 0) {
-        throw new SliderException("commands are not supported in version " + Metainfo.VERSION_TWO_ZERO);
-      }
-    }
-
-    if (commandScript != null) {
-      commandScript.validate(version);
-    }
-
-    if (version.equals(Metainfo.VERSION_TWO_ONE)) {
-      for (ComponentCommand cc : getCommands()) {
-        cc.validate(version);
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ComponentCommand.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ComponentCommand.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ComponentCommand.java
deleted file mode 100644
index 52117c5..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ComponentCommand.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.core.exceptions.SliderException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Represents the metadata associated with the application.
- */
-public class ComponentCommand implements Validate {
-  protected static final Logger
-      log = LoggerFactory.getLogger(ComponentCommand.class);
-
-
-  private String exec;
-  private String name = "START";
-  private String type = "SHELL";
-
-  /**
-   * Creator.
-   */
-  public ComponentCommand() {
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public void setExec(String exec) {
-    this.exec = exec;
-  }
-
-  public String getExec() {
-    return exec;
-  }
-
-  public void setType(String type) {
-    this.type = type;
-  }
-
-  public String getType() {
-    return type;
-  }
-
-  public void validate(String version) throws SliderException {
-    Metainfo.checkNonNull(getName(), "name", "componentCommand");
-
-    Metainfo.checkNonNull(getType(), "version", "application");
-  }
-
-  public static ComponentCommand getDefaultComponentCommand() {
-    ComponentCommand cc = new ComponentCommand();
-    cc.setExec("DEFAULT");
-    return cc;
-  }
-
-  public static ComponentCommand getDefaultComponentCommand(String commandName) {
-    ComponentCommand cc = new ComponentCommand();
-    cc.setExec("DEFAULT");
-    cc.setName(commandName);
-    return cc;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ComponentExport.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ComponentExport.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ComponentExport.java
deleted file mode 100644
index a18854c..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ComponentExport.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-/**
- *
- */
-public class ComponentExport {
-  String name;
-  String value;
-
-  public ComponentExport() {
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public String getValue() {
-    return value;
-  }
-
-  public void setValue(String value) {
-    this.value = value;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("{");
-    sb.append(",\n\"name\": ").append(name);
-    sb.append(",\n\"value\": ").append(value);
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ComponentsInAddonPackage.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ComponentsInAddonPackage.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ComponentsInAddonPackage.java
deleted file mode 100644
index 855e5b6..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ComponentsInAddonPackage.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.core.exceptions.SliderException;
-
-public class ComponentsInAddonPackage extends AbstractComponent {
-
-  @Override
-  public void validate(String version) throws SliderException {
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ConfigFile.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ConfigFile.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ConfigFile.java
deleted file mode 100644
index cb47512..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ConfigFile.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.core.exceptions.SliderException;
-
-/**
- *
- */
-public class ConfigFile implements Validate {
-  String type;
-  String fileName;
-  String dictionaryName;
-
-  public ConfigFile() {
-  }
-
-  public String getType() {
-    return type;
-  }
-
-  public void setType(String type) {
-    this.type = type;
-  }
-
-  public String getFileName() {
-    return fileName;
-  }
-
-  public void setFileName(String fileName) {
-    this.fileName = fileName;
-  }
-
-  public String getDictionaryName() {
-    return dictionaryName;
-  }
-
-  public void setDictionaryName(String dictionaryName) {
-    this.dictionaryName = dictionaryName;
-  }
-
-  public void validate(String version) throws SliderException {
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DefaultConfig.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DefaultConfig.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DefaultConfig.java
deleted file mode 100644
index 46c8836..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DefaultConfig.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Application default config
- */
-public class DefaultConfig {
-  List<PropertyInfo> propertyInfos;
-
-  public DefaultConfig() {
-    propertyInfos = new ArrayList<PropertyInfo>();
-  }
-
-  public void addPropertyInfo(PropertyInfo propertyInfo) {
-    propertyInfos.add(propertyInfo);
-  }
-
-  public List<PropertyInfo> getPropertyInfos() {
-    return propertyInfos;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DefaultConfigParser.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DefaultConfigParser.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DefaultConfigParser.java
deleted file mode 100644
index e136775..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DefaultConfigParser.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.commons.digester.Digester;
-import org.xml.sax.SAXException;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- *
- */
-public class DefaultConfigParser {
-
-  public DefaultConfig parse(InputStream configFileStream) throws IOException {
-    Digester digester = new Digester();
-    digester.setValidating(false);
-
-    digester.addObjectCreate("configuration", DefaultConfig.class);
-
-    digester.addObjectCreate("*/property", PropertyInfo.class);
-    digester.addBeanPropertySetter("*/property/name");
-    digester.addBeanPropertySetter("*/property/value");
-    digester.addBeanPropertySetter("*/property/description");
-    digester.addSetNext("*/property", "addPropertyInfo");
-
-    try {
-      return (DefaultConfig) digester.parse(configFileStream);
-    } catch (IOException e) {
-
-    } catch (SAXException e) {
-
-    } finally {
-      configFileStream.close();
-    }
-
-    return null;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DockerContainer.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DockerContainer.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DockerContainer.java
deleted file mode 100644
index 4c61e7f..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DockerContainer.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.core.exceptions.SliderException;
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Represents a docker container
- */
-public class DockerContainer implements Validate {
-  protected static final Logger
-      log = LoggerFactory.getLogger(DockerContainer.class);
-
-  private String name;
-  private String image;
-  private String network;
-  private String useNetworkScript;
-  private String options;
-  private List<DockerContainerMount> mounts = new ArrayList<>();
-  private List<DockerContainerPort> ports = new ArrayList<>();
-  private String statusCommand;
-  private String startCommand;
-  private String commandPath;
-  private String additionalParam;
-  private String runPrivilegedContainer;
-  private List<DockerContainerInputFile> inputFiles = new ArrayList<>();
-  private List<ConfigFile> configFiles = new ArrayList<>();
-
-  public DockerContainer() {
-  }
-
-  @JsonProperty("mounts")
-  public List<DockerContainerMount> getMounts() { return this.mounts; }
-
-  @JsonProperty("ports")
-  public List<DockerContainerPort> getPorts() {
-    return this.ports;
-  }
-
-  @JsonProperty("inputFiles")
-  public List<DockerContainerInputFile> getInputFiles() {
-    return this.inputFiles;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public String getImage() {
-    return image;
-  }
-
-  public void setImage(String image) {
-    this.image = image;
-  }
-
-  public String getNetwork() {
-    return network;
-  }
-
-  public void setNetwork(String network) {
-    this.network = network;
-  }
-
-  public String getUseNetworkScript() {
-    return useNetworkScript;
-  }
-
-  public void setUseNetworkScript(String useNetworkScript) {
-    this.useNetworkScript = useNetworkScript;
-  }
-
-  public String getOptions() {
-    return options;
-  }
-
-  public void setOptions(String options) {
-    this.options = options;
-  }
-
-  @Override
-  public void validate(String version) throws SliderException {
-    Metainfo.checkNonNull(getName(), "name", "dockerContainer");
-    Metainfo.checkNonNull(getImage(), "image", "dockerContainer");
-    for (DockerContainerMount dcm : getMounts()) {
-      dcm.validate(version);
-    }
-    for (DockerContainerPort dcp : getPorts()) {
-      dcp.validate(version);
-    }
-  }
-
-  @JsonProperty("statusCommand")
-  public String getStatusCommand() {
-    return statusCommand;
-  }
-
-  @JsonProperty("statusCommand")
-  public void setStatusCommand(String statusCommand) {
-    this.statusCommand = statusCommand;
-  }
-
-  public String getCommandPath() {
-    return commandPath;
-  }
-
-  public void setCommandPath(String commandPath) {
-    this.commandPath = commandPath;
-  }
-
-  public String getAdditionalParam() {
-    return additionalParam;
-  }
-
-  public void setAdditionalParam(String additionalParam) {
-    this.additionalParam = additionalParam;
-  }
-
-  @JsonProperty("startCommand")
-  public String getStartCommand() {
-    return startCommand;
-  }
-
-  @JsonProperty("startCommand")
-  public void setStartCommand(String startCommand) {
-    this.startCommand = startCommand;
-  }
-
-  @JsonProperty("runPrivilegedContainer")
-  public String getRunPrivilegedContainer() {
-    return runPrivilegedContainer;
-  }
-
-  @JsonProperty("runPrivilegedContainer")
-  public void setRunPrivilegedContainer(String runPrivilegedContainer) {
-    this.runPrivilegedContainer = runPrivilegedContainer;
-  }
-
-  public List<ConfigFile> getConfigFiles() {
-    return configFiles;
-  }
-
-  public void setConfigFiles(List<ConfigFile> configFiles) {
-    this.configFiles = configFiles;
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder result = new StringBuilder("DockerContainer [name=")
-        .append(name).append(", image=").append(image).append(", options=")
-        .append(options).append(", mounts=").append(mounts).append(", ports=")
-        .append(ports).append(", statusCommand=").append(statusCommand)
-        .append(", commandPath=").append(commandPath)
-        .append(", additionalParam=").append(additionalParam)
-        .append(", inputFiles=").append(inputFiles).append(", startCommand=")
-        .append(startCommand).append(", runPriviledgedContainer=")
-        .append(runPrivilegedContainer).append(", configFiles=")
-        .append(configFiles).append("]");
-    return result.toString();
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DockerContainerInputFile.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DockerContainerInputFile.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DockerContainerInputFile.java
deleted file mode 100644
index 0faceb9..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DockerContainerInputFile.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DockerContainerInputFile {
-  protected static final Logger log = LoggerFactory
-      .getLogger(DockerContainerInputFile.class);
-
-  private String containerPath;
-  private String fileLocalPath;
-
-  public DockerContainerInputFile() {
-  }
-
-  public String getContainerMount() {
-    return containerPath;
-  }
-
-  public void setContainerMount(String containerMount) {
-    this.containerPath = containerMount;
-  }
-
-  public String getFileLocalPath() {
-    return fileLocalPath;
-  }
-
-  public void setFileLocalPath(String fileLocalPath) {
-    this.fileLocalPath = fileLocalPath;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DockerContainerMount.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DockerContainerMount.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DockerContainerMount.java
deleted file mode 100644
index 61f07f4..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DockerContainerMount.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.core.exceptions.SliderException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Represents a docker container mount
- */
-public class DockerContainerMount implements Validate {
-  protected static final Logger
-      log = LoggerFactory.getLogger(DockerContainerMount.class);
-
-
-  private String containerMount;
-  private String hostMount;
-
-  public DockerContainerMount() {
-  }
-
-  public String getContainerMount() {
-    return containerMount;
-  }
-
-  public void setContainerMount(String containerMount) {
-    this.containerMount = containerMount;
-  }
-
-  public String getHostMount() {
-    return hostMount;
-  }
-
-  public void setHostMount(String hostMount) {
-    this.hostMount = hostMount;
-  }
-
-  @Override
-  public void validate(String version) throws SliderException {
-    Metainfo.checkNonNull(getContainerMount(), "containerMount", "dockerContainerMount");
-    Metainfo.checkNonNull(getHostMount(), "hostMount", "dockerContainerMount");
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DockerContainerPort.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DockerContainerPort.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DockerContainerPort.java
deleted file mode 100644
index 0629d9d..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/DockerContainerPort.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.core.exceptions.SliderException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Represents a docker container port
- */
-public class DockerContainerPort implements Validate {
-  protected static final Logger
-      log = LoggerFactory.getLogger(DockerContainerPort.class);
-
-
-  private String containerPort;
-  private String hostPort;
-
-  public DockerContainerPort() {
-  }
-
-  public String getContainerPort() {
-    return containerPort;
-  }
-
-  public void setContainerPort(String containerPort) {
-    this.containerPort = containerPort;
-  }
-
-  public String getHostPort() {
-    return hostPort;
-  }
-
-  public void setHostPort(String hostPort) {
-    this.hostPort = hostPort;
-  }
-
-  @Override
-  public void validate(String version) throws SliderException {
-    Metainfo.checkNonNull(getContainerPort(), "containerPort", "dockerContainerPort");
-    Metainfo.checkNonNull(getHostPort(), "hostPort", "dockerContainerPort");
-  }
-
-  @Override
-  public String toString() {
-    return "DockerContainerPort [containerPort=" + containerPort
-         + ", hostPort=" + hostPort + "]";
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Export.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Export.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Export.java
deleted file mode 100644
index 5e0fb24..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Export.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.core.exceptions.SliderException;
-
-/**
- *
- */
-public class Export implements Validate {
-  String name;
-  String value;
-
-  public Export() {
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public String getValue() {
-    return value;
-  }
-
-  public void setValue(String value) {
-    this.value = value;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("{");
-    sb.append(",\n\"name\": ").append(name);
-    sb.append(",\n\"value\": ").append(value);
-    sb.append('}');
-    return sb.toString();
-  }
-
-  public void validate(String version) throws SliderException {
-    Metainfo.checkNonNull(getName(), "name", "export");
-    Metainfo.checkNonNull(getValue(), "value", "export");
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ExportGroup.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ExportGroup.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ExportGroup.java
deleted file mode 100644
index 3d9f34c..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/ExportGroup.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.core.exceptions.SliderException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- */
-public class ExportGroup implements Validate {
-  String name;
-  List<Export> exports;
-
-  public ExportGroup() {
-    exports = new ArrayList<Export>();
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public void addExport(Export export) {
-    exports.add(export);
-  }
-
-  public List<Export> getExports() {
-    return exports;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb =
-        new StringBuilder("{");
-    sb.append(",\n\"name\": ").append(name);
-    sb.append(",\n\"exports\" : {");
-    for (Export export : exports) {
-      sb.append("\n").append(export);
-    }
-    sb.append("\n},");
-    sb.append('}');
-    return sb.toString();
-  }
-
-  public void validate(String version) throws SliderException {
-    Metainfo.checkNonNull(getName(), "name", "exportGroup");
-    for(Export exp : getExports()) {
-      exp.validate(version);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Metainfo.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Metainfo.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Metainfo.java
deleted file mode 100644
index 10c497f..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Metainfo.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.SliderException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Application metainfo uber class
- */
-public class Metainfo {
-  protected static final Logger log =
-      LoggerFactory.getLogger(Metainfo.class);
-  public static String VERSION_TWO_ZERO = "2.0";
-  public static String VERSION_TWO_ONE = "2.1";
-
-  String schemaVersion;
-  ApplicationPackage applicationPackage;
-  Application application;
-
-  public String getSchemaVersion() {
-    return schemaVersion;
-  }
-
-  public void setSchemaVersion(String schemaVersion) {
-    this.schemaVersion = schemaVersion;
-  }
-
-  public ApplicationPackage getApplicationPackage() {
-    return applicationPackage;
-  }
-
-  public void setApplicationPackage(ApplicationPackage pkg) {
-    this.applicationPackage = pkg;
-  }
-
-  public Application getApplication() {
-    return application;
-  }
-
-  public void setApplication(Application application) {
-    this.application = application;
-  }
-
-  public Component getApplicationComponent(String roleGroup) {
-    if (application == null) {
-      log.error("Malformed app definition: Expect application as the top level element for metainfo");
-    } else {
-      for (Component component : application.getComponents()) {
-        if (component.getName().equals(roleGroup)) {
-          return component;
-        }
-      }
-    }
-    return null;
-  }
-
-  public List<ConfigFile> getComponentConfigFiles(String roleGroup) {
-    List<ConfigFile> componentConfigFiles = new ArrayList<>();
-    componentConfigFiles.addAll(application.getConfigFiles());
-    Component component = getApplicationComponent(roleGroup);
-    if (component != null) {
-      componentConfigFiles.addAll(component.getConfigFiles());
-    }
-    return componentConfigFiles;
-  }
-
-  public void validate() throws SliderException {
-    if (!VERSION_TWO_ONE.equals(schemaVersion) &&
-        !VERSION_TWO_ZERO.equals(schemaVersion)) {
-      throw new SliderException("Unsupported version " + getSchemaVersion());
-    }
-    if (application != null) {
-      application.validate(schemaVersion);
-    }
-    if (applicationPackage != null) {
-      applicationPackage.validate(schemaVersion);
-    }
-  }
-
-  public static void checkNonNull(String value, String field, String type) throws SliderException {
-    if (SliderUtils.isUnset(value)) {
-      throw new SliderException(type + "." + field + " cannot be null");
-    }
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder builder = new StringBuilder();
-    builder.append("Metainfo [schemaVersion=");
-    builder.append(schemaVersion);
-    builder.append(", applicationPackage=");
-    builder.append(applicationPackage);
-    builder.append(", application=");
-    builder.append(application);
-    builder.append("]");
-    return builder.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/MetainfoParser.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/MetainfoParser.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/MetainfoParser.java
deleted file mode 100644
index 8b520eb..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/MetainfoParser.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.commons.digester.Digester;
-
-/**
- *
- */
-public class MetainfoParser extends AbstractMetainfoParser{
-  
-  protected void composeSchema(Digester digester){
-    digester.addObjectCreate("metainfo", Metainfo.class);
-    digester.addBeanPropertySetter("metainfo/schemaVersion");
-
-    digester.addObjectCreate("*/application", Application.class);
-    digester.addBeanPropertySetter("*/application/name");
-    digester.addBeanPropertySetter("*/application/comment");
-    digester.addBeanPropertySetter("*/application/version");
-    digester.addBeanPropertySetter("*/application/exportedConfigs");
-
-    digester.addObjectCreate("*/commandOrder", CommandOrder.class);
-    digester.addBeanPropertySetter("*/commandOrder/command");
-    digester.addBeanPropertySetter("*/commandOrder/requires");
-    digester.addSetNext("*/commandOrder", "addCommandOrder");
-
-    digester.addObjectCreate("*/exportGroup", ExportGroup.class);
-    digester.addBeanPropertySetter("*/exportGroup/name");
-    digester.addObjectCreate("*/export", Export.class);
-    digester.addBeanPropertySetter("*/export/name");
-    digester.addBeanPropertySetter("*/export/value");
-    digester.addSetNext("*/export", "addExport");
-    digester.addSetNext("*/exportGroup", "addExportGroup");
-
-    digester.addObjectCreate("*/component", Component.class);
-    digester.addBeanPropertySetter("*/component/name");
-    digester.addBeanPropertySetter("*/component/category");
-    digester.addBeanPropertySetter("*/component/publishConfig");
-    digester.addBeanPropertySetter("*/component/minInstanceCount");
-    digester.addBeanPropertySetter("*/component/maxInstanceCount");
-    digester.addBeanPropertySetter("*/component/autoStartOnFailure");
-    digester.addBeanPropertySetter("*/component/appExports");
-    digester.addBeanPropertySetter("*/component/compExports");
-    digester.addObjectCreate("*/componentExport", ComponentExport.class);
-    digester.addBeanPropertySetter("*/componentExport/name");
-    digester.addBeanPropertySetter("*/componentExport/value");
-    digester.addSetNext("*/componentExport", "addComponentExport");
-    digester.addSetNext("*/component", "addComponent");
-
-    digester.addObjectCreate("*/commandScript", CommandScript.class);
-    digester.addBeanPropertySetter("*/commandScript/script");
-    digester.addBeanPropertySetter("*/commandScript/scriptType");
-    digester.addBeanPropertySetter("*/commandScript/timeout");
-    digester.addSetNext("*/commandScript", "addCommandScript");
-
-    digester.addObjectCreate("*/command", ComponentCommand.class);
-    digester.addBeanPropertySetter("*/command/exec");
-    digester.addBeanPropertySetter("*/command/name");
-    digester.addBeanPropertySetter("*/command/type");
-    digester.addSetNext("*/command", "addCommand");
-
-    digester.addObjectCreate("*/osSpecific", OSSpecific.class);
-    digester.addBeanPropertySetter("*/osSpecific/osType");
-    digester.addObjectCreate("*/osSpecific/packages/package", OSPackage.class);
-    digester.addBeanPropertySetter("*/osSpecific/packages/package/type");
-    digester.addBeanPropertySetter("*/osSpecific/packages/package/name");
-    digester.addSetNext("*/osSpecific/packages/package", "addOSPackage");
-    digester.addSetNext("*/osSpecific", "addOSSpecific");
-
-    digester.addObjectCreate("*/application/packages/package", Package.class);
-    digester.addBeanPropertySetter("*/application/packages/package/type");
-    digester.addBeanPropertySetter("*/application/packages/package/name");
-    digester.addSetNext("*/application/packages/package", "addPackage");
-
-    digester.addObjectCreate("*/configFile", ConfigFile.class);
-    digester.addBeanPropertySetter("*/configFile/type");
-    digester.addBeanPropertySetter("*/configFile/fileName");
-    digester.addBeanPropertySetter("*/configFile/dictionaryName");
-    digester.addSetNext("*/configFile", "addConfigFile");
-
-    digester.addSetRoot("*/application", "setApplication");
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/OSPackage.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/OSPackage.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/OSPackage.java
deleted file mode 100644
index 32b4890..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/OSPackage.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.core.exceptions.SliderException;
-
-/**
- *
- */
-public class OSPackage implements Validate {
-  String type;
-  String name;
-
-  public OSPackage() {
-  }
-
-  public String getType() {
-    return type;
-  }
-
-  public void setType(String type) {
-    this.type = type;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public void validate(String version) throws SliderException {
-    Metainfo.checkNonNull(getName(), "name", "osPackage");
-    Metainfo.checkNonNull(getType(), "type", "osPackage");
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/OSSpecific.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/OSSpecific.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/OSSpecific.java
deleted file mode 100644
index c06d498..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/OSSpecific.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.core.exceptions.SliderException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- */
-public class OSSpecific implements Validate {
-  String osType;
-  List<OSPackage> packages;
-
-  public OSSpecific() {
-    packages = new ArrayList<OSPackage>();
-  }
-
-  public String getOsType() {
-    return osType;
-  }
-
-  public void setOsType(String osType) {
-    this.osType = osType;
-  }
-
-  public void addOSPackage(OSPackage osPackage) {
-    packages.add(osPackage);
-  }
-
-  public List<OSPackage> getPackages() {
-    return packages;
-  }
-
-  public void validate(String version) throws SliderException {
-    Metainfo.checkNonNull(getOsType(), "osType", "osSpecific");
-    for (OSPackage opkg : getPackages()) {
-      opkg.validate(version);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Package.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Package.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Package.java
deleted file mode 100644
index b88f77d..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Package.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.core.exceptions.SliderException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Represents package description.
- */
-public class Package implements Validate {
-  protected static final Logger
-      log = LoggerFactory.getLogger(Package.class);
-
-
-  private String name;
-  private String type;
-
-  public Package() {
-  }
-
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public String getType() {
-    return type;
-  }
-
-  public void setType(String type) {
-    this.type = type;
-  }
-
-  public void validate(String version) throws SliderException {
-    Metainfo.checkNonNull(getName(), "name", "package");
-    Metainfo.checkNonNull(getType(), "type", "package");
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/PropertyInfo.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/PropertyInfo.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/PropertyInfo.java
deleted file mode 100644
index 62ee0f5..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/PropertyInfo.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-/**
- * Application config property info
- */
-public class PropertyInfo {
-  String name;
-  String value;
-  String description;
-
-  public PropertyInfo() {
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public String getValue() {
-    return value;
-  }
-
-  public void setValue(String value) {
-    this.value = value;
-  }
-
-  public String getDescription() {
-    return description;
-  }
-
-  public void setDescription(String description) {
-    this.description = description;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Validate.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Validate.java b/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Validate.java
deleted file mode 100644
index ef03dcd..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/application/metadata/Validate.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.slider.providers.agent.application.metadata;
-
-import org.apache.slider.core.exceptions.SliderException;
-
-/**
- * Implementer provides a validate method
- */
-public interface Validate {
-
-  public void validate(String version) throws SliderException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/todo.md
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/todo.md b/slider-core/src/main/java/org/apache/slider/providers/agent/todo.md
deleted file mode 100644
index dfd1373..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/todo.md
+++ /dev/null
@@ -1,22 +0,0 @@
-<!---
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
-  
-# todo list
-
-* Retry on failure
-  * Agent can toleate a configurable number of failures (e.g. 3) before giving up
-* Agent should separate out hostname and label that is received for registration

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMClientProvider.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMClientProvider.java b/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMClientProvider.java
deleted file mode 100644
index e5430f2..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMClientProvider.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers.slideram;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.yarn.api.records.LocalResource;
-import org.apache.hadoop.yarn.api.records.LocalResourceType;
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.slider.api.InternalKeys;
-import org.apache.slider.api.ResourceKeys;
-import org.apache.slider.api.RoleKeys;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.SliderXmlConfKeys;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.BadClusterStateException;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.launch.AbstractLauncher;
-import org.apache.slider.core.launch.JavaCommandLineBuilder;
-import org.apache.slider.providers.AbstractClientProvider;
-import org.apache.slider.providers.PlacementPolicy;
-import org.apache.slider.providers.ProviderRole;
-import org.apache.slider.providers.ProviderUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.apache.slider.api.ResourceKeys.COMPONENT_INSTANCES;
-
-/**
- * handles the setup of the Slider AM.
- * This keeps aspects of role, cluster validation and Clusterspec setup
- * out of the core slider client
- */
-public class SliderAMClientProvider extends AbstractClientProvider
-    implements SliderKeys {
-
-
-  protected static final Logger log =
-    LoggerFactory.getLogger(SliderAMClientProvider.class);
-  protected static final String NAME = "SliderAM";
-  public static final String INSTANCE_RESOURCE_BASE = PROVIDER_RESOURCE_BASE_ROOT +
-                                                       "slideram/instance/";
-  public static final String INTERNAL_JSON =
-    INSTANCE_RESOURCE_BASE + "internal.json";
-  public static final String APPCONF_JSON =
-    INSTANCE_RESOURCE_BASE + "appconf.json";
-  public static final String RESOURCES_JSON =
-    INSTANCE_RESOURCE_BASE + "resources.json";
-
-  public SliderAMClientProvider(Configuration conf) {
-    super(conf);
-  }
-
-  /**
-   * List of roles
-   */
-  public static final List<ProviderRole> ROLES =
-    new ArrayList<ProviderRole>();
-
-  public static final int KEY_AM = ROLE_AM_PRIORITY_INDEX;
-
-  public static final ProviderRole APPMASTER =
-      new ProviderRole(COMPONENT_AM, KEY_AM,
-          PlacementPolicy.EXCLUDE_FROM_FLEXING,
-          ResourceKeys.DEFAULT_NODE_FAILURE_THRESHOLD, 
-          0, "");
-
-  /**
-   * Initialize role list
-   */
-  static {
-    ROLES.add(APPMASTER);
-  }
-
-  @Override
-  public String getName() {
-    return NAME;
-  }
-
-  @Override
-  public List<ProviderRole> getRoles() {
-    return ROLES;
-  }
-
-
-  @Override //Client
-  public void preflightValidateClusterConfiguration(SliderFileSystem sliderFileSystem,
-                                                    String clustername,
-                                                    Configuration configuration,
-                                                    AggregateConf instanceDefinition,
-                                                    Path clusterDirPath,
-                                                    Path generatedConfDirPath,
-                                                    boolean secure)
-      throws SliderException, IOException {
-
-    super.preflightValidateClusterConfiguration(sliderFileSystem, clustername, configuration, instanceDefinition, clusterDirPath, generatedConfDirPath, secure);
-    //add a check for the directory being writeable by the current user
-    String
-      dataPath = instanceDefinition.getInternalOperations()
-                                   .getGlobalOptions()
-                                   .getMandatoryOption(
-                                     InternalKeys.INTERNAL_DATA_DIR_PATH);
-
-    Path path = new Path(dataPath);
-    sliderFileSystem.verifyDirectoryWriteAccess(path);
-    Path historyPath = new Path(clusterDirPath, SliderKeys.HISTORY_DIR_NAME);
-    sliderFileSystem.verifyDirectoryWriteAccess(historyPath);
-  }
-
-  /**
-   * Verify that an instance definition is considered valid by the provider
-   * @param instanceDefinition instance definition
-   * @throws SliderException if the configuration is not valid
-   */
-  public void validateInstanceDefinition(AggregateConf instanceDefinition, SliderFileSystem fs) throws
-      SliderException {
-
-    super.validateInstanceDefinition(instanceDefinition, fs);
-    
-    // make sure there is no negative entry in the instance count
-    Map<String, Map<String, String>> instanceMap =
-        instanceDefinition.getResources().components;
-    for (Map.Entry<String, Map<String, String>> entry : instanceMap.entrySet()) {
-      MapOperations mapOperations = new MapOperations(entry);
-      int instances = mapOperations.getOptionInt(COMPONENT_INSTANCES, 0);
-      if (instances < 0) {
-        throw new BadClusterStateException(
-            "Component %s has negative instance count: %d",
-            mapOperations.name,
-            instances);
-      }
-    }
-  }
-  
-  /**
-   * The Slider AM sets up all the dependency JARs above slider.jar itself
-   * {@inheritDoc}
-   */
-  public void prepareAMAndConfigForLaunch(SliderFileSystem fileSystem,
-      Configuration serviceConf,
-      AbstractLauncher launcher,
-      AggregateConf instanceDescription,
-      Path snapshotConfDirPath,
-      Path generatedConfDirPath,
-      Configuration clientConfExtras,
-      String libdir,
-      Path tempPath, boolean miniClusterTestRun)
-    throws IOException, SliderException {
-
-    Map<String, LocalResource> providerResources = new HashMap<>();
-
-    ProviderUtils.addProviderJar(providerResources,
-        this,
-        SLIDER_JAR,
-        fileSystem,
-        tempPath,
-        libdir,
-        miniClusterTestRun);
-
-    String libDirProp =
-        System.getProperty(SliderKeys.PROPERTY_LIB_DIR);
-    log.info("Loading all dependencies for AM.");
-    // If slider.tar.gz is available in hdfs use it, else upload all jars
-    Path dependencyLibTarGzip = fileSystem.getDependencyTarGzip();
-    if (fileSystem.isFile(dependencyLibTarGzip)) {
-      SliderUtils.putAmTarGzipAndUpdate(providerResources, fileSystem);
-    } else {
-      ProviderUtils.addAllDependencyJars(providerResources,
-                                         fileSystem,
-                                         tempPath,
-                                         libdir,
-                                         libDirProp);
-    }
-    addKeytabResourceIfNecessary(fileSystem,
-                                 instanceDescription,
-                                 providerResources);
-
-    launcher.addLocalResources(providerResources);
-
-    //also pick up all env variables from a map
-    launcher.copyEnvVars(
-      instanceDescription.getInternalOperations().getOrAddComponent(
-        SliderKeys.COMPONENT_AM));
-  }
-
-  /**
-   * If the cluster is secure, and an HDFS installed keytab is available for AM
-   * authentication, add this keytab as a local resource for the AM launch.
-   *
-   * @param fileSystem
-   * @param instanceDescription
-   * @param providerResources
-   * @throws IOException
-   * @throws BadConfigException if there's no keytab and it is explicitly required.
-   */
-  protected void addKeytabResourceIfNecessary(SliderFileSystem fileSystem,
-                                              AggregateConf instanceDescription,
-                                              Map<String, LocalResource> providerResources)
-    throws IOException, BadConfigException {
-    if (UserGroupInformation.isSecurityEnabled()) {
-      String keytabPathOnHost = instanceDescription.getAppConfOperations()
-          .getComponent(SliderKeys.COMPONENT_AM).get(
-              SliderXmlConfKeys.KEY_AM_KEYTAB_LOCAL_PATH);
-      if (SliderUtils.isUnset(keytabPathOnHost)) {
-        String amKeytabName = instanceDescription.getAppConfOperations()
-            .getComponent(SliderKeys.COMPONENT_AM).get(
-                SliderXmlConfKeys.KEY_AM_LOGIN_KEYTAB_NAME);
-        String keytabDir = instanceDescription.getAppConfOperations()
-            .getComponent(SliderKeys.COMPONENT_AM).get(
-                SliderXmlConfKeys.KEY_HDFS_KEYTAB_DIR);
-        Path keytabPath = fileSystem.buildKeytabPath(keytabDir, amKeytabName,
-                                                     instanceDescription.getName());
-        if (fileSystem.getFileSystem().exists(keytabPath)) {
-          LocalResource keytabRes = fileSystem.createAmResource(keytabPath,
-                                                  LocalResourceType.FILE);
-
-          providerResources.put(SliderKeys.KEYTAB_DIR + "/" +
-                                 amKeytabName, keytabRes);
-        } else {
-          log.warn("No keytab file was found at {}.", keytabPath);
-          if (getConf().getBoolean(KEY_AM_LOGIN_KEYTAB_REQUIRED, false)) {
-            throw new BadConfigException("No keytab file was found at %s.", keytabPath);
-
-          } else {
-            log.warn("The AM will be "
-              + "started without a kerberos authenticated identity. "
-              + "The application is therefore not guaranteed to remain "
-              + "operational beyond 24 hours.");
-          }
-        }
-      }
-    }
-  }
-
-  /**
-   * Update the AM resource with any local needs
-   * @param capability capability to update
-   */
-  public void prepareAMResourceRequirements(MapOperations sliderAM,
-                                            Resource capability) {
-    capability.setMemory(sliderAM.getOptionInt(
-      ResourceKeys.YARN_MEMORY,
-      capability.getMemory()));
-    capability.setVirtualCores(
-        sliderAM.getOptionInt(ResourceKeys.YARN_CORES, capability.getVirtualCores()));
-  }
-  
-  /**
-   * Extract any JVM options from the cluster specification and
-   * add them to the command line
-   */
-  public void addJVMOptions(AggregateConf aggregateConf,
-                            JavaCommandLineBuilder cmdLine)
-      throws BadConfigException {
-
-    MapOperations sliderAM =
-        aggregateConf.getAppConfOperations().getMandatoryComponent(
-        SliderKeys.COMPONENT_AM);
-    cmdLine.forceIPv4().headless();
-    String heap = sliderAM.getOption(RoleKeys.JVM_HEAP,
-                                   DEFAULT_JVM_HEAP);
-    cmdLine.setJVMHeap(heap);
-    String jvmopts = sliderAM.getOption(RoleKeys.JVM_OPTS, "");
-    if (SliderUtils.isSet(jvmopts)) {
-      cmdLine.add(jvmopts);
-    }
-  }
-
-
-  @Override
-  public void prepareInstanceConfiguration(AggregateConf aggregateConf)
-      throws SliderException, IOException {
-    mergeTemplates(aggregateConf,
-        INTERNAL_JSON, RESOURCES_JSON, APPCONF_JSON
-                  );
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMProviderService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMProviderService.java b/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMProviderService.java
deleted file mode 100644
index 67d3647..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMProviderService.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers.slideram;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hdfs.HdfsConfiguration;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.registry.client.binding.RegistryTypeUtils;
-import org.apache.hadoop.registry.client.types.ServiceRecord;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.tools.ConfigHelper;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.launch.ContainerLauncher;
-import org.apache.slider.core.registry.docstore.PublishedConfiguration;
-import org.apache.slider.core.registry.info.CustomRegistryConstants;
-import org.apache.slider.providers.AbstractProviderService;
-import org.apache.slider.providers.ProviderCore;
-import org.apache.slider.providers.ProviderRole;
-import org.apache.slider.providers.agent.AgentKeys;
-import org.apache.slider.server.appmaster.PublishedArtifacts;
-import org.apache.slider.server.appmaster.web.rest.RestPaths;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.apache.slider.server.appmaster.web.rest.RestPaths.*;
-
-/**
- * Exists just to move some functionality out of AppMaster into a peer class
- * of the actual service provider doing the real work
- */
-public class SliderAMProviderService extends AbstractProviderService implements
-    ProviderCore,
-    AgentKeys,
-    SliderKeys {
-
-  public SliderAMProviderService() {
-    super("SliderAMProviderService");
-  }
-
-  @Override
-  public String getHumanName() {
-    return "Slider Application";
-  }
-  
-  @Override
-  public Configuration loadProviderConfigurationInformation(File confDir) throws
-      BadCommandArgumentsException,
-      IOException {
-    return null;
-  }
-
-  @Override
-  public void buildContainerLaunchContext(ContainerLauncher containerLauncher,
-      AggregateConf instanceDefinition,
-      Container container,
-      ProviderRole role,
-      SliderFileSystem sliderFileSystem,
-      Path generatedConfPath,
-      MapOperations resourceComponent,
-      MapOperations appComponent,
-      Path containerTmpDirPath) throws IOException, SliderException {
-  }
-
-  @Override
-  public List<ProviderRole> getRoles() {
-    return new ArrayList<>(0);
-  }
-
-  @Override
-  public void validateInstanceDefinition(AggregateConf instanceDefinition) throws
-      SliderException {
-
-  }
-
-  @Override
-  public void applyInitialRegistryDefinitions(URL amWebURI,
-      URL agentOpsURI,
-      URL agentStatusURI,
-      ServiceRecord serviceRecord)
-      throws IOException {
-    super.applyInitialRegistryDefinitions(amWebURI,
-        agentOpsURI,
-        agentStatusURI,
-        serviceRecord);
-    // now publish site.xml files
-    YarnConfiguration defaultYarnConfig = new YarnConfiguration();
-    amState.getPublishedSliderConfigurations().put(
-        PublishedArtifacts.COMPLETE_CONFIG,
-        new PublishedConfiguration(
-            "Complete slider application settings",
-            getConfig(), getConfig()));
-    amState.getPublishedSliderConfigurations().put(
-        PublishedArtifacts.YARN_SITE_CONFIG,
-        new PublishedConfiguration(
-            "YARN site settings",
-            ConfigHelper.loadFromResource("yarn-site.xml"),
-            defaultYarnConfig) );
-
-    amState.getPublishedSliderConfigurations().put(
-        PublishedArtifacts.CORE_SITE_CONFIG,
-        new PublishedConfiguration(
-            "Core site settings",
-            ConfigHelper.loadFromResource("core-site.xml"),
-            defaultYarnConfig) );
-    amState.getPublishedSliderConfigurations().put(
-        PublishedArtifacts.HDFS_SITE_CONFIG,
-        new PublishedConfiguration(
-            "HDFS site settings",
-            ConfigHelper.loadFromResource("hdfs-site.xml"),
-            new HdfsConfiguration(true)) );
-
-
-    try {
-
-      URL managementAPI = new URL(amWebURI, RELATIVE_PATH_MANAGEMENT);
-      URL registryREST = new URL(amWebURI, RELATIVE_PATH_REGISTRY);
-
-      URL publisherURL = new URL(amWebURI, RELATIVE_PATH_PUBLISHER);
-
-      // Set the configurations URL.
-
-      String configurationsURL = SliderUtils.appendToURL(
-          publisherURL.toExternalForm(), RestPaths.SLIDER_CONFIGSET);
-      String exportsURL = SliderUtils.appendToURL(
-          publisherURL.toExternalForm(), RestPaths.SLIDER_EXPORTS);
-
-      serviceRecord.addExternalEndpoint(
-          RegistryTypeUtils.webEndpoint(
-              CustomRegistryConstants.WEB_UI, amWebURI.toURI()));
-      
-      serviceRecord.addExternalEndpoint(
-          RegistryTypeUtils.webEndpoint(
-              CustomRegistryConstants.AM_REST_BASE, amWebURI.toURI()));
-      
-      serviceRecord.addExternalEndpoint(
-          RegistryTypeUtils.restEndpoint(
-              CustomRegistryConstants.MANAGEMENT_REST_API,
-              managementAPI.toURI()));
-      serviceRecord.addExternalEndpoint(
-          RegistryTypeUtils.restEndpoint(
-              CustomRegistryConstants.PUBLISHER_REST_API,
-              publisherURL.toURI()));
-      serviceRecord.addExternalEndpoint(
-          RegistryTypeUtils.restEndpoint(
-              CustomRegistryConstants.REGISTRY_REST_API,
-              registryREST.toURI()));
-      serviceRecord.addExternalEndpoint(
-          RegistryTypeUtils.restEndpoint(
-              CustomRegistryConstants.PUBLISHER_CONFIGURATIONS_API,
-              new URI(configurationsURL)));
-      serviceRecord.addExternalEndpoint(
-          RegistryTypeUtils.restEndpoint(
-              CustomRegistryConstants.PUBLISHER_EXPORTS_API,
-              new URI(exportsURL)));
-
-    } catch (URISyntaxException e) {
-      throw new IOException(e);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/AppMasterActionOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/AppMasterActionOperations.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/AppMasterActionOperations.java
deleted file mode 100644
index 288f25a..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/AppMasterActionOperations.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster;
-
-import org.apache.slider.server.appmaster.operations.RMOperationHandlerActions;
-
-/**
- * Interface of AM operations
- */
-public interface AppMasterActionOperations extends RMOperationHandlerActions {
-
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/PrivilegedConnectToCM.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/PrivilegedConnectToCM.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/PrivilegedConnectToCM.java
deleted file mode 100644
index 65b88cf..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/PrivilegedConnectToCM.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.server.appmaster;
-
-
-import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
-
-import java.net.InetSocketAddress;
-import java.security.PrivilegedAction;
-
-/**
- * Implement privileged connection to the CM
- *
- */
-public class PrivilegedConnectToCM implements PrivilegedAction<ContainerManagementProtocol> {
-  final SliderAppMaster appMaster;
-  final InetSocketAddress cmAddress;
-
-  public PrivilegedConnectToCM(SliderAppMaster appMaster,
-                               InetSocketAddress cmAddress) {
-    this.appMaster = appMaster;
-    this.cmAddress = cmAddress;
-  }
-
-
-  @Override //PrivilegedAction
-  public ContainerManagementProtocol run() {
-    return ((ContainerManagementProtocol) appMaster.getProxy(
-      ContainerManagementProtocol.class,
-      cmAddress));
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/ProtobufClusterServices.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/ProtobufClusterServices.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/ProtobufClusterServices.java
deleted file mode 100644
index 5d52441..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/ProtobufClusterServices.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster;
-
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.util.Records;
-import org.apache.hadoop.yarn.util.resource.Resources;
-import org.apache.slider.server.appmaster.state.AbstractClusterServices;
-
-public class ProtobufClusterServices extends AbstractClusterServices {
-
-  public Resource newResource() {
-    return Records.newRecord(Resource.class);
-  }
-
-  @Override
-  public Resource newResource(int memory, int cores) {
-    return Resources.createResource(memory, cores);
-  }
-}



[18/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppStateBindingInfo.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppStateBindingInfo.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppStateBindingInfo.java
deleted file mode 100644
index a8aa1a2..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppStateBindingInfo.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.NodeReport;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.providers.ProviderRole;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Binding information for application states; designed to be extensible
- * so that tests don't have to be massivley reworked when new arguments
- * are added.
- */
-public class AppStateBindingInfo {
-  public AggregateConf instanceDefinition;
-  public Configuration serviceConfig = new Configuration();
-  public Configuration publishedProviderConf = new Configuration(false);
-  public List<ProviderRole> roles = new ArrayList<>();
-  public FileSystem fs;
-  public Path historyPath;
-  public List<Container> liveContainers = new ArrayList<>(0);
-  public Map<String, String> applicationInfo = new HashMap<>();
-  public ContainerReleaseSelector releaseSelector = new SimpleReleaseSelector();
-  /** node reports off the RM. */
-  public List<NodeReport> nodeReports = new ArrayList<>(0);
-
-  public void validate() throws IllegalArgumentException {
-    Preconditions.checkArgument(instanceDefinition != null, "null instanceDefinition");
-    Preconditions.checkArgument(serviceConfig != null, "null appmasterConfig");
-    Preconditions.checkArgument(publishedProviderConf != null, "null publishedProviderConf");
-    Preconditions.checkArgument(releaseSelector != null, "null releaseSelector");
-    Preconditions.checkArgument(roles != null, "null providerRoles");
-    Preconditions.checkArgument(fs != null, "null fs");
-    Preconditions.checkArgument(historyPath != null, "null historyDir");
-    Preconditions.checkArgument(nodeReports != null, "null nodeReports");
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerAllocationOutcome.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerAllocationOutcome.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerAllocationOutcome.java
deleted file mode 100644
index 5b3a93c..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerAllocationOutcome.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-/**
- * Outcome of the assignment
- */
-public enum ContainerAllocationOutcome {
-  /**
-   * There wasn't a request for this
-   */
-  Unallocated,
-
-  /**
-   * Open placement
-   */
-  Open,
-
-  /**
-   * Allocated explicitly  where requested
-   */
-  Placed,
-
-  /**
-   * This was an escalated placement
-   */
-  Escalated
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerAllocationResults.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerAllocationResults.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerAllocationResults.java
deleted file mode 100644
index e80639e..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerAllocationResults.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import org.apache.slider.server.appmaster.operations.AbstractRMOperation;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This is just a tuple of the outcome of a container allocation
- */
-public class ContainerAllocationResults {
-
-  /**
-   * What was the outcome of this allocation: placed, escalated, ...
-   */
-  public ContainerAllocationOutcome outcome;
-
-  /**
-   * The outstanding request which originated this.
-   * This will be null if the outcome is {@link ContainerAllocationOutcome#Unallocated}
-   * as it wasn't expected.
-   */
-  public OutstandingRequest origin;
-
-  /**
-   * A possibly empty list of requests to add to the follow-up actions
-   */
-  public List<AbstractRMOperation> operations = new ArrayList<>(0);
-
-  public ContainerAllocationResults() {
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerAssignment.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerAssignment.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerAssignment.java
deleted file mode 100644
index 3e8a3c3..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerAssignment.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import org.apache.hadoop.yarn.api.records.Container;
-
-/**
- * Static assignment structure
- */
-public class ContainerAssignment {
-
-  /**
-   * Container that has been allocated
-   */
-  public final Container container;
-
-  /**
-   * Role to assign to it
-   */
-  public final RoleStatus role;
-
-  /**
-   * Placement outcome: was this from history or not
-   */
-  public final ContainerAllocationOutcome placement;
-
-  public ContainerAssignment(Container container,
-      RoleStatus role,
-      ContainerAllocationOutcome placement) {
-    this.container = container;
-    this.role = role;
-    this.placement = placement;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb = new StringBuilder("ContainerAssignment{");
-    sb.append("container=").append(container);
-    sb.append(", role=").append(role);
-    sb.append(", placement=").append(placement);
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerOutcome.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerOutcome.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerOutcome.java
deleted file mode 100644
index 59ab30b..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerOutcome.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import org.apache.hadoop.yarn.api.records.ContainerExitStatus;
-
-/**
- * Container outcomes we care about; slightly simplified from
- * {@link ContainerExitStatus} -and hopefully able to handle
- * any new exit codes.
- */
-public enum ContainerOutcome {
-  Completed,
-  Failed,
-  Failed_limits_exceeded,
-  Node_failure,
-  Preempted;
-
-  /**
-   * Build a container outcome from an exit status.
-   * The values in {@link ContainerExitStatus} are used
-   * here.
-   * @param exitStatus exit status
-   * @return an enumeration of the outcome.
-   */
-  public static ContainerOutcome fromExitStatus(int exitStatus) {
-    switch (exitStatus) {
-      case ContainerExitStatus.ABORTED:
-      case ContainerExitStatus.KILLED_BY_APPMASTER:
-      case ContainerExitStatus.KILLED_BY_RESOURCEMANAGER:
-      case ContainerExitStatus.KILLED_AFTER_APP_COMPLETION:
-        // could either be a release or node failure. Treat as completion
-        return Completed;
-      case ContainerExitStatus.DISKS_FAILED:
-        return Node_failure;
-      case ContainerExitStatus.PREEMPTED:
-        return Preempted;
-      case ContainerExitStatus.KILLED_EXCEEDED_PMEM:
-      case ContainerExitStatus.KILLED_EXCEEDED_VMEM:
-        return Failed_limits_exceeded;
-      default:
-        return exitStatus == 0 ? Completed : Failed;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerPriority.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerPriority.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerPriority.java
deleted file mode 100644
index df222fa..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerPriority.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.Priority;
-import org.apache.hadoop.yarn.util.Records;
-
-import java.util.Locale;
-
-/**
- * Class containing the logic to build/split container priorities into the
- * different fields used by Slider
- *
- * The original design here had a requestID merged with the role, to
- * track outstanding requests. However, this isn't possible, so
- * the request ID has been dropped. A "location specified" flag was
- * added to indicate whether or not the request was for a specific location
- * -though this is currently unused.
- * 
- * The methods are effectively surplus -but retained to preserve the
- * option of changing behavior in future
- */
-public final class ContainerPriority {
-
-  // bit that represents whether location is specified
-  static final int NOLOCATION = 1 << 30;
-  
-  public static int buildPriority(int role,
-                                  boolean locationSpecified) {
-    int location = locationSpecified ? 0 : NOLOCATION;
-    return role | location;
-  }
-
-
-  public static Priority createPriority(int role,
-                                        boolean locationSpecified) {
-    Priority pri = Records.newRecord(Priority.class);
-    pri.setPriority(ContainerPriority.buildPriority(role,
-                                                    locationSpecified));
-    return pri;
-  }
-
-  public static int extractRole(int priority) {
-    return priority >= NOLOCATION ? priority ^ NOLOCATION : priority;
-  }
-
-  /**
-   * Does the priority have location
-   * @param priority priority index
-   * @return true if the priority has the location marker
-   */
-  public static boolean hasLocation(int priority) {
-    return (priority ^ NOLOCATION ) == 0;
-  }
-  
-  /**
-   * Map from a container to a role key by way of its priority
-   * @param container container
-   * @return role key
-   */
-  public static int extractRole(Container container) {
-    Priority priority = container.getPriority();
-    return extractRole(priority);
-  }
-  
-  /**
-   * Priority record to role mapper
-   * @param priorityRecord priority record
-   * @return the role #
-   */
-  public static int extractRole(Priority priorityRecord) {
-    Preconditions.checkNotNull(priorityRecord);
-    return extractRole(priorityRecord.getPriority());
-  }
-
-  /**
-   * Convert a priority record to a string, extracting role and locality
-   * @param priorityRecord priority record. May be null
-   * @return a string value
-   */
-  public static String toString(Priority priorityRecord) {
-    if (priorityRecord==null) {
-      return "(null)";
-    } else {
-      return String.format(Locale.ENGLISH,
-          "role %d (locality=%b)",
-          extractRole(priorityRecord),
-          hasLocation(priorityRecord.getPriority()));
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerReleaseSelector.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerReleaseSelector.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerReleaseSelector.java
deleted file mode 100644
index fafbada..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ContainerReleaseSelector.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import java.util.List;
-
-/**
- * Interface implemented by anything that must choose containers to release
- * 
- */
-public interface ContainerReleaseSelector {
-
-  /**
-   * Given a list of candidate containers, return a sorted version of the priority
-   * in which they should be released. 
-   * @param candidates candidate list ... everything considered suitable
-   * @return the list of candidates
-   */
-  List<RoleInstance> sortCandidates(int roleId,
-      List<RoleInstance> candidates);
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/MostRecentContainerReleaseSelector.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/MostRecentContainerReleaseSelector.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/MostRecentContainerReleaseSelector.java
deleted file mode 100644
index 38c5b8e..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/MostRecentContainerReleaseSelector.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import org.apache.slider.common.tools.Comparators;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-/**
- * Sort the candidate list by the most recent container first.
- */
-public class MostRecentContainerReleaseSelector implements ContainerReleaseSelector {
-
-  @Override
-  public List<RoleInstance> sortCandidates(int roleId,
-      List<RoleInstance> candidates) {
-    Collections.sort(candidates, new newerThan());
-    return candidates;
-  }
-
-  private static class newerThan implements Comparator<RoleInstance>, Serializable {
-    private final Comparator<Long> innerComparator =
-        new Comparators.ComparatorReverser<>(new Comparators.LongComparator());
-    public int compare(RoleInstance o1, RoleInstance o2) {
-      return innerComparator.compare(o1.createTime, o2.createTime);
-
-    }
-    
-  }
-  
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeEntry.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeEntry.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeEntry.java
deleted file mode 100644
index eb8ff03..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeEntry.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import com.google.common.annotations.VisibleForTesting;
-import org.apache.slider.api.types.NodeEntryInformation;
-
-/**
- * Information about the state of a role on a specific node instance.
- * No fields are synchronized; sync on the instance to work with it
- * <p>
- * The two fields `releasing` and `requested` are used to track the ongoing
- * state of YARN requests; they do not need to be persisted across stop/start
- * cycles. They may be relevant across AM restart, but without other data
- * structures in the AM, not enough to track what the AM was up to before
- * it was restarted. The strategy will be to ignore unexpected allocation
- * responses (which may come from pre-restart) requests, while treating
- * unexpected container release responses as failures.
- * <p>
- * The `active` counter is only decremented after a container release response
- * has been received.
- * <p>
- *
- */
-public class NodeEntry implements Cloneable {
-  
-  public final int rolePriority;
-
-  public NodeEntry(int rolePriority) {
-    this.rolePriority = rolePriority;
-  }
-
-  /**
-   * instance explicitly requested on this node: it's OK if an allocation
-   * comes in that has not been (and when that happens, this count should 
-   * not drop).
-   */
-  private int requested;
-
-  /** number of starting instances */
-  private int starting;
-
-  /** incrementing counter of instances that failed to start */
-  private int startFailed;
-
-  /** incrementing counter of instances that failed */
-  private int failed;
-
-  /**
-   * Counter of "failed recently" events. These are all failures
-   * which have happened since it was last reset.
-   */
-  private int failedRecently;
-
-  /** incrementing counter of instances that have been pre-empted. */
-  private int preempted;
-
-  /**
-   * Number of live nodes. 
-   */
-  private int live;
-
-  /** number of containers being released off this node */
-  private int releasing;
-
-  /** timestamp of last use */
-  private long lastUsed;
-
-  /**
-   * Is the node available for assignments? That is, it is
-   * not running any instances of this type, nor are there
-   * any requests oustanding for it.
-   * @return true if a new request could be issued without taking
-   * the number of instances &gt; 1.
-   */
-  public synchronized boolean isAvailable() {
-    return live + requested + starting - releasing <= 0;
-  }
-
-  /**
-   * Are the anti-affinity constraints held. That is, zero or one
-   * node running or starting
-   * @return true if the constraint holds.
-   */
-  public synchronized boolean isAntiAffinityConstraintHeld() {
-    return (live - releasing + starting) <= 1;
-  }
-
-  /**
-   * return no of active instances -those that could be released as they
-   * are live and not already being released
-   * @return a number, possibly 0
-   */
-  public synchronized int getActive() {
-    return (live - releasing);
-  }
-
-  /**
-   * Return true if the node is not busy, and it
-   * has not been used since the absolute time
-   * @param absoluteTime time
-   * @return true if the node could be cleaned up
-   */
-  public synchronized boolean notUsedSince(long absoluteTime) {
-    return isAvailable() && lastUsed < absoluteTime;
-  }
-
-  public synchronized int getLive() {
-    return live;
-  }
-
-  public int getStarting() {
-    return starting;
-  }
-
-  /**
-   * Set the live value directly -used on AM restart
-   * @param v value
-   */
-  public synchronized void setLive(int v) {
-    live = v;
-  }
-  
-  private synchronized void incLive() {
-    ++live;
-  }
-
-  private synchronized void decLive() {
-    live = RoleHistoryUtils.decToFloor(live);
-  }
-  
-  public synchronized void onStarting() {
-    ++starting;
-  }
-
-  private void decStarting() {
-    starting = RoleHistoryUtils.decToFloor(starting);
-  }
-
-  public synchronized void onStartCompleted() {
-    decStarting();
-    incLive();
-  }
-  
-    /**
-   * start failed -decrement the starting flag.
-   * @return true if the node is now available
-   */
-  public synchronized boolean onStartFailed() {
-    decStarting();
-    ++startFailed;
-    return containerCompleted(false, ContainerOutcome.Failed);
-  }
-  
-  /**
-   * no of requests made of this role of this node. If it goes above
-   * 1 there's a problem
-   */
-  public synchronized  int getRequested() {
-    return requested;
-  }
-
-  /**
-   * request a node: 
-   */
-  public synchronized void request() {
-    ++requested;
-  }
-
-  /**
-   * A request made explicitly to this node has completed
-   */
-  public synchronized void requestCompleted() {
-    requested = RoleHistoryUtils.decToFloor(requested);
-  }
-
-  /**
-   * No of instances in release state
-   */
-  public synchronized int getReleasing() {
-    return releasing;
-  }
-
-  /**
-   * Release an instance -which is no longer marked as active
-   */
-  public synchronized void release() {
-    releasing++;
-  }
-
-  /**
-   * completion event, which can be a planned or unplanned
-   * planned: dec our release count
-   * unplanned: dec our live count
-   * @param wasReleased true if this was planned
-   * @param outcome
-   * @return true if this node is now available
-   */
-  public synchronized boolean containerCompleted(boolean wasReleased, ContainerOutcome outcome) {
-    if (wasReleased) {
-      releasing = RoleHistoryUtils.decToFloor(releasing);
-    } else {
-      // for the node, we use the outcome of the faiure to decide
-      // whether this is potentially "node-related"
-      switch(outcome) {
-        // general "any reason" app failure
-        case Failed:
-        // specific node failure
-        case Node_failure:
-
-          ++failed;
-          ++failedRecently;
-          break;
-
-        case Preempted:
-          preempted++;
-          break;
-
-          // failures which are node-independent
-        case Failed_limits_exceeded:
-        case Completed:
-        default:
-          break;
-      }
-    }
-    decLive();
-    return isAvailable();
-  }
-
-  /**
-   * Time last used.
-   */
-  public synchronized long getLastUsed() {
-    return lastUsed;
-  }
-
-  public synchronized void setLastUsed(long lastUsed) {
-    this.lastUsed = lastUsed;
-  }
-
-  public synchronized int getStartFailed() {
-    return startFailed;
-  }
-
-  public synchronized int getFailed() {
-    return failed;
-  }
-
-  public synchronized int getFailedRecently() {
-    return failedRecently;
-  }
-
-  @VisibleForTesting
-  public synchronized void setFailedRecently(int failedRecently) {
-    this.failedRecently = failedRecently;
-  }
-
-  public synchronized int getPreempted() {
-    return preempted;
-  }
-
-
-  /**
-   * Reset the failed recently count.
-   */
-  public synchronized void resetFailedRecently() {
-    failedRecently = 0;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb = new StringBuilder("NodeEntry{");
-    sb.append("priority=").append(rolePriority);
-    sb.append(", requested=").append(requested);
-    sb.append(", starting=").append(starting);
-    sb.append(", live=").append(live);
-    sb.append(", releasing=").append(releasing);
-    sb.append(", lastUsed=").append(lastUsed);
-    sb.append(", failedRecently=").append(failedRecently);
-    sb.append(", preempted=").append(preempted);
-    sb.append(", startFailed=").append(startFailed);
-    sb.append('}');
-    return sb.toString();
-  }
-
-  /**
-   * Produced a serialized form which can be served up as JSON
-   * @return a summary of the current role status.
-   */
-  public synchronized NodeEntryInformation serialize() {
-    NodeEntryInformation info = new NodeEntryInformation();
-    info.priority = rolePriority;
-    info.requested = requested;
-    info.releasing = releasing;
-    info.starting = starting;
-    info.startFailed = startFailed;
-    info.failed = failed;
-    info.failedRecently = failedRecently;
-    info.preempted = preempted;
-    info.live = live;
-    info.lastUsed = lastUsed;
-    return info;
-  }
-
-  @Override
-  public Object clone() throws CloneNotSupportedException {
-    return super.clone();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeInstance.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeInstance.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeInstance.java
deleted file mode 100644
index cc17cf0..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeInstance.java
+++ /dev/null
@@ -1,409 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.NodeReport;
-import org.apache.hadoop.yarn.api.records.NodeState;
-import org.apache.slider.api.types.NodeInformation;
-import org.apache.slider.common.tools.Comparators;
-import org.apache.slider.common.tools.SliderUtils;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-/**
- * A node instance -stores information about a node in the cluster.
- * <p>
- * Operations on the array/set of roles are synchronized.
- */
-public class NodeInstance {
-
-  public final String hostname;
-
-  /**
-   * last state of node. Starts off as {@link NodeState#RUNNING},
-   * on the assumption that it is live.
-   */
-  private NodeState nodeState = NodeState.RUNNING;
-
-  /**
-   * Last node report. If null: none
-   */
-  private NodeReport nodeReport = null;
-
-  /**
-   * time of state update
-   */
-  private long nodeStateUpdateTime = 0;
-
-  /**
-   * Node labels.
-   *
-   * IMPORTANT: we assume that there is one label/node, which is the policy
-   * for Hadoop as of November 2015
-   */
-  private String nodeLabels = "";
-
-  /**
-   * An unordered list of node entries of specific roles. There's nothing
-   * indexed so as to support sparser datastructures.
-   */
-  private final List<NodeEntry> nodeEntries;
-
-  /**
-   * Create an instance and the (empty) array of nodes
-   * @param roles role count -the no. of roles
-   */
-  public NodeInstance(String hostname, int roles) {
-    this.hostname = hostname;
-    nodeEntries = new ArrayList<>(roles);
-  }
-
-  /**
-   * Update the node status.
-   * The return code is true if the node state changed enough to
-   * trigger a re-evaluation of pending requests. That is, either a node
-   * became available when it was previously not, or the label changed
-   * on an available node.
-   *
-   * Transitions of a node from live to dead aren't treated as significant,
-   * nor label changes on a dead node.
-   *
-   * @param report latest node report
-   * @return true if the node state changed enough for a request evaluation.
-   */
-  public synchronized boolean updateNode(NodeReport report) {
-    nodeStateUpdateTime = report.getLastHealthReportTime();
-    nodeReport = report;
-    NodeState oldState = nodeState;
-    boolean oldStateUnusable = oldState.isUnusable();
-    nodeState = report.getNodeState();
-    boolean newUsable = !nodeState.isUnusable();
-    boolean nodeNowAvailable = oldStateUnusable && newUsable;
-    String labels = this.nodeLabels;
-    nodeLabels = SliderUtils.extractNodeLabel(report);
-    return nodeNowAvailable
-        || newUsable && !this.nodeLabels.equals(labels);
-  }
-
-  public String getNodeLabels() {
-    return nodeLabels;
-  }
-
-  /**
-   * Get the entry for a role -if present
-   * @param role role index
-   * @return the entry
-   * null if the role is out of range
-   */
-  public synchronized NodeEntry get(int role) {
-    for (NodeEntry nodeEntry : nodeEntries) {
-      if (nodeEntry.rolePriority == role) {
-        return nodeEntry;
-      }
-    }
-    return null;
-  }
-  
-  /**
-   * Get the entry for a role -if present
-   * @param role role index
-   * @return the entry
-   * @throws ArrayIndexOutOfBoundsException if the role is out of range
-   */
-  public synchronized NodeEntry getOrCreate(int role) {
-    NodeEntry entry = get(role);
-    if (entry == null) {
-      entry = new NodeEntry(role);
-      nodeEntries.add(entry);
-    }
-    return entry;
-  }
-
-  /**
-   * Get the node entry matching a container on this node
-   * @param container container
-   * @return matching node instance for the role
-   */
-  public NodeEntry getOrCreate(Container container) {
-    return getOrCreate(ContainerPriority.extractRole(container));
-  }
-
-  /**
-   * Count the number of active role instances on this node
-   * @param role role index
-   * @return 0 if there are none, otherwise the #of nodes that are running and
-   * not being released already.
-   */
-  public int getActiveRoleInstances(int role) {
-    NodeEntry nodeEntry = get(role);
-    return (nodeEntry != null ) ? nodeEntry.getActive() : 0;
-  }
-  
-  /**
-   * Count the number of live role instances on this node
-   * @param role role index
-   * @return 0 if there are none, otherwise the #of nodes that are running 
-   */
-  public int getLiveRoleInstances(int role) {
-    NodeEntry nodeEntry = get(role);
-    return (nodeEntry != null ) ? nodeEntry.getLive() : 0;
-  }
-
-  /**
-   * Is the node considered online
-   * @return the node
-   */
-  public boolean isOnline() {
-    return !nodeState.isUnusable();
-  }
-
-  /**
-   * Query for a node being considered unreliable
-   * @param role role key
-   * @param threshold threshold above which a node is considered unreliable
-   * @return true if the node is considered unreliable
-   */
-  public boolean isConsideredUnreliable(int role, int threshold) {
-    NodeEntry entry = get(role);
-    return entry != null && entry.getFailedRecently() > threshold;
-  }
-
-  /**
-   * Get the entry for a role -and remove it if present
-   * @param role the role index
-   * @return the entry that WAS there
-   */
-  public synchronized NodeEntry remove(int role) {
-    NodeEntry nodeEntry = get(role);
-    if (nodeEntry != null) {
-      nodeEntries.remove(nodeEntry);
-    }
-    return nodeEntry;
-  }
-
-  public synchronized void set(int role, NodeEntry nodeEntry) {
-    remove(role);
-    nodeEntries.add(nodeEntry);
-  }
-
-  /**
-   * run through each entry; gc'ing & removing old ones that don't have
-   * a recent failure count (we care about those)
-   * @param absoluteTime age in millis
-   * @return true if there are still entries left
-   */
-  public synchronized boolean purgeUnusedEntries(long absoluteTime) {
-    boolean active = false;
-    ListIterator<NodeEntry> entries = nodeEntries.listIterator();
-    while (entries.hasNext()) {
-      NodeEntry entry = entries.next();
-      if (entry.notUsedSince(absoluteTime) && entry.getFailedRecently() == 0) {
-        entries.remove();
-      } else {
-        active = true;
-      }
-    }
-    return active;
-  }
-
-
-  /**
-   * run through each entry resetting the failure count
-   */
-  public synchronized void resetFailedRecently() {
-    for (NodeEntry entry : nodeEntries) {
-      entry.resetFailedRecently();
-    }
-  }
-  
-  @Override
-  public String toString() {
-    return hostname;
-  }
-
-  /**
-   * Full dump of entry including children
-   * @return a multi-line description fo the node
-   */
-  public String toFullString() {
-    final StringBuilder sb =
-      new StringBuilder(toString());
-    sb.append("{ ");
-    for (NodeEntry entry : nodeEntries) {
-      sb.append(String.format("\n  [%02d]  ", entry.rolePriority));
-        sb.append(entry.toString());
-    }
-    sb.append("} ");
-    return sb.toString();
-  }
-
-  /**
-   * Equality test is purely on the hostname of the node address
-   * @param o other
-   * @return true if the hostnames are equal
-   */
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    NodeInstance that = (NodeInstance) o;
-    return hostname.equals(that.hostname);
-  }
-
-  @Override
-  public int hashCode() {
-    return hostname.hashCode();
-  }
-
-
-  /**
-   * Predicate to query if the number of recent failures of a role
-   * on this node exceeds that role's failure threshold.
-   * If there is no record of a deployment of that role on this
-   * node, the failure count is taken as "0".
-   * @param role role to look up
-   * @return true if the failure rate is above the threshold.
-   */
-  public boolean exceedsFailureThreshold(RoleStatus role) {
-    NodeEntry entry = get(role.getKey());
-    int numFailuresOnLastHost = entry != null ? entry.getFailedRecently() : 0;
-    int failureThreshold = role.getNodeFailureThreshold();
-    return failureThreshold < 0 || numFailuresOnLastHost > failureThreshold;
-  }
-
-  /**
-   * Produced a serialized form which can be served up as JSON
-   * @param naming map of priority -> value for naming entries
-   * @return a summary of the current role status.
-   */
-  public synchronized NodeInformation serialize(Map<Integer, String> naming) {
-    NodeInformation info = new NodeInformation();
-    info.hostname = hostname;
-    // null-handling state constructor
-    info.state = "" + nodeState;
-    info.lastUpdated = nodeStateUpdateTime;
-    info.labels = nodeLabels;
-    if (nodeReport != null) {
-      info.httpAddress = nodeReport.getHttpAddress();
-      info.rackName = nodeReport.getRackName();
-      info.healthReport = nodeReport.getHealthReport();
-    }
-    info.entries = new HashMap<>(nodeEntries.size());
-    for (NodeEntry nodeEntry : nodeEntries) {
-      String name = naming.get(nodeEntry.rolePriority);
-      if (name == null) {
-        name = Integer.toString(nodeEntry.rolePriority);
-      }
-      info.entries.put(name, nodeEntry.serialize());
-    }
-    return info;
-  }
-
-  /**
-   * Is this node instance a suitable candidate for the specific role?
-   * @param role role ID
-   * @param label label which must match, or "" for no label checks
-   * @return true if the node has space for this role, is running and the labels
-   * match.
-   */
-  public boolean canHost(int role, String label) {
-    return isOnline()
-        && (SliderUtils.isUnset(label) || label.equals(nodeLabels))   // label match
-        && getOrCreate(role).isAvailable();                          // no live role
-  }
-
-  /**
-   * A comparator for sorting entries where the node is preferred over another.
-   *
-   * The exact algorithm may change: current policy is "most recent first", so sorted
-   * on the lastUsed
-   *
-   * the comparision is a positive int if left is preferred to right;
-   * negative if right over left, 0 for equal
-   */
-  public static class Preferred implements Comparator<NodeInstance>, Serializable {
-
-    private static final Comparators.InvertedLongComparator comparator =
-        new Comparators.InvertedLongComparator();
-    private final int role;
-
-    public Preferred(int role) {
-      this.role = role;
-    }
-
-    @Override
-    public int compare(NodeInstance o1, NodeInstance o2) {
-      NodeEntry left = o1.get(role);
-      NodeEntry right = o2.get(role);
-      long ageL = left != null ? left.getLastUsed() : -1;
-      long ageR = right != null ? right.getLastUsed() : -1;
-      return comparator.compare(ageL, ageR);
-    }
-  }
-
-  /**
-   * A comparator for sorting entries where the role is newer than
-   * the other. 
-   * This sort only compares the lastUsed field, not whether the
-   * node is in use or not
-   */
-  public static class MoreActiveThan implements Comparator<NodeInstance>,
-                                           Serializable {
-
-    private final int role;
-
-    public MoreActiveThan(int role) {
-      this.role = role;
-    }
-
-    @Override
-    public int compare(NodeInstance left, NodeInstance right) {
-      int activeLeft = left.getActiveRoleInstances(role);
-      int activeRight = right.getActiveRoleInstances(role);
-      return activeRight - activeLeft;
-    }
-  }
-  /**
-   * A comparator for sorting entries alphabetically
-   */
-  public static class CompareNames implements Comparator<NodeInstance>,
-                                           Serializable {
-
-    public CompareNames() {
-    }
-
-    @Override
-    public int compare(NodeInstance left, NodeInstance right) {
-      return left.hostname.compareTo(right.hostname);
-    }
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeMap.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeMap.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeMap.java
deleted file mode 100644
index 3858b68..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeMap.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import com.google.common.annotations.VisibleForTesting;
-import org.apache.hadoop.yarn.api.records.NodeReport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Node map map -and methods to work with it. 
- * Not Synchronized: caller is expected to lock access.
- */
-public class NodeMap extends HashMap<String, NodeInstance> {
-  protected static final Logger log =
-    LoggerFactory.getLogger(NodeMap.class);
-
-  /**
-   * number of roles
-   */
-  private final int roleSize;
-
-  /**
-   * Construct
-   * @param roleSize number of roles
-   */
-  public NodeMap(int roleSize) {
-    this.roleSize = roleSize;
-  }
-
-  /**
-   * Get the node instance for the specific node -creating it if needed
-   * @param hostname node
-   * @return the instance
-   */
-  public NodeInstance getOrCreate(String hostname) {
-    NodeInstance node = get(hostname);
-    if (node == null) {
-      node = new NodeInstance(hostname, roleSize);
-      put(hostname, node);
-    }
-    return node;
-  }
-
-  /**
-   * List the active nodes
-   * @param role role
-   * @return a possibly empty sorted list of all nodes that are active
-   * in that role
-   */
-  public List<NodeInstance> listActiveNodes(int role) {
-    List<NodeInstance> nodes = new ArrayList<>();
-    for (NodeInstance instance : values()) {
-      if (instance.getActiveRoleInstances(role) > 0) {
-        nodes.add(instance);
-      }
-    }
-    Collections.sort(nodes, new NodeInstance.MoreActiveThan(role));
-    return nodes;
-  }
-
-  /**
-   * reset the failed recently counters
-   */
-  public void resetFailedRecently() {
-    for (Map.Entry<String, NodeInstance> entry : entrySet()) {
-      NodeInstance ni = entry.getValue();
-      ni.resetFailedRecently();
-    }
-  }
-
-  /**
-   * Update the node state. Return true if the node state changed: either by
-   * being created, or by changing its internal state as defined
-   * by {@link NodeInstance#updateNode(NodeReport)}.
-   *
-   * @param hostname host name
-   * @param report latest node report
-   * @return true if the node state changed enough for a request evaluation.
-   */
-  public boolean updateNode(String hostname, NodeReport report) {
-    boolean nodeExisted = get(hostname) != null;
-    boolean updated = getOrCreate(hostname).updateNode(report);
-    return updated || !nodeExisted;
-  }
-
-  /**
-   * Clone point
-   * @return a shallow clone
-   */
-  @Override
-  public Object clone() {
-    return super.clone();
-  }
-
-  /**
-   * Insert a list of nodes into the map; overwrite any with that name
-   * This is a bulk operation for testing.
-   * @param nodes collection of nodes.
-   */
-  @VisibleForTesting
-  public void insert(Collection<NodeInstance> nodes) {
-    for (NodeInstance node : nodes) {
-      put(node.hostname, node);
-    }
-  }
-
-  /**
-   * Test helper: build or update a cluster from a list of node reports
-   * @param reports the list of reports
-   * @return true if this has been considered to have changed the cluster
-   */
-  @VisibleForTesting
-  public boolean buildOrUpdate(List<NodeReport> reports) {
-    boolean updated = false;
-    for (NodeReport report : reports) {
-      updated |= getOrCreate(report.getNodeId().getHost()).updateNode(report);
-    }
-    return updated;
-  }
-
-  /**
-   * Scan the current node map for all nodes capable of hosting an instance
-   * @param role role ID
-   * @param label label which must match, or "" for no label checks
-   * @return a possibly empty list of node instances matching the criteria.
-   */
-  public List<NodeInstance> findAllNodesForRole(int role, String label) {
-    List<NodeInstance> nodes = new ArrayList<>(size());
-    for (NodeInstance instance : values()) {
-      if (instance.canHost(role, label)) {
-        nodes.add(instance);
-      }
-    }
-    Collections.sort(nodes, new NodeInstance.CompareNames());
-    return nodes;
-  }
-
-  @Override
-  public synchronized String toString() {
-    final StringBuilder sb = new StringBuilder("NodeMap{");
-    List<String> keys = new ArrayList<>(keySet());
-    Collections.sort(keys);
-    for (String key : keys) {
-      sb.append(key).append(": ");
-      sb.append(get(key).toFullString()).append("\n");
-    }
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/OutstandingRequest.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/OutstandingRequest.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/OutstandingRequest.java
deleted file mode 100644
index 4357ef8..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/OutstandingRequest.java
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.yarn.api.records.Priority;
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.client.api.AMRMClient;
-import org.apache.hadoop.yarn.client.api.InvalidContainerRequestException;
-import org.apache.hadoop.yarn.util.resource.Resources;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.server.appmaster.operations.CancelSingleRequest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Tracks an outstanding request. This is used to correlate an allocation response
- * with the node and role used in the request.
- * <p>
- * The node identifier may be null -which indicates that a request was made without
- * a specific target node
- * <p>
- * Equality and the hash code are based <i>only</i> on the role and hostname,
- * which are fixed in the constructor. This means that a simple 
- * instance constructed with (role, hostname) can be used to look up
- * a complete request instance in the {@link OutstandingRequestTracker} map
- */
-public final class OutstandingRequest extends RoleHostnamePair {
-  protected static final Logger log =
-    LoggerFactory.getLogger(OutstandingRequest.class);
-
-  /**
-   * Node the request is for -may be null
-   */
-  public final NodeInstance node;
-
-  /**
-   * A list of all possible nodes to list in an AA request. For a non-AA
-   * request where {@link #node} is set, element 0 of the list is the same
-   * value.
-   */
-  public final List<NodeInstance> nodes = new ArrayList<>(1);
-
-  /**
-   * Optional label. This is cached as the request option (explicit-location + label) is forbidden,
-   * yet the label needs to be retained for escalation.
-   */
-  public String label;
-
-  /**
-   * Requested time in millis.
-   * <p>
-   * Only valid after {@link #buildContainerRequest(Resource, RoleStatus, long)}
-   */
-  private AMRMClient.ContainerRequest issuedRequest;
-  
-  /**
-   * Requested time in millis.
-   * <p>
-   * Only valid after {@link #buildContainerRequest(Resource, RoleStatus, long)}
-   */
-  private long requestedTimeMillis;
-
-  /**
-   * Time in millis after which escalation should be triggered..
-   * <p>
-   * Only valid after {@link #buildContainerRequest(Resource, RoleStatus, long)}
-   */
-  private long escalationTimeoutMillis;
-
-  /**
-   * Has the placement request been escalated?
-   */
-  private boolean escalated;
-
-  /**
-   * Flag to indicate that escalation is allowed
-   */
-  private boolean mayEscalate;
-
-  /**
-   * Priority of request; only valid after the request is built up
-   */
-  private int priority = -1;
-
-  /**
-   * Is this an Anti-affine request which should be cancelled on
-   * a cluster resize?
-   */
-  private boolean antiAffine = false;
-
-  /**
-   * Create a request
-   * @param roleId role
-   * @param node node -can be null
-   */
-  public OutstandingRequest(int roleId,
-                            NodeInstance node) {
-    super(roleId, node != null ? node.hostname : null);
-    this.node = node;
-    nodes.add(node);
-  }
-
-  /**
-   * Create an outstanding request with the given role and hostname
-   * Important: this is useful only for map lookups -the other constructor
-   * with the NodeInstance parameter is needed to generate node-specific
-   * container requests
-   * @param roleId role
-   * @param hostname hostname
-   */
-  public OutstandingRequest(int roleId, String hostname) {
-    super(roleId, hostname);
-    this.node = null;
-  }
-
-  /**
-   * Create an Anti-affine reques, including all listed nodes (there must be one)
-   * as targets.
-   * @param roleId role
-   * @param nodes list of nodes
-   */
-  public OutstandingRequest(int roleId, List<NodeInstance> nodes) {
-    super(roleId, nodes.get(0).hostname);
-    this.node = null;
-    this.antiAffine = true;
-    this.nodes.addAll(nodes);
-  }
-
-  /**
-   * Is the request located in the cluster, that is: does it have a node.
-   * @return true if a node instance was supplied in the constructor
-   */
-  public boolean isLocated() {
-    return node != null;
-  }
-
-  public long getRequestedTimeMillis() {
-    return requestedTimeMillis;
-  }
-
-  public long getEscalationTimeoutMillis() {
-    return escalationTimeoutMillis;
-  }
-
-  public synchronized boolean isEscalated() {
-    return escalated;
-  }
-
-  public boolean mayEscalate() {
-    return mayEscalate;
-  }
-
-  public AMRMClient.ContainerRequest getIssuedRequest() {
-    return issuedRequest;
-  }
-
-  public int getPriority() {
-    return priority;
-  }
-
-  public boolean isAntiAffine() {
-    return antiAffine;
-  }
-
-  public void setAntiAffine(boolean antiAffine) {
-    this.antiAffine = antiAffine;
-  }
-
-  /**
-   * Build a container request.
-   * <p>
-   *  The value of {@link #node} is used to direct a lot of policy. If null,
-   *  placement is relaxed.
-   *  If not null, the choice of whether to use the suggested node
-   *  is based on the placement policy and failure history.
-   * <p>
-   * If the request has an address, it is set in the container request
-   * (with a flag to enable relaxed priorities).
-   * <p>
-   * This operation sets the requested time flag, used for tracking timeouts
-   * on outstanding requests
-   * @param resource resource
-   * @param role role
-   * @param time time in millis to record as request time
-   * @return the request to raise
-   */
-  public synchronized AMRMClient.ContainerRequest buildContainerRequest(
-      Resource resource, RoleStatus role, long time) {
-    Preconditions.checkArgument(resource != null, "null `resource` arg");
-    Preconditions.checkArgument(role != null, "null `role` arg");
-
-    // cache label for escalation
-    label = role.getLabelExpression();
-    requestedTimeMillis = time;
-    escalationTimeoutMillis = time + role.getPlacementTimeoutSeconds() * 1000;
-    String[] hosts;
-    boolean relaxLocality;
-    boolean strictPlacement = role.isStrictPlacement();
-    NodeInstance target = this.node;
-    String nodeLabels;
-
-    if (isAntiAffine()) {
-      int size = nodes.size();
-      log.info("Creating anti-affine request across {} nodes; first node = {}",
-          size, hostname);
-      hosts = new String[size];
-      StringBuilder builder = new StringBuilder(size * 16);
-      int c = 0;
-      for (NodeInstance nodeInstance : nodes) {
-        hosts[c++] = nodeInstance.hostname;
-        builder.append(nodeInstance.hostname).append(" ");
-      }
-      log.debug("Full host list: [ {}]", builder);
-      escalated = false;
-      mayEscalate = false;
-      relaxLocality = false;
-      nodeLabels = null;
-    } else if (target != null) {
-      // placed request. Hostname is used in request
-      hosts = new String[1];
-      hosts[0] = target.hostname;
-      // and locality flag is set to false; Slider will decide when
-      // to relax things
-      relaxLocality = false;
-
-      log.info("Submitting request for container on {}", hosts[0]);
-      // enable escalation for all but strict placements.
-      escalated = false;
-      mayEscalate = !strictPlacement;
-      nodeLabels = null;
-    } else {
-      // no hosts
-      hosts = null;
-      // relax locality is mandatory on an unconstrained placement
-      relaxLocality = true;
-      // declare that the the placement is implicitly escalated.
-      escalated = true;
-      // and forbid it happening
-      mayEscalate = false;
-      nodeLabels = label;
-    }
-    Priority pri = ContainerPriority.createPriority(roleId, !relaxLocality);
-    priority = pri.getPriority();
-    issuedRequest = new AMRMClient.ContainerRequest(resource,
-                                      hosts,
-                                      null,
-                                      pri,
-                                      relaxLocality,
-                                      nodeLabels);
-    validate();
-    return issuedRequest;
-  }
-
-
-  /**
-   * Build an escalated container request, updating {@link #issuedRequest} with
-   * the new value.
-   * @return the new container request, which has the same resource and label requirements
-   * as the original one, and the same host, but: relaxed placement, and a changed priority
-   * so as to place it into the relaxed list.
-   */
-  public synchronized AMRMClient.ContainerRequest escalate() {
-    Preconditions.checkNotNull(issuedRequest, "cannot escalate if request not issued " + this);
-    log.debug("Escalating {}", this.toString());
-    escalated = true;
-
-    // this is now the priority
-    // it is tagged as unlocated because it needs to go into a different
-    // set of outstanding requests from the strict placements
-    Priority pri = ContainerPriority.createPriority(roleId, false);
-    // update the field
-    priority = pri.getPriority();
-
-    String[] nodes;
-    List<String> issuedRequestNodes = issuedRequest.getNodes();
-    if (SliderUtils.isUnset(label) && issuedRequestNodes != null) {
-      nodes = issuedRequestNodes.toArray(new String[issuedRequestNodes.size()]);
-    } else {
-      nodes = null;
-    }
-
-    issuedRequest = new AMRMClient.ContainerRequest(issuedRequest.getCapability(),
-        nodes,
-        null,
-        pri,
-        true,
-        label);
-    validate();
-    return issuedRequest;
-  }
-      
-  /**
-   * Mark the request as completed (or canceled).
-   * <p>
-   *   Current action: if a node is defined, its request count is decremented
-   */
-  public void completed() {
-    if (node != null) {
-      node.getOrCreate(roleId).requestCompleted();
-    }
-  }
-
-  /**
-   * Query to see if the request is available and ready to be escalated
-   * @param time time to check against
-   * @return true if escalation should begin
-   */
-  public synchronized boolean shouldEscalate(long time) {
-    return mayEscalate
-           && !escalated
-           && issuedRequest != null
-           && escalationTimeoutMillis < time;
-  }
-
-  /**
-   * Query for the resource requirements matching; always false before a request is issued
-   * @param resource
-   * @return
-   */
-  public synchronized boolean resourceRequirementsMatch(Resource resource) {
-    return issuedRequest != null && Resources.fitsIn(issuedRequest.getCapability(), resource);
-  }
-
-  @Override
-  public String toString() {
-    boolean requestHasLocation = ContainerPriority.hasLocation(getPriority());
-    final StringBuilder sb = new StringBuilder("OutstandingRequest{");
-    sb.append("roleId=").append(roleId);
-    if (hostname != null) {
-      sb.append(", hostname='").append(hostname).append('\'');
-    }
-    sb.append(", node=").append(node);
-    sb.append(", hasLocation=").append(requestHasLocation);
-    sb.append(", label=").append(label);
-    sb.append(", requestedTimeMillis=").append(requestedTimeMillis);
-    sb.append(", mayEscalate=").append(mayEscalate);
-    sb.append(", escalated=").append(escalated);
-    sb.append(", escalationTimeoutMillis=").append(escalationTimeoutMillis);
-    sb.append(", issuedRequest=").append(
-        issuedRequest != null ? SliderUtils.requestToString(issuedRequest) : "(null)");
-    sb.append('}');
-    return sb.toString();
-  }
-
-  /**
-   * Create a cancel operation
-   * @return an operation that can be used to cancel the request
-   */
-  public CancelSingleRequest createCancelOperation() {
-    Preconditions.checkState(issuedRequest != null, "No issued request to cancel");
-    return new CancelSingleRequest(issuedRequest);
-  }
-
-  /**
-   * Valid if a node label expression specified on container request is valid or
-   * not. Mimics the logic in AMRMClientImpl, so can be used for preflight checking
-   * and in mock tests
-   *
-   */
-  public void validate() throws InvalidContainerRequestException {
-    Preconditions.checkNotNull(issuedRequest, "request has not yet been built up");
-    AMRMClient.ContainerRequest containerRequest = issuedRequest;
-    String requestDetails = this.toString();
-    validateContainerRequest(containerRequest, priority, requestDetails);
-  }
-
-  /**
-   * Inner Validation logic for container request
-   * @param containerRequest request
-   * @param priority raw priority of role
-   * @param requestDetails details for error messages
-   */
-  @VisibleForTesting
-  public static void validateContainerRequest(AMRMClient.ContainerRequest containerRequest,
-    int priority, String requestDetails) {
-    String exp = containerRequest.getNodeLabelExpression();
-    boolean hasRacks = containerRequest.getRacks() != null &&
-      (!containerRequest.getRacks().isEmpty());
-    boolean hasNodes = containerRequest.getNodes() != null &&
-      (!containerRequest.getNodes().isEmpty());
-
-    boolean hasLabel = SliderUtils.isSet(exp);
-
-    // Don't support specifying >= 2 node labels in a node label expression now
-    if (hasLabel && (exp.contains("&&") || exp.contains("||"))) {
-      throw new InvalidContainerRequestException(
-          "Cannot specify more than two node labels"
-              + " in a single node label expression: " + requestDetails);
-    }
-
-    // Don't allow specify node label against ANY request listing hosts or racks
-    if (hasLabel && ( hasRacks || hasNodes)) {
-      throw new InvalidContainerRequestException(
-          "Cannot specify node label with rack or node: " + requestDetails);
-    }
-  }
-
-  /**
-   * Create a new role/hostname pair for indexing.
-   * @return a new index.
-   */
-  public RoleHostnamePair getIndex() {
-    return new RoleHostnamePair(roleId, hostname);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/OutstandingRequestTracker.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/OutstandingRequestTracker.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/OutstandingRequestTracker.java
deleted file mode 100644
index c16aa3c..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/OutstandingRequestTracker.java
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.client.api.AMRMClient;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.server.appmaster.operations.AbstractRMOperation;
-import org.apache.slider.server.appmaster.operations.CancelSingleRequest;
-import org.apache.slider.server.appmaster.operations.ContainerRequestOperation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Tracks outstanding requests made with a specific placement option.
- * <p>
- *   <ol>
- *     <li>Used to decide when to return a node to 'can request containers here' list</li>
- *     <li>Used to identify requests where placement has timed out, and so issue relaxed requests</li>
- *   </ol>
- * <p>
- * If an allocation comes in that is not in the map: either the allocation
- * was unplaced, or the placed allocation could not be met on the specified
- * host, and the RM/scheduler fell back to another location. 
- */
-
-public class OutstandingRequestTracker {
-  protected static final Logger log =
-    LoggerFactory.getLogger(OutstandingRequestTracker.class);
-
-  /**
-   * no requests; saves creating a new list if not needed
-   */
-  private final List<AbstractRMOperation> NO_REQUESTS = new ArrayList<>(0);
- 
-  private Map<RoleHostnamePair, OutstandingRequest> placedRequests = new HashMap<>();
-
-  /**
-   * List of open requests; no specific details on them.
-   */
-  private List<OutstandingRequest> openRequests = new ArrayList<>();
-
-  /**
-   * Create a new request for the specific role.
-   * <p>
-   * If a location is set, the request is added to {@link #placedRequests}.
-   * If not, it is added to {@link #openRequests}
-   * <p>
-   * This does not update the node instance's role's request count
-   * @param instance node instance to manager
-   * @param role role index
-   * @return a new request
-   */
-  public synchronized OutstandingRequest newRequest(NodeInstance instance, int role) {
-    OutstandingRequest request = new OutstandingRequest(role, instance);
-    if (request.isLocated()) {
-      placedRequests.put(request.getIndex(), request);
-    } else {
-      openRequests.add(request);
-    }
-    return request;
-  }
-
-  /**
-   * Create a new Anti-affine request for the specific role
-   * <p>
-   * It is added to {@link #openRequests}
-   * <p>
-   * This does not update the node instance's role's request count
-   * @param role role index
-   * @param nodes list of suitable nodes
-   * @param label label to use
-   * @return a new request
-   */
-  public synchronized OutstandingRequest newAARequest(int role,
-      List<NodeInstance> nodes,
-      String label) {
-    Preconditions.checkArgument(!nodes.isEmpty());
-    // safety check to verify the allocation will hold
-    for (NodeInstance node : nodes) {
-      Preconditions.checkState(node.canHost(role, label),
-        "Cannot allocate role ID %d to node %s", role, node);
-    }
-    OutstandingRequest request = new OutstandingRequest(role, nodes);
-    openRequests.add(request);
-    return request;
-  }
-
-  /**
-   * Look up any oustanding request to a (role, hostname). 
-   * @param role role index
-   * @param hostname hostname
-   * @return the request or null if there was no outstanding one in the {@link #placedRequests}
-   */
-  @VisibleForTesting
-  public synchronized OutstandingRequest lookupPlacedRequest(int role, String hostname) {
-    Preconditions.checkArgument(hostname != null, "null hostname");
-    return placedRequests.get(new RoleHostnamePair(role, hostname));
-  }
-
-  /**
-   * Remove a request
-   * @param request matching request to find
-   * @return the request or null for no match in the {@link #placedRequests}
-   */
-  @VisibleForTesting
-  public synchronized OutstandingRequest removePlacedRequest(OutstandingRequest request) {
-    return placedRequests.remove(request);
-  }
-
-  /**
-   * Notification that a container has been allocated
-   *
-   * <ol>
-   *   <li>drop it from the {@link #placedRequests} structure.</li>
-   *   <li>generate the cancellation request</li>
-   *   <li>for AA placement, any actions needed</li>
-   * </ol>
-   *
-   * @param role role index
-   * @param hostname hostname
-   * @return the allocation outcome
-   */
-  public synchronized ContainerAllocationResults onContainerAllocated(int role,
-      String hostname,
-      Container container) {
-    final String containerDetails = SliderUtils.containerToString(container);
-    log.debug("Processing allocation for role {}  on {}", role,
-        containerDetails);
-    ContainerAllocationResults allocation = new ContainerAllocationResults();
-    ContainerAllocationOutcome outcome;
-    OutstandingRequest request = placedRequests.remove(new OutstandingRequest(role, hostname));
-    if (request != null) {
-      //satisfied request
-      log.debug("Found oustanding placed request for container: {}", request);
-      request.completed();
-      // derive outcome from status of tracked request
-      outcome = request.isEscalated()
-          ? ContainerAllocationOutcome.Escalated
-          : ContainerAllocationOutcome.Placed;
-    } else {
-      // not in the list; this is an open placement
-      // scan through all containers in the open request list
-      request = removeOpenRequest(container);
-      if (request != null) {
-        log.debug("Found open outstanding request for container: {}", request);
-        request.completed();
-        outcome = ContainerAllocationOutcome.Open;
-      } else {
-        log.warn("No oustanding request found for container {}, outstanding queue has {} entries ",
-            containerDetails,
-            openRequests.size());
-        outcome = ContainerAllocationOutcome.Unallocated;
-      }
-    }
-    if (request != null && request.getIssuedRequest() != null) {
-      allocation.operations.add(request.createCancelOperation());
-    } else {
-      // there's a request, but no idea what to cancel.
-      // rather than try to recover from it inelegantly, (and cause more confusion),
-      // log the event, but otherwise continue
-      log.warn("Unexpected allocation of container " + SliderUtils.containerToString(container));
-    }
-
-    allocation.origin = request;
-    allocation.outcome = outcome;
-    return allocation;
-  }
-
-  /**
-   * Find and remove an open request. Determine it by scanning open requests
-   * for one whose priority & resource requirements match that of the container
-   * allocated.
-   * @param container container allocated
-   * @return a request which matches the allocation, or null for "no match"
-   */
-  private OutstandingRequest removeOpenRequest(Container container) {
-    int pri = container.getPriority().getPriority();
-    Resource resource = container.getResource();
-    OutstandingRequest request = null;
-    ListIterator<OutstandingRequest> openlist = openRequests.listIterator();
-    while (openlist.hasNext() && request == null) {
-      OutstandingRequest r = openlist.next();
-      if (r.getPriority() == pri) {
-        // matching resource
-        if (r.resourceRequirementsMatch(resource)) {
-          // match of priority and resources
-          request = r;
-          openlist.remove();
-        } else {
-          log.debug("Matched priorities but resources different");
-        }
-      }
-    }
-    return request;
-  }
-  
-  /**
-   * Determine which host was a role type most recently used on, so that
-   * if a choice is made of which (potentially surplus) containers to use,
-   * the most recent one is picked first. This operation <i>does not</i>
-   * change the role history, though it queries it.
-   */
-  static class newerThan implements Comparator<Container>, Serializable {
-    private RoleHistory rh;
-    
-    public newerThan(RoleHistory rh) {
-      this.rh = rh;
-    }
-
-    /**
-     * Get the age of a node hosting container. If it is not known in the history, 
-     * return 0.
-     * @param c container
-     * @return age, null if there's no entry for it. 
-     */
-    private long getAgeOf(Container c) {
-      long age = 0;
-      NodeInstance node = rh.getExistingNodeInstance(c);
-      int role = ContainerPriority.extractRole(c);
-      if (node != null) {
-        NodeEntry nodeEntry = node.get(role);
-        if (nodeEntry != null) {
-          age = nodeEntry.getLastUsed();
-        }
-      }
-      return age;
-    }
-
-    /**
-     * Comparator: which host is more recent?
-     * @param c1 container 1
-     * @param c2 container 2
-     * @return 1 if c2 older-than c1, 0 if equal; -1 if c1 older-than c2
-     */
-    @Override
-    public int compare(Container c1, Container c2) {
-      int role1 = ContainerPriority.extractRole(c1);
-      int role2 = ContainerPriority.extractRole(c2);
-      if (role1 < role2) return -1;
-      if (role1 > role2) return 1;
-
-      long age = getAgeOf(c1);
-      long age2 = getAgeOf(c2);
-
-      if (age > age2) {
-        return -1;
-      } else if (age < age2) {
-        return 1;
-      }
-      // equal
-      return 0;
-    }
-  }
-
-  /**
-   * Take a list of requests and split them into specific host requests and
-   * generic assignments. This is to give requested hosts priority
-   * in container assignments if more come back than expected
-   * @param rh RoleHistory instance
-   * @param inAllocated the list of allocated containers
-   * @param outPlaceRequested initially empty list of requested locations 
-   * @param outUnplaced initially empty list of unrequested hosts
-   */
-  public synchronized void partitionRequests(RoleHistory rh,
-      List<Container> inAllocated,
-      List<Container> outPlaceRequested,
-      List<Container> outUnplaced) {
-    Collections.sort(inAllocated, new newerThan(rh));
-    for (Container container : inAllocated) {
-      int role = ContainerPriority.extractRole(container);
-      String hostname = RoleHistoryUtils.hostnameOf(container);
-      if (placedRequests.containsKey(new OutstandingRequest(role, hostname))) {
-        outPlaceRequested.add(container);
-      } else {
-        outUnplaced.add(container);
-      }
-    }
-  }
-  
-
-  /**
-   * Reset list all outstanding requests for a role: return the hostnames
-   * of any canceled requests
-   *
-   * @param role role to cancel
-   * @return possibly empty list of hostnames
-   */
-  public synchronized List<NodeInstance> resetOutstandingRequests(int role) {
-    List<NodeInstance> hosts = new ArrayList<>();
-    Iterator<Map.Entry<RoleHostnamePair, OutstandingRequest>> iterator =
-      placedRequests.entrySet().iterator();
-    while (iterator.hasNext()) {
-      Map.Entry<RoleHostnamePair, OutstandingRequest> next =
-        iterator.next();
-      OutstandingRequest request = next.getValue();
-      if (request.roleId == role) {
-        iterator.remove();
-        request.completed();
-        hosts.add(request.node);
-      }
-    }
-    ListIterator<OutstandingRequest> openlist = openRequests.listIterator();
-    while (openlist.hasNext()) {
-      OutstandingRequest next = openlist.next();
-      if (next.roleId == role) {
-        openlist.remove();
-      }
-    }
-    return hosts;
-  }
-
-  /**
-   * Get a list of outstanding requests. The list is cloned, but the contents
-   * are shared
-   * @return a list of the current outstanding requests
-   */
-  public synchronized List<OutstandingRequest> listPlacedRequests() {
-    return new ArrayList<>(placedRequests.values());
-  }
-
-  /**
-   * Get a list of outstanding requests. The list is cloned, but the contents
-   * are shared
-   * @return a list of the current outstanding requests
-   */
-  public synchronized List<OutstandingRequest> listOpenRequests() {
-    return new ArrayList<>(openRequests);
-  }
-
-  /**
-   * Escalate operation as triggered by external timer.
-   * @return a (usually empty) list of cancel/request operations.
-   */
-  @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
-  public synchronized List<AbstractRMOperation> escalateOutstandingRequests(long now) {
-    if (placedRequests.isEmpty()) {
-      return NO_REQUESTS;
-    }
-
-    List<AbstractRMOperation> operations = new ArrayList<>();
-    for (OutstandingRequest outstandingRequest : placedRequests.values()) {
-      synchronized (outstandingRequest) {
-        // sync escalation check with operation so that nothing can happen to state
-        // of the request during the escalation
-        if (outstandingRequest.shouldEscalate(now)) {
-
-          // time to escalate
-          CancelSingleRequest cancel = outstandingRequest.createCancelOperation();
-          operations.add(cancel);
-          AMRMClient.ContainerRequest escalated = outstandingRequest.escalate();
-          operations.add(new ContainerRequestOperation(escalated));
-        }
-      }
-      
-    }
-    return operations;
-  }
-
-  /**
-   * Cancel all outstanding AA requests from the lists of requests.
-   *
-   * This does not remove them from the role status; they must be reset
-   * by the caller.
-   *
-   */
-  @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
-  public synchronized List<AbstractRMOperation> cancelOutstandingAARequests() {
-
-    log.debug("Looking for AA request to cancel");
-    List<AbstractRMOperation> operations = new ArrayList<>();
-
-    // first, all placed requests
-    List<RoleHostnamePair> requestsToRemove = new ArrayList<>(placedRequests.size());
-    for (Map.Entry<RoleHostnamePair, OutstandingRequest> entry : placedRequests.entrySet()) {
-      OutstandingRequest outstandingRequest = entry.getValue();
-      synchronized (outstandingRequest) {
-        if (outstandingRequest.isAntiAffine()) {
-          // time to escalate
-          operations.add(outstandingRequest.createCancelOperation());
-          requestsToRemove.add(entry.getKey());
-        }
-      }
-    }
-    for (RoleHostnamePair keys : requestsToRemove) {
-      placedRequests.remove(keys);
-    }
-
-    // second, all open requests
-    ListIterator<OutstandingRequest> orit = openRequests.listIterator();
-    while (orit.hasNext()) {
-      OutstandingRequest outstandingRequest =  orit.next();
-      synchronized (outstandingRequest) {
-        if (outstandingRequest.isAntiAffine()) {
-          // time to escalate
-          operations.add(outstandingRequest.createCancelOperation());
-          orit.remove();
-        }
-      }
-    }
-    log.info("Cancelling {} outstanding AA requests", operations.size());
-
-    return operations;
-  }
-
-  /**
-   * Extract a specific number of open requests for a role
-   * @param roleId role Id
-   * @param count count to extract
-   * @return a list of requests which are no longer in the open request list
-   */
-  public synchronized List<OutstandingRequest> extractOpenRequestsForRole(int roleId, int count) {
-    List<OutstandingRequest> results = new ArrayList<>();
-    ListIterator<OutstandingRequest> openlist = openRequests.listIterator();
-    while (openlist.hasNext() && count > 0) {
-      OutstandingRequest openRequest = openlist.next();
-      if (openRequest.roleId == roleId) {
-        results.add(openRequest);
-        openlist.remove();
-        count--;
-      }
-    }
-    return results;
-  }
-
-  /**
-   * Extract a specific number of placed requests for a role
-   * @param roleId role Id
-   * @param count count to extract
-   * @return a list of requests which are no longer in the placed request data structure
-   */
-  public synchronized List<OutstandingRequest> extractPlacedRequestsForRole(int roleId, int count) {
-    List<OutstandingRequest> results = new ArrayList<>();
-    Iterator<Map.Entry<RoleHostnamePair, OutstandingRequest>>
-        iterator = placedRequests.entrySet().iterator();
-    while (iterator.hasNext() && count > 0) {
-      OutstandingRequest request = iterator.next().getValue();
-      if (request.roleId == roleId) {
-        results.add(request);
-        count--;
-      }
-    }
-    // now cull them from the map
-    for (OutstandingRequest result : results) {
-      placedRequests.remove(result);
-    }
-
-    return results;
-  }
-
-}


[19/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
deleted file mode 100644
index 49e7b78..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
+++ /dev/null
@@ -1,2494 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.appmaster.state;
-
-import com.codahale.metrics.Metric;
-import com.codahale.metrics.MetricRegistry;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.api.records.ContainerStatus;
-import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
-import org.apache.hadoop.yarn.api.records.NodeId;
-import org.apache.hadoop.yarn.api.records.NodeReport;
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.api.records.impl.pb.ContainerPBImpl;
-import org.apache.hadoop.yarn.client.api.AMRMClient;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
-import org.apache.hadoop.yarn.util.resource.Resources;
-import org.apache.slider.api.ClusterDescription;
-import org.apache.slider.api.ClusterDescriptionKeys;
-import org.apache.slider.api.ClusterDescriptionOperations;
-import org.apache.slider.api.ClusterNode;
-import org.apache.slider.api.InternalKeys;
-import org.apache.slider.api.ResourceKeys;
-import org.apache.slider.api.StatusKeys;
-import org.apache.slider.api.types.ApplicationLivenessInformation;
-import org.apache.slider.api.types.ComponentInformation;
-import org.apache.slider.api.types.RoleStatistics;
-import org.apache.slider.common.SliderExitCodes;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.tools.ConfigHelper;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.BadClusterStateException;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.exceptions.ErrorStrings;
-import org.apache.slider.core.exceptions.NoSuchNodeException;
-import org.apache.slider.core.exceptions.SliderInternalStateException;
-import org.apache.slider.core.exceptions.TriggerClusterTeardownException;
-import org.apache.slider.core.persist.AggregateConfSerDeser;
-import org.apache.slider.core.persist.ConfTreeSerDeser;
-import org.apache.slider.providers.PlacementPolicy;
-import org.apache.slider.providers.ProviderRole;
-import org.apache.slider.server.appmaster.management.LongGauge;
-import org.apache.slider.server.appmaster.management.MetricsAndMonitoring;
-import org.apache.slider.server.appmaster.management.MetricsConstants;
-import org.apache.slider.server.appmaster.operations.AbstractRMOperation;
-import org.apache.slider.server.appmaster.operations.ContainerReleaseOperation;
-import org.apache.slider.server.appmaster.operations.ContainerRequestOperation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ConcurrentSkipListMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import static org.apache.slider.api.ResourceKeys.*;
-import static org.apache.slider.api.RoleKeys.*;
-import static org.apache.slider.api.StateValues.*;
-
-/**
- * The model of all the ongoing state of a Slider AM.
- *
- * concurrency rules: any method which begins with <i>build</i>
- * is not synchronized and intended to be used during
- * initialization.
- */
-public class AppState {
-  protected static final Logger log =
-    LoggerFactory.getLogger(AppState.class);
-  
-  private final AbstractClusterServices recordFactory;
-
-  private final MetricsAndMonitoring metricsAndMonitoring;
-
-  /**
-   * Flag set to indicate the application is live -this only happens
-   * after the buildInstance operation
-   */
-  private boolean applicationLive = false;
-
-  /**
-   * The definition of the instance. Flexing updates the resources section
-   * This is used as a synchronization point on activities that update
-   * the CD, and also to update some of the structures that
-   * feed in to the CD
-   */
-  private AggregateConf instanceDefinition;
-
-  /**
-   * Time the instance definition snapshots were created
-   */
-  private long snapshotTime;
-
-  /**
-   * Snapshot of the instance definition. This is fully
-   * resolved.
-   */
-  private AggregateConf instanceDefinitionSnapshot;
-
-  /**
-   * Snapshot of the raw instance definition; unresolved and
-   * without any patch of an AM into it.
-   */
-  private AggregateConf unresolvedInstanceDefinition;
-
-  /**
-   * snapshot of resources as of last update time
-   */
-  private ConfTreeOperations resourcesSnapshot;
-  private ConfTreeOperations appConfSnapshot;
-  private ConfTreeOperations internalsSnapshot;
-
-  /**
-   * This is the status, the live model
-   */
-  private ClusterDescription clusterStatus = new ClusterDescription();
-
-  /**
-   * Metadata provided by the AM for use in filling in status requests
-   */
-  private Map<String, String> applicationInfo;
-
-  /**
-   * Client properties created via the provider -static for the life
-   * of the application
-   */
-  private Map<String, String> clientProperties = new HashMap<>();
-
-  /**
-   * This is a template of the cluster status
-   */
-  private ClusterDescription clusterStatusTemplate = new ClusterDescription();
-
-  private final Map<Integer, RoleStatus> roleStatusMap =
-    new ConcurrentSkipListMap<>();
-
-  private final Map<String, ProviderRole> roles =
-    new ConcurrentHashMap<>();
-
-  private final ConcurrentSkipListMap<Integer, ProviderRole> rolePriorityMap =
-    new ConcurrentSkipListMap<>();
-
-  /**
-   * The master node.
-   */
-  private RoleInstance appMasterNode;
-
-  /**
-   * Hash map of the containers we have. This includes things that have
-   * been allocated but are not live; it is a superset of the live list
-   */
-  private final ConcurrentMap<ContainerId, RoleInstance> ownedContainers =
-    new ConcurrentHashMap<>();
-
-  /**
-   * Hash map of the containers we have released, but we
-   * are still awaiting acknowledgements on. Any failure of these
-   * containers is treated as a successful outcome
-   */
-  private final ConcurrentMap<ContainerId, Container> containersBeingReleased =
-    new ConcurrentHashMap<>();
-  
-  /**
-   * Counter for completed containers ( complete denotes successful or failed )
-   */
-  private final LongGauge completedContainerCount = new LongGauge();
-
-  /**
-   *   Count of failed containers
-   */
-  private final LongGauge failedContainerCount = new LongGauge();
-
-  /**
-   * # of started containers
-   */
-  private final LongGauge startedContainers = new LongGauge();
-
-  /**
-   * # of containers that failed to start 
-   */
-  private final LongGauge startFailedContainerCount = new LongGauge();
-
-  /**
-   * Track the number of surplus containers received and discarded
-   */
-  private final LongGauge surplusContainers = new LongGauge();
-
-  /**
-   * Track the number of requested containers.
-   * Important: this does not include AA requests which are yet to be issued.
-   */
-  private final LongGauge outstandingContainerRequests = new LongGauge();
-
-  /**
-   * Map of requested nodes. This records the command used to start it,
-   * resources, etc. When container started callback is received,
-   * the node is promoted from here to the containerMap
-   */
-  private final Map<ContainerId, RoleInstance> startingContainers =
-    new ConcurrentHashMap<>();
-
-  /**
-   * List of completed nodes. This isn't kept in the CD as it gets too
-   * big for the RPC responses. Indeed, we should think about how deep to get this
-   */
-  private final Map<ContainerId, RoleInstance> completedContainers
-    = new ConcurrentHashMap<>();
-
-  /**
-   * Nodes that failed to start.
-   * Again, kept out of the CD
-   */
-  private final Map<ContainerId, RoleInstance> failedContainers =
-    new ConcurrentHashMap<>();
-
-  /**
-   * Nodes that came assigned to a role above that
-   * which were asked for -this appears to happen
-   */
-  private final Set<ContainerId> surplusNodes = new HashSet<>();
-
-  /**
-   * Map of containerID to cluster nodes, for status reports.
-   * Access to this should be synchronized on the clusterDescription
-   */
-  private final Map<ContainerId, RoleInstance> liveNodes =
-    new ConcurrentHashMap<>();
-  private final AtomicInteger completionOfNodeNotInLiveListEvent =
-    new AtomicInteger();
-  private final AtomicInteger completionOfUnknownContainerEvent =
-    new AtomicInteger();
-
-
-  /**
-   * limits of container core numbers in this queue
-   */
-  private int containerMaxCores;
-  private int containerMinCores;
-
-  /**
-   * limits of container memory in this queue
-   */
-  private int containerMaxMemory;
-  private int containerMinMemory;
-
-  private RoleHistory roleHistory;
-  private Configuration publishedProviderConf;
-  private long startTimeThreshold;
-
-  private int failureThreshold = 10;
-  private int nodeFailureThreshold = 3;
-
-  private String logServerURL = "";
-
-  /**
-   * Selector of containers to release; application wide.
-   */
-  private ContainerReleaseSelector containerReleaseSelector;
-  private Resource minResource;
-  private Resource maxResource;
-
-  /**
-   * Create an instance
-   * @param recordFactory factory for YARN records
-   * @param metricsAndMonitoring metrics and monitoring services
-   */
-  public AppState(AbstractClusterServices recordFactory,
-      MetricsAndMonitoring metricsAndMonitoring) {
-    Preconditions.checkArgument(recordFactory != null, "null recordFactory");
-    Preconditions.checkArgument(metricsAndMonitoring != null, "null metricsAndMonitoring");
-    this.recordFactory = recordFactory;
-    this.metricsAndMonitoring = metricsAndMonitoring;
-
-    // register any metrics
-    register(MetricsConstants.CONTAINERS_OUTSTANDING_REQUESTS, outstandingContainerRequests);
-    register(MetricsConstants.CONTAINERS_SURPLUS, surplusContainers);
-    register(MetricsConstants.CONTAINERS_STARTED, startedContainers);
-    register(MetricsConstants.CONTAINERS_COMPLETED, completedContainerCount);
-    register(MetricsConstants.CONTAINERS_FAILED, failedContainerCount);
-    register(MetricsConstants.CONTAINERS_START_FAILED, startFailedContainerCount);
-  }
-
-  private void register(String name, Metric counter) {
-    this.metricsAndMonitoring.getMetrics().register(
-        MetricRegistry.name(AppState.class, name), counter);
-  }
-
-  public long getFailedCountainerCount() {
-    return failedContainerCount.getCount();
-  }
-
-  /**
-   * Increment the count
-   */
-  public void incFailedCountainerCount() {
-    failedContainerCount.inc();
-  }
-
-  public long getStartFailedCountainerCount() {
-    return startFailedContainerCount.getCount();
-  }
-
-  /**
-   * Increment the count and return the new value
-   */
-  public void incStartedCountainerCount() {
-    startedContainers.inc();
-  }
-
-  public long getStartedCountainerCount() {
-    return startedContainers.getCount();
-  }
-
-  /**
-   * Increment the count and return the new value
-   */
-  public void incStartFailedCountainerCount() {
-    startFailedContainerCount.inc();
-  }
-
-  public AtomicInteger getCompletionOfNodeNotInLiveListEvent() {
-    return completionOfNodeNotInLiveListEvent;
-  }
-
-  public AtomicInteger getCompletionOfUnknownContainerEvent() {
-    return completionOfUnknownContainerEvent;
-  }
-
-
-  public Map<Integer, RoleStatus> getRoleStatusMap() {
-    return roleStatusMap;
-  }
-  
-  protected Map<String, ProviderRole> getRoleMap() {
-    return roles;
-  }
-
-  public Map<Integer, ProviderRole> getRolePriorityMap() {
-    return rolePriorityMap;
-  }
-
-  private Map<ContainerId, RoleInstance> getStartingContainers() {
-    return startingContainers;
-  }
-
-  private Map<ContainerId, RoleInstance> getCompletedContainers() {
-    return completedContainers;
-  }
-
-  public Map<ContainerId, RoleInstance> getFailedContainers() {
-    return failedContainers;
-  }
-
-  public Map<ContainerId, RoleInstance> getLiveContainers() {
-    return liveNodes;
-  }
-
-  /**
-   * Get the current view of the cluster status.
-   * <p>
-   *   Calls to {@link #refreshClusterStatus()} trigger a
-   *   refresh of this field.
-   * <p>
-   * This is read-only
-   * to the extent that changes here do not trigger updates in the
-   * application state. 
-   * @return the cluster status
-   */
-  public synchronized ClusterDescription getClusterStatus() {
-    return clusterStatus;
-  }
-
-  @VisibleForTesting
-  protected synchronized void setClusterStatus(ClusterDescription clusterDesc) {
-    this.clusterStatus = clusterDesc;
-  }
-
-  /**
-   * Set the instance definition -this also builds the (now obsolete)
-   * cluster specification from it.
-   * 
-   * Important: this is for early binding and must not be used after the build
-   * operation is complete. 
-   * @param definition initial definition
-   * @throws BadConfigException
-   */
-  public synchronized void setInitialInstanceDefinition(AggregateConf definition)
-      throws BadConfigException, IOException {
-    log.debug("Setting initial instance definition");
-    // snapshot the definition
-    AggregateConfSerDeser serDeser = new AggregateConfSerDeser();
-
-    unresolvedInstanceDefinition = serDeser.fromInstance(definition);
-    
-    this.instanceDefinition = serDeser.fromInstance(definition);
-    onInstanceDefinitionUpdated();
-  }
-
-  public synchronized AggregateConf getInstanceDefinition() {
-    return instanceDefinition;
-  }
-
-  /**
-   * Get the role history of the application
-   * @return the role history
-   */
-  @VisibleForTesting
-  public RoleHistory getRoleHistory() {
-    return roleHistory;
-  }
-
-  /**
-   * Get the path used for history files
-   * @return the directory used for history files
-   */
-  @VisibleForTesting
-  public Path getHistoryPath() {
-    return roleHistory.getHistoryPath();
-  }
-
-  /**
-   * Set the container limits -the min and max values for
-   * resource requests. All requests must be multiples of the min
-   * values.
-   * @param minMemory min memory MB
-   * @param maxMemory maximum memory
-   * @param minCores min v core count
-   * @param maxCores maximum cores
-   */
-  public void setContainerLimits(int minMemory,int maxMemory, int minCores, int maxCores) {
-    containerMinCores = minCores;
-    containerMaxCores = maxCores;
-    containerMinMemory = minMemory;
-    containerMaxMemory = maxMemory;
-    minResource = recordFactory.newResource(containerMinMemory, containerMinCores);
-    maxResource = recordFactory.newResource(containerMaxMemory, containerMaxCores);
-  }
-
-  public ConfTreeOperations getResourcesSnapshot() {
-    return resourcesSnapshot;
-  }
-
-  public ConfTreeOperations getAppConfSnapshot() {
-    return appConfSnapshot;
-  }
-
-  public ConfTreeOperations getInternalsSnapshot() {
-    return internalsSnapshot;
-  }
-
-  public boolean isApplicationLive() {
-    return applicationLive;
-  }
-
-  public long getSnapshotTime() {
-    return snapshotTime;
-  }
-
-  public synchronized AggregateConf getInstanceDefinitionSnapshot() {
-    return instanceDefinitionSnapshot;
-  }
-
-  public AggregateConf getUnresolvedInstanceDefinition() {
-    return unresolvedInstanceDefinition;
-  }
-
-  public synchronized void buildInstance(AppStateBindingInfo binding)
-      throws BadClusterStateException, BadConfigException, IOException {
-    binding.validate();
-
-    log.debug("Building application state");
-    publishedProviderConf = binding.publishedProviderConf;
-    applicationInfo = binding.applicationInfo != null ? binding.applicationInfo
-                        : new HashMap<String, String>();
-
-    clientProperties = new HashMap<>();
-    containerReleaseSelector = binding.releaseSelector;
-
-
-    Set<String> confKeys = ConfigHelper.sortedConfigKeys(publishedProviderConf);
-
-    //  Add the -site configuration properties
-    for (String key : confKeys) {
-      String val = publishedProviderConf.get(key);
-      clientProperties.put(key, val);
-    }
-
-    // set the cluster specification (once its dependency the client properties
-    // is out the way
-    setInitialInstanceDefinition(binding.instanceDefinition);
-
-    //build the initial role list
-    List<ProviderRole> roleList = new ArrayList<>(binding.roles);
-    for (ProviderRole providerRole : roleList) {
-      buildRole(providerRole);
-    }
-
-    ConfTreeOperations resources = instanceDefinition.getResourceOperations();
-
-    Set<String> roleNames = resources.getComponentNames();
-    for (String name : roleNames) {
-      if (roles.containsKey(name)) {
-        continue;
-      }
-      if (hasUniqueNames(resources, name)) {
-        log.info("Skipping group {}", name);
-        continue;
-      }
-      // this is a new value
-      log.info("Adding role {}", name);
-      MapOperations resComponent = resources.getComponent(name);
-      ProviderRole dynamicRole = createDynamicProviderRole(name, resComponent);
-      buildRole(dynamicRole);
-      roleList.add(dynamicRole);
-    }
-    //then pick up the requirements
-    buildRoleRequirementsFromResources();
-
-    //set the livespan
-    MapOperations globalResOpts = instanceDefinition.getResourceOperations().getGlobalOptions();
-
-    startTimeThreshold = globalResOpts.getOptionInt(
-        InternalKeys.INTERNAL_CONTAINER_FAILURE_SHORTLIFE,
-        InternalKeys.DEFAULT_INTERNAL_CONTAINER_FAILURE_SHORTLIFE);
-
-    failureThreshold = globalResOpts.getOptionInt(
-        CONTAINER_FAILURE_THRESHOLD,
-        DEFAULT_CONTAINER_FAILURE_THRESHOLD);
-    nodeFailureThreshold = globalResOpts.getOptionInt(
-        NODE_FAILURE_THRESHOLD,
-        DEFAULT_NODE_FAILURE_THRESHOLD);
-    initClusterStatus();
-
-
-    // set up the role history
-    roleHistory = new RoleHistory(roleStatusMap.values(), recordFactory);
-    roleHistory.register(metricsAndMonitoring);
-    roleHistory.onStart(binding.fs, binding.historyPath);
-    // trigger first node update
-    roleHistory.onNodesUpdated(binding.nodeReports);
-
-
-    //rebuild any live containers
-    rebuildModelFromRestart(binding.liveContainers);
-
-    // any am config options to pick up
-    logServerURL = binding.serviceConfig.get(YarnConfiguration.YARN_LOG_SERVER_URL, "");
-    //mark as live
-    applicationLive = true;
-  }
-
-  public void initClusterStatus() {
-    //copy into cluster status. 
-    ClusterDescription status = ClusterDescription.copy(clusterStatusTemplate);
-    status.state = STATE_CREATED;
-    MapOperations infoOps = new MapOperations("info", status.info);
-    infoOps.mergeWithoutOverwrite(applicationInfo);
-    SliderUtils.addBuildInfo(infoOps, "status");
-
-    long now = now();
-    status.setInfoTime(StatusKeys.INFO_LIVE_TIME_HUMAN,
-                              StatusKeys.INFO_LIVE_TIME_MILLIS,
-                              now);
-    SliderUtils.setInfoTime(infoOps,
-        StatusKeys.INFO_LIVE_TIME_HUMAN,
-        StatusKeys.INFO_LIVE_TIME_MILLIS,
-        now);
-    if (0 == status.createTime) {
-      status.createTime = now;
-      SliderUtils.setInfoTime(infoOps,
-          StatusKeys.INFO_CREATE_TIME_HUMAN,
-          StatusKeys.INFO_CREATE_TIME_MILLIS,
-          now);
-    }
-    status.state = STATE_LIVE;
-
-      //set the app state to this status
-    setClusterStatus(status);
-  }
-
-  /**
-   * Build a dynamic provider role
-   * @param name name of role
-   * @return a new provider role
-   * @throws BadConfigException bad configuration
-   */
-  public ProviderRole createDynamicProviderRole(String name, MapOperations component)
-      throws BadConfigException {
-    return createDynamicProviderRole(name, name, component);
-  }
-
-  /**
-   * Build a dynamic provider role
-   * @param name name of role
-   * @param group group of role
-   * @return a new provider role
-   * @throws BadConfigException bad configuration
-   */
-  public ProviderRole createDynamicProviderRole(String name, String group, MapOperations component)
-      throws BadConfigException {
-    String priOpt = component.getMandatoryOption(COMPONENT_PRIORITY);
-    int priority = SliderUtils.parseAndValidate(
-        "value of " + name + " " + COMPONENT_PRIORITY, priOpt, 0, 1, -1);
-
-    String placementOpt = component.getOption(COMPONENT_PLACEMENT_POLICY,
-        Integer.toString(PlacementPolicy.DEFAULT));
-
-    int placement = SliderUtils.parseAndValidate(
-        "value of " + name + " " + COMPONENT_PLACEMENT_POLICY, placementOpt, 0, 0, -1);
-
-    int placementTimeout = component.getOptionInt(PLACEMENT_ESCALATE_DELAY,
-            DEFAULT_PLACEMENT_ESCALATE_DELAY_SECONDS);
-
-    ProviderRole newRole = new ProviderRole(name,
-        group,
-        priority,
-        placement,
-        getNodeFailureThresholdForRole(group),
-        placementTimeout,
-        component.getOption(YARN_LABEL_EXPRESSION, DEF_YARN_LABEL_EXPRESSION));
-    log.info("New {} ", newRole);
-    return newRole;
-  }
-
-  /**
-   * Actions to perform when an instance definition is updated
-   * Currently: 
-   * <ol>
-   *   <li>
-   *     resolve the configuration
-   *   </li>
-   *   <li>
-   *     update the cluster spec derivative
-   *   </li>
-   * </ol>
-   *  
-   * @throws BadConfigException
-   */
-  private synchronized void onInstanceDefinitionUpdated()
-      throws BadConfigException, IOException {
-
-    log.debug("Instance definition updated");
-    //note the time 
-    snapshotTime = now();
-
-    for (String component : instanceDefinition.getResourceOperations().getComponentNames()) {
-      instanceDefinition.getAppConfOperations().getOrAddComponent(component);
-    }
-
-    // resolve references if not already done
-    instanceDefinition.resolve();
-
-    // force in the AM desired state values
-    ConfTreeOperations resources = instanceDefinition.getResourceOperations();
-
-    if (resources.getComponent(SliderKeys.COMPONENT_AM) != null) {
-      resources.setComponentOpt(
-          SliderKeys.COMPONENT_AM, COMPONENT_INSTANCES, "1");
-    }
-
-
-    //snapshot all three sectons
-    resourcesSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getResources());
-    appConfSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getAppConf());
-    internalsSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getInternal());
-    //build a new aggregate from the snapshots
-    instanceDefinitionSnapshot = new AggregateConf(resourcesSnapshot.confTree,
-                                                   appConfSnapshot.confTree,
-                                                   internalsSnapshot.confTree);
-    instanceDefinitionSnapshot.setName(instanceDefinition.getName());
-
-    clusterStatusTemplate = ClusterDescriptionOperations.buildFromInstanceDefinition(
-          instanceDefinition);
-
-    // Add the -site configuration properties
-    for (Map.Entry<String, String> prop : clientProperties.entrySet()) {
-      clusterStatusTemplate.clientProperties.put(prop.getKey(), prop.getValue());
-    }
-
-  }
-
-  /**
-   * The resource configuration is updated -review and update state.
-   * @param resources updated resources specification
-   * @return a list of any dynamically added provider roles
-   * (purely for testing purposes)
-   */
-  @VisibleForTesting
-  public synchronized List<ProviderRole> updateResourceDefinitions(ConfTree resources)
-      throws BadConfigException, IOException {
-    log.debug("Updating resources to {}", resources);
-    // snapshot the (possibly unresolved) values
-    ConfTreeSerDeser serDeser = new ConfTreeSerDeser();
-    unresolvedInstanceDefinition.setResources(
-        serDeser.fromInstance(resources));
-    // assign another copy under the instance definition for resolving
-    // and then driving application size
-    instanceDefinition.setResources(serDeser.fromInstance(resources));
-    onInstanceDefinitionUpdated();
-
-    // propagate the role table
-    Map<String, Map<String, String>> updated = resources.components;
-    getClusterStatus().roles = SliderUtils.deepClone(updated);
-    getClusterStatus().updateTime = now();
-    return buildRoleRequirementsFromResources();
-  }
-
-  /**
-   * build the role requirements from the cluster specification
-   * @return a list of any dynamically added provider roles
-   */
-  private List<ProviderRole> buildRoleRequirementsFromResources() throws BadConfigException {
-
-    List<ProviderRole> newRoles = new ArrayList<>(0);
-
-    // now update every role's desired count.
-    // if there are no instance values, that role count goes to zero
-
-    ConfTreeOperations resources =
-        instanceDefinition.getResourceOperations();
-
-    // Add all the existing roles
-    Map<String, Integer> groupCounts = new HashMap<>();
-    for (RoleStatus roleStatus : getRoleStatusMap().values()) {
-      if (roleStatus.isExcludeFromFlexing()) {
-        // skip inflexible roles, e.g AM itself
-        continue;
-      }
-      long currentDesired = roleStatus.getDesired();
-      String role = roleStatus.getName();
-      String roleGroup = roleStatus.getGroup();
-      int desiredInstanceCount = getDesiredInstanceCount(resources, roleGroup);
-
-      int newDesired = desiredInstanceCount;
-      if (hasUniqueNames(resources, roleGroup)) {
-        Integer groupCount = 0;
-        if (groupCounts.containsKey(roleGroup)) {
-          groupCount = groupCounts.get(roleGroup);
-        }
-
-        newDesired = desiredInstanceCount - groupCount;
-
-        if (newDesired > 0) {
-          newDesired = 1;
-          groupCounts.put(roleGroup, groupCount + newDesired);
-        } else {
-          newDesired = 0;
-        }
-      }
-
-      if (newDesired == 0) {
-        log.info("Role {} has 0 instances specified", role);
-      }
-      if (currentDesired != newDesired) {
-        log.info("Role {} flexed from {} to {}", role, currentDesired,
-            newDesired);
-        roleStatus.setDesired(newDesired);
-      }
-    }
-
-    // now the dynamic ones. Iterate through the the cluster spec and
-    // add any role status entries not in the role status
-    Set<String> roleNames = resources.getComponentNames();
-    for (String name : roleNames) {
-      if (roles.containsKey(name)) {
-        continue;
-      }
-      if (hasUniqueNames(resources, name)) {
-        // THIS NAME IS A GROUP
-        int desiredInstanceCount = getDesiredInstanceCount(resources, name);
-        Integer groupCount = 0;
-        if (groupCounts.containsKey(name)) {
-          groupCount = groupCounts.get(name);
-        }
-        for (int i = groupCount + 1; i <= desiredInstanceCount; i++) {
-          int priority = resources.getComponentOptInt(name, COMPONENT_PRIORITY, i);
-          // this is a new instance of an existing group
-          String newName = String.format("%s%d", name, i);
-          int newPriority = getNewPriority(priority + i - 1);
-          log.info("Adding new role {}", newName);
-          MapOperations component = resources.getComponent(name,
-              Collections.singletonMap(COMPONENT_PRIORITY,
-                  Integer.toString(newPriority)));
-          if (component == null) {
-            throw new BadConfigException("Component is null for name = " + name
-                + ", newPriority =" + newPriority);
-          }
-          ProviderRole dynamicRole = createDynamicProviderRole(newName, name, component);
-          RoleStatus roleStatus = buildRole(dynamicRole);
-          roleStatus.setDesired(1);
-          log.info("New role {}", roleStatus);
-          if (roleHistory != null) {
-            roleHistory.addNewRole(roleStatus);
-          }
-          newRoles.add(dynamicRole);
-        }
-      } else {
-        // this is a new value
-        log.info("Adding new role {}", name);
-        MapOperations component = resources.getComponent(name);
-        ProviderRole dynamicRole = createDynamicProviderRole(name, component);
-        RoleStatus roleStatus = buildRole(dynamicRole);
-        roleStatus.setDesired(getDesiredInstanceCount(resources, name));
-        log.info("New role {}", roleStatus);
-        if (roleHistory != null) {
-          roleHistory.addNewRole(roleStatus);
-        }
-        newRoles.add(dynamicRole);
-      }
-    }
-    // and fill in all those roles with their requirements
-    buildRoleResourceRequirements();
-
-    return newRoles;
-  }
-
-  private int getNewPriority(int start) {
-    if (!rolePriorityMap.containsKey(start)) {
-      return start;
-    }
-    return rolePriorityMap.lastKey() + 1;
-  }
-
-  /**
-   * Get the desired instance count of a role, rejecting negative values
-   * @param resources resource map
-   * @param roleGroup role group
-   * @return the instance count
-   * @throws BadConfigException if the count is negative
-   */
-  private int getDesiredInstanceCount(ConfTreeOperations resources,
-      String roleGroup) throws BadConfigException {
-    int desiredInstanceCount =
-      resources.getComponentOptInt(roleGroup, COMPONENT_INSTANCES, 0);
-
-    if (desiredInstanceCount < 0) {
-      log.error("Role {} has negative desired instances : {}", roleGroup,
-          desiredInstanceCount);
-      throw new BadConfigException(
-          "Negative instance count (%) requested for component %s",
-          desiredInstanceCount, roleGroup);
-    }
-    return desiredInstanceCount;
-  }
-
-  private Boolean hasUniqueNames(ConfTreeOperations resources, String group) {
-    MapOperations component = resources.getComponent(group);
-    if (component == null) {
-      log.info("Component was null for {} when checking unique names", group);
-      return Boolean.FALSE;
-    }
-    return component.getOptionBool(UNIQUE_NAMES, Boolean.FALSE);
-  }
-
-  /**
-   * Add knowledge of a role.
-   * This is a build-time operation that is not synchronized, and
-   * should be used while setting up the system state -before servicing
-   * requests.
-   * @param providerRole role to add
-   * @return the role status built up
-   * @throws BadConfigException if a role of that priority already exists
-   */
-  public RoleStatus buildRole(ProviderRole providerRole) throws BadConfigException {
-    // build role status map
-    int priority = providerRole.id;
-    if (roleStatusMap.containsKey(priority)) {
-      throw new BadConfigException("Duplicate Provider Key: %s and %s",
-                                   providerRole,
-                                   roleStatusMap.get(priority));
-    }
-    RoleStatus roleStatus = new RoleStatus(providerRole);
-    roleStatusMap.put(priority, roleStatus);
-    String name = providerRole.name;
-    roles.put(name, providerRole);
-    rolePriorityMap.put(priority, providerRole);
-    // register its entries
-    metricsAndMonitoring.addMetricSet(MetricsConstants.PREFIX_SLIDER_ROLES + name, roleStatus);
-    return roleStatus;
-  }
-
-  /**
-   * Build up the requirements of every resource
-   */
-  private void buildRoleResourceRequirements() {
-    for (RoleStatus role : roleStatusMap.values()) {
-      role.setResourceRequirements(
-          buildResourceRequirements(role, recordFactory.newResource()));
-    }
-  }
-
-  /**
-   * build up the special master node, which lives
-   * in the live node set but has a lifecycle bonded to the AM
-   * @param containerId the AM master
-   * @param host hostname
-   * @param amPort port
-   * @param nodeHttpAddress http address: may be null
-   */
-  public void buildAppMasterNode(ContainerId containerId,
-                                 String host,
-                                 int amPort,
-                                 String nodeHttpAddress) {
-    Container container = new ContainerPBImpl();
-    container.setId(containerId);
-    NodeId nodeId = NodeId.newInstance(host, amPort);
-    container.setNodeId(nodeId);
-    container.setNodeHttpAddress(nodeHttpAddress);
-    RoleInstance am = new RoleInstance(container);
-    am.role = SliderKeys.COMPONENT_AM;
-    am.group = SliderKeys.COMPONENT_AM;
-    am.roleId = SliderKeys.ROLE_AM_PRIORITY_INDEX;
-    am.createTime =now();
-    am.startTime = am.createTime;
-    appMasterNode = am;
-    //it is also added to the set of live nodes
-    getLiveContainers().put(containerId, am);
-    putOwnedContainer(containerId, am);
-
-    // patch up the role status
-    RoleStatus roleStatus = roleStatusMap.get(SliderKeys.ROLE_AM_PRIORITY_INDEX);
-    roleStatus.setDesired(1);
-    roleStatus.incActual();
-    roleStatus.incStarted();
-  }
-
-  /**
-   * Note that the master node has been launched,
-   * though it isn't considered live until any forked
-   * processes are running. It is NOT registered with
-   * the role history -the container is incomplete
-   * and it will just cause confusion
-   */
-  public void noteAMLaunched() {
-    getLiveContainers().put(appMasterNode.getContainerId(), appMasterNode);
-  }
-
-  /**
-   * AM declares ourselves live in the cluster description.
-   * This is meant to be triggered from the callback
-   * indicating the spawned process is up and running.
-   */
-  public void noteAMLive() {
-    appMasterNode.state = STATE_LIVE;
-  }
-
-  /**
-   * Look up the status entry of a role or raise an exception
-   * @param key role ID
-   * @return the status entry
-   * @throws RuntimeException if the role cannot be found
-   */
-  public RoleStatus lookupRoleStatus(int key) {
-    RoleStatus rs = getRoleStatusMap().get(key);
-    if (rs == null) {
-      throw new RuntimeException("Cannot find role for role ID " + key);
-    }
-    return rs;
-  }
-
-  /**
-   * Look up the status entry of a container or raise an exception
-   *
-   * @param c container
-   * @return the status entry
-   * @throws RuntimeException if the role cannot be found
-   */
-  public RoleStatus lookupRoleStatus(Container c) {
-    return lookupRoleStatus(ContainerPriority.extractRole(c));
-  }
-
-  /**
-   * Get a deep clone of the role status list. Concurrent events may mean this
-   * list (or indeed, some of the role status entries) may be inconsistent
-   * @return a snapshot of the role status entries
-   */
-  public List<RoleStatus> cloneRoleStatusList() {
-    Collection<RoleStatus> statuses = roleStatusMap.values();
-    List<RoleStatus> statusList = new ArrayList<>(statuses.size());
-    try {
-      for (RoleStatus status : statuses) {
-        statusList.add((RoleStatus)(status.clone()));
-      }
-    } catch (CloneNotSupportedException e) {
-      log.warn("Unexpected cloning failure: {}", e, e);
-    }
-    return statusList;
-  }
-
-
-  /**
-   * Look up a role in the map
-   * @param name role name
-   * @return the instance
-   * @throws YarnRuntimeException if not found
-   */
-  public RoleStatus lookupRoleStatus(String name) throws YarnRuntimeException {
-    ProviderRole providerRole = roles.get(name);
-    if (providerRole == null) {
-      throw new YarnRuntimeException("Unknown role " + name);
-    }
-    return lookupRoleStatus(providerRole.id);
-  }
-
-
-  /**
-   * Clone the list of active (==owned) containers
-   * @return the list of role instances representing all owned containers
-   */
-  public synchronized List<RoleInstance> cloneOwnedContainerList() {
-    Collection<RoleInstance> values = ownedContainers.values();
-    return new ArrayList<>(values);
-  }
-
-  /**
-   * Get the number of active (==owned) containers
-   * @return
-   */
-  public int getNumOwnedContainers() {
-    return ownedContainers.size();
-  }
-  
-  /**
-   * Look up an active container: any container that the AM has, even
-   * if it is not currently running/live
-   */
-  public RoleInstance getOwnedContainer(ContainerId id) {
-    return ownedContainers.get(id);
-  }
-
-  /**
-   * Remove an owned container
-   * @param id container ID
-   * @return the instance removed
-   */
-  private RoleInstance removeOwnedContainer(ContainerId id) {
-    return ownedContainers.remove(id);
-  }
-
-  /**
-   * set/update an owned container
-   * @param id container ID
-   * @param instance
-   * @return
-   */
-  private RoleInstance putOwnedContainer(ContainerId id,
-      RoleInstance instance) {
-    return ownedContainers.put(id, instance);
-  }
-
-  /**
-   * Clone the live container list. This is synchronized.
-   * @return a snapshot of the live node list
-   */
-  public synchronized List<RoleInstance> cloneLiveContainerInfoList() {
-    List<RoleInstance> allRoleInstances;
-    Collection<RoleInstance> values = getLiveContainers().values();
-    allRoleInstances = new ArrayList<>(values);
-    return allRoleInstances;
-  }
-
-  /**
-   * Lookup live instance by string value of container ID
-   * @param containerId container ID as a string
-   * @return the role instance for that container
-   * @throws NoSuchNodeException if it does not exist
-   */
-  public synchronized RoleInstance getLiveInstanceByContainerID(String containerId)
-      throws NoSuchNodeException {
-    Collection<RoleInstance> nodes = getLiveContainers().values();
-    return findNodeInCollection(containerId, nodes);
-  }
-
-  /**
-   * Lookup owned instance by string value of container ID
-   * @param containerId container ID as a string
-   * @return the role instance for that container
-   * @throws NoSuchNodeException if it does not exist
-   */
-  public synchronized RoleInstance getOwnedInstanceByContainerID(String containerId)
-      throws NoSuchNodeException {
-    Collection<RoleInstance> nodes = ownedContainers.values();
-    return findNodeInCollection(containerId, nodes);
-  }
-
-  /**
-   * Iterate through a collection of role instances to find one with a
-   * specific (string) container ID
-   * @param containerId container ID as a string
-   * @param nodes collection
-   * @return the found node 
-   * @throws NoSuchNodeException if there was no match
-   */
-  private RoleInstance findNodeInCollection(String containerId,
-      Collection<RoleInstance> nodes) throws NoSuchNodeException {
-    RoleInstance found = null;
-    for (RoleInstance node : nodes) {
-      if (containerId.equals(node.id)) {
-        found = node;
-        break;
-      }
-    }
-    if (found != null) {
-      return found;
-    } else {
-      //at this point: no node
-      throw new NoSuchNodeException("Unknown node: " + containerId);
-    }
-  }
-
-  public synchronized List<RoleInstance> getLiveInstancesByContainerIDs(
-    Collection<String> containerIDs) {
-    //first, a hashmap of those containerIDs is built up
-    Set<String> uuidSet = new HashSet<String>(containerIDs);
-    List<RoleInstance> nodes = new ArrayList<RoleInstance>(uuidSet.size());
-    Collection<RoleInstance> clusterNodes = getLiveContainers().values();
-
-    for (RoleInstance node : clusterNodes) {
-      if (uuidSet.contains(node.id)) {
-        nodes.add(node);
-      }
-    }
-    //at this point: a possibly empty list of nodes
-    return nodes;
-  }
-
-  /**
-   * Enum all nodes by role. 
-   * @param role role, or "" for all roles
-   * @return a list of nodes, may be empty
-   */
-  public synchronized List<RoleInstance> enumLiveNodesInRole(String role) {
-    List<RoleInstance> nodes = new ArrayList<RoleInstance>();
-    Collection<RoleInstance> allRoleInstances = getLiveContainers().values();
-    for (RoleInstance node : allRoleInstances) {
-      if (role.isEmpty() || role.equals(node.role)) {
-        nodes.add(node);
-      }
-    }
-    return nodes;
-  }
-
- 
-  /**
-   * enum nodes by role ID, from either the owned or live node list
-   * @param roleId role the container must be in
-   * @param owned flag to indicate "use owned list" rather than the smaller
-   * "live" list
-   * @return a list of nodes, may be empty
-   */
-  public synchronized List<RoleInstance> enumNodesWithRoleId(int roleId,
-      boolean owned) {
-    List<RoleInstance> nodes = new ArrayList<RoleInstance>();
-    Collection<RoleInstance> allRoleInstances;
-    allRoleInstances = owned ? ownedContainers.values() : liveNodes.values();
-    for (RoleInstance node : allRoleInstances) {
-      if (node.roleId == roleId) {
-        nodes.add(node);
-      }
-    }
-    return nodes;
-  }
-
-  /**
-   * Build an instance map.
-   * @return the map of Role name to list of role instances
-   */
-  private synchronized Map<String, List<String>> createRoleToInstanceMap() {
-    Map<String, List<String>> map = new HashMap<String, List<String>>();
-    for (RoleInstance node : getLiveContainers().values()) {
-      List<String> containers = map.get(node.role);
-      if (containers == null) {
-        containers = new ArrayList<String>();
-        map.put(node.role, containers);
-      }
-      containers.add(node.id);
-    }
-    return map;
-  }
-
-  /**
-   * Build a map of role->nodename->node-info
-   * 
-   * @return the map of Role name to list of Cluster Nodes
-   */
-  public synchronized Map<String, Map<String, ClusterNode>> createRoleToClusterNodeMap() {
-    Map<String, Map<String, ClusterNode>> map = new HashMap<>();
-    for (RoleInstance node : getLiveContainers().values()) {
-      
-      Map<String, ClusterNode> containers = map.get(node.role);
-      if (containers == null) {
-        containers = new HashMap<String, ClusterNode>();
-        map.put(node.role, containers);
-      }
-      ClusterNode clusterNode = node.toClusterNode();
-      containers.put(clusterNode.name, clusterNode);
-    }
-    return map;
-  }
-
-  /**
-   * Notification called just before the NM is asked to 
-   * start a container
-   * @param container container to start
-   * @param instance clusterNode structure
-   */
-  public void containerStartSubmitted(Container container,
-                                      RoleInstance instance) {
-    instance.state = STATE_SUBMITTED;
-    instance.container = container;
-    instance.createTime = now();
-    getStartingContainers().put(container.getId(), instance);
-    putOwnedContainer(container.getId(), instance);
-    roleHistory.onContainerStartSubmitted(container, instance);
-  }
-
-  /**
-   * Note that a container has been submitted for release; update internal state
-   * and mark the associated ContainerInfo released field to indicate that
-   * while it is still in the active list, it has been queued for release.
-   *
-   * @param container container
-   * @throws SliderInternalStateException if there is no container of that ID
-   * on the active list
-   */
-  public synchronized void containerReleaseSubmitted(Container container)
-      throws SliderInternalStateException {
-    ContainerId id = container.getId();
-    //look up the container
-    RoleInstance instance = getOwnedContainer(id);
-    if (instance == null) {
-      throw new SliderInternalStateException(
-        "No active container with ID " + id);
-    }
-    //verify that it isn't already released
-    if (containersBeingReleased.containsKey(id)) {
-      throw new SliderInternalStateException(
-        "Container %s already queued for release", id);
-    }
-    instance.released = true;
-    containersBeingReleased.put(id, instance.container);
-    RoleStatus role = lookupRoleStatus(instance.roleId);
-    role.incReleasing();
-    roleHistory.onContainerReleaseSubmitted(container);
-  }
-
-  /**
-   * Create a container request.
-   * Update internal state, such as the role request count. 
-   * Anti-Affine: the {@link RoleStatus#outstandingAArequest} is set here.
-   * This is where role history information will be used for placement decisions.
-   * @param role role
-   * @return the container request to submit or null if there is none
-   */
-  private AMRMClient.ContainerRequest createContainerRequest(RoleStatus role) {
-    if (role.isAntiAffinePlacement()) {
-      return createAAContainerRequest(role);
-    } else {
-      incrementRequestCount(role);
-      OutstandingRequest request = roleHistory.requestContainerForRole(role);
-      if (request != null) {
-        return request.getIssuedRequest();
-      } else {
-        return null;
-      }
-    }
-  }
-
-  /**
-   * Create a container request.
-   * Update internal state, such as the role request count.
-   * Anti-Affine: the {@link RoleStatus#outstandingAArequest} is set here.
-   * This is where role history information will be used for placement decisions.
-   * @param role role
-   * @return the container request to submit or null if there is none
-   */
-  private AMRMClient.ContainerRequest createAAContainerRequest(RoleStatus role) {
-    OutstandingRequest request = roleHistory.requestContainerForAARole(role);
-    if (request == null) {
-      return null;
-    }
-    incrementRequestCount(role);
-    role.setOutstandingAArequest(request);
-    return request.getIssuedRequest();
-  }
-
-  /**
-   * Increment the request count of a role.
-   * <p>
-   *   Also updates application state counters
-   * @param role role being requested.
-   */
-  protected void incrementRequestCount(RoleStatus role) {
-    role.incRequested();
-    incOutstandingContainerRequests();
-  }
-
-  /**
-   * Inc #of outstanding requests.
-   */
-  private void incOutstandingContainerRequests() {
-     outstandingContainerRequests.inc();
-  }
-
-  /**
-   * Decrement the number of outstanding requests. This never goes below zero.
-   */
-  private void decOutstandingContainerRequests() {
-    synchronized (outstandingContainerRequests) {
-      if (outstandingContainerRequests.getCount() > 0) {
-        // decrement but never go below zero
-        outstandingContainerRequests.dec();
-      }
-    }
-  }
-
-
-  /**
-   * Get the value of a YARN requirement (cores, RAM, etc).
-   * These are returned as integers, but there is special handling of the 
-   * string {@link ResourceKeys#YARN_RESOURCE_MAX}, which triggers
-   * the return of the maximum value.
-   * @param group component to get from
-   * @param option option name
-   * @param defVal default value
-   * @param maxVal value to return if the max val is requested
-   * @return parsed value
-   * @throws NumberFormatException if the role could not be parsed.
-   */
-  private int getResourceRequirement(ConfTreeOperations resources,
-                                     String group,
-                                     String option,
-                                     int defVal,
-                                     int maxVal) {
-
-    String val = resources.getComponentOpt(group, option,
-        Integer.toString(defVal));
-    Integer intVal;
-    if (YARN_RESOURCE_MAX.equals(val)) {
-      intVal = maxVal;
-    } else {
-      intVal = Integer.decode(val);
-    }
-    return intVal;
-  }
-
-  /**
-   * Build up the resource requirements for this role from the
-   * cluster specification, including substituing max allowed values
-   * if the specification asked for it.
-   * @param role role
-   * @param capability capability to set up. A new one may be created
-   * during normalization
-   */
-  public Resource buildResourceRequirements(RoleStatus role, Resource capability) {
-    // Set up resource requirements from role values
-    String name = role.getName();
-    String group = role.getGroup();
-    ConfTreeOperations resources = getResourcesSnapshot();
-    int cores = getResourceRequirement(resources,
-                                       group,
-                                       YARN_CORES,
-                                       DEF_YARN_CORES,
-                                       containerMaxCores);
-    capability.setVirtualCores(cores);
-    int ram = getResourceRequirement(resources, group,
-                                     YARN_MEMORY,
-                                     DEF_YARN_MEMORY,
-                                     containerMaxMemory);
-    capability.setMemory(ram);
-    log.debug("Component {} has RAM={}, vCores ={}", name, ram, cores);
-    Resource normalized = recordFactory.normalize(capability, minResource,
-        maxResource);
-    if (!Resources.equals(normalized, capability)) {
-      // resource requirements normalized to something other than asked for.
-      // LOG @ WARN so users can see why this is happening.
-      log.warn("Resource requirements of {} normalized" +
-              " from {} to {}", name, capability, normalized);
-    }
-    return normalized;
-  }
-
-  /**
-   * add a launched container to the node map for status responses
-   * @param container id
-   * @param node node details
-   */
-  private void addLaunchedContainer(Container container, RoleInstance node) {
-    node.container = container;
-    if (node.role == null) {
-      throw new RuntimeException(
-        "Unknown role for node " + node);
-    }
-    getLiveContainers().put(node.getContainerId(), node);
-    //tell role history
-    roleHistory.onContainerStarted(container);
-  }
-
-  /**
-   * container start event
-   * @param containerId container that is to be started
-   * @return the role instance, or null if there was a problem
-   */
-  public synchronized RoleInstance onNodeManagerContainerStarted(ContainerId containerId) {
-    try {
-      return innerOnNodeManagerContainerStarted(containerId);
-    } catch (YarnRuntimeException e) {
-      log.error("NodeManager callback on started container {} failed",
-                containerId,
-                e);
-      return null;
-    }
-  }
-
-   /**
-   * container start event handler -throwing an exception on problems
-   * @param containerId container that is to be started
-   * @return the role instance
-   * @throws RuntimeException on problems
-   */
-  @VisibleForTesting
-  public RoleInstance innerOnNodeManagerContainerStarted(ContainerId containerId) {
-    incStartedCountainerCount();
-    RoleInstance instance = getOwnedContainer(containerId);
-    if (instance == null) {
-      //serious problem
-      throw new YarnRuntimeException("Container not in active containers start "+
-                containerId);
-    }
-    if (instance.role == null) {
-      throw new YarnRuntimeException("Component instance has no instance name " +
-                                     instance);
-    }
-    instance.startTime = now();
-    RoleInstance starting = getStartingContainers().remove(containerId);
-    if (null == starting) {
-      throw new YarnRuntimeException(
-        "Container "+ containerId +" is already started");
-    }
-    instance.state = STATE_LIVE;
-    RoleStatus roleStatus = lookupRoleStatus(instance.roleId);
-    roleStatus.incStarted();
-    Container container = instance.container;
-    addLaunchedContainer(container, instance);
-    return instance;
-  }
-
-  /**
-   * update the application state after a failure to start a container.
-   * This is perhaps where blacklisting could be most useful: failure
-   * to start a container is a sign of a more serious problem
-   * than a later exit.
-   *
-   * -relayed from NMClientAsync.CallbackHandler 
-   * @param containerId failing container
-   * @param thrown what was thrown
-   */
-  public synchronized void onNodeManagerContainerStartFailed(ContainerId containerId,
-                                                             Throwable thrown) {
-    removeOwnedContainer(containerId);
-    incFailedCountainerCount();
-    incStartFailedCountainerCount();
-    RoleInstance instance = getStartingContainers().remove(containerId);
-    if (null != instance) {
-      RoleStatus roleStatus = lookupRoleStatus(instance.roleId);
-      String text;
-      if (null != thrown) {
-        text = SliderUtils.stringify(thrown);
-      } else {
-        text = "container start failure";
-      }
-      instance.diagnostics = text;
-      roleStatus.noteFailed(true, text, ContainerOutcome.Failed);
-      getFailedContainers().put(containerId, instance);
-      roleHistory.onNodeManagerContainerStartFailed(instance.container);
-    }
-  }
-
-  /**
-   * Handle node update from the RM. This syncs up the node map with the RM's view
-   * @param updatedNodes updated nodes
-   */
-  public synchronized NodeUpdatedOutcome onNodesUpdated(List<NodeReport> updatedNodes) {
-    boolean changed = roleHistory.onNodesUpdated(updatedNodes);
-    if (changed) {
-      log.info("YARN cluster changed \u2014cancelling current AA requests");
-      List<AbstractRMOperation> operations = cancelOutstandingAARequests();
-      log.debug("Created {} cancel requests", operations.size());
-      return new NodeUpdatedOutcome(true, operations);
-    }
-    return new NodeUpdatedOutcome(false, new ArrayList<AbstractRMOperation>(0));
-  }
-
-  /**
-   * Return value of the {@link #onNodesUpdated(List)} call.
-   */
-  public static class NodeUpdatedOutcome {
-    public final boolean clusterChanged;
-    public final List<AbstractRMOperation> operations;
-
-    public NodeUpdatedOutcome(boolean clusterChanged,
-        List<AbstractRMOperation> operations) {
-      this.clusterChanged = clusterChanged;
-      this.operations = operations;
-    }
-  }
-  /**
-   * Is a role short lived by the threshold set for this application
-   * @param instance instance
-   * @return true if the instance is considered short lived
-   */
-  @VisibleForTesting
-  public boolean isShortLived(RoleInstance instance) {
-    long time = now();
-    long started = instance.startTime;
-    boolean shortlived;
-    if (started > 0) {
-      long duration = time - started;
-      shortlived = duration < (startTimeThreshold * 1000);
-      log.info("Duration {} and startTimeThreshold {}", duration, startTimeThreshold);
-    } else {
-      // never even saw a start event
-      shortlived = true;
-    }
-    return shortlived;
-  }
-
-  /**
-   * Current time in milliseconds. Made protected for
-   * the option to override it in tests.
-   * @return the current time.
-   */
-  protected long now() {
-    return System.currentTimeMillis();
-  }
-
-  /**
-   * This is a very small class to send a multiple result back from 
-   * the completion operation
-   */
-  public static class NodeCompletionResult {
-    public boolean surplusNode = false;
-    public RoleInstance roleInstance;
-    // did the container fail for *any* reason?
-    public boolean containerFailed = false;
-    // detailed outcome on the container failure
-    public ContainerOutcome outcome = ContainerOutcome.Completed;
-    public int exitStatus = 0;
-    public boolean unknownNode = false;
-
-    public String toString() {
-      final StringBuilder sb =
-        new StringBuilder("NodeCompletionResult{");
-      sb.append("surplusNode=").append(surplusNode);
-      sb.append(", roleInstance=").append(roleInstance);
-      sb.append(", exitStatus=").append(exitStatus);
-      sb.append(", containerFailed=").append(containerFailed);
-      sb.append(", outcome=").append(outcome);
-      sb.append(", unknownNode=").append(unknownNode);
-      sb.append('}');
-      return sb.toString();
-    }
-  }
-
-  /**
-   * handle completed node in the CD -move something from the live
-   * server list to the completed server list.
-   * @param status the node that has just completed
-   * @return NodeCompletionResult
-   */
-  public synchronized NodeCompletionResult onCompletedNode(ContainerStatus status) {
-    ContainerId containerId = status.getContainerId();
-    NodeCompletionResult result = new NodeCompletionResult();
-    RoleInstance roleInstance;
-
-    int exitStatus = status.getExitStatus();
-    result.exitStatus = exitStatus;
-    if (containersBeingReleased.containsKey(containerId)) {
-      log.info("Container was queued for release : {}", containerId);
-      Container container = containersBeingReleased.remove(containerId);
-      RoleStatus roleStatus = lookupRoleStatus(container);
-      long releasing = roleStatus.decReleasing();
-      long actual = roleStatus.decActual();
-      long completedCount = roleStatus.incCompleted();
-      log.info("decrementing role count for role {} to {}; releasing={}, completed={}",
-          roleStatus.getName(),
-          actual,
-          releasing,
-          completedCount);
-      result.outcome = ContainerOutcome.Completed;
-      roleHistory.onReleaseCompleted(container);
-
-    } else if (surplusNodes.remove(containerId)) {
-      //its a surplus one being purged
-      result.surplusNode = true;
-    } else {
-      // a container has failed or been killed
-      // use the exit code to determine the outcome
-      result.containerFailed = true;
-      result.outcome = ContainerOutcome.fromExitStatus(exitStatus);
-
-      roleInstance = removeOwnedContainer(containerId);
-      if (roleInstance != null) {
-        //it was active, move it to failed 
-        incFailedCountainerCount();
-        failedContainers.put(containerId, roleInstance);
-      } else {
-        // the container may have been noted as failed already, so look
-        // it up
-        roleInstance = failedContainers.get(containerId);
-      }
-      if (roleInstance != null) {
-        int roleId = roleInstance.roleId;
-        String rolename = roleInstance.role;
-        log.info("Failed container in role[{}] : {}", roleId, rolename);
-        try {
-          RoleStatus roleStatus = lookupRoleStatus(roleId);
-          roleStatus.decActual();
-          boolean shortLived = isShortLived(roleInstance);
-          String message;
-          Container failedContainer = roleInstance.container;
-
-          //build the failure message
-          if (failedContainer != null) {
-            String completedLogsUrl = getLogsURLForContainer(failedContainer);
-            message = String.format("Failure %s on host %s (%d): %s",
-                roleInstance.getContainerId(),
-                failedContainer.getNodeId().getHost(),
-                exitStatus,
-                completedLogsUrl);
-          } else {
-            message = String.format("Failure %s (%d)", containerId, exitStatus);
-          }
-          roleStatus.noteFailed(shortLived, message, result.outcome);
-          long failed = roleStatus.getFailed();
-          log.info("Current count of failed role[{}] {} =  {}",
-              roleId, rolename, failed);
-          if (failedContainer != null) {
-            roleHistory.onFailedContainer(failedContainer, shortLived, result.outcome);
-          }
-
-        } catch (YarnRuntimeException e1) {
-          log.error("Failed container of unknown role {}", roleId);
-        }
-      } else {
-        //this isn't a known container.
-
-        log.error("Notified of completed container {} that is not in the list" +
-            " of active or failed containers", containerId);
-        completionOfUnknownContainerEvent.incrementAndGet();
-        result.unknownNode = true;
-      }
-    }
-
-    if (result.surplusNode) {
-      //a surplus node
-      return result;
-    }
-
-    //record the complete node's details; this pulls it from the livenode set 
-    //remove the node
-    ContainerId id = status.getContainerId();
-    log.info("Removing node ID {}", id);
-    RoleInstance node = getLiveContainers().remove(id);
-    if (node != null) {
-      node.state = STATE_DESTROYED;
-      node.exitCode = exitStatus;
-      node.diagnostics = status.getDiagnostics();
-      getCompletedContainers().put(id, node);
-      result.roleInstance = node;
-    } else {
-      // not in the list
-      log.warn("Received notification of completion of unknown node {}", id);
-      completionOfNodeNotInLiveListEvent.incrementAndGet();
-    }
-
-    // and the active node list if present
-    removeOwnedContainer(containerId);
-
-    // finally, verify the node doesn't exist any more
-    assert !containersBeingReleased.containsKey(
-        containerId) : "container still in release queue";
-    assert !getLiveContainers().containsKey(
-        containerId) : " container still in live nodes";
-    assert getOwnedContainer(containerId) ==
-           null : "Container still in active container list";
-
-    return result;
-  }
-
-  /**
-   * Get the URL log for a container
-   * @param c container
-   * @return the URL or "" if it cannot be determined
-   */
-  protected String getLogsURLForContainer(Container c) {
-    if (c==null) {
-      return null;
-    }
-    String user = null;
-    try {
-      user = SliderUtils.getCurrentUser().getShortUserName();
-    } catch (IOException ignored) {
-    }
-    String completedLogsUrl = "";
-    String url = logServerURL;
-    if (user != null && SliderUtils.isSet(url)) {
-      completedLogsUrl = url
-          + "/" + c.getNodeId() + "/" + c.getId() + "/ctx/" + user;
-    }
-    return completedLogsUrl;
-  }
-
-  /**
-   * Return the percentage done that Slider is to have YARN display in its
-   * Web UI
-   * @return an number from 0 to 100
-   */
-  public synchronized float getApplicationProgressPercentage() {
-    float percentage;
-    long desired = 0;
-    float actual = 0;
-    for (RoleStatus role : getRoleStatusMap().values()) {
-      desired += role.getDesired();
-      actual += role.getActual();
-    }
-    if (desired == 0) {
-      percentage = 100;
-    } else {
-      percentage = actual / desired;
-    }
-    return percentage;
-  }
-
-  /**
-   * Update the cluster description with the current application state
-   */
-
-  public ClusterDescription refreshClusterStatus() {
-    return refreshClusterStatus(null);
-  }
-
-  /**
-   * Update the cluster description with the current application state
-   * @param providerStatus status from the provider for the cluster info section
-   */
-  public synchronized ClusterDescription refreshClusterStatus(Map<String, String> providerStatus) {
-    ClusterDescription cd = getClusterStatus();
-    long now = now();
-    cd.setInfoTime(StatusKeys.INFO_STATUS_TIME_HUMAN,
-                   StatusKeys.INFO_STATUS_TIME_MILLIS,
-                   now);
-    if (providerStatus != null) {
-      for (Map.Entry<String, String> entry : providerStatus.entrySet()) {
-        cd.setInfo(entry.getKey(), entry.getValue());
-      }
-    }
-    MapOperations infoOps = new MapOperations("info", cd.info);
-    infoOps.mergeWithoutOverwrite(applicationInfo);
-    SliderUtils.addBuildInfo(infoOps, "status");
-    cd.statistics = new HashMap<>();
-
-    // build the map of node -> container IDs
-    Map<String, List<String>> instanceMap = createRoleToInstanceMap();
-    cd.instances = instanceMap;
-    
-    //build the map of node -> containers
-    Map<String, Map<String, ClusterNode>> clusterNodes =
-      createRoleToClusterNodeMap();
-    log.info("app state clusterNodes {} ", clusterNodes.toString());
-    cd.status = new HashMap<>();
-    cd.status.put(ClusterDescriptionKeys.KEY_CLUSTER_LIVE, clusterNodes);
-
-
-    for (RoleStatus role : getRoleStatusMap().values()) {
-      String rolename = role.getName();
-      if (hasUniqueNames(instanceDefinition.getResourceOperations(),
-          role.getGroup())) {
-        cd.setRoleOpt(rolename, COMPONENT_PRIORITY, role.getPriority());
-        cd.setRoleOpt(rolename, ROLE_GROUP, role.getGroup());
-        MapOperations groupOptions = instanceDefinition.getResourceOperations()
-            .getComponent(role.getGroup());
-        SliderUtils.mergeMapsIgnoreDuplicateKeys(cd.getRole(rolename),
-            groupOptions.options);
-      }
-      String prefix = instanceDefinition.getAppConfOperations()
-          .getComponentOpt(role.getGroup(), ROLE_PREFIX, null);
-      if (SliderUtils.isSet(prefix)) {
-        cd.setRoleOpt(rolename, ROLE_PREFIX, SliderUtils.trimPrefix(prefix));
-      }
-      List<String> instances = instanceMap.get(rolename);
-      int nodeCount = instances != null ? instances.size(): 0;
-      cd.setRoleOpt(rolename, COMPONENT_INSTANCES,
-                    role.getDesired());
-      cd.setRoleOpt(rolename, ROLE_ACTUAL_INSTANCES, nodeCount);
-      cd.setRoleOpt(rolename, ROLE_REQUESTED_INSTANCES, role.getRequested());
-      cd.setRoleOpt(rolename, ROLE_RELEASING_INSTANCES, role.getReleasing());
-      cd.setRoleOpt(rolename, ROLE_FAILED_INSTANCES, role.getFailed());
-      cd.setRoleOpt(rolename, ROLE_FAILED_STARTING_INSTANCES, role.getStartFailed());
-      cd.setRoleOpt(rolename, ROLE_FAILED_RECENTLY_INSTANCES, role.getFailedRecently());
-      cd.setRoleOpt(rolename, ROLE_NODE_FAILED_INSTANCES, role.getNodeFailed());
-      cd.setRoleOpt(rolename, ROLE_PREEMPTED_INSTANCES, role.getPreempted());
-      if (role.isAntiAffinePlacement()) {
-        cd.setRoleOpt(rolename, ROLE_PENDING_AA_INSTANCES, role.getPendingAntiAffineRequests());
-      }
-      Map<String, Integer> stats = role.buildStatistics();
-      cd.statistics.put(rolename, stats);
-    }
-
-    Map<String, Integer> sliderstats = getLiveStatistics();
-    cd.statistics.put(SliderKeys.COMPONENT_AM, sliderstats);
-
-    // liveness
-    cd.liveness = getApplicationLivenessInformation();
-
-    return cd;
-  }
-
-  /**
-   * get application liveness information
-   * @return a snapshot of the current liveness information
-   */  
-  public ApplicationLivenessInformation getApplicationLivenessInformation() {
-    ApplicationLivenessInformation li = new ApplicationLivenessInformation();
-    RoleStatistics stats = getRoleStatistics();
-    int outstanding = (int)(stats.desired - stats.actual);
-    li.requestsOutstanding = outstanding;
-    li.allRequestsSatisfied = outstanding <= 0;
-    li.activeRequests = (int)stats.requested;
-    return li;
-  }
-
-  /**
-   * Get the live statistics map
-   * @return a map of statistics values, defined in the {@link StatusKeys}
-   * keylist.
-   */
-  protected Map<String, Integer> getLiveStatistics() {
-    Map<String, Integer> sliderstats = new HashMap<>();
-    sliderstats.put(StatusKeys.STATISTICS_CONTAINERS_LIVE,
-        liveNodes.size());
-    sliderstats.put(StatusKeys.STATISTICS_CONTAINERS_COMPLETED,
-        completedContainerCount.intValue());
-    sliderstats.put(StatusKeys.STATISTICS_CONTAINERS_FAILED,
-        failedContainerCount.intValue());
-    sliderstats.put(StatusKeys.STATISTICS_CONTAINERS_STARTED,
-        startedContainers.intValue());
-    sliderstats.put(StatusKeys.STATISTICS_CONTAINERS_START_FAILED,
-         startFailedContainerCount.intValue());
-    sliderstats.put(StatusKeys.STATISTICS_CONTAINERS_SURPLUS,
-        surplusContainers.intValue());
-    sliderstats.put(StatusKeys.STATISTICS_CONTAINERS_UNKNOWN_COMPLETED,
-        completionOfUnknownContainerEvent.get());
-    return sliderstats;
-  }
-
-  /**
-   * Get the aggregate statistics across all roles
-   * @return role statistics
-   */
-  public RoleStatistics getRoleStatistics() {
-    RoleStatistics stats = new RoleStatistics();
-    for (RoleStatus role : getRoleStatusMap().values()) {
-      stats.add(role.getStatistics());
-    }
-    return stats;
-  }
-
-  /**
-   * Get a snapshot of component information.
-   * <p>
-   *   This does <i>not</i> include any container list, which 
-   *   is more expensive to create.
-   * @return a map of current role status values.
-   */
-  public Map<String, ComponentInformation> getComponentInfoSnapshot() {
-
-    Map<Integer, RoleStatus> statusMap = getRoleStatusMap();
-    Map<String, ComponentInformation> results = new HashMap<>(
-            statusMap.size());
-
-    for (RoleStatus status : statusMap.values()) {
-      String name = status.getName();
-      ComponentInformation info = status.serialize();
-      results.put(name, info);
-    }
-    return results;
-  }
-
-  /**
-   * Look at where the current node state is -and whether it should be changed
-   */
-  public synchronized List<AbstractRMOperation> reviewRequestAndReleaseNodes()
-      throws SliderInternalStateException, TriggerClusterTeardownException {
-    log.debug("in reviewRequestAndReleaseNodes()");
-    List<AbstractRMOperation> allOperations = new ArrayList<>();
-    for (RoleStatus roleStatus : getRoleStatusMap().values()) {
-      if (!roleStatus.isExcludeFromFlexing()) {
-        List<AbstractRMOperation> operations = reviewOneRole(roleStatus);
-        allOperations.addAll(operations);
-      }
-    }
-    return allOperations;
-  }
-
-  /**
-   * Check the "recent" failure threshold for a role
-   * @param role role to examine
-   * @throws TriggerClusterTeardownException if the role
-   * has failed too many times
-   */
-  private void checkFailureThreshold(RoleStatus role)
-      throws TriggerClusterTeardownException {
-    long failures = role.getFailedRecently();
-    int threshold = getFailureThresholdForRole(role);
-    if (log.isDebugEnabled() && failures > 0) {
-      log.debug("Failure count of component: {}: {}, threshold={}",
-          role.getName(), failures, threshold);
-    }
-
-    if (failures > threshold) {
-      throw new TriggerClusterTeardownException(
-        SliderExitCodes.EXIT_DEPLOYMENT_FAILED,
-          FinalApplicationStatus.FAILED, ErrorStrings.E_UNSTABLE_CLUSTER +
-        " - failed with component %s failed 'recently' %d times (%d in startup);" +
-        " threshold is %d - last failure: %s",
-          role.getName(),
-        role.getFailed(),
-        role.getStartFailed(),
-          threshold,
-        role.getFailureMessage());
-    }
-  }
-
-  /**
-   * Get the failure threshold for a specific role, falling back to
-   * the global one if not
-   * @param roleStatus role
-   * @return the threshold for failures
-   */
-  private int getFailureThresholdForRole(RoleStatus roleStatus) {
-    ConfTreeOperations resources =
-        instanceDefinition.getResourceOperations();
-    return resources.getComponentOptInt(roleStatus.getGroup(),
-        CONTAINER_FAILURE_THRESHOLD,
-        failureThreshold);
-  }
-
-  /**
-   * Get the node failure threshold for a specific role, falling back to
-   * the global one if not
-   * @param roleGroup role group
-   * @return the threshold for failures
-   */
-  private int getNodeFailureThresholdForRole(String roleGroup) {
-    ConfTreeOperations resources =
-        instanceDefinition.getResourceOperations();
-    return resources.getComponentOptInt(roleGroup,
-                                        NODE_FAILURE_THRESHOLD,
-                                        nodeFailureThreshold);
-  }
-
-  /**
-   * Reset the "recent" failure counts of all roles
-   */
-  public void resetFailureCounts() {
-    for (RoleStatus roleStatus : getRoleStatusMap().values()) {
-      long failed = roleStatus.resetFailedRecently();
-      log.info("Resetting failure count of {}; was {}",
-               roleStatus.getName(),
-          failed);
-    }
-    roleHistory.resetFailedRecently();
-  }
-
-  /**
-   * Escalate operation as triggered by external timer.
-   * @return a (usually empty) list of cancel/request operations.
-   */
-  public List<AbstractRMOperation> escalateOutstandingRequests() {
-    return roleHistory.escalateOutstandingRequests();
-  }
-
-  /**
-   * Cancel any outstanding AA Requests, building up the list of ops to
-   * cancel, removing them from RoleHistory structures and the RoleStatus
-   * entries.
-   * @return a (usually empty) list of cancel/request operations.
-   */
-  public synchronized List<AbstractRMOperation> cancelOutstandingAARequests() {
-    // get the list of cancel operations
-    List<AbstractRMOperation> operations = roleHistory.cancelOutstandingAARequests();
-    for (RoleStatus roleStatus : roleStatusMap.values()) {
-      if (roleStatus.isAARequestOutstanding()) {
-        log.info("Cancelling outstanding AA request for {}", roleStatus);
-        roleStatus.cancelOutstandingAARequest();
-      }
-    }
-    return operations;
-  }
-
-  /**
-   * Look at the allocation status of one role, and trigger add/release
-   * actions if the number of desired role instances doesn't equal 
-   * (actual + pending).
-   * <p>
-   * MUST be executed from within a synchronized method
-   * <p>
-   * @param role role
-   * @return a list of operations
-   * @throws SliderInternalStateException if the operation reveals that
-   * the internal state of the application is inconsistent.
-   */
-  @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
-  private List<AbstractRMOperation> reviewOneRole(RoleStatus role)
-      throws SliderInternalStateException, TriggerClusterTeardownException {
-    List<AbstractRMOperation> operations = new ArrayList<>();
-    long delta;
-    long expected;
-    String name = role.getName();
-    synchronized (role) {
-      delta = role.getDelta();
-      expected = role.getDesired();
-    }
-
-    log.info("Reviewing {} : ", role);
-    log.debug("Expected {}, Delta: {}", expected, delta);
-    checkFailureThreshold(role);
-
-    if (expected < 0 ) {
-      // negative value: fail
-      throw new TriggerClusterTeardownException(
-          SliderExitCodes.EXIT_DEPLOYMENT_FAILED,
-          FinalApplicationStatus.FAILED,
-          "Negative component count of %d desired for component %s",
-          expected, role);
-    }
-
-    if (delta > 0) {
-      // more workers needed than we have -ask for more
-      log.info("{}: Asking for {} more nodes(s) for a total of {} ", name, delta, expected);
-
-      if (role.isAntiAffinePlacement()) {
-        long pending = delta;
-        if (roleHistory.canPlaceAANodes()) {
-          // build one only if there is none outstanding, the role history knows
-          // enough about the cluster to ask, and there is somewhere to place
-          // the node
-          if (!role.isAARequestOutstanding()) {
-            // no outstanding AA; try to place things
-            AMRMClient.ContainerRequest request = createAAContainerRequest(role);
-            if (request != null) {
-              pending--;
-              log.info("Starting an anti-affine request sequence for {} nodes; pending={}",
-                delta, pending);
-              addContainerRequest(operations, request);
-            } else {
-              log.info("No location for anti-affine request");
-            }
-          }
-        } else {
-          log.warn("Awaiting node map before generating anti-affinity requests");
-        }
-        log.info("Setting pending to {}", pending);
-        role.setPendingAntiAffineRequests(pending);
-      } else {
-
-        for (int i = 0; i < delta; i++) {
-          //get the role history to select a suitable node, if available
-          addContainerRequest(operations, createContainerRequest(role));
-        }
-      }
-    } else if (delta < 0) {
-      log.info("{}: Asking for {} fewer node(s) for a total of {}", name,
-               -delta,
-               expected);
-      // reduce the number expected (i.e. subtract the delta)
-      long excess = -delta;
-
-      // how many requests are outstanding? for AA roles, this includes pending
-      long outstandingRequests = role.getRequested() + role.getPendingAntiAffineRequests();
-      if (outstandingRequests > 0) {
-        // outstanding requests.
-        int toCancel = (int)Math.min(outstandingRequests, excess);
-
-        // Delegate to Role History
-        List<AbstractRMOperation> cancellations = roleHistory.cancelRequestsForRole(role, toCancel);
-        log.info("Found {} outstanding requests to cancel", cancellations.size());
-        operations.addAll(cancellations);
-        if (toCancel != cancellations.size()) {
-          log.error("Tracking of outstanding requests is not in sync with the summary statistics:" +
-              " expected to be able to cancel {} requests, but got {}",
-              toCancel, cancellations.size());
-        }
-
-        role.cancel(toCancel);
-        excess -= toCancel;
-        assert excess >= 0 : "Attempted to cancel too many requests";
-        log.info("Submitted {} cancellations, leaving {} to release",
-            toCancel, excess);
-        if (excess == 0) {
-          log.info("After cancelling requests, application is now at desired size");
-        }
-      }
-
-      // after the cancellation there may be no excess
-      if (excess > 0) {
-
-        // there's an excess, so more to cancel
-        // get the nodes to release
-        int roleId = role.getKey();
-
-        // enum all active nodes that aren't being released
-        List<RoleInstance> containersToRelease = enumNodesWithRoleId(roleId, true);
-        if (containersToRelease.isEmpty()) {
-          log.info("No containers for component {}", roleId);
-        }
-
-        // filter out all release-in-progress nodes
-        ListIterator<RoleInstance> li = containersToRelease.listIterator();
-        while (li.hasNext()) {
-          RoleInstance next = li.next();
-          if (next.released) {
-            li.remove();
-          }
-        }
-
-        // warn if the desired state can't be reached
-        int numberAvailableForRelease = containersToRelease.size();
-        if (numberAvailableForRelease < excess) {
-          log.warn("Not enough containers to release, have {} and need {} more",
-              numberAvailableForRelease,
-              excess - numberAvailableForRelease);
-        }
-
-        // ask the release selector to sort the targets
-        containersToRelease =  containerReleaseSelector.sortCandidates(
-            roleId,
-            containersToRelease);
-
-        // crop to the excess
-        List<RoleInstance> finalCandidates = (excess < numberAvailableForRelease)
-            ? containersToRelease.subList(0, (int)excess)
-            : containersToRelease;
-
-        // then build up a release operation, logging each container as released
-        for (RoleInstance possible : finalCandidates) {
-          log.info("Targeting for release: {}", possible);
-          containerReleaseSubmitted(possible.container);
-          operations.add(new ContainerReleaseOperation(possible.getId()));
-        }
-      }
-
-    } else {
-      // actual + requested == desired
-      // there's a special case here: clear all pending AA requests
-      if (role.getPendingAntiAffineRequests() > 0) {
-        log.debug("Clearing outstanding pending AA requests");
-        role.setPendingAntiAffineRequests(0);
-      }
-    }
-
-    // there's now a list of operations to execute
-    log.debug("operations scheduled: {}; updated role: {}", operations.size(), role);
-    return operations;
-  }
-
-  /**
-   * Add a container request if the request is non-null
-   * @param operations operations to add the entry to
-   * @param containerAsk what to ask for
-   * @return true if a request was added
-   */
-  private boolean addContainerRequest(List<AbstractRMOperation> operations,
-      AMRMClient.ContainerRequest containerAsk) {
-    if (containerAsk != null) {
-      log.info("Container ask is {} and label = {}", containerAsk,
-          containerAsk.getNodeLabelExpression());
-      int askMemory = containerAsk.getCapability().getMemory();
-      if (askMemory > this.containerMaxMemory) {
-        log.warn("Memory requested: {} > max of {}", askMemory, containerMaxMemory);
-      }
-      operations.add(new ContainerRequestOperation(containerAsk));
-      return true;
-    } else {
-      return false;
-    }
-  }
-
-  /**
-   * Releases a container based on container id
-   * @param containerId
-   * @return
-   * @throws SliderInternalStateException
-   */
-  public List<AbstractRMOperation> releaseContainer(ContainerId containerId)
-      throws SliderInternalStateException {
-    List<AbstractRMOperation> operations = new ArrayList<AbstractRMOperation>();
-    List<RoleInstance> activeRoleInstances = cloneOwnedContainerList();
-    for (RoleInstance role : activeRoleInstances) {
-      if (role.container.getId().equals(containerId)) {
-        containerReleaseSubmitted(role.container);
-        operations.add(new ContainerReleaseOperation(role.getId()));
-      }
-    }
-
-    return operations;
-  }
-
-  /**
-   * Find a container running on a specific host -looking
-   * into the node ID to determine this.
-   *
-   * @param node node
-   * @param roleId role the container must be in
-   * @return a container or null if there are no containers on this host
-   * that can be released.
-   */
-  private RoleInstance findRoleInstanceOnHost(NodeInstance node, int roleId) {
-    Collection<RoleInstance> targets = cloneOwnedContainerList();
-    String hostname = node.hostname;
-    for (RoleInstance ri : targets) {
-      if (hostname.equals(RoleHistoryUtils.hostnameOf(ri.container))
-                         && ri.roleId == roleId
-        && containersBeingReleased.get(ri.getContainerId()) == null) {
-        return ri;
-      }
-    }
-    return null;
-  }
-
-  /**
-   * Release all containers.
-   * @return a list of operations to execute
-   */
-  public synchronized List<AbstractRMOperation> releaseAllContainers() {
-
-    Collection<RoleInstance> targets = cloneOwnedContainerList();
-    log.info("Releasing {} containers", targets.size());
-    List<AbstractRMOperation> operations =
-      new ArrayList<>(targets.size());
-    for (RoleInstance instance : targets) {
-      if (instance.roleId == SliderKeys.ROLE_AM_PRIORITY_INDEX) {
-        // don't worry about the AM
-        continue;
-      }
-      Container possible = instance.container;
-      ContainerId id = possible.getId();
-      if (!instance.released) {
-        String url = getLogsURLForContainer(possible);
-        log.info("Releasing container. Log: " + url);
-        try {
-          containerReleaseSubmitted(possible);
-        } catch (SliderInternalStateException e) {
-          log.warn("when releasing container {} :", possible, e);
-        }
-        operations.add(new ContainerReleaseOperation(id));
-      }
-    }
-    return operations;
-  }
-
-  /**
-   * Event handler for allocated containers: builds up the lists
-   * of assignment actions (what to run where), and possibly
-   * a list of operations to perform
-   * @param allocatedContainers the containers allocated
-   * @param assignments the assignments of roles to containers
-   * @param operations any allocation or release operations
-   */
-  public synchronized void onContainersAllocated(List<Container> allocatedContainers,
-                                    List<ContainerAssignment> assignments,
-                                    List<AbstractRMOperation> operations) {
-    assignments.clear();
-    operations.clear();
-    List<Container> ordered = roleHistory.prepareAllocationList(allocatedContainers);
-    log.debug("onContainersAllocated(): Total containers allocated = {}", ordered.size());
-    for (Container container : ordered) {
-      final NodeId nodeId = container.getNodeId();
-      String containerHostInfo = nodeId.getHost() + ":" + nodeId.getPort();
-      //get the role
-      final ContainerId cid = container.getId();
-      final RoleStatus role = lookupRoleStatus(container);
-
-      //dec requested count
-      role.decRequested();
-
-      //inc allocated count -this may need to be dropped in a moment,
-      // but us needed to update the logic below
-      final long allocated = role.incActual();
-      final long desired = role.getDesired();
-
-      final String roleName = role.getName();
-      final ContainerAllocationResults allocation =
-          roleHistory.onContainerAllocated(container, desired, allocated);
-      final ContainerAllocationOutcome outcome = allocation.outcome;
-
-      // add all requests to the operations list
-      operations.addAll(allocation.operations);
-
-      //look for condition where we get more back than we asked
-      if (allocated > desired) {
-        log.info("Discarding surplus {} container {} on {}", roleName,  cid, containerHostInfo);
-        operations.add(new ContainerReleaseOperation(cid));
-        //register as a surplus node
-        surplusNodes.add(cid);
-        surplusContainers.inc();
-        //and, as we aren't binding it to role, dec that role's actual count
-        role.decActual();
-      } else {
-
-        // Allocation being accepted -so decrement the number of outstanding requests
-        decOutstandingContainerRequests();
-
-        log.info("Assigning role {} to container" +
-                 " {}," +
-                 " on {}:{},",
-                 roleName,
-                 cid,
-                 nodeId.getHost(),
-                 nodeId.getPort());
-
-        assignments.add(new ContainerAssignment(container, role, outcome));
-        //add to the history
-        roleHistory.onContainerAssigned(container);
-        // now for AA requests, add some more
-        if (role.isAntiAffinePlacement()) {
-          role.completeOutstandingAARequest();
-          // check invariants. The new node must become unavailable.
-          NodeInstance node = roleHistory.getOrCreateNodeInstance(container);
-          if (node.canHost(role.getKey(), role.getLabelExpression())) {
-            log.error("Assigned node still declares as available {}", node.toFullString() );
-          }
-          if (role.getPendingAntiAffineRequests() > 0) {
-            // still an outstanding AA request: need to issue a new one.
-            log.info("Asking for next container for AA role {}", roleName);
-            if (!addContainerRequest(operations, createAAContainerRequest(role))) {
-              log.info("No capacity in cluster for new requests");
-            } else {
-              role.decPendingAntiAffineRequests();
-            }
-            log.debug("Current AA role status {}", role);
-          } else {
-            log.info("AA request sequence completed for role {}", role);
-          }
-        }
-
-      }
-    }
-  }
-
-  /**
-   * Get diagnostics info about containers
-   */
-  public String getContainerDiagnosticInfo() {
-    StringBuilder builder = new StringBuilder();
-    for (RoleStatus roleStatus : getRoleStatusMap().values()) {
-      builder.append(roleStatus).append('\n');
-    }
-    return builder.toString();
-  }
-
-  /**
-   * Event handler for the list of active containers on restart.
-   * Sets the info key {@link StatusKeys#INFO_CONTAINERS_AM_RESTART}
-   * to the size of the list passed down (and does not set it if none were)
-   * @param liveContainers the containers allocated
-   * @return true if a rebuild took place (even if size 0)
-   * @throws RuntimeException on problems
-   */
-  private boolean rebuildModelFromRestart(List<Container> liveContainers)
-      throws BadClusterStateException {
-    if (liveContainers == null) {
-      return false;
-    }
-    for (Container container : liveContainers) {
-      addRestartedContainer(container);
-    }
-    clusterStatus.setInfo(StatusKeys.INFO_CONTAINERS_AM_RESTART,
-                               Integer.toString(liveContainers.size()));
-    return true;
-  }
-
-  /**
-   * Add a restarted container by walking it through the create/submit/start
-   * lifecycle, so building up the internal structures
-   * @param container container that was running before the AM restarted
-   * @throws RuntimeException on problems
-   */
-  private void addRestartedContainer(Container container)
-      throws BadClusterStateException {
-    String containerHostInfo = container.getNodeId().getHost()
-                               + ":" +
-                               container.getNodeId().getPort();
-    // get the container ID
-    ContainerId cid = container.getId();
-    
-    // get the role
-    int roleId = ContainerPriority.extractRole(container);
-    RoleStatus role =
-      lookupRoleStatus(roleId);
-    // increment its count
-    role.incActual();
-    String roleName = role.getName();
-    
-

<TRUNCATED>


[10/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowScheduledExecutorService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowScheduledExecutorService.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowScheduledExecutorService.java
deleted file mode 100644
index e9f53ed..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowScheduledExecutorService.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import java.util.concurrent.ScheduledExecutorService;
-
-/**
- * Scheduled executor or subclass thereof
- * @param <E> scheduled executor service type
- */
-public class WorkflowScheduledExecutorService<E extends ScheduledExecutorService>
-    extends WorkflowExecutorService<E> {
-
-  public WorkflowScheduledExecutorService(String name) {
-    super(name);
-  }
-
-  public WorkflowScheduledExecutorService(String name,
-      E executor) {
-    super(name, executor);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowSequenceService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowSequenceService.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowSequenceService.java
deleted file mode 100644
index 97f97e8..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/WorkflowSequenceService.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.service.AbstractService;
-import org.apache.hadoop.service.Service;
-import org.apache.hadoop.service.ServiceStateChangeListener;
-import org.apache.hadoop.service.ServiceStateException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * This resembles the YARN CompositeService, except that it
- * starts one service after another
- * 
- * Workflow
- * <ol>
- *   <li>When the <code>WorkflowSequenceService</code> instance is
- *   initialized, it only initializes itself.</li>
- *   
- *   <li>When the <code>WorkflowSequenceService</code> instance is
- *   started, it initializes then starts the first of its children.
- *   If there are no children, it immediately stops.</li>
- *   
- *   <li>When the active child stops, it did not fail, and the parent has not
- *   stopped -then the next service is initialized and started. If there is no
- *   remaining child the parent service stops.</li>
- *   
- *   <li>If the active child did fail, the parent service notes the exception
- *   and stops -effectively propagating up the failure.
- *   </li>
- * </ol>
- * 
- * New service instances MAY be added to a running instance -but no guarantees
- * can be made as to whether or not they will be run.
- */
-
-public class WorkflowSequenceService extends AbstractService implements
-    ServiceParent, ServiceStateChangeListener {
-
-  private static final Logger LOG =
-    LoggerFactory.getLogger(WorkflowSequenceService.class);
-
-  /**
-   * list of services
-   */
-  private final List<Service> serviceList = new ArrayList<>();
-
-  /**
-   * The currently active service.
-   * Volatile -may change & so should be read into a 
-   * local variable before working with
-   */
-  private volatile Service activeService;
-
-  /**
-  the previous service -the last one that finished. 
-  null if one did not finish yet
-   */
-  private volatile Service previousService;
-  
-  private boolean stopIfNoChildServicesAtStartup = true;
-
-  /**
-   * Construct an instance
-   * @param name service name
-   */
-  public WorkflowSequenceService(String name) {
-    super(name);
-  }
-
-  /**
-   * Construct an instance with the default name
-   */
-  public WorkflowSequenceService() {
-    this("WorkflowSequenceService");
-  }
-
-  /**
-   * Create a service sequence with the given list of services
-   * @param name service name
-   * @param children initial sequence
-   */
-  public WorkflowSequenceService(String name, Service... children) {
-    super(name);
-    for (Service service : children) {
-      addService(service);
-    }
-  }  /**
-   * Create a service sequence with the given list of services
-   * @param name service name
-   * @param children initial sequence
-   */
-  public WorkflowSequenceService(String name, List<Service> children) {
-    super(name);
-    for (Service service : children) {
-      addService(service);
-    }
-  }
-
-  /**
-   * Get the current service -which may be null
-   * @return service running
-   */
-  public Service getActiveService() {
-    return activeService;
-  }
-
-  /**
-   * Get the previously active service
-   * @return the service last run, or null if there is none.
-   */
-  public Service getPreviousService() {
-    return previousService;
-  }
-
-  protected void setStopIfNoChildServicesAtStartup(boolean stopIfNoChildServicesAtStartup) {
-    this.stopIfNoChildServicesAtStartup = stopIfNoChildServicesAtStartup;
-  }
-
-  /**
-   * When started
-   * @throws Exception
-   */
-  @Override
-  protected void serviceStart() throws Exception {
-    if (!startNextService() && stopIfNoChildServicesAtStartup) {
-        //nothing to start -so stop
-        stop();
-    }
-  }
-
-  @Override
-  protected void serviceStop() throws Exception {
-    //stop current service.
-    //this triggers a callback that is caught and ignored
-    Service current = activeService;
-    previousService = current;
-    activeService = null;
-    if (current != null) {
-      current.stop();
-    }
-  }
-
-  /**
-   * Start the next service in the list.
-   * Return false if there are no more services to run, or this
-   * service has stopped
-   * @return true if a service was started
-   * @throws RuntimeException from any init or start failure
-   * @throws ServiceStateException if this call is made before
-   * the service is started
-   */
-  public synchronized boolean startNextService() {
-    if (isInState(STATE.STOPPED)) {
-      //downgrade to a failed
-      LOG.debug("Not starting next service -{} is stopped", this);
-      return false;
-    }
-    if (!isInState(STATE.STARTED)) {
-      //reject attempts to start a service too early
-      throw new ServiceStateException(
-        "Cannot start a child service when not started");
-    }
-    if (serviceList.isEmpty()) {
-      //nothing left to run
-      return false;
-    }
-    if (activeService != null && activeService.getFailureCause() != null) {
-      //did the last service fail? Is this caused by some premature callback?
-      LOG.debug("Not starting next service due to a failure of {}",
-          activeService);
-      return false;
-    }
-    //bear in mind that init & start can fail, which
-    //can trigger re-entrant calls into the state change listener.
-    //by setting the current service to null
-    //the start-next-service logic is skipped.
-    //now, what does that mean w.r.t exit states?
-
-    activeService = null;
-    Service head = serviceList.remove(0);
-
-    try {
-      head.init(getConfig());
-      head.registerServiceListener(this);
-      head.start();
-    } catch (RuntimeException e) {
-      noteFailure(e);
-      throw e;
-    }
-    //at this point the service must have explicitly started & not failed,
-    //else an exception would have been raised
-    activeService = head;
-    return true;
-  }
-
-  /**
-   * State change event relays service stop events to
-   * {@link #onServiceCompleted(Service)}. Subclasses can
-   * extend that with extra logic
-   * @param service the service that has changed.
-   */
-  @Override
-  public void stateChanged(Service service) {
-    // only react to the state change when it is the current service
-    // and it has entered the STOPPED state
-    if (service == activeService && service.isInState(STATE.STOPPED)) {
-      onServiceCompleted(service);
-    }
-  }
-
-  /**
-   * handler for service completion: base class starts the next service
-   * @param service service that has completed
-   */
-  protected synchronized void onServiceCompleted(Service service) {
-    LOG.info("Running service stopped: {}", service);
-    previousService = activeService;
-    
-
-    //start the next service if we are not stopped ourselves
-    if (isInState(STATE.STARTED)) {
-
-      //did the service fail? if so: propagate
-      Throwable failureCause = service.getFailureCause();
-      if (failureCause != null) {
-        Exception e = (failureCause instanceof Exception) ?
-                      (Exception) failureCause : new Exception(failureCause);
-        noteFailure(e);
-        stop();
-      }
-      
-      //start the next service
-      boolean started;
-      try {
-        started = startNextService();
-      } catch (Exception e) {
-        //something went wrong here
-        noteFailure(e);
-        started = false;
-      }
-      if (!started) {
-        //no start because list is empty
-        //stop and expect the notification to go upstream
-        stop();
-      }
-    } else {
-      //not started, so just note that the current service
-      //has gone away
-      activeService = null;
-    }
-  }
-
-  /**
-   * Add the passed {@link Service} to the list of services managed by this
-   * {@link WorkflowSequenceService}
-   * @param service the {@link Service} to be added
-   */
-  @Override
-  public synchronized void addService(Service service) {
-    Preconditions.checkArgument(service != null, "null service argument");
-    LOG.debug("Adding service {} ", service.getName());
-    synchronized (serviceList) {
-      serviceList.add(service);
-    }
-  }
-
-  /**
-   * Get an unmodifiable list of services
-   * @return a list of child services at the time of invocation -
-   * added services will not be picked up.
-   */
-  @Override //Parent
-  public synchronized List<Service> getServices() {
-    return Collections.unmodifiableList(serviceList);
-  }
-
-  @Override // Object
-  public synchronized String toString() {
-    return super.toString() + "; current service " + activeService
-           + "; queued service count=" + serviceList.size();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/workflow/package-info.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/package-info.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/package-info.java
deleted file mode 100644
index 36d059a..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/package-info.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.workflow;
-
-/**
-
-<p>
- This package contains classes which can be aggregated to build up
- complex workflows of services: sequences of operations, callbacks
- and composite services with a shared lifespan.
- </p>
-
-<h2>
- Core concepts:
-</h2>
-
-
-<p>
-The Workflow Services are set of Hadoop YARN services, all implementing
-the {@link org.apache.hadoop.service.Service} API.
-They are designed to be aggregated, to be composed to produce larger
-composite services which than perform ordered operations, notify other services
-when work has completed, and to propagate failure up the service hierarchy.
-</p>
-<p>
-Service instances may a limited lifespan, and may self-terminate when
-they consider it appropriate.</p>
-<p>
-Workflow Services that have children implement the
-{@link org.apache.slider.server.services.workflow.ServiceParent}
-class, which provides (thread-safe) access to the children -allowing new children
-to be added, and existing children to be ennumerated. The implement policies
-on how to react to the termination of children -so can sequence operations
-which terminate themselves when complete.
-</p>
-
-<p>
-Workflow Services may be subclassed to extend their behavior, or to use them
-in specific applications. Just as the standard
-{@link org.apache.hadoop.service.CompositeService}
-is often subclassed to aggregate child services, the
-{@link org.apache.slider.server.services.workflow.WorkflowCompositeService}
-can be used instead -adding the feature that failing services trigger automatic
-parent shutdown. If that is the desired operational mode of a class,
-swapping the composite service implementation may be sufficient to adopt it.
-</p>
-
-
-<h2> How do the workflow services differ from the standard YARN services? </h2>
-
- <p>
- 
- There is exactly one standard YARN service for managing children, the
- {@link org.apache.hadoop.service.CompositeService}.
- </p><p>
- The {@link org.apache.slider.server.services.workflow.WorkflowCompositeService}
- shares the same model of "child services, all inited and started together".
- Where it differs is that if any child service stops -either due to a failure
- or to an action which invokes that service's
- {@link org.apache.hadoop.service.Service#stop()} method.
- </p>
- <p>
-
-In contrast, the original <code>CompositeService</code> class starts its children
-in its{@link org.apache.hadoop.service.Service#start()}  method, but does not
-listen or react to any child service halting. As a result, changes in child 
-state are not automatically detected or propagated, other than failures in
-the actual init() and start() methods.
-</p>
-
-<p>
-If a child service runs until completed -that is it will not be stopped until
-instructed to do so, and if it is only the parent service that attempts to
-stop the child, then this difference is unimportant. 
-</p>
-<p>
-
-However, if any service that depends upon all it child services running -
-and if those child services are written so as to stop when they fail, using
-the <code>WorkflowCompositeService</code> as a base class will enable the 
-parent service to be automatically notified of a child stopping.
-
-</p>
-<p>
-The {@link org.apache.slider.server.services.workflow.WorkflowSequenceService}
-resembles the composite service in API, but its workflow is different. It
-initializes and starts its children one-by-one, only starting the second after
-the first one succeeds, the third after the second, etc. If any service in
-the sequence fails, the parent <code>WorkflowSequenceService</code> stops, 
-reporting the same exception. 
-</p>
-
-<p>
-The {@link org.apache.slider.server.services.workflow.ForkedProcessService}:
-Executes a process when started, and binds to the life of that process. When the
-process terminates, so does the service -and vice versa. This service enables
-external processes to be executed as part of a sequence of operations -or,
-using the {@link org.apache.slider.server.services.workflow.WorkflowCompositeService}
-in parallel with other services, terminating the process when the other services
-stop -and vice versa.
-</p>
-
-<p>
-The {@link org.apache.slider.server.services.workflow.WorkflowCallbackService}
-executes a {@link java.util.concurrent.Callable} callback a specified delay
-after the service is started, then potentially terminates itself.
-This is useful for callbacks when a workflow  reaches a specific point
--or simply for executing arbitrary code in the workflow.
-
- </p>
-
-
-<h2>
-Other Workflow Services
-</h2>
-
-There are some minor services that have proven useful within aggregate workflows,
-and simply in applications which are built from composite YARN services.
-
- <ul>
- <li>{@link org.apache.slider.server.services.workflow.WorkflowRpcService }:
- Maintains a reference to an RPC {@link org.apache.hadoop.ipc.Server} instance.
- When the service is started, so is the RPC server. Similarly, when the service
- is stopped, so is the RPC server instance. 
- </li>
-
- <li>{@link org.apache.slider.server.services.workflow.ClosingService}: Closes
- an instance of {@link java.io.Closeable} when the service is stopped. This
- is purely a housekeeping class.
- </li>
-
- </ul>
-
- Lower-level classes 
- <ul>
- <li>{@link org.apache.slider.server.services.workflow.ServiceTerminatingRunnable }:
- A {@link java.lang.Runnable} which runs the runnable supplied in its constructor
- then signals its owning service to stop once that runnable is completed. 
- Any exception raised in the run is stored.
- </li>
- <li>{@link org.apache.slider.server.services.workflow.WorkflowExecutorService}:
- A base class for services that wish to have a {@link java.util.concurrent.ExecutorService}
- with a lifespan mapped to that of a service. When the service is stopped, the
- {@link java.util.concurrent.ExecutorService#shutdownNow()} method is called to
- attempt to shut down all running tasks.
- </li>
- <li>{@link org.apache.slider.server.services.workflow.ServiceThreadFactory}:
- This is a simple {@link java.util.concurrent.ThreadFactory} which generates
- meaningful thread names. It can be used as a parameter to constructors of 
- {@link java.util.concurrent.ExecutorService} instances, to ensure that
- log information can tie back text to the related services</li>
- </ul>
-
-
-
- */

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/server/services/yarnregistry/YarnRegistryViewForProviders.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/yarnregistry/YarnRegistryViewForProviders.java b/slider-core/src/main/java/org/apache/slider/server/services/yarnregistry/YarnRegistryViewForProviders.java
deleted file mode 100644
index 254bf27..0000000
--- a/slider-core/src/main/java/org/apache/slider/server/services/yarnregistry/YarnRegistryViewForProviders.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.server.services.yarnregistry;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.fs.PathNotFoundException;
-import org.apache.hadoop.registry.client.api.RegistryConstants;
-import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
-import org.apache.hadoop.registry.client.api.BindFlags;
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.hadoop.registry.client.binding.RegistryUtils;
-import org.apache.hadoop.registry.client.binding.RegistryPathUtils;
-
-import org.apache.hadoop.registry.client.types.ServiceRecord;
-import org.apache.slider.common.tools.SliderUtils;
-
-import java.io.IOException;
-import java.util.List;
-
-import static org.apache.hadoop.registry.client.binding.RegistryPathUtils.join;
-
-/**
- * Registry view for providers. This tracks where the service
- * is registered, offers access to the record and other things.
- */
-public class YarnRegistryViewForProviders {
-
-  private final RegistryOperations registryOperations;
-
-  private final String user;
-
-  private final String sliderServiceClass;
-  private final String instanceName;
-  private final ApplicationAttemptId applicationAttemptId;
-  /**
-   * Record used where the service registered itself.
-   * Null until the service is registered
-   */
-  private ServiceRecord selfRegistration;
-
-  /**
-   * Path where record was registered
-   * Null until the service is registered
-   */
-  private String selfRegistrationPath;
-
-  public YarnRegistryViewForProviders(RegistryOperations registryOperations,
-      String user,
-      String sliderServiceClass,
-      String instanceName,
-      ApplicationAttemptId applicationAttemptId) {
-    Preconditions.checkArgument(registryOperations != null,
-        "null registry operations");
-    Preconditions.checkArgument(user != null, "null user");
-    Preconditions.checkArgument(SliderUtils.isSet(sliderServiceClass),
-        "unset service class");
-    Preconditions.checkArgument(SliderUtils.isSet(instanceName),
-        "instanceName");
-    Preconditions.checkArgument(applicationAttemptId != null,
-        "null applicationAttemptId");
-    this.registryOperations = registryOperations;
-    this.user = user;
-    this.sliderServiceClass = sliderServiceClass;
-    this.instanceName = instanceName;
-    this.applicationAttemptId = applicationAttemptId;
-  }
-
-  public ApplicationAttemptId getApplicationAttemptId() {
-    return applicationAttemptId;
-  }
-
-  public String getUser() {
-    return user;
-  }
-
-  public String getSliderServiceClass() {
-    return sliderServiceClass;
-  }
-
-  public String getInstanceName() {
-    return instanceName;
-  }
-
-  public RegistryOperations getRegistryOperations() {
-    return registryOperations;
-  }
-
-  public ServiceRecord getSelfRegistration() {
-    return selfRegistration;
-  }
-
-  private void setSelfRegistration(ServiceRecord selfRegistration) {
-    this.selfRegistration = selfRegistration;
-  }
-
-  /**
-   * Get the path to where the service has registered itself.
-   * Null until the service is registered
-   * @return the service registration path.
-   */
-  public String getSelfRegistrationPath() {
-    return selfRegistrationPath;
-  }
-
-  /**
-   * Get the absolute path to where the service has registered itself.
-   * This includes the base registry path
-   * Null until the service is registered
-   * @return the service registration path.
-   */
-  public String getAbsoluteSelfRegistrationPath() {
-    if (selfRegistrationPath == null) {
-      return null;
-    }
-    String root = registryOperations.getConfig().getTrimmed(
-        RegistryConstants.KEY_REGISTRY_ZK_ROOT,
-        RegistryConstants.DEFAULT_ZK_REGISTRY_ROOT);
-    return RegistryPathUtils.join(root, selfRegistrationPath);
-  }
-
-  /**
-   * Add a component under the slider name/entry
-   * @param componentName component name
-   * @param record record to put
-   * @throws IOException
-   */
-  public void putComponent(String componentName,
-      ServiceRecord record) throws
-      IOException {
-    putComponent(sliderServiceClass, instanceName,
-        componentName,
-        record);
-  }
-
-  /**
-   * Add a component 
-   * @param serviceClass service class to use under ~user
-   * @param componentName component name
-   * @param record record to put
-   * @throws IOException
-   */
-  public void putComponent(String serviceClass,
-      String serviceName,
-      String componentName,
-      ServiceRecord record) throws IOException {
-    String path = RegistryUtils.componentPath(
-        user, serviceClass, serviceName, componentName);
-    registryOperations.mknode(RegistryPathUtils.parentOf(path), true);
-    registryOperations.bind(path, record, BindFlags.OVERWRITE);
-  }
-    
-  /**
-   * Add a service under a path, optionally purging any history
-   * @param username user
-   * @param serviceClass service class to use under ~user
-   * @param serviceName name of the service
-   * @param record service record
-   * @param deleteTreeFirst perform recursive delete of the path first.
-   * @return the path the service was created at
-   * @throws IOException
-   */
-  public String putService(String username,
-      String serviceClass,
-      String serviceName,
-      ServiceRecord record,
-      boolean deleteTreeFirst) throws IOException {
-    String path = RegistryUtils.servicePath(
-        username, serviceClass, serviceName);
-    if (deleteTreeFirst) {
-      registryOperations.delete(path, true);
-    }
-    registryOperations.mknode(RegistryPathUtils.parentOf(path), true);
-    registryOperations.bind(path, record, BindFlags.OVERWRITE);
-    return path;
-  }
-
-  /**
-   * Add a service under a path for the current user
-   * @param serviceClass service class to use under ~user
-   * @param serviceName name of the service
-   * @param record service record
-   * @param deleteTreeFirst perform recursive delete of the path first
-   * @return the path the service was created at
-   * @throws IOException
-   */
-  public String putService(
-      String serviceClass,
-      String serviceName,
-      ServiceRecord record,
-      boolean deleteTreeFirst) throws IOException {
-    return putService(user, serviceClass, serviceName, record, deleteTreeFirst);
-  }
-
-
-  /**
-   * Add a service under a path for the current user
-   * @param serviceClass service class to use under ~user
-   * @param serviceName name of the service
-   * @param record service record
-   * @param deleteTreeFirst perform recursive delete of the path first
-   * @return the path the service was created at
-   * @throws IOException
-   */
-  public String registerSelf(
-      ServiceRecord record,
-      boolean deleteTreeFirst) throws IOException {
-    selfRegistrationPath =
-        putService(user, sliderServiceClass, instanceName, record, deleteTreeFirst);
-    setSelfRegistration(record);
-    return selfRegistrationPath;
-  }
-
-  /**
-   * Update the self record by pushing out the latest version of the service
-   * registration record. 
-   * @throws IOException any failure.
-   */
-  public void updateSelf() throws IOException {
-    putService(user, sliderServiceClass, instanceName, selfRegistration, false);
-  }
-    
-  /**
-   * Delete a component
-   * @param componentName component name
-   * @throws IOException
-   */
-  public void deleteComponent(String componentName) throws IOException {
-    String path = RegistryUtils.componentPath(
-        user, sliderServiceClass, instanceName,
-        componentName);
-    registryOperations.delete(path, false);
-  }
-
-  /**
-   * Delete the children of a path -but not the path itself.
-   * It is not an error if the path does not exist
-   * @param path path to delete
-   * @param recursive flag to request recursive deletes
-   * @throws IOException IO problems
-   */
-  public void deleteChildren(String path, boolean recursive) throws IOException {
-    List<String> childNames = null;
-    try {
-      childNames = registryOperations.list(path);
-    } catch (PathNotFoundException e) {
-      return;
-    }
-    for (String childName : childNames) {
-      String child = join(path, childName);
-      registryOperations.delete(child, recursive);
-    }
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/proto/SliderClusterMessages.proto
----------------------------------------------------------------------
diff --git a/slider-core/src/main/proto/SliderClusterMessages.proto b/slider-core/src/main/proto/SliderClusterMessages.proto
deleted file mode 100644
index b8bdc59..0000000
--- a/slider-core/src/main/proto/SliderClusterMessages.proto
+++ /dev/null
@@ -1,396 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-option java_package = "org.apache.slider.api.proto";
-option java_outer_classname = "Messages";
-option java_generic_services = true;
-option java_generate_equals_and_hash = true;
-package org.apache.slider.api;
-
-//import "Security.proto";
-
-/*
-  Look at SliderClusterProtocol.proto to see how to build this
-*/
-
-message RoleInstanceState {
-  required string name =        1;
-  optional string role =        2;
-  required uint32 state =       4;
-  required uint32 exitCode =    5;
-  optional string command =     6;
-  optional string diagnostics = 7;
-  repeated string output =      8;
-  repeated string environment = 9;
-  required uint32 roleId =     10;
-  required bool released =     11;
-  required int64 createTime =  12;
-  required int64 startTime =   13;
-  required string host =       14;
-  required string hostURL =    15;
-  optional string appVersion = 16;
-}
-
-/**
- * stop the cluster
- */
-message StopClusterRequestProto {
-  /**
-  message to include
-  */
-  required string message = 1;
-}
-
-/**
- * stop the cluster
- */
-message StopClusterResponseProto {
-}
-
-/**
- * upgrade the containers
- */
-message UpgradeContainersRequestProto {
-  /**
-  message to include
-  */
-  required string message =     1;
-  repeated string container =   2;
-  repeated string component =   3;
-}
-
-/**
- * upgrade the containers
- */
-message UpgradeContainersResponseProto {
-}
-
-/**
- * flex the cluster
- */
-message FlexClusterRequestProto {
-  required string clusterSpec = 1;
-}
-
-
-/**
- * flex the cluster
- */
-message FlexClusterResponseProto {
-  required bool response = 1;
-}
-
-
-/**
- * void request
- */
-message GetJSONClusterStatusRequestProto {
-}
-
-/**
- * response
- */
-message GetJSONClusterStatusResponseProto {
-  required string clusterSpec = 1;
-}
-
-/**
- * list the nodes in a role
- */
-message ListNodeUUIDsByRoleRequestProto {
-  required string role = 1;
-}
-
-/**
- * list the nodes in a role
- */
-message ListNodeUUIDsByRoleResponseProto {
-  repeated string uuid = 1 ;
-}
-
-/**
- * get a node
- */
-message GetNodeRequestProto {
-  required string uuid = 1;
-}
-
-
-/**
- * response on a node
- */
-message GetNodeResponseProto {
-   required RoleInstanceState clusterNode = 1 ;
-}
-
-/**
- * list the nodes for the UUDs
- */
-message GetClusterNodesRequestProto {
-  repeated string uuid = 1 ;
-}
-
-/**
- * list the nodes in a role
- */
-message GetClusterNodesResponseProto {
-  repeated RoleInstanceState clusterNode = 1 ;
-}
-
-/**
- * Echo
- */
-message EchoRequestProto {
-  required string text = 1;
-}
-
-/**
- * Echo reply
- */
-message EchoResponseProto {
-  required string text = 1;
-}
-
-
-/**
- * Kill a container
- */
-message KillContainerRequestProto {
-  required string id = 1;
-}
-
-/**
- * Kill reply
- */
-message KillContainerResponseProto {
-  required bool success = 1;
-}
-
-/**
- * AM suicide
- */
-message AMSuicideRequestProto {
-  required string text =      1;
-  required int32 signal =     2;
-  required int32 delay =      3;
-}
-
-/**
- * AM suicide reply. For this to be returned implies
- * a failure of the AM to kill itself
- */
-message AMSuicideResponseProto {
-
-}
-
-
-/**
- * Ask for the instance definition details
- */
-message GetInstanceDefinitionRequestProto {
-
-}
-
-/**
- * Get the definition back as three separate JSON strings
- */
-message GetInstanceDefinitionResponseProto {
-  required string internal =        1;
-  required string resources =       2;
-  required string application =     3;
-}
-
-
-  /* ************************************************************************
-  
-  REST model and operations.
-  Below here the operations and payloads designed to mimic
-  the REST API. That API is now the source of those
-  specificatations; this is simply a derivative.
-  
-  **************************************************************************/
-
-/**
- * See org.apache.slider.api.types.ApplicationLivenessInformation
- */
-message ApplicationLivenessInformationProto {
-  optional bool allRequestsSatisfied = 1;
-  optional int32 requestsOutstanding = 2;
-}
-
-/*
- * see org.apache.slider.api.types.ComponentInformation
- */
-message ComponentInformationProto {
-  optional string name =           1;
-  optional int32 priority =        2;
-  optional int32 desired =         3;
-  optional int32 actual =          4;
-  optional int32 releasing =       5;
-  optional int32 requested =       6;
-  optional int32 failed =          7;
-  optional int32 started =         8;
-  optional int32 startFailed =     9;
-  optional int32 completed =      10;
-  optional int32 totalRequested = 11;
-  optional string failureMessage =12;
-  optional int32 placementPolicy =13;
-  repeated string containers =    14;
-  optional int32 failedRecently = 15;
-  optional int32 nodeFailed =     16;
-  optional int32 preempted =      17;
-  optional int32 pendingAntiAffineRequestCount = 18;
-  optional bool isAARequestOutstanding = 19;
-}
-
-/*
- * see org.apache.slider.api.types.ContainerInformation
- */
-message ContainerInformationProto {
-  optional string containerId =   1;
-  optional string component =     2;
-  optional bool released =        3;
-  optional int32 state =          4;
-  optional int32 exitCode =       5;
-  optional string diagnostics =   6;
-  optional int64 createTime =     7;
-  optional int64 startTime =      8;
-  repeated string output =        9;
-  optional string host =         10;
-  optional string hostURL =      11;
-  optional string placement =    12;
-  optional string appVersion =   13;
-}
-
-
-/*
- * see org.apache.slider.api.types.PingInformation
- */
-message PingInformationProto {
-  optional string text = 1;
-  optional string verb = 2;
-  optional string body = 3;
-  optional int64 time =  4;
-}
-
-message NodeEntryInformationProto {
-  required int32 priority =      1;
-  required int32 requested =     2;
-  required int32 starting =      3;
-  required int32 startFailed =   4;
-  required int32 failed =        5;
-  required int32 failedRecently= 6;
-  required int32 preempted =     7;
-  required int32 live =          8;
-  required int32 releasing =     9;
-  required int64 lastUsed =     10;
-  required string name =        11;
-}
-
-message NodeInformationProto {
-  required string hostname =    1;
-  required string state =       2;
-  required string httpAddress = 3;
-  required string rackName =    4;
-  required string labels =      5;
-  required string healthReport= 6;
-  required int64 lastUpdated =  7;
-  repeated NodeEntryInformationProto entries = 8;
-}
-
-message GetModelRequestProto {
-}
-
-message GetModelDesiredRequestProto {
-}
-
-message GetModelDesiredAppconfRequestProto {
-}
-
-message GetModelDesiredResourcesRequestProto {
-}
-
-message GetModelResolvedAppconfRequestProto {
-}
-
-message GetModelResolvedResourcesRequestProto {
-}
-
-message GetModelLiveResourcesRequestProto {
-}
-
-message GetLiveContainersRequestProto {
-}
-
-message GetLiveContainersResponseProto {
-  repeated string names = 1;
-  repeated ContainerInformationProto containers = 2;
-}
-
-message GetLiveContainerRequestProto {
-  required string containerId = 1;
-}
-
-
-message GetLiveComponentsRequestProto {
-}
-
-message GetLiveComponentsResponseProto {
-
-  repeated string names = 1;
-  repeated ComponentInformationProto components = 2;
-}
-
-message GetLiveComponentRequestProto {
-  required string name = 1;
-}
-
-message GetApplicationLivenessRequestProto {
-}
-
-message EmptyPayloadProto {
-}
-
-/**
-  Generic JSON, often containing data structures serialized as a string
-*/
-message WrappedJsonProto {
-  required string json = 1;
-}
-
-message GetCertificateStoreRequestProto {
-  optional string hostname =    1;
-  required string requesterId = 2;
-  required string password =    3;
-  required string type =        4;
-}
-
-message GetCertificateStoreResponseProto {
-  required bytes store = 1;
-}
-
-message GetLiveNodesRequestProto {
-}
-
-message GetLiveNodesResponseProto {
-  repeated NodeInformationProto nodes = 1;
-}
-
-message GetLiveNodeRequestProto {
-  required string name = 1;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/proto/SliderClusterProtocol.proto
----------------------------------------------------------------------
diff --git a/slider-core/src/main/proto/SliderClusterProtocol.proto b/slider-core/src/main/proto/SliderClusterProtocol.proto
deleted file mode 100644
index 4221b1d..0000000
--- a/slider-core/src/main/proto/SliderClusterProtocol.proto
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-option java_package = "org.apache.slider.api.proto";
-option java_outer_classname = "SliderClusterAPI";
-option java_generic_services = true;
-option java_generate_equals_and_hash = true;
-package org.apache.slider.api;
-
-/*
-
-Compiling
-
-Maven: How to do it as part of the build
- mvn install -DskipTests -Pcompile-protobuf
-
-How to do it so as to get error messages
-
-protoc --java_out=src/main/java \
- -Isrc/main/proto src/main/proto/SliderClusterMessages.proto \
-  src/main/proto/SliderClusterProtocol.proto
-
-Once happy: commit the changes
-
-*/
-
-//import "Security.proto";
-import "SliderClusterMessages.proto";
-
-
-/**
- * Protocol used from between Slider Client and AM
- */
-service SliderClusterProtocolPB {
-
-  /**
-   * Stop the cluster
-   */
-
-  rpc stopCluster(StopClusterRequestProto) 
-    returns(StopClusterResponseProto);
-    
-  /**
-   * Upgrade containers 
-   */
-  rpc upgradeContainers(UpgradeContainersRequestProto) 
-    returns(UpgradeContainersResponseProto);
-
-  /**
-   * Flex the cluster. 
-   */
-  rpc flexCluster(FlexClusterRequestProto) 
-    returns(FlexClusterResponseProto);
-
-  /**
-   * Get the current cluster status
-   */
-  rpc getJSONClusterStatus(GetJSONClusterStatusRequestProto)
-    returns(GetJSONClusterStatusResponseProto);
-      
-  /**
-   * Get the instance definition
-   */
-  rpc getInstanceDefinition(GetInstanceDefinitionRequestProto)
-   returns(GetInstanceDefinitionResponseProto);
-      
-  /**
-   * List all running nodes in a role
-   */
-  rpc listNodeUUIDsByRole(ListNodeUUIDsByRoleRequestProto)
-    returns(ListNodeUUIDsByRoleResponseProto);
-
-  /**
-   * Get the details on a node
-   */
-  rpc getNode(GetNodeRequestProto)
-    returns(GetNodeResponseProto);
-
-  /**
-   * Get the 
-   * details on a list of nodes.
-   * Unknown nodes are not returned
-   * <i>Important: the order of the results are undefined</i>
-   */
-  rpc getClusterNodes(GetClusterNodesRequestProto)
-    returns(GetClusterNodesResponseProto);
-    
-   /**
-    * echo some text
-    */
-   rpc echo(EchoRequestProto)
-     returns(EchoResponseProto); 
-
-   /**
-    * kill a container
-    */
-   rpc killContainer(KillContainerRequestProto)
-     returns(KillContainerResponseProto);
-      
-   /**
-    * kill the AM
-    */
-   rpc amSuicide(AMSuicideRequestProto)
-     returns(AMSuicideResponseProto);
-
-  /* ************************************************************************
-  
-  REST model and operations.
-  Below here the operations and payloads designed to mimic
-  the REST API. That API is now the source of those
-  specificatations; this is simply a derivative.
-  
-  **************************************************************************/
-
-  rpc getLivenessInformation(GetApplicationLivenessRequestProto) 
-    returns(ApplicationLivenessInformationProto);
-
-  rpc getLiveContainers(GetLiveContainersRequestProto) 
-    returns(GetLiveContainersResponseProto);
-
-  rpc getLiveContainer(GetLiveContainerRequestProto) 
-    returns(ContainerInformationProto);
-
-  rpc getLiveComponents(GetLiveComponentsRequestProto) 
-    returns(GetLiveComponentsResponseProto);
-
-  rpc getLiveComponent(GetLiveComponentRequestProto) 
-    returns(ComponentInformationProto);
-
-  rpc getLiveNodes(GetLiveNodesRequestProto)
-    returns(GetLiveNodesResponseProto);
-
-  rpc getLiveNode(GetLiveNodeRequestProto)
-    returns(NodeInformationProto);
-  
-// AggregateConf getModelDesired()
-  rpc getModelDesired(EmptyPayloadProto) 
-    returns(WrappedJsonProto);
-
-  // ConfTree getModelDesiredAppconf
-  rpc getModelDesiredAppconf(EmptyPayloadProto) 
-    returns(WrappedJsonProto);
-
-    // ConfTree getModelDesiredResources
-  rpc getModelDesiredResources(EmptyPayloadProto) 
-    returns(WrappedJsonProto);
-  
-// AggregateConf getModelResolved()
-  rpc getModelResolved(EmptyPayloadProto) 
-    returns(WrappedJsonProto);
-
-  // ConfTree getModelResolvedAppconf
-  rpc getModelResolvedAppconf(EmptyPayloadProto) 
-    returns(WrappedJsonProto);
-
-    // ConfTree getModelResolvedResources
-  rpc getModelResolvedResources(EmptyPayloadProto) 
-    returns(WrappedJsonProto);
-
-    // ConfTree getLiveResources
-  rpc getLiveResources(EmptyPayloadProto) 
-    returns(WrappedJsonProto);
-
-  rpc getClientCertificateStore(GetCertificateStoreRequestProto)
-    returns(GetCertificateStoreResponseProto);
-
-  
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/META-INF/services/org.apache.hadoop.security.SecurityInfo
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/META-INF/services/org.apache.hadoop.security.SecurityInfo b/slider-core/src/main/resources/META-INF/services/org.apache.hadoop.security.SecurityInfo
deleted file mode 100644
index 9e67c15..0000000
--- a/slider-core/src/main/resources/META-INF/services/org.apache.hadoop.security.SecurityInfo
+++ /dev/null
@@ -1,15 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-org.apache.slider.server.appmaster.rpc.SliderRPCSecurityInfo

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/org/apache/slider/log4j.properties
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/org/apache/slider/log4j.properties b/slider-core/src/main/resources/org/apache/slider/log4j.properties
deleted file mode 100644
index 65a7ad0..0000000
--- a/slider-core/src/main/resources/org/apache/slider/log4j.properties
+++ /dev/null
@@ -1,52 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
-#  
-#       http://www.apache.org/licenses/LICENSE-2.0
-#  
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-#
-
-# This is a log4j config for slider
-
-log4j.rootLogger=INFO,stdout
-log4j.threshhold=ALL
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c{3} (%F:%M(%L)) - %m%n
-
-log4j.appender.subprocess=org.apache.log4j.ConsoleAppender
-log4j.appender.subprocess.layout=org.apache.log4j.PatternLayout
-log4j.appender.subprocess.layout.ConversionPattern=%c{1}: %m%n
-
-
-#at debug this provides details on what is going on
-log4j.logger.org.apache.slider=DEBUG
-#log4j.logger.org.apache.slider.exec.RunLongLivedApp=ERROR
-
-log4j.logger.org.apache.hadoop.security=DEBUG
-log4j.logger.org.apache.hadoop.yarn.service.launcher=DEBUG
-log4j.logger.org.apache.hadoop.yarn.service=DEBUG
-log4j.logger.org.apache.hadoop.yarn.client=DEBUG
-#crank back on some noise
-log4j.logger.org.apache.hadoop.yarn.server.nodemanager.containermanager.monitor=WARN
-log4j.logger.org.apache.hadoop.yarn.server.nodemanager.NodeStatusUpdaterImpl=WARN
-log4j.logger.org.apache.hadoop.yarn.client.RMProxy=WARN
-
-# for test runs we don't care about native code
-log4j.logger.org.apache.hadoop.util.NativeCodeLoader=ERROR
-# HDFS is noise on tets
-log4j.logger.org.apache.hadoop.hdfs.server.datanode=WARN
-log4j.logger.org.apache.hadoop.hdfs.server.namenode=WARN
-log4j.logger.org.apache.hadoop.hdfs.server.blockmanagement=WARN
-log4j.logger.org.apache.hadoop.hdfs=WARN
-
-log4j.logger.org.apache.zookeeper=WARN

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/agent.txt
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/agent.txt b/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/agent.txt
deleted file mode 100644
index 79c1972..0000000
--- a/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/agent.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- 
-This is the conf directory for the python agent
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/command.json
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/command.json b/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/command.json
deleted file mode 100644
index 197a046..0000000
--- a/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/command.json
+++ /dev/null
@@ -1,168 +0,0 @@
-{
-  "roleCommand": "START",
-  "clusterName": "c1",
-  "hostname": "c6402.ambari.apache.org",
-  "hostLevelParams": {
-    "java_home": "/usr/jdk64/jdk1.7.0_45"
-  },
-  "commandType": "EXECUTION_COMMAND",
-  "roleParams": {},
-  "serviceName": "HBASE",
-  "role": "HBASE_MASTER",
-  "commandParams": {},
-  "taskId": 24,
-  "public_hostname": "c6402.ambari.apache.org",
-  "configurations": {
-    "hbase-log4j": {
-      "log4j.threshold": "ALL",
-      "log4j.rootLogger": "${hbase.root.logger}",
-      "log4j.logger.org.apache.zookeeper": "INFO",
-      "log4j.logger.org.apache.hadoop.hbase": "DEBUG",
-      "log4j.logger.org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher": "INFO",
-      "log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil": "INFO",
-      "log4j.category.SecurityLogger": "${hbase.security.logger}",
-      "log4j.appender.console": "org.apache.log4j.ConsoleAppender",
-      "log4j.appender.console.target": "System.err",
-      "log4j.appender.console.layout": "org.apache.log4j.PatternLayout",
-      "log4j.appender.console.layout.ConversionPattern": "%d{ISO8601} %-5p [%t] %c{2}: %m%n",
-      "log4j.appender.RFAS": "org.apache.log4j.RollingFileAppender",
-      "log4j.appender.RFAS.layout": "org.apache.log4j.PatternLayout",
-      "log4j.appender.RFAS.layout.ConversionPattern": "%d{ISO8601} %p %c: %m%n",
-      "log4j.appender.RFAS.MaxFileSize": "${hbase.security.log.maxfilesize}",
-      "log4j.appender.RFAS.MaxBackupIndex": "${hbase.security.log.maxbackupindex}",
-      "log4j.appender.RFAS.File": "${hbase.log.dir}/${hbase.security.log.file}",
-      "log4j.appender.RFA": "org.apache.log4j.RollingFileAppender",
-      "log4j.appender.RFA.layout": "org.apache.log4j.PatternLayout",
-      "log4j.appender.RFA.layout.ConversionPattern": "%d{ISO8601} %-5p [%t] %c{2}: %m%n",
-      "log4j.appender.RFA.MaxFileSize": "${hbase.log.maxfilesize}",
-      "log4j.appender.RFA.MaxBackupIndex": "${hbase.log.maxbackupindex}",
-      "log4j.appender.RFA.File": "${hbase.log.dir}/${hbase.log.file}",
-      "log4j.appender.NullAppender": "org.apache.log4j.varia.NullAppender",
-      "log4j.appender.DRFA": "org.apache.log4j.DailyRollingFileAppender",
-      "log4j.appender.DRFA.layout": "org.apache.log4j.PatternLayout",
-      "log4j.appender.DRFA.layout.ConversionPattern": "%d{ISO8601} %-5p [%t] %c{2}: %m%n",
-      "log4j.appender.DRFA.File": "${hbase.log.dir}/${hbase.log.file}",
-      "log4j.appender.DRFA.DatePattern": ".yyyy-MM-dd",
-      "log4j.additivity.SecurityLogger": "false",
-      "hbase.security.logger": "INFO,console",
-      "hbase.security.log.maxfilesize": "256MB",
-      "hbase.security.log.maxbackupindex": "20",
-      "hbase.security.log.file": "SecurityAuth.audit",
-      "hbase.root.logger": "INFO,console",
-      "hbase.log.maxfilesize": "256MB",
-      "hbase.log.maxbackupindex": "20",
-      "hbase.log.file": "hbase.log",
-      "hbase.log.dir": "."
-    },
-    "global": {
-      "hbase_root": "/share/hbase/hbase-0.96.1-hadoop2",
-      "hbase_pid_dir": "/var/run/hbase",
-      "proxyuser_group": "users",
-      "syncLimit": "5",
-      "hbase_regionserver_heapsize": "1024m",
-      "rca_enabled": "false",
-      "tickTime": "2000",
-      "hbase_master_heapsize": "1024m",
-      "initLimit": "10",
-      "user_group": "hadoop",
-      "hbase_user": "hbase",
-      "hbase_log_dir": "/var/log/hbase"
-    },
-    "hdfs-site": {
-      "dfs.namenode.checkpoint.period": "21600",
-      "dfs.namenode.avoid.write.stale.datanode": "true",
-      "dfs.namenode.checkpoint.txns": "1000000",
-      "dfs.block.access.token.enable": "true",
-      "dfs.support.append": "true",
-      "dfs.datanode.address": "0.0.0.0:${ambari.dfs.datanode.port}",
-      "dfs.cluster.administrators": " hdfs",
-      "dfs.replication": "3",
-      "ambari.dfs.datanode.http.port": "50075",
-      "dfs.datanode.balance.bandwidthPerSec": "6250000",
-      "dfs.namenode.safemode.threshold-pct": "1.0f",
-      "dfs.namenode.checkpoint.edits.dir": "${dfs.namenode.checkpoint.dir}",
-      "dfs.permissions.enabled": "true",
-      "dfs.client.read.shortcircuit": "true",
-      "dfs.namenode.https-address": "c6402.ambari.apache.org:50470",
-      "dfs.journalnode.edits.dir": "/grid/0/hdfs/journal",
-      "dfs.blocksize": "134217728",
-      "dfs.datanode.max.transfer.threads": "1024",
-      "dfs.datanode.du.reserved": "1073741824",
-      "dfs.webhdfs.enabled": "true",
-      "dfs.namenode.handler.count": "100",
-      "dfs.namenode.checkpoint.dir": "/hadoop/hdfs/namesecondary",
-      "fs.permissions.umask-mode": "022",
-      "dfs.datanode.http.address": "0.0.0.0:${ambari.dfs.datanode.http.port}",
-      "dfs.datanode.ipc.address": "0.0.0.0:8010",
-      "dfs.datanode.data.dir": "/hadoop/hdfs/data",
-      "dfs.namenode.http-address": "c6402.ambari.apache.org:50070",
-      "dfs.blockreport.initialDelay": "120",
-      "dfs.datanode.failed.volumes.tolerated": "0",
-      "dfs.namenode.accesstime.precision": "0",
-      "ambari.dfs.datanode.port": "50010",
-      "dfs.namenode.avoid.read.stale.datanode": "true",
-      "dfs.namenode.secondary.http-address": "c6402.ambari.apache.org:50090",
-      "dfs.namenode.stale.datanode.interval": "30000",
-      "dfs.heartbeat.interval": "3",
-      "dfs.client.read.shortcircuit.streams.cache.size": "4096",
-      "dfs.permissions.superusergroup": "hdfs",
-      "dfs.https.port": "50470",
-      "dfs.journalnode.http-address": "0.0.0.0:8480",
-      "dfs.domain.socket.path": "/var/lib/hadoop-hdfs/dn_socket",
-      "dfs.namenode.write.stale.datanode.ratio": "1.0f",
-      "dfs.hosts.exclude": "/etc/hadoop/conf/dfs.exclude",
-      "dfs.datanode.data.dir.perm": "750",
-      "dfs.namenode.name.dir.restore": "true",
-      "dfs.replication.max": "50",
-      "dfs.namenode.name.dir": "/hadoop/hdfs/namenode"
-    },
-    "hbase-site": {
-      "hbase.hstore.flush.retries.number": "120",
-      "hbase.client.keyvalue.maxsize": "10485760",
-      "hbase.hstore.compactionThreshold": "3",
-      "hbase.rootdir": "hdfs://c6402.ambari.apache.org:8020/apps/hbase/data",
-      "hbase.stagingdir": "hdfs://c6402.ambari.apache.org:8020/apps/hbase/staging",
-      "hbase.regionserver.handler.count": "60",
-      "hbase.regionserver.global.memstore.lowerLimit": "0.38",
-      "hbase.hregion.memstore.block.multiplier": "2",
-      "hbase.hregion.memstore.flush.size": "134217728",
-      "hbase.superuser": "hbase",
-      "hbase.zookeeper.property.clientPort": "2181",
-      "hbase.regionserver.global.memstore.upperLimit": "0.4",
-      "zookeeper.session.timeout": "30000",
-      "hbase.tmp.dir": "/hadoop/hbase",
-      "hbase.hregion.max.filesize": "10737418240",
-      "hfile.block.cache.size": "0.40",
-      "hbase.security.authentication": "simple",
-      "hbase.defaults.for.version.skip": "true",
-      "hbase.zookeeper.quorum": "c6402.ambari.apache.org",
-      "zookeeper.znode.parent": "/hbase-unsecure",
-      "hbase.hstore.blockingStoreFiles": "10",
-      "hbase.hregion.majorcompaction": "86400000",
-      "hbase.security.authorization": "false",
-      "hbase.cluster.distributed": "true",
-      "hbase.hregion.memstore.mslab.enabled": "true",
-      "hbase.client.scanner.caching": "100",
-      "hbase.zookeeper.useMulti": "true",
-      "hbase.regionserver.info.port": "0",
-      "hbase.master.info.port": "60010"
-    },
-    "core-site": {
-      "io.serializations": "org.apache.hadoop.io.serializer.WritableSerialization",
-      "gluster.daemon.user": "null",
-      "fs.trash.interval": "360",
-      "hadoop.security.authentication": "simple",
-      "io.compression.codecs": "org.apache.hadoop.io.compress.GzipCodec,org.apache.hadoop.io.compress.DefaultCodec",
-      "mapreduce.jobtracker.webinterface.trusted": "false",
-      "fs.AbstractFileSystem.glusterfs.impl": "null",
-      "fs.defaultFS": "hdfs://c6402.ambari.apache.org:8020",
-      "ipc.client.connect.max.retries": "50",
-      "ipc.client.idlethreshold": "8000",
-      "io.file.buffer.size": "131072",
-      "hadoop.security.authorization": "false",
-      "hadoop.security.auth_to_local": "\n        RULE:[2:$1@$0]([rn]m@.*)s/.*/yarn/\n        RULE:[2:$1@$0](jhs@.*)s/.*/mapred/\n        RULE:[2:$1@$0]([nd]n@.*)s/.*/hdfs/\n        RULE:[2:$1@$0](hm@.*)s/.*/hbase/\n        RULE:[2:$1@$0](rs@.*)s/.*/hbase/\n        DEFAULT",
-      "ipc.client.connection.maxidletime": "30000"
-    }
-  },
-  "commandId": "2-2"
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/command_template.json
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/command_template.json b/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/command_template.json
deleted file mode 100644
index da06c13..0000000
--- a/slider-core/src/main/resources/org/apache/slider/providers/agent/conf/command_template.json
+++ /dev/null
@@ -1,168 +0,0 @@
-{
-  "roleCommand": "{{COMMAND}}",
-  "clusterName": "{{CLUSTER_NAME}}",
-  "hostname": "{{HOST_NAME}}",
-  "hostLevelParams": {
-    "java_home": "/usr/jdk64/jdk1.7.0_45"
-  },
-  "commandType": "EXECUTION_COMMAND",
-  "roleParams": {},
-  "serviceName": "{{SERVICE_NAME}}",
-  "role": "{{ROLE_NAME}}",
-  "commandParams": {},
-  "taskId": "{{TASK_ID}}",
-  "public_hostname": "{{HOST_NAME}}",
-  "configurations": {
-    "hbase-log4j": {
-      "log4j.threshold": "ALL",
-      "log4j.rootLogger": "${hbase.root.logger}",
-      "log4j.logger.org.apache.zookeeper": "INFO",
-      "log4j.logger.org.apache.hadoop.hbase": "DEBUG",
-      "log4j.logger.org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher": "INFO",
-      "log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil": "INFO",
-      "log4j.category.SecurityLogger": "${hbase.security.logger}",
-      "log4j.appender.console": "org.apache.log4j.ConsoleAppender",
-      "log4j.appender.console.target": "System.err",
-      "log4j.appender.console.layout": "org.apache.log4j.PatternLayout",
-      "log4j.appender.console.layout.ConversionPattern": "%d{ISO8601} %-5p [%t] %c{2}: %m%n",
-      "log4j.appender.RFAS": "org.apache.log4j.RollingFileAppender",
-      "log4j.appender.RFAS.layout": "org.apache.log4j.PatternLayout",
-      "log4j.appender.RFAS.layout.ConversionPattern": "%d{ISO8601} %p %c: %m%n",
-      "log4j.appender.RFAS.MaxFileSize": "${hbase.security.log.maxfilesize}",
-      "log4j.appender.RFAS.MaxBackupIndex": "${hbase.security.log.maxbackupindex}",
-      "log4j.appender.RFAS.File": "${hbase.log.dir}/${hbase.security.log.file}",
-      "log4j.appender.RFA": "org.apache.log4j.RollingFileAppender",
-      "log4j.appender.RFA.layout": "org.apache.log4j.PatternLayout",
-      "log4j.appender.RFA.layout.ConversionPattern": "%d{ISO8601} %-5p [%t] %c{2}: %m%n",
-      "log4j.appender.RFA.MaxFileSize": "${hbase.log.maxfilesize}",
-      "log4j.appender.RFA.MaxBackupIndex": "${hbase.log.maxbackupindex}",
-      "log4j.appender.RFA.File": "${hbase.log.dir}/${hbase.log.file}",
-      "log4j.appender.NullAppender": "org.apache.log4j.varia.NullAppender",
-      "log4j.appender.DRFA": "org.apache.log4j.DailyRollingFileAppender",
-      "log4j.appender.DRFA.layout": "org.apache.log4j.PatternLayout",
-      "log4j.appender.DRFA.layout.ConversionPattern": "%d{ISO8601} %-5p [%t] %c{2}: %m%n",
-      "log4j.appender.DRFA.File": "${hbase.log.dir}/${hbase.log.file}",
-      "log4j.appender.DRFA.DatePattern": ".yyyy-MM-dd",
-      "log4j.additivity.SecurityLogger": "false",
-      "hbase.security.logger": "INFO,console",
-      "hbase.security.log.maxfilesize": "256MB",
-      "hbase.security.log.maxbackupindex": "20",
-      "hbase.security.log.file": "SecurityAuth.audit",
-      "hbase.root.logger": "INFO,console",
-      "hbase.log.maxfilesize": "256MB",
-      "hbase.log.maxbackupindex": "20",
-      "hbase.log.file": "hbase.log",
-      "hbase.log.dir": "."
-    },
-    "global": {
-      "hbase_root": "{{HBASE_HOME}}",
-      "hbase_pid_dir": "{{PID_DIR}}",
-      "proxyuser_group": "users",
-      "syncLimit": "5",
-      "hbase_regionserver_heapsize": "{{REGION_SERVER_HEAP_SIZE}}",
-      "rca_enabled": "false",
-      "tickTime": "2000",
-      "hbase_master_heapsize": "{{MASTER_HEAP_SIZE}}",
-      "initLimit": "10",
-      "user_group": "{{GROUP_NAME}}",
-      "hbase_user": "{{USER_NAME}}",
-      "hbase_log_dir": "{{LOG_DIR}}"
-    },
-    "hdfs-site": {
-      "dfs.namenode.checkpoint.period": "21600",
-      "dfs.namenode.avoid.write.stale.datanode": "true",
-      "dfs.namenode.checkpoint.txns": "1000000",
-      "dfs.block.access.token.enable": "true",
-      "dfs.support.append": "true",
-      "dfs.datanode.address": "0.0.0.0:${ambari.dfs.datanode.port}",
-      "dfs.cluster.administrators": " hdfs",
-      "dfs.replication": "3",
-      "ambari.dfs.datanode.http.port": "50075",
-      "dfs.datanode.balance.bandwidthPerSec": "6250000",
-      "dfs.namenode.safemode.threshold-pct": "1.0f",
-      "dfs.namenode.checkpoint.edits.dir": "${dfs.namenode.checkpoint.dir}",
-      "dfs.permissions.enabled": "true",
-      "dfs.client.read.shortcircuit": "true",
-      "dfs.namenode.https-address": "{{NAMENODE_HTTPS_ADDRESS}}",
-      "dfs.journalnode.edits.dir": "/grid/0/hdfs/journal",
-      "dfs.blocksize": "134217728",
-      "dfs.datanode.max.transfer.threads": "1024",
-      "dfs.datanode.du.reserved": "1073741824",
-      "dfs.webhdfs.enabled": "true",
-      "dfs.namenode.handler.count": "100",
-      "dfs.namenode.checkpoint.dir": "/hadoop/hdfs/namesecondary",
-      "fs.permissions.umask-mode": "022",
-      "dfs.datanode.http.address": "0.0.0.0:${ambari.dfs.datanode.http.port}",
-      "dfs.datanode.ipc.address": "0.0.0.0:8010",
-      "dfs.datanode.data.dir": "/hadoop/hdfs/data",
-      "dfs.namenode.http-address": "{{NAMENODE_HTTP_ADDRESS}}",
-      "dfs.blockreport.initialDelay": "120",
-      "dfs.datanode.failed.volumes.tolerated": "0",
-      "dfs.namenode.accesstime.precision": "0",
-      "ambari.dfs.datanode.port": "50010",
-      "dfs.namenode.avoid.read.stale.datanode": "true",
-      "dfs.namenode.secondary.http-address": "c6402.ambari.apache.org:50090",
-      "dfs.namenode.stale.datanode.interval": "30000",
-      "dfs.heartbeat.interval": "3",
-      "dfs.client.read.shortcircuit.streams.cache.size": "4096",
-      "dfs.permissions.superusergroup": "hdfs",
-      "dfs.https.port": "50470",
-      "dfs.journalnode.http-address": "0.0.0.0:8480",
-      "dfs.domain.socket.path": "/var/lib/hadoop-hdfs/dn_socket",
-      "dfs.namenode.write.stale.datanode.ratio": "1.0f",
-      "dfs.hosts.exclude": "/etc/hadoop/conf/dfs.exclude",
-      "dfs.datanode.data.dir.perm": "750",
-      "dfs.namenode.name.dir.restore": "true",
-      "dfs.replication.max": "50",
-      "dfs.namenode.name.dir": "/hadoop/hdfs/namenode"
-    },
-    "hbase-site": {
-      "hbase.hstore.flush.retries.number": "120",
-      "hbase.client.keyvalue.maxsize": "10485760",
-      "hbase.hstore.compactionThreshold": "3",
-      "hbase.rootdir": "{{HBASE_ROOT_DIR}}",
-      "hbase.stagingdir": "{{HBASE_STAGING_DIR}}",
-      "hbase.regionserver.handler.count": "60",
-      "hbase.regionserver.global.memstore.lowerLimit": "0.38",
-      "hbase.hregion.memstore.block.multiplier": "2",
-      "hbase.hregion.memstore.flush.size": "134217728",
-      "hbase.superuser": "{{HBASE_SUPERUSER}}",
-      "hbase.zookeeper.property.clientPort": "{{ZK_CLIENT_PORT}}",
-      "hbase.regionserver.global.memstore.upperLimit": "0.4",
-      "zookeeper.session.timeout": "30000",
-      "hbase.tmp.dir": "/hadoop/hbase",
-      "hbase.hregion.max.filesize": "10737418240",
-      "hfile.block.cache.size": "0.40",
-      "hbase.security.authentication": "simple",
-      "hbase.defaults.for.version.skip": "true",
-      "hbase.zookeeper.quorum": "{{ZK_HOSTS}}",
-      "zookeeper.znode.parent": "{{ZK_NODE_PARENT}}",
-      "hbase.hstore.blockingStoreFiles": "10",
-      "hbase.hregion.majorcompaction": "86400000",
-      "hbase.security.authorization": "false",
-      "hbase.cluster.distributed": "true",
-      "hbase.hregion.memstore.mslab.enabled": "true",
-      "hbase.client.scanner.caching": "100",
-      "hbase.zookeeper.useMulti": "true",
-      "hbase.regionserver.info.port": "{{REGION_SERVER_INFO_PORT}}",
-      "hbase.master.info.port": "{{MASTER_INFO_PORT}}"
-    },
-    "core-site": {
-      "io.serializations": "org.apache.hadoop.io.serializer.WritableSerialization",
-      "gluster.daemon.user": "null",
-      "fs.trash.interval": "360",
-      "hadoop.security.authentication": "simple",
-      "io.compression.codecs": "org.apache.hadoop.io.compress.GzipCodec,org.apache.hadoop.io.compress.DefaultCodec",
-      "mapreduce.jobtracker.webinterface.trusted": "false",
-      "fs.AbstractFileSystem.glusterfs.impl": "null",
-      "fs.defaultFS": "{{DEFAULT_FS}}",
-      "ipc.client.connect.max.retries": "50",
-      "ipc.client.idlethreshold": "8000",
-      "io.file.buffer.size": "131072",
-      "hadoop.security.authorization": "false",
-      "hadoop.security.auth_to_local": "\n        RULE:[2:$1@$0]([rn]m@.*)s/.*/yarn/\n        RULE:[2:$1@$0](jhs@.*)s/.*/mapred/\n        RULE:[2:$1@$0]([nd]n@.*)s/.*/hdfs/\n        RULE:[2:$1@$0](hm@.*)s/.*/hbase/\n        RULE:[2:$1@$0](rs@.*)s/.*/hbase/\n        DEFAULT",
-      "ipc.client.connection.maxidletime": "30000"
-    }
-  },
-  "commandId": "{{COMMAND_ID}}"
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/org/apache/slider/providers/agent/role-node.xml
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/org/apache/slider/providers/agent/role-node.xml b/slider-core/src/main/resources/org/apache/slider/providers/agent/role-node.xml
deleted file mode 100644
index aff1e05..0000000
--- a/slider-core/src/main/resources/org/apache/slider/providers/agent/role-node.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you under the Apache License, Version 2.0 (the
-  ~  "License"); you may not use this file except in compliance
-  ~  with the License.  You may obtain a copy of the License at
-  ~
-  ~       http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~  Unless required by applicable law or agreed to in writing, software
-  ~  distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  -->
-
-  <!--
-  Role options for an agent-managed node
-  -->
-<configuration>
-  <property>
-    <name>role.name</name>
-    <value>node</value>
-  </property>
-  
-  <property>
-    <name>role.instances</name>
-    <value>1</value>
-  </property>
-    
-  <property>
-    <name>role.priority</name>
-    <value>1</value>
-  </property>
-      
-  <property>
-    <name>role.placement.policy</name>
-    <value>2</value>
-  </property>
-  
-  <property>
-    <name>yarn.memory</name>
-    <value>256</value>
-  </property>
-  
-  <property>
-    <name>yarn.vcores</name>
-    <value>1</value>
-  </property>
-  
-  <property>
-    <name>jvm.heapsize</name>
-    <value>256M</value>
-  </property>
-  
-  <property>
-    <name>env.MALLOC_ARENA_MAX</name>
-    <value>4</value>
-  </property>
-
-</configuration>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/org/apache/slider/providers/dynamic/application.properties
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/org/apache/slider/providers/dynamic/application.properties b/slider-core/src/main/resources/org/apache/slider/providers/dynamic/application.properties
deleted file mode 100644
index d9b42de..0000000
--- a/slider-core/src/main/resources/org/apache/slider/providers/dynamic/application.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
-#  
-#       http://www.apache.org/licenses/LICENSE-2.0
-#  
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-#
-
-# gets updated at build time
-application.name=${pom.name}
-application.version=${pom.version}
-application.build=${buildNumber}
-application.build.java.version=${java.version}
-application.build.user=${user.name}
-application.build.info=${pom.name}-${pom.version} Built against commit# ${buildNumber} on Java ${java.version} by ${user.name}
-hadoop.build.info=${hadoop.version}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/org/apache/slider/providers/slideram/instance/appconf.json
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/org/apache/slider/providers/slideram/instance/appconf.json b/slider-core/src/main/resources/org/apache/slider/providers/slideram/instance/appconf.json
deleted file mode 100644
index 81239a2..0000000
--- a/slider-core/src/main/resources/org/apache/slider/providers/slideram/instance/appconf.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
-  "schema": "http://example.org/specification/v2.0.0",
-
-  "metadata": {
-
-
-  },
-
-  "global": {
-    "env.MALLOC_ARENA_MAX": "4"
-  },
-
-  "components": {
-    "slider-appmaster" : {
-      "jvm.heapsize": "256M"
-    }
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/org/apache/slider/providers/slideram/instance/internal.json
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/org/apache/slider/providers/slideram/instance/internal.json b/slider-core/src/main/resources/org/apache/slider/providers/slideram/instance/internal.json
deleted file mode 100644
index 2367d8f..0000000
--- a/slider-core/src/main/resources/org/apache/slider/providers/slideram/instance/internal.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
-  "schema": "http://example.org/specification/v2.0.0",
-
-  "metadata": {
-  },
-
-  "global": {
-    "internal.container.failure.shortlife": "60000",
-    "internal.container.failure.threshold": "5",
-    "slider.cluster.directory.permissions": "0770",
-    "slider.data.directory.permissions": "0770"
-  },
-
-  "components": {
-
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/org/apache/slider/providers/slideram/instance/resources.json
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/org/apache/slider/providers/slideram/instance/resources.json b/slider-core/src/main/resources/org/apache/slider/providers/slideram/instance/resources.json
deleted file mode 100644
index 478ab7e..0000000
--- a/slider-core/src/main/resources/org/apache/slider/providers/slideram/instance/resources.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
-  "schema": "http://example.org/specification/v2.0.0",
-
-  "metadata": {
- 
-  },
-
-  "global": {
-  },
-
-  "components": {
-    "slider-appmaster": {
-      "yarn.component.instances": "1",
-      "yarn.vcores": "1",
-      "yarn.memory": "1024"
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/org/apache/slider/slider.xml
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/org/apache/slider/slider.xml b/slider-core/src/main/resources/org/apache/slider/slider.xml
deleted file mode 100644
index 37ac65c..0000000
--- a/slider-core/src/main/resources/org/apache/slider/slider.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you under the Apache License, Version 2.0 (the
-  ~  "License"); you may not use this file except in compliance
-  ~  with the License.  You may obtain a copy of the License at
-  ~
-  ~       http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~  Unless required by applicable law or agreed to in writing, software
-  ~  distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  -->
-
-<configuration>
-  <property>
-    <name>slider.config.loaded</name>
-    <value>true</value>
-  </property>
-  <property>
-    <name>slider.provider.agent</name>
-    <value>org.apache.slider.providers.agent.AgentProviderFactory</value>
-  </property>
-</configuration>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/slideragent/.keep
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/slideragent/.keep b/slider-core/src/main/resources/webapps/slideragent/.keep
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/slideram/.keep
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/slideram/.keep b/slider-core/src/main/resources/webapps/slideram/.keep
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/resources/webapps/static/dt-1.9.4/css/demo_page.css
----------------------------------------------------------------------
diff --git a/slider-core/src/main/resources/webapps/static/dt-1.9.4/css/demo_page.css b/slider-core/src/main/resources/webapps/static/dt-1.9.4/css/demo_page.css
deleted file mode 100644
index 51c9448..0000000
--- a/slider-core/src/main/resources/webapps/static/dt-1.9.4/css/demo_page.css
+++ /dev/null
@@ -1,93 +0,0 @@
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * General page setup
- */
-#dt_example {
-	font: 80%/1.45em "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
-	margin: 0;
-	padding: 0;
-	color: #333;
-	background-color: #fff;
-}
-
-
-#dt_example #container {
-	width: 800px;
-	margin: 30px auto;
-	padding: 0;
-}
-
-
-#dt_example #footer {
-	margin: 50px auto 0 auto;
-	padding: 0;
-}
-
-#dt_example #demo {
-	margin: 30px auto 0 auto;
-}
-
-#dt_example .demo_jui {
-	margin: 30px auto 0 auto;
-}
-
-#dt_example .big {
-	font-size: 1.3em;
-	font-weight: bold;
-	line-height: 1.6em;
-	color: #4E6CA3;
-}
-
-#dt_example .spacer {
-	height: 20px;
-	clear: both;
-}
-
-#dt_example .clear {
-	clear: both;
-}
-
-#dt_example pre {
-	padding: 15px;
-	background-color: #F5F5F5;
-	border: 1px solid #CCCCCC;
-}
-
-#dt_example h1 {
-	margin-top: 2em;
-	font-size: 1.3em;
-	font-weight: normal;
-	line-height: 1.6em;
-	color: #4E6CA3;
-	border-bottom: 1px solid #B0BED9;
-	clear: both;
-}
-
-#dt_example h2 {
-	font-size: 1.2em;
-	font-weight: normal;
-	line-height: 1.6em;
-	color: #4E6CA3;
-	clear: both;
-}
-
-#dt_example a {
-	color: #0063DC;
-	text-decoration: none;
-}
-
-#dt_example a:hover {
-	text-decoration: underline;
-}
-
-#dt_example ul {
-	color: #4E6CA3;
-}
-
-.css_right {
-	float: right;
-}
-
-.css_left {
-	float: left;
-}


[28/46] incubator-slider git commit: SLIDER-1165 Create yarn-native-services branch on Slider corresponding to the yarn-native-services branch on Hadoop

Posted by go...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/PlacementPolicyOptions.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/PlacementPolicyOptions.java b/slider-core/src/main/java/org/apache/slider/providers/PlacementPolicyOptions.java
deleted file mode 100644
index e61f944..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/PlacementPolicyOptions.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers;
-
-public enum PlacementPolicyOptions {
-
-  EXCLUDE_FROM_FLEXING,
-  NO_DATA_LOCALITY,
-  ANTI_AFFINITY_REQUIRED,
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/ProviderCompleted.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/ProviderCompleted.java b/slider-core/src/main/java/org/apache/slider/providers/ProviderCompleted.java
deleted file mode 100644
index f6ff4fd..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/ProviderCompleted.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers;
-
-/**
- * This is the callback triggered by the {@link ProviderCompletedCallable}
- * when it generates a notification
- */
-public interface ProviderCompleted {
-  
-  public void eventCallbackEvent(Object parameter);
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/ProviderCompletedCallable.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/ProviderCompletedCallable.java b/slider-core/src/main/java/org/apache/slider/providers/ProviderCompletedCallable.java
deleted file mode 100644
index 47939c9..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/ProviderCompletedCallable.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers;
-
-import java.util.concurrent.Callable;
-
-public class ProviderCompletedCallable implements Callable<Object> {
-
-  private final ProviderCompleted callback;
-  private final Object parameter;
-
-  public ProviderCompletedCallable(ProviderCompleted callback, Object parameter) {
-    this.callback = callback;
-    this.parameter = parameter;
-  }
-
-  @Override
-  public Object call() throws Exception {
-    callback.eventCallbackEvent(parameter);
-    return parameter;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/ProviderCore.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/ProviderCore.java b/slider-core/src/main/java/org/apache/slider/providers/ProviderCore.java
deleted file mode 100644
index 9767430..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/ProviderCore.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTree;
-import org.apache.slider.core.exceptions.SliderException;
-
-import java.util.List;
-public interface ProviderCore {
-
-  String getName();
-
-  List<ProviderRole> getRoles();
-
-  Configuration getConf();
-
-  /**
-   * Verify that an instance definition is considered valid by the provider
-   * @param instanceDefinition instance definition
-   * @throws SliderException if the configuration is not valid
-   */
-  void validateInstanceDefinition(AggregateConf instanceDefinition) throws
-      SliderException;
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/ProviderRole.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/ProviderRole.java b/slider-core/src/main/java/org/apache/slider/providers/ProviderRole.java
deleted file mode 100644
index 761ac0f..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/ProviderRole.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers;
-
-import org.apache.slider.api.ResourceKeys;
-
-/**
- * Provider role and key for use in app requests.
- * 
- * This class uses the role name as the key for hashes and in equality tests,
- * and ignores the other values.
- */
-public final class ProviderRole {
-  public final String name;
-  public final String group;
-  public final int id;
-  public int placementPolicy;
-  public int nodeFailureThreshold;
-  public final long placementTimeoutSeconds;
-  public final String labelExpression;
-
-  public ProviderRole(String name, int id) {
-    this(name,
-        name,
-        id,
-        PlacementPolicy.DEFAULT,
-        ResourceKeys.DEFAULT_NODE_FAILURE_THRESHOLD,
-        ResourceKeys.DEFAULT_PLACEMENT_ESCALATE_DELAY_SECONDS,
-        ResourceKeys.DEF_YARN_LABEL_EXPRESSION);
-  }
-
-  /**
-   * Create a provider role
-   * @param name role/component name
-   * @param id ID. This becomes the YARN priority
-   * @param policy placement policy
-   * @param nodeFailureThreshold threshold for node failures (within a reset interval)
-   * after which a node failure is considered an app failure
-   * @param placementTimeoutSeconds for lax placement, timeout in seconds before
-   * @param labelExpression label expression for requests; may be null
-   */
-  public ProviderRole(String name,
-      int id,
-      int policy,
-      int nodeFailureThreshold,
-      long placementTimeoutSeconds,
-      String labelExpression) {
-    this(name,
-        name,
-        id,
-        policy,
-        nodeFailureThreshold,
-        placementTimeoutSeconds,
-        labelExpression);
-  }
-
-  /**
-   * Create a provider role with a role group
-   * @param name role/component name
-   * @param group role/component group
-   * @param id ID. This becomes the YARN priority
-   * @param policy placement policy
-   * @param nodeFailureThreshold threshold for node failures (within a reset interval)
-   * after which a node failure is considered an app failure
-   * @param placementTimeoutSeconds for lax placement, timeout in seconds before
-   * @param labelExpression label expression for requests; may be null
-   */
-  public ProviderRole(String name,
-      String group,
-      int id,
-      int policy,
-      int nodeFailureThreshold,
-      long placementTimeoutSeconds,
-      String labelExpression) {
-    this.name = name;
-    if (group == null) {
-      this.group = name;
-    } else {
-      this.group = group;
-    }
-    this.id = id;
-    this.placementPolicy = policy;
-    this.nodeFailureThreshold = nodeFailureThreshold;
-    this.placementTimeoutSeconds = placementTimeoutSeconds;
-    this.labelExpression = labelExpression;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    ProviderRole that = (ProviderRole) o;
-    return name.equals(that.name);
-  }
-
-  @Override
-  public int hashCode() {
-    return name.hashCode();
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb = new StringBuilder("ProviderRole{");
-    sb.append("name='").append(name).append('\'');
-    sb.append(", group=").append(group);
-    sb.append(", id=").append(id);
-    sb.append(", placementPolicy=").append(placementPolicy);
-    sb.append(", nodeFailureThreshold=").append(nodeFailureThreshold);
-    sb.append(", placementTimeoutSeconds=").append(placementTimeoutSeconds);
-    sb.append(", labelExpression='").append(labelExpression).append('\'');
-    sb.append('}');
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/ProviderService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/ProviderService.java b/slider-core/src/main/java/org/apache/slider/providers/ProviderService.java
deleted file mode 100644
index 3f24665..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/ProviderService.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.service.Service;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.registry.client.types.ServiceRecord;
-import org.apache.slider.api.ClusterDescription;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.launch.ContainerLauncher;
-import org.apache.slider.core.main.ExitCodeProvider;
-import org.apache.slider.server.appmaster.actions.QueueAccess;
-import org.apache.slider.server.appmaster.operations.RMOperationHandlerActions;
-import org.apache.slider.server.appmaster.state.ContainerReleaseSelector;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-import org.apache.slider.server.appmaster.web.rest.agent.AgentRestOperations;
-import org.apache.slider.server.services.yarnregistry.YarnRegistryViewForProviders;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-
-public interface ProviderService extends ProviderCore,
-    Service,
-    RMOperationHandlerActions,
-    ExitCodeProvider {
-
-  /**
-   * Set up the entire container launch context
-   * @param containerLauncher
-   * @param instanceDefinition
-   * @param container
-   * @param providerRole
-   * @param sliderFileSystem
-   * @param generatedConfPath
-   * @param appComponent
-   * @param containerTmpDirPath
-   */
-  void buildContainerLaunchContext(ContainerLauncher containerLauncher,
-      AggregateConf instanceDefinition,
-      Container container,
-      ProviderRole providerRole,
-      SliderFileSystem sliderFileSystem,
-      Path generatedConfPath,
-      MapOperations resourceComponent,
-      MapOperations appComponent,
-      Path containerTmpDirPath) throws
-      IOException,
-      SliderException;
-
-  /**
-   * Notify the providers of container completion
-   * @param containerId container that has completed
-   */
-  void notifyContainerCompleted(ContainerId containerId);
-
-  /**
-   * Execute a process in the AM
-   * @param instanceDefinition cluster description
-   * @param confDir configuration directory
-   * @param env environment
-   * @param execInProgress the callback for the exec events
-   * @return true if a process was actually started
-   * @throws IOException
-   * @throws SliderException
-   */
-  boolean exec(AggregateConf instanceDefinition,
-               File confDir,
-               Map<String, String> env,
-               ProviderCompleted execInProgress) throws IOException,
-      SliderException;
-
-  /**
-   * Scan through the roles and see if it is supported.
-   * @param role role to look for
-   * @return true if the role is known about -and therefore
-   * that a launcher thread can be deployed to launch it
-   */
-  boolean isSupportedRole(String role);
-
-  /**
-   * Load a specific XML configuration file for the provider config
-   * @param confDir configuration directory
-   * @return a configuration to be included in status
-   * @throws BadCommandArgumentsException
-   * @throws IOException
-   */
-  Configuration loadProviderConfigurationInformation(File confDir)
-    throws BadCommandArgumentsException, IOException;
-
-  /**
-   * The application configuration should be initialized here
-   * 
-   * @param instanceDefinition
-   * @param fileSystem
-   * @param roleGroup
-   * @throws IOException
-   * @throws SliderException
-   */
-  void initializeApplicationConfiguration(AggregateConf instanceDefinition,
-      SliderFileSystem fileSystem, String roleGroup) throws IOException,
-      SliderException;
-
-  /**
-   * This is a validation of the application configuration on the AM.
-   * Here is where things like the existence of keytabs and other
-   * not-seen-client-side properties can be tested, before
-   * the actual process is spawned. 
-   * @param instanceDefinition clusterSpecification
-   * @param confDir configuration directory
-   * @param secure flag to indicate that secure mode checks must exist
-   * @throws IOException IO problemsn
-   * @throws SliderException any failure
-   */
-  void validateApplicationConfiguration(AggregateConf instanceDefinition,
-                                        File confDir,
-                                        boolean secure
-                                       ) throws IOException, SliderException;
-
-  /*
-     * Build the provider status, can be empty
-     * @return the provider status - map of entries to add to the info section
-     */
-  Map<String, String> buildProviderStatus();
-  
-  /**
-   * Build a map of data intended for the AM webapp that is specific
-   * about this provider. The key is some text to be displayed, and the
-   * value can be a URL that will create an anchor over the key text.
-   * 
-   * If no anchor is needed/desired, insert the key with a null value.
-   * @return the details
-   */
-  Map<String, MonitorDetail> buildMonitorDetails(ClusterDescription clusterSpec);
-
-  /**
-   * Get a human friendly name for web UIs and messages
-   * @return a name string. Default is simply the service instance name.
-   */
-  String getHumanName();
-
-  public void bind(StateAccessForProviders stateAccessor,
-      QueueAccess queueAccess,
-      List<Container> liveContainers);
-
-  /**
-   * Bind to the YARN registry
-   * @param yarnRegistry YARN registry
-   */
-  void bindToYarnRegistry(YarnRegistryViewForProviders yarnRegistry);
-
-  /**
-   * Returns the agent rest operations interface.
-   * @return  the interface if available, null otherwise.
-   */
-  AgentRestOperations getAgentRestOperations();
-
-  /**
-   * Build up the endpoint details for this service
-   * @param details
-   */
-  void buildEndpointDetails(Map<String, MonitorDetail> details);
-
-  /**
-   * Prior to going live -register the initial service registry data
-   * @param amWebURI URL to the AM. This may be proxied, so use relative paths
-   * @param agentOpsURI URI for agent operations. This will not be proxied
-   * @param agentStatusURI URI For agent status. Again: no proxy
-   * @param serviceRecord service record to build up
-   */
-  void applyInitialRegistryDefinitions(URL amWebURI,
-      URL agentOpsURI,
-      URL agentStatusURI,
-      ServiceRecord serviceRecord)
-      throws IOException;
-
-  /**
-   * Create the container release selector for this provider...any policy
-   * can be implemented
-   * @return the selector to use for choosing containers.
-   */
-  ContainerReleaseSelector createContainerReleaseSelector();
-
-  /**
-   * On AM restart (for whatever reason) this API is required to rebuild the AM
-   * internal state with the containers which were already assigned and running
-   * 
-   * @param liveContainers
-   * @param applicationId
-   * @param providerRoles
-   */
-  void rebuildContainerDetails(List<Container> liveContainers,
-      String applicationId, Map<Integer, ProviderRole> providerRoles);
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/ProviderUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/ProviderUtils.java b/slider-core/src/main/java/org/apache/slider/providers/ProviderUtils.java
deleted file mode 100644
index 07d106b..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/ProviderUtils.java
+++ /dev/null
@@ -1,530 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers;
-
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.yarn.api.ApplicationConstants;
-import org.apache.hadoop.yarn.api.records.LocalResource;
-import org.apache.slider.api.ClusterDescription;
-import org.apache.slider.api.InternalKeys;
-import org.apache.slider.api.OptionKeys;
-import org.apache.slider.api.ResourceKeys;
-import org.apache.slider.api.RoleKeys;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.exceptions.SliderInternalStateException;
-import org.slf4j.Logger;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Pattern;
-
-/**
- * this is a factoring out of methods handy for providers. It's bonded to a log at
- * construction time
- */
-public class ProviderUtils implements RoleKeys {
-
-  protected final Logger log;
-
-  /**
-   * Create an instace
-   * @param log log directory to use -usually the provider
-   */
-  
-  public ProviderUtils(Logger log) {
-    this.log = log;
-  }
-
-  /**
-   * Add oneself to the classpath. This does not work
-   * on minicluster test runs where the JAR is not built up
-   * @param providerResources map of provider resources to add these entries to
-   * @param provider provider to add
-   * @param jarName name of the jar to use
-   * @param sliderFileSystem target filesystem
-   * @param tempPath path in the cluster FS for temp files
-   * @param libdir relative directory to place resources
-   * @param miniClusterTestRun
-   * @return true if the class was found in a JAR
-   * 
-   * @throws FileNotFoundException if the JAR was not found and this is NOT
-   * a mini cluster test run
-   * @throws IOException IO problems
-   * @throws SliderException any Slider problem
-   */
-  public static boolean addProviderJar(Map<String, LocalResource> providerResources,
-      Object provider,
-      String jarName,
-      SliderFileSystem sliderFileSystem,
-      Path tempPath,
-      String libdir,
-      boolean miniClusterTestRun) throws
-      IOException,
-      SliderException {
-    try {
-      SliderUtils.putJar(providerResources,
-          sliderFileSystem,
-          provider.getClass(),
-          tempPath,
-          libdir,
-          jarName);
-      return true;
-    } catch (FileNotFoundException e) {
-      if (miniClusterTestRun) {
-        return false;
-      } else {
-        throw e;
-      }
-    }
-  }
-
-  /**
-   * Add/overwrite the agent tarball (overwritten every time application is restarted)
-   * @param provider
-   * @param tarName
-   * @param sliderFileSystem
-   * @param agentDir
-   * @return true the location could be determined and the file added
-   * @throws IOException
-   */
-  public static boolean addAgentTar(Object provider,
-                                    String tarName,
-                                    SliderFileSystem sliderFileSystem,
-                                    Path agentDir) throws
-  IOException {
-    File localFile = SliderUtils.findContainingJar(provider.getClass());
-    if(localFile != null) {
-      String parentDir = localFile.getParent();
-      Path agentTarPath = new Path(parentDir, tarName);
-      sliderFileSystem.getFileSystem().copyFromLocalFile(false, true, agentTarPath, agentDir);
-      return true;
-    }
-    return false;
-  }
-  
-  /**
-   * Add a set of dependencies to the provider resources being built up,
-   * by copying them from the local classpath to the remote one, then
-   * registering them
-   * @param providerResources map of provider resources to add these entries to
-   * @param sliderFileSystem target filesystem
-   * @param tempPath path in the cluster FS for temp files
-   * @param libdir relative directory to place resources
-   * @param resources list of resource names (e.g. "hbase.jar"
-   * @param classes list of classes where classes[i] refers to a class in
-   * resources[i]
-   * @throws IOException IO problems
-   * @throws SliderException any Slider problem
-   */
-  public static void addDependencyJars(Map<String, LocalResource> providerResources,
-                                       SliderFileSystem sliderFileSystem,
-                                       Path tempPath,
-                                       String libdir,
-                                       String[] resources,
-                                       Class[] classes
-                                      ) throws
-                                        IOException,
-      SliderException {
-    if (resources.length != classes.length) {
-      throw new SliderInternalStateException(
-        "mismatch in Jar names [%d] and classes [%d]",
-        resources.length,
-        classes.length);
-    }
-    int size = resources.length;
-    for (int i = 0; i < size; i++) {
-      String jarName = resources[i];
-      Class clazz = classes[i];
-      SliderUtils.putJar(providerResources,
-          sliderFileSystem,
-          clazz,
-          tempPath,
-          libdir,
-          jarName);
-    }
-    
-  }
-
-  /**
-   * Loads all dependency jars from the default path
-   * @param providerResources map of provider resources to add these entries to
-   * @param sliderFileSystem target filesystem
-   * @param tempPath path in the cluster FS for temp files
-   * @param libDir relative directory to place resources
-   * @param libLocalSrcDir explicitly supplied local libs dir
-   * @throws IOException
-   * @throws SliderException
-   */
-  public static void addAllDependencyJars(Map<String, LocalResource> providerResources,
-                                          SliderFileSystem sliderFileSystem,
-                                          Path tempPath,
-                                          String libDir,
-                                          String libLocalSrcDir)
-      throws IOException, SliderException {
-    String libSrcToUse = libLocalSrcDir;
-    if (SliderUtils.isSet(libLocalSrcDir)) {
-      File file = new File(libLocalSrcDir);
-      if (!file.exists() || !file.isDirectory()) {
-        throw new BadCommandArgumentsException("Supplied lib src dir %s is not valid", libLocalSrcDir);
-      }
-    }
-    SliderUtils.putAllJars(providerResources, sliderFileSystem, tempPath, libDir, libSrcToUse);
-  }
-
-  /**
-   * build the log directory
-   * @return the log dir
-   */
-  public String getLogdir() throws IOException {
-    String logdir = System.getenv("LOGDIR");
-    if (logdir == null) {
-      logdir =
-        SliderKeys.TMP_LOGDIR_PREFIX + UserGroupInformation.getCurrentUser().getShortUserName();
-    }
-    return logdir;
-  }
-
-
-  public void validateNodeCount(AggregateConf instanceDescription,
-                                String name, int min, int max) throws
-                                                               BadCommandArgumentsException {
-    MapOperations component =
-      instanceDescription.getResourceOperations().getComponent(name);
-    int count;
-    if (component == null) {
-      count = 0;
-    } else {
-      count = component.getOptionInt(ResourceKeys.COMPONENT_INSTANCES, 0);
-    }
-    validateNodeCount(name, count, min, max);
-  }
-  
-  /**
-   * Validate the node count and heap size values of a node class 
-   * <p>
-   * If max &lt;= 0:  min &lt;= count
-   * If max &gt; 0:  min &lt;= count &lt;= max
-   * @param name node class name
-   * @param count requested node count
-   * @param min requested heap size
-   * @param max maximum value. 
-   * @throws BadCommandArgumentsException if the values are out of range
-   */
-  public void validateNodeCount(String name,
-                                int count,
-                                int min,
-                                int max) throws BadCommandArgumentsException {
-    if (count < min) {
-      throw new BadCommandArgumentsException(
-        "requested no of %s nodes: %d is below the minimum of %d", name, count,
-        min);
-    }
-    if (max > 0 && count > max) {
-      throw new BadCommandArgumentsException(
-        "requested no of %s nodes: %d is above the maximum of %d", name, count,
-        max);
-    }
-  }
-
-  /**
-   * copy all options beginning site. into the site.xml
-   * @param clusterSpec cluster specification
-   * @param sitexml map for XML file to build up
-   */
-  public void propagateSiteOptions(ClusterDescription clusterSpec,
-                                    Map<String, String> sitexml) {
-    Map<String, String> options = clusterSpec.options;
-    propagateSiteOptions(options, sitexml);
-  }
-
-  public void propagateSiteOptions(Map<String, String> options,
-                                   Map<String, String> sitexml) {
-    propagateSiteOptions(options, sitexml, "");
-  }
-
-  public void propagateSiteOptions(Map<String, String> options,
-                                   Map<String, String> sitexml,
-                                   String configName) {
-    propagateSiteOptions(options, sitexml, configName, null);
-  }
-
-  public void propagateSiteOptions(Map<String, String> options,
-                                   Map<String, String> sitexml,
-                                   String configName,
-                                   Map<String,String> tokenMap) {
-    String prefix = OptionKeys.SITE_XML_PREFIX +
-                    (!configName.isEmpty() ? configName + "." : "");
-    for (Map.Entry<String, String> entry : options.entrySet()) {
-      String key = entry.getKey();
-      if (key.startsWith(prefix)) {
-        String envName = key.substring(prefix.length());
-        if (!envName.isEmpty()) {
-          String value = entry.getValue();
-          if (tokenMap != null) {
-            for (Map.Entry<String,String> token : tokenMap.entrySet()) {
-              value = value.replaceAll(Pattern.quote(token.getKey()),
-                                       token.getValue());
-            }
-          }
-          sitexml.put(envName, value);
-        }
-      }
-    }
-  }
-
-  /**
-   * Propagate an option from the cluster specification option map
-   * to the site XML map, using the site key for the name
-   * @param global global config spec
-   * @param optionKey key in the option map
-   * @param sitexml  map for XML file to build up
-   * @param siteKey key to assign the value to in the site XML
-   * @throws BadConfigException if the option is missing from the cluster spec
-   */
-  public void propagateOption(MapOperations global,
-                              String optionKey,
-                              Map<String, String> sitexml,
-                              String siteKey) throws BadConfigException {
-    sitexml.put(siteKey, global.getMandatoryOption(optionKey));
-  }
-
-
-  /**
-   * Build the image dir. This path is relative and only valid at the far end
-   * @param instanceDefinition instance definition
-   * @param bindir bin subdir
-   * @param script script in bin subdir
-   * @return the path to the script
-   * @throws FileNotFoundException if a file is not found, or it is not a directory* 
-   */
-  public String buildPathToHomeDir(AggregateConf instanceDefinition,
-                                  String bindir,
-                                  String script) throws
-                                                 FileNotFoundException,
-                                                 BadConfigException {
-    MapOperations globalOptions =
-      instanceDefinition.getInternalOperations().getGlobalOptions();
-    String applicationHome =
-      globalOptions.get(InternalKeys.INTERNAL_APPLICATION_HOME);
-    String imagePath =
-      globalOptions.get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH);
-    return buildPathToHomeDir(imagePath, applicationHome, bindir, script);
-  }
-
-  public String buildPathToHomeDir(String imagePath,
-                                   String applicationHome,
-                                   String bindir, String script) throws
-                                                                 FileNotFoundException {
-    String path;
-    File scriptFile;
-    if (imagePath != null) {
-      File tarball = new File(SliderKeys.LOCAL_TARBALL_INSTALL_SUBDIR);
-      scriptFile = findBinScriptInExpandedArchive(tarball, bindir, script);
-      // now work back from the script to build the relative path
-      // to the binary which will be valid remote or local
-      StringBuilder builder = new StringBuilder();
-      builder.append(SliderKeys.LOCAL_TARBALL_INSTALL_SUBDIR);
-      builder.append("/");
-      //for the script, we want the name of ../..
-      File archive = scriptFile.getParentFile().getParentFile();
-      builder.append(archive.getName());
-      path = builder.toString();
-
-    } else {
-      // using a home directory which is required to be present on 
-      // the local system -so will be absolute and resolvable
-      File homedir = new File(applicationHome);
-      path = homedir.getAbsolutePath();
-
-      //this is absolute, resolve its entire path
-      SliderUtils.verifyIsDir(homedir, log);
-      File bin = new File(homedir, bindir);
-      SliderUtils.verifyIsDir(bin, log);
-      scriptFile = new File(bin, script);
-      SliderUtils.verifyFileExists(scriptFile, log);
-    }
-    return path;
-  }
-
-  
-  /**
-   * Build the image dir. This path is relative and only valid at the far end
-   * @param instance instance options
-   * @param bindir bin subdir
-   * @param script script in bin subdir
-   * @return the path to the script
-   * @throws FileNotFoundException if a file is not found, or it is not a directory* 
-   */
-  public String buildPathToScript(AggregateConf instance,
-                                String bindir,
-                                String script) throws FileNotFoundException {
-    return buildPathToScript(instance.getInternalOperations(), bindir, script);
-  }
-  /**
-   * Build the image dir. This path is relative and only valid at the far end
-   * @param internal internal options
-   * @param bindir bin subdir
-   * @param script script in bin subdir
-   * @return the path to the script
-   * @throws FileNotFoundException if a file is not found, or it is not a directory* 
-   */
-  public String buildPathToScript(ConfTreeOperations internal,
-                                String bindir,
-                                String script) throws FileNotFoundException {
-    
-    String homedir = buildPathToHomeDir(
-      internal.get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH),
-      internal.get(InternalKeys.INTERNAL_APPLICATION_HOME),
-      bindir,
-      script);
-    return buildScriptPath(bindir, script, homedir);
-  }
-  
-  
-
-  public String buildScriptPath(String bindir, String script, String homedir) {
-    StringBuilder builder = new StringBuilder(homedir);
-    builder.append("/");
-    builder.append(bindir);
-    builder.append("/");
-    builder.append(script);
-    return builder.toString();
-  }
-
-
-  public static String convertToAppRelativePath(File file) {
-    return convertToAppRelativePath(file.getPath());
-  }
-
-  public static String convertToAppRelativePath(String path) {
-    return ApplicationConstants.Environment.PWD.$() + "/" + path;
-  }
-
-
-  public static void validatePathReferencesLocalDir(String meaning, String path)
-      throws BadConfigException {
-    File file = new File(path);
-    if (!file.exists()) {
-      throw new BadConfigException("%s directory %s not found", meaning, file);
-    }
-    if (!file.isDirectory()) {
-      throw new BadConfigException("%s is not a directory: %s", meaning, file);
-    }
-  }
-
-  /**
-   * get the user name
-   * @return the user name
-   */
-  public String getUserName() throws IOException {
-    return UserGroupInformation.getCurrentUser().getShortUserName();
-  }
-
-  /**
-   * Find a script in an expanded archive
-   * @param base base directory
-   * @param bindir bin subdir
-   * @param script script in bin subdir
-   * @return the path to the script
-   * @throws FileNotFoundException if a file is not found, or it is not a directory
-   */
-  public File findBinScriptInExpandedArchive(File base,
-                                             String bindir,
-                                             String script)
-      throws FileNotFoundException {
-    
-    SliderUtils.verifyIsDir(base, log);
-    File[] ls = base.listFiles();
-    if (ls == null) {
-      //here for the IDE to be happy, as the previous check will pick this case
-      throw new FileNotFoundException("Failed to list directory " + base);
-    }
-
-    log.debug("Found {} entries in {}", ls.length, base);
-    List<File> directories = new LinkedList<File>();
-    StringBuilder dirs = new StringBuilder();
-    for (File file : ls) {
-      log.debug("{}", false);
-      if (file.isDirectory()) {
-        directories.add(file);
-        dirs.append(file.getPath()).append(" ");
-      }
-    }
-    if (directories.size() > 1) {
-      throw new FileNotFoundException(
-        "Too many directories in archive to identify binary: " + dirs);
-    }
-    if (directories.isEmpty()) {
-      throw new FileNotFoundException(
-        "No directory found in archive " + base);
-    }
-    File archive = directories.get(0);
-    File bin = new File(archive, bindir);
-    SliderUtils.verifyIsDir(bin, log);
-    File scriptFile = new File(bin, script);
-    SliderUtils.verifyFileExists(scriptFile, log);
-    return scriptFile;
-  }
-
-  /**
-   * Return any additional arguments (argv) to provide when starting this role
-   * 
-   * @param roleOptions
-   *          The options for this role
-   * @return A non-null String which contains command line arguments for this role, or the empty string.
-   */
-  public static String getAdditionalArgs(Map<String,String> roleOptions) {
-    if (roleOptions.containsKey(RoleKeys.ROLE_ADDITIONAL_ARGS)) {
-      String additionalArgs = roleOptions.get(RoleKeys.ROLE_ADDITIONAL_ARGS);
-      if (null != additionalArgs) {
-        return additionalArgs;
-      }
-    }
-
-    return "";
-  }
-  
-  public int getRoleResourceRequirement(String val,
-                                        int defVal,
-                                        int maxVal) {
-    if (val==null) {
-      val = Integer.toString(defVal);
-    }
-    Integer intVal;
-    if (ResourceKeys.YARN_RESOURCE_MAX.equals(val)) {
-      intVal = maxVal;
-    } else {
-      intVal = Integer.decode(val);
-    }
-    return intVal;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/SliderProviderFactory.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/SliderProviderFactory.java b/slider-core/src/main/java/org/apache/slider/providers/SliderProviderFactory.java
deleted file mode 100644
index 5dd4a32..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/SliderProviderFactory.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.conf.Configured;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.SliderXmlConfKeys;
-import org.apache.slider.core.exceptions.BadClusterStateException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.providers.agent.AgentKeys;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Base class for factories
- */
-public abstract class SliderProviderFactory extends Configured {
-
-  public static final String DEFAULT_CLUSTER_TYPE = AgentKeys.PROVIDER_AGENT;
-  
-  protected static final Logger log =
-    LoggerFactory.getLogger(SliderProviderFactory.class);
-  public static final String PROVIDER_NOT_FOUND =
-    "Unable to find provider of application type %s";
-
-  public SliderProviderFactory(Configuration conf) {
-    super(conf);
-  }
-
-  protected SliderProviderFactory() {
-  }
-
-  public abstract AbstractClientProvider createClientProvider();
-
-  public abstract ProviderService createServerProvider();
-
-  /**
-   * Create a provider for a specific application
-   * @param application app
-   * @return app instance
-   * @throws SliderException on any instantiation problem
-   */
-  public static SliderProviderFactory createSliderProviderFactory(String application) throws
-      SliderException {
-    Configuration conf = loadSliderConfiguration();
-    if (application == null) {
-      application = DEFAULT_CLUSTER_TYPE;
-    }
-    String providerKey =
-      String.format(SliderXmlConfKeys.KEY_PROVIDER, application);
-    if (application.contains(".")) {
-      log.debug("Treating {} as a classname", application);
-      String name = "classname.key";
-      conf.set(name, application);
-      providerKey = name;
-    }
-    
-    Class<? extends SliderProviderFactory> providerClass;
-    try {
-      providerClass = conf.getClass(providerKey, null, SliderProviderFactory.class);
-    } catch (RuntimeException e) {
-      throw new BadClusterStateException(e, "Failed to load provider %s: %s", application, e);
-    }
-    if (providerClass == null) {
-      throw new BadClusterStateException(PROVIDER_NOT_FOUND, application);
-    }
-
-    Exception ex;
-    try {
-      SliderProviderFactory providerFactory = providerClass.newInstance();
-      providerFactory.setConf(conf);
-      return providerFactory;
-    } catch (Exception e) {
-      ex = e;
-    }
-    //by here the operation failed and ex is set to the value 
-    throw new BadClusterStateException(ex,
-                              "Failed to create an instance of %s : %s",
-                              providerClass,
-                              ex);
-  }
-
-  /**
-   * Load a configuration with the {@link SliderKeys#SLIDER_XML} resource
-   * included
-   * @return a configuration instance
-   */
-  public static Configuration loadSliderConfiguration() {
-    Configuration conf = new Configuration();
-    conf.addResource(SliderKeys.SLIDER_XML);
-    return conf;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/AgentClientProvider.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentClientProvider.java b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentClientProvider.java
deleted file mode 100644
index 8203cf0..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentClientProvider.java
+++ /dev/null
@@ -1,706 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers.agent;
-
-import com.google.common.io.Files;
-import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
-import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
-import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.exception.ExceptionUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.io.IOUtils;
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.hadoop.registry.client.binding.RegistryUtils;
-import org.apache.slider.api.InternalKeys;
-import org.apache.slider.api.ResourceKeys;
-import org.apache.slider.client.ClientUtils;
-import org.apache.slider.common.SliderKeys;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.conf.AggregateConf;
-import org.apache.slider.core.conf.ConfTreeOperations;
-import org.apache.slider.core.conf.MapOperations;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.launch.AbstractLauncher;
-import org.apache.slider.core.registry.docstore.PublishedConfiguration;
-import org.apache.slider.providers.AbstractClientProvider;
-import org.apache.slider.providers.ProviderRole;
-import org.apache.slider.providers.ProviderUtils;
-import org.apache.slider.providers.agent.application.metadata.Application;
-import org.apache.slider.providers.agent.application.metadata.Component;
-import org.apache.slider.providers.agent.application.metadata.ConfigFile;
-import org.apache.slider.providers.agent.application.metadata.Metainfo;
-import org.apache.slider.providers.agent.application.metadata.MetainfoParser;
-import org.apache.slider.providers.agent.application.metadata.OSPackage;
-import org.apache.slider.providers.agent.application.metadata.OSSpecific;
-import org.apache.slider.providers.agent.application.metadata.Package;
-import org.codehaus.jettison.json.JSONException;
-import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.nio.charset.Charset;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-/** This class implements  the client-side aspects of the agent deployer */
-public class AgentClientProvider extends AbstractClientProvider
-    implements AgentKeys, SliderKeys {
-
-
-  protected static final Logger log =
-      LoggerFactory.getLogger(AgentClientProvider.class);
-  protected static final String NAME = "agent";
-  private static final ProviderUtils providerUtils = new ProviderUtils(log);
-  public static final String E_COULD_NOT_READ_METAINFO
-      = "Not a valid app package. Could not read metainfo.";
-
-  protected Map<String, Metainfo> metaInfoMap = new ConcurrentHashMap<String, Metainfo>();
-
-  protected AgentClientProvider(Configuration conf) {
-    super(conf);
-  }
-
-  @Override
-  public String getName() {
-    return NAME;
-  }
-
-  @Override
-  public List<ProviderRole> getRoles() {
-    return AgentRoles.getRoles();
-  }
-
-  @Override //Client
-  public void preflightValidateClusterConfiguration(SliderFileSystem sliderFileSystem,
-                                                    String clustername,
-                                                    Configuration configuration,
-                                                    AggregateConf instanceDefinition,
-                                                    Path clusterDirPath,
-                                                    Path generatedConfDirPath,
-                                                    boolean secure) throws
-      SliderException,
-      IOException {
-    super.preflightValidateClusterConfiguration(sliderFileSystem, clustername,
-                                                configuration,
-                                                instanceDefinition,
-                                                clusterDirPath,
-                                                generatedConfDirPath, secure);
-
-    String appDef = SliderUtils.getApplicationDefinitionPath(instanceDefinition
-        .getAppConfOperations());
-    Path appDefPath = new Path(appDef);
-    sliderFileSystem.verifyFileExists(appDefPath);
-
-    String agentConf = instanceDefinition.getAppConfOperations().
-        getGlobalOptions().getOption(AgentKeys.AGENT_CONF, "");
-    if (StringUtils.isNotEmpty(agentConf)) {
-      sliderFileSystem.verifyFileExists(new Path(agentConf));
-    }
-
-    String appHome = instanceDefinition.getAppConfOperations().
-        getGlobalOptions().get(AgentKeys.PACKAGE_PATH);
-    if (SliderUtils.isUnset(appHome)) {
-      String agentImage = instanceDefinition.getInternalOperations().
-          get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH);
-      sliderFileSystem.verifyFileExists(new Path(agentImage));
-    }
-  }
-
-  @Override
-  public void validateInstanceDefinition(AggregateConf instanceDefinition, SliderFileSystem fs) throws
-      SliderException {
-    super.validateInstanceDefinition(instanceDefinition, fs);
-    log.debug("Validating conf {}", instanceDefinition);
-    ConfTreeOperations resources =
-        instanceDefinition.getResourceOperations();
-
-    providerUtils.validateNodeCount(instanceDefinition, ROLE_NODE,
-                                    0, -1);
-
-    String appDef = null;
-    try {
-      // Validate the app definition
-      appDef = SliderUtils.getApplicationDefinitionPath(instanceDefinition
-          .getAppConfOperations());
-    } catch (BadConfigException bce) {
-      throw new BadConfigException("Application definition must be provided. " + bce.getMessage());
-    }
-
-    log.info("Validating app definition {}", appDef);
-    String extension = appDef.substring(appDef.lastIndexOf(".") + 1, appDef.length());
-    if (!"zip".equals(extension.toLowerCase(Locale.ENGLISH))) {
-      throw new BadConfigException("App definition must be packaged as a .zip file. File provided is " + appDef);
-    }
-
-    Set<String> names = resources.getComponentNames();
-    names.remove(SliderKeys.COMPONENT_AM);
-    Map<Integer, String> priorityMap = new HashMap<Integer, String>();
-
-    for (String name : names) {
-      try {
-        // Validate the app definition
-        appDef = SliderUtils.getApplicationDefinitionPath(instanceDefinition
-            .getAppConfOperations(), name);
-      } catch (BadConfigException bce) {
-        throw new BadConfigException("Application definition must be provided. " + bce.getMessage());
-      }
-      Metainfo metaInfo = getMetainfo(fs, appDef);
-
-      MapOperations component = resources.getMandatoryComponent(name);
-
-      if (metaInfo != null) {
-        Component componentDef = metaInfo.getApplicationComponent(
-            AgentUtils.getMetainfoComponentName(name,
-                instanceDefinition.getAppConfOperations()));
-        if (componentDef == null) {
-          throw new BadConfigException(
-              "Component %s is not a member of application.", name);
-        }
-      }
-
-      int priority =
-          component.getMandatoryOptionInt(ResourceKeys.COMPONENT_PRIORITY);
-      if (priority <= 0) {
-        throw new BadConfigException("Component %s %s value out of range %d",
-                                     name,
-                                     ResourceKeys.COMPONENT_PRIORITY,
-                                     priority);
-      }
-
-      String existing = priorityMap.get(priority);
-      if (existing != null) {
-        throw new BadConfigException(
-            "Component %s has a %s value %d which duplicates that of %s",
-            name,
-            ResourceKeys.COMPONENT_PRIORITY,
-            priority,
-            existing);
-      }
-      priorityMap.put(priority, name);
-
-      // fileSystem may be null for tests
-      if (metaInfo != null) {
-        Component componentDef = metaInfo.getApplicationComponent(
-            AgentUtils.getMetainfoComponentName(name,
-                instanceDefinition.getAppConfOperations()));
-
-        // ensure that intance count is 0 for client components
-        if ("CLIENT".equals(componentDef.getCategory())) {
-          MapOperations componentConfig = resources.getMandatoryComponent(name);
-          int count =
-              componentConfig.getMandatoryOptionInt(ResourceKeys.COMPONENT_INSTANCES);
-          if (count > 0) {
-            throw new BadConfigException("Component %s is of type CLIENT and cannot be instantiated."
-                                         + " Use \"slider client install ...\" command instead.",
-                                         name);
-          }
-        } else {
-          MapOperations componentConfig = resources.getMandatoryComponent(name);
-          int count =
-              componentConfig.getMandatoryOptionInt(ResourceKeys.COMPONENT_INSTANCES);
-          int definedMinCount = componentDef.getMinInstanceCountInt();
-          int definedMaxCount = componentDef.getMaxInstanceCountInt();
-          if (count < definedMinCount || count > definedMaxCount) {
-            throw new BadConfigException("Component %s, %s value %d out of range. "
-                                         + "Expected minimum is %d and maximum is %d",
-                                         name,
-                                         ResourceKeys.COMPONENT_INSTANCES,
-                                         count,
-                                         definedMinCount,
-                                         definedMaxCount);
-          }
-        }
-      }
-    }
-  }
-
-
-  @Override
-  public void prepareAMAndConfigForLaunch(SliderFileSystem fileSystem,
-                                          Configuration serviceConf,
-                                          AbstractLauncher launcher,
-                                          AggregateConf instanceDefinition,
-                                          Path snapshotConfDirPath,
-                                          Path generatedConfDirPath,
-                                          Configuration clientConfExtras,
-                                          String libdir,
-                                          Path tempPath,
-                                          boolean miniClusterTestRun) throws
-      IOException,
-      SliderException {
-    String agentImage = instanceDefinition.getInternalOperations().
-        get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH);
-    if (SliderUtils.isUnset(agentImage)) {
-      Path agentPath = new Path(tempPath.getParent(), AgentKeys.PROVIDER_AGENT);
-      log.info("Automatically uploading the agent tarball at {}", agentPath);
-      fileSystem.getFileSystem().mkdirs(agentPath);
-      if (ProviderUtils.addAgentTar(this, AGENT_TAR, fileSystem, agentPath)) {
-        instanceDefinition.getInternalOperations().set(
-            InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH,
-            new Path(agentPath, AGENT_TAR).toUri());
-      }
-    }
-  }
-
-  @Override
-  public Set<String> getApplicationTags(SliderFileSystem fileSystem,
-                                        String appDef) throws SliderException {
-    Set<String> tags;
-    Metainfo metaInfo = getMetainfo(fileSystem, appDef);
-
-    if (metaInfo == null) {
-      log.error("Error retrieving metainfo from {}", appDef);
-      throw new SliderException("Error parsing metainfo file, possibly bad structure.");
-    }
-
-    Application application = metaInfo.getApplication();
-    tags = new HashSet<String>();
-    tags.add("Name: " + application.getName());
-    tags.add("Version: " + application.getVersion());
-    tags.add("Description: " + SliderUtils.truncate(application.getComment(), 80));
-
-    return tags;
-  }
-
-  @Override
-  public void processClientOperation(SliderFileSystem fileSystem,
-                                     RegistryOperations rops,
-                                     Configuration configuration,
-                                     String operation,
-                                     File clientInstallPath,
-                                     File appPackage,
-                                     JSONObject config,
-                                     String name) throws SliderException {
-    // create temp folder
-    // create sub-folders app_pkg, agent_pkg, command
-    File tmpDir = Files.createTempDir();
-    log.info("Command is being executed at {}", tmpDir.getAbsolutePath());
-    File appPkgDir = new File(tmpDir, "app_pkg");
-    appPkgDir.mkdir();
-
-    File agentPkgDir = new File(tmpDir, "agent_pkg");
-    agentPkgDir.mkdir();
-
-    File cmdDir = new File(tmpDir, "command");
-    cmdDir.mkdir();
-
-    Metainfo metaInfo = null;
-    JSONObject defaultConfig = null;
-    try {
-      // expand app package into /app_pkg
-      ZipInputStream zipInputStream = null;
-      try {
-        zipInputStream = new ZipInputStream(new FileInputStream(appPackage));
-        {
-          ZipEntry zipEntry = zipInputStream.getNextEntry();
-          while (zipEntry != null) {
-            log.info("Processing {}", zipEntry.getName());
-            String filePath = appPkgDir + File.separator + zipEntry.getName();
-            if (!zipEntry.isDirectory()) {
-              log.info("Extracting file {}", filePath);
-              extractFile(zipInputStream, filePath);
-
-              if ("metainfo.xml".equals(zipEntry.getName())) {
-                FileInputStream input = null;
-                try {
-                  input = new FileInputStream(filePath);
-                  metaInfo = new MetainfoParser().fromXmlStream(input);
-                } finally {
-                  IOUtils.closeStream(input);
-                }
-              } else if ("metainfo.json".equals(zipEntry.getName())) {
-                FileInputStream input = null;
-                try {
-                  input = new FileInputStream(filePath);
-                  metaInfo = new MetainfoParser().fromJsonStream(input);
-                } finally {
-                  IOUtils.closeStream(input);
-                }
-              } else if ("clientInstallConfig-default.json".equals(zipEntry.getName())) {
-                try {
-                  defaultConfig = new JSONObject(FileUtils.readFileToString(new File(filePath), Charset.defaultCharset()));
-                } catch (JSONException jex) {
-                  throw new SliderException("Unable to read default client config.", jex);
-                }
-              }
-            } else {
-              log.info("Creating dir {}", filePath);
-              File dir = new File(filePath);
-              dir.mkdir();
-            }
-            zipInputStream.closeEntry();
-            zipEntry = zipInputStream.getNextEntry();
-          }
-        }
-      } finally {
-        zipInputStream.close();
-      }
-
-      if (metaInfo == null) {
-        throw new BadConfigException(E_COULD_NOT_READ_METAINFO);
-      }
-
-      String clientScript = null;
-      String clientComponent = null;
-      for (Component component : metaInfo.getApplication().getComponents()) {
-        if (component.getCategory().equals("CLIENT")) {
-          clientComponent = component.getName();
-          if (component.getCommandScript() != null) {
-            clientScript = component.getCommandScript().getScript();
-          }
-          break;
-        }
-      }
-
-      if (SliderUtils.isUnset(clientScript)) {
-        log.info("Installing CLIENT without script");
-        List<Package> packages = metaInfo.getApplication().getPackages();
-        if (packages.size() > 0) {
-          // retrieve package resources from HDFS and extract
-          for (Package pkg : packages) {
-            Path pkgPath = fileSystem.buildResourcePath(pkg.getName());
-            if (!fileSystem.isFile(pkgPath) && name != null) {
-              pkgPath = fileSystem.buildResourcePath(name, pkg.getName());
-            }
-            if (!fileSystem.isFile(pkgPath)) {
-              throw new IOException("Package doesn't exist as a resource: " +
-                  pkg.getName());
-            }
-            if ("archive".equals(pkg.getType())) {
-              File pkgFile = new File(tmpDir, pkg.getName());
-              fileSystem.copyHdfsFileToLocal(pkgPath, pkgFile);
-              expandTar(pkgFile, clientInstallPath);
-            } else {
-              File pkgFile = new File(clientInstallPath, pkg.getName());
-              fileSystem.copyHdfsFileToLocal(pkgPath, pkgFile);
-            }
-          }
-        } else {
-          // extract tarball from app def
-          for (OSSpecific osSpecific : metaInfo.getApplication()
-              .getOSSpecifics()) {
-            for (OSPackage pkg : osSpecific.getPackages()) {
-              if ("tarball".equals(pkg.getType())) {
-                File pkgFile = new File(appPkgDir, pkg.getName());
-                expandTar(pkgFile, clientInstallPath);
-              }
-            }
-          }
-        }
-        if (name == null) {
-          log.warn("Conf files not being generated because no app name was " +
-              "provided");
-          return;
-        }
-        File confInstallDir;
-        String clientRoot = null;
-        if (config != null) {
-          try {
-            clientRoot = config.getJSONObject("global")
-                .getString(AgentKeys.APP_CLIENT_ROOT);
-          } catch (JSONException e) {
-            log.info("Couldn't read {} from provided client config, falling " +
-                "back on default", AgentKeys.APP_CLIENT_ROOT);
-          }
-        }
-        if (clientRoot == null && defaultConfig != null) {
-          try {
-            clientRoot = defaultConfig.getJSONObject("global")
-                .getString(AgentKeys.APP_CLIENT_ROOT);
-          } catch (JSONException e) {
-            log.info("Couldn't read {} from default client config, using {}",
-                AgentKeys.APP_CLIENT_ROOT, clientInstallPath);
-          }
-        }
-        if (clientRoot == null) {
-          confInstallDir = clientInstallPath;
-        } else {
-          confInstallDir = new File(new File(clientInstallPath, clientRoot), "conf");
-          if (!confInstallDir.exists()) {
-            confInstallDir.mkdirs();
-          }
-        }
-        String user = RegistryUtils.currentUser();
-        for (ConfigFile configFile : metaInfo.getComponentConfigFiles(clientComponent)) {
-          retrieveConfigFile(rops, configuration, configFile, name, user,
-              confInstallDir);
-        }
-      } else {
-        log.info("Installing CLIENT using script {}", clientScript);
-        expandAgentTar(agentPkgDir);
-
-        JSONObject commandJson = getCommandJson(defaultConfig, config, metaInfo, clientInstallPath, name);
-        FileWriter file = new FileWriter(new File(cmdDir, "command.json"));
-        try {
-          file.write(commandJson.toString());
-
-        } catch (IOException e) {
-          log.error("Couldn't write command.json to file");
-        } finally {
-          file.flush();
-          file.close();
-        }
-
-        runCommand(appPkgDir, agentPkgDir, cmdDir, clientScript);
-      }
-
-    } catch (IOException ioex) {
-      log.warn("Error while executing INSTALL command {}", ioex.getMessage());
-      throw new SliderException("INSTALL client failed.");
-    }
-  }
-
-  protected void runCommand(
-      File appPkgDir,
-      File agentPkgDir,
-      File cmdDir,
-      String clientScript) throws SliderException {
-    int exitCode = 0;
-    Exception exp = null;
-    try {
-      String clientScriptPath = appPkgDir.getAbsolutePath() + File.separator + "package" +
-                                File.separator + clientScript;
-      List<String> command = Arrays.asList(AgentKeys.PYTHON_EXE,
-               "-S",
-               clientScriptPath,
-               "INSTALL",
-               cmdDir.getAbsolutePath() + File.separator + "command.json",
-               appPkgDir.getAbsolutePath() + File.separator + "package",
-               cmdDir.getAbsolutePath() + File.separator + "command-out.json",
-               "DEBUG");
-      ProcessBuilder pb = new ProcessBuilder(command);
-      log.info("Command: " + StringUtils.join(pb.command(), " "));
-      pb.environment().put(SliderKeys.PYTHONPATH,
-                           agentPkgDir.getAbsolutePath()
-                           + File.separator + "slider-agent" + File.pathSeparator
-                           + agentPkgDir.getAbsolutePath()
-                           + File.separator + "slider-agent/jinja2");
-      log.info("{}={}", SliderKeys.PYTHONPATH, pb.environment().get(SliderKeys.PYTHONPATH));
-
-      Process proc = pb.start();
-      InputStream stderr = proc.getErrorStream();
-      InputStream stdout = proc.getInputStream();
-      BufferedReader stdOutReader = new BufferedReader(new InputStreamReader(stdout));
-      BufferedReader stdErrReader = new BufferedReader(new InputStreamReader(stderr));
-
-      proc.waitFor();
-
-      String line;
-      while ((line = stdOutReader.readLine()) != null) {
-        log.info("Stdout: " + line);
-      }
-      while ((line = stdErrReader.readLine()) != null) {
-        log.info("Stderr: " + line);
-      }
-
-      exitCode = proc.exitValue();
-      log.info("Exit value is {}", exitCode);
-    } catch (IOException e) {
-      exp = e;
-    } catch (InterruptedException e) {
-      exp = e;
-    }
-
-    if (exitCode != 0) {
-      throw new SliderException("INSTALL client failed with exit code " + exitCode);
-    }
-
-    if (exp != null) {
-      log.error("Error while executing INSTALL command {}. Stack trace {}",
-                exp.getMessage(),
-                ExceptionUtils.getStackTrace(exp));
-      throw new SliderException("INSTALL client failed.", exp);
-    }
-  }
-
-  private void expandAgentTar(File agentPkgDir) throws IOException {
-    String libDirProp =
-        System.getProperty(SliderKeys.PROPERTY_LIB_DIR);
-    File tarFile = new File(libDirProp, SliderKeys.AGENT_TAR);
-    expandTar(tarFile, agentPkgDir);
-  }
-
-  private void expandTar(File tarFile, File destDir) throws IOException {
-    log.info("Expanding tar {} to {}", tarFile, destDir);
-    TarArchiveInputStream tarIn = new TarArchiveInputStream(
-        new GzipCompressorInputStream(
-            new BufferedInputStream(
-                new FileInputStream(tarFile)
-            )
-        )
-    );
-    try {
-      TarArchiveEntry tarEntry = tarIn.getNextTarEntry();
-      while (tarEntry != null) {
-        File destPath = new File(destDir, tarEntry.getName());
-        File parent = destPath.getParentFile();
-        if (!parent.exists()) {
-          parent.mkdirs();
-        }
-        if (tarEntry.isDirectory()) {
-          destPath.mkdirs();
-        } else {
-          byte[] byteToRead = new byte[1024];
-          BufferedOutputStream buffOut =
-              new BufferedOutputStream(new FileOutputStream(destPath));
-          try {
-            int len;
-            while ((len = tarIn.read(byteToRead)) != -1) {
-              buffOut.write(byteToRead, 0, len);
-            }
-          } finally {
-            buffOut.close();
-          }
-        }
-        if ((tarEntry.getMode() & 0100) != 0) {
-          destPath.setExecutable(true);
-        }
-        tarEntry = tarIn.getNextTarEntry();
-      }
-    } finally {
-      tarIn.close();
-    }
-  }
-
-  private void retrieveConfigFile(RegistryOperations rops,
-      Configuration configuration, ConfigFile configFile, String name,
-      String user, File destDir) throws IOException, SliderException {
-    log.info("Retrieving config {} to {}", configFile.getDictionaryName(),
-        destDir);
-    PublishedConfiguration published = ClientUtils.getConfigFromRegistry(rops,
-        configuration, configFile.getDictionaryName(), name, user, true);
-    ClientUtils.saveOrReturnConfig(published, configFile.getType(),
-        destDir, configFile.getFileName());
-  }
-
-  protected JSONObject getCommandJson(JSONObject defaultConfig,
-                                      JSONObject inputConfig,
-                                      Metainfo metainfo,
-                                      File clientInstallPath,
-                                      String name) throws SliderException {
-    try {
-      JSONObject pkgList = new JSONObject();
-      pkgList.put(AgentKeys.PACKAGE_LIST,
-                  AgentProviderService.getPackageListFromApplication(metainfo.getApplication()));
-      JSONObject obj = new JSONObject();
-      obj.put("hostLevelParams", pkgList);
-
-      String user = RegistryUtils.currentUser();
-      JSONObject configuration = new JSONObject();
-      JSONObject global = new JSONObject();
-      global.put("app_install_dir", clientInstallPath.getAbsolutePath());
-      global.put("app_user", user);
-      if (name != null) {
-        global.put("app_name", name);
-      }
-
-      if (defaultConfig != null) {
-        readConfigEntries(defaultConfig, clientInstallPath, global, name, user);
-      }
-      if (inputConfig != null) {
-        readConfigEntries(inputConfig, clientInstallPath, global, name, user);
-      }
-
-      configuration.put("global", global);
-      obj.put("configurations", configuration);
-      return obj;
-    } catch (JSONException jex) {
-      log.warn("Error while executing INSTALL command {}", jex.getMessage());
-      throw new SliderException("INSTALL client failed.");
-    }
-  }
-
-  private void readConfigEntries(JSONObject inpConfig,
-                                 File clientInstallPath,
-                                 JSONObject globalConfig,
-                                 String name, String user)
-      throws JSONException {
-    JSONObject globalSection = inpConfig.getJSONObject("global");
-    Iterator it = globalSection.keys();
-    while (it.hasNext()) {
-      String key = (String) it.next();
-      String value = globalSection.getString(key);
-      if (SliderUtils.isSet(value)) {
-        value = value.replace("{app_install_dir}", clientInstallPath.getAbsolutePath());
-        value = value.replace("{app_user}", user);
-        if (name != null) {
-          value = value.replace("{app_name}", name);
-        }
-      }
-      if (globalConfig.has(key)) {
-        // last one wins
-        globalConfig.remove(key);
-      }
-      globalConfig.put(key, value);
-    }
-  }
-
-  private void extractFile(ZipInputStream zipInputStream, String filePath) throws IOException {
-    BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(filePath));
-    try {
-      byte[] bytesRead = new byte[4096];
-      int read = 0;
-      while ((read = zipInputStream.read(bytesRead)) != -1) {
-        output.write(bytesRead, 0, read);
-      }
-    } finally {
-      output.close();
-    }
-  }
-
-  private Metainfo getMetainfo(SliderFileSystem fs, String appDef) {
-    Metainfo metaInfo = metaInfoMap.get(appDef);
-    if (fs != null && metaInfo == null) {
-      try {
-        metaInfo = AgentUtils.getApplicationMetainfo(fs, appDef, false);
-        metaInfoMap.put(appDef, metaInfo);
-      } catch (IOException ioe) {
-        // Ignore missing metainfo file for now
-        log.info("Missing metainfo {}", ioe.getMessage());
-      } catch (BadConfigException bce) {
-        log.info("Bad Configuration {}", bce.getMessage());
-      }
-    }
-    return metaInfo;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/AgentKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentKeys.java b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentKeys.java
deleted file mode 100644
index 9ea984c..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentKeys.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.slider.providers.agent;
-
-/*
-
- */
-public interface AgentKeys {
-
-  String PROVIDER_AGENT = "agent";
-  String ROLE_NODE = "echo";
-
-  /**
-   * Template stored in the slider classpath -to use if there is
-   * no site-specific template
-   * {@value}
-   */
-  String CONF_RESOURCE = "org/apache/slider/providers/agent/conf/";
-  /*  URL to talk back to Agent Controller*/
-  String CONTROLLER_URL = "agent.controller.url";
-  /**
-   * The location of pre-installed agent path.
-   * This can be also be dynamically computed based on Yarn installation of agent.
-   */
-  String PACKAGE_PATH = "agent.package.root";
-  /**
-   * The location of the script implementing the command.
-   */
-  String SCRIPT_PATH = "agent.script";
-  /**
-   * Execution home for the agent.
-   */
-  String APP_HOME = "app.home";
-  String APP_ROOT = "site.global.app_root";
-  String APP_CLIENT_ROOT = "client_root";
-  /**
-   * Runas user of the application
-   */
-  String RUNAS_USER = "site.global.app_user";
-  /**
-   * Name of the service.
-   */
-  String SERVICE_NAME = "app.name";
-  String ARG_LABEL = "--label";
-  String ARG_HOST = "--host";
-  String ARG_PORT = "--port";
-  String ARG_SECURED_PORT = "--secured_port";
-  String ARG_ZOOKEEPER_QUORUM = "--zk-quorum";
-  String ARG_ZOOKEEPER_REGISTRY_PATH = "--zk-reg-path";
-  String ARG_DEBUG = "--debug";
-  String AGENT_MAIN_SCRIPT_ROOT = "./infra/agent/slider-agent/";
-  String AGENT_JINJA2_ROOT = "./infra/agent/slider-agent/jinja2";
-  String AGENT_MAIN_SCRIPT = "agent/main.py";
-
-  String APP_DEF = "application.def";
-  String APP_DEF_ORIGINAL = "application.def.original";
-  String ADDON_PREFIX = "application.addon.";
-  String ADDONS = "application.addons";
-  String AGENT_VERSION = "agent.version";
-  String AGENT_CONF = "agent.conf";
-  String ADDON_FOR_ALL_COMPONENTS = "ALL";
-
-  String APP_RESOURCES = "application.resources";
-  String APP_RESOURCES_DIR = "app/resources";
-
-  String APP_CONF_DIR = "app/conf";
-
-  String AGENT_INSTALL_DIR = "infra/agent";
-  String APP_DEFINITION_DIR = "app/definition";
-  String ADDON_DEFINITION_DIR = "addon/definition";
-  String AGENT_CONFIG_FILE = "infra/conf/agent.ini";
-  String AGENT_VERSION_FILE = "infra/version";
-  String APP_PACKAGES_DIR = "app/packages";
-  String PER_COMPONENT = "per.component";
-  String PER_GROUP = "per.group";
-
-  String JAVA_HOME = "java_home";
-  String PACKAGE_LIST = "package_list";
-  String SYSTEM_CONFIGS = "system_configs";
-  String WAIT_HEARTBEAT = "wait.heartbeat";
-  String PYTHON_EXE = "python";
-  String CREATE_DEF_ZK_NODE = "create.default.zookeeper.node";
-  String HEARTBEAT_MONITOR_INTERVAL = "heartbeat.monitor.interval";
-  String AGENT_INSTANCE_DEBUG_DATA = "agent.instance.debug.data";
-  String AGENT_OUT_FILE = "slider-agent.out";
-  String KEY_AGENT_TWO_WAY_SSL_ENABLED = "ssl.server.client.auth";
-  String INFRA_RUN_SECURITY_DIR = "infra/run/security/";
-  String CERT_FILE_LOCALIZATION_PATH = INFRA_RUN_SECURITY_DIR + "ca.crt";
-  String KEY_CONTAINER_LAUNCH_DELAY = "container.launch.delay.sec";
-  String TEST_RELAX_VERIFICATION = "test.relax.validation";
-  String AM_CONFIG_GENERATION = "am.config.generation";
-
-  String DEFAULT_METAINFO_MAP_KEY = "DEFAULT_KEY";
-}
-
-

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/AgentLaunchParameter.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentLaunchParameter.java b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentLaunchParameter.java
deleted file mode 100644
index 18c6374..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentLaunchParameter.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers.agent;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Pattern;
-
-class AgentLaunchParameter {
-  public static final Logger log =
-      LoggerFactory.getLogger(AgentLaunchParameter.class);
-  private static final String DEFAULT_PARAMETER = "";
-  private static final String ANY_COMPONENT = "ANY";
-  private static final String NONE_VALUE = "NONE";
-  private final Map<String, CommandTracker> launchParameterTracker;
-
-  public AgentLaunchParameter(String parameters) {
-    launchParameterTracker = parseExpectedLaunchParameters(parameters);
-  }
-
-  /**
-   * Get command for the component type
-   *
-   * @param componentGroup
-   *
-   * @return
-   */
-  public String getNextLaunchParameter(String componentGroup) {
-    if (launchParameterTracker != null) {
-      if (launchParameterTracker.containsKey(componentGroup)
-          || launchParameterTracker.containsKey(ANY_COMPONENT)) {
-        synchronized (this) {
-          CommandTracker indexTracker = null;
-          if (launchParameterTracker.containsKey(componentGroup)) {
-            indexTracker = launchParameterTracker.get(componentGroup);
-          } else {
-            indexTracker = launchParameterTracker.get(ANY_COMPONENT);
-          }
-
-          return indexTracker.getNextCommand();
-        }
-      }
-    }
-
-    return DEFAULT_PARAMETER;
-  }
-
-  /**
-   * Parse launch parameters of the form ANY:PARAM_FOR_FIRST:PARAM_FOR_SECOND:...:PARAM_FOR_REST|HBASE_MASTER:...
-   *
-   * E.g. ANY:DO_NOT_REGISTER:DO_NOT_HEARTBEAT:NONE For any container, first one gets DO_NOT_REGISTER second one gets
-   * DO_NOT_HEARTBEAT, then all of the rest get nothing
-   *
-   * E.g. HBASE_MASTER:FAIL_AFTER_START:NONE For HBASE_MASTER, first one gets FAIL_AFTER_START then "" for all
-   *
-   * @param launchParameters
-   *
-   * @return
-   */
-  Map<String, CommandTracker> parseExpectedLaunchParameters(String launchParameters) {
-    Map<String, CommandTracker> trackers = null;
-    if (launchParameters != null && launchParameters.length() > 0) {
-      String[] componentSpecificParameters = launchParameters.split(Pattern.quote("|"));
-      for (String componentSpecificParameter : componentSpecificParameters) {
-        if (componentSpecificParameter.length() != 0) {
-          String[] parameters = componentSpecificParameter.split(Pattern.quote(":"));
-
-          if (parameters.length > 1 && parameters[0].length() > 0) {
-
-            for (int index = 1; index < parameters.length; index++) {
-              if (parameters[index].equals(NONE_VALUE)) {
-                parameters[index] = DEFAULT_PARAMETER;
-              }
-            }
-
-            if (trackers == null) {
-              trackers = new HashMap<String, CommandTracker>(10);
-            }
-            String componentName = parameters[0];
-            CommandTracker tracker = new CommandTracker(Arrays.copyOfRange(parameters, 1, parameters.length));
-            trackers.put(componentName, tracker);
-          }
-        }
-      }
-    }
-
-    return trackers;
-  }
-
-  class CommandTracker {
-    private final int maxIndex;
-    private final String[] launchCommands;
-    private int currentIndex;
-
-    CommandTracker(String[] launchCommands) {
-      this.currentIndex = 0;
-      this.maxIndex = launchCommands.length - 1;
-      this.launchCommands = launchCommands;
-    }
-
-    String getNextCommand() {
-      String retVal = launchCommands[currentIndex];
-      if (currentIndex != maxIndex) {
-        currentIndex++;
-      }
-
-      return retVal;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/51c2b92c/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderFactory.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderFactory.java b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderFactory.java
deleted file mode 100644
index d5ca749..0000000
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderFactory.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.providers.agent;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.slider.providers.AbstractClientProvider;
-import org.apache.slider.providers.ProviderService;
-import org.apache.slider.providers.SliderProviderFactory;
-
-public class AgentProviderFactory extends SliderProviderFactory {
-
-  public static final String CLASSNAME =
-      "org.apache.slider.providers.agent.AgentProviderFactory";
-
-  public AgentProviderFactory() {
-  }
-
-  public AgentProviderFactory(Configuration conf) {
-    super(conf);
-  }
-
-  @Override
-  public AbstractClientProvider createClientProvider() {
-    return new AgentClientProvider(getConf());
-  }
-
-  @Override
-  public ProviderService createServerProvider() {
-    return new AgentProviderService();
-  }
-}