public final long add ( String pid , InputStream content ) throws LowlevelStorageException { String filePath ; File file = null ; //check that object is not already in store if ( pathRegistry . exists ( pid ) ) { throw new ObjectAlreadyInLowlevelStorageException ( pid ) ; } filePath = pathAlgorithm . get ( pid ) ; if ( filePath == null || filePath . equals ( "" ) ) { //guard against algorithm implementation throw new LowlevelStorageException ( true , "null path from algorithm for pid " + pid ) ; } try { file = new File ( filePath ) ; } catch ( Exception eFile ) { //purposefully general catch-all throw new LowlevelStorageException ( true , "couldn't make File for " + filePath , eFile ) ; } fileSystem . write ( file , content ) ; pathRegistry . put ( pid , filePath ) ; return file . length ( ) ; }
add to lowlevel store content of Fedora object not already in lowlevel store