Package com.zaranux.os.client.commands

Source Code of com.zaranux.os.client.commands.login

package com.zaranux.os.client.commands;

import com.zaranux.client.api.AsyncCallback;
import com.zaranux.client.java.io.PrintStream;


public class login extends Command {

  @Override
  protected void execute(final AsyncCallback<Boolean> callback) {
    String[] args = getArgs();
    if(args.length == 2)
    {
      String id = args[0];
      String pass = args[1];
     
      systemcall.login(id, pass, new AsyncCallback<Boolean>()
        {
          public void onSuccess(final Boolean result)
          {
                 
            /*outPS.print("sessionToken: " + sessionToken ,new AsyncCallback<Boolean>()
            {
              public void onSuccess(Boolean b)
              {
              //  outPS.flush(callback);
                  callback.onSuccess(true);
              }
              public void onFailure(Throwable t)
              {
                callback.onFailure(t);
              }
            });
           
*/       
            callback.onSuccess(true);
          }
          public void onFailure(Throwable T)
          {
            final PrintStream outPS = (PrintStream) System.out;

            outPS.print("Wrong username/password!" ,new AsyncCallback<Boolean>()
            {
              public void onSuccess(Boolean b)
              {
              //  outPS.flush(callback);
                  callback.onSuccess(true);
              }
              public void onFailure(Throwable t)
              {
                callback.onFailure(t);
              }
            });
          }
        });
    }else
    {
      System.out.println("Wrong parameters: Usage: login <username> <pass>",callback);
    }
  }
}
TOP

Related Classes of com.zaranux.os.client.commands.login

TOP
Copyright © 2018 www.massapi.com. 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.