org.skife.jdbi.tweak
Class ClasspathScriptLocator

java.lang.Object
  extended by org.skife.jdbi.tweak.ClasspathScriptLocator
All Implemented Interfaces:
ScriptLocator

public class ClasspathScriptLocator
extends java.lang.Object
implements ScriptLocator

Looks for a script on the classpath. Will first try the exact name passed, will then try appending ".sql" if the name doesn't already end in .sql.

The suffix mechanism will probably be removed in an upcoming major release, it is included here for backwards compatibility with earlier script locating mechanisms.


Constructor Summary
ClasspathScriptLocator()
           
 
Method Summary
 java.io.InputStream locate(java.lang.String name)
          Looks for a script on the classpath.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClasspathScriptLocator

public ClasspathScriptLocator()
Method Detail

locate

public java.io.InputStream locate(java.lang.String name)
                           throws java.lang.Exception
Looks for a script on the classpath. Will first try the exact name passed, will then try appending ".sql" if the name doesn't already end in .sql.

The suffix mechanism will probably be removed in an upcoming major release, it is included here for backwards compatibility with earlier script locating mechanisms.

Specified by:
locate in interface ScriptLocator
Parameters:
name - Resource name to look for. This will be the raw value requested by the client.
Returns:
open input stream, or null if nothing could be found.
Throws:
java.lang.Exception - if anything goes wrong locating the statement, will be wrapped in a DBIException and rethrown