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 MessageSubscribeSpec extends SpecNode {
25: private String channel;
26: private MessageSelectorSpec messageSelector;
27:
28: public String getChannel() {
29: return channel;
30: }
31:
32: public MessageSelectorSpec getMessageSelector() {
33: return messageSelector;
34: }
35:
36: public static MessageSubscribeSpec loadSpec(Element element)
37: throws MactorException {
38: if (element == null)
39: return null;
40: MessageSubscribeSpec s = new MessageSubscribeSpec();
41: s.name = element.attributeValue("name");
42: s.channel = element.attributeValue("channel");
43: s.messageSelector = MessageSelectorSpec.loadSpec(element
44: .element("message_selector"));
45: return s;
46: }
47:
48: public String getShortDescription() {
49: return "Subscriber node - '" + name + "'";
50: }
51:
52: public String getDescription() {
53: return "Channel:" + channel + ". Selector:("
54: + messageSelector.getDescription() + ")";
55: }
56: }
|