private Normalizer classLoadNormalizer( SchemaManager schemaManager, String oid, String className,
Attribute byteCode ) throws Exception
{
// Try to class load the normalizer
Class<?> clazz = null;
Normalizer normalizer = null;
String byteCodeStr = StringConstants.EMPTY;
if ( byteCode == null )
{
clazz = Class.forName( className );
}
else
{
classLoader.setAttribute( byteCode );
clazz = classLoader.loadClass( className );
byteCodeStr = new String( Base64.encode( byteCode.getBytes() ) );
}
// Create the normalizer instance
normalizer = ( Normalizer ) clazz.newInstance();
// Update the common fields
normalizer.setBytecode( byteCodeStr );
normalizer.setFqcn( className );
// Inject the new OID, as the loaded normalizer might have its own
normalizer.setOid( oid );
// Inject the SchemaManager for the normalizer who needs it
normalizer.setSchemaManager( schemaManager );
return normalizer;
}