I'm trying to write my own policy. I get the following stack trace
when:
Mar 5, 2009 5:19:02 PM
org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$
1 error
WARNING: XMLSchema validation problem in: null, line: 9, column: 3
cvc-complex-type.2.4.a: Invalid content was found starting with element
'operation'. One of '{WC[##other:"http://www.osoa.org/xmlns/sca/1.0"]}'
is expected.
Exception in thread "main" org.osoa.sca.ServiceRuntimeException:
org.osoa.sca.ServiceRuntimeException:
org.apache.tuscany.sca.contribution.service.ContributionResolveException
: PolicyValidation exception when processing implementation of component
'HelloWorldServiceComponent' due to Policy Intent
'{http://gdit.com/}foobar' is not defined in this domain
at
org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCADoma
in.java:264)
at
org.apache.tuscany.sca.host.embedded.SCADomain.newInstance(SCADomain.jav
a:69)
at helloworld.Launch.main(Launch.java:13)
Caused by: org.osoa.sca.ServiceRuntimeException:
org.apache.tuscany.sca.contribution.service.ContributionResolveException
: PolicyValidation exception when processing implementation of component
'HelloWorldServiceComponent' due to Policy Intent
'{http://gdit.com/}foobar' is not defined in this domain
at
org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.addContributi
on(DefaultSCADomain.java:274)
at
org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.init(DefaultS
CADomain.java:152)
at
org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.<init>(Defaul
tSCADomain.java:109)
at
org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCADoma
in.java:230)
... 2 more
Caused by:
org.apache.tuscany.sca.contribution.service.ContributionResolveException
: PolicyValidation exception when processing implementation of component
'HelloWorldServiceComponent' due to Policy Intent
'{http://gdit.com/}foobar' is not defined in this domain
at
org.apache.tuscany.sca.assembly.xml.CompositeProcessor.resolve(Composite
Processor.java:885)
at
org.apache.tuscany.sca.assembly.xml.CompositeProcessor.resolve(Composite
Processor.java:80)
at
org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProc
essor.resolve(ExtensibleStAXArtifactProcessor.java:109)
at
org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor.resolve(C
ompositeDocumentProcessor.java:138)
at
org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor.resolve(C
ompositeDocumentProcessor.java:53)
at
org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProce
ssor.resolve(ExtensibleURLArtifactProcessor.java:86)
at
org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl
.processResolvePhase(ContributionServiceImpl.java:464)
at
org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl
.addContribution(ContributionServiceImpl.java:348)
at
org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl
.contribute(ContributionServiceImpl.java:161)
at
org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.addContributi
on(DefaultSCADomain.java:272)
... 5 more
Caused by: org.apache.tuscany.sca.policy.util.PolicyValidationException:
Policy Intent '{http://gdit.com/}foobar' is not defined in this domain
at
org.apache.tuscany.sca.policy.util.PolicyValidationUtils.validateIntents
(PolicyValidationUtils.java:66)
at
org.apache.tuscany.sca.assembly.xml.CompositeProcessor.resolveImplIntent
sAndPolicySets(CompositeProcessor.java:914)
at
org.apache.tuscany.sca.assembly.xml.CompositeProcessor.resolve(Composite
Processor.java:867)
These are my file:
(intents definitions.xml)
<?xml version="1.0" encoding="ASCII"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://gdit.com/"
xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
xmlns:gdit="http://gdit.com/">
<!-- Policy Intents Defined by the SCA Runtime -->
<intent name="FooBarPolicy"
constrains="sca:implementation.java">
<description>
FooBar Policy
</description>
</intent>
</definitions>
HelloWorld.composite
<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://gidt.com/"
xmlns:gdit="http://gdit.com/"
name="helloworld">
<component name="HelloWorldServiceComponent">
<implementation.java
class="helloworld.HelloWorldImpl">
<operation name="sayWorld"
requires="gdit:foobar"/>
</implementation.java>
<service name="HelloWorld">
<interface.java interface="helloworld.HelloWorld"></interface.java>
<binding.ws/>
</service>
<reference name="helloService" target="HelloComponent" />
<reference name="worldService" target="WorldComponent" />
</component>
<component name="HelloComponent">
<implementation.java class="helloworld.HelloServiceImpl"/>
</component>
<component name="WorldComponent">
<implementation.java class="helloworld.WorldServiceImpl">
</implementation.java>
</component>
</composite>
And the policy definitions file:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://gdit.com/"
xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
xmlns:gdit="http://gdit.com/">
<!-- PolicySets -->
<policySet name="FooBarPolicy" provides="gdit:foobar"
appliesTo="sca:implementation.java"
xmlns="http://www.osoa.org/xmlns/sca/1.0">
</policySet>
</definitions>
Any help would be greatly appreciated.
Mike Sacauskis