Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Adding to CDO server properties programmatically
[CDO] Adding to CDO server properties programmatically [message #509761] Mon, 25 January 2010 10:29 Go to next message
Bjoern Sundin is currently offline Bjoern SundinFriend
Messages: 47
Registered: July 2009
Member
I have an application where the database connection details either are
retrieved from a project file or entered by the user at start up. In this
case I'm missing the possibility to add teneo and database properties
programmatically before creating the repository. I do have and use a
cdo-server.xml but would need to be able to add additional properties before
the creation (instantiation) of the repository.

Currently I use the following code while starting the server:
RepositoryConfigurator repositoryConfigurator = new RepositoryConfigurator(
IPluginContainer.INSTANCE);
// Here I would need to add some properties not defined in the config file
IRepository[] repositories = repositoryConfigurator.configure(configFile);

Maybe there is already a solution to this problem that I haven't discovered
yet?

Cheers
Bjoern
Re: [CDO] Adding to CDO server properties programmatically [message #509772 is a reply to message #509761] Mon, 25 January 2010 11:00 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6451
Registered: July 2009
Senior Member
Hi Bjoern,

Unfortunately the RepositoryConfigurator mechanism is somewhat crude. I
would like to come up with a better mechanism in the future. Ideally
using something established like the Spring framework.

I think that all <property name="..." value=".."/> elements in the
config file are passed to the repository. A store implementation can
access them from there.

DTH?

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Bjoern Sundin schrieb:
> I have an application where the database connection details either are
> retrieved from a project file or entered by the user at start up. In this
> case I'm missing the possibility to add teneo and database properties
> programmatically before creating the repository. I do have and use a
> cdo-server.xml but would need to be able to add additional properties before
> the creation (instantiation) of the repository.
>
> Currently I use the following code while starting the server:
> RepositoryConfigurator repositoryConfigurator = new RepositoryConfigurator(
> IPluginContainer.INSTANCE);
> // Here I would need to add some properties not defined in the config file
> IRepository[] repositories = repositoryConfigurator.configure(configFile);
>
> Maybe there is already a solution to this problem that I haven't discovered
> yet?
>
> Cheers
> Bjoern
>
>
>


Re: [CDO] Adding to CDO server properties programmatically [message #509787 is a reply to message #509772] Mon, 25 January 2010 12:37 Go to previous messageGo to next message
Bjoern Sundin is currently offline Bjoern SundinFriend
Messages: 19
Registered: July 2009
Location: Switzerland
Junior Member
Hi Eike,

Not really. Adding the properties as <property name="..." value=".."/> in the cdo.server.xml is what I do right now. This will, however, not do in the actual application, as the database settings are coming from another source.

I can of course programmatically open the cdo-server.xml and patch it to include the database properties before I pass the file to the RepositoryConfigurator. But I had hoped there would be another "cleaner" way to add to those properties.

Cheers
Bjoern
Re: [CDO] Adding to CDO server properties programmatically [message #509795 is a reply to message #509787] Mon, 25 January 2010 12:51 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6451
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070807090008020104060904
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Bjoern Sundin schrieb:
> Hi Eike,
>
> Not really. Adding the properties as <property name="..."
> value=".."/> in the cdo.server.xml is what I do right now. This will,
> however, not do in the actual application, as the database settings
> are coming from another source.
> I can of course programmatically open the cdo-server.xml and patch it
> to include the database properties before I pass the file to the
> RepositoryConfigurator. But I had hoped there would be another
> "cleaner" way to add to those properties.
The offender seems to be at the end of
RepositoryConfigurator.configure(File):

| CDOServerUtil.addRepository(container, repository);|



The addRepository() method implicitely activates the repository. We
could add a boolean parameter to control that and make the
RepositoryConfigurator configurable with that value. Would that help?

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper



--------------070807090008020104060904
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Bjoern Sundin schrieb:
<blockquote cite="mid:hjk3a9$bo7$1@build.eclipse.org" type="cite">Hi
Eike,
<br>
<br>
Not really. Adding the properties as &lt;property name="..."
value=".."/&gt;  in the cdo.server.xml is what I do right now. This
will, however, not do in the actual application, as the database
settings are coming from another source. <br>
I can of course programmatically open the cdo-server.xml and patch it
to include the database properties before I pass the file to the
RepositoryConfigurator. But I had hoped there would be another
"cleaner" way to add to those properties. <br>
</blockquote>
The offender seems to be at the end of
RepositoryConfigurator.configure(File):<br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = -->
<!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code><font color="#ffffff">      </font><font
color="#000000">CDOServerUtil.addRepository</font><font color="#000000">(</font><font
color="#000000">container, repository</font><font color="#000000">)</font><font
color="#000000">;</font></code> </td>
<!-- end source code --> </tr>
</tbody>
</table>
</div>
<!-- = END of automatically generated HTML code = -->
<!-- ======================================================== --><br>
<br>
The addRepository() method implicitely activates the repository. We
could add a boolean parameter to control that and make the
RepositoryConfigurator configurable with that value. Would that help?<br>
<br>
Cheers<br>
/Eike<br>
<br>
----<br>
<a class="moz-txt-link-freetext" href="http://thegordian.blogspot.com">http://thegordian.blogspot.com</a><br>
<a class="moz-txt-link-freetext" href="http://twitter.com/eikestepper">http://twitter.com/eikestepper</a><br>
<br>
<br>
</body>
</html>

--------------070807090008020104060904--


Re: [CDO] Adding to CDO server properties programmatically [message #509806 is a reply to message #509795] Mon, 25 January 2010 13:28 Go to previous messageGo to next message
Bjoern Sundin is currently offline Bjoern SundinFriend
Messages: 19
Registered: July 2009
Location: Switzerland
Junior Member
Hello Eike,

Yes, I think this would help. In this case I would have the possibility to get the repository from the RepositoryConfigurator and add the database properties before activation. I gather I then explicitly have to call CDOServerUtil.addRepository(container, repository) in order to activate, right?

Cheers
Björn
Re: [CDO] Adding to CDO server properties programmatically [message #509904 is a reply to message #509806] Mon, 25 January 2010 13:00 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6451
Registered: July 2009
Senior Member
Bjoern Sundin schrieb:
> Hello Eike,
>
> Yes, I think this would help. In this case I would have the
> possibility to get the repository from the RepositoryConfigurator and
> add the database properties before activation.
Please file an enhancement request. Attaching a simple patch would make
it quicker ;-)

> I gather I then explicitly have to call
> CDOServerUtil.addRepository(container, repository) in order to
> activate, right?
No, just LifecycleUtil.activate(repository);

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] Adding to CDO server properties programmatically [message #510011 is a reply to message #509904] Tue, 26 January 2010 08:14 Go to previous message
Bjoern Sundin is currently offline Bjoern SundinFriend
Messages: 47
Registered: July 2009
Member
Filed enhancement request: Bug 300770

Cheers
Bjoern

"Eike Stepper" <stepper@esc-net.de> schrieb im Newsbeitrag news:hjklsi$fhu$1@build.eclipse.org...
> Bjoern Sundin schrieb:
>> Hello Eike,
>>
>> Yes, I think this would help. In this case I would have the
>> possibility to get the repository from the RepositoryConfigurator and
>> add the database properties before activation.
> Please file an enhancement request. Attaching a simple patch would make
> it quicker ;-)
>
>> I gather I then explicitly have to call
>> CDOServerUtil.addRepository(container, repository) in order to
>> activate, right?
> No, just LifecycleUtil.activate(repository);
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
Previous Topic:Custom Store Developing
Next Topic:Which EEnum field to use for i18n?
Goto Forum:
  


Current Time: Fri Nov 15 20:13:02 GMT 2019

Powered by FUDForum. Page generated in 0.02684 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top