public class login extends VMachine { private String username; public login () { } public void run() { FileClassLoader fileclass = null; fileclass = new FileClassLoader(); fileclass.bindir = "C:\\java\\OSVM\\bin\\"; String input = args; if(input.compareTo("")==0) { sysapi.Write(OUT,"login: "); input = sysapi.Read(IN); } //------------ //Check if user is already logged in //Autenticate - Have to write authentication function or VM //Set Directory Tree to User Directory //------------ User newuser = new User(input); sysapi.setUser(newuser); if(((VMachine)vmh.getType()).Parent != null) {//Detaches this 'login' VM from previous User VM Tree sysapi.Exit(vmh,owner); ((VMachine)vmh.getType()).Parent = null; IN = sysapi.OpenDevice("keyboard",input); OUT = sysapi.OpenDevice("display",input); } else { sysapi.setTitle(input); } sysapi.Write(OUT,"Welcome to OSVM, " + input + "\n"); newuser.addHandle(vmh); try {//Loads Shell VM Class VMClass2 = fileclass.loadCmd("shell"); Handle vmh2 = sysapi.CreateVM(IN,OUT,VMClass2,input,"",this,null,null,0); newuser.addHandle(vmh2); } catch(Exception ex) { System.out.println("Exception while creating new shell."); } sysapi.Compute(vmh); // Runs Shell sysapi.Exit(vmh,input); } };