List of usage examples for javax.naming Context INITIAL_CONTEXT_FACTORY
String INITIAL_CONTEXT_FACTORY
To view the source code for javax.naming Context INITIAL_CONTEXT_FACTORY.
Click Source Link
From source file:Main.java
public static void main(String[] argv) throws Exception { String url = "iiop://localhost/"; Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory"); env.put(Context.PROVIDER_URL, url); Context ctx = new InitialContext(env); }
From source file:Main.java
public static void main(String[] argv) throws Exception { String url = "iiop://localhost/"; Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory"); env.put(Context.PROVIDER_URL, url); Context ctx = new InitialContext(env); Object obj = ctx.lookup("Sample"); }
From source file:List.java
public static void main(String[] args) throws Exception { Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); env.put(Context.PROVIDER_URL, "file:/tmp/marketing"); Object item = null;/* www . j a v a 2 s . com*/ Context initCtx = new InitialContext(env); NamingEnumeration nl = initCtx.list("reports"); if (nl == null) System.out.println("\nNo items in name list"); else while (nl.hasMore()) { item = nl.next(); System.out.println("item's class is " + item.getClass().getName()); System.out.println(item); System.out.println(""); } }
From source file:Main.java
public static void main(String[] argv) throws 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"); }
From source file:Main.java
public static void main(String[] argv) throws 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"); Context obj = (Context) childCtx.lookup("grandChild"); String fullname = obj.getNameInNamespace(); }
From source file:Main.java
public static void main(String[] argv) throws 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); // Add a binding. ctx.bind("Name", null); // Replace a binding. ctx.rebind("Name", null); // Remove a binding. ctx.unbind("Name"); // Rename a binding. ctx.rename("Name", "NewSample"); }
From source file:Print.java
public static void main(String[] args) throws Exception { Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); env.put(Context.PROVIDER_URL, "file:/tmp/marketing"); Context initCtx = new InitialContext(env); File f = (File) initCtx.lookup("reports/report1.txt"); if (f != null) { BufferedReader br = new BufferedReader(new FileReader(f)); String l = null;//from w ww .jav a2s. co m while ((l = br.readLine()) != null) System.out.println(l); } }
From source file:Main.java
public static void main(String[] argv) throws Exception { String url = "ldap://localhost/o=JNDITutorial"; Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, url); DirContext ctx = new InitialDirContext(env); }
From source file:Main.java
public static void main(String[] argv) throws Exception { Hashtable<String, String> env = new Hashtable<String, String>(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "yourURL"); DirContext ctx = new InitialDirContext(env); DirContext tedClasses = ctx.getSchemaClassDefinition("cn=YourName, ou=People"); NamingEnumeration e = tedClasses.search("", null); while (e.hasMore()) { DirContext entry = (DirContext) e.next(); System.out.println(entry); }//from www .j a v a2 s .c o m }
From source file:Main.java
public static void main(String[] argv) throws 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); NameParser parser = ctx.getNameParser(""); Name dn = parser.parse("cn=John, ou=People, o=JNDITutorial"); dn.remove(1);//from w ww . j a v a2 s.c o m dn.add(0, "c=us"); dn.add("cn=fs"); }