summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/javax/naming
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/javax/naming')
-rw-r--r--libjava/classpath/javax/naming/CannotProceedException.java6
-rw-r--r--libjava/classpath/javax/naming/CompositeName.java4
-rw-r--r--libjava/classpath/javax/naming/CompoundName.java4
-rw-r--r--libjava/classpath/javax/naming/Context.java10
-rw-r--r--libjava/classpath/javax/naming/InitialContext.java20
-rw-r--r--libjava/classpath/javax/naming/Name.java18
-rw-r--r--libjava/classpath/javax/naming/NamingEnumeration.java4
-rw-r--r--libjava/classpath/javax/naming/Reference.java4
-rw-r--r--libjava/classpath/javax/naming/ReferralException.java2
-rw-r--r--libjava/classpath/javax/naming/directory/Attribute.java2
-rw-r--r--libjava/classpath/javax/naming/directory/Attributes.java4
-rw-r--r--libjava/classpath/javax/naming/directory/BasicAttribute.java4
-rw-r--r--libjava/classpath/javax/naming/directory/BasicAttributes.java4
-rw-r--r--libjava/classpath/javax/naming/directory/DirContext.java36
-rw-r--r--libjava/classpath/javax/naming/directory/InitialDirContext.java37
-rw-r--r--libjava/classpath/javax/naming/ldap/ControlFactory.java2
-rw-r--r--libjava/classpath/javax/naming/ldap/InitialLdapContext.java12
-rw-r--r--libjava/classpath/javax/naming/ldap/LdapReferralException.java5
-rw-r--r--libjava/classpath/javax/naming/spi/DirObjectFactory.java2
-rw-r--r--libjava/classpath/javax/naming/spi/DirStateFactory.java2
-rw-r--r--libjava/classpath/javax/naming/spi/DirectoryManager.java4
-rw-r--r--libjava/classpath/javax/naming/spi/InitialContextFactory.java3
-rw-r--r--libjava/classpath/javax/naming/spi/InitialContextFactoryBuilder.java10
-rw-r--r--libjava/classpath/javax/naming/spi/NamingManager.java87
-rw-r--r--libjava/classpath/javax/naming/spi/ObjectFactory.java5
-rw-r--r--libjava/classpath/javax/naming/spi/ObjectFactoryBuilder.java4
-rw-r--r--libjava/classpath/javax/naming/spi/Resolver.java41
-rw-r--r--libjava/classpath/javax/naming/spi/StateFactory.java2
28 files changed, 186 insertions, 152 deletions
diff --git a/libjava/classpath/javax/naming/CannotProceedException.java b/libjava/classpath/javax/naming/CannotProceedException.java
index 27868e21ea2..bc2085879cc 100644
--- a/libjava/classpath/javax/naming/CannotProceedException.java
+++ b/libjava/classpath/javax/naming/CannotProceedException.java
@@ -51,7 +51,7 @@ public class CannotProceedException extends NamingException
// Serialized fields.
protected Name remainingNewName;
- protected Hashtable environment;
+ protected Hashtable<?, ?> environment;
protected Name altName;
protected Context altNameCtx;
@@ -65,12 +65,12 @@ public class CannotProceedException extends NamingException
super (msg);
}
- public Hashtable getEnvironment()
+ public Hashtable<?, ?> getEnvironment()
{
return environment;
}
- public void setEnvironment(Hashtable environment)
+ public void setEnvironment(Hashtable<?, ?> environment)
{
this.environment = environment;
}
diff --git a/libjava/classpath/javax/naming/CompositeName.java b/libjava/classpath/javax/naming/CompositeName.java
index 322f63279a2..612932152da 100644
--- a/libjava/classpath/javax/naming/CompositeName.java
+++ b/libjava/classpath/javax/naming/CompositeName.java
@@ -65,7 +65,7 @@ public class CompositeName implements Name, Cloneable, Serializable
elts = new Vector ();
}
- protected CompositeName (Enumeration comps)
+ protected CompositeName (Enumeration<String> comps)
{
elts = new Vector ();
try
@@ -230,7 +230,7 @@ public class CompositeName implements Name, Cloneable, Serializable
return (String) elts.get (posn);
}
- public Enumeration getAll ()
+ public Enumeration<String> getAll ()
{
return elts.elements ();
}
diff --git a/libjava/classpath/javax/naming/CompoundName.java b/libjava/classpath/javax/naming/CompoundName.java
index 556edfc33f2..703d44e4700 100644
--- a/libjava/classpath/javax/naming/CompoundName.java
+++ b/libjava/classpath/javax/naming/CompoundName.java
@@ -73,7 +73,7 @@ public class CompoundName implements Name, Cloneable, Serializable
initializeSyntax ();
}
- protected CompoundName (Enumeration comps, Properties syntax)
+ protected CompoundName (Enumeration<String> comps, Properties syntax)
{
elts = new Vector ();
mySyntax = syntax;
@@ -289,7 +289,7 @@ public class CompoundName implements Name, Cloneable, Serializable
return (String) elts.get (posn);
}
- public Enumeration getAll ()
+ public Enumeration<String> getAll ()
{
return elts.elements ();
}
diff --git a/libjava/classpath/javax/naming/Context.java b/libjava/classpath/javax/naming/Context.java
index 46b540304b4..4b87b9e01e6 100644
--- a/libjava/classpath/javax/naming/Context.java
+++ b/libjava/classpath/javax/naming/Context.java
@@ -270,7 +270,7 @@ public interface Context
* @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 @@ public interface Context
* @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 @@ public interface Context
* @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 @@ public interface Context
* @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 @@ public interface Context
* @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
diff --git a/libjava/classpath/javax/naming/InitialContext.java b/libjava/classpath/javax/naming/InitialContext.java
index d4a9587f21c..1a3b1e38b03 100644
--- a/libjava/classpath/javax/naming/InitialContext.java
+++ b/libjava/classpath/javax/naming/InitialContext.java
@@ -73,7 +73,7 @@ public class InitialContext implements Context
/**
* 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
@@ -111,7 +111,7 @@ public class InitialContext implements Context
* created.
* @throws NamingException
*/
- public InitialContext(Hashtable environment) throws NamingException
+ public InitialContext(Hashtable<?,?> environment) throws NamingException
{
init(environment);
}
@@ -166,13 +166,13 @@ public class InitialContext implements Context
* 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);
@@ -424,25 +424,25 @@ public class InitialContext implements Context
}
/** @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 +522,7 @@ public class InitialContext implements Context
}
/** @inheritDoc */
- public Hashtable getEnvironment () throws NamingException
+ public Hashtable<?,?> getEnvironment () throws NamingException
{
return myProps;
}
diff --git a/libjava/classpath/javax/naming/Name.java b/libjava/classpath/javax/naming/Name.java
index f0475766a97..687ebd6fbde 100644
--- a/libjava/classpath/javax/naming/Name.java
+++ b/libjava/classpath/javax/naming/Name.java
@@ -60,8 +60,10 @@ import java.util.Enumeration;
* @author Anthony Green (green@redhat.com)
* @author Mark Wielaard (mark@klomp.org)
*/
-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
+
long serialVersionUID = -3617482732056931635L;
/**
@@ -80,7 +82,7 @@ public interface Name extends Cloneable, Serializable, Comparable
* 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.
@@ -94,22 +96,27 @@ public interface Name extends Cloneable, Serializable, Comparable
* Returns the components till the given index as a <code>Name</code>.
* The returned <code>Name</code> can be modified without changing the
* original.
+ *
+ * @param posn the ending position, exclusive
*
* @exception ArrayIndexOutOfBoundsException if the given index is smaller
* then zero or greater then or equal to <code>size()</code>.
*/
- Name getPrefix(int i);
+ Name getPrefix(int posn);
/**
* Returns the components from the given index till the end as a
* <code>Name</code>.
* The returned <code>Name</code> can be modified without changing the
* original.
+ *
+ * @param posn the starting position, inclusive. If it is equal to the size
+ * of the name, the empty name is returned.
*
* @exception ArrayIndexOutOfBoundsException if the given index is smaller
* then zero or greater then or equal to <code>size()</code>.
*/
- Name getSuffix(int i);
+ Name getSuffix(int posn);
/**
* Adds the given <code>String</code> component to the end of this
@@ -145,7 +152,8 @@ public interface Name extends Cloneable, Serializable, Comparable
/**
* Inserts all the components of the given <code>Name</code> to this
- * <code>Name</code> at the given index. The method modifies the current
+ * <code>Name</code> at the given index. Components after this index
+ * (if any) are shifted up. The method modifies the current
* <code>Name</code> and then returns it.
*
* @exception ArrayIndexOutOfBoundsException if the given index is smaller
diff --git a/libjava/classpath/javax/naming/NamingEnumeration.java b/libjava/classpath/javax/naming/NamingEnumeration.java
index 86b1dfb414d..a7c57706f8b 100644
--- a/libjava/classpath/javax/naming/NamingEnumeration.java
+++ b/libjava/classpath/javax/naming/NamingEnumeration.java
@@ -52,7 +52,7 @@ import java.util.Enumeration;
* 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 @@ public interface NamingEnumeration extends Enumeration
* @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
diff --git a/libjava/classpath/javax/naming/Reference.java b/libjava/classpath/javax/naming/Reference.java
index 0fdecc19ec7..3379bd5a837 100644
--- a/libjava/classpath/javax/naming/Reference.java
+++ b/libjava/classpath/javax/naming/Reference.java
@@ -58,7 +58,7 @@ public class Reference implements Cloneable, Serializable
* 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,
@@ -218,7 +218,7 @@ public class Reference implements Cloneable, Serializable
/**
* Get the enumeration over all defined addresses of the object.
*/
- public Enumeration getAll ()
+ public Enumeration<RefAddr> getAll ()
{
return addrs.elements ();
}
diff --git a/libjava/classpath/javax/naming/ReferralException.java b/libjava/classpath/javax/naming/ReferralException.java
index ec2178e77e6..c264d637f18 100644
--- a/libjava/classpath/javax/naming/ReferralException.java
+++ b/libjava/classpath/javax/naming/ReferralException.java
@@ -61,7 +61,7 @@ public abstract class ReferralException extends NamingException
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();
diff --git a/libjava/classpath/javax/naming/directory/Attribute.java b/libjava/classpath/javax/naming/directory/Attribute.java
index 59bf66dabc8..d29e1eae0b2 100644
--- a/libjava/classpath/javax/naming/directory/Attribute.java
+++ b/libjava/classpath/javax/naming/directory/Attribute.java
@@ -51,7 +51,7 @@ public interface Attribute extends Cloneable, Serializable
{
long serialVersionUID = 8707690322213556804L;
- NamingEnumeration getAll() throws NamingException;
+ NamingEnumeration<?> getAll() throws NamingException;
Object get() throws NamingException;
int size();
String getID();
diff --git a/libjava/classpath/javax/naming/directory/Attributes.java b/libjava/classpath/javax/naming/directory/Attributes.java
index 3d5ef9f4fa7..2dc2c610155 100644
--- a/libjava/classpath/javax/naming/directory/Attributes.java
+++ b/libjava/classpath/javax/naming/directory/Attributes.java
@@ -52,8 +52,8 @@ public interface Attributes extends Cloneable, Serializable
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);
diff --git a/libjava/classpath/javax/naming/directory/BasicAttribute.java b/libjava/classpath/javax/naming/directory/BasicAttribute.java
index c6419794f10..5a1bb0e881f 100644
--- a/libjava/classpath/javax/naming/directory/BasicAttribute.java
+++ b/libjava/classpath/javax/naming/directory/BasicAttribute.java
@@ -62,7 +62,7 @@ public class BasicAttribute implements Attribute
/** 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 ()
@@ -182,7 +182,7 @@ public class BasicAttribute implements Attribute
return values.get (index);
}
- public NamingEnumeration getAll ()
+ public NamingEnumeration<?> getAll ()
throws NamingException
{
return new BasicAttributeEnumeration ();
diff --git a/libjava/classpath/javax/naming/directory/BasicAttributes.java b/libjava/classpath/javax/naming/directory/BasicAttributes.java
index 9318fbb2be7..6880f5b3362 100644
--- a/libjava/classpath/javax/naming/directory/BasicAttributes.java
+++ b/libjava/classpath/javax/naming/directory/BasicAttributes.java
@@ -126,12 +126,12 @@ public class BasicAttributes implements Attributes
return null;
}
- public NamingEnumeration getAll ()
+ public NamingEnumeration<Attribute> getAll ()
{
return new BasicAttributesEnumeration (false);
}
- public NamingEnumeration getIDs ()
+ public NamingEnumeration<String> getIDs ()
{
return new BasicAttributesEnumeration (true);
}
diff --git a/libjava/classpath/javax/naming/directory/DirContext.java b/libjava/classpath/javax/naming/directory/DirContext.java
index 002cb78a913..d7d94a3456b 100644
--- a/libjava/classpath/javax/naming/directory/DirContext.java
+++ b/libjava/classpath/javax/naming/directory/DirContext.java
@@ -72,12 +72,32 @@ public interface DirContext extends Context
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;
}
diff --git a/libjava/classpath/javax/naming/directory/InitialDirContext.java b/libjava/classpath/javax/naming/directory/InitialDirContext.java
index c946f416bff..8c7852fbba6 100644
--- a/libjava/classpath/javax/naming/directory/InitialDirContext.java
+++ b/libjava/classpath/javax/naming/directory/InitialDirContext.java
@@ -66,7 +66,7 @@ public class InitialDirContext extends InitialContext implements DirContext
super (lazy);
}
- public InitialDirContext (Hashtable environment)
+ public InitialDirContext (Hashtable<?, ?> environment)
throws NamingException
{
super (environment);
@@ -205,58 +205,65 @@ public class InitialDirContext extends InitialContext implements DirContext
return getURLOrDefaultInitDirCtx (name).getSchemaClassDefinition (name);
}
- public NamingEnumeration search(Name name, Attributes matchingAttributes,
- String[] attributesToReturn)
+ public NamingEnumeration<SearchResult> search(Name name,
+ Attributes matchingAttributes,
+ String[] attributesToReturn)
throws NamingException
{
return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes,
attributesToReturn);
}
- public NamingEnumeration search(String name, Attributes matchingAttributes,
- String[] attributesToReturn)
+ public NamingEnumeration<SearchResult> search(String name,
+ Attributes matchingAttributes,
+ String[] attributesToReturn)
throws NamingException
{
return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes,
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,
- SearchControls cons)
+ 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,
- SearchControls cons)
+ 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,
diff --git a/libjava/classpath/javax/naming/ldap/ControlFactory.java b/libjava/classpath/javax/naming/ldap/ControlFactory.java
index f72e67a7587..b8151640fc6 100644
--- a/libjava/classpath/javax/naming/ldap/ControlFactory.java
+++ b/libjava/classpath/javax/naming/ldap/ControlFactory.java
@@ -59,7 +59,7 @@ public abstract class ControlFactory
public static Control getControlInstance (Control control,
Context ctx,
- Hashtable env)
+ Hashtable<?, ?> env)
throws NamingException
{
String path = (String) env.get (LdapContext.CONTROL_FACTORIES);
diff --git a/libjava/classpath/javax/naming/ldap/InitialLdapContext.java b/libjava/classpath/javax/naming/ldap/InitialLdapContext.java
index 45a9eae1af5..f9493c3b29c 100644
--- a/libjava/classpath/javax/naming/ldap/InitialLdapContext.java
+++ b/libjava/classpath/javax/naming/ldap/InitialLdapContext.java
@@ -60,22 +60,24 @@ public class InitialLdapContext
this (null, null);
}
- public InitialLdapContext (Hashtable environment, Control[] connControls)
+ public InitialLdapContext (Hashtable<?, ?> environment,
+ Control[] connControls)
throws NamingException
{
super (false);
+ Hashtable myenv = null;
if (connControls != null)
{
if (environment == null)
- environment = new Hashtable ();
+ myenv = new Hashtable ();
else
- environment = (Hashtable) environment.clone ();
- environment.put ("java.naming.ldap.control.connect",
+ myenv = (Hashtable) environment.clone ();
+ myenv.put ("java.naming.ldap.control.connect",
connControls);
}
- init (environment);
+ init (myenv);
}
private LdapContext getDefaultInitLdapCtx ()
diff --git a/libjava/classpath/javax/naming/ldap/LdapReferralException.java b/libjava/classpath/javax/naming/ldap/LdapReferralException.java
index 61a2b8e440c..87942b9fce4 100644
--- a/libjava/classpath/javax/naming/ldap/LdapReferralException.java
+++ b/libjava/classpath/javax/naming/ldap/LdapReferralException.java
@@ -61,8 +61,9 @@ public abstract class LdapReferralException extends ReferralException
}
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;
}
diff --git a/libjava/classpath/javax/naming/spi/DirObjectFactory.java b/libjava/classpath/javax/naming/spi/DirObjectFactory.java
index ea0e69706cc..1a71c28f7df 100644
--- a/libjava/classpath/javax/naming/spi/DirObjectFactory.java
+++ b/libjava/classpath/javax/naming/spi/DirObjectFactory.java
@@ -51,6 +51,6 @@ import javax.naming.directory.Attributes;
public interface DirObjectFactory extends ObjectFactory
{
Object getObjectInstance(Object obj, Name name, Context nameCtx,
- Hashtable environment, Attributes attrs)
+ Hashtable<?, ?> environment, Attributes attrs)
throws Exception;
}
diff --git a/libjava/classpath/javax/naming/spi/DirStateFactory.java b/libjava/classpath/javax/naming/spi/DirStateFactory.java
index b5add91cba7..6ddd12f3655 100644
--- a/libjava/classpath/javax/naming/spi/DirStateFactory.java
+++ b/libjava/classpath/javax/naming/spi/DirStateFactory.java
@@ -77,7 +77,7 @@ public interface DirStateFactory extends StateFactory
DirStateFactory.Result getStateToBind(Object obj, Name name,
Context nameCtx,
- Hashtable environment,
+ Hashtable<?, ?> environment,
Attributes inAttrs)
throws NamingException;
}
diff --git a/libjava/classpath/javax/naming/spi/DirectoryManager.java b/libjava/classpath/javax/naming/spi/DirectoryManager.java
index fd482efb5c6..a6d91b20cfa 100644
--- a/libjava/classpath/javax/naming/spi/DirectoryManager.java
+++ b/libjava/classpath/javax/naming/spi/DirectoryManager.java
@@ -93,7 +93,7 @@ public class DirectoryManager extends NamingManager
public static Object getObjectInstance (Object refInfo, Name name,
Context nameCtx,
- Hashtable environment,
+ Hashtable<?, ?> environment,
Attributes attrs)
throws Exception
{
@@ -186,7 +186,7 @@ public class DirectoryManager extends NamingManager
public static DirStateFactory.Result getStateToBind (Object obj,
Name name,
Context nameCtx,
- Hashtable environment,
+ Hashtable<?, ?> environment,
Attributes attrs)
throws NamingException
{
diff --git a/libjava/classpath/javax/naming/spi/InitialContextFactory.java b/libjava/classpath/javax/naming/spi/InitialContextFactory.java
index d9b3336dcc2..f715327ef50 100644
--- a/libjava/classpath/javax/naming/spi/InitialContextFactory.java
+++ b/libjava/classpath/javax/naming/spi/InitialContextFactory.java
@@ -66,5 +66,6 @@ public interface InitialContextFactory
* @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;
}
diff --git a/libjava/classpath/javax/naming/spi/InitialContextFactoryBuilder.java b/libjava/classpath/javax/naming/spi/InitialContextFactoryBuilder.java
index 4696cecb8e7..31bafe6dc06 100644
--- a/libjava/classpath/javax/naming/spi/InitialContextFactoryBuilder.java
+++ b/libjava/classpath/javax/naming/spi/InitialContextFactoryBuilder.java
@@ -53,14 +53,14 @@ import javax.naming.NamingException;
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
- * the table for other purposes after the method returns.
+ * @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;
}
diff --git a/libjava/classpath/javax/naming/spi/NamingManager.java b/libjava/classpath/javax/naming/spi/NamingManager.java
index a36d519d75a..3dfba0f668d 100644
--- a/libjava/classpath/javax/naming/spi/NamingManager.java
+++ b/libjava/classpath/javax/naming/spi/NamingManager.java
@@ -79,7 +79,7 @@ public class NamingManager
NamingManager ()
{
}
-
+
/**
* Checks if the initial context factory builder has been set.
*
@@ -110,7 +110,7 @@ public class NamingManager
* 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;
@@ -151,7 +151,7 @@ public class NamingManager
return icf.getInitialContext (environment);
}
-
+
/**
* <p>
* Creates the URL context for the given URL scheme id.
@@ -187,23 +187,26 @@ public class NamingManager
* @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
{
- // Specified as the default in the docs. Unclear if this is
- // right for us.
- String defaultPrefix = "com.sun.jndi.url";
+ // Doc specifies com.sun.jndi.url as the final destination, but we cannot
+ // put our classes into such namespace.
+ String defaultPrefix = "gnu.javax.naming.jndi.url";
+ // The final default location, as specified in the documentation.
+ String finalPrefix = "com.sun.jndi.url";
+
StringBuffer allPrefixes = new StringBuffer();
String prefixes;
- if (environment != null)
- {
+ if (environment != null)
+ {
prefixes = (String) environment.get(Context.URL_PKG_PREFIXES);
if (prefixes != null)
allPrefixes.append(prefixes);
- }
-
+ }
+
prefixes = System.getProperty(Context.URL_PKG_PREFIXES);
if (prefixes != null)
{
@@ -215,12 +218,14 @@ public class NamingManager
if (allPrefixes.length() > 0)
allPrefixes.append(':');
allPrefixes.append(defaultPrefix);
+ allPrefixes.append(':');
+ allPrefixes.append(finalPrefix);
- scheme = scheme + "." + scheme + "URLContextFactory";
-
+ scheme = scheme + "." + scheme + "URLContextFactory";
+
StringTokenizer tokens = new StringTokenizer(allPrefixes.toString(), ":");
while (tokens.hasMoreTokens())
- {
+ {
String aTry = tokens.nextToken();
try
{
@@ -228,12 +233,21 @@ public class NamingManager
Class factoryClass = forName(tryClass);
if (factoryClass != null)
{
- ObjectFactory factory = (ObjectFactory) factoryClass.newInstance();
- Object obj = factory.getObjectInstance(refInfo, name, nameCtx,
- environment);
- Context ctx = (Context) obj;
- if (ctx != null)
- return ctx;
+ Object obj;
+ try
+ {
+ ObjectFactory factory = (ObjectFactory) factoryClass.newInstance();
+ obj = factory.getObjectInstance(refInfo, name, nameCtx,
+ environment);
+ Context ctx = (Context) obj;
+ if (ctx != null)
+ return ctx;
+ }
+ catch (RuntimeException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
}
catch (ClassNotFoundException _1)
@@ -263,11 +277,11 @@ public class NamingManager
{
// Anything from getObjectInstance.
}
- }
-
+ }
+
return null;
}
-
+
/**
* Load the class with the given name. This method tries to use the context
* class loader first. If this fails, it searches for the suitable class
@@ -315,15 +329,15 @@ public class NamingManager
* </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
@@ -331,13 +345,14 @@ public class NamingManager
* 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);
@@ -436,7 +451,7 @@ public class NamingManager
public static Object getObjectInstance (Object refInfo,
Name name,
Context nameCtx,
- Hashtable environment)
+ Hashtable<?, ?> environment)
throws Exception
{
ObjectFactory factory = null;
@@ -609,7 +624,7 @@ public class NamingManager
* @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,
diff --git a/libjava/classpath/javax/naming/spi/ObjectFactory.java b/libjava/classpath/javax/naming/spi/ObjectFactory.java
index 27771b6cbbd..4534481a75a 100644
--- a/libjava/classpath/javax/naming/spi/ObjectFactory.java
+++ b/libjava/classpath/javax/naming/spi/ObjectFactory.java
@@ -70,6 +70,7 @@ public interface ObjectFactory
*
* @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;
}
diff --git a/libjava/classpath/javax/naming/spi/ObjectFactoryBuilder.java b/libjava/classpath/javax/naming/spi/ObjectFactoryBuilder.java
index cb20c666e71..6a528b17a06 100644
--- a/libjava/classpath/javax/naming/spi/ObjectFactoryBuilder.java
+++ b/libjava/classpath/javax/naming/spi/ObjectFactoryBuilder.java
@@ -52,7 +52,7 @@ import javax.naming.Referenceable;
* @author Warren Levy (warrenl@redhat.com)
*/
public interface ObjectFactoryBuilder
-{
+{
/**
* Create a new object using the supplied environment.
*
@@ -65,6 +65,6 @@ public interface ObjectFactoryBuilder
* @throws NamingException
*/
ObjectFactory createObjectFactory(Object refInfo,
- Hashtable environment)
+ Hashtable<?, ?> environment)
throws NamingException;
}
diff --git a/libjava/classpath/javax/naming/spi/Resolver.java b/libjava/classpath/javax/naming/spi/Resolver.java
index eb3eeb56079..f01790502ed 100644
--- a/libjava/classpath/javax/naming/spi/Resolver.java
+++ b/libjava/classpath/javax/naming/spi/Resolver.java
@@ -44,41 +44,20 @@ import javax.naming.NamingException;
import javax.naming.NotContextException;
/**
- * <p>Represents the object, capable for the at least partial name resolution.
- * The object is not necessay capable for the complete name resolution and
- * need not implement the {@link Context}.</p>
- * <p>
- * Both passed parameters and returned results are owned by the caller.</p>
- *
++ * <p>Represents the object, capable for the at least partial name resolution.
++ * The object is not necessay capable for the complete name resolution and
++ * need not implement the {@link Context}.</p>
++ * <p>
++ * Both passed parameters and returned results are owned by the caller.</p>
++ *
* @author Warren Levy (warrenl@redhat.com)
*/
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;
}
diff --git a/libjava/classpath/javax/naming/spi/StateFactory.java b/libjava/classpath/javax/naming/spi/StateFactory.java
index 5694f8a1a09..0c48309e3d5 100644
--- a/libjava/classpath/javax/naming/spi/StateFactory.java
+++ b/libjava/classpath/javax/naming/spi/StateFactory.java
@@ -75,5 +75,5 @@ public interface StateFactory
* @see DirectoryManager#getStateToBind
*/
Object getStateToBind(Object obj, Name name, Context nameCtx,
- Hashtable environment) throws NamingException;
+ Hashtable<?, ?> environment) throws NamingException;
}
OpenPOWER on IntegriCloud