{
try
{
- String url = new RegistrySourceAdapter(source)
- .getOriginalDataSourceUri();
- return url;
+ // kind of dumb, since org.biodas.jdas.dassources.utils.VersionAdapter.getSourceUriFromQueryUri() does this,
+ // but this way, we can access non DAS 1.6 compliant sources (which have to have a URL like <sourcename>/das/ and cause a validation exception)
+
+ for (CAPABILITY cap : getVersion().getCAPABILITY())
+ {
+ String capname = cap.getType().substring(
+ cap.getType().indexOf(":") + 1);
+ int p=cap.getQueryUri().lastIndexOf(capname);
+ if (p<-1) {
+ throw new Exception("Invalid das source: "+source.getUri());
+ }
+ if (cap.getQueryUri().charAt(p)=='/')
+ {
+ p--;
+ }
+ return cap.getQueryUri().substring(0,p);
+ }
} catch (Exception x)
{
System.err.println("Serious: Couldn't get the URL for source "