public class QueryLoader extends Object
QueryLoader
is a registry for sets of queries so
that multiple copies of the same queries aren't loaded into memory.
This implementation loads properties files filled with query name to
SQL mappings. This class is thread safe.Modifier | Constructor and Description |
---|---|
protected |
QueryLoader()
QueryLoader constructor.
|
Modifier and Type | Method and Description |
---|---|
static QueryLoader |
instance()
Return an instance of this class.
|
Map<String,String> |
load(String path)
Loads a Map of query names to SQL values.
|
protected Map<String,String> |
loadQueries(String path)
Loads a set of named queries into a Map object.
|
void |
unload(String path)
Removes the queries for the given path from the cache.
|
public static QueryLoader instance()
public Map<String,String> load(String path) throws IOException
path
- The path that the ClassLoader will use to find the file.
This is not a file system path. If you had a jarred
Queries.properties file in the com.yourcorp.app.jdbc package you would
pass "/com/yourcorp/app/jdbc/Queries.properties" to this method.IOException
- if a file access error occursIllegalArgumentException
- if the ClassLoader can't find a file at
the given path.protected Map<String,String> loadQueries(String path) throws IOException
path
- The path that the ClassLoader will use to find the file.IOException
- if a file access error occursIllegalArgumentException
- if the ClassLoader can't find a file at
the given path.public void unload(String path)
path
- The path that the queries were loaded from.Copyright © 2002-2012 Apache Software Foundation. All Rights Reserved.