From 6fadbc9cd1fcf03d0b3630f772d91df149b70428 Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:07:19 +0000 Subject: Moving 1.x branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835123 13f79535-47bb-0310-9956-ffa450edef68 --- .../policy/EchoBindingEncryptionPolicy.java | 41 ------------ .../EchoBindingEncryptionPolicyProcessor.java | 36 ---------- .../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 --------------- 10 files changed, 431 deletions(-) delete mode 100644 branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java delete mode 100644 branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java delete mode 100644 branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java delete mode 100644 branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java delete mode 100644 branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java delete mode 100644 branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java delete mode 100644 branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java delete mode 100644 branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java delete mode 100644 branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java delete mode 100644 branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java (limited to 'branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy') diff --git a/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java b/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java deleted file mode 100644 index 33dc761aa4..0000000000 --- a/branches/sca-java-1.0.1/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/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java b/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java deleted file mode 100644 index 49d195395b..0000000000 --- a/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java +++ /dev/null @@ -1,36 +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; - - -/** - * - */ -public class EchoBindingEncryptionPolicyProcessor extends EchoBindingPolicyProcessor { - - public EchoBindingEncryptionPolicyProcessor(ModelFactoryExtensionPoint modelFactories) { - } - - public Class getModelType() { - return EchoBindingEncryptionPolicy.class; - } - -} diff --git a/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java b/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java deleted file mode 100644 index 7d38e3b7a8..0000000000 --- a/branches/sca-java-1.0.1/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/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java b/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java deleted file mode 100644 index 72b8002238..0000000000 --- a/branches/sca-java-1.0.1/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/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java b/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java deleted file mode 100644 index deda8d9744..0000000000 --- a/branches/sca-java-1.0.1/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/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java b/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java deleted file mode 100644 index ffadfc7fff..0000000000 --- a/branches/sca-java-1.0.1/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/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java b/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java deleted file mode 100644 index 6fa5f26977..0000000000 --- a/branches/sca-java-1.0.1/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/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java b/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java deleted file mode 100644 index cf55b36fc2..0000000000 --- a/branches/sca-java-1.0.1/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/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java b/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java deleted file mode 100644 index ac610cfb51..0000000000 --- a/branches/sca-java-1.0.1/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/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java b/branches/sca-java-1.0.1/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java deleted file mode 100644 index fcb250b444..0000000000 --- a/branches/sca-java-1.0.1/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 { - - } -} -- cgit v1.2.3