gov.bnl.star.offline.scheduler.util
Class FilesystemToolkit

java.lang.Object
  extended by gov.bnl.star.offline.scheduler.util.FilesystemToolkit

public class FilesystemToolkit
extends java.lang.Object

Tools for accessing the file system on the host computer.

Version:
$Revision: 1.15 $ $Date: 2006/11/21 00:41:29 $
Author:
Gabriele Carcassi & Jerome LAURET & Levente Hajdu

Field Summary
static java.util.Map mockfilelists
           
static java.util.Map mockWildcards
           
 
Method Summary
static boolean checkIfDirExists(java.lang.String path, java.lang.String machine, boolean hostAllowed)
          Check if a directory exist.
static boolean checkIfDirExists(java.net.URI file, boolean hostAllowed)
          Check if a directory exist.
static boolean checkIfDirExists(java.net.URL file, boolean hostAllowed)
          Check if a directory exist.
static boolean checkIfFileExists(java.net.URL file, boolean hostAllowed)
          Check if a file exist.
static java.lang.String getCurrentDirectory()
          This function is used to get the current working directory.
static void main(java.lang.String[] args)
           
static java.lang.String[] resolveWildcard(java.lang.String wildcard)
           
static java.util.List retrieveFileListContents(java.lang.String fileList, int nfiles)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mockWildcards

public static java.util.Map mockWildcards

mockfilelists

public static java.util.Map mockfilelists
Method Detail

getCurrentDirectory

public static java.lang.String getCurrentDirectory()
This function is used to get the current working directory. Because under UNIX file systems can be mounted at different locations this function needs to get the path right from the $PWD. All attempts to get this call using less expensive java calls such as System.getProperties() and java.io.File.getAbsolutePath() returned the operating systems path not the mount point path causing problems. Because we are not aware of this problem under windows, windows uses a less expensive way of retrieving the path.

Returns:
the current working directory.

checkIfFileExists

public static boolean checkIfFileExists(java.net.URL file,
                                        boolean hostAllowed)
Check if a file exist. This is not thread safe and can not time out.


checkIfDirExists

public static boolean checkIfDirExists(java.net.URI file,
                                       boolean hostAllowed)
Check if a directory exist. This is not thread safe and can not time out.


checkIfDirExists

public static boolean checkIfDirExists(java.lang.String path,
                                       java.lang.String machine,
                                       boolean hostAllowed)
Check if a directory exist. This is not thread safe and can not time out.


checkIfDirExists

public static boolean checkIfDirExists(java.net.URL file,
                                       boolean hostAllowed)
Check if a directory exist. This is not thread safe and can not time out.


resolveWildcard

public static java.lang.String[] resolveWildcard(java.lang.String wildcard)

retrieveFileListContents

public static java.util.List retrieveFileListContents(java.lang.String fileList,
                                                      int nfiles)

main

public static void main(java.lang.String[] args)


Copyright © 2002-2004 STAR collaboration - Brookhaven National Laboratory. All Rights Reserved.