From e2fa0e67712b92c69f6863afe10c1c973a068e3e Mon Sep 17 00:00:00 2001 From: Instrumental Date: Thu, 7 Feb 2019 11:09:32 -0600 Subject: Add Batch in Config image Change Images to run as aaf Issue-ID: AAF-740 Change-Id: If5b8583dc19ac4095ba9b25715e9330d2a0ed5fc Signed-off-by: Instrumental --- .../main/java/org/onap/aaf/auth/org/OrganizationFactory.java | 12 ++++++++++++ .../java/org/onap/aaf/auth/server/AbsServiceStarter.java | 8 +++++--- .../java/org/onap/aaf/auth/server/JettyServiceStarter.java | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) (limited to 'auth/auth-core/src/main') 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..40c8c2d3 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) { + throw new OrganizationException("At least one Organization must be defined",e); + } + } if (defaultOrg == null) { defaultOrg = firstOrg; } diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java index 8f0eb8aa..1bc367e6 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java @@ -41,13 +41,15 @@ public abstract class AbsServiceStarter service; - public AbsServiceStarter(final AbsService service) { + public AbsServiceStarter(final AbsService service, boolean noexit) { this.service = service; try { OrganizationFactory.init(service.env); } catch (OrganizationException e) { - service.access.log(e, "Missing defined Organzation Plugins"); - System.exit(3); + service.access.log(e, "Missing defined Organization Plugins"); + if(!noexit) { + System.exit(3); + } } // do_register - this is used for specialty Debug Situations. Developer can create an Instance for a remote system // for Debugging purposes without fear that real clients will start to call your debug instance diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java index 413b7919..98503d11 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java @@ -59,7 +59,7 @@ public class JettyServiceStarter ex private boolean secure; public JettyServiceStarter(final AbsService service) throws OrganizationException { - super(service); + super(service,false); secure = true; } -- cgit 1.2.3-korg