Java Reference
In-Depth Information
</bean>
</entry>
</map>
</property>
</bean>
</property>
</bean>
<!—other beans -->
</beans>
The rules property is used to externalize the rules that are applicable for a particular
audit event. The AuditRules class acts as a container for the audit rules, as shown in
Listing 6-19.
Listing 6-19. AuditRules.java
public class AuditRules{
public Map ruleMap;
public AuditRule getRule(String key){
return (AuditRule)ruleMap.get(key);
}
public Map getRuleMap() {
return ruleMap;
}
public void setRuleMap(Map ruleMap) {
this.ruleMap = ruleMap;
}
}
Each rule is an instance of the class AuditRule . In the current example, I'm using a
very simple rule. I just check whether the current method being intercepted is in the rule
definition. There is also a fine-grained control to turn off this rule. You can do this by set-
ting the applyRule property. Listing 6-20 shows the AuditRule class.
 
Search WWH ::




Custom Search