X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fserver%2FJettyServiceStarter.java;h=78a7702b8d9f010fc94319aa8902944bf36f3bd3;hb=3d1706fcbe7f95830ff6fd23cf679ee55c6d0595;hp=413b791985beed535a7b286fa7a32446b2d344ec;hpb=39596f5b6d2c67d8c2b357243ecfb2dd6d746796;p=aaf%2Fauthz.git 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..78a7702b 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 @@ -21,7 +21,6 @@ package org.onap.aaf.auth.server; import java.io.IOException; -import java.net.Inet4Address; import java.net.InetAddress; import java.util.Properties; @@ -45,34 +44,21 @@ import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.onap.aaf.auth.org.OrganizationException; import org.onap.aaf.auth.rserv.RServlet; +import org.onap.aaf.cadi.Access.Level; import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.LocatorException; -import org.onap.aaf.cadi.Access.Level; import org.onap.aaf.cadi.config.Config; -import org.onap.aaf.cadi.config.SecurityInfo; import org.onap.aaf.misc.env.Trans; import org.onap.aaf.misc.env.util.Split; import org.onap.aaf.misc.rosetta.env.RosettaEnv; public class JettyServiceStarter extends AbsServiceStarter { - private boolean secure; - public JettyServiceStarter(final AbsService service) throws OrganizationException { - super(service); - secure = true; + public JettyServiceStarter(final AbsService service, boolean secure) throws OrganizationException { + super(service, secure); } - /** - * Specifically set this Service starter to Insecure (HTTP) Mode. - * @return - */ - public JettyServiceStarter insecure() { - secure = false; - return this; - } - - @Override public void _propertyAdjustment() { // System.setProperty("com.sun.management.jmxremote.port", "8081"); @@ -81,7 +67,7 @@ public class JettyServiceStarter ex // Critical - if no Security Protocols set, then set it. We'll just get messed up if not if ((httpproto=props.get(Config.CADI_PROTOCOLS))==null) { if ((httpproto=props.get(Config.HTTPS_PROTOCOLS))==null) { - props.put(Config.CADI_PROTOCOLS, (httpproto=SecurityInfo.HTTPS_PROTOCOLS_DEFAULT)); + props.put(Config.CADI_PROTOCOLS, (httpproto=Config.HTTPS_PROTOCOLS_DEFAULT)); } else { props.put(Config.CADI_PROTOCOLS, httpproto); } @@ -94,10 +80,6 @@ public class JettyServiceStarter ex @Override public void _start(RServlet rserv) throws Exception { - String hostname = access().getProperty(Config.HOSTNAME, null); - if (hostname==null) { - hostname = Inet4Address.getLocalHost().getHostName(); - } final int port = Integer.parseInt(access().getProperty("port","0")); final String keystore = access().getProperty(Config.CADI_KEYSTORE, null); final int IDLE_TIMEOUT = Integer.parseInt(access().getProperty(Config.AAF_CONN_IDLE_TIMEOUT, Config.AAF_CONN_IDLE_TIMEOUT_DEF)); @@ -133,7 +115,7 @@ public class JettyServiceStarter ex sslContextFactory.setTrustStorePassword(access().decrypt(truststorePassword, false)); } // Be able to accept only certain protocols, i.e. TLSv1.1+ - String subprotocols = access().getProperty(Config.CADI_PROTOCOLS, SecurityInfo.HTTPS_PROTOCOLS_DEFAULT); + String subprotocols = access().getProperty(Config.CADI_PROTOCOLS, Config.HTTPS_PROTOCOLS_DEFAULT); service.setSubprotocol(subprotocols); final String[] protocols = Split.splitTrim(',', subprotocols); sslContextFactory.setIncludeProtocols(protocols); @@ -202,7 +184,7 @@ public class JettyServiceStarter ex ); try { - access().printf(Level.INIT, "Starting service on %s:%d (%s)",hostname,port,InetAddress.getLocalHost().getHostAddress()); + access().printf(Level.INIT, "Starting service on %s:%d (%s)",hostname,port,InetAddress.getByName(hostname).getHostAddress()); server.start(); access().log(Level.INIT,server.dump()); } catch (Exception e) { @@ -215,9 +197,15 @@ public class JettyServiceStarter ex } } try { - register(service.registrants(port)); + String no_register = env().getProperty("aaf_no_register",null); + if(no_register==null) { + register(service.registrants(port)); + } else { + access().printf(Level.INIT,"'aaf_no_register' is set. %s will not be registered with Locator", service.app_name); + } access().printf(Level.INIT, "Starting Jetty Service for %s, version %s, on %s://%s:%d", service.app_name,service.app_version,protocol,hostname,port); - //server.join(); + + rserv.postStartup(hostname, port); } catch (Exception e) { access().log(e,"Error registering " + service.app_name); String doExit = access().getProperty("cadi_exitOnFailure", "true");