1 | package org.greenstone.gsdl3.util;
|
---|
2 |
|
---|
3 | import org.w3c.dom.Document;
|
---|
4 | import org.w3c.dom.Element;
|
---|
5 |
|
---|
6 | /** holds all the site setup variables
|
---|
7 | * includes a method to represent them as an XML node
|
---|
8 | *
|
---|
9 | * is this only applicable to the servlet type interface? should this
|
---|
10 | * be called ServletConfigVars? or WebServletVars?
|
---|
11 | */
|
---|
12 | public class ConfigVars {
|
---|
13 |
|
---|
14 | /** the name that has been given to the servlet thats running eg library
|
---|
15 | * not needed for other types of clients*/
|
---|
16 | public String library_name_=null;
|
---|
17 | /** the gsdl home directory
|
---|
18 | * where the sites and interfaces directories live */
|
---|
19 | public String gsdl3_home_ = null;
|
---|
20 | /** the name of the current site - may be null if the interface talks
|
---|
21 | * to a communicator */
|
---|
22 | public String site_name_=null;
|
---|
23 | /** the name of the current interface */
|
---|
24 | public String interface_name_=null;
|
---|
25 | /** the default language of the interface */
|
---|
26 | public String default_language_ = null;
|
---|
27 | /** the xml <config> element containing all the variables */
|
---|
28 | public Element config_xml_ = null;
|
---|
29 |
|
---|
30 | /** creates the <config> Element containting the variables
|
---|
31 | * needed by the xslt stuff */
|
---|
32 | public void createXML() {
|
---|
33 |
|
---|
34 | XMLConverter converter = new XMLConverter();
|
---|
35 | Document doc = converter.newDOM();
|
---|
36 |
|
---|
37 | config_xml_ = doc.createElement(GSXML.CONFIGURATION_ELEM);
|
---|
38 |
|
---|
39 | Element e;
|
---|
40 | e = GSXML.createTextElement(doc, "library_name", library_name_);
|
---|
41 | config_xml_.appendChild(e);
|
---|
42 | e = GSXML.createTextElement(doc, "gsdl3_home", gsdl3_home_);
|
---|
43 | config_xml_.appendChild(e);
|
---|
44 | e = GSXML.createTextElement(doc, "site_name", site_name_);
|
---|
45 | config_xml_.appendChild(e);
|
---|
46 | e = GSXML.createTextElement(doc, "interface_name", interface_name_);
|
---|
47 | config_xml_.appendChild(e);
|
---|
48 | }
|
---|
49 | }
|
---|
50 |
|
---|