当前位置: 首页>>代码示例>>Java>>正文


Java ExtendedResponse类代码示例

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


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

示例1: getExtendedResponse

import javax.naming.ldap.ExtendedResponse; //导入依赖的package包/类
public ExtendedResponse getExtendedResponse() throws NamingException {

        if (result != null && result.getResultCode() == 0
                && responseValues != null) {
            String id = null;
            if (responseValues[4] != null) {
                id = Utils.getString((byte[]) responseValues[4]);
            }
            byte[] value = (byte[]) responseValues[5];
            int length = 0;
            if (value != null) {
                length = value.length;
            }

            response = request.createExtendedResponse(id, value, 0, length);

        }
        return response;
    }
 
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:ExtendedOp.java

示例2: extendedOperation

import javax.naming.ldap.ExtendedResponse; //导入依赖的package包/类
public ExtendedResponse extendedOperation(ExtendedRequest request)
        throws NamingException {
    ExtendedOp op = new ExtendedOp(request);
    try {
        doBasicOperation(op);
    } catch (ReferralException e) {
        if (isFollowReferral(e)) {
            LdapContext referralContext = (LdapContext) getReferralContext(e);
            return referralContext.extendedOperation(request);
        }
        throw e;
    }
    ExtendedResponse response = op.getExtendedResponse();
    // set existing underlying socket to startTls extended response
    if (response instanceof StartTlsResponseImpl) {
        ((StartTlsResponseImpl) response).setSocket(client.getSocket());
    }
    return response;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:LdapContextImpl.java

示例3: test_getExtendedResponse

import javax.naming.ldap.ExtendedResponse; //导入依赖的package包/类
public void test_getExtendedResponse() throws Exception {
    MockExtendedRequest mockRequest = new MockExtendedRequest();
    ExtendedOp op = new ExtendedOp(mockRequest);

    assertSame(mockRequest, op.getExtendedRequest());
    assertNull(op.getExtendedResponse());

    Object[] values = new Object[] { ASN1Integer.fromIntValue(0),
            Utils.getBytes(""), Utils.getBytes(""), null,
            Utils.getBytes("hello"), Utils.getBytes("world") };

    op.decodeValues(values);

    LdapResult result = op.getResult();
    assertNotNull(result);
    assertEquals(0, result.getResultCode());
    assertEquals("", result.getMachedDN());
    assertEquals("", result.getErrorMessage());
    assertNull(result.getReferrals());

    ExtendedResponse response = op.getExtendedResponse();
    assertTrue(response instanceof MockExtendedResponse);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:24,代码来源:ExtendedOpTest.java

示例4: extendedOperation

import javax.naming.ldap.ExtendedResponse; //导入依赖的package包/类
public final ExtendedResponse extendedOperation( final ExtendedRequest request )
{
    if ( request == null )
    {
        throw new NullPointerException( "request must not be null" );
    }

    return null;
}
 
开发者ID:ldapchai,项目名称:ldapchai,代码行数:10,代码来源:AbstractProvider.java

示例5: extendedOperation

import javax.naming.ldap.ExtendedResponse; //导入依赖的package包/类
@LdapOperation
@ModifyOperation
public final ExtendedResponse extendedOperation( final ExtendedRequest request )
        throws ChaiUnavailableException, ChaiOperationException

{
    activityPreCheck();

    getInputValidator().extendedOperation( request );

    preCheckExtendedOperation( request );

    final LdapContext ldapConnection = getLdapConnection();
    try
    {
        return ldapConnection.extendedOperation( request );
    }
    catch ( NamingException e )
    {
        cacheExtendedOperationException( request, e );

        // guaranteedb to throw ChaiException
        convertNamingException( e );
    }

    return null;
}
 
开发者ID:ldapchai,项目名称:ldapchai,代码行数:28,代码来源:JNDIProviderImpl.java

示例6: testPasswordPolicy

import javax.naming.ldap.ExtendedResponse; //导入依赖的package包/类
public boolean testPasswordPolicy( final String password )
        throws ChaiUnavailableException, ChaiPasswordPolicyException
{
    final boolean useNmasSetting = this.getChaiProvider().getChaiConfiguration().getBooleanSetting( ChaiSetting.EDIRECTORY_ENABLE_NMAS );
    if ( !useNmasSetting )
    {
        return true;
    }

    final PwdPolicyCheckRequest request = new PwdPolicyCheckRequest();
    request.setData( password );
    request.setObjectDN( this.getEntryDN() );
    final ExtendedResponse response;
    try
    {
        response = getChaiProvider().extendedOperation( request );
    }
    catch ( ChaiOperationException e )
    {
        LOGGER.debug( "unexpected error while checking [nmas] password policy: " + e.getMessage() );
        return true;
    }
    if ( response != null )
    {
        final PwdPolicyCheckResponse setResponse = ( PwdPolicyCheckResponse ) response;
        final int responseCode = setResponse.getNmasRetCode();
        if ( responseCode != 0 )
        {
            LOGGER.debug( "nmas response code returned from server while testing nmas password: " + responseCode );
            final String errorString = "nmas error " + responseCode;
            throw new ChaiPasswordPolicyException( errorString, ChaiErrors.getErrorForMessage( errorString ) );
        }
    }
    return true;
}
 
开发者ID:ldapchai,项目名称:ldapchai,代码行数:36,代码来源:InetOrgPersonImpl.java

示例7: readPassword

import javax.naming.ldap.ExtendedResponse; //导入依赖的package包/类
public final String readPassword()
        throws ChaiUnavailableException, ChaiOperationException
{
    final boolean useNmasSetting = this.getChaiProvider().getChaiConfiguration().getBooleanSetting( ChaiSetting.EDIRECTORY_ENABLE_NMAS );
    if ( !useNmasSetting )
    {
        throw new UnsupportedOperationException( "readPassword() is not supported when ChaiSetting.EDIRECTORY_ENABLE_NMAS is false" );
    }

    final GetPwdRequest request = new GetPwdRequest( "", this.getEntryDN() );
    final ExtendedResponse response;
    response = getChaiProvider().extendedOperation( request );
    if ( response != null )
    {
        final GetPwdResponse getResponse = ( GetPwdResponse ) response;
        final int responseCode = getResponse.getNmasRetCode();
        switch ( responseCode )
        {
            // Success
            case 0:
                return getResponse.getPwdStr();

            // NMAS_E_ENTRY_ATTRIBUTE_NOT_FOUND
            case ( -16049 ):
                LOGGER.debug( "readPassword() reports: NMAS_E_ENTRY_ATTRIBUTE_NOT_FOUND " + responseCode );
                throw new ChaiOperationException( "object has no password attribute: error " + responseCode, ChaiError.NO_SUCH_ATTRIBUTE );

            default:
                LOGGER.debug( "error testing nmas password: " + responseCode );
                throw new ChaiOperationException( "error reading nmas password: error " + responseCode, ChaiError.UNKNOWN );
        }
    }

    LOGGER.debug( "unknown error retreiving password (null response)" );
    throw new ChaiOperationException( "unknown error retreiving password (null response)", ChaiError.UNKNOWN );
}
 
开发者ID:ldapchai,项目名称:ldapchai,代码行数:37,代码来源:InetOrgPersonImpl.java

示例8: extendedOperation

import javax.naming.ldap.ExtendedResponse; //导入依赖的package包/类
/**
 * <p>This method is performs an extended operation.</p>
 * @param arg0 The extended request for the operation.
 * @return ExtendedResponse The extended response of this operation.
 */
public ExtendedResponse extendedOperation(ExtendedRequest arg0)	throws NamingException , NullPointerException{

	if(arg0==null) throw new NullPointerException();
	if(arg0.getID()=="1.3.6.1.4.1.1466.20037") return new MockStartTlsResponse();
	return null;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:12,代码来源:MockInitialLdapContext.java

示例9: createExtendedResponse

import javax.naming.ldap.ExtendedResponse; //导入依赖的package包/类
public ExtendedResponse createExtendedResponse(String s, byte[] value,
        int offset, int length) throws NamingException {
    if (s.equalsIgnoreCase("exception")) {
        throw new NamingException("exception");
    }
    return new MockExtendedResponse(s, value);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:LdapContextServerMockedTest.java

示例10: extendedOperation

import javax.naming.ldap.ExtendedResponse; //导入依赖的package包/类
/**
 * @see javax.naming.ldap.LdapContext#extendedOperation(javax.naming.ldap.ExtendedRequest)
 */
@Override
public ExtendedResponse extendedOperation(final ExtendedRequest request) throws NamingException {
    return (ExtendedResponse) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(), getLogger()){

        @Override
        public Object operation() throws NamingException {
            return ((LdapContext) getDelegate()).extendedOperation(request);
        }}.perform();
}
 
开发者ID:twachan,项目名称:James,代码行数:13,代码来源:RetryingLdapContext.java

示例11: callStoredProcedure

import javax.naming.ldap.ExtendedResponse; //导入依赖的package包/类
/**
 * Invoke a Stored Procedure
 * 
 * @param ctx The execution context
 * @param procedureName The procedure to execute
 * @param arguments The procedure's arguments
 * @return The execution resut
 * @throws NamingException If we have had an error whil executing the stored procedure
 */
public static Object callStoredProcedure( LdapContext ctx, String procedureName, Object[] arguments )
    throws NamingException
{
    String language = "Java";

    Object responseObject;
    try
    {
        /**
         * Create a new stored procedure execution request.
         */
        StoredProcedureRequestImpl req = new StoredProcedureRequestImpl( 0, procedureName, language );

        /**
         * For each argument UTF-8-encode the type name
         * and Java-serialize the value
         * and add them to the request as a parameter object.
         */
        for ( int i = 0; i < arguments.length; i++ )
        {
            byte[] type;
            byte[] value;
            type = arguments[i].getClass().getName().getBytes( "UTF-8" );
            value = SerializationUtils.serialize( ( Serializable ) arguments[i] );
            req.addParameter( type, value );
        }

        /**
         * Call the stored procedure via the extended operation
         * and get back its return value.
         */
        ExtendedRequest jndiReq = LdapApiServiceFactory.getSingleton().toJndi( req );
        ExtendedResponse resp = ctx.extendedOperation( jndiReq );

        /**
         * Restore a Java object from the return value.
         */
        byte[] responseStream = resp.getEncodedValue();
        responseObject = SerializationUtils.deserialize( responseStream );
    }
    catch ( Exception e )
    {
        NamingException ne = new NamingException();
        ne.setRootCause( e );
        throw ne;
    }

    return responseObject;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:59,代码来源:JavaStoredProcUtils.java

示例12: extendedOperation

import javax.naming.ldap.ExtendedResponse; //导入依赖的package包/类
@Override
public ExtendedResponse extendedOperation( final ExtendedRequest request )
        throws ChaiOperationException, ChaiUnavailableException, IllegalStateException
{
    return providerHolder.getProvider().extendedOperation( request );
}
 
开发者ID:ldapchai,项目名称:ldapchai,代码行数:7,代码来源:WatchdogWrapper.java

示例13: extendedOperation

import javax.naming.ldap.ExtendedResponse; //导入依赖的package包/类
public ExtendedResponse extendedOperation(ExtendedRequest request)
		throws NamingException {
	return initCtx.extendedOperation(request);
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:5,代码来源:LDAPConnectionImpl.java

示例14: extendedOperation

import javax.naming.ldap.ExtendedResponse; //导入依赖的package包/类
public ExtendedResponse extendedOperation(ExtendedRequest e)
		throws NamingException {
	InvokeRecord.set((String) this.props.get("url.schema"), e);
	takeActions();
	return null;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:7,代码来源:MockLdapContext.java

示例15: extendedOperation

import javax.naming.ldap.ExtendedResponse; //导入依赖的package包/类
public ExtendedResponse extendedOperation(ExtendedRequest e)
		throws NamingException {
	return null;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:5,代码来源:DirectoryManagerJCKTest.java


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