You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by du...@apache.org on 2001/02/21 00:12:26 UTC

cvs commit: xml-axis/java/src/org/apache/axis/utils AxisClassLoader.java

dug         01/02/20 15:12:26

  Modified:    java/src/org/apache/axis/utils AxisClassLoader.java
  Log:
  Always forget to add comments
  
  Revision  Changes    Path
  1.2       +22 -2     xml-axis/java/src/org/apache/axis/utils/AxisClassLoader.java
  
  Index: AxisClassLoader.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/AxisClassLoader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AxisClassLoader.java	2001/02/20 22:51:30	1.1
  +++ AxisClassLoader.java	2001/02/20 23:12:25	1.2
  @@ -58,6 +58,15 @@
   import java.io.* ;
   import java.util.Hashtable ;
   
  +/**
  + * This allows us to specify that certain classes, the ones we register
  + * using the registerClass method, should be loaded using this class
  + * loader - all others use the system default one.
  + * This was added so that the *.jws processor can reload classes
  + * that have already been loaded once - when the java file changes.
  + *
  + * @author Doug Davis (dug@us.ibm.com)
  + */
   public class AxisClassLoader extends ClassLoader {
     static Hashtable list = null ;
   
  @@ -68,8 +77,8 @@
     public synchronized void registerClass( String name, String classFile )
         throws FileNotFoundException, IOException
     {
  -    if ( list == null ) list = new Hashtable();
  -
  +    /* Load the class file the *.class file */
  +    /****************************************/
       FileInputStream       fis  = new FileInputStream( classFile );
       ByteArrayOutputStream baos = new ByteArrayOutputStream();
       byte buf[] = new byte[1024];
  @@ -78,12 +87,20 @@
       fis.close();
       baos.close();
   
  +    /* Create a new Class object from it */
  +    /*************************************/
       byte[] data = baos.toByteArray();
       Class  cls  = defineClass( name, data, 0, data.length );
  +    if ( list == null ) list = new Hashtable();
  +
  +    /* And finally register it */
  +    /***************************/
       list.put( name, cls );
     }
   
     public synchronized void deregisterClass( String name ) {
  +    /* Deregister the passed in className */
  +    /**************************************/
       if ( list != null )
         list.remove( name);
     }
  @@ -91,6 +108,9 @@
     public Class loadClass(String name) throws ClassNotFoundException {
       Object obj ;
   
  +    /* Check the 'list' for the className - if there just return the */
  +    /* class - if not there use the default class loader.            */
  +    /*****************************************************************/
       if ( list != null ) {
         obj = list.get( name );
         if ( obj != null )