summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-07-09 17:11:31 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-07-09 17:11:31 +0000
commite549b5fdded309c9bd4c0ba61bbeec4673bdf883 (patch)
tree4e0958af9d7b6458408b529fc81b924af54d6a2c /java
parentad7f276b9b4421c7436b7d42b88ee5240b16b4ee (diff)
Update the dependency and change the namespace
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@792609 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/sca/modules/policy-logging/META-INF/MANIFEST.MF3
-rw-r--r--java/sca/modules/policy-logging/pom.xml6
-rw-r--r--java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java8
-rw-r--r--java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java2
-rw-r--r--java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.java7
-rw-r--r--java/sca/modules/policy-logging/src/main/resources/META-INF/definitions.xml31
-rw-r--r--java/sca/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml20
-rw-r--r--java/sca/modules/policy-logging/src/test/java/org/apache/tuscany/sca/policy/logging/Logging.java46
-rw-r--r--java/sca/modules/policy-logging/src/test/resources/org/apache/tuscany/sca/policy/logging/jdk/mock_policies.xml2
9 files changed, 79 insertions, 46 deletions
diff --git a/java/sca/modules/policy-logging/META-INF/MANIFEST.MF b/java/sca/modules/policy-logging/META-INF/MANIFEST.MF
index df410e306f..c68ad94ca7 100644
--- a/java/sca/modules/policy-logging/META-INF/MANIFEST.MF
+++ b/java/sca/modules/policy-logging/META-INF/MANIFEST.MF
@@ -22,7 +22,8 @@ Import-Package: javax.xml.namespace,
org.apache.tuscany.sca.monitor;version="2.0.0",
org.apache.tuscany.sca.policy;version="2.0.0",
org.apache.tuscany.sca.provider;version="2.0.0",
- org.apache.tuscany.sca.runtime;version="2.0.0"
+ org.apache.tuscany.sca.runtime;version="2.0.0",
+ org.oasisopen.sca.annotation
Bundle-SymbolicName: org.apache.tuscany.sca.policy.logging
Bundle-DocURL: http://www.apache.org/
diff --git a/java/sca/modules/policy-logging/pom.xml b/java/sca/modules/policy-logging/pom.xml
index 218458c9fb..c8dc8362a9 100644
--- a/java/sca/modules/policy-logging/pom.xml
+++ b/java/sca/modules/policy-logging/pom.xml
@@ -38,6 +38,12 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-assembly-xml</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
diff --git a/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java b/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java
index 3bd825afb1..cb2a8b7ee8 100644
--- a/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java
+++ b/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java
@@ -22,6 +22,8 @@ import java.util.logging.Level;
import javax.xml.namespace.QName;
+import org.apache.tuscany.sca.assembly.Base;
+
/**
* Implementation for policies that could be injected as parameter
* into the axis2config.
@@ -29,9 +31,9 @@ import javax.xml.namespace.QName;
* @version $Rev$ $Date$
*/
public class JDKLoggingPolicy {
- static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
- static final String SCA10_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
- private static final QName JDK_LOGGING_POLICY_QNAME = new QName(SCA10_TUSCANY_NS, "jdkLogger");
+ static final String SCA11_NS = Base.SCA11_NS;
+ static final String SCA11_TUSCANY_NS = Base.SCA11_TUSCANY_NS;
+ private static final QName JDK_LOGGING_POLICY_QNAME = new QName(SCA11_TUSCANY_NS, "jdkLogger");
private String loggerName;
private String resourceBundleName;
diff --git a/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java b/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java
index 4b5f053c82..fbcb293513 100644
--- a/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java
+++ b/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java
@@ -39,7 +39,7 @@ import org.apache.tuscany.sca.policy.PolicySet;
*/
public class JDKLoggingPolicyInterceptor implements PhasedInterceptor {
public static final String loggingPolicy = "JDKLoggingPolicy";
- public static final QName policySetQName = new QName(JDKLoggingPolicy.SCA10_TUSCANY_NS, loggingPolicy);
+ public static final QName policySetQName = new QName(JDKLoggingPolicy.SCA11_TUSCANY_NS, loggingPolicy);
private Logger logger = null;
private Invoker next;
diff --git a/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.java b/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.java
index 5fd7a37a26..0254da7620 100644
--- a/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.java
+++ b/java/sca/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.java
@@ -41,12 +41,11 @@ import org.apache.tuscany.sca.monitor.Monitor;
* @version $Rev$ $Date$
*/
public class JDKLoggingPolicyProcessor implements StAXArtifactProcessor<JDKLoggingPolicy> {
- private static final QName JDK_LOGGING_POLICY_QNAME = new QName(JDKLoggingPolicy.SCA10_TUSCANY_NS, "jdkLogger");
+ private static final QName JDK_LOGGING_POLICY_QNAME = new QName(JDKLoggingPolicy.SCA11_TUSCANY_NS, "jdkLogger");
private static final String LOG_LEVEL = "logLevel";
private static final String RESOURCE_BUNDLE = "resourceBundle";
private static final String USE_PARENT_HANDLERS = "useParentHandlers";
- private static final String TUSACNY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
-
+
public QName getArtifactType() {
return JDK_LOGGING_POLICY_QNAME;
}
@@ -101,7 +100,7 @@ public class JDKLoggingPolicyProcessor implements StAXArtifactProcessor<JDKLoggi
writer.writeStartElement(prefix,
JDK_LOGGING_POLICY_QNAME.getLocalPart(),
JDK_LOGGING_POLICY_QNAME.getNamespaceURI());
- writer.writeNamespace("tuscany", JDKLoggingPolicy.SCA10_TUSCANY_NS);
+ writer.writeNamespace("tuscany", JDKLoggingPolicy.SCA11_TUSCANY_NS);
if (policy.getLoggerName() != null) {
writer.writeAttribute("name", policy.getLoggerName());
diff --git a/java/sca/modules/policy-logging/src/main/resources/META-INF/definitions.xml b/java/sca/modules/policy-logging/src/main/resources/META-INF/definitions.xml
deleted file mode 100644
index 46e6d4490a..0000000000
--- a/java/sca/modules/policy-logging/src/main/resources/META-INF/definitions.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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://docs.oasis-open.org/ns/opencsa/sca/200903"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.1"
- xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200903"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1">
-
- <!-- Policy Intents Defined by the SCA Runtime -->
- <intent name="logging" constrains="sca:implementation sca:binding">
- <description>
- All messages to and from this implementation must be logged
- </description>
- </intent>
-</definitions> \ No newline at end of file
diff --git a/java/sca/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml b/java/sca/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml
index 956a8983a2..d168775f31 100644
--- a/java/sca/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml
+++ b/java/sca/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml
@@ -17,15 +17,25 @@
* specific language governing permissions and limitations
* under the License.
-->
-<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">
+<definitions xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.1"
+ xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200903"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1">
<!-- Policy Intents Defined by the SCA Runtime -->
- <intent name="logging" constrains="sca:implementation.java sca:implementation.spring">
+ <intent name="logging" constrains="sca:implementation sca:binding">
<description>
All messages to and from this implementation must be logged
</description>
</intent>
+
+ <policySet name="JDKLoggingPolicy"
+ provides="tuscany:logging"
+ appliesTo="sca:binding sca:implementation">
+ <tuscany:jdkLogger name="test.logger">
+ <tuscany:logLevel>INFO</tuscany:logLevel>
+ <tuscany:resourceBundle>Trace_Messages.properties</tuscany:resourceBundle>
+ </tuscany:jdkLogger>
+ </policySet>
+
</definitions> \ No newline at end of file
diff --git a/java/sca/modules/policy-logging/src/test/java/org/apache/tuscany/sca/policy/logging/Logging.java b/java/sca/modules/policy-logging/src/test/java/org/apache/tuscany/sca/policy/logging/Logging.java
new file mode 100644
index 0000000000..2124d453e6
--- /dev/null
+++ b/java/sca/modules/policy-logging/src/test/java/org/apache/tuscany/sca/policy/logging/Logging.java
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+package org.apache.tuscany.sca.policy.logging;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.oasisopen.sca.annotation.Intent;
+import org.oasisopen.sca.annotation.Qualifier;
+
+@Inherited
+@Target({TYPE, FIELD, METHOD, PARAMETER})
+@Retention(RUNTIME)
+@Intent(Logging.LOGGING)
+
+public @interface Logging {
+ String LOGGING = "{"+Base.SCA11_TUSCANY_NS + "}logging";
+
+ @Qualifier
+ String[] value() default "";
+}
diff --git a/java/sca/modules/policy-logging/src/test/resources/org/apache/tuscany/sca/policy/logging/jdk/mock_policies.xml b/java/sca/modules/policy-logging/src/test/resources/org/apache/tuscany/sca/policy/logging/jdk/mock_policies.xml
index fabb554236..45ede2597b 100644
--- a/java/sca/modules/policy-logging/src/test/resources/org/apache/tuscany/sca/policy/logging/jdk/mock_policies.xml
+++ b/java/sca/modules/policy-logging/src/test/resources/org/apache/tuscany/sca/policy/logging/jdk/mock_policies.xml
@@ -17,7 +17,7 @@
* specific language governing permissions and limitations
* under the License.
-->
-<tuscany:jdkLogger xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" name="test.logger">
+<tuscany:jdkLogger xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" name="test.logger">
<logLevel>INFO</logLevel>
<resourceBundle>Trace_Messages.properties</resourceBundle>
</tuscany:jdkLogger> \ No newline at end of file