org.molgenis.omx.decorators
Class MolgenisFileHandler

java.lang.Object
  extended by org.molgenis.omx.services.StorageHandler
      extended by org.molgenis.omx.decorators.MolgenisFileHandler

public class MolgenisFileHandler
extends StorageHandler


Nested Class Summary
 class MolgenisFileHandler.TypeUnknownException
           
 
Constructor Summary
MolgenisFileHandler(Database db)
           
 
Method Summary
 void deleteFile(MolgenisFile mf, Database db)
          Deletes the file that belongs to this MolgenisFile entity.
 String findFile(MolgenisFile mf, Database db)
          Find the type of MolgenisFile (subclass) for this file, if it exists.
 File getFile(MolgenisFile mf, Database db)
          Get the file pointer for this MolgenisFile, if it exists.
 File getFile(String name, Database db)
          Get the file pointer for this name of a MolgenisFile, if it exists.
 File getFileDirectly(String fileName, String extension, String mfType, Database db)
          Get the file pointer for this filename / extension / type, bypassing MolgenisFile to handle it.
 File getStorageDirFor(MolgenisFile mf, Database db)
          Get the storage directory for this MolgenisFile object.
 File getStorageDirFor(String type, Database db)
          Get the storage directory for a type of file denoted by this String.
 
Methods inherited from class org.molgenis.omx.services.StorageHandler
deleteFileStorage, getFileStorage, getFileStorage, getReport, hasFileStorage, hasValidFileStorage, setFileStorage, validateFileStorage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MolgenisFileHandler

public MolgenisFileHandler(Database db)
Method Detail

getStorageDirFor

public File getStorageDirFor(MolgenisFile mf,
                             Database db)
                      throws Exception
Get the storage directory for this MolgenisFile object. Directory is created if it does not exist, and will throw error if this fails.

Parameters:
mf -
Returns:
Throws:
MolgenisFileHandler.TypeUnknownException
Exception

getStorageDirFor

public File getStorageDirFor(String type,
                             Database db)
                      throws Exception
Get the storage directory for a type of file denoted by this String. Directory is created if it does not exist, and will throw error if this fails.

Parameters:
type -
Returns:
Throws:
MolgenisFileHandler.TypeUnknownException
MolgenisFileHandler.TypeUnknownException
Exception

deleteFile

public void deleteFile(MolgenisFile mf,
                       Database db)
                throws Exception
Deletes the file that belongs to this MolgenisFile entity. Use only if you know what you're doing, because you usually want the decorator to take care of deleting the file by removing the MolgenisFile.

Parameters:
mf -
Throws:
MolgenisFileHandler.TypeUnknownException
Exception

getFile

public File getFile(MolgenisFile mf,
                    Database db)
             throws Exception
Get the file pointer for this MolgenisFile, if it exists.

Parameters:
db -
mf -
Returns:
Throws:
MolgenisFileHandler.TypeUnknownException
Exception

getFileDirectly

public File getFileDirectly(String fileName,
                            String extension,
                            String mfType,
                            Database db)
                     throws Exception
Get the file pointer for this filename / extension / type, bypassing MolgenisFile to handle it.

Parameters:
db -
mf -
Returns:
Throws:
MolgenisFileHandler.TypeUnknownException
Exception

getFile

public File getFile(String name,
                    Database db)
             throws Exception
Get the file pointer for this name of a MolgenisFile, if it exists.

Parameters:
name -
Returns:
Throws:
MolgenisFileHandler.TypeUnknownException
Exception

findFile

public String findFile(MolgenisFile mf,
                       Database db)
                throws Exception
Find the type of MolgenisFile (subclass) for this file, if it exists.

Parameters:
db -
mf -
Returns:
Throws:
MolgenisFileHandler.TypeUnknownException
MolgenisFileHandler.TypeUnknownException
Exception


Copyright © 2013. All Rights Reserved.