本文整理汇总了Java中org.apache.directory.server.i18n.I18n.err方法的典型用法代码示例。如果您正苦于以下问题:Java I18n.err方法的具体用法?Java I18n.err怎么用?Java I18n.err使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.directory.server.i18n.I18n
的用法示例。
在下文中一共展示了I18n.err方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: delete
import org.apache.directory.server.i18n.I18n; //导入方法依赖的package包/类
/**
* Checks to make sure the entry being deleted exists, and has no children, otherwise throws the appropriate
* LdapException.
*/
public void delete( DeleteOperationContext deleteContext ) throws LdapException
{
Dn dn = deleteContext.getDn();
if ( dn.equals( subschemSubentryDn ) )
{
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_253,
subschemSubentryDn ) );
}
next( deleteContext );
// Update the alias cache
synchronized ( notAliasCache )
{
if ( notAliasCache.containsKey( dn.getNormName() ) )
{
notAliasCache.remove( dn.getNormName() );
}
}
}
示例2: getPartition
import org.apache.directory.server.i18n.I18n; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public Partition getPartition( Dn dn ) throws LdapException
{
Partition parent = null;
synchronized ( partitionLookupTree )
{
parent = partitionLookupTree.getElement( dn );
}
if ( parent == null )
{
throw new LdapNoSuchObjectException( I18n.err( I18n.ERR_268, dn ) );
}
else
{
return parent;
}
}
示例3: move
import org.apache.directory.server.i18n.I18n; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void move( MoveOperationContext moveContext ) throws LdapException
{
Dn oriChildName = moveContext.getDn();
if ( oriChildName.equals( subschemSubentryDn ) )
{
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_258,
subschemSubentryDn, subschemSubentryDn ) );
}
next( moveContext );
// Remove the original entry from the NotAlias cache, if needed
synchronized ( notAliasCache )
{
if ( notAliasCache.containsKey( oriChildName.getNormName() ) )
{
notAliasCache.remove( oriChildName.getNormName() );
}
}
}
示例4: moveAndRename
import org.apache.directory.server.i18n.I18n; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
Dn oldDn = moveAndRenameContext.getDn();
// Don't allow M&R in the SSSE
if ( oldDn.equals( subschemSubentryDn ) )
{
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_258,
subschemSubentryDn, subschemSubentryDn ) );
}
// Remove the original entry from the NotAlias cache, if needed
synchronized ( notAliasCache )
{
if ( notAliasCache.containsKey( oldDn.getNormName() ) )
{
notAliasCache.remove( oldDn.getNormName() );
}
}
next( moveAndRenameContext );
}
示例5: convert
import org.apache.directory.server.i18n.I18n; //导入方法依赖的package包/类
private Value<?> convert( AttributeType attributeType, Value<?> value ) throws LdapException
{
if ( attributeType.getSyntax().isHumanReadable() )
{
if ( value instanceof BinaryValue )
{
try
{
return new StringValue( attributeType, new String( ( ( BinaryValue ) value ).getBytes(), "UTF-8" ) );
}
catch ( UnsupportedEncodingException uee )
{
String message = I18n.err( I18n.ERR_47 );
LOG.error( message );
throw new LdapException( message );
}
}
}
else
{
if ( value instanceof StringValue )
{
return new BinaryValue( attributeType, ( ( StringValue ) value ).getBytes() );
}
}
return null;
}
示例6: buildLdapPartialResultException
import org.apache.directory.server.i18n.I18n; //导入方法依赖的package包/类
private LdapPartialResultException buildLdapPartialResultException( Dn childDn )
{
LdapPartialResultException lpre = new LdapPartialResultException( I18n.err( I18n.ERR_315 ) );
lpre.setRemainingDn( childDn );
lpre.setResolvedDn( Dn.EMPTY_DN );
return lpre;
}
示例7: getUnion
import org.apache.directory.server.i18n.I18n; //导入方法依赖的package包/类
/**
* Creates a new attribute which contains the values representing the union
* of two attributes. If one attribute is null then the resultant attribute
* returned is a copy of the non-null attribute. If both are null then we
* cannot determine the attribute ID and an {@link IllegalArgumentException}
* is raised.
*
* @param attr0 the first attribute
* @param attr1 the second attribute
* @return a new attribute with the union of values from both attribute
* arguments
* @throws LdapException if there are problems accessing attribute values
*/
public static Attribute getUnion( Attribute attr0, Attribute attr1 ) throws LdapException
{
if ( attr0 == null && attr1 == null )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_465 ) );
}
else if ( attr0 == null )
{
return attr1.clone();
}
else if ( attr1 == null )
{
return attr0.clone();
}
else if ( !attr0.getAttributeType().equals( attr1.getAttributeType() ) )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_466 ) );
}
Attribute attr = attr0.clone();
for ( Value<?> value : attr1 )
{
attr.add( value );
}
return attr;
}
示例8: ensureStarted
import org.apache.directory.server.i18n.I18n; //导入方法依赖的package包/类
private void ensureStarted() throws LdapServiceUnavailableException
{
if ( !directoryService.isStarted() )
{
throw new LdapServiceUnavailableException( ResultCodeEnum.UNAVAILABLE, I18n.err( I18n.ERR_316 ) );
}
}
示例9: eagerlyPopulateFields
import org.apache.directory.server.i18n.I18n; //导入方法依赖的package包/类
/**
* Eagerly populates fields of operation contexts so multiple Interceptors
* in the processing pathway can reuse this value without performing a
* redundant lookup operation.
*
* @param opContext the operation context to populate with cached fields
*/
private void eagerlyPopulateFields( OperationContext opContext ) throws LdapException
{
// If the entry field is not set for ops other than add for example
// then we set the entry but don't freak if we fail to do so since it
// may not exist in the first place
if ( opContext.getEntry() == null )
{
// We have to use the admin session here, otherwise we may have
// trouble reading the entry due to insufficient access rights
CoreSession adminSession = opContext.getSession().getDirectoryService().getAdminSession();
LookupOperationContext lookupContext = new LookupOperationContext( adminSession, opContext.getDn(),
SchemaConstants.ALL_ATTRIBUTES_ARRAY );
Entry foundEntry = opContext.getSession().getDirectoryService().getPartitionNexus().lookup( lookupContext );
if ( foundEntry != null )
{
opContext.setEntry( foundEntry );
}
else
{
// This is an error : we *must* have an entry if we want to be able to rename.
LdapNoSuchObjectException ldnfe = new LdapNoSuchObjectException( I18n.err( I18n.ERR_256_NO_SUCH_OBJECT,
opContext.getDn() ) );
throw ldnfe;
}
}
}
示例10: assertRdn
import org.apache.directory.server.i18n.I18n; //导入方法依赖的package包/类
private void assertRdn( Dn dn, Entry entry ) throws LdapException
{
for ( Ava atav : dn.getRdn() )
{
Attribute attribute = entry.get( atav.getNormType() );
if ( ( attribute == null ) || ( !attribute.contains( atav.getNormValue() ) ) )
{
String message = I18n.err( I18n.ERR_62, dn, atav.getType() );
LOG.error( message );
throw new LdapSchemaViolationException( ResultCodeEnum.NOT_ALLOWED_ON_RDN, message );
}
}
}
示例11: getSchemaName
import org.apache.directory.server.i18n.I18n; //导入方法依赖的package包/类
private String getSchemaName( Dn dn ) throws LdapException
{
int size = dn.size();
if ( size < 2 )
{
throw new LdapException( I18n.err( I18n.ERR_276 ) );
}
Rdn rdn = dn.getRdn( size - 2 );
return rdn.getNormValue().getString();
}
示例12: initSchemaPartition
import org.apache.directory.server.i18n.I18n; //导入方法依赖的package包/类
private void initSchemaPartition() throws IOException, LdapException, KerberosException {
InstanceLayout instanceLayout = directoryService.getInstanceLayout();
File schemaPartitionDirectory = new File(instanceLayout.getPartitionsDirectory(), "schema");
// Extract the schema on disk (a brand new one) and load the registries
if (schemaPartitionDirectory.exists()) {
LOGGER.info("schema partition already exists, skipping schema extraction");
} else {
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor(instanceLayout.getPartitionsDirectory());
extractor.extractOrCopy();
}
SchemaLoader loader = new LdifSchemaLoader(schemaPartitionDirectory);
SchemaManager schemaManager = new DefaultSchemaManager(loader);
// We have to load the schema now, otherwise we won't be able
// to initialize the Partitions, as we won't be able to parse
// and normalize their suffix Dn
schemaManager.loadAllEnabled();
List<Throwable> errors = schemaManager.getErrors();
if (errors.size() != 0) {
throw new KerberosException(I18n.err(I18n.ERR_317, Exceptions.printErrors(errors)));
}
directoryService.setSchemaManager(schemaManager);
// Init the LdifPartition with schema
LdifPartition schemaLdifPartition = new LdifPartition(schemaManager, directoryService.getDnFactory());
schemaLdifPartition.setPartitionPath(schemaPartitionDirectory.toURI());
// The schema partition
SchemaPartition schemaPartition = new SchemaPartition(schemaManager);
schemaPartition.setWrappedPartition(schemaLdifPartition);
directoryService.setSchemaPartition(schemaPartition);
}
示例13: initSchemaPartition
import org.apache.directory.server.i18n.I18n; //导入方法依赖的package包/类
private void initSchemaPartition() throws Exception {
InstanceLayout instanceLayout = directoryService.getInstanceLayout();
File schemaPartitionDirectory = new File( instanceLayout.getPartitionsDirectory(), "schema" );
if ( schemaPartitionDirectory.exists() ) {
System.out.println( "schema partition already exists, skipping schema extraction" );
} else {
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor(instanceLayout.getPartitionsDirectory());
try {
extractor.extractOrCopy();
} catch (IOException e) {
log.error("Extracting schema partition failed " + e.getMessage());
throw new Exception();
}
}
SchemaLoader loader = new LdifSchemaLoader(schemaPartitionDirectory);
SchemaManager schemaManager = new DefaultSchemaManager( loader );
log.info("loading schmea partition... ");
schemaManager.loadAllEnabled();
List<Throwable> errors = schemaManager.getErrors();
if (errors.size() != 0) {
log.error("Error creating schema partition");
throw new Exception(I18n.err(I18n.ERR_317, Exceptions.printErrors(errors)));
}
directoryService.setSchemaManager(schemaManager);
LdifPartition schemaLdifPartition = new LdifPartition(schemaManager, directoryService.getDnFactory());
schemaLdifPartition.setPartitionPath(schemaPartitionDirectory.toURI());
SchemaPartition schemaPartition = new SchemaPartition(schemaManager);
schemaPartition.setWrappedPartition(schemaLdifPartition);
directoryService.setSchemaPartition(schemaPartition);
}
示例14: initSchema
import org.apache.directory.server.i18n.I18n; //导入方法依赖的package包/类
/**
* Inits the schema and schema partition.
*
* @throws Exception If unable to extract schema files.
*/
private void initSchema()
throws Exception {
SchemaPartition schemaPartition = directoryService.getSchemaService().getSchemaPartition();
// Init the LdifPartition
LdifPartition ldifPartition = new LdifPartition();
String workingDirectory = directoryService.getWorkingDirectory().getPath();
ldifPartition.setWorkingDirectory(workingDirectory + File.separator + "schema");
// Extract the schema on disk (a brand new one) and load the registries
File schemaRepository = new File(workingDirectory, "schema");
if (!schemaRepository.exists()) {
SchemaLdifExtractor extractor =
new CarbonSchemaLdifExtractor(new File(workingDirectory),
new File(this.schemaZipStore));
extractor.extractOrCopy();
}
schemaPartition.setWrappedPartition(ldifPartition);
SchemaLoader loader = new LdifSchemaLoader(schemaRepository);
SchemaManager schemaManager = new DefaultSchemaManager(loader);
directoryService.setSchemaManager(schemaManager);
// We have to load the schema now, otherwise we won't be able
// to initialize the Partitions, as we won't be able to parse
// and normalize their suffix DN
schemaManager.loadAllEnabled();
schemaPartition.setSchemaManager(schemaManager);
List<Throwable> errors = schemaManager.getErrors();
if (!errors.isEmpty()) {
throw new DirectoryServerException(I18n.err(I18n.ERR_317, ExceptionUtils.printErrors(errors)));
}
}
示例15: initSchemaPartition
import org.apache.directory.server.i18n.I18n; //导入方法依赖的package包/类
/**
* Initialize the schema manager and add the schema partition to directory service.
*
* @throws Exception if the schema LDIF files are not found on the classpath
*/
private void initSchemaPartition() throws Exception {
InstanceLayout instanceLayout = service.getInstanceLayout();
File schemaPartitionDirectory = new File(instanceLayout.getPartitionsDirectory(), "schema");
// Extract the schema on disk (a brand new one) and load the registries
if (schemaPartitionDirectory.exists()) {
LOG.debug("schema partition already exists, skipping schema extraction");
} else {
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor(instanceLayout.getPartitionsDirectory());
extractor.extractOrCopy();
}
SchemaLoader loader = new LdifSchemaLoader(schemaPartitionDirectory);
SchemaManager schemaManager = new DefaultSchemaManager(loader);
// We have to load the schema now, otherwise we won't be able
// to initialize the Partitions, as we won't be able to parse
// and normalize their suffix Dn
schemaManager.loadAllEnabled();
List<Throwable> errors = schemaManager.getErrors();
if (!errors.isEmpty()) {
throw new IllegalStateException(I18n.err(I18n.ERR_317, Exceptions.printErrors(errors)));
}
service.setSchemaManager(schemaManager);
// Init the LdifPartition with schema
LdifPartition schemaLdifPartition = new LdifPartition(schemaManager, service.getDnFactory());
schemaLdifPartition.setPartitionPath(schemaPartitionDirectory.toURI());
// The schema partition
SchemaPartition schemaPartition = new SchemaPartition(schemaManager);
schemaPartition.setWrappedPartition(schemaLdifPartition);
service.setSchemaPartition(schemaPartition);
}