Creating and Destroying a Subcontext in the Naming Service : Context « JNDI LDAP « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JDK 6
25.JNDI LDAP
26.JPA
27.JSP
28.JSTL
29.Language Basics
30.Network Protocol
31.PDF RTF
32.Reflection
33.Regular Expressions
34.Scripting
35.Security
36.Servlets
37.Spring
38.Swing Components
39.Swing JFC
40.SWT JFace Eclipse
41.Threads
42.Tiny Application
43.Velocity
44.Web Services SOA
45.XML
Java » JNDI LDAP » ContextScreenshots 
Creating and Destroying a Subcontext in the Naming Service
   

import java.util.Hashtable;

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

public class Main {
  public static void main(String[] argvthrows Exception {
    String url = "iiop://localhost/";
    Hashtable<String, String> env = new Hashtable<String, String>();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
    env.put(Context.PROVIDER_URL, url);

    Context ctx = new InitialContext(env);

    // Create a subcontext.
    Context childCtx = ctx.createSubcontext("child");

    // Destroy the subcontext.
    ctx.destroySubcontext("child");
  }
}

   
    
    
  
Related examples in the same category
1.how to list the name and class of objects in a context
2.how to create a new subcontext called "ou=NewOu" with some attributes
3.how to destroy a subcontext called "ou=NewOu"
4.Listing a Context in the Naming Service
5.Deleting an entry
6.rebind Context
7.tearDown Context Recursively
8.Create a context path recursively.
9.A JNDI context wrapper implementation that delegates read-only methods to its delegate Context, and throws OperationNotSupportedException for any method with a side-effect
10.A static utility class for common JNDI operations
11.JNDI utilities
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.