Package biz.db.dev.tools.remote.access.database

Examples of biz.db.dev.tools.remote.access.database.ServerInfo


    if( LOG.isDebugEnabled() ) {
      LOG.debug( "Calling ssh connect method");
    }

    ServerInfo info = datastore.findServerInfo(name);

    if( info == null ) {
      return "Server under name " + name + " not found ";
    }
View Full Code Here


    builder.append("=======================================" + OsUtils.LINE_SEPARATOR);
    builder.append("*      Server Info        *" + OsUtils.LINE_SEPARATOR);
    builder.append("=======================================" + OsUtils.LINE_SEPARATOR);
    builder.append( OsUtils.LINE_SEPARATOR );

    ServerInfo info = datastore.findServerInfo( name );

    if( info == null ) {
      return "None found";
    }

    output( builder, pad20("Name: "), info.getName() );
    output( builder, pad20("Host: "), info.getHost() );
    output( builder, pad20("Port:"), info.getPort().toString() );
    output( builder, pad20("Keyfile: "), nullVariant(info.getKeyFile()) );
    output( builder, pad20("CheckHostKey: "), nullVariant(info.getCheckHostKey()) );
    output( builder, pad20("Username: "), nullVariant(info.getUsername()) );
    output( builder, pad20("Password: "), nullVariant( "****" ) );

    builder.append( OsUtils.LINE_SEPARATOR );

    for(PortForwarding pf : info.getPortForwardings() ) {
      builder.append("== Port Forwarding" + OsUtils.LINE_SEPARATOR );
      output( builder, pad20("Name: "), pf.getName() );
      output( builder, pad20("Type: "), nullVariant( pf.getType() ) );
      output( builder, pad20("Description: "), nullVariant( pf.getDescription() ) );
      output( builder, pad20("Remote Host: "), pf.getRemoteHost() );
      output( builder, pad20("Remote Port: "), pf.getRemotePort().toString() );
      output( builder, pad20("Local Port: "), nullVariant( pf.getLocalPort() ) );
      builder.append("==" + OsUtils.LINE_SEPARATOR );
    }

    for(ServerLink link : info.getLinks() ) {
      builder.append("== Link" + OsUtils.LINE_SEPARATOR );
      output( builder, pad20("Name: "), link.getTarget() );
      output( builder, pad20("Local Port: "), link.getLocalPort().toString() );
      builder.append("==" + OsUtils.LINE_SEPARATOR );
    }
View Full Code Here

    if( LOG.isDebugEnabled() ) {
      LOG.debug( "Calling servers add method");
    }

    try {
      ServerInfo info = new ServerInfo( name, host, port, checkHostKey, keyfile, username, password );

      datastore.addServerInfo( info );

      return "Saved";
    } catch( IllegalArgumentException ex ) {
View Full Code Here

      setupLink(host, sshInfo, link);
    }
  }

  private void setupLink(String host, SshConnectionInfo sshInfo, ServerLink link) throws JSchException {
    ServerInfo targetInfo = datastore.findServerInfo(link.getTarget());

    if( targetInfo == null ) {
      LOG.info( "Target server info with name " + link.getTarget() + " not found");
      return;
    }

    int assignedPort = 0;

    try {
      assignedPort = sshInfo.getSession().setPortForwardingL(link.getLocalPort(), targetInfo.getHost(), targetInfo.getPort());
      LOG.info( "Assigned port for link host: " + host + " and target: " + targetInfo.getHost() + " is " + assignedPort );

      // setup the link
      SshConnectionInfo childInfo = openSession( targetInfo.getName(), targetInfo.getUsername(), targetInfo.getPassword(), LOCALHOST, assignedPort, targetInfo.getCheckHostKey(), targetInfo.getPortForwardings(), targetInfo.getLinks());
      sshInfo.addChild( childInfo );
    } catch( Exception ex ) {
      LOG.warn( "Failed to setup link with host: " + host + " forwarded port: " + assignedPort + " for host: " + targetInfo.getHost(), ex );
      System.out.println( "Failed to setup link with host: " + host + " forwarded port: " + assignedPort + " for host: " + targetInfo.getHost() + ". Error was " + ex.getLocalizedMessage() );
    }
  }
View Full Code Here

TOP

Related Classes of biz.db.dev.tools.remote.access.database.ServerInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.