Fix Metaproxy stops logging after check config failed MP-590
[metaproxy-moved-to-github.git] / xml / experiments / config-imagine.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     <filter type="bounce"/>
43     </route>
44     <route id="public">
45       <filter type="z3950-client">
46         <target>localhost:9999/A</target>
47     </filter>
48     <filter type="bounce"/>
49     </route>
50     <route id="internal">
51       <filter type="z3950-client">
52         <target>localhost:9999/B</target>
53       </filter>
54       <filter type="bounce"/>
55    </route>
56     <route id="internal">
57       <xml:include href="file://module2.xml#filter45"/>
58       <xml:include href="file://module4.xml#filter145"/>
59       <filter type="bounce"/>
60     </route>
61     <route id="AB">
62       <filter type="multi">
63         <package route="A"/>
64         <package route="B"/>
65         <merge type="simple"/>
66       </filter>
67       <filter type="bounce"/>
68     </route>
69   </routes>
70 </yp2>
71
72 <!-- functions:
73     db           returns Z39.50 database(s)
74     path         HTTP path
75     HTTP-header  Any HTTP header (including content-type)
76     request-type Init,Search,HTTP,...
77     origin       IP of origin
78     port         Port
79
80
81 mother object filter-dom-hash
82   deletes pointers to contexts and filters  on program exit
83 hash filter-type -> hash-filter-id -> Context
84                  -> filter-binary-pointer
85
86 moher object router pointer hash
87
88 created in mother thread, read only structures.
89
90 Context* filter.configure(dom );
91
92
93
94 process(Context con)
95
96 where each filter can have is own context class
97
98 yp2::filter::Log::Context : public Context
99
100
101 Filters are constructed with a FilterFactory class which exposes a
102 method
103
104 Filter* createFilter(std::string type)
105
106  .. which returns a filter
107 instance. (The interface pointer that is). The FilterFactory may later
108 offer function
109   loadModule(std::string filename);
110 or even
111   loadModules(std::string filenamemask);
112
113
114
115 -->
116
117 <!-- observation: the logic could be controlled by a XSLT! -->