javax.media.jai
Class OperationRegistry

java.lang.Object
  |
  +--javax.media.jai.OperationRegistry
All Implemented Interfaces:
Externalizable, Serializable

public class OperationRegistry
extends Object
implements Externalizable

A class responsible for maintaining a registry of various types of factory objects and preferences among them. The operation registry hierarchy looks as follows


                                                      |-object1-
                                           |-product1-|-object2-
                             |-descriptor1-|          |-object3-
                             |             |
                             |             |          |-object1-
                             |             |-product2-|-object2-
                     |-mode1-|                        |-object3-
                     |       |
 |-OperationRegistry-|       |                        |-object1-
                     |       |             |-product1-|-object2-
                     |       |-descriptor2-|          |-object3-
                     |                     |
                     |                     |          |-object1-
                     |                     |-product2-|-object2-
                     |                                |-object3-
                     |
                     |-mode2-|-descriptor1-|-object1--
                             |
                             |-descriptor2-|-object1--
 

The OperationRegistry class maps a descriptor name (for example, an image operation name) into the particular kind of factory object requested, capable of implementing the functionality described by the descriptor. The mapping is constructed in several stages:

At the highest level all objects are registered against some mode. A mode is specified by a String which must be one of those returned by RegistryMode.getModeNames(). Examples of known registry modes include "rendered", "renderable", "collection", "renderableCollection", "tileEncoder", "tileDecoder", "remoteRendered", "remoteRenderable", etc.

Each registry mode is associated with a RegistryElementDescriptor which describes some functionality to be implemented by factory objects associated with this descriptor. For example, the "rendered" registry mode is associated with OperationDescriptor.class and "tileEncoder" is associated with TileCodecDescriptor.class. Different registry modes can share the same RegistryElementDescriptor. For example "rendered", "renderable" (and other image operation registry modes) are all associated with OperationDescriptor.class.

If a registry mode supports preferences (for example "rendered", "tileEncoder" etc.), then the hierarchy of objects registered under that mode looks like that of "mode1" above. Descriptors are first registered against all modes that the specific instance supports. Each factory object that implements the functionality specified by that descriptor is registered against some product (name) under that descriptor. Preferences can be set among products under a given descriptor or among objects under a specific product/descriptor.

The ordering of such factory objects is determined by the order of the products attached to an OperationDescriptor, and by the order of the factory objects within each product. The orders are established by setting pairwise preferences, resulting in a partial order which is then sorted topologically. The results of creating a cycle are undefined.

The ordering of factory objects within a product is intended to allow vendors to create complex "fallback" chains. An example would be installing a RenderedImageFactory that implements separable convolution ahead of a RenderedImageFactory that implements a more general algorithm.

If a registry mode does not support preferences (for example, "renderable", "remoteRenderable" etc.) then the hierarchy of objects registered under that mode looks like that of "mode2" above. Only a single factory object belonging to this mode can be associated with a given descriptor. If multiple objects are registered under the same descriptor, the last one registered is retained.

The OperationRegistry has several methods to manage this hierarchy, which accept a modeName and work with Objects. The preferred manner of usage is through the type-safe wrapper class which are specific to each mode (for example RIFRegistry, CRIFRegistry etc.)

Vendors are encouraged to use unique product names (by means of the Java programming language convention of reversed Internet addresses) in order to maximize the likelihood of clean installation. See The Java Programming Language, §10.1 for a discussion of this convention in the context of package naming.

Users will, for the most part, only wish to set ordering preferences on the product level, since the factory object level orderings will be complex. However, it is possible for a knowledgable user to insert a specific factory object into an existing product for tuning purposes.

The OperationRegistry also has the responsibility of associating a set of PropertyGenerators with each descriptor. This set will be coalesced into a PropertySource suitable for use by the getPropertySource() method. If several PropertyGenerators associated with a particular descriptor generate the same property, only the last one to be registered will have any effect.

The registry handles all names (except class names) in a case-insensitive but retentive manner.

Initialization and automatic loading of registry objects.

The user has two options for automatic loading of registry objects.

The initialization of the OperationRegistry of the default instance of JAI happens as follows

  1. Load the JAI distributed registry file "META-INF/javax.media.jai.registryFile.jai" (from jai_core.jar)
  2. Find and load all "META-INF/registryFile.jai" files found in the classpath in some arbitrary order.
  3. Look for registered service providers of OperationRegistrySpi listed in all "META-INF/services/javax.media.jai.OperationRegistrySpi" files found in the classpath and call their updateRegistry method passing in the default OperationRegistry. The order of these calls to updateRegistry is arbitrary.
Note that the user should not make any assumption about the order of loading WITHIN step 2 or 3. If there is a need for the updateRegistry method to be called right after the associated registryFile.jai is read in, the following could be done.

The user could give the registry file a package qualified name for e.g xxx.yyy.registryFile.jai and put this in the META-INF directory of the jar file. Then in the concrete class that implements OperationRegistrySpi

  void updateRegistry(OperationRegistry or) {
      String registryFile = "META-INF/xxx.yyy.registryFile.jai";
      InputStream is = ClassLoader.getResourceAsStream(registryFile);

      or.updateFromStream(is);

      // Make other changes to "or" ...
  }
 
For information on the format of the registry file, see the serialized form of the OperationRegistry.

See Also:
OperationRegistrySpi, RegistryMode, RegistryElementDescriptor, Serialized Form

Constructor Summary
OperationRegistry()
          Default Constructor.
 
Method Summary
 void addPropertyGenerator(String operationName, PropertyGenerator generator)
          Deprecated. as of JAI 1.1 in favor of the version where the modeName is explicitly specified. This is currently equivalent to addPropertyGenerator("rendered", ...)
 void addPropertyGenerator(String modeName, String descriptorName, PropertyGenerator generator)
          Adds a PropertyGenerator to the registry, associating it with a particular descriptor registered against a registry mode.
 void clearCIFPreferences(String operationName, String productName)
          Deprecated. as of JAI 1.1 in favor of CIFRegistry.clearPreferences(...) . This is currently equivalent to CIFRegistry.clearPreferences(this, operationName, productName)
 void clearFactoryPreferences(String modeName, String descriptorName, String productName)
          Removes all preferences between instances of a factory within a product registered under a particular OperationDescriptor.
 void clearOperationPreferences(String operationName, String productName)
          Deprecated. as of JAI 1.1 in favor of calling *IFRegistry.clearPreferences(..) on all image operation related modes.
 void clearProductPreferences(String operationName)
          Deprecated. as of JAI 1.1 in favor of clearProductPreferences(...) which specifies a modeName also. This is currently equivalent to clearProductPreferences("rendered", operationName)
 void clearProductPreferences(String modeName, String descriptorName)
          Remove all the preferences between products for a descriptor registered under a registry mode.
 void clearPropertyState()
          Deprecated. as of JAI 1.1 in factor of the version where the modeName is explicitly specified. This is currently equivalent to clearPropertyState("rendered")
 void clearPropertyState(String modeName)
          Removes all property associated information for this registry mode from this OperationRegistry.
 void clearRIFPreferences(String operationName, String productName)
          Deprecated. as of JAI 1.1 in favor of RIFRegistry.clearPreferences(...) . This is currently equivalent to RIFRegistry.clearPreferences(this, operationName, productName)
 void copyPropertyFromSource(String operationName, String propertyName, int sourceIndex)
          Deprecated. as of JAI 1.1 in favor of the version where the modeName is explicitly specified. This is currently equivalent to copyPropertyFromSource("rendered", ...)
 void copyPropertyFromSource(String modeName, String descriptorName, String propertyName, int sourceIndex)
          Forces a property to be copied from the specified source by nodes performing a particular operation.
 PlanarImage create(String operationName, ParameterBlock paramBlock, RenderingHints renderHints)
          Deprecated. as of JAI 1.1 in favor of RIFRegistry.create(...) which returns a RenderedImage and not a PlanarImage. This is currently equivalent to PlanarImage.wrapRenderedImage(RIFRegistry.create(this, operationName, paramBlock, renderHints))
 CollectionImage createCollection(String operationName, ParameterBlock args, RenderingHints hints)
          Deprecated. as of JAI 1.1 in favor of CIFRegistry.create(...) . This is currently equivalent to CIFRegistry.create(this, operationName, args, hints))
 ContextualRenderedImageFactory createRenderable(String operationName, ParameterBlock paramBlock)
          Deprecated. as of JAI 1.1 in favor of CRIFRegistry.get(...) This is currently equivalent to CRIFRegistry.get(this, operationName)
 RegistryElementDescriptor getDescriptor(Class descriptorClass, String descriptorName)
          Get the RegistryElementDescriptor corresponding to a descriptorClass and a descriptorName.
 RegistryElementDescriptor getDescriptor(String modeName, String descriptorName)
          Get the RegistryElementDescriptor corresponding to descriptorName which supports the specified mode.
 String[] getDescriptorNames(Class descriptorClass)
          Get an array of all the descriptor names corresponding to the descriptorClass.
 String[] getDescriptorNames(String modeName)
          Get an array of all descriptor-names of descriptors registered under a given registry mode.
 List getDescriptors(Class descriptorClass)
          Get a List of all RegistryElementDescriptor corresponding to the descriptorClass.
 List getDescriptors(String modeName)
          Get a list of all RegistryElementDescriptors registered under a given registry mode.
 Object getFactory(String modeName, String descriptorName)
          Returns the factory of the specified type for the named operation.
 Iterator getFactoryIterator(String modeName, String descriptorName)
          Returns an Iterator over all factory objects registered with the specified factory and operation names over all products.
 Object[][] getFactoryPreferences(String modeName, String descriptorName, String productName)
          Get all pairwise preferences between instances of a factory within a product registered under a particular OperationDescriptor.
 String[] getGeneratedPropertyNames(String operationName)
          Deprecated. as of JAI 1.1 in favor of the version where the modeName is explicitly specified. This is currently equivalent to getGeneratedPropertyNames("rendered", ...)
 String[] getGeneratedPropertyNames(String modeName, String descriptorName)
          Returns a list of the properties generated by nodes implementing the descriptor associated with a particular descriptor Name.
 OperationDescriptor getOperationDescriptor(String operationName)
          Deprecated. as of JAI 1.1 in favor of getDescriptor(...) where the mode name is explicitly specified.
 Vector getOperationDescriptors()
          Deprecated. as of JAI 1.1 in favor of getDescriptors( OperationDescriptor.class) which returns a List and not a Vector. This is currently equivalent to new Vector(getDescriptors(OperationDescriptor.class))
 String[] getOperationNames()
          Deprecated. as of JAI 1.1 in favor of getDescriptorNames( OperationDescriptor.class).
 Vector getOrderedCIFList(String operationName, String productName)
          Deprecated. as of JAI 1.1 in favor of CIFRegistry.getOrderedList(...) which returns a List and not a Vector. This is currently equivalent to new Vector(CIFRegistry.getOrderedList(this, operationName, productName))
 List getOrderedFactoryList(String modeName, String descriptorName, String productName)
          Returns a list of the factory instances of a product registered under a particular OperationDescriptor, in an ordering that satisfies all of the pairwise preferences that have been set.
 Vector getOrderedProductList(String operationName)
          Deprecated. as of JAI 1.1 in favor of getOrderedProductList(...) which accepts a modeName also. This is currently equivalent to getOrderedProductList("rendered", operationName)
 Vector getOrderedProductList(String modeName, String descriptorName)
          Returns a list of the products registered under a particular descriptor in an ordering that satisfies all of the pairwise preferences that have been set.
 Vector getOrderedRIFList(String operationName, String productName)
          Deprecated. as of JAI 1.1 in favor of RIFRegistry.getOrderedList(...) which returns a List and not a Vector. This is currently equivalent to new Vector(RIFRegistry.getOrderedList(this, operationName, productName))
 String[][] getProductPreferences(String operationName)
          Deprecated. as of JAI 1.1 in favor of getProductPreferences(...) which accepts a modeName also. This is currently equivalent to getProductPreferences("rendered", operationName)
 String[][] getProductPreferences(String modeName, String descriptorName)
          Returns a list of the pairwise product preferences under a particular descriptor registered against a registry mode.
 PropertySource getPropertySource(OperationNode op)
          Constructs and returns a PropertySource suitable for use by a given OperationNode.
 PropertySource getPropertySource(RenderableOp op)
          Deprecated. as of JAI 1.1 in favor CRIFRegistry.getPropertySource(op)
 PropertySource getPropertySource(RenderedOp op)
          Deprecated. as of JAI 1.1 in favor RIFRegistry.getPropertySource(op)
 PropertySource getPropertySource(String modeName, String descriptorName, Object op, Vector sources)
          Merge mode-specific property environment with mode-independent property environment of the descriptor.
 String[] getRegistryModes()
          Get's the list of known registry modes known to the OperationRegistry.
static OperationRegistry getThreadSafeOperationRegistry()
          Creates and returns a new thread-safe version of the OperationRegistry which uses reader-writer locks to wrap every method with a read or a write lock as appropriate.
 void initializeFromStream(InputStream in)
          Initializes the OperationRegistry from an InputStream.
 Object invokeFactory(String modeName, String descriptorName, Object[] args)
          Finds the factory of the specified type for the named operation and invokes its default factory method with the supplied parameters.
 void readExternal(ObjectInput in)
          Restores the contents of the registry from an ObjectInput which was previously written using the writeExternal method.
 void registerCIF(String operationName, String productName, CollectionImageFactory CIF)
          Deprecated. as of JAI 1.1 in favor of CIFRegistry.register(...) . This is currently equivalent to CIFRegistry.register(this, operationName, productName, CIF)
 void registerCRIF(String operationName, ContextualRenderedImageFactory CRIF)
          Deprecated. as of JAI 1.1 in favor of CRIFRegistry.register(...) . This is currently equivalent to CRIFRegistry.register(this, operationName, productName, CRIF)
 void registerDescriptor(RegistryElementDescriptor descriptor)
          Register a descriptor against all the registry modes it supports.
 void registerFactory(String modeName, String descriptorName, String productName, Object factory)
          Register a factory object with a particular product and descriptor against a specified mode.
 void registerOperationDescriptor(OperationDescriptor odesc, String operationName)
          Deprecated. as of JAI 1.1 in favor of registerDescriptor(odesc)
 void registerRIF(String operationName, String productName, RenderedImageFactory RIF)
          Deprecated. as of JAI 1.1 in favor of RIFRegistry.register(...) . This is currently equivalent to RIFRegistry.register(this, operationName, productName, RIF)
 void registerServices(ClassLoader cl)
          Load all the "META-INF/registryFile.jai" files and then called the updateRegistry() of the registered service provider of OperationRegistrySpi found in the classpath corresponding to this class loader.
 void removePropertyGenerator(String operationName, PropertyGenerator generator)
          Deprecated. as of JAI 1.1 in favor of the version where the modeName is explicitly specified. This is currently equivalent to removePropertyGenerator("rendered", ...)
 void removePropertyGenerator(String modeName, String descriptorName, PropertyGenerator generator)
          Removes a PropertyGenerator from its association with a particular descriptor/registry-mode in the registry.
 void removeRegistryMode(String modeName)
          Remove a registry mode (including pre-defined JAI modes) from the OperationRegistry.
 void setCIFPreference(String operationName, String productName, CollectionImageFactory preferredCIF, CollectionImageFactory otherCIF)
          Deprecated. as of JAI 1.1 in favor of CIFRegistry.setPreference(...) . This is currently equivalent to CIFRegistry.setPreference(this, operationName, productName, preferredCIF, otherCIF)
 void setFactoryPreference(String modeName, String descriptorName, String productName, Object preferredOp, Object otherOp)
          Sets a preference between two factory instances for a given operation under a specified product.
 void setProductPreference(String operationName, String preferredProductName, String otherProductName)
          Deprecated. as of JAI 1.1 in favor of setProductPreference(...) which specifies a modeName also. This is currently equivalent to setProductPreference("rendered", operationName, preferredProductName, otherProductName)
 void setProductPreference(String modeName, String descriptorName, String preferredProductName, String otherProductName)
          Set the preference between two products for a descriptor registered under a registry mode.
 void setRIFPreference(String operationName, String productName, RenderedImageFactory preferredRIF, RenderedImageFactory otherRIF)
          Deprecated. as of JAI 1.1 in favor of RIFRegistry.setPreference(...) . This is currently equivalent to RIFRegistry.setPreference(this, operationName, productName, preferredRIF, otherRIF)
 void suppressAllProperties(String operationName)
          Deprecated. as of JAI 1.1 in favor of the version where the modeName is explicitly specified. This is currently equivalent to suppressAllProperties("rendered", ...)
 void suppressAllProperties(String modeName, String descriptorName)
          Forces all properties to be suppressed by nodes performing a particular operation.
 void suppressProperty(String operationName, String propertyName)
          Deprecated. as of JAI 1.1 in favor of the version where the modeName is explicitly specified. This is currently equivalent to suppressProperty("rendered", ...)
 void suppressProperty(String modeName, String descriptorName, String propertyName)
          Forces a particular property to be suppressed by nodes performing a particular operation.
 String toString()
          Returns a String representation of the registry.
 void unregisterCIF(String operationName, String productName, CollectionImageFactory CIF)
          Deprecated. as of JAI 1.1 in favor of CIFRegistry.unregister(...) . This is currently equivalent to CIFRegistry.unregister(this, operationName, productName, CIF)
 void unregisterCRIF(String operationName, ContextualRenderedImageFactory CRIF)
          Deprecated. as of JAI 1.1 in favor of CRIFRegistry.unregister(...) . This is currently equivalent to CRIFRegistry.unregister(this, operationName, productName, CRIF)
 void unregisterDescriptor(RegistryElementDescriptor descriptor)
          Unregister a descriptor against all its supported modes from the operation registry.
 void unregisterFactory(String modeName, String descriptorName, String productName, Object factory)
          Unregister a factory object previously registered with a product and descriptor against the specified mode.
 void unregisterOperationDescriptor(String operationName)
          Deprecated. as of JAI 1.1 in favor of unregisterDescriptor(...) which accepts an OperationDescriptor and not a operationName.
 void unregisterRIF(String operationName, String productName, RenderedImageFactory RIF)
          Deprecated. as of JAI 1.1 in favor of RIFRegistry.unregister(...) . This is currently equivalent to RIFRegistry.unregister(this, operationName, productName, RIF)
 void unsetCIFPreference(String operationName, String productName, CollectionImageFactory preferredCIF, CollectionImageFactory otherCIF)
          Deprecated. as of JAI 1.1 in favor of CIFRegistry.unsetPreference(...) . This is currently equivalent to CIFRegistry.unsetPreference(this, operationName, productName, preferredCIF, otherCIF)
 void unsetFactoryPreference(String modeName, String descriptorName, String productName, Object preferredOp, Object otherOp)
          Unsets a preference between two factory instances for a given operation under a specified product.
 void unsetProductPreference(String operationName, String preferredProductName, String otherProductName)
          Deprecated. as of JAI 1.1 in favor of unsetProductPreference(...) which specifies a modeName also. This is currently equivalent to unsetProductPreference("rendered", operationName, preferredProductName, otherProductName)
 void unsetProductPreference(String modeName, String descriptorName, String preferredProductName, String otherProductName)
          Remove the preference between two products for a descriptor registered under a registry mode.
 void unsetRIFPreference(String operationName, String productName, RenderedImageFactory preferredRIF, RenderedImageFactory otherRIF)
          Deprecated. as of JAI 1.1 in favor of RIFRegistry.unsetPreference(...) . This is currently equivalent to RIFRegistry.unsetPreference(this, operationName, productName, preferredRIF, otherRIF)
 void updateFromStream(InputStream in)
          Updates the current OperationRegistry with the operations specified by the given InputStream.
 void writeExternal(ObjectOutput out)
          Saves the contents of the registry as described in the serialized form.
 void writeToStream(OutputStream out)
          Writes out the contents of the OperationRegistry to a stream as specified in the writeExternal method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OperationRegistry

public OperationRegistry()
Default Constructor. The OperationRegistry created is not thread-safe. Note that none of the automatic loading of registry files or services happens here.
See Also:
getThreadSafeOperationRegistry()
Method Detail

getThreadSafeOperationRegistry

public static OperationRegistry getThreadSafeOperationRegistry()
Creates and returns a new thread-safe version of the OperationRegistry which uses reader-writer locks to wrap every method with a read or a write lock as appropriate. Note that none of the automatic loading of registry files or services is done on this OperationRegistry.
Since:
JAI 1.1

toString

public String toString()
Returns a String representation of the registry.
Overrides:
toString in class Object
Returns:
the string representation of this OperationRegistry.

writeToStream

public void writeToStream(OutputStream out)
                   throws IOException
Writes out the contents of the OperationRegistry to a stream as specified in the writeExternal method. For more information see the serialized form.
Parameters:
out - The OutputStream to which the OperationRegistry state is written.
Throws:
IllegalArgumentException - if out is null.
See Also:
writeExternal(java.io.ObjectOutput)

initializeFromStream

public void initializeFromStream(InputStream in)
                          throws IOException
Initializes the OperationRegistry from an InputStream. All non-IO exceptions encountered while parsing the registry files are caught and their error messages are redirected to System.err. If System.err is null the error messages will never be seen.

The InputStream passed in will not be closed by this method, the caller should close the InputStream when it is no longer needed.

The format of the data from the InputStream is expected to be the same as that of the writeExternal method as specified in the serialized form.

Parameters:
in - The InputStream from which to read the data.
Throws:
IllegalArgumentException - if in is null.
See Also:
writeExternal(java.io.ObjectOutput)

updateFromStream

public void updateFromStream(InputStream in)
                      throws IOException
Updates the current OperationRegistry with the operations specified by the given InputStream. All non-IO exceptions encountered while parsing the registry files are caught and their error messages are redirected to System.err. If System.err is null the error messages will never be seen.

The InputStream passed in will not be closed by this method, the caller should close the InputStream when it is no longer needed.

The format of the data from the InputStream is expected to be the same as that of the writeExternal method as specified in the serialized form.

Parameters:
in - The InputStream from which to read the data.
Throws:
IllegalArgumentException - if in is null.
Since:
JAI 1.1
See Also:
writeExternal(java.io.ObjectOutput)

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Restores the contents of the registry from an ObjectInput which was previously written using the writeExternal method.

All non-IO exceptions encountered while parsing the registry files are caught and their error messages are redirected to System.err. If System.err is null the error messages will never be seen.

Specified by:
readExternal in interface Externalizable
Parameters:
in - An ObjectInput from which to read the data.
Throws:
IllegalArgumentException - if in is null.
See Also:
writeExternal(java.io.ObjectOutput)

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Saves the contents of the registry as described in the serialized form.
Specified by:
writeExternal in interface Externalizable
Parameters:
out - An ObjectOutput to which to write the data.
Throws:
IllegalArgumentException - if out is null.

removeRegistryMode

public void removeRegistryMode(String modeName)
Remove a registry mode (including pre-defined JAI modes) from the OperationRegistry. When a mode is removed, all associated descriptors are also removed unless associated with another mode. Note that this does not unregister or remove this mode from RegistryMode Also note that a registry mode need not be explicitly added to the OperationRegistry. All modes registered under RegistryMode are automatically recognized by the OperationRegistry.
Throws:
IllegalArgumentException - if modeName is null or if the modeName is not one of the modes returned RegistryMode.getModes()
Since:
JAI 1.1

getRegistryModes

public String[] getRegistryModes()
Get's the list of known registry modes known to the OperationRegistry. This might not be all modes listed in RegistryMode.getModeNames().
Since:
JAI 1.1

registerDescriptor

public void registerDescriptor(RegistryElementDescriptor descriptor)
Register a descriptor against all the registry modes it supports. The "descriptor" must be an instance of the RegistryMode.getDescriptorClass() The "descriptor" is keyed on descriptor.getName(). Only one descriptor can be registered against a descriptor name for a given mode.
Parameters:
descriptor - an instance of a concrete sub-class of RegistryElementDescriptor
Throws:
IllegalArgumentException - is descriptor is null
IllegalArgumentException - if any of the modes returned by descriptor.getSupportedModes() is not one of those returned by RegistryMode.getModes()
IllegalArgumentException - if another descriptor with the same name has already been registered against any of the modes supported by this descriptor.
Since:
JAI 1.1

unregisterDescriptor

public void unregisterDescriptor(RegistryElementDescriptor descriptor)
Unregister a descriptor against all its supported modes from the operation registry.
Parameters:
descriptor - an instance of a concrete sub-class of RegistryElementDescriptor
Throws:
IllegalArgumentException - is descriptor is null
IllegalArgumentException - if any of the modes returned by descriptor.getSupportedModes() is not one of those returned by RegistryMode.getModes()
IllegalArgumentException - if any of the PropertyGenerators associated with the RegistryElementDescriptor to be unregistered is null.
Since:
JAI 1.1

getDescriptor

public RegistryElementDescriptor getDescriptor(Class descriptorClass,
                                               String descriptorName)
Get the RegistryElementDescriptor corresponding to a descriptorClass and a descriptorName. For example, getDescriptor(OperationDescriptor.class, "add") would get the operation descriptor for the "add" image operation. Note that different descriptors might have been registered against each mode associated with the descriptorClass. In this case this methods will arbitrarily return the first descriptor it encounters with a matching descriptorName and descriptorClass.
Parameters:
descriptorClass - the descriptor Class
descriptorName - the descriptor name as a String
Throws:
IllegalArgumentException - if descriptorClass is null or if the descriptorClass is not associated with any of the modes returned RegistryMode.getModes()
IllegalArgumentException - if descriptorName is null
Since:
JAI 1.1

getDescriptors

public List getDescriptors(Class descriptorClass)
Get a List of all RegistryElementDescriptor corresponding to the descriptorClass. For example, getDescriptors(OperationDescriptor.class) would get a list of all image operation descriptors.
Parameters:
descriptorClass - the descriptor Class
Throws:
IllegalArgumentException - if descriptorClass is null or if the descriptorClass is not associated with any of the modes returned RegistryMode.getModes()
Since:
JAI 1.1

getDescriptorNames

public String[] getDescriptorNames(Class descriptorClass)
Get an array of all the descriptor names corresponding to the descriptorClass. For example, getDescriptorNames(OperationDescriptor.class) would get an array of all image operation descriptor names.
Parameters:
descriptorClass - the descriptor Class
Throws:
IllegalArgumentException - if descriptorClass is null or if the descriptorClass is not associated with any of the modes returned RegistryMode.getModes()
Since:
JAI 1.1

getDescriptor

public RegistryElementDescriptor getDescriptor(String modeName,
                                               String descriptorName)
Get the RegistryElementDescriptor corresponding to descriptorName which supports the specified mode. This is done by matching up the descriptorName against RegistryElementDescriptor.getName in a case-insensitive manner. This returns null if there no RegistryElementDescriptor corresponding to descriptorName that supports the specified mode.
Parameters:
modeName - the registry mode name as a String
descriptorName - the descriptor name as a String
Throws:
IllegalArgumentException - if modeName is null or if the modeName is not one of the modes returned RegistryMode.getModes()
IllegalArgumentException - if descriptorName is null
Since:
JAI 1.1

getDescriptors

public List getDescriptors(String modeName)
Get a list of all RegistryElementDescriptors registered under a given registry mode.
Parameters:
modeName - the registry mode name as a String
Throws:
IllegalArgumentException - if modeName is null or if the modeName is not one of the modes returned RegistryMode.getModes()
Since:
JAI 1.1

getDescriptorNames

public String[] getDescriptorNames(String modeName)
Get an array of all descriptor-names of descriptors registered under a given registry mode.
Parameters:
modeName - the registry mode name as a String
Throws:
IllegalArgumentException - if modeName is null or if the modeName is not one of the modes returned RegistryMode.getModes()
Since:
JAI 1.1

setProductPreference

public void setProductPreference(String modeName,
                                 String descriptorName,
                                 String preferredProductName,
                                 String otherProductName)
Set the preference between two products for a descriptor registered under a registry mode.
Parameters:
modeName - the registry mode name as a String
descriptorName - the descriptor name as a String
preferredProductName - the product to be preferred.
otherProductName - the other product.
Throws:
IllegalArgumentException - if any of the arguments is null
IllegalArgumentException - if modeName is not one of those returned by RegistryMode.getModes()
IllegalArgumentException - if the registry mode does not support preferences
IllegalArgumentException - if there is no RegistryElementDescriptor registered against the descriptorName under modeName.
IllegalArgumentException - if either of the products are not registered against descriptorName under productName.
Since:
JAI 1.1

unsetProductPreference

public void unsetProductPreference(String modeName,
                                   String descriptorName,
                                   String preferredProductName,
                                   String otherProductName)
Remove the preference between two products for a descriptor registered under a registry mode.
Parameters:
modeName - the registry mode name as a String
descriptorName - the descriptor name as a String
preferredProductName - the product formerly preferred.
otherProductName - the other product.
Throws:
IllegalArgumentException - if any of the arguments is null
IllegalArgumentException - if modeName is not one of those returned by RegistryMode.getModes()
IllegalArgumentException - if the registry mode does not support preferences
IllegalArgumentException - if there is no RegistryElementDescriptor registered against the descriptorName under modeName.
IllegalArgumentException - if either of the products are not registered against descriptorName under productName.
Since:
JAI 1.1

clearProductPreferences

public void clearProductPreferences(String modeName,
                                    String descriptorName)
Remove all the preferences between products for a descriptor registered under a registry mode.
Parameters:
modeName - the registry mode name as a String
descriptorName - the descriptor name as a String
Throws:
IllegalArgumentException - if modeName is null or if the modeName is not one of the modes returned RegistryMode.getModes()
IllegalArgumentException - if descriptorName is null
IllegalArgumentException - if the registry mode does not support preferences
Since:
JAI 1.1

getProductPreferences

public String[][] getProductPreferences(String modeName,
                                        String descriptorName)
Returns a list of the pairwise product preferences under a particular descriptor registered against a registry mode.
Parameters:
modeName - the registry mode name as a String
descriptorName - the descriptor name as a String
Returns:
an array of 2-element arrays of Strings.
Throws:
IllegalArgumentException - if modeName is null or if the modeName is not one of the modes returned RegistryMode.getModes()
IllegalArgumentException - if descriptorName is null
IllegalArgumentException - if the registry mode does not support preferences
Since:
JAI 1.1

getOrderedProductList

public Vector getOrderedProductList(String modeName,
                                    String descriptorName)
Returns a list of the products registered under a particular descriptor in an ordering that satisfies all of the pairwise preferences that have been set. Returns null if cycles exist. Returns null if no descriptor has been registered under this descriptorName, or if no products exist for this operation.
Parameters:
modeName - the registry mode name as a String
descriptorName - the descriptor name as a String
Returns:
a Vector of Strings representing product names.
Throws:
IllegalArgumentException - if modeName is null or if the modeName is not one of the modes returned RegistryMode.getModes()
IllegalArgumentException - if descriptorName is null
IllegalArgumentException - if the registry mode does not support preferences
Since:
JAI 1.1

registerFactory

public void registerFactory(String modeName,
                            String descriptorName,
                            String productName,
                            Object factory)
Register a factory object with a particular product and descriptor against a specified mode. For modes that do not support preferences the productName is ignored (can be null)
Parameters:
modeName - the registry mode name as a String
descriptorName - the descriptor name as a String
productName - the product name as a String
factory - the object to be registered.
Throws:
IllegalArgumentException - if any of the arguments is null (productName can be null for modes that do not support preferences).
IllegalArgumentException - if modeName is not one of those returned by RegistryMode.getModes()
IllegalArgumentException - if there is no RegistryElementDescriptor registered against the descriptorName
Since:
JAI 1.1

unregisterFactory

public void unregisterFactory(String modeName,
                              String descriptorName,
                              String productName,
                              Object factory)
Unregister a factory object previously registered with a product and descriptor against the specified mode. For modes that do not support preferences the productName is ignored (can be null)
Parameters:
modeName - the registry mode name as a String
descriptorName - the descriptor name as a String
productName - the product name as a String
factory - the object to be unregistered.
Throws:
IllegalArgumentException - if any of the arguments is null (productName can be null for modes that do not support preferences).
IllegalArgumentException - if modeName is not one of those returned by RegistryMode.getModes()
IllegalArgumentException - if there is no RegistryElementDescriptor registered against the descriptorName
IllegalArgumentException - if the factory object was not previously registered against descriptorName and productName
Since:
JAI 1.1

setFactoryPreference

public void setFactoryPreference(String modeName,
                                 String descriptorName,
                                 String productName,
                                 Object preferredOp,
                                 Object otherOp)
Sets a preference between two factory instances for a given operation under a specified product.
Parameters:
modeName - the registry mode name as a String
descriptorName - the descriptor name as a String
productName - the product name as a String
preferredOp - the preferred factory object
otherOp - the other factory object
Throws:
IllegalArgumentException - if any of the arguments is null
IllegalArgumentException - if modeName is not one of those returned by RegistryMode.getModes()
IllegalArgumentException - if there is no RegistryElementDescriptor registered against the descriptorName
IllegalArgumentException - if either of the factory objects were not previously registered against descriptorName and productName
IllegalArgumentException - if the registry mode does not support preferences
Since:
JAI 1.1

unsetFactoryPreference

public void unsetFactoryPreference(String modeName,
                                   String descriptorName,
                                   String productName,
                                   Object preferredOp,
                                   Object otherOp)
Unsets a preference between two factory instances for a given operation under a specified product.
Parameters:
modeName - the registry mode name as a String
descriptorName - the descriptor name as a String
productName - the product name as a String
preferredOp - the factory object formerly preferred
otherOp - the other factory object
Throws:
IllegalArgumentException - if any of the arguments is null
IllegalArgumentException - if modeName is not one of those returned by RegistryMode.getModes()
IllegalArgumentException - if there is no RegistryElementDescriptor registered against the descriptorName
IllegalArgumentException - if either of the factory objects were not previously registered against descriptorName and productName
IllegalArgumentException - if the registry mode does not support preferences
Since:
JAI 1.1

clearFactoryPreferences

public void clearFactoryPreferences(String modeName,
                                    String descriptorName,
                                    String productName)
Removes all preferences between instances of a factory within a product registered under a particular OperationDescriptor.
Parameters:
modeName - the registry mode name as a String
descriptorName - the descriptor name as a String
productName - the product name as a String
Throws:
IllegalArgumentException - if any of the arguments is null
IllegalArgumentException - if modeName is not one of those returned by RegistryMode.getModes()
IllegalArgumentException - if there is no RegistryElementDescriptor registered against the descriptorName
Since:
JAI 1.1

getFactoryPreferences

public Object[][] getFactoryPreferences(String modeName,
                                        String descriptorName,
                                        String productName)
Get all pairwise preferences between instances of a factory within a product registered under a particular OperationDescriptor.
Parameters:
modeName - the registry mode name as a String
descriptorName - the descriptor name as a String
productName - the product name as a String
Throws:
IllegalArgumentException - if any of the arguments is null
IllegalArgumentException - if modeName is not one of those returned by RegistryMode.getModes()
IllegalArgumentException - if there is no RegistryElementDescriptor registered against the descriptorName
Since:
JAI 1.1

getOrderedFactoryList

public List getOrderedFactoryList(String modeName,
                                  String descriptorName,
                                  String productName)
Returns a list of the factory instances of a product registered under a particular OperationDescriptor, in an ordering that satisfies all of the pairwise preferences that have been set. Returns null if cycles exist. Returns null, if the product does not exist under this descriptorName. If the particular registry mode does not support preferences then the returned List will contain a single factory.
Parameters:
modeName - the registry mode name as a String
descriptorName - the descriptor name as a String
productName - the product name as a String
Returns:
an ordered List of factory instances
Throws:
IllegalArgumentException - if any of the arguments is null (productName can be null for modes that do not support preferences).
IllegalArgumentException - if modeName is not one of those returned by RegistryMode.getModes()
IllegalArgumentException - if there is no RegistryElementDescriptor registered against the descriptorName
Since:
JAI 1.1

getFactoryIterator

public Iterator getFactoryIterator(String modeName,
                                   String descriptorName)
Returns an Iterator over all factory objects registered with the specified factory and operation names over all products. The order of objects in the iteration will be according to the pairwise preferences among products and image factories within a product. The remove() method of the Iterator may not be implemented. If the particular factory does not have preferences then the returned Iterator will traverse a collection containing the single factory.
Parameters:
modeName - the registry mode name as a String
descriptorName - the descriptor name as a String
Returns:
an Iterator over factory objects
Throws:
IllegalArgumentException - if any of the arguments is null
IllegalArgumentException - if modeName is not one of those returned by RegistryMode.getModes()
IllegalArgumentException - if there is no RegistryElementDescriptor registered against the descriptorName
Since:
JAI 1.1

getFactory

public Object getFactory(String modeName,
                         String descriptorName)
Returns the factory of the specified type for the named operation. This method will return the first factory that would be encountered by the Iterator returned by the getFactoryIterator() method.
Parameters:
modeName - the registry mode name as a String
descriptorName - the descriptor name as a String
Returns:
a registered factory object
Throws:
IllegalArgumentException - if any of the arguments is null
IllegalArgumentException - if modeName is not one of those returned by RegistryMode.getModes()
IllegalArgumentException - if there is no RegistryElementDescriptor registered against the descriptorName
Since:
JAI 1.1

invokeFactory

public Object invokeFactory(String modeName,
                            String descriptorName,
                            Object[] args)
Finds the factory of the specified type for the named operation and invokes its default factory method with the supplied parameters. The class of the returned object is that of the object returned by the factory's object creation method.
Parameters:
modeName - the registry mode name as a String
descriptorName - the descriptor name as a String
Returns:
an object created by the factory method
Throws:
IllegalArgumentException - if modeName or descriptorName is null
IllegalArgumentException - if modeName is not one of those returned by RegistryMode.getModes()
IllegalArgumentException - if there is no RegistryElementDescriptor registered against the descriptorName
Since:
JAI 1.1

addPropertyGenerator