private DeviceIdentificationAnalyserResult testDevicePatterns(
final String fileName, final String deviceName)
throws RepositoryException, DeviceRepositoryException {
// load the identification object
final Identification identification = loadIdentification(fileName);
if (identification == null) {
throw new RepositoryException(EXCEPTION_LOCALIZER.format(
"device-repository-file-missing",
DeviceRepositoryConstants.IDENTIFICATION_XML));
}
// create the repository
final SimpleDeviceRepositoryFactory factory =
new SimpleDeviceRepositoryFactory();
final DeviceRepository repository =
factory.createDeviceRepository("file://" + fileName, null);
final Iterator entriesIter;
if (deviceName == null) {
// iterate throuogh the identification entries
entriesIter = identification.entries();
} else {
// only check one entry
final IdentificationEntry entry = identification.find(deviceName);
entriesIter = Collections.singleton(entry).iterator();
}
return testDevicePatterns(repository, entriesIter);
}