Re: Jakarta/Apache XML/RDF configuration file format(s)

Hi Stefano, Eric, everybody

I have been on travel and just now been able to catch up with all my email.
(also, Eric, can you update my address on the mailing list from
ridruejo@esi.us.es to daniel@rawbyte.com? Thanks!)
I have been working on a new version of Comanche for the past months.
I have implemented some ideas that you may find interesting

> > are not bothered by unnecessary information in their XML configuration
> 
> I assume you are referring to the separation of the application
> dependent data from the data that the GUI configuration program uses.

I have implmented it in the following way: One XML file to describe the
syntax, type, etc of the data file and the data file. If you edit by hand
you only have to modify the data file. The GUI loads the data file ad when
it has to represent one of the entries, it looks up it in the definition.

Example:

Data:

<servername>www.myhost.com</serverName>
<port>80</port>

Definition file:
<string name="serverName" label="Server Name" width="20">
<default>localhost</localhost>
</string>
<number name="port" label="Port" width="5">
<default>80</default>
</number>

> I believe Daniel Lopez Ridruejo has a lot of experience on this
> topic. Daniel - have you figured out the ultimate configuration schema
> to describe the universe?

Kind of :-) Here is my take on that. I wanted a generic enough configuration
mechanism so I can define arbitrary syntaxis. Brent Welch (from Tcl fame) gave
me the idea that I should go for describing the content, not what it looks
like (i.e use string instead of entry, because this way you can separate 
syntax from representation)

I have the following basic building blocks:


- String 
<string name="serverName" label="Name of the server"> 
<default>www.rawbyte.com</default> 
</string> 

What will appear in the configuration file:
<serverName>www.rawbyte.com</serverName>


- Number 
<string name="port" label="Port"> 
<default>80</default> 
</string> 
  
Conf file:
<port>80</port>

  
- List (Collection of elements of the same type. The list element definiton 
  (the part inside <syntax> can be itself be described in terms of other
basic building blocks) This is the simple case of a list of strings

<list name="userNames" label="Name of the users"> 
<syntax><string name="user" /></syntax>
<default> 
<item>Brent</item>
<item>Dani</item> 
</default> 
</list> 

Conf file:
<userNames><item>Brent</item><item>Dani</item></userNames>


- Structure: The structure is composed of one or more elements. For example, 
a web server address structure would be composed of a IP address / Port pair: 

<structure name="webAddress" label="Web address"> 
<syntax> 
<string name="ip" label="Ip Address" /> 
<string name="port" label="Port" /> 
</syntax> 
</structure> 

Conf file:
<webAddress>
<ip>10.0.0.1</ip>
<port>9-</port>
</webAddress>

- Choice: The user can select among several options. 
<choice name="fruits" label="Fruits of the loom"> 
<syntax> 
<option name="pear" value="green pear" /> 
<option name="grape" value="Red grape" /> 
</syntax> 
<default>pear</default> 
</choice> 

Conf file:
<fruits>pear</fruits>

- Boolean: The value can be one or zero (for true/false) 

<boolean name="hostNameLookUps" label="Look up host names?" > 
<default>0</default> 
</boolean> 

Conf file:
<hostNameLookUps>1</hostNameLookUps>

- Alternate: select one of several syntaxis

<alternate name="bindAddress" label="Address to bind the server">
<syntax>
<label name="allAddresses" label="All available addresses" />
<string name="specific" label="Specific address/domain-name" >
</string>
</syntax>
</alternate>

<bindAddress><specific>10.0.0.1</specific></bindAddress>


The cool thing about this is that you can arbitrarily define 
complex directives based on simple building blocks
Here is what comanche uses for allow/deny, etc directives
(do not worry, I think this is as complex as it can get:

<list name="access" label="IP based Access Control">
<syntax>
   <structure name="rule" label="Access Rule" >
         <syntax>
	      <choice name="action" label="Action">
	           <syntax>
		        <option name="allow" value="Allow Access" />
			<option name="deny" value="Deny Access" />
		   </syntax>
		   <default>deny</default>
	       </choice>
   <alternate name="subject" label="Based on" style="normal" align="horizontal">
         <syntax>
	      <alternate name="host" label="Hostname or IP address" style="normal">
                  <syntax>
		  <label name="all" label="All hosts" />
		  <string name="ipDom" label="Certain host(s) " />
                  </syntax>
	      </alternate>
	      <string name="env" label="Existence of environment variable" />
	 </syntax>
   </alternate>
  </syntax>
 </structure>
 </syntax>
 </list>
			       
Which translates into:

<access>
   <rule>
      <action>allow</allow>
      <subject><env>Mozilla</env></subject>
   </rule>
   <rule>
      <action>Deny</allow>
      <subject><env>Explorer</env></subject>
   </rule>   
</access>


To ease the transition, what I have also now is a set of rules for
converting from httpd.conf format to this one and the other way around.
So you can still edit your config files by hand.

I will release a beta as soon as I finnish the clean
up and some stuff I still have to do, so you can actually play with it.

What do you think of this stuff?


Cheers

Daniel

Received on Tuesday, 13 July 1999 20:35:03 UTC