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 org.dom4j.Element;
22: import org.mactor.framework.MactorException;
23:
24: public class MessagePublishSpec extends SpecNode {
25: private String channel;
26: private MessageBuilderSpec messageBuilder;
27: private boolean acceptResponse;
28:
29: public String getChannel() {
30: return channel;
31: }
32:
33: public static MessagePublishSpec loadSpec(Element element)
34: throws MactorException {
35: if (element == null)
36: return null;
37: MessagePublishSpec s = new MessagePublishSpec();
38: s.name = element.attributeValue("name");
39: s.channel = element.attributeValue("channel");
40: s.acceptResponse = Boolean.parseBoolean(element
41: .attributeValue("accept_response"));
42: s.messageBuilder = MessageBuilderSpec.loadSpec(element
43: .element("message_builder"));
44: return s;
45: }
46:
47: public MessageBuilderSpec getMessageBuilder() {
48: return messageBuilder;
49: }
50:
51: public String getShortDescription() {
52: return "Publisher node - '" + name + "'";
53: }
54:
55: public String getDescription() {
56: return "Channel:" + channel + ". Message builder:("
57: + messageBuilder.getDescription() + ")";
58: }
59:
60: public boolean isAcceptResponse() {
61: return acceptResponse;
62: }
63: }
|