Hi,
Not out-of-the-box, no.
However, all the metadata is modifiable at runtime. We do something like the
following code.
Hope that helps
Charles.
private void init {
JdbcConnectionDescriptor connectionDescriptor =
getConnectionDescriptor("");
Properties databaseProperties = getDatabaseProperties(); // Get this
from wherever...
if (databaseProperties != null) {
changeDescriptor(databaseProperties, connectionDescriptor);
}
}
private void changeDescriptor(Properties databaseProperties,
JdbcConnectionDescriptor connectionDescriptor) {
String driver = databaseProperties.getProperty("driver");
if (driver != null) {
Log.debug(this, "changeDescriptor - setting driver");
connectionDescriptor.setDriver(driver);
}
String protocol = databaseProperties.getProperty("protocol");
if (protocol != null) {
Log.debug(this, "changeDescriptor - setting protocol");
connectionDescriptor.setDbAlias(protocol);
}
String subprotocol = databaseProperties.getProperty("subprotocol");
if (subprotocol != null) {
Log.debug(this, "changeDescriptor - setting subprotocol");
connectionDescriptor.setSubProtocol(subprotocol);
}
String dbalias = databaseProperties.getProperty("dbalias");
if (dbalias != null) {
Log.debug(this, "changeDescriptor - setting dbAlias");
connectionDescriptor.setDbAlias(dbalias);
}
String username = databaseProperties.getProperty("username");
if (username != null) {
Log.debug(this, "changeDescriptor - setting username");
connectionDescriptor.setUserName(username);
}
String password = databaseProperties.getProperty("password");
if (password != null) {
Log.debug(this, "changeDescriptor - setting password");
connectionDescriptor.setPassWord(password);
}
}
private JdbcConnectionDescriptor getConnectionDescriptor(String jcdAlias) {
MetadataManager metadataManager = MetadataManager.getInstance();
ConnectionRepository connectionRepository =
metadataManager.connectionRepository();
PBKey defaultKey =
connectionRepository.getStandardPBKeyForJcdAlias(jcdAlias);
JdbcConnectionDescriptor connectionDescriptor =
connectionRepository.getDescriptor(defaultKey);
return connectionDescriptor;
}
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: 29 September 2003 11:37
> To: [EMAIL PROTECTED]
> Subject: externalize db-props from repository.xml
>
>
> Hi,
> I want to move the database-alias, username and password from
> repository.xml
> to a *.properties-file, because this will make the deploy process
> (test-/production-environment) much easier.
> For example :
>
> repository.xml:
> <jdbc-connection-descriptor dbalias="${db.alias}"
> password="${db.passwd}"
> username="${db.username}" .... />
>
> ojb.properties:
> db.alias=/192.168...........
> db.user=honk
> db.passwd=test
>
> Is this possible?
> Is there an other easy way to do this?
>
> Thanks in advance,
> Sven
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
This email and any attachments are strictly confidential and are intended
solely for the addressee. If you are not the intended recipient you must
not disclose, forward, copy or take any action in reliance on this message
or its attachments. If you have received this email in error please notify
the sender as soon as possible and delete it from your computer systems.
Any views or opinions presented are solely those of the author and do not
necessarily reflect those of HPD Software Limited or its affiliates.
At present the integrity of email across the internet cannot be guaranteed
and messages sent via this medium are potentially at risk. All liability
is excluded to the extent permitted by law for any claims arising as a re-
sult of the use of this medium to transmit information by or to
HPD Software Limited or its affiliates.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]