Example usage for javax.naming Reference getFactoryClassName

List of usage examples for javax.naming Reference getFactoryClassName

Introduction

In this page you can find the example usage for javax.naming Reference getFactoryClassName.

Prototype

public String getFactoryClassName() 

Source Link

Document

Retrieves the class name of the factory of the object to which this reference refers.

Usage

From source file:org.apache.axis2.transport.jms.JMSUtils.java

public static <T> T lookup(Context context, Class<T> clazz, String name) throws NamingException {

    Object object = context.lookup(name);
    try {/*from   w  ww  .  j a  v  a2 s  .  c  om*/
        return clazz.cast(object);
    } catch (ClassCastException ex) {
        // Instead of a ClassCastException, throw an exception with some
        // more information.
        if (object instanceof Reference) {
            Reference ref = (Reference) object;
            handleException("JNDI failed to de-reference Reference with name " + name + "; is the factory "
                    + ref.getFactoryClassName() + " in your classpath?");
            return null;
        } else {
            handleException("JNDI lookup of name " + name + " returned a " + object.getClass().getName()
                    + " while a " + clazz + " was expected");
            return null;
        }
    }
}

From source file:org.wso2.carbon.apimgt.jms.listener.utils.JMSUtils.java

public static <T> T lookup(Context context, Class<T> clazz, String name) throws NamingException {

    Object object = context.lookup(name);
    try {/*w w  w.  j av a 2  s. c  om*/
        return clazz.cast(object);
    } catch (ClassCastException ex) {
        // Instead of a ClassCastException, throw an exception with some
        // more information.
        if (object instanceof Reference) {
            Reference ref = (Reference) object;
            BaseUtils.handleException("JNDI failed to de-reference Reference with name " + name
                    + "; is the factory " + ref.getFactoryClassName() + " in your classpath?");
            return null;
        } else {
            BaseUtils.handleException("JNDI lookup of name " + name + " returned a "
                    + object.getClass().getName() + " while a " + clazz + " was expected");
            return null;
        }
    }
}

From source file:org.wso2.carbon.deployment.notifier.internal.JMSUtils.java

public static <T> T lookup(Context context, Class<T> clazz, String name) throws NamingException {

    Object object = context.lookup(name);
    try {/*from w  w  w .  j  a v a 2 s. c  o  m*/
        return clazz.cast(object);
    } catch (ClassCastException ex) {
        // Instead of a ClassCastException, throw an exception with some
        // more information.
        if (object instanceof Reference) {
            Reference ref = (Reference) object;
            throw new NamingException("JNDI failed to de-reference Reference with name " + name
                    + "; is the factory " + ref.getFactoryClassName() + " in your classpath?");
        } else {
            throw new NamingException("JNDI lookup of name " + name + " returned a "
                    + object.getClass().getName() + " while a " + clazz + " was expected");
        }
    }

}

From source file:org.wso2.carbon.inbound.endpoint.protocol.jms.JMSUtils.java

private static <T> T lookup(Context context, Class<T> clazz, String name) throws NamingException {

    Object object = context.lookup(name);
    try {//from www.j  av  a2 s  .  c o m
        return clazz.cast(object);
    } catch (ClassCastException ex) {
        // Instead of a ClassCastException, throw an exception with some
        // more information.
        if (object instanceof Reference) {
            Reference ref = (Reference) object;
            handleException("JNDI failed to de-reference Reference with name " + name + "; is the factory "
                    + ref.getFactoryClassName() + " in your classpath?");
            return null;
        } else {
            handleException("JNDI lookup of name " + name + " returned a " + object.getClass().getName()
                    + " while a " + clazz + " was expected");
            return null;
        }
    }
}