Experiments with session map template.
[metaproxy-moved-to-github.git] / etc / config1.xml
1 <?xml version="1.0"?>
2 <!-- imagined config for yp2..
3   The router system understands yp2, sequence and filter elements.
4   Everything else interpreted by filters.
5   Each filter is invoked in a sequence (unless a filter invokes another
6   sequence.. A start sequence must be determined somehow.
7   -->
8 <yp2 xmlns="http://indexdata.dk/yp2/config/1">
9   <start route="id_hytg"/>
10   <filters>
11     <filter id="front_default" type="frontend-net">
12       <!-- the Z39.50/HTTP frontend -->
13       <port>210</port>
14     </filter>
15     <filter id="log_out" type="log">          <!-- apply logging always -->
16       <logfile>out.log</logfile>
17     </filter>
18     <filter id="log_cerr" type="log">          <!-- apply logging always -->
19       <logfile>std::cerr</logfile>
20     </filter>
21   </filters>
22
23   <routes>  
24     <route id="start">
25       <filter refid="log_cout"/>
26       <filter type="cond">           <!-- conditional -->
27         <if test="port=210 and db=public" route="A"/> 
28         <if test="port=210 and db=other" route="B"/> 
29         <switch>
30           <case test="blabla" route="C"/>
31           <case test="blabla2" route="C2"/>
32           <default route="C3"/>
33         </switch>
34       </filter>
35       <filter refid="log_out"/>
36       <filter refid="log_cerr"/>
37       <filter type="log">          <!-- apply logging always -->
38         <logfile>mylog.log</logfile>
39       </filter>   
40     <filter name="reject">        <!-- reject .. -->
41     </filter>
42     </route>
43     <route id="public">
44       <filter type="z3950-client">
45         <target>localhost:9999/A</target>
46     </filter>
47     </route>
48     <route id="internal">
49       <filter type="z3950-client">
50         <target>localhost:9999/B</target>
51       </filter>
52     </route>
53     <route id="internal">
54       <xml:include href="file://module2.xml#filter45"/>
55       <xml:include href="file://module4.xml#filter145"/>
56     </route>
57     <route id="AB">
58       <filter type="multi">
59         <package route="A"/>
60         <package route="B"/>
61         <merge type="simple"/>
62       </filter>
63     </route>
64   </routes>
65 </yp2>
66
67 <!-- functions:
68     db           returns Z39.50 database(s)
69     path         HTTP path
70     HTTP-header  Any HTTP header (including content-type)
71     request-type Init,Search,HTTP,...
72     origin       IP of origin
73     port         Port
74
75
76 mother object filter-dom-hash
77   deletes pointers to contexts and filters  on program exit
78 hash filter-type -> hash-filter-id -> Context
79                  -> filter-binary-pointer
80
81 moher object router pointer hash
82
83 created in mother thread, read only structures.
84
85 Context* filter.configure(dom );
86
87
88
89 process(Context con)
90
91 where each filter can have is own context class
92
93 yp2::filter::Log::Context : public Context
94
95
96 Filters are constructed with a FilterFactory class which exposes a
97 method 
98
99 Filter* createFilter(std::string type)
100
101  .. which returns a filter
102 instance. (The interface pointer that is). The FilterFactory may later
103 offer function
104   loadModule(std::string filename);
105 or even
106   loadModules(std::string filenamemask);
107
108
109
110 -->
111
112 <!-- observation: the logic could be controlled by a XSLT! -->