All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.ext.shell.ShellServiceOptions Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR1
Show newest version
/*
 * Copyright 2015 Red Hat, Inc.
 *
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  and Apache License v2.0 which accompanies this distribution.
 *
 *  The Eclipse Public License is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 *
 *  The Apache License v2.0 is available at
 *  http://www.opensource.org/licenses/apache2.0.php
 *
 *  You may elect to redistribute this code under either of these licenses.
 *
 *
 * Copyright (c) 2015 The original author or authors
 * ------------------------------------------------------
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and Apache License v2.0 which accompanies this distribution.
 *
 *     The Eclipse Public License is available at
 *     http://www.eclipse.org/legal/epl-v10.html
 *
 *     The Apache License v2.0 is available at
 *     http://www.opensource.org/licenses/apache2.0.php
 *
 * You may elect to redistribute this code under either of these licenses.
 *
 */

package io.vertx.ext.shell;

import io.vertx.codegen.annotations.DataObject;
import io.vertx.codegen.json.annotations.JsonGen;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.shell.term.SSHTermOptions;
import io.vertx.ext.shell.term.TelnetTermOptions;
import io.vertx.ext.shell.term.HttpTermOptions;

/**
 * The configurations options for the shell service, the shell connectors can be configured
 * with {@link TelnetTermOptions}, {@link SSHTermOptions} and {@link HttpTermOptions}.
 *
 * @author Julien Viet
 */
@DataObject
@JsonGen(publicConverter = false)
public class ShellServiceOptions extends ShellServerOptions {

  private TelnetTermOptions telnetOptions;
  private SSHTermOptions sshOptions;
  private HttpTermOptions httpOptions;

  public ShellServiceOptions() {
  }

  public ShellServiceOptions(ShellServiceOptions that) {
    super(that);
    this.telnetOptions = that.telnetOptions != null ? new TelnetTermOptions(that.telnetOptions) : null;
    this.sshOptions = that.sshOptions != null ? new SSHTermOptions(that.sshOptions) : null;
    this.httpOptions = that.httpOptions != null ? new HttpTermOptions(that.httpOptions) : null;
  }

  public ShellServiceOptions(JsonObject json) {
    super(json);
    ShellServiceOptionsConverter.fromJson(json, this);
  }

  @Override
  public ShellServiceOptions setWelcomeMessage(String welcomeMessage) {
    return (ShellServiceOptions) super.setWelcomeMessage(welcomeMessage);
  }

  @Override
  public ShellServiceOptions setSessionTimeout(long timeoutMillis) {
    return (ShellServiceOptions) super.setSessionTimeout(timeoutMillis);
  }

  @Override
  public ShellServiceOptions setReaperInterval(long reaperInterval) {
    return (ShellServiceOptions) super.setReaperInterval(reaperInterval);
  }

  /**
   * @return the Telnet options
   */
  public TelnetTermOptions getTelnetOptions() {
    return telnetOptions;
  }

  /**
   * Set the Telnet options, if the option is null, Telnet will not be started.
   *
   * @param telnetOptions the ssh options
   * @return a reference to this, so the API can be used fluently
   */
  public ShellServiceOptions setTelnetOptions(TelnetTermOptions telnetOptions) {
    this.telnetOptions = telnetOptions;
    return this;
  }

  /**
   * @return the SSH options
   */
  public SSHTermOptions getSSHOptions() {
    return sshOptions;
  }

  /**
   * Set the SSH options, if the option is null, SSH will not be started.
   *
   * @param sshOptions the ssh options
   * @return a reference to this, so the API can be used fluently
   */
  public ShellServiceOptions setSSHOptions(SSHTermOptions sshOptions) {
    this.sshOptions = sshOptions;
    return this;
  }

  public HttpTermOptions getHttpOptions() {
    return httpOptions;
  }

  public ShellServiceOptions setHttpOptions(HttpTermOptions httpOptions) {
    this.httpOptions = httpOptions;
    return this;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy