Example usage for javax.naming Context getClass

List of usage examples for javax.naming Context getClass

Introduction

In this page you can find the example usage for javax.naming Context getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.egt.core.util.Utils.java

public static void bind2InitialContext(String name, Object obj) {
    Context c;
    try {/*w  w  w.  ja  v a 2s  .c o  m*/
        c = new InitialContext();
        Bitacora.trace(c.getClass(), "bind", name, obj);
        c.bind(name, obj);
    } catch (NamingException ex) {
        Bitacora.logFatal(ThrowableUtils.getString(ex));
    }
}

From source file:com.egt.core.util.Utils.java

public static void traceContext(String name) {
    Context c;
    try {/*from w  ww.j a  v  a 2s .  c  o m*/
        c = new InitialContext();
        Bitacora.trace(c.getClass(), "list", c.getNameInNamespace());
        traceContext(c, name);
    } catch (NamingException ex) {
        Bitacora.logFatal(ThrowableUtils.getString(ex));
    }
}

From source file:com.egt.core.util.Utils.java

public static void traceContext() {
    Context c;
    try {//from w  ww .  j  a  v  a  2 s.  co m
        c = new InitialContext();
        Bitacora.trace(c.getClass(), "list", c.getNameInNamespace());
        //          traceContext(c, "java:comp");
        //          traceContext(c, "java:global");
    } catch (NamingException ex) {
        Bitacora.logFatal(ThrowableUtils.getString(ex));
    }
}

From source file:com.egt.core.util.Utils.java

public static void createEjbSubcontext() {
    Context c;
    Context s;//from  w  w w  . java2 s. c  o  m
    try {
        c = new InitialContext();
        Bitacora.trace(c.getClass(), "createSubcontext", "comp:java/env/ejb");
        //          s = c.createSubcontext("comp:java");
        traceContext(c, "comp:java");
        //          s = s.createSubcontext("env");
        traceContext(c, "comp:java/env");
        //          s = s.createSubcontext("ejb");
        traceContext(c, "comp:java/env/ejb");
    } catch (NamingException ex) {
        Bitacora.logFatal(ThrowableUtils.getString(ex));
    }
}

From source file:com.netspective.axiom.connection.JndiConnectionProvider.java

public Class getUnderlyingImplementationClass() {
    Context jndiJdbcContext = getRootContext();
    if (jndiJdbcContext != null)
        return jndiJdbcContext.getClass();
    else/*from w  ww.j ava 2  s.c om*/
        return null;
}

From source file:org.eclipse.ecr.runtime.api.DataSourceHelper.java

public static void autodetectPrefix() {
    Context ctx = getDefaultInitCtx();
    String name = ctx == null ? null : ctx.getClass().getName();
    if ("org.nuxeo.common.jndi.NamingContext".equals(name)) { // Nuxeo-Embedded
        prefix = DEFAULT_PREFIX;/* ww  w  .  j  a  v a2 s.  c  o  m*/
    } else if ("org.jnp.interfaces.NamingContext".equals(name)) { // JBoss
        prefix = "java:";
    } else if ("org.apache.naming.SelectorContext".equals(name)) { // Tomcat
        prefix = DEFAULT_PREFIX;
    } else if ("org.mortbay.naming.local.localContextRoot".equals(name)) { // Jetty
        prefix = "jdbc";
    } else if ("com.sun.enterprise.naming.impl.SerialContext".equals(name)) { // GlassFish
        prefix = DEFAULT_PREFIX;
    } else {
        // unknown, use Java EE standard
        log.error("Unknown JNDI Context class: " + name);
        prefix = DEFAULT_PREFIX;
    }
    log.info("Using JDBC JNDI prefix: " + prefix);
}

From source file:org.nuxeo.runtime.datasource.DataSourceHelper.java

public static void autodetectPrefix() {
    Context ctx = InitialContextAccessor.getInitialContext();
    String name = ctx == null ? null : ctx.getClass().getName();
    if ("org.jnp.interfaces.NamingContext".equals(name)) { // JBoss
        prefix = "java:";
    } else if ("org.mortbay.naming.local.localContextRoot".equals(name)) { // Jetty
        prefix = "jdbc";
    } else {/*w w w.  j ava 2  s.  c  om*/
        // Standard JEE containers (Nuxeo-Embedded, Tomcat, GlassFish, ...
        prefix = DEFAULT_PREFIX;
    }
    log.info("Using JDBC JNDI prefix: " + prefix);
}

From source file:org.nuxeo.runtime.jtajca.NuxeoContainer.java

protected static String detectJNDIPrefix(Context context) {
    String name = context.getClass().getName();
    if ("org.jnp.interfaces.NamingContext".equals(name)) { // JBoss
        return "java:";
    } else if ("org.jboss.as.naming.InitialContext".equals(name)) { // Wildfly
        return "java:jboss/";
    } else if ("org.mortbay.naming.local.localContextRoot".equals(name)) { // Jetty
        return "jdbc/";
    }/*w w  w  . java 2 s. com*/
    // Standard JEE containers (Nuxeo-Embedded, Tomcat, GlassFish,
    // ...
    return "java:comp/env/";
}

From source file:org.wso2.carbon.appfactory.ext.jndi.ApplicationAwareCarbonInitialJNDIContext.java

public void close() throws NamingException {
    if (isSubTenant(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId())
            && !isBaseContextRequested()) {
        CarbonUtils.checkSecurity();//from   www .  java2  s .co m
    }

    Context ctx = this.getInitialContext();
    /* the below condition is there, because of a bug in Tomcat JNDI context close method,
     * see org.apache.naming.NamingContext#close() */
    if (!ctx.getClass().getName().equals("org.apache.naming.SelectorContext")) {
        ctx.close();
    }
}