diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2014-06-05 14:13:37 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2014-06-05 14:13:37 +0200 |
| commit | cedb32b6b7a799ef4142b418e64d3538cf604af1 (patch) | |
| tree | 20b6975f944132485beff9304869df0ac589da36 /src/main/java/com/c2kernel/utils/ObjectProperties.java | |
| parent | 28f6763508612fadcc34d87cff383e6a5aef2ad6 (diff) | |
Recreate old Authenticator interface as 'ProxyLogin'
Server boots with new lookup interface.
Diffstat (limited to 'src/main/java/com/c2kernel/utils/ObjectProperties.java')
| -rw-r--r-- | src/main/java/com/c2kernel/utils/ObjectProperties.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/com/c2kernel/utils/ObjectProperties.java b/src/main/java/com/c2kernel/utils/ObjectProperties.java index 1e9db8b..731b009 100644 --- a/src/main/java/com/c2kernel/utils/ObjectProperties.java +++ b/src/main/java/com/c2kernel/utils/ObjectProperties.java @@ -151,11 +151,17 @@ public class ObjectProperties extends Properties { }
}
- public Object getInstance(String propName) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
- Object prop = getObject(propName);
+ public Object getInstance(String propName, Object defaultVal) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+ Object prop = getObject(propName, defaultVal);
+ if (prop == null || prop.equals(""))
+ throw new InstantiationException("Property '"+propName+"' was not defined. Cannot instantiate.");
if (prop instanceof String)
return Class.forName((String)prop).newInstance();
return prop;
+ }
+
+ public Object getInstance(String propName) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+ return getInstance(propName, null);
}
}
|
