public static OperationRegistry initializeRegistry() { try { InputStream url = PropertyUtil.getFileFromClasspath(JAI_REGISTRY_FILE); if (url == null) { throw new RuntimeException("Could not find the main registry file"); } OperationRegistry registry = new ConcurrentOperationRegistry(); if (url != null) { registry.updateFromStream(url); } registry.registerServices(null); return registry; } catch (IOException ioe) { ImagingListener listener = JAI.getDefaultInstance().getImagingListener(); String message = "Error occurred while initializing JAI"; listener.errorOccurred( message, new ImagingException(message, ioe), OperationRegistry.class, false); return null; } }
/** * Returns a list of property names that are recognized by this image. * * @return An array of <code>String</code>s containing valid property names. */ public String[] getPropertyNames() { // Get statistics names and names from superclass. String[] statsNames = getStatisticsNames(); String[] superNames = super.getPropertyNames(); // Return stats names if not superclass names. if (superNames == null) { return statsNames; } // Check for overlap between stats names and superclass names. Vector extraNames = new Vector(); for (int i = 0; i < statsNames.length; i++) { String prefix = statsNames[i]; String[] names = PropertyUtil.getPropertyNames(superNames, prefix); if (names != null) { for (int j = 0; j < names.length; j++) { if (names[j].equalsIgnoreCase(prefix)) { extraNames.add(prefix); } } } } // If no overlap then return. if (extraNames.size() == 0) { return superNames; } // Combine superclass and extra names. String[] propNames = new String[superNames.length + extraNames.size()]; System.arraycopy(superNames, 0, propNames, 0, superNames.length); int offset = superNames.length; for (int i = 0; i < extraNames.size(); i++) { propNames[offset++] = (String) extraNames.get(i); } // Return combined name set. return propNames; }