JettyStartups to improve new Filters
[aaf/authz.git] / auth / auth-core / src / main / java / org / onap / aaf / auth / server / AbsService.java
index e1c0171..af6c88d 100644 (file)
@@ -22,6 +22,7 @@
 package org.onap.aaf.auth.server;
 
 import java.security.NoSuchAlgorithmException;
+import java.util.Properties;
 
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLSocketFactory;
@@ -103,8 +104,18 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
                }
     }
 
-       public abstract Filter[] filters() throws CadiException,  LocatorException;
-
+       protected abstract Filter[] _filters(Object ... additionalTafLurs) throws CadiException,  LocatorException;
+       
+       /**
+        * Overload this method to add new TAF or LURs
+        * 
+        * @return
+        * @throws CadiException
+        * @throws LocatorException
+        */
+       public Filter[] filters() throws CadiException,  LocatorException {
+               return _filters();
+       }
 
     public abstract Registrant<ENV>[] registrants(final int port) throws CadiException, LocatorException;
 
@@ -153,4 +164,26 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
        public<RET> RET clientAsUser(TaggedPrincipal p,Retryable<RET> retryable) throws APIException, LocatorException, CadiException  {
                        return aafCon.hman().best(new HTransferSS(p,app_name, aafCon.securityInfo()), retryable);
        }
+       
+       protected static final String loadFromArgOrSystem(final Properties props, final String tag, final String args[], final String def) {
+               String tagEQ = tag + '=';
+               String value;
+               for(String arg : args) {
+                       if(arg.startsWith(tagEQ)) {
+                               props.put(tag, value=arg.substring(tagEQ.length()));
+                               return value;
+                       }
+               }
+               // check System.properties
+               value = System.getProperty(tag);
+               if(value!=null) { 
+                       props.put(tag, value);
+                       return value;
+               }
+               
+               if(def!=null) {
+                       props.put(tag,def);
+               }
+               return def;
+       }
 }