com.jalios.jcms
Class AssociatedFilesManager

java.lang.Object
  extended by com.jalios.jcms.AssociatedFilesManager

public class AssociatedFilesManager
extends Object

Manager class to deal with associated files


Constructor Summary
AssociatedFilesManager()
           
 
Method Summary
 void addAssociatedFilesEventListener(AssociatedFilesEventListener listener)
           
 File addFile(File file, File associatedFile)
          Add a associated File to a File.
 File addFile(File file, File associatedFile, boolean replace)
          Add a associated File to a File.
 File addFile(File file, String associatedFilename)
          Add a associated File to a File.
 File addFile(File file, String associatedFilename, boolean replace)
          Add a associated File to a File.
 void deleteAllAssociatedFile(File fileDocument)
           
 void fireAddEvent(File file, File associatedFile)
           
 void fireDeleteEvent(File file, File associatedFile)
           
 void fireUpdateEvent(File file, File associatedFile)
           
 File getAssociatedDirectory(File file)
          Returns the File which is the directory in which associated files are stored
 File getAssociatedDirectory(FileDocument fileDoc)
          Returns the File which is the directory in which associated files are stored
 File getAssociatedFile(File file, String filename)
          Returns the File associated with a File with provided name
 List<AssociatedFilesEventListener> getAssociatedFilesEventListener()
           
 File getFile(File file, String filename)
           
 Set<File> getFiles(File file)
          Retrieve all associated files of the File
static AssociatedFilesManager getInstance()
          returns the singleton instance
 File getOriginatedFile(File file)
           
 void removeAllAssociatedFilesEventListener()
           
 void removeAssociatedFilesEventListener(AssociatedFilesEventListener listener)
           
 void removeFile(File file, File associatedFile)
          Remove File associated to a File
 void removeFile(File file, String filename)
          Remove File associated to a File
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssociatedFilesManager

public AssociatedFilesManager()
Method Detail

getInstance

public static AssociatedFilesManager getInstance()
returns the singleton instance

Returns:
the singleton instance

getFiles

public Set<File> getFiles(File file)
Retrieve all associated files of the File

Parameters:
file - the File. It must not be a directory
Returns:
All associated files of the File

addFile

public File addFile(File file,
                    File associatedFile,
                    boolean replace)
             throws IOException
Add a associated File to a File. If the provided File is not in the correct directory, the file is moved into correct directory and rename if replace is false.

Parameters:
file - the File. It must not be a directory
associatedFile - the File
replace - true if a associated file with the same name should be overwrite or not
Returns:
the moved and/or renamed File
Throws:
IOException

addFile

public File addFile(File file,
                    File associatedFile)
             throws IOException
Add a associated File to a File. If the provided File is not in the correct directory, the file is moved into correct directory and rename if needed.

Parameters:
file - the File. It must not be a directory
associatedFile - the File
Returns:
the moved and/or renamed File
Throws:
IOException

addFile

public File addFile(File file,
                    String associatedFilename)
             throws IOException
Add a associated File to a File. If the File already exists in associated directory, it will be overwrite.

Parameters:
file - the File. It must not be a directory
associatedFilename - the file name
Returns:
the associated File
Throws:
IOException

addFile

public File addFile(File file,
                    String associatedFilename,
                    boolean replace)
             throws IOException
Add a associated File to a File.

Parameters:
file - the File. It must not be a directory
associatedFilename - the file name
replace - true if a associated file with the same name should be overwrite or not
Returns:
the associated File
Throws:
IOException

removeFile

public void removeFile(File file,
                       String filename)
Remove File associated to a File

Parameters:
file - the File. It must not be a directory
filename - the name of the associated file

removeFile

public void removeFile(File file,
                       File associatedFile)
Remove File associated to a File

Parameters:
file - the File. It must not be a directory
associatedFile - the associated File

getAssociatedFile

public File getAssociatedFile(File file,
                              String filename)
Returns the File associated with a File with provided name

Parameters:
file - the File
filename - the name of the associated associatedFile
Returns:
the File associated with a File with provided name

getAssociatedDirectory

public File getAssociatedDirectory(FileDocument fileDoc)
Returns the File which is the directory in which associated files are stored

Parameters:
fileDoc - the FileDocument
Returns:
the File which is the directory in which associated files are stored

getAssociatedDirectory

public File getAssociatedDirectory(File file)
Returns the File which is the directory in which associated files are stored

Parameters:
file - the File
Returns:
the File which is the directory in which associated files are stored

fireAddEvent

public void fireAddEvent(File file,
                         File associatedFile)

fireDeleteEvent

public void fireDeleteEvent(File file,
                            File associatedFile)

fireUpdateEvent

public void fireUpdateEvent(File file,
                            File associatedFile)

addAssociatedFilesEventListener

public void addAssociatedFilesEventListener(AssociatedFilesEventListener listener)

removeAssociatedFilesEventListener

public void removeAssociatedFilesEventListener(AssociatedFilesEventListener listener)

getAssociatedFilesEventListener

public List<AssociatedFilesEventListener> getAssociatedFilesEventListener()

removeAllAssociatedFilesEventListener

public void removeAllAssociatedFilesEventListener()

deleteAllAssociatedFile

public void deleteAllAssociatedFile(File fileDocument)
                             throws IOException
Throws:
IOException

getFile

public File getFile(File file,
                    String filename)

getOriginatedFile

public File getOriginatedFile(File file)


Copyright © 2001-2010 Jalios SA. All Rights Reserved.