Author: akarasulu
Date: Thu Oct 28 13:24:18 2004
New Revision: 55890
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/ResultFilteringEnumeration.java
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/SearchResultFilter.java
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/FilterServiceImpl.java
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/LookupFilter.java
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/OperationalAttributeService.java
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/SchemaService.java
Log:
added LdapContext parameters to LookupFilter and SearchResultFilter methods
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/ResultFilteringEnumeration.java
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/ResultFilteringEnumeration.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/ResultFilteringEnumeration.java
Thu Oct 28 13:24:18 2004
@@ -23,6 +23,7 @@
import javax.naming.NamingException;
import javax.naming.NamingEnumeration;
+import javax.naming.ldap.LdapContext;
import javax.naming.directory.SearchControls;
@@ -47,6 +48,8 @@
private boolean isClosed = false;
/** the controls associated with the search operation */
private final SearchControls searchControls;
+ /** the LDAP context that made the search creating this enumeration */
+ private final LdapContext ctx;
// ------------------------------------------------------------------------
@@ -59,13 +62,18 @@
* underlying enumeration.
*
* @param decorated the underlying decorated enumeration
- * @param searchControls
+ * @param searchControls the search controls associated with the search
+ * creating this enumeration
+ * @param ctx the LDAP context that made the search creating this
+ * enumeration
*/
public ResultFilteringEnumeration( NamingEnumeration decorated,
- SearchControls searchControls )
+ SearchControls searchControls,
+ LdapContext ctx )
throws NamingException
{
this.searchControls = searchControls;
+ this.ctx = ctx;
this.filters = new ArrayList();
this.decorated = decorated;
@@ -209,7 +217,7 @@
else if ( filters.size() == 1 )
{
accepted = ( ( SearchResultFilter ) filters.get( 0 ) )
- .accept( tmp, searchControls );
+ .accept( ctx, tmp, searchControls );
this.prefetched = tmp;
return;
}
@@ -218,7 +226,7 @@
for ( int ii = 0; ii < filters.size(); ii ++ )
{
SearchResultFilter filter = ( SearchResultFilter )
filters.get( ii );
- accepted &= filter.accept( tmp, searchControls );
+ accepted &= filter.accept( ctx, tmp, searchControls );
if ( ! accepted )
{
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/SearchResultFilter.java
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/SearchResultFilter.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/db/SearchResultFilter.java
Thu Oct 28 13:24:18 2004
@@ -18,6 +18,7 @@
import javax.naming.NamingException;
+import javax.naming.ldap.LdapContext;
import javax.naming.directory.SearchControls;
@@ -42,5 +43,6 @@
* @return true if the result is to be returned, false if it is to be
* discarded from the result set
*/
- boolean accept( DbSearchResult result, SearchControls controls ) throws
NamingException;
+ boolean accept( LdapContext ctx, DbSearchResult result, SearchControls
controls )
+ throws NamingException;
}
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/FilterServiceImpl.java
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/FilterServiceImpl.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/FilterServiceImpl.java
Thu Oct 28 13:24:18 2004
@@ -23,6 +23,7 @@
import javax.naming.Name;
import javax.naming.NamingException;
+import javax.naming.ldap.LdapContext;
import javax.naming.directory.*;
import org.apache.eve.db.SearchResultFilter;
@@ -104,7 +105,8 @@
{
Attributes attributes = ( Attributes ) invocation.getReturnValue();
Attributes retval = ( Attributes ) attributes.clone();
- filter( dn, retval );
+ LdapContext ctx = ( LdapContext )
invocation.getContextStack().peek();
+ filter( ctx, dn, retval );
invocation.setReturnValue( retval );
}
}
@@ -119,9 +121,10 @@
if ( invocation.getState() == InvocationStateEnum.POSTINVOCATION )
{
+ LdapContext ctx = ( LdapContext )
invocation.getContextStack().peek();
Attributes attributes = ( Attributes ) invocation.getReturnValue();
Attributes retval = ( Attributes ) attributes.clone();
- filter( dn, retval, ids );
+ filter( ctx, dn, retval, ids );
invocation.setReturnValue( retval );
}
}
@@ -145,14 +148,16 @@
SearchResultEnumeration enum ;
ResultFilteringEnumeration retval;
+ LdapContext ctx = ( LdapContext )
invocation.getContextStack().peek();
enum = ( SearchResultEnumeration ) invocation.getReturnValue();
- retval = new ResultFilteringEnumeration( enum, searchControls );
+ retval = new ResultFilteringEnumeration( enum, searchControls, ctx
);
retval.addResultFilter( new SearchResultFilter()
{
- public boolean accept( DbSearchResult result, SearchControls
controls )
+ public boolean accept( LdapContext ctx, DbSearchResult result,
+ SearchControls controls )
throws NamingException
{
- return FilterServiceImpl.this.accept( result, controls );
+ return FilterServiceImpl.this.accept( ctx, result,
controls );
}
} );
invocation.setReturnValue( retval );
@@ -172,12 +177,13 @@
* @param result the copy of the database search result to accep, modify,
* or reject before being returned
* @param controls the search controls associated with the invocation
+ * @param ctx the LDAP context that made the search call
* @return true if this result should not be returned to the callers of a
* search result enumeration
* @throws NamingException if there are errors while applying the linear
* composition of filters
*/
- private boolean accept( DbSearchResult result, SearchControls controls )
+ private boolean accept( LdapContext ctx, DbSearchResult result,
SearchControls controls )
throws NamingException
{
boolean isAccepted = true;
@@ -186,7 +192,7 @@
{
SearchResultFilter filter = ( SearchResultFilter )
resultFilters.get( ii );
- if ( ! ( isAccepted &= filter.accept( result, controls ) ) )
+ if ( ! ( isAccepted &= filter.accept( ctx, result, controls ) ) )
{
break;
}
@@ -200,16 +206,17 @@
* Applies the linear stack of entry filters to the entry looked up and
* eventually returned a caller of the lookup methods.
*
+ * @param ctx the LDAP context that made the lookup call
* @param dn the distinguished name of the lookup entry being filtered
* @param entry the attributes of the entry being filtered
* @throws NamingException if there are errors while applying the linear
* composition of filters
*/
- private void filter( Name dn, Attributes entry ) throws NamingException
+ private void filter( LdapContext ctx, Name dn, Attributes entry ) throws
NamingException
{
for ( int ii = 0; ii < lookupFilters.size(); ii++ )
{
- ( ( LookupFilter ) lookupFilters.get( ii ) ).filter( dn, entry );
+ ( ( LookupFilter ) lookupFilters.get( ii ) ).filter( ctx, dn,
entry );
}
}
@@ -218,6 +225,7 @@
* Applies the linear stack of entry filters to the entry looked up and
* eventually returned a caller of the lookup methods.
*
+ * @param ctx the LDAP context that made the lookup call
* @param dn the distinguished name of the lookup entry being filtered
* @param entry the attributes of the entry being filtered
* @param ids the attributes of the the lookup operation is supposed to
@@ -225,11 +233,12 @@
* @throws NamingException if there are errors while applying the linear
* composition of filters
*/
- private void filter( Name dn, Attributes entry, String[] ids ) throws
NamingException
+ private void filter( LdapContext ctx, Name dn, Attributes entry, String[]
ids )
+ throws NamingException
{
for ( int ii = 0; ii < lookupFilters.size(); ii++ )
{
- ( ( LookupFilter ) lookupFilters.get( ii ) ).filter( dn, entry,
ids );
+ ( ( LookupFilter ) lookupFilters.get( ii ) ).filter( ctx, dn,
entry, ids );
}
}
}
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/LookupFilter.java
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/LookupFilter.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/LookupFilter.java
Thu Oct 28 13:24:18 2004
@@ -19,6 +19,7 @@
import javax.naming.Name;
import javax.naming.NamingException;
+import javax.naming.ldap.LdapContext;
import javax.naming.directory.Attributes;
@@ -46,7 +47,8 @@
* @throws NamingException if there are any errors while trying to apply
* the filter
*/
- void filter( Name dn, Attributes entry ) throws NamingException;
+ void filter( LdapContext ctx, Name dn, Attributes entry )
+ throws NamingException;
/**
* Filters attributes to be returned from
@@ -58,5 +60,6 @@
* @throws NamingException if there are any errors while trying to apply
* the filter
*/
- void filter( Name dn, Attributes entry, String[] ids ) throws
NamingException;
+ void filter( LdapContext ctx, Name dn, Attributes entry, String[] ids )
+ throws NamingException;
}
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/OperationalAttributeService.java
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/OperationalAttributeService.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/OperationalAttributeService.java
Thu Oct 28 13:24:18 2004
@@ -21,6 +21,7 @@
import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.NamingEnumeration;
+import javax.naming.ldap.LdapContext;
import javax.naming.directory.*;
import org.apache.eve.RootNexus;
@@ -51,7 +52,7 @@
/** the database search result filter to register with filter service */
private final SearchResultFilter SEARCH_FILTER = new SearchResultFilter()
{
- public boolean accept( DbSearchResult result, SearchControls controls )
+ public boolean accept( LdapContext ctx, DbSearchResult result,
SearchControls controls )
throws NamingException
{
if ( controls.getReturningAttributes() == null )
@@ -65,12 +66,13 @@
/** the lookup filter to register with filter service */
private final LookupFilter LOOKUP_FILTER = new LookupFilter()
{
- public void filter( Name dn, Attributes entry ) throws NamingException
+ public void filter( LdapContext ctx, Name dn, Attributes entry )
+ throws NamingException
{
OperationalAttributeService.this.filter( entry );
}
- public void filter( Name dn, Attributes entry, String[] ids )
+ public void filter( LdapContext ctx, Name dn, Attributes entry,
String[] ids )
{
// do nothing since this explicity specifies which attributes
// to include - backends will automatically populate with right
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/SchemaService.java
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/SchemaService.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/SchemaService.java
Thu Oct 28 13:24:18 2004
@@ -17,9 +17,18 @@
package org.apache.eve.jndi.ibs;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.ldap.LdapContext;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.SearchControls;
+
import org.apache.eve.jndi.BaseInterceptor;
import org.apache.eve.RootNexus;
+import org.apache.eve.db.SearchResultFilter;
+import org.apache.eve.db.DbSearchResult;
import org.apache.eve.schema.GlobalRegistries;
+import org.apache.ldap.common.NotImplementedException;
/**
@@ -63,6 +72,28 @@
if ( this.filterService == null )
{
throw new NullPointerException( "the filter service cannot be
null" );
+ }
+ }
+
+
+ private class BinaryAttributeFilter implements LookupFilter,
SearchResultFilter
+ {
+ public void filter( LdapContext ctx, Name dn, Attributes entry )
+ throws NamingException
+ {
+ throw new NotImplementedException( "filter in
org.apache.eve.jndi.ibs.SchemaService.BinaryAttributeFilter not implemented!" );
+ }
+
+
+ public void filter( LdapContext ctx, Name dn, Attributes entry,
String[] ids ) throws NamingException
+ {
+ throw new NotImplementedException( "filter in
org.apache.eve.jndi.ibs.SchemaService.BinaryAttributeFilter not implemented!" );
+ }
+
+
+ public boolean accept( LdapContext ctx, DbSearchResult result,
SearchControls controls ) throws NamingException
+ {
+ throw new NotImplementedException( "accept in
org.apache.eve.jndi.ibs.SchemaService.BinaryAttributeFilter not implemented!" );
}
}
}