You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sh...@apache.org on 2015/06/11 23:34:46 UTC
[5/8] airavata git commit: moved commons-utils to commons module
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/src/main/java/org/apache/airavata/common/utils/XMLUtil.java
----------------------------------------------------------------------
diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/XMLUtil.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/XMLUtil.java
new file mode 100644
index 0000000..0ba02f9
--- /dev/null
+++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/XMLUtil.java
@@ -0,0 +1,586 @@
+/*
+ *
+ * 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.airavata.common.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.airavata.common.exception.UtilsException;
+import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+import org.xml.sax.SAXException;
+import org.xmlpull.infoset.XmlDocument;
+import org.xmlpull.infoset.XmlElement;
+import org.xmlpull.infoset.XmlNamespace;
+import org.xmlpull.mxp1.MXParserFactory;
+import org.xmlpull.mxp1_serializer.MXSerializer;
+
+public class XMLUtil {
+
+ /**
+ * The XML builder for XPP5
+ */
+ public static final org.xmlpull.infoset.XmlInfosetBuilder BUILDER = org.xmlpull.infoset.XmlInfosetBuilder
+ .newInstance();
+
+ /**
+ * The XML builder for XPP3.
+ */
+ public static final org.xmlpull.v1.builder.XmlInfosetBuilder BUILDER3 = org.xmlpull.v1.builder.XmlInfosetBuilder
+ .newInstance(new MXParserFactory());
+
+ private static final Logger logger = LoggerFactory.getLogger(XMLUtil.class);
+
+ private final static String PROPERTY_SERIALIZER_INDENTATION = "http://xmlpull.org/v1/doc/properties.html#serializer-indentation";
+
+ private final static String INDENT = " ";
+
+ /**
+ * Parses a specified string and returns the XmlElement (XPP3).
+ *
+ * @param string
+ * @return The XmlElement (XPP3) parsed.
+ */
+ public static org.xmlpull.v1.builder.XmlElement stringToXmlElement3(String string) {
+ return BUILDER3.parseFragmentFromReader(new StringReader(string));
+ }
+
+ /**
+ * Parses a specified string and returns the XmlElement (XPP5).
+ *
+ * @param string
+ * @return The XmlElement (XPP5) parsed.
+ */
+ public static org.xmlpull.infoset.XmlElement stringToXmlElement(String string) {
+ XmlDocument document = BUILDER.parseString(string);
+ org.xmlpull.infoset.XmlElement element = document.getDocumentElement();
+ return element;
+ }
+
+ /**
+ * Converts a specified XmlElement (XPP3) to the XmlElement (XPP5).
+ *
+ * @param element
+ * @return The XmlElement (XPP5) converted.
+ */
+ public static org.xmlpull.infoset.XmlElement xmlElement3ToXmlElement5(org.xmlpull.v1.builder.XmlElement element) {
+ String string = xmlElementToString(element);
+ return stringToXmlElement(string);
+ }
+
+ /**
+ * Converts a specified XmlElement (XPP5) to the XmlElement (XPP3).
+ *
+ * @param element
+ * @return The XmlElement (XPP3) converted.
+ */
+ public static org.xmlpull.v1.builder.XmlElement xmlElement5ToXmlElement3(org.xmlpull.infoset.XmlElement element) {
+ String string = xmlElementToString(element);
+ return stringToXmlElement3(string);
+ }
+
+ /**
+ * Returns the XML string of a specified XmlElement.
+ *
+ * @param element
+ * The specified XmlElement
+ * @return The XML string
+ */
+ public static String xmlElementToString(org.xmlpull.v1.builder.XmlElement element) {
+ MXSerializer serializer = new MXSerializer();
+ StringWriter writer = new StringWriter();
+ serializer.setOutput(writer);
+ serializer.setProperty(PROPERTY_SERIALIZER_INDENTATION, INDENT);
+ BUILDER3.serialize(element, serializer);
+ String xmlText = writer.toString();
+ return xmlText;
+ }
+
+ /**
+ * Returns the XML string as a specified XmlElement (XPP5).
+ *
+ * @param element
+ * The specified XmlElement
+ * @return The XML string
+ */
+ public static String xmlElementToString(org.xmlpull.infoset.XmlElement element) {
+ String string;
+ if (element == null) {
+ string = "";
+ } else {
+ string = BUILDER.serializeToStringPretty(element);
+ }
+ return string;
+ }
+
+ /**
+ * Converts a specified XPP5 XML element to a DOM element under a specified document.
+ *
+ * @param xppElement
+ * @param document
+ * @return The converted DOM element.
+ */
+ public static Element xppElementToDomElement(org.xmlpull.infoset.XmlElement xppElement, Document document) {
+ Element domElement = document.createElement(xppElement.getName());
+
+ for (org.xmlpull.infoset.XmlNamespace namespace : xppElement.namespaces()) {
+ logger.debug("namespace: " + namespace);
+ }
+
+ for (org.xmlpull.infoset.XmlAttribute attribute : xppElement.attributes()) {
+ domElement.setAttribute(attribute.getName(), attribute.getValue());
+ }
+
+ for (Object object : xppElement.children()) {
+ if (object instanceof org.xmlpull.infoset.XmlElement) {
+ domElement.appendChild(xppElementToDomElement((org.xmlpull.infoset.XmlElement) object, document));
+ } else if (object instanceof String) {
+ Text text = document.createTextNode((String) object);
+ domElement.appendChild(text);
+ } else {
+ logger.debug("object.getClass(): " + object.getClass());
+ }
+ }
+ return domElement;
+ }
+
+// /**
+// * @param definitions3
+// * @return The WsdlDefinitions (XSUL5)
+// */
+// @Deprecated
+// public static xsul5.wsdl.WsdlDefinitions wsdlDefinitions3ToWsdlDefintions5(xsul.wsdl.WsdlDefinitions definitions3) {
+// return WSDLUtil.wsdlDefinitions3ToWsdlDefintions5(definitions3);
+// }
+//
+// /**
+// * @param definitions5
+// * @return The WsdlDefinitions (XSUL3)
+// */
+// @Deprecated
+// public static xsul.wsdl.WsdlDefinitions wsdlDefinitions5ToWsdlDefintions3(xsul5.wsdl.WsdlDefinitions definitions5) {
+// return WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(definitions5);
+// }
+
+ /**
+ * Converts a specified XPP3 XML element to a DOM element under a specified document.
+ *
+ * @param xppElement
+ * @param document
+ * @return The converted DOM element.
+ */
+ public static Element xppElementToDomElement(org.xmlpull.v1.builder.XmlElement xppElement, Document document) {
+ Element domElement = document.createElement(xppElement.getName());
+
+ Iterator nsIt = xppElement.namespaces();
+ while (nsIt.hasNext()) {
+ org.xmlpull.v1.builder.XmlNamespace namespace = (org.xmlpull.v1.builder.XmlNamespace) nsIt.next();
+ logger.debug("namespace: " + namespace);
+ // TODO
+ }
+
+ Iterator attrIt = xppElement.attributes();
+ while (attrIt.hasNext()) {
+ org.xmlpull.v1.builder.XmlAttribute attribute = (org.xmlpull.v1.builder.XmlAttribute) attrIt.next();
+ // TODO namespace
+ domElement.setAttribute(attribute.getName(), attribute.getValue());
+ }
+
+ Iterator elementIt = xppElement.children();
+ while (elementIt.hasNext()) {
+ Object object = elementIt.next();
+ if (object instanceof org.xmlpull.v1.builder.XmlElement) {
+ domElement.appendChild(xppElementToDomElement((org.xmlpull.v1.builder.XmlElement) object, document));
+ } else if (object instanceof String) {
+ Text text = document.createTextNode((String) object);
+ domElement.appendChild(text);
+ } else {
+ logger.debug("object.getClass(): " + object.getClass());
+ }
+ }
+ return domElement;
+ }
+
+ /**
+ * @param element
+ * @return The cloned XmlElement.
+ */
+ public static org.xmlpull.infoset.XmlElement deepClone(org.xmlpull.infoset.XmlElement element)
+ throws UtilsException {
+ try {
+ XmlElement clonedElement = element.clone();
+ clonedElement.setParent(null);
+ return clonedElement;
+ } catch (CloneNotSupportedException e) {
+ // This should not happen because we don't put any special Objects.
+ throw new UtilsException(e);
+ }
+ }
+
+ /**
+ * Saves a specified XmlElement to a specified file.
+ *
+ * @param element
+ * @param file
+ * @throws IOException
+ */
+ public static void saveXML(org.xmlpull.infoset.XmlElement element, File file) throws IOException {
+ XmlDocument document = BUILDER.newDocument();
+ document.setDocumentElement(element);
+ String xmlText = BUILDER.serializeToStringPretty(document);
+ IOUtil.writeToFile(xmlText, file);
+ }
+
+ /**
+ * Saves a specified XmlElement to a specified file.
+ *
+ * @param element
+ * @param file
+ * @throws IOException
+ */
+ public static void saveXML(org.xmlpull.v1.builder.XmlElement element, File file) throws IOException {
+ saveXML(xmlElement3ToXmlElement5(element), file);
+ }
+
+ /**
+ * @param file
+ * @return The XmlElement in the document.
+ * @throws IOException
+ */
+ public static org.xmlpull.infoset.XmlElement loadXML(InputStream stream) throws IOException {
+ String xmlText = IOUtil.readToString(stream);
+ XmlDocument document = BUILDER.parseString(xmlText);
+ return document.getDocumentElement();
+ }
+
+ /**
+ * @param file
+ * @return The XmlElement in the document.
+ * @throws IOException
+ */
+ public static org.xmlpull.infoset.XmlElement loadXML(File file) throws IOException {
+ return loadXML(new FileInputStream(file));
+ }
+
+ /**
+ * @param string
+ * @return true if the specified string is XML, false otherwise
+ */
+ public static boolean isXML(String string) {
+ try {
+ stringToXmlElement(string);
+ return true;
+ } catch (RuntimeException e) {
+ return false;
+ }
+ }
+
+ /**
+ * Validates a specified XmlObject along with logging errors if any.
+ *
+ * @param xmlObject
+ */
+ public static void validate(XmlObject xmlObject) throws UtilsException {
+ XmlOptions validateOptions = new XmlOptions();
+ ArrayList errorList = new ArrayList();
+ validateOptions.setErrorListener(errorList);
+
+ boolean isValid = xmlObject.validate(validateOptions);
+ if (isValid) {
+ // Valid
+ return;
+ }
+
+ // Error
+ StringBuilder stringBuilder = new StringBuilder();
+ for (int i = 0; i < errorList.size(); i++) {
+ XmlError error = (XmlError) errorList.get(i);
+ logger.warn("Message: " + error.getMessage());
+ logger.warn("Location of invalid XML: " + error.getCursorLocation().xmlText());
+ stringBuilder.append("Message:" + error.getMessage());
+ stringBuilder.append("Location of invalid XML: " + error.getCursorLocation().xmlText());
+ }
+ throw new UtilsException(stringBuilder.toString());
+ }
+
+ /**
+ * Returns the local part of a specified QName.
+ *
+ * @param qname
+ * the specified QName in string, e.g. ns:value
+ * @return the local part of the QName, e.g. value
+ */
+ public static String getLocalPartOfQName(String qname) {
+ int index = qname.indexOf(':');
+ if (index < 0) {
+ return qname;
+ } else {
+ return qname.substring(index + 1);
+ }
+ }
+
+ /**
+ * Returns the prefix of a specified QName.
+ *
+ * @param qname
+ * the specified QName in string, e.g. ns:value
+ * @return the prefix of the QName, e.g. ns
+ */
+ public static String getPrefixOfQName(String qname) {
+ int index = qname.indexOf(':');
+ if (index < 0) {
+ return null;
+ } else {
+ return qname.substring(0, index);
+ }
+ }
+
+ /**
+ * @param prefixCandidate
+ * @param uri
+ * @param alwaysUseSuffix
+ * @param element
+ * @return The namespace found or declared.
+ */
+ public static XmlNamespace declareNamespaceIfNecessary(String prefixCandidate, String uri, boolean alwaysUseSuffix,
+ XmlElement element) {
+ XmlNamespace namespace = element.lookupNamespaceByName(uri);
+ if (namespace == null) {
+ return declareNamespace(prefixCandidate, uri, alwaysUseSuffix, element);
+ } else {
+ return namespace;
+ }
+ }
+
+ /**
+ * @param prefixCandidate
+ * @param uri
+ * @param alwaysUseSuffix
+ * @param element
+ * @return The namespace declared.
+ */
+ public static XmlNamespace declareNamespace(String prefixCandidate, String uri, boolean alwaysUseSuffix,
+ XmlElement element) {
+ if (prefixCandidate == null || prefixCandidate.length() == 0) {
+ prefixCandidate = "a";
+ }
+ String prefix = prefixCandidate;
+ if (alwaysUseSuffix) {
+ prefix += "0";
+ }
+ if (element.lookupNamespaceByPrefix(prefix) != null) {
+ int i = 1;
+ prefix = prefixCandidate + i;
+ while (element.lookupNamespaceByPrefix(prefix) != null) {
+ i++;
+ }
+ }
+ XmlNamespace namespace = element.declareNamespace(prefix, uri);
+ return namespace;
+ }
+
+ /**
+ *
+ * @param xml
+ * @param name
+ */
+ public static void removeElements(XmlElement xml, String name) {
+
+ Iterable<XmlElement> removeElements = xml.elements(null, name);
+ LinkedList<XmlElement> removeList = new LinkedList<XmlElement>();
+ for (XmlElement xmlElement : removeElements) {
+ removeList.add(xmlElement);
+ }
+ for (XmlElement xmlElement : removeList) {
+ xml.removeChild(xmlElement);
+ }
+ Iterable children = xml.children();
+ for (Object object : children) {
+ if (object instanceof XmlElement) {
+ XmlElement element = (XmlElement) object;
+ removeElements(element, name);
+ }
+ }
+ }
+
+ /**
+ * @param url
+ * @return Document
+ */
+ public static Document retrievalXMLDocFromUrl(String url) {
+ try {
+ URL xmlUrl = new URL(url);
+ InputStream in = xmlUrl.openStream();
+ Document ret = null;
+ DocumentBuilderFactory domFactory;
+ DocumentBuilder builder;
+
+ domFactory = DocumentBuilderFactory.newInstance();
+ domFactory.setValidating(false);
+ domFactory.setNamespaceAware(false);
+ builder = domFactory.newDocumentBuilder();
+
+ ret = builder.parse(in);
+
+ return ret;
+ } catch (MalformedURLException e) {
+ logger.error(e.getMessage(), e);
+ } catch (IOException e) {
+ logger.error(e.getMessage(), e);
+ } catch (ParserConfigurationException e) {
+ logger.error(e.getMessage(), e);
+ } catch (SAXException e) {
+ logger.error(e.getMessage(), e);
+ }
+
+ return null;
+ }
+
+ /**
+ * @param url
+ * @return Document
+ */
+ public static Document retrievalXMLDocForParse(String url) {
+ try {
+ URL xmlUrl = new URL(url);
+ InputStream in = xmlUrl.openStream();
+ DocumentBuilderFactory xmlFact = DocumentBuilderFactory.newInstance();
+ xmlFact.setNamespaceAware(true);
+ DocumentBuilder builder = xmlFact.newDocumentBuilder();
+ Document doc = builder.parse(in);
+
+ return doc;
+ } catch (MalformedURLException e) {
+ logger.error("Malformed URL", e);
+ } catch (IOException e) {
+ logger.error(e.getMessage(), e);
+ } catch (ParserConfigurationException e) {
+ logger.error(e.getMessage(), e);
+ } catch (SAXException e) {
+ logger.error(e.getMessage(), e);
+ }
+
+ return null;
+ }
+
+ public static boolean isEqual(XmlElement elem1, XmlElement elem2) throws Exception {
+
+ if (elem1 == null && elem2 == null) {
+ return true;
+ } else if (elem1 == null) {
+ return false;
+ } else if (elem2 == null) {
+ return false;
+ }
+
+ if (!elem1.getName().equals(elem2.getName())) {
+ return false;
+ } else {
+ // now check if children are the same
+ Iterator children1 = elem1.children().iterator();
+ Iterator children2 = elem2.children().iterator();
+
+ //check first ones for string
+ Object child1 = null;
+ Object child2 = null;
+ if (children1.hasNext() && children2.hasNext()) {
+ child1 = children1.next();
+ child2 = children2.next();
+
+ if (!children1.hasNext() && !children2.hasNext()) {
+ //only one node could be string could be xmlelement
+ return compareObjs(child1, child2);
+ } else {
+ //get new iterators
+
+ List<XmlElement> elemSet1 = getXmlElementsOnly(elem1.children().iterator());
+ List<XmlElement> elemSet2 = getXmlElementsOnly(elem2.children().iterator());
+
+ if(elemSet1.size() != elemSet2.size()){
+ return false;
+ }
+ for(int i =0; i< elemSet1.size(); ++i){
+ if(!isEqual(elemSet1.get(i), elemSet2.get(i))){
+ return false;
+ }
+ }
+ return true;
+ }
+
+
+ }else {
+ //no internal element
+
+ return true;
+ }
+ }
+
+
+ }
+
+
+
+ private static List<XmlElement> getXmlElementsOnly(Iterator itr){
+ LinkedList<XmlElement> list = new LinkedList<XmlElement>();
+ while(itr.hasNext()){
+ Object obj = itr.next();
+ if(obj instanceof XmlElement){
+ list.add((XmlElement) obj);
+ }
+ }
+ return list;
+ }
+
+
+
+ private static boolean compareObjs(Object child1, Object child2) throws Exception {
+ if (child1 instanceof String && child2 instanceof String) {
+ return child1.equals(child2);
+
+
+ } else if (child1 instanceof XmlElement && child2 instanceof XmlElement) {
+ return isEqual((XmlElement) child1, (XmlElement) child2);
+ } else {
+ return false;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/src/main/java/org/apache/airavata/common/utils/XmlFormatter.java
----------------------------------------------------------------------
diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/XmlFormatter.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/XmlFormatter.java
new file mode 100644
index 0000000..1440dbf
--- /dev/null
+++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/XmlFormatter.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.airavata.common.utils;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * Pretty-prints xml, supplied as a string.
+ * <p/>
+ * eg. <code>
+ * String formattedXml = new XmlFormatter().format("<tag><nested>hello</nested></tag>");
+ * </code>
+ */
+public class XmlFormatter {
+
+ /**
+ * @param unformattedXml
+ * @return formattedXml
+ */
+ public static String format(String unformattedXml) {
+ try {
+ final Document document = parseXmlFile(unformattedXml);
+ OutputFormat format = new OutputFormat(document);
+ format.setLineWidth(65);
+ format.setIndenting(true);
+ format.setIndent(2);
+ Writer out = new StringWriter();
+ XMLSerializer serializer = new XMLSerializer(out, format);
+ serializer.serialize(document);
+ return out.toString();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static Document parseXmlFile(String in) {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ InputSource is = new InputSource(new StringReader(in));
+ return db.parse(is);
+ } catch (ParserConfigurationException e) {
+ throw new RuntimeException(e);
+ } catch (SAXException e) {
+ throw new RuntimeException(e);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/src/main/java/org/apache/airavata/common/utils/listener/AbstractActivityListener.java
----------------------------------------------------------------------
diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/listener/AbstractActivityListener.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/listener/AbstractActivityListener.java
new file mode 100644
index 0000000..e972012
--- /dev/null
+++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/listener/AbstractActivityListener.java
@@ -0,0 +1,27 @@
+/*
+ *
+ * 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.airavata.common.utils.listener;
+
+
+public interface AbstractActivityListener {
+ public void setup(Object... configurations);
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/src/main/java/org/apache/airavata/common/utils/listener/AbstractStateChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/listener/AbstractStateChangeRequest.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/listener/AbstractStateChangeRequest.java
new file mode 100644
index 0000000..8529c4b
--- /dev/null
+++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/listener/AbstractStateChangeRequest.java
@@ -0,0 +1,27 @@
+/*
+ *
+ * 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.airavata.common.utils.listener;
+
+
+public abstract class AbstractStateChangeRequest implements PublisherMessage {
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/src/main/java/org/apache/airavata/common/utils/listener/PublisherMessage.java
----------------------------------------------------------------------
diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/listener/PublisherMessage.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/listener/PublisherMessage.java
new file mode 100644
index 0000000..0d5404a
--- /dev/null
+++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/listener/PublisherMessage.java
@@ -0,0 +1,26 @@
+/*
+ *
+ * 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.airavata.common.utils.listener;
+
+public interface PublisherMessage {
+// public String getType();
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/src/test/java/org/apache/airavata/common/utils/ApplicationSettingsTest.java
----------------------------------------------------------------------
diff --git a/modules/commons/src/test/java/org/apache/airavata/common/utils/ApplicationSettingsTest.java b/modules/commons/src/test/java/org/apache/airavata/common/utils/ApplicationSettingsTest.java
new file mode 100644
index 0000000..ed61793
--- /dev/null
+++ b/modules/commons/src/test/java/org/apache/airavata/common/utils/ApplicationSettingsTest.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.airavata.common.utils;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 7/5/13
+ * Time: 4:39 PM
+ */
+
+public class ApplicationSettingsTest extends TestCase {
+
+ public void testGetAbsoluteSettingWithSpecialCharacters() throws Exception {
+
+ String url = ServerSettings.getSetting("default.registry.user");
+ Assert.assertEquals("admin", url);
+
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/src/test/java/org/apache/airavata/common/utils/SecurityUtilTest.java
----------------------------------------------------------------------
diff --git a/modules/commons/src/test/java/org/apache/airavata/common/utils/SecurityUtilTest.java b/modules/commons/src/test/java/org/apache/airavata/common/utils/SecurityUtilTest.java
new file mode 100644
index 0000000..aa87283
--- /dev/null
+++ b/modules/commons/src/test/java/org/apache/airavata/common/utils/SecurityUtilTest.java
@@ -0,0 +1,104 @@
+/*
+ *
+ * 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.airavata.common.utils;
+
+import junit.framework.Assert;
+import org.junit.Test;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.security.KeyStore;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 10/11/13
+ * Time: 10:42 AM
+ */
+
+public class SecurityUtilTest {
+ @Test
+ public void testEncryptString() throws Exception {
+
+ URL url = this.getClass().getClassLoader().getResource("mykeystore.jks");
+
+ assert url != null;
+
+ String stringToEncrypt = "Test string to encrypt";
+ byte[] encrypted = SecurityUtil.encryptString(url.getPath(), "mykey", new TestKeyStoreCallback(), stringToEncrypt);
+
+ String decrypted = SecurityUtil.decryptString(url.getPath(), "mykey", new TestKeyStoreCallback(), encrypted);
+ Assert.assertTrue(stringToEncrypt.equals(decrypted));
+
+ }
+
+ @Test
+ public void testEncryptBytes() throws Exception {
+
+ URL url = this.getClass().getClassLoader().getResource("mykeystore.jks");
+
+ assert url != null;
+
+ String stringToEncrypt = "Test string to encrypt";
+ byte[] encrypted = SecurityUtil.encrypt(url.getPath(), "mykey", new TestKeyStoreCallback(),
+ stringToEncrypt.getBytes("UTF-8"));
+
+ byte[] decrypted = SecurityUtil.decrypt(url.getPath(), "mykey", new TestKeyStoreCallback(), encrypted);
+ Assert.assertTrue(stringToEncrypt.equals(new String(decrypted, "UTF-8")));
+
+ }
+
+ @Test
+ public void testLoadKeyStore() throws Exception{
+ InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("mykeystore.jks");
+
+ KeyStore ks = SecurityUtil.loadKeyStore(inputStream, "jceks", new TestKeyStoreCallback());
+ Assert.assertNotNull(ks);
+
+ }
+
+ @Test
+ public void testLoadKeyStoreFromFile() throws Exception{
+ URL url = this.getClass().getClassLoader().getResource("mykeystore.jks");
+
+ assert url != null;
+ KeyStore ks = SecurityUtil.loadKeyStore(url.getPath(), "jceks", new TestKeyStoreCallback());
+ Assert.assertNotNull(ks);
+
+ }
+
+ private class TestKeyStoreCallback implements KeyStorePasswordCallback {
+
+ @Override
+ public char[] getStorePassword() {
+ return "airavata".toCharArray();
+ }
+
+ @Override
+ public char[] getSecretKeyPassPhrase(String keyAlias) {
+ if (keyAlias.equals("mykey")) {
+ return "airavatasecretkey".toCharArray();
+ }
+
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/src/test/java/org/apache/airavata/common/utils/XMLUtilTest.java
----------------------------------------------------------------------
diff --git a/modules/commons/src/test/java/org/apache/airavata/common/utils/XMLUtilTest.java b/modules/commons/src/test/java/org/apache/airavata/common/utils/XMLUtilTest.java
new file mode 100644
index 0000000..3c2c189
--- /dev/null
+++ b/modules/commons/src/test/java/org/apache/airavata/common/utils/XMLUtilTest.java
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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.airavata.common.utils;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class XMLUtilTest {
+ private final static Logger logger = LoggerFactory.getLogger(XMLUtilTest.class);
+
+ @Test
+ public void isXMLTest(){
+ String xml = "<test>testing</test>";
+ org.junit.Assert.assertTrue(XMLUtil.isXML(xml));
+ org.junit.Assert.assertFalse(XMLUtil.isXML("NonXMLString"));
+ }
+
+ @Test
+ public void isEqualTest(){
+ String xml1 = "<test><inner>innerValue</inner></test>";
+ String xml2 = "<test><inner>innerValue</inner></test>";
+ String xml3 = "<test1><inner>innerValue</inner></test1>";
+ try {
+ org.junit.Assert.assertTrue(XMLUtil.isEqual(XMLUtil.stringToXmlElement(xml1), XMLUtil.stringToXmlElement(xml2)));
+ org.junit.Assert.assertFalse(XMLUtil.isEqual(XMLUtil.stringToXmlElement(xml1), XMLUtil.stringToXmlElement(xml3)));
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+ @Test
+ public void getQNameTest(){
+ String qname = "ns1:a";
+ org.junit.Assert.assertEquals("a",XMLUtil.getLocalPartOfQName(qname));
+ org.junit.Assert.assertEquals("ns1",XMLUtil.getPrefixOfQName(qname));
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/src/test/resources/mykeystore.jks
----------------------------------------------------------------------
diff --git a/modules/commons/src/test/resources/mykeystore.jks b/modules/commons/src/test/resources/mykeystore.jks
new file mode 100644
index 0000000..335ebf8
Binary files /dev/null and b/modules/commons/src/test/resources/mykeystore.jks differ
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/pom.xml
----------------------------------------------------------------------
diff --git a/modules/commons/utils/pom.xml b/modules/commons/utils/pom.xml
deleted file mode 100644
index b3dd589..0000000
--- a/modules/commons/utils/pom.xml
+++ /dev/null
@@ -1,150 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--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. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.apache.airavata</groupId>
- <artifactId>commons</artifactId>
- <version>0.16-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>airavata-common-utils</artifactId>
- <packaging>jar</packaging>
- <name>Airavata Common Utilities</name>
- <url>http://airavata.apache.org/</url>
-
- <dependencies>
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- <version>2.9.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.xmlbeans</groupId>
- <artifactId>xmlbeans</artifactId>
- <version>${xmlbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.ogce</groupId>
- <artifactId>xpp3</artifactId>
- <version>${xpp3.version}</version>
- </dependency>
- <dependency>
- <groupId>org.ogce</groupId>
- <artifactId>xpp5</artifactId>
- <version>${xpp5.version}</version>
- </dependency>
- <!--dependency>
- <groupId>org.ogce</groupId>
- <artifactId>xsul</artifactId>
- <version>${xsul.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcprov-jdk16</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.ogce</groupId>
- <artifactId>xsul5</artifactId>
- <version>${xsul5.version}</version>
- </dependency>
- -->
- <dependency>
- <groupId>commons-dbcp</groupId>
- <artifactId>commons-dbcp</artifactId>
- <version>1.4</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>12.0</version>
- </dependency>
-
- <!-- Logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>${derby.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbyclient</artifactId>
- <version>${derby.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbynet</artifactId>
- <version>${derby.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbytools</artifactId>
- <version>${derby.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-core</artifactId>
- <version>7.0.22</version>
- </dependency>
- <dependency>
- <groupId>commons-cli</groupId>
- <artifactId>commons-cli</artifactId>
- <version>1.2</version>
- </dependency>
- <!-- Testing -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-server-configuration</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-framework</artifactId>
- <version>${curator.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- <version>${thrift.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>${google.gson.version}</version>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/context/RequestContext.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/context/RequestContext.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/context/RequestContext.java
deleted file mode 100644
index 724d3a3..0000000
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/context/RequestContext.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.common.context;
-
-/**
- * The request context class. This will be local to a thread. User data that needs to propagate relevant to a request
- * will be stored here. We use thread local globals to store request data. Currently we only store user identity.
- */
-public class RequestContext {
-
- public String getUserIdentity() {
- return userIdentity;
- }
-
- public void setUserIdentity(String userIdentity) {
- this.userIdentity = userIdentity;
- }
-
- /**
- * User associated with current request.
- */
- private String userIdentity;
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- /**
- * The gateway id.
- */
- private String gatewayId;
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/context/WorkflowContext.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/context/WorkflowContext.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/context/WorkflowContext.java
deleted file mode 100644
index 59142e4..0000000
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/context/WorkflowContext.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.common.context;
-
-/**
- * The workflow context class. This will be local to a thread. Workflow data that needs to propagate relevant to a
- * request will be stored here. We use thread local globals to store request data. Currently we only store user
- * identity.
- */
-public class WorkflowContext {
-
- private static final ThreadLocal userThreadLocal = new InheritableThreadLocal();
-
- /**
- * Sets the context.
- *
- * @param context
- * The context to be set. - Careful when calling this. Make sure other data relevant to context is
- * preserved.
- */
- public static void set(RequestContext context) {
- userThreadLocal.set(context);
- }
-
- /**
- * Clears the context
- */
- public static void unset() {
- userThreadLocal.remove();
- }
-
- /**
- * Gets the context associated with current context.
- *
- * @return The context associated with current thread.
- */
- public static RequestContext get() {
- return (RequestContext) userThreadLocal.get();
- }
-
- /**
- * Gets the user associated with current user.
- *
- * @return User id associated with current request.
- */
- public static synchronized String getRequestUser() {
-
- RequestContext requestContext = (RequestContext) userThreadLocal.get();
-
- if (requestContext != null) {
- return requestContext.getUserIdentity();
- }
-
- return null;
- }
-
- public static synchronized String getGatewayId() {
-
- RequestContext requestContext = (RequestContext) userThreadLocal.get();
-
- if (requestContext != null) {
- return requestContext.getGatewayId();
- }
-
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/AiravataConfigurationException.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/AiravataConfigurationException.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/AiravataConfigurationException.java
deleted file mode 100644
index 874e029..0000000
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/AiravataConfigurationException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.common.exception;
-
-public class AiravataConfigurationException extends AiravataException {
- private static final long serialVersionUID = -9124231436834631249L;
-
- public AiravataConfigurationException() {
- }
-
- public AiravataConfigurationException(String message){
- this(message, null);
- }
-
- public AiravataConfigurationException(String message, Throwable e){
- super(message,e);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/AiravataException.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/AiravataException.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/AiravataException.java
deleted file mode 100644
index a41b77d..0000000
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/AiravataException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.common.exception;
-
-public class AiravataException extends Exception {
-
- private static final long serialVersionUID = -5665822765183116821L;
- public AiravataException() {
- }
-
- public AiravataException(String message, Throwable e) {
- super(message,e);
- }
-
- public AiravataException(String message) {
- super(message);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/ApplicationSettingsException.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/ApplicationSettingsException.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/ApplicationSettingsException.java
deleted file mode 100644
index b669fe0..0000000
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/ApplicationSettingsException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.common.exception;
-
-public class ApplicationSettingsException extends AiravataException {
-
- private static final long serialVersionUID = -4901850535475160411L;
-
- public ApplicationSettingsException(String message) {
- super(message);
- }
-
- public ApplicationSettingsException(String message, Throwable e) {
- super(message, e);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/ApplicationSettingsLoadException.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/ApplicationSettingsLoadException.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/ApplicationSettingsLoadException.java
deleted file mode 100644
index 2735cf3..0000000
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/ApplicationSettingsLoadException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.common.exception;
-
-public class ApplicationSettingsLoadException extends ApplicationSettingsException {
-
- private static final long serialVersionUID = -5102090895499711299L;
- public ApplicationSettingsLoadException(String message) {
- super(message);
- }
-
- public ApplicationSettingsLoadException(Throwable e) {
- this(e.getMessage(),e);
- }
-
- public ApplicationSettingsLoadException(String message, Throwable e) {
- super(message,e);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/ApplicationSettingsStoreException.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/ApplicationSettingsStoreException.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/ApplicationSettingsStoreException.java
deleted file mode 100644
index 5f258bf..0000000
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/ApplicationSettingsStoreException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.common.exception;
-
-public class ApplicationSettingsStoreException extends ApplicationSettingsException {
-
- private static final long serialVersionUID = -5102090895499711299L;
- public ApplicationSettingsStoreException(String filePath) {
- super("Error while attempting to store settings in "+filePath);
- }
-
- public ApplicationSettingsStoreException(String filePath, Throwable e) {
- super(filePath,e);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/LazyLoadedDataException.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/LazyLoadedDataException.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/LazyLoadedDataException.java
deleted file mode 100644
index 4ba58d7..0000000
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/LazyLoadedDataException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.common.exception;
-
-public class LazyLoadedDataException extends AiravataException {
- private static final long serialVersionUID = -3164776318582067936L;
- public LazyLoadedDataException(String message) {
- super(message);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/UnspecifiedApplicationSettingsException.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/UnspecifiedApplicationSettingsException.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/UnspecifiedApplicationSettingsException.java
deleted file mode 100644
index c29ff24..0000000
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/UnspecifiedApplicationSettingsException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.common.exception;
-
-public class UnspecifiedApplicationSettingsException extends ApplicationSettingsException {
-
- private static final long serialVersionUID = -1159027432434546003L;
- public UnspecifiedApplicationSettingsException(String key) {
- super("The '"+key+"' is not configured in settings!!!");
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/UtilsException.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/UtilsException.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/UtilsException.java
deleted file mode 100644
index a412fe1..0000000
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/exception/UtilsException.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.common.exception;
-
-public class UtilsException extends Exception {
-
- /**
- * Constructs a UtilsException.
- *
- */
- public UtilsException() {
- super();
- }
-
- /**
- * Constructs a UtilsException.
- *
- * @param message
- */
- public UtilsException(String message) {
- super(message);
- }
-
- /**
- * Constructs a UtilsException.
- *
- * @param cause
- */
- public UtilsException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Constructs a UtilsException.
- *
- * @param message
- * @param cause
- */
- public UtilsException(String message, Throwable cause) {
- super(message, cause);
- }
-}