diff options
Diffstat (limited to 'sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common')
12 files changed, 704 insertions, 0 deletions
diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/ConcurrentExceptionOcurrenceException.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/ConcurrentExceptionOcurrenceException.java new file mode 100644 index 0000000000..4bfe1320b4 --- /dev/null +++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/ConcurrentExceptionOcurrenceException.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.common; + +public class ConcurrentExceptionOcurrenceException extends Exception { + + public ConcurrentExceptionOcurrenceException() { + super(); + } + + public ConcurrentExceptionOcurrenceException(String message) { + super(message); + } + + public ConcurrentExceptionOcurrenceException(String message, Throwable cause) { + super(message, cause); + } + + public ConcurrentExceptionOcurrenceException(Throwable cause) { + super(cause); + } +} diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/Constants.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/Constants.java new file mode 100644 index 0000000000..cf5d56179d --- /dev/null +++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/Constants.java @@ -0,0 +1,82 @@ +/* + * 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.common; + +import javax.xml.namespace.QName; + +public interface Constants { + + String RECOVERY_RULES = "recovery_rules"; + QName RECOVERY_RULES_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, RECOVERY_RULES); + + String RULE = "rule"; + QName RULE_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, RULE); + + String NAME = "name"; + QName NAME_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, NAME); + + String SIGNALED_EXCEPTION = "signaled_exception"; + QName SIGNALED_EXCEPTION_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, SIGNALED_EXCEPTION); + + String PARTICIPANT = "participant"; + QName PARTICIPANT_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, PARTICIPANT); + + String MATCH = "match"; + QName MATCH_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, MATCH); + + String THROW_EXCEPTION = "throw_exception"; + QName THROW_EXCEPTION_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, THROW_EXCEPTION); + + String CLASS = "class"; + QName CLASS_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, CLASS); + + String TARGET_CONTEXT = "target_context"; + QName TARGET_CONTEXT_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, TARGET_CONTEXT); + + String MIN_PARTICIPANT_JOINED = "min_participant_joined"; + QName MIN_PARTICIPANT_JOINED_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, MIN_PARTICIPANT_JOINED); + + String MAX_PARTICIPANT_JOINED = "max_participant_joined"; + QName MAX_PARTICIPANT_JOINED_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, MAX_PARTICIPANT_JOINED); + + String AFFECTED_PARTICIPANTS = "affected_participants"; + QName AFFECTED_PARTICIPANTS_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, AFFECTED_PARTICIPANTS); + + String FIRST = "FIRST"; + QName FIRST_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, FIRST); + + String LAST = "LAST"; + QName LAST_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, LAST); + + String ALL = "ALL"; + QName ALL_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, ALL); + + String RESOLUTION_TREE = "resolution_tree"; + QName RESOLUTION_TREE_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, RESOLUTION_TREE); + + String RESOLUTION_TREES = "resolution_trees"; + QName RESOLUTION_TREES_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, RESOLUTION_TREES); + + String EXCEPTION_LEVEL = "exception_level"; + QName EXCEPTION_LEVEL_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, EXCEPTION_LEVEL); + + String EXCEPTION = "exception"; + QName EXCEPTION_QNAME = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA10_TUSCANY_NS, EXCEPTION); + +} diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/Context.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/Context.java new file mode 100644 index 0000000000..95c6f3bed6 --- /dev/null +++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/Context.java @@ -0,0 +1,79 @@ +/* + * 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.common; + +import java.util.LinkedList; +import java.util.List; + +public class Context { + + public static Context CURRENT_CONTEXT = new Context("CURRENT_CONTEXT"); + public static Context INIT_CONTEXT = new Context("INIT_CONTEXT"); + public static Context GUARDIAN_CONTEXT = new Context("GUARDIAN_CONTEXT"); + + private String name; + private List<Class<? extends GlobalException>> exceptionList; + + public Context() { + this(null); + } + + public Context(String name) { + this(name, new LinkedList<Class<? extends GlobalException>>()); + } + + public Context(String name, List<Class<? extends GlobalException>> exceptionList) { + this.name = name; + this.exceptionList = exceptionList; + } + + public void addException(Class<? extends GlobalException> ex) { + this.exceptionList.add(ex); + } + + public void setExceptionList(List<Class<? extends GlobalException>> exceptionList) { + this.exceptionList = exceptionList; + } + + public List<Class<? extends GlobalException>> getExceptionList() { + return this.exceptionList; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object obj) { + return (obj instanceof Context && + (((Context) obj).getName().equals(this.getName()) || + this == Context.CURRENT_CONTEXT || + ((Context) obj) == Context.CURRENT_CONTEXT)); + } +} diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/GlobalException.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/GlobalException.java new file mode 100644 index 0000000000..022fe1a5f8 --- /dev/null +++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/GlobalException.java @@ -0,0 +1,85 @@ +/* + * 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.common; + +import java.util.LinkedList; +import java.util.List; + +public class GlobalException extends RuntimeException implements GlobalExceptionInterface { + + private List<String> signalingParticipants; + private Context signalingContext; + private Context targetContext; + + public GlobalException() { + super(); + signalingParticipants = new LinkedList<String>(); + } + + public GlobalException(String message) { + super(message); + signalingParticipants = new LinkedList<String>(); + } + + public GlobalException(String message, Throwable cause) { + super(message, cause); + signalingParticipants = new LinkedList<String>(); + } + + public GlobalException(Throwable cause) { + super(cause); + signalingParticipants = new LinkedList<String>(); + } + + /** + * @return the signalingContext + */ + public Context getSignalingContext() { + return signalingContext; + } + + /** + * @param signalingContext the signalingContext to set + */ + public void setSignalingContext(Context signalingContext) { + this.signalingContext = signalingContext; + } + + /** + * @return the targetContext + */ + public Context getTargetContext() { + return targetContext; + } + + /** + * @param targetContext the targetContext to set + */ + public void setTargetContext(Context targetContext) { + this.targetContext = targetContext; + } + + public void putSignalingParticipant(String participant) { + signalingParticipants.add(participant); + } + + public List<String> getSignalingParticipants() { + return signalingParticipants; + } +} diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/GlobalExceptionInterface.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/GlobalExceptionInterface.java new file mode 100644 index 0000000000..450d4ae18b --- /dev/null +++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/GlobalExceptionInterface.java @@ -0,0 +1,54 @@ +/* + * 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.common; + +import java.util.List; + +public interface GlobalExceptionInterface { + + /** + * @return the signalingContext + */ + public Context getSignalingContext(); + + /** + * @param signalingContext the signalingContext to set + */ + public void setSignalingContext(Context signalingContext); + + /** + * @return the targetContext + */ + public Context getTargetContext(); + + /** + * @param targetContext the targetContext to set + */ + public void setTargetContext(Context targetContext); + + /** + * @return the signalingProcess + */ + public List<String> getSignalingParticipants(); + + /** + * @param signalingProcess the signalingProcess to set + */ + public void putSignalingParticipant(String participant); +} diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/InvalidNodeException.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/InvalidNodeException.java new file mode 100644 index 0000000000..ed85661dbf --- /dev/null +++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/InvalidNodeException.java @@ -0,0 +1,30 @@ +/* + * 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.common; + +public class InvalidNodeException extends RuntimeException { + + public InvalidNodeException() { + super(); + } + + public InvalidNodeException(String message) { + super(message); + } +} diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/InvalidRegularExpressionException.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/InvalidRegularExpressionException.java new file mode 100644 index 0000000000..99aa027fb8 --- /dev/null +++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/InvalidRegularExpressionException.java @@ -0,0 +1,30 @@ +/* + * 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.common; + +public class InvalidRegularExpressionException extends RuntimeException { + + public InvalidRegularExpressionException() { + super(); + } + + public InvalidRegularExpressionException(String message) { + super(message); + } +} diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/JoinException.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/JoinException.java new file mode 100644 index 0000000000..890b8704ee --- /dev/null +++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/JoinException.java @@ -0,0 +1,39 @@ +/* + * 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.common; + +public class JoinException extends GlobalException { + + public JoinException() { + super(); + } + + public JoinException(String message) { + super(message); + } + + public JoinException(String message, Throwable cause) { + super(message, cause); + } + + public JoinException(Throwable cause) { + super(cause); + } +} diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/LeaveException.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/LeaveException.java new file mode 100644 index 0000000000..9684de22ad --- /dev/null +++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/LeaveException.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.common; + +public class LeaveException extends GlobalException { + + public LeaveException() { + super(); + } + + public LeaveException(String message) { + super(message); + } + + public LeaveException(String message, Throwable cause) { + super(message, cause); + } + + public LeaveException(Throwable cause) { + super(cause); + } +} diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/ResolutionTreeUtils.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/ResolutionTreeUtils.java new file mode 100644 index 0000000000..fbf147285e --- /dev/null +++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/ResolutionTreeUtils.java @@ -0,0 +1,153 @@ +/* + * 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.common; + +import java.util.Collections; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import org.apache.axiom.om.OMAttribute; +import org.apache.axiom.om.OMElement; + +public class ResolutionTreeUtils { + + //E: Euler tour of the tree obtained by listing the nodes visited in a depth first search of the tree starting from the root. Contains 2n-1 elements + private List<String> eulerTour; + //L: Array of level numbers such that L[i] contains the tree-depth of the node E[i]. Contains 2n-1 elements + private List<Integer> levels; + //R: Map of size n such that R<K> contains the index of the first ocurrence of node 'K' in E + private Map<String, Integer> rMap; + private OMElement root; + private int treeSize; + + public ResolutionTreeUtils() { + init(null); + } + + public ResolutionTreeUtils(OMElement root) { + init(root); + } + + public void setRoot(OMElement root) { + init(root); + } + + public List<String> getEulerTourDepthFirstSearch() { + + if (root == null) { + throw new NullPointerException("The root musn't be null"); + } + + if (eulerTour == null) { + eulerTour = new LinkedList<String>(); + levels = new LinkedList<Integer>(); + + eulerTourDFSRecursive(root, 0); + } + + return eulerTour; + } + + public String getLowestCommonAncestor(String node1, String node2) { + String lca = null; + Integer indexNode1, indexNode2; + + Map<String, Integer> r = getRMap(); + + indexNode1 = r.get(node1); + indexNode2 = r.get(node2); + + //Check nodes existence + if (indexNode1 == null && indexNode2 == null) { + throw new InvalidNodeException("Could not find the specified nodes: " + node1 + " and " + node2); + } else if (indexNode1 == null) { + throw new InvalidNodeException("Could not find the specified nodes: " + node1); + } else if (indexNode2 == null) { + throw new InvalidNodeException("Could not find the specified nodes: " + node2); + } + + int indexLCA; + if (indexNode1 < indexNode2) { + indexLCA = getRangeMinimumQuery(levels, indexNode1, indexNode2); + } else { + indexLCA = getRangeMinimumQuery(levels, indexNode2, indexNode1); + } + + lca = eulerTour.get(indexLCA); + + return lca; + } + + //Get the index of the smallest element between beginIndex and endIndex (both inclusive) in the list + private int getRangeMinimumQuery(List list, int beginIndex, int endIndex) { + + List sublist = list.subList(beginIndex, endIndex + 1); + + Object elem = Collections.min(sublist); + + return sublist.indexOf(elem) + beginIndex; + } + + private void init(OMElement root) { + this.root = root; + eulerTour = null; + levels = null; + rMap = null; + treeSize = 0; + } + + private void eulerTourDFSRecursive(OMElement node, int level) { + String classAttribute = ((OMAttribute) node.getAllAttributes().next()).getAttributeValue(); + eulerTour.add(classAttribute); + + levels.add(level); + treeSize++; + + Iterator children = node.getChildElements(); + + OMElement child; + while (children.hasNext()) { + child = (OMElement) children.next(); + eulerTourDFSRecursive(child, level + 1); + eulerTour.add(classAttribute); + levels.add(level); + } + } + + private Map<String, Integer> getRMap() { + if (rMap == null) { + rMap = new Hashtable<String, Integer>(); + + List<String> tour = getEulerTourDepthFirstSearch(); + for (int i = 0; i < tour.size(); i++) { + String key = tour.get(i); + if (!rMap.containsKey(key)) { + rMap.put(key, i); + } + + if (rMap.size() == treeSize) { + break; + } + } + } + return rMap; + } +} diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/SuspendException.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/SuspendException.java new file mode 100644 index 0000000000..5ce2f5afd9 --- /dev/null +++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/SuspendException.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.common; + +public class SuspendException extends GlobalException { + + public SuspendException() { + super(); + } + + public SuspendException(String message) { + super(message); + } + + public SuspendException(String message, Throwable cause) { + super(message, cause); + } + + public SuspendException(Throwable cause) { + super(cause); + } +} diff --git a/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/UnhandledException.java b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/UnhandledException.java new file mode 100644 index 0000000000..a8f9cdfad6 --- /dev/null +++ b/sandbox/dougsleite/implementation-guardian/src/main/java/org/apache/tuscany/sca/implementation/guardian/common/UnhandledException.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.common; + +public class UnhandledException extends GlobalException { + + public UnhandledException() { + super(); + } + + public UnhandledException(String message) { + super(message); + } + + public UnhandledException(String message, Throwable cause) { + super(message, cause); + } + + public UnhandledException(Throwable cause) { + super(cause); + } +} |