Package ome.formats.importer
Class ImportLibrary
- java.lang.Object
- 
- ome.formats.importer.ImportLibrary
 
- 
- All Implemented Interfaces:
- IObservable
 
 public class ImportLibrary extends java.lang.Object implements IObservable support class for the proper usage ofOMEROMetadataStoreClientandFormatReaderinstances. This library was factored out of ImportHandler to support ImportFixture- Since:
- 3.0-M3
- See Also:
- FormatReader,- OMEROMetadataStoreClient,- ImportFixture,- IObservable,- IObserver
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classImportLibrary.ImportCallback
 - 
Constructor SummaryConstructors Constructor Description ImportLibrary(OMEROMetadataStoreClient client, OMEROWrapper reader)The default implementation ofFileTransferperforms a no-op and therefore need not haveFileTransfer.afterTransfer(int, List)as with theImportLibrary(OMEROMetadataStoreClient, OMEROWrapper, FileTransfer)constructor.ImportLibrary(OMEROMetadataStoreClient client, OMEROWrapper reader, FileTransfer transfer)The library will not close the client instance.ImportLibrary(OMEROMetadataStoreClient client, OMEROWrapper reader, FileTransfer transfer, int minutesToWait)ImportLibrary(OMEROMetadataStoreClient client, OMEROWrapper reader, FileTransfer transfer, java.util.List<FileExclusion> exclusions, int minutesToWait)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanaddObserver(IObserver object)Add observer for notificationvoidclear()ImportLibrary.ImportCallbackcreateCallback(ImportProcessPrx proc, HandlePrx handle, ImportContainer container)ImportProcessPrxcreateImport(ImportContainer container)Provide initial configuration to the server in order to create theImportProcessPrxwhich will manage state server-side.java.util.List<java.lang.String>deleteFilesFromRepository(ImportContainer container)Delete files from the managed repository.booleandeleteObserver(IObserver object)Delete observerOMEROMetadataStoreClientgetMetadataStore()Retrieves the currently active metadata store.booleanimportCandidates(ImportConfig config, ImportCandidates candidates)Primary user method for importing a number of import candidates.java.util.List<Pixels>importImage(ImportContainer container, int index, int numDone, int total)Deprecated.now used by tests onlyjava.util.List<Pixels>importImage(ImportContainer container, java.util.concurrent.ExecutorService threadPool, int index)Perform an image import uploading files if necessary.OriginalFileloadOriginalFile(RawFileStorePrx uploader)UseRawFileStorePrx.getFileId()in order to load theOriginalFilethat the service argument is acting on.ManagedRepositoryPrxlookupManagedRepository()Retrieves the first managed repository from the list of current active repositories.voidnotifyObservers(ImportEvent event)Notify observers of eventjava.lang.StringuploadFile(ImportProcessPrx proc, java.lang.String[] srcFiles, int index, TimeEstimator estimator)java.lang.StringuploadFile(ImportProcessPrx proc, java.lang.String[] srcFiles, int index, ome.util.checksum.ChecksumProviderFactory cpf, TimeEstimator estimator, byte[] buf)java.util.List<java.lang.String>uploadFilesToRepository(java.lang.String[] srcFiles, ImportProcessPrx proc)Upload files to the managed repository.
 
- 
- 
- 
Constructor Detail- 
ImportLibrarypublic ImportLibrary(OMEROMetadataStoreClient client, OMEROWrapper reader) The default implementation ofFileTransferperforms a no-op and therefore need not haveFileTransfer.afterTransfer(int, List)as with theImportLibrary(OMEROMetadataStoreClient, OMEROWrapper, FileTransfer)constructor.- Parameters:
- client- client-side- MetadataStore, not null
- reader- a Bio-Formats reader (ignored), not null
 
 - 
ImportLibrarypublic ImportLibrary(OMEROMetadataStoreClient client, OMEROWrapper reader, FileTransfer transfer) The library will not close the client instance. The reader will be closed between calls to import. Note: the responsibility of closingFileTransfer.afterTransfer(int, List)falls to invokers of this method.- Parameters:
- client- client-side- MetadataStore, not null
- reader- a Bio-Formats reader (ignored), not null
- transfer- how files are to be transferred to the server
 
 - 
ImportLibrarypublic ImportLibrary(OMEROMetadataStoreClient client, OMEROWrapper reader, FileTransfer transfer, int minutesToWait) 
 - 
ImportLibrarypublic ImportLibrary(OMEROMetadataStoreClient client, OMEROWrapper reader, FileTransfer transfer, java.util.List<FileExclusion> exclusions, int minutesToWait) 
 
- 
 - 
Method Detail- 
addObserverpublic boolean addObserver(IObserver object) Description copied from interface:IObservableAdd observer for notification- Specified by:
- addObserverin interface- IObservable
- Parameters:
- object- - observer object
- Returns:
- true if added
 
 - 
deleteObserverpublic boolean deleteObserver(IObserver object) Description copied from interface:IObservableDelete observer- Specified by:
- deleteObserverin interface- IObservable
- Parameters:
- object- - observer to delete
- Returns:
- true if deleted
 
 - 
notifyObserverspublic void notifyObservers(ImportEvent event) Description copied from interface:IObservableNotify observers of event- Specified by:
- notifyObserversin interface- IObservable
- Parameters:
- event- - event that happened
 
 - 
importCandidatespublic boolean importCandidates(ImportConfig config, ImportCandidates candidates) Primary user method for importing a number of import candidates.- Parameters:
- config- The configuration information.
- candidates- Hosts information about the files to import.
- Returns:
- if the import did not exit because of an error
 
 - 
deleteFilesFromRepositorypublic java.util.List<java.lang.String> deleteFilesFromRepository(ImportContainer container) throws ServerError Delete files from the managed repository.- Parameters:
- container- The current import container containing usedFiles to be deleted.
- Returns:
- List of files that could not be deleted.
- Throws:
- ServerError- if file deletion failed
 
 - 
createImportpublic ImportProcessPrx createImport(ImportContainer container) throws ServerError, java.io.IOException Provide initial configuration to the server in order to create theImportProcessPrxwhich will manage state server-side.- Parameters:
- container- the import container
- Returns:
- the new import process from the server
- Throws:
- ServerError- if the import process could not be created
- java.io.IOException- if the used files' absolute path could not be found
 
 - 
uploadFilesToRepositorypublic java.util.List<java.lang.String> uploadFilesToRepository(java.lang.String[] srcFiles, ImportProcessPrx proc)Upload files to the managed repository. This is done by first passing in the possibly absolute local file paths. A common selection of those are chosen and passed back to the client. As each file is written to the server, a message digest is kept updated of the bytes that are being written. These are then returned to the caller so they can be checked against the values found on the server.- Parameters:
- srcFiles- the files to upload
- proc- the server import process to use for the upload
- Returns:
- A list of the client-side (i.e. local) hashes for each file.
 
 - 
uploadFilepublic java.lang.String uploadFile(ImportProcessPrx proc, java.lang.String[] srcFiles, int index, TimeEstimator estimator) throws ServerError, java.io.IOException - Throws:
- ServerError
- java.io.IOException
 
 - 
uploadFilepublic java.lang.String uploadFile(ImportProcessPrx proc, java.lang.String[] srcFiles, int index, ome.util.checksum.ChecksumProviderFactory cpf, TimeEstimator estimator, byte[] buf) throws ServerError, java.io.IOException - Throws:
- ServerError
- java.io.IOException
 
 - 
importImage@Deprecated public java.util.List<Pixels> importImage(ImportContainer container, int index, int numDone, int total) throws java.lang.Throwable Deprecated.now used by tests onlyImage import with only one file upload thread.- Throws:
- java.lang.Throwable
- See Also:
- importImage(ImportContainer, ExecutorService, int)
 
 - 
importImagepublic java.util.List<Pixels> importImage(ImportContainer container, java.util.concurrent.ExecutorService threadPool, int index) throws loci.formats.FormatException, java.io.IOException, java.lang.Throwable Perform an image import uploading files if necessary.- Parameters:
- container- The import container which houses all the configuration values and target for the import.
- threadPool- The pool of threads to use in file upload.
- index- Index of the import in a set.- 0is safe if this is a singular import.
- Returns:
- List of Pixels that have been imported.
- Throws:
- loci.formats.FormatException- If there is a Bio-Formats image file format error during import.
- java.io.IOException- If there is an I/O error.
- ServerError- If there is an error communicating with the OMERO server we're importing into.
- java.lang.Throwable- If there is some other kind of error during import.
- Since:
- OMERO Beta 4.2.1.
 
 - 
createCallbackpublic ImportLibrary.ImportCallback createCallback(ImportProcessPrx proc, HandlePrx handle, ImportContainer container) throws ServerError - Throws:
- ServerError
 
 - 
getMetadataStorepublic OMEROMetadataStoreClient getMetadataStore() Retrieves the currently active metadata store.- Returns:
- See above.
 
 - 
lookupManagedRepositorypublic ManagedRepositoryPrx lookupManagedRepository() Retrieves the first managed repository from the list of current active repositories.- Returns:
- Active proxy for the legacy repository.
 
 - 
clearpublic void clear() 
 - 
loadOriginalFilepublic OriginalFile loadOriginalFile(RawFileStorePrx uploader) throws ServerError UseRawFileStorePrx.getFileId()in order to load theOriginalFilethat the service argument is acting on.- Parameters:
- uploader- not null
- Returns:
- the original file
- Throws:
- ServerError- if the file could not be identified and loaded
 
 
- 
 
-