Author: svkrish
Date: Tue Aug 21 15:31:20 2007
New Revision: 568311
URL: http://svn.apache.org/viewvc?rev=568311&view=rev
Log:
extending sample to include policies
Added:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/resources/definitions.xml
Modified:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java
incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/resources/EchoBinding.composite
Modified:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java?rev=568311&r1=568310&r2=568311&view=diff
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java
(original)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java
Tue Aug 21 15:31:20 2007
@@ -20,9 +20,11 @@
package echo;
import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
/**
* A model for the sample Echo binding.
*/
-public interface EchoBinding extends Binding {
+public interface EchoBinding extends Binding, PolicySetAttachPoint {
+
}
Modified:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java?rev=568311&r1=568310&r2=568311&view=diff
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
(original)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
Tue Aug 21 15:31:20 2007
@@ -19,22 +19,35 @@
package echo.impl;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
import echo.EchoBinding;
/**
* Implementation of the Echo binding model.
*/
-class EchoBindingImpl implements EchoBinding {
+public class EchoBindingImpl implements EchoBinding {
private String name;
private String uri;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private IntentAttachPointType bindingType = null;
- EchoBindingImpl() {
+ public IntentAttachPointType getType() {
+ return bindingType;
}
-
+
+ public void setType(IntentAttachPointType type) {
+ this.bindingType = type;
+ }
+
public String getName() {
return name;
}
@@ -49,6 +62,14 @@
public void setURI(String uri) {
this.uri = uri;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
}
public List<Object> getExtensions() {
Added:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java?rev=568311&view=auto
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
(added)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
Tue Aug 21 15:31:20 2007
@@ -0,0 +1,155 @@
+/*
+ * 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 echo.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import
org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+import echo.EchoBinding;
+import echo.EchoBindingFactory;
+
+/**
+ * A processor for <binding.echo> elements.
+ */
+public class EchoBindingProcessor implements
StAXArtifactProcessor<EchoBinding> {
+
+ private QName BINDING_ECHO = new QName("http://echo", "binding.echo");
+
+ private final EchoBindingFactory factory;
+ private PolicyFactory policyFactory;
+
+ public EchoBindingProcessor(EchoBindingFactory factory, PolicyFactory
pFactory) {
+ this.factory = factory;
+ this.policyFactory = pFactory;
+ }
+
+ public QName getArtifactType() {
+ return BINDING_ECHO;
+ }
+
+ public Class<EchoBinding> getModelType() {
+ return EchoBinding.class;
+ }
+
+ public EchoBinding read(XMLStreamReader reader) throws
ContributionReadException {
+ EchoBinding echoBinding = factory.createEchoBinding();
+
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null) {
+ echoBinding.setName(name);
+ }
+ String uri = reader.getAttributeValue(null, "uri");
+ if (uri != null) {
+ echoBinding.setURI(uri);
+ }
+
+ readPolicies(echoBinding, null, reader);
+ return echoBinding;
+ }
+
+ protected QName getQNameValue(XMLStreamReader reader, String value) {
+ if (value != null) {
+ int index = value.indexOf(':');
+ String prefix = index == -1 ? "" : value.substring(0, index);
+ String localName = index == -1 ? value : value.substring(index +
1);
+ String ns = reader.getNamespaceContext().getNamespaceURI(prefix);
+ if (ns == null) {
+ ns = "";
+ }
+ return new QName(ns, localName, prefix);
+ } else {
+ return null;
+ }
+ }
+
+ protected void readIntents(IntentAttachPoint attachPoint, Operation
operation, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, "requires");
+ if (value != null) {
+ List<Intent> requiredIntents = attachPoint.getRequiredIntents();
+ for (StringTokenizer tokens = new StringTokenizer(value);
tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ Intent intent = policyFactory.createIntent();
+ intent.setName(qname);
+ if (operation != null) {
+ //intent.getOperations().add(operation);
+ }
+ requiredIntents.add(intent);
+ }
+ }
+ }
+
+ protected void readPolicies(PolicySetAttachPoint attachPoint, Operation
operation, XMLStreamReader reader) {
+ readIntents(attachPoint, operation, reader);
+
+ String value = reader.getAttributeValue(null, "policySets");
+ if (value != null) {
+ List<PolicySet> policySets = attachPoint.getPolicySets();
+ for (StringTokenizer tokens = new StringTokenizer(value);
tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ PolicySet policySet = policyFactory.createPolicySet();
+ policySet.setName(qname);
+ if (operation != null) {
+ //policySet.getOperations().add(operation);
+ }
+ policySets.add(policySet);
+ }
+ }
+ }
+
+ public void write(EchoBinding echoBinding, XMLStreamWriter writer) throws
ContributionWriteException {
+ }
+
+ public void resolve(EchoBinding echoBinding, ModelResolver resolver)
throws ContributionResolveException {
+ List<Intent> requiredIntents = new ArrayList<Intent>();
+ Intent resolvedIntent = null;
+ for ( Intent intent : echoBinding.getRequiredIntents() ) {
+ resolvedIntent = resolver.resolveModel(Intent.class, intent);
+ requiredIntents.add(resolvedIntent);
+ }
+ echoBinding.getRequiredIntents().clear();
+ echoBinding.getRequiredIntents().addAll(requiredIntents);
+
+ List<PolicySet> resolvedPolicySets = new ArrayList<PolicySet>();
+ PolicySet resolvedPolicySet = null;
+ for ( PolicySet policySet : echoBinding.getPolicySets() ) {
+ resolvedPolicySet = resolver.resolveModel(PolicySet.class,
policySet);
+ resolvedPolicySets.add(resolvedPolicySet);
+ }
+ echoBinding.getPolicySets().clear();
+ echoBinding.getPolicySets().addAll(resolvedPolicySets);
+ }
+}
Modified:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java?rev=568311&r1=568310&r2=568311&view=diff
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java
(original)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java
Tue Aug 21 15:31:20 2007
@@ -31,6 +31,7 @@
public Message invoke(Message msg) {
try {
+ System.out.println("Passing thro invoker...");
Object[] args = msg.getBody();
// echo back the first parameter, a real binding would invoke some
API for flowing the request
Added:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java?rev=568311&view=auto
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java
(added)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java
Tue Aug 21 15:31:20 2007
@@ -0,0 +1,71 @@
+/*
+ * 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 echo.provider;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+import echo.provider.policy.PolicyHandler;
+import echo.provider.policy.EncryptionPolicyHandler;
+
+/**
+ * Invoker that applies policies before invocation for the sample echo binding.
+ */
+public class EchoBindingPoliciedInvoker implements Invoker {
+ List<PolicySet> policies = null;
+ Map<QName, PolicyHandler> policyHandlers = new HashMap<QName,
PolicyHandler>();
+
+ public EchoBindingPoliciedInvoker(List<PolicySet> policies) {
+ this.policies = policies;
+ policyHandlers.put(new
QName("http://sample/policy","EncryptionPolicy"),
+ new EncryptionPolicyHandler());
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object[] args = msg.getBody();
+
+ applyPolicies(args);
+
+ // echo back the first parameter, a real binding would invoke some
API for flowing the request
+ Object result = args[0];
+
+ msg.setBody(result);
+
+ } catch (Exception e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+ private void applyPolicies(Object[] args) throws Exception {
+ for ( PolicySet policySet : policies ) {
+ PolicyHandler policyHandler =
policyHandlers.get(policySet.getName());
+ policyHandler.applyPolicy(args, policySet);
+ }
+ }
+
+}
Modified:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java?rev=568311&r1=568310&r2=568311&view=diff
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java
(original)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java
Tue Aug 21 15:31:20 2007
@@ -19,9 +19,15 @@
package echo.provider;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
@@ -34,18 +40,24 @@
class EchoReferenceBindingProvider implements ReferenceBindingProvider {
private RuntimeComponentReference reference;
+ private EchoBinding binding;
EchoReferenceBindingProvider(RuntimeComponent component,
RuntimeComponentReference reference,
EchoBinding binding) {
this.reference = reference;
+ this.binding = binding;
}
public Invoker createInvoker(Operation operation, boolean isCallback) {
if (isCallback) {
throw new UnsupportedOperationException();
} else {
- return new EchoBindingInvoker();
+ if ( !binding.getPolicySets().isEmpty() ){
+ return new
EchoBindingPoliciedInvoker(((PolicySetAttachPoint)binding).getPolicySets());
+ } else {
+ return new EchoBindingInvoker();
+ }
}
}
Added:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java?rev=568311&view=auto
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java
(added)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java
Tue Aug 21 15:31:20 2007
@@ -0,0 +1,41 @@
+/*
+ * 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 echo.provider.policy;
+
+/**
+ */
+public class EchoBindingEncryptionPolicy extends EchoBindingPolicy {
+
+ private String encryptionStrategyClassName;
+ private Class<? extends EncryptionStrategy> strategyClass;
+
+ public String getEncryptionStrategyClassName() {
+ return encryptionStrategyClassName;
+ }
+ public void setEncryptionStrategyClassName(String
encryptionStrategyClassName) {
+ this.encryptionStrategyClassName = encryptionStrategyClassName;
+ }
+ public Class<? extends EncryptionStrategy> getStrategyClass() {
+ return strategyClass;
+ }
+ public void setStrategyClass(Class<? extends EncryptionStrategy> strategy)
{
+ this.strategyClass = strategy;
+ }
+
+}
Added:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java?rev=568311&view=auto
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java
(added)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java
Tue Aug 21 15:31:20 2007
@@ -0,0 +1,36 @@
+/*
+ * 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 echo.provider.policy;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+
+
+/**
+ *
+ */
+public class EchoBindingEncryptionPolicyProcessor extends
EchoBindingPolicyProcessor<EchoBindingEncryptionPolicy> {
+
+ public EchoBindingEncryptionPolicyProcessor(ModelFactoryExtensionPoint
modelFactories) {
+ }
+
+ public Class<EchoBindingEncryptionPolicy> getModelType() {
+ return EchoBindingEncryptionPolicy.class;
+ }
+
+}
Added:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java?rev=568311&view=auto
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java
(added)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java
Tue Aug 21 15:31:20 2007
@@ -0,0 +1,43 @@
+/*
+ * 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 echo.provider.policy;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+
+ */
+public class EchoBindingPolicy implements Policy {
+ private boolean unresolved = true;
+
+ public QName getSchemaName() {
+ return new QName("http://sample/policy","echoBindingPolicy");
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+}
Added:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java?rev=568311&view=auto
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java
(added)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java
Tue Aug 21 15:31:20 2007
@@ -0,0 +1,78 @@
+/*
+ * 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 echo.provider.policy;
+
+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.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import
org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ *
+ */
+public abstract class EchoBindingPolicyProcessor<T extends EchoBindingPolicy>
implements StAXArtifactProcessor<T> {
+ public static final String ENCRYPTION = "Encryption";
+
+ public QName getArtifactType() {
+ return new QName("http://sample/policy", "echoBindingPolicy");
+ }
+
+ public T read(XMLStreamReader reader) throws ContributionReadException,
XMLStreamException {
+ String name = reader.getAttributeValue(null, "name");
+ if ( name != null && name.equals(ENCRYPTION) ) {
+ EchoBindingEncryptionPolicy policy = new
EchoBindingEncryptionPolicy();
+
policy.setEncryptionStrategyClassName(reader.getAttributeValue(null,
"strategy"));
+ return (T)policy;
+ }
+ return null;
+ }
+
+ public void write(T arg0, XMLStreamWriter arg1) throws
ContributionWriteException,
+ XMLStreamException {
+ }
+
+ public void resolve(T policy, ModelResolver resolver) throws
ContributionResolveException {
+ if ( policy instanceof EchoBindingEncryptionPolicy ) {
+ EchoBindingEncryptionPolicy ePolicy =
(EchoBindingEncryptionPolicy)policy;
+
+ ClassReference classReference = new
ClassReference(ePolicy.getEncryptionStrategyClassName());
+ classReference = resolver.resolveModel(ClassReference.class,
classReference);
+ Class javaClass = classReference.getJavaClass();
+ if (javaClass == null) {
+ //throw new ContributionResolveException(new
ClassNotFoundException(ePolicy.getEncryptionStrategyClass()));
+ }
+ //ePolicy.setStrategyClass(javaClass);
+ //FIXME: need to resolve this thro resolver
+ try {
+ ePolicy.setStrategyClass((Class<? extends
EncryptionStrategy>)Class.forName(ePolicy.getEncryptionStrategyClassName()));
+ } catch ( Exception e ) {
+ throw new ContributionResolveException(e);
+ }
+ ePolicy.setStrategyClass(ePolicy.getStrategyClass());
+ ePolicy.setUnresolved(false);
+ }
+ }
+}
Added:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java?rev=568311&view=auto
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java
(added)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java
Tue Aug 21 15:31:20 2007
@@ -0,0 +1,48 @@
+/*
+ * 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 echo.provider.policy;
+
+import org.apache.tuscany.sca.policy.Policy;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Sample policy handler
+ */
+public class EncryptionPolicyHandler implements PolicyHandler {
+
+ public void applyPolicy(Object msg, PolicySet policySet) throws Exception {
+ for ( Object aPolicy : policySet.getPolicies() ) {
+ if ( aPolicy instanceof EchoBindingEncryptionPolicy ) {
+ encrypt(msg, (EchoBindingEncryptionPolicy)aPolicy);
+ }
+ }
+ }
+
+ private void encrypt(Object msg, EchoBindingEncryptionPolicy policy)
throws Exception {
+ if ( !policy.isUnresolved() && msg instanceof Object[] ) {
+ EncryptionStrategy strategy =
policy.getStrategyClass().newInstance();
+ Object[] msgArgs = (Object[])msg;
+ for ( int count = 0 ; count < msgArgs.length ; ++count ) {
+ msgArgs[count] = strategy.encryptMessage(msgArgs[count]);
+ }
+ }
+
+ }
+
+}
Added:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java?rev=568311&view=auto
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java
(added)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java
Tue Aug 21 15:31:20 2007
@@ -0,0 +1,26 @@
+/*
+ * 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 echo.provider.policy;
+
+/**
+
+ */
+public interface EncryptionStrategy {
+ Object encryptMessage(Object msg);
+}
Added:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java?rev=568311&view=auto
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java
(added)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java
Tue Aug 21 15:31:20 2007
@@ -0,0 +1,29 @@
+/*
+ * 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 echo.provider.policy;
+
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Sample Policy Handler Interface
+ *
+ */
+public interface PolicyHandler {
+ void applyPolicy(Object msg, PolicySet policySet) throws Exception;
+}
Added:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java?rev=568311&view=auto
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java
(added)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java
Tue Aug 21 15:31:20 2007
@@ -0,0 +1,33 @@
+/*
+ * 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 echo.provider.policy;
+
+/**
+ */
+public class ReverseEncryptionStrategy implements EncryptionStrategy {
+
+ public Object encryptMessage(Object msg) {
+ if ( msg instanceof String ) {
+ StringBuffer sb = new StringBuffer((String)msg);
+ msg = sb.reverse().toString();
+ }
+ return msg;
+ }
+
+}
Added:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java?rev=568311&view=auto
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java
(added)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java
Tue Aug 21 15:31:20 2007
@@ -0,0 +1,43 @@
+/*
+ * 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 echo.provider.policy;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+
+ */
+public class WSPolicy implements Policy {
+ private boolean unresolved = true;
+
+ public QName getSchemaName() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy",
"PolicyAttachment");
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+}
Added:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java?rev=568311&view=auto
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java
(added)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java
Tue Aug 21 15:31:20 2007
@@ -0,0 +1,60 @@
+/*
+ * 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 echo.provider.policy;
+
+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.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import
org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+ * @author administrator
+ *
+ */
+public class WSPolicyProcessor implements StAXArtifactProcessor<WSPolicy> {
+
+ public QName getArtifactType() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy",
"PolicyAttachment");
+ }
+
+ public WSPolicy read(XMLStreamReader arg0) throws
ContributionReadException, XMLStreamException {
+ return new WSPolicy();
+ }
+
+ public void write(WSPolicy arg0, XMLStreamWriter arg1) throws
ContributionWriteException,
+ XMLStreamException {
+
+ }
+
+ public Class<WSPolicy> getModelType() {
+ // TODO Auto-generated method stub
+ return WSPolicy.class;
+ }
+
+ public void resolve(WSPolicy arg0, ModelResolver arg1) throws
ContributionResolveException {
+
+ }
+}
Modified:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=568311&r1=568310&r2=568311&view=diff
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
(original)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
Tue Aug 21 15:31:20 2007
@@ -17,3 +17,5 @@
# Implementation class for the artifact processor extension
org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://echo#binding.echo,model=echo.EchoBinding,factory=echo.EchoBindingFactory
+echo.provider.policy.EchoBindingEncryptionPolicyProcessor;qname=http://sample/policy#echoBindingPolicy,model=echo.provider.policy.EchoBindingEncryptionPolicy
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://schemas.xmlsoap.org/ws/2004/09/policy#PolicyAttachment,model=echo.provider.policy.WSPolicy
Modified:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java?rev=568311&r1=568310&r2=568311&view=diff
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java
(original)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java
Tue Aug 21 15:31:20 2007
@@ -43,7 +43,7 @@
public void testEchoBinding() {
String result = service.echo("foo");
- assertEquals(result, "foo");
+ assertEquals(result, "oof");
}
Modified:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java?rev=568311&r1=568310&r2=568311&view=diff
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java
(original)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java
Tue Aug 21 15:31:20 2007
@@ -43,7 +43,7 @@
public void testEchoBinding() throws Exception {
String result =
EchoServer.getServer().sendReceive("http://tempuri.org", "foo");
- assertEquals(result, "foo");
+ assertEquals(result, "oof");
}
Modified:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/resources/EchoBinding.composite
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/resources/EchoBinding.composite?rev=568311&r1=568310&r2=568311&view=diff
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/resources/EchoBinding.composite
(original)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/resources/EchoBinding.composite
Tue Aug 21 15:31:20 2007
@@ -21,11 +21,12 @@
targetNamespace="http://sample/echo"
xmlns:se="http://sample/echo"
xmlns:e="http://echo"
+ xmlns:p="http://sample/policy"
name="EchoBinding">
<service name="EchoService" promote="EchoComponent">
<interface.java interface="echo.Echo"/>
- <e:binding.echo uri="http://tempuri.org" />
+ <e:binding.echo uri="http://tempuri.org" />
</service>
<component name="EchoComponent">
@@ -34,7 +35,7 @@
<reference name="EchoReference" promote="EchoComponent/echoReference">
<interface.java interface="echo.Echo"/>
- <e:binding.echo uri="http://tempuri.org" />
+ <e:binding.echo uri="http://tempuri.org"
policySets="p:EncryptionPolicy" />
</reference>
</composite>
Added:
incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/resources/definitions.xml
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/resources/definitions.xml?rev=568311&view=auto
==============================================================================
---
incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/resources/definitions.xml
(added)
+++
incubator/tuscany/java/sca/samples/binding-echo-extension/src/test/resources/definitions.xml
Tue Aug 21 15:31:20 2007
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="ASCII"?>
+<sca:definitions xmlns="http://test"
+ targetNamespace="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <!-- qualified intents -->
+ <sca:intent name="confidentiality.transport" />
+ <sca:intent name="confidentiality.message" />
+ <sca:intent name="confidentiality.message.whole" />
+ <sca:intent name="confidentiality.message.body" />
+
+ <!-- POLICY SETS -->
+ <sca:policySet name="p:EncryptionPolicy"
+ provides="confidentiality"
+ appliesTo="sca:binding.echo"
+ xmlns="http://test"
+ xmlns:p="http://sample/policy">
+ <p:echoBindingPolicy name="Encryption"
strategy="echo.provider.policy.ReverseEncryptionStrategy" />
+ </sca:policySet>
+
+ <sca:policySet name="SecureReliablePolicy"
+ provides="confidentiality.transport integrity"
+ appliesTo="sca:binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </sca:policySet>
+
+ <sca:policySet name="SecureReliablePolicy"
+ provides="confidentiality.transport integrity"
+ appliesTo="sca:binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </sca:policySet>
+
+ <sca:policySet name="SecureMessagingPolicies"
+ provides="confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sca:intentMap provides="confidentiality" default="transport">
+ <sca:qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "transport"
alternative -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
+ </sca:qualifier>
+ <sca:qualifier name="message">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "message"
alternative" -->
+ </wsp:PolicyAttachment>
+ </sca:qualifier>
+ </sca:intentMap>
+</sca:policySet>
+
+<sca:policySet name="SecurityPolicy" provides="confidentiality"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" >
+ <sca:intentMap provides="confidentiality" default="message">
+ <sca:qualifier name="message">
+ <sca:intentMap provides="message" default="whole">
+ <sca:qualifier name="body">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for body encryption -->
+ </wsp:PolicyAttachment>
+ </sca:qualifier>
+ <sca:qualifier name="whole">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for whole message
encryption -->
+ </wsp:PolicyAttachment>
+ </sca:qualifier>
+ </sca:intentMap>
+ </sca:qualifier>
+ <sca:qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for transport encryption -->
+ </wsp:PolicyAttachment>
+ </sca:qualifier>
+ </sca:intentMap>
+</sca:policySet>
+
+<sca:policySet name="BasicAuthMsgProtSecurity"
+ provides="authentication confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://test">
+ <sca:policySetReference name="AuthenticationPolicies"/>
+ <sca:policySetReference name="ConfidentialityPolicies"/>
+</sca:policySet>
+
+<sca:policySet name="AuthenticationPolicies"
+ provides="authentication"
+ appliesTo="binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "basic
+ authentication" -->
+ </wsp:PolicyAttachment>
+</sca:policySet>
+
+<sca:policySet name="ConfidentialityPolicies"
+ provides="confidentiality"
+ bindings="binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sca:intentMap provides="confidentiality" default="transport">
+ <sca:qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "transport"
+ alternative -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
+ </sca:qualifier>
+ <sca:qualifier name="message">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "message"
+ alternative" -->...
+ </wsp:PolicyAttachment>
+ </sca:qualifier>
+ </sca:intentMap>
+</sca:policySet>
+
+<!-- profile intent -->
+ <sca:intent name="reliableMessageProtection"
+ constrains="sca:binding"
+ requires="messageProtection">
+ <sca:description>
+ Protect messages from unauthorized reading or
modification
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="messageProtection"
+ constrains="sca:binding"
+ requires="confidentiality integrity">
+ <sca:description>
+ Protect messages from unauthorized reading or
modification
+ </sca:description>
+ </sca:intent>
+
+<!-- simple intent -->
+ <sca:intent name="confidentiality"
+ constrains="sca:binding">
+ <sca:description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="integrity"
+ constrains="sca:binding">
+ <sca:description>
+ Communitcation thro this binding must prevent
+ unauthorized modification of the messages.
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="authentication"
+ constrains="sca:binding">
+ <sca:description>
+ Communitcation thro this binding required
+ Authentication.
+ </sca:description>
+ </sca:intent>
+
+</sca:definitions>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]