KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > ejtools > deploy > Main


1 /*
2  * EJTools, the Enterprise Java Tools
3  *
4  * Distributable under LGPL license.
5  * See terms of license at www.gnu.org.
6  */

7 package net.sourceforge.ejtools.deploy;
8
9 // Standard Imports
10
import java.io.File JavaDoc;
11 import java.net.URL JavaDoc;
12 import java.net.URLClassLoader JavaDoc;
13 import java.security.AccessController JavaDoc;
14 import java.security.Permission JavaDoc;
15 import java.security.PrivilegedExceptionAction JavaDoc;
16 import java.util.LinkedList JavaDoc;
17
18 /**
19  * Description of the Class
20  *
21  * @author letiembl
22  * @created 21 mars 2002
23  * @todo Javadoc to complete
24  * @todo Add log4j logs
25  */

26 public class Main
27 {
28    /**
29     * The main program for the Main class
30     *
31     * @param args The command line arguments
32     * @exception Exception Description of Exception
33     */

34    public static void main(String JavaDoc[] args) throws Exception JavaDoc
35    {
36       File JavaDoc pluginDir = new File JavaDoc("../lib/ext");
37       LinkedList JavaDoc list = new LinkedList JavaDoc();
38       File JavaDoc[] plugins = pluginDir.listFiles();
39       for (int i = 0; i < plugins.length; i++)
40       {
41          System.out.println(plugins[i].toURL());
42          list.add(plugins[i].toURL());
43       }
44       pluginDir = new File JavaDoc("../lib");
45       plugins = pluginDir.listFiles();
46       for (int i = 0; i < plugins.length; i++)
47       {
48          System.out.println(plugins[i].toURL());
49          list.add(plugins[i].toURL());
50       }
51       URL JavaDoc[] pluginURLs = (URL JavaDoc[]) list.toArray(new URL JavaDoc[list.size()]);
52
53       Thread.currentThread().setContextClassLoader(new URLClassLoader JavaDoc(pluginURLs, Thread.currentThread().getContextClassLoader()));
54
55       System.setSecurityManager(
56          new SecurityManager JavaDoc()
57          {
58             public void checkPermission(Permission JavaDoc p)
59             {
60             }
61
62
63             public void checkPermission(Permission JavaDoc perm, Object JavaDoc context)
64             {
65             }
66          });
67
68       AccessController.doPrivileged(
69          new PrivilegedExceptionAction JavaDoc()
70          {
71             public Object JavaDoc run()
72                    throws Exception JavaDoc
73             {
74                java.beans.Beans.instantiate(Thread.currentThread().getContextClassLoader(), "net.sourceforge.ejtools.deploy.DeploymentBrowser");
75                return null;
76             }
77          });
78    }
79 }
80
81
Popular Tags