tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r719153 - in /tomcat/trunk/java/org/apache/naming: ./ factory/ java/ resources/
Date Thu, 20 Nov 2008 01:39:31 GMT
Author: markt
Date: Wed Nov 19 17:39:30 2008
New Revision: 719153

URL: http://svn.apache.org/viewvc?rev=719153&view=rev
Log:
Generics for o.a.naming.*
A little messy in places due to differences in env handling. Properties, Hashtable<?,?>, Hashtable<String,Object> and Hashtable<String,String) are all used and in a few places it is necessary to cast from one to the other.

Modified:
    tomcat/trunk/java/org/apache/naming/ContextAccessController.java
    tomcat/trunk/java/org/apache/naming/ContextBindings.java
    tomcat/trunk/java/org/apache/naming/HandlerRef.java
    tomcat/trunk/java/org/apache/naming/NamingContext.java
    tomcat/trunk/java/org/apache/naming/NamingContextBindingsEnumeration.java
    tomcat/trunk/java/org/apache/naming/NamingContextEnumeration.java
    tomcat/trunk/java/org/apache/naming/ResourceRef.java
    tomcat/trunk/java/org/apache/naming/SelectorContext.java
    tomcat/trunk/java/org/apache/naming/ServiceRef.java
    tomcat/trunk/java/org/apache/naming/StringManager.java
    tomcat/trunk/java/org/apache/naming/factory/BeanFactory.java
    tomcat/trunk/java/org/apache/naming/factory/EjbFactory.java
    tomcat/trunk/java/org/apache/naming/factory/MailSessionFactory.java
    tomcat/trunk/java/org/apache/naming/factory/OpenEjbFactory.java
    tomcat/trunk/java/org/apache/naming/factory/ResourceEnvFactory.java
    tomcat/trunk/java/org/apache/naming/factory/ResourceFactory.java
    tomcat/trunk/java/org/apache/naming/factory/ResourceLinkFactory.java
    tomcat/trunk/java/org/apache/naming/factory/SendMailFactory.java
    tomcat/trunk/java/org/apache/naming/factory/TransactionFactory.java
    tomcat/trunk/java/org/apache/naming/java/javaURLContextFactory.java
    tomcat/trunk/java/org/apache/naming/resources/BaseDirContext.java
    tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
    tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java
    tomcat/trunk/java/org/apache/naming/resources/FileDirContext.java
    tomcat/trunk/java/org/apache/naming/resources/ProxyDirContext.java
    tomcat/trunk/java/org/apache/naming/resources/RecyclableNamingEnumeration.java
    tomcat/trunk/java/org/apache/naming/resources/ResourceAttributes.java
    tomcat/trunk/java/org/apache/naming/resources/ResourceCache.java
    tomcat/trunk/java/org/apache/naming/resources/WARDirContext.java

Modified: tomcat/trunk/java/org/apache/naming/ContextAccessController.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/ContextAccessController.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/ContextAccessController.java (original)
+++ tomcat/trunk/java/org/apache/naming/ContextAccessController.java Wed Nov 19 17:39:30 2008
@@ -36,13 +36,15 @@
     /**
      * Catalina context names on which writing is not allowed.
      */
-    private static Hashtable readOnlyContexts = new Hashtable();
+    private static Hashtable<Object,Object> readOnlyContexts =
+        new Hashtable<Object,Object>();
 
 
     /**
      * Security tokens repository.
      */
-    private static Hashtable securityTokens = new Hashtable();
+    private static Hashtable<Object,Object> securityTokens =
+        new Hashtable<Object,Object>();
 
 
     // --------------------------------------------------------- Public Methods

Modified: tomcat/trunk/java/org/apache/naming/ContextBindings.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/ContextBindings.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/ContextBindings.java (original)
+++ tomcat/trunk/java/org/apache/naming/ContextBindings.java Wed Nov 19 17:39:30 2008
@@ -42,31 +42,36 @@
     /**
      * Bindings name - naming context. Keyed by name.
      */
-    private static Hashtable contextNameBindings = new Hashtable();
+    private static Hashtable<Object,Context> contextNameBindings =
+        new Hashtable<Object,Context>();
 
 
     /**
      * Bindings thread - naming context. Keyed by thread id.
      */
-    private static Hashtable threadBindings = new Hashtable();
+    private static Hashtable<Thread,Context> threadBindings =
+        new Hashtable<Thread,Context>();
 
 
     /**
      * Bindings thread - name. Keyed by thread id.
      */
-    private static Hashtable threadNameBindings = new Hashtable();
+    private static Hashtable<Thread,Object> threadNameBindings =
+        new Hashtable<Thread,Object>();
 
 
     /**
      * Bindings class loader - naming context. Keyed by CL id.
      */
-    private static Hashtable clBindings = new Hashtable();
+    private static Hashtable<ClassLoader,Context> clBindings =
+        new Hashtable<ClassLoader,Context>();
 
 
     /**
      * Bindings class loader - name. Keyed by CL id.
      */
-    private static Hashtable clNameBindings = new Hashtable();
+    private static Hashtable<ClassLoader,Object> clNameBindings =
+        new Hashtable<ClassLoader,Object>();
 
 
     /**
@@ -132,7 +137,7 @@
      * @param name Name of the context
      */
     static Context getContext(Object name) {
-        return (Context) contextNameBindings.get(name);
+        return contextNameBindings.get(name);
     }
 
 
@@ -156,7 +161,7 @@
     public static void bindThread(Object name, Object token) 
         throws NamingException {
         if (ContextAccessController.checkSecurityToken(name, token)) {
-            Context context = (Context) contextNameBindings.get(name);
+            Context context = contextNameBindings.get(name);
             if (context == null)
                 throw new NamingException
                     (sm.getString("contextBindings.unknownContext", name));
@@ -195,8 +200,7 @@
      */
     public static Context getThread()
         throws NamingException {
-        Context context = 
-            (Context) threadBindings.get(Thread.currentThread());
+        Context context = threadBindings.get(Thread.currentThread());
         if (context == null)
             throw new NamingException
                 (sm.getString("contextBindings.noContextBoundToThread"));
@@ -259,7 +263,7 @@
                                        ClassLoader classLoader) 
         throws NamingException {
         if (ContextAccessController.checkSecurityToken(name, token)) {
-            Context context = (Context) contextNameBindings.get(name);
+            Context context = contextNameBindings.get(name);
             if (context == null)
                 throw new NamingException
                     (sm.getString("contextBindings.unknownContext", name));
@@ -318,7 +322,7 @@
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         Context context = null;
         do {
-            context = (Context) clBindings.get(cl);
+            context = clBindings.get(cl);
             if (context != null) {
                 return context;
             }

Modified: tomcat/trunk/java/org/apache/naming/HandlerRef.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/HandlerRef.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/HandlerRef.java (original)
+++ tomcat/trunk/java/org/apache/naming/HandlerRef.java Wed Nov 19 17:39:30 2008
@@ -166,9 +166,9 @@
         sb.append(getFactoryClassLocation());
         sb.append(",factoryClassName=");
         sb.append(getFactoryClassName());
-        Enumeration refAddrs = getAll();
+        Enumeration<RefAddr> refAddrs = getAll();
         while (refAddrs.hasMoreElements()) {
-            RefAddr refAddr = (RefAddr) refAddrs.nextElement();
+            RefAddr refAddr = refAddrs.nextElement();
             sb.append(",{type=");
             sb.append(refAddr.getType());
             sb.append(",content=");

Modified: tomcat/trunk/java/org/apache/naming/NamingContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/NamingContext.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/NamingContext.java (original)
+++ tomcat/trunk/java/org/apache/naming/NamingContext.java Wed Nov 19 17:39:30 2008
@@ -21,10 +21,13 @@
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Enumeration;
+
+import javax.naming.Binding;
 import javax.naming.Context;
 import javax.naming.Name;
 import javax.naming.LinkRef;
 import javax.naming.CompositeName;
+import javax.naming.NameClassPair;
 import javax.naming.NameParser;
 import javax.naming.Referenceable;
 import javax.naming.Reference;
@@ -65,17 +68,17 @@
     /**
      * Builds a naming context using the given environment.
      */
-    public NamingContext(Hashtable env, String name) 
+    public NamingContext(Hashtable<String,Object> env, String name) 
         throws NamingException {
-        this.bindings = new HashMap();
-        this.env = new Hashtable();
+        this.bindings = new HashMap<String,NamingEntry>();
+        this.env = new Hashtable<String,Object>();
         // FIXME ? Could be put in the environment ?
         this.name = name;
         // Populating the environment hashtable
         if (env != null ) {
-            Enumeration envEntries = env.keys();
+            Enumeration<String> envEntries = env.keys();
             while (envEntries.hasMoreElements()) {
-                String entryName = (String) envEntries.nextElement();
+                String entryName = envEntries.nextElement();
                 addToEnvironment(entryName, env.get(entryName));
             }
         }
@@ -85,7 +88,8 @@
     /**
      * Builds a naming context using the given environment.
      */
-    public NamingContext(Hashtable env, String name, HashMap bindings) 
+    public NamingContext(Hashtable<String,Object> env, String name,
+            HashMap<String,NamingEntry> bindings) 
         throws NamingException {
         this(env, name);
         this.bindings = bindings;
@@ -98,7 +102,7 @@
     /**
      * Environment.
      */
-    protected Hashtable env;
+    protected Hashtable<String,Object> env;
 
 
     /**
@@ -110,7 +114,7 @@
     /**
      * Bindings in this Context.
      */
-    protected HashMap bindings;
+    protected HashMap<String,NamingEntry> bindings;
 
 
     /**
@@ -248,7 +252,7 @@
             throw new NamingException
                 (sm.getString("namingContext.invalidName"));
         
-        NamingEntry entry = (NamingEntry) bindings.get(name.get(0));
+        NamingEntry entry = bindings.get(name.get(0));
         
         if (entry == null) {
             throw new NameNotFoundException
@@ -330,7 +334,7 @@
      * this context. Each element of the enumeration is of type NameClassPair.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration list(Name name)
+    public NamingEnumeration<NameClassPair> list(Name name)
         throws NamingException {
         // Removing empty parts
         while ((!name.isEmpty()) && (name.get(0).length() == 0))
@@ -339,7 +343,7 @@
             return new NamingContextEnumeration(bindings.values().iterator());
         }
         
-        NamingEntry entry = (NamingEntry) bindings.get(name.get(0));
+        NamingEntry entry = bindings.get(name.get(0));
         
         if (entry == null) {
             throw new NameNotFoundException
@@ -363,7 +367,7 @@
      * this context. Each element of the enumeration is of type NameClassPair.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration list(String name)
+    public NamingEnumeration<NameClassPair> list(String name)
         throws NamingException {
         return list(new CompositeName(name));
     }
@@ -382,7 +386,7 @@
      * Each element of the enumeration is of type Binding.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration listBindings(Name name)
+    public NamingEnumeration<Binding> listBindings(Name name)
         throws NamingException {
         // Removing empty parts
         while ((!name.isEmpty()) && (name.get(0).length() == 0))
@@ -391,7 +395,7 @@
             return new NamingContextBindingsEnumeration(bindings.values().iterator(), this);
         }
         
-        NamingEntry entry = (NamingEntry) bindings.get(name.get(0));
+        NamingEntry entry = bindings.get(name.get(0));
         
         if (entry == null) {
             throw new NameNotFoundException
@@ -415,7 +419,7 @@
      * Each element of the enumeration is of type Binding.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration listBindings(String name)
+    public NamingEnumeration<Binding> listBindings(String name)
         throws NamingException {
         return listBindings(new CompositeName(name));
     }
@@ -457,7 +461,7 @@
             throw new NamingException
                 (sm.getString("namingContext.invalidName"));
         
-        NamingEntry entry = (NamingEntry) bindings.get(name.get(0));
+        NamingEntry entry = bindings.get(name.get(0));
         
         if (entry == null) {
             throw new NameNotFoundException
@@ -695,7 +699,7 @@
      * @return the environment of this context; never null
      * @exception NamingException if a naming exception is encountered
      */
-    public Hashtable getEnvironment()
+    public Hashtable<?,?> getEnvironment()
         throws NamingException {
         return env;
     }
@@ -764,7 +768,7 @@
             return new NamingContext(env, this.name, bindings);
         }
         
-        NamingEntry entry = (NamingEntry) bindings.get(name.get(0));
+        NamingEntry entry = bindings.get(name.get(0));
         
         if (entry == null) {
             throw new NameNotFoundException
@@ -836,7 +840,7 @@
             throw new NamingException
                 (sm.getString("namingContext.invalidName"));
         
-        NamingEntry entry = (NamingEntry) bindings.get(name.get(0));
+        NamingEntry entry = bindings.get(name.get(0));
         
         if (name.size() > 1) {
             if (entry == null) {

Modified: tomcat/trunk/java/org/apache/naming/NamingContextBindingsEnumeration.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/NamingContextBindingsEnumeration.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/NamingContextBindingsEnumeration.java (original)
+++ tomcat/trunk/java/org/apache/naming/NamingContextBindingsEnumeration.java Wed Nov 19 17:39:30 2008
@@ -34,13 +34,14 @@
  */
 
 public class NamingContextBindingsEnumeration 
-    implements NamingEnumeration {
+    implements NamingEnumeration<Binding> {
 
 
     // ----------------------------------------------------------- Constructors
 
 
-    public NamingContextBindingsEnumeration(Iterator entries, Context ctx) {
+    public NamingContextBindingsEnumeration(Iterator<NamingEntry> entries,
+            Context ctx) {
     	iterator = entries;
         this.ctx = ctx;
     }
@@ -51,7 +52,7 @@
     /**
      * Underlying enumeration.
      */
-    protected Iterator iterator;
+    protected Iterator<NamingEntry> iterator;
 
     
     /**
@@ -66,7 +67,7 @@
     /**
      * Retrieves the next element in the enumeration.
      */
-    public Object next()
+    public Binding next()
         throws NamingException {
         return nextElementInternal();
     }
@@ -94,7 +95,7 @@
     }
 
 
-    public Object nextElement() {
+    public Binding nextElement() {
         try {
             return nextElementInternal();
         } catch (NamingException e) {
@@ -102,8 +103,8 @@
         }
     }
     
-    private Object nextElementInternal() throws NamingException {
-        NamingEntry entry = (NamingEntry) iterator.next();
+    private Binding nextElementInternal() throws NamingException {
+        NamingEntry entry = iterator.next();
         
         // If the entry is a reference, resolve it
         if (entry.type == NamingEntry.REFERENCE

Modified: tomcat/trunk/java/org/apache/naming/NamingContextEnumeration.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/NamingContextEnumeration.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/NamingContextEnumeration.java (original)
+++ tomcat/trunk/java/org/apache/naming/NamingContextEnumeration.java Wed Nov 19 17:39:30 2008
@@ -32,13 +32,13 @@
  */
 
 public class NamingContextEnumeration 
-    implements NamingEnumeration {
+    implements NamingEnumeration<NameClassPair> {
 
 
     // ----------------------------------------------------------- Constructors
 
 
-    public NamingContextEnumeration(Iterator entries) {
+    public NamingContextEnumeration(Iterator<NamingEntry> entries) {
     	iterator = entries;
     }
 
@@ -49,7 +49,7 @@
     /**
      * Underlying enumeration.
      */
-    protected Iterator iterator;
+    protected Iterator<NamingEntry> iterator;
 
 
     // --------------------------------------------------------- Public Methods
@@ -58,7 +58,7 @@
     /**
      * Retrieves the next element in the enumeration.
      */
-    public Object next()
+    public NameClassPair next()
         throws NamingException {
         return nextElement();
     }
@@ -86,8 +86,8 @@
     }
 
 
-    public Object nextElement() {
-        NamingEntry entry = (NamingEntry) iterator.next();
+    public NameClassPair nextElement() {
+        NamingEntry entry = iterator.next();
         return new NameClassPair(entry.name, entry.value.getClass().getName());
     }
 

Modified: tomcat/trunk/java/org/apache/naming/ResourceRef.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/ResourceRef.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/ResourceRef.java (original)
+++ tomcat/trunk/java/org/apache/naming/ResourceRef.java Wed Nov 19 17:39:30 2008
@@ -147,9 +147,9 @@
         sb.append(getFactoryClassLocation());
         sb.append(",factoryClassName=");
         sb.append(getFactoryClassName());
-        Enumeration refAddrs = getAll();
+        Enumeration<RefAddr> refAddrs = getAll();
         while (refAddrs.hasMoreElements()) {
-            RefAddr refAddr = (RefAddr) refAddrs.nextElement();
+            RefAddr refAddr = refAddrs.nextElement();
             sb.append(",{type=");
             sb.append(refAddr.getType());
             sb.append(",content=");

Modified: tomcat/trunk/java/org/apache/naming/SelectorContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/SelectorContext.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/SelectorContext.java (original)
+++ tomcat/trunk/java/org/apache/naming/SelectorContext.java Wed Nov 19 17:39:30 2008
@@ -19,8 +19,11 @@
 package org.apache.naming;
 
 import java.util.Hashtable;
+
+import javax.naming.Binding;
 import javax.naming.Context;
 import javax.naming.Name;
+import javax.naming.NameClassPair;
 import javax.naming.NameParser;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -62,7 +65,7 @@
     /**
      * Builds a Catalina selector context using the given environment.
      */
-    public SelectorContext(Hashtable env) {
+    public SelectorContext(Hashtable<String,Object> env) {
         this.env = env;
     }
 
@@ -70,7 +73,8 @@
     /**
      * Builds a Catalina selector context using the given environment.
      */
-    public SelectorContext(Hashtable env, boolean initialContext) {
+    public SelectorContext(Hashtable<String,Object> env,
+            boolean initialContext) {
         this(env);
         this.initialContext = initialContext;
     }
@@ -82,7 +86,7 @@
     /**
      * Environment.
      */
-    protected Hashtable env;
+    protected Hashtable<String,Object> env;
 
 
     /**
@@ -287,7 +291,7 @@
      * this context. Each element of the enumeration is of type NameClassPair.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration list(Name name)
+    public NamingEnumeration<NameClassPair> list(Name name)
         throws NamingException {
         return getBoundContext().list(parseName(name));
     }
@@ -302,7 +306,7 @@
      * this context. Each element of the enumeration is of type NameClassPair.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration list(String name)
+    public NamingEnumeration<NameClassPair> list(String name)
         throws NamingException {
         return getBoundContext().list(parseName(name));
     }
@@ -321,7 +325,7 @@
      * Each element of the enumeration is of type Binding.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration listBindings(Name name)
+    public NamingEnumeration<Binding> listBindings(Name name)
         throws NamingException {
         return getBoundContext().listBindings(parseName(name));
     }
@@ -336,7 +340,7 @@
      * Each element of the enumeration is of type Binding.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration listBindings(String name)
+    public NamingEnumeration<Binding> listBindings(String name)
         throws NamingException {
         return getBoundContext().listBindings(parseName(name));
     }
@@ -562,7 +566,7 @@
      * @return the environment of this context; never null
      * @exception NamingException if a naming exception is encountered
      */
-    public Hashtable getEnvironment()
+    public Hashtable<?,?> getEnvironment()
         throws NamingException {
         return getBoundContext().getEnvironment();
     }

Modified: tomcat/trunk/java/org/apache/naming/ServiceRef.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/ServiceRef.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/ServiceRef.java (original)
+++ tomcat/trunk/java/org/apache/naming/ServiceRef.java Wed Nov 19 17:39:30 2008
@@ -195,9 +195,9 @@
         sb.append(getFactoryClassLocation());
         sb.append(",factoryClassName=");
         sb.append(getFactoryClassName());
-        Enumeration refAddrs = getAll();
+        Enumeration<RefAddr> refAddrs = getAll();
         while (refAddrs.hasMoreElements()) {
-            RefAddr refAddr = (RefAddr) refAddrs.nextElement();
+            RefAddr refAddr = refAddrs.nextElement();
             sb.append(",{type=");
             sb.append(refAddr.getType());
             sb.append(",content=");

Modified: tomcat/trunk/java/org/apache/naming/StringManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/StringManager.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/StringManager.java (original)
+++ tomcat/trunk/java/org/apache/naming/StringManager.java Wed Nov 19 17:39:30 2008
@@ -113,7 +113,7 @@
             Object nonNullArgs[] = args;
             for (int i=0; i<args.length; i++) {
 		if (args[i] == null) {
-		    if (nonNullArgs==args) nonNullArgs=(Object[])args.clone();
+		    if (nonNullArgs==args) nonNullArgs = args.clone();
 		    nonNullArgs[i] = "null";
 		}
 	    }
@@ -197,7 +197,8 @@
     // STATIC SUPPORT METHODS
     // --------------------------------------------------------------
 
-    private static Hashtable managers = new Hashtable();
+    private static Hashtable<String,StringManager> managers =
+        new Hashtable<String,StringManager>();
 
     /**
      * Get the StringManager for a particular package. If a manager for
@@ -208,7 +209,7 @@
      */
 
     public synchronized static StringManager getManager(String packageName) {
-	StringManager mgr = (StringManager)managers.get(packageName);
+	StringManager mgr = managers.get(packageName);
 	if (mgr == null) {
 	    mgr = new StringManager(packageName);
 	    managers.put(packageName, mgr);

Modified: tomcat/trunk/java/org/apache/naming/factory/BeanFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/factory/BeanFactory.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/factory/BeanFactory.java (original)
+++ tomcat/trunk/java/org/apache/naming/factory/BeanFactory.java Wed Nov 19 17:39:30 2008
@@ -108,7 +108,7 @@
      * @param obj The reference object describing the Bean
      */
     public Object getObjectInstance(Object obj, Name name, Context nameCtx,
-                                    Hashtable environment)
+                                    Hashtable<?,?> environment)
         throws NamingException {
 
         if (obj instanceof ResourceRef) {
@@ -117,7 +117,7 @@
                 
                 Reference ref = (Reference) obj;
                 String beanClassName = ref.getClassName();
-                Class beanClass = null;
+                Class<?> beanClass = null;
                 ClassLoader tcl = 
                     Thread.currentThread().getContextClassLoader();
                 if (tcl != null) {
@@ -142,10 +142,10 @@
                 
                 Object bean = beanClass.newInstance();
                 
-                Enumeration e = ref.getAll();
+                Enumeration<RefAddr> e = ref.getAll();
                 while (e.hasMoreElements()) {
                     
-                    RefAddr ra = (RefAddr) e.nextElement();
+                    RefAddr ra = e.nextElement();
                     String propName = ra.getType();
                     
                     if (propName.equals(Constants.FACTORY) ||
@@ -162,7 +162,7 @@
 
                         if (pda[i].getName().equals(propName)) {
 
-                            Class propType = pda[i].getPropertyType();
+                            Class<?> propType = pda[i].getPropertyType();
 
                             if (propType.equals(String.class)) {
                                 valueArray[0] = value;

Modified: tomcat/trunk/java/org/apache/naming/factory/EjbFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/factory/EjbFactory.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/factory/EjbFactory.java (original)
+++ tomcat/trunk/java/org/apache/naming/factory/EjbFactory.java Wed Nov 19 17:39:30 2008
@@ -60,7 +60,7 @@
      * @param obj The reference object describing the DataSource
      */
     public Object getObjectInstance(Object obj, Name name, Context nameCtx,
-                                    Hashtable environment)
+                                    Hashtable<?,?> environment)
         throws Exception {
         
         if (obj instanceof EjbRef) {
@@ -110,7 +110,7 @@
                 // Loading factory
                 ClassLoader tcl = 
                     Thread.currentThread().getContextClassLoader();
-                Class factoryClass = null;
+                Class<?> factoryClass = null;
                 if (tcl != null) {
                     try {
                         factoryClass = tcl.loadClass(factoryClassName);

Modified: tomcat/trunk/java/org/apache/naming/factory/MailSessionFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/factory/MailSessionFactory.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/factory/MailSessionFactory.java (original)
+++ tomcat/trunk/java/org/apache/naming/factory/MailSessionFactory.java Wed Nov 19 17:39:30 2008
@@ -89,7 +89,7 @@
      * @exception Exception if an error occurs during object creation
      */
     public Object getObjectInstance(Object refObj, Name name, Context context,
-				    Hashtable env) throws Exception 
+				    Hashtable<?,?> env) throws Exception 
     {
 
         // Return null if we cannot create an object of the requested type
@@ -102,8 +102,8 @@
         // exceptions.
         //
         // Bugzilla 31288, 33077: add support for authentication.
-        return AccessController.doPrivileged( new PrivilegedAction() {
-		public Object run() {
+        return AccessController.doPrivileged(new PrivilegedAction<Session>() {
+		public Session run() {
 
                     // Create the JavaMail properties we will use
                     Properties props = new Properties();
@@ -112,9 +112,9 @@
 
                     String password = null;
 
-                    Enumeration attrs = ref.getAll();
+                    Enumeration<RefAddr> attrs = ref.getAll();
                     while (attrs.hasMoreElements()) {
-                        RefAddr attr = (RefAddr) attrs.nextElement();
+                        RefAddr attr = attrs.nextElement();
                         if ("factory".equals(attr.getType())) {
                             continue;
                         }
@@ -124,7 +124,7 @@
                             continue;
                         }
 
-                        props.put(attr.getType(), (String) attr.getContent());
+                        props.put(attr.getType(), attr.getContent());
                     }
 
                     Authenticator auth = null;

Modified: tomcat/trunk/java/org/apache/naming/factory/OpenEjbFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/factory/OpenEjbFactory.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/factory/OpenEjbFactory.java (original)
+++ tomcat/trunk/java/org/apache/naming/factory/OpenEjbFactory.java Wed Nov 19 17:39:30 2008
@@ -55,7 +55,7 @@
      * @param obj The reference object describing the DataSource
      */
     public Object getObjectInstance(Object obj, Name name, Context nameCtx,
-                                    Hashtable environment)
+                                    Hashtable<?,?> environment)
         throws Exception {
 
         Object beanObj = null;

Modified: tomcat/trunk/java/org/apache/naming/factory/ResourceEnvFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/factory/ResourceEnvFactory.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/factory/ResourceEnvFactory.java (original)
+++ tomcat/trunk/java/org/apache/naming/factory/ResourceEnvFactory.java Wed Nov 19 17:39:30 2008
@@ -59,7 +59,7 @@
      * @param obj The reference object describing the DataSource
      */
     public Object getObjectInstance(Object obj, Name name, Context nameCtx,
-                                    Hashtable environment)
+                                    Hashtable<?,?> environment)
         throws Exception {
         
         if (obj instanceof ResourceEnvRef) {
@@ -73,7 +73,7 @@
                 // Loading factory
                 ClassLoader tcl = 
                     Thread.currentThread().getContextClassLoader();
-                Class factoryClass = null;
+                Class<?> factoryClass = null;
                 if (tcl != null) {
                     try {
                         factoryClass = tcl.loadClass(factoryClassName);

Modified: tomcat/trunk/java/org/apache/naming/factory/ResourceFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/factory/ResourceFactory.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/factory/ResourceFactory.java (original)
+++ tomcat/trunk/java/org/apache/naming/factory/ResourceFactory.java Wed Nov 19 17:39:30 2008
@@ -59,7 +59,7 @@
      * @param obj The reference object describing the DataSource
      */
     public Object getObjectInstance(Object obj, Name name, Context nameCtx,
-                                    Hashtable environment)
+                                    Hashtable<?,?> environment)
         throws Exception {
         
         if (obj instanceof ResourceRef) {
@@ -73,7 +73,7 @@
                 // Loading factory
                 ClassLoader tcl = 
                     Thread.currentThread().getContextClassLoader();
-                Class factoryClass = null;
+                Class<?> factoryClass = null;
                 if (tcl != null) {
                     try {
                         factoryClass = tcl.loadClass(factoryClassName);

Modified: tomcat/trunk/java/org/apache/naming/factory/ResourceLinkFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/factory/ResourceLinkFactory.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/factory/ResourceLinkFactory.java (original)
+++ tomcat/trunk/java/org/apache/naming/factory/ResourceLinkFactory.java Wed Nov 19 17:39:30 2008
@@ -77,7 +77,7 @@
      * @param obj The reference object describing the DataSource
      */
     public Object getObjectInstance(Object obj, Name name, Context nameCtx,
-                                    Hashtable environment)
+                                    Hashtable<?,?> environment)
         throws NamingException {
         
         if (!(obj instanceof ResourceLinkRef))

Modified: tomcat/trunk/java/org/apache/naming/factory/SendMailFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/factory/SendMailFactory.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/factory/SendMailFactory.java (original)
+++ tomcat/trunk/java/org/apache/naming/factory/SendMailFactory.java Wed Nov 19 17:39:30 2008
@@ -80,7 +80,7 @@
 	"javax.mail.internet.MimePartDataSource";
 
     public Object getObjectInstance(Object RefObj, Name Nm, Context Ctx,
-				    Hashtable Env) throws Exception 
+				    Hashtable<?,?> Env) throws Exception 
     {
 	final Reference Ref = (Reference)RefObj;
 
@@ -88,23 +88,24 @@
 	// so that javamail can read its default properties without
 	// throwing Security Exceptions
 	if (Ref.getClassName().equals(DataSourceClassName)) {
-	    return AccessController.doPrivileged( new PrivilegedAction()
+	    return AccessController.doPrivileged(
+	            new PrivilegedAction<MimePartDataSource>()
 	    {
-		public Object run() {
+		public MimePartDataSource run() {
         	    // set up the smtp session that will send the message
 	            Properties props = new Properties();
 		    // enumeration of all refaddr
-		    Enumeration list = Ref.getAll();
+		    Enumeration<RefAddr> list = Ref.getAll();
 		    // current refaddr to be set
 		    RefAddr refaddr;
 	            // set transport to smtp
 	            props.put("mail.transport.protocol", "smtp");
 
 		    while (list.hasMoreElements()) {
-			refaddr = (RefAddr)list.nextElement();
+			refaddr = list.nextElement();
 
 			// set property
-			props.put(refaddr.getType(), (String)refaddr.getContent());
+			props.put(refaddr.getType(), refaddr.getContent());
 		    }
 		    MimeMessage message = new MimeMessage(
 			Session.getInstance(props));

Modified: tomcat/trunk/java/org/apache/naming/factory/TransactionFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/factory/TransactionFactory.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/factory/TransactionFactory.java (original)
+++ tomcat/trunk/java/org/apache/naming/factory/TransactionFactory.java Wed Nov 19 17:39:30 2008
@@ -59,7 +59,7 @@
      * @param obj The reference object describing the DataSource
      */
     public Object getObjectInstance(Object obj, Name name, Context nameCtx,
-                                    Hashtable environment)
+                                    Hashtable<?,?> environment)
         throws Exception {
         
         if (obj instanceof TransactionRef) {
@@ -73,7 +73,7 @@
                 // Loading factory
                 ClassLoader tcl = 
                     Thread.currentThread().getContextClassLoader();
-                Class factoryClass = null;
+                Class<?> factoryClass = null;
                 if (tcl != null) {
                     try {
                         factoryClass = tcl.loadClass(factoryClassName);

Modified: tomcat/trunk/java/org/apache/naming/java/javaURLContextFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/java/javaURLContextFactory.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/java/javaURLContextFactory.java (original)
+++ tomcat/trunk/java/org/apache/naming/java/javaURLContextFactory.java Wed Nov 19 17:39:30 2008
@@ -79,11 +79,11 @@
      * Crete a new Context's instance.
      */
     public Object getObjectInstance(Object obj, Name name, Context nameCtx,
-                                    Hashtable environment)
+                                    Hashtable<?,?> environment)
         throws NamingException {
         if ((ContextBindings.isThreadBound()) || 
             (ContextBindings.isClassLoaderBound())) {
-            return new SelectorContext(environment);
+            return new SelectorContext((Hashtable<String,Object>)environment);
         } else {
             return null;
         }
@@ -93,16 +93,18 @@
     /**
      * Get a new (writable) initial context.
      */
-    public Context getInitialContext(Hashtable environment)
+    public Context getInitialContext(Hashtable<?,?> environment)
         throws NamingException {
         if (ContextBindings.isThreadBound() || 
             (ContextBindings.isClassLoaderBound())) {
             // Redirect the request to the bound initial context
-            return new SelectorContext(environment, true);
+            return new SelectorContext(
+                    (Hashtable<String,Object>)environment, true);
         } else {
             // If the thread is not bound, return a shared writable context
             if (initialContext == null)
-                initialContext = new NamingContext(environment, MAIN);
+                initialContext = new NamingContext(
+                        (Hashtable<String,Object>)environment, MAIN);
             return initialContext;
         }
     }

Modified: tomcat/trunk/java/org/apache/naming/resources/BaseDirContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/BaseDirContext.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/BaseDirContext.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/BaseDirContext.java Wed Nov 19 17:39:30 2008
@@ -20,8 +20,10 @@
 
 import java.util.Hashtable;
 
+import javax.naming.Binding;
 import javax.naming.Context;
 import javax.naming.Name;
+import javax.naming.NameClassPair;
 import javax.naming.NameParser;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -29,6 +31,7 @@
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
 
 import org.apache.naming.NameParserImpl;
 import org.apache.naming.StringManager;
@@ -53,14 +56,14 @@
      * Builds a base directory context.
      */
     public BaseDirContext() {
-        this.env = new Hashtable();
+        this.env = new Hashtable<String,Object>();
     }
 
 
     /**
      * Builds a base directory context using the given environment.
      */
-    public BaseDirContext(Hashtable env) {
+    public BaseDirContext(Hashtable<String,Object> env) {
         this.env = env;
     }
 
@@ -77,7 +80,7 @@
     /**
      * Environment.
      */
-    protected Hashtable env;
+    protected Hashtable<String,Object> env;
 
 
     /**
@@ -221,7 +224,7 @@
      * Allocate resources for this directory context.
      */
     public void allocate() {
-        ; // No action taken by the default implementation
+        // No action taken by the default implementation
     }
 
 
@@ -229,7 +232,7 @@
      * Release any resources allocated for this directory context.
      */
     public void release() {
-        ; // No action taken by the default implementation
+        // No action taken by the default implementation
     }
 
 
@@ -408,7 +411,7 @@
      * this context. Each element of the enumeration is of type NameClassPair.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration list(Name name)
+    public NamingEnumeration<NameClassPair> list(Name name)
         throws NamingException {
         return list(name.toString());
     }
@@ -423,7 +426,7 @@
      * this context. Each element of the enumeration is of type NameClassPair.
      * @exception NamingException if a naming exception is encountered
      */
-    public abstract NamingEnumeration list(String name)
+    public abstract NamingEnumeration<NameClassPair> list(String name)
         throws NamingException;
 
 
@@ -440,7 +443,7 @@
      * Each element of the enumeration is of type Binding.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration listBindings(Name name)
+    public NamingEnumeration<Binding> listBindings(Name name)
         throws NamingException {
         return listBindings(name.toString());
     }
@@ -455,7 +458,7 @@
      * Each element of the enumeration is of type Binding.
      * @exception NamingException if a naming exception is encountered
      */
-    public abstract NamingEnumeration listBindings(String name)
+    public abstract NamingEnumeration<Binding> listBindings(String name)
         throws NamingException;
 
 
@@ -675,7 +678,7 @@
      * @return the environment of this context; never null
      * @exception NamingException if a naming exception is encountered
      */
-    public Hashtable getEnvironment()
+    public Hashtable<String,Object> getEnvironment()
         throws NamingException {
         return env;
     }
@@ -1045,8 +1048,8 @@
      * context named by name.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(Name name, Attributes matchingAttributes,
-                                    String[] attributesToReturn)
+    public NamingEnumeration<SearchResult> search(Name name,
+            Attributes matchingAttributes, String[] attributesToReturn)
         throws NamingException {
         return search(name.toString(), matchingAttributes, attributesToReturn);
     }
@@ -1068,7 +1071,7 @@
      * context named by name.
      * @exception NamingException if a naming exception is encountered
      */
-    public abstract NamingEnumeration search
+    public abstract NamingEnumeration<SearchResult> search
         (String name, Attributes matchingAttributes,
          String[] attributesToReturn)
         throws NamingException;
@@ -1089,8 +1092,8 @@
      * context named by name.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(Name name, Attributes matchingAttributes)
-        throws NamingException {
+    public NamingEnumeration<SearchResult> search(Name name,
+            Attributes matchingAttributes) throws NamingException {
         return search(name.toString(), matchingAttributes);
     }
 
@@ -1108,7 +1111,7 @@
      * context named by name.
      * @exception NamingException if a naming exception is encountered
      */
-    public abstract NamingEnumeration search
+    public abstract NamingEnumeration<SearchResult> search
         (String name, Attributes matchingAttributes)
         throws NamingException;
 
@@ -1132,7 +1135,7 @@
      * contain invalid settings
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search
+    public NamingEnumeration<SearchResult> search
         (Name name, String filter, SearchControls cons)
         throws NamingException {
         return search(name.toString(), filter, cons);
@@ -1158,8 +1161,8 @@
      * contain invalid settings
      * @exception NamingException if a naming exception is encountered
      */
-    public abstract NamingEnumeration search(String name, String filter, 
-                                             SearchControls cons)
+    public abstract NamingEnumeration<SearchResult> search(String name,
+            String filter, SearchControls cons)
         throws NamingException;
 
 
@@ -1187,7 +1190,7 @@
      * represents an invalid search filter
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(Name name, String filterExpr, 
+    public NamingEnumeration<SearchResult> search(Name name, String filterExpr, 
                                     Object[] filterArgs, SearchControls cons)
         throws NamingException {
         return search(name.toString(), filterExpr, filterArgs, cons);
@@ -1218,7 +1221,7 @@
      * represents an invalid search filter
      * @exception NamingException if a naming exception is encountered
      */
-    public abstract NamingEnumeration search
+    public abstract NamingEnumeration<SearchResult> search
         (String name, String filterExpr, 
          Object[] filterArgs, SearchControls cons)
         throws NamingException;

Modified: tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/DirContextURLConnection.java Wed Nov 19 17:39:30 2008
@@ -28,6 +28,7 @@
 import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Vector;
 import javax.naming.NamingException;
@@ -238,7 +239,7 @@
     /**
      * Returns an unmodifiable Map of the header fields.
      */
-    public Map getHeaderFields() {
+    public Map<String,List<String>> getHeaderFields() {
 
       if (!connected) {
           // Try to connect (silently)
@@ -251,15 +252,17 @@
       if (attributes == null)
           return (Collections.EMPTY_MAP);
 
-      HashMap headerFields = new HashMap(attributes.size());
-      NamingEnumeration attributeEnum = attributes.getIDs();
+      HashMap<String,List<String>> headerFields =
+          new HashMap<String,List<String>>(attributes.size());
+      NamingEnumeration<String> attributeEnum = attributes.getIDs();
       try {
           while (attributeEnum.hasMore()) {
-              String attributeID = (String)attributeEnum.next();
+              String attributeID = attributeEnum.next();
               Attribute attribute = attributes.get(attributeID);
               if (attribute == null) continue;
-              ArrayList attributeValueList = new ArrayList(attribute.size());
-              NamingEnumeration attributeValues = attribute.getAll();
+              ArrayList<String> attributeValueList =
+                  new ArrayList<String>(attribute.size());
+              NamingEnumeration<?> attributeValues = attribute.getAll();
               while (attributeValues.hasMore()) {
                   Object attrValue = attributeValues.next();
                   attributeValueList.add(getHeaderValueAsString(attrValue));
@@ -292,10 +295,10 @@
         if (attributes == null)
             return (null);
 
-        NamingEnumeration attributeEnum = attributes.getIDs();
+        NamingEnumeration<String> attributeEnum = attributes.getIDs();
         try {
             while (attributeEnum.hasMore()) {
-                String attributeID = (String)attributeEnum.next();
+                String attributeID = attributeEnum.next();
                 if (attributeID.equalsIgnoreCase(name)) {
                     Attribute attribute = attributes.get(attributeID);
                     if (attribute == null) return null;
@@ -391,7 +394,7 @@
      * List children of this collection. The names given are relative to this
      * URI's path. The full uri of the children is then : path + "/" + name.
      */
-    public Enumeration list()
+    public Enumeration<String> list()
         throws IOException {
         
         if (!connected) {
@@ -402,13 +405,14 @@
             throw new FileNotFoundException();
         }
         
-        Vector result = new Vector();
+        Vector<String> result = new Vector<String>();
         
         if (collection != null) {
             try {
-                NamingEnumeration enumeration = context.list(getURL().getFile());
+                NamingEnumeration<NameClassPair> enumeration =
+                    context.list(getURL().getFile());
                 while (enumeration.hasMoreElements()) {
-                    NameClassPair ncp = (NameClassPair) enumeration.nextElement();
+                    NameClassPair ncp = enumeration.nextElement();
                     result.addElement(ncp.getName());
                 }
             } catch (NamingException e) {

Modified: tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/DirContextURLStreamHandler.java Wed Nov 19 17:39:30 2008
@@ -53,13 +53,15 @@
     /**
      * Bindings class loader - directory context. Keyed by CL id.
      */
-    private static Hashtable clBindings = new Hashtable();
+    private static Hashtable<ClassLoader,DirContext> clBindings =
+        new Hashtable<ClassLoader,DirContext>();
     
     
     /**
      * Bindings thread - directory context. Keyed by thread id.
      */
-    private static Hashtable threadBindings = new Hashtable();
+    private static Hashtable<Thread,DirContext> threadBindings =
+        new Hashtable<Thread,DirContext>();
     
     
     // ----------------------------------------------------- Instance Variables
@@ -203,17 +205,17 @@
         ClassLoader currentCL = currentThread.getContextClassLoader();
 
         // Checking CL binding
-        result = (DirContext) clBindings.get(currentCL);
+        result = clBindings.get(currentCL);
         if (result != null)
             return result;
 
         // Checking thread biding
-        result = (DirContext) threadBindings.get(currentThread);
+        result = threadBindings.get(currentThread);
 
         // Checking parent CL binding
         currentCL = currentCL.getParent();
         while (currentCL != null) {
-            result = (DirContext) clBindings.get(currentCL);
+            result = clBindings.get(currentCL);
             if (result != null)
                 return result;
             currentCL = currentCL.getParent();
@@ -247,7 +249,7 @@
      * Get the bound context.
      */
     public static DirContext get(ClassLoader cl) {
-        return (DirContext) clBindings.get(cl);
+        return clBindings.get(cl);
     }
     
     
@@ -255,7 +257,7 @@
      * Get the bound context.
      */
     public static DirContext get(Thread thread) {
-        return (DirContext) threadBindings.get(thread);
+        return threadBindings.get(thread);
     }
     
     

Modified: tomcat/trunk/java/org/apache/naming/resources/FileDirContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/FileDirContext.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/FileDirContext.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/FileDirContext.java Wed Nov 19 17:39:30 2008
@@ -28,7 +28,9 @@
 import java.util.Date;
 import java.util.Hashtable;
 
+import javax.naming.Binding;
 import javax.naming.NameAlreadyBoundException;
+import javax.naming.NameClassPair;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.OperationNotSupportedException;
@@ -36,6 +38,7 @@
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
 
 import org.apache.naming.NamingContextBindingsEnumeration;
 import org.apache.naming.NamingContextEnumeration;
@@ -76,7 +79,7 @@
     /**
      * Builds a file directory context using the given environment.
      */
-    public FileDirContext(Hashtable env) {
+    public FileDirContext(Hashtable<String,Object> env) {
         super(env);
     }
 
@@ -293,7 +296,7 @@
      * this context. Each element of the enumeration is of type NameClassPair.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration list(String name)
+    public NamingEnumeration<NameClassPair> list(String name)
         throws NamingException {
 
         File file = file(name);
@@ -320,7 +323,7 @@
      * Each element of the enumeration is of type Binding.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration listBindings(String name)
+    public NamingEnumeration<Binding> listBindings(String name)
         throws NamingException {
 
         File file = file(name);
@@ -666,8 +669,8 @@
      * context named by name.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(String name, Attributes matchingAttributes,
-                                    String[] attributesToReturn)
+    public NamingEnumeration<SearchResult> search(String name,
+            Attributes matchingAttributes, String[] attributesToReturn)
         throws NamingException {
         return null;
     }
@@ -688,8 +691,8 @@
      * context named by name.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(String name, Attributes matchingAttributes)
-        throws NamingException {
+    public NamingEnumeration<SearchResult> search(String name,
+            Attributes matchingAttributes) throws NamingException {
         return null;
     }
 
@@ -713,7 +716,7 @@
      * contain invalid settings
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(String name, String filter,
+    public NamingEnumeration<SearchResult> search(String name, String filter,
                                     SearchControls cons)
         throws NamingException {
         return null;
@@ -744,8 +747,8 @@
      * represents an invalid search filter
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(String name, String filterExpr,
-                                    Object[] filterArgs, SearchControls cons)
+    public NamingEnumeration<SearchResult> search(String name,
+            String filterExpr, Object[] filterArgs, SearchControls cons)
         throws NamingException {
         return null;
     }
@@ -884,9 +887,9 @@
      * @param file Collection
      * @return Vector containg NamingEntry objects
      */
-    protected ArrayList list(File file) {
+    protected ArrayList<NamingEntry> list(File file) {
 
-        ArrayList entries = new ArrayList();
+        ArrayList<NamingEntry> entries = new ArrayList<NamingEntry>();
         if (!file.isDirectory())
             return entries;
         String[] names = file.list();

Modified: tomcat/trunk/java/org/apache/naming/resources/ProxyDirContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/ProxyDirContext.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/ProxyDirContext.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/ProxyDirContext.java Wed Nov 19 17:39:30 2008
@@ -35,6 +35,7 @@
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
 
 import org.apache.naming.StringManager;
 
@@ -61,7 +62,8 @@
     /**
      * Builds a proxy directory context using the given environment.
      */
-    public ProxyDirContext(Hashtable env, DirContext dirContext) {
+    public ProxyDirContext(Hashtable<String,String> env,
+            DirContext dirContext) {
         this.env = env;
         this.dirContext = dirContext;
         if (dirContext instanceof BaseDirContext) {
@@ -86,8 +88,8 @@
                 }
             }
         }
-        hostName = (String) env.get(HOST);
-        contextName = (String) env.get(CONTEXT);
+        hostName = env.get(HOST);
+        contextName = env.get(CONTEXT);
     }
 
 
@@ -126,7 +128,7 @@
     /**
      * Environment.
      */
-    protected Hashtable env;
+    protected Hashtable<String,String> env;
 
 
     /**
@@ -750,7 +752,7 @@
      * @return the environment of this context; never null
      * @exception NamingException if a naming exception is encountered
      */
-    public Hashtable getEnvironment()
+    public Hashtable<?,?> getEnvironment()
         throws NamingException {
         return dirContext.getEnvironment();
     }
@@ -1183,8 +1185,8 @@
      * context named by name.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(Name name, Attributes matchingAttributes,
-                                    String[] attributesToReturn)
+    public NamingEnumeration<SearchResult> search(Name name,
+            Attributes matchingAttributes, String[] attributesToReturn)
         throws NamingException {
         return dirContext.search(parseName(name), matchingAttributes, 
                                  attributesToReturn);
@@ -1207,8 +1209,8 @@
      * context named by name.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(String name, Attributes matchingAttributes,
-                                    String[] attributesToReturn)
+    public NamingEnumeration<SearchResult> search(String name,
+            Attributes matchingAttributes, String[] attributesToReturn)
         throws NamingException {
         return dirContext.search(parseName(name), matchingAttributes, 
                                  attributesToReturn);
@@ -1230,8 +1232,8 @@
      * context named by name.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(Name name, Attributes matchingAttributes)
-        throws NamingException {
+    public NamingEnumeration<SearchResult> search(Name name,
+            Attributes matchingAttributes) throws NamingException {
         return dirContext.search(parseName(name), matchingAttributes);
     }
 
@@ -1249,8 +1251,8 @@
      * context named by name.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(String name, Attributes matchingAttributes)
-        throws NamingException {
+    public NamingEnumeration<SearchResult> search(String name,
+            Attributes matchingAttributes) throws NamingException {
         return dirContext.search(parseName(name), matchingAttributes);
     }
 
@@ -1274,7 +1276,7 @@
      * contain invalid settings
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(Name name, String filter, 
+    public NamingEnumeration<SearchResult> search(Name name, String filter, 
                                     SearchControls cons)
         throws NamingException {
         return dirContext.search(parseName(name), filter, cons);
@@ -1300,7 +1302,7 @@
      * contain invalid settings
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(String name, String filter, 
+    public NamingEnumeration<SearchResult> search(String name, String filter, 
                                     SearchControls cons)
         throws NamingException {
         return dirContext.search(parseName(name), filter, cons);
@@ -1331,7 +1333,7 @@
      * represents an invalid search filter
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(Name name, String filterExpr,
+    public NamingEnumeration<SearchResult> search(Name name, String filterExpr,
                                     Object[] filterArgs, SearchControls cons)
         throws NamingException {
         return dirContext.search(parseName(name), filterExpr, filterArgs, 
@@ -1363,8 +1365,8 @@
      * represents an invalid search filter
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(String name, String filterExpr,
-                                    Object[] filterArgs, SearchControls cons)
+    public NamingEnumeration<SearchResult> search(String name,
+            String filterExpr, Object[] filterArgs, SearchControls cons)
         throws NamingException {
         return dirContext.search(parseName(name), filterExpr, filterArgs, 
                                  cons);
@@ -1584,13 +1586,13 @@
                 }
                 entry.resource.setContent(b);
             } catch (IOException e) {
-                ; // Ignore
+                // Ignore
             } finally {
                 try {
                     if (is != null)
                         is.close();
                 } catch (IOException e) {
-                    ; // Ignore
+                    // Ignore
                 }
             }
         }

Modified: tomcat/trunk/java/org/apache/naming/resources/RecyclableNamingEnumeration.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/RecyclableNamingEnumeration.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/RecyclableNamingEnumeration.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/RecyclableNamingEnumeration.java Wed Nov 19 17:39:30 2008
@@ -31,14 +31,14 @@
  * @version $Revision$ $Date$
  */
 
-public class RecyclableNamingEnumeration 
-    implements NamingEnumeration {
+public class RecyclableNamingEnumeration<E> 
+    implements NamingEnumeration<E> {
 
 
     // ----------------------------------------------------------- Constructors
 
 
-    public RecyclableNamingEnumeration(Vector entries) {
+    public RecyclableNamingEnumeration(Vector<E> entries) {
         this.entries = entries;
         recycle();
     }
@@ -50,13 +50,13 @@
     /**
      * Entries.
      */
-    protected Vector entries;
+    protected Vector<E> entries;
 
 
     /**
      * Underlying enumeration.
      */
-    protected Enumeration enumeration;
+    protected Enumeration<E> enumeration;
 
 
     // --------------------------------------------------------- Public Methods
@@ -65,7 +65,7 @@
     /**
      * Retrieves the next element in the enumeration.
      */
-    public Object next()
+    public E next()
         throws NamingException {
         return nextElement();
     }
@@ -93,7 +93,7 @@
     }
 
 
-    public Object nextElement() {
+    public E nextElement() {
         return enumeration.nextElement();
     }
 

Modified: tomcat/trunk/java/org/apache/naming/resources/ResourceAttributes.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/ResourceAttributes.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/ResourceAttributes.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/ResourceAttributes.java Wed Nov 19 17:39:30 2008
@@ -311,11 +311,11 @@
                         try {
                             contentLength = Long.parseLong(value.toString());
                         } catch (NumberFormatException e) {
-                            ; // Ignore
+                            // Ignore
                         }
                     }
                 } catch (NamingException e) {
-                    ; // No value for the attribute
+                    // No value for the attribute
                 }
             }
         }
@@ -364,7 +364,7 @@
                             try {
                                 result = formats[i].parse(creationDateValue);
                             } catch (ParseException e) {
-                                ;
+                                // Ignore
                             }
                         }
                         if (result != null) {
@@ -373,7 +373,7 @@
                         }
                     }
                 } catch (NamingException e) {
-                    ; // No value for the attribute
+                    // No value for the attribute
                 }
             }
         }
@@ -426,7 +426,7 @@
                             try {
                                 result = formats[i].parse(creationDateValue);
                             } catch (ParseException e) {
-                                ;
+                                // Ignore
                             }
                         }
                         if (result != null) {
@@ -435,7 +435,7 @@
                         }
                     }
                 } catch (NamingException e) {
-                    ; // No value for the attribute
+                    // No value for the attribute
                 }
             }
         }
@@ -486,7 +486,7 @@
                                 result = 
                                     formats[i].parse(lastModifiedDateValue);
                             } catch (ParseException e) {
-                                ;
+                                // Ignore
                             }
                         }
                         if (result != null) {
@@ -495,7 +495,7 @@
                         }
                     }
                 } catch (NamingException e) {
-                    ; // No value for the attribute
+                    // No value for the attribute
                 }
             }
         }
@@ -560,7 +560,7 @@
                                 result = 
                                     formats[i].parse(lastModifiedDateValue);
                             } catch (ParseException e) {
-                                ;
+                                // Ignore
                             }
                         }
                         if (result != null) {
@@ -569,7 +569,7 @@
                         }
                     }
                 } catch (NamingException e) {
-                    ; // No value for the attribute
+                    // No value for the attribute
                 }
             }
         }
@@ -648,7 +648,7 @@
                 try {
                     name = attribute.get().toString();
                 } catch (NamingException e) {
-                    ; // No value for the attribute
+                    // No value for the attribute
                 }
             }
         }
@@ -681,7 +681,7 @@
                 try {
                     result = attribute.get().toString();
                 } catch (NamingException e) {
-                    ; // No value for the attribute
+                    // No value for the attribute
                 }
             }
         }
@@ -720,7 +720,7 @@
                 try {
                     result = attribute.get().toString();
                 } catch (NamingException e) {
-                    ; // No value for the attribute
+                    // No value for the attribute
                 }
             }
         }
@@ -870,9 +870,9 @@
     /**
      * Get all attributes.
      */
-    public NamingEnumeration getAll() {
+    public NamingEnumeration<? extends Attribute> getAll() {
         if (attributes == null) {
-            Vector attributes = new Vector();
+            Vector<BasicAttribute> attributes = new Vector<BasicAttribute>();
             Date creationDate = getCreationDate();
             if (creationDate != null) {
                 attributes.addElement(new BasicAttribute
@@ -907,7 +907,7 @@
                 attributes.addElement(new BasicAttribute(ETAG, etag));
                 attributes.addElement(new BasicAttribute(ALTERNATE_ETAG, etag));
             }
-            return new RecyclableNamingEnumeration(attributes);
+            return new RecyclableNamingEnumeration<BasicAttribute>(attributes);
         } else {
             return attributes.getAll();
         }
@@ -917,9 +917,9 @@
     /**
      * Get all attribute IDs.
      */
-    public NamingEnumeration getIDs() {
+    public NamingEnumeration<String> getIDs() {
         if (attributes == null) {
-            Vector attributeIDs = new Vector();
+            Vector<String> attributeIDs = new Vector<String>();
             Date creationDate = getCreationDate();
             if (creationDate != null) {
                 attributeIDs.addElement(CREATION_DATE);
@@ -948,7 +948,7 @@
                 attributeIDs.addElement(ETAG);
                 attributeIDs.addElement(ALTERNATE_ETAG);
             }
-            return new RecyclableNamingEnumeration(attributeIDs);
+            return new RecyclableNamingEnumeration<String>(attributeIDs);
         } else {
             return attributes.getIDs();
         }

Modified: tomcat/trunk/java/org/apache/naming/resources/ResourceCache.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/ResourceCache.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/ResourceCache.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/ResourceCache.java Wed Nov 19 17:39:30 2008
@@ -56,7 +56,8 @@
     /**
      * Not found cache.
      */
-    protected HashMap notFoundCache = new HashMap();
+    protected HashMap<String,CacheEntry> notFoundCache =
+        new HashMap<String,CacheEntry>();
 
 
     /**
@@ -298,7 +299,7 @@
         }
         if (cacheEntry == null) {
             try {
-                cacheEntry = (CacheEntry) notFoundCache.get(name);
+                cacheEntry = notFoundCache.get(name);
             } catch (Exception e) {
                 // Ignore: the reliability of this lookup is not critical
             }

Modified: tomcat/trunk/java/org/apache/naming/resources/WARDirContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/WARDirContext.java?rev=719153&r1=719152&r2=719153&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/WARDirContext.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/WARDirContext.java Wed Nov 19 17:39:30 2008
@@ -30,8 +30,10 @@
 import java.util.zip.ZipException;
 import java.util.zip.ZipFile;
 
+import javax.naming.Binding;
 import javax.naming.CompositeName;
 import javax.naming.Name;
+import javax.naming.NameClassPair;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.OperationNotSupportedException;
@@ -39,6 +41,7 @@
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
 
 import org.apache.naming.NamingContextBindingsEnumeration;
 import org.apache.naming.NamingContextEnumeration;
@@ -70,7 +73,7 @@
     /**
      * Builds a WAR directory context using the given environment.
      */
-    public WARDirContext(Hashtable env) {
+    public WARDirContext(Hashtable<String,Object> env) {
         super(env);
     }
 
@@ -257,7 +260,7 @@
      * this context. Each element of the enumeration is of type NameClassPair.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration list(String name)
+    public NamingEnumeration<NameClassPair> list(String name)
         throws NamingException {
         return list(new CompositeName(name));
     }
@@ -276,7 +279,7 @@
      * this context. Each element of the enumeration is of type NameClassPair.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration list(Name name)
+    public NamingEnumeration<NameClassPair> list(Name name)
         throws NamingException {
         if (name.isEmpty())
             return new NamingContextEnumeration(list(entries).iterator());
@@ -301,7 +304,7 @@
      * Each element of the enumeration is of type Binding.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration listBindings(String name)
+    public NamingEnumeration<Binding> listBindings(String name)
         throws NamingException {
         return listBindings(new CompositeName(name));
     }
@@ -320,7 +323,7 @@
      * Each element of the enumeration is of type Binding.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration listBindings(Name name)
+    public NamingEnumeration<Binding> listBindings(Name name)
         throws NamingException {
         if (name.isEmpty())
             return new NamingContextBindingsEnumeration(list(entries).iterator(),
@@ -622,8 +625,8 @@
      * context named by name.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(String name, Attributes matchingAttributes,
-                                    String[] attributesToReturn)
+    public NamingEnumeration<SearchResult> search(String name,
+            Attributes matchingAttributes, String[] attributesToReturn)
         throws NamingException {
         throw new OperationNotSupportedException();
     }
@@ -644,8 +647,8 @@
      * context named by name.
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(String name, Attributes matchingAttributes)
-        throws NamingException {
+    public NamingEnumeration<SearchResult> search(String name,
+            Attributes matchingAttributes) throws NamingException {
         throw new OperationNotSupportedException();
     }
 
@@ -669,7 +672,7 @@
      * contain invalid settings
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(String name, String filter, 
+    public NamingEnumeration<SearchResult> search(String name, String filter, 
                                     SearchControls cons)
         throws NamingException {
         throw new OperationNotSupportedException();
@@ -700,7 +703,7 @@
      * represents an invalid search filter
      * @exception NamingException if a naming exception is encountered
      */
-    public NamingEnumeration search(String name, String filterExpr, 
+    public NamingEnumeration<SearchResult> search(String name, String filterExpr, 
                                     Object[] filterArgs, SearchControls cons)
         throws NamingException {
         throw new OperationNotSupportedException();
@@ -731,12 +734,12 @@
 
         try {
 
-            Enumeration entryList = base.entries();
+            Enumeration<? extends ZipEntry> entryList = base.entries();
             entries = new Entry("/", new ZipEntry("/"));
             
             while (entryList.hasMoreElements()) {
                 
-                ZipEntry entry = (ZipEntry) entryList.nextElement();
+                ZipEntry entry = entryList.nextElement();
                 String name = normalize(entry);
                 int pos = name.lastIndexOf('/');
                 // Check that parent entries exist and, if not, create them.
@@ -801,9 +804,9 @@
     /**
      * List children as objects.
      */
-    protected ArrayList list(Entry entry) {
+    protected ArrayList<NamingEntry> list(Entry entry) {
         
-        ArrayList entries = new ArrayList();
+        ArrayList<NamingEntry> entries = new ArrayList<NamingEntry>();
         Entry[] children = entry.getChildren();
         Arrays.sort(children);
         NamingEntry namingEntry = null;
@@ -832,7 +835,7 @@
     /**
      * Entries structure.
      */
-    protected class Entry implements Comparable {
+    protected class Entry implements Comparable<Object> {
 
 
         // -------------------------------------------------------- Constructor



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message