Hi Douglas,
The issue in your case is the mix of namespace. Your policySet provides the
intent "recoveryRules" for the following namespace *{
http://www.osoa.org/xmlns/sca/1.0}<http://www.osoa.org/xmlns/sca/1.0%7DrecoveryRules>.
*But your definitions.xml file in
http://svn.apache.org/repos/asf/tuscany/sandbox/dougsleite/policy-recoveryrules/src/main/resources/org/apache/tuscany/sca/policy/recoveryrules/definitions.xmldefines
the intent in a different namespace
*{http://tuscany.apache.org/xmlns/sca/1.0}*.
*
*You problem should be resolved if this namespace issue is fixed OR You can
change your definitions.xml file to look like this...*
*
<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
<sca:policySet name="recoveryRulesPolicy"
provides="tuscany:recoveryRules"
appliesTo="sca:implementation.java">
You are right, in the user application "requires=recoveryRules" should be
added as an attribute for the implementation.java element.
And since you have registered your RecoveryRulesPolicyProcessor using the
StAXArtifactProcessor extension as you have already done here...
http://svn.apache.org/repos/asf/tuscany/sandbox/dougsleite/policy-recoveryrules/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor.
The SCA runtime will invoke your processor as and when required.
On Tue, Jul 21, 2009 at 11:25 PM, Douglas Leite <[email protected]>wrote:
> Hi,
>
> Based on the "policy-loggin" and "binding-ws-axis2-policy" modules, I have
> implemented the "policy-recoveryrules" module in order to treat the recovery
> rules as a policy. I have defined a xml processor
> (RecoveryRulesPolicyProcessor), so I am able to read and process the data
> present at definition.xml file. However, when I try to use the policy in a
> composite file (e.g., <implementation.java
> class="org.apache.tuscany.sca.guardian.GuardianGroupImpl"
> requires="recoveryRules"/>) I get the following message:
>
> *SEVERE: Provided Intent - {
> http://www.osoa.org/xmlns/sca/1.0}recoveryRules<http://www.osoa.org/xmlns/sca/1.0%7DrecoveryRules>not
> found for PolicySet {
> http://primarybackup}recoveryRulesPolicy*
> *Exception in thread "main" org.osoa.sca.ServiceRuntimeException: Provided
> Intent -
> {http://www.osoa.org/xmlns/sca/1.0}recoveryRules<http://www.osoa.org/xmlns/sca/1.0%7DrecoveryRules>not
> found for PolicySet {
> http://primarybackup}recoveryRulesPolicy*
>
> Actually, the problem appears even the "requires="recoveryRules"" is not
> defined. The presence of the definition.xml file is enough to get the
> message error.
>
> I am not sure, but I understood that an user application, in order to use
> the recovery rules as polices, needs to define at the composite file the
> "requires=recoveryRules" clause (as an attribute of an implementation.java
> tag), and the recovery rules at the definition.xml file. Then, with my
> RecoveryRulesPolicyProcessor I am able to process the definition.xml. Is it
> right? Moreover, does the SCA runtime invoke the processor or I need to do
> it inside my code?
>
> Probably, I am missing something. I tried to search some example that
> applies the pollicy-loggin in a composite, but I could not find. Do you know
> any example that could help me?
>
> Regards,
>
> Source code:
> #guardian-model:
> http://svn.apache.org/repos/asf/tuscany/sandbox/dougsleite/guardian-model/
> #policy-recoveryrules:
> http://svn.apache.org/repos/asf/tuscany/sandbox/dougsleite/policy-recoveryrules/
>
>
> On Thu, Jul 16, 2009 at 9:53 AM, Douglas Leite <[email protected]>wrote:
>
>> Hi Ramkumar,
>>
>> At this moment I am working to implement the design proposed in this
>> thread, i.e., move the recovery rules configuration file to the
>> definition.xml.
>>
>> I will post the updates soon.
>>
>> Regards
>>
>>
>> On Thu, Jul 16, 2009 at 6:30 AM, Ramkumar R <[email protected]>wrote:
>>
>>> Hi Douglas,
>>>
>>> Were you able to get this working for you, please keep posting if you
>>> have any issues in doing so.
>>>
>>>
>>> On Wed, Jul 8, 2009 at 7:40 PM, Luciano Resende <[email protected]>wrote:
>>>
>>>> On Wed, Jul 8, 2009 at 4:38 AM, Ramkumar R<[email protected]>
>>>> wrote:
>>>> > On Mon, Jul 6, 2009 at 10:52 PM, Douglas Leite <[email protected]>
>>>> wrote:
>>>> >>
>>>> >> How does it work? In the composite file I would use
>>>> >> requires="recoveryRules, but how about the definitions.xml file? Is
>>>> there a
>>>> >> way to set the configurations like the recovery rules XML file is
>>>> defined?
>>>> >> (take a look at [1])
>>>> >>
>>>> >> [1]
>>>> >>
>>>> http://svn.apache.org/repos/asf/tuscany/sandbox/dougsleite/guardian-model/src/main/resources/recoveryrules.xml
>>>> >
>>>> > Hi Douglas,
>>>> >
>>>> > You can define a policySet in definition.xml for the recovery rules as
>>>> shown
>>>> > below...
>>>> >
>>>> > <policySet name="RecoveryPolicy" provides="tuscany:recoveryRules"
>>>> > appliesTo="sca:implementation.java"
>>>> > xmlns="http://www.osoa.org/xmlns/sca/1.0">
>>>> > <tuscany:recovery_rules>
>>>> > <tuscany:rule name="Rule1"
>>>> > signaled_exception="org.apache.tuscany.sca.guardian.JoinException">
>>>> > <tuscany:participant match="SIGNALER">
>>>> > <tuscany:throw_exception
>>>> >
>>>> class="org.apache.tuscany.sca.guardian.itests.primaryBackup.common.PrimaryExistsException"
>>>> > target_context="MAIN" min_participant_joined="2"/>
>>>> > </tuscany:participant>
>>>> > <tuscany:participant match="!SIGNALER">
>>>> > <tuscany:throw_exception
>>>> >
>>>> class="org.apache.tuscany.sca.guardian.itests.primaryBackup.common.BackupJoinedException"
>>>> > target_context="PRIMARY" min_participant_joined="2"/>
>>>> > </tuscany:participant>
>>>> > </tuscany:rule>
>>>> > </tuscany:recovery_rules>
>>>> > </policySet>
>>>> >
>>>>
>>>> You will also need to define a ArtifactProcessor to read the elements
>>>> you have defined for the policySet, see the policy logging for a
>>>> simple example of a artifact processor that reads configurations from
>>>> a policySet.
>>>>
>>>>
>>>>
>>>> --
>>>> Luciano Resende
>>>> Apache Tuscany, Apache PhotArk
>>>> http://people.apache.org/~lresende<http://people.apache.org/%7Elresende>
>>>> http://lresende.blogspot.com/
>>>>
>>>
>>>
>>>
>>> --
>>> Thanks & Regards,
>>> Ramkumar Ramalingam
>>>
>>
>>
>>
>> --
>> Douglas Siqueira Leite
>> Graduate student at University of Campinas (Unicamp), Brazil
>>
>>
>
>
> --
> Douglas Siqueira Leite
> Graduate student at University of Campinas (Unicamp), Brazil
>
>
--
Thanks & Regards,
Ramkumar Ramalingam