1. /*
  2. * @(#)EventDirContext.java 1.5 00/02/02
  3. *
  4. * Copyright 1999, 2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package javax.naming.event;
  11. import javax.naming.Name;
  12. import javax.naming.NamingException;
  13. import javax.naming.directory.DirContext;
  14. import javax.naming.directory.SearchControls;
  15. /**
  16. * Contains methods for registering listeners to be notified
  17. * of events fired when objects named in a directory context changes.
  18. *<p>
  19. * The methods in this interface support identification of objects by
  20. * <A HREF="ftp://ftp.isi.edu/in-notes/rfc2254.txt">RFC 2254</a>
  21. * search filters.
  22. *
  23. *<P>Using the search filter, it is possible to register interest in objects
  24. * that do not exist at the time of registration but later come into existence and
  25. * satisfy the filter. However, there might be limitations in the extent
  26. * to which this can be supported by the service provider and underlying
  27. * protocol/service. If the caller submits a filter that cannot be
  28. * supported in this way, <tt>addNamingListener()</tt> throws an
  29. * <tt>InvalidSearchFilterException</tt>.
  30. *<p>
  31. * See <tt>EventContext</tt> for a description of event source
  32. * and target, and information about listener registration/deregistration
  33. * that are also applicable to methods in this interface.
  34. * See the
  35. * <a href=package-summary.html#THREADING>package description</a>
  36. * for information on threading issues.
  37. *<p>
  38. * A <tt>SearchControls</tt> or array object
  39. * passed as a parameter to any method is owned by the caller.
  40. * The service provider will not modify the object or keep a reference to it.
  41. *
  42. * @author Rosanna Lee
  43. * @author Scott Seligman
  44. * @version 1.5 00/02/02
  45. * @since 1.3
  46. */
  47. public interface EventDirContext extends EventContext, DirContext {
  48. /**
  49. * Adds a listener for receiving naming events fired
  50. * when objects identified by the search filter <tt>filter</tt> at
  51. * the object named by target are modified.
  52. * <p>
  53. * The scope, returningObj flag, and returningAttributes flag from
  54. * the search controls <tt>ctls</tt> are used to control the selection
  55. * of objects that the listener is interested in,
  56. * and determines what information is returned in the eventual
  57. * <tt>NamingEvent</tt> object. Note that the requested
  58. * information to be returned might not be present in the <tt>NamingEvent</tt>
  59. * object if they are unavailable or could not be obtained by the
  60. * service provider or service.
  61. *
  62. * @param target The nonnull name of the object resolved relative to this context.
  63. * @param filter The nonnull string filter (see RFC2254).
  64. * @param ctls The possibly null search controls. If null, the default
  65. * search controls are used.
  66. * @param l The nonnull listener.
  67. * @exception NamingException If a problem was encountered while
  68. * adding the listener.
  69. * @see EventContext#removeNamingListener
  70. * @see javax.naming.directory.DirContext#search(javax.naming.Name, java.lang.String, javax.naming.directory.SearchControls)
  71. */
  72. void addNamingListener(Name target, String filter, SearchControls ctls,
  73. NamingListener l) throws NamingException;
  74. /**
  75. * Adds a listener for receiving naming events fired when
  76. * objects identified by the search filter <tt>filter</tt> at the
  77. * object named by the string target name are modified.
  78. * See the overload that accepts a <tt>Name</tt> for details of
  79. * how this method behaves.
  80. *
  81. * @param target The nonnull string name of the object resolved relative to this context.
  82. * @param filter The nonnull string filter (see RFC2254).
  83. * @param ctls The possibly null search controls. If null, the default
  84. * search controls is used.
  85. * @param l The nonnull listener.
  86. * @exception NamingException If a problem was encountered while
  87. * adding the listener.
  88. * @see EventContext#removeNamingListener
  89. * @see javax.naming.directory.DirContext#search(java.lang.String, java.lang.String, javax.naming.directory.SearchControls)
  90. */
  91. void addNamingListener(String target, String filter, SearchControls ctls,
  92. NamingListener l) throws NamingException;
  93. /**
  94. * Adds a listener for receiving naming events fired
  95. * when objects identified by the search filter <tt>filter</tt> and
  96. * filter arguments at the object named by the target are modified.
  97. * The scope, returningObj flag, and returningAttributes flag from
  98. * the search controls <tt>ctls</tt> are used to control the selection
  99. * of objects that the listener is interested in,
  100. * and determines what information is returned in the eventual
  101. * <tt>NamingEvent</tt> object. Note that the requested
  102. * information to be returned might not be present in the <tt>NamingEvent</tt>
  103. * object if they are unavailable or could not be obtained by the
  104. * service provider or service.
  105. *
  106. * @param target The nonnull name of the object resolved relative to this context.
  107. * @param filter The nonnull string filter (see RFC2254).
  108. * @param filterArgs The possibly null array of arguments for the filter.
  109. * @param ctls The possibly null search controls. If null, the default
  110. * search controls are used.
  111. * @param l The nonnull listener.
  112. * @exception NamingException If a problem was encountered while
  113. * adding the listener.
  114. * @see EventContext#removeNamingListener
  115. * @see javax.naming.directory.DirContext#search(javax.naming.Name, java.lang.String, java.lang.Object[], javax.naming.directory.SearchControls)
  116. */
  117. void addNamingListener(Name target, String filter, Object[] filterArgs,
  118. SearchControls ctls, NamingListener l) throws NamingException;
  119. /**
  120. * Adds a listener for receiving naming events fired when
  121. * objects identified by the search filter <tt>filter</tt>
  122. * and filter arguments at the
  123. * object named by the string target name are modified.
  124. * See the overload that accepts a <tt>Name</tt> for details of
  125. * how this method behaves.
  126. *
  127. * @param target The nonnull string name of the object resolved relative to this context.
  128. * @param filter The nonnull string filter (see RFC2254).
  129. * @param filterArgs The possibly null array of arguments for the filter.
  130. * @param ctls The possibly null search controls. If null, the default
  131. * search controls is used.
  132. * @param l The nonnull listener.
  133. * @exception NamingException If a problem was encountered while
  134. * adding the listener.
  135. * @see EventContext#removeNamingListener
  136. * @see javax.naming.directory.DirContext#search(java.lang.String, java.lang.String, java.lang.Object[], javax.naming.directory.SearchControls) */
  137. void addNamingListener(String target, String filter, Object[] filterArgs,
  138. SearchControls ctls, NamingListener l) throws NamingException;
  139. }