You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Noel J. Bergman" <no...@devtech.com> on 2004/03/21 08:18:16 UTC

VirtualUserTable updates

With help from Craig Raw, we now have massively improved Virtual User Table
functionality.

The new code moves the core Virtual User Table behavior into a base class,
with specialized mapping classes.  XML and JDBC mappers are currently
supported.

An example of the XML format would be:

  <mailet match="All" class="XMLVirtualUserTable">
     <!-- 1:1 mapping -->
     <mapping>morgoth@middle-earth=sauron@mordor</mapping>
     <!-- 1:n mapping -->

<mapping>istari@middle-earth=saruman@isengard;radigast;gandalf</mapping>
     <!-- DSN mapping -->
     <mapping>boromir@osgilliath=error:550 Requested action not taken: no
such user here</mapping>
     <!-- regex based mapping -->
     <mapping>*@osgilliath=regex:(.*)@osgilliath:${1}@minas-tirith</mapping>
     <!-- both standard and regex mapping -->
     <mapping>ring@*=onering@mordor;regex:ring@(.*):ring@${1}</mapping>
     <!-- conditional regex mapping example -->

<mapping>*@listserver=regex:(.*)-on@listserver:${1}-subscribe@listserver;

regex:(.*)-off@listserver:${1}-unsubscribe@listserver
     </mapping>
  </mailet>

A JDBC representation of the same mapping would be:

  insert ignore into VirtualUserTable values("morgoth", "middle-earth",
"sauron@mordor");
  insert ignore into VirtualUserTable values("istari", "middle-earth",
"saruman@isengard;radigast;gandalf");
  insert ignore into VirtualUserTable values("boromir", "osgilliath",
"error:550 Requested action not taken: no such user here");
  insert ignore into VirtualUserTable values("%", "osgilliath",
"regex:(.*)@osgilliath:${1}@minas-tirith");
  insert ignore into VirtualUserTable values("ring", "%",
"onering@mordor;regex:ring@(.*):ring@${1}");
  insert ignore into VirtualUserTable values("%", "listserver",
"regex:(.*)-on@listserver:${1}-subscribe@listserver;regex:(.*)-off@listserve
r:${1}-unsubscribe@listserver");

These examples demonstrate a forwarding address, a simple list, an error
reply, a regex mapping for bulk forwarding, a regex mapping that essentially
adds a CC to an existing message, and conversion from -on/-off
to -subscribe/-unsubscribe.

I've tested all of these samples with both the XML and JDBC implementations.

	--- Noel


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org