Package org.apache.sshd.server

Examples of org.apache.sshd.server.CommandFactory


      sshd.setFileSystemFactory(new NativeFileSystemFactory());
      sshd.setPort(port);
      sshd.setShellFactory(new ProcessShellFactory());
      sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(tempPrivateKeyFile));
      sshd.setCommandFactory(new ScpCommandFactory());
      sshd.setCommandFactory(new ScpCommandFactory(new CommandFactory() {
         public Command createCommand(String command) {
            return new ProcessShellFactory(command.split(" ")).create();
         }
      }));
      sshd.setPublickeyAuthenticator(new PublickeyAuthenticator() {
View Full Code Here


    public void sshCommandFactory() {
        prepareServer(true);
        server.start();
        try {
            org.apache.sshd.SshServer sshd = (org.apache.sshd.SshServer) ReflectionTestUtils.getField(server, "sshd");
            CommandFactory fact = sshd.getCommandFactory();
            Command cmd = fact.createCommand("shutdown now");
            assertTrue(cmd instanceof SshCommand);
            assertEquals(((SshCommand) cmd).getCommand(),"shutdown now");
        } finally {
            server.stop();
        }
View Full Code Here

        if (!authFound) {
            throw new CitrusRuntimeException("Neither 'password' nor 'allowed-key-path' is set. Please provide at least one");
        }

        // Setup endpoint adapter
        sshd.setCommandFactory(new CommandFactory() {
            public Command createCommand(String command) {
                return new SshCommand(command, getEndpointAdapter());
            }
        });
View Full Code Here

    log = l;
  }

  @Override
  public CommandFactory get() {
    return new CommandFactory() {
      public Command createCommand(final String requestCommand) {
        return new Trampoline(requestCommand);
      }
    };
  }
View Full Code Here

        sshd.setPort( port );
        if ( !certDir.exists() ) {
            certDir.mkdirs();
        }
        sshd.setKeyPairProvider( new SimpleGeneratorHostKeyProvider( new File( certDir, "hostkey.ser" ).getAbsolutePath() ) );
        sshd.setCommandFactory( new CommandFactory() {
            public Command createCommand( String command ) {
                if ( command.startsWith( "git-upload-pack" ) ) {
                    return new GitUploadCommand( command, repositoryResolver, getAuthorizationManager() );
                } else if ( command.startsWith( "git-receive-pack" ) ) {
                    return new GitReceiveCommand( command, repositoryResolver, getAuthorizationManager(), receivePackFactory );
View Full Code Here

TOP

Related Classes of org.apache.sshd.server.CommandFactory

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.