You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openaz.apache.org by co...@apache.org on 2015/05/05 14:23:47 UTC
[49/54] [abbrv] [partial] incubator-openaz git commit: Do an eclipse
based "cleanup" on the project
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/XACMLPdpRegisterThread.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/XACMLPdpRegisterThread.java b/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/XACMLPdpRegisterThread.java
index dc5e8ab..bee3a38 100644
--- a/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/XACMLPdpRegisterThread.java
+++ b/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/XACMLPdpRegisterThread.java
@@ -47,7 +47,7 @@ import com.att.research.xacml.rest.XACMLPdpServlet.PutRequest;
import com.att.research.xacml.util.XACMLProperties;
public class XACMLPdpRegisterThread implements Runnable {
- private static final Log logger = LogFactory.getLog(XACMLPdpRegisterThread.class);
+ private static final Log logger = LogFactory.getLog(XACMLPdpRegisterThread.class);
public volatile boolean isRunning = false;
@@ -60,20 +60,19 @@ public class XACMLPdpRegisterThread implements Runnable {
}
/**
- *
* This is our thread that runs on startup to tell the PAP server we are up-and-running.
- *
*/
@Override
public void run() {
- synchronized(this) {
+ synchronized (this) {
this.isRunning = true;
}
boolean registered = false;
boolean interrupted = false;
int seconds;
try {
- seconds = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_REGISTER_SLEEP));
+ seconds = Integer.parseInt(XACMLProperties
+ .getProperty(XACMLRestProperties.PROP_PDP_REGISTER_SLEEP));
} catch (NumberFormatException e) {
logger.error("REGISTER_SLEEP: ", e);
seconds = 5;
@@ -83,12 +82,13 @@ public class XACMLPdpRegisterThread implements Runnable {
}
int retries;
try {
- retries = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_REGISTER_RETRIES));
+ retries = Integer.parseInt(XACMLProperties
+ .getProperty(XACMLRestProperties.PROP_PDP_REGISTER_RETRIES));
} catch (NumberFormatException e) {
logger.error("REGISTER_SLEEP: ", e);
retries = -1;
}
- while (! registered && ! interrupted && this.isRunning()) {
+ while (!registered && !interrupted && this.isRunning()) {
HttpURLConnection connection = null;
try {
//
@@ -97,7 +97,7 @@ public class XACMLPdpRegisterThread implements Runnable {
URL url = new URL(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL));
logger.info("Registering with " + url.toString());
boolean finished = false;
- while (! finished) {
+ while (!finished) {
//
// Open up the connection
//
@@ -108,7 +108,9 @@ public class XACMLPdpRegisterThread implements Runnable {
connection.setRequestMethod("POST");
connection.setRequestProperty("Accept", "text/x-java-properties");
connection.setRequestProperty("Content-Type", "text/x-java-properties");
- connection.setRequestProperty(XACMLRestProperties.PROP_PDP_HTTP_HEADER_ID, XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_ID));
+ connection.setRequestProperty(XACMLRestProperties.PROP_PDP_HTTP_HEADER_ID,
+ XACMLProperties
+ .getProperty(XACMLRestProperties.PROP_PDP_ID));
connection.setUseCaches(false);
//
// Adding this in. It seems the HttpUrlConnection class does NOT
@@ -124,11 +126,13 @@ public class XACMLPdpRegisterThread implements Runnable {
//
// Send our current policy configuration
//
- String lists = XACMLProperties.PROP_ROOTPOLICIES + "=" + XACMLProperties.getProperty(XACMLProperties.PROP_ROOTPOLICIES);
- lists = lists + "\n" + XACMLProperties.PROP_REFERENCEDPOLICIES + "=" + XACMLProperties.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES) + "\n";
+ String lists = XACMLProperties.PROP_ROOTPOLICIES + "="
+ + XACMLProperties.getProperty(XACMLProperties.PROP_ROOTPOLICIES);
+ lists = lists + "\n" + XACMLProperties.PROP_REFERENCEDPOLICIES + "="
+ + XACMLProperties.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES) + "\n";
try (InputStream listsInputStream = new ByteArrayInputStream(lists.getBytes());
- InputStream pipInputStream = Files.newInputStream(XACMLPdpLoader.getPIPConfig());
- OutputStream os = connection.getOutputStream()) {
+ InputStream pipInputStream = Files.newInputStream(XACMLPdpLoader.getPIPConfig());
+ OutputStream os = connection.getOutputStream()) {
IOUtils.copy(listsInputStream, os);
//
@@ -156,14 +160,17 @@ public class XACMLPdpRegisterThread implements Runnable {
// Queue it
//
// The incoming properties does NOT include urls
- PutRequest req = new PutRequest(XACMLProperties.getPolicyProperties(properties, false), XACMLProperties.getPipProperties(properties));
+ PutRequest req = new PutRequest(
+ XACMLProperties
+ .getPolicyProperties(properties, false),
+ XACMLProperties.getPipProperties(properties));
XACMLPdpServlet.queue.offer(req);
//
// We are now registered
//
finished = true;
- registered=true;
- } else if (connection.getResponseCode() >= 300 && connection.getResponseCode() <= 399) {
+ registered = true;
+ } else if (connection.getResponseCode() >= 300 && connection.getResponseCode() <= 399) {
//
// Re-direction
//
@@ -176,7 +183,8 @@ public class XACMLPdpRegisterThread implements Runnable {
url = new URL(newLocation);
}
} else {
- logger.warn("Failed: " + connection.getResponseCode() + " message: " + connection.getResponseMessage());
+ logger.warn("Failed: " + connection.getResponseCode() + " message: "
+ + connection.getResponseMessage());
finished = true;
}
}
@@ -221,10 +229,11 @@ public class XACMLPdpRegisterThread implements Runnable {
this.terminate();
}
}
- synchronized(this) {
+ synchronized (this) {
this.isRunning = false;
}
- logger.info("Thread exiting...(registered=" + registered + ", interrupted=" + interrupted + ", isRunning=" + this.isRunning() + ", retries=" + retries + ")");
+ logger.info("Thread exiting...(registered=" + registered + ", interrupted=" + interrupted
+ + ", isRunning=" + this.isRunning() + ", retries=" + retries + ")");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/XACMLPdpServlet.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/XACMLPdpServlet.java b/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/XACMLPdpServlet.java
index c6d7cce..0399949 100644
--- a/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/XACMLPdpServlet.java
+++ b/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/XACMLPdpServlet.java
@@ -69,41 +69,29 @@ import com.att.research.xacml.util.XACMLProperties;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
- * Servlet implementation class XacmlPdpServlet
- *
- * This is an implementation of the XACML 3.0 RESTful Interface with added features to support
- * simple PAP RESTful API for policy publishing and PIP configuration changes.
- *
- * If you are running this the first time, then we recommend you look at the xacml.pdp.properties file.
- * This properties file has all the default parameter settings. If you are running the servlet as is,
- * then we recommend setting up you're container to run it on port 8080 with context "/pdp". Wherever
- * the default working directory is set to, a "config" directory will be created that holds the policy
- * and pip cache. This setting is located in the xacml.pdp.properties file.
- *
- * When you are ready to customize, you can create a separate xacml.pdp.properties on you're local file
- * system and setup the parameters as you wish. Just set the Java VM System variable to point to that file:
- *
- * -Dxacml.properties=/opt/app/xacml/etc/xacml.pdp.properties
- *
- * Or if you only want to change one or two properties, simply set the Java VM System variable for that property.
- *
- * -Dxacml.rest.pdp.register=false
- *
- *
+ * Servlet implementation class XacmlPdpServlet This is an implementation of the XACML 3.0 RESTful Interface
+ * with added features to support simple PAP RESTful API for policy publishing and PIP configuration changes.
+ * If you are running this the first time, then we recommend you look at the xacml.pdp.properties file. This
+ * properties file has all the default parameter settings. If you are running the servlet as is, then we
+ * recommend setting up you're container to run it on port 8080 with context "/pdp". Wherever the default
+ * working directory is set to, a "config" directory will be created that holds the policy and pip cache. This
+ * setting is located in the xacml.pdp.properties file. When you are ready to customize, you can create a
+ * separate xacml.pdp.properties on you're local file system and setup the parameters as you wish. Just set
+ * the Java VM System variable to point to that file:
+ * -Dxacml.properties=/opt/app/xacml/etc/xacml.pdp.properties Or if you only want to change one or two
+ * properties, simply set the Java VM System variable for that property. -Dxacml.rest.pdp.register=false
*/
-@WebServlet(
- description = "Implements the XACML PDP RESTful API and client PAP API.",
- urlPatterns = { "/" },
- loadOnStartup=1,
-initParams = {
- @WebInitParam(name = "XACML_PROPERTIES_NAME", value = "xacml.pdp.properties", description = "The location of the PDP xacml.pdp.properties file holding configuration information.")
-})
+@WebServlet(description = "Implements the XACML PDP RESTful API and client PAP API.", urlPatterns = {
+ "/"
+}, loadOnStartup = 1, initParams = {
+ @WebInitParam(name = "XACML_PROPERTIES_NAME", value = "xacml.pdp.properties", description = "The location of the PDP xacml.pdp.properties file holding configuration information.")
+ })
public class XACMLPdpServlet extends HttpServlet implements Runnable {
private static final long serialVersionUID = 1L;
//
// Our application debug log
//
- private static final Log logger = LogFactory.getLog(XACMLPdpServlet.class);
+ private static final Log logger = LogFactory.getLog(XACMLPdpServlet.class);
//
// This logger is specifically only for Xacml requests and their corresponding response.
// It's output ideally should be sent to a separate file from the application logger.
@@ -129,6 +117,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
//
private static volatile StdPDPStatus status = new StdPDPStatus();
private static final Object pdpStatusLock = new Object();
+
//
// Queue of PUT requests
//
@@ -141,6 +130,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
this.pipConfigProperties = pips;
}
}
+
public static volatile BlockingQueue<PutRequest> queue = new LinkedBlockingQueue<PutRequest>(2);
//
// This is our configuration thread that attempts to load
@@ -158,6 +148,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
/**
* @see Servlet#init(ServletConfig)
*/
+ @Override
public void init(ServletConfig config) throws ServletException {
//
// Initialize
@@ -169,7 +160,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
//
PDPEngine engine = XACMLPdpLoader.loadEngine(XACMLPdpServlet.status, null, null);
if (engine != null) {
- synchronized(pdpEngineLock) {
+ synchronized (pdpEngineLock) {
pdpEngine = engine;
}
}
@@ -192,6 +183,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
/**
* @see Servlet#destroy()
*/
+ @Override
public void destroy() {
super.destroy();
logger.info("Destroying....");
@@ -223,55 +215,27 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
}
/**
- * PUT - The PAP engine sends configuration information using HTTP PUT request.
- *
- * One parameter is expected:
- *
- * config=[policy|pip|all]
- *
- * policy - Expect a properties file that contains updated lists of the root and referenced policies that the PDP should
- * be using for PEP requests.
- *
- * Specifically should AT LEAST contain the following properties:
- * xacml.rootPolicies
- * xacml.referencedPolicies
- *
- * In addition, any relevant information needed by the PDP to load or retrieve the policies to store in its cache.
- *
- * EXAMPLE:
- * xacml.rootPolicies=PolicyA.1, PolicyB.1
- *
- * PolicyA.1.url=http://localhost:9090/PAP?id=b2d7b86d-d8f1-4adf-ba9d-b68b2a90bee1&version=1
- * PolicyB.1.url=http://localhost:9090/PAP/id=be962404-27f6-41d8-9521-5acb7f0238be&version=1
- *
- * xacml.referencedPolicies=RefPolicyC.1, RefPolicyD.1
- *
- * RefPolicyC.1.url=http://localhost:9090/PAP?id=foobar&version=1
- * RefPolicyD.1.url=http://localhost:9090/PAP/id=example&version=1
- *
- * pip - Expect a properties file that contain PIP engine configuration properties.
- *
- * Specifically should AT LEAST the following property:
- * xacml.pip.engines
- *
- * In addition, any relevant information needed by the PDP to load and configure the PIPs.
- *
- * EXAMPLE:
- * xacml.pip.engines=foo,bar
- *
- * foo.classname=com.foo
- * foo.sample=abc
- * foo.example=xyz
- * ......
- *
- * bar.classname=com.bar
- * ......
- *
- * all - Expect ALL new configuration properties for the PDP
+ * PUT - The PAP engine sends configuration information using HTTP PUT request. One parameter is expected:
+ * config=[policy|pip|all] policy - Expect a properties file that contains updated lists of the root and
+ * referenced policies that the PDP should be using for PEP requests. Specifically should AT LEAST contain
+ * the following properties: xacml.rootPolicies xacml.referencedPolicies In addition, any relevant
+ * information needed by the PDP to load or retrieve the policies to store in its cache. EXAMPLE:
+ * xacml.rootPolicies=PolicyA.1, PolicyB.1
+ * PolicyA.1.url=http://localhost:9090/PAP?id=b2d7b86d-d8f1-4adf-ba9d-b68b2a90bee1&version=1
+ * PolicyB.1.url=http://localhost:9090/PAP/id=be962404-27f6-41d8-9521-5acb7f0238be&version=1
+ * xacml.referencedPolicies=RefPolicyC.1, RefPolicyD.1
+ * RefPolicyC.1.url=http://localhost:9090/PAP?id=foobar&version=1
+ * RefPolicyD.1.url=http://localhost:9090/PAP/id=example&version=1 pip - Expect a properties file that
+ * contain PIP engine configuration properties. Specifically should AT LEAST the following property:
+ * xacml.pip.engines In addition, any relevant information needed by the PDP to load and configure the
+ * PIPs. EXAMPLE: xacml.pip.engines=foo,bar foo.classname=com.foo foo.sample=abc foo.example=xyz ......
+ * bar.classname=com.bar ...... all - Expect ALL new configuration properties for the PDP
*
* @see HttpServlet#doPut(HttpServletRequest request, HttpServletResponse response)
*/
- protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ @Override
+ protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException,
+ IOException {
//
// Dump our request out
//
@@ -286,7 +250,8 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
// Should be a list of policy and pip configurations in Java properties format
//
if (cache != null && request.getContentType().equals("text/x-java-properties")) {
- if (request.getContentLength() > Integer.parseInt(XACMLProperties.getProperty("MAX_CONTENT_LENGTH", "32767"))) {
+ if (request.getContentLength() > Integer.parseInt(XACMLProperties
+ .getProperty("MAX_CONTENT_LENGTH", "32767"))) {
String message = "Content-Length larger than server will accept.";
logger.info(message);
response.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
@@ -294,19 +259,22 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
}
this.doPutConfig(cache, request, response);
} else {
- String message = "Invalid cache: '" + cache + "' or content-type: '" + request.getContentType() + "'";
+ String message = "Invalid cache: '" + cache + "' or content-type: '" + request.getContentType()
+ + "'";
logger.error(message);
response.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
return;
}
}
- protected void doPutConfig(String config, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ protected void doPutConfig(String config, HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
try {
// prevent multiple configuration changes from stacking up
if (XACMLPdpServlet.queue.remainingCapacity() <= 0) {
logger.error("Queue capacity reached");
- response.sendError(HttpServletResponse.SC_CONFLICT, "Multiple configuration changes waiting processing.");
+ response.sendError(HttpServletResponse.SC_CONFLICT,
+ "Multiple configuration changes waiting processing.");
return;
}
//
@@ -317,7 +285,8 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
// should have something in the request
if (newProperties.size() == 0) {
logger.error("No properties in PUT");
- response.sendError(HttpServletResponse.SC_BAD_REQUEST, "PUT must contain at least one property");
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST,
+ "PUT must contain at least one property");
return;
}
//
@@ -328,7 +297,8 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
newProperties = XACMLProperties.getPolicyProperties(newProperties, true);
if (newProperties.size() == 0) {
logger.error("No policy properties in PUT");
- response.sendError(HttpServletResponse.SC_BAD_REQUEST, "PUT with cache=policies must contain at least one policy property");
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST,
+ "PUT with cache=policies must contain at least one policy property");
return;
}
XACMLPdpServlet.queue.offer(new PutRequest(newProperties, null));
@@ -336,7 +306,8 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
newProperties = XACMLProperties.getPipProperties(newProperties);
if (newProperties.size() == 0) {
logger.error("No pips properties in PUT");
- response.sendError(HttpServletResponse.SC_BAD_REQUEST, "PUT with cache=pips must contain at least one pip property");
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST,
+ "PUT with cache=pips must contain at least one pip property");
return;
}
XACMLPdpServlet.queue.offer(new PutRequest(null, newProperties));
@@ -344,13 +315,15 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
Properties newPolicyProperties = XACMLProperties.getPolicyProperties(newProperties, true);
if (newPolicyProperties.size() == 0) {
logger.error("No policy properties in PUT");
- response.sendError(HttpServletResponse.SC_BAD_REQUEST, "PUT with cache=all must contain at least one policy property");
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST,
+ "PUT with cache=all must contain at least one policy property");
return;
}
Properties newPipProperties = XACMLProperties.getPipProperties(newProperties);
if (newPipProperties.size() == 0) {
logger.error("No pips properties in PUT");
- response.sendError(HttpServletResponse.SC_BAD_REQUEST, "PUT with cache=all must contain at least one pip property");
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST,
+ "PUT with cache=all must contain at least one pip property");
return;
}
XACMLPdpServlet.queue.offer(new PutRequest(newPolicyProperties, newPipProperties));
@@ -359,7 +332,8 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
// Invalid value
//
logger.error("Invalid config value: " + config);
- response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Config must be one of 'policies', 'pips', 'all'");
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST,
+ "Config must be one of 'policies', 'pips', 'all'");
return;
}
} catch (Exception e) {
@@ -370,22 +344,17 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
}
/**
- * Parameters: type=hb|config|Status
- *
- * 1. HeartBeat Status
- * HeartBeat
- * OK - All Policies are Loaded, All PIPs are Loaded
- * LOADING_IN_PROGRESS - Currently loading a new policy set/pip configuration
- * LAST_UPDATE_FAILED - Need to track the items that failed during last update
- * LOAD_FAILURE - ??? Need to determine what information is sent and how
- * 2. Configuration
- * 3. Status
- * return the StdPDPStatus object in the Response content
- *
+ * Parameters: type=hb|config|Status 1. HeartBeat Status HeartBeat OK - All Policies are Loaded, All PIPs
+ * are Loaded LOADING_IN_PROGRESS - Currently loading a new policy set/pip configuration
+ * LAST_UPDATE_FAILED - Need to track the items that failed during last update LOAD_FAILURE - ??? Need to
+ * determine what information is sent and how 2. Configuration 3. Status return the StdPDPStatus object in
+ * the Response content
*
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
+ IOException {
XACMLRest.dumpRequest(request);
//
// What are they requesting?
@@ -397,11 +366,13 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
if ("config".equals(type)) {
response.setContentType("text/x-java-properties");
try {
- String lists = XACMLProperties.PROP_ROOTPOLICIES + "=" + XACMLProperties.getProperty(XACMLProperties.PROP_ROOTPOLICIES, "");
- lists = lists + "\n" + XACMLProperties.PROP_REFERENCEDPOLICIES + "=" + XACMLProperties.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES, "") + "\n";
+ String lists = XACMLProperties.PROP_ROOTPOLICIES + "="
+ + XACMLProperties.getProperty(XACMLProperties.PROP_ROOTPOLICIES, "");
+ lists = lists + "\n" + XACMLProperties.PROP_REFERENCEDPOLICIES + "="
+ + XACMLProperties.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES, "") + "\n";
try (InputStream listInputStream = new ByteArrayInputStream(lists.getBytes());
- InputStream pipInputStream = Files.newInputStream(XACMLPdpLoader.getPIPConfig());
- OutputStream os = response.getOutputStream()) {
+ InputStream pipInputStream = Files.newInputStream(XACMLPdpLoader.getPIPConfig());
+ OutputStream os = response.getOutputStream()) {
IOUtils.copy(listInputStream, os);
IOUtils.copy(pipInputStream, os);
}
@@ -417,9 +388,9 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
} else if ("Status".equals(type)) {
// convert response object to JSON and include in the response
- synchronized(pdpStatusLock) {
+ synchronized (pdpStatusLock) {
ObjectMapper mapper = new ObjectMapper();
- mapper.writeValue(response.getOutputStream(), status);
+ mapper.writeValue(response.getOutputStream(), status);
}
response.setStatus(HttpServletResponse.SC_OK);
@@ -427,25 +398,28 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
response.sendError(HttpServletResponse.SC_BAD_REQUEST, "type not 'config' or 'hb'");
}
if (returnHB) {
- synchronized(pdpStatusLock) {
- response.addHeader(XACMLRestProperties.PROP_PDP_HTTP_HEADER_HB, status.getStatus().toString());
+ synchronized (pdpStatusLock) {
+ response
+ .addHeader(XACMLRestProperties.PROP_PDP_HTTP_HEADER_HB, status.getStatus().toString());
}
}
}
/**
- * POST - We expect XACML requests to be posted by PEP applications. They can be in the form of XML or JSON according
- * to the XACML 3.0 Specifications for both.
- *
+ * POST - We expect XACML requests to be posted by PEP applications. They can be in the form of XML or
+ * JSON according to the XACML 3.0 Specifications for both.
*
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
+ IOException {
//
// no point in doing any work if we know from the get-go that we cannot do anything with the request
//
if (status.getLoadedRootPolicies().size() == 0) {
- logger.warn("Request from PEP at " + request.getRequestURI() + " for service when PDP has No Root Policies loaded");
+ logger.warn("Request from PEP at " + request.getRequestURI()
+ + " for service when PDP has No Root Policies loaded");
response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
return;
}
@@ -466,7 +440,8 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
//
// Limit the Content-Length to something reasonable
//
- if (request.getContentLength() > Integer.parseInt(XACMLProperties.getProperty("MAX_CONTENT_LENGTH", "32767"))) {
+ if (request.getContentLength() > Integer.parseInt(XACMLProperties.getProperty("MAX_CONTENT_LENGTH",
+ "32767"))) {
String message = "Content-Length larger than server will accept.";
logger.info(message);
response.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
@@ -482,7 +457,8 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
try {
contentType = ContentType.parse(request.getContentType());
} catch (Exception e) {
- String message = "Parsing Content-Type: " + request.getContentType() + ", error=" + e.getMessage();
+ String message = "Parsing Content-Type: " + request.getContentType() + ", error="
+ + e.getMessage();
logger.error(message, e);
response.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
return;
@@ -492,16 +468,16 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
//
String incomingRequestString = null;
Request pdpRequest = null;
- if (contentType.getMimeType().equalsIgnoreCase(ContentType.APPLICATION_JSON.getMimeType()) ||
- contentType.getMimeType().equalsIgnoreCase(ContentType.APPLICATION_XML.getMimeType()) ||
- contentType.getMimeType().equalsIgnoreCase("application/xacml+xml") ) {
+ if (contentType.getMimeType().equalsIgnoreCase(ContentType.APPLICATION_JSON.getMimeType())
+ || contentType.getMimeType().equalsIgnoreCase(ContentType.APPLICATION_XML.getMimeType())
+ || contentType.getMimeType().equalsIgnoreCase("application/xacml+xml")) {
//
// Read in the string
//
StringBuilder buffer = new StringBuilder();
BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream()));
String line;
- while((line = reader.readLine()) != null) {
+ while ((line = reader.readLine()) != null) {
buffer.append(line);
}
incomingRequestString = buffer.toString();
@@ -512,11 +488,12 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
try {
if (contentType.getMimeType().equalsIgnoreCase(ContentType.APPLICATION_JSON.getMimeType())) {
pdpRequest = JSONRequest.load(incomingRequestString);
- } else if ( contentType.getMimeType().equalsIgnoreCase(ContentType.APPLICATION_XML.getMimeType()) ||
- contentType.getMimeType().equalsIgnoreCase("application/xacml+xml")) {
+ } else if (contentType.getMimeType().equalsIgnoreCase(ContentType.APPLICATION_XML
+ .getMimeType())
+ || contentType.getMimeType().equalsIgnoreCase("application/xacml+xml")) {
pdpRequest = DOMRequest.load(incomingRequestString);
}
- } catch(Exception e) {
+ } catch (Exception e) {
logger.error("Could not parse request", e);
response.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage());
return;
@@ -530,7 +507,8 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
//
// Did we successfully get and parse a request?
//
- if (pdpRequest == null || pdpRequest.getRequestAttributes() == null || pdpRequest.getRequestAttributes().size() <= 0) {
+ if (pdpRequest == null || pdpRequest.getRequestAttributes() == null
+ || pdpRequest.getRequestAttributes().size() <= 0) {
String message = "Zero Attributes found in the request";
logger.error(message);
response.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
@@ -544,7 +522,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
// Get the pointer to the PDP Engine
//
PDPEngine myEngine = null;
- synchronized(pdpEngineLock) {
+ synchronized (pdpEngineLock) {
myEngine = this.pdpEngine;
}
if (myEngine == null) {
@@ -557,23 +535,27 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
// Send the request and save the response
//
long lTimeStart, lTimeEnd;
- Response pdpResponse = null;
+ Response pdpResponse = null;
-//TODO - Make this unnecessary
-//TODO It seems that the PDP Engine is not thread-safe, so when a configuration change occurs in the middle of processing
-//TODO a PEP Request, that Request fails (it throws a NullPointerException in the decide() method).
-//TODO Using synchronize will slow down processing of PEP requests, possibly by a significant amount.
-//TODO Since configuration changes are rare, it would be A Very Good Thing if we could eliminate this sychronized block.
-//TODO
-//TODO This problem was found by starting one PDP then
-//TODO RestLoadTest switching between 2 configurations, 1 second apart
-//TODO both configurations contain the datarouter policy
-//TODO both configurations already have all policies cached in the PDPs config directory
-//TODO RestLoadTest started with the Datarouter test requests, 5 threads, no interval
-//TODO With that configuration this code (without the synchronized) throws a NullPointerException
-//TODO within a few seconds.
-//
- synchronized(pdpEngineLock) {
+ // TODO - Make this unnecessary
+ // TODO It seems that the PDP Engine is not thread-safe, so when a configuration change occurs in
+ // the middle of processing
+ // TODO a PEP Request, that Request fails (it throws a NullPointerException in the decide()
+ // method).
+ // TODO Using synchronize will slow down processing of PEP requests, possibly by a significant
+ // amount.
+ // TODO Since configuration changes are rare, it would be A Very Good Thing if we could eliminate
+ // this sychronized block.
+ // TODO
+ // TODO This problem was found by starting one PDP then
+ // TODO RestLoadTest switching between 2 configurations, 1 second apart
+ // TODO both configurations contain the datarouter policy
+ // TODO both configurations already have all policies cached in the PDPs config directory
+ // TODO RestLoadTest started with the Datarouter test requests, 5 threads, no interval
+ // TODO With that configuration this code (without the synchronized) throws a NullPointerException
+ // TODO within a few seconds.
+ //
+ synchronized (pdpEngineLock) {
myEngine = this.pdpEngine;
try {
lTimeStart = System.currentTimeMillis();
@@ -619,8 +601,8 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
//
outgoingResponseString = JSONResponse.toString(pdpResponse, false);
}
- } else if ( contentType.getMimeType().equalsIgnoreCase(ContentType.APPLICATION_XML.getMimeType()) ||
- contentType.getMimeType().equalsIgnoreCase("application/xacml+xml")) {
+ } else if (contentType.getMimeType().equalsIgnoreCase(ContentType.APPLICATION_XML.getMimeType())
+ || contentType.getMimeType().equalsIgnoreCase("application/xacml+xml")) {
//
// Get it as a String. This is not very efficient but we need to log our
// results for auditing.
@@ -655,27 +637,33 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
// Keep running until we are told to terminate
//
try {
- while (! this.configThreadTerminate) {
+ while (!this.configThreadTerminate) {
PutRequest request = XACMLPdpServlet.queue.take();
StdPDPStatus newStatus = new StdPDPStatus();
-//TODO - This is related to the problem discussed in the doPost() method about the PDPEngine not being thread-safe.
-//TODO See that discussion, and when the PDPEngine is made thread-safe it should be ok to move the loadEngine out of
-//TODO the synchronized block.
-//TODO However, since configuration changes should be rare we may not care about changing this.
+ // TODO - This is related to the problem discussed in the doPost() method about the PDPEngine
+ // not being thread-safe.
+ // TODO See that discussion, and when the PDPEngine is made thread-safe it should be ok to
+ // move the loadEngine out of
+ // TODO the synchronized block.
+ // TODO However, since configuration changes should be rare we may not care about changing
+ // this.
PDPEngine newEngine = null;
- synchronized(pdpStatusLock) {
+ synchronized (pdpStatusLock) {
XACMLPdpServlet.status.setStatus(Status.UPDATING_CONFIGURATION);
- newEngine = XACMLPdpLoader.loadEngine(newStatus, request.policyProperties, request.pipConfigProperties);
+ newEngine = XACMLPdpLoader.loadEngine(newStatus, request.policyProperties,
+ request.pipConfigProperties);
}
-// PDPEngine newEngine = XACMLPdpLoader.loadEngine(newStatus, request.policyProperties, request.pipConfigProperties);
+ // PDPEngine newEngine = XACMLPdpLoader.loadEngine(newStatus, request.policyProperties,
+ // request.pipConfigProperties);
if (newEngine != null) {
- synchronized(XACMLPdpServlet.pdpEngineLock) {
+ synchronized (XACMLPdpServlet.pdpEngineLock) {
this.pdpEngine = newEngine;
try {
logger.info("Saving configuration.");
if (request.policyProperties != null) {
- try (OutputStream os = Files.newOutputStream(XACMLPdpLoader.getPDPPolicyCache())) {
+ try (OutputStream os = Files.newOutputStream(XACMLPdpLoader
+ .getPDPPolicyCache())) {
request.policyProperties.store(os, "");
}
}
@@ -695,7 +683,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
} else {
newStatus.setStatus(Status.LAST_UPDATE_FAILED);
}
- synchronized(pdpStatusLock) {
+ synchronized (pdpStatusLock) {
XACMLPdpServlet.status.set(newStatus);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/impl/XACMLPdpPIPFinderFactory.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/impl/XACMLPdpPIPFinderFactory.java b/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/impl/XACMLPdpPIPFinderFactory.java
index 74390b3..ad5c4f2 100644
--- a/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/impl/XACMLPdpPIPFinderFactory.java
+++ b/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/impl/XACMLPdpPIPFinderFactory.java
@@ -44,7 +44,7 @@ import com.att.research.xacml.util.XACMLProperties;
public class XACMLPdpPIPFinderFactory extends PIPFinderFactory {
private ConfigurableEngineFinder pipFinder;
- private static Log logger = LogFactory.getLog(XACMLPdpPIPFinderFactory.class);
+ private static Log logger = LogFactory.getLog(XACMLPdpPIPFinderFactory.class);
public XACMLPdpPIPFinderFactory() {
}
@@ -55,13 +55,13 @@ public class XACMLPdpPIPFinderFactory extends PIPFinderFactory {
@Override
public PIPFinder getFinder() throws PIPException {
if (pipFinder == null) {
- synchronized(this) {
+ synchronized (this) {
if (pipFinder == null) {
if (logger.isDebugEnabled()) {
logger.debug("Creating default configurable engine finder");
}
- pipFinder = new ConfigurableEngineFinder();
- Properties xacmlProperties = null;
+ pipFinder = new ConfigurableEngineFinder();
+ Properties xacmlProperties = null;
try {
xacmlProperties = XACMLProperties.getProperties();
} catch (Exception ex) {
@@ -69,7 +69,7 @@ public class XACMLPdpPIPFinderFactory extends PIPFinderFactory {
return null;
}
if (xacmlProperties != null) {
- ((ConfigurableEngineFinder)pipFinder).configure(xacmlProperties);
+ pipFinder.configure(xacmlProperties);
}
}
}
@@ -80,13 +80,13 @@ public class XACMLPdpPIPFinderFactory extends PIPFinderFactory {
@Override
public PIPFinder getFinder(Properties properties) throws PIPException {
if (pipFinder == null) {
- synchronized(this) {
+ synchronized (this) {
if (pipFinder == null) {
if (logger.isDebugEnabled()) {
logger.debug("Creating configurable engine finder using: " + properties);
}
- pipFinder = new ConfigurableEngineFinder();
- ((ConfigurableEngineFinder)pipFinder).configure(properties);
+ pipFinder = new ConfigurableEngineFinder();
+ pipFinder.configure(properties);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/impl/XACMLPdpPolicyFinderFactory.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/impl/XACMLPdpPolicyFinderFactory.java b/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/impl/XACMLPdpPolicyFinderFactory.java
index 6f35879..ad3b46e 100644
--- a/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/impl/XACMLPdpPolicyFinderFactory.java
+++ b/openaz-xacml-pdp-rest/src/main/java/com/att/research/xacml/rest/impl/XACMLPdpPolicyFinderFactory.java
@@ -47,22 +47,16 @@ import com.att.research.xacml.std.StdStatusCode;
import com.att.research.xacml.std.dom.DOMStructureException;
import com.att.research.xacml.util.FactoryException;
import com.att.research.xacml.util.XACMLProperties;
-import com.att.research.xacmlatt.pdp.policy.Policy;
-import com.att.research.xacmlatt.pdp.policy.PolicyDef;
-import com.att.research.xacmlatt.pdp.policy.PolicyFinder;
-import com.att.research.xacmlatt.pdp.policy.PolicyFinderFactory;
-import com.att.research.xacmlatt.pdp.policy.dom.DOMPolicyDef;
-import com.att.research.xacmlatt.pdp.std.StdPolicyFinder;
import com.google.common.base.Splitter;
public class XACMLPdpPolicyFinderFactory extends PolicyFinderFactory {
- public static final String PROP_FILE = ".file";
- public static final String PROP_URL = ".url";
+ public static final String PROP_FILE = ".file";
+ public static final String PROP_URL = ".url";
- private static Log logger = LogFactory.getLog(XACMLPdpPolicyFinderFactory.class);
+ private static Log logger = LogFactory.getLog(XACMLPdpPolicyFinderFactory.class);
private List<PolicyDef> rootPolicies;
private List<PolicyDef> referencedPolicies;
- private boolean needsInit = true;
+ private boolean needsInit = true;
private Properties properties = null;
@@ -87,9 +81,9 @@ public class XACMLPdpPolicyFinderFactory extends PolicyFinderFactory {
}
/**
- * Loads the <code>PolicyDef</code> for the given <code>String</code> identifier by looking first
- * for a ".file" property associated with the ID and using that to load from a <code>File</code> and
- * looking for a ".url" property associated with the ID and using that to load from a <code>URL</code>.
+ * Loads the <code>PolicyDef</code> for the given <code>String</code> identifier by looking first for a
+ * ".file" property associated with the ID and using that to load from a <code>File</code> and looking for
+ * a ".url" property associated with the ID and using that to load from a <code>URL</code>.
*
* @param policyId the <code>String</code> identifier for the policy
* @return a <code>PolicyDef</code> loaded from the given identifier
@@ -97,16 +91,18 @@ public class XACMLPdpPolicyFinderFactory extends PolicyFinderFactory {
protected PolicyDef loadPolicyDef(String policyId) {
String propLocation = null;
if (this.properties == null) {
- propLocation = XACMLProperties.getProperty(policyId + PROP_FILE);
+ propLocation = XACMLProperties.getProperty(policyId + PROP_FILE);
} else {
- propLocation = this.properties.getProperty(policyId + PROP_FILE);
+ propLocation = this.properties.getProperty(policyId + PROP_FILE);
}
if (propLocation != null) {
- File fileLocation = new File(propLocation);
+ File fileLocation = new File(propLocation);
if (!fileLocation.exists()) {
- XACMLPdpPolicyFinderFactory.logger.error("Policy file " + fileLocation.getAbsolutePath() + " does not exist.");
+ XACMLPdpPolicyFinderFactory.logger.error("Policy file " + fileLocation.getAbsolutePath()
+ + " does not exist.");
} else if (!fileLocation.canRead()) {
- XACMLPdpPolicyFinderFactory.logger.error("Policy file " + fileLocation.getAbsolutePath() + " cannot be read.");
+ XACMLPdpPolicyFinderFactory.logger.error("Policy file " + fileLocation.getAbsolutePath()
+ + " cannot be read.");
} else {
try {
XACMLPdpPolicyFinderFactory.logger.info("Loading policy file " + fileLocation);
@@ -115,7 +111,9 @@ public class XACMLPdpPolicyFinderFactory extends PolicyFinderFactory {
return policyDef;
}
} catch (DOMStructureException ex) {
- XACMLPdpPolicyFinderFactory.logger.error("Error loading policy file " + fileLocation.getAbsolutePath() + ": " + ex.getMessage(), ex);
+ XACMLPdpPolicyFinderFactory.logger.error("Error loading policy file "
+ + fileLocation.getAbsolutePath() + ": "
+ + ex.getMessage(), ex);
return new Policy(StdStatusCode.STATUS_CODE_SYNTAX_ERROR, ex.getMessage());
}
}
@@ -128,27 +126,32 @@ public class XACMLPdpPolicyFinderFactory extends PolicyFinderFactory {
if (propLocation != null) {
InputStream is = null;
try {
- URL url = new URL(propLocation);
- URLConnection urlConnection = url.openConnection();
+ URL url = new URL(propLocation);
+ URLConnection urlConnection = url.openConnection();
XACMLPdpPolicyFinderFactory.logger.info("Loading policy file " + url.toString());
is = urlConnection.getInputStream();
- PolicyDef policyDef = DOMPolicyDef.load(is);
+ PolicyDef policyDef = DOMPolicyDef.load(is);
if (policyDef != null) {
return policyDef;
}
} catch (MalformedURLException ex) {
- XACMLPdpPolicyFinderFactory.logger.error("Invalid URL " + propLocation + ": " + ex.getMessage(), ex);
+ XACMLPdpPolicyFinderFactory.logger.error("Invalid URL " + propLocation + ": "
+ + ex.getMessage(), ex);
} catch (IOException ex) {
- XACMLPdpPolicyFinderFactory.logger.error("IOException opening URL " + propLocation + ": " + ex.getMessage(), ex);
+ XACMLPdpPolicyFinderFactory.logger.error("IOException opening URL " + propLocation + ": "
+ + ex.getMessage(), ex);
} catch (DOMStructureException ex) {
- XACMLPdpPolicyFinderFactory.logger.error("Invalid Policy " + propLocation + ": " + ex.getMessage(), ex);
+ XACMLPdpPolicyFinderFactory.logger.error("Invalid Policy " + propLocation + ": "
+ + ex.getMessage(), ex);
return new Policy(StdStatusCode.STATUS_CODE_SYNTAX_ERROR, ex.getMessage());
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
- XACMLPdpPolicyFinderFactory.logger.error("Exception closing InputStream for GET of url " + propLocation + " : " + e.getMessage() + " (May be memory leak)", e);
+ XACMLPdpPolicyFinderFactory.logger
+ .error("Exception closing InputStream for GET of url " + propLocation + " : "
+ + e.getMessage() + " (May be memory leak)", e);
}
}
}
@@ -162,21 +165,22 @@ public class XACMLPdpPolicyFinderFactory extends PolicyFinderFactory {
* Finds the identifiers for all of the policies referenced by the given property name in the
* <code>XACMLProperties</code> and loads them using the requested loading method.
*
- * @param propertyName the <code>String</code> name of the property containing the list of policy identifiers
+ * @param propertyName the <code>String</code> name of the property containing the list of policy
+ * identifiers
* @return a <code>List</code> of <code>PolicyDef</code>s loaded from the given property name
*/
protected List<PolicyDef> getPolicyDefs(String propertyName) {
- String policyIds = XACMLProperties.getProperty(propertyName);
+ String policyIds = XACMLProperties.getProperty(propertyName);
if (policyIds == null || policyIds.length() == 0) {
return null;
}
- Iterable<String> policyIdArray = Splitter.on(',').trimResults().omitEmptyStrings().split(policyIds);
+ Iterable<String> policyIdArray = Splitter.on(',').trimResults().omitEmptyStrings().split(policyIds);
if (policyIdArray == null) {
return null;
}
- List<PolicyDef> listPolicyDefs = new ArrayList<PolicyDef>();
+ List<PolicyDef> listPolicyDefs = new ArrayList<PolicyDef>();
for (String policyId : policyIdArray) {
PolicyDef policyDef = this.loadPolicyDef(policyId);
if (policyDef != null) {
@@ -191,13 +195,13 @@ public class XACMLPdpPolicyFinderFactory extends PolicyFinderFactory {
if (XACMLPdpPolicyFinderFactory.logger.isDebugEnabled()) {
XACMLPdpPolicyFinderFactory.logger.debug("Initializing");
}
- this.rootPolicies = this.getPolicyDefs(XACMLProperties.PROP_ROOTPOLICIES);
- this.referencedPolicies = this.getPolicyDefs(XACMLProperties.PROP_REFERENCEDPOLICIES);
+ this.rootPolicies = this.getPolicyDefs(XACMLProperties.PROP_ROOTPOLICIES);
+ this.referencedPolicies = this.getPolicyDefs(XACMLProperties.PROP_REFERENCEDPOLICIES);
if (XACMLPdpPolicyFinderFactory.logger.isDebugEnabled()) {
XACMLPdpPolicyFinderFactory.logger.debug("Root Policies: " + this.rootPolicies);
XACMLPdpPolicyFinderFactory.logger.debug("Referenced Policies: " + this.referencedPolicies);
}
- this.needsInit = false;
+ this.needsInit = false;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/ATTPDPEngine.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/ATTPDPEngine.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/ATTPDPEngine.java
index ee311a1..fd8dedd 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/ATTPDPEngine.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/ATTPDPEngine.java
@@ -69,19 +69,27 @@ import com.att.research.xacmlatt.pdp.policy.PolicyDef;
import com.att.research.xacmlatt.pdp.policy.PolicyFinderResult;
/**
- * ATTPDPEngine implements the {@link com.att.research.xacml.api.pdp.PDPEngine} interface using the XACML 3.0 specification.
- *
+ * ATTPDPEngine implements the {@link com.att.research.xacml.api.pdp.PDPEngine} interface using the XACML 3.0
+ * specification.
*/
public class ATTPDPEngine implements PDPEngine, Traceable {
- private static final Status STATUS_ADVICE_NA = new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, "Advice not allowed in combined decision");
- private static final Status STATUS_OBLIGATIONS_NA = new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, "Obligations not allowed in combined decision");
- private static final Status STATUS_COMBINE_FAILED = new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, "Individual decisions do not match");
- private static final Result RESULT_ECTX_NULL = new StdMutableResult(new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, "Null EvaluationContext"));
+ private static final Status STATUS_ADVICE_NA = new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR,
+ "Advice not allowed in combined decision");
+ private static final Status STATUS_OBLIGATIONS_NA = new StdStatus(
+ StdStatusCode.STATUS_CODE_PROCESSING_ERROR,
+ "Obligations not allowed in combined decision");
+ private static final Status STATUS_COMBINE_FAILED = new StdStatus(
+ StdStatusCode.STATUS_CODE_PROCESSING_ERROR,
+ "Individual decisions do not match");
+ private static final Result RESULT_ECTX_NULL = new StdMutableResult(
+ new StdStatus(
+ StdStatusCode.STATUS_CODE_PROCESSING_ERROR,
+ "Null EvaluationContext"));
/*
* These are the profiles that this reference implementation of the PDP engine supports
*/
- private static final Set<URI> PROFILES = new HashSet<URI>();
+ private static final Set<URI> PROFILES = new HashSet<URI>();
static {
PROFILES.add(XACML3.ID_PROFILE_MULTIPLE_COMBINED_DECISION.getUri());
PROFILES.add(XACML3.ID_PROFILE_MULTIPLE_REFERENCE.getUri());
@@ -91,19 +99,20 @@ public class ATTPDPEngine implements PDPEngine, Traceable {
}
private EvaluationContextFactory evaluationContextFactory;
- private Decision defaultDecision = Decision.INDETERMINATE;
+ private Decision defaultDecision = Decision.INDETERMINATE;
private ScopeResolver scopeResolver;
private TraceEngine traceEngine;
- private Log logger = LogFactory.getLog(this.getClass());
+ private Log logger = LogFactory.getLog(this.getClass());
protected TraceEngine getTraceEngine() {
if (this.traceEngine == null) {
- synchronized(this) {
+ synchronized (this) {
if (this.traceEngine == null) {
try {
- this.traceEngine = TraceEngineFactory.newInstance().getTraceEngine();
+ this.traceEngine = TraceEngineFactory.newInstance().getTraceEngine();
} catch (FactoryException ex) {
- this.logger.error("FactoryException creating TraceEngine instance: " + ex.toString(), ex);
+ this.logger.error("FactoryException creating TraceEngine instance: " + ex.toString(),
+ ex);
throw new IllegalStateException("FactoryException creating TraceEngine instance", ex);
}
}
@@ -113,51 +122,60 @@ public class ATTPDPEngine implements PDPEngine, Traceable {
}
public ATTPDPEngine(EvaluationContextFactory evaluationContextFactoryIn, ScopeResolver scopeResolverIn) {
- this.evaluationContextFactory = evaluationContextFactoryIn;
- this.scopeResolver = scopeResolverIn;
+ this.evaluationContextFactory = evaluationContextFactoryIn;
+ this.scopeResolver = scopeResolverIn;
}
- public ATTPDPEngine(EvaluationContextFactory evaluationContextFactoryIn, Decision defaultDecisionIn, ScopeResolver scopeResolverIn) {
+ public ATTPDPEngine(EvaluationContextFactory evaluationContextFactoryIn, Decision defaultDecisionIn,
+ ScopeResolver scopeResolverIn) {
this(evaluationContextFactoryIn, scopeResolverIn);
- this.defaultDecision = defaultDecisionIn;
+ this.defaultDecision = defaultDecisionIn;
}
- public ATTPDPEngine(EvaluationContextFactory evaluationContextFactoryIn, Decision defaultDecisionIn, ScopeResolver scopeResolverIn, Properties properties) {
+ public ATTPDPEngine(EvaluationContextFactory evaluationContextFactoryIn, Decision defaultDecisionIn,
+ ScopeResolver scopeResolverIn, Properties properties) {
this(evaluationContextFactoryIn, defaultDecisionIn, scopeResolverIn);
}
protected Result processRequest(EvaluationContext evaluationContext) {
try {
- PolicyFinderResult<PolicyDef> policyFinderResult = evaluationContext.getRootPolicyDef();
+ PolicyFinderResult<PolicyDef> policyFinderResult = evaluationContext.getRootPolicyDef();
if (policyFinderResult.getStatus() != null && !policyFinderResult.getStatus().isOk()) {
return new StdMutableResult(policyFinderResult.getStatus());
}
- PolicyDef policyDefRoot = policyFinderResult.getPolicyDef();
+ PolicyDef policyDefRoot = policyFinderResult.getPolicyDef();
if (policyDefRoot == null) {
- switch(this.defaultDecision) {
+ switch (this.defaultDecision) {
case DENY:
case NOTAPPLICABLE:
case PERMIT:
- return new StdMutableResult(this.defaultDecision, new StdStatus(StdStatusCode.STATUS_CODE_OK, "No applicable policy"));
+ return new StdMutableResult(this.defaultDecision,
+ new StdStatus(StdStatusCode.STATUS_CODE_OK,
+ "No applicable policy"));
case INDETERMINATE:
case INDETERMINATE_DENY:
case INDETERMINATE_DENYPERMIT:
case INDETERMINATE_PERMIT:
- return new StdMutableResult(this.defaultDecision, new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, "No applicable policy"));
+ return new StdMutableResult(this.defaultDecision,
+ new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR,
+ "No applicable policy"));
}
}
- Result result = policyDefRoot.evaluate(evaluationContext);
+ Result result = policyDefRoot.evaluate(evaluationContext);
if (result.getStatus().isOk()) {
- Collection<AttributeCategory> listRequestAttributesIncludeInResult = evaluationContext.getRequest().getRequestAttributesIncludedInResult();
- if (listRequestAttributesIncludeInResult != null && listRequestAttributesIncludeInResult.size() > 0) {
- StdMutableResult stdMutableResult = new StdMutableResult(result);
+ Collection<AttributeCategory> listRequestAttributesIncludeInResult = evaluationContext
+ .getRequest().getRequestAttributesIncludedInResult();
+ if (listRequestAttributesIncludeInResult != null
+ && listRequestAttributesIncludeInResult.size() > 0) {
+ StdMutableResult stdMutableResult = new StdMutableResult(result);
stdMutableResult.addAttributeCategories(listRequestAttributesIncludeInResult);
- result = new StdResult(stdMutableResult);
+ result = new StdResult(stdMutableResult);
}
}
return result;
} catch (EvaluationException ex) {
- return new StdMutableResult(new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, ex.getMessage()));
+ return new StdMutableResult(new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR,
+ ex.getMessage()));
}
}
@@ -166,11 +184,11 @@ public class ATTPDPEngine implements PDPEngine, Traceable {
/*
* Validate the request
*/
- TraceEngine traceEngineThis = this.getTraceEngine();
+ TraceEngine traceEngineThis = this.getTraceEngine();
if (traceEngineThis.isTracing()) {
traceEngineThis.trace(new StdTraceEvent<Request>("Input Request", this, pepRequest));
}
- Status statusRequest = pepRequest.getStatus();
+ Status statusRequest = pepRequest.getStatus();
if (statusRequest != null && !statusRequest.isOk()) {
return new StdMutableResponse(statusRequest);
}
@@ -178,56 +196,65 @@ public class ATTPDPEngine implements PDPEngine, Traceable {
/*
* Split the original request up into individual decision requests
*/
- StdIndividualDecisionRequestGenerator stdIndividualDecisionRequestGenerator = new StdIndividualDecisionRequestGenerator(this.scopeResolver, pepRequest);
+ StdIndividualDecisionRequestGenerator stdIndividualDecisionRequestGenerator = new StdIndividualDecisionRequestGenerator(
+ this.scopeResolver,
+ pepRequest);
/*
* Determine if we are combining multiple results into a single result
*/
boolean bCombineResults = pepRequest.getCombinedDecision();
- StdMutableResult stdResultCombined = null;
+ StdMutableResult stdResultCombined = null;
/*
- * Iterate over all of the individual decision requests and process them, combining them into the final response
+ * Iterate over all of the individual decision requests and process them, combining them into the
+ * final response
*/
- StdMutableResponse stdResponse = new StdMutableResponse();
- Iterator<Request> iterRequestsIndividualDecision = stdIndividualDecisionRequestGenerator.getIndividualDecisionRequests();
+ StdMutableResponse stdResponse = new StdMutableResponse();
+ Iterator<Request> iterRequestsIndividualDecision = stdIndividualDecisionRequestGenerator
+ .getIndividualDecisionRequests();
if (iterRequestsIndividualDecision == null || !iterRequestsIndividualDecision.hasNext()) {
- return new StdMutableResponse(new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, "No individual decision requests"));
+ return new StdMutableResponse(new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR,
+ "No individual decision requests"));
}
while (iterRequestsIndividualDecision.hasNext()) {
- Request requestIndividualDecision = iterRequestsIndividualDecision.next();
+ Request requestIndividualDecision = iterRequestsIndividualDecision.next();
if (traceEngineThis.isTracing()) {
- traceEngineThis.trace(new StdTraceEvent<Request>("Individual Request", this, requestIndividualDecision));
+ traceEngineThis.trace(new StdTraceEvent<Request>("Individual Request", this,
+ requestIndividualDecision));
}
- Result resultIndividualDecision = null;
- if (requestIndividualDecision.getStatus() != null && !requestIndividualDecision.getStatus().isOk()) {
- resultIndividualDecision = new StdMutableResult(requestIndividualDecision.getStatus());
+ Result resultIndividualDecision = null;
+ if (requestIndividualDecision.getStatus() != null
+ && !requestIndividualDecision.getStatus().isOk()) {
+ resultIndividualDecision = new StdMutableResult(requestIndividualDecision.getStatus());
} else {
- EvaluationContext evaluationContext = this.evaluationContextFactory.getEvaluationContext(requestIndividualDecision);
+ EvaluationContext evaluationContext = this.evaluationContextFactory
+ .getEvaluationContext(requestIndividualDecision);
if (evaluationContext == null) {
- resultIndividualDecision = RESULT_ECTX_NULL;
+ resultIndividualDecision = RESULT_ECTX_NULL;
} else {
- resultIndividualDecision = this.processRequest(evaluationContext);
+ resultIndividualDecision = this.processRequest(evaluationContext);
}
}
- assert(resultIndividualDecision != null);
+ assert (resultIndividualDecision != null);
if (traceEngineThis.isTracing()) {
- traceEngineThis.trace(new StdTraceEvent<Result>("Individual Result", this, resultIndividualDecision));
+ traceEngineThis.trace(new StdTraceEvent<Result>("Individual Result", this,
+ resultIndividualDecision));
}
if (bCombineResults) {
- Decision decision = resultIndividualDecision.getDecision();
- Status status = resultIndividualDecision.getStatus();
+ Decision decision = resultIndividualDecision.getDecision();
+ Status status = resultIndividualDecision.getStatus();
if (resultIndividualDecision.getAssociatedAdvice().size() > 0) {
- decision = Decision.INDETERMINATE;
- status = STATUS_ADVICE_NA;
+ decision = Decision.INDETERMINATE;
+ status = STATUS_ADVICE_NA;
} else if (resultIndividualDecision.getObligations().size() > 0) {
- decision = Decision.INDETERMINATE;
- status = STATUS_OBLIGATIONS_NA;
+ decision = Decision.INDETERMINATE;
+ status = STATUS_OBLIGATIONS_NA;
}
if (stdResultCombined == null) {
- stdResultCombined = new StdMutableResult(decision, status);
+ stdResultCombined = new StdMutableResult(decision, status);
} else {
if (stdResultCombined.getDecision() != resultIndividualDecision.getDecision()) {
stdResultCombined.setDecision(Decision.INDETERMINATE);
@@ -238,7 +265,8 @@ public class ATTPDPEngine implements PDPEngine, Traceable {
stdResultCombined.addPolicySetIdentifiers(resultIndividualDecision.getPolicySetIdentifiers());
stdResultCombined.addAttributeCategories(resultIndividualDecision.getAttributes());
if (traceEngineThis.isTracing()) {
- traceEngineThis.trace(new StdTraceEvent<Result>("Combined result", this, stdResultCombined));
+ traceEngineThis.trace(new StdTraceEvent<Result>("Combined result", this,
+ stdResultCombined));
}
} else {
stdResponse.add(resultIndividualDecision);
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/ATTPDPEngineFactory.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/ATTPDPEngineFactory.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/ATTPDPEngineFactory.java
index e6c07e7..7d6117f 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/ATTPDPEngineFactory.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/ATTPDPEngineFactory.java
@@ -41,20 +41,19 @@ import com.att.research.xacml.util.FactoryException;
import com.att.research.xacmlatt.pdp.eval.EvaluationContextFactory;
/**
- * ATTPDPEngineFactory extends {@link com.att.research.xacml.api.pdp.PDPEngineFactory} by implementing the abstract
- * <code>newEngine</code> method to create a {@link ATTPDPEngine} instance and initialize it
- * with policies and PIP instances based on configuration information provided to the factory.
- *
+ * ATTPDPEngineFactory extends {@link com.att.research.xacml.api.pdp.PDPEngineFactory} by implementing the
+ * abstract <code>newEngine</code> method to create a {@link ATTPDPEngine} instance and initialize it with
+ * policies and PIP instances based on configuration information provided to the factory.
*/
public class ATTPDPEngineFactory extends PDPEngineFactory {
- private Log logger = LogFactory.getLog(this.getClass());
+ private Log logger = LogFactory.getLog(this.getClass());
public ATTPDPEngineFactory() {
}
@Override
public PDPEngine newEngine() throws FactoryException {
- EvaluationContextFactory evaluationContextFactory = EvaluationContextFactory.newInstance();
+ EvaluationContextFactory evaluationContextFactory = EvaluationContextFactory.newInstance();
if (evaluationContextFactory == null) {
this.logger.error("Null EvaluationContextFactory");
throw new FactoryException("Null EvaluationContextFactory");
@@ -64,11 +63,12 @@ public class ATTPDPEngineFactory extends PDPEngineFactory {
@Override
public PDPEngine newEngine(Properties properties) throws FactoryException {
- EvaluationContextFactory evaluationContextFactory = EvaluationContextFactory.newInstance(properties);
+ EvaluationContextFactory evaluationContextFactory = EvaluationContextFactory.newInstance(properties);
if (evaluationContextFactory == null) {
this.logger.error("Null EvaluationContextFactory");
throw new FactoryException("Null EvaluationContextFactory");
}
- return new ATTPDPEngine(evaluationContextFactory, this.getDefaultBehavior(), this.getScopeResolver(), properties);
+ return new ATTPDPEngine(evaluationContextFactory, this.getDefaultBehavior(), this.getScopeResolver(),
+ properties);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/Evaluatable.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/Evaluatable.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/Evaluatable.java
index 68f7134..bc9f7e8 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/Evaluatable.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/Evaluatable.java
@@ -32,9 +32,9 @@
package com.att.research.xacmlatt.pdp.eval;
/**
- * Evaluatable is the interface objects implement to indicate they can be evaluated with an {@link com.att.research.xacmlatt.pdp.eval.EvaluationContext}
- * and return an {@link com.att.research.xacmlatt.pdp.eval.EvaluationResult}.
- *
+ * Evaluatable is the interface objects implement to indicate they can be evaluated with an
+ * {@link com.att.research.xacmlatt.pdp.eval.EvaluationContext} and return an
+ * {@link com.att.research.xacmlatt.pdp.eval.EvaluationResult}.
*/
public interface Evaluatable {
public EvaluationResult evaluate(EvaluationContext evaluationContext) throws EvaluationException;
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationContext.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationContext.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationContext.java
index 23bc1fc..81f8a9e 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationContext.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationContext.java
@@ -43,48 +43,55 @@ import com.att.research.xacmlatt.pdp.policy.PolicyFinderResult;
import com.att.research.xacmlatt.pdp.policy.PolicySet;
/**
- * EvaluationContext provides the interface that the PDP uses to evaluate its set of Policies and PolicySets against
- * a {@link com.att.research.xacml.api.Request}.
- *
+ * EvaluationContext provides the interface that the PDP uses to evaluate its set of Policies and PolicySets
+ * against a {@link com.att.research.xacml.api.Request}.
*/
public interface EvaluationContext extends PIPFinder, TraceEngine {
/**
- * Gets the original <code>Request</code> provided to the <code>ATTPDPEngine</code>'s <code>decide</code> method.
+ * Gets the original <code>Request</code> provided to the <code>ATTPDPEngine</code>'s <code>decide</code>
+ * method.
*
- * @return the <code>Request</code> provided to the <code>ATTPDPEngine</code>'s <code>decide</code> method.
+ * @return the <code>Request</code> provided to the <code>ATTPDPEngine</code>'s <code>decide</code>
+ * method.
*/
public Request getRequest();
/**
- * Gets the root {@link com.att.research.xacmlatt.pdp.policy.PolicyDef} from the policy store
- * configured by the particular implementation of the <code>PolicyFinderFactory</code> class.
+ * Gets the root {@link com.att.research.xacmlatt.pdp.policy.PolicyDef} from the policy store configured
+ * by the particular implementation of the <code>PolicyFinderFactory</code> class.
*
* @return a <code>PolicyFinderResult</code> with the root <code>PolicyDef</code>
*/
public abstract PolicyFinderResult<PolicyDef> getRootPolicyDef();
/**
- * Gets the {@link com.att.research.xacmlatt.pdp.policy.Policy} that matches the given {@link com.att.research.xacml.api.IdReferenceMatch}.
+ * Gets the {@link com.att.research.xacmlatt.pdp.policy.Policy} that matches the given
+ * {@link com.att.research.xacml.api.IdReferenceMatch}.
*
* @param idReferenceMatch the <code>IdReferenceMatch</code> to search for
- * @return a <code>PolicyFinderResult</code> with the <code>Policy</code> matching the given <code>IdReferenceMatch</code>
+ * @return a <code>PolicyFinderResult</code> with the <code>Policy</code> matching the given
+ * <code>IdReferenceMatch</code>
*/
public abstract PolicyFinderResult<Policy> getPolicy(IdReferenceMatch idReferenceMatch);
/**
- * Gets the {@link com.att.research.xacmlatt.pdp.policy.PolicySet} that matches the given {@link com.att.research.xacml.api.IdReferenceMatch}.
+ * Gets the {@link com.att.research.xacmlatt.pdp.policy.PolicySet} that matches the given
+ * {@link com.att.research.xacml.api.IdReferenceMatch}.
*
* @param idReferenceMatch the <code>IdReferenceMatch</code> to search for
- * @return a <code>PolicyFinderResult</code> with the <code>PolicySet</code> matching the given <code>IdReferenceMatch</code>.
+ * @return a <code>PolicyFinderResult</code> with the <code>PolicySet</code> matching the given
+ * <code>IdReferenceMatch</code>.
*/
public abstract PolicyFinderResult<PolicySet> getPolicySet(IdReferenceMatch idReferenceMatch);
/**
- * Gets the {@link com.att.research.xacml.api.pip.PIPResponse} containing {@link com.att.research.xacml.api.Attribute}s that
- * match the given {@link com.att.research.xacml.api.pip.PIPRequest} from this <code>EvaluationContext</code>.
+ * Gets the {@link com.att.research.xacml.api.pip.PIPResponse} containing
+ * {@link com.att.research.xacml.api.Attribute}s that match the given
+ * {@link com.att.research.xacml.api.pip.PIPRequest} from this <code>EvaluationContext</code>.
*
* @param pipRequest the <code>PIPRequest</code> specifying which <code>Attribute</code>s to retrieve
- * @return the <code>PIPResponse</code> containing the {@link com.att.research.xacml.api.Status} and <code>Attribute</code>s
+ * @return the <code>PIPResponse</code> containing the {@link com.att.research.xacml.api.Status} and
+ * <code>Attribute</code>s
* @throws EvaluationException if there is an error retrieving the <code>Attribute</code>s
*/
public PIPResponse getAttributes(PIPRequest pipRequest) throws PIPException;
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationContextException.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationContextException.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationContextException.java
index 402125d..2c8b340 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationContextException.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationContextException.java
@@ -31,9 +31,8 @@
package com.att.research.xacmlatt.pdp.eval;
/**
- * EvaluationContextException extends <code>Exception</code> to represent errors thrown by
- * methods in the {@link EvaluationContext} and {@link EvaluationContextFactory}.
- *
+ * EvaluationContextException extends <code>Exception</code> to represent errors thrown by methods in the
+ * {@link EvaluationContext} and {@link EvaluationContextFactory}.
*/
public class EvaluationContextException extends Exception {
private static final long serialVersionUID = -8270506903118536839L;
@@ -53,7 +52,8 @@ public class EvaluationContextException extends Exception {
super(message, cause);
}
- public EvaluationContextException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ public EvaluationContextException(String message, Throwable cause, boolean enableSuppression,
+ boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationContextFactory.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationContextFactory.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationContextFactory.java
index 59fbf44..c22267a 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationContextFactory.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationContextFactory.java
@@ -40,13 +40,12 @@ import com.att.research.xacmlatt.pdp.policy.PolicyFinder;
import com.att.research.xacmlatt.pdp.util.ATTPDPProperties;
/**
- * EvaluationContextFactory provides methods for creating {@link EvaluationContext} objects
- * based on configuration information found in standard places. (TODO: Detail what these are)
- *
+ * EvaluationContextFactory provides methods for creating {@link EvaluationContext} objects based on
+ * configuration information found in standard places. (TODO: Detail what these are)
*/
public abstract class EvaluationContextFactory {
- private static final String FACTORYID = ATTPDPProperties.PROP_EVALUATIONCONTEXTFACTORY;
- private static final String DEFAULT_FACTORY_CLASSNAME = "com.att.research.xacmlatt.pdp.std.StdEvaluationContextFactory";
+ private static final String FACTORYID = ATTPDPProperties.PROP_EVALUATIONCONTEXTFACTORY;
+ private static final String DEFAULT_FACTORY_CLASSNAME = "com.att.research.xacmlatt.pdp.std.StdEvaluationContextFactory";
protected EvaluationContextFactory() {
}
@@ -59,10 +58,12 @@ public abstract class EvaluationContextFactory {
}
public static EvaluationContextFactory newInstance(Properties properties) throws FactoryException {
- return FactoryFinder.find(FACTORYID, DEFAULT_FACTORY_CLASSNAME, EvaluationContextFactory.class, properties);
+ return FactoryFinder.find(FACTORYID, DEFAULT_FACTORY_CLASSNAME, EvaluationContextFactory.class,
+ properties);
}
- public static EvaluationContextFactory newInstance(String className, ClassLoader classLoader) throws FactoryException {
+ public static EvaluationContextFactory newInstance(String className, ClassLoader classLoader)
+ throws FactoryException {
return FactoryFinder.newInstance(className, EvaluationContextFactory.class, classLoader, false);
}
@@ -71,7 +72,8 @@ public abstract class EvaluationContextFactory {
}
/**
- * Gets a new {@link com.att.research.xacml.pdp.eval.EvaluationContext} for the given {@link com.att.research.xacml.api.Request}.
+ * Gets a new {@link com.att.research.xacml.pdp.eval.EvaluationContext} for the given
+ * {@link com.att.research.xacml.api.Request}.
*
* @param request the <code>Request</code> for the new <code>EvaluationContext</code>
* @return a new <code>EvaluationContext</code> for the given <code>Request</code>
@@ -79,16 +81,19 @@ public abstract class EvaluationContextFactory {
public abstract EvaluationContext getEvaluationContext(Request request);
/**
- * Sets the {@link com.att.research.xacmlatt.pdp.policy.PolicyFinder} for this <code>EvaluationContextFactory</code> to an
- * explicit instance instead of the default or configured value.
+ * Sets the {@link com.att.research.xacmlatt.pdp.policy.PolicyFinder} for this
+ * <code>EvaluationContextFactory</code> to an explicit instance instead of the default or configured
+ * value.
*
- * @param policyFinder the <code>PolicyFinder</code> to use in creating new <code>EvaluationContext</code>s.
+ * @param policyFinder the <code>PolicyFinder</code> to use in creating new <code>EvaluationContext</code>
+ * s.
*/
public abstract void setPolicyFinder(PolicyFinder policyFinder);
/**
- * Sets the {@link com.att.research.xacml.api.pip.PIPFinder} for this <code>EvaluationContextFactory</code> to an
- * explicit instance instaed of the default or configured value.
+ * Sets the {@link com.att.research.xacml.api.pip.PIPFinder} for this
+ * <code>EvaluationContextFactory</code> to an explicit instance instaed of the default or configured
+ * value.
*
* @param pipFinder the <code>PIPFinder</code> to use in creating new <code>EvaluationContext</code>s.
*/
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationException.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationException.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationException.java
index c1d2a91..211f176 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationException.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/eval/EvaluationException.java
@@ -34,7 +34,6 @@ package com.att.research.xacmlatt.pdp.eval;
/**
* EvaluationException extends <code>Exception</code> to represent errors returned by methods of the
* {@link Evaluatable} interface and the {@link Matchable} interface.
- *
*/
public class EvaluationException extends Exception {
private static final long serialVersionUID = 302250127793947492L;
@@ -54,7 +53,8 @@ public class EvaluationException extends Exception {
super(message, cause);
}
- public EvaluationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ public EvaluationException(String message, Throwable cause, boolean enableSuppression,
+ boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}