/** * Must be called by all subclasses to initialize the nexus proxy and the * environment settings to be used by this Context implementation. This * constructor is used to propagate new contexts from existing contexts. * * @param principal the directory user principal that is propagated * @param dn the distinguished name of this context */ protected ServerContext(DirectoryService service, LdapPrincipal principal, Name dn) throws NamingException { this.service = service; this.dn = ( LdapDN ) dn.clone(); this.env = ( Hashtable ) service.getConfiguration().getEnvironment().clone(); this.env.put( PROVIDER_URL, dn.toString() ); this.nexusProxy = new PartitionNexusProxy( this, service ); ; this.principal = principal; }
public void add( LdapDN normName, Attributes entry ) throws NamingException { add( normName, entry, null ); }
public void addContextPartition( PartitionConfiguration config ) throws NamingException { addContextPartition( config, null ); }
public void modify( LdapDN name, int modOp, Attributes mods, Collection bypass ) throws NamingException { ensureStarted(); InvocationStack stack = InvocationStack.getInstance(); Integer modOpObj; switch ( modOp ) { case ( DirContext.ADD_ATTRIBUTE ): modOpObj = ADD_MODOP; break; case ( DirContext.REMOVE_ATTRIBUTE ): modOpObj = REMOVE_MODOP; break; case ( DirContext.REPLACE_ATTRIBUTE ): modOpObj = REPLACE_MODOP; break; default: throw new IllegalArgumentException( "bad modification operation value: " + modOp ); } stack.push( new Invocation( this, caller, "modify", new Object[] { name, modOpObj, mods }, bypass ) ); try { this.configuration.getInterceptorChain().modify( name, modOp, mods ); } finally { stack.pop(); } }
new PartitionNexusProxy( service.getJndiContext( principalDn, principal, credential, authentication, "" ), service ).addContextPartition( ( ( AddPartitionConfiguration ) cfg ) .getDirectoryPartitionConfiguration() ); PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, service ); proxy.removeContextPartition( ( ( RemovePartitionConfiguration ) cfg ).getSuffix() );
public LdapDN getMatchedName ( LdapDN dn ) throws NamingException { return getMatchedName( dn, null ); }
public void addNamingListener( Name name, int scope, NamingListener namingListener ) throws NamingException { ExprNode filter = new PresenceNode( "objectClass" ); SearchControls controls = new SearchControls(); controls.setSearchScope( scope ); ( ( PartitionNexusProxy ) this.nexusProxy ).addNamingListener( this, buildTarget( name ), filter, controls, namingListener ); listeners.add( namingListener ); }
public void delete( LdapDN name ) throws NamingException { delete( name, null ); }
public Attributes getRootDSE() throws NamingException { return getRootDSE( null ); }
public boolean compare( LdapDN name, String oid, Object value ) throws NamingException { return compare( name, oid, value, null ); }
public void bind( LdapDN bindDn, byte[] credentials, List mechanisms, String saslAuthId ) throws NamingException { bind( bindDn, credentials, mechanisms, saslAuthId, null ); }
public LdapDN getSuffix( LdapDN dn, Collection bypass ) throws NamingException { ensureStarted(); InvocationStack stack = InvocationStack.getInstance(); Object[] args = new Object[] { dn }; stack.push( new Invocation( this, caller, "getSuffix", args, bypass ) ); try { return this.configuration.getInterceptorChain().getSuffix( dn ); } finally { stack.pop(); } }
/** * Asserts that an entry is present and as a side effect if it is not, creates a LdapNameNotFoundException, which is * used to set the before exception on the invocation - eventually the exception is thrown. * * @param msg the message to prefix to the distinguished name for explanation * @param dn the distinguished name of the entry that is asserted * @throws NamingException if the entry does not exist */ private void assertHasEntry( NextInterceptor nextInterceptor, String msg, LdapDN dn ) throws NamingException { Invocation invocation = InvocationStack.getInstance().peek(); PartitionNexusProxy proxy = invocation.getProxy(); if ( !nextInterceptor.hasEntry( dn ) ) { LdapNameNotFoundException e; if ( msg != null ) { e = new LdapNameNotFoundException( msg + dn ); } else { e = new LdapNameNotFoundException( dn.toString() ); } e.setResolvedName( new LdapDN( proxy.getMatchedName( dn ).getUpName() ) ); throw e; } } }
public void addNamingListener( Name name, String filterStr, SearchControls searchControls, NamingListener namingListener ) throws NamingException { ExprNode filter; try { filter = filterParser.parse( filterStr ); } catch ( Exception e ) { NamingException e2 = new NamingException( "could not parse filter: " + filterStr ); e2.setRootCause( e ); throw e2; } ( ( PartitionNexusProxy ) getNexusProxy() ).addNamingListener( this, buildTarget( name ), filter, searchControls, namingListener ); getListeners().add( namingListener ); }
public void delete( LdapDN name, Collection bypass ) throws NamingException { ensureStarted(); InvocationStack stack = InvocationStack.getInstance(); stack.push( new Invocation( this, caller, "delete", new Object[] { name }, bypass ) ); try { this.configuration.getInterceptorChain().delete( name ); } finally { stack.pop(); } }
this.nexusProxy = new PartitionNexusProxy( this, service );
public NamingEnumeration list( LdapDN base, Collection bypass ) throws NamingException { ensureStarted(); InvocationStack stack = InvocationStack.getInstance(); stack.push( new Invocation( this, caller, "list", new Object[] { base }, bypass ) ); try { return this.configuration.getInterceptorChain().list( base ); } finally { stack.pop(); } }
public Attributes lookup( LdapDN name, Collection bypass ) throws NamingException { ensureStarted(); InvocationStack stack = InvocationStack.getInstance(); stack.push( new Invocation( this, caller, "lookup", new Object[] { name }, bypass ) ); try { return this.configuration.getInterceptorChain().lookup( name ); } finally { stack.pop(); } }
public Attributes getRootDSE( Collection bypass ) throws NamingException { ensureStarted(); InvocationStack stack = InvocationStack.getInstance(); stack.push( new Invocation( this, caller, "getRootDSE", null, bypass ) ); try { return this.configuration.getInterceptorChain().getRootDSE(); } finally { stack.pop(); } }
public LdapDN getMatchedName( LdapDN dn, Collection bypass ) throws NamingException { ensureStarted(); InvocationStack stack = InvocationStack.getInstance(); Object[] args = new Object[] { dn }; stack.push( new Invocation( this, caller, "getMatchedDn", args, bypass ) ); try { return this.configuration.getInterceptorChain().getMatchedName( dn ); } finally { stack.pop(); } }