liquibase
Class CompositeFileOpener

java.lang.Object
  extended by liquibase.CompositeFileOpener
All Implemented Interfaces:
FileOpener

public class CompositeFileOpener
extends java.lang.Object
implements FileOpener

A FileOpener that will search in a List of other FileOpeners until it finds one that has a resource of the appropriate name and path.

Author:
Constructor Summary
CompositeFileOpener(FileOpener... openers)
          Creates a CompositeFileOpener with 2 entries.
CompositeFileOpener(java.util.List<FileOpener> openers)
          Creates a Composite Opener with the list specified.
 
Method Summary
 java.io.InputStream getResourceAsStream(java.lang.String file)
          Searches through all of the FileOpeners in order for the file.
 java.util.Enumeration<java.net.URL> getResources(java.lang.String packageName)
          Searches all of the FileOpeners for a directory named packageName.
 java.lang.ClassLoader toClassLoader()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeFileOpener

public CompositeFileOpener(java.util.List<FileOpener> openers)
Creates a Composite Opener with the list specified. The List will be searched in order from beginning to end.

Parameters:
openers - The list of Openers to use

CompositeFileOpener

public CompositeFileOpener(FileOpener... openers)
Creates a CompositeFileOpener with 2 entries.

Parameters:
openers - The list of Openers to use
Method Detail

getResourceAsStream

public java.io.InputStream getResourceAsStream(java.lang.String file)
                                        throws java.io.IOException
Searches through all of the FileOpeners in order for the file.

If none of the FileOpeners was able to produce a stream to the file then null is returned.

Specified by:
getResourceAsStream in interface FileOpener
Throws:
java.io.IOException

getResources

public java.util.Enumeration<java.net.URL> getResources(java.lang.String packageName)
                                                 throws java.io.IOException
Searches all of the FileOpeners for a directory named packageName. If no results are found within any of the directories then an empty Enumeration is returned.

Specified by:
getResources in interface FileOpener
Throws:
java.io.IOException

toClassLoader

public java.lang.ClassLoader toClassLoader()
Specified by:
toClassLoader in interface FileOpener