liquibase.resource
Class CompositeResourceAccessor

java.lang.Object
  extended by liquibase.resource.CompositeResourceAccessor
All Implemented Interfaces:
ResourceAccessor
Direct Known Subclasses:
AntResourceAccessor

public class CompositeResourceAccessor
extends Object
implements ResourceAccessor

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
CompositeResourceAccessor(List<ResourceAccessor> openers)
          Creates a Composite Opener with the list specified.
CompositeResourceAccessor(ResourceAccessor... openers)
          Creates a CompositeFileOpener with 2 entries.
 
Method Summary
 InputStream getResourceAsStream(String file)
          Searches through all of the FileOpeners in order for the file.
 Enumeration<URL> getResources(String packageName)
          Searches all of the FileOpeners for a directory named packageName.
 ClassLoader toClassLoader()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompositeResourceAccessor

public CompositeResourceAccessor(List<ResourceAccessor> 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

CompositeResourceAccessor

public CompositeResourceAccessor(ResourceAccessor... openers)
Creates a CompositeFileOpener with 2 entries.

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

getResourceAsStream

public InputStream getResourceAsStream(String file)
                                throws 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 ResourceAccessor
Throws:
IOException

getResources

public Enumeration<URL> getResources(String packageName)
                              throws 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 ResourceAccessor
Throws:
IOException

toClassLoader

public ClassLoader toClassLoader()
Specified by:
toClassLoader in interface ResourceAccessor

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012 Liquibase.org. All Rights Reserved.