protected void handleLoadIndex ( String indexLocation ) { reportable . output ( "Loading resource from index file:" ) ; reportable . output ( " " + indexLocation ) ; File indexFile = new File ( indexLocation ) ; if ( ! indexFile . exists ( ) || ! indexFile . canRead ( ) ) { // try the index as an online resource. try { ResolvedResource resolvedResource = cacheService . resolveResource ( ResourceType . RESOURCE_INDEX , indexLocation ) ; indexFile = resolvedResource . getCacheResourceCopy ( ) ; } catch ( Exception e ) { reportable . error ( "Index could not be read" ) ; bail ( GENERAL_FAILURE ) ; } } try { ResourceIndex . INSTANCE . loadIndex ( indexFile ) ; } catch ( Exception e ) { reportable . error ( "Unable to load index" ) ; reportable . error ( "Reason: " + e . getMessage ( ) ) ; bail ( GENERAL_FAILURE ) ; } Index index = ResourceIndex . INSTANCE . getIndex ( ) ; cacheMgrService . updateResourceIndexInCache ( index ) ; }
Handle the load index option .