This is an automated email from the ASF dual-hosted git repository. billblough pushed a commit to branch 1_6 in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-sandesha.git
commit ce5f2b69debf4af2c09419776c046ae7f3bebc42 Author: Andreas Veithen <veit...@apache.org> AuthorDate: Mon Jul 11 20:38:26 2011 +0000 Merged r1072332, r1072333 and r1090216 to the 1.6 branch to upgrade to Neethi 3.0.1. --- .../sandesha2/policy/SandeshaPolicyBean.java | 5 +- .../AcknowledgementIntervalAssertionBuilder.java | 43 +++++++ .../builders/ContextManagerAssertionBuilder.java | 43 +++++++ .../builders/EPRDecoratorAssertionBuilder.java | 43 +++++++ .../policy/builders/EnforceRMAssertionBuilder.java | 43 +++++++ .../ExponentialBackoffAssertionBuilder.java | 43 +++++++ .../InactivityTimeoutAssertionBuilder.java | 43 +++++++ .../InactivityTimeoutMeasureAssertionBuilder.java | 43 +++++++ .../builders/InvokeInOrderAssertionBuilder.java | 45 +++++++ .../builders/MakeConnectionAssertionBuilder.java | 71 +++++++++++ ...MaximumRetransmissionCountAssertionBuilder.java | 43 +++++++ .../MessageTypesToDropAssertionBuilder.java | 55 +++++++++ .../policy/builders/RMAssertionBuilder.java | 134 +-------------------- .../RetransmissionIntervalAssertionBuilder.java | 43 +++++++ .../policy/builders/SandeshaPropertyAssertion.java | 59 +++++++++ .../builders/SecurityManagerAssertionBuilder.java | 43 +++++++ .../SequenceRemovalTimeoutAssertionBuilder.java | 43 +++++++ ...uenceRemovalTimeoutMeasureAssertionBuilder.java | 43 +++++++ .../builders/StorageManagersAssertionBuilder.java | 49 ++++++++ .../UseMessageSerializationAssertionBuilder.java | 43 +++++++ .../org.apache.neethi.builders.AssertionBuilder | 18 +++ pom.xml | 2 +- 22 files changed, 866 insertions(+), 131 deletions(-) diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/SandeshaPolicyBean.java b/modules/core/src/main/java/org/apache/sandesha2/policy/SandeshaPolicyBean.java index acb77bf..96597d7 100644 --- a/modules/core/src/main/java/org/apache/sandesha2/policy/SandeshaPolicyBean.java +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/SandeshaPolicyBean.java @@ -627,5 +627,8 @@ public class SandeshaPolicyBean implements Assertion { public void setParent(SandeshaPolicyBean parent) { this.parent = parent; } - + + public boolean isIgnorable() { + return false; + } } diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/AcknowledgementIntervalAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/AcknowledgementIntervalAssertionBuilder.java new file mode 100644 index 0000000..c3a16d1 --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/AcknowledgementIntervalAssertionBuilder.java @@ -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 org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class AcknowledgementIntervalAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_ACK_INTERVAL }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + final long value = Long.parseLong(element.getText().trim()); + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + propertyBean.setAcknowledgementInterval(value); + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/ContextManagerAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/ContextManagerAssertionBuilder.java new file mode 100644 index 0000000..653d1c8 --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/ContextManagerAssertionBuilder.java @@ -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 org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class ContextManagerAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_CONTEXT_MGR }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + final String value = element.getText().trim(); + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + propertyBean.setContextManagerClass(value); + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/EPRDecoratorAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/EPRDecoratorAssertionBuilder.java new file mode 100644 index 0000000..4a14b05 --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/EPRDecoratorAssertionBuilder.java @@ -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 org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class EPRDecoratorAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_EPR_DECORATOR }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + final String value = element.getText().trim(); + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + propertyBean.setEPRDecoratorClass(value); + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/EnforceRMAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/EnforceRMAssertionBuilder.java new file mode 100644 index 0000000..d7c7f69 --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/EnforceRMAssertionBuilder.java @@ -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 org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class EnforceRMAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_ENFORCE_RM }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + final boolean value = Boolean.valueOf(element.getText().trim()).booleanValue(); + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + propertyBean.setEnforceRM(value); + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/ExponentialBackoffAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/ExponentialBackoffAssertionBuilder.java new file mode 100644 index 0000000..ac59baa --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/ExponentialBackoffAssertionBuilder.java @@ -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 org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class ExponentialBackoffAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_EXP_BACKOFF }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + final boolean value = Boolean.valueOf(element.getText().trim()).booleanValue(); + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + propertyBean.setExponentialBackoff(value); + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/InactivityTimeoutAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/InactivityTimeoutAssertionBuilder.java new file mode 100644 index 0000000..ca62f89 --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/InactivityTimeoutAssertionBuilder.java @@ -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 org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class InactivityTimeoutAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_INACTIVITY_TIMEOUT }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + final long value = Long.parseLong(element.getText().trim()); + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + propertyBean.setInactiveTimeoutValue(value); + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/InactivityTimeoutMeasureAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/InactivityTimeoutMeasureAssertionBuilder.java new file mode 100644 index 0000000..f771e04 --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/InactivityTimeoutMeasureAssertionBuilder.java @@ -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 org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class InactivityTimeoutMeasureAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_INACTIVITY_TIMEOUT_MEASURES }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + final String value = element.getText().trim(); + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + propertyBean.setInactivityTimeoutMeasure(value); + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/InvokeInOrderAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/InvokeInOrderAssertionBuilder.java new file mode 100644 index 0000000..b50d8d8 --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/InvokeInOrderAssertionBuilder.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.axis2.Constants; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class InvokeInOrderAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_INVOKE_INORDER }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + String value = element.getText().trim(); + final boolean inOrder = value!=null && Constants.VALUE_TRUE.equals(value); + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + propertyBean.setInOrder(inOrder); + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/MakeConnectionAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/MakeConnectionAssertionBuilder.java new file mode 100644 index 0000000..fe03126 --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/MakeConnectionAssertionBuilder.java @@ -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 org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class MakeConnectionAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_MAKE_CONNECTION }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + final boolean enableMakeConnection; + final boolean enableMakeConnectionSet; + OMElement enabledElem = element.getFirstChildWithName(Sandesha2Constants.Assertions.Q_ELEM_ENABLED); + if (enabledElem!=null) { + String data = enabledElem.getText().trim(); + enableMakeConnection = Boolean.valueOf(data).booleanValue(); + enableMakeConnectionSet = true; + } else { + enableMakeConnection = false; + enableMakeConnectionSet = false; + } + + final boolean enableRMAnonURI; + final boolean enableRMAnonURISet; + OMElement useRMAnonElem = element.getFirstChildWithName(Sandesha2Constants.Assertions.Q_ELEM_USE_RM_ANON_URI); + if (useRMAnonElem!=null) { + String data = useRMAnonElem.getText().trim(); + enableRMAnonURI = Boolean.valueOf(data).booleanValue(); + enableRMAnonURISet = true; + } else { + enableRMAnonURI = false; + enableRMAnonURISet = false; + } + + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + if (enableMakeConnectionSet) { + propertyBean.setEnableMakeConnection(enableMakeConnection); + } + if (enableRMAnonURISet) { + propertyBean.setEnableRMAnonURI(enableRMAnonURI); + } + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/MaximumRetransmissionCountAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/MaximumRetransmissionCountAssertionBuilder.java new file mode 100644 index 0000000..6534654 --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/MaximumRetransmissionCountAssertionBuilder.java @@ -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 org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class MaximumRetransmissionCountAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_MAX_RETRANS_COUNT }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + final int value = Integer.parseInt(element.getText().trim()); + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + propertyBean.setMaximumRetransmissionCount(value); + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/MessageTypesToDropAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/MessageTypesToDropAssertionBuilder.java new file mode 100644 index 0000000..9198c47 --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/MessageTypesToDropAssertionBuilder.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sandesha2.policy.builders; + +import java.util.ArrayList; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class MessageTypesToDropAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_MSG_TYPES_TO_DROP }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + final ArrayList<Integer> types = new ArrayList<Integer>(); + String str = element.getText().trim(); + String[] items = str.split(Sandesha2Constants.LIST_SEPERATOR); + if (items!=null) { + int size = items.length; + for (int i=0;i<size;i++) { + String itemStr = items[i]; + if (!itemStr.equals("") && !itemStr.equals(Sandesha2Constants.VALUE_NONE) ) + types.add(new Integer (itemStr)); + } + } + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + propertyBean.setMsgTypesToDrop(types); + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/RMAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/RMAssertionBuilder.java index 0aa9e85..404f100 100644 --- a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/RMAssertionBuilder.java +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/RMAssertionBuilder.java @@ -19,24 +19,19 @@ package org.apache.sandesha2.policy.builders; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - import javax.xml.namespace.QName; import org.apache.axiom.om.OMElement; -import org.apache.axis2.Constants; import org.apache.neethi.Assertion; import org.apache.neethi.AssertionBuilderFactory; import org.apache.neethi.Policy; +import org.apache.neethi.PolicyComponent; import org.apache.neethi.PolicyEngine; import org.apache.neethi.builders.AssertionBuilder; -import org.apache.neethi.builders.xml.XmlPrimtiveAssertion; import org.apache.sandesha2.Sandesha2Constants; import org.apache.sandesha2.policy.SandeshaPolicyBean; -public class RMAssertionBuilder implements AssertionBuilder { +public class RMAssertionBuilder implements AssertionBuilder<OMElement> { public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { @@ -44,7 +39,9 @@ public class RMAssertionBuilder implements AssertionBuilder { SandeshaPolicyBean propertyBean = new SandeshaPolicyBean(); Policy policy = PolicyEngine.getPolicy(element.getFirstElement()); - processElements(policy.getPolicyComponents(), propertyBean); + for (PolicyComponent component : policy.getPolicyComponents()) { + ((SandeshaPropertyAssertion)component).apply(propertyBean); + } return propertyBean; } @@ -52,125 +49,4 @@ public class RMAssertionBuilder implements AssertionBuilder { return new QName[] { new QName( Sandesha2Constants.Assertions.URI_RM_POLICY_NS, "RMAssertion") }; } - - private void processElements(List policyComponents, - SandeshaPolicyBean propertyBean) { - - XmlPrimtiveAssertion xmlPrimtiveAssertion; - - for (Iterator iterator = policyComponents.iterator(); iterator - .hasNext();) { - xmlPrimtiveAssertion = (XmlPrimtiveAssertion) iterator.next(); - OMElement element = xmlPrimtiveAssertion.getValue(); - String name = element.getLocalName(); - - if (Sandesha2Constants.Assertions.ELEM_ACK_INTERVAL.equals(name)) { - propertyBean.setAcknowledgementInterval(Long.parseLong(element - .getText().trim())); - - } else if (Sandesha2Constants.Assertions.ELEM_EXP_BACKOFF - .equals(name)) { - propertyBean.setExponentialBackoff(Boolean.valueOf( - element.getText().trim()).booleanValue()); - - } else if (Sandesha2Constants.Assertions.ELEM_INACTIVITY_TIMEOUT - .equals(name)) { - - propertyBean.setInactiveTimeoutValue (Long.parseLong(element - .getText().trim())); - - } else if (Sandesha2Constants.Assertions.ELEM_INACTIVITY_TIMEOUT_MEASURES - .equals(name)) { - //using the previously set Inactivity Timeout - propertyBean.setInactivityTimeoutMeasure (element.getText().trim()); - - } else if (Sandesha2Constants.Assertions.ELEM_DELETION_TIMEOUT - .equals(name)) { - - propertyBean.setSequenceRemovalTimeoutValue (Long.parseLong(element - .getText().trim())); - - } else if (Sandesha2Constants.Assertions.ELEM_DELETION_TIMEOUT_MEASURES - .equals(name)) { - //using the previously set Inavtivity Timeout - propertyBean.setSequenceRemovalTimeoutMeasure (element.getText().trim()); - - } else if (Sandesha2Constants.Assertions.ELEM_INVOKE_INORDER - .equals(name)) { - String value = element.getText().trim(); - boolean inOrder = false; - - if (value!=null && Constants.VALUE_TRUE.equals(value)) - inOrder = true; - - propertyBean.setInOrder(inOrder); - - } else if (Sandesha2Constants.Assertions.ELEM_MAX_RETRANS_COUNT - .equals(name)) { - propertyBean.setMaximumRetransmissionCount (Integer.parseInt(element.getText().trim())); - } else if (Sandesha2Constants.Assertions.ELEM_MSG_TYPES_TO_DROP - .equals(name)) { - ArrayList<Integer> types = new ArrayList<Integer>(); - String str = element.getText().trim(); - String[] items = str.split(Sandesha2Constants.LIST_SEPERATOR); - if (items!=null) { - int size = items.length; - for (int i=0;i<size;i++) { - String itemStr = items[i]; - if (!itemStr.equals("") && !itemStr.equals(Sandesha2Constants.VALUE_NONE) ) - types.add(new Integer (itemStr)); - } - } - propertyBean.setMsgTypesToDrop (types); - } else if (Sandesha2Constants.Assertions.ELEM_RETRANS_INTERVAL - .equals(name)) { - propertyBean.setRetransmissionInterval (Long.parseLong (element.getText().trim())); - } else if (Sandesha2Constants.Assertions.ELEM_SEC_MGR - .equals(name)) { - propertyBean.setSecurityManagerClass (element.getText().trim()); - } - else if (Sandesha2Constants.Assertions.ELEM_EPR_DECORATOR.equals(name)) { - propertyBean.setEPRDecoratorClass(element.getText().trim()); - } else if (Sandesha2Constants.Assertions.ELEM_STORAGE_MGR - .equals(name)) { - //finding out storage managers. - - OMElement inmemoryStorageManagerElem = element.getFirstChildWithName(Sandesha2Constants.Assertions.Q_ELEM_INMEMORY_STORAGE_MGR); - if (inmemoryStorageManagerElem!=null) { - String inMemoryStorageMgr = inmemoryStorageManagerElem.getText().trim(); - propertyBean.setInMemoryStorageManagerClass(inMemoryStorageMgr); - } - - OMElement permanentStorageManagerElem = element.getFirstChildWithName(Sandesha2Constants.Assertions.Q_ELEM_PERMANENT_STORAGE_MGR); - if (permanentStorageManagerElem!=null) { - String permanentStorageMgr = permanentStorageManagerElem.getText().trim(); - propertyBean.setPermanentStorageManagerClass(permanentStorageMgr); - } - } else if (Sandesha2Constants.Assertions.ELEM_CONTEXT_MGR.equals(name)) { - propertyBean.setContextManagerClass (element.getText().trim()); - - } else if(Sandesha2Constants.Assertions.ELEM_MAKE_CONNECTION.equals(name)) { - // Read the nested assertions - - OMElement enabledElem = element.getFirstChildWithName(Sandesha2Constants.Assertions.Q_ELEM_ENABLED); - if (enabledElem!=null) { - String data = enabledElem.getText().trim(); - propertyBean.setEnableMakeConnection(Boolean.valueOf(data).booleanValue()); - } - - OMElement useRMAnonElem = element.getFirstChildWithName(Sandesha2Constants.Assertions.Q_ELEM_USE_RM_ANON_URI); - if (useRMAnonElem!=null) { - String data = useRMAnonElem.getText().trim(); - propertyBean.setEnableRMAnonURI(Boolean.valueOf(data).booleanValue()); - } - } else if (Sandesha2Constants.Assertions.ELEM_USE_SERIALIZATION.equals(name)) { - String value = element.getText().trim(); - propertyBean.setUseMessageSerialization(Boolean.valueOf(value).booleanValue()); - } else if (Sandesha2Constants.Assertions.ELEM_ENFORCE_RM.equals(name)) { - String value = element.getText().trim(); - propertyBean.setEnforceRM (Boolean.valueOf(value).booleanValue()); - } - } - } - } diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/RetransmissionIntervalAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/RetransmissionIntervalAssertionBuilder.java new file mode 100644 index 0000000..b2fe8da --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/RetransmissionIntervalAssertionBuilder.java @@ -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 org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class RetransmissionIntervalAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_RETRANS_INTERVAL }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + final long value = Long.parseLong (element.getText().trim()); + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + propertyBean.setRetransmissionInterval(value); + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/SandeshaPropertyAssertion.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/SandeshaPropertyAssertion.java new file mode 100644 index 0000000..4da46ad --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/SandeshaPropertyAssertion.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; + +import org.apache.neethi.Assertion; +import org.apache.neethi.PolicyComponent; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public abstract class SandeshaPropertyAssertion implements Assertion { + public abstract void apply(SandeshaPolicyBean propertyBean); + + public QName getName() { + throw new UnsupportedOperationException(); + } + + public boolean isIgnorable() { + throw new UnsupportedOperationException(); + } + + public boolean isOptional() { + throw new UnsupportedOperationException(); + } + + public PolicyComponent normalize() { + throw new UnsupportedOperationException(); + } + + public void serialize(XMLStreamWriter writer) throws XMLStreamException { + throw new UnsupportedOperationException(); + } + + public boolean equal(PolicyComponent policyComponent) { + throw new UnsupportedOperationException(); + } + + public short getType() { + throw new UnsupportedOperationException(); + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/SecurityManagerAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/SecurityManagerAssertionBuilder.java new file mode 100644 index 0000000..70945d6 --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/SecurityManagerAssertionBuilder.java @@ -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 org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class SecurityManagerAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_SEC_MGR }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + final String value = element.getText().trim(); + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + propertyBean.setSecurityManagerClass(value); + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/SequenceRemovalTimeoutAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/SequenceRemovalTimeoutAssertionBuilder.java new file mode 100644 index 0000000..93c01a7 --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/SequenceRemovalTimeoutAssertionBuilder.java @@ -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 org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class SequenceRemovalTimeoutAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_SEQUENCE_REMOVAL_TIMEOUT }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + final long value = Long.parseLong(element.getText().trim()); + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + propertyBean.setSequenceRemovalTimeoutValue(value); + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/SequenceRemovalTimeoutMeasureAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/SequenceRemovalTimeoutMeasureAssertionBuilder.java new file mode 100644 index 0000000..2404607 --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/SequenceRemovalTimeoutMeasureAssertionBuilder.java @@ -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 org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class SequenceRemovalTimeoutMeasureAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_SEQUENCE_REMOVAL_TIMEOUT_MEASURES }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + final String value = element.getText().trim(); + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + propertyBean.setSequenceRemovalTimeoutMeasure(value); + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/StorageManagersAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/StorageManagersAssertionBuilder.java new file mode 100644 index 0000000..4ff3ad4 --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/StorageManagersAssertionBuilder.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class StorageManagersAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_STORAGE_MGR }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + OMElement inmemoryStorageManagerElem = element.getFirstChildWithName(Sandesha2Constants.Assertions.Q_ELEM_INMEMORY_STORAGE_MGR); + final String inMemoryStorageMgr = inmemoryStorageManagerElem == null ? null : inmemoryStorageManagerElem.getText().trim(); + + OMElement permanentStorageManagerElem = element.getFirstChildWithName(Sandesha2Constants.Assertions.Q_ELEM_PERMANENT_STORAGE_MGR); + final String permanentStorageMgr = permanentStorageManagerElem == null ? null : permanentStorageManagerElem.getText().trim(); + + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + propertyBean.setInMemoryStorageManagerClass(inMemoryStorageMgr); + propertyBean.setPermanentStorageManagerClass(permanentStorageMgr); + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/sandesha2/policy/builders/UseMessageSerializationAssertionBuilder.java b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/UseMessageSerializationAssertionBuilder.java new file mode 100644 index 0000000..8a0eed4 --- /dev/null +++ b/modules/core/src/main/java/org/apache/sandesha2/policy/builders/UseMessageSerializationAssertionBuilder.java @@ -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 org.apache.sandesha2.policy.builders; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.builders.AssertionBuilder; +import org.apache.sandesha2.Sandesha2Constants; +import org.apache.sandesha2.policy.SandeshaPolicyBean; + +public class UseMessageSerializationAssertionBuilder implements AssertionBuilder<OMElement> { + public QName[] getKnownElements() { + return new QName[] { Sandesha2Constants.Assertions.Q_ELEM_USE_SERIALIZATION }; + } + + public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException { + final boolean value = Boolean.valueOf(element.getText().trim()).booleanValue(); + return new SandeshaPropertyAssertion() { + public void apply(SandeshaPolicyBean propertyBean) { + propertyBean.setUseMessageSerialization(value); + } + }; + } +} diff --git a/modules/policy/src/main/resources/META-INF/services/org.apache.neethi.builders.AssertionBuilder b/modules/policy/src/main/resources/META-INF/services/org.apache.neethi.builders.AssertionBuilder index 5a69262..8034487 100644 --- a/modules/policy/src/main/resources/META-INF/services/org.apache.neethi.builders.AssertionBuilder +++ b/modules/policy/src/main/resources/META-INF/services/org.apache.neethi.builders.AssertionBuilder @@ -16,3 +16,21 @@ # under the License. org.apache.sandesha2.policy.builders.RMAssertionBuilder +org.apache.sandesha2.policy.builders.MessageTypesToDropAssertionBuilder +org.apache.sandesha2.policy.builders.SecurityManagerAssertionBuilder +org.apache.sandesha2.policy.builders.ExponentialBackoffAssertionBuilder +org.apache.sandesha2.policy.builders.SequenceRemovalTimeoutAssertionBuilder +org.apache.sandesha2.policy.builders.InactivityTimeoutMeasureAssertionBuilder +org.apache.sandesha2.policy.builders.AcknowledgementIntervalAssertionBuilder +org.apache.sandesha2.policy.builders.InvokeInOrderAssertionBuilder +org.apache.sandesha2.policy.builders.ContextManagerAssertionBuilder +org.apache.sandesha2.policy.builders.EnforceRMAssertionBuilder +org.apache.sandesha2.policy.builders.StorageManagersAssertionBuilder +org.apache.sandesha2.policy.builders.SandeshaPropertyAssertion +org.apache.sandesha2.policy.builders.RetransmissionIntervalAssertionBuilder +org.apache.sandesha2.policy.builders.MaximumRetransmissionCountAssertionBuilder +org.apache.sandesha2.policy.builders.SequenceRemovalTimeoutMeasureAssertionBuilder +org.apache.sandesha2.policy.builders.EPRDecoratorAssertionBuilder +org.apache.sandesha2.policy.builders.InactivityTimeoutAssertionBuilder +org.apache.sandesha2.policy.builders.MakeConnectionAssertionBuilder +org.apache.sandesha2.policy.builders.UseMessageSerializationAssertionBuilder diff --git a/pom.xml b/pom.xml index cc9cb94..9397d31 100644 --- a/pom.xml +++ b/pom.xml @@ -439,7 +439,7 @@ <axis2.version>1.6.1-SNAPSHOT</axis2.version> <rampart.version>1.6.1-SNAPSHOT</rampart.version> <axiom.version>1.2.12</axiom.version> - <neethi.version>2.0.5</neethi.version> + <neethi.version>3.0.1-SNAPSHOT</neethi.version> <commons.logging.version>1.1.1</commons.logging.version> <junit.version>3.8.2</junit.version> <log4j.version>1.2.15</log4j.version>