本文整理汇总了Java中org.apache.directory.api.ldap.model.schema.registries.Schema.getDependencies方法的典型用法代码示例。如果您正苦于以下问题:Java Schema.getDependencies方法的具体用法?Java Schema.getDependencies怎么用?Java Schema.getDependencies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.directory.api.ldap.model.schema.registries.Schema
的用法示例。
在下文中一共展示了Schema.getDependencies方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import org.apache.directory.api.ldap.model.schema.registries.Schema; //导入方法依赖的package包/类
/**
* Converts a Schema to an Entry
*
* @param schema The Schema to convert
* @param schemaManager The SchemaManager
* @return An Entry containing the converted Schema
* @throws LdapException If the conversion failed
*/
public Entry convert( Schema schema, SchemaManager schemaManager ) throws LdapException
{
Entry entry = new DefaultEntry( schemaManager );
entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_SCHEMA_OC );
entry.put( SchemaConstants.CN_AT, schema.getSchemaName() );
entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
if ( schema.isDisabled() )
{
entry.put( MetaSchemaConstants.M_DISABLED_AT, "TRUE" );
}
String[] dependencies = schema.getDependencies();
if ( dependencies != null && dependencies.length > 0 )
{
Attribute attr = new DefaultAttribute(
schemaManager.getAttributeType( MetaSchemaConstants.M_DEPENDENCIES_AT ) );
for ( String dependency : dependencies )
{
attr.add( dependency );
}
entry.put( attr );
}
return entry;
}
示例2: load
import org.apache.directory.api.ldap.model.schema.registries.Schema; //导入方法依赖的package包/类
/**
* Load the schema in the registries. We will load everything accordingly to the two flags :
* - isRelaxed
* - disabledAccepted
*/
private boolean load( Registries registries, Schema schema ) throws LdapException
{
if ( schema == null )
{
LOG.info( "The schema is null" );
return false;
}
// First avoid loading twice the same schema
if ( registries.isSchemaLoaded( schema.getSchemaName() ) )
{
return true;
}
if ( schema.isDisabled() )
{
if ( registries.isDisabledAccepted() )
{
LOG.info( "Loading {} disabled schema: \n{}", schema.getSchemaName(), schema );
registries.schemaLoaded( schema );
addSchemaObjects( schema, registries );
}
else
{
return false;
}
}
else
{
LOG.info( "Loading {} enabled schema: \n{}", schema.getSchemaName(), schema );
// Check that the dependencies, if any, are correct
if ( schema.getDependencies() != null )
{
for ( String dependency : schema.getDependencies() )
{
Schema dependencySchema = schemaMap.get( dependency );
if ( dependencySchema == null )
{
// The dependency has not been loaded.
String msg = I18n.err( I18n.ERR_11002, schema.getSchemaName() );
LOG.info( msg );
Throwable error = new LdapProtocolErrorException( msg );
errors.add( error );
return false;
}
// If the dependency is disabled, then enable it
if ( dependencySchema.isDisabled() )
{
dependencySchema.enable();
if ( !load( registries, dependencySchema ) )
{
dependencySchema.disable();
return false;
}
}
}
}
registries.schemaLoaded( schema );
addSchemaObjects( schema, registries );
}
return true;
}
示例3: loadDepsFirst
import org.apache.directory.api.ldap.model.schema.registries.Schema; //导入方法依赖的package包/类
/**
* Recursive method which loads schema's with their dependent schemas first
* and tracks what schemas it has seen so the recursion does not go out of
* control with dependency cycle detection.
*
* @param registries The Registries in which the schemas will be loaded
* @param schema the current schema we are attempting to load
* @throws Exception if there is a cycle detected and/or another
* failure results while loading, producing and or registering schema objects
*/
private void loadDepsFirst( Registries registries, Schema schema ) throws LdapException
{
if ( schema == null )
{
LOG.info( "The schema is null" );
return;
}
if ( schema.isDisabled() && !registries.isDisabledAccepted() )
{
LOG.info( "The schema is disabled and the registries does not accepted disabled schema" );
return;
}
String schemaName = schema.getSchemaName();
if ( registries.isSchemaLoaded( schemaName ) )
{
LOG.info( "{} schema has already been loaded", schema.getSchemaName() );
return;
}
String[] deps = schema.getDependencies();
// if no deps then load this guy and return
if ( ( deps == null ) || ( deps.length == 0 ) )
{
load( registries, schema );
return;
}
/*
* We got deps and need to load them before this schema. We go through
* all deps loading them with their deps first if they have not been
* loaded.
*/
for ( String depName : deps )
{
if ( registries.isSchemaLoaded( depName ) )
{
// The schema is already loaded. Loop on the next schema
continue;
}
else
{
// Call recursively this method
Schema schemaDep = schemaMap.get( depName );
loadDepsFirst( registries, schemaDep );
}
}
// Now load the current schema
load( registries, schema );
}
示例4: loadDepsFirstRelaxed
import org.apache.directory.api.ldap.model.schema.registries.Schema; //导入方法依赖的package包/类
/**
* Recursive method which loads schema's with their dependent schemas first
* and tracks what schemas it has seen so the recursion does not go out of
* control with dependency cycle detection.
*
* @param schema the current schema we are attempting to load
* @throws Exception if there is a cycle detected and/or another
* failure results while loading, producing and or registering schema objects
*/
private void loadDepsFirstRelaxed( Schema schema ) throws LdapException
{
if ( schema == null )
{
LOG.info( "The schema is null" );
return;
}
if ( schema.isDisabled() && !registries.isDisabledAccepted() )
{
LOG.info( "The schema is disabled and the registries does not accepted disabled schema" );
return;
}
String schemaName = schema.getSchemaName();
if ( registries.isSchemaLoaded( schemaName ) )
{
LOG.info( "{} schema has already been loaded", schema.getSchemaName() );
return;
}
String[] deps = schema.getDependencies();
// if no deps then load this guy and return
if ( ( deps == null ) || ( deps.length == 0 ) )
{
load( registries, schema );
return;
}
/*
* We got deps and need to load them before this schema. We go through
* all deps loading them with their deps first if they have not been
* loaded.
*/
for ( String depName : deps )
{
if ( registries.isSchemaLoaded( schemaName ) )
{
// The schema is already loaded. Loop on the next schema
continue;
}
else
{
// Call recursively this method
Schema schemaDep = schema.getSchemaLoader().getSchema( depName );
loadDepsFirstRelaxed( schemaDep );
}
}
// Now load the current schema
load( registries, schema );
}