com.stratelia.webactiv.util
Class FileRepositoryManager

java.lang.Object
  extended by com.stratelia.webactiv.util.FileRepositoryManager

public class FileRepositoryManager
extends Object

Version:
Author:
Norbert CHAIX

Field Summary
static String CONTEXT_TOKEN
           
 
Method Summary
static void copyFile(String from, String to)
          Copy a contents from a file to another one
static void createAbsolutePath(String componentId, String directoryName)
           
static void createAbsolutePath(String spaceId, String componentId, String directoryName)
          Deprecated.  
static void createGlobalTempPath(String sDirectoryName)
           
static void createTempPath(String sComponentId, String sDirectoryName)
           
static void createTempPath(String spaceId, String componentId, String directoryName)
          Deprecated.  
static void deleteAbsolutePath(String sSpaceId, String sComponentId, String sDirectoryName)
           
static void deleteTempPath(String sSpaceId, String sComponentId, String sDirectoryName)
           
static String formatFileSize(long lSize)
          Get the file size with the suitable unit
static String formatFileUploadTime(long size)
           
static String getAbsolutePath(String sComponentId)
           
static String getAbsolutePath(String sSpaceId, String sComponentId)
          Deprecated.  
static String getAbsolutePath(String componentId, String[] directoryName)
           
static String getAbsolutePath(String spaceId, String componentId, String[] directoryName)
          Deprecated.  
static String[] getAttachmentContext(String str)
          to create the array of the string this array represents the repertories where the files must be stored.
static String getAvatarPath()
           
static String getComponentTemporaryPath(String sComponentId)
           
static String getDomainAuthenticationPropertiesPath(String domainName)
           
static String getDomainPropertiesPath(String domainName)
           
static String getExportTemplateRepository()
          Gets the path of the repository that contains the templates to use in exports.
static String getFileDownloadTime(long size)
          Get the estimated download time
static String getFileExtension(String fileName)
           
static String getFileIcon(boolean small, String extension)
           
static String getFileIcon(boolean small, String filename, boolean isReadOnly)
           
static String getFileIcon(String extension)
           
static String getFileIcon(String extension, boolean isReadOnly)
          Get File icon
static long getFileSize(String sourceFile)
          Get the size of a file (in bytes)
static String getRelativePath(String... directories)
          Construct an OS specific relative path.
static String getSecurityDirPath()
          Gets the path of the directory in which all the resources related to the security in Silverpeas are stored.
static String getTemporaryPath()
           
static String getTemporaryPath(String sSpaceId, String sComponentId)
           
static long getUploadMaximumFileSize()
          Gets the file size limit for an upload.
static String getUploadPath()
          Gets the path of the repository into which attachments and other files are uploaded in Silverpeas.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT_TOKEN

public static final String CONTEXT_TOKEN
See Also:
Constant Field Values
Method Detail

getSecurityDirPath

public static String getSecurityDirPath()
Gets the path of the directory in which all the resources related to the security in Silverpeas are stored.

Returns:
the path of the Silverpeas security directory.

getAbsolutePath

@Deprecated
public static String getAbsolutePath(String sSpaceId,
                                                String sComponentId)
Deprecated. 

Parameters:
sSpaceId -
sComponentId -
Returns:

getAbsolutePath

public static String getAbsolutePath(String sComponentId)

getAvatarPath

public static String getAvatarPath()

getUploadPath

public static String getUploadPath()
Gets the path of the repository into which attachments and other files are uploaded in Silverpeas.

Returns:
the path of the root repository for uploads.

getAbsolutePath

@Deprecated
public static String getAbsolutePath(String spaceId,
                                                String componentId,
                                                String[] directoryName)
Deprecated. 

Add by Jean-Claude Groccia


getAbsolutePath

public static String getAbsolutePath(String componentId,
                                     String[] directoryName)
Parameters:
componentId -
directoryName -
Returns:
path

getRelativePath

public static String getRelativePath(String... directories)
Construct an OS specific relative path.

Parameters:
directories - the names of sub directory. (path1, path2,...)
Returns:
path1/path2/.../

getTemporaryPath

public static String getTemporaryPath()

getDomainPropertiesPath

public static String getDomainPropertiesPath(String domainName)

getDomainAuthenticationPropertiesPath

public static String getDomainAuthenticationPropertiesPath(String domainName)

getTemporaryPath

public static String getTemporaryPath(String sSpaceId,
                                      String sComponentId)

getComponentTemporaryPath

public static String getComponentTemporaryPath(String sComponentId)

createAbsolutePath

@Deprecated
public static void createAbsolutePath(String spaceId,
                                                 String componentId,
                                                 String directoryName)
Deprecated. 

Parameters:
spaceId -
componentId -
directoryName -

createAbsolutePath

public static void createAbsolutePath(String componentId,
                                      String directoryName)

createTempPath

@Deprecated
public static void createTempPath(String spaceId,
                                             String componentId,
                                             String directoryName)
Deprecated. 

Parameters:
spaceId -
componentId -
directoryName -

createTempPath

public static void createTempPath(String sComponentId,
                                  String sDirectoryName)

createGlobalTempPath

public static void createGlobalTempPath(String sDirectoryName)

deleteAbsolutePath

public static void deleteAbsolutePath(String sSpaceId,
                                      String sComponentId,
                                      String sDirectoryName)

deleteTempPath

public static void deleteTempPath(String sSpaceId,
                                  String sComponentId,
                                  String sDirectoryName)

getFileIcon

public static String getFileIcon(boolean small,
                                 String extension)

getFileIcon

public static String getFileIcon(String extension)

getFileIcon

public static String getFileIcon(String extension,
                                 boolean isReadOnly)
Get File icon

Parameters:
extension -
isReadOnly -
Returns:

getFileIcon

public static String getFileIcon(boolean small,
                                 String filename,
                                 boolean isReadOnly)

getFileExtension

public static String getFileExtension(String fileName)

formatFileSize

public static String formatFileSize(long lSize)
Get the file size with the suitable unit

Parameters:
lSize - : size
Returns:
String

getFileSize

public static long getFileSize(String sourceFile)
Get the size of a file (in bytes)

Parameters:
sourceFile -
Returns:
int

getFileDownloadTime

public static String getFileDownloadTime(long size)
Get the estimated download time

Parameters:
size - the file's size
Returns:
String

getUploadMaximumFileSize

public static long getUploadMaximumFileSize()
Gets the file size limit for an upload.

Returns:

copyFile

public static void copyFile(String from,
                            String to)
                     throws IOException
Copy a contents from a file to another one

Parameters:
from - The name of the source file, the one to copy.
to - The name of the destination file, where to paste data.
Throws:
IOException

formatFileUploadTime

public static String formatFileUploadTime(long size)

getAttachmentContext

public static String[] getAttachmentContext(String str)
to create the array of the string this array represents the repertories where the files must be stored.

Parameters:
str - : type String: the string of repertories
Returns:

getExportTemplateRepository

public static String getExportTemplateRepository()
Gets the path of the repository that contains the templates to use in exports.

Returns:
the path of the export template repository.


Copyright © 2016 Silverpeas. All Rights Reserved.