support multiple persistence mechanisms in muse.xml
---------------------------------------------------
Key: MUSE-287
URL: https://issues.apache.org/jira/browse/MUSE-287
Project: Muse
Issue Type: Bug
Affects Versions: 2.2.0
Reporter: Vinh Nguyen
Assignee: Dan Jemiolo
Hi,
Currently, muse.xml only allows configuration of one persistence
implementation. The default is file-based persistence. This is ok for
"singleton" services.
But, dynamically created resources may need to be persisted to an external data
source like a database. I can do this by writing custom persistence code and
explicitly invoke it during initialization/shutdown of my dynamic resources (I
would also need to extend SimpleResource to initiate the invokation there).
But ideally, I should just need to write my Persistence class and have it
managed by the Muse framework itself the same way as it already does for the
default RouterFilePersistence.
This can be achieved if muse.xml lets <persistence> be defined in each
<resource-type> definition, instead of globally in the <router> element. For
example, the following configuration would let SimpleResource use file-based
persistence, and SubscriptionManager use db persistence:
<resource-type>
<context-path>SimpleResource</context-path>
<persistence>
<java-persistence-class>org.apache.muse.core.routing.RouterFilePersistence</java-persistence-class>
<persistence-location>router-entries</persistence-location>
</persistence>
...
</resource-type>
<resource-type>
<context-path>SubscriptionManager</context-path>
<persistence>
<java-persistence-class>com.cisco.sample.routing.RouterDBPersistence</java-persistence-class>
<persistence-location>some jndi value</persistence-location>
</persistence>
...
</resource-type>
With this design, the framework can automatically manage all the different
types of resource persistence implementations specified. If a <resource-type>
doesn't contain a <persistence> entry, the framework can simply ignore that
resource definition during startup. Also, the "use-router-persistence"
attribute in the <resource-type> element will no longer be needed.
-Vinh
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]