http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/SwingUtil.java ---------------------------------------------------------------------- diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/SwingUtil.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/SwingUtil.java deleted file mode 100644 index 5b413ae..0000000 --- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/SwingUtil.java +++ /dev/null @@ -1,361 +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.utils; - -import java.awt.Color; -import java.awt.Component; -import java.awt.Container; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Frame; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Image; -import java.awt.Insets; -import java.awt.Rectangle; -import java.awt.Toolkit; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.net.URL; -import java.util.List; - -import javax.swing.ImageIcon; -import javax.swing.JDialog; -import javax.swing.JOptionPane; -import javax.swing.JTextField; -import javax.swing.Spring; -import javax.swing.SpringLayout; - -public class SwingUtil { - - /** - * Minimum size, zero. - */ - public static final Dimension MINIMUM_SIZE = new Dimension(0, 0); - - /** - * The default distance between components. - */ - public static final int PAD = 6; - - /** - * Default cursor. - */ - public static final Cursor DEFAULT_CURSOR = new Cursor(Cursor.DEFAULT_CURSOR); - - /** - * Hand cursor. - */ - public static final Cursor HAND_CURSOR = new Cursor(Cursor.HAND_CURSOR); - - /** - * Cross hair cursor. - */ - public static final Cursor CROSSHAIR_CURSOR = new Cursor(Cursor.CROSSHAIR_CURSOR); - - /** - * Move cursor. - */ - public static final Cursor MOVE_CURSOR = new Cursor(Cursor.MOVE_CURSOR); - - /** - * Wait cursor. - */ - public static final Cursor WAIT_CURSOR = new Cursor(Cursor.WAIT_CURSOR); - - /** - * Creates an icon from an image contained in the "images" directory. - * - * @param filename - * @return the ImageIcon created - */ - public static ImageIcon createImageIcon(String filename) { - ImageIcon icon = null; - URL imgURL = getImageURL(filename); - if (imgURL != null) { - icon = new ImageIcon(imgURL); - } - return icon; - } - - /** - * Creates an image from an image contained in the "images" directory. - * - * @param filename - * @return the Image created - */ - public static Image createImage(String filename) { - Image icon = null; - URL imgURL = getImageURL(filename); - if (imgURL != null) { - icon = Toolkit.getDefaultToolkit().getImage(imgURL); - } - return icon; - } - - public static URL getImageURL(String filename) { - String path = "/images/" + filename; - URL imgURL = SwingUtil.class.getResource(path); - return imgURL; - } - - /** - * Return the Frame of a specified component if any. - * - * @param component - * the specified component - * - * @return the Frame of a specified component if any; otherwise null - */ - public static Frame getFrame(Component component) { - Frame frame; - Component parent; - while ((parent = component.getParent()) != null) { - component = parent; - } - if (component instanceof Frame) { - frame = (Frame) component; - } else { - frame = null; - } - return frame; - } - - /** - * Wight none of rows or eolumns. Used by layoutToGrid(). - */ - public final static int WEIGHT_NONE = -1; - - /** - * Weight all rows or columns equally. Used by layoutToGrid(). - */ - public final static int WEIGHT_EQUALLY = -2; - - /** - * Layouts the child components of a specified parent component using GridBagLayout. - * - * @param parent - * The specified parent component - * @param numRow - * The number of rows - * @param numColumn - * The number of columns - * @param weightedRow - * The row to weight - * @param weightedColumn - * The column to weight - */ - public static void layoutToGrid(Container parent, int numRow, int numColumn, int weightedRow, int weightedColumn) { - GridBagLayout layout = new GridBagLayout(); - parent.setLayout(layout); - GridBagConstraints constraints = new GridBagConstraints(); - - constraints.fill = GridBagConstraints.BOTH; - constraints.insets = new Insets(SwingUtil.PAD, SwingUtil.PAD, SwingUtil.PAD, SwingUtil.PAD); - - for (int row = 0; row < numRow; row++) { - constraints.gridy = row; - if (weightedRow == WEIGHT_EQUALLY) { - constraints.weighty = 1; - } else if (row == weightedRow) { - constraints.weighty = 1; - } else { - constraints.weighty = 0; - } - for (int column = 0; column < numColumn; column++) { - constraints.gridx = column; - if (weightedColumn == WEIGHT_EQUALLY) { - constraints.weightx = 1; - } else if (column == weightedColumn) { - constraints.weightx = 1; - } else { - constraints.weightx = 0; - } - Component component = parent.getComponent(row * numColumn + column); - layout.setConstraints(component, constraints); - } - } - } - - /** - * @param parent - * @param rowWeights - * @param columnWeights - */ - public static void layoutToGrid(Container parent, double[] rowWeights, double[] columnWeights) { - GridBagLayout layout = new GridBagLayout(); - parent.setLayout(layout); - GridBagConstraints constraints = new GridBagConstraints(); - - constraints.fill = GridBagConstraints.BOTH; - constraints.insets = new Insets(SwingUtil.PAD, SwingUtil.PAD, SwingUtil.PAD, SwingUtil.PAD); - - for (int row = 0; row < rowWeights.length; row++) { - constraints.gridy = row; - constraints.weighty = rowWeights[row]; - for (int column = 0; column < columnWeights.length; column++) { - constraints.gridx = column; - constraints.weightx = columnWeights[column]; - Component component = parent.getComponent(row * columnWeights.length + column); - layout.setConstraints(component, constraints); - } - } - } - - /** - * @param parent - * @param rowWeights - * @param columnWeights - */ - @SuppressWarnings("boxing") - public static void layoutToGrid(Container parent, List<Double> rowWeights, List<Double> columnWeights) { - GridBagLayout layout = new GridBagLayout(); - parent.setLayout(layout); - GridBagConstraints constraints = new GridBagConstraints(); - - constraints.fill = GridBagConstraints.BOTH; - constraints.insets = new Insets(SwingUtil.PAD, SwingUtil.PAD, SwingUtil.PAD, SwingUtil.PAD); - - for (int row = 0; row < rowWeights.size(); row++) { - constraints.gridy = row; - constraints.weighty = rowWeights.get(row); - for (int column = 0; column < columnWeights.size(); column++) { - constraints.gridx = column; - constraints.weightx = columnWeights.get(column); - Component component = parent.getComponent(row * columnWeights.size() + column); - layout.setConstraints(component, constraints); - } - } - } - - /** - * Aligns the first <code>rows</code> * <code>cols</code> components of <code>parent</code> in a grid. Each - * component in a column is as wide as the maximum preferred width of the components in that column; height is - * similarly determined for each row. The parent is made just big enough to fit them all. - * - * @param parent - * - * @param rows - * number of rows - * @param cols - * number of columns - */ - public static void makeSpringCompactGrid(Container parent, int rows, int cols) { - makeSpringCompactGrid(parent, rows, cols, PAD, PAD, PAD, PAD); - } - - /** - * Aligns the first <code>rows</code> * <code>cols</code> components of <code>parent</code> in a grid. Each - * component in a column is as wide as the maximum preferred width of the components in that column; height is - * similarly determined for each row. The parent is made just big enough to fit them all. - * - * @param parent - * - * @param rows - * number of rows - * @param cols - * number of columns - * @param initialX - * x location to start the grid at - * @param initialY - * y location to start the grid at - * @param xPad - * x padding between cells - * @param yPad - * y padding between cells - */ - private static void makeSpringCompactGrid(Container parent, int rows, int cols, int initialX, int initialY, - int xPad, int yPad) { - - SpringLayout layout = new SpringLayout(); - parent.setLayout(layout); - - // Align all cells in each column and make them the same width. - Spring x = Spring.constant(initialX); - for (int c = 0; c < cols; c++) { - Spring width = Spring.constant(0); - for (int r = 0; r < rows; r++) { - width = Spring.max(width, getConstraintsForCell(r, c, parent, cols).getWidth()); - } - for (int r = 0; r < rows; r++) { - SpringLayout.Constraints constraints = getConstraintsForCell(r, c, parent, cols); - constraints.setX(x); - constraints.setWidth(width); - } - x = Spring.sum(x, Spring.sum(width, Spring.constant(xPad))); - } - - // Align all cells in each row and make them the same height. - Spring y = Spring.constant(initialY); - for (int r = 0; r < rows; r++) { - Spring height = Spring.constant(0); - for (int c = 0; c < cols; c++) { - height = Spring.max(height, getConstraintsForCell(r, c, parent, cols).getHeight()); - } - for (int c = 0; c < cols; c++) { - SpringLayout.Constraints constraints = getConstraintsForCell(r, c, parent, cols); - constraints.setY(y); - constraints.setHeight(height); - } - y = Spring.sum(y, Spring.sum(height, Spring.constant(yPad))); - } - - // Set the parent's size. - SpringLayout.Constraints pCons = layout.getConstraints(parent); - pCons.setConstraint(SpringLayout.SOUTH, y); - pCons.setConstraint(SpringLayout.EAST, x); - } - - /* Used by makeCompactGrid. */ - private static SpringLayout.Constraints getConstraintsForCell(int row, int col, Container parent, int cols) { - SpringLayout layout = (SpringLayout) parent.getLayout(); - Component c = parent.getComponent(row * cols + col); - return layout.getConstraints(c); - } - - public static void addPlaceHolder(final JTextField field,final String placeHolderText){ - field.addFocusListener(new FocusListener(){ - private Color fontColor=field.getForeground(); -// private String previousText=field.getText(); - - public void focusGained(FocusEvent arg0) { - if (field.getText().equals(placeHolderText)){ - field.setText(""); - } - field.setForeground(fontColor); - } - - public void focusLost(FocusEvent arg0) { - if (field.getText().trim().equals("")){ - fontColor=field.getForeground(); - field.setForeground(Color.GRAY); - field.setText(placeHolderText); - } - } - }); - if (field.getText().trim().equals("")){ - field.setText(placeHolderText); - field.setForeground(Color.GRAY); - } - } - -} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ThriftUtils.java ---------------------------------------------------------------------- diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ThriftUtils.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ThriftUtils.java deleted file mode 100644 index ee86f74..0000000 --- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ThriftUtils.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.utils; - -import org.apache.thrift.TBase; -import org.apache.thrift.TDeserializer; -import org.apache.thrift.TException; -import org.apache.thrift.TSerializer; - -public class ThriftUtils { - public static byte[] serializeThriftObject(TBase object) throws TException { - return new TSerializer().serialize(object); - } - - public static void createThriftFromBytes(byte []bytes, TBase object) throws TException { - new TDeserializer().deserialize(object, bytes); - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/Version.java ---------------------------------------------------------------------- diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/Version.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/Version.java deleted file mode 100644 index fe34bb1..0000000 --- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/Version.java +++ /dev/null @@ -1,120 +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.utils; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlRootElement -public class Version { - public String PROJECT_NAME; - private Integer majorVersion=0; - private Integer minorVersion=0; - private Integer maintenanceVersion; - private String versionData; - private BuildType buildType; - - public static enum BuildType{ - ALPHA, - BETA, - RC - } - - public Version() { - } - - public Version(String PROJECT_NAME,Integer majorVersion,Integer minorVersion,Integer maintenanceVersion,String versionData,BuildType buildType) { - this.PROJECT_NAME=PROJECT_NAME; - this.majorVersion=majorVersion; - this.minorVersion=minorVersion; - this.maintenanceVersion=maintenanceVersion; - this.versionData=versionData; - this.buildType=buildType; - } - - public Integer getMajorVersion() { - return majorVersion; - } - - public Integer getMinorVersion() { - return minorVersion; - } - - public Integer getMaintenanceVersion() { - return maintenanceVersion; - } - - public String getVersionData() { - return versionData; - } - - public BuildType getBuildType() { - return buildType; - } - - public String getVersion(){ - String version = getBaseVersion(); - version = attachVersionData(version); - return version; - } - - private String attachVersionData(String version) { - if (getVersionData()!=null){ - version+="-"+getVersionData(); - } - return version; - } - - public String getBaseVersion() { - String version=getMajorVersion().toString()+"."+getMinorVersion(); - return version; - } - - public String getFullVersion(){ - String version = getBaseVersion(); - version = attachMaintainanceVersion(version); - version = attachVersionData(version); - version = attachBuildType(version); - return version; - } - - private String attachMaintainanceVersion(String version) { - if (getMaintenanceVersion()!=null){ - version+="."+getMaintenanceVersion(); - } - return version; - } - - private String attachBuildType(String version) { - if (getBuildType()!=null){ - version+="-"+getBuildType().name(); - } - return version; - } - - @Override - public String toString() { - return getVersion(); - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/WSConstants.java ---------------------------------------------------------------------- diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/WSConstants.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/WSConstants.java deleted file mode 100644 index 9737ac4..0000000 --- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/WSConstants.java +++ /dev/null @@ -1,187 +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.utils; - -import javax.xml.namespace.QName; - -import org.xmlpull.infoset.XmlNamespace; - -public interface WSConstants { - - /** - * xmlns - */ - public final static String XMLNS = "xmlns"; - - /** - * XML Schema prefix, xsd - */ - public static final String XSD_NS_PREFIX = "xsd"; - - /** - * XML Schema URI. - */ - public static final String XSD_NS_URI = "http://www.w3.org/2001/XMLSchema"; - -// /** -// * XML Schema Namespace -// */ -// public static final XmlNamespace XSD_NS = XmlConstants.BUILDER.newNamespace(XSD_NS_PREFIX, XSD_NS_URI); - - /** - * The any type. - */ - public static final QName XSD_ANY_TYPE = new QName(XSD_NS_URI, "any", XSD_NS_PREFIX); - - /** - * xsd:anyURI - */ - public static final QName XSD_ANY_URI = new QName(XSD_NS_URI, "anyURI", XSD_NS_PREFIX); - - /** - * tns - */ - public static final String TARGET_NS_PREFIX = "tns"; - - /** - * typens - */ - public static final String TYPE_NS_PREFIX = "typens"; - - /** - * schema - */ - public static final String SCHEMA_TAG = "schema"; - - /** - * Element name for annotation, annotation - */ - public static final String ANNOTATION_TAG = "annotation"; - - /** - * Element name for documentation, documentation - */ - public static final String DOCUMENTATION_TAG = "documentation"; - - /** - * appinfo - */ - public static final String APPINFO_TAG = "appinfo"; - - /** - * element - */ - public static final String ELEMENT_TAG = "element"; - - /** - * sequence - */ - public static final String SEQUENCE_TAG = "sequence"; - - /** - * complexType - */ - public static final String COMPLEX_TYPE_TAG = "complexType"; - - /** - * simpleType - */ - public static final String SIMPLE_TYPE_TAG = "simpleType"; - - /** - * name - */ - public static final String NAME_ATTRIBUTE = "name"; - - /** - * type - */ - public static final String TYPE_ATTRIBUTE = "type"; - - /** - * targetNamespace - */ - public static final String TARGET_NAMESPACE_ATTRIBUTE = "targetNamespace"; - - /** - * elementFormDefault - */ - public final static String ELEMENT_FORM_DEFAULT_ATTRIBUTE = "elementFormDefault"; - - /** - * unqualified - */ - public final static String UNQUALIFIED_VALUE = "unqualified"; - - /** - * default - */ - public static final String DEFAULT_ATTRIBUTE = "default"; - - /** - * UsingAddressing - */ - public static final String USING_ADDRESSING_TAG = "UsingAddressing"; - - /** - * <appinfo xmlns="http://www.w3.org/2001/XMLSchema"> - * - * </appinfo> - */ -// public static final String EMPTY_APPINFO = "<appinfo xmlns=\"http://www.w3.org/2001/XMLSchema\">\n\n</appinfo>"; - public static final String EMPTY_APPINFO = "{'appinfo': '' }"; - - /** - * minOccurs - */ - public static final String MIN_OCCURS_ATTRIBUTE = "minOccurs"; - - /** - * maxOccurs - */ - public static final String MAX_OCCURS_ATTRIBUTE = "maxOccurs"; - - /** - * unbounded - */ - public static final String UNBOUNDED_VALUE = "unbounded"; - - /** - * import - */ - public static final String IMPORT_TAG = "import"; - - /** - * schemaLocation - */ - public static final String SCHEMA_LOCATION_ATTRIBUTE = "schemaLocation"; - - public static final String LEAD_NS_URI = "http://www.extreme.indiana.edu/lead"; - - /** - * The any type. - */ - public static final QName LEAD_ANY_TYPE = new QName(LEAD_NS_URI, "any", - XSD_NS_PREFIX); - - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/WSDLUtil.java ---------------------------------------------------------------------- diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/WSDLUtil.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/WSDLUtil.java deleted file mode 100644 index 522bb73..0000000 --- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/WSDLUtil.java +++ /dev/null @@ -1,553 +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.utils; - -import java.io.IOException; -import java.io.StringReader; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.net.URLConnection; -import java.util.LinkedList; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.apache.airavata.common.exception.UtilsException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.xmlpull.infoset.XmlAttribute; -import org.xmlpull.infoset.XmlBuilderException; -import org.xmlpull.infoset.XmlElement; -import org.xmlpull.infoset.XmlNamespace; - -//import xsul.XmlConstants; -//import xsul5.wsdl.WsdlBinding; -//import xsul5.wsdl.WsdlDefinitions; -//import xsul5.wsdl.WsdlPortType; -//import xsul5.wsdl.WsdlPortTypeOperation; -//import xsul5.wsdl.WsdlUtil; - -public class WSDLUtil { - - private static final Logger logger = LoggerFactory.getLogger(WSDLUtil.class); - -// /** -// * @param wsdlString -// * @return The WSDL -// * @throws UtilsException -// */ -// public static WsdlDefinitions stringToWSDL(String wsdlString) throws UtilsException { -// try { -// XmlElement wsdlElement = XMLUtil.stringToXmlElement(wsdlString); -// WsdlDefinitions definitions = new WsdlDefinitions(wsdlElement); -// return definitions; -// } catch (RuntimeException e) { -// throw new UtilsException(e); -// } -// } -// -// /** -// * @param definitions3 -// * @return The WsdlDefinitions (XSUL5) -// */ -// public static xsul5.wsdl.WsdlDefinitions wsdlDefinitions3ToWsdlDefintions5(xsul.wsdl.WsdlDefinitions definitions3) { -// -// return new xsul5.wsdl.WsdlDefinitions(XMLUtil.xmlElement3ToXmlElement5(definitions3)); -// } -// -// /** -// * @param definitions5 -// * @return The WsdlDefinitions (XSUL3) -// */ -// public static xsul.wsdl.WsdlDefinitions wsdlDefinitions5ToWsdlDefintions3(xsul5.wsdl.WsdlDefinitions definitions5) { -// -// return new xsul.wsdl.WsdlDefinitions(XMLUtil.xmlElement5ToXmlElement3(definitions5.xml())); -// } -// -// /** -// * @param definitions -// * @return The name of the WSDL. -// */ -// public static String getWSDLName(WsdlDefinitions definitions) { -// String wsdlName = definitions.xml().attributeValue(WSConstants.NAME_ATTRIBUTE); -// if (wsdlName == null) { -// // name is optional. -// wsdlName = ""; -// } -// return wsdlName; -// } -// -// /** -// * @param definitions -// * @return The QName of the WSDL. -// */ -// public static QName getWSDLQName(WsdlDefinitions definitions) { -// String targetNamespace = definitions.getTargetNamespace(); -// String wsdlName = getWSDLName(definitions); -// return new QName(targetNamespace, wsdlName); -// } -// -// /** -// * @param definitions -// * @return The first portType -// * @throws UtilsException -// */ -// public static WsdlPortType getFirstPortType(WsdlDefinitions definitions) throws UtilsException { -// for (WsdlPortType portType : definitions.portTypes()) { -// return portType; -// } -// throw new UtilsException("No portType is defined in WSDL"); -// } -// -// public static WsdlPortTypeOperation getFirstOperation(WsdlDefinitions definitions) throws UtilsException { -// for (WsdlPortTypeOperation operation : getFirstPortType(definitions).operations()) { -// return operation; -// } -// throw new UtilsException("No portType is defined in WSDL"); -// } -// -// /** -// * @param definitions -// * @return The QName of the first portType. -// * @throws UtilsException -// */ -// public static QName getFirstPortTypeQName(WsdlDefinitions definitions) throws UtilsException { -// String targetNamespace = definitions.getTargetNamespace(); -// for (WsdlPortType portType : definitions.portTypes()) { -// String portTypeName = portType.getName(); -// QName portTypeQName = new QName(targetNamespace, portTypeName); -// return portTypeQName; -// } -// throw new UtilsException("No portType is defined."); -// } -// -// /** -// * @param definitions -// * @param portTypeQName -// * @return The name of the first operation in a given portType. -// * @throws UtilsException -// */ -// public static String getFirstOperationName(WsdlDefinitions definitions, QName portTypeQName) throws UtilsException { -// WsdlPortType portType = definitions.getPortType(portTypeQName.getLocalPart()); -// for (WsdlPortTypeOperation operation : portType.operations()) { -// String operationName = operation.getOperationName(); -// -// // XXX Temporary solution to skip some GFac specific operations. -// if ("Shutdown".equals(operationName)) { -// continue; -// } else if ("Kill".equals(operationName)) { -// continue; -// } else if ("Ping".equals(operationName)) { -// continue; -// } -// -// return operationName; -// } -// throw new UtilsException("No operation is defined"); -// } -// -// /** -// * @param definitions -// * @return The cloned WsdlDefinitions -// */ -// public static WsdlDefinitions deepClone(WsdlDefinitions definitions) throws UtilsException { -// return new WsdlDefinitions(XMLUtil.deepClone(definitions.xml())); -// } -// -// /** -// * @param definitions -// * @param paramType -// * @return The schema that includes the type definition -// */ -// public static XmlElement getSchema(WsdlDefinitions definitions, QName paramType) throws UtilsException { -// XmlElement types = definitions.getTypes(); -// -// Iterable<XmlElement> schemas = types.elements(WSConstants.XSD_NS, WSConstants.SCHEMA_TAG); -// for (XmlElement schema : schemas) { -// if (isTypeDefinedInSchema(paramType, schema)) { -// return schema; -// } -// } -// -// // ok we didnt find the type in the schema in first level -// // now we try try to see if it exist in schema imports. -// // we loop in two step because its better to avoid the network -// // connection if possible -// for (XmlElement schema : schemas) { -// Iterable<XmlElement> imports = schema.elements(WSConstants.XSD_NS, WSConstants.IMPORT_TAG); -// for (XmlElement importEle : imports) { -// String schemaLocation = importEle.attributeValue(WSConstants.SCHEMA_LOCATION_ATTRIBUTE); -// if (null != schemaLocation && !"".equals(schemaLocation)) { -// try { -// // connect using a url connection -// URL url = new URL(schemaLocation); -// URLConnection connection = url.openConnection(); -// connection.connect(); -// XmlElement importedSchema = xsul5.XmlConstants.BUILDER.parseFragmentFromInputStream(connection -// .getInputStream()); -// if (isTypeDefinedInSchema(paramType, importedSchema)) { -// // still return the parent schema -// return schema; -// } -// } catch (MalformedURLException e) { -// throw new UtilsException(e); -// } catch (XmlBuilderException e) { -// throw new UtilsException(e); -// } catch (IOException e) { -// throw new UtilsException(e); -// } -// } -// } -// } -// -// return null; -// } -// -// private static boolean isTypeDefinedInSchema(QName paramType, XmlElement schema) { -// String schemaTargetNamespace = schema.attributeValue(WSConstants.TARGET_NAMESPACE_ATTRIBUTE); -// if (schemaTargetNamespace.equals(paramType.getNamespaceURI())) { -// for (XmlElement complexType : schema.elements(WSConstants.XSD_NS, WSConstants.COMPLEX_TYPE_TAG)) { -// String complexTypeName = complexType.attributeValue(WSConstants.NAME_ATTRIBUTE); -// if (complexTypeName.equals(paramType.getLocalPart())) { -// return true; -// } -// } -// for (XmlElement simpleType : schema.elements(WSConstants.XSD_NS, WSConstants.SIMPLE_TYPE_TAG)) { -// String simpleTypeName = simpleType.attributeValue(WSConstants.NAME_ATTRIBUTE); -// if (simpleTypeName.equals(paramType.getLocalPart())) { -// return true; -// } -// } -// } -// return false; -// } -// -// /** -// * @param definitions -// * @param paramType -// * @return The type definition -// */ -// public static XmlElement getTypeDefinition(WsdlDefinitions definitions, QName paramType) throws UtilsException { -// XmlElement types = definitions.getTypes(); -// XmlElement returnType = null; -// types.element(null, WSConstants.SCHEMA_TAG); -// Iterable<XmlElement> schemas = types.elements(null, WSConstants.SCHEMA_TAG); -// for (XmlElement schema : schemas) { -// -// returnType = findTypeInSchema(paramType, schema); -// if (returnType != null) { -// return returnType; -// } -// } -// // ok we didnt find the type in the schemas -// // try to find it in the schema imports. -// -// // if not found it will return null so we would return null -// return findTypeDefinitionInImports(definitions, paramType); -// -// } -// -// /** -// * -// * @param definitions -// * @param paramType -// * @return -// */ -// -// public static XmlElement getImportContainingTypeDefinition(WsdlDefinitions definitions, QName paramType) -// throws UtilsException { -// XmlElement types = definitions.getTypes(); -// XmlElement returnType = null; -// Iterable<XmlElement> schemas = types.elements(WSConstants.XSD_NS, WSConstants.SCHEMA_TAG); -// for (XmlElement schema : schemas) { -// Iterable<XmlElement> imports = schema.elements(WSConstants.XSD_NS, WSConstants.IMPORT_TAG); -// for (XmlElement importEle : imports) { -// String schemaLocation = importEle.attributeValue(WSConstants.SCHEMA_LOCATION_ATTRIBUTE); -// if (null != schemaLocation && !"".equals(schemaLocation)) { -// try { -// // connect using a url connection -// URL url = new URL(schemaLocation); -// URLConnection connection = url.openConnection(); -// connection.connect(); -// XmlElement importedSchema = xsul5.XmlConstants.BUILDER.parseFragmentFromInputStream(connection -// .getInputStream()); -// returnType = findTypeInSchema(paramType, importedSchema); -// if (returnType != null) { -// return importEle; -// } -// -// } catch (MalformedURLException e) { -// throw new UtilsException(e); -// } catch (XmlBuilderException e) { -// throw new UtilsException(e); -// } catch (IOException e) { -// throw new UtilsException(e); -// } -// } -// } -// } -// return null; -// } -// -// /** -// * -// * @param definitions -// * @param paramType -// * @return -// */ -// -// public static XmlElement findTypeDefinitionInImports(WsdlDefinitions definitions, QName paramType) -// throws UtilsException { -// XmlElement types = definitions.getTypes(); -// XmlElement returnType = null; -// Iterable<XmlElement> schemas = types.elements(null, WSConstants.SCHEMA_TAG); -// for (XmlElement schema : schemas) { -// Iterable<XmlElement> imports = schema.elements(WSConstants.XSD_NS, WSConstants.IMPORT_TAG); -// for (XmlElement importEle : imports) { -// String schemaLocation = importEle.attributeValue(WSConstants.SCHEMA_LOCATION_ATTRIBUTE); -// if (null != schemaLocation && !"".equals(schemaLocation)) { -// try { -// // connect using a url connection -// URL url = new URL(schemaLocation); -// URLConnection connection = url.openConnection(); -// connection.connect(); -// XmlElement importedSchema = xsul5.XmlConstants.BUILDER.parseFragmentFromInputStream(connection -// .getInputStream()); -// returnType = findTypeInSchema(paramType, importedSchema); -// if (returnType != null) { -// return returnType; -// } -// -// } catch (MalformedURLException e) { -// throw new UtilsException(e); -// } catch (XmlBuilderException e) { -// throw new UtilsException(e); -// } catch (IOException e) { -// throw new UtilsException(e); -// } -// } -// } -// } -// return null; -// -// } -// -// private static XmlElement findTypeInSchema(QName paramType, XmlElement schema) { -// String schemaTargetNamespace = schema.attributeValue(WSConstants.TARGET_NAMESPACE_ATTRIBUTE); -// if (null != schemaTargetNamespace && schemaTargetNamespace.equals(paramType.getNamespaceURI())) { -// for (XmlElement complexType : schema.elements(WSConstants.XSD_NS, WSConstants.COMPLEX_TYPE_TAG)) { -// String complexTypeName = complexType.attributeValue(WSConstants.NAME_ATTRIBUTE); -// if (complexTypeName.equals(paramType.getLocalPart())) { -// return complexType; -// -// } -// } -// for (XmlElement simpleType : schema.elements(WSConstants.XSD_NS, WSConstants.SIMPLE_TYPE_TAG)) { -// String simpleTypeName = simpleType.attributeValue(WSConstants.NAME_ATTRIBUTE); -// if (simpleTypeName.equals(paramType.getLocalPart())) { -// return simpleType; -// } -// } -// } -// return null; -// } -// -// /** -// * @param wsdl -// * @return true if the WSDL is AWSDL; false otherwise. -// */ -// public static boolean isAWSDL(WsdlDefinitions wsdl) { -// if (wsdl.services().iterator().hasNext()) { -// return false; -// } -// return true; -// } -// -// /** -// * @param definitions -// * @return true if the service supports asynchronous invocation; false otherwise; -// */ -// public static boolean isAsynchronousSupported(WsdlDefinitions definitions) { -// for (WsdlBinding binding : definitions.bindings()) { -// XmlElement element = binding.xml().element(WSConstants.USING_ADDRESSING_TAG); -// if (element != null) { -// return true; -// } -// } -// return false; -// } -// -// /** -// * Converts a specified AWSDL to CWSDL using DSC URI. -// * -// * @param definitions -// * The specified AWSDL. This will be modified. -// * @param url -// * The URL of the service -// * @return The CWSDL converted. -// */ -// public static WsdlDefinitions convertToCWSDL(WsdlDefinitions definitions, URI url) { -// for (WsdlPortType portType : definitions.portTypes()) { -// WsdlUtil.createCWSDL(definitions, portType, url); -// } -// return definitions; -// } - - /** - * @param uri - * @return The URI with "?wsdl" at the end. - */ - public static String appendWSDLQuary(String uri) { - URI wsdlURI = appendWSDLQuary(URI.create(uri)); - return wsdlURI.toString(); - } - - public static List<XmlNamespace> getNamespaces(XmlElement element) { - LinkedList<XmlNamespace> namespaces = new LinkedList<XmlNamespace>(); - namespaces.add(element.getNamespace()); - Iterable<XmlAttribute> attributes = element.attributes(); - for (XmlAttribute xmlAttribute : attributes) { - if (xmlAttribute.getNamespace() != null && !namespaces.contains(xmlAttribute.getNamespace())) { - namespaces.add(xmlAttribute.getNamespace()); - } - int index = xmlAttribute.getValue().indexOf(':'); - if (-1 != index) { - String prefix = xmlAttribute.getValue().substring(0, index); - if (element.lookupNamespaceByPrefix(prefix) != null) { - namespaces.add(element.lookupNamespaceByPrefix(prefix)); - } - } - } - Iterable children = element.children(); - for (Object object : children) { - if (object instanceof XmlElement) { - List<XmlNamespace> newNSs = getNamespaces((XmlElement) object); - for (XmlNamespace xmlNamespace : newNSs) { - if (!namespaces.contains(xmlNamespace)) { - namespaces.add(xmlNamespace); - } - } - } - } - return namespaces; - } - - /** - * @param uri - * @return The URI with "?wsdl" at the end. - */ - public static URI appendWSDLQuary(URI uri) { - if (uri.toString().endsWith("?wsdl")) { - logger.warn("URL already has ?wsdl at the end: " + uri.toString()); - // Don't throw exception to be more error tolerant. - return uri; - } - String path = uri.getPath(); - if (path == null || path.length() == 0) { - uri = uri.resolve("/"); - } - uri = URI.create(uri.toString() + "?wsdl"); - return uri; - } - -// /** -// * @param valueElement -// * @return -// */ -// public static org.xmlpull.v1.builder.XmlElement xmlElement5ToXmlElementv1(XmlElement valueElement) { -// -// return XmlConstants.BUILDER.parseFragmentFromReader(new StringReader(xsul5.XmlConstants.BUILDER -// .serializeToStringPretty(valueElement))); -// } - - /** - * - * @param vals - * @param <T> - * @return - */ - public static <T extends Object> T getfirst(Iterable<T> vals) { - for (T class1 : vals) { - return class1; - } - throw new RuntimeException("Iterator empty"); - - } - -// /** -// * @param serviceSchema -// */ -// public static void print(XmlElement serviceSchema) { -// System.out.println(xsul5.XmlConstants.BUILDER.serializeToStringPretty(serviceSchema)); -// } - - /** - * @param workflowID - * @return - */ - public static String findWorkflowName(URI workflowID) { - String[] splits = workflowID.toString().split("/"); - return splits[splits.length - 1]; - - } - - /** - * - * @param element - * @param name - * @param oldValue - * @param newValue - */ - public static void replaceAttributeValue(XmlElement element, String name, String oldValue, String newValue) { - XmlAttribute attribute = element.attribute(name); - if (null != attribute && oldValue.equals(attribute.getValue())) { - element.removeAttribute(attribute); - element.setAttributeValue(name, newValue); - } - Iterable iterator = element.children(); - for (Object object : iterator) { - if (object instanceof XmlElement) { - replaceAttributeValue((XmlElement) object, name, oldValue, newValue); - } - } - - } - - public static boolean attributeExist(XmlElement element, String name, String value) { - XmlAttribute attribute = element.attribute(name); - if (null != attribute && value.equals(attribute.getValue())) { - return true; - } - Iterable iterator = element.children(); - boolean ret = false; - for (Object object : iterator) { - if (object instanceof XmlElement) { - ret = ret || attributeExist((XmlElement) object, name, value); - } - } - return ret; - - } - - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/XMLUtil.java ---------------------------------------------------------------------- diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/XMLUtil.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/XMLUtil.java deleted file mode 100644 index 0ba02f9..0000000 --- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/XMLUtil.java +++ /dev/null @@ -1,586 +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.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/utils/src/main/java/org/apache/airavata/common/utils/XmlFormatter.java ---------------------------------------------------------------------- diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/XmlFormatter.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/XmlFormatter.java deleted file mode 100644 index 1440dbf..0000000 --- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/XmlFormatter.java +++ /dev/null @@ -1,82 +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.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/utils/src/main/java/org/apache/airavata/common/utils/listener/AbstractActivityListener.java ---------------------------------------------------------------------- diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/listener/AbstractActivityListener.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/listener/AbstractActivityListener.java deleted file mode 100644 index e972012..0000000 --- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/listener/AbstractActivityListener.java +++ /dev/null @@ -1,27 +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.utils.listener; - - -public interface AbstractActivityListener { - public void setup(Object... configurations); -} http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/listener/AbstractStateChangeRequest.java ---------------------------------------------------------------------- diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/listener/AbstractStateChangeRequest.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/listener/AbstractStateChangeRequest.java deleted file mode 100644 index 8529c4b..0000000 --- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/listener/AbstractStateChangeRequest.java +++ /dev/null @@ -1,27 +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.utils.listener; - - -public abstract class AbstractStateChangeRequest implements PublisherMessage { - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/listener/PublisherMessage.java ---------------------------------------------------------------------- diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/listener/PublisherMessage.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/listener/PublisherMessage.java deleted file mode 100644 index 0d5404a..0000000 --- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/listener/PublisherMessage.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package 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/utils/src/test/java/org/apache/airavata/common/utils/ApplicationSettingsTest.java ---------------------------------------------------------------------- diff --git a/modules/commons/utils/src/test/java/org/apache/airavata/common/utils/ApplicationSettingsTest.java b/modules/commons/utils/src/test/java/org/apache/airavata/common/utils/ApplicationSettingsTest.java deleted file mode 100644 index ed61793..0000000 --- a/modules/commons/utils/src/test/java/org/apache/airavata/common/utils/ApplicationSettingsTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.common.utils; - -import junit.framework.Assert; -import junit.framework.TestCase; - -/** - * User: AmilaJ ([email protected]) - * 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/utils/src/test/java/org/apache/airavata/common/utils/SecurityUtilTest.java ---------------------------------------------------------------------- diff --git a/modules/commons/utils/src/test/java/org/apache/airavata/common/utils/SecurityUtilTest.java b/modules/commons/utils/src/test/java/org/apache/airavata/common/utils/SecurityUtilTest.java deleted file mode 100644 index aa87283..0000000 --- a/modules/commons/utils/src/test/java/org/apache/airavata/common/utils/SecurityUtilTest.java +++ /dev/null @@ -1,104 +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.utils; - -import junit.framework.Assert; -import org.junit.Test; - -import java.io.InputStream; -import java.net.URL; -import java.security.KeyStore; - -/** - * User: AmilaJ ([email protected]) - * 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/utils/src/test/java/org/apache/airavata/common/utils/XMLUtilTest.java ---------------------------------------------------------------------- diff --git a/modules/commons/utils/src/test/java/org/apache/airavata/common/utils/XMLUtilTest.java b/modules/commons/utils/src/test/java/org/apache/airavata/common/utils/XMLUtilTest.java deleted file mode 100644 index 3c2c189..0000000 --- a/modules/commons/utils/src/test/java/org/apache/airavata/common/utils/XMLUtilTest.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.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/utils/src/test/resources/mykeystore.jks ---------------------------------------------------------------------- diff --git a/modules/commons/utils/src/test/resources/mykeystore.jks b/modules/commons/utils/src/test/resources/mykeystore.jks deleted file mode 100644 index 335ebf8..0000000 Binary files a/modules/commons/utils/src/test/resources/mykeystore.jks and /dev/null differ http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/credential-store/credential-store-service/pom.xml ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/pom.xml b/modules/credential-store/credential-store-service/pom.xml index 6a80bba..882e2ec 100644 --- a/modules/credential-store/credential-store-service/pom.xml +++ b/modules/credential-store/credential-store-service/pom.xml @@ -114,7 +114,7 @@ </dependency> <dependency> <groupId>org.apache.airavata</groupId> - <artifactId>airavata-common-utils</artifactId> + <artifactId>airavata-commons</artifactId> <version>${project.version}</version> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java index de84ae2..979dedc 100644 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java +++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/notifier/NotifierBootstrap.java @@ -43,7 +43,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.text.ParseException; -import java.text.SimpleDateFormat; import java.util.*; /** http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java index ebed9a1..9fa3adb 100644 --- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java +++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java @@ -34,7 +34,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.net.InetAddress; -import java.net.InetSocketAddress; public class CredentialStoreServer implements IServer { private final static Logger logger = LoggerFactory.getLogger(CredentialStoreServer.class); http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/credential-store/credential-store-stubs/pom.xml ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-stubs/pom.xml b/modules/credential-store/credential-store-stubs/pom.xml index 7af8152..32a4f64 100644 --- a/modules/credential-store/credential-store-stubs/pom.xml +++ b/modules/credential-store/credential-store-stubs/pom.xml @@ -37,7 +37,7 @@ </dependency> <dependency> <groupId>org.apache.airavata</groupId> - <artifactId>airavata-common-utils</artifactId> + <artifactId>airavata-commons</artifactId> <version>${project.version}</version> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/airavata/blob/8d16d0ec/modules/credential-store/credential-store-webapp/pom.xml ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-webapp/pom.xml b/modules/credential-store/credential-store-webapp/pom.xml index 2e66d05..dcac26a 100644 --- a/modules/credential-store/credential-store-webapp/pom.xml +++ b/modules/credential-store/credential-store-webapp/pom.xml @@ -100,7 +100,7 @@ </dependency> <dependency> <groupId>org.apache.airavata</groupId> - <artifactId>airavata-common-utils</artifactId> + <artifactId>airavata-commons</artifactId> <version>${project.version}</version> </dependency> <dependency>
