Thread: [Ejtools-cvs] CVS: applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser Main.java,
Brought to you by:
letiemble
From: Laurent E. <let...@us...> - 2002-05-02 19:39:17
|
Update of /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser In directory usw-pr-cvs1:/tmp/cvs-serv6472/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser Modified Files: Main.java Log Message: Add some JavaDocs Index: Main.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/Main.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Main.java 30 Apr 2002 21:13:19 -0000 1.2 --- Main.java 2 May 2002 19:39:14 -0000 1.3 *************** *** 7,10 **** --- 7,11 ---- package net.sourceforge.ejtools.jndibrowser; + import java.beans.Beans; import java.io.File; import java.net.URL; *************** *** 18,68 **** /** ! * Description of the Class * ! * @author letiembl ! * @created 21 mars 2002 ! * @todo Javadoc to complete ! * @todo Add log4j logs */ public class Main { ! private final static Category logger = Category.getInstance(Main.class); /** ! * The main program for the Main class * ! * @param args The command line arguments ! * @exception Exception Description of Exception */ public static void main(String[] args) throws Exception { ! File pluginDir; ! File[] plugins; LinkedList list = new LinkedList(); ! logger.debug("Building classpath..."); ! logger.debug("Scanning lib directory..."); pluginDir = new File("../lib"); plugins = pluginDir.listFiles(); for (int i = 0; i < plugins.length; i++) { ! logger.debug("Found " + plugins[i].toURL()); System.out.println(plugins[i].toURL()); list.add(plugins[i].toURL()); } ! logger.debug("Scanning lib/ext directory..."); pluginDir = new File("../lib/ext"); plugins = pluginDir.listFiles(); for (int i = 0; i < plugins.length; i++) { ! logger.debug("Found " + plugins[i].toURL()); list.add(plugins[i].toURL()); } URL[] pluginURLs = (URL[]) list.toArray(new URL[list.size()]); - Thread.currentThread().setContextClassLoader(new URLClassLoader(pluginURLs, Thread.currentThread().getContextClassLoader())); System.setSecurityManager( new SecurityManager() --- 19,76 ---- /** ! * Main class for the JNDI Browser. Construct the classloader dynamically by ! * scanning directories. Once the classloader has been built, launch the Browser ! * with a custom security manager. * ! * @author letiemble ! * @created 21 mars 2002 ! * @version $Revision$ */ public class Main { ! /** Log4j logger */ ! static Category logger = Category.getInstance(Main.class); ! /** ! * The main method * ! * @param args The command line arguments ! * @exception Exception Exception */ public static void main(String[] args) throws Exception { ! File pluginDir; ! File[] plugins; LinkedList list = new LinkedList(); ! logger.debug("Building classpath..."); ! // Store the files from lib directory ! logger.debug("Scanning lib directory..."); pluginDir = new File("../lib"); plugins = pluginDir.listFiles(); for (int i = 0; i < plugins.length; i++) { ! logger.debug("Found " + plugins[i].toURL()); System.out.println(plugins[i].toURL()); list.add(plugins[i].toURL()); } ! // Store the files from lib/ext directory ! logger.debug("Scanning lib/ext directory..."); pluginDir = new File("../lib/ext"); plugins = pluginDir.listFiles(); for (int i = 0; i < plugins.length; i++) { ! logger.debug("Found " + plugins[i].toURL()); list.add(plugins[i].toURL()); } + // Create a custom classloader URL[] pluginURLs = (URL[]) list.toArray(new URL[list.size()]); Thread.currentThread().setContextClassLoader(new URLClassLoader(pluginURLs, Thread.currentThread().getContextClassLoader())); + + // Custom security manager System.setSecurityManager( new SecurityManager() *************** *** 78,89 **** }); ! logger.debug("Launching JNDIBrowser"); AccessController.doPrivileged( new PrivilegedExceptionAction() { ! public Object run() ! throws Exception { ! java.beans.Beans.instantiate(Thread.currentThread().getContextClassLoader(), "net.sourceforge.ejtools.jndibrowser.JNDIBrowser"); return null; } --- 86,97 ---- }); ! // Create the JNDI Browser JavaBean ! logger.debug("Launching JNDIBrowser"); AccessController.doPrivileged( new PrivilegedExceptionAction() { ! public Object run() throws Exception { ! Beans.instantiate(Thread.currentThread().getContextClassLoader(), "net.sourceforge.ejtools.jndibrowser.JNDIBrowser"); return null; } |