directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: [naming] ResourceLinks
Date Thu, 01 Jan 1970 00:00:00 GMT
--- Erhalten von  SYSUEXT.UE05588 +41 51 220 49 56           12.01.05 16.37

Hi Phil

Thank's for your repliy. First I give you some explanations what we are doing
and then what we would like to have:

We have developed a framework similar to Hivemind. In our application code we
have jndi lookups to java:comp/env but also to the 'global' context.


To make our code work with out modification in a J2SE Environment, where no
JNDI implementaion is available from an App Server, we need to be able to
bind names to the global/initial context and also to some other contexts like
java:comp/env. We also need to have references (resourcelink) pointing to
'global' resources.

Since it looks like I have some time to spend on that I would like to provide
patches. Here are my thoughts:

- To enable resourcelinks I propose to change the naming.dtd ( see below).
Only the class ResourceLinkFactory from Tomcat sources must be added AFAIK
and some coding to make it work is necessary.

- To be able to store resources to the global context a way must be found to
identify which context of all the contexts in naming.xml is/are the global
one. Since the context without a name attribut is associated with
java:comp/env I propose to indicate the global one with a flag in the context
element. <context global="true">. The name attribute would then be ignored.

I can implement a solution and submit it to you. If you like it, commit it
otherwise drop it.



More than one context element is allowed in naming.xml. Why is
XMLConfigurator destroying the previous initial context when a context
element, having a name attribute, is found? This way all previous created
contexts are lost. Is this a bug or a feature? Can you explain me the scenes

                if (ctx.getName() != null)



                    Context initialContext = new InitialContext();

                    Name nm = initialContext.getNameParser("").parse

                    envContext = initialContext.createSubcontext(nm.get(0));

                    jndiCtx = envContext;

                    for (int k = 1; k < nm.size(); k++) {

                        jndiCtx = jndiCtx.createSubcontext(nm.get(k));



Kind regards

The proposed dtd:

<!ELEMENT naming (context*)>

<!ELEMENT context ((context|environment|resource|resourcelink)*)>
<!ATTLIST context
    name  CDATA #IMPLIED>
    global CDATA #IMPLIED>

<!ELEMENT environment (EMPTY)>
<!ATTLIST environment
        type  CDATA #REQUIRED
        value CDATA #REQUIRED

<!ELEMENT resource (parameter*)>
<!ATTLIST resource
        type  CDATA #REQUIRED

Date: Tue, 11 Jan 2005 16:59:52 -0500
Subject: Re: [naming] ResourceLinks

> --- Erhalten von  SYSUEXT.UE05588 +41 51 220 49 56           11.01.05 15.57
> Hi all
> Yes, this message does not belong to this list but so far there is no user
> list. Right?

Yes, this is the only list, for now and you are asking in the right place.

> In a J2SE Environment (without any EJB/Web Container) we want to simulate
> the <ResourceLink> Element like it is used in Tomcat's server.xml.
> Can this be achived like this?:
> <naming>
> For entries in <GlobalNamingResources> <Resource>
>   <context name="IC_">
>      <resource name="jdbc/pool" type="javax.sql.DataSource">
>       ...
>      </resource>
>   </context>
> For entries in <Context> <ResourceLink>
>   <context>
>      <resource name="jdbc/pool" type="javax.sql.DataSource">
>       ...
>      </resource>
>   </context>
> </naming>
> Thank's for any help on this!
> Best regards Roland

Can you explain a little more what exactly you are trying to do?
Currently, ResourceLinks are not supported by the XmlConfigurator,
though this would be a pretty easy extension.  The examples here:
pretty much cover what is available via the configurator now.

The JNDI provider, however, does support links, so you could use the API
directly to set this up as well.

Let us know what you would like to see -- best of all with patches --
and we will see what we can do.


---- 12.01.05 16.37 ---- Gesendet an   --------------------------------------

View raw message