You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by cc...@apache.org on 2007/07/14 09:55:59 UTC
svn commit: r556238 [4/8] - in /directory: apacheds/trunk-with-dependencies/
sandbox/ccustine/new_installers/apacheds/
sandbox/ccustine/new_installers/apacheds/benchmarks/
sandbox/ccustine/new_installers/apacheds/bootstrap-extract/
sandbox/ccustine/new...
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableBTreePartitionConfiguration.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableBTreePartitionConfiguration.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableBTreePartitionConfiguration.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableBTreePartitionConfiguration.java Sat Jul 14 00:55:44 2007
@@ -19,13 +19,13 @@
*/
package org.apache.directory.server.core.partition.impl.btree;
+
import java.util.Set;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import org.apache.directory.server.core.configuration.PartitionConfiguration;
-import org.apache.directory.server.core.partition.Partition;
/**
@@ -42,21 +42,21 @@
}
- public void setName( String name )
+ public void setId( String name )
{
- super.setName( name );
+ super.setId( name );
}
- public void setIndexedAttributes( Set indexedAttributes )
+ public void setIndexedAttributes( Set<Object> indexedAttributes )
{
super.setIndexedAttributes( indexedAttributes );
}
- public void setContextPartition( Partition partition )
+ public void setPartitionClassName( String partitionClassName )
{
- super.setContextPartition( partition );
+ super.setPartitionClassName( partitionClassName );
}
@@ -91,7 +91,7 @@
newConfig.setCacheSize( config.getCacheSize() );
newConfig.setContextEntry( config.getContextEntry() );
newConfig.setIndexedAttributes( config.getIndexedAttributes() );
- newConfig.setName( config.getName() );
+ newConfig.setId( config.getId() );
newConfig.setSuffix( config.getSuffix() );
newConfig.setSynchOnWrite( false );
return newConfig;
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Sat Jul 14 00:55:44 2007
@@ -83,7 +83,7 @@
throws NamingException
{
// setup optimizer and registries for parent
- initOptimizer0( cfg );
+ initOptimizerAndConfiguration0( cfg );
initRegistries1( factoryCfg.getRegistries() );
// initialize the store
@@ -92,13 +92,13 @@
storeConfig.setCacheSize( cfg.getCacheSize() );
storeConfig.setContextEntry( cfg.getContextEntry() );
storeConfig.setIndexedAttributes( cfg.getIndexedAttributes() );
- storeConfig.setName( cfg.getName() );
+ storeConfig.setName( cfg.getId() );
storeConfig.setOidRegistry( oidRegistry );
storeConfig.setSuffixDn( cfg.getSuffix() );
storeConfig.setWorkingDirectory( new File(
factoryCfg.getStartupConfiguration().getWorkingDirectory().getPath()
- + File.separator + cfg.getName() ) );
+ + File.separator + cfg.getId() ) );
if ( cfg instanceof BTreePartitionConfiguration )
{
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java Sat Jul 14 00:55:44 2007
@@ -38,14 +38,11 @@
import javax.naming.directory.SearchResult;
import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.authn.AuthenticationService;
-import org.apache.directory.server.core.authz.AuthorizationService;
-import org.apache.directory.server.core.authz.DefaultAuthorizationService;
import org.apache.directory.server.core.configuration.InterceptorConfiguration;
+import org.apache.directory.server.core.configuration.StartupConfiguration;
import org.apache.directory.server.core.enumeration.ReferralHandlingEnumeration;
import org.apache.directory.server.core.enumeration.SearchResultFilter;
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
-import org.apache.directory.server.core.event.EventService;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
@@ -60,14 +57,9 @@
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.jndi.ServerLdapContext;
-import org.apache.directory.server.core.normalization.NormalizationService;
-import org.apache.directory.server.core.operational.OperationalAttributeService;
import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
-import org.apache.directory.server.core.schema.SchemaService;
-import org.apache.directory.server.core.subtree.SubentryService;
-import org.apache.directory.server.core.trigger.TriggerService;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.server.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.NotImplementedException;
@@ -98,9 +90,6 @@
*/
public class ReferralService extends BaseInterceptor
{
- /** The service name */
- public static final String NAME = "referralService";
-
private static final Logger log = LoggerFactory.getLogger( ReferralService.class );
private static final String IGNORE = "ignore";
private static final String THROW_FINDING_BASE = "throw-finding-base";
@@ -124,16 +113,16 @@
* partitions of the system during startup and during add/remove partition ops
*/
Collection<String> c = new HashSet<String>();
- c.add( NormalizationService.NAME );
- c.add( AuthenticationService.NAME );
- c.add( AuthorizationService.NAME );
- c.add( DefaultAuthorizationService.NAME );
- c.add( SchemaService.NAME );
- c.add( SubentryService.NAME );
- c.add( OperationalAttributeService.NAME );
- c.add( ReferralService.NAME );
- c.add( EventService.NAME );
- c.add( TriggerService.NAME );
+ c.add( StartupConfiguration.NORMALIZATION_SERVICE_NAME );
+ c.add( StartupConfiguration.AUTHENTICATION_SERVICE_NAME );
+ c.add( StartupConfiguration.AUTHORIZATION_SERVICE_NAME );
+ c.add( StartupConfiguration.DEFAULT_AUTHORIZATION_SERVICE_NAME );
+ c.add( StartupConfiguration.SCHEMA_SERVICE_NAME );
+ c.add( StartupConfiguration.SUBENTRY_SERVICE_NAME );
+ c.add( StartupConfiguration.OPERATIONAL_ATTRIBUTE_SERVICE_NAME );
+ c.add( StartupConfiguration.REFERRAL_SERVICE_NAME );
+ c.add( StartupConfiguration.EVENT_SERVICE_NAME );
+ c.add( StartupConfiguration.TRIGGER_SERVICE_NAME );
SEARCH_BYPASS = Collections.unmodifiableCollection( c );
}
@@ -784,7 +773,7 @@
next.addContextPartition( opContext );
// add referrals immediately after adding the new partition
- Partition partition = ((AddContextPartitionOperationContext)opContext).getCfg().getContextPartition();
+ Partition partition = ( ( AddContextPartitionOperationContext ) opContext ).getPartition();
LdapDN suffix = partition.getSuffix();
Invocation invocation = InvocationStack.getInstance().peek();
NamingEnumeration list = invocation.getProxy().search(
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java Sat Jul 14 00:55:44 2007
@@ -541,7 +541,7 @@
SyntaxImpl syntax = new SyntaxImpl( desc.getNumericOid(), globalRegistries.getSyntaxCheckerRegistry() );
setSchemaObjectProperties( desc, syntax );
- syntax.setHumanReadible( isHumanReadable( desc ) );
+ syntax.setHumanReadable( isHumanReadable( desc ) );
syntaxes[ii] = syntax;
}
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java Sat Jul 14 00:55:44 2007
@@ -542,10 +542,10 @@
SyntaxImpl syntax = new SyntaxImpl( oid, targetRegistries.getSyntaxCheckerRegistry() );
syntax.setSchema( schema );
- if ( entry.get( MetaSchemaConstants.X_HUMAN_READIBLE_AT ) != null )
+ if ( entry.get( MetaSchemaConstants.X_HUMAN_READABLE_AT ) != null )
{
- String val = ( String ) entry.get( MetaSchemaConstants.X_HUMAN_READIBLE_AT ).get();
- syntax.setHumanReadible( val.toUpperCase().equals( "TRUE" ) );
+ String val = ( String ) entry.get( MetaSchemaConstants.X_HUMAN_READABLE_AT ).get();
+ syntax.setHumanReadable( val.toUpperCase().equals( "TRUE" ) );
}
if ( entry.get( MetaSchemaConstants.M_DESCRIPTION_AT ) != null )
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java Sat Jul 14 00:55:44 2007
@@ -35,17 +35,11 @@
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.constants.MetaSchemaConstants;
-import org.apache.directory.server.core.authn.AuthenticationService;
-import org.apache.directory.server.core.authz.AuthorizationService;
-import org.apache.directory.server.core.authz.DefaultAuthorizationService;
-import org.apache.directory.server.core.collective.CollectiveAttributeService;
-import org.apache.directory.server.core.exception.ExceptionService;
+import org.apache.directory.server.core.configuration.StartupConfiguration;
import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.jndi.ServerLdapContext;
-import org.apache.directory.server.core.normalization.NormalizationService;
-import org.apache.directory.server.core.referral.ReferralService;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.server.schema.registries.ObjectClassRegistry;
import org.apache.directory.server.schema.registries.OidRegistry;
@@ -178,14 +172,14 @@
VALID_OU_VALUES.add( SchemaConstants.DIT_STRUCTURE_RULES_AT.toLowerCase() );
HashSet<String> set = new HashSet<String>();
- set.add( NormalizationService.NAME );
- set.add( AuthenticationService.NAME );
- set.add( ReferralService.NAME );
- set.add( AuthorizationService.NAME );
- set.add( DefaultAuthorizationService.NAME );
- set.add( ExceptionService.NAME );
- set.add( SchemaService.NAME );
- set.add( CollectiveAttributeService.NAME );
+ set.add( StartupConfiguration.NORMALIZATION_SERVICE_NAME );
+ set.add( StartupConfiguration.AUTHENTICATION_SERVICE_NAME );
+ set.add( StartupConfiguration.REFERRAL_SERVICE_NAME );
+ set.add( StartupConfiguration.AUTHORIZATION_SERVICE_NAME );
+ set.add( StartupConfiguration.DEFAULT_AUTHORIZATION_SERVICE_NAME );
+ set.add( StartupConfiguration.EXCEPTION_SERVICE_NAME );
+ set.add( StartupConfiguration.SCHEMA_SERVICE_NAME );
+ set.add( StartupConfiguration.COLLECTIVE_ATTRIBUTE_SERVICE_NAME );
SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS = Collections.unmodifiableCollection( set );
}
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Sat Jul 14 00:55:44 2007
@@ -115,9 +115,6 @@
/** The LoggerFactory used by this Interceptor */
private static Logger log = LoggerFactory.getLogger( SchemaService.class );
- /** The service name */
- public static final String NAME = "schemaService";
-
private static final String[] EMPTY_STRING_ARRAY = new String[0];
private static final String BINARY_KEY = JndiPropertyConstants.JNDI_LDAP_ATTRIBUTES_BINARY;
@@ -1600,7 +1597,7 @@
continue;
}
- asBinary = !type.getSyntax().isHumanReadible();
+ asBinary = !type.getSyntax().isHumanReadable();
asBinary = asBinary || ( ( binaries != null ) && ( binaries.contains( type ) ) );
asBinary = asBinary || binaries.contains( type );
@@ -1719,7 +1716,7 @@
}
// Check the attributes values and transform them to String if necessary
- assertHumanReadible( entry );
+ assertHumanReadable( entry );
// Now check the syntaxes
assertSyntaxes( entry );
@@ -1892,7 +1889,7 @@
{
String message = "Attribute value '" +
(value instanceof String ? value : StringTools.dumpBytes( (byte[])value ) ) +
- "' for attribute '" + attribute.getID() + "' is syntaxically incorrect";
+ "' for attribute '" + attribute.getID() + "' is syntactically incorrect";
log.info( message );
throw new LdapInvalidAttributeValueException( message, ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
@@ -1903,10 +1900,10 @@
}
/**
- * Check that all the attribute's values which are Human Readible can be transformed
+ * Check that all the attribute's values which are Human Readable can be transformed
* to valid String if they are stored as byte[].
*/
- private void assertHumanReadible( Attributes entry ) throws NamingException
+ private void assertHumanReadable( Attributes entry ) throws NamingException
{
NamingEnumeration attributes = entry.getAll();
boolean isEntryModified = false;
@@ -1920,7 +1917,7 @@
AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( attribute.getID() );
// If the attributeType is H-R, check all of its values
- if ( attributeType.getSyntax().isHumanReadible() )
+ if ( attributeType.getSyntax().isHumanReadable() )
{
Enumeration values = attribute.getAll();
Attribute clone = null;
@@ -1962,7 +1959,7 @@
}
else
{
- throw new NamingException( "The value stored in an Human Readible attribute is not a String" );
+ throw new NamingException( "The value stored in an Human Readable attribute is not a String" );
}
}
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java Sat Jul 14 00:55:44 2007
@@ -28,15 +28,11 @@
import javax.naming.directory.Attributes;
import org.apache.directory.server.constants.MetaSchemaConstants;
-import org.apache.directory.server.core.authn.AuthenticationService;
-import org.apache.directory.server.core.authz.AuthorizationService;
-import org.apache.directory.server.core.authz.DefaultAuthorizationService;
-import org.apache.directory.server.core.exception.ExceptionService;
+import org.apache.directory.server.core.configuration.StartupConfiguration;
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
-import org.apache.directory.server.core.referral.ReferralService;
import org.apache.directory.server.schema.bootstrap.Schema;
import org.apache.directory.server.utils.AttributesFactory;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -72,12 +68,12 @@
static
{
Set<String> bypass = new HashSet<String>();
- bypass.add( AuthenticationService.NAME );
- bypass.add( ReferralService.NAME );
- bypass.add( AuthorizationService.NAME );
- bypass.add( DefaultAuthorizationService.NAME );
- bypass.add( ExceptionService.NAME );
- bypass.add( SchemaService.NAME );
+ bypass.add( StartupConfiguration.AUTHENTICATION_SERVICE_NAME );
+ bypass.add( StartupConfiguration.REFERRAL_SERVICE_NAME );
+ bypass.add( StartupConfiguration.AUTHORIZATION_SERVICE_NAME );
+ bypass.add( StartupConfiguration.DEFAULT_AUTHORIZATION_SERVICE_NAME );
+ bypass.add( StartupConfiguration.EXCEPTION_SERVICE_NAME );
+ bypass.add( StartupConfiguration.SCHEMA_SERVICE_NAME );
BYPASS = Collections.unmodifiableCollection( bypass );
}
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SyntaxImpl.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SyntaxImpl.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SyntaxImpl.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SyntaxImpl.java Sat Jul 14 00:55:44 2007
@@ -53,9 +53,9 @@
}
- public void setHumanReadible( boolean humanReadible )
+ public void setHumanReadable( boolean humanReadable )
{
- super.setHumanReadible( humanReadible );
+ super.setHumanReadable( humanReadable );
}
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java Sat Jul 14 00:55:44 2007
@@ -87,9 +87,6 @@
*/
public class SubentryService extends BaseInterceptor
{
- /** The service name */
- public static final String NAME = "subentryService";
-
/** the subentry control OID */
private static final String SUBENTRY_CONTROL = SubentriesControl.CONTROL_OID;
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java Sat Jul 14 00:55:44 2007
@@ -21,7 +21,6 @@
package org.apache.directory.server.core.trigger;
-import java.lang.reflect.Method;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
@@ -36,6 +35,7 @@
import org.apache.directory.server.core.DirectoryServiceConfiguration;
import org.apache.directory.server.core.configuration.InterceptorConfiguration;
+import org.apache.directory.server.core.configuration.StartupConfiguration;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.InterceptorChain;
import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -49,7 +49,10 @@
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.jndi.ServerLdapContext;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
-import org.apache.directory.server.core.sp.LdapClassLoader;
+import org.apache.directory.server.core.sp.StoredProcEngine;
+import org.apache.directory.server.core.sp.StoredProcEngineConfig;
+import org.apache.directory.server.core.sp.StoredProcExecutionManager;
+import org.apache.directory.server.core.sp.java.JavaStoredProcEngineConfig;
import org.apache.directory.server.core.subtree.SubentryService;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -62,7 +65,6 @@
import org.apache.directory.shared.ldap.trigger.TriggerSpecification;
import org.apache.directory.shared.ldap.trigger.TriggerSpecificationParser;
import org.apache.directory.shared.ldap.trigger.TriggerSpecification.SPSpec;
-import org.apache.directory.shared.ldap.util.DirectoryClassUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -77,11 +79,6 @@
{
/** the logger for this class */
private static final Logger log = LoggerFactory.getLogger( TriggerService.class );
-
- /** The service name */
- public static final String NAME = "triggerService";
-
-
/** the entry trigger attribute string: entryTrigger */
private static final String ENTRY_TRIGGER_ATTR = "entryTriggerSpecification";
@@ -98,6 +95,8 @@
/** a Trigger Execution Authorizer */
private TriggerExecutionAuthorizer triggerExecutionAuthorizer = new SimpleTriggerExecutionAuthorizer();
+
+ private StoredProcExecutionManager manager;
/**
* Adds prescriptiveTrigger TriggerSpecificaitons to a collection of
@@ -236,6 +235,15 @@
}
);
chain = dirServCfg.getInterceptorChain();
+
+ //StoredProcEngineConfig javaxScriptSPEngineConfig = new JavaxStoredProcEngineConfig();
+ StoredProcEngineConfig javaSPEngineConfig = new JavaStoredProcEngineConfig();
+ List<StoredProcEngineConfig> spEngineConfigs = new ArrayList<StoredProcEngineConfig>();
+ //spEngineConfigs.add( javaxScriptSPEngineConfig );
+ spEngineConfigs.add( javaSPEngineConfig );
+ String spContainer = "ou=Stored Procedures,ou=system";
+ manager = new StoredProcExecutionManager( spContainer, spEngineConfigs );
+
this.enabled = true; // TODO: Get this from the configuration if needed.
}
@@ -436,7 +444,7 @@
// we need to construct an entry to represent it
// at least with minimal requirements which are object class
// and access control subentry operational attributes.
- SubentryService subentryService = ( SubentryService ) chain.get( SubentryService.NAME );
+ SubentryService subentryService = ( SubentryService ) chain.get( StartupConfiguration.SUBENTRY_SERVICE_NAME );
Attributes fakeImportedEntry = subentryService.getSubentryAttributes( newDN, importedEntry );
NamingEnumeration attrList = importedEntry.getAll();
while ( attrList.hasMore() )
@@ -510,7 +518,7 @@
// we need to construct an entry to represent it
// at least with minimal requirements which are object class
// and access control subentry operational attributes.
- SubentryService subentryService = ( SubentryService ) chain.get( SubentryService.NAME );
+ SubentryService subentryService = ( SubentryService ) chain.get( StartupConfiguration.SUBENTRY_SERVICE_NAME );
Attributes fakeImportedEntry = subentryService.getSubentryAttributes( newDN, importedEntry );
NamingEnumeration attrList = importedEntry.getAll();
@@ -578,50 +586,26 @@
{
List<Object> arguments = new ArrayList<Object>();
arguments.addAll( injector.getArgumentsToInject( spSpec.getParameters() ) );
- List<Class> typeList = new ArrayList<Class>();
- typeList.addAll( getTypesFromValues( arguments ) );
- Class[] types = getTypesFromValues( arguments ).toArray( EMPTY_CLASS_ARRAY );
Object[] values = arguments.toArray();
- Object returnValue = executeProcedure( callerRootCtx, spSpec.getName(), types, values );
- returnValues.add(returnValue);
+ Object returnValue = executeProcedure( callerRootCtx, spSpec.getName(), values );
+ returnValues.add( returnValue );
}
return returnValues;
}
+
- private static Class[] EMPTY_CLASS_ARRAY = new Class[ 0 ];
-
- private List<Class> getTypesFromValues( List objects )
- {
- List<Class> types = new ArrayList<Class>();
-
- Iterator it = objects.iterator();
-
- while( it.hasNext() )
- {
- types.add( it.next().getClass() );
- }
-
- return types;
- }
-
- private Object executeProcedure( ServerLdapContext ctx, String procedure, Class[] types, Object[] values ) throws NamingException
+ private Object executeProcedure( ServerLdapContext ctx, String procedure, Object[] values ) throws NamingException
{
- int lastDot = procedure.lastIndexOf( '.' );
- String className = procedure.substring( 0, lastDot );
- String methodName = procedure.substring( lastDot + 1 );
- LdapClassLoader loader = new LdapClassLoader( ctx );
try
{
- Class clazz = loader.loadClass( className );
- Method proc = DirectoryClassUtils.getAssignmentCompatibleMethod( clazz, methodName, types );
- return proc.invoke( null, values );
+ Attributes spUnit = manager.findStoredProcUnit( ctx, procedure );
+ StoredProcEngine engine = manager.getStoredProcEngineInstance( spUnit );
+ return engine.invokeProcedure( ctx, procedure, values );
}
- catch ( Exception e )
+ catch ( NamingException e )
{
- log.debug( "Exception occured during executing stored procedure:\n" +
- e.getMessage() + "\n" + e.getStackTrace() );
LdapNamingException lne = new LdapNamingException( ResultCodeEnum.OTHER );
lne.setRootCause( e );
throw lne;
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java Sat Jul 14 00:55:44 2007
@@ -271,7 +271,7 @@
private static final long serialVersionUID = 1L;
- public boolean isHumanReadible()
+ public boolean isHumanReadable()
{
return true;
}
@@ -337,7 +337,7 @@
private static final long serialVersionUID = 1L;
- public boolean isHumanReadible()
+ public boolean isHumanReadable()
{
return true;
}
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java Sat Jul 14 00:55:44 2007
@@ -171,10 +171,10 @@
tuples = getTuples( new ProtectedItem.AllAttributeValues( attrTypes ) );
- Assert.assertEquals( 1, filterA.filter( tuples, OperationScope.ATTRIBUTE_TYPE, null, null, USER_NAME, null,
+ Assert.assertEquals( 1, filterA.filter( tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME, null,
null, null, "attrA", null, null, null ).size() );
- Assert.assertEquals( 0, filterB.filter( tuples, OperationScope.ATTRIBUTE_TYPE, null, null, USER_NAME, null,
+ Assert.assertEquals( 0, filterB.filter( tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME, null,
null, null, "attrB", null, null, null ).size() );
}
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java Sat Jul 14 00:55:44 2007
@@ -24,25 +24,19 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.naming.Context;
-import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchResult;
import junit.framework.TestCase;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.DirectoryServiceConfiguration;
import org.apache.directory.server.core.DirectoryServiceListener;
-import org.apache.directory.server.core.configuration.InterceptorConfiguration;
import org.apache.directory.server.core.configuration.MutableInterceptorConfiguration;
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.OperationContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.jndi.DeadContext;
@@ -51,31 +45,43 @@
/**
- * Unit test cases for InterceptorChain methods.
+ * Unit test cases for InterceptorChain methods which test bypass
+ * instructions in the chain.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
public class InterceptorChainTest extends TestCase
{
- private final MockInterceptor[] interceptorArray =
- { new MockInterceptor( "0" ), new MockInterceptor( "1" ), new MockInterceptor( "2" ),
- new MockInterceptor( "3" ), new MockInterceptor( "4" ) };
+ private static final int INTERCEPTOR_COUNT = 5;
private InterceptorChain chain;
- private List<Interceptor> interceptors = new ArrayList<Interceptor>( interceptorArray.length );
-
+ List<MockInterceptor> interceptors = new ArrayList<MockInterceptor>( INTERCEPTOR_COUNT );
+
+ public InterceptorChainTest()
+ {
+ }
+
+
protected void setUp() throws Exception
{
chain = new InterceptorChain();
- for ( int ii = 0; ii < interceptorArray.length; ii++ )
+ for ( int ii = 0; ii < INTERCEPTOR_COUNT; ii++ )
{
MutableInterceptorConfiguration config = new MutableInterceptorConfiguration();
- config.setInterceptor( interceptorArray[ii] );
- config.setName( interceptorArray[ii].getName() );
+ config.setInterceptorClassName( MockInterceptor.class.getName() );
+ config.setName( Integer.toString( ii ) );
chain.addLast( config );
}
+
+ List interceptorsInChain = chain.getAll();
+ for ( int ii = 0; ii < INTERCEPTOR_COUNT; ii++ )
+ {
+ MockInterceptor interceptor = ( MockInterceptor ) interceptorsInChain.get( ii );
+ interceptor.setTest( this );
+ interceptor.setName( Integer.toString( ii ) );
+ }
}
@@ -92,8 +98,7 @@
Context ctx = new DeadContext();
DirectoryService ds = new MockDirectoryService();
PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
- Invocation i = new Invocation( proxy, ctx, "lookup", new Object[]
- { dn } );
+ Invocation i = new Invocation( proxy, ctx, "lookup", new Object[]{ dn } );
InvocationStack.getInstance().push( i );
try
@@ -104,10 +109,10 @@
{
}
- assertEquals( interceptorArray.length, interceptors.size() );
- for ( int ii = 0; ii < interceptorArray.length; ii++ )
+ assertEquals( INTERCEPTOR_COUNT, interceptors.size() );
+ for ( int ii = 0; ii < INTERCEPTOR_COUNT; ii++ )
{
- assertEquals( interceptorArray[ii], interceptors.get( ii ) );
+ assertEquals( Integer.toString( ii ), interceptors.get( ii ).getName() );
}
}
@@ -130,15 +135,11 @@
{
}
- assertEquals( interceptorArray.length - 1, interceptors.size() );
- for ( int ii = 0; ii < interceptorArray.length; ii++ )
+ assertEquals( INTERCEPTOR_COUNT - 1, interceptors.size() );
+ for ( int ii = 1; ii < INTERCEPTOR_COUNT; ii++ )
{
- if ( ii != 0 )
- {
- assertEquals( interceptorArray[ii], interceptors.get( ii - 1 ) );
- }
+ assertEquals( Integer.toString( ii ), interceptors.get( ii - 1 ).getName() );
}
- assertFalse( interceptors.contains( interceptorArray[0] ) );
}
@@ -163,16 +164,11 @@
{
}
- assertEquals( interceptorArray.length - 2, interceptors.size() );
- for ( int ii = 0; ii < interceptorArray.length; ii++ )
+ assertEquals( INTERCEPTOR_COUNT - 2, interceptors.size() );
+ for ( int ii = 2; ii < INTERCEPTOR_COUNT; ii++ )
{
- if ( ii != 0 && ii != 1 )
- {
- assertEquals( interceptorArray[ii], interceptors.get( ii - 2 ) );
- }
+ assertEquals( Integer.toString( ii ), interceptors.get( ii - 2 ).getName() );
}
- assertFalse( interceptors.contains( interceptorArray[0] ) );
- assertFalse( interceptors.contains( interceptorArray[1] ) );
}
@@ -197,12 +193,10 @@
{
}
- assertEquals( interceptorArray.length - 2, interceptors.size() );
- assertEquals( interceptorArray[1], interceptors.get( 0 ) );
- assertEquals( interceptorArray[2], interceptors.get( 1 ) );
- assertEquals( interceptorArray[3], interceptors.get( 2 ) );
- assertFalse( interceptors.contains( interceptorArray[0] ) );
- assertFalse( interceptors.contains( interceptorArray[4] ) );
+ assertEquals( INTERCEPTOR_COUNT - 2, interceptors.size() );
+ assertEquals( "1", interceptors.get( 0 ).getName() );
+ assertEquals( "2", interceptors.get( 1 ).getName() );
+ assertEquals( "3", interceptors.get( 2 ).getName() );
}
@@ -227,12 +221,10 @@
{
}
- assertEquals( interceptorArray.length - 2, interceptors.size() );
- assertEquals( interceptorArray[0], interceptors.get( 0 ) );
- assertEquals( interceptorArray[2], interceptors.get( 1 ) );
- assertEquals( interceptorArray[4], interceptors.get( 2 ) );
- assertFalse( interceptors.contains( interceptorArray[1] ) );
- assertFalse( interceptors.contains( interceptorArray[3] ) );
+ assertEquals( INTERCEPTOR_COUNT - 2, interceptors.size() );
+ assertEquals( "0", interceptors.get( 0 ).getName() );
+ assertEquals( "2", interceptors.get( 1 ).getName() );
+ assertEquals( "4", interceptors.get( 2 ).getName() );
}
@@ -257,172 +249,7 @@
assertEquals( 0, interceptors.size() );
}
- class MockInterceptor implements Interceptor
- {
- String name;
-
-
- public MockInterceptor(String name)
- {
- this.name = name;
- }
-
-
- public String getName()
- {
- return this.name;
- }
-
-
- public void init( DirectoryServiceConfiguration factoryCfg, InterceptorConfiguration cfg )
- throws NamingException
- {
- }
-
-
- public void destroy()
- {
- }
-
-
- public Attributes getRootDSE( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.getRootDSE( opContext );
- }
-
-
- public LdapDN getMatchedName ( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.getMatchedName( opContext );
- }
-
-
- public LdapDN getSuffix ( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.getSuffix( opContext );
- }
-
-
- public Iterator listSuffixes ( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.listSuffixes( opContext );
- }
-
-
- public void addContextPartition( NextInterceptor next, OperationContext opContext )
- throws NamingException
- {
- interceptors.add( this );
- next.addContextPartition( opContext );
- }
-
-
- public void removeContextPartition( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- next.removeContextPartition( opContext );
- }
-
-
- public boolean compare( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.compare( opContext );
- }
-
-
- public void delete( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- next.delete( opContext );
- }
-
-
- public void add(NextInterceptor next, OperationContext opContext )
- throws NamingException
- {
- interceptors.add( this );
- next.add( opContext );
- }
-
-
- public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- next.modify( opContext );
- }
-
-
- public NamingEnumeration list( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.list( opContext );
- }
-
-
- public NamingEnumeration<SearchResult> search( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.search( opContext );
- }
-
-
- public Attributes lookup( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.lookup( opContext );
- }
-
-
- public boolean hasEntry( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.hasEntry( opContext );
- }
-
-
- public void rename( NextInterceptor next, OperationContext opContext )
- throws NamingException
- {
- interceptors.add( this );
- next.rename( opContext );
- }
-
-
- public void move( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- next.move( opContext );
- }
-
-
- public void moveAndRename( NextInterceptor next, OperationContext opContext )
- throws NamingException
- {
- interceptors.add( this );
- next.moveAndRename( opContext );
- }
-
-
- public void bind( NextInterceptor next, OperationContext opContext )
- throws NamingException
- {
- interceptors.add( this );
- next.bind( opContext );
- }
-
-
- public void unbind( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- next.unbind( opContext );
- }
- }
-
+
class MockDirectoryService extends DirectoryService
{
public void startup( DirectoryServiceListener listener, Hashtable environment ) throws NamingException
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java Sat Jul 14 00:55:44 2007
@@ -131,10 +131,10 @@
// --------------------------------------------------------------------
MutablePartitionConfiguration pc = new MutablePartitionConfiguration();
- pc.setName( "schema" );
+ pc.setId( "schema" );
pc.setCacheSize( 1000 );
+ pc.setPartitionClassName( JdbmPartition.class.getName() );
pc.setIndexedAttributes( extractor.getDbFileListing().getIndexedAttributes() );
- pc.setOptimizerEnabled( true );
pc.setSuffix( "ou=schema" );
Attributes entry = new AttributesImpl();
Modified: directory/sandbox/ccustine/new_installers/apacheds/jdbm-store/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/jdbm-store/pom.xml?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/jdbm-store/pom.xml (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/jdbm-store/pom.xml Sat Jul 14 00:55:44 2007
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.directory.server</groupId>
- <artifactId>build</artifactId>
+ <artifactId>apacheds-parent</artifactId>
<version>1.5.1-SNAPSHOT</version>
</parent>
<artifactId>apacheds-jdbm-store</artifactId>
@@ -25,12 +25,6 @@
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>nlog4j</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
Modified: directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/pom.xml?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/pom.xml (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/pom.xml Sat Jul 14 00:55:44 2007
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.directory.server</groupId>
- <artifactId>build</artifactId>
+ <artifactId>apacheds-parent</artifactId>
<version>1.5.1-SNAPSHOT</version>
</parent>
<artifactId>apacheds-kerberos-shared</artifactId>
Modified: directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/checksum/ChecksumHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/checksum/ChecksumHandler.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/checksum/ChecksumHandler.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/checksum/ChecksumHandler.java Sat Jul 14 00:55:44 2007
@@ -59,6 +59,29 @@
/**
+ * Calculate a checksum based on raw bytes and an (optional) key for keyed checksums.
+ *
+ * @param checksumType
+ * @param bytes
+ * @param key
+ * @param usage
+ * @return The {@link Checksum}.
+ * @throws KerberosException
+ */
+ public Checksum calculateChecksum( ChecksumType checksumType, byte[] bytes, byte[] key, KeyUsage usage )
+ throws KerberosException
+ {
+ if ( !DEFAULT_CHECKSUMS.containsKey( checksumType ) )
+ {
+ throw new KerberosException( ErrorType.KDC_ERR_SUMTYPE_NOSUPP );
+ }
+
+ ChecksumEngine digester = getEngine( checksumType );
+ return new Checksum( checksumType, digester.calculateChecksum( bytes, key, usage ) );
+ }
+
+
+ /**
* Verify a checksum by providing the raw bytes and an (optional) key for keyed checksums.
*
* @param checksum
Modified: directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/CipherTextHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/CipherTextHandler.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/CipherTextHandler.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/CipherTextHandler.java Sat Jul 14 00:55:44 2007
@@ -33,6 +33,7 @@
import org.apache.directory.server.kerberos.shared.io.decoder.Decoder;
import org.apache.directory.server.kerberos.shared.io.decoder.DecoderFactory;
import org.apache.directory.server.kerberos.shared.io.decoder.EncApRepPartDecoder;
+import org.apache.directory.server.kerberos.shared.io.decoder.EncKdcRepPartDecoder;
import org.apache.directory.server.kerberos.shared.io.decoder.EncKrbPrivPartDecoder;
import org.apache.directory.server.kerberos.shared.io.decoder.EncTicketPartDecoder;
import org.apache.directory.server.kerberos.shared.io.decoder.EncryptedTimestampDecoder;
@@ -50,6 +51,7 @@
import org.apache.directory.server.kerberos.shared.messages.TicketGrantReply;
import org.apache.directory.server.kerberos.shared.messages.components.Authenticator;
import org.apache.directory.server.kerberos.shared.messages.components.EncApRepPart;
+import org.apache.directory.server.kerberos.shared.messages.components.EncKdcRepPart;
import org.apache.directory.server.kerberos.shared.messages.components.EncKrbPrivPart;
import org.apache.directory.server.kerberos.shared.messages.components.EncTicketPart;
import org.apache.directory.server.kerberos.shared.messages.value.AuthorizationData;
@@ -100,6 +102,7 @@
map.put( AuthorizationData.class, AuthorizationDataDecoder.class );
map.put( EncKrbPrivPart.class, EncKrbPrivPartDecoder.class );
map.put( EncApRepPart.class, EncApRepPartDecoder.class );
+ map.put( EncKdcRepPart.class, EncKdcRepPartDecoder.class );
DEFAULT_DECODERS = Collections.unmodifiableMap( map );
}
Modified: directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/HostAddressDecoder.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/HostAddressDecoder.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/HostAddressDecoder.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/HostAddressDecoder.java Sat Jul 14 00:55:44 2007
@@ -46,7 +46,7 @@
*/
protected static HostAddress decode( DERSequence sequence )
{
- HostAddressType type = HostAddressType.NULL;
+ HostAddressType type = HostAddressType.ADDRTYPE_IPV4;
byte[] value = null;
for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
Modified: directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/LastRequestDecoder.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/LastRequestDecoder.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/LastRequestDecoder.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/LastRequestDecoder.java Sat Jul 14 00:55:44 2007
@@ -45,7 +45,7 @@
* lr-value[1] KerberosTime
* }
*/
- protected LastRequest decodeSequence( DERSequence sequence )
+ protected static LastRequest decodeSequence( DERSequence sequence )
{
LastRequestEntry[] entries = new LastRequestEntry[sequence.size()];
@@ -62,7 +62,7 @@
}
- protected LastRequestEntry decode( DERSequence sequence )
+ protected static LastRequestEntry decode( DERSequence sequence )
{
LastRequestType type = LastRequestType.NONE;
KerberosTime value = null;
Modified: directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/TicketDecoder.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/TicketDecoder.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/TicketDecoder.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/decoder/TicketDecoder.java Sat Jul 14 00:55:44 2007
@@ -25,6 +25,7 @@
import org.apache.directory.server.kerberos.shared.messages.components.Ticket;
import org.apache.directory.server.kerberos.shared.messages.components.TicketModifier;
+import org.apache.directory.shared.asn1.der.ASN1InputStream;
import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
import org.apache.directory.shared.asn1.der.DEREncodable;
import org.apache.directory.shared.asn1.der.DERGeneralString;
@@ -39,6 +40,23 @@
*/
public class TicketDecoder
{
+ /**
+ * Decodes a byte array into an {@link Ticket}.
+ *
+ * @param encodedTicket
+ * @return The {@link Ticket}.
+ * @throws IOException
+ */
+ public static Ticket decode( byte[] encodedTicket ) throws IOException
+ {
+ ASN1InputStream ais = new ASN1InputStream( encodedTicket );
+
+ DERApplicationSpecific app = ( DERApplicationSpecific ) ais.readObject();
+
+ return decode( app );
+ }
+
+
/**
* Decodes a {@link DERSequence} into an array of {@link Ticket}s.
*
Modified: directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcRequestEncoder.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcRequestEncoder.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcRequestEncoder.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/KdcRequestEncoder.java Sat Jul 14 00:55:44 2007
@@ -20,6 +20,7 @@
package org.apache.directory.server.kerberos.shared.io.encoder;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -84,6 +85,25 @@
sequence.add( new DERTaggedObject( 4, encodeKdcRequestBody( app ) ) );
return sequence;
+ }
+
+
+ /**
+ * Encodes a {@link KdcRequest} into a byte[].
+ *
+ * @param request
+ * @return The encoded {@link KdcRequest}.
+ * @throws IOException
+ */
+ public byte[] encodeBody( KdcRequest request ) throws IOException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ASN1OutputStream aos = new ASN1OutputStream( baos );
+
+ aos.writeObject( encodeKdcRequestBody( request ) );
+ aos.close();
+
+ return baos.toByteArray();
}
Modified: directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/TicketEncoder.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/TicketEncoder.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/TicketEncoder.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/io/encoder/TicketEncoder.java Sat Jul 14 00:55:44 2007
@@ -20,7 +20,11 @@
package org.apache.directory.server.kerberos.shared.io.encoder;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
import org.apache.directory.server.kerberos.shared.messages.components.Ticket;
+import org.apache.directory.shared.asn1.der.ASN1OutputStream;
import org.apache.directory.shared.asn1.der.DERApplicationSpecific;
import org.apache.directory.shared.asn1.der.DERGeneralString;
import org.apache.directory.shared.asn1.der.DERInteger;
@@ -34,6 +38,25 @@
*/
public class TicketEncoder
{
+ /**
+ * Encodes a {@link Ticket} into a its ASN.1 DER encoding.
+ *
+ * @param ticket
+ * @return The byte[] containing the ASN.1 DER encoding of the {@link Ticket}.
+ * @throws IOException
+ */
+ public static byte[] encodeTicket( Ticket ticket ) throws IOException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ASN1OutputStream aos = new ASN1OutputStream( baos );
+
+ aos.writeObject( encode( ticket ) );
+ aos.close();
+
+ return baos.toByteArray();
+ }
+
+
/**
* Ticket ::= [APPLICATION 1] SEQUENCE {
* tkt-vno[0] INTEGER,
Modified: directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/components/EncKdcRepPart.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/components/EncKdcRepPart.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/components/EncKdcRepPart.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/components/EncKdcRepPart.java Sat Jul 14 00:55:44 2007
@@ -22,6 +22,7 @@
import javax.security.auth.kerberos.KerberosPrincipal;
+import org.apache.directory.server.kerberos.shared.messages.Encodable;
import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
import org.apache.directory.server.kerberos.shared.messages.value.HostAddresses;
import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
@@ -35,7 +36,7 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class EncKdcRepPart
+public class EncKdcRepPart implements Encodable
{
private EncryptionKey key;
private LastRequest lastRequest;
Modified: directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddress.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddress.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddress.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddress.java Sat Jul 14 00:55:44 2007
@@ -56,7 +56,7 @@
*/
public HostAddress( InetAddress internetAddress )
{
- addressType = HostAddressType.ADDRTYPE_INET;
+ addressType = HostAddressType.ADDRTYPE_IPV4;
byte[] newAddress = internetAddress.getAddress();
address = new byte[newAddress.length];
System.arraycopy( newAddress, 0, address, 0, newAddress.length );
Modified: directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddressType.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddressType.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddressType.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddressType.java Sat Jul 14 00:55:44 2007
@@ -26,144 +26,69 @@
/**
+ * Type-safe enumerator for RFC 4120 section 7.5.3 "Address Types."
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
public final class HostAddressType implements Comparable
{
/**
- * Constant for the "null" host address type.
+ * Constant for the "IPv4" host address type.
*/
- public static final HostAddressType NULL = new HostAddressType( 0, "null" );
+ public static final HostAddressType ADDRTYPE_IPV4 = new HostAddressType( 2, "IPv4" );
/**
- * Constant for the "Unix" host address type.
+ * Constant for the "Directional" host address type.
*/
- public static final HostAddressType ADDRTYPE_UNIX = new HostAddressType( 1, "Unix" );
+ public static final HostAddressType ADDRTYPE_DIRECTIONAL = new HostAddressType( 3, "Directional" );
/**
- * Constant for the "Internet" host address type.
+ * Constant for the "ChaosNet" host address type.
*/
- public static final HostAddressType ADDRTYPE_INET = new HostAddressType( 2, "Internet" );
+ public static final HostAddressType ADDRTYPE_CHAOSNET = new HostAddressType( 5, "ChaosNet" );
/**
- * Constant for the "Arpanet" host address type.
+ * Constant for the "XEROX Network Services (XNS)" host address type.
*/
- public static final HostAddressType ADDRTYPE_IMPLINK = new HostAddressType( 3, "Arpanet" );
+ public static final HostAddressType ADDRTYPE_XNS = new HostAddressType( 6, "XEROX Network Services (XNS)" );
/**
- * Constant for the "PUP" host address type.
+ * Constant for the "ISO" host address type.
*/
- public static final HostAddressType ADDRTYPE_PUP = new HostAddressType( 4, "PUP" );
+ public static final HostAddressType ADDRTYPE_ISO = new HostAddressType( 7, "ISO" );
/**
- * Constant for the "CHAOS" host address type.
+ * Constant for the "DECNET Phase IV" host address type.
*/
- public static final HostAddressType ADDRTYPE_CHAOS = new HostAddressType( 5, "CHAOS" );
+ public static final HostAddressType ADDRTYPE_DECNET = new HostAddressType( 12, "DECNET Phase IV" );
/**
- * Constant for the "XEROX Network Services" host address type.
+ * Constant for the "AppleTalk DDP" host address type.
*/
- public static final HostAddressType ADDRTYPE_XNS = new HostAddressType( 6, "XEROX Network Services" );
-
- /**
- * Constant for the "IPX" host address type.
- */
- public static final HostAddressType ADDRTYPE_IPX = new HostAddressType( 6, "IPX" );
-
- /**
- * Constant for the "OSI" host address type.
- */
- public static final HostAddressType ADDRTYPE_OSI = new HostAddressType( 7, "OSI" );
-
- /**
- * Constant for the "European Computer Manufacturers" host address type.
- */
- public static final HostAddressType ADDRTYPE_ECMA = new HostAddressType( 8, "European Computer Manufacturers" );
-
- /**
- * Constant for the "Datakit" host address type.
- */
- public static final HostAddressType ADDRTYPE_DATAKIT = new HostAddressType( 9, "Datakit" );
-
- /**
- * Constant for the "CCITT" host address type.
- */
- public static final HostAddressType ADDRTYPE_CCITT = new HostAddressType( 10, "CCITT" );
-
- /**
- * Constant for the "SNA" host address type.
- */
- public static final HostAddressType ADDRTYPE_SNA = new HostAddressType( 11, "SNA" );
-
- /**
- * Constant for the "DECnet" host address type.
- */
- public static final HostAddressType ADDRTYPE_DECNET = new HostAddressType( 12, "DECnet" );
-
- /**
- * Constant for the "Direct Data Link Interface" host address type.
- */
- public static final HostAddressType ADDRTYPE_DLI = new HostAddressType( 13, "Direct Data Link Interface" );
-
- /**
- * Constant for the "LAT" host address type.
- */
- public static final HostAddressType ADDRTYPE_LAT = new HostAddressType( 14, "LAT" );
-
- /**
- * Constant for the "NSC Hyperchannel" host address type.
- */
- public static final HostAddressType ADDRTYPE_HYLINK = new HostAddressType( 15, "NSC Hyperchannel" );
-
- /**
- * Constant for the "AppleTalk" host address type.
- */
- public static final HostAddressType ADDRTYPE_APPLETALK = new HostAddressType( 16, "AppleTalk" );
+ public static final HostAddressType ADDRTYPE_APPLETALK = new HostAddressType( 16, "AppleTalk DDP" );
/**
* Constant for the "NetBios" host address type.
*/
- public static final HostAddressType ADDRTYPE_NETBIOS = new HostAddressType( 17, "NetBios" );
-
- /**
- * Constant for the "VoiceView" host address type.
- */
- public static final HostAddressType ADDRTYPE_VOICEVIEW = new HostAddressType( 18, "VoiceView" );
-
- /**
- * Constant for the "Firefox" host address type.
- */
- public static final HostAddressType ADDRTYPE_FIREFOX = new HostAddressType( 19, "Firefox" );
-
- /**
- * Constant for the "Banyan" host address type.
- */
- public static final HostAddressType ADDRTYPE_BAN = new HostAddressType( 21, "Banyan" );
-
- /**
- * Constant for the "ATM" host address type.
- */
- public static final HostAddressType ADDRTYPE_ATM = new HostAddressType( 22, "ATM" );
+ public static final HostAddressType ADDRTYPE_NETBIOS = new HostAddressType( 20, "NetBios" );
/**
- * Constant for the "Internet Protocol V6" host address type.
+ * Constant for the "IPv6" host address type.
*/
- public static final HostAddressType ADDRTYPE_INET6 = new HostAddressType( 23, "Internet Protocol V6" );
+ public static final HostAddressType ADDRTYPE_IPV6 = new HostAddressType( 24, "IPv6" );
/**
* Array for building a List of VALUES.
*/
private static final HostAddressType[] values =
- { NULL, ADDRTYPE_UNIX, ADDRTYPE_INET, ADDRTYPE_IMPLINK, ADDRTYPE_PUP, ADDRTYPE_CHAOS, ADDRTYPE_XNS,
- ADDRTYPE_IPX, ADDRTYPE_OSI, ADDRTYPE_ECMA, ADDRTYPE_DATAKIT, ADDRTYPE_CCITT, ADDRTYPE_SNA, ADDRTYPE_DECNET,
- ADDRTYPE_DLI, ADDRTYPE_LAT, ADDRTYPE_HYLINK, ADDRTYPE_APPLETALK, ADDRTYPE_NETBIOS, ADDRTYPE_VOICEVIEW,
- ADDRTYPE_FIREFOX, ADDRTYPE_BAN, ADDRTYPE_ATM, ADDRTYPE_INET6 };
+ { ADDRTYPE_IPV4, ADDRTYPE_DIRECTIONAL, ADDRTYPE_CHAOSNET, ADDRTYPE_XNS, ADDRTYPE_ISO, ADDRTYPE_DECNET,
+ ADDRTYPE_APPLETALK, ADDRTYPE_NETBIOS, ADDRTYPE_IPV6 };
/**
* A List of all the host address type constants.
*/
- public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values ) );
+ public static final List<HostAddressType> VALUES = Collections.unmodifiableList( Arrays.asList( values ) );
/**
* The name of the host address type.
@@ -202,7 +127,7 @@
}
}
- return NULL;
+ return ADDRTYPE_IPV4;
}
Modified: directory/sandbox/ccustine/new_installers/apacheds/mitosis/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/mitosis/pom.xml?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/mitosis/pom.xml (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/mitosis/pom.xml Sat Jul 14 00:55:44 2007
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.directory.server</groupId>
- <artifactId>build</artifactId>
+ <artifactId>apacheds-parent</artifactId>
<version>1.5.1-SNAPSHOT</version>
</parent>
<artifactId>mitosis</artifactId>
Modified: directory/sandbox/ccustine/new_installers/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/DefaultCSNFactory.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/DefaultCSNFactory.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/DefaultCSNFactory.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/DefaultCSNFactory.java Sat Jul 14 00:55:44 2007
@@ -28,7 +28,6 @@
public class DefaultCSNFactory implements CSNFactory
{
private static int operationSequence;
- private static long lastTimestamp = System.currentTimeMillis();
public DefaultCSNFactory()
@@ -53,13 +52,12 @@
public synchronized CSN newInstance( ReplicaId replicaId )
{
long newTimestamp = System.currentTimeMillis();
- if ( lastTimestamp == newTimestamp )
+ if ( operationSequence == Integer.MAX_VALUE )
{
operationSequence = 0;
}
CSN newCSN = new DefaultCSN( newTimestamp, replicaId, operationSequence++ );
- lastTimestamp = newTimestamp;
return newCSN;
}
}
Modified: directory/sandbox/ccustine/new_installers/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java Sat Jul 14 00:55:44 2007
@@ -26,7 +26,6 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import javax.naming.NameNotFoundException;
import javax.naming.NamingEnumeration;
@@ -43,6 +42,7 @@
import org.apache.directory.mitosis.common.Replica;
import org.apache.directory.mitosis.common.ReplicaId;
import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
+import org.apache.directory.mitosis.configuration.ReplicationInterceptorConfiguration;
import org.apache.directory.mitosis.operation.Operation;
import org.apache.directory.mitosis.operation.OperationFactory;
import org.apache.directory.mitosis.service.protocol.codec.ReplicationServerProtocolCodecFactory;
@@ -60,7 +60,10 @@
import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.partition.PartitionNexus;
@@ -169,13 +172,6 @@
}
- public void setConfiguration( ReplicationConfiguration cfg )
- {
- cfg.validate();
- this.configuration = cfg;
- }
-
-
public DirectoryServiceConfiguration getFactoryConfiguration()
{
return directoryServiceConfiguration;
@@ -184,6 +180,8 @@
public void init( DirectoryServiceConfiguration serviceCfg, InterceptorConfiguration cfg ) throws NamingException
{
+ ReplicationInterceptorConfiguration replicationCfg = ( ReplicationInterceptorConfiguration ) cfg;
+ configuration = replicationCfg.getReplicationConfiguration();
configuration.validate();
// and then preserve frequently used ones
directoryServiceConfiguration = serviceCfg;
@@ -383,9 +381,10 @@
}
- public void delete( NextInterceptor nextInterceptor, LdapDN name ) throws NamingException
+ @Override
+ public void delete( NextInterceptor next, OperationContext opContext ) throws NamingException
{
- Operation op = operationFactory.newDelete( name );
+ Operation op = operationFactory.newDelete( opContext.getDn() );
op.execute( nexus, store, attrRegistry );
}
@@ -395,27 +394,31 @@
Operation op = operationFactory.newModify( modifyContext );
op.execute( nexus, store, attrRegistry );
}
-
-
- public void modifyRn( NextInterceptor next, LdapDN oldName, String newRDN, boolean deleteOldRDN )
- throws NamingException
+
+
+ @Override
+ public void move( NextInterceptor next, OperationContext opContext ) throws NamingException
{
- Operation op = operationFactory.newModifyRn( oldName, newRDN, deleteOldRDN );
+ MoveOperationContext moveOpContext = (MoveOperationContext) opContext;
+ Operation op = operationFactory.newMove( moveOpContext.getDn(), moveOpContext.getParent() );
op.execute( nexus, store, attrRegistry );
}
-
-
- public void move( NextInterceptor next, LdapDN oldName, LdapDN newParentName, String newRDN, boolean deleteOldRDN )
- throws NamingException
+
+
+ @Override
+ public void moveAndRename( NextInterceptor next, OperationContext opContext ) throws NamingException
{
- Operation op = operationFactory.newMove( oldName, newParentName, newRDN, deleteOldRDN );
+ MoveAndRenameOperationContext moveAndRenameOpContext = (MoveAndRenameOperationContext) opContext;
+ Operation op = operationFactory.newMove( moveAndRenameOpContext.getDn(), moveAndRenameOpContext.getParent(), moveAndRenameOpContext.getNewRdn(), moveAndRenameOpContext.getDelOldDn() );
op.execute( nexus, store, attrRegistry );
}
-
-
- public void move( NextInterceptor next, LdapDN oldName, LdapDN newParentName ) throws NamingException
+
+
+ @Override
+ public void rename( NextInterceptor next, OperationContext opContext ) throws NamingException
{
- Operation op = operationFactory.newMove( oldName, newParentName );
+ RenameOperationContext renameOpContext = (RenameOperationContext) opContext;
+ Operation op = operationFactory.newModifyRn( renameOpContext.getDn(), renameOpContext.getNewRdn(), renameOpContext.getDelOldDn() );
op.execute( nexus, store, attrRegistry );
}
@@ -481,12 +484,13 @@
}
- public NamingEnumeration list( NextInterceptor nextInterceptor, LdapDN baseName ) throws NamingException
+ @Override
+ public NamingEnumeration list( NextInterceptor next, OperationContext opContext ) throws NamingException
{
DirContext ctx = ( DirContext ) InvocationStack.getInstance().peek().getCaller();
- NamingEnumeration e = nextInterceptor.search(
+ NamingEnumeration e = next.search(
new SearchOperationContext(
- baseName, ctx.getEnvironment(),
+ opContext.getDn(), ctx.getEnvironment(),
new PresenceNode( SchemaConstants.OBJECT_CLASS_AT_OID ),
new SearchControls() ) );
@@ -495,9 +499,12 @@
}
- public NamingEnumeration search( NextInterceptor nextInterceptor, LdapDN baseName, Map environment, ExprNode filter,
- SearchControls searchControls ) throws NamingException
+ @Override
+ public NamingEnumeration<SearchResult> search( NextInterceptor next, OperationContext opContext ) throws NamingException
{
+ SearchOperationContext searchOpContext = (SearchOperationContext) opContext;
+ SearchControls searchControls = searchOpContext.getSearchControls();
+
if ( searchControls.getReturningAttributes() != null )
{
String[] oldAttrIds = searchControls.getReturningAttributes();
@@ -507,8 +514,8 @@
searchControls.setReturningAttributes( newAttrIds );
}
- NamingEnumeration e = nextInterceptor.search(
- new SearchOperationContext( baseName, environment, filter, searchControls ) );
+ NamingEnumeration e = next.search(
+ new SearchOperationContext( searchOpContext.getDn(), searchOpContext.getEnv(), searchOpContext.getFilter(), searchControls ) );
return new SearchResultFilteringEnumeration( e, searchControls, InvocationStack.getInstance().peek(),
Constants.DELETED_ENTRIES_FILTER, "Search Replication filter" );
}
Modified: directory/sandbox/ccustine/new_installers/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java Sat Jul 14 00:55:44 2007
@@ -30,6 +30,7 @@
import javax.naming.Context;
import javax.naming.InitialContext;
+import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.ldap.InitialLdapContext;
@@ -41,13 +42,14 @@
import org.apache.commons.io.FileUtils;
import org.apache.directory.mitosis.common.Replica;
import org.apache.directory.mitosis.common.ReplicaId;
+import org.apache.directory.mitosis.configuration.MutableReplicationInterceptorConfiguration;
import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.configuration.InterceptorConfiguration;
-import org.apache.directory.server.core.configuration.MutableInterceptorConfiguration;
import org.apache.directory.server.core.configuration.MutableStartupConfiguration;
import org.apache.directory.server.core.configuration.ShutdownConfiguration;
import org.apache.directory.server.core.jndi.CoreContextFactory;
+import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.mina.util.AvailablePortFinder;
@@ -72,21 +74,11 @@
destroyAllReplicas();
}
- public void testOneWayBind() throws Exception
+ public void testOneWay() throws Exception
{
- LdapContext ctxA = getReplicaContext( "A" );
- LdapContext ctxB = getReplicaContext( "B" );
- LdapContext ctxC = getReplicaContext( "C" );
-
- Attributes entry = new AttributesImpl( true );
- entry.put( "cn", "test" );
- entry.put( "objectClass", "top" );
- ctxA.bind( "cn=test,ou=system", entry );
-
- Thread.sleep( 5000 );
-
- Assert.assertNotNull( ctxB.lookup( "cn=test,ou=system" ) );
- Assert.assertNotNull( ctxC.lookup( "cn=test,ou=system" ) );
+ String dn1 = "cn=test,ou=system";
+ testOneWayBind( dn1 );
+ testOneWayUnbind( dn1 );
}
public void _testTwoWayBind() throws Exception
@@ -107,13 +99,59 @@
entryB.put( "objectClass", "top" );
ctxB.bind( "cn=test,ou=system", entryB );
- Thread.sleep( 5000 );
+ Thread.sleep( 7000 );
Assert.assertEquals( "B", getAttributeValue( ctxA, "cn=test,ou=system", "ou" ) );
Assert.assertEquals( "B", getAttributeValue( ctxB, "cn=test,ou=system", "ou" ) );
Assert.assertEquals( "B", getAttributeValue( ctxC, "cn=test,ou=system", "ou" ) );
}
+ private void testOneWayBind( String dn ) throws Exception
+ {
+ LdapContext ctxA = getReplicaContext( "A" );
+ LdapContext ctxB = getReplicaContext( "B" );
+ LdapContext ctxC = getReplicaContext( "C" );
+
+ Attributes entry = new AttributesImpl( true );
+ entry.put( "cn", "test" );
+ entry.put( "objectClass", "top" );
+ ctxA.bind( dn, entry );
+
+ Thread.sleep( 7000 );
+
+ Assert.assertNotNull( ctxB.lookup( dn ) );
+ Assert.assertNotNull( ctxC.lookup( dn ) );
+ }
+
+ private void testOneWayUnbind( String dn ) throws Exception
+ {
+ LdapContext ctxA = getReplicaContext( "A" );
+ LdapContext ctxB = getReplicaContext( "B" );
+ LdapContext ctxC = getReplicaContext( "C" );
+
+ ctxA.unbind( dn );
+
+ Thread.sleep( 7000 );
+
+ assertNotExists( ctxA, dn );
+ assertNotExists( ctxB, dn );
+ assertNotExists( ctxC, dn );
+ }
+
+ private void assertNotExists( LdapContext ctx, String dn ) throws NamingException
+ {
+ try
+ {
+ ctx.lookup( dn );
+ }
+ catch ( LdapNameNotFoundException e )
+ {
+ // This is expected so return immediately.
+ return;
+ }
+ throw new AssertionError( "The entry exists" );
+ }
+
private String getAttributeValue( LdapContext ctx, String name, String attrName ) throws Exception
{
Attribute attr = ( ( Attributes ) ctx.lookup( name ) ).get( attrName );
@@ -170,12 +208,11 @@
}
ReplicationService replicationService = new ReplicationService();
- replicationService.setConfiguration( replicationCfg );
-
- MutableInterceptorConfiguration interceptorCfg = new MutableInterceptorConfiguration();
+ MutableReplicationInterceptorConfiguration interceptorCfg =
+ new MutableReplicationInterceptorConfiguration();
interceptorCfg.setName( "mitosis" );
- interceptorCfg.setInterceptor( replicationService );
-
+ interceptorCfg.setInterceptorClassName( replicationService.getClass().getName() );
+ interceptorCfg.setReplicationConfiguration( replicationCfg );
interceptorCfgs.add( interceptorCfg );
ldapCfg.setInterceptorConfigurations( interceptorCfgs );