X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Forg%2FOrganizationFactory.java;h=4f2ba4f22d6d855676bea1f8a3fe1ed904502036;hb=3d1706fcbe7f95830ff6fd23cf679ee55c6d0595;hp=332018640f58fa9fffc4f0549d9640a6e472b3d7;hpb=adfe545fbfb2bf2279ed51137f8c86ca2fb35203;p=aaf%2Fauthz.git diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java index 33201864..4f2ba4f2 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java @@ -28,6 +28,7 @@ import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; import org.onap.aaf.auth.env.AuthzTrans; +import org.onap.aaf.cadi.config.Config; import org.onap.aaf.cadi.util.FQI; import org.onap.aaf.cadi.util.Split; import org.onap.aaf.misc.env.Env; @@ -62,6 +63,17 @@ public class OrganizationFactory { } } } + if(firstOrg==null) { // attempt to load DefaultOrg + try { + Class cls = Class.forName("org.onap.aaf.org.DefaultOrg"); + @SuppressWarnings("unchecked") + Constructor cnst = (Constructor)cls.getConstructor(Env.class,String.class); + String realm = env.getProperty(Config.AAF_DEFAULT_REALM,"people.osaaf.org"); + defaultOrg = cnst.newInstance(env,realm); + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException e) { + env.init().log("Default Organization Module not linked in",e); + } + } if (defaultOrg == null) { defaultOrg = firstOrg; } @@ -80,7 +92,7 @@ public class OrganizationFactory { String orgClass = env.getProperty(ORGANIZATION_DOT+orgNS); if (orgClass == null) { - env.warn().log("There is no Organization." + orgNS + " property"); + env.warn().printf("There is no Organization.%s property",orgNS); } else { try { Class orgCls = Class.forName(orgClass);