List of usage examples for javax.naming Name get
public String get(int posn);
From source file:org.sonar.server.database.JndiDatabaseConnector.java
private void createJNDISubContexts(Context ctx, String jndiBinding) throws NamingException { Name name = new CompositeName(jndiBinding); for (int i = 0; i < name.size() - 1; i++) { String namingContext = name.get(i); try {/* w w w . j a v a 2s . co m*/ Object obj = ctx.lookup(namingContext); if (!(obj instanceof Context)) { throw new NamingException(namingContext + " is not a JNDI Context"); } } catch (NameNotFoundException ex) { ctx = ctx.createSubcontext(namingContext); } } }
From source file:org.springframework.ldap.core.DistinguishedName.java
/** * Construct a new <code>DistinguishedName</code> from the supplied * {@link Name}. The parts of the supplied {@link Name} must be * syntactically correct {@link LdapRdn}s. * // w w w .j a va 2 s.com * @param name the {@link Name} to construct a new * <code>DistinguishedName</code> from. */ public DistinguishedName(Name name) { Assert.notNull(name, "name cannot be null"); if (name instanceof CompositeName) { parse(LdapUtils.convertCompositeNameToString((CompositeName) name)); return; } names = new LinkedList(); for (int i = 0; i < name.size(); i++) { names.add(new LdapRdn(name.get(i))); } }
From source file:org.squale.jraf.bootstrap.naming.NamingHelper.java
/** * Bind le couple nom/valeur dans le contexte jndi. * @param in_context contexte jndi racine * @param in_name nom//from w w w.j a v a 2 s .c o m * @param in_value valeur * @throws NamingException */ public static void bind(Context in_context, String in_name, Object in_value) throws JrafConfigException { if (log.isDebugEnabled()) { log.debug("binding : " + in_name); } String lc_name = in_name; try { in_context.rebind(lc_name, in_value); } catch (NamingException e) { try { Name n = in_context.getNameParser("").parse(lc_name); while (n.size() > 1) { String ctxName = n.get(0); Context subctx = null; try { if (log.isDebugEnabled()) { log.debug("lookup: " + ctxName); } subctx = (Context) in_context.lookup(ctxName); } catch (NameNotFoundException nfe) { } if (subctx != null) { if (log.isDebugEnabled()) { log.debug("Found subcontext: " + ctxName); } in_context = subctx; } else { // log.info("Creating subcontext: " + ctxName); in_context = in_context.createSubcontext(ctxName); } n = n.getSuffix(1); } if (log.isDebugEnabled()) { log.debug("binding: " + n); } in_context.rebind(n, in_value); } catch (NamingException e1) { log.error("Impossible de recupere l'objet dans JNDI.", e); throw new JrafConfigException("Impossible de recupere l'objet dans JNDI.", e); } } if (log.isDebugEnabled()) { log.debug("Bound name: " + in_name); } }
From source file:org.wso2.carbon.appfactory.ext.jndi.ApplicationAwareCarbonInitialJNDIContext.java
private Context getInitialContext(Name name) { return getInitialContext(name.get(0)); }
From source file:org.wso2.carbon.appfactory.ext.jndi.ApplicationAwareCarbonInitialJNDIContext.java
private DirContext getDirectoryContext(Name name) throws NamingException { return getDirectoryContext(name.get(0)); }
From source file:org.wso2.carbon.appfactory.ext.jndi.ApplicationAwareCarbonInitialJNDIContext.java
private EventContext getEventContext(Name name) throws NamingException { return getEventContext(name.get(0)); }
From source file:org.wso2.carbon.appfactory.ext.jndi.ApplicationAwareCarbonInitialJNDIContext.java
private EventDirContext getEventDirContext(Name name) throws NamingException { return getEventDirContext(name.get(0)); }
From source file:org.wso2.carbon.appfactory.ext.jndi.Context.TenantSelectorContext.java
private Object getApplicationSelectorContext(Name name) throws NamingException { return getApplicationSelectorContext(name.get(0)); }
From source file:org.wso2.carbon.appfactory.ext.jndi.Context.TenantSelectorContext.java
private boolean isApplicationRequest(Name name) { return isApplicationRequest(name.get(0)); }