nyla.solutions.core.ds.JndiAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nyla.solutions.core Show documentation
Show all versions of nyla.solutions.core Show documentation
This Java API provides support for application utilities (application configuration, data encryption, debugger, text processing, and more).
The newest version!
package nyla.solutions.core.ds;
import javax.naming.NamingException;
import javax.naming.directory.InitialDirContext;
import java.security.PrivilegedAction;
import java.util.Hashtable;
public class JndiAction implements PrivilegedAction
{
public JndiAction(Hashtable,?> env)
{
if(env == null)
this.env = null;
else
this.env = (Hashtable,?>)env.clone();
}
@SuppressWarnings("unchecked")
public T run()
{
javax.naming.directory.DirContext result = null;
try
{
result = new InitialDirContext(env);
}
catch(NamingException ex)
{
ex.printStackTrace();
}
return (T)result;
}
private Hashtable,?> env;
}