// Is the module source stored in the database?
try {
final XmldbURI locationUri = XmldbURI.xmldbUriFor(query);
DocumentImpl sourceDoc = null;
try {
sourceDoc = broker.getXMLResource(locationUri.toCollectionPathURI(), Lock.READ_LOCK);
if (sourceDoc == null)
{throw new ServletException("XQuery resource: " + query + " not found in database");}
if (sourceDoc.getResourceType() != DocumentImpl.BINARY_FILE ||
!"application/xquery".equals(sourceDoc.getMetadata().getMimeType()))
{throw new ServletException("XQuery resource: " + query + " is not an XQuery or " +