summaryrefslogtreecommitdiffstats
path: root/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/BlockingInterface.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/BlockingInterface.java)3
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianGroup.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GuardianGroup.java)5
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianGroupImplementation.java29
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianGroupImplementationFactory.java24
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianMember.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GuardianMember.java)13
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianPrimitives.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GuardianPrimitives.java)5
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/RecoveryRules.java (renamed from sandbox/dougsleite/policy-recoveryrules/src/main/java/org/apache/tuscany/sca/policy/recoveryrules/RecoveryRulesPolicy.java)25
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/ResolutionTrees.java32
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/ConcurrentExceptionOcurrenceException.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/ConcurrentExceptionOcurrenceException.java)4
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/Constants.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/Constants.java)3
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/Context.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/Context.java)2
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/GlobalException.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GlobalException.java)2
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/GlobalExceptionInterface.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GlobalExceptionInterface.java)2
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/InvalidNodeException.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/InvalidNodeException.java)2
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/InvalidRegularExpressionException.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/InvalidRegularExpression.java)8
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/JoinException.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/JoinException.java)4
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/LeaveException.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/LeaveException.java)4
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/ResolutionTreeUtils.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/ResolutionTreeUtils.java)2
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/SuspendException.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/SuspendException.java)4
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/UnhandledException.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/UnhandledException.java)2
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/GuardianGroupImpl.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GuardianGroupImpl.java)61
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/GuardianGroupImplementationFactoryImpl.java43
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/GuardianGroupImplementationImpl.java134
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/GuardianMemberImpl.java (renamed from sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GuardianMemberImpl.java)29
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/RecoveryRulesImpl.java33
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/ResolutionTreesImpl.java (renamed from sandbox/dougsleite/policy-resolutiontrees/src/main/java/org/apache/tuscany/sca/policy/resolutiontrees/ResolutionTreesPolicy.java)22
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/provider/GuardianGroupImplementationProvider.java115
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/provider/GuardianGroupImplementationProviderFactory.java38
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/provider/GuardianGroupInvoker.java163
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/xml/GuardianGroupImplementationProcessor.java144
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/xml/RecoveryRulesProcessor.java (renamed from sandbox/dougsleite/policy-recoveryrules/src/main/java/org/apache/tuscany/sca/policy/recoveryrules/RecoveryRulesPolicyProcessor.java)31
-rw-r--r--sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/xml/ResolutionTreesProcessor.java (renamed from sandbox/dougsleite/policy-resolutiontrees/src/main/java/org/apache/tuscany/sca/policy/resolutiontrees/ResolutionTreesPolicyProcessor.java)30
32 files changed, 870 insertions, 148 deletions
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/BlockingInterface.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/BlockingInterface.java
index 848c4a874d..1bb1066435 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/BlockingInterface.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/BlockingInterface.java
@@ -16,8 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian;
+@Deprecated
public interface BlockingInterface {
//@OneWay
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GuardianGroup.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianGroup.java
index 5119390a14..2775699843 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GuardianGroup.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianGroup.java
@@ -16,11 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian;
-import org.osoa.sca.annotations.Remotable;
-
-//@Remotable
public interface GuardianGroup extends GuardianPrimitives {
public static int NORMAL_PARTICIPANT_STATE = 0;
diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianGroupImplementation.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianGroupImplementation.java
new file mode 100644
index 0000000000..cb7495f9e4
--- /dev/null
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianGroupImplementation.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.guardian;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.assembly.Implementation;
+
+public interface GuardianGroupImplementation extends Implementation {
+
+ public void setGuardianProperties(OMElement guardianProperties);
+
+ public OMElement getGuardianProperties();
+}
diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianGroupImplementationFactory.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianGroupImplementationFactory.java
new file mode 100644
index 0000000000..d0758753b3
--- /dev/null
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianGroupImplementationFactory.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.guardian;
+
+public interface GuardianGroupImplementationFactory {
+
+ public GuardianGroupImplementation createGuardianGroupImplementation();
+}
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GuardianMember.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianMember.java
index 48dad22bff..b82bf082b1 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GuardianMember.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianMember.java
@@ -16,19 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian;
+
+import org.apache.tuscany.sca.implementation.guardian.common.Context;
+import org.apache.tuscany.sca.implementation.guardian.common.GlobalException;
public interface GuardianMember extends GuardianPrimitives {
public void addException(GlobalException ex);
- public void setService(BlockingInterface service);
-
- public void removeService();
-
- public Context getCurrentContext();
-
- public BlockingInterface getService();
+ public Context getCurrentContext();
public String getParticipantIdentifier();
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GuardianPrimitives.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianPrimitives.java
index 9ddd22a2fd..c50e855d30 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GuardianPrimitives.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/GuardianPrimitives.java
@@ -16,9 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian;
import java.util.List;
+import org.apache.tuscany.sca.implementation.guardian.common.Context;
+import org.apache.tuscany.sca.implementation.guardian.common.GlobalException;
+import org.apache.tuscany.sca.implementation.guardian.common.GlobalExceptionInterface;
//@Remotable
public interface GuardianPrimitives {
diff --git a/sandbox/dougsleite/policy-recoveryrules/src/main/java/org/apache/tuscany/sca/policy/recoveryrules/RecoveryRulesPolicy.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/RecoveryRules.java
index a2497935e2..4757615c21 100644
--- a/sandbox/dougsleite/policy-recoveryrules/src/main/java/org/apache/tuscany/sca/policy/recoveryrules/RecoveryRulesPolicy.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/RecoveryRules.java
@@ -16,34 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.policy.recoveryrules;
+package org.apache.tuscany.sca.implementation.guardian;
-import java.util.Hashtable;
import java.util.Map;
import javax.xml.namespace.QName;
import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.policy.Policy;
import org.apache.tuscany.sca.assembly.xml.Constants;
-public class RecoveryRulesPolicy implements Policy {
+public interface RecoveryRules {
public static final QName RECOVERY_RULES_POLICY_QNAME =
- new QName(Constants.SCA10_TUSCANY_NS, org.apache.tuscany.sca.guardian.Constants.RECOVERY_RULES);
-
- private Map<String, OMElement> ruleElements = new Hashtable<String, OMElement>();
+ new QName(Constants.SCA10_TUSCANY_NS, org.apache.tuscany.sca.implementation.guardian.common.Constants.RECOVERY_RULES);
- public QName getSchemaName() {
- return RECOVERY_RULES_POLICY_QNAME;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public Map<String, OMElement> getRuleElements() {
- return ruleElements;
- }
+ public Map<String, OMElement> getRuleElements();
}
diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/ResolutionTrees.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/ResolutionTrees.java
new file mode 100644
index 0000000000..d35deff75a
--- /dev/null
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/ResolutionTrees.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.guardian;
+
+import java.util.Map;
+import javax.xml.namespace.QName;
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+public interface ResolutionTrees {
+
+ public static final QName RESOLUTION_TREES_POLICY_QNAME =
+ new QName(Constants.SCA10_TUSCANY_NS, org.apache.tuscany.sca.implementation.guardian.common.Constants.RESOLUTION_TREES);
+
+ public Map<String, OMElement> getResolutionTreeElements();
+}
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/ConcurrentExceptionOcurrenceException.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/ConcurrentExceptionOcurrenceException.java
index 30584f2d78..4bfe1320b4 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/ConcurrentExceptionOcurrenceException.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/ConcurrentExceptionOcurrenceException.java
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian.common;
-class ConcurrentExceptionOcurrenceException extends Exception {
+public class ConcurrentExceptionOcurrenceException extends Exception {
public ConcurrentExceptionOcurrenceException() {
super();
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/Constants.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/Constants.java
index 9fa4db4f78..cf5d56179d 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/Constants.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/Constants.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian.common;
import javax.xml.namespace.QName;
@@ -78,4 +78,5 @@ public interface Constants {
String EXCEPTION = "exception";
QName EXCEPTION_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, EXCEPTION);
+
}
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/Context.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/Context.java
index 3ac5d63a42..95c6f3bed6 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/Context.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/Context.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian.common;
import java.util.LinkedList;
import java.util.List;
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GlobalException.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/GlobalException.java
index b880db6aa1..022fe1a5f8 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GlobalException.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/GlobalException.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian.common;
import java.util.LinkedList;
import java.util.List;
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GlobalExceptionInterface.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/GlobalExceptionInterface.java
index 68a09a9bc8..450d4ae18b 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GlobalExceptionInterface.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/GlobalExceptionInterface.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian.common;
import java.util.List;
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/InvalidNodeException.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/InvalidNodeException.java
index 3df76b0596..ed85661dbf 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/InvalidNodeException.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/InvalidNodeException.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian.common;
public class InvalidNodeException extends RuntimeException {
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/InvalidRegularExpression.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/InvalidRegularExpressionException.java
index 30e750941e..99aa027fb8 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/InvalidRegularExpression.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/InvalidRegularExpressionException.java
@@ -16,15 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian.common;
-public class InvalidRegularExpression extends RuntimeException {
+public class InvalidRegularExpressionException extends RuntimeException {
- public InvalidRegularExpression() {
+ public InvalidRegularExpressionException() {
super();
}
- public InvalidRegularExpression(String message) {
+ public InvalidRegularExpressionException(String message) {
super(message);
}
}
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/JoinException.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/JoinException.java
index b14ebeac2b..890b8704ee 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/JoinException.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/JoinException.java
@@ -17,9 +17,9 @@
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian.common;
-class JoinException extends GlobalException {
+public class JoinException extends GlobalException {
public JoinException() {
super();
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/LeaveException.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/LeaveException.java
index 04e892f4bd..9684de22ad 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/LeaveException.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/LeaveException.java
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian.common;
-class LeaveException extends GlobalException {
+public class LeaveException extends GlobalException {
public LeaveException() {
super();
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/ResolutionTreeUtils.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/ResolutionTreeUtils.java
index 09dd0673eb..fbf147285e 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/ResolutionTreeUtils.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/ResolutionTreeUtils.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian.common;
import java.util.Collections;
import java.util.Hashtable;
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/SuspendException.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/SuspendException.java
index b7ede6d530..5ce2f5afd9 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/SuspendException.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/SuspendException.java
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian.common;
-class SuspendException extends GlobalException {
+public class SuspendException extends GlobalException {
public SuspendException() {
super();
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/UnhandledException.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/UnhandledException.java
index 81e3844280..a8f9cdfad6 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/UnhandledException.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/UnhandledException.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian.common;
public class UnhandledException extends GlobalException {
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GuardianGroupImpl.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/GuardianGroupImpl.java
index f9fe5c2c59..5a243560e3 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GuardianGroupImpl.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/GuardianGroupImpl.java
@@ -16,10 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian.impl;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.policy.resolutiontrees.ResolutionTreesPolicyProcessor;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Iterator;
@@ -33,13 +31,21 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMElement;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-import org.apache.tuscany.sca.policy.recoveryrules.RecoveryRulesPolicyProcessor;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.implementation.guardian.common.InvalidRegularExpressionException;
+import org.apache.tuscany.sca.implementation.guardian.GuardianGroup;
+import org.apache.tuscany.sca.implementation.guardian.GuardianMember;
+import org.apache.tuscany.sca.implementation.guardian.common.ConcurrentExceptionOcurrenceException;
+import org.apache.tuscany.sca.implementation.guardian.common.Constants;
+import org.apache.tuscany.sca.implementation.guardian.common.Context;
+import org.apache.tuscany.sca.implementation.guardian.common.GlobalException;
+import org.apache.tuscany.sca.implementation.guardian.common.GlobalExceptionInterface;
+import org.apache.tuscany.sca.implementation.guardian.common.InvalidNodeException;
+import org.apache.tuscany.sca.implementation.guardian.common.ResolutionTreeUtils;
+import org.apache.tuscany.sca.implementation.guardian.common.SuspendException;
+import org.apache.tuscany.sca.implementation.guardian.xml.RecoveryRulesProcessor;
+import org.apache.tuscany.sca.implementation.guardian.xml.ResolutionTreesProcessor;
-@Service(GuardianGroup.class)
-@Scope("COMPOSITE")
public class GuardianGroupImpl implements GuardianGroup {
private List<GuardianMember> guardianList;
@@ -49,20 +55,22 @@ public class GuardianGroupImpl implements GuardianGroup {
private ResolutionTreeUtils resolutionTreeUtils;
private Map<String, OMElement> ruleElements;
- public GuardianGroupImpl() {
+ public GuardianGroupImpl(String recoveryRules, String resolutionTrees) {
guardianList = new LinkedList<GuardianMember>();
concurrentExList = new LinkedList<GlobalExceptionInterface>();
innerThread = new InnerGuardianGroupThread();
resolutionTreeUtils = new ResolutionTreeUtils();
+
+ setRecoveryRules(recoveryRules);
+ setResolutionTree(resolutionTrees);
}
- @Property(name = "recovery_rules", required = false)
- public void setRecoveryRules(String recoveryRules) {
+ private void setRecoveryRules(String recoveryRules) {
try {
FileInputStream fileInputStream = new FileInputStream(recoveryRules);
XMLStreamReader xmlReader = XMLInputFactory.newInstance().createXMLStreamReader(fileInputStream);
- RecoveryRulesPolicyProcessor processor = new RecoveryRulesPolicyProcessor(null, null);
+ RecoveryRulesProcessor processor = new RecoveryRulesProcessor();
ruleElements = processor.read(xmlReader).getRuleElements();
} catch (ContributionReadException ex) {
@@ -74,14 +82,13 @@ public class GuardianGroupImpl implements GuardianGroup {
}
}
- @Property(name = "resolution_tree", required = false)
- public void setResolutionTree(String resolutionTree) {
+ private void setResolutionTree(String resolutionTree) {
try {
FileInputStream fileInputStream = new FileInputStream(resolutionTree);
XMLStreamReader resolutionTreeReader = XMLInputFactory.newInstance().createXMLStreamReader(fileInputStream);
- ResolutionTreesPolicyProcessor processor = new ResolutionTreesPolicyProcessor(null, null);
+ ResolutionTreesProcessor processor = new ResolutionTreesProcessor();
resolutionTreeElements = processor.read(resolutionTreeReader).getResolutionTreeElements();
} catch (ContributionReadException ex) {
@@ -98,9 +105,12 @@ public class GuardianGroupImpl implements GuardianGroup {
guardianMember.setUniqueParticipantID(guardianList.size() - 1);
}
+ public boolean removeGuardianMember(GuardianMember guardianMember) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
public void enableContext(Context context) {
- System.out.println("Enable Context.. nothing to do!");
- //throw new UnsupportedOperationException("Not supported yet.");
+ throw new UnsupportedOperationException("Not supported yet.");
}
public void removeContext() {
@@ -132,6 +142,7 @@ public class GuardianGroupImpl implements GuardianGroup {
innerThread.setGlobalException(ex);
new Thread(innerThread).start();
}
+
}
public boolean propagate(GlobalExceptionInterface ex) {
@@ -142,10 +153,6 @@ public class GuardianGroupImpl implements GuardianGroup {
throw new UnsupportedOperationException("Not supported yet.");
}
- public boolean removeGuardianMember(GuardianMember guardianMember) {
- return this.guardianList.remove(guardianMember);
- }
-
private class InnerGuardianGroupThread implements Runnable {
private boolean isRunning;
@@ -485,7 +492,7 @@ public class GuardianGroupImpl implements GuardianGroup {
//Invalid regular expression
if (splitByComma.length > 2) {
- throw new InvalidRegularExpression("The comma ',' operator can only be applied for two expressions");
+ throw new InvalidRegularExpressionException("The comma ',' operator can only be applied for two expressions");
}
//There is no comma on the regular expression
@@ -533,7 +540,7 @@ public class GuardianGroupImpl implements GuardianGroup {
//Invalid expression
if (index == -1) {
- throw new InvalidRegularExpression("The comma ',' requires a SIGNALER or !SIGNALER element in one side of the expression");
+ throw new InvalidRegularExpressionException("The comma ',' requires a SIGNALER or !SIGNALER element in one side of the expression");
}
String re = createJavaRegularExpression(splitByComma[1 - index]);
@@ -570,7 +577,7 @@ public class GuardianGroupImpl implements GuardianGroup {
*
* Not supported yet: !<Context>, !<Context> || <Context>, !(<Context> || <Context>)
*/
- private String createJavaRegularExpression(String regularExpression) throws InvalidRegularExpression {
+ private String createJavaRegularExpression(String regularExpression) throws InvalidRegularExpressionException {
StringBuffer re = new StringBuffer();
String[] splitByBar = regularExpression.split("\\|\\|");
@@ -592,7 +599,7 @@ public class GuardianGroupImpl implements GuardianGroup {
//Validate the regular expression
if (j + 1 != splitByPeriod.length && splitByPeriod[j + 1].equals("*")) {
- throw new InvalidRegularExpression();
+ throw new InvalidRegularExpressionException();
}
//*
@@ -634,4 +641,4 @@ public class GuardianGroupImpl implements GuardianGroup {
return re.toString();
}
}
-} \ No newline at end of file
+}
diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/GuardianGroupImplementationFactoryImpl.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/GuardianGroupImplementationFactoryImpl.java
new file mode 100644
index 0000000000..cf6b3245ce
--- /dev/null
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/GuardianGroupImplementationFactoryImpl.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.tuscany.sca.implementation.guardian.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.guardian.GuardianGroupImplementation;
+import org.apache.tuscany.sca.implementation.guardian.GuardianGroupImplementationFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+public class GuardianGroupImplementationFactoryImpl implements GuardianGroupImplementationFactory {
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+
+ public GuardianGroupImplementationFactoryImpl(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
+ this.assemblyFactory = assemblyFactory;
+ this.javaFactory = javaFactory;
+ }
+
+ public GuardianGroupImplementation createGuardianGroupImplementation() {
+ return new GuardianGroupImplementationImpl(assemblyFactory, javaFactory);
+ }
+
+// public GuardianGroupImplementation createGuardianGroupImplementation() {
+// return new GuardianGroupImplementationImpl();
+// }
+}
diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/GuardianGroupImplementationImpl.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/GuardianGroupImplementationImpl.java
new file mode 100644
index 0000000000..7520846d55
--- /dev/null
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/GuardianGroupImplementationImpl.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.guardian.impl;
+
+import org.apache.tuscany.sca.implementation.guardian.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+public class GuardianGroupImplementationImpl implements GuardianGroupImplementation {
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+ private List<Service> services = new ArrayList<Service>();
+ private OMElement guardianProperties;
+
+ public GuardianGroupImplementationImpl(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory) {
+
+ this.assemblyFactory = assemblyFactory;
+ this.javaFactory = javaFactory;
+ this.guardianProperties = null;
+ }
+
+ private void introspectServices(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
+
+ Service guardianService = assemblyFactory.createService();
+
+ guardianService.setName("GuardianGroup");
+
+ JavaInterface guardianInterface;
+
+ try {
+ guardianInterface = javaFactory.createJavaInterface(GuardianGroup.class);
+ } catch (InvalidInterfaceException ex) {
+ throw new IllegalArgumentException(ex);
+ }
+
+ JavaInterfaceContract guardianInterfaceContract = javaFactory.createJavaInterfaceContract();
+
+ guardianInterfaceContract.setInterface(guardianInterface);
+
+ guardianService.setInterfaceContract(guardianInterfaceContract);
+
+ services.add(guardianService);
+ }
+
+ public void setGuardianProperties(OMElement guardianProperties) {
+ this.guardianProperties = guardianProperties;
+ }
+
+ public OMElement getGuardianProperties() {
+ return this.guardianProperties;
+ }
+
+ @Override
+ public String getURI() {
+ // The Guardian Model implementation does not have a URI
+ return null;
+ }
+
+ @Override
+ public void setURI(String arg0) {
+ // The Guardian Model implementation does not have a URI
+ }
+
+ @Override
+ public List<Service> getServices() {
+ if (services == null || services.size() == 0) {
+ introspectServices(assemblyFactory, javaFactory);
+ }
+ return services;
+ }
+
+ @Override
+ public List<Reference> getReferences() {
+ // The Guardian Model implementation does not support references
+ return Collections.emptyList();
+ }
+
+ @Override
+ public List<Property> getProperties() {
+ // The sample DATA implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ @Override
+ public ConstrainingType getConstrainingType() {
+ // The Guardian Model implementation does not support constrainingTypes
+ return null;
+ }
+
+ @Override
+ public void setConstrainingType(ConstrainingType arg0) {
+ // The Guardian Model implementation does not support constrainingTypes
+ }
+
+ @Override
+ public boolean isUnresolved() {
+ // The Guardian Model implementation is always resolved
+ return false;
+ }
+
+ @Override
+ public void setUnresolved(boolean arg0) {
+ // The Guardian Model implementation is always resolved
+ }
+}
diff --git a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GuardianMemberImpl.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/GuardianMemberImpl.java
index 893d5fcb1b..80b9321e79 100644
--- a/sandbox/dougsleite/guardian-model/src/main/java/org/apache/tuscany/sca/guardian/GuardianMemberImpl.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/GuardianMemberImpl.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.guardian;
+package org.apache.tuscany.sca.implementation.guardian.impl;
import java.util.LinkedList;
import java.util.List;
@@ -24,10 +24,17 @@ import java.util.Queue;
import java.util.Stack;
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.apache.tuscany.sca.implementation.guardian.common.GlobalExceptionInterface;
+import org.apache.tuscany.sca.implementation.guardian.GuardianGroup;
+import org.apache.tuscany.sca.implementation.guardian.GuardianMember;
+import org.apache.tuscany.sca.implementation.guardian.common.Context;
+import org.apache.tuscany.sca.implementation.guardian.common.GlobalException;
+import org.apache.tuscany.sca.implementation.guardian.common.JoinException;
+import org.apache.tuscany.sca.implementation.guardian.common.SuspendException;
+import org.osoa.sca.annotations.Destroy;
import org.osoa.sca.annotations.Init;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Destroy;
import org.osoa.sca.annotations.Service;
@Service(GuardianMember.class)
@@ -36,7 +43,7 @@ public class GuardianMemberImpl implements GuardianMember {
private int participantState;
private Stack<Context> contextList;
- private BlockingInterface service;
+
private Queue<GlobalException> exceptionQueue;
@Reference(name = "guardian_group", required = true)
public GuardianGroup guardianGroup;
@@ -66,17 +73,10 @@ public class GuardianMemberImpl implements GuardianMember {
exceptionQueue.add(ex);
}
- public void setService(BlockingInterface service) {
- this.service = service;
- }
-
public Context getCurrentContext() {
return contextList.peek();
}
-
- public BlockingInterface getService() {
- return service;
- }
+
public void enableContext(Context context) {
//Update the context list with the related set of exceptions
@@ -109,9 +109,6 @@ public class GuardianMemberImpl implements GuardianMember {
guardianGroup.gthrow(ex, participantList);
exceptionThrown = true;
} else {
- /*if (service instanceof BlockingInterface && !service.isBlocked()) {
- service.block();
- }*/
setParticipantState(GuardianGroup.SUSPENDED_PARTICIPANT_STATE);
}
}
@@ -170,10 +167,6 @@ public class GuardianMemberImpl implements GuardianMember {
this.id = id;
}
- public void removeService() {
- this.service = null;
- }
-
public int getParticipantState() {
return participantState;
}
diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/RecoveryRulesImpl.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/RecoveryRulesImpl.java
new file mode 100644
index 0000000000..e2fc2f8048
--- /dev/null
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/RecoveryRulesImpl.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.guardian.impl;
+
+import org.apache.tuscany.sca.implementation.guardian.RecoveryRules;
+import java.util.Hashtable;
+import java.util.Map;
+import org.apache.axiom.om.OMElement;
+
+public class RecoveryRulesImpl implements RecoveryRules {
+
+ private Map<String, OMElement> ruleElements = new Hashtable<String, OMElement>();
+
+ public Map<String, OMElement> getRuleElements() {
+ return ruleElements;
+ }
+}
diff --git a/sandbox/dougsleite/policy-resolutiontrees/src/main/java/org/apache/tuscany/sca/policy/resolutiontrees/ResolutionTreesPolicy.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/ResolutionTreesImpl.java
index 2a2972c8ca..669f06b1ef 100644
--- a/sandbox/dougsleite/policy-resolutiontrees/src/main/java/org/apache/tuscany/sca/policy/resolutiontrees/ResolutionTreesPolicy.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/impl/ResolutionTreesImpl.java
@@ -16,33 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.policy.resolutiontrees;
+package org.apache.tuscany.sca.implementation.guardian.impl;
import java.util.Hashtable;
import java.util.Map;
-import javax.xml.namespace.QName;
import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.policy.Policy;
-import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.implementation.guardian.ResolutionTrees;
-public class ResolutionTreesPolicy implements Policy {
-
- public static final QName RESOLUTION_TREES_POLICY_QNAME =
- new QName(Constants.SCA10_TUSCANY_NS, org.apache.tuscany.sca.guardian.Constants.RESOLUTION_TREES);
+public class ResolutionTreesImpl implements ResolutionTrees {
private Map<String, OMElement> resolutionTreeElements = new Hashtable<String, OMElement>();
- public QName getSchemaName() {
- return RESOLUTION_TREES_POLICY_QNAME;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
public Map<String, OMElement> getResolutionTreeElements() {
return resolutionTreeElements;
}
diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/provider/GuardianGroupImplementationProvider.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/provider/GuardianGroupImplementationProvider.java
new file mode 100644
index 0000000000..2eb3dbdf58
--- /dev/null
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/provider/GuardianGroupImplementationProvider.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.guardian.provider;
+
+import org.apache.tuscany.sca.implementation.guardian.impl.*;
+import java.util.Iterator;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.implementation.guardian.GuardianGroup;
+import org.apache.tuscany.sca.implementation.guardian.GuardianGroupImplementation;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.implementation.guardian.common.Constants;
+
+public class GuardianGroupImplementationProvider implements ImplementationProvider {
+
+ private GuardianGroupImplementation implementation;
+ private GuardianGroupImpl guardian;
+
+ public GuardianGroupImplementationProvider(RuntimeComponent component, GuardianGroupImplementation implementation) {
+ this.implementation = implementation;
+ this.guardian = createGuardian(implementation.getGuardianProperties());
+ }
+
+ private GuardianGroupImpl createGuardian(OMElement guardianProperties) {
+ GuardianGroupImpl guardian = null;
+
+ String recoveryRules = null;
+ String resolutionTrees = null;
+
+ OMAttribute at;
+ Iterator it = guardianProperties.getAllAttributes();
+ while (it.hasNext()) {
+ at = (OMAttribute) it.next();
+
+ if (at.getLocalName().equals(Constants.RECOVERY_RULES)) {
+ recoveryRules = at.getAttributeValue();
+ } else if (at.getLocalName().equals(Constants.RESOLUTION_TREES)) {
+ resolutionTrees = at.getAttributeValue();
+ }
+ }
+
+ if (recoveryRules != null && resolutionTrees != null) {
+ guardian = new GuardianGroupImpl(recoveryRules, resolutionTrees);
+ }
+
+ return guardian;
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ String operationName = operation.getName();
+ String interfaceFullName = operation.getInterface().toString();
+
+ //GuardianGroup interface
+ if (interfaceFullName.equals(GuardianGroup.class.getName())) {
+
+ //Why is the createInvoker ivoked 'n' static inner class times?
+ //System.out.println("NAME: " + operationName);
+
+ //public void addGuardianMember(GuardianMember guardianMember)
+ if (operationName.equals("addGuardianMember")) {
+ return new GuardianGroupInvoker.AddGuardianMemberInvoker(guardian);
+ } //public boolean removeGuardianMember(GuardianMember guardianMember)
+ else if (operationName.equals("removeGuardianMember")) {
+ return new GuardianGroupInvoker.RemoveGuardianMemberInvoker(guardian);
+ } //public void enableContext(Context context);
+ else if (operationName.equals("enableContext")) {
+ return new GuardianGroupInvoker.EnableContextInvoker(guardian);
+ } //public void removeContext();
+ else if (operationName.equals("removeContext")) {
+ return new GuardianGroupInvoker.RemoveContextInvoker(guardian);
+ } //public void gthrow(GlobalExceptionInterface ex, List<String> participantList);
+ else if (operationName.equals("gthrow")) {
+ return new GuardianGroupInvoker.GthrowInvoker(guardian);
+ } //public boolean propagate(GlobalExceptionInterface ex);
+ else if (operationName.equals("propagate")) {
+ return new GuardianGroupInvoker.PropagateInvoker(guardian);
+ } //public void checkExceptionStatus() throws GlobalException;
+ else if (operationName.equals("checkExceptionStatus")) {
+ return new GuardianGroupInvoker.CheckExceptionStatusInvoker(guardian);
+ }
+ }
+
+ return new GuardianGroupInvoker(null);
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+}
diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/provider/GuardianGroupImplementationProviderFactory.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/provider/GuardianGroupImplementationProviderFactory.java
new file mode 100644
index 0000000000..a42c35506d
--- /dev/null
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/provider/GuardianGroupImplementationProviderFactory.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.guardian.provider;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.implementation.guardian.GuardianGroupImplementation;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+public class GuardianGroupImplementationProviderFactory implements ImplementationProviderFactory<GuardianGroupImplementation> {
+ public GuardianGroupImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, GuardianGroupImplementation implementation) {
+ return new GuardianGroupImplementationProvider(component, implementation);
+ }
+
+ public Class<GuardianGroupImplementation> getModelType() {
+ return GuardianGroupImplementation.class;
+ }
+}
diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/provider/GuardianGroupInvoker.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/provider/GuardianGroupInvoker.java
new file mode 100644
index 0000000000..8f393ebcb9
--- /dev/null
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/provider/GuardianGroupInvoker.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.guardian.provider;
+
+import org.apache.tuscany.sca.implementation.guardian.impl.*;
+import java.util.List;
+import org.apache.tuscany.sca.implementation.guardian.GuardianMember;
+import org.apache.tuscany.sca.implementation.guardian.common.Context;
+import org.apache.tuscany.sca.implementation.guardian.common.GlobalExceptionInterface;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+public class GuardianGroupInvoker implements Invoker {
+
+ protected final GuardianGroupImpl guardian;
+
+ public GuardianGroupInvoker(GuardianGroupImpl guardian) {
+ this.guardian = guardian;
+ }
+
+ public Message invoke(Message arg0) {
+ throw new UnsupportedOperationException("Not supported yet. 1");
+ }
+
+ //AddGuardianMember operation invoker
+ public static class AddGuardianMemberInvoker extends GuardianGroupInvoker {
+
+ public AddGuardianMemberInvoker(GuardianGroupImpl guardian) {
+ super(guardian);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ GuardianMember guardianMember = (GuardianMember) ((Object[]) msg.getBody())[0];
+ this.guardian.addGuardianMember(guardianMember);
+
+ return msg;
+ }
+ }
+
+ //RemoveGuardianMember operation invoker
+ public static class RemoveGuardianMemberInvoker extends GuardianGroupInvoker {
+
+ public RemoveGuardianMemberInvoker(GuardianGroupImpl guardian) {
+ super(guardian);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ GuardianMember guardianMember = (GuardianMember) ((Object[]) msg.getBody())[0];
+ boolean returnedValue = this.guardian.removeGuardianMember(guardianMember);
+
+ msg.setBody(returnedValue);
+ return msg;
+ }
+ }
+
+ //EnableContext operation invoker
+ public static class EnableContextInvoker extends GuardianGroupInvoker {
+
+ public EnableContextInvoker(GuardianGroupImpl guardian) {
+ super(guardian);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ Context context = (Context) ((Object[]) msg.getBody())[0];
+
+ this.guardian.enableContext(context);
+
+ return msg;
+ }
+ }
+
+ //RemoveContext operation invoker
+ public static class RemoveContextInvoker extends GuardianGroupInvoker {
+
+ public RemoveContextInvoker(GuardianGroupImpl guardian) {
+ super(guardian);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ this.guardian.removeContext();
+
+ return msg;
+ }
+ }
+
+ //Gthrow operation invoker
+ public static class GthrowInvoker extends GuardianGroupInvoker {
+
+ public GthrowInvoker(GuardianGroupImpl guardian) {
+ super(guardian);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ GlobalExceptionInterface ex = (GlobalExceptionInterface) ((Object[]) msg.getBody())[0];
+ List<String> participantList = (List<String>) ((Object[]) msg.getBody())[1];
+
+ this.guardian.gthrow(ex, participantList);
+
+ return msg;
+ }
+ }
+
+ //Propagate operation invoker
+ public static class PropagateInvoker extends GuardianGroupInvoker {
+
+ public PropagateInvoker(GuardianGroupImpl guardian) {
+ super(guardian);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ GlobalExceptionInterface ex = (GlobalExceptionInterface) ((Object[]) msg.getBody())[0];
+
+ boolean needPropagation = this.guardian.propagate(ex);
+ msg.setBody(needPropagation);
+
+ return msg;
+ }
+ }
+
+ //CheckExceptionStatus operation invoker
+ public static class CheckExceptionStatusInvoker extends GuardianGroupInvoker {
+
+ public CheckExceptionStatusInvoker(GuardianGroupImpl guardian) {
+ super(guardian);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ this.guardian.checkExceptionStatus();
+
+ return msg;
+ }
+ }
+}
diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/xml/GuardianGroupImplementationProcessor.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/xml/GuardianGroupImplementationProcessor.java
new file mode 100644
index 0000000000..048ef7b9c8
--- /dev/null
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/xml/GuardianGroupImplementationProcessor.java
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.guardian.xml;
+
+import org.apache.tuscany.sca.implementation.guardian.*;
+import java.util.Iterator;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+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.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.implementation.guardian.impl.GuardianGroupImplementationFactoryImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+public class GuardianGroupImplementationProcessor implements StAXArtifactProcessor<GuardianGroupImplementation> {
+
+ protected static final QName IMPLEMENTATION_GUARDIAN = new QName(Constants.SCA10_TUSCANY_NS, "implementation.guardian");
+ protected static final QName GUARDIAN_PROPERTIES = new QName(Constants.SCA10_TUSCANY_NS, "guardianProperties");
+ private GuardianGroupImplementationFactory guardianGroupImplementationFactory;
+
+ private AssemblyFactory assemblyFactor;
+ private JavaInterfaceFactory javaFactory;
+
+ //public GuardianGroupImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ //public GuardianGroupImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
+ public GuardianGroupImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+
+ assemblyFactor = modelFactories.getFactory(AssemblyFactory.class);
+ javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+
+ guardianGroupImplementationFactory = new GuardianGroupImplementationFactoryImpl(assemblyFactor, javaFactory);
+ //guardianGroupImplementationFactory = modelFactories.getFactory(GuardianGroupImplementationFactory.class);
+ }
+
+ public GuardianGroupImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ assert IMPLEMENTATION_GUARDIAN.equals(reader.getName());
+
+ GuardianGroupImplementation implementation = guardianGroupImplementationFactory.createGuardianGroupImplementation();
+
+ while (reader.hasNext()) {
+ reader.next();
+
+ if (reader.isStartElement() && reader.getName().equals(GUARDIAN_PROPERTIES)) {
+ OMElement guardianPropertiesElement = readGuardianProperties(reader);
+
+ //REVIEW
+ implementation.setGuardianProperties(guardianPropertiesElement);
+
+ break;
+ }
+ }
+
+ return implementation;
+ }
+
+ private OMElement readGuardianProperties(XMLStreamReader reader) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMElement element = fac.createOMElement(reader.getName());
+
+ for (int i = 0; i < reader.getAttributeCount(); i++) {
+
+ String ns = reader.getAttributeNamespace(i);
+ String prefix = reader.getAttributePrefix(i);
+ String qname = reader.getAttributeLocalName(i);
+ String value = reader.getAttributeValue(i);
+
+ if (ns != null) {
+ element.addAttribute(qname, value, fac.createOMNamespace(ns, prefix));
+ element.declareNamespace(ns, prefix);
+ } else {
+ element.addAttribute(qname, value, null);
+ }
+ }
+
+ return element;
+ }
+
+ public void write(GuardianGroupImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ writer.writeStartElement(IMPLEMENTATION_GUARDIAN.getNamespaceURI(), IMPLEMENTATION_GUARDIAN.getLocalPart());
+
+ OMElement guardianProperties = implementation.getGuardianProperties();
+ if (guardianProperties != null) {
+ writeGuardianProperties(guardianProperties, writer);
+ }
+
+ writer.writeEndElement();
+ }
+
+ private void writeGuardianProperties(OMElement guardianProperties, XMLStreamWriter writer) throws XMLStreamException {
+
+ OMAttribute at;
+
+ //write the element's name
+ writer.writeStartElement(guardianProperties.getLocalName());
+
+ //write the attributes
+ Iterator attributes = guardianProperties.getAllAttributes();
+ while (attributes.hasNext()) {
+ at = (OMAttribute) attributes.next();
+ writer.writeAttribute(at.getLocalName(), at.getAttributeValue());
+ }
+
+ writer.writeEndElement();
+ }
+
+ public QName getArtifactType() {
+ return IMPLEMENTATION_GUARDIAN;
+ }
+
+ public void resolve(GuardianGroupImplementation arg0, ModelResolver arg1) throws ContributionResolveException {
+ }
+
+ public Class<GuardianGroupImplementation> getModelType() {
+ return GuardianGroupImplementation.class;
+ }
+}
diff --git a/sandbox/dougsleite/policy-recoveryrules/src/main/java/org/apache/tuscany/sca/policy/recoveryrules/RecoveryRulesPolicyProcessor.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/xml/RecoveryRulesProcessor.java
index 44e6e04594..7d82f356de 100644
--- a/sandbox/dougsleite/policy-recoveryrules/src/main/java/org/apache/tuscany/sca/policy/recoveryrules/RecoveryRulesPolicyProcessor.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/xml/RecoveryRulesProcessor.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.policy.recoveryrules;
+package org.apache.tuscany.sca.implementation.guardian.xml;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamConstants;
@@ -31,20 +31,20 @@ 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.guardian.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.implementation.guardian.common.Constants;
+import org.apache.tuscany.sca.implementation.guardian.impl.RecoveryRulesImpl;
+import org.apache.tuscany.sca.implementation.guardian.RecoveryRules;
-public class RecoveryRulesPolicyProcessor implements StAXArtifactProcessor<RecoveryRulesPolicy>, Constants {
+public class RecoveryRulesProcessor implements StAXArtifactProcessor<RecoveryRules>, Constants {
- private static final QName RECOVERY_RULES_POLICY_QNAME = RecoveryRulesPolicy.RECOVERY_RULES_POLICY_QNAME;
+ private static final QName RECOVERY_RULES_POLICY_QNAME = RecoveryRules.RECOVERY_RULES_POLICY_QNAME;
- public RecoveryRulesPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ public RecoveryRulesProcessor() {
}
- public RecoveryRulesPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ public RecoveryRules read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- RecoveryRulesPolicy policy = new RecoveryRulesPolicy();
+ RecoveryRules policy = new RecoveryRulesImpl();
QName name = null;
String ruleName = null;
OMElement ruleElement = null;
@@ -72,20 +72,20 @@ public class RecoveryRulesPolicyProcessor implements StAXArtifactProcessor<Recov
return policy;
}
- public void write(RecoveryRulesPolicy policy, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public void write(RecoveryRules policy, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ //throw new UnsupportedOperationException("Not supported yet.");
}
public QName getArtifactType() {
return RECOVERY_RULES_POLICY_QNAME;
}
- public void resolve(RecoveryRulesPolicy arg0, ModelResolver arg1) throws ContributionResolveException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public void resolve(RecoveryRules arg0, ModelResolver arg1) throws ContributionResolveException {
+
}
- public Class<RecoveryRulesPolicy> getModelType() {
- return RecoveryRulesPolicy.class;
+ public Class<RecoveryRules> getModelType() {
+ return RecoveryRules.class;
}
private OMElement loadElement(XMLStreamReader reader) throws XMLStreamException {
@@ -154,4 +154,5 @@ public class RecoveryRulesPolicyProcessor implements StAXArtifactProcessor<Recov
}
}
}
+
}
diff --git a/sandbox/dougsleite/policy-resolutiontrees/src/main/java/org/apache/tuscany/sca/policy/resolutiontrees/ResolutionTreesPolicyProcessor.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/xml/ResolutionTreesProcessor.java
index ef0f8e9cea..b9cfe647b4 100644
--- a/sandbox/dougsleite/policy-resolutiontrees/src/main/java/org/apache/tuscany/sca/policy/resolutiontrees/ResolutionTreesPolicyProcessor.java
+++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/xml/ResolutionTreesProcessor.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.policy.resolutiontrees;
+package org.apache.tuscany.sca.implementation.guardian.xml;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamConstants;
@@ -31,20 +31,20 @@ 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.guardian.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.implementation.guardian.common.Constants;
+import org.apache.tuscany.sca.implementation.guardian.impl.ResolutionTreesImpl;
+import org.apache.tuscany.sca.implementation.guardian.ResolutionTrees;
-public class ResolutionTreesPolicyProcessor implements StAXArtifactProcessor<ResolutionTreesPolicy>, Constants {
+public class ResolutionTreesProcessor implements StAXArtifactProcessor<ResolutionTrees>, Constants {
- private static final QName RESOLUTION_TREES_POLICY_QNAME = ResolutionTreesPolicy.RESOLUTION_TREES_POLICY_QNAME;
+ private static final QName RESOLUTION_TREES_POLICY_QNAME = ResolutionTrees.RESOLUTION_TREES_POLICY_QNAME;
- public ResolutionTreesPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ public ResolutionTreesProcessor() {
}
- public ResolutionTreesPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ public ResolutionTrees read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- ResolutionTreesPolicy policy = new ResolutionTreesPolicy();
+ ResolutionTrees policy = new ResolutionTreesImpl();
QName name = null;
String ruleName = null;
OMElement ruleElement = null;
@@ -72,20 +72,20 @@ public class ResolutionTreesPolicyProcessor implements StAXArtifactProcessor<Res
return policy;
}
- public void write(ResolutionTreesPolicy policy, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public void write(ResolutionTrees policy, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ //throw new UnsupportedOperationException("Not supported yet.");
}
public QName getArtifactType() {
return RESOLUTION_TREES_POLICY_QNAME;
}
- public void resolve(ResolutionTreesPolicy arg0, ModelResolver arg1) throws ContributionResolveException {
- throw new UnsupportedOperationException("Not supported yet.");
+ public void resolve(ResolutionTrees arg0, ModelResolver arg1) throws ContributionResolveException {
+ //throw new UnsupportedOperationException("Not supported yet.");
}
- public Class<ResolutionTreesPolicy> getModelType() {
- return ResolutionTreesPolicy.class;
+ public Class<ResolutionTrees> getModelType() {
+ return ResolutionTrees.class;
}
private OMElement loadElement(XMLStreamReader reader) throws XMLStreamException {