User: juhalindfors
Date: 02/02/22 06:19:01
Added: src/main/org/jboss/mx/interceptor
MBeanAttributeInterceptor.java
Log:
dummy impl. of mmb attribute handling. just updates the descriptors,
no method mapping or caching
Revision Changes Path
1.1
jmx/src/main/org/jboss/mx/interceptor/MBeanAttributeInterceptor.java
Index: MBeanAttributeInterceptor.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.mx.interceptor;
import java.util.HashMap;
import java.util.Date;
import javax.management.Descriptor;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.management.Attribute;
import javax.management.modelmbean.ModelMBeanInfo;
import javax.management.modelmbean.ModelMBeanInfoSupport;
import org.jboss.mx.modelmbean.ModelMBeanConstants;
/**
* Quick hack, non mapping/caching attribute interceptor
*
* @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>.
* @version $Revision: 1.1 $
*
*/
public class MBeanAttributeInterceptor
extends Interceptor
implements ModelMBeanConstants
{
// Attributes ----------------------------------------------------
private ModelMBeanInfo info = null;
// Constructors --------------------------------------------------
public MBeanAttributeInterceptor(ModelMBeanInfo info)
{
super("MBean Attribute Interceptor");
this.info = info;
}
// Public --------------------------------------------------------
public Object invoke(Invocation invocation) throws InvocationException
{
if (invocation.getInvocationType() == Invocation.OPERATION)
return getNext().invoke(invocation);
try
{
// this is mighty slow as we copy all over, will do for now
Descriptor d = info.getDescriptor(invocation.getName(),
ATTRIBUTE_DESCRIPTOR);
if (invocation.getImpact() == Invocation.WRITE)
{
d.setField(VALUE, ((Attribute)invocation.getArgs() [0]).getValue());
info.setDescriptor(d, ATTRIBUTE_DESCRIPTOR);
return getNext().invoke(invocation);
}
else
{
return d.getFieldValue(VALUE);
}
}
catch (Throwable t)
{
// FIXME: need to check this exception handling
throw new InvocationException(t);
}
}
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development