2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.netconf.nettyutil.handler.ssh.client;
10 import java.io.IOException;
13 * Abstract class providing mechanism of invoking various SSH level services.
14 * Class is not allowed to be extended, as it provides its own implementations via instance initiators.
16 public abstract class Invoker {
17 private boolean invoked = false;
21 protected boolean isInvoked() {
22 // TODO invoked is always false
26 abstract void invoke(SshSession session) throws IOException;
29 * Invoker implementation to invokes subsystem SSH service.
34 public static Invoker subsystem(final String subsystem) {
35 return new Invoker() {
37 void invoke(SshSession session) throws IOException {
39 throw new IllegalStateException("Already invoked.");
42 session.startSubSystem(subsystem);