You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ji...@apache.org on 2017/09/12 00:35:28 UTC
[26/84] [abbrv] hadoop git commit: YARN-7050. Post cleanup after
YARN-6903, removal of org.apache.slider package. Contributed by Jian He
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderVersionInfo.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderVersionInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderVersionInfo.java
deleted file mode 100644
index 86025ee..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/buildutils/BuildHelper.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/buildutils/BuildHelper.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/buildutils/BuildHelper.java
deleted file mode 100644
index 80f165f..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/buildutils/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.buildutils;
-
-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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/conf/MapOperations.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/conf/MapOperations.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/conf/MapOperations.java
deleted file mode 100644
index 9714a0f..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadClusterStateException.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadClusterStateException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadClusterStateException.java
deleted file mode 100644
index e73ce57..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadCommandArgumentsException.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadCommandArgumentsException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadCommandArgumentsException.java
deleted file mode 100644
index 0d5d686..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadConfigException.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadConfigException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadConfigException.java
deleted file mode 100644
index 65a8ea8..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ErrorStrings.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ErrorStrings.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ErrorStrings.java
deleted file mode 100644
index 8b04969..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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";
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ExceptionConverter.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ExceptionConverter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ExceptionConverter.java
deleted file mode 100644
index efec676..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/NoSuchNodeException.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/NoSuchNodeException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/NoSuchNodeException.java
deleted file mode 100644
index ad2f1a4..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/NotFoundException.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/NotFoundException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/NotFoundException.java
deleted file mode 100644
index 40cb94d..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ServiceNotReadyException.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ServiceNotReadyException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ServiceNotReadyException.java
deleted file mode 100644
index 435bc1a..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/SliderException.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/SliderException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/SliderException.java
deleted file mode 100644
index 1430c5a..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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.hadoop.yarn.service.conf.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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/SliderInternalStateException.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/SliderInternalStateException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/SliderInternalStateException.java
deleted file mode 100644
index deddbbc..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/TriggerClusterTeardownException.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/TriggerClusterTeardownException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/TriggerClusterTeardownException.java
deleted file mode 100644
index bb9f430..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/UnknownApplicationInstanceException.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/UnknownApplicationInstanceException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/UnknownApplicationInstanceException.java
deleted file mode 100644
index a1f8ae9..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/UsageException.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/UsageException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/UsageException.java
deleted file mode 100644
index 8684294..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/WaitTimeoutException.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/WaitTimeoutException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/WaitTimeoutException.java
deleted file mode 100644
index 5ad3fdc..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/AbstractLauncher.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/AbstractLauncher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/AbstractLauncher.java
deleted file mode 100644
index a3e1bf2..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/AbstractLauncher.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.security.Credentials;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
-import org.apache.hadoop.yarn.api.records.ContainerRetryContext;
-import org.apache.hadoop.yarn.api.records.ContainerRetryPolicy;
-import org.apache.hadoop.yarn.api.records.LocalResource;
-import org.apache.hadoop.yarn.util.Records;
-import org.apache.hadoop.yarn.service.conf.SliderKeys;
-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.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import static org.apache.hadoop.yarn.service.provider.docker.DockerKeys.DEFAULT_DOCKER_NETWORK;
-
-/**
- * Launcher of applications: base class
- */
-public class AbstractLauncher {
- 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 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 boolean yarnDockerMode = false;
- protected String dockerImage;
- protected String dockerNetwork = DEFAULT_DOCKER_NETWORK;
- protected String dockerHostname;
- protected String runPrivilegedContainer;
-
-
- /**
- * Create instance.
- * @param coreFileSystem filesystem
- * @param credentials initial set of credentials -null is permitted
- */
- public AbstractLauncher(
- CoreFileSystem coreFileSystem,
- Credentials credentials) {
- this.coreFileSystem = coreFileSystem;
- this.credentials = credentials != null ? credentials: new Credentials();
- }
-
- public void setYarnDockerMode(boolean yarnDockerMode){
- this.yarnDockerMode = yarnDockerMode;
- }
-
- /**
- * Get the env vars to work on
- * @return env vars
- */
- public Map<String, String> getEnv() {
- return envVars;
- }
-
- /**
- * Get the launch commands.
- * @return the live list of commands
- */
- public List<String> getCommands() {
- return commands;
- }
-
- 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);
- }
-
- /**
- * Accessor to the credentials
- * @return the credentials associated with this launcher
- */
- public Credentials getCredentials() {
- return credentials;
- }
-
-
- public void addCommand(String cmd) {
- commands.add(cmd);
- }
-
- /**
- * 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(envVars);
-
- //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);
- env.put("YARN_CONTAINER_RUNTIME_DOCKER_CONTAINER_NETWORK", dockerNetwork);
- env.put("YARN_CONTAINER_RUNTIME_DOCKER_CONTAINER_HOSTNAME",
- dockerHostname);
- 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;
- }
-
- public void setRetryContext(int maxRetries, int retryInterval) {
- ContainerRetryContext retryContext = ContainerRetryContext
- .newInstance(ContainerRetryPolicy.RETRY_ON_ALL_ERRORS, null, maxRetries,
- retryInterval);
- containerLaunchContext.setContainerRetryContext(retryContext);
- }
-
- /**
- * 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();
- envVars.put(SliderKeys.HADOOP_USER_NAME, userName);
- }
-
- /**
- * 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");
- envVars.put(var, value);
- }
-
-
- public void putEnv(Map<String, String> map) {
- envVars.putAll(map);
- }
-
-
- public void setDockerImage(String dockerImage) {
- this.dockerImage = dockerImage;
- }
-
- public void setDockerNetwork(String dockerNetwork) {
- this.dockerNetwork = dockerNetwork;
- }
-
- public void setDockerHostname(String dockerHostname) {
- this.dockerHostname = dockerHostname;
- }
-
- public void setRunPrivilegedContainer(boolean runPrivilegedContainer) {
- if (runPrivilegedContainer) {
- this.runPrivilegedContainer = Boolean.toString(true);
- } else {
- this.runPrivilegedContainer = Boolean.toString(false);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/ClasspathConstructor.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/ClasspathConstructor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/ClasspathConstructor.java
deleted file mode 100644
index 6eb4058..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/CommandLineBuilder.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/CommandLineBuilder.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/CommandLineBuilder.java
deleted file mode 100644
index 5ab0532..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/CommandLineBuilder.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.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 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, " ");
- }
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/d44876af/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/ContainerLauncher.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/ContainerLauncher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/ContainerLauncher.java
deleted file mode 100644
index 7e164e4..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/ContainerLauncher.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.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);
-
- public ContainerLauncher(Configuration conf,
- CoreFileSystem coreFileSystem,
- Container container,
- Credentials credentials) {
- super(coreFileSystem, credentials);
- }
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org