From 0daa6e66908eb59332ee38b5bd2193ba40a7eb55 Mon Sep 17 00:00:00 2001 From: antelder Date: Mon, 23 Mar 2009 08:34:33 +0000 Subject: Delete test trunk in sandbox git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@757347 13f79535-47bb-0310-9956-ffa450edef68 --- .../token/Axis2TokenAuthenticationPolicy.java | 54 ------- .../Axis2TokenAuthenticationPolicyProcessor.java | 113 --------------- ...s2TokenAuthenticationPolicyProviderFactory.java | 75 ---------- ...enAuthenticationReferencePolicyInterceptor.java | 84 ----------- ...TokenAuthenticationReferencePolicyProvider.java | 89 ------------ ...okenAuthenticationServicePolicyInterceptor.java | 93 ------------ ...s2TokenAuthenticationServicePolicyProvider.java | 87 ------------ .../configuration/Axis2ConfigParamPolicy.java | 53 ------- .../Axis2ConfigParamPolicyHandler.java | 78 ----------- .../Axis2ConfigParamPolicyProcessor.java | 156 --------------------- .../Axis2ConfigParamPolicyProviderFactory.java | 99 ------------- .../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 ------- ...ca.contribution.processor.StAXArtifactProcessor | 21 --- ...ache.tuscany.sca.provider.PolicyProviderFactory | 20 --- .../policy/configuration/PolicyReadTestCase.java | 59 -------- .../axis2/policy/configuration/mock_policies.xml | 36 ----- 25 files changed, 1840 deletions(-) delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicy.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProcessor.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicy.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyHandler.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProcessor.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProviderFactory.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicy.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProcessor.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyUtil.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeader.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeaderString.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/PolicyReadTestCase.java delete mode 100644 sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/mock_policies.xml (limited to 'sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src') diff --git a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicy.java b/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicy.java deleted file mode 100644 index 0d6743bfe2..0000000000 --- a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicy.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.authentication.token; - -import javax.xml.namespace.QName; - -/** - * Implementation for policies that could be injected as parameter - * into the axis2config. - * - * @version $Rev: 695374 $ $Date: 2008-09-15 09:07:58 +0100 (Mon, 15 Sep 2008) $ - */ -public class Axis2TokenAuthenticationPolicy { - private static final String SCA11_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.1"; - public static final QName AXIS2_TOKEN_AUTHENTICATION_POLICY_QNAME = new QName(SCA11_TUSCANY_NS, "axis2TokenAuthentication"); - public static final String AXIS2_TOKEN_AUTHENTICATION_TOKEN_NAME = "tokenName"; - - private QName tokenName; - - public QName getTokenName() { - return tokenName; - } - - public void setTokenName(QName tokenName) { - this.tokenName = tokenName; - } - - public QName getSchemaName() { - return AXIS2_TOKEN_AUTHENTICATION_POLICY_QNAME; - } - - public boolean isUnresolved() { - return false; - } - - public void setUnresolved(boolean unresolved) { - } -} diff --git a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProcessor.java b/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProcessor.java deleted file mode 100644 index 61624bb346..0000000000 --- a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProcessor.java +++ /dev/null @@ -1,113 +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.authentication.token; - -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; - -/** - * - * Adjusted for 2.0 environment, Mike Edwards, 4th Dec 2008 - * @version $Rev: 695374 $ $Date: 2008-09-15 09:07:58 +0100 (Mon, 15 Sep 2008) $ - */ -public class Axis2TokenAuthenticationPolicyProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor { - private static final String SCA11_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.1"; - - public QName getArtifactType() { - return Axis2TokenAuthenticationPolicy.AXIS2_TOKEN_AUTHENTICATION_POLICY_QNAME; - } - - public Axis2TokenAuthenticationPolicyProcessor(FactoryExtensionPoint modelFactories, Monitor monitor) { - } - - - public Axis2TokenAuthenticationPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - Axis2TokenAuthenticationPolicy policy = new Axis2TokenAuthenticationPolicy(); - 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.setTokenName(getQName(reader, Axis2TokenAuthenticationPolicy.AXIS2_TOKEN_AUTHENTICATION_TOKEN_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(Axis2TokenAuthenticationPolicy policy, XMLStreamWriter writer) - throws ContributionWriteException, XMLStreamException { - String prefix = "tuscany"; - writer.writeStartElement(prefix, - getArtifactType().getLocalPart(), - getArtifactType().getNamespaceURI()); - writer.writeNamespace("tuscany", SCA11_TUSCANY_NS); - - if ( policy.getTokenName() != null ) { - writer.writeStartElement(prefix, - Axis2TokenAuthenticationPolicy.AXIS2_TOKEN_AUTHENTICATION_TOKEN_NAME, - getArtifactType().getNamespaceURI()); - writer.writeCharacters(policy.getTokenName().toString()); - writer.writeEndElement(); - } - - writer.writeEndElement(); - } - - public Class getModelType() { - return Axis2TokenAuthenticationPolicy.class; - } - - public void resolve(Axis2TokenAuthenticationPolicy arg0, ModelResolver arg1) throws ContributionResolveException { - - } - -} diff --git a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.java b/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.java deleted file mode 100644 index 805d6f80cb..0000000000 --- a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.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.authentication.token; - -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: 695374 $ $Date: 2008-09-15 09:07:58 +0100 (Mon, 15 Sep 2008) $ - */ -public class Axis2TokenAuthenticationPolicyProviderFactory implements PolicyProviderFactory { - private ExtensionPointRegistry registry; - - public Axis2TokenAuthenticationPolicyProviderFactory(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 Axis2TokenAuthenticationReferencePolicyProvider(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 Axis2TokenAuthenticationServicePolicyProvider(component, service, binding); - } - - /** - * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType() - */ - public Class getModelType() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java b/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java deleted file mode 100644 index 0046d3d6ca..0000000000 --- a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java +++ /dev/null @@ -1,84 +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.authentication.token; - -import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2SOAPHeaderString; -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: 698457 $ $Date: 2008-09-24 09:13:02 +0100 (Wed, 24 Sep 2008) $ - */ -public class Axis2TokenAuthenticationReferencePolicyInterceptor implements Interceptor { - - private Invoker next; - private Operation operation; - private PolicySet policySet = null; - private String context; - private Axis2TokenAuthenticationPolicy policy; - - public Axis2TokenAuthenticationReferencePolicyInterceptor(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 Axis2TokenAuthenticationPolicy){ - policy = (Axis2TokenAuthenticationPolicy)policyObject; - break; - } - } - } - } - - public Message invoke(Message msg) { - // could call out here to some 3rd party system to get credentials - - if ( policy.getTokenName() != null){ - // create Axis representation of header - Axis2SOAPHeaderString header = new Axis2SOAPHeaderString(); - header.setHeaderName(policy.getTokenName()); - header.setHeaderString("SomeWSAuthorizationToken"); - - // add header to Tuscany message - msg.getHeaders().add(header); - } - - return getNext().invoke(msg); - } - - public Invoker getNext() { - return next; - } - - public void setNext(Invoker next) { - this.next = next; - } -} diff --git a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java b/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java deleted file mode 100644 index 4753012de4..0000000000 --- a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java +++ /dev/null @@ -1,89 +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.authentication.token; - -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: 695374 $ $Date: 2008-09-15 09:07:58 +0100 (Mon, 15 Sep 2008) $ - */ -public class Axis2TokenAuthenticationReferencePolicyProvider implements PolicyProvider { - private RuntimeComponent component; - private RuntimeComponentReference reference; - private Binding binding; - - public Axis2TokenAuthenticationReferencePolicyProvider(RuntimeComponent component, - RuntimeComponentReference reference, - Binding binding) { - super(); - this.component = component; - this.reference = reference; - 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 (Axis2TokenAuthenticationPolicy.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 Axis2TokenAuthenticationReferencePolicyInterceptor(getContext(), operation, ps); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase() - */ - public String getPhase() { - return Phase.REFERENCE_POLICY; - } - -} diff --git a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java b/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java deleted file mode 100644 index cf081e1121..0000000000 --- a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java +++ /dev/null @@ -1,93 +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.authentication.token; - - -import java.security.Principal; - -import javax.security.auth.Subject; - -import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicyUtil; -import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2SOAPHeaderString; -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; -import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal; -import org.apache.tuscany.sca.policy.security.SecurityUtil; - -/** - * Policy handler to handle PolicySet related to Logging with the QName - * {http://tuscany.apache.org/xmlns/sca/1.1/impl/java}LoggingPolicy - * - * @version $Rev: 721811 $ $Date: 2008-11-30 13:46:51 +0000 (Sun, 30 Nov 2008) $ - */ -public class Axis2TokenAuthenticationServicePolicyInterceptor implements Interceptor { - private Invoker next; - private Operation operation; - private PolicySet policySet = null; - private String context; - private Axis2TokenAuthenticationPolicy policy; - - public Axis2TokenAuthenticationServicePolicyInterceptor(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 Axis2TokenAuthenticationPolicy){ - policy = (Axis2TokenAuthenticationPolicy)policyObject; - break; - } - } - } - } - - public Message invoke(Message msg) { - - Axis2SOAPHeaderString header = (Axis2SOAPHeaderString)Axis2HeaderPolicyUtil.getHeader(msg, policy.getTokenName()); - - if (header != null) { - System.out.println("Web service received token: " + header.getHeaderString()); - - // call out here to some 3rd party system to do whatever you - // need to turn header credentials into an authenticated principal - - Subject subject = SecurityUtil.getSubject(msg); - Principal principal = new TokenPrincipal(header.getHeaderString()); - subject.getPrincipals().add(principal); - } - - return getNext().invoke(msg); - } - - public Invoker getNext() { - return next; - } - - public void setNext(Invoker next) { - this.next = next; - } -} diff --git a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.java b/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.java deleted file mode 100644 index d1be46d1ce..0000000000 --- a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.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.authentication.token; - -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: 695374 $ $Date: 2008-09-15 09:07:58 +0100 (Mon, 15 Sep 2008) $ - */ -public class Axis2TokenAuthenticationServicePolicyProvider implements PolicyProvider { - private RuntimeComponent component; - private RuntimeComponentService service; - private Binding binding; - - public Axis2TokenAuthenticationServicePolicyProvider(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 (Axis2TokenAuthenticationPolicy.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 Axis2TokenAuthenticationServicePolicyInterceptor(getContext(), operation, ps); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase() - */ - public String getPhase() { - return Phase.SERVICE_POLICY; - } - -} diff --git a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicy.java b/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicy.java deleted file mode 100644 index ded09392ec..0000000000 --- a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicy.java +++ /dev/null @@ -1,53 +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.configuration; - -import java.util.Hashtable; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.axiom.om.OMElement; - -/** - * Implementation for policies that could be injected as parameter - * into the axis2config. - * - * @version $Rev$ $Date$ - */ -public class Axis2ConfigParamPolicy { - private static final String SCA11_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.1"; - public static final QName NAME = new QName(SCA11_TUSCANY_NS, "wsConfigParam"); - private Map paramElements = new Hashtable(); - - public Map getParamElements() { - return paramElements; - } - - public QName getSchemaName() { - return NAME; - } - - public boolean isUnresolved() { - return false; - } - - public void setUnresolved(boolean unresolved) { - } -} diff --git a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyHandler.java b/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyHandler.java deleted file mode 100644 index dfedaf97a5..0000000000 --- a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyHandler.java +++ /dev/null @@ -1,78 +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.configuration; - -import org.apache.axis2.AxisFault; -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.description.Parameter; -import org.apache.tuscany.sca.policy.PolicySet; - - -/** - * Policy handler to handle PolicySet that contain Axis2ConfigParamPolicy instances - * - * @version $Rev$ $Date$ - */ -public class Axis2ConfigParamPolicyHandler { - private PolicySet applicablePolicySet = null; - - public void setUp(Object... context) { - Axis2ConfigParamPolicy axis2ConfigParamPolicy = null; - Parameter configParam = null; - for ( Object contextObject : context ) { - if ( contextObject instanceof ConfigurationContext ) { - ConfigurationContext configContext = (ConfigurationContext)contextObject; - for ( Object policy : applicablePolicySet.getPolicies() ) { - if ( policy instanceof Axis2ConfigParamPolicy ) { - axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy; - for ( String paramName : axis2ConfigParamPolicy.getParamElements().keySet() ) { - configParam = new Parameter(paramName, - axis2ConfigParamPolicy.getParamElements().get(paramName).getFirstElement()); - configParam.setParameterElement(axis2ConfigParamPolicy.getParamElements().get(paramName)); - try { - configContext.getAxisConfiguration().addParameter(configParam); - } catch ( AxisFault e ) { - throw new RuntimeException(e); - } - } - } - } - } - } - } - - public void cleanUp(Object... context) { - } - - public void beforeInvoke(Object... context) { - } - - public void afterInvoke(Object... context) { - - } - - public PolicySet getApplicablePolicySet() { - return applicablePolicySet; - } - - public void setApplicablePolicySet(PolicySet applicablePolicySet) { - this.applicablePolicySet = applicablePolicySet; - } -} diff --git a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProcessor.java b/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProcessor.java deleted file mode 100644 index 33a1688138..0000000000 --- a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProcessor.java +++ /dev/null @@ -1,156 +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.configuration; - -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.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.axiom.om.OMAbstractFactory; -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMFactory; -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 Axis2ConfigParamPolicyProcessor implements StAXArtifactProcessor { - public static final QName AXIS2_CONFIG_PARAM_POLICY_QNAME = Axis2ConfigParamPolicy.NAME; - public static final String PARAMETER = "parameter"; - public QName getArtifactType() { - return AXIS2_CONFIG_PARAM_POLICY_QNAME; - } - - public Axis2ConfigParamPolicyProcessor(FactoryExtensionPoint modelFactories, Monitor monitor) { - } - - public Axis2ConfigParamPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - Axis2ConfigParamPolicy policy = new Axis2ConfigParamPolicy(); - int event = reader.getEventType(); - QName name = null; - OMElement parameterElement = null; - String paramName = null; - while (reader.hasNext()) { - event = reader.getEventType(); - switch (event) { - case START_ELEMENT : { - name = reader.getName(); - if ( PARAMETER.equals(name.getLocalPart()) ) { - paramName = reader.getAttributeValue(null, "name"); - parameterElement = loadElement(reader); - policy.getParamElements().put(paramName, parameterElement); - } - break; - } - } - - if ( event == END_ELEMENT ) { - if ( AXIS2_CONFIG_PARAM_POLICY_QNAME.equals(reader.getName()) ) { - break; - } - } - - //Read the next element - if (reader.hasNext()) { - reader.next(); - } - } - - return policy; - } - - public void write(Axis2ConfigParamPolicy arg0, XMLStreamWriter arg1) throws ContributionWriteException, - XMLStreamException { - } - - public Class getModelType() { - return Axis2ConfigParamPolicy.class; - } - - public void resolve(Axis2ConfigParamPolicy arg0, ModelResolver arg1) throws ContributionResolveException { - - } - - private OMElement loadElement(XMLStreamReader reader) throws XMLStreamException { - OMFactory fac = OMAbstractFactory.getOMFactory(); - OMElement head = fac.createOMElement(reader.getName()); - OMElement current = head; - while (true) { - switch (reader.next()) { - case XMLStreamConstants.START_ELEMENT: - //since the axis2 code checks against a no namespace we need to generate accordingly - QName name = new QName(reader.getName().getLocalPart()); - OMElement child = fac.createOMElement(name, current); - - int count = reader.getNamespaceCount(); - for (int i = 0; i < count; i++) { - String prefix = reader.getNamespacePrefix(i); - String ns = reader.getNamespaceURI(i); - child.declareNamespace(ns, prefix); - } - - if(!"".equals(name.getNamespaceURI())) { - child.declareNamespace(name.getNamespaceURI(), name.getPrefix()); - } - - // add the attributes for this element - count = reader.getAttributeCount(); - for (int i = 0; i < count; i++) { - String ns = reader.getAttributeNamespace(i); - String prefix = reader.getAttributePrefix(i); - String qname = reader.getAttributeLocalName(i); - String value = reader.getAttributeValue(i); - - if (ns != null) { - child.addAttribute(qname, value, fac.createOMNamespace(ns, prefix)); - child.declareNamespace(ns, prefix); - } else { - child.addAttribute(qname, value, null); - } - } - current = child; - break; - case XMLStreamConstants.CDATA: - fac.createOMText(current, reader.getText()); - break; - case XMLStreamConstants.CHARACTERS: - fac.createOMText(current, reader.getText()); - break; - case XMLStreamConstants.END_ELEMENT: - if ( current == head ) { - return head; - } else { - current = (OMElement)current.getParent(); - } - } - } - } -} diff --git a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProviderFactory.java b/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProviderFactory.java deleted file mode 100644 index ed4335baa7..0000000000 --- a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProviderFactory.java +++ /dev/null @@ -1,99 +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.configuration; - -import org.apache.axis2.AxisFault; -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.description.Parameter; -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.policy.PolicySet; -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; -import org.oasisopen.sca.ServiceRuntimeException; - -/** - * @version $Rev$ $Date$ - */ -public class Axis2ConfigParamPolicyProviderFactory implements PolicyProviderFactory { - - public Axis2ConfigParamPolicyProviderFactory(ExtensionPointRegistry registry) { - super(); - } - - /** - * @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; - } - - /** - * @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 null; - } - - /** - * @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 null; - } - - /** - * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType() - */ - public Class getModelType() { - return Axis2ConfigParamPolicy.class; - } - - // FIXME: [rfeng] I think this should be refactored into the binding.ws axis2 code - public void setUp(ConfigurationContext configContext, PolicySet ps) { - Axis2ConfigParamPolicy axis2ConfigParamPolicy = null; - Parameter configParam = null; - for (Object policy : ps.getPolicies()) { - if (policy instanceof Axis2ConfigParamPolicy) { - axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy; - for (String paramName : axis2ConfigParamPolicy.getParamElements().keySet()) { - configParam = - new Parameter(paramName, axis2ConfigParamPolicy.getParamElements().get(paramName) - .getFirstElement()); - configParam.setParameterElement(axis2ConfigParamPolicy.getParamElements().get(paramName)); - try { - configContext.getAxisConfiguration().addParameter(configParam); - } catch (AxisFault e) { - throw new ServiceRuntimeException(e); - } - } - } - } - } - -} diff --git a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicy.java b/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProcessor.java b/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java b/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyUtil.java b/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java b/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java b/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.java b/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java b/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeader.java b/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeaderString.java b/sandbox/ant/sca/trunk/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/sandbox/ant/sca/trunk/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(); - } -} diff --git a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor deleted file mode 100644 index 8dd9f200d8..0000000000 --- a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ /dev/null @@ -1,21 +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.binding.ws.axis2.policy.configuration.Axis2ConfigParamPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#wsConfigParam,model=org.apache.tuscany.sca.binding.ws.axis2.policy.configuration.Axis2ConfigParamPolicy -org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#axis2TokenAuthentication,model=org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicy -org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#axis2Header,model=org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicy diff --git a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory deleted file mode 100644 index ced48cf236..0000000000 --- a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/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.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicyProviderFactory;model=org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicy -org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicyProviderFactory;model=org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicy \ No newline at end of file diff --git a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/PolicyReadTestCase.java b/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/PolicyReadTestCase.java deleted file mode 100644 index 44533fe0b6..0000000000 --- a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/PolicyReadTestCase.java +++ /dev/null @@ -1,59 +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.configuration; - - -import java.io.InputStream; -import java.net.URL; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; - -/** - * - * Test the reading of ws config params policy. - * - * @version $Rev$ $Date$ - */ -public class PolicyReadTestCase extends TestCase { - - public void testPolicyReading() throws Exception { - ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); - XMLInputFactory inputFactory = XMLInputFactory.newInstance(); - StAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null); - - URL url = getClass().getResource("mock_policies.xml"); - - InputStream urlStream = url.openStream(); - XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream); - - Axis2ConfigParamPolicy policy = (Axis2ConfigParamPolicy)staxProcessor.read(reader); - assertEquals(policy.getParamElements().size(), 2); - } - -} diff --git a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/mock_policies.xml b/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/mock_policies.xml deleted file mode 100644 index cc84a83a47..0000000000 --- a/sandbox/ant/sca/trunk/modules/binding-ws-axis2-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/mock_policies.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - Timestamp Signature - org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties - - - - - Timestamp Signature - TuscanyWsUser - org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties - org.apache.tuscany.sca.binding.ws.axis2.itests.policy.IntegrityPWCBHandler" + - DirectReference - - - \ No newline at end of file -- cgit v1.2.3