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 MessageBuilderSpec extends SpecNode {
28: private String templatePath;
29: private String command;
30: private List<String> params = new LinkedList<String>();
31:
32: public String getCommand() {
33: return command;
34: }
35:
36: public List<String> getParams() {
37: return params;
38: }
39:
40: public String getTemplatePath() {
41: return templatePath;
42: }
43:
44: public static MessageBuilderSpec loadSpec(Element element)
45: throws MactorException {
46: if (element == null)
47: return null;
48: MessageBuilderSpec mbs = new MessageBuilderSpec();
49: mbs.name = element.attributeValue("name");
50: mbs.command = element.attributeValue("command");
51: mbs.templatePath = element.attributeValue("template_path");
52: Iterator it = element.elementIterator("param");
53: while (it.hasNext())
54: mbs.params.add(((Element) it.next()).getTextTrim());
55: return mbs;
56: }
57:
58: public String getShortDescription() {
59: return "Message builder node - '" + name + "'";
60: }
61:
62: public String getDescription() {
63: return "Command:" + command + ". Params:" + params
64: + ". Template path:" + templatePath;
65: }
66: }
|