Most application-servers provide a JNDI InitialContext implementation
instance to web applications running under it, in a manner that is
compatible with those provided by a Java2 Enterprise Edition application
server. In this context it is possible to define resources like: 
*) JavaBean Resources 
*) JavaMail Sessions 
*) JDBC Data Sources 
*) User Transactions 

Since this provides a documented and standarized way to retrieve a JDBC
Data Source (even pooled one's), i have looked how hard it is to make
MMBase work with connections retrieved from the application server. 

The changes which are needed to add the functionality of this to MMBase
are: 
    - Create a protected constructor inside
    org.mmbase.module.database.MultiConnection 
    - Add an 'Module-'class replacement (i used the file:
    org.mmbase.module.database.Naming, but maybe someone has a better
    name) 
    - Add the jdbc.jar to the lib directory. (We could also add the
    j2ee.jar to the lib-directory, this way we only need j2ee.jar,
    junit.jar and log4j.jar) 
    
Changes needed to activate this functionality: 
    - Inside config/module/jdbc.xml we need -only- the following
    information 
        - classname = "org.mmbase.module.database.Naming"; 
        - context = "java:comp/env" 
        - resource name = "jdbc/MMBase" 
    - Inside web.xml we need to tell the application server, that we
    require the resource 
        ... 
        <resource-ref> 
          <res-ref-name>jdbc/MMBase</res-ref-name> 
          <res-type>javax.sql.DataSource</res-type> 
          <res-auth>Container</res-auth> 
        </resource-ref> 
        ... 
    - Inside the application-server configuration the resource has to be
    defined. This is application server specific. 

Im not trying to change the way the connection-pooling now works, but i
want to provide a way in which MMBase can be deployed more like an
webapplication. (more easy to create a generic security-manager-config,
since the jdbc-driver-name is no longer relevate for MMBase, only the
sort of database) 

Tested with: 
Orion && PostgreSQL 
Tomcat && PostgreSQL 
Tomcat && HSQLdb 

In the same line: 
    We can also use JavaMail-Sessions, so that this some of the email
    configuration can also be stored inside the application server 

An other point: ImageMagick is used with an exec command, it also has an
java interface,... 

-- 
Eduard Witteveen Systeem Ontwikkelaar
Publieke Omroep,  Gateway C Kamer 101
+31(0)356772910 http://www.omroep.nl/
Sed quis custodiet ipsos custodes? : The sixth Satire from Juvenal

Reply via email to