[jboss-cvs] jboss-docs/jbossas/j2ee/examples/src/main/org/jboss/book/jmx/xmbean ...
Norman Richards
norman.richards at jboss.com
Wed Nov 1 13:14:20 EST 2006
User: nrichards
Date: 06/11/01 13:14:20
Added: jbossas/j2ee/examples/src/main/org/jboss/book/jmx/xmbean
ClientInterface.java JNDIMap.java
ServerSecurityInterceptor.java TestXMBean1.java
TestXMBean3.java TestXMBeanRestart.java
jboss-service.xml jboss-service2.xml
jboss-service3.xml jndimap-xmbean1.xml
jndimap-xmbean2.xml jndimap-xmbean3.xml
Log:
modified for j2ee guide
Revision Changes Path
1.1 date: 2006/11/01 18:14:20; author: nrichards; state: Exp;jboss-docs/jbossas/j2ee/examples/src/main/org/jboss/book/jmx/xmbean/ClientInterface.java
Index: ClientInterface.java
===================================================================
package org.jboss.book.jmx.xmbean;
/**
* @author Scott.Stark at jboss.org
* @version $Revision: 1.1 $
*/
public interface ClientInterface
{
public String[] getInitialValues();
public void setInitialValues(String[] keyValuePairs);
public Object get(Object key);
public void put(Object key, Object value);
}
1.1 date: 2006/11/01 18:14:20; author: nrichards; state: Exp;jboss-docs/jbossas/j2ee/examples/src/main/org/jboss/book/jmx/xmbean/JNDIMap.java
Index: JNDIMap.java
===================================================================
package org.jboss.book.jmx.xmbean;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Map;
import java.util.HashMap;
import javax.naming.InitialContext;
import javax.naming.Name;
import javax.naming.NamingException;
import javax.management.Notification;
import org.jboss.naming.NonSerializableFactory;
import org.jboss.system.ServiceMBeanSupport;
/**
* An XMBean variation of the JNDIMap standard MBean.
*/
public class JNDIMap
extends ServiceMBeanSupport
{
private static final String GET_EVENT_TYPE = "org.jboss.book.jmx.xmbean.JNDIMap.get";
private static final String PUT_EVENT_TYPE = "org.jboss.book.jmx.xmbean.JNDIMap.put";
private String jndiName;
private String[] keyValuePairs = {"key0", "value0"};
private Map proxyMap = null;
public String getJndiName()
{
return jndiName;
}
public void setJndiName(String jndiName)
throws NamingException
{
String oldName = this.jndiName;
this.jndiName = jndiName;
// we only need to act if the service has been started
if (super.getState() == STARTED) {
unbind(oldName);
try {
rebind();
} catch (Exception e) {
NamingException ne = new
NamingException("Failed to update jndiName");
ne.setRootCause(e);
throw ne;
}
}
}
public String[] getInitialValues()
{
return keyValuePairs;
}
public void setInitialValues(String[] keyValuePairs)
{
if (keyValuePairs == null) {
keyValuePairs = new String[0];
}
this.keyValuePairs = keyValuePairs;
for(int n = 0; n < keyValuePairs.length; n += 2) {
String key = keyValuePairs[n];
String value = keyValuePairs[n+1];
put(key, value);
}
}
public void startService()
throws Exception
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Class[] interfaces = {Map.class};
proxyMap = (Map) Proxy.newProxyInstance(loader, interfaces, new ProxyMap());
log.info("Created Map proxy to handle notifications");
rebind();
}
public void stopService()
{
unbind(jndiName);
}
public Object get(Object key)
{
System.out.println("GET: " + key);
System.out.println("PM: " + proxyMap);
Object value = null;
if (proxyMap != null) {
value = proxyMap.get(key);
}
return value;
}
public void put(Object key, Object value)
{
System.out.println("PUT: " + key + "," + value);
if (proxyMap != null) {
proxyMap.put(key, value);
}
}
private void rebind()
throws NamingException
{
InitialContext rootCtx = new InitialContext();
Name fullName = rootCtx.getNameParser("").parse(jndiName);
log.info("fullName=" + fullName);
NonSerializableFactory.rebind(fullName, proxyMap, true);
}
private void unbind(String jndiName)
{
try {
InitialContext rootCtx = new InitialContext();
rootCtx.unbind(jndiName);
NonSerializableFactory.unbind(jndiName);
} catch (NamingException e) {
log.error("Failed to unbind map", e);
}
}
private void generateNotification(String type) {
long eventID = super.getNextNotificationSequenceNumber();
Notification event = new Notification(type, this, eventID);
log.info("sendNotification(event): " + event);
super.sendNotification(event);
}
public class ProxyMap
implements InvocationHandler
{
/** The in memory map we manage and expose through JNDI */
private HashMap contextMap = new HashMap();
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable
{
Object value = method.invoke(this.contextMap, args);
if (method.getName().equals("get")) {
generateNotification(GET_EVENT_TYPE);
} else if (method.getName().equals("put")) {
generateNotification(PUT_EVENT_TYPE);
}
return value;
}
}
}
1.1 date: 2006/11/01 18:14:20; author: nrichards; state: Exp;jboss-docs/jbossas/j2ee/examples/src/main/org/jboss/book/jmx/xmbean/ServerSecurityInterceptor.java
Index: ServerSecurityInterceptor.java
===================================================================
package org.jboss.book.jmx.xmbean;
import java.security.Principal;
import org.jboss.logging.Logger;
import org.jboss.mx.interceptor.AbstractInterceptor;
import org.jboss.mx.server.Invocation;
import org.jboss.security.SimplePrincipal;
import org.jboss.invocation.InvocationException;
/** A simple security interceptor example that restricts access to a single
* principal
*
* @author Scott.Stark at jboss.org
* @version $Revision: 1.1 $
*/
public class ServerSecurityInterceptor
extends AbstractInterceptor
{
private static Logger log = Logger.getLogger(ServerSecurityInterceptor.class);
private SimplePrincipal admin = new SimplePrincipal("admin");
public String getAdminName()
{
return admin.getName();
}
public void setAdminName(String name)
{
admin = new SimplePrincipal(name);
}
public Object invoke(Invocation invocation) throws Throwable
{
String opName = invocation.getName();
log.info("invoke, opName=" + opName);
Object[] a = invocation.getArgs();
if (a !=null) {
for (int i=0; i<a.length; i++) {
System.out.println("arg[" + i + "]=" + a[i]);
}
}
if (opName == null || !opName.equals("invoke")) {
return invocation.nextInterceptor().invoke(invocation);
}
Object[] args = invocation.getArgs();
org.jboss.invocation.Invocation invokeInfo =
(org.jboss.invocation.Invocation) args[0];
Principal caller = invokeInfo.getPrincipal();
log.info("invoke, opName=" + opName + ", caller=" + caller);
// Only the admin caller is allowed access
if (caller == null || caller.equals(admin) == false) {
throw new SecurityException("Caller=" +
caller + " is not allowed access");
}
// Let the invocation go
return invocation.nextInterceptor().invoke(invocation);
}
}
1.1 date: 2006/11/01 18:14:20; author: nrichards; state: Exp;jboss-docs/jbossas/j2ee/examples/src/main/org/jboss/book/jmx/xmbean/TestXMBean1.java
Index: TestXMBean1.java
===================================================================
package org.jboss.book.jmx.xmbean;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import javax.management.Attribute;
import javax.management.MBeanInfo;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanParameterInfo;
import javax.management.Notification;
import javax.management.ObjectName;
import javax.naming.InitialContext;
import org.jboss.jmx.adaptor.rmi.RMIAdaptor;
import org.jboss.jmx.adaptor.rmi.RMINotificationListener;
/**
* A client that demonstrates how to connect to the JMX server using
* the RMI adaptor.
*
* @author Scott.Stark at jboss.org
* @version $Revision: 1.1 $
*/
public class TestXMBean1
{
public static class Listener implements RMINotificationListener
{
public Listener() throws RemoteException
{
UnicastRemoteObject.exportObject(this);
}
public void handleNotification(Notification event, Object handback)
{
System.out.println("handleNotification, event: "+event);
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws Exception
{
InitialContext ic = new InitialContext();
RMIAdaptor server = (RMIAdaptor) ic.lookup("jmx/rmi/RMIAdaptor");
// Get the MBeanInfo for the JNDIMap XMBean
ObjectName name = new ObjectName("chap2.xmbean:service=JNDIMap");
MBeanInfo info = server.getMBeanInfo(name);
System.out.println("JNDIMap Class: "+info.getClassName());
MBeanOperationInfo[] opInfo = info.getOperations();
System.out.println("JNDIMap Operations: ");
for(int o = 0; o < opInfo.length; o ++)
{
MBeanOperationInfo op = opInfo[o];
String returnType = op.getReturnType();
String opName = op.getName();
System.out.print(" + "+returnType+" "+opName+"(");
MBeanParameterInfo[] params = op.getSignature();
for(int p = 0; p < params.length; p ++)
{
MBeanParameterInfo paramInfo = params[p];
String pname = paramInfo.getName();
String type = paramInfo.getType();
if( pname.equals(type) )
System.out.print(type);
else
System.out.print(type+" "+name);
if( p < params.length-1 )
System.out.print(',');
}
System.out.println(")");
}
// Register as a notification listener
Listener listener = new Listener();
server.addNotificationListener(name, listener, null, null);
// Get the InitialValues attribute
String[] initialValues = (String[]) server.getAttribute(name, "InitialValues");
for(int n = 0; n < initialValues.length; n += 2)
{
String key = initialValues[n];
String value = initialValues[n+1];
System.out.println("key="+key+", value="+value);
}
// Invoke the put(Object, Object) op
String[] sig = {"java.lang.Object", "java.lang.Object"};
Object[] opArgs = {"key1", "value1"};
server.invoke(name, "put", opArgs, sig);
System.out.println("JNDIMap.put(key1, value1) successful");
sig = new String[]{"java.lang.Object"};
opArgs = new Object[]{"key0"};
Object result0 = server.invoke(name, "get", opArgs, sig);
System.out.println("JNDIMap.get(key0): "+result0);
opArgs = new Object[]{"key1"};
Object result1 = server.invoke(name, "get", opArgs, sig);
System.out.println("JNDIMap.get(key1): "+result1);
// Change the InitialValues
initialValues[0] = "key10";
initialValues[1] = "value10";
Attribute ivalues = new Attribute("InitialValues", initialValues);
server.setAttribute(name, ivalues);
// Unregister the listener.
server.removeNotificationListener(name, listener);
UnicastRemoteObject.unexportObject(listener, true);
}
}
1.1 date: 2006/11/01 18:14:20; author: nrichards; state: Exp;jboss-docs/jbossas/j2ee/examples/src/main/org/jboss/book/jmx/xmbean/TestXMBean3.java
Index: TestXMBean3.java
===================================================================
package org.jboss.book.jmx.xmbean;
import javax.naming.InitialContext;
import org.jboss.security.SecurityAssociation;
import org.jboss.security.SimplePrincipal;
/**
* A client that accesses an XMBean through its RMI interface
* @author Scott.Stark at jboss.org
* @version $Revision: 1.1 $
*/
public class TestXMBean3
{
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws Exception
{
InitialContext ic = new InitialContext();
ClientInterface xmbean = (ClientInterface) ic.lookup("secure-xmbean/ClientInterface");
// This call should fail because we have not set a security context
try {
String[] tmp = xmbean.getInitialValues();
throw new IllegalStateException("Was able to call getInitialValues");
} catch (Exception e) {
System.out.println("Called to getInitialValues failed as expected: "
+ e.getMessage());
}
// Set a security context using the SecurityAssociation
SecurityAssociation.setPrincipal(new SimplePrincipal("admin"));
// Get the InitialValues attribute
String[] initialValues = xmbean.getInitialValues();
for(int n = 0; n < initialValues.length; n += 2) {
String key = initialValues[n];
String value = initialValues[n+1];
System.out.println("key="+key+", value="+value);
}
// Invoke the put(Object, Object) op
xmbean.put("key1", "value1");
System.out.println("JNDIMap.put(key1, value1) successful");
Object result0 = xmbean.get("key0");
System.out.println("JNDIMap.get(key0): "+result0);
Object result1 = xmbean.get("key1");
System.out.println("JNDIMap.get(key1): "+result1);
// Change the InitialValues
initialValues[0] += ".1";
initialValues[1] += ".2";
xmbean.setInitialValues(initialValues);
initialValues = xmbean.getInitialValues();
for(int n = 0; n < initialValues.length; n += 2) {
String key = initialValues[n];
String value = initialValues[n+1];
System.out.println("key="+key+", value="+value);
}
}
}
1.1 date: 2006/11/01 18:14:20; author: nrichards; state: Exp;jboss-docs/jbossas/j2ee/examples/src/main/org/jboss/book/jmx/xmbean/TestXMBeanRestart.java
Index: TestXMBeanRestart.java
===================================================================
package org.jboss.book.jmx.xmbean;
import javax.management.Attribute;
import javax.management.ObjectName;
import javax.naming.InitialContext;
import org.jboss.jmx.adaptor.rmi.RMIAdaptor;
/** A client that demonstrates the persistence of the xmbean attributes. Every
time it it run it looks up the InitialValues attribute, prints it out
and then adds a new key/value to the list.
@author Scott.Stark at jboss.org
@version $Revision: 1.1 $
*/
public class TestXMBeanRestart
{
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws Exception
{
InitialContext ic = new InitialContext();
RMIAdaptor server = (RMIAdaptor) ic.lookup("jmx/invoker/RMIAdaptor");
// Get the InitialValues attribute
ObjectName name = new ObjectName("chap2.xmbean:service=JNDIMap");
String[] initialValues = (String[]) server.getAttribute(name, "InitialValues");
System.out.println("InitialValues.length="+initialValues.length);
int length = initialValues.length;
for(int n = 0; n < length; n += 2)
{
String key = initialValues[n];
String value = initialValues[n+1];
System.out.println("key="+key+", value="+value);
}
// Add a new key/value pair
String[] newInitialValues = new String[length+2];
System.arraycopy(initialValues, 0, newInitialValues, 0, length);
newInitialValues[length] = "key"+(length/2+1);
newInitialValues[length+1] = "value"+(length/2+1);
Attribute ivalues = new Attribute("InitialValues", newInitialValues);
server.setAttribute(name, ivalues);
}
}
1.1 date: 2006/11/01 18:14:20; author: nrichards; state: Exp;jboss-docs/jbossas/j2ee/examples/src/main/org/jboss/book/jmx/xmbean/jboss-service.xml
Index: jboss-service.xml
===================================================================
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE server PUBLIC
"-//JBoss//DTD MBean Service 3.2//EN"
"http://www.jboss.org/j2ee/dtd/jboss-service_3_2.dtd">
<server>
<mbean code="org.jboss.book.jmx.xmbean.JNDIMap" name="chap2.xmbean:service=JNDIMap"
xmbean-dd="META-INF/jndimap-xmbean.xml">
<attribute name="JndiName">inmemory/maps/MapTest</attribute>
<depends>jboss:service=Naming</depends>
</mbean>
</server>
1.1 date: 2006/11/01 18:14:20; author: nrichards; state: Exp;jboss-docs/jbossas/j2ee/examples/src/main/org/jboss/book/jmx/xmbean/jboss-service2.xml
Index: jboss-service2.xml
===================================================================
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE server PUBLIC
"-//JBoss//DTD MBean Service 3.2//EN"
"http://www.jboss.org/j2ee/dtd/jboss-service_3_2.dtd"
>
<server>
<mbean code="org.jboss.book.jmx.xmbean.JNDIMap" name="chap2.xmbean:service=JNDIMap"
xmbean-dd="META-INF/jndimap-xmbean.xml">
<depends>jboss:service=Naming</depends>
</mbean>
</server>
1.1 date: 2006/11/01 18:14:20; author: nrichards; state: Exp;jboss-docs/jbossas/j2ee/examples/src/main/org/jboss/book/jmx/xmbean/jboss-service3.xml
Index: jboss-service3.xml
===================================================================
<?xml version='1.0' encoding='UTF-8' ?>
<!--DOCTYPE server
PUBLIC "-//JBoss//DTD MBean Service 3.2//EN"
"http://www.jboss.org/j2ee/dtd/jboss-service_3_2.dtd"
This instance goes beyond the jboss-service_3_2.dtd model
due to its use of the embedded <interceptors> element in the
ClientInterceptors attribute of the JRMPProxyFactory config.
-->
<server>
<mbean code="org.jboss.book.jmx.xmbean.InvokeJNDIMap"
name="chap2.xmbean:service=JNDIMap,version=3"
xmbean-dd="META-INF/jndimap-xmbean3.xml">
<depends>jboss:service=Naming</depends>
</mbean>
<!-- The JRMP invoker proxy configuration for the naming service -->
<mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
name="jboss.test:service=proxyFactory,type=jrmp,target=JNDIMap">
<!-- Use the standard JRMPInvoker from conf/jboss-service.xml -->
<attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>
<attribute name="TargetName">chap2.xmbean:service=JNDIMap,version=3</attribute>
<attribute name="JndiName">secure-xmbean/ClientInterface</attribute>
<attribute name="ExportedInterface">org.jboss.book.jmx.xmbean.ClientInterface</attribute>
<!-- <attribute name="InvokeTargetMethod">true</attribute> -->
<attribute name="ClientInterceptors">
<iterceptors>
<interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
<interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
<interceptor>org.jboss.jmx.connector.invoker.client.InvokerAdaptorClientInterceptor</interceptor>
<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
</iterceptors>
</attribute>
<depends>jboss:service=invoker,type=jrmp</depends>
<depends>chap2.xmbean:service=JNDIMap,version=3</depends>
</mbean>
</server>
1.1 date: 2006/11/01 18:14:20; author: nrichards; state: Exp;jboss-docs/jbossas/j2ee/examples/src/main/org/jboss/book/jmx/xmbean/jndimap-xmbean1.xml
Index: jndimap-xmbean1.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mbean PUBLIC
"-//JBoss//DTD JBOSS XMBEAN 1.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_0.dtd">
<mbean>
<description>The JNDIMap XMBean Example Version 1</description>
<descriptors>
<persistence persistPolicy="Never"
persistPeriod="10"
persistLocation="data/JNDIMap.data"
persistName="JNDIMap"/>
<currencyTimeLimit value="10"/>
<state-action-on-update value="keep-running"/>
</descriptors>
<class>org.jboss.test.jmx.xmbean.JNDIMap</class>
<constructor>
<description>The default constructor</description>
<name>JNDIMap</name>
</constructor>
<!-- Attributes -->
<attribute access="read-write" getMethod="getJndiName" setMethod="setJndiName">
<description>The location in JNDI where the Map we manage will be bound</description>
<name>JndiName</name>
<type>java.lang.String</type>
<descriptors>
<default value="inmemory/maps/MapTest" />
</descriptors>
</attribute>
<attribute access="read-write" getMethod="getInitialValues" setMethod="setInitialValues">
<description>The array of initial values that will be placed into
the map associated with the service. The array is a collection of
key,value pairs with elements[0,2,4,...2n] being the keys and
elements [1,3,5,...,2n+1] the associated values</description>
<name>InitialValues</name>
<type>[Ljava.lang.String;</type>
<descriptors>
<default value="key0,value0" />
</descriptors>
</attribute>
<!-- Operations -->
<operation>
<description>The start lifecycle operation</description>
<name>start</name>
</operation>
<operation>
<description>The stop lifecycle operation</description>
<name>stop</name>
</operation>
<operation impact="ACTION">
<description>Put a value into the nap</description>
<name>put</name>
<parameter>
<description>The key the value will be store under</description>
<name>key</name>
<type>java.lang.Object</type>
</parameter>
<parameter>
<description>The value to place into the map</description>
<name>value</name>
<type>java.lang.Object</type>
</parameter>
</operation>
<operation impact="INFO">
<description>Get a value from the map</description>
<name>get</name>
<parameter>
<description>The key to lookup in the map</description>
<name>get</name>
<type>java.lang.Object</type>
</parameter>
<return-type>java.lang.Object</return-type>
</operation>
<!-- Notifications -->
<notification>
<description>The notification sent whenever a value is get into the map
managed by the service</description>
<name>javax.management.Notification</name>
<notification-type>org.jboss.book.jmx.xmbean.JNDIMap.get</notification-type>
</notification>
<notification>
<description>The notification sent whenever a value is put into the map
managed by the service</description>
<name>javax.management.Notification</name>
<notification-type>org.jboss.book.jmx.xmbean.JNDIMap.put</notification-type>
</notification>
</mbean>
1.1 date: 2006/11/01 18:14:20; author: nrichards; state: Exp;jboss-docs/jbossas/j2ee/examples/src/main/org/jboss/book/jmx/xmbean/jndimap-xmbean2.xml
Index: jndimap-xmbean2.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mbean PUBLIC
"-//JBoss//DTD JBOSS XMBEAN 1.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_0.dtd">
<mbean>
<description>The JNDIMap XMBean Example Version 2</description>
<descriptors>
<persistence persistPolicy="OnUpdate"
persistPeriod="10"
persistLocation="${jboss.server.data.dir}"
persistName="JNDIMap.ser"/>
<currencyTimeLimit value="10"/>
<state-action-on-update value="keep-running"/>
<persistence-manager value="org.jboss.mx.persistence.ObjectStreamPersistenceManager" />
</descriptors>
<class>org.jboss.test.jmx.xmbean.JNDIMap</class>
<constructor>
<description>The default constructor</description>
<name>JNDIMap</name>
</constructor>
<!-- Attributes -->
<attribute access="read-write" getMethod="getJndiName" setMethod="setJndiName">
<description>The location in JNDI where the Map we manage will be bound</description>
<name>JndiName</name>
<type>java.lang.String</type>
<descriptors>
<value value="inmemory/maps/MapTest" />
</descriptors>
</attribute>
<attribute access="read-write" getMethod="getInitialValues" setMethod="setInitialValues">
<description>The array of initial values that will be placed into
the map associated with the service. The array is a collection of
key,value pairs with elements[0,2,4,...2n] being the keys and
elements [1,3,5,...,2n+1] the associated values</description>
<name>InitialValues</name>
<type>[Ljava.lang.String;</type>
<descriptors>
<default value="key0,value0" />
</descriptors>
</attribute>
<!-- Operations -->
<operation>
<description>The start lifecycle operation</description>
<name>start</name>
</operation>
<operation>
<description>The stop lifecycle operation</description>
<name>stop</name>
</operation>
<operation impact="ACTION">
<description>Put a value into the nap</description>
<name>put</name>
<parameter>
<description>The key the value will be store under</description>
<name>key</name>
<type>java.lang.Object</type>
</parameter>
<parameter>
<description>The value to place into the map</description>
<name>value</name>
<type>java.lang.Object</type>
</parameter>
</operation>
<operation impact="INFO">
<description>Get a value from the map</description>
<name>get</name>
<parameter>
<description>The key to lookup in the map</description>
<name>get</name>
<type>java.lang.Object</type>
</parameter>
<return-type>java.lang.Object</return-type>
</operation>
<!-- Notifications -->
<notification>
<description>The notification sent whenever a value is get into the map
managed by the service</description>
<name>javax.management.Notification</name>
<notification-type>org.jboss.book.jmx.xmbean.JNDIMap.get</notification-type>
</notification>
<notification>
<description>The notification sent whenever a value is put into the map
managed by the service</description>
<name>javax.management.Notification</name>
<notification-type>org.jboss.book.jmx.xmbean.JNDIMap.put</notification-type>
</notification>
</mbean>
1.1 date: 2006/11/01 18:14:20; author: nrichards; state: Exp;jboss-docs/jbossas/j2ee/examples/src/main/org/jboss/book/jmx/xmbean/jndimap-xmbean3.xml
Index: jndimap-xmbean3.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mbean PUBLIC
"-//JBoss//DTD JBOSS XMBEAN 1.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_0.dtd"
[
<!ATTLIST interceptor adminName CDATA #IMPLIED>
]
>
<mbean>
<description>The JNDIMap XMBean Example Version 3</description>
<descriptors>
<interceptors>
<interceptor code="org.jboss.book.jmx.xmbean.ServerSecurityInterceptor"
adminName="admin"/>
<interceptor code="org.jboss.book.jmx.xmbean.InvokerInterceptor" />
<interceptor code="org.jboss.mx.interceptor.PersistenceInterceptor2" />
<interceptor code="org.jboss.mx.interceptor.ModelMBeanInterceptor" />
<interceptor code="org.jboss.mx.interceptor.ObjectReferenceInterceptor" />
</interceptors>
<persistence persistPolicy="Never" />
<currencyTimeLimit value="10" />
</descriptors>
<class>org.jboss.test.jmx.xmbean.InvokeJNDIMap</class>
<constructor>
<description>The default constructor</description>
<name>JNDIMap</name>
</constructor>
<!-- Attributes -->
<attribute access="read-write" getMethod="getJndiName" setMethod="setJndiName">
<description>The location in JNDI where the Map we manage will be bound</description>
<name>JndiName</name>
<type>java.lang.String</type>
<descriptors>
<value value="inmemory/maps/MapTest" />
</descriptors>
</attribute>
<attribute access="read-write" getMethod="getInitialValues" setMethod="setInitialValues">
<description>The array of initial values that will be placed into
the map associated with the service. The array is a collection of
key,value pairs with elements[0,2,4,...2n] being the keys and
elements [1,3,5,...,2n+1] the associated values</description>
<name>InitialValues</name>
<type>[Ljava.lang.String;</type>
<descriptors>
<value value="key0,value0" />
</descriptors>
</attribute>
<!-- Operations -->
<operation>
<description>The start lifecycle operation</description>
<name>start</name>
</operation>
<operation>
<description>The stop lifecycle operation</description>
<name>stop</name>
</operation>
<operation impact="ACTION">
<description>Put a value into the nap</description>
<name>put</name>
<parameter>
<description>The key the value will be store under</description>
<name>key</name>
<type>java.lang.Object</type>
</parameter>
<parameter>
<description>The value to place into the map</description>
<name>value</name>
<type>java.lang.Object</type>
</parameter>
</operation>
<operation impact="INFO">
<description>Get a value from the map</description>
<name>get</name>
<parameter>
<description>The key to lookup in the map</description>
<name>get</name>
<type>java.lang.Object</type>
</parameter>
<return-type>java.lang.Object</return-type>
</operation>
<operation impact="INFO">
<description>The detached invoker invoke(Invocation) entry point</description>
<name>invoke</name>
<parameter>
<description>The Invocation representation</description>
<name>invocation</name>
<type>org.jboss.invocation.Invocation</type>
</parameter>
<return-type>java.lang.Object</return-type>
</operation>
<!-- Notifications -->
<notification>
<description>The notification sent whenever a value is get into the map
managed by the service</description>
<name>javax.management.Notification</name>
<notification-type>org.jboss.book.jmx.xmbean.JNDIMap.get</notification-type>
</notification>
<notification>
<description>The notification sent whenever a value is put into the map
managed by the service</description>
<name>javax.management.Notification</name>
<notification-type>org.jboss.book.jmx.xmbean.JNDIMap.put</notification-type>
</notification>
</mbean>
More information about the jboss-cvs-commits
mailing list