// Get any custom interceptors specified at the attribute level
for (Iterator it = attributeContextMap.entrySet().iterator(); it.hasNext();)
{
Map.Entry entry = (Map.Entry) it.next();
InvocationContext ctx = (InvocationContext) entry.getValue();
List list = getInterceptors(ctx.getDescriptor());
if (list == null)
{
// Use the mbean inteceptors if sepecified
if (defaultInterceptors != null)
{
list = new ArrayList(defaultInterceptors);
}
else
{
list = new ArrayList();
}
}
// Add the attribute accessor semantic interceptors
list.add(new PersistenceInterceptor());
list.add(new ModelMBeanAttributeInterceptor());
ctx.setInterceptors(list);
}
// Get any custom interceptors specified at the operation level
for (Iterator it = operationContextMap.entrySet().iterator(); it.hasNext();)
{
Map.Entry entry = (Map.Entry) it.next();
InvocationContext ctx = (InvocationContext) entry.getValue();
List list = getInterceptors(ctx.getDescriptor());
if (list == null && defaultInterceptors != null)
list = new ArrayList(defaultInterceptors);
// Add operation caching (not for standard mbeans)
if (dynamicResource)
{
if (list == null)
{
list = new ArrayList();
}
list.add(new ModelMBeanOperationInterceptor());
}
if (list != null)
{
// Add a noop interceptor since the 3.2.3- interceptors always had
// to delegate to the next in order to dispatch the operation. Now
// there is no interceptor for this so this prevents NPEs.
list.add(new NullInterceptor());
ctx.setInterceptors(list);
}
}
}