|
From: <ls...@us...> - 2007-01-07 08:23:00
|
Revision: 3001
http://jnode.svn.sourceforge.net/jnode/?rev=3001&view=rev
Author: lsantha
Date: 2007-01-07 00:22:57 -0800 (Sun, 07 Jan 2007)
Log Message:
-----------
Classpath patches.
Modified Paths:
--------------
trunk/core/src/classpath/javax/javax/naming/CannotProceedException.java
trunk/core/src/classpath/javax/javax/naming/CompositeName.java
trunk/core/src/classpath/javax/javax/naming/CompoundName.java
trunk/core/src/classpath/javax/javax/naming/Context.java
trunk/core/src/classpath/javax/javax/naming/InitialContext.java
trunk/core/src/classpath/javax/javax/naming/Name.java
trunk/core/src/classpath/javax/javax/naming/NamingEnumeration.java
trunk/core/src/classpath/javax/javax/naming/Reference.java
trunk/core/src/classpath/javax/javax/naming/ReferralException.java
trunk/core/src/classpath/javax/javax/naming/directory/Attribute.java
trunk/core/src/classpath/javax/javax/naming/directory/Attributes.java
trunk/core/src/classpath/javax/javax/naming/directory/BasicAttribute.java
trunk/core/src/classpath/javax/javax/naming/directory/BasicAttributes.java
trunk/core/src/classpath/javax/javax/naming/directory/DirContext.java
trunk/core/src/classpath/javax/javax/naming/directory/InitialDirContext.java
trunk/core/src/classpath/javax/javax/naming/ldap/ControlFactory.java
trunk/core/src/classpath/javax/javax/naming/ldap/InitialLdapContext.java
trunk/core/src/classpath/javax/javax/naming/ldap/LdapReferralException.java
trunk/core/src/classpath/javax/javax/naming/spi/DirObjectFactory.java
trunk/core/src/classpath/javax/javax/naming/spi/DirStateFactory.java
trunk/core/src/classpath/javax/javax/naming/spi/DirectoryManager.java
trunk/core/src/classpath/javax/javax/naming/spi/InitialContextFactory.java
trunk/core/src/classpath/javax/javax/naming/spi/InitialContextFactoryBuilder.java
trunk/core/src/classpath/javax/javax/naming/spi/NamingManager.java
trunk/core/src/classpath/javax/javax/naming/spi/ObjectFactory.java
trunk/core/src/classpath/javax/javax/naming/spi/ObjectFactoryBuilder.java
trunk/core/src/classpath/javax/javax/naming/spi/Resolver.java
trunk/core/src/classpath/javax/javax/naming/spi/StateFactory.java
Modified: trunk/core/src/classpath/javax/javax/naming/CannotProceedException.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/CannotProceedException.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/CannotProceedException.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -51,7 +51,7 @@
// Serialized fields.
protected Name remainingNewName;
- protected Hashtable environment;
+ protected Hashtable<?, ?> environment;
protected Name altName;
protected Context altNameCtx;
@@ -65,12 +65,12 @@
super (msg);
}
- public Hashtable getEnvironment()
+ public Hashtable<?, ?> getEnvironment()
{
return environment;
}
- public void setEnvironment(Hashtable environment)
+ public void setEnvironment(Hashtable<?, ?> environment)
{
this.environment = environment;
}
Modified: trunk/core/src/classpath/javax/javax/naming/CompositeName.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/CompositeName.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/CompositeName.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -58,16 +58,16 @@
{
private static final long serialVersionUID = 1667768148915813118L;
- private transient Vector elts;
+ private transient Vector<String> elts;
public CompositeName ()
{
- elts = new Vector ();
+ elts = new Vector<String> ();
}
- protected CompositeName (Enumeration comps)
+ protected CompositeName (Enumeration<String> comps)
{
- elts = new Vector ();
+ elts = new Vector<String> ();
try
{
while (comps.hasMoreElements ())
@@ -80,7 +80,7 @@
public CompositeName (String n) throws InvalidNameException
{
- elts = new Vector ();
+ elts = new Vector<String> ();
// Parse the string into its components.
final char no_quote = 'x'; // Use 'x' to mean no quoting.
char quote = no_quote;
@@ -151,7 +151,7 @@
public Name addAll (int posn, Name n) throws InvalidNameException
{
- Enumeration e = n.getAll ();
+ Enumeration<String> e = n.getAll ();
try
{
while (e.hasMoreElements ())
@@ -168,7 +168,7 @@
public Name addAll (Name suffix) throws InvalidNameException
{
- Enumeration e = suffix.getAll ();
+ Enumeration<String> e = suffix.getAll ();
try
{
while (e.hasMoreElements ())
@@ -193,8 +193,8 @@
int last = Math.min (cn.elts.size (), elts.size ());
for (int i = 0; i < last; ++i)
{
- String f = (String) elts.get (i);
- int comp = f.compareTo ((String) cn.elts.get (i));
+ String f = elts.get (i);
+ int comp = f.compareTo (cn.elts.get (i));
if (comp != 0)
return comp;
}
@@ -227,10 +227,10 @@
public String get (int posn)
{
- return (String) elts.get (posn);
+ return elts.get (posn);
}
- public Enumeration getAll ()
+ public Enumeration<String> getAll ()
{
return elts.elements ();
}
@@ -239,7 +239,7 @@
{
CompositeName cn = new CompositeName ();
for (int i = 0; i < posn; ++i)
- cn.elts.add ((String) elts.get (i));
+ cn.elts.add (elts.get (i));
return cn;
}
@@ -249,7 +249,7 @@
throw new ArrayIndexOutOfBoundsException (posn);
CompositeName cn = new CompositeName ();
for (int i = posn; i < elts.size (); ++i)
- cn.elts.add ((String) elts.get (i));
+ cn.elts.add (elts.get (i));
return cn;
}
@@ -299,7 +299,7 @@
{
// For simplicity we choose to always quote using escapes and
// never quotes.
- String elt = (String) elts.get (i);
+ String elt = elts.get (i);
if (i > 0
|| (i == elts.size () - 1 && elt.equals ("")))
result.append ('/');
@@ -327,9 +327,9 @@
throws IOException, ClassNotFoundException
{
int size = s.readInt();
- elts = new Vector(size);
+ elts = new Vector<String>(size);
for (int i = 0; i < size; i++)
- elts.add(s.readObject());
+ elts.add((String) s.readObject());
}
private void writeObject(ObjectOutputStream s) throws IOException
Modified: trunk/core/src/classpath/javax/javax/naming/CompoundName.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/CompoundName.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/CompoundName.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -68,14 +68,14 @@
private CompoundName (Properties syntax)
{
- elts = new Vector ();
+ elts = new Vector<String> ();
mySyntax = syntax;
initializeSyntax ();
}
- protected CompoundName (Enumeration comps, Properties syntax)
+ protected CompoundName (Enumeration<String> comps, Properties syntax)
{
- elts = new Vector ();
+ elts = new Vector<String> ();
mySyntax = syntax;
initializeSyntax ();
try
@@ -91,7 +91,7 @@
public CompoundName (String n, Properties syntax)
throws InvalidNameException
{
- elts = new Vector ();
+ elts = new Vector<String> ();
mySyntax = syntax;
initializeSyntax ();
@@ -186,7 +186,7 @@
int len = elts.size ();
for (i = 0; i < len / 2; ++i)
{
- Object t = elts.set (i, elts.get (len - i - 1));
+ String t = elts.set (i, elts.get (len - i - 1));
elts.set (len - i - 1, t);
}
}
@@ -210,7 +210,7 @@
public Name addAll (int posn, Name n) throws InvalidNameException
{
- Enumeration e = n.getAll ();
+ Enumeration<String> e = n.getAll ();
try
{
while (e.hasMoreElements ())
@@ -227,7 +227,7 @@
public Name addAll (Name suffix) throws InvalidNameException
{
- Enumeration e = suffix.getAll ();
+ Enumeration<String> e = suffix.getAll ();
try
{
while (e.hasMoreElements ())
@@ -252,8 +252,8 @@
int last = Math.min (cn.elts.size (), elts.size ());
for (int i = 0; i < last; ++i)
{
- String f = canonicalize ((String) elts.get (i));
- int comp = f.compareTo (canonicalize ((String) cn.elts.get (i)));
+ String f = canonicalize (elts.get (i));
+ int comp = f.compareTo (canonicalize (cn.elts.get (i)));
if (comp != 0)
return comp;
}
@@ -270,8 +270,8 @@
int delta = elts.size () - cn.elts.size ();
for (int i = 0; i < cn.elts.size (); ++i)
{
- String f = canonicalize ((String) elts.get (delta + i));
- if (! f.equals (canonicalize ((String) cn.elts.get (i))))
+ String f = canonicalize (elts.get (delta + i));
+ if (! f.equals (canonicalize (cn.elts.get (i))))
return false;
}
return true;
@@ -286,10 +286,10 @@
public String get (int posn)
{
- return (String) elts.get (posn);
+ return elts.get (posn);
}
- public Enumeration getAll ()
+ public Enumeration<String> getAll ()
{
return elts.elements ();
}
@@ -316,7 +316,7 @@
{
int h = 0;
for (int i = 0; i < elts.size (); ++i)
- h += canonicalize ((String) elts.get (i)).hashCode ();
+ h += canonicalize (elts.get (i)).hashCode ();
return h;
}
@@ -344,8 +344,8 @@
return false;
for (int i = 0; i < cn.elts.size (); ++i)
{
- String f = canonicalize ((String) elts.get (i));
- if (! f.equals (canonicalize ((String) cn.elts.get (i))))
+ String f = canonicalize (elts.get (i));
+ if (! f.equals (canonicalize (cn.elts.get (i))))
return false;
}
return true;
@@ -383,7 +383,7 @@
// Find the appropriate element. FIXME: not clear what FLAT
// means.
int offset = (direction == RIGHT_TO_LEFT) ? (size - i - 1) : i;
- String element = (String) elts.get (offset);
+ String element = elts.get (offset);
if (i > 0
|| (i == size - 1 && element.equals ("")))
result.append (separator);
@@ -478,7 +478,7 @@
{
mySyntax = (Properties) s.readObject();
int count = s.readInt();
- elts = new Vector(count);
+ elts = new Vector<String>(count);
for (int i = 0; i < count; i++)
elts.addElement((String) s.readObject());
}
@@ -499,7 +499,7 @@
protected transient Properties mySyntax;
// The actual elements.
- private transient Vector elts;
+ private transient Vector<String> elts;
// The following are all used for syntax.
private transient int direction;
Modified: trunk/core/src/classpath/javax/javax/naming/Context.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/Context.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/Context.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -270,7 +270,7 @@
* @return the enumeration over the names, known for the given subcontext.
* @throws NamingException
*/
- NamingEnumeration list(Name name) throws NamingException;
+ NamingEnumeration<NameClassPair> list(Name name) throws NamingException;
/**
* Creates and returns the enumeration over the name bindings that are present
@@ -284,7 +284,7 @@
* @return the enumeration over the names, known for the given subcontext.
* @throws NamingException
*/
- NamingEnumeration list(String name) throws NamingException;
+ NamingEnumeration<NameClassPair> list(String name) throws NamingException;
/**
* Creates and returns the enumeration over the name - object bindings that
@@ -297,7 +297,7 @@
* @return the enumeration over the names, known for the given subcontext.
* @throws NamingException
*/
- NamingEnumeration listBindings(Name name) throws NamingException;
+ NamingEnumeration<Binding> listBindings(Name name) throws NamingException;
/**
* Creates and returns the enumeration over the name - object bindings that
@@ -310,7 +310,7 @@
* @return the enumeration over the names, known for the given subcontext.
* @throws NamingException
*/
- NamingEnumeration listBindings(String name) throws NamingException;
+ NamingEnumeration<Binding> listBindings(String name) throws NamingException;
/**
* Creates the new naming subcontext and binds it to the current (this)
@@ -467,7 +467,7 @@
* @return the table, representing the environment of this context
* @throws NamingException
*/
- Hashtable getEnvironment() throws NamingException;
+ Hashtable<?,?> getEnvironment() throws NamingException;
/**
* Releases all resources, associated with this context. The close() method
Modified: trunk/core/src/classpath/javax/javax/naming/InitialContext.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/InitialContext.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/InitialContext.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -73,21 +73,21 @@
/**
* The environment, associated with this initial context.
*/
- protected Hashtable myProps;
+ protected Hashtable<Object,Object> myProps;
/**
* The list of the properties, to that the second alternative value must
* be appended after the colon to the first possible value. Used in
* {@link #merge(Hashtable, Hashtable)}
*/
- static final HashSet colon_list;
+ static final HashSet<String> colon_list;
static
{
- colon_list = new HashSet();
+ colon_list = new HashSet<String>();
colon_list.add(Context.OBJECT_FACTORIES);
colon_list.add(Context.URL_PKG_PREFIXES);
colon_list.add(Context.STATE_FACTORIES);
- };
+ }
/**
* The properties that are searched in the agreed places in the
@@ -111,7 +111,7 @@
* created.
* @throws NamingException
*/
- public InitialContext(Hashtable environment) throws NamingException
+ public InitialContext(Hashtable<?,?> environment) throws NamingException
{
init(environment);
}
@@ -166,13 +166,13 @@
* not later reuse this structure for other purposes.
* @since 1.3
*/
- protected void init(Hashtable environment) throws NamingException
+ protected void init(Hashtable<?, ?> environment) throws NamingException
{
// If is documented that the caller should not modify the environment.
if (environment != null)
- myProps = environment;
+ myProps = (Hashtable<Object, Object>) environment;
else
- myProps = new Hashtable();
+ myProps = new Hashtable<Object, Object>();
Applet napplet = (Applet) myProps.get(Context.APPLET);
@@ -262,7 +262,8 @@
* in this table.
* @param additional the second table, from where additional values are taken
*/
- static void merge (Hashtable primary, Hashtable additional)
+ static void merge (Hashtable<Object, Object> primary,
+ Hashtable<Object, Object> additional)
{
Enumeration en = additional.keys();
@@ -424,25 +425,25 @@
}
/** @inheritDoc */
- public NamingEnumeration list (Name name) throws NamingException
+ public NamingEnumeration<NameClassPair> list (Name name) throws NamingException
{
return getURLOrDefaultInitCtx (name).list (name);
}
/** @inheritDoc */
- public NamingEnumeration list (String name) throws NamingException
+ public NamingEnumeration<NameClassPair> list (String name) throws NamingException
{
return getURLOrDefaultInitCtx (name).list (name);
}
/** @inheritDoc */
- public NamingEnumeration listBindings (Name name) throws NamingException
+ public NamingEnumeration<Binding> listBindings (Name name) throws NamingException
{
return getURLOrDefaultInitCtx (name).listBindings (name);
}
/** @inheritDoc */
- public NamingEnumeration listBindings (String name) throws NamingException
+ public NamingEnumeration<Binding> listBindings (String name) throws NamingException
{
return getURLOrDefaultInitCtx (name).listBindings (name);
}
@@ -522,7 +523,7 @@
}
/** @inheritDoc */
- public Hashtable getEnvironment () throws NamingException
+ public Hashtable<?,?> getEnvironment () throws NamingException
{
return myProps;
}
Modified: trunk/core/src/classpath/javax/javax/naming/Name.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/Name.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/Name.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -60,7 +60,7 @@
* @author Anthony Green (gr...@re...)
* @author Mark Wielaard (ma...@kl...)
*/
-public interface Name extends Cloneable, Serializable, Comparable
+public interface Name extends Cloneable, Serializable, Comparable<Object>
{
// This class is implemented as gnu.javax.naming.ictxImpl.trans.GnuName
@@ -82,7 +82,7 @@
* Returns a non-null (but possibly empty) <code>Enumeration</code> of the
* components of the <code>Name</code> as <code>String</code>s.
*/
- Enumeration getAll();
+ Enumeration<String> getAll();
/**
* Gets the component at the given index.
Modified: trunk/core/src/classpath/javax/javax/naming/NamingEnumeration.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/NamingEnumeration.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/NamingEnumeration.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -52,7 +52,7 @@
* exception has been thrown, not other method should be called of that
* enumeration.</p>
*/
-public interface NamingEnumeration extends Enumeration
+public interface NamingEnumeration<T> extends Enumeration<T>
{
/**
* Returns the next element in this enumeration. The naming - specific
@@ -62,7 +62,7 @@
* @return the next element of this enumeration
* @throws NamingException
*/
- Object next() throws NamingException;
+ T next() throws NamingException;
/**
* Checks if there are more unvisited elements in the enumeration, throwing
Modified: trunk/core/src/classpath/javax/javax/naming/Reference.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/Reference.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/Reference.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -58,7 +58,7 @@
* The list of addresses, stored in this reference. The object may be
* have by several different addresses.
*/
- protected Vector addrs;
+ protected Vector<RefAddr> addrs;
/**
* The name of the class factory to create an instance of the object,
@@ -83,7 +83,7 @@
public Reference (String className)
{
this.className = className;
- addrs = new Vector ();
+ addrs = new Vector<RefAddr> ();
}
/**
@@ -93,7 +93,7 @@
public Reference (String className, RefAddr addr)
{
this.className = className;
- addrs = new Vector ();
+ addrs = new Vector<RefAddr> ();
addrs.add (addr);
}
@@ -112,7 +112,7 @@
this.className = className;
this.classFactory = factoryClassName;
this.classFactoryLocation = factoryLocation;
- addrs = new Vector ();
+ addrs = new Vector<RefAddr> ();
}
/**
@@ -131,7 +131,7 @@
this.className = className;
this.classFactory = factoryClassName;
this.classFactoryLocation = factoryLocation;
- addrs = new Vector ();
+ addrs = new Vector<RefAddr> ();
addrs.add (addr);
}
@@ -164,7 +164,7 @@
{
Reference r = new Reference (className, classFactory,
classFactoryLocation);
- r.addrs = (Vector) addrs.clone ();
+ r.addrs = (Vector<RefAddr>) addrs.clone ();
return r;
}
@@ -193,7 +193,7 @@
*/
public RefAddr get (int posn)
{
- return (RefAddr) addrs.get (posn);
+ return addrs.get (posn);
}
/**
@@ -208,7 +208,7 @@
{
for (int i = 0; i < addrs.size (); ++i)
{
- RefAddr r = (RefAddr) addrs.get (i);
+ RefAddr r = addrs.get (i);
if (addrType.equals (r.getType ()))
return r;
}
@@ -218,7 +218,7 @@
/**
* Get the enumeration over all defined addresses of the object.
*/
- public Enumeration getAll ()
+ public Enumeration<RefAddr> getAll ()
{
return addrs.elements ();
}
Modified: trunk/core/src/classpath/javax/javax/naming/ReferralException.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/ReferralException.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/ReferralException.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -61,7 +61,7 @@
public abstract Object getReferralInfo();
public abstract Context getReferralContext() throws NamingException;
- public abstract Context getReferralContext(Hashtable env)
+ public abstract Context getReferralContext(Hashtable<?, ?> env)
throws NamingException;
public abstract boolean skipReferral();
public abstract void retryReferral();
Modified: trunk/core/src/classpath/javax/javax/naming/directory/Attribute.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/directory/Attribute.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/directory/Attribute.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -51,7 +51,7 @@
{
long serialVersionUID = 8707690322213556804L;
- NamingEnumeration getAll() throws NamingException;
+ NamingEnumeration<?> getAll() throws NamingException;
Object get() throws NamingException;
int size();
String getID();
Modified: trunk/core/src/classpath/javax/javax/naming/directory/Attributes.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/directory/Attributes.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/directory/Attributes.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -52,8 +52,8 @@
boolean isCaseIgnored();
int size();
Attribute get(String attrID);
- NamingEnumeration getAll();
- NamingEnumeration getIDs();
+ NamingEnumeration<? extends Attribute> getAll();
+ NamingEnumeration<String> getIDs();
Attribute put(String attrID, Object val);
Attribute put(Attribute attr);
Attribute remove(String attrID);
Modified: trunk/core/src/classpath/javax/javax/naming/directory/BasicAttribute.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/directory/BasicAttribute.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/directory/BasicAttribute.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -62,7 +62,7 @@
/** True if this attribute's values are ordered. */
protected boolean ordered;
/** Values for this attribute. */
- protected transient Vector values;
+ protected transient Vector<Object> values;
// Used by cloning.
private BasicAttribute ()
@@ -78,7 +78,7 @@
{
attrID = id;
this.ordered = ordered;
- values = new Vector ();
+ values = new Vector<Object> ();
}
public BasicAttribute (String id, Object value)
@@ -90,7 +90,7 @@
{
attrID = id;
this.ordered = ordered;
- values = new Vector ();
+ values = new Vector<Object> ();
values.add (value);
}
@@ -118,7 +118,7 @@
BasicAttribute c = new BasicAttribute ();
c.attrID = attrID;
c.ordered = ordered;
- c.values = (Vector) values.clone ();
+ c.values = (Vector<Object>) values.clone ();
return c;
}
@@ -182,7 +182,7 @@
return values.get (index);
}
- public NamingEnumeration getAll ()
+ public NamingEnumeration<?> getAll ()
throws NamingException
{
return new BasicAttributeEnumeration ();
@@ -307,7 +307,7 @@
{
s.defaultReadObject();
int size = s.readInt();
- values = new Vector(size);
+ values = new Vector<Object>(size);
for (int i=0; i < size; i++)
values.add(s.readObject());
}
Modified: trunk/core/src/classpath/javax/javax/naming/directory/BasicAttributes.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/directory/BasicAttributes.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/directory/BasicAttributes.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -63,7 +63,7 @@
public BasicAttributes (boolean ignoreCase)
{
this.ignoreCase = ignoreCase;
- this.attributes = new Vector ();
+ this.attributes = new Vector<Attribute>();
}
public BasicAttributes (String attrID, Object val)
@@ -74,7 +74,7 @@
public BasicAttributes (String attrID, Object val, boolean ignoreCase)
{
this.ignoreCase = ignoreCase;
- attributes = new Vector ();
+ attributes = new Vector<Attribute>();
attributes.add (new BasicAttribute (attrID, val));
}
@@ -82,7 +82,7 @@
{
// Slightly inefficient as we make a garbage Vector here.
BasicAttributes ba = new BasicAttributes (ignoreCase);
- ba.attributes = (Vector) attributes.clone ();
+ ba.attributes = (Vector<Attribute>) attributes.clone ();
return ba;
}
@@ -117,7 +117,7 @@
{
for (int i = 0; i < attributes.size (); ++i)
{
- Attribute at = (Attribute) attributes.get (i);
+ Attribute at = attributes.get (i);
if ((ignoreCase && attrID.equalsIgnoreCase (at.getID ()))
|| (! ignoreCase && attrID.equals (at.getID ())))
return at;
@@ -126,16 +126,42 @@
return null;
}
- public NamingEnumeration getAll ()
+ public NamingEnumeration<Attribute> getAll ()
{
- return new BasicAttributesEnumeration (false);
+ return new BasicAttributesEnumeration();
}
- public NamingEnumeration getIDs ()
+ public NamingEnumeration<String> getIDs ()
{
- return new BasicAttributesEnumeration (true);
+ final NamingEnumeration<Attribute> attrs = getAll();
+ return new NamingEnumeration<String>() {
+ public boolean hasMore() throws NamingException
+ {
+ return attrs.hasMore();
+ }
+
+ public boolean hasMoreElements()
+ {
+ return attrs.hasMoreElements();
}
+ public String next() throws NamingException
+ {
+ return attrs.next().getID();
+ }
+
+ public String nextElement()
+ {
+ return attrs.nextElement().getID();
+ }
+
+ public void close() throws NamingException
+ {
+ attrs.close();
+ }
+ };
+ }
+
public int hashCode ()
{
int val = 0;
@@ -197,16 +223,16 @@
// This is set by the serialization spec.
private boolean ignoreCase;
// Package-private to avoid a trampoline.
- transient Vector attributes;
+ transient Vector<Attribute> attributes;
private void readObject(ObjectInputStream s) throws IOException,
ClassNotFoundException
{
s.defaultReadObject();
int size = s.readInt();
- attributes = new Vector(size);
+ attributes = new Vector<Attribute>(size);
for (int i = 0; i < size; i++)
- attributes.add(s.readObject());
+ attributes.add((Attribute) s.readObject());
}
private void writeObject(ObjectOutputStream s) throws IOException
@@ -218,14 +244,13 @@
}
// Used when enumerating.
- private class BasicAttributesEnumeration implements NamingEnumeration
+ private class BasicAttributesEnumeration
+ implements NamingEnumeration<Attribute>
{
int where = 0;
- boolean id;
- public BasicAttributesEnumeration (boolean id)
+ public BasicAttributesEnumeration ()
{
- this.id = id;
}
public void close () throws NamingException
@@ -237,7 +262,7 @@
return hasMoreElements ();
}
- public Object next () throws NamingException
+ public Attribute next () throws NamingException
{
return nextElement ();
}
@@ -247,13 +272,13 @@
return where < attributes.size ();
}
- public Object nextElement () throws NoSuchElementException
+ public Attribute nextElement () throws NoSuchElementException
{
if (where >= attributes.size ())
throw new NoSuchElementException ("no more elements");
- Attribute at = (Attribute) attributes.get (where);
+ Attribute at = attributes.get (where);
++where;
- return id ? (Object) at.getID () : (Object) at;
+ return at;
}
}
}
Modified: trunk/core/src/classpath/javax/javax/naming/directory/DirContext.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/directory/DirContext.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/directory/DirContext.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -72,12 +72,32 @@
DirContext getSchema(String name) throws NamingException;
DirContext getSchemaClassDefinition(Name name) throws NamingException;
DirContext getSchemaClassDefinition(String name) throws NamingException;
- NamingEnumeration search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException;
- NamingEnumeration search(String name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException;
- NamingEnumeration search(Name name, Attributes matchingAttributes) throws NamingException;
- NamingEnumeration search(String name, Attributes matchingAttributes) throws NamingException;
- NamingEnumeration search(Name name, String filter, SearchControls cons) throws NamingException;
- NamingEnumeration search(String name, String filter, SearchControls cons) throws NamingException;
- NamingEnumeration search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException;
- NamingEnumeration search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException;
+ NamingEnumeration<SearchResult> search(Name name,
+ Attributes matchingAttributes,
+ String[] attributesToReturn)
+ throws NamingException;
+ NamingEnumeration<SearchResult> search(String name,
+ Attributes matchingAttributes,
+ String[] attributesToReturn)
+ throws NamingException;
+ NamingEnumeration<SearchResult> search(Name name,
+ Attributes matchingAttributes)
+ throws NamingException;
+ NamingEnumeration<SearchResult> search(String name,
+ Attributes matchingAttributes)
+ throws NamingException;
+ NamingEnumeration<SearchResult> search(Name name, String filter,
+ SearchControls cons)
+ throws NamingException;
+ NamingEnumeration<SearchResult> search(String name, String filter,
+ SearchControls cons)
+ throws NamingException;
+ NamingEnumeration<SearchResult> search(Name name, String filterExpr,
+ Object[] filterArgs,
+ SearchControls cons)
+ throws NamingException;
+ NamingEnumeration<SearchResult> search(String name, String filterExpr,
+ Object[] filterArgs,
+ SearchControls cons)
+ throws NamingException;
}
Modified: trunk/core/src/classpath/javax/javax/naming/directory/InitialDirContext.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/directory/InitialDirContext.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/directory/InitialDirContext.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -66,7 +66,7 @@
super (lazy);
}
- public InitialDirContext (Hashtable environment)
+ public InitialDirContext (Hashtable<?, ?> environment)
throws NamingException
{
super (environment);
@@ -205,7 +205,8 @@
return getURLOrDefaultInitDirCtx (name).getSchemaClassDefinition (name);
}
- public NamingEnumeration search(Name name, Attributes matchingAttributes,
+ public NamingEnumeration<SearchResult> search(Name name,
+ Attributes matchingAttributes,
String[] attributesToReturn)
throws NamingException
{
@@ -213,7 +214,8 @@
attributesToReturn);
}
- public NamingEnumeration search(String name, Attributes matchingAttributes,
+ public NamingEnumeration<SearchResult> search(String name,
+ Attributes matchingAttributes,
String[] attributesToReturn)
throws NamingException
{
@@ -221,42 +223,47 @@
attributesToReturn);
}
- public NamingEnumeration search(Name name, Attributes matchingAttributes)
+ public NamingEnumeration<SearchResult> search(Name name,
+ Attributes matchingAttributes)
throws NamingException
{
return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes);
}
- public NamingEnumeration search(String name, Attributes matchingAttributes)
+ public NamingEnumeration<SearchResult> search(String name,
+ Attributes matchingAttributes)
throws NamingException
{
return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes);
}
- public NamingEnumeration search(Name name, String filter,
+ public NamingEnumeration<SearchResult> search(Name name, String filter,
SearchControls cons)
throws NamingException
{
return getURLOrDefaultInitDirCtx (name).search (name, filter, cons);
}
- public NamingEnumeration search(String name, String filter,
+ public NamingEnumeration<SearchResult> search(String name, String filter,
SearchControls cons)
throws NamingException
{
return getURLOrDefaultInitDirCtx (name).search (name, filter, cons);
}
- public NamingEnumeration search(Name name, String filterExpr,
- Object[] filterArgs, SearchControls cons)
+ public NamingEnumeration<SearchResult> search(Name name, String filterExpr,
+ Object[] filterArgs,
+ SearchControls cons)
throws NamingException
{
return getURLOrDefaultInitDirCtx (name).search (name, filterExpr,
filterArgs, cons);
}
- 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 getURLOrDefaultInitDirCtx (name).search (name, filterExpr,
Modified: trunk/core/src/classpath/javax/javax/naming/ldap/ControlFactory.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/ldap/ControlFactory.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/ldap/ControlFactory.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -59,7 +59,7 @@
public static Control getControlInstance (Control control,
Context ctx,
- Hashtable env)
+ Hashtable<?, ?> env)
throws NamingException
{
String path = (String) env.get (LdapContext.CONTROL_FACTORIES);
Modified: trunk/core/src/classpath/javax/javax/naming/ldap/InitialLdapContext.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/ldap/InitialLdapContext.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/ldap/InitialLdapContext.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -60,22 +60,24 @@
this (null, null);
}
- public InitialLdapContext (Hashtable environment, Control[] connControls)
+ public InitialLdapContext (Hashtable<?, ?> environment,
+ Control[] connControls)
throws NamingException
{
super (false);
+ Hashtable<Object, Object> myenv = null;
if (connControls != null)
{
if (environment == null)
- environment = new Hashtable ();
+ myenv = new Hashtable<Object, Object> ();
else
- environment = (Hashtable) environment.clone ();
- environment.put ("java.naming.ldap.control.connect",
+ myenv = (Hashtable<Object, Object>) environment.clone ();
+ myenv.put ("java.naming.ldap.control.connect",
connControls);
}
- init (environment);
+ init (myenv);
}
private LdapContext getDefaultInitLdapCtx ()
Modified: trunk/core/src/classpath/javax/javax/naming/ldap/LdapReferralException.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/ldap/LdapReferralException.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/ldap/LdapReferralException.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -61,8 +61,9 @@
}
public abstract Context getReferralContext() throws NamingException;
- public abstract Context getReferralContext(Hashtable env)
+ public abstract Context getReferralContext(Hashtable<?, ?> env)
throws NamingException;
- public abstract Context getReferralContext(Hashtable env, Control[] reqCtls)
+ public abstract Context getReferralContext(Hashtable<?, ?> env,
+ Control[] reqCtls)
throws NamingException;
}
Modified: trunk/core/src/classpath/javax/javax/naming/spi/DirObjectFactory.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/spi/DirObjectFactory.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/spi/DirObjectFactory.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -51,6 +51,6 @@
public interface DirObjectFactory extends ObjectFactory
{
Object getObjectInstance(Object obj, Name name, Context nameCtx,
- Hashtable environment, Attributes attrs)
+ Hashtable<?, ?> environment, Attributes attrs)
throws Exception;
}
Modified: trunk/core/src/classpath/javax/javax/naming/spi/DirStateFactory.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/spi/DirStateFactory.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/spi/DirStateFactory.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -77,7 +77,7 @@
DirStateFactory.Result getStateToBind(Object obj, Name name,
Context nameCtx,
- Hashtable environment,
+ Hashtable<?, ?> environment,
Attributes inAttrs)
throws NamingException;
}
Modified: trunk/core/src/classpath/javax/javax/naming/spi/DirectoryManager.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/spi/DirectoryManager.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/spi/DirectoryManager.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -93,7 +93,7 @@
public static Object getObjectInstance (Object refInfo, Name name,
Context nameCtx,
- Hashtable environment,
+ Hashtable<?, ?> environment,
Attributes attrs)
throws Exception
{
@@ -186,7 +186,7 @@
public static DirStateFactory.Result getStateToBind (Object obj,
Name name,
Context nameCtx,
- Hashtable environment,
+ Hashtable<?, ?> environment,
Attributes attrs)
throws NamingException
{
Modified: trunk/core/src/classpath/javax/javax/naming/spi/InitialContextFactory.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/spi/InitialContextFactory.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/spi/InitialContextFactory.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -66,5 +66,6 @@
* @return the new initial context
* @throws NamingException if the naming exception has occured
*/
- Context getInitialContext(Hashtable environment) throws NamingException;
+ Context getInitialContext (Hashtable<?, ?> environment)
+ throws NamingException;
}
Modified: trunk/core/src/classpath/javax/javax/naming/spi/InitialContextFactoryBuilder.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/spi/InitialContextFactoryBuilder.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/spi/InitialContextFactoryBuilder.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -53,14 +53,14 @@
public interface InitialContextFactoryBuilder
{
/**
- * Create the new inital context factory
+ * Create the new initial context factory
*
- * @param environment the properties, used for creation of the initial context
- * factory. The parameter is owned by the caller: it is safe to reuse
+ * @param environment the properties, used for creation of the initial
+ * context factory. The parameter is owned by the caller: it is safe to reuse
* the table for other purposes after the method returns.
* @return the created initial context factory, never null.
* @throws NamingException on failure
*/
- InitialContextFactory createInitialContextFactory (Hashtable environment)
+ InitialContextFactory createInitialContextFactory (Hashtable<?, ?> environment)
throws NamingException;
}
Modified: trunk/core/src/classpath/javax/javax/naming/spi/NamingManager.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/spi/NamingManager.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/spi/NamingManager.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -110,7 +110,7 @@
* class, named by this property, cannot be instantiated.
* @throws NamingException if throws by the context factory
*/
- public static Context getInitialContext (Hashtable environment)
+ public static Context getInitialContext (Hashtable<?, ?> environment)
throws NamingException
{
InitialContextFactory icf = null;
@@ -187,7 +187,7 @@
* @throws NamingException if thrown by the factory when creating the context.
*/
static Context getURLContext(Object refInfo, Name name, Context nameCtx,
- String scheme, Hashtable environment)
+ String scheme, Hashtable<?,?> environment)
throws NamingException
{
// Doc specifies com.sun.jndi.url as the final destination, but we cannot
@@ -329,15 +329,15 @@
* </p>
* <p>
* The class name of the factory that creates the context has the naming
- * pattern scheme-idURLContextFactory. For instance, the factory for the "ftp"
- * sheme should be named "ftpURLContextFactory". The Context.URL_PKG_PREFIXES
- * environment property contains the colon-separated list of the possible
- * package prefixes. The package name is constructed concatenating the package
- * prefix with the scheme id.
+ * pattern scheme-idURLContextFactory. For instance, the factory for the
+ * "ftp" scheme should be named "ftpURLContextFactory".
+ * The Context.URL_PKG_PREFIXES environment property contains the
+ * colon-separated list of the possible package prefixes. The package name
+ * is constructed by concatenating the package prefix with the scheme id.
* </p>
* <p>
- * If the factory class cannot be found in the specified packages, system will
- * try to use the default internal factory for the given scheme.
+ * If the factory class cannot be found in the specified packages, the
+ * system will try to use the default internal factory for the given scheme.
* </p>
* <p>
* After the factory is instantiated, its method
@@ -345,13 +345,14 @@
* is called to create and return the object instance.
*
* @param scheme the url scheme that must be supported by the given context
- * @param environment the properties for creating the factory and context (may
- * be null)
+ * @param environment the properties for creating the factory and context
+ * (may be null)
* @return the created context
- * @throws NamingException if thrown by the factory when creating the context.
+ * @throws NamingException if thrown by the factory when creating the
+ * context.
*/
public static Context getURLContext (String scheme,
- Hashtable environment)
+ Hashtable<?, ?> environment)
throws NamingException
{
return getURLContext (null, null, null, scheme, environment);
@@ -450,7 +451,7 @@
public static Object getObjectInstance (Object refInfo,
Name name,
Context nameCtx,
- Hashtable environment)
+ Hashtable<?, ?> environment)
throws Exception
{
ObjectFactory factory = null;
@@ -623,7 +624,7 @@
* @throws NamingException
*/
public static Object getStateToBind (Object obj, Name name,
- Context nameCtx, Hashtable environment)
+ Context nameCtx, Hashtable<?, ?> environment)
throws NamingException
{
StringTokenizer tokens = getPlusPath (Context.STATE_FACTORIES,
Modified: trunk/core/src/classpath/javax/javax/naming/spi/ObjectFactory.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/spi/ObjectFactory.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/spi/ObjectFactory.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -70,6 +70,7 @@
*
* @see NamingManager#getObjectInstance(Object, Name, Context, Hashtable)
*/
- Object getObjectInstance(Object refObj, Name name, Context nameCtx,
- Hashtable environment) throws Exception;
+ Object getObjectInstance (Object refObj, Name name, Context nameCtx,
+ Hashtable<?, ?> environment)
+ throws Exception;
}
Modified: trunk/core/src/classpath/javax/javax/naming/spi/ObjectFactoryBuilder.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/spi/ObjectFactoryBuilder.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/spi/ObjectFactoryBuilder.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -65,6 +65,6 @@
* @throws NamingException
*/
ObjectFactory createObjectFactory(Object refInfo,
- Hashtable environment)
+ Hashtable<?, ?> environment)
throws NamingException;
}
Modified: trunk/core/src/classpath/javax/javax/naming/spi/Resolver.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/spi/Resolver.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/spi/Resolver.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -41,7 +41,6 @@
import javax.naming.Context;
import javax.naming.Name;
import javax.naming.NamingException;
-import javax.naming.NotContextException;
/**
* <p>Represents the object, capable for the at least partial name resolution.
@@ -54,31 +53,10 @@
*/
public interface Resolver
{
- /**
- * Partially resolve the name, stopping at the first instance of the context
- * that is an instance of the contextType
- *
- * @param name the name to resolve
- * @param contextType the class of the context, on that the resolution should
- * be terminated
- * @return the complete or partial name resolution
- * @throws NotContextException if the context of the contextType is not found
- * @throws NamingException on other failure
- */
- ResolveResult resolveToClass(Name name, Class contextType)
+ ResolveResult resolveToClass(Name name,
+ Class<? extends Context> contextType)
throws NamingException;
-
- /**
- * Partially resolve the name, stopping at the first instance of the context
- * that is an instance of the contextType
- *
- * @param name the name to resolve
- * @param contextType the class of the context, on that the resolution should
- * be terminated
- * @return the complete or partial name resolution
- * @throws NotContextException if the context of the contextType is not found
- * @throws NamingException on other failure
- */
- ResolveResult resolveToClass(String name, Class contextType)
+ ResolveResult resolveToClass(String name,
+ Class<? extends Context> contextType)
throws NamingException;
}
Modified: trunk/core/src/classpath/javax/javax/naming/spi/StateFactory.java
===================================================================
--- trunk/core/src/classpath/javax/javax/naming/spi/StateFactory.java 2007-01-07 08:22:28 UTC (rev 3000)
+++ trunk/core/src/classpath/javax/javax/naming/spi/StateFactory.java 2007-01-07 08:22:57 UTC (rev 3001)
@@ -75,5 +75,5 @@
* @see DirectoryManager#getStateToBind
*/
Object getStateToBind(Object obj, Name name, Context nameCtx,
- Hashtable environment) throws NamingException;
+ Hashtable<?, ?> environment) throws NamingException;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|