org.omg.PortableInterceptor.Interceptor Java Examples

The following examples show how to use org.omg.PortableInterceptor.Interceptor. 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: PIHandlerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called by ORBInitInfo when an interceptor needs to be registered.
 * The type is one of:
 * <ul>
 *   <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
 * </ul>
 *
 * @exception DuplicateName Thrown if an interceptor of the given
 *     name already exists for the given type.
 */
public void register_interceptor( Interceptor interceptor, int type )
    throws DuplicateName
{
    // We will assume interceptor is not null, since it is called
    // internally.
    if( (type >= InterceptorList.NUM_INTERCEPTOR_TYPES) || (type < 0) ) {
        throw wrapper.typeOutOfRange( new Integer( type ) ) ;
    }

    String interceptorName = interceptor.name();

    if( interceptorName == null ) {
        throw wrapper.nameNull() ;
    }

    // Register with interceptor list:
    interceptorList.register_interceptor( interceptor, type );
}
 
Example #2
Source File: PIHandlerImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Called by ORBInitInfo when an interceptor needs to be registered.
 * The type is one of:
 * <ul>
 *   <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
 * </ul>
 *
 * @exception DuplicateName Thrown if an interceptor of the given
 *     name already exists for the given type.
 */
public void register_interceptor( Interceptor interceptor, int type )
    throws DuplicateName
{
    // We will assume interceptor is not null, since it is called
    // internally.
    if( (type >= InterceptorList.NUM_INTERCEPTOR_TYPES) || (type < 0) ) {
        throw wrapper.typeOutOfRange( new Integer( type ) ) ;
    }

    String interceptorName = interceptor.name();

    if( interceptorName == null ) {
        throw wrapper.nameNull() ;
    }

    // Register with interceptor list:
    interceptorList.register_interceptor( interceptor, type );
}
 
Example #3
Source File: PIHandlerImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called by ORBInitInfo when an interceptor needs to be registered.
 * The type is one of:
 * <ul>
 *   <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
 * </ul>
 *
 * @exception DuplicateName Thrown if an interceptor of the given
 *     name already exists for the given type.
 */
public void register_interceptor( Interceptor interceptor, int type )
    throws DuplicateName
{
    // We will assume interceptor is not null, since it is called
    // internally.
    if( (type >= InterceptorList.NUM_INTERCEPTOR_TYPES) || (type < 0) ) {
        throw wrapper.typeOutOfRange( new Integer( type ) ) ;
    }

    String interceptorName = interceptor.name();

    if( interceptorName == null ) {
        throw wrapper.nameNull() ;
    }

    // Register with interceptor list:
    interceptorList.register_interceptor( interceptor, type );
}
 
Example #4
Source File: PIHandlerImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called by ORBInitInfo when an interceptor needs to be registered.
 * The type is one of:
 * <ul>
 *   <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
 * </ul>
 *
 * @exception DuplicateName Thrown if an interceptor of the given
 *     name already exists for the given type.
 */
public void register_interceptor( Interceptor interceptor, int type )
    throws DuplicateName
{
    // We will assume interceptor is not null, since it is called
    // internally.
    if( (type >= InterceptorList.NUM_INTERCEPTOR_TYPES) || (type < 0) ) {
        throw wrapper.typeOutOfRange( new Integer( type ) ) ;
    }

    String interceptorName = interceptor.name();

    if( interceptorName == null ) {
        throw wrapper.nameNull() ;
    }

    // Register with interceptor list:
    interceptorList.register_interceptor( interceptor, type );
}
 
Example #5
Source File: PIHandlerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called by ORBInitInfo when an interceptor needs to be registered.
 * The type is one of:
 * <ul>
 *   <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
 * </ul>
 *
 * @exception DuplicateName Thrown if an interceptor of the given
 *     name already exists for the given type.
 */
public void register_interceptor( Interceptor interceptor, int type )
    throws DuplicateName
{
    // We will assume interceptor is not null, since it is called
    // internally.
    if( (type >= InterceptorList.NUM_INTERCEPTOR_TYPES) || (type < 0) ) {
        throw wrapper.typeOutOfRange( new Integer( type ) ) ;
    }

    String interceptorName = interceptor.name();

    if( interceptorName == null ) {
        throw wrapper.nameNull() ;
    }

    // Register with interceptor list:
    interceptorList.register_interceptor( interceptor, type );
}
 
Example #6
Source File: PIHandlerImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called by ORBInitInfo when an interceptor needs to be registered.
 * The type is one of:
 * <ul>
 *   <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
 * </ul>
 *
 * @exception DuplicateName Thrown if an interceptor of the given
 *     name already exists for the given type.
 */
public void register_interceptor( Interceptor interceptor, int type )
    throws DuplicateName
{
    // We will assume interceptor is not null, since it is called
    // internally.
    if( (type >= InterceptorList.NUM_INTERCEPTOR_TYPES) || (type < 0) ) {
        throw wrapper.typeOutOfRange( new Integer( type ) ) ;
    }

    String interceptorName = interceptor.name();

    if( interceptorName == null ) {
        throw wrapper.nameNull() ;
    }

    // Register with interceptor list:
    interceptorList.register_interceptor( interceptor, type );
}
 
Example #7
Source File: PIHandlerImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called by ORBInitInfo when an interceptor needs to be registered.
 * The type is one of:
 * <ul>
 *   <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
 * </ul>
 *
 * @exception DuplicateName Thrown if an interceptor of the given
 *     name already exists for the given type.
 */
public void register_interceptor( Interceptor interceptor, int type )
    throws DuplicateName
{
    // We will assume interceptor is not null, since it is called
    // internally.
    if( (type >= InterceptorList.NUM_INTERCEPTOR_TYPES) || (type < 0) ) {
        throw wrapper.typeOutOfRange( new Integer( type ) ) ;
    }

    String interceptorName = interceptor.name();

    if( interceptorName == null ) {
        throw wrapper.nameNull() ;
    }

    // Register with interceptor list:
    interceptorList.register_interceptor( interceptor, type );
}
 
Example #8
Source File: PIHandlerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called by ORBInitInfo when an interceptor needs to be registered.
 * The type is one of:
 * <ul>
 *   <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
 * </ul>
 *
 * @exception DuplicateName Thrown if an interceptor of the given
 *     name already exists for the given type.
 */
public void register_interceptor( Interceptor interceptor, int type )
    throws DuplicateName
{
    // We will assume interceptor is not null, since it is called
    // internally.
    if( (type >= InterceptorList.NUM_INTERCEPTOR_TYPES) || (type < 0) ) {
        throw wrapper.typeOutOfRange( new Integer( type ) ) ;
    }

    String interceptorName = interceptor.name();

    if( interceptorName == null ) {
        throw wrapper.nameNull() ;
    }

    // Register with interceptor list:
    interceptorList.register_interceptor( interceptor, type );
}
 
Example #9
Source File: PIHandlerImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called by ORBInitInfo when an interceptor needs to be registered.
 * The type is one of:
 * <ul>
 *   <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
 * </ul>
 *
 * @exception DuplicateName Thrown if an interceptor of the given
 *     name already exists for the given type.
 */
public void register_interceptor( Interceptor interceptor, int type )
    throws DuplicateName
{
    // We will assume interceptor is not null, since it is called
    // internally.
    if( (type >= InterceptorList.NUM_INTERCEPTOR_TYPES) || (type < 0) ) {
        throw wrapper.typeOutOfRange( new Integer( type ) ) ;
    }

    String interceptorName = interceptor.name();

    if( interceptorName == null ) {
        throw wrapper.nameNull() ;
    }

    // Register with interceptor list:
    interceptorList.register_interceptor( interceptor, type );
}
 
Example #10
Source File: PIHandlerImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Called by ORBInitInfo when an interceptor needs to be registered.
 * The type is one of:
 * <ul>
 *   <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
 * </ul>
 *
 * @exception DuplicateName Thrown if an interceptor of the given
 *     name already exists for the given type.
 */
public void register_interceptor( Interceptor interceptor, int type )
    throws DuplicateName
{
    // We will assume interceptor is not null, since it is called
    // internally.
    if( (type >= InterceptorList.NUM_INTERCEPTOR_TYPES) || (type < 0) ) {
        throw wrapper.typeOutOfRange( new Integer( type ) ) ;
    }

    String interceptorName = interceptor.name();

    if( interceptorName == null ) {
        throw wrapper.nameNull() ;
    }

    // Register with interceptor list:
    interceptorList.register_interceptor( interceptor, type );
}
 
Example #11
Source File: InterceptorList.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes all interceptors arrays to zero-length arrays of the
 * correct type, based on the classTypes list.
 */
private void initInterceptorArrays() {
    for( int type = 0; type < NUM_INTERCEPTOR_TYPES; type++ ) {
        Class classType = classTypes[type];

        // Create a zero-length array for each type:
        interceptors[type] =
            (Interceptor[])Array.newInstance( classType, 0 );
    }
}
 
Example #12
Source File: InterceptorList.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Grows the given interceptor array by one:
 */
private void growInterceptorArray( int type ) {
    Class classType = classTypes[type];
    int currentLength = interceptors[type].length;
    Interceptor[] replacementArray;

    // Create new array to replace the old one.  The new array will be
    // one element larger but have the same type as the old one.
    replacementArray = (Interceptor[])
        Array.newInstance( classType, currentLength + 1 );
    System.arraycopy( interceptors[type], 0,
                      replacementArray, 0, currentLength );
    interceptors[type] = replacementArray;
}
 
Example #13
Source File: InterceptorList.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Grows the given interceptor array by one:
 */
private void growInterceptorArray( int type ) {
    Class classType = classTypes[type];
    int currentLength = interceptors[type].length;
    Interceptor[] replacementArray;

    // Create new array to replace the old one.  The new array will be
    // one element larger but have the same type as the old one.
    replacementArray = (Interceptor[])
        Array.newInstance( classType, currentLength + 1 );
    System.arraycopy( interceptors[type], 0,
                      replacementArray, 0, currentLength );
    interceptors[type] = replacementArray;
}
 
Example #14
Source File: InterceptorList.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes all interceptors arrays to zero-length arrays of the
 * correct type, based on the classTypes list.
 */
private void initInterceptorArrays() {
    for( int type = 0; type < NUM_INTERCEPTOR_TYPES; type++ ) {
        Class classType = classTypes[type];

        // Create a zero-length array for each type:
        interceptors[type] =
            (Interceptor[])Array.newInstance( classType, 0 );
    }
}
 
Example #15
Source File: InterceptorList.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Registers an interceptor of the given type into the interceptor list.
 * The type is one of:
 * <ul>
 *   <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
 * </ul>
 *
 * @exception DuplicateName Thrown if an interceptor of the given
 *     name already exists for the given type.
 */
void register_interceptor( Interceptor interceptor, int type )
    throws DuplicateName
{
    // If locked, deny any further addition of interceptors.
    if( locked ) {
        throw wrapper.interceptorListLocked() ;
    }

    // Cache interceptor name:
    String interceptorName = interceptor.name();
    boolean anonymous = interceptorName.equals( "" );
    boolean foundDuplicate = false;
    Interceptor[] interceptorList = interceptors[type];

    // If this is not an anonymous interceptor,
    // search for an interceptor of the same name in this category:
    if( !anonymous ) {
        int size = interceptorList.length;

        // An O(n) search will suffice because register_interceptor is not
        // likely to be called often.
        for( int i = 0; i < size; i++ ) {
            Interceptor in = (Interceptor)interceptorList[i];
            if( in.name().equals( interceptorName ) ) {
                foundDuplicate = true;
                break;
            }
        }
    }

    if( !foundDuplicate ) {
        growInterceptorArray( type );
        interceptors[type][interceptors[type].length-1] = interceptor;
    }
    else {
        throw new DuplicateName( interceptorName );
    }
}
 
Example #16
Source File: InterceptorList.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes all interceptors arrays to zero-length arrays of the
 * correct type, based on the classTypes list.
 */
private void initInterceptorArrays() {
    for( int type = 0; type < NUM_INTERCEPTOR_TYPES; type++ ) {
        Class classType = classTypes[type];

        // Create a zero-length array for each type:
        interceptors[type] =
            (Interceptor[])Array.newInstance( classType, 0 );
    }
}
 
Example #17
Source File: InterceptorList.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Grows the given interceptor array by one:
 */
private void growInterceptorArray( int type ) {
    Class classType = classTypes[type];
    int currentLength = interceptors[type].length;
    Interceptor[] replacementArray;

    // Create new array to replace the old one.  The new array will be
    // one element larger but have the same type as the old one.
    replacementArray = (Interceptor[])
        Array.newInstance( classType, currentLength + 1 );
    System.arraycopy( interceptors[type], 0,
                      replacementArray, 0, currentLength );
    interceptors[type] = replacementArray;
}
 
Example #18
Source File: InterceptorList.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Initializes all interceptors arrays to zero-length arrays of the
 * correct type, based on the classTypes list.
 */
private void initInterceptorArrays() {
    for( int type = 0; type < NUM_INTERCEPTOR_TYPES; type++ ) {
        Class classType = classTypes[type];

        // Create a zero-length array for each type:
        interceptors[type] =
            (Interceptor[])Array.newInstance( classType, 0 );
    }
}
 
Example #19
Source File: InterceptorList.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Registers an interceptor of the given type into the interceptor list.
 * The type is one of:
 * <ul>
 *   <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
 * </ul>
 *
 * @exception DuplicateName Thrown if an interceptor of the given
 *     name already exists for the given type.
 */
void register_interceptor( Interceptor interceptor, int type )
    throws DuplicateName
{
    // If locked, deny any further addition of interceptors.
    if( locked ) {
        throw wrapper.interceptorListLocked() ;
    }

    // Cache interceptor name:
    String interceptorName = interceptor.name();
    boolean anonymous = interceptorName.equals( "" );
    boolean foundDuplicate = false;
    Interceptor[] interceptorList = interceptors[type];

    // If this is not an anonymous interceptor,
    // search for an interceptor of the same name in this category:
    if( !anonymous ) {
        int size = interceptorList.length;

        // An O(n) search will suffice because register_interceptor is not
        // likely to be called often.
        for( int i = 0; i < size; i++ ) {
            Interceptor in = (Interceptor)interceptorList[i];
            if( in.name().equals( interceptorName ) ) {
                foundDuplicate = true;
                break;
            }
        }
    }

    if( !foundDuplicate ) {
        growInterceptorArray( type );
        interceptors[type][interceptors[type].length-1] = interceptor;
    }
    else {
        throw new DuplicateName( interceptorName );
    }
}
 
Example #20
Source File: InterceptorList.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Registers an interceptor of the given type into the interceptor list.
 * The type is one of:
 * <ul>
 *   <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
 * </ul>
 *
 * @exception DuplicateName Thrown if an interceptor of the given
 *     name already exists for the given type.
 */
void register_interceptor( Interceptor interceptor, int type )
    throws DuplicateName
{
    // If locked, deny any further addition of interceptors.
    if( locked ) {
        throw wrapper.interceptorListLocked() ;
    }

    // Cache interceptor name:
    String interceptorName = interceptor.name();
    boolean anonymous = interceptorName.equals( "" );
    boolean foundDuplicate = false;
    Interceptor[] interceptorList = interceptors[type];

    // If this is not an anonymous interceptor,
    // search for an interceptor of the same name in this category:
    if( !anonymous ) {
        int size = interceptorList.length;

        // An O(n) search will suffice because register_interceptor is not
        // likely to be called often.
        for( int i = 0; i < size; i++ ) {
            Interceptor in = (Interceptor)interceptorList[i];
            if( in.name().equals( interceptorName ) ) {
                foundDuplicate = true;
                break;
            }
        }
    }

    if( !foundDuplicate ) {
        growInterceptorArray( type );
        interceptors[type][interceptors[type].length-1] = interceptor;
    }
    else {
        throw new DuplicateName( interceptorName );
    }
}
 
Example #21
Source File: InterceptorList.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Grows the given interceptor array by one:
 */
private void growInterceptorArray( int type ) {
    Class classType = classTypes[type];
    int currentLength = interceptors[type].length;
    Interceptor[] replacementArray;

    // Create new array to replace the old one.  The new array will be
    // one element larger but have the same type as the old one.
    replacementArray = (Interceptor[])
        Array.newInstance( classType, currentLength + 1 );
    System.arraycopy( interceptors[type], 0,
                      replacementArray, 0, currentLength );
    interceptors[type] = replacementArray;
}
 
Example #22
Source File: InterceptorList.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Registers an interceptor of the given type into the interceptor list.
 * The type is one of:
 * <ul>
 *   <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
 * </ul>
 *
 * @exception DuplicateName Thrown if an interceptor of the given
 *     name already exists for the given type.
 */
void register_interceptor( Interceptor interceptor, int type )
    throws DuplicateName
{
    // If locked, deny any further addition of interceptors.
    if( locked ) {
        throw wrapper.interceptorListLocked() ;
    }

    // Cache interceptor name:
    String interceptorName = interceptor.name();
    boolean anonymous = interceptorName.equals( "" );
    boolean foundDuplicate = false;
    Interceptor[] interceptorList = interceptors[type];

    // If this is not an anonymous interceptor,
    // search for an interceptor of the same name in this category:
    if( !anonymous ) {
        int size = interceptorList.length;

        // An O(n) search will suffice because register_interceptor is not
        // likely to be called often.
        for( int i = 0; i < size; i++ ) {
            Interceptor in = (Interceptor)interceptorList[i];
            if( in.name().equals( interceptorName ) ) {
                foundDuplicate = true;
                break;
            }
        }
    }

    if( !foundDuplicate ) {
        growInterceptorArray( type );
        interceptors[type][interceptors[type].length-1] = interceptor;
    }
    else {
        throw new DuplicateName( interceptorName );
    }
}
 
Example #23
Source File: InterceptorList.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes all interceptors arrays to zero-length arrays of the
 * correct type, based on the classTypes list.
 */
private void initInterceptorArrays() {
    for( int type = 0; type < NUM_INTERCEPTOR_TYPES; type++ ) {
        Class classType = classTypes[type];

        // Create a zero-length array for each type:
        interceptors[type] =
            (Interceptor[])Array.newInstance( classType, 0 );
    }
}
 
Example #24
Source File: InterceptorList.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Grows the given interceptor array by one:
 */
private void growInterceptorArray( int type ) {
    Class classType = classTypes[type];
    int currentLength = interceptors[type].length;
    Interceptor[] replacementArray;

    // Create new array to replace the old one.  The new array will be
    // one element larger but have the same type as the old one.
    replacementArray = (Interceptor[])
        Array.newInstance( classType, currentLength + 1 );
    System.arraycopy( interceptors[type], 0,
                      replacementArray, 0, currentLength );
    interceptors[type] = replacementArray;
}
 
Example #25
Source File: InterceptorList.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Registers an interceptor of the given type into the interceptor list.
 * The type is one of:
 * <ul>
 *   <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
 * </ul>
 *
 * @exception DuplicateName Thrown if an interceptor of the given
 *     name already exists for the given type.
 */
void register_interceptor( Interceptor interceptor, int type )
    throws DuplicateName
{
    // If locked, deny any further addition of interceptors.
    if( locked ) {
        throw wrapper.interceptorListLocked() ;
    }

    // Cache interceptor name:
    String interceptorName = interceptor.name();
    boolean anonymous = interceptorName.equals( "" );
    boolean foundDuplicate = false;
    Interceptor[] interceptorList = interceptors[type];

    // If this is not an anonymous interceptor,
    // search for an interceptor of the same name in this category:
    if( !anonymous ) {
        int size = interceptorList.length;

        // An O(n) search will suffice because register_interceptor is not
        // likely to be called often.
        for( int i = 0; i < size; i++ ) {
            Interceptor in = (Interceptor)interceptorList[i];
            if( in.name().equals( interceptorName ) ) {
                foundDuplicate = true;
                break;
            }
        }
    }

    if( !foundDuplicate ) {
        growInterceptorArray( type );
        interceptors[type][interceptors[type].length-1] = interceptor;
    }
    else {
        throw new DuplicateName( interceptorName );
    }
}
 
Example #26
Source File: InterceptorList.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Grows the given interceptor array by one:
 */
private void growInterceptorArray( int type ) {
    Class classType = classTypes[type];
    int currentLength = interceptors[type].length;
    Interceptor[] replacementArray;

    // Create new array to replace the old one.  The new array will be
    // one element larger but have the same type as the old one.
    replacementArray = (Interceptor[])
        Array.newInstance( classType, currentLength + 1 );
    System.arraycopy( interceptors[type], 0,
                      replacementArray, 0, currentLength );
    interceptors[type] = replacementArray;
}
 
Example #27
Source File: InterceptorList.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Registers an interceptor of the given type into the interceptor list.
 * The type is one of:
 * <ul>
 *   <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
 *   <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
 * </ul>
 *
 * @exception DuplicateName Thrown if an interceptor of the given
 *     name already exists for the given type.
 */
void register_interceptor( Interceptor interceptor, int type )
    throws DuplicateName
{
    // If locked, deny any further addition of interceptors.
    if( locked ) {
        throw wrapper.interceptorListLocked() ;
    }

    // Cache interceptor name:
    String interceptorName = interceptor.name();
    boolean anonymous = interceptorName.equals( "" );
    boolean foundDuplicate = false;
    Interceptor[] interceptorList = interceptors[type];

    // If this is not an anonymous interceptor,
    // search for an interceptor of the same name in this category:
    if( !anonymous ) {
        int size = interceptorList.length;

        // An O(n) search will suffice because register_interceptor is not
        // likely to be called often.
        for( int i = 0; i < size; i++ ) {
            Interceptor in = (Interceptor)interceptorList[i];
            if( in.name().equals( interceptorName ) ) {
                foundDuplicate = true;
                break;
            }
        }
    }

    if( !foundDuplicate ) {
        growInterceptorArray( type );
        interceptors[type][interceptors[type].length-1] = interceptor;
    }
    else {
        throw new DuplicateName( interceptorName );
    }
}
 
Example #28
Source File: InterceptorList.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes all interceptors arrays to zero-length arrays of the
 * correct type, based on the classTypes list.
 */
private void initInterceptorArrays() {
    for( int type = 0; type < NUM_INTERCEPTOR_TYPES; type++ ) {
        Class classType = classTypes[type];

        // Create a zero-length array for each type:
        interceptors[type] =
            (Interceptor[])Array.newInstance( classType, 0 );
    }
}
 
Example #29
Source File: InterceptorList.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes all interceptors arrays to zero-length arrays of the
 * correct type, based on the classTypes list.
 */
private void initInterceptorArrays() {
    for( int type = 0; type < NUM_INTERCEPTOR_TYPES; type++ ) {
        Class classType = classTypes[type];

        // Create a zero-length array for each type:
        interceptors[type] =
            (Interceptor[])Array.newInstance( classType, 0 );
    }
}
 
Example #30
Source File: InterceptorList.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Grows the given interceptor array by one:
 */
private void growInterceptorArray( int type ) {
    Class classType = classTypes[type];
    int currentLength = interceptors[type].length;
    Interceptor[] replacementArray;

    // Create new array to replace the old one.  The new array will be
    // one element larger but have the same type as the old one.
    replacementArray = (Interceptor[])
        Array.newInstance( classType, currentLength + 1 );
    System.arraycopy( interceptors[type], 0,
                      replacementArray, 0, currentLength );
    interceptors[type] = replacementArray;
}