summaryrefslogtreecommitdiffstats
path: root/auth/auth-core/src/main
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2019-10-15 08:19:50 -0500
committerInstrumental <jonathan.gathman@att.com>2019-10-15 08:35:35 -0500
commit1296352d8eafee57f982a4342ad79ada4aa56d28 (patch)
tree355cdb89d85530a861319f892b0f24236e6adc50 /auth/auth-core/src/main
parentbdce7667a6e272e2fa32e298d957a0d9090c5bc9 (diff)
Sonar Fixes, Formatting
Issue-ID: AAF-1019 Change-Id: Ica49d9e7323aad9622ff9d95cc21b87430c22c54 Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/auth-core/src/main')
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/cache/Cache.java36
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java14
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java34
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTrans.java24
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java20
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java30
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java8
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java14
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/layer/DirectIntrospectImpl.java4
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/layer/FacadeImpl.java6
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java46
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java30
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/local/DataFile.java30
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java42
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/log4j/Log4JAccessAppender.java4
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/EmailWarnings.java4
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/Executor.java8
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/FileMailer.java18
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/Mailer.java10
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java176
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationException.java6
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java20
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java28
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java110
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CodeSetter.java8
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Content.java22
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpCode.java36
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpMethods.java4
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Match.java42
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Pair.java12
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RServlet.java20
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java20
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RouteReport.java4
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java18
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java28
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransOnlyFilter.java14
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java48
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Version.java10
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/doc/ApiDoc.java6
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java32
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java22
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java46
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java16
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/ServiceStarter.java4
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java12
45 files changed, 573 insertions, 573 deletions
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/cache/Cache.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/cache/Cache.java
index 6a8ccf1e..ca387dc5 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/cache/Cache.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/cache/Cache.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,7 @@ import org.onap.aaf.misc.env.Trans;
/**
* Create and maintain a Map of Maps used for Caching
- *
+ *
* @author Jonathan
*
* @param <TRANS>
@@ -58,7 +58,7 @@ public class Cache<TRANS extends Trans, DATA> {
/**
* Dated Class - store any Data with timestamp
- *
+ *
* @author Jonathan
*
*/
@@ -66,7 +66,7 @@ public class Cache<TRANS extends Trans, DATA> {
public Date timestamp;
public List<?> data;
private long expireIn;
-
+
public Dated(List<?> data, long expireIn) {
timestamp = new Date(System.currentTimeMillis()+expireIn);
this.data = data;
@@ -85,7 +85,7 @@ public class Cache<TRANS extends Trans, DATA> {
timestamp = new Date(System.currentTimeMillis()+expireIn);
}
}
-
+
public static Map<String,Dated> obtain(String key) {
Map<String, Dated> m = cacheMap.get(key);
if (m==null) {
@@ -99,24 +99,24 @@ public class Cache<TRANS extends Trans, DATA> {
/**
* Clean will examine resources, and remove those that have expired.
- *
+ *
* If "highs" have been exceeded, then we'll expire 10% more the next time. This will adjust after each run
* without checking contents more than once, making a good average "high" in the minimum speed.
- *
+ *
* @author Jonathan
*
*/
private static final class Clean extends TimerTask {
private final Env env;
private Set<String> set;
-
- // The idea here is to not be too restrictive on a high, but to Expire more items by
+
+ // The idea here is to not be too restrictive on a high, but to Expire more items by
// shortening the time to expire. This is done by judiciously incrementing "advance"
// when the "highs" are exceeded. This effectively reduces numbers of cached items quickly.
private final int high;
private long advance;
private final long timeInterval;
-
+
public Clean(Env env, long cleanInterval, int highCount) {
this.env = env;
high = highCount;
@@ -124,7 +124,7 @@ public class Cache<TRANS extends Trans, DATA> {
advance = 0;
set = new HashSet<>();
}
-
+
public synchronized void add(String key) {
set.add(key);
}
@@ -134,8 +134,8 @@ public class Cache<TRANS extends Trans, DATA> {
int total = 0;
// look at now. If we need to expire more by increasing "now" by "advance"
Date now = new Date(System.currentTimeMillis() + advance);
-
-
+
+
for (String name : set) {
Map<String,Dated> map = cacheMap.get(name);
if (map==null) {
@@ -150,7 +150,7 @@ public class Cache<TRANS extends Trans, DATA> {
}
}
}
-
+
if (count>0) {
env.debug().log("Cache removed",count,"expired Cached Elements out of", total);
}
@@ -170,11 +170,11 @@ public class Cache<TRANS extends Trans, DATA> {
public static synchronized void startCleansing(Env env, String ... keys) {
if (cleanseTimer==null) {
cleanseTimer = new Timer("Cache Cleanup Timer");
- int cleanInterval = Integer.parseInt(env.getProperty(CACHE_CLEAN_INTERVAL,"60000")); // 1 minute clean cycles
+ int cleanInterval = Integer.parseInt(env.getProperty(CACHE_CLEAN_INTERVAL,"60000")); // 1 minute clean cycles
int highCount = Integer.parseInt(env.getProperty(CACHE_HIGH_COUNT,"5000"));
cleanseTimer.schedule(clean = new Clean(env, cleanInterval, highCount), cleanInterval, cleanInterval);
}
-
+
for (String key : keys) {
clean.add(key);
}
@@ -193,7 +193,7 @@ public class Cache<TRANS extends Trans, DATA> {
public void run() {
Cache.stopTimer();
}
- });
+ });
}
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java
index 5fb590c1..77d9e8a0 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java
@@ -7,9 +7,9 @@
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
- * *
+ * *
* * http://www.apache.org/licenses/LICENSE-2.0
- * *
+ * *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -44,14 +44,14 @@ public class Define {
}
return ROOT_NS;
}
-
+
public static String ROOT_COMPANY() {
if (ROOT_NS==null) {
throw new RuntimeException(Define.class.getName() + MSG);
}
return ROOT_COMPANY;
}
-
+
public static void set(Access access) throws CadiException {
ROOT_NS = access.getProperty(Config.AAF_ROOT_NS,"org.osaaf.aaf");
ROOT_COMPANY = access.getProperty(Config.AAF_ROOT_COMPANY,null);
@@ -63,7 +63,7 @@ public class Define {
throw new CadiException(Config.AAF_ROOT_COMPANY + " or " + Config.AAF_ROOT_NS + " property with 3 positions is required.");
}
}
-
+
for ( Entry<Object, Object> es : access.getProperties().entrySet()) {
if (es.getKey().toString().startsWith(ROOT_NS_TAG_DOT)) {
access.getProperties().setProperty(es.getKey().toString(),varReplace(es.getValue().toString()));
@@ -90,7 +90,7 @@ public class Define {
public static boolean isInitialized() {
return initialized;
}
-
+
public static String getCredType(int type) {
switch(type) {
case 0: return "NoCrd";
@@ -102,5 +102,5 @@ public class Define {
return "n/a";
}
}
-
+
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java
index a46be8ef..0e2d4145 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,10 +39,10 @@ import org.onap.aaf.misc.rosetta.env.RosettaEnv;
/**
* AuthzEnv is the Env tailored to Authz Service
- *
+ *
* Most of it is derived from RosettaEnv, but it also implements Access, which
* is an Interface that Allows CADI to interact with Container Logging
- *
+ *
* @author Jonathan
*
*/
@@ -65,14 +65,14 @@ public class AuthzEnv extends RosettaEnv implements Access {
super();
_init(new PropAccess(props));
}
-
+
public AuthzEnv(PropAccess pa) {
super();
_init(pa);
}
-
- private final void _init(PropAccess pa) {
+
+ private final void _init(PropAccess pa) {
access = pa;
times = new long[20];
idx = 0;
@@ -85,16 +85,16 @@ public class AuthzEnv extends RosettaEnv implements Access {
debug = new AccessLogTarget(access, Level.DEBUG);
trace = new AccessLogTarget(access, Level.TRACE);
}
-
+
private class AccessLogTarget implements LogTarget {
private final Level level;
private final Access access;
-
+
public AccessLogTarget(final Access access, final Level level) {
this.level = level;
this.access = access;
}
-
+
@Override
public void log(Object... msgs) {
access.log(level, msgs);
@@ -117,7 +117,7 @@ public class AuthzEnv extends RosettaEnv implements Access {
public void printf(String fmt, Object... vars) {
access.printf(level, fmt, vars);
}
-
+
}
@Override
public AuthzTransImpl newTrans() {
@@ -146,7 +146,7 @@ public class AuthzEnv extends RosettaEnv implements Access {
++count;
pot += times[i]-prev;
}
- prev = times[i];
+ prev = times[i];
}
}
for (int i=0;i<idx;++i) {
@@ -155,13 +155,13 @@ public class AuthzEnv extends RosettaEnv implements Access {
++count;
pot += times[i]-prev;
}
- prev = times[i];
+ prev = times[i];
}
}
return count==0?300000L:pot/count; // Return Weighted Avg, or 5 mins, if none avail.
}
-
+
@Override
public ClassLoader classLoader() {
return getClass().getClassLoader();
@@ -199,7 +199,7 @@ public class AuthzEnv extends RosettaEnv implements Access {
public void setLogLevel(Level level) {
access.setLogLevel(level);
}
-
+
private static final byte[] ENC="enc:".getBytes();
public String decrypt(String encrypted, final boolean anytext) throws IOException {
if (encrypted==null) {
@@ -237,7 +237,7 @@ public class AuthzEnv extends RosettaEnv implements Access {
return "";
}
}
-
+
};
}
return decryptor.decrypt(encrypted);
@@ -290,5 +290,5 @@ public class AuthzEnv extends RosettaEnv implements Access {
public Properties getProperties() {
return access.getProperties();
};
-
+
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTrans.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTrans.java
index ac16833d..934b8417 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTrans.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTrans.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -45,13 +45,13 @@ public interface AuthzTrans extends TransStore {
public abstract AuthzTrans set(HttpServletRequest req, HttpServletResponse resp);
public abstract HttpServletRequest hreq();
-
+
public abstract HttpServletResponse hresp();
public abstract String user();
public abstract void setUser(TaggedPrincipal p);
-
+
public abstract TaggedPrincipal getUserPrincipal();
public abstract String ip();
@@ -63,27 +63,27 @@ public interface AuthzTrans extends TransStore {
public abstract String path();
public abstract String agent();
-
+
public abstract AuthzEnv env();
public abstract void setLur(Lur lur);
-
+
public abstract Lur getLur();
public abstract boolean fish(Permission ... p);
-
+
public abstract Organization org();
public abstract boolean requested(REQD_TYPE requested);
-
+
public void requested(REQD_TYPE requested, boolean b);
-
+
public abstract void logAuditTrail(LogTarget lt);
-
+
public abstract Date now();
-
+
public abstract void setTag(String tag);
-
+
public abstract String getTag();
public abstract void clearCache();
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java
index bd9f8875..e78a4889 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -48,7 +48,7 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
public static final String SPECIAL_LOG_SLOT = "SPECIAL_LOG_SLOT";
public static final int BUCKETSIZE = 2;
-
+
public AuthzTransFilter(AuthzEnv env, Connector con, TrustChecker tc, Object ... additionalTafLurs) throws CadiException, LocatorException {
super(env.access(),con, tc, additionalTafLurs);
this.env = env;
@@ -61,7 +61,7 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
specialLogSlot = env.slot(SPECIAL_LOG_SLOT);
}
}
-
+
@Override
protected AuthzTrans newTrans(HttpServletRequest req, HttpServletResponse resp) {
AuthzTrans at = env.newTrans();
@@ -87,7 +87,7 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
protected void tallyHo(AuthzTrans trans, String target) {
Boolean b = trans.get(specialLogSlot, false);
LogTarget lt = b?trans.warn():trans.debug();
-
+
if (lt.isLoggable()) {
// Transaction is done, now post full Audit Trail
StringBuilder sb = new StringBuilder("AuditTrail\n");
@@ -100,7 +100,7 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
for (int i=0;i<serviceMetric.buckets.length;++i) {
serviceMetric.buckets[i]+=m.buckets[i];
}
-
+
Long tsi;
if ((tsi=trans.get(transIDslot, null))!=null) {
sb.append(" TraceID=");
@@ -118,14 +118,14 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
} else {
// Single Line entry
// IMPORTANT!!! if you add more entries here, change "BUCKETSIZE"!!!
- StringBuilder content = new StringBuilder();
+ StringBuilder content = new StringBuilder();
Metric m = trans.auditTrail(lt,1, content, Env.REMOTE,Env.JSON);
// Add current Metrics to total metrics
serviceMetric.total+= m.total;
for (int i=0;i<serviceMetric.buckets.length;++i) {
serviceMetric.buckets[i]+=m.buckets[i];
}
-
+
StringBuilder sb = new StringBuilder();
sb.append("user=");
Principal p = trans.getUserPrincipal();
@@ -140,7 +140,7 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
sb.append('(');
sb.append(((TrustPrincipal)p).personalName()); // UserChain
sb.append(')');
- } else {
+ } else {
sb.append('[');
if (p instanceof TaggedPrincipal) {
sb.append(((TaggedPrincipal)p).tag());
@@ -184,7 +184,7 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
}
sb.append('"');
}
-
+
lt.log(sb);
}
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java
index 037ce4ee..c3d0298d 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -60,7 +60,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
hreq = req;
hresp = resp;
user = (TaggedPrincipal)req.getUserPrincipal();
-
+
for (REQD_TYPE rt : REQD_TYPE.values()) {
requested(rt,req);
}
@@ -73,7 +73,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
org=null;
return this;
}
-
+
@Override
public HttpServletRequest hreq() {
return hreq;
@@ -96,7 +96,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
public String user() {
return user==null?N_A:user.getName();
}
-
+
/**
* @see org.onap.aaf.auth.env.test.AuthTrans#getUserPrincipal()
*/
@@ -150,12 +150,12 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
public AuthzEnv env() {
return (AuthzEnv)delegate;
}
-
+
@Override
public boolean requested(REQD_TYPE requested) {
return (mask&requested.bit)==requested.bit;
}
-
+
public void requested(REQD_TYPE requested, boolean b) {
if (b) {
mask|=requested.bit;
@@ -163,7 +163,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
mask&=~requested.bit;
}
}
-
+
private void requested(REQD_TYPE reqtype, HttpServletRequest req) {
String p = req.getParameter(reqtype.name());
if (p!=null) {
@@ -175,12 +175,12 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
public void setLur(Lur lur) {
this.lur = lur;
}
-
+
@Override
public Lur getLur() {
- return lur;
+ return lur;
}
-
+
@Override
public boolean fish(Permission ... pond) {
if (lur!=null) {
@@ -188,7 +188,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
}
return false;
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.env.test.AuthzTrans#org()
*/
@@ -200,10 +200,10 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
org = Organization.NULL;
}
} catch (Exception e) {
-
+
org = Organization.NULL;
}
- }
+ }
return org;
}
@@ -229,7 +229,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
}
return now;
}
-
+
/*
* (non-Javadoc)
* @see org.onap.aaf.auth.env.AuthzTrans#setTag(java.lang.String)
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java
index 5545c7da..396f0d11 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,9 +39,9 @@ public class AuthzTransOnlyFilter extends TransOnlyFilter<AuthzTrans> {
public AuthzTransOnlyFilter(AuthzEnv env) {
this.env = env;
serviceMetric = new Metric();
- serviceMetric.buckets = new float[BUCKETSIZE];
+ serviceMetric.buckets = new float[BUCKETSIZE];
}
-
+
@Override
protected AuthzTrans newTrans(HttpServletRequest req, HttpServletResponse resp) {
AuthzTrans trans = env.newTrans();
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java
index df086cda..a10cae9c 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -42,13 +42,13 @@ import org.onap.aaf.misc.env.TimeTaken;
*/
public class NullTrans implements AuthzTrans {
private static final AuthzTrans singleton = new NullTrans();
-
+
public static final AuthzTrans singleton() {
return singleton;
}
private Date now;
-
+
public void checkpoint(String text) {}
public void checkpoint(String text, int additionalFlag) {}
public Metric auditTrail(int indent, StringBuilder sb, int... flag) {return null;}
@@ -144,7 +144,7 @@ public class NullTrans implements AuthzTrans {
public HttpServletResponse hresp() {
return null;
}
-
+
@Override
public String user() {
@@ -159,7 +159,7 @@ public class NullTrans implements AuthzTrans {
@Override
public void setUser(TaggedPrincipal p) {
}
-
+
@Override
public String ip() {
return null;
@@ -209,7 +209,7 @@ public class NullTrans implements AuthzTrans {
@Override
public Lur getLur() {
- return null;
+ return null;
}
@Override
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/DirectIntrospectImpl.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/DirectIntrospectImpl.java
index 41f0e74a..dd3a14d9 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/DirectIntrospectImpl.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/DirectIntrospectImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/FacadeImpl.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/FacadeImpl.java
index c81504b6..a80ad26f 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/FacadeImpl.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/FacadeImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,7 +34,7 @@ public abstract class FacadeImpl {
protected void setContentType(HttpServletResponse response, TYPE type) {
response.setContentType(type==Data.TYPE.JSON?"application/json":"text.xml");
}
-
+
protected void setCacheControlOff(HttpServletResponse response) {
response.setHeader("Cache-Control", "no-store");
response.setHeader("Pragma", "no-cache");
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java
index 9d7347ac..9050553c 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,7 +28,7 @@ import java.util.Set;
/**
* It would be nice if Java Enums were extensible, but they're not.
- *
+ *
* @author Jonathan
*
*/
@@ -47,12 +47,12 @@ public class Result<RV> {
ERR_ActionNotCompleted = 8,
ERR_Backend = 9,
ERR_General = 20;
-
+
public RV value;
public final int status;
public final String details;
public final Object[] variables;
-
+
public Result(RV value, int status, String details, Object ... variables) {
this.value = value;
if (value==null) {
@@ -66,12 +66,12 @@ public class Result<RV> {
this.variables=variables;
}
}
-
+
/**
* Create a Result class with "OK" status and "Success" for details
- *
+ *
* This is the easiest to use
- *
+ *
* @param value
* @param status
* @return
@@ -126,7 +126,7 @@ public class Result<RV> {
}
/**
- * Create a Status (usually non OK, with a details statement
+ * Create a Status (usually non OK, with a details statement
* @param value
* @param status
* @param details
@@ -135,7 +135,7 @@ public class Result<RV> {
// public static<R> Result<R> err(int status, String details) {
// return new Result<R>(null,status,details,null);
// }
-
+
/**
* Create a Status (usually non OK, with a details statement and variables supported
* @param status
@@ -166,7 +166,7 @@ public class Result<RV> {
}
/**
- * Create a Status (usually non OK, with a details statement
+ * Create a Status (usually non OK, with a details statement
* @param value
* @param status
* @param details
@@ -177,7 +177,7 @@ public class Result<RV> {
}
/**
- * Create a Status from a previous status' result/details
+ * Create a Status from a previous status' result/details
* @param value
* @param status
* @param details
@@ -189,10 +189,10 @@ public class Result<RV> {
private static final int PARTIAL_CONTENT = 0x001;
private static final int EMPTY_LIST = 0x002;
-
+
/**
- * AAF Specific problems, etc
- *
+ * AAF Specific problems, etc
+ *
* @author Jonathan
*
*/
@@ -227,7 +227,7 @@ public class Result<RV> {
/**
* When Result is a List, you can check here to see if it's empty instead of looping
- *
+ *
* @return
*/
public boolean isEmpty() {
@@ -237,7 +237,7 @@ public class Result<RV> {
/**
* A common occurrence is that data comes back, but list is empty. If set, you can skip looking
* at list at the outset.
- *
+ *
* @param emptyList
* @return
*/
@@ -250,8 +250,8 @@ public class Result<RV> {
return this;
}
-
- /**
+
+ /**
* Convenience function. Checks OK, and also if List is not Empty
* Not valid if Data is not a List
* @return
@@ -260,7 +260,7 @@ public class Result<RV> {
return status == OK;
}
- /**
+ /**
* Convenience function. Checks OK, and also if List is not Empty
* Not valid if Data is not a List
* @return
@@ -269,7 +269,7 @@ public class Result<RV> {
return status != OK;
}
- /**
+ /**
* Convenience function. Checks OK, and also if List is not Empty
* Not valid if Data is not a List
* @return
@@ -279,7 +279,7 @@ public class Result<RV> {
}
- /**
+ /**
* Convenience function. Checks OK, and also if List is not Empty
* Not valid if Data is not a List
* @return
@@ -307,7 +307,7 @@ public class Result<RV> {
return sb.toString();
}
}
-
+
public String errorString() {
StringBuilder sb = new StringBuilder();
switch(status) {
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java
index 6f644bd4..cdc0e486 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -55,21 +55,21 @@ public abstract class AbsData implements Iterable<String> {
this.fieldOffset = fieldOffset;
idxf = new File(dir,name.concat(".idx"));
lockf = new File(dir,name.concat(".lock"));
-
-
+
+
data = new DataFile(dataf,"r");
ti = new TextIndex(idxf);
skipLines=0;
}
-
+
public void skipLines(int lines) {
skipLines=lines;
}
-
+
public String name() {
return name;
}
-
+
public void open(AuthzTrans trans, long timeout) throws IOException {
TimeTaken tt = trans.start("Open Data File", Env.SUB);
boolean first = true;
@@ -84,7 +84,7 @@ public abstract class AbsData implements Iterable<String> {
if (first) {
trans.warn().log("Waiting for",lockf.getCanonicalPath(),"to close");
first = false;
- }
+ }
try {
Thread.sleep(200);
} catch (InterruptedException e) {
@@ -103,12 +103,12 @@ public abstract class AbsData implements Iterable<String> {
throw e;
}
ti.open();
-
+
} finally {
tt.done();
}
}
-
+
private synchronized void ensureIdxGood(AuthzTrans trans) throws IOException {
if (!idxf.exists() || idxf.length()==0 || dataf.lastModified()>idxf.lastModified()) {
trans.warn().log(idxf.getAbsolutePath(),"is missing, empty or out of date, creating");
@@ -129,7 +129,7 @@ public abstract class AbsData implements Iterable<String> {
ti.close();
data.close();
}
-
+
public class Reuse {
public Token tokenData;
private Field fieldData;
@@ -138,7 +138,7 @@ public abstract class AbsData implements Iterable<String> {
tokenData = data.new Token(size);
fieldData = tokenData.new Field(delim);
}
-
+
public void reset() {
getFieldData().reset();
}
@@ -151,7 +151,7 @@ public abstract class AbsData implements Iterable<String> {
public String next() {
return getFieldData().next();
}
-
+
public String at(int field) {
return getFieldData().at(field);
}
@@ -164,7 +164,7 @@ public abstract class AbsData implements Iterable<String> {
return fieldData;
}
}
-
+
public Reuse reuse() {
return new Reuse(maxLineSize,delim);
}
@@ -172,7 +172,7 @@ public abstract class AbsData implements Iterable<String> {
public Iter iterator() {
return new Iter();
}
-
+
public class Iter implements Iterator<String> {
private Reuse reuse;
private org.onap.aaf.auth.local.TextIndex.Iter tii;
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/DataFile.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/DataFile.java
index a65c13db..2ca6e1f9 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/DataFile.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/DataFile.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,7 @@ public class DataFile {
public MappedByteBuffer mapBuff;
private final File file;
private final String access;
-
+
public DataFile(File file, String access) {
this.file = file;
this.access = access;
@@ -73,21 +73,21 @@ public class DataFile {
}
return len<0?0:len;
}
-
+
public class Token {
private byte[] buff;
int pos, next, end;
-
+
public Token(int size) {
buff = new byte[size];
pos = next = end = 0;
}
-
+
public boolean pos(int to) {
pos = next = to;
return (end=load(this))>0;
}
-
+
public boolean nextLine() {
end = load(this);
pos = next;
@@ -100,7 +100,7 @@ public class DataFile {
}
return false;
}
-
+
public IntBuffer getIntBuffer() {
return ByteBuffer.wrap(buff).asIntBuffer();
}
@@ -108,7 +108,7 @@ public class DataFile {
public String toString() {
return new String(buff,0,end);
}
-
+
public class Field {
char delim;
int idx;
@@ -119,12 +119,12 @@ public class DataFile {
idx = 0;
bb = null;
}
-
+
public Field reset() {
idx = 0;
return this;
}
-
+
public String next() {
if (idx>=end)return null;
int start = idx;
@@ -134,7 +134,7 @@ public class DataFile {
if (c=='\r')endStr=idx;
++idx;
}
-
+
if (endStr<0) {
endStr=idx-start;
} else {
@@ -157,7 +157,7 @@ public class DataFile {
}
return new String(buff,start,(idx-start-(c=='\r'?1:0)));
}
-
+
public String atToEnd(int fieldOffset) {
int start;
byte c=0;
@@ -169,7 +169,7 @@ public class DataFile {
start = idx+1;
}
}
-
+
for (; idx<end && idx<buff.length && (c=buff[idx])!='\n'; ++idx) {
++idx;
}
@@ -186,5 +186,5 @@ public class DataFile {
public File file() {
return file;
}
-
+
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java
index 73ad07c7..b36ed4b9 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,19 +40,19 @@ import org.onap.aaf.misc.env.Trans;
public class TextIndex {
private static final int REC_SIZE=8;
-
+
private File file;
private DataFile dataFile=null;
-
+
public TextIndex(File theFile) {
file = theFile;
}
-
+
public void open() throws IOException {
dataFile = new DataFile(file,"r");
dataFile.open();
}
-
+
public void close() throws IOException {
if (dataFile!=null) {
dataFile.close();
@@ -63,7 +63,7 @@ public class TextIndex {
public int find(Object key, AbsData.Reuse reuse, int offset) throws IOException {
return find(key,reuse.tokenData,reuse.getFieldData(),offset);
}
-
+
public int find(Object key, DataFile.Token dtok, Field df, int offset) throws IOException {
if (dataFile==null) {
throw new IOException("File not opened");
@@ -88,7 +88,7 @@ public class TextIndex {
break;
}
}
-
+
List<Integer> entries = new ArrayList<>();
for (int i=min;i<=max;++i) {
ttok.pos(i*REC_SIZE);
@@ -100,7 +100,7 @@ public class TextIndex {
break;
}
}
-
+
for (Integer i : entries) {
dtok.pos(i);
if (df.at(offset).equals(key)) {
@@ -109,7 +109,7 @@ public class TextIndex {
}
return -1;
}
-
+
/*
* Have to change Bytes into a Long, to avoid the inevitable signs in the Hash
@@ -123,10 +123,10 @@ public class TextIndex {
}
return rv;
}
-
+
public void create(final Trans trans,final DataFile data, int maxLine, char delim, int fieldOffset, int skipLines) throws IOException {
FileChannel fos;
-
+
List<Idx> list = new LinkedList<>(); // Some hashcodes will double... DO NOT make a set
TimeTaken tt2 = trans.start("Open Files", Env.SUB);
RandomAccessFile raf=null;
@@ -138,12 +138,12 @@ public class TextIndex {
} finally {
tt2.done();
}
-
+
try {
-
- Token t = data.new Token(maxLine);
+
+ Token t = data.new Token(maxLine);
Field f = t.new Field(delim);
-
+
int count = 0;
if (skipLines>0) {
trans.info().log("Skipping",skipLines,"line"+(skipLines==1?" in":"s in"),data.file().getName());
@@ -184,14 +184,14 @@ public class TextIndex {
}
} finally {
fos.close();
- }
+ }
} finally {
if (raf!=null) {
raf.close(); // closed by fos
}
}
}
-
+
public class Iter {
private int idx;
private Token t;
@@ -210,7 +210,7 @@ public class TextIndex {
end = -1L;
}
}
-
+
public int next() {
t.pos(idx);
ib.clear();
@@ -224,14 +224,14 @@ public class TextIndex {
return idx<end;
}
}
-
+
private static class Idx implements Comparable<Idx> {
public int hash, pos;
public Idx(Object obj, int pos) {
hash = obj.hashCode();
this.pos = pos;
}
-
+
@Override
public int compareTo(Idx ib) {
long a = hashToLong(hash);
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/log4j/Log4JAccessAppender.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/log4j/Log4JAccessAppender.java
index 165295d9..7cb25c73 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/log4j/Log4JAccessAppender.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/log4j/Log4JAccessAppender.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/EmailWarnings.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/EmailWarnings.java
index 7084fbd8..be5d6e0e 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/EmailWarnings.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/EmailWarnings.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Executor.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Executor.java
index 48ac9dce..bfe588f3 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Executor.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Executor.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,9 +26,9 @@ public interface Executor {
// remove user from Admins
// if # of Owners > 1, remove User from Owner
// if # of Owners = 1, changeOwner to X Remove Owner????
- boolean hasPermission(String user, String ns, String type, String instance, String action);
+ boolean hasPermission(String user, String ns, String type, String instance, String action);
boolean inRole(String name);
-
+
public String namespace() throws Exception;
public String id();
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/FileMailer.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/FileMailer.java
index 9478832b..8896ca87 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/FileMailer.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/FileMailer.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,7 +41,7 @@ public class FileMailer implements Mailer {
public FileMailer(Access access) throws APIException {
count = 0;
-
+
mail_from = access.getProperty("MAIL_FROM", null);
if(mail_from==null) {
throw new APIException("MAIL_FROM property is required for Email Notifications");
@@ -59,7 +59,7 @@ public class FileMailer implements Mailer {
throw new APIException("Cannot create directory: " + dir.toString(),e);
}
}
-
+
boolean dryrun = Boolean.parseBoolean(access.getProperty("DRY_RUN","false"));
String str = access.getProperty("MAX_EMAIL", null);
int maxEmail = str==null || str.isEmpty()?Integer.MAX_VALUE:Integer.parseInt(str);
@@ -94,7 +94,7 @@ public class FileMailer implements Mailer {
bw.write(to);
}
bw.newLine();
-
+
bw.write("CC: ");
first = true;
for(String cc : ccList) {
@@ -106,17 +106,17 @@ public class FileMailer implements Mailer {
bw.write(cc);
}
bw.newLine();
-
+
bw.write("FROM: ");
bw.write(mail_from);
bw.newLine();
-
+
bw.write("SUBJECT: ");
bw.write(subject);
bw.newLine();
-
+
if(urgent) {
- bw.write("Importance: High");
+ bw.write("Importance: High");
bw.newLine();
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Mailer.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Mailer.java
index 64a2e8dd..ad1d5a23 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Mailer.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Mailer.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,9 +28,9 @@ public interface Mailer {
public boolean sendEmail(
AuthzTrans trans,
String test,
- List<String> toList,
- List<String> ccList,
- String subject,
+ List<String> toList,
+ List<String> ccList,
+ String subject,
String body,
Boolean urgent) throws OrganizationException;
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java
index 75669632..288d79d3 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,13 +32,13 @@ import org.onap.aaf.auth.env.AuthzTrans;
/**
* Organization
- *
+ *
* There is Organizational specific information required which we have extracted to a plugin
- *
+ *
* It supports using Company Specific User Directory lookups, as well as supporting an
* Approval/Validation Process to simplify control of Roles and Permissions for large organizations
- * in lieu of direct manipulation by a set of Admins.
- *
+ * in lieu of direct manipulation by a set of Admins.
+ *
* @author Jonathan
*
*/
@@ -55,7 +55,7 @@ public interface Organization {
public String fullName();
public String firstName();
/**
- * If Responsible entity, then String returned is "null" meaning "no Objection".
+ * If Responsible entity, then String returned is "null" meaning "no Objection".
* If String exists, it is the Policy objection text setup by the entity.
* @return
*/
@@ -90,7 +90,7 @@ public interface Organization {
* @return
*/
public String getRealm();
-
+
public boolean supportsRealm(String user);
public void addSupportedRealm(String r);
@@ -99,44 +99,44 @@ public interface Organization {
/**
* Get Identity information based on userID
- *
+ *
* @param id
* @return
*/
public Identity getIdentity(AuthzTrans trans, String id) throws OrganizationException;
-
+
/**
* Is Revoked
- *
- * Deletion of an Identity that has been removed from an Organization can be dangerous. Mistakes may have been made
- * in the Organization side, a Feed might be corrupted, an API might not be quite right.
- *
+ *
+ * Deletion of an Identity that has been removed from an Organization can be dangerous. Mistakes may have been made
+ * in the Organization side, a Feed might be corrupted, an API might not be quite right.
+ *
* The implementation of this method can use a double check of some sort, such as comparison of missing ID in Organization
- * feed with a "Deleted ID" feed.
- *
+ * feed with a "Deleted ID" feed.
+ *
*/
public boolean isRevoked(AuthzTrans trans, String id);
/**
* Does the ID pass Organization Standards
- *
- * Return a Blank (empty) String if empty, otherwise, return a "\n" separated list of
+ *
+ * Return a Blank (empty) String if empty, otherwise, return a "\n" separated list of
* reasons why it fails
- *
+ *
* @param id
* @return
*/
public String isValidID(AuthzTrans trans, String id);
/**
- * Return a Blank (empty) String if empty, otherwise, return a "\n" separated list of
+ * Return a Blank (empty) String if empty, otherwise, return a "\n" separated list of
* reasons why it fails
- *
+ *
* Identity is passed in to allow policies regarding passwords that are the same as user ID
- *
+ *
* any entries for "prev" imply a reset
- *
+ *
* @param id
* @param password
* @return
@@ -149,7 +149,7 @@ public interface Organization {
public String[] getPasswordRules();
/**
- *
+ *
* @param id
* @return
*/
@@ -157,7 +157,7 @@ public interface Organization {
/**
* If response is Null, then it is valid. Otherwise, the Organization specific reason is returned.
- *
+ *
* @param trans
* @param policy
* @param executor
@@ -169,7 +169,7 @@ public interface Organization {
/**
* Does your Company distinguish essential permission structures by kind of Identity?
- * i.e. Employee, Contractor, Vendor
+ * i.e. Employee, Contractor, Vendor
* @return
*/
public Set<String> getIdentityTypes();
@@ -198,30 +198,30 @@ public interface Organization {
ERR_UserNotExist,
ERR_NotificationFailure,
};
-
+
public enum Expiration {
Password,
- TempPassword,
+ TempPassword,
Future,
UserInRole,
- UserDelegate,
+ UserDelegate,
ExtendPassword
}
-
+
public enum Policy {
- CHANGE_JOB,
- LEFT_COMPANY,
- CREATE_MECHID,
+ CHANGE_JOB,
+ LEFT_COMPANY,
+ CREATE_MECHID,
CREATE_MECHID_BY_PERM_ONLY,
OWNS_MECHID,
- AS_RESPONSIBLE,
+ AS_RESPONSIBLE,
MAY_EXTEND_CRED_EXPIRES,
MAY_APPLY_DEFAULT_REALM
}
-
+
/**
* Notify a User of Action or Info
- *
+ *
* @param type
* @param url
* @param users (separated by commas)
@@ -233,7 +233,7 @@ public interface Organization {
/**
* (more) generic way to send an email
- *
+ *
* @param toList
* @param ccList
* @param subject
@@ -245,36 +245,36 @@ public interface Organization {
/**
* whenToValidate
- *
+ *
* Authz support services will ask the Organization Object at startup when it should
- * kickoff Validation processes given particular types.
- *
+ * kickoff Validation processes given particular types.
+ *
* This allows the Organization to express Policy
- *
+ *
* Turn off Validation behavior by returning "null"
- *
+ *
*/
public Date whenToValidate(Notify type, Date lastValidated);
-
+
/**
* Expiration
- *
+ *
* Given a Calendar item of Start (or now), set the Expiration Date based on the Policy
* based on type.
- *
+ *
* For instance, "Passwords expire in 3 months"
- *
+ *
* The Extra Parameter is used by certain Orgs.
- *
+ *
* For Password, the extra is UserID, so it can check the User Type
- *
+ *
* @param gc
* @param exp
* @return
*/
public GregorianCalendar expiration(GregorianCalendar gc, Expiration exp, String ... extra);
-
+
/**
* Get Email Warning timing policies
* @return
@@ -282,7 +282,7 @@ public interface Organization {
public EmailWarnings emailWarningPolicy();
/**
- *
+ *
* @param trans
* @param user
* @return
@@ -295,23 +295,23 @@ public interface Organization {
* 2 = expects both self and immediate responsible party
* 3 = expects self, immediate report and any higher that the Organization wants to escalate to in the
* hierarchy.
- *
+ *
* Note: this is used to notify of imminent danger of Application's Cred or Role expirations.
*/
public List<Identity> getIDs(AuthzTrans trans, String user, int escalate) throws OrganizationException ;
-
+
/*
- *
+ *
* @param user
* @param type
* @param users
* @return
public Response notifyRequest(AuthzTrans trans, String user, Approval type, List<User> approvers);
*/
-
+
/**
- *
+ *
* @return
*/
public String getApproverType();
@@ -319,7 +319,7 @@ public interface Organization {
/*
* startOfDay - define for company what hour of day business starts (specifically for password and other expiration which
* were set by Date only.)
- *
+ *
* @return
*/
public int startOfDay();
@@ -333,12 +333,12 @@ public interface Organization {
* @return
*/
public boolean canHaveMultipleCreds(String id);
-
+
boolean isTestEnv();
public void setTestMode(boolean dryRun);
- public static final Organization NULL = new Organization()
+ public static final Organization NULL = new Organization()
{
private final GregorianCalendar gc = new GregorianCalendar(1900, 1, 1);
private final List<Identity> nullList = new ArrayList<>();
@@ -355,27 +355,27 @@ public interface Organization {
public String mayOwn() {
return N_A; // negative case
}
-
+
@Override
public boolean isFound() {
return false;
}
-
+
@Override
public String id() {
return N_A;
}
-
+
@Override
public String fullID() {
return N_A;
}
-
+
@Override
public String email() {
return N_A;
}
-
+
@Override
public List<String> delegate() {
return nullUser;
@@ -406,12 +406,12 @@ public interface Organization {
public String getName() {
return N_A;
}
-
+
@Override
public String getRealm() {
return N_A;
}
-
+
@Override
public boolean supportsRealm(String r) {
return false;
@@ -425,87 +425,87 @@ public interface Organization {
public String getDomain() {
return N_A;
}
-
+
@Override
public Identity getIdentity(AuthzTrans trans, String id) {
return nullIdentity;
}
-
+
@Override
public String isValidID(final AuthzTrans trans, String id) {
return N_A;
}
-
+
@Override
public String isValidPassword(final AuthzTrans trans, final String user, final String password, final String... prev) {
return N_A;
}
-
+
@Override
public Set<String> getIdentityTypes() {
return nullStringSet;
}
-
+
@Override
public Response notify(AuthzTrans trans, Notify type, String url,
String[] users, String[] ccs, String summary, Boolean urgent) {
return Response.ERR_NotImplemented;
}
-
+
@Override
public int sendEmail(AuthzTrans trans, List<String> toList, List<String> ccList,
String subject, String body, Boolean urgent) throws OrganizationException {
return 0;
}
-
+
@Override
public Date whenToValidate(Notify type, Date lastValidated) {
return gc.getTime();
}
-
+
@Override
public GregorianCalendar expiration(GregorianCalendar gc,
Expiration exp, String... extra) {
return gc;
}
-
+
@Override
public List<Identity> getApprovers(AuthzTrans trans, String user)
throws OrganizationException {
return nullList;
}
-
+
@Override
public String getApproverType() {
return "";
}
-
+
@Override
public int startOfDay() {
return 0;
}
-
+
@Override
public boolean canHaveMultipleCreds(String id) {
return false;
}
-
+
@Override
public boolean isValidCred(final AuthzTrans trans, final String id) {
return false;
}
-
+
@Override
public String validate(AuthzTrans trans, Policy policy, Executor executor, String ... vars)
throws OrganizationException {
return "Null Organization rejects all Policies";
}
-
+
@Override
public boolean isTestEnv() {
return false;
}
-
+
@Override
public void setTestMode(boolean dryRun) {
}
@@ -519,24 +519,24 @@ public interface Organization {
{
return 604800000L; // 7 days in millis 1000 * 86400 * 7
}
-
+
@Override
public long roleEmailInterval()
{
return 604800000L; // 7 days in millis 1000 * 86400 * 7
}
-
+
@Override
public long apprEmailInterval() {
return 259200000L; // 3 days in millis 1000 * 86400 * 3
}
-
+
@Override
public long credExpirationWarning()
{
return( 2592000000L ); // One month, in milliseconds 1000 * 86400 * 30 in milliseconds
}
-
+
@Override
public long roleExpirationWarning()
{
@@ -550,15 +550,15 @@ public interface Organization {
}
};
-
+
}
@Override
public String[] getPasswordRules() {
- return nullStringArray;
+ return nullStringArray;
}
-
+
@Override
public boolean isRevoked(AuthzTrans trans, String id) {
// provide a corresponding feed that indicates that an ID has been intentionally removed from identities.dat table.
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationException.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationException.java
index 347e2d35..c291c65b 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationException.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationException.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,7 +24,7 @@ package org.onap.aaf.auth.org;
public class OrganizationException extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
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 2ada75d2..867d2984 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,10 +36,10 @@ import org.onap.aaf.misc.env.impl.BasicEnv;
/**
* Organization Plugin Mechanism
- *
- * Define a NameSpace for the company (i.e. com.att), and put in Properties as
- * "Organization.[your NS" and assign the supporting Class.
- *
+ *
+ * Define a NameSpace for the company (i.e. com.att), and put in Properties as
+ * "Organization.[your NS" and assign the supporting Class.
+ *
* Example:
* Organization.com.att=org.onap.aaf.auth.org.test.att.ATT
*
@@ -53,7 +53,7 @@ public class OrganizationFactory {
public static Organization init(BasicEnv env) throws OrganizationException {
int idx = ORGANIZATION_DOT.length();
Organization org,firstOrg = null;
-
+
for (Entry<Object, Object> es : env.getProperties().entrySet()) {
String key = es.getKey().toString();
if (key.startsWith(ORGANIZATION_DOT)) {
@@ -117,8 +117,8 @@ public class OrganizationFactory {
org.addSupportedRealm(r);
}
}
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException |
- InstantiationException | IllegalAccessException | IllegalArgumentException |
+ } catch (ClassNotFoundException | NoSuchMethodException | SecurityException |
+ InstantiationException | IllegalAccessException | IllegalArgumentException |
InvocationTargetException e) {
env.error().log(e, "Error on Organization Construction");
throw new OrganizationException(e);
@@ -138,7 +138,7 @@ public class OrganizationFactory {
}
}
}
-
+
return org;
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java
index 0e70e25e..bd718e46 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,7 +29,7 @@ import org.onap.aaf.misc.env.Trans;
/**
* Find Acceptable Paths and place them where TypeCode can evaluate.
- *
+ *
* If there are more than one, TypeCode will choose based on "q" value
* @author Jonathan
*
@@ -38,12 +38,12 @@ import org.onap.aaf.misc.env.Trans;
class Acceptor<TRANS extends Trans> {
private List<Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>>> types;
List<Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>>> acceptable;
-
+
public Acceptor(List<Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>>> types) {
this.types = types;
acceptable = new ArrayList<>();
}
-
+
private boolean eval(HttpCode<TRANS,?> code, String str, List<String> props) {
// int plus = str.indexOf('+');
// if (plus<0) {
@@ -67,7 +67,7 @@ class Acceptor<TRANS extends Trans> {
// String nstr;
// while (prev!=0) {
// nstr = first + (plus<0?str.substring(prev):str.substring(prev,plus));
-//
+//
// for (Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>> type : types) {
// if (type.x.equals(nstr)) {
// acceptable.add(type);
@@ -114,17 +114,17 @@ class Acceptor<TRANS extends Trans> {
}
/**
- * parse
- *
+ * parse
+ *
* Note: I'm processing by index to avoid lots of memory creation, which speeds things
- * up for this time critical section of code.
+ * up for this time critical section of code.
* @param code
* @param cntnt
* @return
*/
protected boolean parse(HttpCode<TRANS, ?> code, String cntnt) {
byte bytes[] = cntnt.getBytes();
-
+
int cis,cie=-1,cend;
int sis,sie,send;
String name;
@@ -133,17 +133,17 @@ class Acceptor<TRANS extends Trans> {
// Clear these in case more than one Semi
props.clear(); // on loop, do not want mixed properties
name=null;
-
+
cis = cie+1; // find comma start
while (cis<bytes.length && Character.isSpaceChar(bytes[cis]))++cis;
cie = cntnt.indexOf(',',cis); // find comma end
cend = cie<0?bytes.length:cie; // If no comma, set comma end to full length, else cie
while (cend>cis && Character.isSpaceChar(bytes[cend-1]))--cend;
// Start SEMIS
- sie=cis-1;
+ sie=cis-1;
do {
sis = sie+1; // semi start is one after previous end
- while (sis<bytes.length && Character.isSpaceChar(bytes[sis]))++sis;
+ while (sis<bytes.length && Character.isSpaceChar(bytes[sis]))++sis;
sie = cntnt.indexOf(';',sis);
send = sie>cend || sie<0?cend:sie; // if the Semicolon is after the comma, or non-existent, use comma end, else keep
while (send>sis && Character.isSpaceChar(bytes[send-1]))--send;
@@ -165,5 +165,5 @@ class Acceptor<TRANS extends Trans> {
} while (cie>=0); // loop to next comma
return false; // didn't get even one match
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java
index ac87d80e..3c76e928 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -55,15 +55,15 @@ import org.onap.aaf.misc.env.Store;
import org.onap.aaf.misc.env.Trans;
/*
* CachingFileAccess
- *
+ *
* Author: Jonathan Gathman, Gathsys 2010
- *
+ *
*/
public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void> {
public static void setEnv(Store store, String[] args) {
- for (int i=0;i<args.length-1;i+=2) { // cover two parms required for each
+ for (int i=0;i<args.length-1;i+=2) { // cover two parms required for each
if (CFA_WEB_PATH.equals(args[i])) {
- store.put(store.staticSlot(CFA_WEB_PATH), args[i+1]);
+ store.put(store.staticSlot(CFA_WEB_PATH), args[i+1]);
} else if (CFA_CACHE_CHECK_INTERVAL.equals(args[i])) {
store.put(store.staticSlot(CFA_CACHE_CHECK_INTERVAL), Long.parseLong(args[i+1]));
} else if (CFA_MAX_SIZE.equals(args[i])) {
@@ -71,7 +71,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
}
}
}
-
+
private static String MAX_AGE = "max-age=3600"; // 1 hour Caching
private final Map<String,String> typeMap;
private final NavigableMap<String,Content> content;
@@ -79,7 +79,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
public final static String CFA_WEB_PATH = "aaf_cfa_web_path";
// when to re-validate from file
// Re validating means comparing the Timestamp on the disk, and seeing it has changed. Cache is not marked
- // dirty unless file has changed, but it still makes File IO, which for some kinds of cached data, i.e.
+ // dirty unless file has changed, but it still makes File IO, which for some kinds of cached data, i.e.
// deployed GUI elements is unnecessary, and wastes time.
// This parameter exists to cover the cases where data can be more volatile, so the user can choose how often the
// File IO will be accessed, based on probability of change. "0", of course, means, check every time.
@@ -96,10 +96,10 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
private String web_path;
// A command key is set in the Properties, preferably changed on deployment.
// it is compared at the beginning of the path, and if so, it is assumed to issue certain commands
- // It's purpose is to protect, to some degree the command, even though it is HTTP, allowing
+ // It's purpose is to protect, to some degree the command, even though it is HTTP, allowing
// local batch files to, for instance, clear caches on resetting of files.
private String clear_command;
-
+
public CachingFileAccess(EnvJAXB env, String ... args) throws IOException {
super(null,"Caching File Access");
setEnv(env,args);
@@ -130,16 +130,16 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
typeMap.put("class", "application/java");
typeMap.put("props", "text/plain");
typeMap.put("jks", "application/octet-stream");
-
+
// Fonts
typeMap.put("ttf","font/ttf");
typeMap.put("woff","font/woff");
typeMap.put("woff2","font/woff2");
-
+
timer = new Timer("Caching Cleanup",true);
timer.schedule(new Cleanup(content,500),60000,60000);
-
+
// Property params
web_path = env.get(env.staticSlot(CFA_WEB_PATH));
env.init().log("CachingFileAccess path: " + new File(web_path).getCanonicalPath());
@@ -150,18 +150,18 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
} else {
checkInterval=Long.parseLong((String)obj);
}
-
+
obj = env.get(env.staticSlot(CFA_MAX_SIZE), 512000); // Default is max file 500k
if (obj instanceof Integer) {
maxItemSize=(Integer)obj;
} else {
maxItemSize =Integer.parseInt((String)obj);
}
-
+
clear_command = env.getProperty(CFA_CLEAR_COMMAND,null);
}
-
+
@Override
public void handle(TRANS trans, HttpServletRequest req, HttpServletResponse resp) throws IOException {
@@ -190,12 +190,12 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
public String webPath() {
return web_path;
}
-
+
/**
* Reset the Cleanup size and interval
- *
+ *
* The size and interval when started are 500 items (memory size unknown) checked every minute in a background thread.
- *
+ *
* @param size
* @param interval
*/
@@ -204,13 +204,13 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
timer = new Timer();
timer.schedule(new Cleanup(content,size), interval, interval);
}
-
-
+
+
/**
* Load a file, first checking cache
- *
- *
+ *
+ *
* @param logTarget - logTarget can be null (won't log)
* @param dataRoot - data root storage directory
* @param key - relative File Path
@@ -234,7 +234,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
isRoot = false;
}
Content c = content.get(key);
- long systime = System.currentTimeMillis();
+ long systime = System.currentTimeMillis();
File f=null;
if (c!=null) {
// Don't check every hit... only after certain time value
@@ -245,11 +245,11 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
}
}
}
- if (c==null) {
+ if (c==null) {
if (logTarget!=null) {
logTarget.log("File Read: ",key);
}
-
+
if (f==null){
f = new File(fileName);
}
@@ -266,7 +266,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
c = new CachedContent(f);
cacheMe = checkInterval>0;
}
-
+
if (mediaType==null) { // determine from file Ending
int idx = key.lastIndexOf('.');
String subkey = key.substring(++idx);
@@ -279,9 +279,9 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
c.contentType=mediaType;
c.attachmentOnly = false;
}
-
+
c.date = f.lastModified();
-
+
if (cacheMe) {
content.put(key, c);
}
@@ -297,14 +297,14 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
c.access = systime;
return c;
}
-
+
public void invalidate(String key) {
content.remove(key);
}
-
+
private static final Content NULL=new Content() {
-
+
@Override
public void setHeader(HttpServletResponse resp) {
resp.setStatus(404/*NOT_FOUND_404*/);
@@ -318,37 +318,37 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
@Override
public void write(OutputStream os) throws IOException {
}
-
+
};
private static abstract class Content {
private long date; // date of the actual artifact (i.e. File modified date)
private long access; // last accessed
-
+
protected String contentType;
protected boolean attachmentOnly;
-
+
public void setHeader(HttpServletResponse resp) {
resp.setStatus(200/*OK_200*/);
resp.setHeader("Content-Type",contentType);
resp.setHeader("Cache-Control", MAX_AGE);
}
-
+
public abstract void write(Writer writer) throws IOException;
public abstract void write(OutputStream os) throws IOException;
}
private static class DirectFileContent extends Content {
- private File file;
+ private File file;
public DirectFileContent(File f) {
file = f;
}
-
+
public String toString() {
return file.getName();
}
-
+
public void write(Writer writer) throws IOException {
FileReader fr = new FileReader(file);
char[] buff = new char[1024];
@@ -387,7 +387,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
public DirectoryContent(File directory, boolean isRoot) {
notRoot = !isRoot;
-
+
files = directory.listFiles();
Arrays.sort(files,new Comparator<File>() {
@Override
@@ -399,7 +399,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
// if numbers, are the numbers in the same start position
int i1 = m1.start();
int i2 = m2.start();
-
+
// If same start position and the text is the same, then reverse sort
if (i1==i2 && f1.getName().startsWith(f2.getName().substring(0,i1))) {
// reverse sort files that start similarly, but have numbers in them
@@ -408,14 +408,14 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
}
return f1.compareTo(f2);
}
-
+
});
name = directory.getName();
attachmentOnly = false;
contentType = "text/html";
}
-
-
+
+
@Override
public void write(Writer w) throws IOException {
w.append(H1);
@@ -435,19 +435,19 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
w.append(F);
w.flush();
}
-
+
@Override
public void write(OutputStream os) throws IOException {
write(new OutputStreamWriter(os));
}
-
+
}
private static class CachedContent extends Content {
private byte[] data;
private int end;
- private char[] cdata;
-
+ private char[] cdata;
+
public CachedContent(File f) throws IOException {
// Read and Cache
ByteBuffer bb = ByteBuffer.allocate((int)f.length());
@@ -462,11 +462,11 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
end = bb.position();
cdata=null;
}
-
+
public String toString() {
return Arrays.toString(data);
}
-
+
public void write(Writer writer) throws IOException {
synchronized(this) {
// do the String Transformation once, and only if actually used
@@ -495,24 +495,24 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
private static class Cleanup extends TimerTask {
private int maxSize;
private NavigableMap<String, Content> content;
-
+
public Cleanup(NavigableMap<String, Content> content, int size) {
maxSize = size;
this.content = content;
}
-
+
private class Comp implements Comparable<Comp> {
public Map.Entry<String, Content> entry;
-
+
public Comp(Map.Entry<String, Content> en) {
entry = en;
}
-
+
@Override
public int compareTo(Comp o) {
return (int)(entry.getValue().access-o.entry.getValue().access);
}
-
+
}
@SuppressWarnings("unchecked")
@Override
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CodeSetter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CodeSetter.java
index 1c171fd7..761fd8cc 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CodeSetter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CodeSetter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,13 +39,13 @@ class CodeSetter<TRANS extends Trans> {
this.trans = trans;
this.req = req;
this.resp = resp;
-
+
}
public boolean matches(Route<TRANS> route) throws IOException, ServletException {
// Find best Code in Route based on "Accepts (Get) or Content-Type" (if exists)
return (code = route.getCode(trans, req, resp))!=null;
}
-
+
public HttpCode<TRANS,?> code() {
return code;
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Content.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Content.java
index 63a2eeaa..e9c8adb0 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Content.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Content.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,14 +29,14 @@ import org.onap.aaf.misc.env.Trans;
/**
* A Class to hold Service "ContentTypes", and to match incoming "Accept" types from HTTP.
- *
+ *
* This is a multi-use class built to use the same Parser for ContentTypes and Accept.
- *
+ *
* Thus, you would create and use "Content.Type" within your service, and use it to match
* Accept Strings. What is returned is an Integer (for faster processing), which can be
* used in a switch statement to act on match different Actions. The server should
* know which behaviors match.
- *
+ *
* "bestMatch" returns an integer for the best match, or -1 if no matches.
*
* @author Jonathan
@@ -49,16 +49,16 @@ public abstract class Content<TRANS extends Trans> {
/**
* Parse a Content-Type/Accept. As found, call "types" and "props", which do different
- * things depending on if it's a Content-Type or Accepts.
- *
+ * things depending on if it's a Content-Type or Accepts.
+ *
* For Content-Type, it builds a tree suitable for Comparison
* For Accepts, it compares against the tree, and builds an acceptable type list
- *
+ *
* Since this parse code is used for every incoming HTTP transaction, I have removed the implementation
* that uses String.split, and replaced with integers evaluating the Byte array. This results
- * in only the necessary strings created, resulting in 1/3 better speed, and less
+ * in only the necessary strings created, resulting in 1/3 better speed, and less
* Garbage collection.
- *
+ *
* @param trans
* @param code
* @param cntnt
@@ -111,5 +111,5 @@ public abstract class Content<TRANS extends Trans> {
} while (cie>=0);
return contType && contProp; // for use in finds, True if a type found AND all props matched
}
-
+
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpCode.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpCode.java
index 0768145f..8c533f6e 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpCode.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpCode.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,13 +28,13 @@ import org.onap.aaf.misc.env.Trans;
/**
* HTTP Code element, which responds to the essential "handle Method".
- *
+ *
* Use Native HttpServletRe[quest|sponse] calls for questions like QueryParameters (getParameter, etc)
- *
+ *
* Use local "pathParam" method to obtain in an optimized manner the path parameter, which must be interpreted by originating string
- *
+ *
* i.e. my/path/:id/:other/*
- *
+ *
* @author Jonathan
*
* @param <TRANS>
@@ -45,14 +45,14 @@ public abstract class HttpCode<TRANS extends Trans, CONTEXT> {
private String desc;
protected String [] roles;
private boolean all;
-
+
// Package by design... Set by Route when linked
Match match;
-
+
public HttpCode(CONTEXT context, String description, String ... roles) {
this.context = context;
desc = description;
-
+
// Evaluate for "*" once...
all = false;
for (String srole : roles) {
@@ -63,16 +63,16 @@ public abstract class HttpCode<TRANS extends Trans, CONTEXT> {
}
this.roles = all?null:roles;
}
-
+
public abstract void handle(TRANS trans, HttpServletRequest req, HttpServletResponse resp) throws Exception;
-
+
public String desc() {
return desc;
}
-
+
/**
* Get the variable element out of the Path Parameter, as set by initial Code
- *
+ *
* @param req
* @param key
* @return
@@ -92,12 +92,12 @@ public abstract class HttpCode<TRANS extends Trans, CONTEXT> {
}
// Note: get Query Params from Request
-
+
/**
* Check for Authorization when set.
- *
+ *
* If no Roles set, then accepts all users
- *
+ *
* @param req
* @return
*/
@@ -110,11 +110,11 @@ public abstract class HttpCode<TRANS extends Trans, CONTEXT> {
}
return false;
}
-
+
public boolean no_cache() {
return false;
}
-
+
public String toString() {
return desc;
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpMethods.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpMethods.java
index 3f7f93c7..2ea340e3 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpMethods.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpMethods.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Match.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Match.java
index 599e45b2..8f47126f 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Match.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Match.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,9 +27,9 @@ import java.util.Set;
/**
* This path matching algorithm avoids using split strings during the critical transactional run-time. By pre-analyzing the
- * content at "set Param" time, and storing data in an array-index model which presumably is done once and at the beginning,
+ * content at "set Param" time, and storing data in an array-index model which presumably is done once and at the beginning,
* we can match in much less time when it actually counts.
- *
+ *
* @author Jonathan
*
*/
@@ -39,14 +39,14 @@ public class Match {
private Integer vars[];
private boolean wildcard;
-
+
/*
* These two methods are pairs of searching performance for variables Spark Style.
* setParams evaluates the target path, and sets a HashMap that will return an Integer.
* the Keys are both :key and key so that there will be no string operations during
* a transaction
- *
- * For the Integer, if the High Order is 0, then it is just one value. If High Order >0, then it is
+ *
+ * For the Integer, if the High Order is 0, then it is just one value. If High Order >0, then it is
* a multi-field option, i.e. ending with a wild-card.
*/
public Match(String path) {
@@ -56,7 +56,7 @@ public class Match {
String[] pa = path.split("/");
values = new byte[pa.length][];
vars = new Integer[pa.length];
-
+
int val = 0;
String key;
for (int i=0;i<pa.length && !wildcard;++i) {
@@ -69,7 +69,7 @@ public class Match {
val = i;
key = pa[i];
}
- params.put(key,val); //put in :key
+ params.put(key,val); //put in :key
params.put(key.substring(1,key.length()), val); // put in just key, better than adding a missing one, like Spark
// values[i]=null; // null stands for Variable
vars[i]=val;
@@ -96,14 +96,14 @@ public class Match {
/*
* This is the second of the param evaluation functions. First, we look up to see if there is
* any reference by key in the params Map created by the above.
- *
+ *
* The resulting Integer, if not null, is split high/low order into start and end.
* We evaluate the string for '/', rather than splitting into String[] to avoid the time/mem needed
- * We traverse to the proper field number for slash, evaluate the end (whether wild card or no),
- * and return the substring.
- *
+ * We traverse to the proper field number for slash, evaluate the end (whether wild card or no),
+ * and return the substring.
+ *
* The result is something less than .003 milliseconds per evaluation
- *
+ *
*/
public String param(String path,String key) {
Integer val = params.get(key); // :key or key
@@ -116,7 +116,7 @@ public class Match {
idx = path.indexOf('/',idx+1);
if (idx<0)break;
}
- if (i==start) {
+ if (i==start) {
++idx;
if (end==0) {
end = path.indexOf('/',idx);
@@ -131,7 +131,7 @@ public class Match {
}
return null;
}
-
+
public boolean match(String path) {
if (path==null|| path.length()==0 || "/".equals(path) ) {
if (values==null)return true;
@@ -140,7 +140,7 @@ public class Match {
case 1: return values[0].length==0;
default: return false;
}
- }
+ }
boolean rv = true;
byte[] pabytes = path.getBytes();
int field=0;
@@ -169,7 +169,7 @@ public class Match {
++j;
}
}
-
+
if (k==lastByte && pabytes[k-1]!='/')++field;
if (k>i)i=k-1; // if we've incremented, have to accommodate the outer for loop incrementing as well
fieldMatched = false; // reset
@@ -183,10 +183,10 @@ public class Match {
}
rv = fieldMatched && ++field<lastField;
// reset
- fieldMatched = false;
+ fieldMatched = false;
fieldIdx = 0;
} else if (values[field].length==0) {
- // double slash in path, but content in field. We check specially here to avoid
+ // double slash in path, but content in field. We check specially here to avoid
// Array out of bounds issues.
rv = false;
} else {
@@ -204,7 +204,7 @@ public class Match {
if (field!=lastField || pabytes.length!=lastByte) rv = false; // have we matched all the fields and all the bytes?
return rv;
}
-
+
public Set<String> getParamNames() {
return params.keySet();
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Pair.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Pair.java
index f4d1394b..54b2e59e 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Pair.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Pair.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,8 +22,8 @@
package org.onap.aaf.auth.rserv;
/**
- * A pair of generic Objects.
- *
+ * A pair of generic Objects.
+ *
* @author Jonathan
*
* @param <X>
@@ -32,12 +32,12 @@ package org.onap.aaf.auth.rserv;
public class Pair<X,Y> {
public X x;
public Y y;
-
+
public Pair(X x, Y y) {
this.x = x;
this.y = y;
}
-
+
public String toString() {
return "X: " + x.toString() + "-->" + y.toString();
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RServlet.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RServlet.java
index 9dec87db..7f94acba 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RServlet.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RServlet.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -59,19 +59,19 @@ public abstract class RServlet<TRANS extends Trans> implements Servlet {
r.add(code,moreTypes);
env.init().log(r.report(code),code);
}
-
+
@Override
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
HttpServletRequest request = (HttpServletRequest)req;
HttpServletResponse response = (HttpServletResponse)res;
-
+
@SuppressWarnings("unchecked")
TRANS trans = (TRANS)req.getAttribute(TransFilter.TRANS_TAG);
if (trans==null) {
response.setStatus(404); // Not Found, because it didn't go through TransFilter
return;
}
-
+
Route<TRANS> route;
HttpCode<TRANS,?> code=null;
String ct = req.getContentType();
@@ -93,7 +93,7 @@ public abstract class RServlet<TRANS extends Trans> implements Servlet {
} finally {
tt.done();
}
-
+
if (route!=null && code!=null) {
StringBuilder sb = new StringBuilder(72);
sb.append(route.auditText);
@@ -119,7 +119,7 @@ public abstract class RServlet<TRANS extends Trans> implements Servlet {
}
}
}
-
+
@Override
public String getServletInfo() {
return "RServlet for Jetty";
@@ -127,9 +127,9 @@ public abstract class RServlet<TRANS extends Trans> implements Servlet {
/**
* Allow Service to instantiate certain actions after service starts up
- * @throws LocatorException
- * @throws CadiException
- * @throws APIException
+ * @throws LocatorException
+ * @throws CadiException
+ * @throws APIException
*/
public void postStartup(String hostname, int port) throws APIException {
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java
index 46a3a955..a3282849 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,12 +36,12 @@ public class Route<TRANS extends Trans> {
public final String auditText;
public final HttpMethods meth;
public final String path;
-
+
private Match match;
// package on purpose
private final TypedCode<TRANS> content;
private final boolean isContentType;
-
+
public Route(HttpMethods meth, String path) {
this.path = path;
auditText = meth.name() + ' ' + path;
@@ -50,12 +50,12 @@ public class Route<TRANS extends Trans> {
match = new Match(path);
content = new TypedCode<TRANS>();
}
-
+
public void add(HttpCode<TRANS,?> code, String ... others) {
code.match = match;
content.add(code, others);
}
-
+
public HttpCode<TRANS,?> getCode(TRANS trans, HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
// Type is associated with Accept for GET (since it is what is being returned
// We associate the rest with ContentType.
@@ -82,11 +82,11 @@ public class Route<TRANS extends Trans> {
}
return null;
}
-
+
public Route<TRANS> matches(String method, String path) {
return meth.name().equalsIgnoreCase(method) && match.match(path)?this:null;
}
-
+
public TimeTaken start(Trans trans, String auditText, HttpCode<TRANS,?> code, String type) {
StringBuilder sb = new StringBuilder(auditText);
sb.append(", ");
@@ -100,9 +100,9 @@ public class Route<TRANS extends Trans> {
boolean resolvesTo(HttpMethods hm, String p) {
return(path.equals(p) && hm.equals(meth));
}
-
+
public String toString() {
- return auditText + ' ' + content;
+ return auditText + ' ' + content;
}
public String report(HttpCode<TRANS, ?> code) {
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RouteReport.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RouteReport.java
index cb7c48bc..4e4cdb5b 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RouteReport.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RouteReport.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java
index ed6326a8..3afe223f 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,14 +35,14 @@ public class Routes<TRANS extends Trans> {
// Since this must be very, very fast, and only needs one creation, we'll use just an array.
private Route<TRANS>[] routes;
private int end;
-
+
@SuppressWarnings("unchecked")
public Routes() {
routes = new Route[10];
end = 0;
}
-
+
// This method for setup of Routes only...
// Package on purpose
synchronized Route<TRANS> findOrCreate(HttpMethods meth, String path) {
@@ -50,7 +50,7 @@ public class Routes<TRANS extends Trans> {
for (int i=0;i<end;++i) {
if (routes[i].resolvesTo(meth,path))rv = routes[i];
}
-
+
if (rv==null) {
if (end>=routes.length) {
@SuppressWarnings("unchecked")
@@ -58,12 +58,12 @@ public class Routes<TRANS extends Trans> {
System.arraycopy(routes, 0, temp, 0, routes.length);
routes = temp;
}
-
+
routes[end++]=rv=new Route<TRANS>(meth,path);
}
return rv;
}
-
+
public Route<TRANS> derive(HttpServletRequest req, CodeSetter<TRANS> codeSetter) throws IOException, ServletException {
Route<TRANS> rv = null;
String path = req.getPathInfo();
@@ -71,13 +71,13 @@ public class Routes<TRANS extends Trans> {
//TODO a TREE would be better
for (int i=0;rv==null && i<end; ++i) {
rv = routes[i].matches(meth,path);
- if (rv!=null && !codeSetter.matches(rv)) { // potential match, check if has Code
+ if (rv!=null && !codeSetter.matches(rv)) { // potential match, check if has Code
rv = null; // not quite, keep going
}
}
return rv;
}
-
+
public List<RouteReport> routeReport() {
ArrayList<RouteReport> ltr = new ArrayList<>();
for (int i=0;i<end;++i) {
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java
index 2acfbe34..5b856935 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,22 +52,22 @@ import org.onap.aaf.misc.env.util.Split;
/**
* Create a new Transaction Object for each and every incoming Transaction
- *
+ *
* Attach to Request. User "FilterHolder" mechanism to retain single instance.
- *
+ *
* TransFilter includes CADIFilter as part of the package, so that it can
* set User Data, etc, as necessary.
- *
+ *
* @author Jonathan
*
*/
public abstract class TransFilter<TRANS extends TransStore> implements Filter {
public static final String TRANS_TAG = "__TRANS__";
-
+
private CadiHTTPManip cadi;
private final String[] no_authn;
-
+
public TransFilter(Access access, Connector con, TrustChecker tc, Object ... additionalTafLurs) throws CadiException, LocatorException {
cadi = new CadiHTTPManip(access, con, tc, additionalTafLurs);
String no = access.getProperty(Config.CADI_NOAUTHN, null);
@@ -81,7 +81,7 @@ public abstract class TransFilter<TRANS extends TransStore> implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
-
+
protected Lur getLur() {
return cadi.getLur();
}
@@ -90,19 +90,19 @@ public abstract class TransFilter<TRANS extends TransStore> implements Filter {
protected abstract TimeTaken start(TRANS trans);
protected abstract void authenticated(TRANS trans, Principal p);
protected abstract void tallyHo(TRANS trans, String target);
-
+
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest)request;
HttpServletResponse res = (HttpServletResponse)response;
-
+
TRANS trans = newTrans(req,res);
-
+
TimeTaken overall = start(trans);
String target = "n/a";
try {
request.setAttribute(TRANS_TAG, trans);
-
+
if (no_authn!=null) {
for (String prefix : no_authn) {
if (req.getPathInfo().startsWith(prefix)) {
@@ -133,7 +133,7 @@ public abstract class TransFilter<TRANS extends TransStore> implements Filter {
} finally {
security.done();
}
-
+
if (r==RESP.IS_AUTHENTICATED) {
trans.checkpoint(resp.desc());
if (cadi.notCadi(cw, res)) {
@@ -141,7 +141,7 @@ public abstract class TransFilter<TRANS extends TransStore> implements Filter {
}
} else {
//TODO this is a good place to check if too many checks recently
- // Would need Cached Counter objects that are cleaned up on
+ // Would need Cached Counter objects that are cleaned up on
// use
trans.checkpoint(resp.desc(),Env.ALWAYS);
if (resp.isFailedAttempt()) {
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransOnlyFilter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransOnlyFilter.java
index ef91e485..0cf4b83e 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransOnlyFilter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransOnlyFilter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,12 +38,12 @@ import org.onap.aaf.misc.env.TransStore;
/**
* Create a new Transaction Object for each and every incoming Transaction
- *
+ *
* Attach to Request. User "FilterHolder" mechanism to retain single instance.
- *
+ *
* TransFilter includes CADIFilter as part of the package, so that it can
* set User Data, etc, as necessary.
- *
+ *
* @author Jonathan
*
*/
@@ -51,14 +51,14 @@ public abstract class TransOnlyFilter<TRANS extends TransStore> implements Filte
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
-
+
protected abstract TRANS newTrans(HttpServletRequest req, HttpServletResponse resp);
protected abstract TimeTaken start(TRANS trans);
protected abstract void authenticated(TRANS trans, TaggedPrincipal p);
protected abstract void tallyHo(TRANS trans);
-
+
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
TRANS trans = newTrans((HttpServletRequest)request,(HttpServletResponse)response);
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java
index 6f1372f3..c292fae3 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,17 +40,17 @@ import org.onap.aaf.misc.env.Trans;
* FYI: For those in the future wondering why I would create a specialized set of "Pair" for the data content:
* 1) TypeCode is used in Route, and this code is used for every transaction... it needs to be blazingly fast
* 2) The actual number of objects accessed is quite small and built at startup. Arrays are best
- * 3) I needed a small, well defined tree where each level is a different Type. Using a "Pair" Generic definitions,
+ * 3) I needed a small, well defined tree where each level is a different Type. Using a "Pair" Generic definitions,
* I created type-safety at each level, which you can't get from a TreeSet, etc.
* 4) Chaining through the Network is simply object dereferencing, which is as fast as Java can go.
* 5) The drawback is that in your code is that all the variables are named "x" and "y", which can be a bit hard to
- * read both in code, and in the debugger. However, TypeSafety allows your IDE (Eclipse) to help you make the
+ * read both in code, and in the debugger. However, TypeSafety allows your IDE (Eclipse) to help you make the
* choices. Also, make sure you have a good "toString()" method on each object so you can see what's happening
* in the IDE Debugger.
- *
+ *
* Empirically, this method of obtaining routes proved to be much faster than the HashSet implementations available in otherwise
* competent Open Source.
- *
+ *
* @author Jonathan
*
* @param <TRANS>
@@ -61,10 +61,10 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
public TypedCode() {
types = new ArrayList<>();
}
-
+
/**
* Construct Typed Code based on ContentType parameters passed in
- *
+ *
* @param code
* @param others
* @return
@@ -74,17 +74,17 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
boolean first = true;
for (String str : others) {
if (first) {
- first = false;
+ first = false;
} else {
sb.append(',');
}
sb.append(str);
}
parse(code, sb.toString());
-
+
return this;
}
-
+
@Override
protected Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>> types(HttpCode<TRANS,?> code, String str) {
Pair<String, Pair<HttpCode<TRANS,?>,List<Pair<String, Object>>>> type = null;
@@ -127,7 +127,7 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
}
return type.y.y.add(new Pair<String,Object>(tag,"version".equals(tag)?new Version(value):value));
}
-
+
public Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> prep(TRANS trans, String compare){
Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>> c,rv=null;
if (types.size()==1 && "".equals((c=types.get(0)).x)) { // if there are no checks for type, skip
@@ -146,11 +146,11 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
}
if (accepted) {
switch(acc.acceptable.size()) {
- case 0:
+ case 0:
// // TODO best Status Code?
// resp.setStatus(HttpStatus.NOT_ACCEPTABLE_406);
break;
- case 1:
+ case 1:
rv = acc.acceptable.get(0);
break;
default: // compare Q values to get Best Match
@@ -177,14 +177,14 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
}
return rv;
}
-
+
/**
* Print on String Builder content related to specific Code
- *
+ *
* This is for Reporting and Debugging purposes, so the content is not cached.
- *
+ *
* If code is "null", then all content is matched
- *
+ *
* @param code
* @return
*/
@@ -211,7 +211,7 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
}
return sb;
}
-
+
public List<Pair<String, Object>> getContent(HttpCode<TRANS,?> code) {
for (Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> pair : types) {
if (pair.y.x == code) {
@@ -220,17 +220,17 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
}
return null;
}
-
+
public String toString() {
return relatedTo(null,new StringBuilder()).toString();
}
-
+
public void api(RouteReport tr) {
// Need to build up a map, because Prop entries can be in several places.
HashMap<HttpCode<?,?>,StringBuilder> psb = new HashMap<>();
StringBuilder temp;
tr.desc = null;
-
+
// Read through Code/TypeCode trees for all accepted Typecodes
for (Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> tc : types) {
// If new, then it's new Code set, create prefix content
@@ -253,7 +253,7 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
}
}
// Gather all ContentType possibilities for the same code together
-
+
for (StringBuilder sb : psb.values()) {
tr.contextTypes.add(sb.toString());
}
@@ -265,5 +265,5 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
}
return null;
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Version.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Version.java
index adf05380..37c26fc5 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Version.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Version.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,7 +24,7 @@ package org.onap.aaf.auth.rserv;
/**
* Analyze and hold Version information for Code
- *
+ *
* @author Jonathan
*
*/
@@ -67,8 +67,8 @@ public class Version {
}
return false;
}
-
-
+
+
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/doc/ApiDoc.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/doc/ApiDoc.java
index 684976b9..ab766a6c 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/doc/ApiDoc.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/doc/ApiDoc.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,5 +36,5 @@ public @interface ApiDoc {
String[] text();
/** Format with name|type|[true|false] */
String[] params();
-
+
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java
index 4fb81d73..31131314 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -55,7 +55,7 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
public final String app_name;
public final String app_version;
public final String ROOT_NS;
-
+
public AbsService(final Access access, final ENV env) throws CadiException {
Define.set(access);
ROOT_NS = Define.ROOT_NS();
@@ -70,14 +70,14 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
str = ROOT_NS + '.' + scomp[0];
}
app_name = str;
-
+
str = access.getProperty(Config.AAF_LOCATOR_VERSION, null);
if(str==null) {
str = Defaults.AAF_VERSION;
env.setProperty(Config.AAF_LOCATOR_VERSION, str);
}
app_version = access.getProperty(Config.AAF_DEPLOYED_VERSION, str);
-
+
// Print Cipher Suites Available
if (access.willLog(Level.DEBUG)) {
SSLContext context;
@@ -99,7 +99,7 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
access.log(Level.DEBUG,sb);
}
}
-
+
public void setProtocol(String proto) {
env.setProperty(Config.AAF_LOCATOR_PROTOCOL, proto);
}
@@ -107,12 +107,12 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
public void setSubprotocol(String subproto) {
env.setProperty(Config.AAF_LOCATOR_SUBPROTOCOL, subproto);
}
-
+
protected abstract Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException;
-
+
/**
* Overload this method to add new TAF or LURs
- *
+ *
* @return
* @throws CadiException
* @throws LocatorException
@@ -134,11 +134,11 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
}
return aafCon;
}
-
+
/**
* Allow to be over ridden for special cases
* @return
- * @throws LocatorException
+ * @throws LocatorException
*/
protected synchronized AAFConHttp _newAAFConHttp() throws CadiException, LocatorException {
if (aafCon==null) {
@@ -147,12 +147,12 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
return aafCon;
}
-
+
// This is a method, so we can overload for AAFAPI
public String aaf_url() {
return access.getProperty(Config.AAF_URL, null);
}
-
+
public Rcli<?> client() throws CadiException {
return aafCon.client();
}
@@ -165,7 +165,7 @@ 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;
@@ -177,11 +177,11 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
}
// check System.properties
value = System.getProperty(tag);
- if (value!=null) {
+ if (value!=null) {
props.put(tag, value);
return value;
}
-
+
if (def!=null) {
props.put(tag,def);
}
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 90f4158f..f09a4ff3 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -68,15 +68,15 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
}
_propertyAdjustment();
}
-
-
+
+
protected abstract void _start(RServlet<TRANS> rserv) throws Exception;
protected abstract void _propertyAdjustment();
-
+
public ENV env() {
return service.env;
}
-
+
public Access access() {
return service.access;
}
@@ -86,8 +86,8 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
ExecutorService es = Executors.newSingleThreadExecutor();
Future<?> app = es.submit(this);
final AbsServiceStarter<?,?> absSS = this;
- // Docker/K8 may separately create startup Status in this dir for startup
- // sequencing. If so, delete ON EXIT
+ // Docker/K8 may separately create startup Status in this dir for startup
+ // sequencing. If so, delete ON EXIT
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
@@ -109,7 +109,7 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
}
}
}
-
+
@SafeVarargs
public final synchronized void register(final Registrant<ENV> ... registrants) {
if (do_register) {
@@ -137,7 +137,7 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
if (registrar!=null) {
registrar.close(env());
registrar=null;
- }
+ }
if (service!=null) {
File status = new File("/opt/app/aaf/status/");
boolean deleted = false;
@@ -147,7 +147,7 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
if(lastdot<0) {
fname = service.app_name + '-' + hostname;
} else {
- fname = service.app_name.substring(lastdot).replace('.', '-')
+ fname = service.app_name.substring(lastdot).replace('.', '-')
+ '-' + hostname;
}
status = new File(status, fname);
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 78a7702b..3f0d2ebb 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -58,7 +58,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
public JettyServiceStarter(final AbsService<ENV,TRANS> service, boolean secure) throws OrganizationException {
super(service, secure);
}
-
+
@Override
public void _propertyAdjustment() {
// System.setProperty("com.sun.management.jmxremote.port", "8081");
@@ -72,7 +72,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
props.put(Config.CADI_PROTOCOLS, httpproto);
}
}
-
+
if ("1.7".equals(System.getProperty("java.specification.version")) && (httpproto==null || (httpproto instanceof String && ((String)httpproto).contains("TLSv1.2")))) {
System.setProperty(Config.HTTPS_CIPHER_SUITES, Config.HTTPS_CIPHER_SUITES_DEFAULT);
}
@@ -84,7 +84,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
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));
Server server = new Server();
-
+
ServerConnector conn;
String protocol;
if (!secure || keystore==null) {
@@ -92,7 +92,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
protocol = "http";
} else {
protocol = "https";
-
+
String keystorePassword = access().getProperty(Config.CADI_KEYSTORE_PASSWORD, null);
if (keystorePassword==null) {
@@ -104,7 +104,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
sslContextFactory.setKeyStorePassword(temp=access().decrypt(keystorePassword, true)); // don't allow unencrypted
sslContextFactory.setKeyManagerPassword(temp);
temp=null; // don't leave lying around
-
+
String truststore = access().getProperty(Config.CADI_TRUSTSTORE, null);
if (truststore!=null) {
String truststorePassword = access().getProperty(Config.CADI_TRUSTSTORE_PASSWORD, null);
@@ -112,17 +112,17 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
throw new CadiException("No Truststore Password configured for " + truststore);
}
sslContextFactory.setTrustStorePath(truststore);
- sslContextFactory.setTrustStorePassword(access().decrypt(truststorePassword, false));
+ sslContextFactory.setTrustStorePassword(access().decrypt(truststorePassword, false));
}
// Be able to accept only certain protocols, i.e. TLSv1.1+
String subprotocols = access().getProperty(Config.CADI_PROTOCOLS, Config.HTTPS_PROTOCOLS_DEFAULT);
service.setSubprotocol(subprotocols);
final String[] protocols = Split.splitTrim(',', subprotocols);
sslContextFactory.setIncludeProtocols(protocols);
-
+
// Want to use Client Certificates, if they exist.
sslContextFactory.setWantClientAuth(true);
-
+
// Optional future checks.
// sslContextFactory.setValidateCerts(true);
// sslContextFactory.setValidatePeerCerts(true);
@@ -132,13 +132,13 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
if (certAlias!=null) {
sslContextFactory.setCertAlias(certAlias);
}
-
+
HttpConfiguration httpConfig = new HttpConfiguration();
httpConfig.setSecureScheme(protocol);
httpConfig.setSecurePort(port);
httpConfig.addCustomizer(new SecureRequestCustomizer());
// httpConfig.setOutputBufferSize(32768); Not sure why take this setting
-
+
conn = new ServerConnector(server,
new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()),
new HttpConnectionFactory(httpConfig)
@@ -146,22 +146,22 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
}
service.setProtocol(protocol);
-
- // Setup JMX
+
+ // Setup JMX
// TODO trying to figure out how to set up/log ports
// MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
// MBeanContainer mbContainer=new MBeanContainer(mbeanServer);
// server.addEventListener(mbContainer);
// server.addBean(mbContainer);
-
+
// Add loggers MBean to server (will be picked up by MBeanContainer above)
// server.addBean(Log.getLog());
-
+
conn.setHost(hostname);
conn.setPort(port);
conn.setIdleTimeout(IDLE_TIMEOUT);
server.addConnector(conn);
-
+
server.setHandler(new AbstractHandler() {
private FilterChain fc = buildFilterChain(service,new FilterChain() {
@Override
@@ -169,7 +169,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
rserv.service(req, resp);
}
});
-
+
@Override
public void handle(String target, Request baseRequest, HttpServletRequest hreq, HttpServletResponse hresp) throws IOException, ServletException {
try {
@@ -182,7 +182,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
}
}
);
-
+
try {
access().printf(Level.INIT, "Starting service on %s:%d (%s)",hostname,port,InetAddress.getByName(hostname).getHostAddress());
server.start();
@@ -204,7 +204,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
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);
-
+
rserv.postStartup(hostname, port);
} catch (Exception e) {
access().log(e,"Error registering " + service.app_name);
@@ -225,15 +225,15 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
}
return fc;
}
-
+
private class FCImpl implements FilterChain {
private Filter f;
private FilterChain next;
-
+
public FCImpl(final Filter f, final FilterChain fc) {
this.f=f;
next = fc;
-
+
}
@Override
public void doFilter(ServletRequest req, ServletResponse resp) throws IOException, ServletException {
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java
index 894f571d..aa7d14cc 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,7 +35,7 @@ import org.onap.aaf.misc.env.util.Chrono;
public class Log4JLogIt implements LogIt {
protected static final String AAF_LOG4J_PREFIX = "aaf_log4j_prefix";
// Log4j does it's own date. Can't apparently turn it off.
-
+
private final String service;
private final String audit;
private final String init;
@@ -74,13 +74,13 @@ public class Log4JLogIt implements LogIt {
laudit = Logger.getLogger(audit);
linit = Logger.getLogger(init);
ltrace = Logger.getLogger(trace);
-
+
lfn.configure(etc_dir,propsFile, log_level);
} catch (IOException e) {
throw new APIException(e);
}
}
-
+
private static final String getArgOrVM(final String tag, final String args[], final String def) {
String tagEQ = tag + '=';
String value;
@@ -91,10 +91,10 @@ public class Log4JLogIt implements LogIt {
}
// check System.properties
value = System.getProperty(tag);
- if (value!=null) {
+ if (value!=null) {
return value;
}
-
+
return def;
}
@@ -127,7 +127,7 @@ public class Log4JLogIt implements LogIt {
default:
lservice.info(PropAccess.buildMsg(service, Chrono.utcFmt, level, elements));
break;
-
+
}
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/ServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/ServiceStarter.java
index 9004f76b..17aeafa1 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/ServiceStarter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/ServiceStarter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java
index 052f21bf..fcbccb12 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -64,7 +64,7 @@ public class Validator {
actionChars = ACTION_CHARS;
instChars = INST_CHARS;
}
-
+
public final String errs() {
return msgs.toString();
}
@@ -96,7 +96,7 @@ public class Validator {
}
protected final boolean nob(String str, Pattern p) {
- return str==null || !p.matcher(str).matches();
+ return str==null || !p.matcher(str).matches();
}
protected final void msg(String ... strs) {
@@ -164,7 +164,7 @@ public class Validator {
}
return this;
}
-
+
public final Validator permType(String type, String ns) {
if (type==null) {
msg("Perm Type is null");
@@ -227,7 +227,7 @@ public class Validator {
return this;
} else if (nob(ns,NAME_CHARS)) {
msg("NS [" + ns + "] is invalid.");
- }
+ }
for (String s : nsKeywords) {
if (ns.endsWith(s)) {
msg("NS [" + ns + "] may not be named with NS keywords");