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.
|
protected QueryLoader()
public static QueryLoader instance()
public Map<String,String> load(String path) throws IOException
.xml
file extension.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.InvalidPropertiesFormatException
- if the XML properties file is
invalidProperties
protected Map<String,String> loadQueries(String path) throws IOException
.xml
file extension.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.InvalidPropertiesFormatException
- if the XML properties file is
invalidProperties
Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.