예제 #1
0
파일: TAIL.java 프로젝트: juanibdn/jPOS
 public void exec(CLIContext cli, String[] args) throws Exception {
   this.p = cli.getOutputStream();
   this.cli = cli;
   this.ansi = cli.getConsoleReader().getTerminal().isANSISupported();
   if (args.length == 1) {
     usage(cli);
     return;
   }
   for (int i = 1; i < args.length; i++) {
     try {
       Logger logger = (Logger) NameRegistrar.get("logger." + args[i]);
       logger.addListener(this);
     } catch (NameRegistrar.NotFoundException e) {
       cli.println("Logger " + args[i] + " not found -- ignored.");
     }
   }
   cli.getConsoleReader().readCharacter(new char[] {'q', 'Q'});
   for (int i = 1; i < args.length; i++) {
     try {
       Logger logger = (Logger) NameRegistrar.get("logger." + args[i]);
       logger.removeListener(this);
     } catch (NameRegistrar.NotFoundException e) {
     }
   }
 }
예제 #2
0
파일: TMMON.java 프로젝트: Zengwn/jPOS
 public void exec(CLIContext cli, String[] args) throws Exception {
   this.p = cli.getOutputStream();
   this.cli = cli;
   this.ansi = cli.getConsoleReader().getTerminal().isANSISupported();
   if (args.length == 1) {
     usage(cli);
     return;
   }
   for (int i = 1; i < args.length; i++) {
     try {
       Object obj = NameRegistrar.get(args[i]);
       if (obj instanceof TransactionManager) {
         ((TransactionManager) obj).addListener(this);
       } else {
         cli.println(
             "Object '"
                 + args[i]
                 + "' is not an instance of TransactionManager ("
                 + obj.toString()
                 + ")");
       }
     } catch (NameRegistrar.NotFoundException e) {
       cli.println("TransactionManager '" + args[i] + "' not found -- ignored.");
     }
   }
   cli.getConsoleReader().readCharacter(new char[] {'q', 'Q'});
   for (int i = 1; i < args.length; i++) {
     try {
       Object obj = NameRegistrar.get(args[i]);
       if (obj instanceof TransactionManager) {
         ((TransactionManager) obj).removeListener(this);
       }
     } catch (NameRegistrar.NotFoundException ignored) {
     }
   }
 }