}
String resourcePath = null;
final DatabaseResources databaseResources = new DatabaseResources(brokerPool);
//UNDERSTAND: why using guest account, it can be disabled
final Subject user = brokerPool.getSecurityManager().getGuestSubject();
if( xri.getNamespace() !=null ){
// XML Schema search
LOG.debug("Searching namespace '"+xri.getNamespace()+"' in database from "+collection+"...");
resourcePath = databaseResources.findXSD(collection, xri.getNamespace(), user);
// DIZZZ: set systemid?
} else if ( xri.getPublicId() !=null ){
// Catalog search
LOG.debug("Searching publicId '"+xri.getPublicId()+"' in catalogs in database from "+collection+"...");
String catalogPath = databaseResources.findCatalogWithDTD(collection, xri.getPublicId(), user);
LOG.debug("Found publicId in catalog '"+catalogPath+"'");
if(catalogPath!=null && catalogPath.startsWith("/")){
catalogPath="xmldb:exist://"+catalogPath;
}