hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jia...@apache.org
Subject [62/76] [abbrv] hadoop git commit: YARN-5909. Remove agent related code in slider AM. Contributed by Jian He
Date Wed, 07 Dec 2016 21:11:02 GMT
YARN-5909. Remove agent related code in slider AM. Contributed by Jian He


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/9fdab600
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/9fdab600
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/9fdab600

Branch: refs/heads/yarn-native-services
Commit: 9fdab600e38b270587d6fc7afef727a7725104c0
Parents: 5877e0c
Author: Jian He <jianhe@apache.org>
Authored: Tue Nov 29 13:06:45 2016 -0800
Committer: Jian He <jianhe@apache.org>
Committed: Wed Dec 7 13:00:06 2016 -0800

----------------------------------------------------------------------
 hadoop-project/pom.xml                          |    5 -
 .../services/webapp/ApplicationApiWebApp.java   |    2 +-
 .../hadoop-yarn-slider-core/pom.xml             |   23 +-
 .../apache/slider/common/tools/SliderUtils.java |    1 -
 .../providers/AbstractProviderService.java      |   21 +-
 .../slider/providers/ProviderService.java       |    9 +-
 .../providers/agent/AgentClientProvider.java    |  713 -----
 .../providers/agent/AgentLaunchParameter.java   |  130 -
 .../providers/agent/AgentProviderFactory.java   |   47 -
 .../providers/agent/AgentProviderService.java   | 2850 ------------------
 .../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 -
 .../server/appmaster/SliderAppMaster.java       |  140 +-
 .../server/appmaster/web/AgentService.java      |   37 -
 .../slider/server/appmaster/web/WebAppApi.java  |    7 -
 .../server/appmaster/web/WebAppApiImpl.java     |    6 -
 .../appmaster/web/rest/AMWebServices.java       |    1 -
 .../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 -
 .../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 --
 .../publisher/TestAgentProviderService.java     |   60 -
 .../publisher/TestSliderProviderFactory.java    |   40 -
 83 files changed, 26 insertions(+), 11517 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/9fdab600/hadoop-project/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml
index 96b3d86..2e61bd4 100644
--- a/hadoop-project/pom.xml
+++ b/hadoop-project/pom.xml
@@ -879,11 +879,6 @@
         <version>${jackson2.version}</version>
       </dependency>
       <dependency>
-        <groupId>com.fasterxml.jackson.jaxrs</groupId>
-        <artifactId>jackson-jaxrs-json-provider</artifactId>
-        <version>${jackson2.version}</version>
-      </dependency>
-      <dependency>
         <groupId>com.fasterxml.jackson.dataformat</groupId>
         <artifactId>jackson-dataformat-cbor</artifactId>
         <version>${jackson2.version}</version>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/9fdab600/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/webapp/ApplicationApiWebApp.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/webapp/ApplicationApiWebApp.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/webapp/ApplicationApiWebApp.java
index 52a9de6..e1bddb5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/webapp/ApplicationApiWebApp.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/webapp/ApplicationApiWebApp.java
@@ -30,7 +30,7 @@ import org.apache.hadoop.service.AbstractService;
 import org.apache.hadoop.yarn.services.api.impl.ApplicationApiService;
 import org.apache.hadoop.yarn.webapp.GenericExceptionHandler;
 import org.apache.hadoop.yarn.webapp.YarnJacksonJaxbJsonProvider;
-import org.mortbay.jetty.webapp.Configuration;
+import org.eclipse.jetty.webapp.Configuration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/9fdab600/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/pom.xml
index a2c67c0..66e9ee9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/pom.xml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/pom.xml
@@ -225,7 +225,7 @@
 
     <dependency>
       <groupId>javax.servlet</groupId>
-      <artifactId>servlet-api</artifactId>
+      <artifactId>javax.servlet-api</artifactId>
     </dependency>
 
     <dependency>
@@ -289,21 +289,6 @@
     </dependency>
 
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty-util</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty-sslengine</artifactId>
-    </dependency>
-
-    <dependency>
       <groupId>javax.servlet.jsp</groupId>
       <artifactId>jsp-api</artifactId>
       <scope>runtime</scope>
@@ -315,12 +300,6 @@
     </dependency>
 
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty-sslengine</artifactId>
-      <version>6.1.26</version>
-    </dependency>
-
-    <dependency>
       <groupId>org.yaml</groupId>
       <artifactId>snakeyaml</artifactId>
       <version>1.16</version>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/9fdab600/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.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/SliderUtils.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/SliderUtils.java
index 713cd02..b101d34 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.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/SliderUtils.java
@@ -70,7 +70,6 @@ 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;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/9fdab600/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.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/providers/AbstractProviderService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
index 19fa07b..00fc606 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
@@ -19,17 +19,17 @@
 package org.apache.slider.providers;
 
 import org.apache.hadoop.conf.Configuration;
+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.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.ContainerStatus;
 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;
@@ -44,7 +44,6 @@ 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;
@@ -77,7 +76,6 @@ public abstract class AbstractProviderService
   private static final Logger log =
     LoggerFactory.getLogger(AbstractProviderService.class);
   protected StateAccessForProviders amState;
-  protected AgentRestOperations restOps;
   protected URL amWebAPI;
   protected YarnRegistryViewForProviders yarnRegistry;
   protected QueueAccess queueAccess;
@@ -127,18 +125,9 @@ public abstract class AbstractProviderService
   }
 
   @Override
-  public AgentRestOperations getAgentRestOperations() {
-    return restOps;
-  }
-
-  @Override
   public void notifyContainerCompleted(ContainerId containerId) {
   }
 
-  public void setAgentRestOperations(AgentRestOperations agentRestOperations) {
-    this.restOps = agentRestOperations;
-  }
-
   /**
    * Load default Configuration
    * @param confDir configuration directory

http://git-wip-us.apache.org/repos/asf/hadoop/blob/9fdab600/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderService.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/providers/ProviderService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderService.java
index b62510a..4ca9326 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderService.java
@@ -20,10 +20,10 @@ package org.apache.slider.providers;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.registry.client.types.ServiceRecord;
 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.hadoop.yarn.api.records.ContainerStatus;
 import org.apache.slider.api.ClusterDescription;
 import org.apache.slider.common.tools.SliderFileSystem;
@@ -37,7 +37,6 @@ 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;
@@ -176,12 +175,6 @@ public interface ProviderService extends ProviderCore,
   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
    */

http://git-wip-us.apache.org/repos/asf/hadoop/blob/9fdab600/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/agent/AgentClientProvider.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/providers/agent/AgentClientProvider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/agent/AgentClientProvider.java
deleted file mode 100644
index 7ca469f..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/agent/AgentClientProvider.java
+++ /dev/null
@@ -1,713 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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;
-
-import static org.apache.slider.common.tools.SliderUtils.getApplicationDefinitionPath;
-
-/** 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(AGENT_CONF, "");
-    if (StringUtils.isNotEmpty(agentConf)) {
-      sliderFileSystem.verifyFileExists(new Path(agentConf));
-    }
-
-    String appHome = instanceDefinition.getAppConfOperations().
-        getGlobalOptions().get(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(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(), 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,
-      ConfTreeOperations appConf) throws SliderException {
-    return getApplicationTags(fileSystem,
-        getApplicationDefinitionPath(appConf));
-  }
-
-  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(APP_CLIENT_ROOT);
-          } catch (JSONException e) {
-            log.info("Couldn't read {} from provided client config, falling " +
-                "back on default", APP_CLIENT_ROOT);
-          }
-        }
-        if (clientRoot == null && defaultConfig != null) {
-          try {
-            clientRoot = defaultConfig.getJSONObject("global")
-                .getString(APP_CLIENT_ROOT);
-          } catch (JSONException e) {
-            log.info("Couldn't read {} from default client config, using {}",
-                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(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(PYTHONPATH,
-                           agentPkgDir.getAbsolutePath()
-                           + File.separator + "slider-agent" + File.pathSeparator
-                           + agentPkgDir.getAbsolutePath()
-                           + File.separator + "slider-agent/jinja2");
-      log.info("{}={}", PYTHONPATH, pb.environment().get(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 = SliderUtils.getLibDir();
-    File tarFile = new File(libDirProp, 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(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/hadoop/blob/9fdab600/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/agent/AgentLaunchParameter.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/providers/agent/AgentLaunchParameter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/agent/AgentLaunchParameter.java
deleted file mode 100644
index 18c6374..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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/hadoop/blob/9fdab600/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderFactory.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/providers/agent/AgentProviderFactory.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderFactory.java
deleted file mode 100644
index d5ca749..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-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();
-  }
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message