| java.lang.Object javax.media.jai.remote.RemoteJAI
RemoteJAI | public class RemoteJAI (Code) | | A convenience class for instantiating operations on remote machines.
This class also provides information related to the server and allows
for setting of parameters for the remote communication with the server.
Conceptually this class is very similar to the JAI
class, except that the RemoteJAI class deals with
remote operations. This class allows programmers to use the syntax:
import javax.media.jai.remote.RemoteJAI;
RemoteJAI rc = new RemoteJAI(protocolName, serverName);
RemoteRenderedOp im = rc.create("convolve", paramBlock, renderHints);
to create new images by applying operators that are executed remotely on
the specified server. The create() method returns a
RemoteRenderedOp encapsulating the protocol name, server
name, operation name, parameter block, and rendering hints. Additionally,
it performs validity checking on the operation parameters. The operation
parameters are determined from the OperationDescriptor
retrieved using the getServerSupportedOperationList() method.
Programmers may also refer to
RemoteJAI.createRenderable("opname", paramBlock, renderHints);
If the OperationDescriptor associated with the
named operation returns true from its
isImmediate() method, the create()
method will ask the RemoteRenderedOp it constructs to render
itself immediately. If this rendering is null ,
create() will itself return null
rather than returning an instance of RemoteRenderedOp
as it normally does.
The registry being used by this class may be
inspected or set using the getOperationRegistry() and
setOperationRegistry() methods. Only experienced
users should attempt to set the registry. This registry is used to
map protocol names into either a RemoteRIF or a
RemoteCRIF .
The TileCache associated with an instance may be
similarly accessed.
Each instance of RemoteJAI contains a set of
default rendering hints which will be used for all image creations.
These hints are merged with any hints supplied to the
create method; directly supplied hints take precedence
over the common hints. When a new RemoteJAI instance is
constructed, its hints are initialized to a copy of the default
hints. Thus when an instance of RemoteJAI is
constructed, hints for the default registry, tile cache, number of
retries, and the retry interval are added to the set of common
rendering hints. Similarly, invoking setOperationRegistry() ,
setTileCache() , setNumRetries() or
setRetryInterval() on a RemoteJAI instance
will cause the respective entity to be added to the common rendering
hints. The hints associated with any instance may be manipulated
using the getRenderingHints() ,
setRenderingHints() , clearRenderingHints() methods.
The TileCache to be used by a particular operation
may be set during construction, or by calling
the setTileCache() method. This will result in the
provided tile cache being added to the set of common rendering
hints.
Network errors are dealt with through the use of retry intervals and
retries. Retries refers to the maximum number of times a remote operation
will be retried. The retry interval refers to the amount of time (in
milliseconds) between two consecutive retries. If errors are encountered
at each retry and the number of specified retries has been exhausted, a
RemoteImagingException will be thrown. By default, the
number of retries is set to five, and the retry interval
is set to a thousand milliseconds. These values can be changed by using
the setNumRetries() and the setRetryInterval
methods and can also be specified via the RenderingHints
object passed as an argument to RemoteJAI.create() . Time
outs (When the amount of time taken to get a response or
the result of an operation from the remote machine exceeds a limit) are
not dealt with, and must be taken care of by the network imaging
protocol implementation itself. The implementation must be responsible
for monitoring time outs, but on encountering one can deal with it by
throwing a RemoteImagingException , which will then be dealt
with using retries and retry intervals.
This class provides the capability of negotiating capabilities
between the client and the server. The negotiate
method uses the preferences specified via the
setNegotiationPreferences method alongwith the server
and client capabilities retrieved via the getServerCapabilities
and getClientCapabilities respectively to negotiate on each
of the preferences. This negotiation treats the client and server
capabilities as being non-preferences, and the user set
NegotiableCapabilitySet as being a preference. The
negotiation is performed according to the rules described in the class
documentation for NegotiableCapability .
Note that negotiation preferences can be set either prior to
specifying a particular rendered or renderable operation (by using
RemoteJAI.create() or
RemoteJAI.createRenderable() ) or afterwards. The currently
set negotiation preferences are passed to the RemoteRenderedOp
on its construction through the RenderingHints using the
KEY_NEGOTIATION_PREFERENCES key. Since
RemoteRenderableOp does not accept a
RenderingHints object as a construction argument, the newly
created RemoteRenderableOp is informed of these preferences
using it's setRenderingHints() method. These preferences
can be changed after the construction using the
setNegotiationPreferences() method on both
RemoteRenderedOp and RemoteRenderableOp .
The same behavior applies to the number of retries and the retry interval,
whether they be the default values contained in the default
RenderingHints or whether they are set using the
setNumRetries or setRetryInterval methods, the
existing values are passed to RemoteRenderedOp 's when they
are created through the RenderingHints argument, and are set
on the newly created RemoteRenderableOp using the
setNumRetries or setRetryInterval methods on
RemoteRenderableOp .
See Also: JAI See Also: JAIRMIDescriptor See Also: RemoteImagingException since: JAI 1.1 |
Constructor Summary | |
public | RemoteJAI(String protocolName, String serverName) Constructs a RemoteJAI instance with the given
protocol name and server name. | public | RemoteJAI(String protocolName, String serverName, OperationRegistry registry, TileCache tileCache) Constructs a RemoteJAI instance with the given
protocol name, server name, OperationRegistry
and TileCache . |
Method Summary | |
public void | clearRenderingHints() Clears the RenderingHints associated with this
RemoteJAI instance. | public RemoteRenderedOp | create(String opName, ParameterBlock args, RenderingHints hints) Creates a RemoteRenderedOp which represents the named
operation to be performed remotely, using the source(s) and/or
parameter(s) specified in the ParameterBlock , and
applying the specified hints to the destination. | public RemoteRenderableOp | createRenderable(String opName, ParameterBlock args) Creates a RemoteRenderableOp that represents the named
operation to be performed remotely, using the source(s) and/or
parameter(s) specified in the ParameterBlock .
This method should only be used when the final result returned
is a single RenderableImage .
The supplied operation name is validated against the names
of the OperationDescriptor s returned from
the getServerSupportedOperationList() method.
The source(s) and/or parameter(s) in the
ParameterBlock are validated against the named
operation's descriptor, both in their numbers and types.
Additional restrictions placed on the sources and parameters
by an individual operation are also validated by calling its
OperationDescriptor.validateRenderableArguments()
method.
Parameters are allowed to have a null input
value, if that particular parameter has a default value specified
in its operation's descriptor. | public NegotiableCapabilitySet | getClientCapabilities() Returns the set of capabilities supported by the client. | public NegotiableCapabilitySet | getNegotiatedValues() Returns the results of the negotiation between the client and server
capabilities according to the user preferences specified at an
earlier time. | public NegotiableCapability | getNegotiatedValues(String category) Returns the results of the negotiation between the client and server
capabilities according to the user preferences specified at an
earlier time for the given category. | public int | getNumRetries() Returns the number of retries. | public OperationRegistry | getOperationRegistry() Returns the OperationRegistry being used by this
RemoteJAI instance. | public String | getProtocolName() Returns the protocol name. | public Object | getRenderingHint(RenderingHints.Key key) Returns the hint value associated with a given key
in this RemoteJAI instance, or null
if no value is associated with the given key. | public RenderingHints | getRenderingHints() Returns the RenderingHints associated with this
RemoteJAI instance. | public int | getRetryInterval() Returns the amount of time between retries in milliseconds. | public NegotiableCapabilitySet | getServerCapabilities() Returns the set of capabilites supported by the server. | public String | getServerName() Returns a String identifying the remote server machine. | public OperationDescriptor[] | getServerSupportedOperationList() Returns the list of OperationDescriptor s that describe
the operations supported by the server. | public TileCache | getTileCache() Returns the TileCache being used by this
RemoteJAI instance. | public static NegotiableCapabilitySet | negotiate(NegotiableCapabilitySet preferences, NegotiableCapabilitySet serverCapabilities, NegotiableCapabilitySet clientCapabilities) This method negotiates the capabilities to be used in the remote
communication. | public static NegotiableCapability | negotiate(NegotiableCapabilitySet preferences, NegotiableCapabilitySet serverCapabilities, NegotiableCapabilitySet clientCapabilities, String category) This method negotiates the capabilities to be used in the remote
communication for the given category. | public void | removeRenderingHint(RenderingHints.Key key) Removes the hint value associated with a given key
in this RemoteJAI instance. | void | sendExceptionToListener(String message, Exception e) | public void | setNegotiationPreferences(NegotiableCapabilitySet preferences) Sets the preferences to be used in the client-server
communication. | public void | setNumRetries(int numRetries) Sets the number of retries. | public void | setOperationRegistry(OperationRegistry operationRegistry) Sets theOperationRegistry to be used by this
RemoteJAI instance. | public void | setRenderingHint(RenderingHints.Key key, Object value) Sets the hint value associated with a given key
in this RemoteJAI instance. | public void | setRenderingHints(RenderingHints hints) Sets the RenderingHints associated with this
RemoteJAI instance. | public void | setRetryInterval(int retryInterval) Sets the amount of time between retries in milliseconds. | public void | setTileCache(TileCache tileCache) Sets the TileCache to be used by this
RemoteJAI . |
DEFAULT_NUM_RETRIES | final public static int DEFAULT_NUM_RETRIES(Code) | | The default number of retries.
|
DEFAULT_RETRY_INTERVAL | final public static int DEFAULT_RETRY_INTERVAL(Code) | | The amount of time to wait between retries (in Millseconds).
|
protocolName | protected String protocolName(Code) | | The name of the protocol used for client-server communication.
|
serverName | protected String serverName(Code) | | The String representing the remote server machine.
|
RemoteJAI | public RemoteJAI(String protocolName, String serverName)(Code) | | Constructs a RemoteJAI instance with the given
protocol name and server name. The semantics of the serverName
are defined by the particular protocol used to create this
class. Instructions on how to create a serverName that is
compatible with this protocol can be retrieved from the
getServerNameDocs() method on the
RemoteDescriptor associated with the given
protocolName. An IllegalArgumentException may
be thrown by the protocol specific classes at a later point, if
null is provided as the serverName argument and null is not
considered a valid serverName by the specified protocol.
Parameters: protocolName - The String that identifies theremote imaging protocol. Parameters: serverName - The String that identifies the server. throws: IllegalArgumentException - if protocolName is null. |
RemoteJAI | public RemoteJAI(String protocolName, String serverName, OperationRegistry registry, TileCache tileCache)(Code) | | Constructs a RemoteJAI instance with the given
protocol name, server name, OperationRegistry
and TileCache . If the specified
OperationRegistry is null, the registry associated
with the default JAI instance will be used. If the
specified TileCache is null, the TileCache
associated with the default JAI instance will be used.
An IllegalArgumentException may
be thrown by the protocol specific classes at a later point, if
null is provided as the serverName argument and null is not
considered a valid serverName by the specified protocol.
Parameters: serverName - The String that identifiesthe server. Parameters: protocolName - The String that identifiesthe remote imaging protocol. Parameters: operationRegistry - The OperationRegistry associatedwith this class, if null, default will be used. Parameters: tileCache - The TileCache associated withthis class, if null, default will be used. throws: IllegalArgumentException - if protocolName is null. |
clearRenderingHints | public void clearRenderingHints()(Code) | | Clears the RenderingHints associated with this
RemoteJAI instance.
|
create | public RemoteRenderedOp create(String opName, ParameterBlock args, RenderingHints hints)(Code) | | Creates a RemoteRenderedOp which represents the named
operation to be performed remotely, using the source(s) and/or
parameter(s) specified in the ParameterBlock , and
applying the specified hints to the destination. This method
should only be used when the final result returned is a single
RemoteRenderedImage .
The supplied operation name is validated against the
names of the OperationDescriptor s returned from
the getServerSupportedOperationList() method. The
source(s) and/or parameter(s) in the ParameterBlock
are validated against the named operation's descriptor, both in
their numbers and types. Additional restrictions placed on the
sources and parameters by an individual operation are also
validated by calling its
OperationDescriptor.validateArguments() method.
Parameters are allowed to have a null input
value, if that particular parameter has a default value specified
in its operation's descriptor. In this case, the default value
will replace the null input.
Unspecified tailing parameters are allowed, if these
parameters have default values specified in the operation's
descriptor. However, if a parameter, which has a default value,
is followed by one or more parameters that
have no default values, this parameter must be specified in the
ParameterBlock , even if it only has a value of
code>null.
The rendering hints associated with this instance of
RemoteJAI are overlaid with the hints passed to this
method. That is, the set of keys will be the union of the
keys from the instance's hints and the hints parameter.
If the same key exists in both places, the value from the
hints parameter will be used.
Parameters: opName - The name of the operation. Parameters: args - The source(s) and/or parameter(s) for the operation. Parameters: hints - The hints for the operation. throws: IllegalArgumentException - if opName isnull . throws: IllegalArgumentException - if args isnull . throws: IllegalArgumentException - if noOperationDescriptor is available from the serverwith the specified operation name. throws: IllegalArgumentException - if theOperationDescriptor for the specifiedoperation name on the server does notsupport the "rendered" registry mode. throws: IllegalArgumentException - if the specified operation doesnot produce ajava.awt.image.RenderedImage . throws: IllegalArgumentException - if the specified operation isunable to handle the sources and parameters specified inargs . A RemoteRenderedOp that represents the namedoperation to be performed remotely, or null if the specified operationis in the "immediate" mode and the rendering of thePlanarImage failed. |
createRenderable | public RemoteRenderableOp createRenderable(String opName, ParameterBlock args)(Code) | | Creates a RemoteRenderableOp that represents the named
operation to be performed remotely, using the source(s) and/or
parameter(s) specified in the ParameterBlock .
This method should only be used when the final result returned
is a single RenderableImage .
The supplied operation name is validated against the names
of the OperationDescriptor s returned from
the getServerSupportedOperationList() method.
The source(s) and/or parameter(s) in the
ParameterBlock are validated against the named
operation's descriptor, both in their numbers and types.
Additional restrictions placed on the sources and parameters
by an individual operation are also validated by calling its
OperationDescriptor.validateRenderableArguments()
method.
Parameters are allowed to have a null input
value, if that particular parameter has a default value specified
in its operation's descriptor. In this case, the default value
will replace the null input.
Unspecified tailing parameters are allowed, if these
parameters have default values specified in the operation's
descriptor. However, if a parameter, which
has a default value, is followed by one or more parameters that
have no default values, this parameter must be specified in the
ParameterBlock , even if it only has a value of
code>null.
Parameters: opName - The name of the operation. Parameters: args - The source(s) and/or parameter(s) for the operation. throws: IllegalArgumentException - if opName isnull . throws: IllegalArgumentException - if args isnull . throws: IllegalArgumentException - if noOperationDescriptor is available from the serverwith the specified operation name. throws: IllegalArgumentException - if theOperationDescriptor for the specifiedoperation name on the server does notsupport "renderable" registry mode. throws: IllegalArgumentException - if the specified operation doesnot produce ajava.awt.image.renderable.RenderableImage . throws: IllegalArgumentException - if the specified operation isunable to handle the sources and parameters specified inargs . A RemoteRenderableOp that represents the namedoperation to be performed remotely. |
getNegotiatedValues | public NegotiableCapabilitySet getNegotiatedValues() throws RemoteImagingException(Code) | | Returns the results of the negotiation between the client and server
capabilities according to the user preferences specified at an
earlier time. This will return null if the negotiation failed.
If a negotiation cycle has not been initiated prior to calling
this method, or the negotiation preferences have been
changed, this method will initiate a new negotiation cycle, which will
create and return a new set of negotiated values.
|
getNegotiatedValues | public NegotiableCapability getNegotiatedValues(String category) throws RemoteImagingException(Code) | | Returns the results of the negotiation between the client and server
capabilities according to the user preferences specified at an
earlier time for the given category. This method returns a
NegotiableCapability object, that represents the result
of the negotiation for the given category. If the negotiation failed,
null will be returned.
If a negotiation cycle has not been initiated prior to calling
this method, or the negotiation preferences have been
changed, this method will initiate a new negotiation cycle, which will
create and return a new negotiated value for the given category.
Parameters: category - The category to negotiate on. throws: IllegalArgumentException - if category is null. |
getNumRetries | public int getNumRetries()(Code) | | Returns the number of retries.
|
getOperationRegistry | public OperationRegistry getOperationRegistry()(Code) | | Returns the OperationRegistry being used by this
RemoteJAI instance.
|
getProtocolName | public String getProtocolName()(Code) | | Returns the protocol name.
|
getRenderingHints | public RenderingHints getRenderingHints()(Code) | | Returns the RenderingHints associated with this
RemoteJAI instance. These rendering hints will be
merged with any hints supplied as an argument to the
create() method.
|
getRetryInterval | public int getRetryInterval()(Code) | | Returns the amount of time between retries in milliseconds.
|
getServerCapabilities | public NegotiableCapabilitySet getServerCapabilities() throws RemoteImagingException(Code) | | Returns the set of capabilites supported by the server. If any
network related errors are encountered by this method (identified
as such by receiving a RemoteImagingException ), they
will be dealt with by the use of retries and retry intervals.
|
getServerName | public String getServerName()(Code) | | Returns a String identifying the remote server machine.
|
getServerSupportedOperationList | public OperationDescriptor[] getServerSupportedOperationList() throws RemoteImagingException(Code) | | Returns the list of OperationDescriptor s that describe
the operations supported by the server. If any
network related errors are encountered by this method (identified
as such by receiving a RemoteImagingException ), they
will be dealt with by the use of retries and retry intervals.
|
getTileCache | public TileCache getTileCache()(Code) | | Returns the TileCache being used by this
RemoteJAI instance.
|
negotiate | public static NegotiableCapabilitySet negotiate(NegotiableCapabilitySet preferences, NegotiableCapabilitySet serverCapabilities, NegotiableCapabilitySet clientCapabilities)(Code) | | This method negotiates the capabilities to be used in the remote
communication. Upon completion of the negotiation process,
this method returns a NegotiableCapabilitySet which
contains an aggregation of the NegotiableCapability
objects that represent the results of negotiation. If the negotiation
fails, null will be returned.
The negotiation process treats the serverCapabilities and the
clientCapabilities as non-preferences and will throw an
IllegalArgumentException if the
isPreference method for either of these returns
true. The preferences NegotiableCapabilitySet should
return true from its isPreference method, otherwise an
IllegalArgumentException will be thrown. The negotiation
is done in accordance with the rules described in the class comments
for NegotiableCapability .
If either the serverCapabilities or the clientCapabilities
is null, then the negotiation will fail, and null will be returned.
If preferences is null, the negotiation will become a two-way
negotiation between the two non-null
NegotiableCapabilitySet s.
Parameters: preferences - The user preferences for the negotiation. Parameters: serverCapabilities - The capabilities of the server. Parameters: clientCapabilities - The capabilities of the client. throws: IllegalArgumentException - if serverCapabilities is apreference, i.e., if it's isPreference() methodreturns true. throws: IllegalArgumentException - if clientCapabilities is apreference, i.e., if it's isPreference() methodreturns true. throws: IllegalArgumentException - if preferences is anon-preference, i.e., if it's isPreference() methodreturns false. |
negotiate | public static NegotiableCapability negotiate(NegotiableCapabilitySet preferences, NegotiableCapabilitySet serverCapabilities, NegotiableCapabilitySet clientCapabilities, String category)(Code) | | This method negotiates the capabilities to be used in the remote
communication for the given category. Upon completion of the
negotiation process, this method returns a
NegotiableCapability object, that represents the result
of the negotiation for the given category. If the negotiation fails,
null will be returned.
The negotiation process treats the serverCapabilities and the
clientCapabilities as non-preferences and will throw an
IllegalArgumentException if the
isPreference method for either of these returns
true. The preferences NegotiableCapabilitySet should
return true from its isPreference method or an
IllegalArgumentException will be thrown. The negotiation
is done in accordance with the rules described in the class comments
for NegotiableCapability .
If either the serverCapabilities or the clientCapabilities
is null, then the negotiation will fail, and null will be returned.
If preferences is null, the negotiation will become a two-way
negotiation between the two non-null
NegotiableCapabilitySet s.
Parameters: preferences - The user preferences for the negotiation. Parameters: serverCapabilities - The capabilities of the server. Parameters: clientCapabilities - The capabilities of the client. Parameters: category - The category to perform the negotiation on. throws: IllegalArgumentException - if preferences is anon-preference, i.e., if it's isPreference() methodreturns false. throws: IllegalArgumentException - if serverCapabilities is apreference, i.e., if it's isPreference() methodreturns true. throws: IllegalArgumentException - if clientCapabilities is apreference, i.e., if it's isPreference() methodreturns true. throws: IllegalArgumentException - if category is null. |
removeRenderingHint | public void removeRenderingHint(RenderingHints.Key key)(Code) | | Removes the hint value associated with a given key
in this RemoteJAI instance.
|
setNegotiationPreferences | public void setNegotiationPreferences(NegotiableCapabilitySet preferences)(Code) | | Sets the preferences to be used in the client-server
communication. These preferences are utilized in the negotiation
process. Note that preferences for more than one category can be
specified using this method since NegotiableCapabilitySet
allows different NegotiableCapability objects to be
bundled up in one NegotiableCapabilitySet class. Even
under the same category (as specified by the getCategory() method
on NegotiableCapability ), multiple
NegotiableCapability objects can be added to the
preferences. The preference added first for a particular category is
given highest priority in the negotiation process.
Since a new set of preferences is set everytime this method is
called, this method allows for changing negotiation preferences
multiple times. However it should be noted that preferences set on
this method are relevant only prior to the creation of an
operation (using the RemoteJAI.create method). To
change negotiation preferences on an operation after it has been
created, the setNegotiationPreferences() method on the
created RemoteRenderedOp should be used. The
preferences parameter will be added to the
RenderingHints of this RemoteJAI instance.
|
setNumRetries | public void setNumRetries(int numRetries)(Code) | | Sets the number of retries. The specified numRetries
parameter will be added to the common RenderingHints
of this RemoteJAI instance, under the
JAI.KEY_NUM_RETRIES key.
Parameters: numRetries - The number of retries. throws: IllegalArgumentException - if numRetries is negative. |
setOperationRegistry | public void setOperationRegistry(OperationRegistry operationRegistry)(Code) | | Sets theOperationRegistry to be used by this
RemoteJAI instance. The operationRegistry
parameter will be added to the RenderingHints of this
RemoteJAI instance.
throws: IllegalArgumentException - if operationRegistry is null. |
setRenderingHints | public void setRenderingHints(RenderingHints hints)(Code) | | Sets the RenderingHints associated with this
RemoteJAI instance. These rendering hints will be
merged with any hints supplied as an argument to the
create() method.
throws: IllegalArgumentException - if hints is null. |
setRetryInterval | public void setRetryInterval(int retryInterval)(Code) | | Sets the amount of time between retries in milliseconds. The
specified retryInterval parameter will be added
to the common RenderingHints of this
RemoteJAI instance, under the
JAI.KEY_RETRY_INTERVAL key.
Parameters: retryInterval - The time interval between retries (milliseconds). throws: IllegalArgumentException - if retryInterval is negative. |
setTileCache | public void setTileCache(TileCache tileCache)(Code) | | Sets the TileCache to be used by this
RemoteJAI . The tileCache parameter
will be added to the RenderingHints of this
RemoteJAI instance.
throws: IllegalArgumentException - if tileCache is null. |
|
|