Jens Kintrup wrote:

Hello,

I do not get the DataSourceComponentSelector to work with fortress. In
cocoon and the Excalibur Examples, the .roles and .xconf files look like
this


With Fortress it is preferred to use the meta tags. However, to answer your question, look further down below.


I started to put up just a single DataSourceComponent and this works with fortress. I want to use the same backend classes of my application in cocoon and other frameworks (e.g. swing). This means, use a DataSourceComponent "exclusiv or" DataSourceComponentSelector for the backend Application (e.g. the "Model" Part of MVC).

Fortress is a little different than ECM. Each component is at the root level. That means you can do this:

<jdbc-datasource id="foo"/>
<jdbc-datasource id="bar"/>
<jdbc-datasource id="baz"/>

Then, you can look up the selector this way:

ServiceSelector selector = (ServiceSelector) m_manager.lookup(
     DataSourceComponent.ROLE + "Selector");

Alternatively, you can look up any particular entry like this:

DataSourceComponent component = (DataSourceComponent)
    m_manager.lookup( DataSourceComponent.ROLE + "/foo" );
DataSourceComponent component = (DataSourceComponent)
    m_manager.lookup( DataSourceComponent.ROLE + "/bar" );
DataSourceComponent component = (DataSourceComponent)
    m_manager.lookup( DataSourceComponent.ROLE + "/baz" );

Lastly, you can get the default entry like this:

DataSourceComponent component = (DataSourceComponent)
    m_manager.lookup( DataSourceComponent.ROLE );

You can influence which entry is the default by adding a default="true"
attribute to the entry.  By default it is the first one listed.

Is it possible to use DataSourceComponentSelector in fortress or do I have
to use ExcaliburComponentManager or another Container (or do I have to write
my own or use that one of cocoon)?

As you can (hopefully) see by the information above, Fortress automatically creates the selectors for you.

--

"They that give up essential liberty to obtain a little temporary safety
 deserve neither liberty nor safety."
                - Benjamin Franklin


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to