- private PropAccess access;
- private AAFCon<?> acon;
- private AAFAuthn<?> authn;
- private HashSet<Class<? extends AuthenticationToken>> supports;
- private AAFLurPerm authz;
- private MapBathConverter mbc;
- private Map<String,String> idMap;
-
-
- /**
- *
- * There appears to be no configuration objects or references available for CADI to start with.
- *
- */
- public AAFRealm () {
- access = new PropAccess(); // pick up cadi_prop_files from VM_Args
- mbc = null;
- idMap = null;
- String cadi_prop_files = access.getProperty(Config.CADI_PROP_FILES);
- if(cadi_prop_files==null) {
- String msg = Config.CADI_PROP_FILES + " in VM Args is required to initialize AAFRealm.";
- logger.info(msg);
- throw new RuntimeException(msg);
- } else {
- try {
- acon = AAFCon.newInstance(access);
- authn = acon.newAuthn();
- authz = acon.newLur(authn);
-
- final String csv = access.getProperty(Config.CADI_BATH_CONVERT);
- if(csv!=null) {
- try {
- mbc = new MapBathConverter(access, new CSV(csv));
- logger.info("MapBathConversion enabled with file "+csv);
- idMap = new TreeMap<String,String>();
- // Load
- for(Entry<String, String> es : mbc.map().entrySet()) {
- String oldID = es.getKey();
- if(oldID.startsWith("Basic ")) {
- oldID = Symm.base64noSplit.decode(oldID.substring(6));
- int idx = oldID.indexOf(':');
- if(idx>=0) {
- oldID = oldID.substring(0, idx);
+ private static class Singleton {
+ private AAFCon<?> acon;
+ private AAFAuthn<?> authn;
+ private Set<Class<? extends AuthenticationToken>> supports;
+ private AAFLurPerm authz;
+ private MapBathConverter mbc;
+ private Map<String,String> idMap;
+ private Singleton() {
+ mbc = null;
+ idMap = null;
+ String cadi_prop_files = access.getProperty(Config.CADI_PROP_FILES);
+ if(cadi_prop_files==null) {
+ String msg = Config.CADI_PROP_FILES + " in VM Args is required to initialize AAFRealm.";
+ access.log(Level.INFO,msg);
+ throw new RuntimeException(msg);
+ } else {
+ try {
+ acon = AAFCon.newInstance(access);
+ authn = acon.newAuthn();
+ authz = acon.newLur(authn);
+
+ final String csv = access.getProperty(Config.CADI_BATH_CONVERT);
+ if(csv!=null) {
+ try {
+ mbc = new MapBathConverter(access, new CSV(csv));
+ access.log(Level.INFO, "MapBathConversion enabled with file ",csv);
+ idMap = new ConcurrentHashMap<String,String>();
+ // Load
+ for(Entry<String, String> es : mbc.map().entrySet()) {
+ String oldID = es.getKey();
+ if(oldID.startsWith("Basic ")) {
+ oldID = Symm.base64noSplit.decode(oldID.substring(6));
+ int idx = oldID.indexOf(':');
+ if(idx>=0) {
+ oldID = oldID.substring(0, idx);
+ }