*
*/
public class QueryProvider {
- protected Properties queries;
+ protected final Properties queries = new Properties();
+
+ public QueryProvider() {
+ }
public QueryProvider(final Properties queries) {
super();
- this.queries = queries;
+ this.queries.putAll(queries);
}
public QueryProvider(final File propertiesFile) throws MalformedURLException, IOException {
}
public QueryProvider(final URL propertiesFile) throws IOException {
+ this.load(propertiesFile);
+ }
+
+ public QueryProvider(final InputStream in) throws IOException {
+ this.queries.load(in);
+ }
+
+ public void load(final URL propertiesFile) throws IOException {
final InputStream in = propertiesFile.openStream();
if (in == null) {
}
try {
- this.initFromInputStream(in);
+ this.queries.load(in);
} finally {
in.close();
}
}
- public QueryProvider(final InputStream in) throws IOException {
- this.initFromInputStream(in);
- }
-
- private void initFromInputStream(final InputStream in) throws IOException {
- this.queries = new Properties();
- this.queries.load(in);
- }
-
public String getQuery(final String key) {
return this.queries.getProperty(key);
}