users@glassfish.java.net

Re: Name Space Binding for constant Strings

From: <glassfish_at_javadesktop.org>
Date: Tue, 17 Jul 2007 11:35:58 PDT

I know that, but doing it that way is not enough.

the entry

<env-entry>
<env-entry-name>cfg/xxx</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>my string</env-entry-value>
</env-entry>

just declares that the program will use an entry of type String with a default value "my string" if nothing is found. This is actually the same with JDBC: you just declare you need a datasource and let the deployer give you one (except you can't define a default value for a datasource). As you said, the level of indirection is used because the value is provided by the Container.

What you still need is the container entry (same as in Datasource) that is defined on the server and linked during the deployment. This is useful for environment sensitive things that you want to be able to change without "opening" the application. A Test environment points to the Test database and an integration environment points to the integration database but the application doesn't change because of that. Just the binding at deployment time.

This can also be done with environment entries (if you have a WebSphere, you can do that under environment > naming > Name Space Binding) to, as an example, get the default directory (localy on test running windows but on NAS running on Linux for the production).

I'm not sure I'm making myself understand but I don't know how else to explain it.

-jeremie
[Message sent by forum member 'granat' (granat)]

http://forums.java.net/jive/thread.jspa?messageID=226985