* 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.
/**
* 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
*
*/
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;
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);
public void printf(String fmt, Object... vars) {
access.printf(level, fmt, vars);
}
-
+
}
@Override
public AuthzTransImpl newTrans() {
++count;
pot += times[i]-prev;
}
- prev = times[i];
+ prev = times[i];
}
}
for (int i=0;i<idx;++i) {
++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();
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) {
return "";
}
}
-
+
};
}
return decryptor.decrypt(encrypted);
public Properties getProperties() {
return access.getProperties();
};
-
+
}