Java Code Examples for org.apache.directory.api.ldap.model.schema.registries.Schema#isDisabled()
The following examples show how to use
org.apache.directory.api.ldap.model.schema.registries.Schema#isDisabled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultSchemaManager.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public List<Schema> getDisabled() { List<Schema> disabled = new ArrayList<>(); for ( Schema schema : registries.getLoadedSchemas().values() ) { if ( schema.isDisabled() ) { disabled.add( schema ); } } return disabled; }
Example 2
Source File: AttributesFactory.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * 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( timeProvider ) ); 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; }
Example 3
Source File: DefaultSchemaManager.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public boolean isDisabled( String schemaName ) { Schema schema = registries.getLoadedSchema( schemaName ); return ( schema != null ) && schema.isDisabled(); }
Example 4
Source File: DefaultSchemaManager.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * 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 LdapException 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 ) { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_16013_SCHEMA_IS_NULL ) ); } return; } if ( schema.isDisabled() && !registries.isDisabledAccepted() ) { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_16017_UNACCEPTED_DISABLED_SCHEMA ) ); } return; } String schemaName = schema.getSchemaName(); if ( registries.isSchemaLoaded( schemaName ) ) { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_16018_SCHEMA_ALREADY_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 ) ) { // Call recursively this method Schema schemaDep = schemaMap.get( depName ); loadDepsFirst( registries, schemaDep ); } } // Now load the current schema load( registries, schema ); }
Example 5
Source File: DefaultSchemaManager.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * 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 LdapException 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 ) { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_16013_SCHEMA_IS_NULL ) ); } return; } if ( schema.isDisabled() && !registries.isDisabledAccepted() ) { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_16017_UNACCEPTED_DISABLED_SCHEMA ) ); } return; } String schemaName = schema.getSchemaName(); if ( registries.isSchemaLoaded( schemaName ) ) { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_16018_SCHEMA_ALREADY_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 ) ) { // Call recursively this method Schema schemaDep = schema.getSchemaLoader().getSchema( depName ); loadDepsFirstRelaxed( schemaDep ); } } // Now load the current schema load( registries, schema ); }
Example 6
Source File: DefaultSchemaManager.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public boolean isDisabled( Schema schema ) { return ( schema != null ) && schema.isDisabled(); }