com.evasion.sam.jaas.JNDIClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of evasion-sam-modul Show documentation
Show all versions of evasion-sam-modul Show documentation
API de l'application modulaire evasion-en-ligne
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.evasion.sam.jaas;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
/**
*
* @author sebastien
*/
public class JNDIClient {
/**
* LOGGER.
*/
private static final Logger LOGGER = Logger.getLogger(EvasionEJBLoginModule.class.getName());
private Context ctx;
public JNDIClient(String providerUrl) {
Map properties = new HashMap(2);
properties.put(Context.PROVIDER_URL, providerUrl); // "iiop://127.0.0.1:3700"
try {
ctx = new InitialContext(new Hashtable(properties));
} catch (NamingException ex) {
LOGGER.log(Level.SEVERE, "JNDI Exception ", ex);
}
}
public Object lookup(String name) {
try {
return ctx.lookup(name);
} catch (NamingException ex) {
LOGGER.log(Level.SEVERE, "JNDI lookup Exception ", ex);
}
return null;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy