You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Phil Steitz (JIRA)" <di...@incubator.apache.org> on 2005/03/27 21:58:15 UTC

[jira] Created: (DIRNAMING-16) Support links in XmlConfigurator

Support links in XmlConfigurator
--------------------------------

         Key: DIRNAMING-16
         URL: http://issues.apache.org/jira/browse/DIRNAMING-16
     Project: Directory Naming
        Type: Improvement
    Reporter: Phil Steitz
 Assigned to: Phil Steitz 


Modify the XmlConfigurator to support links.  Logically, this will provide functionality similar to, but significantly extending, the "global naming resources" provided by tomcat.

The idea is to enable links to other in-memory or external LDAP-backed contexts in XmlConfiguration documents, as in the example below:

<naming> 
  <context name="global">
    <resource name="jdbc/pool" type="javax.sql.DataSource">
      <parameter>
        <name>driverClassName</name>
        <value>org.hsqldb.jdbcDriver</value>
      </parameter>
      <parameter>
        <name>url</name>
        <value>jdbc:hsqldb:target/hsqldb</value>
      </parameter>
      <parameter>
        <name>username</name>
        <value>sa</value>
      </parameter>
      <parameter>
        <name>password</name>
        <value></value>
      </parameter>
    </resource>
  </context>
  <context name="app1" base="java:comp/env">
    <environment name="port" value="5555" type="java.lang.Integer" />
    <link name="datasource" context="global" rname="jdbc/pool" />
  </context> 
</naming>

Hashtable env = new Hashtable();
env.put(NamingContext.NAME, "app1");
Context ctx = new InitialContext(env);
Context env = (Context) ctx.lookup("java:comp/env);
Integer port = (Integer) env.lookup("port");
DataSource ds = (DataSource) env.lookup("datasource"); //follows link

Similarly, an external LDAP context could be referenced, with federation transparent to the client app:

<naming> 
  <context name="persistent" url="ldap://ldap.foo.com:389" />
  <context>
     ...
    <link name="config/host" context="persistent" rname="config/host" />
    <link name="config" context="persistent" rname="config" />
  </context> 
</naming>

Context ctx = new InitialContext();
Context env = (Context) ctx.lookup("java:comp/env);
String host = (String) env.lookup("config/host");

To support this, store jndi LinkRefs with jndi url names to represent the links. 


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira