{
resources = clr.getResources(location, cls != null ? cls.getClassLoader() : null);
}
catch (IOException e)
{
throw new JPOXException("Error loading resource", e).setFatal();
}
while (resources.hasMoreElements())
{
URL fileURL = (URL) resources.nextElement();
if (fileMetaDataByURLString.get(fileURL.toString()) == null)
{
// File hasn't been loaded so load it
FileMetaData filemd = parseFile(fileURL);
filemd.setType(FileMetaData.JDOQUERY_FILE); // TODO Remove this since set in the parser at <jdoquery>
registerFile(fileURL.toString(), filemd, clr);
// Populate all classes in this file we've just parsed
// TODO Populate the classes found in this file
}
}
cmd = getMetaDataForClass(cls, clr);
qmd = (QueryMetaData)queryMetaDataByName.get(query_key);
if (qmd != null)
{
if (JPOXLogger.METADATA.isDebugEnabled())
{
JPOXLogger.METADATA.debug(LOCALISER.msg("044053",query_key,location));
}
return qmd;
}
if (JPOXLogger.METADATA.isDebugEnabled())
{
JPOXLogger.METADATA.debug(LOCALISER.msg("044050",query_key,location));
}
}
return null;
}
// Query isn't scoped to a candidate class, so search the valid package-independent locations
List locations = new ArrayList();
locations.addAll(getValidMetaDataLocationsForItem(getJDOFileSuffix(), null, null, false));
locations.addAll(getValidMetaDataLocationsForItem(getORMFileSuffix(), getORMMappingName(), null, false));
locations.addAll(getValidMetaDataLocationsForItem(getJDOQueryFileSuffix(), null, null, false));
for (int i=0; i<locations.size(); i++)
{
String location = (String) locations.get(i);
// Process all resources for this location
Enumeration resources;
try
{
resources = clr.getResources(location, cls != null ? cls.getClassLoader() : null);
}
catch (IOException e)
{
throw new JPOXException("Error loading resources", e).setFatal();
}
while (resources.hasMoreElements())
{
URL fileURL = (URL) resources.nextElement();
if (fileMetaDataByURLString.get(fileURL.toString()) == null)