01: /******************************************************************************
02: * Copyright (C) Lars Ivar Almli. All rights reserved. *
03: * ---------------------------------------------------------------------------*
04: * This file is part of MActor. *
05: * *
06: * MActor is free software; you can redistribute it and/or modify *
07: * it under the terms of the GNU General Public License as published by *
08: * the Free Software Foundation; either version 2 of the License, or *
09: * (at your option) any later version. *
10: * *
11: * MActor is distributed in the hope that it will be useful, *
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14: * GNU General Public License for more details. *
15: * *
16: * You should have received a copy of the GNU General Public License *
17: * along with MActor; if not, write to the Free Software *
18: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
19: ******************************************************************************/package org.mactor.framework.spec;
20:
21: import java.util.Iterator;
22: import java.util.LinkedList;
23: import java.util.List;
24: import org.dom4j.Element;
25: import org.mactor.framework.MactorException;
26:
27: public class MessageSelectorSpec extends SpecNode {
28: private String command;
29: private List<String> params = new LinkedList<String>();
30:
31: public static MessageSelectorSpec loadSpec(Element element)
32: throws MactorException {
33: if (element == null)
34: return null;
35: MessageSelectorSpec s = new MessageSelectorSpec();
36: s.name = element.attributeValue("name");
37: s.command = element.attributeValue("command");
38: Iterator it = element.elementIterator("param");
39: while (it.hasNext())
40: s.params.add(((Element) it.next()).getTextTrim());
41: return s;
42: }
43:
44: public String getCommand() {
45: return command;
46: }
47:
48: public List<String> getParams() {
49: return params;
50: }
51:
52: public String getShortDescription() {
53: return "Message selector node - '" + name + "'";
54: }
55:
56: public String getDescription() {
57: return "Command:" + command + ". Params:" + params;
58: }
59: }
|