You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/02/10 11:49:57 UTC
svn commit: r376623 [5/38] - in /directory/sandbox/akarasulu/rc1/apacheds:
core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/
core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/
core-shared/src/main/java/org/a...
Modified: directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceTest.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core-unit/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceTest.java Fri Feb 10 02:48:07 2006
@@ -86,7 +86,8 @@
Attribute attribute = new LockableAttributeImpl( "administrativeRole" );
attribute.add( role );
ModificationItem item = new ModificationItem( DirContext.ADD_ATTRIBUTE, attribute );
- super.sysRoot.modifyAttributes( "", new ModificationItem[] { item } );
+ super.sysRoot.modifyAttributes( "", new ModificationItem[]
+ { item } );
}
@@ -95,7 +96,8 @@
Map resultMap = new HashMap();
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- controls.setReturningAttributes( new String[] { "+", "*" } );
+ controls.setReturningAttributes( new String[]
+ { "+", "*" } );
NamingEnumeration results = super.sysRoot.search( "", "(objectClass=*)", controls );
while ( results.hasMore() )
{
@@ -129,8 +131,8 @@
// --------------------------------------------------------------------
Attributes unmarked = ( Attributes ) results.get( "cn=unmarked,ou=system" );
- assertNull( "cn=unmarked,ou=system should not be marked",
- unmarked.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "cn=unmarked,ou=system should not be marked", unmarked
+ .get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
}
@@ -141,7 +143,9 @@
super.sysRoot.createSubcontext( "cn=testsubentry", getTestSubentry() );
fail( "should never get here: cannot create subentry under regular entries" );
}
- catch ( LdapNoSuchAttributeException e ) {}
+ catch ( LdapNoSuchAttributeException e )
+ {
+ }
addAdministrativeRole( "autonomousArea" );
super.sysRoot.createSubcontext( "cn=testsubentry", getTestSubentry() );
@@ -180,24 +184,20 @@
// --------------------------------------------------------------------
Attributes system = ( Attributes ) results.get( "ou=system" );
- assertNull( "ou=system should not be marked",
- system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=system should not be marked", system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes users = ( Attributes ) results.get( "ou=users,ou=system" );
- assertNull( "ou=users,ou=system should not be marked",
- users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=users,ou=system should not be marked", users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes groups = ( Attributes ) results.get( "ou=groups,ou=system" );
- assertNull( "ou=groups,ou=system should not be marked",
- groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=groups,ou=system should not be marked", groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes admin = ( Attributes ) results.get( "uid=admin,ou=system" );
- assertNull( "uid=admin,ou=system should not be marked",
- admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "uid=admin,ou=system should not be marked", admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes sysPrefRoot = ( Attributes ) results.get( "prefNodeName=sysPrefRoot,ou=system" );
- assertNull( "prefNode=sysPrefRoot,ou=system should not be marked",
- sysPrefRoot.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "prefNode=sysPrefRoot,ou=system should not be marked", sysPrefRoot
+ .get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
}
@@ -241,24 +241,20 @@
// --------------------------------------------------------------------
Attributes system = ( Attributes ) results.get( "ou=system" );
- assertNull( "ou=system should not be marked",
- system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=system should not be marked", system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes users = ( Attributes ) results.get( "ou=users,ou=system" );
- assertNull( "ou=users,ou=system should not be marked",
- users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=users,ou=system should not be marked", users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes groups = ( Attributes ) results.get( "ou=groups,ou=system" );
- assertNull( "ou=groups,ou=system should not be marked",
- groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=groups,ou=system should not be marked", groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes admin = ( Attributes ) results.get( "uid=admin,ou=system" );
- assertNull( "uid=admin,ou=system should not be marked",
- admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "uid=admin,ou=system should not be marked", admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes sysPrefRoot = ( Attributes ) results.get( "prefNodeName=sysPrefRoot,ou=system" );
- assertNull( "prefNode=sysPrefRoot,ou=system should not be marked",
- sysPrefRoot.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "prefNode=sysPrefRoot,ou=system should not be marked", sysPrefRoot
+ .get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
// --------------------------------------------------------------------
// Now modify the subentry by introducing an exclusion
@@ -267,7 +263,8 @@
Attribute subtreeSpecification = new LockableAttributeImpl( "subtreeSpecification" );
subtreeSpecification.add( "{ base \"ou=configuration\", specificExclusions { chopBefore:\"ou=services\" } }" );
ModificationItem item = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, subtreeSpecification );
- super.sysRoot.modifyAttributes( "cn=testsubentry", new ModificationItem[] { item } );
+ super.sysRoot.modifyAttributes( "cn=testsubentry", new ModificationItem[]
+ { item } );
results = getAllEntries();
// --------------------------------------------------------------------
@@ -297,31 +294,26 @@
// --------------------------------------------------------------------
system = ( Attributes ) results.get( "ou=system" );
- assertNull( "ou=system should not be marked",
- system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=system should not be marked", system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
users = ( Attributes ) results.get( "ou=users,ou=system" );
- assertNull( "ou=users,ou=system should not be marked",
- users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=users,ou=system should not be marked", users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
groups = ( Attributes ) results.get( "ou=groups,ou=system" );
- assertNull( "ou=groups,ou=system should not be marked",
- groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=groups,ou=system should not be marked", groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
admin = ( Attributes ) results.get( "uid=admin,ou=system" );
- assertNull( "uid=admin,ou=system should not be marked",
- admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "uid=admin,ou=system should not be marked", admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
sysPrefRoot = ( Attributes ) results.get( "prefNodeName=sysPrefRoot,ou=system" );
- assertNull( "prefNode=sysPrefRoot,ou=system should not be marked",
- sysPrefRoot.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "prefNode=sysPrefRoot,ou=system should not be marked", sysPrefRoot
+ .get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
services = ( Attributes ) results.get( "ou=services,ou=configuration,ou=system" );
autonomousSubentry = services.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY );
if ( autonomousSubentry != null )
{
- assertEquals( "ou=services,ou=configuration,ou=system should not be marked",
- 0, autonomousSubentry.size() );
+ assertEquals( "ou=services,ou=configuration,ou=system should not be marked", 0, autonomousSubentry.size() );
}
}
@@ -365,24 +357,20 @@
// --------------------------------------------------------------------
Attributes system = ( Attributes ) results.get( "ou=system" );
- assertNull( "ou=system should not be marked",
- system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=system should not be marked", system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes users = ( Attributes ) results.get( "ou=users,ou=system" );
- assertNull( "ou=users,ou=system should not be marked",
- users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=users,ou=system should not be marked", users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes groups = ( Attributes ) results.get( "ou=groups,ou=system" );
- assertNull( "ou=groups,ou=system should not be marked",
- groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=groups,ou=system should not be marked", groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes admin = ( Attributes ) results.get( "uid=admin,ou=system" );
- assertNull( "uid=admin,ou=system should not be marked",
- admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "uid=admin,ou=system should not be marked", admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes sysPrefRoot = ( Attributes ) results.get( "prefNodeName=sysPrefRoot,ou=system" );
- assertNull( "prefNode=sysPrefRoot,ou=system should not be marked",
- sysPrefRoot.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "prefNode=sysPrefRoot,ou=system should not be marked", sysPrefRoot
+ .get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
// --------------------------------------------------------------------
// Now modify the subentry by introducing an exclusion
@@ -390,7 +378,7 @@
Attributes changes = new LockableAttributesImpl();
changes.put( "subtreeSpecification",
- "{ base \"ou=configuration\", specificExclusions { chopBefore:\"ou=services\" } }" );
+ "{ base \"ou=configuration\", specificExclusions { chopBefore:\"ou=services\" } }" );
super.sysRoot.modifyAttributes( "cn=testsubentry", DirContext.REPLACE_ATTRIBUTE, changes );
results = getAllEntries();
@@ -421,31 +409,26 @@
// --------------------------------------------------------------------
system = ( Attributes ) results.get( "ou=system" );
- assertNull( "ou=system should not be marked",
- system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=system should not be marked", system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
users = ( Attributes ) results.get( "ou=users,ou=system" );
- assertNull( "ou=users,ou=system should not be marked",
- users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=users,ou=system should not be marked", users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
groups = ( Attributes ) results.get( "ou=groups,ou=system" );
- assertNull( "ou=groups,ou=system should not be marked",
- groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=groups,ou=system should not be marked", groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
admin = ( Attributes ) results.get( "uid=admin,ou=system" );
- assertNull( "uid=admin,ou=system should not be marked",
- admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "uid=admin,ou=system should not be marked", admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
sysPrefRoot = ( Attributes ) results.get( "prefNodeName=sysPrefRoot,ou=system" );
- assertNull( "prefNode=sysPrefRoot,ou=system should not be marked",
- sysPrefRoot.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "prefNode=sysPrefRoot,ou=system should not be marked", sysPrefRoot
+ .get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
services = ( Attributes ) results.get( "ou=services,ou=configuration,ou=system" );
autonomousSubentry = services.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY );
if ( autonomousSubentry != null )
{
- assertEquals( "ou=services,ou=configuration,ou=system should not be marked",
- 0, autonomousSubentry.size() );
+ assertEquals( "ou=services,ou=configuration,ou=system should not be marked", 0, autonomousSubentry.size() );
}
}
@@ -473,41 +456,36 @@
autonomousSubentry = interceptors.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY );
if ( autonomousSubentry != null )
{
- assertEquals( "ou=interceptors,ou=configuration,ou=system should not be marked",
- 0,autonomousSubentry.size() );
+ assertEquals( "ou=interceptors,ou=configuration,ou=system should not be marked", 0, autonomousSubentry
+ .size() );
}
Attributes partitions = ( Attributes ) results.get( "ou=partitions,ou=configuration,ou=system" );
autonomousSubentry = partitions.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY );
if ( autonomousSubentry != null )
{
- assertEquals( "ou=partitions,ou=configuration,ou=system should not be marked",
- 0, autonomousSubentry.size() );
+ assertEquals( "ou=partitions,ou=configuration,ou=system should not be marked", 0, autonomousSubentry.size() );
}
Attributes services = ( Attributes ) results.get( "ou=services,ou=configuration,ou=system" );
autonomousSubentry = services.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY );
if ( autonomousSubentry != null )
{
- assertEquals( "ou=services,ou=configuration,ou=system should not be marked",
- 0, autonomousSubentry.size() );
+ assertEquals( "ou=services,ou=configuration,ou=system should not be marked", 0, autonomousSubentry.size() );
}
Attributes system = ( Attributes ) results.get( "ou=system" );
- assertNull( "ou=system should not be marked",
- system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=system should not be marked", system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes users = ( Attributes ) results.get( "ou=users,ou=system" );
- assertNull( "ou=users,ou=system should not be marked",
- users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=users,ou=system should not be marked", users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes admin = ( Attributes ) results.get( "uid=admin,ou=system" );
- assertNull( "uid=admin,ou=system should not be marked",
- admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "uid=admin,ou=system should not be marked", admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes sysPrefRoot = ( Attributes ) results.get( "prefNodeName=sysPrefRoot,ou=system" );
- assertNull( "prefNode=sysPrefRoot,ou=system should not be marked",
- sysPrefRoot.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "prefNode=sysPrefRoot,ou=system should not be marked", sysPrefRoot
+ .get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
}
@@ -552,24 +530,20 @@
// --------------------------------------------------------------------
Attributes system = ( Attributes ) results.get( "ou=system" );
- assertNull( "ou=system should not be marked",
- system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=system should not be marked", system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes users = ( Attributes ) results.get( "ou=users,ou=system" );
- assertNull( "ou=users,ou=system should not be marked",
- users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=users,ou=system should not be marked", users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes groups = ( Attributes ) results.get( "ou=groups,ou=system" );
- assertNull( "ou=groups,ou=system should not be marked",
- groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=groups,ou=system should not be marked", groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes admin = ( Attributes ) results.get( "uid=admin,ou=system" );
- assertNull( "uid=admin,ou=system should not be marked",
- admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "uid=admin,ou=system should not be marked", admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes sysPrefRoot = ( Attributes ) results.get( "prefNodeName=sysPrefRoot,ou=system" );
- assertNull( "prefNode=sysPrefRoot,ou=system should not be marked",
- sysPrefRoot.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "prefNode=sysPrefRoot,ou=system should not be marked", sysPrefRoot
+ .get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
}
@@ -621,28 +595,24 @@
// --------------------------------------------------------------------
Attributes system = ( Attributes ) results.get( "ou=system" );
- assertNull( "ou=system should not be marked",
- system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=system should not be marked", system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes users = ( Attributes ) results.get( "ou=users,ou=system" );
- assertNull( "ou=users,ou=system should not be marked",
- users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=users,ou=system should not be marked", users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes groups = ( Attributes ) results.get( "ou=groups,ou=system" );
- assertNull( "ou=groups,ou=system should not be marked",
- groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=groups,ou=system should not be marked", groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes admin = ( Attributes ) results.get( "uid=admin,ou=system" );
- assertNull( "uid=admin,ou=system should not be marked",
- admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "uid=admin,ou=system should not be marked", admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes sysPrefRoot = ( Attributes ) results.get( "prefNodeName=sysPrefRoot,ou=system" );
- assertNull( "prefNode=sysPrefRoot,ou=system should not be marked",
- sysPrefRoot.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "prefNode=sysPrefRoot,ou=system should not be marked", sysPrefRoot
+ .get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes unmarked = ( Attributes ) results.get( "cn=unmarked,ou=configuration,ou=system" );
- assertNull( "cn=unmarked,ou=configuration,ou=system should not be marked",
- unmarked.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "cn=unmarked,ou=configuration,ou=system should not be marked", unmarked
+ .get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
// --------------------------------------------------------------------
// Now destry one of the marked/unmarked and rename to deleted entry
@@ -653,8 +623,8 @@
results = getAllEntries();
unmarked = ( Attributes ) results.get( "cn=unmarked,ou=configuration,ou=system" );
- assertNull( "cn=unmarked,ou=configuration,ou=system should not be marked",
- unmarked.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "cn=unmarked,ou=configuration,ou=system should not be marked", unmarked
+ .get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
assertNull( results.get( "cn=marked,ou=configuration,ou=system" ) );
// --------------------------------------------------------------------
@@ -720,28 +690,24 @@
// --------------------------------------------------------------------
Attributes system = ( Attributes ) results.get( "ou=system" );
- assertNull( "ou=system should not be marked",
- system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=system should not be marked", system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes users = ( Attributes ) results.get( "ou=users,ou=system" );
- assertNull( "ou=users,ou=system should not be marked",
- users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=users,ou=system should not be marked", users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes groups = ( Attributes ) results.get( "ou=groups,ou=system" );
- assertNull( "ou=groups,ou=system should not be marked",
- groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=groups,ou=system should not be marked", groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes admin = ( Attributes ) results.get( "uid=admin,ou=system" );
- assertNull( "uid=admin,ou=system should not be marked",
- admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "uid=admin,ou=system should not be marked", admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes sysPrefRoot = ( Attributes ) results.get( "prefNodeName=sysPrefRoot,ou=system" );
- assertNull( "prefNode=sysPrefRoot,ou=system should not be marked",
- sysPrefRoot.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "prefNode=sysPrefRoot,ou=system should not be marked", sysPrefRoot
+ .get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes unmarked = ( Attributes ) results.get( "cn=unmarked,ou=system" );
- assertNull( "cn=unmarked,ou=system should not be marked",
- unmarked.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "cn=unmarked,ou=system should not be marked", unmarked
+ .get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
// --------------------------------------------------------------------
// Now destry one of the marked/unmarked and rename to deleted entry
@@ -752,8 +718,8 @@
results = getAllEntries();
unmarked = ( Attributes ) results.get( "cn=unmarked,ou=system" );
- assertNull( "cn=unmarked,ou=system should not be marked",
- unmarked.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "cn=unmarked,ou=system should not be marked", unmarked
+ .get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
assertNull( results.get( "cn=marked,ou=configuration,ou=system" ) );
// --------------------------------------------------------------------
@@ -819,28 +785,24 @@
// --------------------------------------------------------------------
Attributes system = ( Attributes ) results.get( "ou=system" );
- assertNull( "ou=system should not be marked",
- system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=system should not be marked", system.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes users = ( Attributes ) results.get( "ou=users,ou=system" );
- assertNull( "ou=users,ou=system should not be marked",
- users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=users,ou=system should not be marked", users.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes groups = ( Attributes ) results.get( "ou=groups,ou=system" );
- assertNull( "ou=groups,ou=system should not be marked",
- groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "ou=groups,ou=system should not be marked", groups.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes admin = ( Attributes ) results.get( "uid=admin,ou=system" );
- assertNull( "uid=admin,ou=system should not be marked",
- admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "uid=admin,ou=system should not be marked", admin.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes sysPrefRoot = ( Attributes ) results.get( "prefNodeName=sysPrefRoot,ou=system" );
- assertNull( "prefNode=sysPrefRoot,ou=system should not be marked",
- sysPrefRoot.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "prefNode=sysPrefRoot,ou=system should not be marked", sysPrefRoot
+ .get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
Attributes unmarked = ( Attributes ) results.get( "cn=unmarked,ou=system" );
- assertNull( "cn=unmarked,ou=system should not be marked",
- unmarked.get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
+ assertNull( "cn=unmarked,ou=system should not be marked", unmarked
+ .get( SubentryService.AUTONOUMOUS_AREA_SUBENTRY ) );
// --------------------------------------------------------------------
// Now destry one of the marked/unmarked and rename to deleted entry
@@ -861,8 +823,8 @@
assertEquals( "cn=testsubentry,ou=system", autonomousSubentry.get() );
assertEquals( 1, autonomousSubentry.size() );
}
-
-
+
+
public void testSubentriesControl() throws Exception
{
addAdministrativeRole( "autonomousArea" );
@@ -878,14 +840,15 @@
SearchResult result = ( SearchResult ) list.next();
entries.put( result.getName(), result );
}
- assertTrue( entries.size() > 1 );
+ assertTrue( entries.size() > 1 );
assertNull( entries.get( "cn=testsubentry,ou=system" ) );
-
+
// now add the control with visibility set to true where all entries
// except subentries disappear
SubentriesControl ctl = new SubentriesControl();
ctl.setVisibility( true );
- super.sysRoot.setRequestControls( new Control[] { ctl } );
+ super.sysRoot.setRequestControls( new Control[]
+ { ctl } );
list = super.sysRoot.search( "", "(objectClass=*)", searchControls );
SearchResult result = ( SearchResult ) list.next();
assertFalse( list.hasMore() );
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Fri Feb 10 02:48:07 2006
@@ -16,6 +16,7 @@
*/
package org.apache.directory.server.core;
+
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
@@ -77,10 +78,10 @@
private final DirectoryServiceConfiguration configuration = new DefaultDirectoryServiceConfiguration( this );
private DirectoryServiceListener serviceListener;
-
+
/** the initial context environment that fired up the backend subsystem */
private Hashtable environment;
-
+
/** the configuration */
private StartupConfiguration startupConfiguration;
@@ -95,28 +96,28 @@
/** The interceptor (or interceptor chain) for this service */
private InterceptorChain interceptorChain;
-
+
/** whether or not this instance has been shutdown */
private boolean started = false;
-
+
+
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
-
/**
* Creates a new instance.
*/
- public DefaultDirectoryService( String instanceId )
+ public DefaultDirectoryService(String instanceId)
{
- if( instanceId == null )
+ if ( instanceId == null )
{
throw new NullPointerException( "instanceId" );
}
this.instanceId = instanceId;
}
-
+
// ------------------------------------------------------------------------
// BackendSubsystem Interface Method Implemetations
// ------------------------------------------------------------------------
@@ -126,36 +127,38 @@
return this.getJndiContext( null, null, "none", rootDN );
}
- public synchronized Context getJndiContext( String principal, byte[] credential, String authentication, String rootDN ) throws NamingException
+
+ public synchronized Context getJndiContext( String principal, byte[] credential, String authentication,
+ String rootDN ) throws NamingException
{
checkSecuritySettings( principal, credential, authentication );
-
+
if ( !started )
{
return new DeadContext();
}
-
+
Hashtable environment = getEnvironment();
environment.remove( Context.SECURITY_PRINCIPAL );
environment.remove( Context.SECURITY_CREDENTIALS );
environment.remove( Context.SECURITY_AUTHENTICATION );
-
- if( principal != null )
+
+ if ( principal != null )
{
environment.put( Context.SECURITY_PRINCIPAL, principal );
}
-
- if( credential != null )
+
+ if ( credential != null )
{
environment.put( Context.SECURITY_CREDENTIALS, credential );
}
-
- if( authentication != null )
+
+ if ( authentication != null )
{
environment.put( Context.SECURITY_AUTHENTICATION, authentication );
}
-
- if( rootDN == null )
+
+ if ( rootDN == null )
{
rootDN = "";
}
@@ -164,9 +167,10 @@
return new ServerLdapContext( this, environment );
}
+
public synchronized void startup( DirectoryServiceListener listener, Hashtable env ) throws NamingException
{
- if( started )
+ if ( started )
{
return;
}
@@ -177,37 +181,37 @@
if ( cfg.isShutdownHookEnabled() )
{
- Runtime.getRuntime().addShutdownHook( new Thread( new Runnable() {
+ Runtime.getRuntime().addShutdownHook( new Thread( new Runnable()
+ {
public void run()
{
try
{
shutdown();
}
- catch( NamingException e )
+ catch ( NamingException e )
{
- log.warn(
- "Failed to shut down the directory service: " +
- DefaultDirectoryService.this.instanceId, e );
+ log.warn( "Failed to shut down the directory service: "
+ + DefaultDirectoryService.this.instanceId, e );
}
}
}, "ApacheDS Shutdown Hook (" + instanceId + ')' ) );
-
+
log.info( "ApacheDS shutdown hook has been registered with the runtime." );
}
else if ( log.isWarnEnabled() )
{
- log.warn( "ApacheDS shutdown hook has NOT been registered with the runtime." +
- " This default setting for standalone operation has been overriden." );
+ log.warn( "ApacheDS shutdown hook has NOT been registered with the runtime."
+ + " This default setting for standalone operation has been overriden." );
}
envCopy.put( Context.PROVIDER_URL, "" );
-
+
try
{
cfg.validate();
}
- catch( ConfigurationException e )
+ catch ( ConfigurationException e )
{
NamingException ne = new LdapConfigurationException( "Invalid configuration." );
ne.initCause( e );
@@ -216,7 +220,7 @@
this.environment = envCopy;
this.startupConfiguration = cfg;
-
+
listener.beforeStartup( this );
initialize();
@@ -224,13 +228,14 @@
showSecurityWarnings();
this.serviceListener = listener;
started = true;
- if ( ! startupConfiguration.getTestEntries().isEmpty() )
+ if ( !startupConfiguration.getTestEntries().isEmpty() )
{
createTestEntries( env );
}
listener.afterStartup( this );
}
+
public synchronized void sync() throws NamingException
{
if ( !started )
@@ -273,70 +278,81 @@
serviceListener.afterShutdown( this );
}
}
-
+
+
public String getInstanceId()
{
return instanceId;
}
-
+
+
public DirectoryServiceConfiguration getConfiguration()
{
return configuration;
}
-
-
+
+
public Hashtable getEnvironment()
{
return ( Hashtable ) environment.clone();
}
-
+
+
public DirectoryServiceListener getServiceListener()
{
return serviceListener;
}
-
+
+
public StartupConfiguration getStartupConfiguration()
{
return startupConfiguration;
}
-
+
+
public GlobalRegistries getGlobalRegistries()
{
return globalRegistries;
}
+
public DirectoryPartitionNexus getPartitionNexus()
{
return partitionNexus;
}
-
+
+
public InterceptorChain getInterceptorChain()
{
return interceptorChain;
}
-
+
+
public boolean isFirstStart()
{
return firstStart;
}
-
+
+
public boolean isStarted()
{
return started;
}
-
+
+
/**
* Checks to make sure security environment parameters are set correctly.
*
* @throws javax.naming.NamingException if the security settings are not correctly configured.
*/
- private void checkSecuritySettings( String principal, byte[] credential, String authentication ) throws NamingException
+ private void checkSecuritySettings( String principal, byte[] credential, String authentication )
+ throws NamingException
{
- if( authentication == null )
+ if ( authentication == null )
{
authentication = "";
}
-
+
/*
* If bind is simple make sure we have the credentials and the
* principal name set within the environment, otherwise complain
@@ -345,14 +361,14 @@
{
if ( credential == null )
{
- throw new LdapConfigurationException( "missing required "
- + Context.SECURITY_CREDENTIALS + " property for simple authentication" );
+ throw new LdapConfigurationException( "missing required " + Context.SECURITY_CREDENTIALS
+ + " property for simple authentication" );
}
if ( principal == null )
{
- throw new LdapConfigurationException( "missing required "
- + Context.SECURITY_PRINCIPAL + " property for simple authentication" );
+ throw new LdapConfigurationException( "missing required " + Context.SECURITY_PRINCIPAL
+ + " property for simple authentication" );
}
}
/*
@@ -364,17 +380,17 @@
if ( credential != null )
{
throw new LdapConfigurationException( "ambiguous bind "
- + "settings encountered where bind is anonymous yet "
- + Context.SECURITY_CREDENTIALS + " property is set" );
+ + "settings encountered where bind is anonymous yet " + Context.SECURITY_CREDENTIALS
+ + " property is set" );
}
if ( principal != null )
{
throw new LdapConfigurationException( "ambiguous bind "
- + "settings encountered where bind is anonymous yet "
- + Context.SECURITY_PRINCIPAL + " property is set" );
+ + "settings encountered where bind is anonymous yet " + Context.SECURITY_PRINCIPAL
+ + " property is set" );
}
-
- if( !startupConfiguration.isAllowAnonymousAccess() )
+
+ if ( !startupConfiguration.isAllowAnonymousAccess() )
{
throw new LdapNoPermissionException( "Anonymous access disabled." );
}
@@ -385,7 +401,8 @@
* If bind is anything other than simple or none we need to
* complain because SASL is not a supported auth method yet
*/
- throw new LdapAuthenticationNotSupportedException( "Unknown authentication type: '" + authentication + "'", ResultCodeEnum.AUTHMETHODNOTSUPPORTED );
+ throw new LdapAuthenticationNotSupportedException( "Unknown authentication type: '" + authentication + "'",
+ ResultCodeEnum.AUTHMETHODNOTSUPPORTED );
}
}
@@ -428,8 +445,9 @@
attributes.put( "creatorsName", DirectoryPartitionNexus.ADMIN_PRINCIPAL );
attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );
attributes.put( "displayName", "Directory Superuser" );
-
- partitionNexus.add( DirectoryPartitionNexus.ADMIN_PRINCIPAL, DirectoryPartitionNexus.getAdminName(), attributes );
+
+ partitionNexus.add( DirectoryPartitionNexus.ADMIN_PRINCIPAL, DirectoryPartitionNexus.getAdminName(),
+ attributes );
}
// -------------------------------------------------------------------
@@ -538,8 +556,8 @@
attributes.put( "creatorsName", DirectoryPartitionNexus.ADMIN_PRINCIPAL );
attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );
- partitionNexus.add( "ou=partitions,ou=configuration,ou=system",
- new LdapName( "ou=partitions,ou=configuration,ou=system" ), attributes );
+ partitionNexus.add( "ou=partitions,ou=configuration,ou=system", new LdapName(
+ "ou=partitions,ou=configuration,ou=system" ), attributes );
}
// -------------------------------------------------------------------
@@ -560,8 +578,8 @@
attributes.put( "creatorsName", DirectoryPartitionNexus.ADMIN_PRINCIPAL );
attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );
- partitionNexus.add( "ou=services,ou=configuration,ou=system",
- new LdapName( "ou=services,ou=configuration,ou=system" ), attributes );
+ partitionNexus.add( "ou=services,ou=configuration,ou=system", new LdapName(
+ "ou=services,ou=configuration,ou=system" ), attributes );
}
// -------------------------------------------------------------------
@@ -582,8 +600,8 @@
attributes.put( "creatorsName", DirectoryPartitionNexus.ADMIN_PRINCIPAL );
attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );
- partitionNexus.add( "ou=interceptors,ou=configuration,ou=system",
- new LdapName( "ou=interceptors,ou=configuration,ou=system" ), attributes );
+ partitionNexus.add( "ou=interceptors,ou=configuration,ou=system", new LdapName(
+ "ou=interceptors,ou=configuration,ou=system" ), attributes );
}
// -------------------------------------------------------------------
@@ -612,7 +630,8 @@
return firstStart;
}
-
+
+
/**
* Displays security warning messages if any possible secutiry issue is found.
*/
@@ -620,42 +639,40 @@
{
// Warn if the default password is not changed.
boolean needToChangeAdminPassword = false;
-
+
Attributes adminEntry = partitionNexus.lookup( new LdapName( DirectoryPartitionNexus.ADMIN_PRINCIPAL ) );
Object userPassword = adminEntry.get( "userPassword" ).get();
- if( userPassword instanceof byte[] )
+ if ( userPassword instanceof byte[] )
{
- needToChangeAdminPassword = DirectoryPartitionNexus.ADMIN_PASSWORD.equals( new String( ( byte[] ) userPassword ) );
+ needToChangeAdminPassword = DirectoryPartitionNexus.ADMIN_PASSWORD.equals( new String(
+ ( byte[] ) userPassword ) );
}
else if ( userPassword.toString().equals( DirectoryPartitionNexus.ADMIN_PASSWORD ) )
{
needToChangeAdminPassword = DirectoryPartitionNexus.ADMIN_PASSWORD.equals( userPassword.toString() );
}
-
- if( needToChangeAdminPassword )
+
+ if ( needToChangeAdminPassword )
{
- log.warn(
- "You didn't change the admin password of directory service " +
- "instance '" + instanceId + "'. " +
- "Please update the admin password as soon as possible " +
- "to prevent a possible security breach." );
+ log.warn( "You didn't change the admin password of directory service " + "instance '" + instanceId + "'. "
+ + "Please update the admin password as soon as possible " + "to prevent a possible security breach." );
}
}
-
+
+
private void createTestEntries( Hashtable env ) throws NamingException
{
String principal = AbstractContextFactory.getPrincipal( env );
byte[] credential = AbstractContextFactory.getCredential( env );
String authentication = AbstractContextFactory.getAuthentication( env );
- ServerLdapContext ctx = ( ServerLdapContext ) getJndiContext( principal, credential,
- authentication, "" );
-
+ ServerLdapContext ctx = ( ServerLdapContext ) getJndiContext( principal, credential, authentication, "" );
+
Iterator i = startupConfiguration.getTestEntries().iterator();
- while( i.hasNext() )
+ while ( i.hasNext() )
{
Attributes entry = ( Attributes ) ( ( Attributes ) i.next() ).clone();
String dn = ( String ) entry.remove( "dn" ).get();
-
+
try
{
ctx.createSubcontext( dn, entry );
@@ -667,70 +684,72 @@
}
}
+
private void setupOidsMap( BootstrapRegistries bootstrapRegistries ) throws NamingException
{
Iterator keys = bootstrapRegistries.getOidRegistry().getOidByName().keySet().iterator();
-
+
Map oidsMap = new HashMap();
Map oidName = new HashMap();
-
+
while ( keys.hasNext() )
{
- String name = StringTools.deepTrimToLower( (String)keys.next() );
- String principal = null;
-
- if ( OID.isOID( name ) )
- {
- continue;
- }
-
- String oid = bootstrapRegistries.getOidRegistry().getOid( name );
-
- OidNormalizer oidNormalizer = null;
-
- if ( oidName.containsKey( oid ) )
- {
- principal = StringTools.deepTrimToLower( (String)oidName.get( oid ) );
-
- if ( principal.length() > name.length() )
- {
- OidNormalizer oldOidNormalizer = (OidNormalizer)oidsMap.get( principal );
-
-
- oidNormalizer = new OidNormalizer( name, oldOidNormalizer.getNormalizer() );
-
- oidName.remove( oid );
- oidName.put( oid, name );
- oidsMap.remove( principal );
- oidsMap.remove( oid );
- oidsMap.put( principal, oidNormalizer );
- oidsMap.put( name, oidNormalizer );
- oidsMap.put( oid, oidNormalizer );
- continue;
- }
- }
- else
- {
- principal = name;
- oidName.put( oid, principal );
-
- if ( bootstrapRegistries.getNormalizerRegistry().hasNormalizer( oid ) )
- {
- oidNormalizer = new OidNormalizer( principal, bootstrapRegistries.getNormalizerRegistry().lookup( oid ) );
- }
- else
- {
- oidNormalizer = new OidNormalizer( principal, new NoOpNormalizer() );
- }
-
- oidsMap.put( name, oidNormalizer );
- oidsMap.put( oid, oidNormalizer );
- }
+ String name = StringTools.deepTrimToLower( ( String ) keys.next() );
+ String principal = null;
+
+ if ( OID.isOID( name ) )
+ {
+ continue;
+ }
+
+ String oid = bootstrapRegistries.getOidRegistry().getOid( name );
+
+ OidNormalizer oidNormalizer = null;
+
+ if ( oidName.containsKey( oid ) )
+ {
+ principal = StringTools.deepTrimToLower( ( String ) oidName.get( oid ) );
+
+ if ( principal.length() > name.length() )
+ {
+ OidNormalizer oldOidNormalizer = ( OidNormalizer ) oidsMap.get( principal );
+
+ oidNormalizer = new OidNormalizer( name, oldOidNormalizer.getNormalizer() );
+
+ oidName.remove( oid );
+ oidName.put( oid, name );
+ oidsMap.remove( principal );
+ oidsMap.remove( oid );
+ oidsMap.put( principal, oidNormalizer );
+ oidsMap.put( name, oidNormalizer );
+ oidsMap.put( oid, oidNormalizer );
+ continue;
+ }
+ }
+ else
+ {
+ principal = name;
+ oidName.put( oid, principal );
+
+ if ( bootstrapRegistries.getNormalizerRegistry().hasNormalizer( oid ) )
+ {
+ oidNormalizer = new OidNormalizer( principal, bootstrapRegistries.getNormalizerRegistry().lookup(
+ oid ) );
+ }
+ else
+ {
+ oidNormalizer = new OidNormalizer( principal, new NoOpNormalizer() );
+ }
+
+ oidsMap.put( name, oidNormalizer );
+ oidsMap.put( oid, oidNormalizer );
+ }
}
-
+
DnOidContainer.setOids( oidsMap );
}
+
/**
* Kicks off the initialization of the entire system.
*
@@ -738,12 +757,12 @@
*/
private void initialize() throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "---> Initializing the DefaultDirectoryService " );
- }
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "---> Initializing the DefaultDirectoryService " );
+ }
- // --------------------------------------------------------------------
+ // --------------------------------------------------------------------
// Load the schema here and check that it is ok!
// --------------------------------------------------------------------
@@ -776,13 +795,13 @@
{
if ( log.isWarnEnabled() )
{
- log.warn( BINARY_KEY + " in startup environment contains null value. " +
- "Using only schema info to set binary attributeTypes." );
+ log.warn( BINARY_KEY + " in startup environment contains null value. "
+ + "Using only schema info to set binary attributeTypes." );
}
}
else
{
- if ( ! StringTools.isEmpty( binaryIds ) )
+ if ( !StringTools.isEmpty( binaryIds ) )
{
String[] binaryArray = binaryIds.split( " " );
@@ -795,7 +814,7 @@
if ( log.isInfoEnabled() )
{
log.info( "Setting binaries to union of schema defined binaries and those provided in "
- + BINARY_KEY );
+ + BINARY_KEY );
}
}
}
@@ -806,7 +825,7 @@
while ( list.hasNext() )
{
AttributeType type = ( AttributeType ) list.next();
- if ( ! type.getSyntax().isHumanReadible() )
+ if ( !type.getSyntax().isHumanReadible() )
{
// add the OID for the attributeType
binaries.add( type.getOid() );
@@ -828,13 +847,13 @@
partitionNexus = new DefaultDirectoryPartitionNexus( new LockableAttributesImpl() );
partitionNexus.init( configuration, null );
-
+
interceptorChain = new InterceptorChain();
interceptorChain.init( configuration );
-
- if ( log.isDebugEnabled() )
- {
- log.debug( "<--- DefaultDirectoryService initialized" );
- }
+
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "<--- DefaultDirectoryService initialized" );
+ }
}
}
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryServiceConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryServiceConfiguration.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryServiceConfiguration.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryServiceConfiguration.java Fri Feb 10 02:48:07 2006
@@ -16,6 +16,7 @@
*/
package org.apache.directory.server.core;
+
import java.util.Hashtable;
import javax.naming.Context;
@@ -36,63 +37,76 @@
class DefaultDirectoryServiceConfiguration implements DirectoryServiceConfiguration
{
private DefaultDirectoryService parent;
-
- DefaultDirectoryServiceConfiguration( DefaultDirectoryService parent )
+
+
+ DefaultDirectoryServiceConfiguration(DefaultDirectoryService parent)
{
this.parent = parent;
}
-
+
+
public String getInstanceId()
{
return parent.getInstanceId();
}
-
+
+
public DirectoryService getService()
{
return parent;
}
+
public DirectoryServiceListener getServiceListener()
{
return parent.getServiceListener();
}
+
public Hashtable getEnvironment()
{
return parent.getEnvironment();
}
-
+
+
public StartupConfiguration getStartupConfiguration()
{
return parent.getStartupConfiguration();
}
-
+
+
public GlobalRegistries getGlobalRegistries()
{
return parent.getGlobalRegistries();
}
+
public DirectoryPartitionNexus getPartitionNexus()
{
return parent.getPartitionNexus();
}
-
+
+
public InterceptorChain getInterceptorChain()
{
return parent.getInterceptorChain();
}
-
+
+
public boolean isFirstStart()
{
return parent.isFirstStart();
}
+
public Context getJndiContext( String baseName ) throws NamingException
{
return parent.getJndiContext( baseName );
}
- public Context getJndiContext( String principal, byte[] credential, String authentication, String baseName ) throws NamingException
+
+ public Context getJndiContext( String principal, byte[] credential, String authentication, String baseName )
+ throws NamingException
{
return parent.getJndiContext( principal, credential, authentication, baseName );
}
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryService.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryService.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryService.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryService.java Fri Feb 10 02:48:07 2006
@@ -16,6 +16,7 @@
*/
package org.apache.directory.server.core;
+
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
@@ -30,6 +31,7 @@
import org.apache.directory.server.core.jndi.AbstractContextFactory;
import org.apache.directory.server.core.partition.DirectoryPartition;
+
/**
* Provides JNDI service to {@link AbstractContextFactory}.
*
@@ -40,6 +42,7 @@
{
private static final Map instances = new HashMap();
+
/**
* Returns the default instance. This method is identical with calling
* <tt>getInstance( Configuration.DEFAULT_INSTANCE_ID )</tt>.
@@ -48,7 +51,8 @@
{
return getInstance( Configuration.DEFAULT_INSTANCE_ID );
}
-
+
+
/**
* Returns {@link DirectoryService} with the specified instance ID.
*/
@@ -56,15 +60,16 @@
{
instanceId = instanceId.trim();
DirectoryService service = ( DirectoryService ) instances.get( instanceId );
- if( service == null )
+ if ( service == null )
{
service = new DefaultDirectoryService( instanceId );
instances.put( instanceId, service );
}
-
+
return service;
}
-
+
+
/**
* Returns all instances of instantiated {@link DirectoryService}.
*/
@@ -73,6 +78,7 @@
return new HashSet( instances.values() );
}
+
/**
* Starts up this service.
*
@@ -82,36 +88,42 @@
* @throws NamingException if failed to start up
*/
public abstract void startup( DirectoryServiceListener listener, Hashtable environment ) throws NamingException;
-
+
+
/**
* Shuts down this service.
*
* @throws NamingException if failed to shut down
*/
public abstract void shutdown() throws NamingException;
-
+
+
/**
* Calls {@link DirectoryPartition#sync()} for all registered {@link DirectoryPartition}s.
* @throws NamingException if synchronization failed
*/
public abstract void sync() throws NamingException;
-
+
+
/**
* Returns <tt>true</tt> if this service is started.
*/
public abstract boolean isStarted();
-
+
+
/**
* Returns the configuration of this service.
*/
public abstract DirectoryServiceConfiguration getConfiguration();
+
/**
* Returns an anonymous JNDI {@link Context} with the specified <tt>baseName</tt>
* @throws NamingException if failed to create a context
*/
public abstract Context getJndiContext( String baseName ) throws NamingException;
-
+
+
/**
* Returns a JNDI {@link Context} with the specified authentication information
* (<tt>principal</tt>, <tt>credential</tt>, and <tt>authentication</tt>) and
@@ -122,5 +134,6 @@
* @param authentication {@link Context#SECURITY_AUTHENTICATION} value
* @throws NamingException if failed to create a context
*/
- public abstract Context getJndiContext( String principal, byte[] credential, String authentication, String baseName ) throws NamingException;
+ public abstract Context getJndiContext( String principal, byte[] credential, String authentication, String baseName )
+ throws NamingException;
}
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceConfiguration.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceConfiguration.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceConfiguration.java Fri Feb 10 02:48:07 2006
@@ -16,6 +16,7 @@
*/
package org.apache.directory.server.core;
+
import java.util.Hashtable;
import javax.naming.Context;
@@ -25,6 +26,7 @@
import org.apache.directory.server.core.partition.DirectoryPartitionNexus;
import org.apache.directory.server.core.schema.GlobalRegistries;
+
/**
* Represents the global configuration of currently running
* {@link DirectoryService}. You can access all properties of
@@ -33,48 +35,56 @@
*/
public interface DirectoryServiceConfiguration
{
-
+
/**
* Returns the {@link DirectoryService} for this configuration.
*/
DirectoryService getService();
-
+
+
/**
* Returns the instance ID of the {@link DirectoryService}.
*/
String getInstanceId();
-
+
+
/**
* Returns the listener that listens to service events.
*/
DirectoryServiceListener getServiceListener();
-
+
+
/**
* Returns the initial context environment of the {@link DirectoryService}.
*/
Hashtable getEnvironment();
-
+
+
/**
* Returns the startup configuration of the {@link DirectoryService}.
*/
StartupConfiguration getStartupConfiguration();
-
+
+
/**
* Returns the registries for system schema objects of the {@link DirectoryService}.
*/
GlobalRegistries getGlobalRegistries();
+
/**
* Returns the {@link DirectoryPartitionNexus} of the {@link DirectoryService}
* which bypasses the interceptor chain.
*/
DirectoryPartitionNexus getPartitionNexus();
-
+
+
/**
* Returns the interceptor chain of the {@link DirectoryService}.
*/
InterceptorChain getInterceptorChain();
-
+
+
/**
* Returns <tt>true</tt> if this service is started
* and bootstrap entries have been created for the first time.
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceListener.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceListener.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceListener.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceListener.java Fri Feb 10 02:48:07 2006
@@ -16,8 +16,10 @@
*/
package org.apache.directory.server.core;
+
import javax.naming.NamingException;
+
/**
* An event handler that listens to the changes occurs to
* {@link DirectoryService}.
@@ -31,22 +33,32 @@
* Invoked before starting up {@link DirectoryService}.
*/
void beforeStartup( DirectoryService service ) throws NamingException;
+
+
/**
* Invoked after starting up {@link DirectoryService}.
*/
void afterStartup( DirectoryService service ) throws NamingException;
+
+
/**
* Invoked before shutting down {@link DirectoryService}.
*/
void beforeShutdown( DirectoryService service ) throws NamingException;
+
+
/**
* Invoked after shutting down {@link DirectoryService}.
*/
void afterShutdown( DirectoryService service ) throws NamingException;
+
+
/**
* Invoked before calling {@link DirectoryService#sync()}.
*/
void beforeSync( DirectoryService service ) throws NamingException;
+
+
/**
* Invoked after calling {@link DirectoryService#sync()}.
*/
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java Fri Feb 10 02:48:07 2006
@@ -47,7 +47,7 @@
*
* @param type the type of this authenticator (e.g. <tt>'simple'</tt>, <tt>'none'</tt>...)
*/
- protected AbstractAuthenticator( String type )
+ protected AbstractAuthenticator(String type)
{
this.authenticatorType = type;
}
@@ -62,6 +62,7 @@
return factoryCfg;
}
+
/**
* Returns the configuration of this authenticator.
*/
@@ -70,6 +71,7 @@
return cfg;
}
+
public String getAuthenticatorType()
{
return authenticatorType;
@@ -81,7 +83,8 @@
* <tt>configuration</tt>, and calls {@link #doInit()} method.
* Please put your initialization code into {@link #doInit()}.
*/
- public final void init( DirectoryServiceConfiguration factoryCfg, AuthenticatorConfiguration cfg ) throws NamingException
+ public final void init( DirectoryServiceConfiguration factoryCfg, AuthenticatorConfiguration cfg )
+ throws NamingException
{
this.factoryCfg = factoryCfg;
this.cfg = cfg;
@@ -96,6 +99,7 @@
{
}
+
/**
* Calls {@link #doDestroy()} method, and clears default properties
* (<tt>factoryConfiguration</tt> and <tt>configuration</tt>).
@@ -114,6 +118,7 @@
}
}
+
/**
* Implement your deinitialization code here.
*/
@@ -121,6 +126,7 @@
{
}
+
public abstract LdapPrincipal authenticate( ServerContext ctx ) throws NamingException;
@@ -134,7 +140,8 @@
* @throws NamingException if there is a problem parsing <tt>name</tt>
*/
// does not seem to be used
- protected static LdapPrincipal createLdapPrincipal( String name, AuthenticationLevel authenticationLeve ) throws NamingException
+ protected static LdapPrincipal createLdapPrincipal( String name, AuthenticationLevel authenticationLeve )
+ throws NamingException
{
LdapName principalDn = new LdapName( name );
return new LdapPrincipal( principalDn, AuthenticationLevel.SIMPLE );
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AnonymousAuthenticator.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AnonymousAuthenticator.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AnonymousAuthenticator.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AnonymousAuthenticator.java Fri Feb 10 02:48:07 2006
@@ -16,11 +16,13 @@
*/
package org.apache.directory.server.core.authn;
+
import javax.naming.NamingException;
import org.apache.directory.server.core.jndi.ServerContext;
import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
+
/**
* An {@link Authenticator} that handles anonymous connections
* (type <tt>'none'</tt>).
@@ -37,6 +39,7 @@
super( "none" );
}
+
/**
* If the context is not configured to allow anonymous connections,
* this method throws a {@link javax.naming.NoPermissionException}.
@@ -45,7 +48,7 @@
{
if ( getFactoryConfiguration().getStartupConfiguration().isAllowAnonymousAccess() )
{
- return LdapPrincipal.ANONYMOUS ;
+ return LdapPrincipal.ANONYMOUS;
}
else
{
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java Fri Feb 10 02:48:07 2006
@@ -59,12 +59,13 @@
public class AuthenticationService extends BaseInterceptor
{
private static final Logger log = LoggerFactory.getLogger( AuthenticationService.class );
-
+
/** authenticators **/
public Map authenticators = new HashMap();
private DirectoryServiceConfiguration factoryCfg;
+
/**
* Creates an authentication service interceptor.
*/
@@ -72,6 +73,7 @@
{
}
+
/**
* Registers and initializes all {@link Authenticator}s to this service.
*/
@@ -81,7 +83,7 @@
// Register all authenticators
Iterator i = factoryCfg.getStartupConfiguration().getAuthenticatorConfigurations().iterator();
- while( i.hasNext() )
+ while ( i.hasNext() )
{
try
{
@@ -90,30 +92,31 @@
catch ( Exception e )
{
destroy();
- throw ( NamingException ) new NamingException(
- "Failed to register authenticator." ).initCause( e );
+ throw ( NamingException ) new NamingException( "Failed to register authenticator." ).initCause( e );
}
}
}
-
+
+
/**
* Deinitializes and deregisters all {@link Authenticator}s from this service.
*/
public void destroy()
{
Iterator i = new ArrayList( authenticators.values() ).iterator();
- while( i.hasNext() )
+ while ( i.hasNext() )
{
Iterator j = new ArrayList( ( Collection ) i.next() ).iterator();
- while( j.hasNext() )
+ while ( j.hasNext() )
{
unregister( ( Authenticator ) j.next() );
}
}
-
+
authenticators.clear();
}
+
/**
* Initializes the specified {@link Authenticator} and registers it to
* this service.
@@ -132,6 +135,7 @@
authenticatorList.add( cfg.getAuthenticator() );
}
+
/**
* Deinitializes the specified {@link Authenticator} and deregisters it from
* this service.
@@ -146,17 +150,18 @@
}
authenticatorList.remove( authenticator );
-
+
try
{
authenticator.destroy();
}
- catch( Throwable t )
+ catch ( Throwable t )
{
log.warn( "Failed to destroy an authenticator.", t );
}
}
+
/**
* Returns the list of {@link Authenticator}s with the specified type.
*
@@ -165,7 +170,7 @@
private Collection getAuthenticators( String type )
{
Collection result = ( Collection ) authenticators.get( type );
- if( result != null && result.size() > 0 )
+ if ( result != null && result.size() > 0 )
{
return result;
}
@@ -174,15 +179,15 @@
return null;
}
}
-
+
public void add( NextInterceptor next, String upName, Name normName, Attributes entry ) throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Adding the entry " + AttributeUtils.toString( entry ) + " for DN = '" + upName + "'" );
- }
-
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Adding the entry " + AttributeUtils.toString( entry ) + " for DN = '" + upName + "'" );
+ }
+
checkAuthenticated();
next.add( upName, normName, entry );
}
@@ -190,11 +195,11 @@
public void delete( NextInterceptor next, Name name ) throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Deleting name = '" + name.toString() + "'" );
- }
-
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Deleting name = '" + name.toString() + "'" );
+ }
+
checkAuthenticated();
next.delete( name );
}
@@ -202,22 +207,22 @@
public Name getMatchedName( NextInterceptor next, Name dn, boolean normalized ) throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Matching name = '" + dn.toString() + "'" );
- }
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Matching name = '" + dn.toString() + "'" );
+ }
- checkAuthenticated();
+ checkAuthenticated();
return next.getMatchedName( dn, normalized );
}
public Attributes getRootDSE( NextInterceptor next ) throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Getting root DSE" );
- }
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Getting root DSE" );
+ }
checkAuthenticated();
return next.getRootDSE();
@@ -226,10 +231,10 @@
public Name getSuffix( NextInterceptor next, Name dn, boolean normalized ) throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Getting suffix for name = '" + dn.toString() + "'" );
- }
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Getting suffix for name = '" + dn.toString() + "'" );
+ }
checkAuthenticated();
return next.getSuffix( dn, normalized );
@@ -238,10 +243,10 @@
public boolean hasEntry( NextInterceptor next, Name name ) throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Testing if entry name = '" + name.toString() + "' exists");
- }
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Testing if entry name = '" + name.toString() + "' exists" );
+ }
checkAuthenticated();
return next.hasEntry( name );
@@ -250,10 +255,10 @@
public boolean isSuffix( NextInterceptor next, Name name ) throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Testing suffix for name = '" + name.toString() + "'" );
- }
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Testing suffix for name = '" + name.toString() + "'" );
+ }
checkAuthenticated();
return next.isSuffix( name );
@@ -262,10 +267,10 @@
public NamingEnumeration list( NextInterceptor next, Name base ) throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Listing base = '" + base.toString() + "'" );
- }
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Listing base = '" + base.toString() + "'" );
+ }
checkAuthenticated();
return next.list( base );
@@ -274,10 +279,10 @@
public Iterator listSuffixes( NextInterceptor next, boolean normalized ) throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Listing suffixes" );
- }
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Listing suffixes" );
+ }
checkAuthenticated();
return next.listSuffixes( normalized );
@@ -286,10 +291,10 @@
public Attributes lookup( NextInterceptor next, Name dn, String[] attrIds ) throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Lookup name = '" + dn.toString() + "', attributes = " + attrIds );
- }
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Lookup name = '" + dn.toString() + "', attributes = " + attrIds );
+ }
checkAuthenticated();
return next.lookup( dn, attrIds );
@@ -298,10 +303,10 @@
public Attributes lookup( NextInterceptor next, Name name ) throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Lookup name = '" + name.toString() + "'" );
- }
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Lookup name = '" + name.toString() + "'" );
+ }
checkAuthenticated();
return next.lookup( name );
@@ -310,10 +315,10 @@
public void modify( NextInterceptor next, Name name, int modOp, Attributes mods ) throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Modifying name = '" + name.toString() + "', modifs = " + AttributeUtils.toString( mods ) );
- }
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Modifying name = '" + name.toString() + "', modifs = " + AttributeUtils.toString( mods ) );
+ }
checkAuthenticated();
next.modify( name, modOp, mods );
@@ -322,10 +327,10 @@
public void modify( NextInterceptor next, Name name, ModificationItem[] mods ) throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Modifying name = '" + name.toString() + "'" );
- }
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Modifying name = '" + name.toString() + "'" );
+ }
checkAuthenticated();
next.modify( name, mods );
@@ -334,22 +339,25 @@
public void modifyRn( NextInterceptor next, Name name, String newRn, boolean deleteOldRn ) throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Modifying name = '" + name.toString() + "', new RDN = '" + newRn + "', oldRDN = '" + deleteOldRn + "'" );
- }
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Modifying name = '" + name.toString() + "', new RDN = '" + newRn + "', oldRDN = '"
+ + deleteOldRn + "'" );
+ }
checkAuthenticated();
next.modifyRn( name, newRn, deleteOldRn );
}
- public void move( NextInterceptor next, Name oriChildName, Name newParentName, String newRn, boolean deleteOldRn ) throws NamingException
+ public void move( NextInterceptor next, Name oriChildName, Name newParentName, String newRn, boolean deleteOldRn )
+ throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Moving name = '" + oriChildName.toString() + "' to name = '" + newParentName + "', new RDN = '" + newRn + "', oldRDN = '" + deleteOldRn + "'" );
- }
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Moving name = '" + oriChildName.toString() + "' to name = '" + newParentName + "', new RDN = '"
+ + newRn + "', oldRDN = '" + deleteOldRn + "'" );
+ }
checkAuthenticated();
next.move( oriChildName, newParentName, newRn, deleteOldRn );
@@ -358,22 +366,23 @@
public void move( NextInterceptor next, Name oriChildName, Name newParentName ) throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Moving name = '" + oriChildName.toString() + " to name = '" + newParentName + "'" );
- }
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Moving name = '" + oriChildName.toString() + " to name = '" + newParentName + "'" );
+ }
checkAuthenticated();
next.move( oriChildName, newParentName );
}
- public NamingEnumeration search( NextInterceptor next, Name base, Map env, ExprNode filter, SearchControls searchCtls ) throws NamingException
+ public NamingEnumeration search( NextInterceptor next, Name base, Map env, ExprNode filter,
+ SearchControls searchCtls ) throws NamingException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "Search for base = '" + base.toString() + "'" );
- }
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Search for base = '" + base.toString() + "'" );
+ }
checkAuthenticated();
return next.search( base, env, filter, searchCtls );
@@ -395,15 +404,14 @@
throw new IllegalStateException( "Attempted operation by unauthenticated caller." );
}
-
-
- public void bind( NextInterceptor next, Name bindDn, byte[] credentials, List mechanisms, String saslAuthId )
+
+
+ public void bind( NextInterceptor next, Name bindDn, byte[] credentials, List mechanisms, String saslAuthId )
throws NamingException
{
// check if we are already authenticated and if so we return making
// sure first that the credentials are not exposed within context
- ServerContext ctx =
- ( ServerContext ) InvocationStack.getInstance().peek().getCaller();
+ ServerContext ctx = ( ServerContext ) InvocationStack.getInstance().peek().getCaller();
if ( ctx.getPrincipal() != null )
{
@@ -416,7 +424,7 @@
// pick the first matching authenticator type
Collection authenticators = null;
- for ( int ii = 0; ii < mechanisms.size(); ii++)
+ for ( int ii = 0; ii < mechanisms.size(); ii++ )
{
authenticators = getAuthenticators( ( String ) mechanisms.get( ii ) );
@@ -433,8 +441,8 @@
next.bind( bindDn, credentials, mechanisms, saslAuthId );
log.debug( "Nexus succeeded on bind operation." );
// bind succeeded if we got this far
- ctx.setPrincipal( new TrustedPrincipalWrapper(
- new LdapPrincipal( bindDn, LdapJndiProperties.getAuthenticationLevel( ctx.getEnvironment() ) ) ) );
+ ctx.setPrincipal( new TrustedPrincipalWrapper( new LdapPrincipal( bindDn, LdapJndiProperties
+ .getAuthenticationLevel( ctx.getEnvironment() ) ) ) );
// remove creds so there is no security risk
ctx.removeFromEnvironment( Context.SECURITY_CREDENTIALS );
return;
@@ -454,15 +462,15 @@
ctx.removeFromEnvironment( Context.SECURITY_CREDENTIALS );
return;
}
- catch( LdapAuthenticationException e )
+ catch ( LdapAuthenticationException e )
{
// authentication failed, try the next authenticator
if ( log.isInfoEnabled() )
{
- log.info( "Authenticator "+authenticator.getClass()+" failed to authenticate " + bindDn );
+ log.info( "Authenticator " + authenticator.getClass() + " failed to authenticate " + bindDn );
}
}
- catch( Exception e )
+ catch ( Exception e )
{
// Log other exceptions than LdapAuthenticationException
if ( log.isWarnEnabled() )
@@ -475,7 +483,6 @@
throw new LdapAuthenticationException();
}
-
/**
* FIXME This doesn't secure anything actually.
*
@@ -500,7 +507,7 @@
*
* @param principal the LdapPrincipal to wrap
*/
- private TrustedPrincipalWrapper( LdapPrincipal principal )
+ private TrustedPrincipalWrapper(LdapPrincipal principal)
{
this.principal = principal;
}
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java Fri Feb 10 02:48:07 2006
@@ -49,18 +49,21 @@
* <tt>'none'</tt>,...).
*/
public String getAuthenticatorType();
-
+
+
/**
* Called by {@link AuthenticationService} to indicate that this
* authenticator is being placed into service.
*/
public void init( DirectoryServiceConfiguration factoryCfg, AuthenticatorConfiguration cfg ) throws NamingException;
-
+
+
/**
* Called by {@link AuthenticationService} to indicate that this
* authenticator is being removed from service.
*/
public void destroy();
+
/**
* Performs authentication and returns the principal if succeeded.
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java Fri Feb 10 02:48:07 2006
@@ -55,7 +55,7 @@
* @param name the normalized distinguished name of the principal
* @param authenticationLevel
*/
- LdapPrincipal( Name name, AuthenticationLevel authenticationLevel )
+ LdapPrincipal(Name name, AuthenticationLevel authenticationLevel)
{
this.name = name;
this.authenticationLevel = authenticationLevel;