List of usage examples for javax.naming InvalidNameException printStackTrace
public void printStackTrace()
From source file:LdapNametoString.java
public static void main(String args[]) { String name = "cn=JuicyFruit, ou=Fruits"; try {// w w w. j ava 2s. com LdapName dn = new LdapName(name); String str = dn.toString(); System.out.println(str); LdapName dn2 = new LdapName(str); System.out.println(dn.equals(dn2)); } catch (InvalidNameException e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String args[]) { try {// ww w . j a v a 2s .c om LdapName dn = new LdapName("ou=Fruits,o=Food"); LdapName dn2 = new LdapName("ou=Summer"); System.out.println(dn.addAll(dn2)); System.out.println(dn.add(0, "o=Resources")); System.out.println(dn.add("cn=WaterMelon")); System.out.println(dn.remove(1)); System.out.println(dn); } catch (InvalidNameException e) { e.printStackTrace(); } }
From source file:ModifyLdapName.java
public static void main(String args[]) { try {//from w ww .j ava 2 s .com LdapName dn = new LdapName("ou=Fruits,o=Food"); LdapName dn2 = new LdapName("ou=Summer"); System.out.println(dn.addAll(dn2)); // ou=Summer,ou=Fruits,o=Food System.out.println(dn.add(0, "o=Resources")); // ou=Summer,ou=Fruits,o=Food,o=Resources System.out.println(dn.add("cn=WaterMelon")); // cn=WaterMelon,ou=Summer,ou=Fruits,o=Food,o=Resources System.out.println(dn.remove(1)); // o=Food System.out.println(dn); // cn=WaterMelon,ou=Summer,ou=Fruits,o=Resources } catch (InvalidNameException e) { e.printStackTrace(); } }
From source file:CompareLdapNames.java
public static void main(String args[]) { try {/*from www . j a v a 2 s. c o m*/ LdapName one = new LdapName("cn=Vincent Ryan, ou=People, o=JNDITutorial"); LdapName two = new LdapName("cn=Vincent Ryan"); LdapName three = new LdapName("o=JNDITutorial"); LdapName four = new LdapName(""); System.out.println(one.equals(two)); // false System.out.println(one.startsWith(three)); // true System.out.println(one.endsWith(two)); // true System.out.println(one.startsWith(four)); // true System.out.println(one.endsWith(four)); // true System.out.println(one.endsWith(three)); // false System.out.println(one.isEmpty()); // false System.out.println(four.isEmpty()); // true System.out.println(four.size() == 0); // true } catch (InvalidNameException e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String args[]) { try {//from w ww . j a va2 s. c o m LdapName one = new LdapName("cn=Abc Def, ou=People, o=JNDITutorial"); LdapName two = new LdapName("cn=Abc Def"); LdapName three = new LdapName("o=JNDITutorial"); LdapName four = new LdapName(""); System.out.println(one.equals(two)); System.out.println(one.startsWith(three)); System.out.println(one.endsWith(two)); System.out.println(one.startsWith(four)); System.out.println(one.endsWith(four)); System.out.println(one.endsWith(three)); System.out.println(one.isEmpty()); System.out.println(four.isEmpty()); System.out.println(four.size() == 0); } catch (InvalidNameException e) { e.printStackTrace(); } }
From source file:EscapingDNs.java
public static void main(String args[]) { try {/*from ww w. j a v a 2 s . co m*/ // DN with ',' (comma) in its attribute value String unformatted = "Juicy, Fruit"; String formatted = Rdn.escapeValue(unformatted); LdapName dn = new LdapName("cn=" + formatted); System.out.println("dn:" + dn); // DN with a '+' (plus) in its attribute value unformatted = "true+false"; formatted = Rdn.escapeValue(unformatted); dn = new LdapName("cn=" + formatted); System.out.println("dn:" + dn); // DN with a binary value as its attribute value byte[] bytes = new byte[] { 1, 2, 3, 4 }; formatted = Rdn.escapeValue(bytes); System.out.println("Orig val: " + bytes + " Escaped val: " + formatted); } catch (InvalidNameException e) { e.printStackTrace(); } }