1
10package org.jstk.jstksh;
11
12import java.security.*;
13
14public class JSTKShellActions {
15 public static class ExecCommandAction implements PrivilegedExceptionAction {
16 private JSTKShell shell;
17 private String[] cmdargs;
18 public ExecCommandAction(JSTKShell shell, String[] cmdargs){
19 this.shell = shell;
20 this.cmdargs = cmdargs;
21 }
22 public Object run() throws Exception {
23 return shell.execCommand(cmdargs);
24 }
25 }
26
27 public static class CreateSessionAction implements PrivilegedExceptionAction {
28 private JSTKShell shell;
29 public CreateSessionAction(JSTKShell shell){
30 this.shell = shell;
31 }
32 public Object run() throws Exception {
33 return shell.createSession();
34 }
35 }
36
37 public static class DestroySessionAction implements PrivilegedExceptionAction {
38 private JSTKShell shell;
39 private String sessId;
40 public DestroySessionAction(JSTKShell shell, String sessId){
41 this.shell = shell;
42 this.sessId = sessId;
43 }
44 public Object run() throws Exception {
45 shell.destroySession(sessId);
46 return null;
47 }
48 }
49}
50