Java 类javax.naming.ldap.ExtendedRequest 实例源码

项目:ldapchai    文件:AbstractProvider.java   
protected void preCheckExtendedOperation( final ExtendedRequest request )
        throws ChaiOperationException
{
    final boolean cacheFailures = "true".equalsIgnoreCase( this.getChaiConfiguration().getSetting( ChaiSetting.EXTENDED_OPERATION_FAILURE_CACHE ) );
    if ( cacheFailures )
    {
        final Map<String, Object> providerProps = this.getProviderProperties();
        final Map<String, Exception> cacheFailureMap = ( Map<String, Exception> ) providerProps.get( EXTENDED_FAILURE_CACHE_KEY );
        final String requestID = request.getID();
        if ( cacheFailureMap.containsKey( requestID ) )
        {
            LOGGER.debug( "previous extended operation request for " + requestID + " has failed, reissuing cached exception without attempting operation" );
            throw ( ChaiOperationException ) cacheFailureMap.get( requestID );
        }
    }
}
项目:ldapchai    文件:AbstractProvider.java   
protected void cacheExtendedOperationException( final ExtendedRequest request, final Exception e )
        throws ChaiOperationException
{
    final boolean cacheFailures = this.getChaiConfiguration().getBooleanSetting( ChaiSetting.EXTENDED_OPERATION_FAILURE_CACHE );
    if ( cacheFailures )
    {
        final ChaiOperationException opExcep = ChaiOperationException.forErrorMessage( e.getMessage() );
        if ( opExcep.getErrorCode() == ChaiError.UNSUPPORTED_OPERATION )
        {
            final Map<String, Object> providerProps = this.getProviderProperties();
            final Map<String, Exception> cacheFailureMap = ( Map<String, Exception> ) providerProps.get( EXTENDED_FAILURE_CACHE_KEY );
            final String requestID = request.getID();
            cacheFailureMap.put( requestID, opExcep );
            LOGGER.trace( "caching extended operation for " + requestID );
            throw opExcep;
        }
    }
}
项目:cn1    文件:LdapContextImpl.java   
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;
}
项目:nextop-client    文件:LdapContextImpl.java   
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;
}
项目:freeVM    文件:LdapContextImpl.java   
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;
}
项目:ldapchai    文件:AbstractProvider.java   
public final ExtendedResponse extendedOperation( final ExtendedRequest request )
{
    if ( request == null )
    {
        throw new NullPointerException( "request must not be null" );
    }

    return null;
}
项目:ldapchai    文件:JNDIProviderImpl.java   
@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;
}
项目:cn1    文件:MockInitialLdapContext.java   
/**
 * <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;
}
项目:cn1    文件:ExtendedOpTest.java   
public void test_encodeValues_$LObject() {
    ExtendedOp op = new ExtendedOp(new MockExtendedRequest());

    ASN1TestUtils.checkEncode(op, LdapASN1Constant.ExtendedRequest);

    assertEquals(LdapASN1Constant.OP_EXTENDED_REQUEST, op.getRequestId());
    assertEquals(LdapASN1Constant.OP_EXTENDED_RESPONSE, op.getResponseId());
    assertSame(op, op.getRequest());
    assertSame(op, op.getResponse());
}
项目:freeVM    文件:MockInitialLdapContext.java   
/**
 * <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;
}
项目:freeVM    文件:MockInitialLdapContext.java   
/**
 * <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;
}
项目:freeVM    文件:ExtendedOpTest.java   
public void test_encodeValues_$LObject() {
    ExtendedOp op = new ExtendedOp(new MockExtendedRequest());

    ASN1TestUtils.checkEncode(op, LdapASN1Constant.ExtendedRequest);

    assertEquals(LdapASN1Constant.OP_EXTENDED_REQUEST, op.getRequestId());
    assertEquals(LdapASN1Constant.OP_EXTENDED_RESPONSE, op.getResponseId());
    assertSame(op, op.getRequest());
    assertSame(op, op.getResponse());
}
项目:James    文件:RetryingLdapContext.java   
/**
 * @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();
}
项目:directory-ldap-api    文件:JavaStoredProcUtils.java   
/**
 * 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;
}
项目:ldapchai    文件:ApacheLdapProviderImpl.java   
@Override
protected void preCheckExtendedOperation( final ExtendedRequest request )
        throws ChaiOperationException
{
    super.preCheckExtendedOperation( request );
}
项目:ldapchai    文件:ApacheLdapProviderImpl.java   
@Override
protected void cacheExtendedOperationException( final ExtendedRequest request, final Exception e )
        throws ChaiOperationException
{
    super.cacheExtendedOperationException( request, e );
}
项目:ldapchai    文件:WatchdogWrapper.java   
@Override
public ExtendedResponse extendedOperation( final ExtendedRequest request )
        throws ChaiOperationException, ChaiUnavailableException, IllegalStateException
{
    return providerHolder.getProvider().extendedOperation( request );
}
项目:teiid    文件:LDAPConnectionImpl.java   
public ExtendedResponse extendedOperation(ExtendedRequest request)
        throws NamingException {
    return initCtx.extendedOperation(request);
}
项目:cn1    文件:ExtendedOp.java   
public ExtendedOp(ExtendedRequest request) {
    this.request = request;
}
项目:cn1    文件:ExtendedOp.java   
public ExtendedRequest getExtendedRequest() {
    return request;
}
项目:cn1    文件:MockLdapContext.java   
public ExtendedResponse extendedOperation(ExtendedRequest e)
        throws NamingException {
    InvokeRecord.set((String) this.props.get("url.schema"), e);
    takeActions();
    return null;
}
项目:cn1    文件:DirectoryManagerJCKTest.java   
public ExtendedResponse extendedOperation(ExtendedRequest e)
        throws NamingException {
    return null;
}
项目:nextop-client    文件:ExtendedOp.java   
public ExtendedOp(ExtendedRequest request) {
    this.request = request;
}
项目:nextop-client    文件:ExtendedOp.java   
public ExtendedRequest getExtendedRequest() {
    return request;
}
项目:freeVM    文件:MockLdapContext.java   
public ExtendedResponse extendedOperation(ExtendedRequest e)
        throws NamingException {
    InvokeRecord.set((String) this.props.get("url.schema"), e);
    takeActions();
    return null;
}
项目:freeVM    文件:DirectoryManagerJCKTest.java   
public ExtendedResponse extendedOperation(ExtendedRequest e)
        throws NamingException {
    return null;
}
项目:freeVM    文件:ExtendedOp.java   
public ExtendedOp(ExtendedRequest request) {
    this.request = request;
}
项目:freeVM    文件:ExtendedOp.java   
public ExtendedRequest getExtendedRequest() {
    return request;
}
项目:freeVM    文件:MockLdapContext.java   
public ExtendedResponse extendedOperation(ExtendedRequest e)
        throws NamingException {
    InvokeRecord.set((String) this.props.get("url.schema"), e);
    takeActions();
    return null;
}
项目:freeVM    文件:DirectoryManagerJCKTest.java   
public ExtendedResponse extendedOperation(ExtendedRequest e)
        throws NamingException {
    return null;
}
项目:spring-ldap    文件:DelegatingLdapContext.java   
/**
 * @see javax.naming.ldap.LdapContext#extendedOperation(javax.naming.ldap.ExtendedRequest)
 */
public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException {
    this.assertOpen();
    return this.getDelegateLdapContext().extendedOperation(request);
}
项目:spring-ldap    文件:DelegatingLdapContext.java   
/**
 * @see LdapContext#extendedOperation(ExtendedRequest)
 */
public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException {
    this.assertOpen();
    return this.getDelegateLdapContext().extendedOperation(request);
}
项目:ldapchai    文件:ChaiProvider.java   
/**
 * Performs an extended operation against the server.  The extended operation must be understood by the server.
 *
 * @param request An ExtendedRequest bean that can be
 * @return An ExtendedResponse created in response to the request.
 * @throws ChaiOperationException   If an error is encountered during the operation
 * @throws ChaiUnavailableException If no directory servers are reachable
 * @throws IllegalStateException    If the underlying connection is not in an available state
 * @see ExtendedRequest
 * @see ExtendedResponse
 */
@ChaiProvider.LdapOperation
@ChaiProvider.ModifyOperation
ExtendedResponse extendedOperation( ExtendedRequest request )
        throws ChaiOperationException, ChaiUnavailableException, IllegalStateException;