public static String resolveSchema(final ResourceManager resourceManager,
final ResourceKey contextKey,
String catalogUrl)
throws FileSystemException
{
final FileSystemManager fsManager = VFS.getManager();
if (fsManager == null)
{
throw Util.newError("Cannot get virtual file system manager");
}
// Workaround VFS bug.
if (catalogUrl.startsWith("file://localhost"))
{
catalogUrl = catalogUrl.substring("file://localhost".length());
}
if (catalogUrl.startsWith("file:"))
{
catalogUrl = catalogUrl.substring("file:".length());
}
try
{
final File catalogFile = new File(catalogUrl).getCanonicalFile();
final FileObject file = fsManager.toFileObject(catalogFile);
if (file.isReadable())
{
return catalogFile.getPath();
}
}