@ Override protected void initializeStorage ( File directory ) throws BinaryStoreException { // make sure the directory doesn't exist FileUtil . delete ( directory ) ; if ( ! directory . exists ( ) ) { logger . debug ( "Creating temporary directory for transient binary store: {0}" , directory . getAbsolutePath ( ) ) ; directory . mkdirs ( ) ; } if ( ! directory . canRead ( ) ) { throw new BinaryStoreException ( JcrI18n . unableToReadTemporaryDirectory . text ( directory . getAbsolutePath ( ) , JAVA_IO_TMPDIR ) ) ; } if ( ! directory . canWrite ( ) ) { throw new BinaryStoreException ( JcrI18n . unableToWriteTemporaryDirectory . text ( directory . getAbsolutePath ( ) , JAVA_IO_TMPDIR ) ) ; } }
Ensures that the directory used by this binary store exists and can be both read and written to .