• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java I18n类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.directory.server.i18n.I18n的典型用法代码示例。如果您正苦于以下问题:Java I18n类的具体用法?Java I18n怎么用?Java I18n使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



I18n类属于org.apache.directory.server.i18n包,在下文中一共展示了I18n类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handle

import org.apache.directory.server.i18n.I18n; //导入依赖的package包/类
/**
 * Deal with a received BindRequest
 * 
 * @param ldapSession The current session
 * @param bindRequest The received BindRequest
 * @throws Exception If the authentication cannot be handled
 */
public void handle( LdapSession ldapSession, BindRequest bindRequest ) throws Exception
{
    LOG.debug( "Received: {}", bindRequest );

    // Guard clause:  LDAP version 3
    if ( !bindRequest.getVersion3() )
    {
        LOG.error( I18n.err( I18n.ERR_162 ) );
        LdapResult bindResult = bindRequest.getResultResponse().getLdapResult();
        bindResult.setResultCode( ResultCodeEnum.PROTOCOL_ERROR );
        bindResult.setDiagnosticMessage( I18n.err( I18n.ERR_163 ) );
        ldapSession.getIoSession().write( bindRequest.getResultResponse() );
        return;
    }

    // Deal with the two kinds of authentication : Simple and SASL
    if ( bindRequest.isSimple() )
    {
        handleSimpleAuth( ldapSession, bindRequest );
    }
    else
    {
        handleSaslAuth( ldapSession, bindRequest );
    }
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:33,代码来源:BindRequestHandler.java


示例2: init

import org.apache.directory.server.i18n.I18n; //导入依赖的package包/类
public static IoFilterChainBuilder init( LdapServer server ) throws LdapException
{
    SSLContext sslCtx;
    try
    {
    	sslCtx = server.getSSLContext();
    	
    }
    catch ( Exception e )
    {
        throw new LdapException( I18n.err( I18n.ERR_683 ), e );
    }

    DefaultIoFilterChainBuilder chain = new DefaultIoFilterChainBuilder();
    SslFilter sslFilter = new SslFilter( sslCtx );

    List<String> cipherSuites = server.getEnabledCipherSuites();
    if( ( cipherSuites != null ) && !cipherSuites.isEmpty() )
    {
        sslFilter.setEnabledCipherSuites( cipherSuites.toArray( new String[cipherSuites.size()] ) );
    }
    
    sslFilter.setWantClientAuth( true );
    chain.addLast( "sslFilter", sslFilter );
    return chain;
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:27,代码来源:LdapsInitializer.java


示例3: 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;
    }
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:22,代码来源:DefaultPartitionNexus.java


示例4: getOriginalEntry

import org.apache.directory.server.i18n.I18n; //导入依赖的package包/类
private Entry getOriginalEntry( OperationContext opContext ) throws LdapException
{
    // 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();

    Entry foundEntry = adminSession.lookup( opContext.getDn(), SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES,
        SchemaConstants.ALL_USER_ATTRIBUTES );

    if ( foundEntry != null )
    {
        return 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;
    }
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:23,代码来源:DefaultOperationManager.java


示例5: 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() );
        }
    }
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:26,代码来源:ExceptionInterceptor.java


示例6: 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() );
        }
    }
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:25,代码来源:ExceptionInterceptor.java


示例7: 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 );
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:26,代码来源:ExceptionInterceptor.java


示例8: compare

import org.apache.directory.server.i18n.I18n; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public boolean compare( CompareOperationContext compareContext ) throws LdapException
{
    if ( IS_DEBUG )
    {
        LOG.debug( "Operation Context: {}", compareContext );
    }

    // Check that the requested AT exists
    // complain if we do not recognize the attribute being compared
    if ( !schemaManager.getAttributeTypeRegistry().contains( compareContext.getOid() ) )
    {
        throw new LdapInvalidAttributeTypeException( I18n.err( I18n.ERR_266, compareContext.getOid() ) );
    }

    boolean result = next( compareContext );

    return result;
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:22,代码来源:SchemaInterceptor.java


示例9: assertAllAttributesAllowed

import org.apache.directory.server.i18n.I18n; //导入依赖的package包/类
/**
 * Checks to see if an attribute is required by as determined from an entry's
 * set of objectClass attribute values.
 *
 * @return true if the objectClass values require the attribute, false otherwise
 * @throws Exception if the attribute is not recognized
 */
private void assertAllAttributesAllowed( Dn dn, Entry entry, Set<String> allowed ) throws LdapException
{
    // Never check the attributes if the extensibleObject objectClass is
    // declared for this entry
    Attribute objectClass = entry.get( OBJECT_CLASS_AT );

    if ( objectClass.contains( SchemaConstants.EXTENSIBLE_OBJECT_OC ) )
    {
        return;
    }

    for ( Attribute attribute : entry )
    {
        String attrOid = attribute.getAttributeType().getOid();

        AttributeType attributeType = attribute.getAttributeType();

        if ( !attributeType.isCollective() && ( attributeType.getUsage() == UsageEnum.USER_APPLICATIONS )
            && !allowed.contains( attrOid ) )
        {
            throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, I18n.err( I18n.ERR_277,
                attribute.getUpId(), dn.getName() ) );
        }
    }
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:33,代码来源:SchemaInterceptor.java


示例10: getPartition

import org.apache.directory.server.i18n.I18n; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public Partition getPartition( Dn dn ) throws LdapException
{
    Partition parent = null;

    if ( !dn.isSchemaAware() )
    {
        dn.apply( schemaManager );
    }

    synchronized ( partitionLookupTree )
    {
        parent = partitionLookupTree.getElement( dn );
    }

    if ( parent == null )
    {
        throw new LdapNoSuchObjectException( I18n.err( I18n.ERR_268, dn ) );
    }
    else
    {
        return parent;
    }
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:27,代码来源:DefaultPartitionNexus.java


示例11: checkMechanism

import org.apache.directory.server.i18n.I18n; //导入依赖的package包/类
/**
 * Check if the mechanism exists.
 */
private boolean checkMechanism( String saslMechanism ) throws Exception
{
    // Guard clause:  Reject unsupported SASL mechanisms.
    if ( !ldapServer.getSupportedMechanisms().contains( saslMechanism ) )
    {
        LOG.error( I18n.err( I18n.ERR_160, saslMechanism ) );

        return false;
    }
    else
    {
        return true;
    }
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:18,代码来源:BindRequestHandler.java


示例12: handleSaslAuthPending

import org.apache.directory.server.i18n.I18n; //导入依赖的package包/类
private void handleSaslAuthPending( LdapSession ldapSession, BindRequest bindRequest ) throws Exception
{
    // First, check that we have the same mechanism
    String saslMechanism = bindRequest.getSaslMechanism();

    // The empty mechanism is also a request for a new Bind session
    if ( Strings.isEmpty( saslMechanism )
        || !ldapSession.getSaslProperty( SaslConstants.SASL_MECH ).equals( saslMechanism ) )
    {
        sendAuthMethNotSupported( ldapSession, bindRequest );
        return;
    }

    // We have already received a first BindRequest, and sent back some challenge.
    // First, check if the mechanism is the same
    MechanismHandler mechanismHandler = handlers.get( saslMechanism );

    if ( mechanismHandler == null )
    {
        String message = I18n.err( I18n.ERR_161, saslMechanism );

        // Clear the saslProperties, and move to the anonymous state
        ldapSession.clearSaslProperties();
        ldapSession.setAnonymous();

        LOG.error( message );
        throw new IllegalArgumentException( message );
    }

    // Get the previously created SaslServer instance
    SaslServer ss = mechanismHandler.handleMechanism( ldapSession, bindRequest );

    generateSaslChallengeOrComplete( ldapSession, ss, bindRequest );
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:35,代码来源:BindRequestHandler.java


示例13: DefaultPartitionNexus

import org.apache.directory.server.i18n.I18n; //导入依赖的package包/类
/**
 * Creates the root nexus singleton of the entire system.  The root DSE has
 * several attributes that are injected into it besides those that may
 * already exist.  As partitions are added to the system more namingContexts
 * attributes are added to the rootDSE.
 *
 * @see <a href="http://www.faqs.org/rfcs/rfc3045.html">Vendor Information</a>
 * @param rootDse the root entry for the DSA
 * @throws javax.naming.Exception on failure to initialize
 */
public DefaultPartitionNexus( Entry rootDse ) throws Exception
{
    id = ID;
    suffixDn = null;

    // setup that root DSE
    this.rootDse = rootDse;

    // Add the basic informations
    rootDse.put( SchemaConstants.SUBSCHEMA_SUBENTRY_AT, ServerDNConstants.CN_SCHEMA_DN );
    rootDse.put( SchemaConstants.SUPPORTED_LDAP_VERSION_AT, "3" );
    rootDse.put( SchemaConstants.SUPPORTED_FEATURES_AT, SchemaConstants.FEATURE_ALL_OPERATIONAL_ATTRIBUTES );
    rootDse.put( SchemaConstants.SUPPORTED_EXTENSION_AT, NoticeOfDisconnect.EXTENSION_OID );

    // Add the objectClasses
    rootDse.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, SchemaConstants.EXTENSIBLE_OBJECT_OC );

    // Add the 'vendor' name and version infos
    rootDse.put( SchemaConstants.VENDOR_NAME_AT, ASF );

    Properties props = new Properties();

    try
    {
        props.load( getClass().getResourceAsStream( "version.properties" ) );
    }
    catch ( IOException e )
    {
        LOG.error( I18n.err( I18n.ERR_33 ) );
    }

    rootDse.put( SchemaConstants.VENDOR_VERSION_AT, props.getProperty( "apacheds.version", "UNKNOWN" ) );

    // The rootDSE uuid has been randomly created
    rootDse.put( SchemaConstants.ENTRY_UUID_AT, "f290425c-8272-4e62-8a67-92b06f38dbf5" );
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:47,代码来源:DefaultPartitionNexus.java


示例14: 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;
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:42,代码来源:ServerEntryUtils.java


示例15: 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;
        }
    }
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:38,代码来源:DefaultOperationManager.java


示例16: 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;
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:10,代码来源:DefaultOperationManager.java


示例17: 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 ) );
    }
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:8,代码来源:DefaultOperationManager.java


示例18: 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;
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:29,代码来源:SchemaInterceptor.java


示例19: 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();
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:14,代码来源:SchemaInterceptor.java


示例20: assertNumberOfAttributeValuesValid

import org.apache.directory.server.i18n.I18n; //导入依赖的package包/类
/**
 * Checks to see numbers of values of attributes conforms to the schema
 */
private void assertNumberOfAttributeValuesValid( Attribute attribute ) throws LdapInvalidAttributeValueException
{
    if ( attribute.size() > 1 && attribute.getAttributeType().isSingleValued() )
    {
        throw new LdapInvalidAttributeValueException( ResultCodeEnum.CONSTRAINT_VIOLATION, I18n.err( I18n.ERR_278,
            attribute.getUpId() ) );
    }
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:12,代码来源:SchemaInterceptor.java



注:本文中的org.apache.directory.server.i18n.I18n类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DynamoDBIgnore类代码示例发布时间:2022-05-22
下一篇:
Java JdpJmxPacket类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap