KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Made > TIR > Access > Browser > KillAll


1 /* $Id: KillAll.java,v 1.2 2004/05/20 14:23:52 bures Exp $ */
2 package SOFA.SOFAnode.Made.TIR.Access.Browser;
3 import java.rmi.Naming JavaDoc;
4
5 import SOFA.SOFAnode.Made.TIR.ManageRepository;
6 import SOFA.SOFAnode.Made.TIR.WorkRepository;
7
8 /** Abort all active work repositories */
9 public class KillAll {
10   public static void main(String JavaDoc[] argv) {
11     try {
12       System.setSecurityManager(new java.rmi.RMISecurityManager JavaDoc());
13     
14       String JavaDoc rmiport = System.getProperty("sofa.rmiport","1099");
15       String JavaDoc rmihost = System.getProperty("sofa.rmihost","localhost");
16       ManageRepository rep = (ManageRepository) Naming.lookup("//"+rmihost+":"+rmiport+"/Repository");
17       
18       WorkRepository[] wr = rep.getActiveWork();
19
20       if (wr.length==0) {
21         System.out.println("No active");
22         return;
23       }
24       for(int i=0;i<wr.length;i++) {
25         System.out.print("Aborting "+wr[i].workIdent()+"...");
26         if (wr[i].abort())
27           System.out.println("OK");
28         else
29           System.out.println("Error!");
30       }
31
32       
33     } catch (Exception JavaDoc e) {
34       System.out.println("Exception: " + e.getMessage());
35       e.printStackTrace();
36     }
37   }
38 }
39
Popular Tags