@Override public Object lookup(Name name) throws NamingException { return delegating.lookup(name); }
@Override public Object lookup(String name) throws NamingException { return delegating.lookup(name); }
private void registerIdentityChangeListener(final DirContext dirContext, final Consumer<Principal> listener) throws NamingException { EventContext eventContext = (EventContext) dirContext.lookup(""); eventContext.addNamingListener("", EventContext.SUBTREE_SCOPE, new ServerNotificationListener(listener)); }
EventDirContext eventContext = (EventDirContext) context.lookup(""); eventContext.addNamingListener(base, searchFilter, searchControls, this); } else { // otherwise close context (i.e. connection as it is no longer needed)
context = createContext(); if (refreshInterval == -1 && !refreshDisabled) { eventContext = ((EventDirContext) context.lookup(""));
@Override public boolean resourceExists(String name, Context context) { try { return context.getResources().lookup(name) != null; } catch (NamingException ex) { logger.trace("", ex); throw new RuntimeException(ex); } }
@Override public InputStream getResourceStream(String name, Context context) throws IOException { try { return ((Resource) context.getResources().lookup(name)).streamContent(); } catch (NamingException ex) { logger.trace("", ex); throw new RuntimeException(ex); } }
public Object executeWithContext(DirContext ctx) throws NamingException { return ctx.lookup(dn); } });
public Object executeWithContext(DirContext ctx) throws NamingException { return ctx.lookup(dn); } });
public T executeWithContext(DirContext ctx) throws javax.naming.NamingException { Object object = ctx.lookup(dn); return mapper.mapFromContext(object); } });
public T executeWithContext(DirContext ctx) throws javax.naming.NamingException { Object object = ctx.lookup(dn); return mapper.mapFromContext(object); } });
public Object executeWithContext(DirContext ctx) throws NamingException { Object object = ctx.lookup(dn); return mapper.mapFromContext(object); } });
public T executeWithContext(DirContext ctx) throws javax.naming.NamingException { Object object = ctx.lookup(dn); return mapper.mapFromContext(object); } });
public Object executeWithContext(DirContext ctx) throws NamingException { Object object = ctx.lookup(dn); return mapper.mapFromContext(object); } });
public Object executeWithContext(DirContext ctx) throws NamingException { Object object = ctx.lookup(dn); return mapper.mapFromContext(object); } });
@Override protected ManagedObject getManagedObject() throws Throwable { // Create the directory context DirContext context = new InitialDirContext(this.properties); // Obtain the sub directory if (this.subContextName != null) { context = (DirContext) context.lookup(this.subContextName); } // Create the managed object return new JndiDirContextManagedObject(new SynchronisedDirContext( context)); }
public Object lookup(String name) throws NamingException { AliasResult result = findAlias(name); if (result.dirContext != null) { return result.dirContext.lookup(result.aliasName); } throw new NameNotFoundException(MESSAGES.resourceNotFound(name)); }
@Test public void testLookup_String_ContextMapper() throws Exception { expectGetReadOnlyContext(); Object transformed = new Object(); Object expected = new Object(); when(dirContextMock.lookup(DEFAULT_BASE_STRING)).thenReturn(expected); when(contextMapperMock.mapFromContext(expected)).thenReturn(transformed); Object actual = tested.lookup(DEFAULT_BASE_STRING, contextMapperMock); verify(dirContextMock).close(); assertThat(actual).isSameAs(transformed); }
@Test public void testLookup() throws Exception { expectGetReadOnlyContext(); Object expected = new Object(); when(dirContextMock.lookup(nameMock)).thenReturn(expected); Object actual = tested.lookup(nameMock); verify(dirContextMock).close(); assertThat(actual).isSameAs(expected); }
@Test public void testLookup_String() throws Exception { expectGetReadOnlyContext(); Object expected = new Object(); when(dirContextMock.lookup(DEFAULT_BASE_STRING)).thenReturn(expected); Object actual = tested.lookup(DEFAULT_BASE_STRING); verify(dirContextMock).close(); assertThat(actual).isSameAs(expected); }