From 5e78e2a84f0cfcf141f48e58404e8c21c061b079 Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:23:10 +0000 Subject: Moving 2.x tags git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835154 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tuscany/sca/policy/logging/Logging.java | 46 ------ .../JDKLoggingImplementationPolicyProvider.java | 48 ------ .../sca/policy/logging/jdk/JDKLoggingPolicy.java | 97 ------------ .../logging/jdk/JDKLoggingPolicyBuilder.java | 73 --------- .../logging/jdk/JDKLoggingPolicyInterceptor.java | 171 --------------------- .../logging/jdk/JDKLoggingPolicyProcessor.java | 135 ---------------- .../jdk/JDKLoggingPolicyProviderFactory.java | 68 -------- .../jdk/JDKLoggingReferencePolicyProvider.java | 45 ------ .../jdk/JDKLoggingServicePolicyProvider.java | 44 ------ ...ache.tuscany.sca.assembly.builder.PolicyBuilder | 17 -- ...ca.contribution.processor.StAXArtifactProcessor | 20 --- ....apache.tuscany.sca.definitions.xml.Definitions | 17 -- ...ache.tuscany.sca.provider.PolicyProviderFactory | 20 --- .../tuscany/sca/policy/logging/definitions.xml | 30 ---- 14 files changed, 831 deletions(-) delete mode 100644 tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/Logging.java delete mode 100644 tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java delete mode 100644 tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java delete mode 100644 tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyBuilder.java delete mode 100644 tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java delete mode 100644 tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.java delete mode 100644 tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java delete mode 100644 tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java delete mode 100644 tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java delete mode 100644 tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.builder.PolicyBuilder delete mode 100644 tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor delete mode 100644 tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions delete mode 100644 tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory delete mode 100644 tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml (limited to 'tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main') diff --git a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/Logging.java b/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/Logging.java deleted file mode 100644 index 4bed9520ab..0000000000 --- a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/Logging.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java b/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java deleted file mode 100644 index 66a0ba2b51..0000000000 --- a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.jdk; - -import java.util.List; - -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.invocation.PhasedInterceptor; -import org.apache.tuscany.sca.provider.BasePolicyProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -/** - * @version $Rev$ $Date$ - */ -public class JDKLoggingImplementationPolicyProvider extends BasePolicyProvider { - - public JDKLoggingImplementationPolicyProvider(RuntimeComponent component) { - super(JDKLoggingPolicy.class, component); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation) - */ - public PhasedInterceptor createInterceptor(Operation operation) { - List policies = findPolicies(); - return policies.isEmpty() ? null : new JDKLoggingPolicyInterceptor(subject, getContext(), operation, - policies, Phase.IMPLEMENTATION_POLICY); - } - -} diff --git a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java b/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java deleted file mode 100644 index 6e1bad67c1..0000000000 --- a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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.jdk; - -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. - * - * @version $Rev$ $Date$ - */ -public class JDKLoggingPolicy { - static final String SCA11_NS = Base.SCA11_NS; - static final String SCA11_TUSCANY_NS = Base.SCA11_TUSCANY_NS; - static final QName JDK_LOGGING_POLICY_QNAME = new QName(SCA11_TUSCANY_NS, "jdkLogger"); - - private String loggerName; - private String resourceBundleName; - private Level logLevel; - private boolean useParentHandlers = false; - - public String getLoggerName() { - return loggerName; - } - - public void setLoggerName(String loggerName) { - this.loggerName = loggerName; - } - - public Level getLogLevel() { - return logLevel; - } - - public void setLogLevel(Level logLevel) { - this.logLevel = logLevel; - } - - public String getResourceBundleName() { - return resourceBundleName; - } - - public void setResourceBundleName(String resourceBundleName) { - this.resourceBundleName = resourceBundleName; - } - - public boolean isUseParentHandlers() { - return useParentHandlers; - } - - public void setUseParentHandlers(boolean useParentHandlers) { - this.useParentHandlers = useParentHandlers; - } - - public QName getSchemaName() { - return JDK_LOGGING_POLICY_QNAME; - } - - public boolean isUnresolved() { - return false; - } - - public void setUnresolved(boolean unresolved) { - } - - @Override - public String toString() { - return "JDKLoggingPolicy [logLevel=" + logLevel - + ", loggerName=" - + loggerName - + ", resourceBundleName=" - + resourceBundleName - + ", useParentHandlers=" - + useParentHandlers - + "]"; - } -} diff --git a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyBuilder.java b/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyBuilder.java deleted file mode 100644 index be9a05982f..0000000000 --- a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyBuilder.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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.jdk; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.Endpoint; -import org.apache.tuscany.sca.assembly.EndpointReference; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.builder.BuilderContext; -import org.apache.tuscany.sca.assembly.builder.PolicyBuilder; -import org.apache.tuscany.sca.policy.PolicyExpression; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySubject; - -/** - * - */ -public class JDKLoggingPolicyBuilder implements PolicyBuilder { - - public void build(Endpoint endpoint, BuilderContext context) { - List polices = getPolicies(endpoint); - System.out.println(endpoint + ": " + polices); - } - - public void build(EndpointReference endpointReference, BuilderContext context) { - List polices = getPolicies(endpointReference); - System.out.println(endpointReference + ": " + polices); - } - - public void build(Component component, Implementation implementation, BuilderContext context) { - List polices = getPolicies(implementation); - System.out.println(implementation + ": " + polices); - } - - public QName getPolicyType() { - return JDKLoggingPolicy.JDK_LOGGING_POLICY_QNAME; - } - - private List getPolicies(PolicySubject subject) { - List polices = new ArrayList(); - for (PolicySet ps : subject.getPolicySets()) { - for (PolicyExpression exp : ps.getPolicies()) { - if (getPolicyType().equals(exp.getName())) { - polices.add((JDKLoggingPolicy)exp.getPolicy()); - } - } - } - return polices; - } - -} diff --git a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java b/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java deleted file mode 100644 index 0c20d1fa84..0000000000 --- a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * 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.jdk; - -import java.util.List; -import java.util.logging.ConsoleHandler; -import java.util.logging.Handler; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.Endpoint; -import org.apache.tuscany.sca.assembly.EndpointReference; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.invocation.PhasedInterceptor; -import org.apache.tuscany.sca.policy.PolicySubject; - -/** - * Policy handler to handle PolicySet related to Logging with the QName - * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy - * - * @version $Rev$ $Date$ - */ -public class JDKLoggingPolicyInterceptor implements PhasedInterceptor { - public static final String loggingPolicy = "JDKLoggingPolicy"; - public static final QName policySetQName = new QName(JDKLoggingPolicy.SCA11_TUSCANY_NS, loggingPolicy); - private Logger logger = null; - - private Invoker next; - private Operation operation; - private List policies; - private PolicySubject subject; - private String context; - private String phase; - - public JDKLoggingPolicyInterceptor(PolicySubject subject, - String context, - Operation operation, - List policies, - String phase) { - super(); - this.operation = operation; - this.policies = policies; - this.subject = subject; - this.phase = phase; - this.context = getContext(); - init(); - } - - private String getContext() { - if (subject instanceof Endpoint) { - Endpoint endpoint = (Endpoint)subject; - return endpoint.getURI(); - } else if (subject instanceof EndpointReference) { - EndpointReference endpointReference = (EndpointReference)subject; - return endpointReference.getURI(); - } else if (subject instanceof Component) { - Component component = (Component)subject; - return component.getURI(); - } - return null; - } - - private void init() { - JDKLoggingPolicy policy = policies.get(0); - logger = Logger.getLogger(policy.getLoggerName()); - logger.setLevel(policy.getLogLevel()); - logger.setUseParentHandlers(policy.isUseParentHandlers()); - - boolean found = false; - for (Handler handler : logger.getHandlers()) { - if (handler instanceof ConsoleHandler) { - found = true; - break; - } - } - - if (!found) { - ConsoleHandler consoleHandler = new ConsoleHandler(); - consoleHandler.setLevel(Level.ALL); - logger.addHandler(consoleHandler); - } - - if (logger.isLoggable(Level.FINE)) { - logger.logp(Level.FINE, context, "", "Intents: {0}", subject.getRequiredIntents()); - logger.logp(Level.FINE, context, "", "PolicySets: {0}", subject.getPolicySets()); - } - } - - public Message invoke(Message msg) { - if (logger == null) { - return getNext().invoke(msg); - } - logger.logp(Level.INFO, context, "", "Invoking operation - " + operation.getName()); - Object msgBody = msg.getBody(); - if (msgBody instanceof Object[]) { - - if (logger.isLoggable(Level.FINE)) { - StringBuffer sb = new StringBuffer(); - if (msgBody == null) { - sb.append(""); - } else { - Object[] args = (Object[])msgBody; - for (int i = 0; i < args.length; i++) { - sb.append(args[i]); - if (i != args.length - 1) { - sb.append(", "); - } - } - } - - Object[] logParams = new Object[] {operation.getName(), sb.toString()}; - logger.logp(Level.FINE, context, "", "Invoking operation {0} with arguments {1}", logParams); - } - } - - Message responseMsg = null; - try { - responseMsg = getNext().invoke(msg); - return responseMsg; - } catch (RuntimeException e) { - logger.logp(Level.SEVERE, context, "", "Exception thrown from operation - " + operation.getName(), e); - throw e; - } finally { - if (responseMsg != null) { - logger.logp(Level.INFO, context, "", "Returned from operation - " + operation.getName()); - if (logger.isLoggable(Level.FINE)) { - Object[] logParams = new Object[] {operation.getName(), responseMsg.getBody()}; - logger.logp(Level.FINE, - context, - "", - "Returning from operation {0} with return value {1}", - logParams); - } - } - } - } - - public Invoker getNext() { - return next; - } - - public void setNext(Invoker next) { - this.next = next; - } - - public String getPhase() { - return phase; - } - -} diff --git a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.java b/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.java deleted file mode 100644 index 6ca5732e7a..0000000000 --- a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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.jdk; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; - -import java.util.logging.Level; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.contribution.processor.ContributionReadException; -import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; -import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; -import org.apache.tuscany.sca.contribution.processor.ProcessorContext; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; - -/** - * - * @version $Rev$ $Date$ - */ -public class JDKLoggingPolicyProcessor implements StAXArtifactProcessor { - 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"; - - public QName getArtifactType() { - return JDK_LOGGING_POLICY_QNAME; - } - - public JDKLoggingPolicyProcessor(FactoryExtensionPoint modelFactories) { - } - - - public JDKLoggingPolicy read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException { - JDKLoggingPolicy policy = new JDKLoggingPolicy(); - int event = reader.getEventType(); - QName name = null; - - - while (reader.hasNext()) { - event = reader.getEventType(); - switch (event) { - case START_ELEMENT : { - name = reader.getName(); - if ( name.equals(JDK_LOGGING_POLICY_QNAME) ) { - String loggerName = reader.getAttributeValue(null, "name"); - policy.setLoggerName(loggerName); - } else if ( LOG_LEVEL.equals(name.getLocalPart()) ) { - policy.setLogLevel(Level.parse(reader.getElementText())); - } else if ( RESOURCE_BUNDLE.equals(name.getLocalPart()) ) { - policy.setResourceBundleName(reader.getElementText()); - } else if ( USE_PARENT_HANDLERS.equals(name.getLocalPart()) ) { - policy.setUseParentHandlers(Boolean.getBoolean(reader.getElementText())); - } - break; - } - } - - if ( event == END_ELEMENT ) { - if ( JDK_LOGGING_POLICY_QNAME.equals(reader.getName()) ) { - break; - } - } - - //Read the next element - if (reader.hasNext()) { - reader.next(); - } - } - - return policy; - } - - public void write(JDKLoggingPolicy policy, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, - XMLStreamException { - String prefix = "tuscany"; - writer.writeStartElement(prefix, - JDK_LOGGING_POLICY_QNAME.getLocalPart(), - JDK_LOGGING_POLICY_QNAME.getNamespaceURI()); - writer.writeNamespace("tuscany", JDKLoggingPolicy.SCA11_TUSCANY_NS); - - if (policy.getLoggerName() != null) { - writer.writeAttribute("name", policy.getLoggerName()); - } - if ( policy.getLogLevel() != null ) { - writer.writeStartElement(prefix, - LOG_LEVEL, - JDK_LOGGING_POLICY_QNAME.getNamespaceURI()); - writer.writeCharacters(policy.getLogLevel().getLocalizedName()); - writer.writeEndElement(); - } - - if ( policy.getResourceBundleName() != null ) { - writer.writeStartElement(prefix, - RESOURCE_BUNDLE, - JDK_LOGGING_POLICY_QNAME.getNamespaceURI()); - writer.writeCharacters(policy.getResourceBundleName()); - writer.writeEndElement(); - } - - writer.writeEndElement(); - } - - public Class getModelType() { - return JDKLoggingPolicy.class; - } - - public void resolve(JDKLoggingPolicy arg0, ModelResolver arg1, ProcessorContext context) throws ContributionResolveException { - - } - -} diff --git a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java b/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java deleted file mode 100644 index 62bf06475b..0000000000 --- a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.jdk; - -import org.apache.tuscany.sca.assembly.Endpoint; -import org.apache.tuscany.sca.assembly.EndpointReference; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.provider.PolicyProvider; -import org.apache.tuscany.sca.provider.PolicyProviderFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -/** - * @version $Rev$ $Date$ - */ -public class JDKLoggingPolicyProviderFactory implements PolicyProviderFactory { - private ExtensionPointRegistry registry; - - public JDKLoggingPolicyProviderFactory(ExtensionPointRegistry registry) { - super(); - this.registry = registry; - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation) - */ - public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component) { - return new JDKLoggingImplementationPolicyProvider(component); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding) - */ - public PolicyProvider createReferencePolicyProvider(EndpointReference endpointReference) { - return new JDKLoggingReferencePolicyProvider(endpointReference); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding) - */ - public PolicyProvider createServicePolicyProvider(Endpoint endpoint) { - return new JDKLoggingServicePolicyProvider(endpoint); - } - - /** - * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType() - */ - public Class getModelType() { - return JDKLoggingPolicy.class; - } - -} diff --git a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java b/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java deleted file mode 100644 index 80867f57de..0000000000 --- a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.jdk; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.EndpointReference; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.invocation.PhasedInterceptor; -import org.apache.tuscany.sca.provider.BasePolicyProvider; - -/** - * @version $Rev$ $Date$ - */ -public class JDKLoggingReferencePolicyProvider extends BasePolicyProvider { - - public JDKLoggingReferencePolicyProvider(EndpointReference endpointReference) { - super(JDKLoggingPolicy.class, endpointReference); - } - - public PhasedInterceptor createInterceptor(Operation operation) { - List policies = findPolicies(); - return policies.isEmpty() ? null : new JDKLoggingPolicyInterceptor(subject, getContext(), operation, - policies, Phase.REFERENCE_POLICY); - } - -} diff --git a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java b/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java deleted file mode 100644 index 99f0563603..0000000000 --- a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.jdk; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.Endpoint; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.invocation.PhasedInterceptor; -import org.apache.tuscany.sca.provider.BasePolicyProvider; - -/** - * @version $Rev$ $Date$ - */ -public class JDKLoggingServicePolicyProvider extends BasePolicyProvider { - - public JDKLoggingServicePolicyProvider(Endpoint endpoint) { - super(JDKLoggingPolicy.class, endpoint); - } - - public PhasedInterceptor createInterceptor(Operation operation) { - List policies = findPolicies(); - return policies.isEmpty() ? null : new JDKLoggingPolicyInterceptor(subject, getContext(), operation, policies, Phase.SERVICE_POLICY); - } - -} diff --git a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.builder.PolicyBuilder b/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.builder.PolicyBuilder deleted file mode 100644 index f1fbc54a7a..0000000000 --- a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.builder.PolicyBuilder +++ /dev/null @@ -1,17 +0,0 @@ -# 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. -org.apache.tuscany.sca.policy.logging.jdk.JDKLoggingPolicyBuilder;qname=http://tuscany.apache.org/xmlns/sca/1.1#jdkLogger diff --git a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor deleted file mode 100644 index 9d0a8fb67f..0000000000 --- a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ /dev/null @@ -1,20 +0,0 @@ -# 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. - -# Implementation class for the artifact processor extension -org.apache.tuscany.sca.policy.logging.jdk.JDKLoggingPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#jdkLogger,model=org.apache.tuscany.sca.policy.logging.jdk.JDKLoggingPolicy - diff --git a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions b/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions deleted file mode 100644 index bb7aed2087..0000000000 --- a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions +++ /dev/null @@ -1,17 +0,0 @@ -# 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. -org/apache/tuscany/sca/policy/logging/definitions.xml diff --git a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory deleted file mode 100644 index b9bb454550..0000000000 --- a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory +++ /dev/null @@ -1,20 +0,0 @@ -# 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. - -# Implementation class for the policy extension -org.apache.tuscany.sca.policy.logging.jdk.JDKLoggingPolicyProviderFactory;model=org.apache.tuscany.sca.policy.logging.jdk.JDKLoggingPolicy - diff --git a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml b/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml deleted file mode 100644 index 95c976ba49..0000000000 --- a/tags/java/sca/2.0-M4-RC2/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - All messages to and from this implementation must be logged - - - - \ No newline at end of file -- cgit v1.2.3