List of usage examples for javax.naming Name toString
public String toString()
From source file:Util.java
/** * Lookup an object in the given context * /*from w ww .ja v a 2s. c o m*/ * @param context * the context * @param name * the name to lookup * @param clazz * the expected type * @return the object * @throws Exception * for any error */ public static Object lookup(Context context, Name name, Class clazz) throws Exception { Object result = context.lookup(name); checkObject(context, name.toString(), result, clazz); return result; }
From source file:NonSerializableFactory.java
/** Lookup a value from the NonSerializableFactory map. * @param name /*from w ww.j av a 2 s.co m*/ @return the object bound to key is one exists, null otherwise. */ public static Object lookup(Name name) { String key = name.toString(); Object value = wrapperMap.get(key); return value; }
From source file:NonSerializableFactory.java
/** Remove a binding from the NonSerializableFactory map. /* ww w.ja v a2 s . c o m*/ @param name the name for the key into NonSerializableFactory map to remove. The key is obtained as name.toString(). @throws NameNotFoundException thrown if key does not exist in the NonSerializableFactory map */ public static void unbind(Name name) throws NameNotFoundException { String key = name.toString(); if (wrapperMap.remove(key) == null) throw new NameNotFoundException(key + " was not found in the NonSerializableFactory map"); }
From source file:NonSerializableFactory.java
/** * A convenience method that simplifies the process of rebinding a * non-serializable object into a JNDI context. This version binds the * target object into the default IntitialContext using name path. * /*from w w w . jav a 2 s. c om*/ * @param name the name to use as JNDI path name. The key into the * NonSerializableFactory map is obtained from the toString() value of name. * The name parameter cannot be a 0 length name. * @param target the non-Serializable object to bind. * @param createSubcontexts a flag indicating if subcontexts of name should * be created if they do not already exist. * @throws NamingException thrown on failure to rebind key into ctx. * @author Matt Carter **/ public static synchronized void rebind(Name name, Object target, boolean createSubcontexts) throws NamingException { String key = name.toString(); InitialContext ctx = new InitialContext(); if (createSubcontexts == true && name.size() > 1) { int size = name.size() - 1; Util.createSubcontext(ctx, name.getPrefix(size)); } rebind(ctx, key, target); }
From source file:de.micromata.genome.util.runtime.jndi.SimpleJndiContext.java
protected String toString(Name name) { return name.toString(); }
From source file:com.netflix.spinnaker.fiat.roles.ldap.LdapUserRolesProvider.java
private String getUserFullDn(String userId) { String rootDn = LdapUtils.parseRootDnFromUrl(configProps.getUrl()); DistinguishedName root = new DistinguishedName(rootDn); log.debug("Root DN: " + root.toString()); String[] formatArgs = new String[] { LdapEncoder.nameEncode(userId) }; String partialUserDn;/*w ww .ja va2s .co m*/ if (!StringUtils.isEmpty(configProps.getUserSearchFilter())) { try { DirContextOperations res = ldapTemplate.searchForSingleEntry(configProps.getUserSearchBase(), configProps.getUserSearchFilter(), formatArgs); partialUserDn = res.getDn().toString(); } catch (IncorrectResultSizeDataAccessException e) { log.error("Unable to find a single user entry", e); return null; } } else { partialUserDn = configProps.getUserDnPattern().format(formatArgs); } DistinguishedName user = new DistinguishedName(partialUserDn); log.debug("User portion: " + user.toString()); try { Name fullUser = root.addAll(user); log.debug("Full user DN: " + fullUser.toString()); return fullUser.toString(); } catch (InvalidNameException ine) { log.error("Could not assemble full userDn", ine); } return null; }
From source file:ldap.Entry.java
public Entry(Name name, Attributes atts) throws InvalidNameException { this(new LdapName(name.toString()), atts); }
From source file:ldap.Entry.java
public Entry(Name name, Attribute[] atts) throws InvalidNameException { this(new LdapName(name.toString()), makeAtts(atts)); }
From source file:com.springsource.insight.plugin.ldap.TestLdapContext.java
public NameParser getNameParser(Name name) throws NamingException { return getNameParser(name.toString()); }
From source file:com.springsource.insight.plugin.ldap.TestLdapContext.java
public Name composeName(Name name, Name prefix) throws NamingException { return createName(composeName(name.toString(), prefix.toString())); }