lumis.portal.file
Class FileUtil

Package class diagram package FileUtil
java.lang.Object
  extended by lumis.portal.file.FileUtil

public class FileUtil
extends Object

Utility methods for file manipulation.

Since:
6.1.0

Constructor Summary
FileUtil()
           
 
Method Summary
static String calculateWWWFileRelativePath(String path)
          Calculates the physical path to the www folder according to a FileConfig path.
static void deletePortalFile(PortalFile portalFile)
          Deletes portal file and all empty ancestor folders.
static String getContentType(File file)
          Gets content type based on the given file.
static IWebsite getWebsiteByFile(FileConfig fileConfig, ITransaction transaction)
          Returns the website of the given file (the website that contains the file's service instance).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtil

public FileUtil()
Method Detail

getContentType

public static String getContentType(File file)
                             throws IOException
Gets content type based on the given file.

Parameters:
file - the file.
Returns:
content type.
Throws:
IOException - if an IO error occured.
Since:
6.1.0

calculateWWWFileRelativePath

public static String calculateWWWFileRelativePath(String path)
Calculates the physical path to the www folder according to a FileConfig path.

Parameters:
path - the path stored in the FileConfig.
Returns:
adjusted relative path, relative to a web root path.
Since:
6.1.0

deletePortalFile

public static void deletePortalFile(PortalFile portalFile)
Deletes portal file and all empty ancestor folders.

Parameters:
portalFile - the file to be deleted.
Since:
6.1.0

getWebsiteByFile

public static IWebsite getWebsiteByFile(FileConfig fileConfig,
                                        ITransaction transaction)
                                 throws ManagerException,
                                        PortalException
Returns the website of the given file (the website that contains the file's service instance).

Parameters:
fileConfig - the file.
transaction - the transaction.
Returns:
the website of the given file (the website that contains the file's service instance).
Throws:
ManagerException
PortalException
Since:
6.2.0


Lumisportal  6.2.0.120405 - Copyright © 2006–2012 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.