2 * BioJava development code
4 * This code may be freely distributed and modified under the
5 * terms of the GNU Lesser General Public Licence. This should
6 * be distributed with the code. If you do not have a copy,
9 * http://www.gnu.org/copyleft/lesser.html
11 * Copyright for this code is held jointly by the individual
12 * authors. These should be listed in @author doc comments.
14 * For more information on the BioJava project and its aims,
15 * or to join the biojava-l mailing list, visit the home page
18 * http://www.biojava.org/
20 * Created on Mar 20, 2006
23 package org.biojava.dasobert.dasregistry;
25 import org.biojava.dasobert.das2.Das2Source;
27 public class DasSourceValidator {
29 public DasSourceValidator() {
34 public void validateDasSource(DasSource ds) throws Exception {
36 if ( ds instanceof Das2Source ){
38 Das2Source d2s = (Das2Source)ds;
40 Das2Validator validator = new Das2Validator();
41 boolean ok = validator.validate(d2s);
43 throw new Exception("coul not validate DasSource");
49 String url =ds.getUrl();
50 String[] caps = ds.getCapabilities();
51 //String testCode = ds.getTestCode();
53 Das1Validator validator = new Das1Validator();
55 String[] okcaps = validator.validate(url,ds.getCoordinateSystem(),caps);
56 String validationMessage = validator.getValidationMessage();
57 if ( okcaps.length != caps.length){
58 throw new Exception("could not validate DasSource " + validationMessage);