KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > test > common > launch > JacoLauncher


1 package org.jacorb.test.common.launch;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 2005 Gerald Brose.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
21  * MA 02110-1301, USA.
22  */

23
24 import java.util.*;
25 import java.io.*;
26
27 /**
28  * A launcher that uses the jaco script of a given JacORB installation.
29  *
30  * @author Andre Spiegel spiegel@gnu.org
31  * @version $Id: JacoLauncher.java,v 1.1 2005/05/10 13:58:14 andre.spiegel Exp $
32  */

33 public class JacoLauncher extends JacORBLauncher
34 {
35     public JacoLauncher(String JavaDoc jacorbHome, boolean coverage)
36     {
37         super(jacorbHome, coverage);
38         if (coverage)
39             System.out.println ("WARNING: Cannot find coverage when running under jaco");
40     }
41
42     public Process JavaDoc launch(String JavaDoc classpath,
43                           Properties props,
44                           String JavaDoc mainClass,
45                           String JavaDoc[] args)
46     {
47         Runtime JavaDoc rt = Runtime.getRuntime();
48         
49         List cmdList = new ArrayList();
50         
51         cmdList.add (jacorbHome + "/bin/jaco");
52         cmdList.addAll (propsToArgList (props));
53         cmdList.add (mainClass);
54         cmdList.addAll (Arrays.asList(args));
55         
56         String JavaDoc[] envp = new String JavaDoc[]
57         {
58             "JACORB_HOME=" + jacorbHome,
59             "CLASSPATH=" + classpath,
60         };
61                 
62         try
63         {
64             return rt.exec(toStringArray(cmdList), envp);
65         }
66         catch (IOException ex)
67         {
68             throw new RuntimeException JavaDoc(ex);
69         }
70     }
71 }
72
Popular Tags