All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nyla.solutions.core.ds.JndiAction Maven / Gradle / Ivy

Go to download

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;

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy