From 35f81a620ea2d8423a49d8630bcef1d69027f444 Mon Sep 17 00:00:00 2001 From: antelder Date: Sat, 28 Mar 2009 09:44:15 +0000 Subject: Remove old m2 branch git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@759447 13f79535-47bb-0310-9956-ffa450edef68 --- .../ws/axis2/policy/header/Axis2HeaderPolicy.java | 54 ---------- .../policy/header/Axis2HeaderPolicyProcessor.java | 112 --------------------- .../header/Axis2HeaderPolicyProviderFactory.java | 75 -------------- .../axis2/policy/header/Axis2HeaderPolicyUtil.java | 50 --------- .../Axis2HeaderReferencePolicyInterceptor.java | 72 ------------- .../header/Axis2HeaderReferencePolicyProvider.java | 90 ----------------- .../Axis2HeaderServicePolicyInterceptor.java | 73 -------------- .../header/Axis2HeaderServicePolicyProvider.java | 87 ---------------- .../ws/axis2/policy/header/Axis2SOAPHeader.java | 56 ----------- .../axis2/policy/header/Axis2SOAPHeaderString.java | 54 ---------- 10 files changed, 723 deletions(-) delete mode 100644 branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicy.java delete mode 100644 branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProcessor.java delete mode 100644 branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java delete mode 100644 branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyUtil.java delete mode 100644 branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java delete mode 100644 branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java delete mode 100644 branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.java delete mode 100644 branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java delete mode 100644 branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeader.java delete mode 100644 branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeaderString.java (limited to 'branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header') diff --git a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicy.java b/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicy.java deleted file mode 100644 index f25bd8c0cc..0000000000 --- a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicy.java +++ /dev/null @@ -1,54 +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.binding.ws.axis2.policy.header; - -import javax.xml.namespace.QName; - -/** - * Implementation for policies that could be injected as parameter - * into the axis2config. - * - * @version $Rev$ $Date$ - */ -public class Axis2HeaderPolicy { - private static final String SCA11_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.1"; - public static final QName AXIS2_HEADER_POLICY_QNAME = new QName(SCA11_TUSCANY_NS, "axis2Header"); - public static final String AXIS2_HEADER_NAME = "headerName"; - - private QName headerName; - - public QName getHeaderName() { - return headerName; - } - - public void setHeaderName(QName headerName) { - this.headerName = headerName; - } - - public QName getSchemaName() { - return AXIS2_HEADER_POLICY_QNAME; - } - - public boolean isUnresolved() { - return false; - } - - public void setUnresolved(boolean unresolved) { - } -} diff --git a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProcessor.java b/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProcessor.java deleted file mode 100644 index 70afbd22ee..0000000000 --- a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProcessor.java +++ /dev/null @@ -1,112 +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.binding.ws.axis2.policy.header; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; - -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.BaseStAXArtifactProcessor; -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.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.monitor.Monitor; - -/** - * - * @version $Rev$ $Date$ - */ -public class Axis2HeaderPolicyProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor { - private static final String SCA11_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.1"; - - public QName getArtifactType() { - return Axis2HeaderPolicy.AXIS2_HEADER_POLICY_QNAME; - } - - public Axis2HeaderPolicyProcessor(FactoryExtensionPoint modelFactories, Monitor monitor) { - } - - - public Axis2HeaderPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - Axis2HeaderPolicy policy = new Axis2HeaderPolicy(); - int event = reader.getEventType(); - QName name = null; - - while (reader.hasNext()) { - event = reader.getEventType(); - switch (event) { - case START_ELEMENT : { - name = reader.getName(); - if ( name.equals(getArtifactType()) ) { - policy.setHeaderName(getQName(reader, Axis2HeaderPolicy.AXIS2_HEADER_NAME)); - } - break; - } - } - - if ( event == END_ELEMENT ) { - if ( getArtifactType().equals(reader.getName()) ) { - break; - } - } - - //Read the next element - if (reader.hasNext()) { - reader.next(); - } - } - - return policy; - } - - public void write(Axis2HeaderPolicy policy, XMLStreamWriter writer) - throws ContributionWriteException, XMLStreamException { - String prefix = "tuscany"; - writer.writeStartElement(prefix, - getArtifactType().getLocalPart(), - getArtifactType().getNamespaceURI()); - writer.writeNamespace("tuscany", SCA11_TUSCANY_NS); - - if ( policy.getHeaderName() != null ) { - writer.writeStartElement(prefix, - Axis2HeaderPolicy.AXIS2_HEADER_NAME, - getArtifactType().getNamespaceURI()); - writer.writeCharacters(policy.getHeaderName().toString()); - writer.writeEndElement(); - } - - writer.writeEndElement(); - } - - public Class getModelType() { - return Axis2HeaderPolicy.class; - } - - public void resolve(Axis2HeaderPolicy arg0, ModelResolver arg1) throws ContributionResolveException { - - } - -} diff --git a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java b/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java deleted file mode 100644 index 71833df382..0000000000 --- a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java +++ /dev/null @@ -1,75 +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.binding.ws.axis2.policy.header; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Implementation; -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; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - -/** - * @version $Rev$ $Date$ - */ -public class Axis2HeaderPolicyProviderFactory implements PolicyProviderFactory { - private ExtensionPointRegistry registry; - - public Axis2HeaderPolicyProviderFactory(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, Implementation implementation) { - return null;//new TokenAuthenticationImplementationPolicyProvider(component, implementation); - } - - /** - * @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(RuntimeComponent component, - RuntimeComponentReference reference, - Binding binding) { - return new Axis2HeaderReferencePolicyProvider(component, reference, binding); - } - - /** - * @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(RuntimeComponent component, - RuntimeComponentService service, - Binding binding) { - return new Axis2HeaderServicePolicyProvider(component, service, binding); - } - - /** - * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType() - */ - public Class getModelType() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyUtil.java b/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyUtil.java deleted file mode 100644 index 98d011a8fc..0000000000 --- a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyUtil.java +++ /dev/null @@ -1,50 +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.binding.ws.axis2.policy.header; - - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.invocation.Message; - - -/** - * - * @version $Rev$ $Date$ - */ -public class Axis2HeaderPolicyUtil { - - public static Axis2SOAPHeader getHeader(Message msg, QName headerName){ - - Axis2SOAPHeader axis2Header = null; - - for (Object header : msg.getHeaders()){ - if (header instanceof Axis2SOAPHeader){ - Axis2SOAPHeader tmpHeader = (Axis2SOAPHeader)header; - - if (tmpHeader.getHeaderName().equals(headerName)){ - axis2Header = tmpHeader; - break; - } - } - } - - return axis2Header; - } -} diff --git a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java b/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java deleted file mode 100644 index 35c8a68be2..0000000000 --- a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java +++ /dev/null @@ -1,72 +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.binding.ws.axis2.policy.header; - -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Policy handler to handle PolicySet related to Logging with the QName - * {http://tuscany.apache.org/xmlns/sca/1.1/impl/java}LoggingPolicy - * - * @version $Rev$ $Date$ - */ -public class Axis2HeaderReferencePolicyInterceptor implements Interceptor { - private Invoker next; - private Operation operation; - private PolicySet policySet = null; - private String context; - private Axis2HeaderPolicy policy; - - public Axis2HeaderReferencePolicyInterceptor(String context, Operation operation, PolicySet policySet) { - super(); - this.operation = operation; - this.policySet = policySet; - this.context = context; - init(); - } - - private void init() { - if (policySet != null) { - for (Object policyObject : policySet.getPolicies()){ - if (policyObject instanceof Axis2HeaderPolicy){ - policy = (Axis2HeaderPolicy)policyObject; - break; - } - } - } - } - - public Message invoke(Message msg) { - // TODO - not yet implemented - - return getNext().invoke(msg); - } - - public Invoker getNext() { - return next; - } - - public void setNext(Invoker next) { - this.next = next; - } -} diff --git a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java b/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java deleted file mode 100644 index d0fc58cd33..0000000000 --- a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java +++ /dev/null @@ -1,90 +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.binding.ws.axis2.policy.header; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySubject; -import org.apache.tuscany.sca.provider.PolicyProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; - -/** - * @version $Rev$ $Date$ - */ -public class Axis2HeaderReferencePolicyProvider implements PolicyProvider { - private RuntimeComponent component; - private RuntimeComponentReference reference; - private Binding binding; - - public Axis2HeaderReferencePolicyProvider(RuntimeComponent component, - RuntimeComponentReference reference, - Binding binding) { - super(); - this.component = component; - this.reference = reference; - this.binding = binding; - } - - // FIXME: Need to use the endpoint with effective policies - private PolicySet findPolicySet() { - if (binding instanceof PolicySubject) { - List policySets = ((PolicySubject)binding).getPolicySets(); - for (PolicySet ps : policySets) { - for (Object p : ps.getPolicies()) { - if (Axis2HeaderPolicy.class.isInstance(p)) { - return ps; - } - } - } - } - return null; - } - - private String getContext() { - return "component.reference: " + component.getURI() - + "#" - + reference.getName() - + "(" - + binding.getClass().getName() - + ")"; - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation) - */ - public Interceptor createInterceptor(Operation operation) { - PolicySet ps = findPolicySet(); - return ps == null ? null : new Axis2HeaderReferencePolicyInterceptor(getContext(), operation, ps); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase() - */ - public String getPhase() { - return Phase.REFERENCE_POLICY; - } - -} diff --git a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.java b/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.java deleted file mode 100644 index c6758aea48..0000000000 --- a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.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.binding.ws.axis2.policy.header; - - -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Policy handler to handle PolicySet related to Logging with the QName - * {http://tuscany.apache.org/xmlns/sca/1.1/impl/java}LoggingPolicy - * - * @version $Rev$ $Date$ - */ -public class Axis2HeaderServicePolicyInterceptor implements Interceptor { - private Invoker next; - private Operation operation; - private PolicySet policySet = null; - private String context; - private Axis2HeaderPolicy policy; - - public Axis2HeaderServicePolicyInterceptor(String context, Operation operation, PolicySet policySet) { - super(); - this.operation = operation; - this.policySet = policySet; - this.context = context; - init(); - } - - private void init() { - if (policySet != null) { - for (Object policyObject : policySet.getPolicies()){ - if (policyObject instanceof Axis2HeaderPolicy){ - policy = (Axis2HeaderPolicy)policyObject; - break; - } - } - } - } - - public Message invoke(Message msg) { - // TODO - not yet implemented - - return getNext().invoke(msg); - } - - public Invoker getNext() { - return next; - } - - public void setNext(Invoker next) { - this.next = next; - } -} diff --git a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java b/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java deleted file mode 100644 index 3cb6d8007b..0000000000 --- a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java +++ /dev/null @@ -1,87 +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.binding.ws.axis2.policy.header; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySubject; -import org.apache.tuscany.sca.provider.PolicyProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - -/** - * @version $Rev$ $Date$ - */ -public class Axis2HeaderServicePolicyProvider implements PolicyProvider { - private RuntimeComponent component; - private RuntimeComponentService service; - private Binding binding; - - public Axis2HeaderServicePolicyProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) { - super(); - this.component = component; - this.service = service; - this.binding = binding; - } - - private PolicySet findPolicySet() { - if (binding instanceof PolicySubject) { - List policySets = ((PolicySubject)binding).getPolicySets(); - for (PolicySet ps : policySets) { - for (Object p : ps.getPolicies()) { - if (Axis2HeaderPolicy.class.isInstance(p)) { - return ps; - } - } - } - } - return null; - } - - private String getContext() { - return "component.service: " + component.getURI() - + "#" - + service.getName() - + "(" - + binding.getClass().getName() - + ")"; - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation) - */ - public Interceptor createInterceptor(Operation operation) { - PolicySet ps = findPolicySet(); - return ps == null ? null : new Axis2HeaderServicePolicyInterceptor(getContext(), operation, ps); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase() - */ - public String getPhase() { - return Phase.SERVICE_POLICY; - } - -} diff --git a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeader.java b/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeader.java deleted file mode 100644 index 36916f4ff5..0000000000 --- a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeader.java +++ /dev/null @@ -1,56 +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.binding.ws.axis2.policy.header; - -import javax.xml.namespace.QName; - -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMFactory; -import org.apache.axiom.om.OMNamespace; -import org.apache.axiom.soap.SOAPFactory; - -/** - * Implementation for policies that could be injected as parameter - * into the axis2config. - * - * @version $Rev$ $Date$ - */ -public class Axis2SOAPHeader { - - private QName headerName; - - public QName getHeaderName() { - return headerName; - } - - public void setHeaderName(QName headerName) { - this.headerName = headerName; - } - - public OMElement getAsSOAPHeaderBlock(OMFactory factory) { - OMNamespace ns1 = factory.createOMNamespace(headerName.getNamespaceURI(), - headerName.getPrefix()); - OMElement header = ((SOAPFactory)factory).createSOAPHeaderBlock(headerName.getLocalPart(),ns1); - return header; - } - - public void setAsSOAPHeaderBlock(OMElement header) { - headerName = header.getQName(); - } -} diff --git a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeaderString.java b/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeaderString.java deleted file mode 100644 index c593f07780..0000000000 --- a/branches/sca-java-2.0-M2/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeaderString.java +++ /dev/null @@ -1,54 +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.binding.ws.axis2.policy.header; - -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMFactory; -import org.apache.axiom.om.OMText; - -/** - * Implementation for policies that could be injected as parameter - * into the axis2config. - * - * @version $Rev$ $Date$ - */ -public class Axis2SOAPHeaderString extends Axis2SOAPHeader { - - private String headerString; - - public String getHeaderString() { - return headerString; - } - - public void setHeaderString(String headerString) { - this.headerString = headerString; - } - - public OMElement getAsSOAPHeaderBlock(OMFactory factory) { - OMElement header = super.getAsSOAPHeaderBlock(factory); - OMText headerText = factory.createOMText(header, headerString); - header.addChild(headerText); - return header; - } - - public void setAsSOAPHeaderBlock(OMElement header) { - super.setAsSOAPHeaderBlock(header); - headerString = header.getText(); - } -} -- cgit v1.2.3