001/* 002 * Copyright (c) 2004-2010 The Regents of the University of California. 003 * All rights reserved. 004 * 005 * '$Author: welker $' 006 * '$Date: 2010-05-06 05:21:26 +0000 (Thu, 06 May 2010) $' 007 * '$Revision: 24234 $' 008 * 009 * Permission is hereby granted, without written agreement and without 010 * license or royalty fees, to use, copy, modify, and distribute this 011 * software and its documentation for any purpose, provided that the above 012 * copyright notice and the following two paragraphs appear in all copies 013 * of this software. 014 * 015 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY 016 * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 017 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 018 * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF 019 * SUCH DAMAGE. 020 * 021 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 022 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE 024 * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF 025 * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, 026 * ENHANCEMENTS, OR MODIFICATIONS. 027 * 028 */ 029 030package org.ecoinformatics.seek.ecogrid; 031 032import java.io.IOException; 033import java.util.Vector; 034 035import org.ecoinformatics.ecogrid.queryservice.query.QueryType; 036import org.ecoinformatics.ecogrid.queryservice.resultset.ResultsetType; 037import org.ecoinformatics.seek.ecogrid.exception.EcoGridException; 038import org.ecoinformatics.seek.ecogrid.exception.InvalidEcogridQueryException; 039import org.xml.sax.SAXException; 040 041import ptolemy.kernel.CompositeEntity; 042import ptolemy.kernel.util.IllegalActionException; 043import ptolemy.kernel.util.NameDuplicationException; 044 045/** 046 * <p> 047 * 048 * Title:PlugInQueryTransferInterface 049 * </p> 050 * <p> 051 * 052 * Description: This is a plugin interface and it defines a all methods any 053 * metadata type should implement into order to search ecogrid service and parse 054 * the results 055 * </p> 056 * <p> 057 * 058 * Copyright: Copyright (c) 2004 059 * </p> 060 * <p> 061 * 062 * Company: 063 * </p> 064 * 065 *@author not attributable 066 *@created February 17, 2005 067 *@version 1.0 068 */ 069 070public abstract class MetadataSpecificationInterface { 071 // Constant 072 /** 073 * Description of the Field 074 */ 075 public final static String RETURNFIELD = "returnField"; 076 /** 077 * Description of the Field 078 */ 079 public final static String RETURNFIELDTYPE = "type"; 080 /** 081 * Description of the Field 082 */ 083 public final static String RETURNFIELDTITLE = "title"; 084 /** 085 * Description of the Field 086 */ 087 public final static String RETURNFIELDENTITY = "entityName"; 088 /** 089 * Description of the Field 090 */ 091 public final static String NAMESPACE = "namespace"; 092 /** 093 * Description of the Field 094 */ 095 public final static String QUICKPATH = "quickSearchPath"; 096 /** 097 * Description of the Field 098 */ 099 public final static String QUERYTITLE = "queryTitle"; 100 /** 101 * Description of the Field 102 */ 103 public final static String ENDPOINT = "endPoint"; 104 /** 105 * Description of the Field 106 */ 107 public final static String METADATACLASS = "metadataSpecificationClass"; 108 /** 109 * Description of the Field 110 */ 111 public final static String ECOGRIDPATH = "ecogridService"; 112 /** 113 * Description of the Field 114 */ 115 public final static String SERVICESLIST = "servicesList"; 116 /** 117 * Description of the Field 118 */ 119 public final static String SERVICE = "service"; 120 /** 121 * Description of the Field 122 */ 123 public final static String SERVICENAME = "serviceName"; 124 /** 125 * Description of the Field 126 */ 127 public final static String SERVICETYPE = "serviceType"; 128 /** 129 * Description of the Field 130 */ 131 public final static String DOCUMENTTYPE = "documentType"; 132 /** 133 * Description of the Field 134 */ 135 public final static String LABEL = "label"; 136 /** 137 * Description of the Field 138 */ 139 public final static String RETURNFIELDTYPELIST = "returnFieldTypeList"; 140 /** 141 * Description of the Field 142 */ 143 public final static String METADATASPECIFICATIONCLASSLIST = "metadataSpecificationClassList"; 144 /** 145 * Description of the field 146 */ 147 public final static String SELECTION = "selected"; 148 149 /** 150 * field for service clustering/authentication 151 */ 152 public final static String SERVICEGROUP = "serviceGroup"; 153 public final static String SERVICECLASSIFICATION = "serviceClassification"; 154 public final static String DESCRIPTION = "description"; 155 156 public final static String AUTHENTICATION_MAPPING = "authenticationMapping"; 157 public final static String AUTHENTICATION_SERVICETYPE = "serviceType"; 158 public final static String AUTHENTICATION_SERVICECLASS = "serviceClass"; 159 160 /** 161 * This method will return a quick search query base on the given value 162 * 163 *@param value 164 * String 165 *@return QueryType 166 *@exception InvalidEcogridQueryException 167 * Description of the Exception 168 */ 169 public abstract QueryType getQuickSearchEcoGridQuery(String value) 170 throws InvalidEcogridQueryException; 171 172 /** 173 * This method will transfer a query group into ecogrid query base on 174 * different namespace 175 * 176 *@return QueryType 177 */ 178 public abstract QueryType getEcoGridQuery(); 179 180 /** 181 * The ResultSet is added directly to the container 182 * 183 *@param results 184 *@param endpoint 185 *@param container 186 *@param aResultList 187 * The feature to be added to the ResultsetRecordsToContainer 188 * attribute 189 * *@throws SAXException 190 *@throws IOException 191 *@throws EcoGridException 192 *@throws NameDuplicationException 193 *@throws IllegalActionException 194 */ 195 public abstract boolean addResultsetRecordsToContainer( 196 ResultsetType results, String endpoint, CompositeEntity container, 197 Vector aResultList) throws SAXException, IOException, 198 EcoGridException, NameDuplicationException, IllegalActionException; 199 200 /** 201 *@return Returns a unique name that descrobes this class, often it is the 202 * name of the class that implments the interface 203 */ 204 public abstract String getName(); 205 206 /** 207 *@return Returns the Data Source Type Name 208 */ 209 public abstract String getBriefName(); 210 211 /** 212 *@return returns the number of results that for this data. 213 */ 214 public abstract int getNumResults(); 215 216 /* A a method will replace a "." by "-" in a string */ 217 public static String replaceDotByDash(String originalString) { 218 String withoutDotString = null; 219 if (originalString == null) { 220 return withoutDotString; 221 } 222 223 if (originalString.indexOf(".") != -1) { 224 withoutDotString = originalString.replace('.', '-'); 225 226 } else { 227 withoutDotString = originalString; 228 } 229 // debugger.print("The string without dot is " + withoutDotString, 2); 230 return withoutDotString; 231 } 232 233}