# Interface EventDirContext

All Superinterfaces:
  `Context, DirContext, EventContext`

public interface EventDirContext extends EventContext, DirContext
Contains methods for registering listeners to be notified of events fired when objects named in a directory context changes.

The methods in this interface support identification of objects by RFC 2254 search filters.

Using the search filter, it is possible to register interest in objects that do not exist at the time of registration but later come into existence and satisfy the filter. However, there might be limitations in the extent to which this can be supported by the service provider and underlying protocol/service. If the caller submits a filter that cannot be supported in this way, `addNamingListener()` throws an `InvalidSearchFilterException`.

See `EventContext` for a description of event source and target, and information about listener registration/deregistration that are also applicable to methods in this interface. See the package description for information on threading issues.

A `SearchControls` or array object passed as a parameter to any method is owned by the caller. The service provider will not modify the object or keep a reference to it.

Since:
  1.3

## Field Summary

### Fields declared in interface Context

`AUTHORITATIVE, BATCHSIZE, DNS_URL, INITIAL_CONTEXT_FACTORY, LANGUAGE, OBJECT_FACTORIES, PROVIDER_URL, REFERRAL, SECURITY_AUTHENTICATION, SECURITY_CREDENTIALS, SECURITY_PRINCIPAL, SECURITY_PROTOCOL, STATE_FACTORIES, URL_PKG_PREFIXES`
Modifier and Type
Field
Description
`static final String`
`AUTHORITATIVE`
Constant that holds the name of the environment property for specifying the authoritativeness of the service requested.
`static final String`
`BATCHSIZE`
Constant that holds the name of the environment property for specifying the batch size to use when returning data via the service's protocol.
`static final String`
`DNS_URL`
Constant that holds the name of the environment property for specifying the DNS host and domain names to use for the JNDI URL context (for example, "dns://somehost/wiz.com").
`static final String`
`INITIAL_CONTEXT_FACTORY`
Constant that holds the name of the environment property for specifying the initial context factory to use.
`static final String`
`LANGUAGE`
Constant that holds the name of the environment property for specifying the preferred language to use with the service.
`static final String`
`OBJECT_FACTORIES`
Constant that holds the name of the environment property for specifying the list of object factories to use.
`static final String`
`PROVIDER_URL`
Constant that holds the name of the environment property for specifying configuration information for the service provider to use.
`static final String`
`REFERRAL`
Constant that holds the name of the environment property for specifying how referrals encountered by the service provider are to be processed.
`static final String`
`SECURITY_AUTHENTICATION`
Constant that holds the name of the environment property for specifying the security level to use.
`static final String`
`SECURITY_CREDENTIALS`
Constant that holds the name of the environment property for specifying the credentials of the principal for authenticating the caller to the service.
`static final String`
`SECURITY_PRINCIPAL`
Constant that holds the name of the environment property for specifying the identity of the principal for authenticating the caller to the service.
`static final String`
`SECURITY_PROTOCOL`
Constant that holds the name of the environment property for specifying the security protocol to use.
`static final String`
`STATE_FACTORIES`
Constant that holds the name of the environment property for specifying the list of state factories to use.
`static final String`
`URL_PKG_PREFIXES`
Constant that holds the name of the environment property for specifying the list of package prefixes to use when loading in URL context factories.

### Fields declared in interface DirContext

`ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE`
Modifier and Type
Field
Description
`static final int`
`ADD_ATTRIBUTE`
This constant specifies to add an attribute with the specified values.
`static final int`
`REMOVE_ATTRIBUTE`
This constant specifies to delete the specified attribute values from the attribute.
`static final int`
`REPLACE_ATTRIBUTE`
This constant specifies to replace an attribute with specified values.

### Fields declared in interface EventContext

`OBJECT_SCOPE, ONELEVEL_SCOPE, SUBTREE_SCOPE`
Modifier and Type
Field
Description
`static final int`
`OBJECT_SCOPE`
Constant for expressing interest in events concerning the object named by the target.
`static final int`
`ONELEVEL_SCOPE`
Constant for expressing interest in events concerning objects in the context named by the target, excluding the context named by the target.
`static final int`
`SUBTREE_SCOPE`
Constant for expressing interest in events concerning objects in the subtree of the object named by the target, including the object named by the target.

## Method Summary

Modifier and Type
Method
Description
`void`
`addNamingListener(String target, String filter, Object[] filterArgs, SearchControls ctls, NamingListener l)`
Adds a listener for receiving naming events fired when objects identified by the search filter `filter` and filter arguments at the object named by the string target name are modified.
`void`
`addNamingListener(String target, String filter, SearchControls ctls, NamingListener l)`
Adds a listener for receiving naming events fired when objects identified by the search filter `filter` at the object named by the string target name are modified.
`void`
`addNamingListener(Name target, String filter, Object[] filterArgs, SearchControls ctls, NamingListener l)`
Adds a listener for receiving naming events fired when objects identified by the search filter `filter` and filter arguments at the object named by the target are modified.
`void`
`addNamingListener(Name target, String filter, SearchControls ctls, NamingListener l)`
Adds a listener for receiving naming events fired when objects identified by the search filter `filter` at the object named by target are modified.

### Methods declared in interface Context

`addToEnvironment, bind, bind, close, composeName, composeName, createSubcontext, createSubcontext, destroySubcontext, destroySubcontext, getEnvironment, getNameInNamespace, getNameParser, getNameParser, list, list, listBindings, listBindings, lookup, lookup, lookupLink, lookupLink, rebind, rebind, removeFromEnvironment, rename, rename, unbind, unbind`
Modifier and Type
Method
Description
`Object`
`addToEnvironment(String propName, Object propVal)`
Adds a new environment property to the environment of this context.
`void`
`bind(String name, Object obj)`
Binds a name to an object.
`void`
`bind(Name name, Object obj)`
Binds a name to an object.
`void`
`close()`
Closes this context.
`String`
`composeName(String name, String prefix)`
Composes the name of this context with a name relative to this context.
`Name`
`composeName(Name name, Name prefix)`
Composes the name of this context with a name relative to this context.
`Context`
`createSubcontext(String name)`
Creates and binds a new context.
`Context`
`createSubcontext(Name name)`
Creates and binds a new context.
`void`
`destroySubcontext(String name)`
Destroys the named context and removes it from the namespace.
`void`
`destroySubcontext(Name name)`
Destroys the named context and removes it from the namespace.
`Hashtable<?,?>`
`getEnvironment()`
Retrieves the environment in effect for this context.
`String`
`getNameInNamespace()`
Retrieves the full name of this context within its own namespace.
`NameParser`
`getNameParser(String name)`
Retrieves the parser associated with the named context.
`NameParser`
`getNameParser(Name name)`
Retrieves the parser associated with the named context.
`NamingEnumeration<NameClassPair>`
`list(String name)`
Enumerates the names bound in the named context, along with the class names of objects bound to them.
`NamingEnumeration<NameClassPair>`
`list(Name name)`
Enumerates the names bound in the named context, along with the class names of objects bound to them.
`NamingEnumeration<Binding>`
`listBindings(String name)`
Enumerates the names bound in the named context, along with the objects bound to them.
`NamingEnumeration<Binding>`
`listBindings(Name name)`
Enumerates the names bound in the named context, along with the objects bound to them.
`Object`
`lookup(String name)`
Retrieves the named object.
`Object`
`lookup(Name name)`
Retrieves the named object.
`Object`
`lookupLink(String name)`
Retrieves the named object, following links except for the terminal atomic component of the name.
`Object`
`lookupLink(Name name)`
Retrieves the named object, following links except for the terminal atomic component of the name.
`void`
`rebind(String name, Object obj)`
Binds a name to an object, overwriting any existing binding.
`void`
`rebind(Name name, Object obj)`
Binds a name to an object, overwriting any existing binding.
`Object`
`removeFromEnvironment(String propName)`
Removes an environment property from the environment of this context.
`void`
`rename(String oldName, String newName)`
Binds a new name to the object bound to an old name, and unbinds the old name.
`void`
`rename(Name oldName, Name newName)`
Binds a new name to the object bound to an old name, and unbinds the old name.
`void`
`unbind(String name)`
Unbinds the named object.
`void`
`unbind(Name name)`
Unbinds the named object.

### Methods declared in interface DirContext

`bind, bind, createSubcontext, createSubcontext, getAttributes, getAttributes, getAttributes, getAttributes, getSchema, getSchema, getSchemaClassDefinition, getSchemaClassDefinition, modifyAttributes, modifyAttributes, modifyAttributes, modifyAttributes, rebind, rebind, search, search, search, search, search, search, search, search`
Modifier and Type
Method
Description
`void`
`bind(String name, Object obj, Attributes attrs)`
Binds a name to an object, along with associated attributes.
`void`
`bind(Name name, Object obj, Attributes attrs)`
Binds a name to an object, along with associated attributes.
`DirContext`
`createSubcontext(String name, Attributes attrs)`
Creates and binds a new context, along with associated attributes.
`DirContext`
`createSubcontext(Name name, Attributes attrs)`
Creates and binds a new context, along with associated attributes.
`Attributes`
`getAttributes(String name)`
Retrieves all of the attributes associated with a named object.
`Attributes`
`getAttributes(String name, String[] attrIds)`
Retrieves selected attributes associated with a named object.
`Attributes`
`getAttributes(Name name)`
Retrieves all of the attributes associated with a named object.
`Attributes`
`getAttributes(Name name, String[] attrIds)`
Retrieves selected attributes associated with a named object.
`DirContext`
`getSchema(String name)`
Retrieves the schema associated with the named object.
`DirContext`
`getSchema(Name name)`
Retrieves the schema associated with the named object.
`DirContext`
`getSchemaClassDefinition(String name)`
Retrieves a context containing the schema objects of the named object's class definitions.
`DirContext`
`getSchemaClassDefinition(Name name)`
Retrieves a context containing the schema objects of the named object's class definitions.
`void`
`modifyAttributes(String name, int mod_op, Attributes attrs)`
Modifies the attributes associated with a named object.
`void`
`modifyAttributes(String name, ModificationItem[] mods)`
Modifies the attributes associated with a named object using an ordered list of modifications.
`void`
`modifyAttributes(Name name, int mod_op, Attributes attrs)`
Modifies the attributes associated with a named object.
`void`
`modifyAttributes(Name name, ModificationItem[] mods)`
Modifies the attributes associated with a named object using an ordered list of modifications.
`void`
`rebind(String name, Object obj, Attributes attrs)`
Binds a name to an object, along with associated attributes, overwriting any existing binding.
`void`
`rebind(Name name, Object obj, Attributes attrs)`
Binds a name to an object, along with associated attributes, overwriting any existing binding.
`NamingEnumeration<SearchResult>`
`search(String name, String filterExpr, Object[] filterArgs, SearchControls cons)`
Searches in the named context or object for entries that satisfy the given search filter.
`NamingEnumeration<SearchResult>`
`search(String name, String filter, SearchControls cons)`
Searches in the named context or object for entries that satisfy the given search filter.
`NamingEnumeration<SearchResult>`
`search(String name, Attributes matchingAttributes)`
Searches in a single context for objects that contain a specified set of attributes.
`NamingEnumeration<SearchResult>`
`search(String name, Attributes matchingAttributes, String[] attributesToReturn)`
Searches in a single context for objects that contain a specified set of attributes, and retrieves selected attributes.
`NamingEnumeration<SearchResult>`
`search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons)`
Searches in the named context or object for entries that satisfy the given search filter.
`NamingEnumeration<SearchResult>`
`search(Name name, String filter, SearchControls cons)`
Searches in the named context or object for entries that satisfy the given search filter.
`NamingEnumeration<SearchResult>`
`search(Name name, Attributes matchingAttributes)`
Searches in a single context for objects that contain a specified set of attributes.
`NamingEnumeration<SearchResult>`
`search(Name name, Attributes matchingAttributes, String[] attributesToReturn)`
Searches in a single context for objects that contain a specified set of attributes, and retrieves selected attributes.

### Methods declared in interface EventContext

`addNamingListener, addNamingListener, removeNamingListener, targetMustExist`
Modifier and Type
Method
Description
`void`
`addNamingListener(String target, int scope, NamingListener l)`
Adds a listener for receiving naming events fired when the object named by the string target name and scope changes.
`void`
`addNamingListener(Name target, int scope, NamingListener l)`
Adds a listener for receiving naming events fired when the object(s) identified by a target and scope changes.
`void`
`removeNamingListener(NamingListener l)`
Removes a listener from receiving naming events fired by this `EventContext`.
`boolean`
`targetMustExist()`
Determines whether a listener can register interest in a target that does not exist.

## Method Details

### addNamingListener

void addNamingListener(Name target, String filter, SearchControls ctls, NamingListener l) throws NamingException
Adds a listener for receiving naming events fired when objects identified by the search filter `filter` at the object named by target are modified.

The scope, returningObj flag, and returningAttributes flag from the search controls `ctls` are used to control the selection of objects that the listener is interested in, and determines what information is returned in the eventual `NamingEvent` object. Note that the requested information to be returned might not be present in the `NamingEvent` object if they are unavailable or could not be obtained by the service provider or service.

Parameters:
  `target` - The nonnull name of the object resolved relative to this context.
  `filter` - The nonnull string filter (see RFC2254).
  `ctls` - The possibly null search controls. If null, the default search controls are used.
  `l` - The nonnull listener.
Throws:
  `NamingException` - If a problem was encountered while adding the listener.
See Also:
  - `EventContext.removeNamingListener(NamingListener)`
  - `DirContext.search(javax.naming.Name, java.lang.String, javax.naming.directory.SearchControls)`

### addNamingListener

void addNamingListener(String target, String filter, SearchControls ctls, NamingListener l) throws NamingException
Adds a listener for receiving naming events fired when objects identified by the search filter `filter` at the object named by the string target name are modified. See the overload that accepts a `Name` for details of how this method behaves.

Parameters:
  `target` - The nonnull string name of the object resolved relative to this context.
  `filter` - The nonnull string filter (see RFC2254).
  `ctls` - The possibly null search controls. If null, the default search controls is used.
  `l` - The nonnull listener.
Throws:
  `NamingException` - If a problem was encountered while adding the listener.
See Also:
  - `EventContext.removeNamingListener(NamingListener)`
  - `DirContext.search(java.lang.String, java.lang.String, javax.naming.directory.SearchControls)`

### addNamingListener

void addNamingListener(Name target, String filter, Object[] filterArgs, SearchControls ctls, NamingListener l) throws NamingException
Adds a listener for receiving naming events fired when objects identified by the search filter `filter` and filter arguments at the object named by the target are modified. The scope, returningObj flag, and returningAttributes flag from the search controls `ctls` are used to control the selection of objects that the listener is interested in, and determines what information is returned in the eventual `NamingEvent` object. Note that the requested information to be returned might not be present in the `NamingEvent` object if they are unavailable or could not be obtained by the service provider or service.

Parameters:
  `target` - The nonnull name of the object resolved relative to this context.
  `filter` - The nonnull string filter (see RFC2254).
  `filterArgs` - The possibly null array of arguments for the filter.
  `ctls` - The possibly null search controls. If null, the default search controls are used.
  `l` - The nonnull listener.
Throws:
  `NamingException` - If a problem was encountered while adding the listener.
See Also:
  - `EventContext.removeNamingListener(NamingListener)`
  - `DirContext.search(javax.naming.Name, java.lang.String, java.lang.Object[], javax.naming.directory.SearchControls)`

### addNamingListener

void addNamingListener(String target, String filter, Object[] filterArgs, SearchControls ctls, NamingListener l) throws NamingException
Adds a listener for receiving naming events fired when objects identified by the search filter `filter` and filter arguments at the object named by the string target name are modified. See the overload that accepts a `Name` for details of how this method behaves.

Parameters:
  `target` - The nonnull string name of the object resolved relative to this context.
  `filter` - The nonnull string filter (see RFC2254).
  `filterArgs` - The possibly null array of arguments for the filter.
  `ctls` - The possibly null search controls. If null, the default search controls is used.
  `l` - The nonnull listener.
Throws:
  `NamingException` - If a problem was encountered while adding the listener.
See Also:
  - `EventContext.removeNamingListener(NamingListener)`
  - `DirContext.search(java.lang.String, java.lang.String, java.lang.Object[], javax.naming.directory.SearchControls)`