| 1 | // jademx - JADE management using JMX |
| 2 | // Copyright 2005 Caboodle Networks, Inc. |
| 3 | // |
| 4 | // This library is free software; you can redistribute it and/or |
| 5 | // modify it under the terms of the GNU Lesser General Public |
| 6 | // License as published by the Free Software Foundation; either |
| 7 | // version 2.1 of the License, or (at your option) any later version. |
| 8 | // |
| 9 | // This library is distributed in the hope that it will be useful, |
| 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | // Lesser General Public License for more details. |
| 13 | // |
| 14 | // You should have received a copy of the GNU Lesser General Public |
| 15 | // License along with this library; if not, write to the Free Software |
| 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| 17 | |
| 18 | package jade.jademx.mbean; |
| 19 | |
| 20 | import javax.management.ObjectName; |
| 21 | |
| 22 | /** |
| 23 | * MBean interface for a JADE platform. |
| 24 | * @author David Bernstein, <a href="http://www.caboodlenetworks.com" |
| 25 | * >Caboodle Networks, Inc.</a> |
| 26 | */ |
| 27 | public interface JadePlatformMBean extends JadeBaseMBean { |
| 28 | |
| 29 | /** JADE MBean type */ |
| 30 | public final static String TYPE = "Platform"; |
| 31 | |
| 32 | // ATTRIBUTES |
| 33 | |
| 34 | /** <code>Agents</code> attribute name */ |
| 35 | public final static String ATTR_AGENTS = "Agents"; |
| 36 | /** <code>AgentNames</code> attribute name */ |
| 37 | public final static String ATTR_AGENT_NAMES = "AgentNames"; |
| 38 | /** <code>AgentObjectNames</code> attribute name */ |
| 39 | public final static String ATTR_AGENT_OBJECT_NAMES = "AgentObjectNames"; |
| 40 | /** <code>PlatformName</code> attribute name */ |
| 41 | public final static String ATTR_PLATFORM_NAME = "PlatformName"; |
| 42 | /** <code>StateCode</code> attribute name */ |
| 43 | public final static String ATTR_STATE_CODE = "StateCode"; |
| 44 | /** <code>StateName</code> attribute name */ |
| 45 | public final static String ATTR_STATE_NAME = "StateName"; |
| 46 | /** <code>ThreadGroupName</code> attribute name */ |
| 47 | public final static String ATTR_THREAD_GROUP_NAME = "ThreadGroupName"; |
| 48 | /** <code>ThreadId</code> attribute name */ |
| 49 | public final static String ATTR_THREAD_ID = "ThreadId"; |
| 50 | /** <code>ThreadName</code> attribute name */ |
| 51 | public final static String ATTR_THREAD_NAME = "ThreadName"; |
| 52 | |
| 53 | // OPERATIONS |
| 54 | |
| 55 | /** <code>createNewAgent</code> operation */ |
| 56 | public final static String OPER_CREATE_NEW_AGENT = "createNewAgent"; |
| 57 | /** <code>createNewAgentReturnName</code> operation */ |
| 58 | public final static String OPER_CREATE_NEW_AGENT_RETURN_NAME = |
| 59 | "createNewAgentReturnName"; |
| 60 | /** <code>getAgent</code> operation */ |
| 61 | public final static String OPER_GET_AGENT = "getAgent"; |
| 62 | /** <code>getAgentName</code> operation */ |
| 63 | public final static String OPER_GET_AGENT_NAME = "getAgentName"; |
| 64 | |
| 65 | /** <code>getAgentObjectName</code> operation */ |
| 66 | public final static String OPER_GET_AGENT_OBJECT_NAME = |
| 67 | "getAgentObjectName"; |
| 68 | /** getAgentObjectName operation description */ |
| 69 | public final static String OPER_GET_AGENT_OBJECT_NAME_DESC = |
| 70 | "get ObjectName for given agent local name"; |
| 71 | /** agentLocalName parameter type */ |
| 72 | public final static String OPER_GET_AGENT_OBJECT_NAME_AGENT_LOCAL_NAME_PARM_TYPE = |
| 73 | String.class.getName(); |
| 74 | /** signature for a addVariable operation */ |
| 75 | public final static String OPER_GET_AGENT_OBJECT_NAME_SIGNATURE[] = { |
| 76 | OPER_GET_AGENT_OBJECT_NAME_AGENT_LOCAL_NAME_PARM_TYPE |
| 77 | }; |
| 78 | /** return type for addVariable operation */ |
| 79 | public final static String OPER_GET_AGENT_OBJECT_NAME_TYPE = |
| 80 | ObjectName.class.getName(); |
| 81 | |
| 82 | /** <code>kill</code> operation */ |
| 83 | public final static String OPER_KILL = "kill"; |
| 84 | // /** <code>resume</code> operation */ |
| 85 | // public final static String OPER_RESUME = "resume"; |
| 86 | // /** <code>start</code> operation */ |
| 87 | // public final static String OPER_START = "start"; |
| 88 | // /** <code>suspend</code> operation */ |
| 89 | // public final static String OPER_SUSPEND = "suspend"; |
| 90 | |
| 91 | // NOTIFICATIONS |
| 92 | |
| 93 | /** born-agent notification */ |
| 94 | public final static String NOTIFICATION_BORN_AGENT = |
| 95 | "born-agent"; |
| 96 | /** dead-agent notification */ |
| 97 | public final static String NOTIFICATION_DEAD_AGENT = |
| 98 | "dead-agent"; |
| 99 | // /** killed-platform notification */ |
| 100 | // public final static String NOTIFICATION_KILLED_PLATFORM = |
| 101 | // "killed-platform"; |
| 102 | // /** resumed-platform notification */ |
| 103 | // public final static String NOTIFICATION_RESUMED_PLATFORM = |
| 104 | // "resumed-platform"; |
| 105 | // /** started-platform notification */ |
| 106 | // public final static String NOTIFICATION_STARTED_PLATFORM = |
| 107 | // "started-platform"; |
| 108 | // /** suspended-platform notification */ |
| 109 | // public final static String NOTIFICATION_SUSPENDED_PLATFORM = |
| 110 | // "suspended-platform"; |
| 111 | |
| 112 | |
| 113 | // ATTRIBUTES |
| 114 | |
| 115 | |
| 116 | /** |
| 117 | * Get agent proxy to local agent given its local name. |
| 118 | * @param localAgentName The short local name of the desired agent. |
| 119 | * @return ObjectName string for AgentMBean |
| 120 | * @throws JademxException If any probelms occur obtaining this proxy. |
| 121 | */ |
| 122 | public JadeAgent getAgent(String localAgentName) throws JademxException; |
| 123 | |
| 124 | /** |
| 125 | * Get name of agent proxy to local agent given its local name. |
| 126 | * @param localAgentName The short local name of the desired agent. |
| 127 | * @return ObjectName string for AgentMBean |
| 128 | * @throws JademxException If any probelms occur obtaining this proxy. |
| 129 | */ |
| 130 | public String getAgentName(String localAgentName) throws JademxException; |
| 131 | |
| 132 | /** |
| 133 | * Get ObjectName of agent MBean given its local name. |
| 134 | * @param localAgentName The short local name of the desired agent. |
| 135 | * @return ObjectName for AgentMBean |
| 136 | * @throws JademxException If any probelms occur obtaining this proxy. |
| 137 | */ |
| 138 | public ObjectName getAgentObjectName(String localAgentName) throws JademxException; |
| 139 | |
| 140 | /** |
| 141 | * return <code>JadeAgentMBeanDef</code>s of this platform. |
| 142 | * @return agent mbean names for platform |
| 143 | */ |
| 144 | public JadeAgent[] getAgents(); |
| 145 | |
| 146 | /** |
| 147 | * return names for <code>JadeAgentMBeanDef</code>s of this platform. |
| 148 | * @return agent mbean names for platform |
| 149 | */ |
| 150 | public String[] getAgentNames(); |
| 151 | |
| 152 | /** |
| 153 | * return <code>ObjectName</code>s for this platform's agents. |
| 154 | * @return agent mbean names for platform |
| 155 | */ |
| 156 | public ObjectName[] getAgentObjectNames(); |
| 157 | |
| 158 | |
| 159 | /** |
| 160 | * Get the name of the platform. |
| 161 | * @return String The platform name. |
| 162 | */ |
| 163 | public String getPlatformName(); |
| 164 | |
| 165 | // state is an object that has both name and integer code. |
| 166 | // expose it as two simple attributes |
| 167 | |
| 168 | /** |
| 169 | * return integer code for platform state |
| 170 | * @return integer code for platform state |
| 171 | */ |
| 172 | public int getStateCode(); |
| 173 | |
| 174 | /** |
| 175 | * return name of platform state |
| 176 | * @return name of platform state |
| 177 | */ |
| 178 | public String getStateName(); |
| 179 | |
| 180 | /** |
| 181 | * return thread group name |
| 182 | * @return thread group name |
| 183 | */ |
| 184 | public String getThreadGroupName(); |
| 185 | |
| 186 | /** |
| 187 | * return thread id |
| 188 | * @return thread id |
| 189 | */ |
| 190 | public long getThreadId(); |
| 191 | |
| 192 | /** |
| 193 | * return thread name |
| 194 | * @return thread name |
| 195 | */ |
| 196 | public String getThreadName(); |
| 197 | |
| 198 | |
| 199 | // OPERATIONS |
| 200 | |
| 201 | /** |
| 202 | * Create a new agent. |
| 203 | * @param nickname The name of the agent. |
| 204 | * @param className The class implementing the agent. |
| 205 | * @return ObjectName string for AgentMBean |
| 206 | * @param args The agents parameters - typically String[] from a configuration file. |
| 207 | * @return AgentController to enable control of the agent. |
| 208 | * @throws JademxException problems creating agent |
| 209 | */ |
| 210 | public JadeAgent createNewAgent(String nickname, String className, |
| 211 | Object[] args) throws JademxException; |
| 212 | |
| 213 | /** |
| 214 | * Create a new agent. |
| 215 | * @param nickname The name of the agent. |
| 216 | * @param className The class implementing the agent. |
| 217 | * @return ObjectName string for AgentMBean |
| 218 | * @param args The agents parameters - typically String[] from a configuration file. |
| 219 | * @return AgentController to enable control of the agent. |
| 220 | * @throws JademxException problems creating agent |
| 221 | */ |
| 222 | public String createNewAgentReturnName(String nickname, String className, |
| 223 | Object[] args) throws JademxException; |
| 224 | |
| 225 | /** |
| 226 | * Kill the agent platform. Kills all agents. |
| 227 | * @throws JademxException If any problems other than illegal state occur. |
| 228 | * @throws IllegalStateException If state is illegal for this activity. |
| 229 | */ |
| 230 | public void kill() throws JademxException; |
| 231 | |
| 232 | // /** |
| 233 | // * Activate the agent platform. Next action may be suspend or kill. |
| 234 | // * @throws JademxException a problem that isn't illegal state |
| 235 | // * @throws IllegalStateException state illegal for this activity. |
| 236 | // */ |
| 237 | // public void resume() throws JademxException; |
| 238 | // |
| 239 | // /** |
| 240 | // * Start the platform after its been initialized. |
| 241 | // * @throws JademxException a problem that isn't illegal state |
| 242 | // * @throws IllegalStateException state illegal for this activity. |
| 243 | // */ |
| 244 | // public void start() throws JademxException; |
| 245 | // |
| 246 | // /** |
| 247 | // * Suspend the agent platform. Next action may be resume or kill. |
| 248 | // * @throws JademxException a problem that isn't illegal state |
| 249 | // * @throws IllegalStateException state illegal for this activity. |
| 250 | // */ |
| 251 | // public void suspend() throws JademxException; |
| 252 | |
| 253 | |
| 254 | } |