1 | /*
|
---|
2 | * Communicator.java
|
---|
3 | * Copyright (C) 2002 New Zealand Digital Library, http://www.nzdl.org
|
---|
4 | *
|
---|
5 | * This program is free software; you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation; either version 2 of the License, or
|
---|
8 | * (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program; if not, write to the Free Software
|
---|
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
18 | */
|
---|
19 | package org.greenstone.gsdl3.comms;
|
---|
20 |
|
---|
21 | import org.greenstone.gsdl3.core.ModuleInterface;
|
---|
22 | import org.greenstone.gsdl3.util.*;
|
---|
23 |
|
---|
24 | //XML packages
|
---|
25 | import org.w3c.dom.Element;
|
---|
26 |
|
---|
27 | /** Communicator - base class for Modules that talk via some protocol to other modules
|
---|
28 | *
|
---|
29 | * can be used by a MessageRouter - in this case set localSiteName
|
---|
30 | * can be used by any other module - in this case it has no local site - dont set localsiteName. the setting of localSiteName affects the handling of teh to and from fields in the message.
|
---|
31 | * @author <a href="mailto:[email protected]">Katherine Don</a>
|
---|
32 | * @version $Revision: 3519 $
|
---|
33 | */
|
---|
34 | abstract public class Communicator
|
---|
35 | implements ModuleInterface {
|
---|
36 |
|
---|
37 | /** name of local site */
|
---|
38 | protected String local_site_name_ = null;
|
---|
39 |
|
---|
40 | /** name of site to connect to */
|
---|
41 | protected String remote_site_name_=null;
|
---|
42 |
|
---|
43 | /** converter for String to DOM and vice versa */
|
---|
44 | protected XMLConverter converter_= null;
|
---|
45 |
|
---|
46 | public Communicator() {
|
---|
47 | converter_ = new XMLConverter();
|
---|
48 | }
|
---|
49 |
|
---|
50 | public void setLocalSiteName(String name) {
|
---|
51 | local_site_name_ = name;
|
---|
52 | }
|
---|
53 | /** this should be done as part of configure */
|
---|
54 | public void setRemoteSiteName(String name) {
|
---|
55 | remote_site_name_ = name;
|
---|
56 | }
|
---|
57 | /** configures the Communicator using the <site> element */
|
---|
58 | abstract public boolean configure(Element site_elem);
|
---|
59 |
|
---|
60 | abstract public String process(String xml_in);
|
---|
61 |
|
---|
62 | abstract public Element process(Element xml_in);
|
---|
63 | }
|
---|