Commit 6c788949 authored by Romain Ferrari's avatar Romain Ferrari

Cleaning code and using logback

parent bbbe25a0
......@@ -91,6 +91,11 @@
</dependency>
<!-- /Test dependencies -->
<!-- Uncoment dependency below to use log4j as SLFJ implementation for test logs -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.10</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
......
......@@ -72,7 +72,7 @@ public class BaseFunctionFactory extends FunctionFactory
{
// the backing maps for the Function objects
private HashMap functionMap = null;
private HashMap<String, Object> functionMap = null;
// the superset factory chained to this factory
private FunctionFactory superset = null;
......@@ -100,7 +100,7 @@ public class BaseFunctionFactory extends FunctionFactory
* @param superset the superset factory or null
*/
public BaseFunctionFactory(FunctionFactory superset) {
functionMap = new HashMap();
functionMap = new HashMap<String, Object>();
this.superset = superset;
}
......@@ -113,8 +113,8 @@ public class BaseFunctionFactory extends FunctionFactory
* @param supportedAbstractFunctions a mapping from <code>URI</code> to
* <code>FunctionProxy</code>
*/
public BaseFunctionFactory(Set supportedFunctions,
Map supportedAbstractFunctions) {
public BaseFunctionFactory(Set<?> supportedFunctions,
Map<?, ?> supportedAbstractFunctions) {
this(null, supportedFunctions, supportedAbstractFunctions);
}
......@@ -132,11 +132,11 @@ public class BaseFunctionFactory extends FunctionFactory
* <code>FunctionProxy</code>
*/
public BaseFunctionFactory(FunctionFactory superset,
Set supportedFunctions,
Map supportedAbstractFunctions) {
Set<?> supportedFunctions,
Map<?, ?> supportedAbstractFunctions) {
this(superset);
Iterator it = supportedFunctions.iterator();
Iterator<?> it = supportedFunctions.iterator();
while (it.hasNext()) {
Function function = (Function)(it.next());
LOGGER.debug("Adding supported function to the functionMap: "+function.getIdentifier());
......@@ -222,11 +222,12 @@ public class BaseFunctionFactory extends FunctionFactory
*
* @return a <code>Set</code> of <code>String</code>s
*/
public Set getSupportedFunctions() {
Set set = new HashSet(functionMap.keySet());
public Set<String> getSupportedFunctions() {
Set<String> set = new HashSet<String>(functionMap.keySet());
if (superset != null)
if (superset != null) {
set.addAll(superset.getSupportedFunctions());
}
return set;
}
......
......@@ -158,7 +158,7 @@ public class StandardFunctionFactory extends BaseFunctionFactory
targetFunctions.addAll((new MatchFunctionCluster()).getSupportedFunctions());
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Added Target functions: {}", StringUtils.join(targetFunctions.toArray(), ','));
LOGGER.debug("Added Target functions: {}", StringUtils.join(targetFunctions.toArray(), '\n'));
}
targetAbstractFunctions = new HashMap();
......
......@@ -66,8 +66,9 @@ public class StringFunctionCluster implements FunctionCluster
iterator();
LOGGER.debug("Initialize String function");
while (it.hasNext())
while (it.hasNext()) {
set.add(new StringFunction((String)(it.next())));
}
set.add(new URLStringCatFunction());
......
......@@ -15,16 +15,10 @@
*/
package com.thalesgroup.authzforce.audit.aspect;
import java.io.StringWriter;
import java.net.URI;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.Attribute;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.Policy;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.Result;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.Rule;
......@@ -85,7 +79,9 @@ public class AuditAspect {
audit.getRules().add(auditedRule);
AuditLogs.getInstance().addAudit(audit);
synchronized (audit) {
AuditLogs.getInstance().addAudit(audit);
}
break;
case POLICY:
......@@ -105,7 +101,9 @@ public class AuditAspect {
}
}
audit.getMatchedPolicies().add(auditedPolicy);
AuditLogs.getInstance().addAudit(audit);
synchronized (audit) {
AuditLogs.getInstance().addAudit(audit);
}
break;
case ATTRIBUTE:
......@@ -129,8 +127,7 @@ public class AuditAspect {
System.out.println(AuditLogs.getInstance().toString());
break;
default:
System.err.println("Type unknown: " + annotation.type());
;
LOGGER.error("Type unknown: " + annotation.type());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment