KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > examples > tools > xdoclet > MyService


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8 package mx4j.examples.tools.xdoclet;
9
10 /**
11  * Sample MBean implementation.
12  *
13  * @version $Revision: 1.3 $
14  * @jmx:mbean name="mx4j:name=My MBean" description="My wonderful service."
15  * @jmx:mlet-entry archive="MyApp.jar" codebase="../lib"
16  */

17 public class MyService implements MyServiceMBean
18 {
19    protected int status = 0;
20    protected String JavaDoc m_dummy = null;
21
22    /**
23     * Default constructor.
24     *
25     * @jmx:managed-constructor description="Default constructor."
26     */

27    public MyService()
28    {
29    }
30
31    /**
32     * Constructor.
33     *
34     * @param type the type,
35     * @param status the status.
36     * @jmx:managed-constructor description="Build the service."
37     * @jmx:managed-constructor-parameter name="type" position="0" description="The type."
38     * @jmx:managed-constructor-parameter name="status" position="1" description="The status."
39     */

40    public MyService(String JavaDoc type, int status)
41    {
42    }
43
44    /**
45     * Start my service.
46     *
47     * @jmx:managed-operation description="Starts the service."
48     */

49    public void start()
50    {
51    }
52
53    /**
54     * Method that is not an JMX managed operation.
55     */

56    public void stop()
57    {
58    }
59
60    /**
61     * Echos a string.
62     *
63     * @jmx:managed-operation description="Echoes the string given as a parameter."
64     * @jmx:managed-operation-parameter name="str" position="0" description="The string to echo."
65     */

66    public void echo(String JavaDoc str)
67    {
68    }
69
70    /**
71     * Does some crazy stuff.
72     *
73     * @jmx:managed-operation description="Do some crazy stuff."
74     * @jmx:managed-operation-parameter name="firstObject" position="0" description="My first object."
75     * @jmx:managed-operation-parameter name="secondObject" position="1" description="My second object."
76     */

77    public int doSomeCrazyStuff(Object JavaDoc firstObject, Object JavaDoc secondObject)
78    {
79       return -1;
80    }
81
82    /**
83     * Sets the status.
84     *
85     * @jmx:managed-attribute description="My Status."
86     */

87    public void setStatus(int status)
88    {
89       this.status = status;
90    }
91
92    /**
93     * Gets the dummy variable.
94     *
95     * @jmx:managed-attribute description="My dummy attribute."
96     */

97    public String JavaDoc getDummy()
98    {
99       return "";
100    }
101
102    /**
103     * Sets the dummy variable.
104     *
105     * @jmx:managed-attribute description="This description should be ignored because of the getter."
106     */

107    public void setDummy(String JavaDoc dummy)
108    {
109    }
110
111 }
112
Popular Tags