Package javax.naming

Examples of javax.naming.Context


                return DriverManager.getConnection(url, prop);
                //## Java 1.4 begin ##
            } else if (javax.naming.Context.class.isAssignableFrom(d)) {
                // JNDI context
                try {
                    Context context = (Context) d.newInstance();
                    DataSource ds = (DataSource) context.lookup(url);
                    String user = prop.getProperty("user");
                    String password = prop.getProperty("password");
                    if (StringUtils.isNullOrEmpty(user) && StringUtils.isNullOrEmpty(password)) {
                        return ds.getConnection();
                    }
View Full Code Here


   * Resolve the name inside the javaURLContext
   * Result must be a Context + the name in this Context
   */
  private ResolveResult findContextFor(String name) throws NamingException {
    String rname = getRelativeName(name);
    Context context = null;

    if (rname.equals("")) {
      // null name refers to this context
      context = new scnURLContext(myEnv);
    } else {
View Full Code Here

      return new scnURLContext(myEnv);
    }

    // Retrieve the correct context to resolve the reminding name
    ResolveResult r = findContextFor(name);
    Context ctx = (Context) r.getResolvedObj();
    String rname = r.getRemainingName().toString();
   

    Object o =  ctx.lookup(rname);
    return o;
    ////////////////////////////
    // Resolve the name in its proper context
    //return ctx.lookup(rname);
  }
View Full Code Here

   * @throws  NamingException if a naming exception is encountered
   */
  public void bind(String name, Object obj) throws NamingException {
    // Retrieve the correct context for this name
    ResolveResult r = findContextFor(name);
    Context ctx = (Context) r.getResolvedObj();
    String rname = r.getRemainingName().toString();

    // Bind the name in its proper context
    ctx.bind(rname, obj);
  }
View Full Code Here

   * @throws  NamingException if a naming exception is encountered
   */
  public void rebind(String name, Object obj) throws NamingException {
    // Retrieve the correct context for this name
    ResolveResult r = findContextFor(name);
    Context ctx = (Context) r.getResolvedObj();
    String rname = r.getRemainingName().toString();

    // Rebind the name in its proper context
    ctx.rebind(rname, obj);
  }
View Full Code Here

   * @throws  NamingException if a naming exception is encountered
   */
  public void unbind(String name) throws NamingException {
    // Retrieve the correct context for this name
    ResolveResult r = findContextFor(name);
    Context ctx = (Context) r.getResolvedObj();
    String rname = r.getRemainingName().toString();

    // Unbind the name in its proper context
    ctx.unbind(rname);
  }
View Full Code Here

   * @throws  NamingException if a naming exception is encountered
   */
  public NamingEnumeration list(String name) throws NamingException {
    // Retrieve the correct context to resolve the reminding name
    ResolveResult r = findContextFor(name);
    Context ctx = (Context) r.getResolvedObj();
    String rname = r.getRemainingName().toString();

    // List the correct Context
    return ctx.list(rname);
  }
View Full Code Here

   * @throws  NamingException if a naming exception is encountered
   */
  public NamingEnumeration listBindings(String name) throws NamingException {
    // Retrieve the correct context to resolve the reminding name
    ResolveResult r = findContextFor(name);
    Context ctx = (Context) r.getResolvedObj();
    String rname = r.getRemainingName().toString();

    // List the correct Context
    return ctx.listBindings(rname);
  }
View Full Code Here

   * @throws  NamingException if a naming exception is encountered
   */
  public Context createSubcontext(String name) throws NamingException {
    // Retrieve the correct context to resolve the reminding name
    ResolveResult r = findContextFor(name);
    Context ctx = (Context) r.getResolvedObj();
    String rname = r.getRemainingName().toString();
   
    // create subcontext
    return ctx.createSubcontext(rname);
  }
View Full Code Here

      return new scnURLContext(myEnv);
    }

    // Retrieve the correct context to resolve the reminding name
    ResolveResult r = findContextFor(name);
    Context ctx = (Context) r.getResolvedObj();
    String rname = r.getRemainingName().toString();

    // Resolve the name in its proper context
    return ctx.lookupLink(rname);
  }
View Full Code Here

TOP

Related Classes of javax.naming.Context

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.