summaryrefslogtreecommitdiffstats
path: root/java/sca
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--java/sca/itest/policies/pom.xml6
-rw-r--r--java/sca/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/PaymentImpl.java2
-rw-r--r--java/sca/itest/policies/src/main/resources/Customer.composite4
-rw-r--r--java/sca/itest/policies/src/main/resources/Payment.composite5
-rw-r--r--java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java20
-rw-r--r--java/sca/modules/pom.xml14
6 files changed, 41 insertions, 10 deletions
diff --git a/java/sca/itest/policies/pom.xml b/java/sca/itest/policies/pom.xml
index 919e5c057b..4d9168ba95 100644
--- a/java/sca/itest/policies/pom.xml
+++ b/java/sca/itest/policies/pom.xml
@@ -37,6 +37,12 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-logging</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-impl</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>test</scope>
diff --git a/java/sca/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/PaymentImpl.java b/java/sca/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/PaymentImpl.java
index 1388d2ea75..4bda0d5e95 100644
--- a/java/sca/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/PaymentImpl.java
+++ b/java/sca/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/PaymentImpl.java
@@ -24,6 +24,7 @@ import org.apache.tuscany.sca.itest.policies.CreditCardPayment;
import org.apache.tuscany.sca.itest.policies.Customer;
import org.apache.tuscany.sca.itest.policies.CustomerRegistry;
import org.apache.tuscany.sca.itest.policies.Payment;
+import org.apache.tuscany.sca.policy.logging.Logging;
import org.oasisopen.sca.annotation.Authentication;
import org.oasisopen.sca.annotation.Confidentiality;
import org.oasisopen.sca.annotation.Reference;
@@ -32,6 +33,7 @@ import org.oasisopen.sca.annotation.Requires;
/**
*
*/
+@Logging
public class PaymentImpl implements Payment {
@Reference
diff --git a/java/sca/itest/policies/src/main/resources/Customer.composite b/java/sca/itest/policies/src/main/resources/Customer.composite
index 29458ad284..f38f5fe7f4 100644
--- a/java/sca/itest/policies/src/main/resources/Customer.composite
+++ b/java/sca/itest/policies/src/main/resources/Customer.composite
@@ -19,11 +19,11 @@
-->
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
xmlns:c="http://customer"
- xmlns:sca = "http://docs.oasis-open.org/ns/opencsa/sca/200903"
targetNamespace="http://customer"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
name="Customer">
- <service name="Registry" promote="CustomerRegistry">
+ <service name="Registry" promote="CustomerRegistry" requires="tuscany:logging">
<binding.sca/>
</service>
diff --git a/java/sca/itest/policies/src/main/resources/Payment.composite b/java/sca/itest/policies/src/main/resources/Payment.composite
index a1f9aefdac..2b50c6a32a 100644
--- a/java/sca/itest/policies/src/main/resources/Payment.composite
+++ b/java/sca/itest/policies/src/main/resources/Payment.composite
@@ -21,6 +21,7 @@
xmlns:p="http://payment"
xmlns:c="http://customer"
xmlns:sca = "http://docs.oasis-open.org/ns/opencsa/sca/200903"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
requires = "sca:authorization"
targetNamespace="http://payment"
name="Payment">
@@ -28,10 +29,10 @@
<component name="Payment">
<implementation.java class="org.apache.tuscany.sca.itest.policies.impl.PaymentImpl" />
<reference name="creditCardPayment" target="CreditCardPayment">
- <binding.sca requires="sca:integrity">
+ <binding.sca requires="sca:integrity tuscany:logging">
</binding.sca>
</reference>
- <reference name="customerRegistry" target="Customer/Registry" requires="sca:suspendsTransaction"/>
+ <reference name="customerRegistry" target="Customer/Registry" requires="sca:suspendsTransaction tuscany:logging"/>
</component>
<component name="CreditCardPayment">
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java
index fe58c65a1c..37192104e8 100644
--- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java
+++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BasePolicyProvider.java
@@ -29,6 +29,7 @@ import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.PhasedInterceptor;
+import org.apache.tuscany.sca.policy.PolicyExpression;
import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.PolicySubject;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
@@ -55,6 +56,13 @@ public abstract class BasePolicyProvider<T> implements PolicyProvider {
if (policyType.isInstance(p)) {
policies.add(policyType.cast(p));
}
+ if (p instanceof PolicyExpression) {
+ PolicyExpression exp = (PolicyExpression)p;
+ if (policyType.isInstance(exp.getPolicy())) {
+ policies.add(policyType.cast(exp.getPolicy()));
+ }
+ }
+
}
}
return policies;
@@ -68,6 +76,12 @@ public abstract class BasePolicyProvider<T> implements PolicyProvider {
if (policyType.isInstance(p)) {
policies.add(ps);
}
+ if (p instanceof PolicyExpression) {
+ PolicyExpression exp = (PolicyExpression)p;
+ if (policyType.isInstance(exp.getPolicy())) {
+ policies.add(ps);
+ }
+ }
}
}
return policies;
@@ -80,6 +94,12 @@ public abstract class BasePolicyProvider<T> implements PolicyProvider {
if (policyType.isInstance(p)) {
return ps;
}
+ if (p instanceof PolicyExpression) {
+ PolicyExpression exp = (PolicyExpression)p;
+ if (policyType.isInstance(exp.getPolicy())) {
+ return ps;
+ }
+ }
}
}
return null;
diff --git a/java/sca/modules/pom.xml b/java/sca/modules/pom.xml
index bee543f522..906ce7091b 100644
--- a/java/sca/modules/pom.xml
+++ b/java/sca/modules/pom.xml
@@ -84,6 +84,7 @@
<module>policy-security</module>
<module>policy-xml</module>
<module>policy-xml-ws</module>
+ <module>policy-logging</module>
<module>sca-api</module>
<module>sca-client-impl</module>
<module>stripes</module>
@@ -100,14 +101,16 @@
<profile>
<id>eclipse</id>
<build>
- <!--plugins>
+ <defaultGoal>org.apache.tuscany.maven.plugins:maven-bundle-plugin:eclipse</defaultGoal>
+ <!--
+ <plugins>
<plugin>
<groupId>org.apache.tuscany.maven.plugins</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.0.2</version>
<extensions>true</extensions>
<executions>
- <execution>
+ <execution>
<id>generate-pde</id>
<phase>generate-resources</phase>
<goals>
@@ -115,12 +118,11 @@
</goals>
<configuration>
</configuration>
- </execution>
+ </execution>
</executions>
</plugin>
- </plugins-->
- <defaultGoal>org.apache.tuscany.maven.plugins:maven-bundle-plugin:eclipse</defaultGoal>
-
+ </plugins>
+ -->
</build>
</profile>
</profiles>