@ SuppressWarnings ( "unchecked" ) private boolean isIndexRecoveryRequired ( ) throws RepositoryException { // instantiate filters first, if not initialized if ( recoveryFilters == null ) { recoveryFilters = new ArrayList < AbstractRecoveryFilter > ( ) ; log . info ( "Initializing RecoveryFilters." ) ; // add default filter, if none configured. if ( recoveryFilterClasses . isEmpty ( ) ) { this . recoveryFilterClasses . add ( DocNumberRecoveryFilter . class . getName ( ) ) ; } for ( String recoveryFilterClassName : recoveryFilterClasses ) { AbstractRecoveryFilter filter = null ; Class < ? extends AbstractRecoveryFilter > filterClass ; try { filterClass = ( Class < ? extends AbstractRecoveryFilter > ) ClassLoading . forName ( recoveryFilterClassName , this ) ; Constructor < ? extends AbstractRecoveryFilter > constuctor = filterClass . getConstructor ( SearchIndex . class ) ; filter = constuctor . newInstance ( this ) ; recoveryFilters . add ( filter ) ; } catch ( ClassNotFoundException e ) { throw new RepositoryException ( e . getMessage ( ) , e ) ; } catch ( IllegalArgumentException e ) { throw new RepositoryException ( e . getMessage ( ) , e ) ; } catch ( InstantiationException e ) { throw new RepositoryException ( e . getMessage ( ) , e ) ; } catch ( IllegalAccessException e ) { throw new RepositoryException ( e . getMessage ( ) , e ) ; } catch ( InvocationTargetException e ) { throw new RepositoryException ( e . getMessage ( ) , e ) ; } catch ( SecurityException e ) { throw new RepositoryException ( e . getMessage ( ) , e ) ; } catch ( NoSuchMethodException e ) { throw new RepositoryException ( e . getMessage ( ) , e ) ; } } } // invoke filters for ( AbstractRecoveryFilter filter : recoveryFilters ) { if ( filter . accept ( ) ) { return true ; } } return false ; }
Invokes all recovery filters from the set