private String createDigitalObject ( File file ) throws HarvesterException , StorageException { String objectId ; DigitalObject object ; if ( forceUpdate ) { object = StorageUtils . storeFile ( getStorage ( ) , file , ! forceLocalStorage ) ; } else { String oid = StorageUtils . generateOid ( file ) ; String pid = StorageUtils . generatePid ( file ) ; object = getStorage ( ) . createObject ( oid ) ; if ( forceLocalStorage ) { try { object . createStoredPayload ( pid , new FileInputStream ( file ) ) ; } catch ( FileNotFoundException ex ) { throw new HarvesterException ( ex ) ; } } else { object . createLinkedPayload ( pid , file . getAbsolutePath ( ) ) ; } } // update object metadata Properties props = object . getMetadata ( ) ; props . setProperty ( "render-pending" , "true" ) ; props . setProperty ( "file.path" , FilenameUtils . separatorsToUnix ( file . getAbsolutePath ( ) ) ) ; objectId = object . getId ( ) ; // Store rendition information if we have it String ext = FilenameUtils . getExtension ( file . getName ( ) ) ; for ( String chain : renderChains . keySet ( ) ) { Map < String , List < String > > details = renderChains . get ( chain ) ; if ( details . get ( "fileTypes" ) . contains ( ext ) ) { storeList ( props , details , "harvestQueue" ) ; storeList ( props , details , "indexOnHarvest" ) ; storeList ( props , details , "renderQueue" ) ; } } object . close ( ) ; return objectId ; }
Store the provided file in storage . Ensure proper queue routing is set in object properties .