org.argouml.application.security
Class ArgoJarClassLoader

java.lang.Object
  extended byjava.lang.ClassLoader
      extended byjava.security.SecureClassLoader
          extended byjava.net.URLClassLoader
              extended byorg.argouml.application.security.ArgoJarClassLoader

public class ArgoJarClassLoader
extends java.net.URLClassLoader

A class loader for loading jar files, both local and remote. This source was taken primarily from Sun's tutorial


Constructor Summary
ArgoJarClassLoader(java.net.URL url)
          Creates a new ClassLoader for the specified url.
 
Method Summary
 java.lang.String getMainClassName()
          Returns the name of the jar file main class, or null if no "Main-Class" manifest attributes was defined.
 void invokeClass(java.lang.String name, java.lang.String[] args)
          Invokes the application in this jar file given the name of the main class and an array of arguments.
 
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findClass, findResource, findResources, getPermissions, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArgoJarClassLoader

public ArgoJarClassLoader(java.net.URL url)
Creates a new ClassLoader for the specified url.

Parameters:
url - the url of the jar file
Method Detail

getMainClassName

public java.lang.String getMainClassName()
                                  throws java.io.IOException
Returns the name of the jar file main class, or null if no "Main-Class" manifest attributes was defined.

Throws:
java.io.IOException

invokeClass

public void invokeClass(java.lang.String name,
                        java.lang.String[] args)
                 throws java.lang.ClassNotFoundException,
                        java.lang.NoSuchMethodException,
                        java.lang.reflect.InvocationTargetException
Invokes the application in this jar file given the name of the main class and an array of arguments. The class must define a static method "main" which takes an array of String arguemtns and is of return type "void".

Parameters:
name - the name of the main class
args - the arguments for the application
Throws:
java.lang.ClassNotFoundException - if the specified class could not be found
java.lang.NoSuchMethodException - if the specified class does not contain a "main" method
java.lang.reflect.InvocationTargetException - if the application raised an exception


ArgoUML © 1996-2003 (20030829)ArgoUML Project HomeArgoUML Cookbook