From 9425990f532b1152c2d73db96c0f07ef5216a3d1 Mon Sep 17 00:00:00 2001 From: lresende Date: Thu, 12 Nov 2009 00:43:48 +0000 Subject: Moving 2.x contribs git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835178 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/echo/EchoBinding.java | 29 ----- .../src/main/java/echo/EchoBindingFactory.java | 33 ------ .../java/echo/impl/EchoBindingFactoryImpl.java | 34 ------ .../src/main/java/echo/impl/EchoBindingImpl.java | 104 ----------------- .../main/java/echo/impl/EchoBindingProcessor.java | 128 --------------------- .../java/echo/provider/EchoBindingInvoker.java | 48 -------- .../echo/provider/EchoBindingPoliciedInvoker.java | 71 ------------ .../echo/provider/EchoBindingProviderFactory.java | 58 ---------- .../provider/EchoReferenceBindingProvider.java | 71 ------------ .../echo/provider/EchoServiceBindingProvider.java | 78 ------------- .../policy/EchoBindingEncryptionPolicy.java | 41 ------- .../EchoBindingEncryptionPolicyProcessor.java | 37 ------ .../echo/provider/policy/EchoBindingPolicy.java | 43 ------- .../policy/EchoBindingPolicyProcessor.java | 78 ------------- .../provider/policy/EncryptionPolicyHandler.java | 48 -------- .../echo/provider/policy/EncryptionStrategy.java | 26 ----- .../java/echo/provider/policy/PolicyHandler.java | 29 ----- .../provider/policy/ReverseEncryptionStrategy.java | 33 ------ .../main/java/echo/provider/policy/WSPolicy.java | 43 ------- .../echo/provider/policy/WSPolicyProcessor.java | 54 --------- .../src/main/java/echo/server/EchoServer.java | 78 ------------- .../main/java/echo/server/EchoServiceListener.java | 52 --------- .../META-INF/services/echo.EchoBindingFactory | 19 --- ...ca.contribution.processor.StAXArtifactProcessor | 21 ---- ...any.sca.contribution.processor.ValidationSchema | 19 --- ...che.tuscany.sca.provider.BindingProviderFactory | 19 --- .../src/main/resources/sample-binding-echo.xsd | 36 ------ 27 files changed, 1330 deletions(-) delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory delete mode 100644 java/sca-contrib/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd (limited to 'java/sca-contrib/samples/binding-echo-extension/src/main') diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java deleted file mode 100644 index 3fe1598e0d..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java +++ /dev/null @@ -1,29 +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 echo; - -import org.apache.tuscany.sca.assembly.Binding; - -/** - * A model for the sample Echo binding. - */ -public interface EchoBinding extends Binding { - -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java deleted file mode 100644 index 0f6fee82be..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java +++ /dev/null @@ -1,33 +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 echo; - -/** - * A factory for the sample Echo binding model. - */ -public interface EchoBindingFactory { - - /** - * Creates a new Echo binding. - * - * @return a new Echo binding - */ - EchoBinding createEchoBinding(); -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java deleted file mode 100644 index af759dbf93..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java +++ /dev/null @@ -1,34 +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 echo.impl; - -import echo.EchoBinding; -import echo.EchoBindingFactory; - -/** - * A factory for the sample Echo binding model. - */ -public class EchoBindingFactoryImpl implements EchoBindingFactory { - - public EchoBinding createEchoBinding() { - return new EchoBindingImpl(); - } - -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java deleted file mode 100644 index 19c9271bb8..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java +++ /dev/null @@ -1,104 +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 echo.impl; - -import java.util.ArrayList; -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 org.apache.tuscany.sca.policy.PolicySetAttachPoint; - -import echo.EchoBinding; - -/** - * Implementation of the Echo binding model. - */ -public class EchoBindingImpl implements EchoBinding, PolicySetAttachPoint { - - private String name; - private String uri; - private List requiredIntents = new ArrayList(); - private List policySets = new ArrayList(); - private List applicablePolicySets = new ArrayList(); - private IntentAttachPointType bindingType = null; - - public IntentAttachPointType getType() { - return bindingType; - } - - public void setType(IntentAttachPointType type) { - this.bindingType = type; - } - - public String getName() { - return name; - } - - public String getURI() { - return uri; - } - - public void setName(String name) { - this.name = name; - } - - public void setURI(String uri) { - this.uri = uri; - } - - public List getPolicySets() { - return policySets; - } - - public List getRequiredIntents() { - return requiredIntents; - } - - public boolean isUnresolved() { - // The sample binding is always resolved - return false; - } - - public void setUnresolved(boolean unresolved) { - // The sample binding is always resolved - } - - public void setPolicySets(List policySets) { - this.policySets = policySets; - - } - - public void setRequiredIntents(List intents) { - this.requiredIntents = intents; - - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - public List getApplicablePolicySets() { - return this.applicablePolicySets; - } - -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java deleted file mode 100644 index 45fdb73f67..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java +++ /dev/null @@ -1,128 +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 echo.impl; - -import java.util.ArrayList; -import java.util.List; - -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.assembly.xml.PolicyAttachPointProcessor; -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.Intent; -import org.apache.tuscany.sca.policy.PolicyFactory; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.IntentAttachPointType; -import org.apache.tuscany.sca.policy.impl.IntentAttachPointTypeFactoryImpl; - -import echo.EchoBinding; -import echo.EchoBindingFactory; - -/** - * A processor for elements. - */ -public class EchoBindingProcessor implements StAXArtifactProcessor { - - private QName BINDING_ECHO = new QName("http://echo", "binding.echo"); - - private final EchoBindingFactory factory; - private PolicyAttachPointProcessor policyProcessor; - - public EchoBindingProcessor(EchoBindingFactory factory, PolicyFactory policyFactory) { - this.factory = factory; - this.policyProcessor = new PolicyAttachPointProcessor(policyFactory); - } - - public QName getArtifactType() { - return BINDING_ECHO; - } - - public Class getModelType() { - return EchoBinding.class; - } - - public EchoBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - EchoBinding echoBinding = factory.createEchoBinding(); - IntentAttachPointType bindingType = new IntentAttachPointTypeFactoryImpl().createBindingType(); - bindingType.setName(getArtifactType()); - bindingType.setUnresolved(true); - ((PolicySetAttachPoint)echoBinding).setType(bindingType); - - String name = reader.getAttributeValue(null, "name"); - if (name != null) { - echoBinding.setName(name); - } - - String uri = reader.getAttributeValue(null, "uri"); - if (uri != null) { - echoBinding.setURI(uri); - } - - policyProcessor.readPolicies(echoBinding, reader); - - return echoBinding; - } - - public void write(EchoBinding echoBinding, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { - - policyProcessor.writePolicyPrefixes(echoBinding, writer); - writer.writeStartElement(BINDING_ECHO.getNamespaceURI(), BINDING_ECHO.getLocalPart()); - policyProcessor.writePolicyAttributes(echoBinding, writer); - - if (echoBinding.getName() != null) { - writer.writeAttribute("name", echoBinding.getName()); - } - - if (echoBinding.getURI() != null) { - writer.writeAttribute("uri", echoBinding.getURI()); - } - - writer.writeEndElement(); - } - - public void resolve(EchoBinding echoBinding, ModelResolver resolver) throws ContributionResolveException { - PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)echoBinding; - List requiredIntents = new ArrayList(); - Intent resolvedIntent = null; - for ( Intent intent : policySetAttachPoint.getRequiredIntents() ) { - resolvedIntent = resolver.resolveModel(Intent.class, intent); - requiredIntents.add(resolvedIntent); - } - policySetAttachPoint.getRequiredIntents().clear(); - policySetAttachPoint.getRequiredIntents().addAll(requiredIntents); - - List resolvedPolicySets = new ArrayList(); - PolicySet resolvedPolicySet = null; - for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) { - resolvedPolicySet = resolver.resolveModel(PolicySet.class, policySet); - resolvedPolicySets.add(resolvedPolicySet); - } - policySetAttachPoint.getPolicySets().clear(); - policySetAttachPoint.getPolicySets().addAll(resolvedPolicySets); - } -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java deleted file mode 100644 index 91697fcd9a..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo.provider; - -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; - -/** - * Invoker for the sample echo binding. - */ -class EchoBindingInvoker implements Invoker { - - EchoBindingInvoker() { - } - - 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 - Object result = args[0]; - - msg.setBody(result); - - } catch (Exception e) { - msg.setFaultBody(e); - } - return msg; - } - -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java deleted file mode 100644 index 4877bade7f..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java +++ /dev/null @@ -1,71 +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 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 policies = null; - Map policyHandlers = new HashMap(); - - public EchoBindingPoliciedInvoker(List policies) { - this.policies = policies; - policyHandlers.put(new QName("http://test","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); - } - } - -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java deleted file mode 100644 index ba74d8f99a..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java +++ /dev/null @@ -1,58 +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 echo.provider; - -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.invocation.MessageFactory; -import org.apache.tuscany.sca.provider.BindingProviderFactory; -import org.apache.tuscany.sca.provider.ReferenceBindingProvider; -import org.apache.tuscany.sca.provider.ServiceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - -import echo.EchoBinding; - - -/** - * Implementation of the Echo binding model. - */ -public class EchoBindingProviderFactory implements BindingProviderFactory { - - private MessageFactory messageFactory; - - public EchoBindingProviderFactory(ExtensionPointRegistry extensionPoints) { - ModelFactoryExtensionPoint factories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); - this.messageFactory = factories.getFactory(MessageFactory.class); - } - - public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, EchoBinding binding) { - return new EchoReferenceBindingProvider(component, reference, binding); - } - - public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, EchoBinding binding) { - return new EchoServiceBindingProvider(component, service, binding, messageFactory); - } - - public Class getModelType() { - return EchoBinding.class; - } -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java deleted file mode 100644 index 0efc319af9..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java +++ /dev/null @@ -1,71 +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 echo.provider; - -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.PolicySetAttachPoint; -import org.apache.tuscany.sca.provider.ReferenceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; - -import echo.EchoBinding; - -/** - * Implementation of the Echo binding provider. - */ -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) { - if (binding instanceof PolicySetAttachPoint) { - PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)binding; - if ( !policySetAttachPoint.getPolicySets().isEmpty() ){ - return new EchoBindingPoliciedInvoker(policySetAttachPoint.getPolicySets()); - } - } - return new EchoBindingInvoker(); - } - - public boolean supportsOneWayInvocation() { - return false; - } - - public InterfaceContract getBindingInterfaceContract() { - return reference.getInterfaceContract(); - } - - public void start() { - } - - public void stop() { - } - -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java deleted file mode 100644 index 1cd1e5af4e..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.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 echo.provider; - -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.invocation.InvocationChain; -import org.apache.tuscany.sca.invocation.MessageFactory; -import org.apache.tuscany.sca.provider.ServiceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; -import org.apache.tuscany.sca.runtime.RuntimeWire; - -import echo.EchoBinding; -import echo.server.EchoServer; -import echo.server.EchoServiceListener; - -/** - * Implementation of the Echo binding provider. - */ -class EchoServiceBindingProvider implements ServiceBindingProvider { - - private RuntimeComponent component; - private RuntimeComponentService service; - private EchoBinding binding; - private MessageFactory messageFactory; - - EchoServiceBindingProvider(RuntimeComponent component, - RuntimeComponentService service, EchoBinding binding, MessageFactory messageFactory) { - this.component = component; - this.service = service; - this.binding = binding; - this.messageFactory = messageFactory; - } - - public InterfaceContract getBindingInterfaceContract() { - return service.getInterfaceContract(); - } - - public boolean supportsOneWayInvocation() { - return false; - } - - public void start() { - - RuntimeComponentService componentService = (RuntimeComponentService) service; - RuntimeWire wire = componentService.getRuntimeWire(binding); - InvocationChain chain = wire.getInvocationChains().get(0); - - // Register with the hosting server - String uri = binding.getURI(); - EchoServer.getServer().register(uri, new EchoServiceListener(chain.getHeadInvoker(), messageFactory)); - } - - public void stop() { - - // Unregister from the hosting server - String uri = component.getURI() + "/" + binding.getName(); - EchoServer.getServer().unregister(uri); - } - -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java deleted file mode 100644 index 33dc761aa4..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java +++ /dev/null @@ -1,41 +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 echo.provider.policy; - -/** - */ -public class EchoBindingEncryptionPolicy extends EchoBindingPolicy { - - private String encryptionStrategyClassName; - private Class strategyClass; - - public String getEncryptionStrategyClassName() { - return encryptionStrategyClassName; - } - public void setEncryptionStrategyClassName(String encryptionStrategyClassName) { - this.encryptionStrategyClassName = encryptionStrategyClassName; - } - public Class getStrategyClass() { - return strategyClass; - } - public void setStrategyClass(Class strategy) { - this.strategyClass = strategy; - } - -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java deleted file mode 100644 index c847d088a6..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java +++ /dev/null @@ -1,37 +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 echo.provider.policy; - -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.monitor.Monitor; - - -/** - * - */ -public class EchoBindingEncryptionPolicyProcessor extends EchoBindingPolicyProcessor { - - public EchoBindingEncryptionPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { - } - - public Class getModelType() { - return EchoBindingEncryptionPolicy.class; - } - -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java deleted file mode 100644 index 7d38e3b7a8..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java +++ /dev/null @@ -1,43 +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 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; - } - -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java deleted file mode 100644 index 72b8002238..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.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 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 implements StAXArtifactProcessor { - 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 != null ? classReference.getJavaClass() : null; - if (javaClass == null) { - //throw new ContributionResolveException(new ClassNotFoundException(ePolicy.getEncryptionStrategyClass())); - } - //ePolicy.setStrategyClass(javaClass); - //FIXME: need to resolve this thro resolver - try { - ePolicy.setStrategyClass((Class)Class.forName(ePolicy - .getEncryptionStrategyClassName())); - } catch (Exception e) { - throw new ContributionResolveException(e); - } - ePolicy.setStrategyClass(ePolicy.getStrategyClass()); - ePolicy.setUnresolved(false); - } - } -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java deleted file mode 100644 index deda8d9744..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package 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]); - } - } - - } - -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java deleted file mode 100644 index ffadfc7fff..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java +++ /dev/null @@ -1,26 +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 echo.provider.policy; - -/** - - */ -public interface EncryptionStrategy { - Object encryptMessage(Object msg); -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java deleted file mode 100644 index 6fa5f26977..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java +++ /dev/null @@ -1,29 +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 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; -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java deleted file mode 100644 index cf55b36fc2..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java +++ /dev/null @@ -1,33 +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 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; - } - -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java deleted file mode 100644 index ac610cfb51..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java +++ /dev/null @@ -1,43 +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 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; - } - -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java deleted file mode 100644 index fcb250b444..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.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 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; - -public class WSPolicyProcessor implements StAXArtifactProcessor { - - public QName getArtifactType() { - return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment"); - } - - public WSPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - //FIXME Implement this method - return new WSPolicy(); - } - - public void write(WSPolicy wsPolicy, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { - //FIXME Implement this method - } - - public Class getModelType() { - return WSPolicy.class; - } - - public void resolve(WSPolicy wsPolicy, ModelResolver modelResolver) throws ContributionResolveException { - - } -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java deleted file mode 100644 index 8ea2395d04..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.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 echo.server; - -import java.lang.reflect.InvocationTargetException; -import java.util.HashMap; -import java.util.Map; - -/** - * A sample Echo server, showing how to integrate service bindings. - */ -public class EchoServer { - - public static EchoServer server; - - private Map services = new HashMap(); - - public static void start() { - } - - public static void stop() { - } - - public static EchoServer getServer() { - if (server == null) - server = new EchoServer(); - return server; - } - - /** - * Register a service under the given name. - * - * @param service - * @param name - */ - public void register(String uri, EchoServiceListener service) { - if (services.isEmpty()) { - start(); - } - services.put(uri, service); - } - - public void unregister(String uri) { - services.remove(uri); - if (services.isEmpty()) { - stop(); - } - } - - /** - * Dispatch an incoming interaction to the corresponding service. - * - * @param uri - * @param input - * @return - */ - public String sendReceive(String uri, String input) throws InvocationTargetException { - return services.get(uri).sendReceive(input); - } - -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java b/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java deleted file mode 100644 index 32336dd94f..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java +++ /dev/null @@ -1,52 +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 echo.server; - -import java.lang.reflect.InvocationTargetException; - -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.invocation.MessageFactory; - -public class EchoServiceListener { - private Invoker invoker; - private MessageFactory messageFactory; - - public EchoServiceListener(Invoker invoker, MessageFactory messageFactory) { - super(); - this.invoker = invoker; - this.messageFactory = messageFactory; - } - - public String sendReceive(String input) throws InvocationTargetException { - - // Create a request message - Message request = messageFactory.createMessage(); - request.setBody(new Object[] {input}); - - // Dispatch and get the response - Message response = invoker.invoke(request); - Object body = response.getBody(); - if (response.isFault()) { - throw new InvocationTargetException((Throwable)body); - } - return (String)body; - } - -} diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory b/java/sca-contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory deleted file mode 100644 index 55be293862..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory +++ /dev/null @@ -1,19 +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 binding model factory -echo.impl.EchoBindingFactoryImpl diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/java/sca-contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor deleted file mode 100644 index 06d53250c1..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/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.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 diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/java/sca-contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema deleted file mode 100644 index 4ad61f573d..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema +++ /dev/null @@ -1,19 +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. - -# URI of the XML schema to be used for validation -sample-binding-echo.xsd diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/java/sca-contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory deleted file mode 100644 index efa475ef92..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory +++ /dev/null @@ -1,19 +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 binding provider extension -echo.provider.EchoBindingProviderFactory;model=echo.EchoBinding diff --git a/java/sca-contrib/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd b/java/sca-contrib/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd deleted file mode 100644 index 9b64df4871..0000000000 --- a/java/sca-contrib/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - -- cgit v1.2.3