/*******************************************************************************
 * Copyright (c) 2012-2017 Codenvy, S.A.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Codenvy, S.A. - initial API and implementation
 *******************************************************************************/
package org.eclipse.che.api.agent;

import com.google.inject.Inject;
import com.google.inject.Singleton;

import org.eclipse.che.api.agent.server.launcher.AbstractAgentLauncher;
import org.eclipse.che.api.agent.server.launcher.CompositeAgentLaunchingChecker;
import org.eclipse.che.api.agent.server.launcher.MappedPortIsListeningAgentChecker;
import org.eclipse.che.api.agent.server.launcher.ProcessIsLaunchedChecker;

import javax.inject.Named;

/**
 * Starts SSH agent.
 *
 * @author Anatolii Bazko
 * @author Alexander Garagatyi
 */
@Singleton
public class SshAgentLauncher extends AbstractAgentLauncher {
    @Inject
    public SshAgentLauncher(@Named("che.agent.dev.max_start_time_ms") long agentMaxStartTimeMs,
                            @Named("che.agent.dev.ping_delay_ms") long agentPingDelayMs) {
        super(agentMaxStartTimeMs,
              agentPingDelayMs,
              new CompositeAgentLaunchingChecker(new ProcessIsLaunchedChecker("sshd"),
                                                 new MappedPortIsListeningAgentChecker("22/tcp")));
    }

    @Override
    public String getMachineType() {
        return "docker";
    }

    @Override
    public String getAgentId() {
        return "org.eclipse.che.ssh";
    }
}

@@ -1394,130 +1394,8 @@
 Ms,%0A
-              new CompositeAgentLaunchingChecker(new ProcessIsLaunchedChecker(%22sshd%22),%0A                                   
     
@@ -1452,17 +1452,16 @@
 2/tcp%22))
-)
 ;%0A    %7D%0A

Fix launching SSH agent in some cases (#4708)