Patches item #477656, was opened at 2001-11-02 14:01
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376687&aid=477656&group_id=22866

Category: JBossServer
Group: v2.5 Rabbit Hole (unstable)
Status: Open
Resolution: None
Priority: 5
Submitted By: Guillaume Boissiere (boissier)
Assigned to: Nobody/Anonymous (nobody)
Summary: Minor cleanups - Scope.java

Initial Comment:
Adds some javadocs comments to this class and an 
import to HashMap.
Enjoy!

-- Guillaume


diff -urN 
jboss/src/main/org/jboss/deployment/scope/Scope.java 
gb-jboss/src/main/org/jboss/deployment/scope/Scope.java
--- 
jboss/src/main/org/jboss/deployment/scope/Scope.java
        Tue Sep 11 14:34:59 2001
+++ gb-
jboss/src/main/org/jboss/deployment/scope/Scope.java
        Fri Nov  2 16:47:30 2001
@@ -7,10 +7,11 @@
 
 package org.jboss.deployment.scope;
 
-import java.util.Set;
-import java.util.Map;
-import java.util.Iterator;
 import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
 
 import org.jboss.logging.Logger;
 
@@ -28,26 +29,34 @@
 public class Scope {
     
     /** keeps a map of class loaders that participate 
in this scope */
-    final protected Map classLoaders=new 
java.util.HashMap();
+    final protected Map classLoaders = new HashMap();
     
     /** keeps a hashtable of dependencies between the 
classLoaders */
-    final protected Map dependencies=new 
java.util.HashMap();
+    final protected Map dependencies = new HashMap();
     
     /** keeps a hashtable of class appearances */
-    final protected Map classLocations=new 
java.util.HashMap();
+    final protected Map classLocations = new HashMap
();
     
     /** keeps a hashtable of resource appearances */
-    final protected Map resourceLocations=new 
java.util.HashMap();
+    final protected Map resourceLocations = new 
HashMap();
     
     /** keeps a reference to a logger which which to 
interact */
     final protected Logger log;
     
-    /** Creates new Scope */
+    /** Creates new Scope 
+     *
+     * @param log - The logger this new scope will 
interact with.
+     */
     public Scope(Logger log) {
         this.log=log;
     }
     
-    /** registers a classloader in this scope */
+    /** 
+     * Registers a classloader in this scope.
+     *
+     * @param loader - The classloader to register.
+     * @return The newly registered classloader.
+     */
     public ScopedURLClassLoader registerClassLoader
(ScopedURLClassLoader loader) {
         // must synchronize not to collide with 
deregistrations and
         // dependency logging
@@ -56,9 +65,12 @@
         }
     }
     
-    
-    /** deRegisters a classloader in this scope
-     *  removes all cached data related to this 
classloader
+    /** 
+     * Deregisters a classloader in this scope.
+     * Removes all cached data related to this 
classloader.
+     *
+     * @param loader - The classloader to deregister.
+     * @return The newly deregistered classloader.
      */
     public ScopedURLClassLoader deRegisterClassLoader
(ScopedURLClassLoader loader) {
         // synchronized not to collide with 
registrations
@@ -75,8 +87,12 @@
         }
     }
     
-    /** helper method that will clear all entries 
from a map
-     *  with a dedicated target value.
+    /** 
+     * Helper method that will clear all entries from 
a map
+     * with a dedicated target value.
+     *
+     * @param map - The map we want to clear entries 
from.
+     * @param value - The object we want to remove 
from that map.
      */
     protected void clearByValue(Map map, Object 
value) {
         Iterator values=map.values().iterator();
@@ -87,19 +103,28 @@
         }
     }
     
-    /** returns the classLoaders that a particular 
classLoader is
-     *  dependent on. Should be called after locking 
classLoaders
+    /** 
+     * Returns the classLoaders that a particular 
classLoader is
+     * dependent on. Should be called after locking 
classLoaders.
+     *
+     * @param loader - The classloader we want to 
find dependencies of.
+     * @return The set of classloaders this 
classloader is dependent on.
      */
     public Set getDependentClassLoaders
(ScopedURLClassLoader loader) {
         Set result=(Set) dependencies.get(loader);
         if(result==null)
-            result=new java.util.HashSet();
+            result=new HashSet();
         return result;
     }
     
-    /** adds a dependency between two classloaders. 
this can be called
-     *  from within application threads that require 
resource loading.
-     *  Should be called after locking classLoaders
+    /** 
+     * Adds a dependency between two classloaders. 
This can be called
+     * from within application threads that require 
resource loading.
+     * Should be called after locking classLoaders.
+     *
+     * @param source - The classloader we are adding 
dependency from.
+     * @param target - The classloader we are adding 
dependency to.
+     * @return true if the operation was successful, 
false otherwise.
      */
     protected boolean addDependency
(ScopedURLClassLoader source, ScopedURLClassLoader 
target) {
         // no rescursions necessary (but not volatile 
for the code)
@@ -120,7 +145,17 @@
             return false;
     }
     
-    /** loads a class on behalf of a given 
classloader */
+    /**
+     * Loads a class on behalf of a given classloader.
+     *
+     * @param className - The name of the class we 
are trying to load.
+     * @param resolve - Whether or not the class 
should be resolved.
+     * @param source - The classloader we want to 
load the class with.
+     *
+     * @throws ClassNotFoundException - If the class 
cannot be loaded 
+     *                                  properly.
+     * @return The new class that has been loaded.
+     */
     public Class loadClass(String className, boolean 
resolve, ScopedURLClassLoader source)
     throws ClassNotFoundException {
         
@@ -165,8 +200,16 @@
         } // sync
     }
     
-    /** gets a URL on behalf of a given classloader 
which may be null
-     *  in case that we do not check dependencies */
+    /** 
+     * Gets a URL on behalf of a given classloader 
which may be null
+     * in case that we do not check dependencies.
+     * 
+     * @param name - The name of the target 
ScopedURLClassLoader.
+     * @param source - The source 
ScopedURLClassLoader.
+     * @return The name of the target URL where the 
resource was loaded
+     *         or null if no loader in the scope was 
able to load the 
+     *         resource.
+     */
     public URL getResource(String name, 
ScopedURLClassLoader source) {
         
         // short look into the resource location 
cache, is synchronized in


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376687&aid=477656&group_id=22866

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to