1 37 package net.sourceforge.cruisecontrol.jmx; 38 39 import java.lang.reflect.Method ; 40 import java.util.HashMap ; 41 import java.util.Map ; 42 43 import mx4j.MBeanDescriptionAdapter; 44 45 48 public class ProjectControllerMBeanDescription extends MBeanDescriptionAdapter { 49 50 private static final Map METHOD_DESCRIPTIONS; 51 52 static { 53 METHOD_DESCRIPTIONS = new HashMap (); 54 55 METHOD_DESCRIPTIONS.put("pause", "Pauses the project"); 56 METHOD_DESCRIPTIONS.put("resume", "Resumes the project when it's paused"); 57 METHOD_DESCRIPTIONS.put("build", "Forces a build of the project"); 58 METHOD_DESCRIPTIONS.put("buildWithTarget", "Forces a build of the project using the given target"); 59 METHOD_DESCRIPTIONS.put("serialize", "Persists the state of the project to disk"); 60 } 61 62 private static final Map ATTR_DESCRIPTIONS; 63 64 static { 65 ATTR_DESCRIPTIONS = new HashMap (); 66 ATTR_DESCRIPTIONS.put("ConfigFileName", 67 "The name of the config file this project reads its settings from"); 68 69 ATTR_DESCRIPTIONS.put("Label", "The current build label"); 70 71 ATTR_DESCRIPTIONS.put("LabelIncrementer", 72 "The classname of the LabelIncrementer used to determine the build label. " 73 + "Changes to this attribute are not persisted"); 74 75 ATTR_DESCRIPTIONS.put("LastBuild", 76 "Time of the last build, using the format 'yyyyMMddHHmmss'"); 77 78 ATTR_DESCRIPTIONS.put("LastSuccessfulBuild", 79 "Time of the last successful build, using the format 'yyyyMMddHHmmss'"); 80 81 ATTR_DESCRIPTIONS.put("LogDir", 82 "The directory where the log files for this project are written to. " 83 + "Changes to this attribute are not persisted"); 84 85 ATTR_DESCRIPTIONS.put("ProjectName", "The name of this project"); 86 87 ATTR_DESCRIPTIONS.put("BuildInterval", 88 "The build interval in milliseconds. Changes to this attribute are not persisted"); 89 90 ATTR_DESCRIPTIONS.put("Status", "The current status of the project"); 91 92 ATTR_DESCRIPTIONS.put("Paused", "Indicates if the project is paused"); 93 94 ATTR_DESCRIPTIONS.put("BuildStartTime", 95 "Start Time of the last build, using the format 'yyyyMMddHHmmss'"); 96 } 97 98 public String getOperationDescription(Method method) { 99 String methodName = method.getName(); 100 if (METHOD_DESCRIPTIONS.containsKey(methodName)) { 101 return (String ) METHOD_DESCRIPTIONS.get(methodName); 102 } 103 return super.getOperationDescription(method); 104 } 105 106 public String getAttributeDescription(String attr) { 107 if (ATTR_DESCRIPTIONS.containsKey(attr)) { 108 return (String ) ATTR_DESCRIPTIONS.get(attr); 109 } 110 return super.getAttributeDescription(attr); 111 } 112 113 public String getMBeanDescription() { 114 return "Controller for a CruiseControl project"; 115 } 116 } 117 | Popular Tags |