org.apache.karaf.main
Class Utils

java.lang.Object
  extended by org.apache.karaf.main.Utils

public class Utils
extends java.lang.Object


Constructor Summary
Utils()
           
 
Method Summary
static void cleanDirectory(java.io.File directory)
          Clean a directory without deleting it.
static void deleteDirectory(java.io.File directory)
          Recursively delete a directory.
static void forceDelete(java.io.File file)
           Delete a file.
static java.io.File getKarafDirectory(java.lang.String directoryProperty, java.lang.String directoryEnvironmentVariable, java.io.File defaultValue, boolean create, boolean validate)
           
static java.io.File getKarafHome()
           
static java.io.File validateDirectoryExists(java.lang.String path, java.lang.String errPrefix, boolean createDirectory, boolean validate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

getKarafHome

public static java.io.File getKarafHome()
                                 throws java.io.IOException
Throws:
java.io.IOException

validateDirectoryExists

public static java.io.File validateDirectoryExists(java.lang.String path,
                                                   java.lang.String errPrefix,
                                                   boolean createDirectory,
                                                   boolean validate)

getKarafDirectory

public static java.io.File getKarafDirectory(java.lang.String directoryProperty,
                                             java.lang.String directoryEnvironmentVariable,
                                             java.io.File defaultValue,
                                             boolean create,
                                             boolean validate)

deleteDirectory

public static void deleteDirectory(java.io.File directory)
                            throws java.io.IOException
Recursively delete a directory.

Parameters:
directory - directory to delete
Throws:
java.io.IOException - in case deletion is unsuccessful

cleanDirectory

public static void cleanDirectory(java.io.File directory)
                           throws java.io.IOException
Clean a directory without deleting it.

Parameters:
directory - directory to clean
Throws:
java.io.IOException - in case cleaning is unsuccessful

forceDelete

public static void forceDelete(java.io.File file)
                        throws java.io.IOException

Delete a file. If file is a directory, delete it and all sub-directories.

The difference between File.delete() and this method are:

Parameters:
file - file or directory to delete.
Throws:
java.io.IOException - in case deletion is unsuccessful


Copyright © 2007-2011 Apache Software Foundation. All Rights Reserved.