|
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[] attri...
[truncated message content] |