http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/config/ui/MinimalLayout.java ---------------------------------------------------------------------- diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/config/ui/MinimalLayout.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/config/ui/MinimalLayout.java deleted file mode 100644 index 153b982..0000000 --- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/config/ui/MinimalLayout.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (C) 2003 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. Authorship - * of the modifications may be determined from the ChangeLog placed at - * the end of this file. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - * - **************************************************************** - * Source code information - * ----------------------- - * Filename $RCSfile: MinimalLayout.java,v $ - * Revision $Revision: 1.1 $ - * Release status $State: Exp $ - * Last modified on $Date: 2007/06/27 12:49:48 $ - * by $Author: davidwithers $ - * Created on 26 Jun 2007 - *****************************************************************/ -package org.biomart.martservice.config.ui; - -import java.awt.Component; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.Insets; -import java.awt.LayoutManager; - -/** - * A layout manager that lays out components, either horizontally or vertically, - * according to their minimum size. - * - * @author David Withers - */ -class MinimalLayout implements LayoutManager { - public static final int HORIZONTAL = 0; - - public static final int VERTICAL = 1; - - private static final int gap = 5; - - private int type; - - public MinimalLayout() { - type = HORIZONTAL; - } - - public MinimalLayout(int type) { - this.type = type; - } - - /* - * (non-Javadoc) - * - * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component) - */ - public void removeLayoutComponent(Component comp) { - } - - /* - * (non-Javadoc) - * - * @see java.awt.LayoutManager#layoutContainer(java.awt.Container) - */ - public void layoutContainer(Container parent) { - Insets insets = parent.getInsets(); - int x = insets.left; - int y = insets.top; - if (type == HORIZONTAL) { - Component[] components = parent.getComponents(); - for (int i = 0; i < components.length; i++) { - components[i].setLocation(x, y); - components[i].setSize(getSize(components[i])); - x = x + gap + components[i].getWidth(); - } - } else { - Component[] components = parent.getComponents(); - for (int i = 0; i < components.length; i++) { - components[i].setLocation(x, y); - components[i].setSize(getSize(components[i])); - y = y + gap + components[i].getHeight(); - } - } - } - - /* - * (non-Javadoc) - * - * @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, - * java.awt.Component) - */ - public void addLayoutComponent(String name, Component comp) { - } - - /* - * (non-Javadoc) - * - * @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container) - */ - public Dimension minimumLayoutSize(Container parent) { - Insets insets = parent.getInsets(); - Dimension minimumSize = new Dimension(insets.left, insets.top); - if (type == HORIZONTAL) { - int x = insets.left; - Component[] components = parent.getComponents(); - for (int i = 0; i < components.length; i++) { - Dimension size = getSize(components[i]); - if (insets.top + size.height > minimumSize.height) { - minimumSize.height = insets.top + size.height; - } - minimumSize.width = x + size.width; - x = x + size.width + gap; - } - } else { - int y = insets.top; - Component[] components = parent.getComponents(); - for (int i = 0; i < components.length; i++) { - Dimension size = getSize(components[i]); - if (insets.left + size.width > minimumSize.width) { - minimumSize.width = insets.left + size.width; - } - minimumSize.height = y + size.height; - y = y + size.height + gap; - } - } - minimumSize.width = minimumSize.width + insets.right; - minimumSize.height = minimumSize.height + insets.bottom; - - return (minimumSize); - } - - /* - * (non-Javadoc) - * - * @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container) - */ - public Dimension preferredLayoutSize(Container parent) { - return minimumLayoutSize(parent); - } - - private Dimension getSize(Component component) { - return component.getPreferredSize(); - } - -}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/config/ui/QueryComponent.java ---------------------------------------------------------------------- diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/config/ui/QueryComponent.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/config/ui/QueryComponent.java deleted file mode 100644 index b976684..0000000 --- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/config/ui/QueryComponent.java +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright (C) 2003 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. Authorship - * of the modifications may be determined from the ChangeLog placed at - * the end of this file. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - * - **************************************************************** - * Source code information - * ----------------------- - * Filename $RCSfile: QueryComponent.java,v $ - * Revision $Revision: 1.2 $ - * Release status $State: Exp $ - * Last modified on $Date: 2007/12/13 11:38:56 $ - * by $Author: davidwithers $ - * Created on 03-Apr-2006 - *****************************************************************/ -package org.biomart.martservice.config.ui; - -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.util.Vector; - -import javax.swing.AbstractButton; -import javax.swing.JPanel; - -import org.biomart.martservice.MartDataset; -import org.biomart.martservice.config.event.QueryComponentEvent; -import org.biomart.martservice.config.event.QueryComponentListener; -import org.ensembl.mart.lib.config.BaseNamedConfigurationObject; - -/** - * Abstract class for creating query configuration UI components. - * - * @author David Withers - */ -public abstract class QueryComponent extends JPanel { - public static final int ATTRIBUTE = 0; - - public static final int FILTER = 1; - - public static final int LINK = 2; - - private Vector<QueryComponentListener> queryComponentListeners = new Vector<QueryComponentListener>(); - - private MartDataset dataset; - - private String pointerDataset; - - private String name; - - private String value; - - private BaseNamedConfigurationObject configObject; - - protected AbstractButton selectorButton; - - public abstract int getType(); - - /** - * Returns the dataset. - * - * @return the dataset. - */ - public MartDataset getDataset() { - return dataset; - } - - /** - * Sets the dataset. - * - * @param dataset - * the dataset to set. - */ - public void setDataset(MartDataset dataset) { - this.dataset = dataset; - } - - /** - * Returns the pointerDataset. - * - * @return the pointerDataset - */ - public String getPointerDataset() { - return pointerDataset; - } - - /** - * Sets the pointerDataset. - * - * @param pointerDataset the new pointerDataset - */ - public void setPointerDataset(String pointerDataset) { - this.pointerDataset = pointerDataset; - } - - /** - * Returns the name. - * - * @return the name. - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set. - */ - public void setName(String name) { - this.name = name; - } - - public String getQualifiedName() { - return getDataset().getName() + "." + getName(); - } - - public String getOldQualifiedName() { - if (pointerDataset == null) { - return getDataset().getName() + "." + getName(); - } else { - return pointerDataset + "." + getName(); - } - } - - /** - * Returns the value. - * - * @return the value. - */ - public String getValue() { - return value; - } - - /** - * Sets the value. - * - * @param value - * the value to set. - */ - public void setValue(String value) { - this.value = value; - } - - /** - * Returns the configObject. - * - * @return the configObject - */ - public BaseNamedConfigurationObject getConfigObject() { - return configObject; - } - - /** - * Sets the configObject. - * - * @param configObject - * the configObject to set. - */ - public void setConfigObject(BaseNamedConfigurationObject configObject) { - this.configObject = configObject; - } - - /** - * Sets the selected state of this component. - * - * @param selected - * <code>true</code> if this component is selected, - * <code>false</code> otherwise - */ - public void setSelected(boolean selected) { - if (selectorButton != null) { - selectorButton.setSelected(selected); - } - } - - /** - * Sets the button used to select/deselect this QueryComponent. - * - * This function adds an ItemListener to the button and fires the - * appropriate QueryComponentEvent when the button is selected or - * deselected. - * - * @param button - * the button used to select/deselect this QueryComponent. - */ - public void setSelectorButton(AbstractButton button) { - selectorButton = button; - button.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - if (getType() == ATTRIBUTE) { - fireAttributeAdded(new QueryComponentEvent( - QueryComponent.this, getName(), getDataset())); - } else { - fireFilterAdded(new QueryComponentEvent( - QueryComponent.this, getName(), getDataset())); - } - } else if (e.getStateChange() == ItemEvent.DESELECTED) { - if (getType() == ATTRIBUTE) { - fireAttributeRemoved(new QueryComponentEvent( - QueryComponent.this, getName(), getDataset())); - } else { - fireFilterRemoved(new QueryComponentEvent( - QueryComponent.this, getName(), getDataset())); - } - } - } - }); - } - - /** - * Adds the specified query component listener to receive query component - * events. If <code>listener</code> is null, no exception is thrown and no - * action is performed. - * - * @param listener - * the query component listener - */ - public void addQueryComponentListener(QueryComponentListener listener) { - queryComponentListeners.add(listener); - } - - /** - * Removes the specified query component listener so that it no longer - * receives component query events. This method performs no function, nor - * does it throw an exception, if <code>listener</code> was not previously - * added to this component. If <code>listener</code> is null, no exception - * is thrown and no action is performed. - * - * @param listener - * the query component listener - */ - public void removeQueryComponentListener(QueryComponentListener listener) { - queryComponentListeners.remove(listener); - } - - /** - * Fires an attribute added event. - * - * @param event the event to be fired - */ - protected void fireAttributeAdded(QueryComponentEvent event) { - for (QueryComponentListener listener : queryComponentListeners) { - listener.attributeAdded(event); - } - } - - /** - * Fires an attribute removed event. - * - * @param event the event to be fired - */ - protected void fireAttributeRemoved(QueryComponentEvent event) { - for (QueryComponentListener listener : queryComponentListeners) { - listener.attributeRemoved(event); - } - } - - /** - * Fires an filter added event. - * - * @param event the event to be fired - */ - protected void fireFilterAdded(QueryComponentEvent event) { - for (QueryComponentListener listener : queryComponentListeners) { - listener.filterAdded(event); - } - } - - /** - * Fires an filter removed event. - * - * @param event the event to be fired - */ - protected void fireFilterRemoved(QueryComponentEvent event) { - for (QueryComponentListener listener : queryComponentListeners) { - listener.filterRemoved(event); - } - } - - /** - * Fires an filter changed event. - * - * @param event the event to be fired - */ - protected void fireFilterChanged(QueryComponentEvent event) { - for (QueryComponentListener listener : queryComponentListeners) { - listener.filterChanged(event); - } - } - - /** - * Fires an link added event. - * - * @param event the event to be fired - */ - protected void fireLinkAdded(QueryComponentEvent event) { - for (QueryComponentListener listener : queryComponentListeners) { - listener.linkAdded(event); - } - } - - /** - * Fires an link removed event. - * - * @param event the event to be fired - */ - protected void fireLinkRemoved(QueryComponentEvent event) { - for (QueryComponentListener listener : queryComponentListeners) { - listener.linkRemoved(event); - } - } - - /** - * Fires an link changed event. - * - * @param event the event to be fired - */ - protected void fireLinkChanged(QueryComponentEvent event) { - for (QueryComponentListener listener : queryComponentListeners) { - listener.linkChanged(event); - } - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/config/ui/QueryConfigUIFactory.java ---------------------------------------------------------------------- diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/config/ui/QueryConfigUIFactory.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/config/ui/QueryConfigUIFactory.java deleted file mode 100644 index d0a740a..0000000 --- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/config/ui/QueryConfigUIFactory.java +++ /dev/null @@ -1,345 +0,0 @@ -/* - * Copyright (C) 2003 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. Authorship - * of the modifications may be determined from the ChangeLog placed at - * the end of this file. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - * - **************************************************************** - * Source code information - * ----------------------- - * Filename $RCSfile: QueryConfigUIFactory.java,v $ - * Revision $Revision: 1.1 $ - * Release status $State: Exp $ - * Last modified on $Date: 2007/01/31 14:12:08 $ - * by $Author: davidwithers $ - * Created on 04-Apr-2006 - *****************************************************************/ -package org.biomart.martservice.config.ui; - -import java.awt.Component; - -import org.biomart.martservice.MartServiceException; -import org.ensembl.mart.lib.config.AttributeCollection; -import org.ensembl.mart.lib.config.AttributeDescription; -import org.ensembl.mart.lib.config.AttributeGroup; -import org.ensembl.mart.lib.config.AttributeList; -import org.ensembl.mart.lib.config.AttributePage; -import org.ensembl.mart.lib.config.FilterCollection; -import org.ensembl.mart.lib.config.FilterDescription; -import org.ensembl.mart.lib.config.FilterGroup; -import org.ensembl.mart.lib.config.FilterPage; - -/** - * Interface for generating graphical components from <code>DatasetConfig</code> - * objects. - * - * @author David Withers - */ -public interface QueryConfigUIFactory { - - public final static String SINGLE_SELECTION = "SINGLE"; - - public final static String MULTIPLE_SELECTION = "MULTIPLE"; - - public final static String LIST_SELECTION = "LIST"; - - /** - * Generates a <code>Component</code> for a <code>DatasetConfig</code>. - * - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getDatasetConfigUI() throws MartServiceException; - - /** - * Generates a <code>Component</code> for an array of - * <code>AttributePage</code>. - * - * @param attributePages - * an array of <code>AttributePage</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getAttributePagesUI(AttributePage[] attributePages, - Object data) throws MartServiceException; - - /** - * Generates a <code>Component</code> for an <code>AttributePage</code>. - * - * @param attributePage - * an <code>AttributePage</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getAttributePageUI(AttributePage attributePage, Object data) - throws MartServiceException; - - /** - * Generates a <code>Component</code> for an array of - * <code>AttributeGroup</code>. - * - * @param attributeGroups - * an array of <code>AttributeGroup</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getAttributeGroupsUI(AttributeGroup[] attributeGroups, - Object data) throws MartServiceException; - - /** - * Generates a <code>Component</code> for an <code>AttributeGroup</code>. - * - * @param attributeGroup - * an <code>AttributeGroup</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getAttributeGroupUI(AttributeGroup attributeGroup, - Object data) throws MartServiceException; - - /** - * Generates a <code>Component</code> for an array of - * <code>AttributeCollection</code>. - * - * @param attributeCollections - * an array of <code>AttributeCollection</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getAttributeCollectionsUI( - AttributeCollection[] attributeCollections, Object data) - throws MartServiceException; - - /** - * Generates a <code>Component</code> for an - * <code>AttributeCollection</code>. - * - * @param attributeCollection - * an <code>AttributeCollection</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getAttributeCollectionUI( - AttributeCollection attributeCollection, Object data) - throws MartServiceException; - - /** - * Generates a <code>Component</code> for an array of - * <code>AttributeDescription</code>. - * - * @param attributeDescriptions - * an array of <code>AttributeDescription</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getAttributeDescriptionsUI( - AttributeDescription[] attributeDescriptions, Object data) - throws MartServiceException; - - /** - * Generates a <code>Component</code> for an - * <code>AttributeDescription</code>. - * - * @param attributeDescription - * an <code>AttributeDescription</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getAttributeDescriptionUI( - AttributeDescription attributeDescription, Object data) - throws MartServiceException; - - /** - * Generates a <code>Component</code> for an array of - * <code>AttributeList</code>. - * - * @param attributeLists - * an array of <code>AttributeList</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getAttributeListsUI( - AttributeList[] attributeLists, Object data) - throws MartServiceException; - - /** - * Generates a <code>Component</code> for an - * <code>AttributeList</code>. - * - * @param attributeList - * an <code>AttributeList</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getAttributeListUI( - AttributeList attributeList, Object data) - throws MartServiceException; - - /** - * Generates a <code>Component</code> for an array of - * <code>FilterPage</code>. - * - * @param filterPages - * an array of <code>FilterPage</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getFilterPagesUI(FilterPage[] filterPages, Object data) - throws MartServiceException; - - /** - * Generates a <code>Component</code> for a <code>FilterPage</code>. - * - * @param filterPage - * a <code>FilterPage</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getFilterPageUI(FilterPage filterPage, Object data) - throws MartServiceException; - - /** - * Generates a <code>Component</code> for an array of - * <code>FilterGroup</code>. - * - * @param filterGroups - * an array of <code>FilterGroup</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getFilterGroupsUI(FilterGroup[] filterGroups, Object data) - throws MartServiceException; - - /** - * Generates a <code>Component</code> for a <code>FilterGroup</code>. - * - * @param filterGroup - * a <code>FilterGroup</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getFilterGroupUI(FilterGroup filterGroup, Object data) - throws MartServiceException; - - /** - * Generates a <code>Component</code> for an array of - * <code>FilterCollection</code>. - * - * @param filterCollections - * an array of <code>FilterCollection</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getFilterCollectionsUI( - FilterCollection[] filterCollections, Object data) - throws MartServiceException; - - /** - * Generates a <code>Component</code> for a <code>FilterCollection</code>. - * - * @param filterCollection - * a <code>FilterCollection</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getFilterCollectionUI(FilterCollection filterCollection, - Object data) throws MartServiceException; - - /** - * Generates a <code>Component</code> for an array of - * <code>FilterDescription</code>. - * - * @param filterDescriptions - * an array of <code>FilterDescription</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getFilterDescriptionsUI( - FilterDescription[] filterDescriptions, Object data) - throws MartServiceException; - - /** - * Generates a <code>Component</code> for a <code>FilterDescription</code>. - * - * @param filterDescription - * a <code>FilterDescription</code> - * @param data - * extra context information - * @return the generated <code>Component</code> - * @throws MartServiceException - * if the MartService returns an error or is unavailable - */ - public Component getFilterDescriptionUI( - FilterDescription filterDescription, Object data) - throws MartServiceException; - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Attribute.java ---------------------------------------------------------------------- diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Attribute.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Attribute.java deleted file mode 100644 index 7ec9932..0000000 --- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Attribute.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (C) 2003 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. Authorship - * of the modifications may be determined from the ChangeLog placed at - * the end of this file. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - * - **************************************************************** - * Source code information - * ----------------------- - * Filename $RCSfile: Attribute.java,v $ - * Revision $Revision: 1.2 $ - * Release status $State: Exp $ - * Last modified on $Date: 2008/03/04 16:43:40 $ - * by $Author: davidwithers $ - * Created on 26-Apr-2006 - *****************************************************************/ -package org.biomart.martservice.query; - -/** - * Class for creating attribute elements of mart queries. - * - * @author David Withers - */ -public class Attribute { - private String name; - - private String attributes; - - private int attributesCount; - - private Dataset containingDataset; - - /** - * Constructs an instance of an <code>Attribute</code> with the specified name. - * - * @param name - * the name of the <code>Attribute</code>; must not be <code>null</code> - */ - public Attribute(String name) { - if (name == null) { - throw new IllegalArgumentException("Parameter 'name' must not be null"); - } - this.name = name; - } - - /** - * Constructs an instance of an <code>Attribute</code> which is a copy of - * another <code>Attribute</code>. - * - * @param attribute - * the <code>Attribute</code> to copy; must not be <code>null</code> - */ - public Attribute(Attribute attribute) { - if (attribute == null) { - throw new IllegalArgumentException("Parameter 'attribute' must not be null"); - } - setName(attribute.getName()); - setAttributes(attribute.getAttributes()); - } - - /** - * Returns the name of the Attribute. - * - * @return the name of the Attribute - */ - public String getName() { - return name; - } - - /** - * Sets the name of the Attribute. - * - * @param name - * the name of the Attribute; must not be <code>null</code> - */ - public void setName(String name) { - if (name == null) { - throw new IllegalArgumentException("Parameter 'name' must not be null"); - } - this.name = name; - } - - /** - * Returns the qualified name of this <code>Attribute</code>. - * - * The qualified name is <code>containingDatasetName.attributeName</code> - * or just <code>attributeName</code> if the <code>Attribute</code> is - * not in a <code>Dataset</code>. - * - * @return the qualified name of this <code>Attribute</code> - */ - public String getQualifiedName() { - if (containingDataset == null) { - return name; - } else { - return containingDataset.getName() + "." + getName(); - } - } - - /** - * Returns the component attributes as a comma separated list. - * - * @return the attributes as a comma separated list or null if there are no component attributes - */ - public String getAttributes() { - return attributes; - } - - /** - * Sets the attributes. - * - * @param attributes the new attributes - */ - public void setAttributes(String attributes) { - this.attributes = attributes; - if (attributes == null) { - attributesCount = 0; - } else { - attributesCount = attributes.split(",").length; - } - } - - /** - * Returns the number of component attributes. - * - * @return the number of component attributes - */ - public int getAttributesCount() { - return attributesCount; - } - - /** - * Returns the Dataset containing this Attribute or null if it is not in a - * Dataset. - * - * @return the Dataset containing this Attribute or null if it is not in a - * Dataset - */ - public Dataset getContainingDataset() { - return containingDataset; - } - - /** - * Sets the containing Dataset. - * - * @param dataset - * the containing Dataset - */ - void setContainingDataset(Dataset dataset) { - this.containingDataset = dataset; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - boolean result = false; - if (obj != null) { - Attribute attribute = (Attribute) obj; - String qualifiedName = getQualifiedName(); - if (qualifiedName == null) { - result = attribute.getQualifiedName() == null; - } else { - result = qualifiedName.equals(attribute.getQualifiedName()); - } - } - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return getQualifiedName().hashCode(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Dataset.java ---------------------------------------------------------------------- diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Dataset.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Dataset.java deleted file mode 100644 index 20ea68f..0000000 --- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Dataset.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright (C) 2003 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. Authorship - * of the modifications may be determined from the ChangeLog placed at - * the end of this file. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - * - **************************************************************** - * Source code information - * ----------------------- - * Filename $RCSfile: Dataset.java,v $ - * Revision $Revision: 1.2 $ - * Release status $State: Exp $ - * Last modified on $Date: 2007/10/03 15:57:30 $ - * by $Author: davidwithers $ - * Created on 21-Apr-2006 - *****************************************************************/ -package org.biomart.martservice.query; - -import java.util.ArrayList; -import java.util.List; - -/** - * Class for creating dataset elements of mart queries. - * - * @author David Withers - */ -public class Dataset { - private String name; - - private List<Attribute> attributes = new ArrayList<Attribute>(); - - private List<Filter> filters = new ArrayList<Filter>(); - - private Query containingQuery; - - /** - * Constructs an instance of a <code>Dataset</code> with the specified - * name. - * - * @param name - * the name of the <code>Dataset</code> - */ - public Dataset(String name) { - setName(name); - } - - /** - * Constructs an instance of a <code>Dataset</code> which is a deep copy - * of another <code>Dataset</code>. - * - * @param dataset - * the <code>Dataset</code> to copy - */ - public Dataset(Dataset dataset) { - setName(dataset.getName()); - for (Attribute attribute : dataset.getAttributes()) { - addAttribute(new Attribute(attribute)); - } - for (Filter filter : dataset.getFilters()) { - addFilter(new Filter(filter)); - } - } - - /** - * Returns the name of the Dataset. - * - * @return the name of the Dataset. - */ - public String getName() { - return name; - } - - /** - * Set the name of the Dataset. - * - * @param name - * the new name for this Dataset. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Returns a List of the Attributes in this dataset. - * - * @return a List of the Attributes in this dataset - */ - public List<Attribute> getAttributes() { - return new ArrayList<Attribute>(attributes); - } - - /** - * Adds an Attribute to the dataset. The attribute's containing dataset will - * be set to this dataset. If this dataset is in a query an attribute added - * event will be fired. - * - * @param attribute - * the Attribute to add - * @return true if the Attribute is not already in the dataset - */ - public boolean addAttribute(Attribute attribute) { - if (!attributes.contains(attribute)) { - attributes.add(attribute); - attribute.setContainingDataset(this); - if (containingQuery != null) { - containingQuery.fireAttributeAdded(attribute, this); - } - return true; - } else { - return false; - } - } - - /** - * Adds an array of Attributes to the dataset. - * - * @param attributeArray - * the array of Attributes to add - */ - public void addAttributes(Attribute[] attributeArray) { - for (int i = 0; i < attributeArray.length; i++) { - addAttribute(attributeArray[i]); - } - } - - /** - * Returns true if attribute is in the dataset. - * - * @param attribute - * @return true if attribute is in the dataset. - */ - public boolean hasAttribute(Attribute attribute) { - return attributes.contains(attribute); - } - - /** - * Returns true if the dataset contains any Attributes. - * - * @return true if the dataset contains any Attributes - */ - public boolean hasAttributes() { - return attributes.size() > 0; - } - - /** - * Removes an Attribute from the dataset. - * - * If the attribute is contained in this dataset: - * <ul> - * <li>The attribute's containing dataset will be set to null. - * <li>If this dataset is in a query an attribute removed event will be fired. - * - * @param attribute - * the attribute to remove - * @return true if the attribute is removed - */ - public boolean removeAttribute(Attribute attribute) { - if (attributes.remove(attribute)) { - attribute.setContainingDataset(null); - if (containingQuery != null) { - containingQuery.fireAttributeRemoved(attribute, this); - } - return true; - } else { - return false; - } - } - - /** - * Removes all the Attributes from this dataset. - */ - public void removeAllAttributes() { - for (Attribute attribute : getAttributes()) { - removeAttribute(attribute); - } - } - - /** - * Returns a List of the Filters in this dataset. - * - * @return a List of the Filters in this dataset - */ - public List<Filter> getFilters() { - return new ArrayList<Filter>(filters); - } - - /** - * Adds a Filter to the dataset. The filter's containing dataset will be set - * to this dataset. If this dataset is in a query a filter added event will - * be fired. - * - * @param filter - * the Filter to add - * @return true if the Filter is not already in the dataset - */ - public boolean addFilter(Filter filter) { - if (!filters.contains(filter)) { - filters.add(filter); - filter.setContainingDataset(this); - if (containingQuery != null) { - containingQuery.fireFilterAdded(filter, this); - } - return true; - } else { - return false; - } - } - - /** - * Adds an array of Filters to the dataset. - * - * @param filterArray - * the array of Filters to add - */ - public void addFilters(Filter[] filterArray) { - for (int i = 0; i < filterArray.length; i++) { - addFilter(filterArray[i]); - } - } - - /** - * Returns true if filter is in the dataset. - * - * @param filter - * @return true if filter is in the dataset - */ - public boolean hasFilter(Filter filter) { - return filters.contains(filter); - } - - /** - * Returns true if the dataset contains any filters. - * - * @return true if the dataset contains any filters - */ - public boolean hasFilters() { - return filters.size() > 0; - } - - /** - * Removes an Filter from the dataset. - * - * If the filter is contained in this dataset: - * <ul> - * <li>The filter's containing dataset will be set to null. - * <li>If this dataset is in a query an attribute removed event will be fired. - * - * @param filter - * the filter to remove - * @return true if the filter is removed - */ - public boolean removeFilter(Filter filter) { - if (filters.remove(filter)) { - filter.setContainingDataset(null); - if (containingQuery != null) { - containingQuery.fireFilterRemoved(filter, this); - } - return true; - } else { - return false; - } - } - - /** - * Removes all the filters from the dataset. - */ - public void removeAllFilters() { - for (Filter filter : getFilters()) { - removeFilter(filter); - } - } - - /** - * Returns the containingQuery. - * - * @return the containingQuery. - */ - public Query getContainingQuery() { - return containingQuery; - } - - /** - * Sets the containingQuery. - * - * @param containingQuery - * the containingQuery to set. - */ - void setContainingQuery(Query containingQuery) { - this.containingQuery = containingQuery; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Filter.java ---------------------------------------------------------------------- diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Filter.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Filter.java deleted file mode 100644 index 1c088d0..0000000 --- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Filter.java +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (C) 2003 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. Authorship - * of the modifications may be determined from the ChangeLog placed at - * the end of this file. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - * - **************************************************************** - * Source code information - * ----------------------- - * Filename $RCSfile: Filter.java,v $ - * Revision $Revision: 1.1 $ - * Release status $State: Exp $ - * Last modified on $Date: 2007/01/31 14:12:09 $ - * by $Author: davidwithers $ - * Created on 26-Apr-2006 - *****************************************************************/ -package org.biomart.martservice.query; - -/** - * Class for creating filter elements of mart queries. - * - * @author David Withers - */ -public class Filter { - private String name; - - private String value; - - private boolean booleanFilter; - - private boolean listFilter; - - private Dataset containingDataset; - - /** - * Constructs an instance of a <code>Filter</code> with the specified name. - * - * @param name - * the name of the <code>Filter</code>; must not be <code>null</code> - */ - public Filter(String name) { - this(name, null); - } - - /** - * Constructs a instance of a <code>Filter</code> with the specified name - * and value. - * - * @param name - * the name of the <code>Filter</code>; must not be <code>null</code> - * @param value - * the value of the <code>Filter</code> - */ - public Filter(String name, String value) { - this(name, value, false); - } - - /** - * Constructs a instance of a <code>Filter</code> with the specified name - * and value, and sets a flag to indicate if this is a boolean - * <code>Filter</code>. - * - * @param name - * the name of the <code>Filter</code>; must not be <code>null</code> - * @param value - * the value of the <code>Filter</code> - * @param booleanFilter - */ - public Filter(String name, String value, boolean booleanFilter) { - if (name == null) { - throw new IllegalArgumentException("Parameter 'name' must not be null"); - } - this.name = name; - this.value = value; - this.booleanFilter = booleanFilter; - } - - /** - * Constructs an instance of a <code>Filter</code> which is a copy of - * another <code>Filter</code>. - * - * @param filter - * the <code>Filter</code> to copy; must not be <code>null</code> - */ - public Filter(Filter filter) { - if (filter == null) { - throw new IllegalArgumentException("Parameter 'filter' must not be null"); - } - this.name = filter.name; - this.value = filter.value; - this.booleanFilter = filter.booleanFilter; - } - - /** - * Returns the name of the Filter. - * - * @return the name of the Filter - */ - public String getName() { - return name; - } - - /** - * Sets the name of the Filter. - * - * @param name - * the name of the Filter; must not be <code>null</code> - */ - public void setName(String name) { - if (name == null) { - throw new IllegalArgumentException("Parameter 'name' must not be null"); - } - this.name = name; - } - - /** - * Returns the qualified name of this <code>Filter</code>. - * - * The qualified name is <code>containingDatasetName.filterName</code> or - * just <code>attributeName</code> if the <code>Filter</code> is not in - * a <code>Dataset</code>. - * - * @return the qualified name of this <code>Filter</code>. - */ - public String getQualifiedName() { - if (containingDataset == null) { - return name; - } else { - return containingDataset.getName() + "." + getName(); - } - } - - /** - * Returns the <code>Dataset</code> containing this <code>Filter</code> - * or null if it is not in a <code>Dataset</code>. - * - * @return the <code>Dataset</code> containing this <code>Filter</code> - * or null if it is not in a <code>Dataset</code> - */ - public Dataset getContainingDataset() { - return containingDataset; - } - - /** - * Sets the containing <code>Dataset</code>. - * - * @param dataset - * the containing <code>Dataset</code> - */ - void setContainingDataset(Dataset dataset) { - this.containingDataset = dataset; - } - - /** - * Returns the value. - * - * @return the value. - */ - public String getValue() { - return value; - } - - /** - * Sets the value. - * - * @param value - * the value to set. - */ - public void setValue(String value) { - boolean valueChanged = false; - if (this.value == null) { - if (value != null) { - this.value = value; - valueChanged = true; - } - } else if (!this.value.equals(value)) { - this.value = value; - valueChanged = true; - } - if (valueChanged) { - if (containingDataset != null) { - if (containingDataset.getContainingQuery() != null) { - containingDataset.getContainingQuery().fireFilterChanged( - this, containingDataset); - } - } - } - } - - /** - * Returns <code>true</code> if this is a boolean filter. - * - * @return <code>true</code> if this is a boolean filter. - */ - public boolean isBoolean() { - return booleanFilter; - } - - /** - * Sets the booleanFilter flag. - * - * @param booleanFilter - */ - public void setBoolean(boolean booleanFilter) { - this.booleanFilter = booleanFilter; - } - - /** - * Returns <code>true</code> if this is a list filter. - * - * @return <code>true</code> if this is a list filter. - */ - public boolean isList() { - return listFilter; - } - - /** - * Sets the listFilter flag. - * - * @param listFilter - */ - public void setList(boolean listFilter) { - this.listFilter = listFilter; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Link.java ---------------------------------------------------------------------- diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Link.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Link.java deleted file mode 100644 index 721428c..0000000 --- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Link.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (C) 2003 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. Authorship - * of the modifications may be determined from the ChangeLog placed at - * the end of this file. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - * - **************************************************************** - * Source code information - * ----------------------- - * Filename $RCSfile: Link.java,v $ - * Revision $Revision: 1.1 $ - * Release status $State: Exp $ - * Last modified on $Date: 2007/01/31 14:12:09 $ - * by $Author: davidwithers $ - * Created on 26-Apr-2006 - *****************************************************************/ -package org.biomart.martservice.query; - -/** - * Class for creating link elements of mart queries. - * - * @author David Withers - */ -public class Link { - private String source; - - private String target; - - private String defaultLink; - - private Query containingQuery; - - /** - * Constructs an instance of a <code>Link</code>. - * - * @param source - * the source dataset of the <code>Link</code> - * @param target - * the target dataset of the <code>Link</code> - * @param defaultLink - * the ID the links the datasets - */ - public Link(String source, String target, String defaultLink) { - this.source = source; - this.target = target; - this.defaultLink = defaultLink; - } - - /** - * Constructs an instance of a <code>Link</code> which is a copy of - * another <code>Link</code>. - * - * @param filter - * the <code>Link</code> to copy - */ - public Link(Link link) { - this.source = link.source; - this.target = link.target; - this.defaultLink = link.defaultLink; - } - - /** - * Returns the defaultLink. - * - * @return the defaultLink. - */ - public String getDefaultLink() { - return defaultLink; - } - - /** - * @param defaultLink - * the defaultLink to set. - */ - public void setDefaultLink(String defaultLink) { - this.defaultLink = defaultLink; - } - - /** - * Returns the source dataset. - * - * @return the source dataset. - */ - public String getSource() { - return source; - } - - /** - * Sets the source dataset. - * - * @param source - * the source dataset to set. - */ - public void setSource(String source) { - this.source = source; - } - - /** - * Returns the target dataset. - * - * @return the target dataset. - */ - public String getTarget() { - return target; - } - - /** - * Sets the target dataset. - * - * @param target - * the target dataset to set. - */ - public void setTarget(String target) { - this.target = target; - } - - /** - * Returns the containingQuery. - * - * @return the containingQuery. - */ - public Query getContainingQuery() { - return containingQuery; - } - - /** - * Sets the containingQuery. - * - * @param containingQuery - * the containingQuery to set. - */ - void setContainingQuery(Query containingQuery) { - this.containingQuery = containingQuery; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - boolean result = false; - if (obj != null) { - Link link = (Link) obj; - result = ((source == null && link.source == null) || source - .equals(link.source)) - && ((target == null && link.target == null) || target - .equals(link.target)) - && ((defaultLink == null && link.defaultLink == null) || defaultLink - .equals(link.defaultLink)); - } - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return source.hashCode() + target.hashCode() + defaultLink.hashCode(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Query.java ---------------------------------------------------------------------- diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Query.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Query.java deleted file mode 100644 index c7c9f20..0000000 --- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/Query.java +++ /dev/null @@ -1,555 +0,0 @@ -/* - * Copyright (C) 2003 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. Authorship - * of the modifications may be determined from the ChangeLog placed at - * the end of this file. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - * - **************************************************************** - * Source code information - * ----------------------- - * Filename $RCSfile: Query.java,v $ - * Revision $Revision: 1.4 $ - * Release status $State: Exp $ - * Last modified on $Date: 2007/10/03 15:57:30 $ - * by $Author: davidwithers $ - * Created on 03-Apr-2006 - *****************************************************************/ -package org.biomart.martservice.query; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.biomart.martservice.MartServiceException; - -/** - * Class for creating mart queries. - * - * @author David Withers - */ -public class Query { - private String virtualSchemaName; - - private int count; - - private int uniqueRows; - - private String softwareVersion; - - private String formatter; - - private String requestId; - - private List<Dataset> datasets = new ArrayList<Dataset>(); - - private Map<String, Dataset> datasetMap = new HashMap<String, Dataset>(); - - private Set<Link> links = new HashSet<Link>(); - - private Map<String, Link> linkSourceMap = new HashMap<String, Link>(); - - private List<QueryListener> listeners = new ArrayList<QueryListener>(); - - /** - * Constructs an instance of a <code>Query</code> with the specified - * <code>virtualSchemaName</code> and a <code>count</code> of 0. - * - * @param virtualSchemaName - */ - public Query(String virtualSchemaName) { - this(virtualSchemaName, 0); - } - - /** - * Constructs an instance of a <code>Query</code> with the specified - * <code>virtualSchemaName</code> and <code>count</code>. - * - * @param virtualSchemaName - * @param count - */ - public Query(String virtualSchemaName, int count) { - setVirtualSchemaName(virtualSchemaName); - setCount(count); - } - - /** - * Constructs an instance of a <code>Query</code> with the specified - * <code>virtualSchemaName</code>, <code>softwareVersion</code> and - * <code>requestId</code>. - * - * @param virtualSchemaName - * @param softwareVersion - * @param requestId - */ - public Query(String virtualSchemaName, String softwareVersion, - String requestId) { - this(virtualSchemaName, 0, softwareVersion, requestId); - } - - /** - * Constructs an instance of a <code>Query</code> with the specified - * <code>virtualSchemaName</code>, <code>count</code> and - * <code>softwareVersion</code>. - * - * @param virtualSchemaName - * @param count - * @param softwareVersion - */ - public Query(String virtualSchemaName, int count, String softwareVersion) { - this(virtualSchemaName, count, softwareVersion, null); - } - - /** - * Constructs an instance of a <code>Query</code> with the specified - * <code>virtualSchemaName</code>, <code>count</code>, - * <code>softwareVersion</code> and <code>requestId</code>. - * - * @param virtualSchemaName - * @param count - * @param softwareVersion - * @param requestId - */ - public Query(String virtualSchemaName, int count, String softwareVersion, - String requestId) { - setVirtualSchemaName(virtualSchemaName); - setCount(count); - setSoftwareVersion(softwareVersion); - setRequestId(requestId); - } - - /** - * Constructs an instance of a <code>Query</code> which is a deep copy of - * another <code>Query</code>. - * - * @param query - * the <code>Query</code> to copy - * @throws MartServiceException - */ - public Query(Query query) { - setVirtualSchemaName(query.virtualSchemaName); - setCount(query.count); - setUniqueRows(query.uniqueRows); - setSoftwareVersion(query.softwareVersion); - setFormatter(query.formatter); - setRequestId(query.requestId); - for (Dataset dataset : query.getDatasets()) { - addDataset(new Dataset(dataset)); - } - for (Link link : query.getLinks()) { - addLink(new Link(link)); - } - } - - /** - * Returns the virtualSchema. - * - * @return the virtualSchema. - */ - public String getVirtualSchemaName() { - return virtualSchemaName; - } - - /** - * Sets the virtualSchema. - * - * @param virtualSchemaName - * the virtualSchema to set. - */ - public void setVirtualSchemaName(String virtualSchemaName) { - this.virtualSchemaName = virtualSchemaName; - } - - /** - * Returns the count. - * - * @return the count. - */ - public int getCount() { - return count; - } - - /** - * Sets the count. - * - * @param count - * the count to set. - */ - public void setCount(int count) { - this.count = count; - } - - /** - * Returns the uniqueRows query attribute - * - * @return the uniqueRows query attribute - */ - public int getUniqueRows() { - return uniqueRows; - } - - /** - * Sets the uniqueRows query attribute. - * - * Valid values are 0 or 1. - * - * @param uniqueRows value for the uniqueRows query attribute - */ - public void setUniqueRows(int uniqueRows) { - this.uniqueRows = uniqueRows; - } - - /** - * Returns the softwareVersion. - * - * @return the softwareVersion - */ - public String getSoftwareVersion() { - return softwareVersion; - } - - /** - * Sets the softwareVersion. - * - * @param softwareVersion - * the new softwareVersion - */ - public void setSoftwareVersion(String softwareVersion) { - this.softwareVersion = softwareVersion; - } - - /** - * Returns the formatter. - * - * @return the formatter - */ - public String getFormatter() { - return formatter; - } - - /** - * Sets the formatter. - * - * @param formatter the new formatter - */ - public void setFormatter(String formatter) { - if (this.formatter == null) { - if (formatter != null) { - this.formatter = formatter; - fireFormatterAdded(formatter); - } - } else if (!this.formatter.equals(formatter)) { - if (formatter == null) { - String removedFormatter = this.formatter; - this.formatter = formatter; - fireFormatterRemoved(removedFormatter); - } else { - this.formatter = formatter; - fireFormatterChanged(formatter); - } - } - } - - /** - * Returns the requestId. - * - * @return the requestId - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the requestId. - * - * @param requestId - * the new requestId - */ - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - /** - * Adds a Dataset to the Query. - * - * The Dataset is added at the end of the list of Datasets. - * - * @param dataset - * the Dataset to add - */ - public void addDataset(Dataset dataset) { - addDataset(datasets.size(), dataset); - } - - /** - * Adds a Dataset to the Query at the specified position. - * - * @param index - * the position to add the Dataset - * @param dataset - * the Dataset to add - */ - public void addDataset(int index, Dataset dataset) { - datasets.add(index, dataset); - datasetMap.put(dataset.getName(), dataset); - if (dataset.getContainingQuery() != null) { - dataset.getContainingQuery().removeDataset(dataset); - } - dataset.setContainingQuery(this); - } - - /** - * Removes a Dataset from the Query. - * - * @param dataset - * the Dataset to remove - */ - public void removeDataset(Dataset dataset) { - datasets.remove(dataset); - datasetMap.remove(dataset.getName()); - dataset.setContainingQuery(null); - } - - /** - * Removes all the Datasets from the Query. - */ - public void removeAllDatasets() { - for (Dataset dataset : datasets) { - dataset.setContainingQuery(null); - } - datasets.clear(); - datasetMap.clear(); - } - - /** - * Returns the Datasets that this Query contains. - * - * @return the Datasets that this Query contains. - */ - public List<Dataset> getDatasets() { - return new ArrayList<Dataset>(datasets); - } - - /** - * Returns a Dataset with the given datasetName. If the Query has no Dataset - * with the given datasetName null is returned. - * - * @param datasetName - * @return a Dataset with the given datasetName - */ - public Dataset getDataset(String datasetName) { - return (Dataset) datasetMap.get(datasetName); - } - - /** - * Returns true if this Query contains a Dataset with the name - * <code>datasetName</code>. - * - * @param datasetName - * @return true if this Query contains a Dataset with the name - * <code>datasetName</code>. - */ - public boolean containsDataset(String datasetName) { - return datasetMap.containsKey(datasetName); - } - - /** - * Adds a Link to the Query. - * - * @param link - * the Link to add - */ - public void addLink(Link link) { - links.add(link); - linkSourceMap.put(link.getSource(), link); - if (link.getContainingQuery() != null) { - link.getContainingQuery().removeLink(link); - } - link.setContainingQuery(this); - } - - /** - * Removes a link from the Query - * - * @param link - * the Link to remove - */ - public void removeLink(Link link) { - links.remove(link); - linkSourceMap.remove(link.getSource()); - link.setContainingQuery(null); - } - - /** - * Returns the Links that this Query contains. - * - * @return the Links that this Query contains. - */ - public Set<Link> getLinks() { - return new HashSet<Link>(links); - } - - /** - * Returns a Link with the given source. If the Query has no Link with the - * given source null is returned. - * - * @param source - * the source of the link - * @return a Link with the given source - */ - public Link getLink(String source) { - return (Link) linkSourceMap.get(source); - } - - /** - * Returns true if this Query contains a Link with the same source. - * - * @param source - * the source of the link - * @return true if this Query contains a Link with the same source. - */ - public boolean containsLink(String source) { - return linkSourceMap.containsKey(source); - } - - /** - * Returns a List of Links with the given target. If the Query has no Link - * with the given target an empty List is returned. - * - * @param target - * the target of the link - * @return a Link with the given target - */ - public Set<Link> getLinks(String target) { - Set<Link> result = new HashSet<Link>(); - Set<Link> links = getLinks(); - for (Link link: links) { - if (link.getTarget().equals(target)) { - result.add(link); - } - } - return result; - } - - /** - * Returns all the Attributes from all the Datasets in this Query. - * - * @return all the Attributes from all the Datasets in this Query. - */ - public List<Attribute> getAttributes() { - List<Attribute> attributes = new ArrayList<Attribute>(); - for (Dataset dataset : datasets) { - attributes.addAll(dataset.getAttributes()); - } - return attributes; - } - - /** - * Returns all the Filters from all the Datasets in this Query. - * - * @return all the Filters from all the Datasets in this Query. - */ - public List<Filter> getFilters() { - List<Filter> filters = new ArrayList<Filter>(); - for (Dataset dataset : datasets) { - filters.addAll(dataset.getFilters()); - } - return filters; - } - - /** - * Adds the specified query listener to receive query events. If - * <code>listener</code> is null, no exception is thrown and no action is - * performed. - * - * @param listener - * the query listener - */ - public void addQueryListener(QueryListener listener) { - if (listener != null) { - listeners.add(listener); - } - } - - /** - * Removes the specified query listener so that it no longer receives query - * events. This method performs no function, nor does it throw an exception, - * if <code>listener</code> was not previously added to this component. If - * <code>listener</code> is null, no exception is thrown and no action is - * performed. - * - * @param listener - * the query listener - */ - public void removeQueryListener(QueryListener listener) { - listeners.remove(listener); - } - - void fireAttributeAdded(Attribute attribute, Dataset dataset) { - for (QueryListener listener : listeners) { - listener.attributeAdded(attribute, dataset); - } - } - - void fireAttributeRemoved(Attribute attribute, Dataset dataset) { - for (QueryListener listener : listeners) { - listener.attributeRemoved(attribute, dataset); - } - } - - void fireFilterAdded(Filter filter, Dataset dataset) { - for (QueryListener listener : listeners) { - listener.filterAdded(filter, dataset); - } - } - - void fireFilterRemoved(Filter filter, Dataset dataset) { - for (QueryListener listener : listeners) { - listener.filterRemoved(filter, dataset); - } - } - - void fireFilterChanged(Filter filter, Dataset dataset) { - for (QueryListener listener : listeners) { - listener.filterChanged(filter, dataset); - } - } - - void fireFormatterAdded(String formatter) { - for (QueryListener listener : listeners) { - listener.formatterAdded(formatter); - } - } - - void fireFormatterRemoved(String formatter) { - for (QueryListener listener : listeners) { - listener.formatterRemoved(formatter); - } - } - - void fireFormatterChanged(String formatter) { - for (QueryListener listener : listeners) { - listener.formatterChanged(formatter); - } - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/QueryListener.java ---------------------------------------------------------------------- diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/QueryListener.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/QueryListener.java deleted file mode 100644 index 9f10f45..0000000 --- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/QueryListener.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2003 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. Authorship - * of the modifications may be determined from the ChangeLog placed at - * the end of this file. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - * - **************************************************************** - * Source code information - * ----------------------- - * Filename $RCSfile: QueryListener.java,v $ - * Revision $Revision: 1.2 $ - * Release status $State: Exp $ - * Last modified on $Date: 2007/10/03 15:57:30 $ - * by $Author: davidwithers $ - * Created on 03-Apr-2006 - *****************************************************************/ -package org.biomart.martservice.query; - -/** - * The listener interface for receiving Query events. - * - * @author David Withers - */ -public interface QueryListener { - - /** - * Invoked when an <code>Attribute</code> is added to a <code>Query</code>. - * - * @param attribute - * the <code>Attribute</code> added. - */ - public void attributeAdded(Attribute attribute, Dataset dataset); - - /** - * Invoked when an <code>Attribute</code> is removed from a - * <code>Query</code>. - * - * @param attribute - * the <code>Attribute</code> removed. - */ - public void attributeRemoved(Attribute attribute, Dataset dataset); - - /** - * Invoked when a <code>Filter</code> is added to a <code>Query</code>. - * - * @param filter - * the <code>Filter</code> added. - */ - public void filterAdded(Filter filter, Dataset dataset); - - /** - * Invoked when a <code>Filter</code> is removed from a <code>Query</code>. - * - * @param filter - * the <code>Filter</code> removed. - */ - public void filterRemoved(Filter filter, Dataset dataset); - - /** - * Invoked when the value of a <code>Filter</code> is changed. - * - * @param filter - * the <code>Filter</code> whose value has changed. - */ - public void filterChanged(Filter filter, Dataset dataset); - - /** - * Invoked when a formatter is added to a <code>Query</code>. - * - * @param formatter - * the formatter added. - */ - public void formatterAdded(String formatter); - - /** - * Invoked when a formatter is removed from a <code>Query</code>. - * - * @param formatter - * the formatter removed. - */ - public void formatterRemoved(String formatter); - - /** - * Invoked when the value of the formatter is changed. - * - * @param filter - * the new value of the formatter. - */ - public void formatterChanged(String formatter); - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/QueryXMLHandler.java ---------------------------------------------------------------------- diff --git a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/QueryXMLHandler.java b/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/QueryXMLHandler.java deleted file mode 100644 index 13c7791..0000000 --- a/taverna-biomart-martservice/src/main/java/org/biomart/martservice/query/QueryXMLHandler.java +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Copyright (C) 2003 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. Authorship - * of the modifications may be determined from the ChangeLog placed at - * the end of this file. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - * - **************************************************************** - * Source code information - * ----------------------- - * Filename $RCSfile: QueryXMLHandler.java,v $ - * Revision $Revision: 1.6 $ - * Release status $State: Exp $ - * Last modified on $Date: 2008/03/04 16:45:18 $ - * by $Author: davidwithers $ - * Created on 28-Apr-2006 - *****************************************************************/ -package org.biomart.martservice.query; - -import java.util.List; - -import org.jdom.Element; -import org.jdom.Namespace; - -/** - * Utility class for serializing <code>Query</code> classes to XML. - * - * @author David Withers - */ -public class QueryXMLHandler { - public static final String QUERY_ELEMENT = "Query"; - - public static final String DATASET_ELEMENT = "Dataset"; - - public static final String ATTRIBUTE_ELEMENT = "Attribute"; - - public static final String FILTER_ELEMENT = "Filter"; - - public static final String LINK_ELEMENT = "Links"; - - public static final String ATTRIBUTES_ATTRIBUTE = "attributes"; - - public static final String NAME_ATTRIBUTE = "name"; - - public static final String COUNT_ATTRIBUTE = "count"; - - public static final String UNIQUE_ROWS_ATTRIBUTE = "uniqueRows"; - - public static final String VERSION_ATTRIBUTE = "softwareVersion"; - - public static final String FORMATTER_ATTRIBUTE = "formatter"; - - public static final String HEADER_ATTRIBUTE = "header"; - - public static final String REQUEST_ID_ATTRIBUTE = "requestId"; - - public static final String SCHEMA_ATTRIBUTE = "virtualSchemaName"; - - /** - * Converts a <code>Query</code> to an XML element. - * - * @param query - * the <code>Query</code> to serialize - * @param namespace - * the <code>Namespace</code> to use when constructing the - * <code>Element</code> - * @return an XML serialization of the <code>Query</code> - */ - public static Element queryToElement(Query query, Namespace namespace) { - Element queryElement = new Element(QUERY_ELEMENT, namespace); - String virtualSchemaName = query.getVirtualSchemaName(); - if (virtualSchemaName == null) { - queryElement.setAttribute(SCHEMA_ATTRIBUTE, "default"); - } else { - queryElement.setAttribute(SCHEMA_ATTRIBUTE, virtualSchemaName); - } - queryElement.setAttribute(COUNT_ATTRIBUTE, String.valueOf(query.getCount())); - queryElement.setAttribute(UNIQUE_ROWS_ATTRIBUTE, String.valueOf(query.getUniqueRows())); - String softwareVersion = query.getSoftwareVersion(); - if (softwareVersion != null) { - queryElement.setAttribute(VERSION_ATTRIBUTE, softwareVersion); - } - String formatter = query.getFormatter(); - if (formatter != null) { - queryElement.setAttribute(FORMATTER_ATTRIBUTE, formatter); - queryElement.setAttribute(HEADER_ATTRIBUTE, "1"); - } - String requestId = query.getRequestId(); - if (requestId != null) { - queryElement.setAttribute(REQUEST_ID_ATTRIBUTE, requestId); - } - for (Dataset dataset : query.getDatasets()) { - queryElement.addContent(datasetToElement(dataset, namespace)); - } - for (Link link : query.getLinks()) { - queryElement.addContent(linkToElement(link, namespace)); - } - - return queryElement; - } - - /** - * Converts a <code>Dataset</code> to an XML element. - * - * @param dataset - * the <code>Dataset</code> to serialize - * @param namespace - * the <code>Namespace</code> to use when constructing the - * <code>Element</code> - * @return an XML serialization of the <code>Dataset</code> - */ - public static Element datasetToElement(Dataset dataset, Namespace namespace) { - Element datasetElement = new Element(DATASET_ELEMENT, namespace); - datasetElement.setAttribute(NAME_ATTRIBUTE, dataset.getName()); - - for (Attribute attribute : dataset.getAttributes()) { - datasetElement.addContent(attributeToElement(attribute, namespace)); - } - - for (Filter filter : dataset.getFilters()) { - datasetElement.addContent(filterToElement(filter, namespace)); - } - - return datasetElement; - } - - /** - * Converts a <code>Link</code> to an XML element. - * - * @param link - * the <code>Link</code> to serialize - * @param namespace - * the <code>Namespace</code> to use when constructing the - * <code>Element</code> - * @return an XML serialization of the <code>Link</code> - */ - public static Element linkToElement(Link link, Namespace namespace) { - Element linkElement = new Element(LINK_ELEMENT, namespace); - linkElement.setAttribute("source", link.getSource()); - linkElement.setAttribute("target", link.getTarget()); - linkElement.setAttribute("defaultLink", link.getDefaultLink()); - return linkElement; - } - - /** - * Converts an <code>Attribute</code> to an XML element. - * - * @param attribute - * the <code>Attribute</code> to serialize - * @param namespace - * the <code>Namespace</code> to use when constructing the - * <code>Element</code> - * @return an XML serialization of the <code>Attribute</code> - */ - public static Element attributeToElement(Attribute attribute, - Namespace namespace) { - Element attributeElement = new Element(ATTRIBUTE_ELEMENT, namespace); - attributeElement.setAttribute(NAME_ATTRIBUTE, attribute.getName()); - String attributes = attribute.getAttributes(); - if (attributes != null) { - attributeElement.setAttribute(ATTRIBUTES_ATTRIBUTE, attributes); - } - return attributeElement; - } - - /** - * Converts a <code>Filter</code> to an XML element. - * - * @param filter - * the <code>Filter</code> to serialize - * @param namespace - * the <code>Namespace</code> to use when constructing the - * <code>Element</code> - * @return an XML serialization of the <code>Filter</code> - */ - public static Element filterToElement(Filter filter, Namespace namespace) { - Element filterElement = new Element(FILTER_ELEMENT, namespace); - filterElement.setAttribute(NAME_ATTRIBUTE, filter.getName()); - String value = filter.getValue(); - if (filter.isBoolean()) { - if ("excluded".equalsIgnoreCase(value)) { - filterElement.setAttribute("excluded", "1"); - } else { - filterElement.setAttribute("excluded", "0"); - } - } else { - if (value == null) { - filterElement.setAttribute("value", ""); - } else { - filterElement.setAttribute("value", value); - } - } - if (filter.isList()) { - filterElement.setAttribute("list", "true"); - } - return filterElement; - } - - /** - * Creates a <code>Query</code> from an XML element. - * - * @param element - * the <code>Element</code> to deserialize - * @param namespace - * the <code>Namespace</code> containing the - * <code>Element</code> - * @return a deserialized <code>Query</code> - */ - public static Query elementToQuery(Element element, Namespace namespace) { - String virtualSchema = element.getAttributeValue(SCHEMA_ATTRIBUTE); - int count = Integer.parseInt(element.getAttributeValue(COUNT_ATTRIBUTE)); - String version = element.getAttributeValue(VERSION_ATTRIBUTE); - String formatter = element.getAttributeValue(FORMATTER_ATTRIBUTE); - String requestId = element.getAttributeValue(REQUEST_ID_ATTRIBUTE); - Query query = new Query(virtualSchema, count, version, requestId); - query.setFormatter(formatter); - String uniqueRows = element.getAttributeValue(UNIQUE_ROWS_ATTRIBUTE); - if (uniqueRows != null) { - query.setUniqueRows(Integer.parseInt(uniqueRows)); - } - List<Element> datasets = element.getChildren(DATASET_ELEMENT, namespace); - for (Element datasetElement : datasets) { - query.addDataset(elementToDataset(datasetElement, namespace)); - } - List<Element> links = element.getChildren(LINK_ELEMENT, namespace); - for (Element linkElement : links) { - query.addLink(elementToLink(linkElement)); - } - return query; - } - - /** - * Creates a <code>Dataset</code> from an XML element. - * - * @param element - * the <code>Element</code> to deserialize - * @param namespace - * the <code>Namespace</code> containing the - * <code>Element</code> - * @return a deserialized <code>Dataset</code> - */ - public static Dataset elementToDataset(Element element, Namespace namespace) { - Dataset dataset = new Dataset(element.getAttributeValue(NAME_ATTRIBUTE)); - - List<Element> attributes = element.getChildren(ATTRIBUTE_ELEMENT, namespace); - for (Element attributeElement : attributes) { - dataset.addAttribute(elementToAttribute(attributeElement)); - } - - List<Element> filters = element.getChildren(FILTER_ELEMENT, namespace); - for (Element filterElement : filters) { - dataset.addFilter(elementToFilter(filterElement)); - } - return dataset; - } - - /** - * Creates a <code>Filter</code> from an XML element. - * - * @param element - * the <code>Element</code> to deserialize - * @return a deserialized <code>Filter</code> - */ - public static Filter elementToFilter(Element element) { - Filter filter; - String filterName = element.getAttributeValue(NAME_ATTRIBUTE); - String filterValue = element.getAttributeValue("value"); - if (filterValue != null) { - filter = new Filter(filterName, filterValue); - } else { - filterValue = element.getAttributeValue("excluded"); - if ("1".equals(filterValue)) { - filter = new Filter(filterName, "excluded", true); - } else { - filter = new Filter(filterName, "only", true); - } - } - String listValue = element.getAttributeValue("list"); - if ("true".equals(listValue)) { - filter.setList(true); - } - return filter; - } - - /** - * Creates an <code>Attribute</code> from an XML element. - * - * @param element - * the <code>Element</code> to deserialize - * @return a deserialized <code>Attribute</code> - */ - public static Attribute elementToAttribute(Element element) { - String attributeName = element.getAttributeValue(NAME_ATTRIBUTE); - Attribute attribute = new Attribute(attributeName); - String attributes = element.getAttributeValue(ATTRIBUTES_ATTRIBUTE); - if (attributes != null) { - attribute.setAttributes(attributes); - } - return attribute; - } - - /** - * Creates an <code>Link</code> from an XML element. - * - * @param element - * the <code>Element</code> to deserialize - * @return a deserialized <code>Link</code> - * @deprecated MartJ 0.5 won't require links to be specified - */ - public static Link elementToLink(Element element) { - return new Link(element.getAttributeValue("source"), element - .getAttributeValue("target"), element - .getAttributeValue("defaultLink")); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/contract.gif ---------------------------------------------------------------------- diff --git a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/contract.gif b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/contract.gif deleted file mode 100644 index 8325346..0000000 Binary files a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/contract.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/expand.gif ---------------------------------------------------------------------- diff --git a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/expand.gif b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/expand.gif deleted file mode 100644 index 7d3ddff..0000000 Binary files a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/expand.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic.gif ---------------------------------------------------------------------- diff --git a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic.gif b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic.gif deleted file mode 100644 index bbd2318..0000000 Binary files a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic.gif and /dev/null differ