CPPSERV


Home Projects Jobs Clientele Contact

cppserv


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Config API



So, here is what I came up with:

There is an abstract class ServerConfig. It provides following functions:
private addApp(name, sessionTimeout)
private addServlet(app,name,dsoPath)
private removeApp(name)
private removeServlet(app,name)
public processConfig() - this will be called by main application server
object

App name must be unique server-wide
Servlet name should be unique application-wide

ServerConfig also declares following pure virtual functions:
getNodes(parent) - this function returns children nodes of parent.
                                  if parent is predefined NondeRoot,
returns top-level nodes.

ServerConfig::ConfigNode has following members:
type - type of node. For example Root, App, Servlet, Param
name - name of node (may be optional for some node types)
attributes - hash map of node attributes.

internally ServerConfig will create and keep hash map of
ServerConfig::App objects, that will have ServerContext*,
collection of Servlets, DSO handles for servlets, etc. inside.

The idea is that processConfig() will walk through config tree by calling
getNodes() and looking at things it recognizes. This means there will be
absolutely no structure checking in derived class - processConfig() will
yell
itself, when it finds something wrong (like definition of DSO parameter for
App).

I still have to think through run-time configuration change handling...

-- 
Ilya A. Volynets-Evenbakh
Total Knowledge. CTO
http://www.total-knowledge.com


Authoright © Total Knowledge: 2001-2008