com.ibm.wala.util.config
Class FileProvider

java.lang.Object
  extended by com.ibm.wala.util.config.FileProvider

public class FileProvider
extends java.lang.Object

This class provides Jar files that are packaged with this plug-in


Constructor Summary
FileProvider()
           
 
Method Summary
static java.lang.String filePathFromURL(java.net.URL url)
          Properly creates the String file name of a URL.
static java.io.File getFile(java.lang.String fileName)
           
static java.io.File getFileFromClassLoader(java.lang.String fileName)
           
static java.io.File getFileFromPlugin(org.eclipse.core.runtime.Plugin p, java.lang.String fileName)
           
static Module getJarFileFromClassLoader(java.lang.String fileName)
           
static Module getJarFileModule(java.lang.String fileName)
           
static org.eclipse.core.resources.IWorkspace getWorkspace()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileProvider

public FileProvider()
Method Detail

getWorkspace

public static org.eclipse.core.resources.IWorkspace getWorkspace()
Returns:
null if there's a problem

getJarFileModule

public static Module getJarFileModule(java.lang.String fileName)
                               throws java.io.IOException
Parameters:
fileName -
Returns:
the jar file packaged with this plug-in of the given name, or null if not found.
Throws:
java.io.IOException

getFile

public static java.io.File getFile(java.lang.String fileName)
                            throws java.io.IOException
Throws:
java.io.IOException

getFileFromPlugin

public static java.io.File getFileFromPlugin(org.eclipse.core.runtime.Plugin p,
                                             java.lang.String fileName)
                                      throws java.io.IOException
Parameters:
fileName -
Returns:
the jar file packaged with this plug-in of the given name, or null if not found.
Throws:
java.lang.IllegalArgumentException - if p is null
java.io.IOException

getFileFromClassLoader

public static java.io.File getFileFromClassLoader(java.lang.String fileName)
                                           throws java.io.FileNotFoundException
Throws:
java.io.FileNotFoundException

getJarFileFromClassLoader

public static Module getJarFileFromClassLoader(java.lang.String fileName)
                                        throws java.io.IOException
Parameters:
fileName -
Returns:
the jar file packaged with this plug-in of the given name, or null if not found: wrapped as a JarFileModule or a NestedJarFileModule
Throws:
java.io.IOException

filePathFromURL

public static java.lang.String filePathFromURL(java.net.URL url)
Properly creates the String file name of a URL. This works around a bug in the Sun implementation of URL.getFile(), which doesn't properly handle file paths with spaces (see bug report). For now, fails with an assertion if the url is malformed.

Parameters:
url -
Returns:
the path name for the url
Throws:
java.lang.IllegalArgumentException - if url is null