KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > tools > naming > CosNamingServiceMBeanDescription


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
9 package mx4j.tools.naming;
10
11 import java.lang.reflect.Constructor JavaDoc;
12 import java.lang.reflect.Method JavaDoc;
13
14 import mx4j.MBeanDescriptionAdapter;
15
16 /**
17  * Management interface descriptions for the CosNamingService MBean.
18  *
19  * @version $Revision: 1.3 $
20  */

21 public class CosNamingServiceMBeanDescription extends MBeanDescriptionAdapter
22 {
23    public String JavaDoc getMBeanDescription()
24    {
25       return "MBean that wraps tnameserv";
26    }
27
28    public String JavaDoc getConstructorDescription(Constructor JavaDoc ctor)
29    {
30       if (ctor.toString().equals("public mx4j.tools.naming.CosNamingService()"))
31       {
32          return "Creates a new instance of CosNamingService with the default port (900)";
33       }
34       if (ctor.toString().equals("public mx4j.tools.naming.CosNamingService(int)"))
35       {
36          return "Creates a new instance of CosNamingService with the specified port";
37       }
38       return super.getConstructorDescription(ctor);
39    }
40
41    public String JavaDoc getConstructorParameterName(Constructor JavaDoc ctor, int index)
42    {
43       if (ctor.toString().equals("public mx4j.tools.naming.CosNamingService(int)"))
44       {
45          switch (index)
46          {
47             case 0:
48                return "port";
49          }
50       }
51       return super.getConstructorParameterName(ctor, index);
52    }
53
54    public String JavaDoc getConstructorParameterDescription(Constructor JavaDoc ctor, int index)
55    {
56       if (ctor.toString().equals("public mx4j.tools.naming.CosNamingService(int)"))
57       {
58          switch (index)
59          {
60             case 0:
61                return "The port on which tnameserv will listen for incoming connections";
62          }
63       }
64       return super.getConstructorParameterDescription(ctor, index);
65    }
66
67    public String JavaDoc getAttributeDescription(String JavaDoc attribute)
68    {
69       if (attribute.equals("Port"))
70       {
71          return "The port on which tnameserv listens for incoming connections";
72       }
73       if (attribute.equals("Running"))
74       {
75          return "The running status of this MBean";
76       }
77       if (attribute.equals("Delay"))
78       {
79          return "The delay (ms) for the start() and stop() methods";
80       }
81       return super.getAttributeDescription(attribute);
82    }
83
84    public String JavaDoc getOperationDescription(Method JavaDoc operation)
85    {
86       String JavaDoc name = operation.getName();
87       if (name.equals("start"))
88       {
89          return "Starts tnameserv";
90       }
91       if (name.equals("stop"))
92       {
93          return "Stops tnameserv";
94       }
95       return super.getOperationDescription(operation);
96    }
97 }
98
Popular Tags