001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package test.implementation.util.support;
023:
024: import javax.management.*;
025: import javax.management.modelmbean.*;
026:
027: /**
028: * @author <a href="mailto:juha@jboss.org">Juha Lindfors</a>.
029: * @version $Revision: 57200 $
030: */
031: public class ExtendedResource implements MyInterface2 {
032: private String attr = null;
033: private String attr2 = null;
034: private Object arg = null;
035:
036: public void setAttributeName(String attr) {
037: this .attr = attr;
038: }
039:
040: public void setAttributeName2(String attr) {
041: this .attr2 = attr;
042: }
043:
044: public String getAttributeName2() {
045: return attr2;
046: }
047:
048: public void setAttribute3(Object arg) {
049: this .arg = arg;
050: }
051:
052: public Object getAttribute3() {
053: return arg.toString();
054: }
055:
056: public Object doOperation() {
057: return "doOperation";
058: }
059:
060: public String executeThis(Object arg) {
061: return arg.toString();
062: }
063:
064: public Object runMe(String str) {
065: return str;
066: }
067:
068: public ModelMBeanInfo getMBeanInfo() {
069: ModelMBeanAttributeInfo[] attributes = new ModelMBeanAttributeInfo[] {
070: new ModelMBeanAttributeInfo("AttributeName",
071: "java.lang.String", "description", false, true,
072: false),
073: new ModelMBeanAttributeInfo("AttributeName2",
074: "java.lang.String", "description", true, true,
075: false),
076: new ModelMBeanAttributeInfo("Attribute3",
077: "java.lang.Object", "description", true, true,
078: false) };
079:
080: ModelMBeanOperationInfo[] operations = new ModelMBeanOperationInfo[] {
081: new ModelMBeanOperationInfo("doOperation",
082: "description", null, "java.lang.Object", 1),
083: new ModelMBeanOperationInfo(
084: "executeThis",
085: "description",
086:
087: new MBeanParameterInfo[] { new MBeanParameterInfo(
088: "arg", "java.lang.Object",
089: "description") }, "java.lang.Object", 1),
090: new ModelMBeanOperationInfo("runMe", "description",
091:
092: new MBeanParameterInfo[] { new MBeanParameterInfo(
093: "arg", "java.lang.String", "description") },
094: "java.lang.Object", 1) };
095:
096: ModelMBeanInfoSupport info = new ModelMBeanInfoSupport(
097: "test.implementation.util.support.Resource",
098: "description", attributes, null, operations, null);
099:
100: return info;
101: }
102:
103: }
|