package consumer;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public abstract class ConsumerUtils {

    @SuppressWarnings("unchecked")
    public static <T> T lookup(Class<T> className) {
        return (T) lookup(className.getName());
    }

    public static Object lookup(String className) {
        try {
            Context initialContext;
            initialContext = new InitialContext();

            return initialContext.lookup(className);
        } catch (NamingException e) {
            e.printStackTrace();
        }

        return null;
    }
}
