| java.rmi.server.UnicastRemoteObject com.sun.media.jai.rmi.JAIRMIImageServer
JAIRMIImageServer | public class JAIRMIImageServer extends UnicastRemoteObject implements ImageServer(Code) | | The server-side implementation of the ImageServer interface. A
JAIRMIImageServer has a RenderedImage source, acquired via one of three
setSource() methods. The first takes a RenderedImage directly as
its parameter; this image is simply copied over the network using
the normal RMI mechanisms. Note that not every image can be
transferred in this way -- for example, attempting to pass an
OpImage that uses native code or that depends on the availability
of a class not resident on the server as a parameter will cause an
exception to be thrown.
The second and third ways of setting sources make use of the
RenderedOp and RenderableOp classes to send a high-level
description of an image chain based on operation names. This
chain will be copied over to the server using RMI, where it will be
expanded into an OpImage chain using the server's registry. This
is the preferred method since it requires less data transfer and
offers a better chance of success. It may still fail if the
sources or parameters of any operation in the chain are not
serializable.
RMI requires all remote methods to declare `throws
RemoteException' in their signatures. It is up to the client to
deal with errors. A simple implementation of error handling may be
found in the RemoteRenderedImage class.
This class contains a main() method that should be run on the
server after starting the RMI registry. The registry will then
construct new instances of JAIRMIImageServer on demand.
See Also: ImageServer See Also: RenderedOp since: 1.1 |
Constructor Summary | |
public | JAIRMIImageServer(int serverport) Constructs a JAIRMIImageServer with a source to be specified
later. |
Method Summary | |
public SerializableState | copyData(Long id, Rectangle bounds) Returns the same result as getData(Rectangle) would for the
same rectangular region. | public RenderedImage | createDefaultRendering(Long id) Returnd a RenderedImage instance of this image with a default
width and height in pixels. | public synchronized void | createRenderableOp(Long id, String opName, ParameterBlock pb) Creates a RenderableOp on the server side with a parameter block
empty of sources. | public void | createRenderedOp(Long id, String opName, ParameterBlock pb, SerializableState hints) Creates a RenderedOp on the server side with a parameter block
empty of sources. | public RenderedImage | createRendering(Long id, SerializableState renderContextState) Creates a RenderedImage that represented a rendering of this image
using a given RenderContext. | public RenderedImage | createScaledRendering(Long id, int w, int h, SerializableState hintsState) Creates a RenderedImage instance of this image with width w, and
height h in pixels. | public synchronized void | dispose(Long id) Disposes of any resouces allocated to the client object with
the specified ID. | public Rectangle | getBounds(Long id) Returns a Rectangle indicating the image bounds. | public SerializableState | getBounds2D(Long nodeId, String operationName) | public SerializableState | getColorModel(Long id) Returns the ColorModel associated with this image. | public byte[] | getCompressedTile(Long id, int x, int y) Compresses tile (x, y) and returns the compressed tile's contents
as a byte array. | public SerializableState | getData(Long id) Returns the entire image as a single Raster. | public SerializableState | getData(Long id, Rectangle bounds) Returns an arbitrary rectangular region of the RenderedImage
in a Raster. | public int | getHeight(Long id) Returns the height of the ImageServer. | public synchronized SerializableState | getInvalidRegion(Long id, ParameterBlock oldParamBlock, SerializableState oldRHints, ParameterBlock newParamBlock, SerializableState newRHints) Calculates the region over which two distinct renderings
of an operation may be expected to differ.
The class of the returned object will vary as a function of
the nature of the operation. | public int | getMaxTileX(Long id) Returns the index of the rightmost column of tiles. | public int | getMaxTileY(Long id) Returns the index of the bottom row of tiles. | public int | getMaxX(Long id) Returns the smallest X coordinate to the right of the ImageServer. | public int | getMaxY(Long id) Returns the smallest Y coordinate below the ImageServer. | public int | getMinTileX(Long id) Returns the index of the leftmost column of tiles. | public int | getMinTileY(Long id) Returns the index of the uppermost row of tiles. | public int | getMinX(Long id) Returns the minimum X coordinate of the ImageServer. | public int | getMinY(Long id) Returns the minimum Y coordinate of the ImageServer. | public RenderedOp | getNode(Long id) | public int | getNumXTiles(Long id) Returns the number of tiles along the tile grid in the horizontal
direction. | public int | getNumYTiles(Long id) Returns the number of tiles along the tile grid in the vertical
direction. | public List | getOperationDescriptors() Gets the OperationDescriptor s of the operations
supported on this server. | public Object | getProperty(Long id, String name) Gets a property from the property set of this image. | public String[] | getPropertyNames(Long id) Returns a list of names recognized by getProperty(). | public String[] | getPropertyNames(String opName) Returns a list of names recognized by getProperty(). | public synchronized Long | getRemoteID() Returns the identifier of the remote image. | public float | getRenderableHeight(Long id) Gets the height (in user coordinate space) of the
RenderableImage stored against the given ID. | public float | getRenderableMinX(Long id) Gets the minimum X coordinate of the rendering-independent image
stored against the given ID. | public float | getRenderableMinY(Long id) Gets the minimum Y coordinate of the rendering-independent image
stored against the given ID. | public float | getRenderableWidth(Long id) Gets the width (in user coordinate space) of the
RenderableImage stored against the given ID. | public boolean | getRendering(Long id) | public synchronized Long | getRendering(Long id, SerializableState rcs) | public SerializableState | getSampleModel(Long id) Returns the SampleModel associated with this image. | public synchronized NegotiableCapabilitySet | getServerCapabilities() Returns the server's capabilities. | public String[] | getServerSupportedOperationNames() | public SerializableState | getTile(Long id, int tileX, int tileY) Returns tile (x, y). | public int | getTileGridXOffset(Long id) Returns the X coordinate of the upper-left pixel of tile (0, 0). | public int | getTileGridYOffset(Long id) Returns the Y coordinate of the upper-left pixel of tile (0, 0). | public int | getTileHeight(Long id) Returns the height of a tile in pixels. | public int | getTileWidth(Long id) Returns the width of a tile in pixels. | public int | getWidth(Long id) Returns the width of the ImageServer. | public synchronized Long | handleEvent(Long renderedOpID, String propName, Object oldValue, Object newValue) A method that handles the given event. | public synchronized Long | handleEvent(Long renderedOpID, int srcIndex, SerializableState srcInvalidRegion, Object oldRendering) A method that handles a change in one of it's source's rendering,
i.e. | public void | incrementRefCount(Long id) Increments the reference count for this id, i.e. | public boolean | isDynamic(String opName) | public boolean | isDynamic(Long id) Returns true if successive renderings with the same
arguments may produce different results for the node represented
by the given id. | public static void | main(String[] args) Starts a server on a given port. | public Rectangle | mapDestRect(Long id, Rectangle destRect, int sourceIndex) Returns a conservative estimate of the region of a specified
source that is required in order to compute the pixels of a
given destination rectangle.
Parameters: id - A Long identifying the node for whomthe source region needs to be calculated . Parameters: destRect - The Rectangle in destination coordinates. Parameters: sourceIndex - The index of the source image. | public SerializableState | mapRenderContext(int id, Long nodeId, String operationName, SerializableState rcs) | public Rectangle | mapSourceRect(Long id, Rectangle sourceRect, int sourceIndex) Returns a conservative estimate of the destination region that
can potentially be affected by the pixels of a rectangle of a
given source.
Parameters: id - A Long identifying the node for whomthe destination region needs to be calculated . Parameters: sourceRect - The Rectangle in source coordinates. Parameters: sourceIndex - The index of the source image. | public synchronized void | setRenderableRMIServerProxyAsSource(Long id, Long sourceId, String serverName, String opName, int index) | public synchronized void | setRenderableSource(Long id, Long sourceId, int index) | public synchronized void | setRenderableSource(Long id, Long sourceId, String serverName, String opName, int index) | public synchronized void | setRenderableSource(Long id, RenderableOp source, int index) when source is set to a RenderableOp and isnt supposed to be
rendered yet. | public synchronized void | setRenderableSource(Long id, SerializableRenderableImage s, int index) | public synchronized void | setRenderableSource(Long id, RenderedImage source, int index) | public synchronized void | setRenderedSource(Long id, RenderedImage source, int index) | public synchronized void | setRenderedSource(Long id, RenderedOp source, int index) | public synchronized void | setRenderedSource(Long id, Long sourceId, int index) | public synchronized void | setRenderedSource(Long id, Long sourceId, String serverName, String opName, int index) | public void | setServerNegotiatedValues(Long id, NegotiableCapabilitySet negotiatedValues) Informs the server of the negotiated values that are the result of
a successful negotiation. |
NULL_PROPERTY | final public static Object NULL_PROPERTY(Code) | | Tag to represent a null property.
|
JAIRMIImageServer | public JAIRMIImageServer(int serverport) throws RemoteException(Code) | | Constructs a JAIRMIImageServer with a source to be specified
later.
|
createDefaultRendering | public RenderedImage createDefaultRendering(Long id) throws RemoteException(Code) | | Returnd a RenderedImage instance of this image with a default
width and height in pixels. The RenderContext is built
automatically with an appropriate usr2dev transform and an area
of interest of the full image. The rendering hints are
empty. createDefaultRendering may make use of a stored
rendering for speed.
a RenderedImage containing the rendered data. |
createRenderableOp | public synchronized void createRenderableOp(Long id, String opName, ParameterBlock pb) throws RemoteException(Code) | | Creates a RenderableOp on the server side with a parameter block
empty of sources. The sources are set by separate calls depending
upon the type and serializabilty of the source.
|
createRenderedOp | public void createRenderedOp(Long id, String opName, ParameterBlock pb, SerializableState hints) throws RemoteException(Code) | | Creates a RenderedOp on the server side with a parameter block
empty of sources. The sources are set by separate calls depending
upon the type and serializabilty of the source.
|
createRendering | public RenderedImage createRendering(Long id, SerializableState renderContextState) throws RemoteException(Code) | | Creates a RenderedImage that represented a rendering of this image
using a given RenderContext. This is the most general way to obtain a
rendering of a RenderableImage.
The created RenderedImage may have a property identified
by the String HINTS_OBSERVED to indicate which RenderingHints
(from the RenderContext) were used to create the image.
In addition any RenderedImages
that are obtained via the getSources() method on the created
RenderedImage may have such a property.
Parameters: renderContext - the RenderContext to use to produce the rendering. a RenderedImage containing the rendered data. |
createScaledRendering | public RenderedImage createScaledRendering(Long id, int w, int h, SerializableState hintsState) throws RemoteException(Code) | | Creates a RenderedImage instance of this image with width w, and
height h in pixels. The RenderContext is built automatically
with an appropriate usr2dev transform and an area of interest
of the full image. All the rendering hints come from hints
passed in.
If w == 0, it will be taken to equal
Math.round(h*(getWidth()/getHeight())).
Similarly, if h == 0, it will be taken to equal
Math.round(w*(getHeight()/getWidth())). One of
w or h must be non-zero or else an IllegalArgumentException
will be thrown.
The created RenderedImage may have a property identified
by the String HINTS_OBSERVED to indicate which RenderingHints
were used to create the image. In addition any RenderedImages
that are obtained via the getSources() method on the created
RenderedImage may have such a property.
Parameters: w - the width of rendered image in pixels, or 0. Parameters: h - the height of rendered image in pixels, or 0. Parameters: hints - a RenderingHints object containg hints. a RenderedImage containing the rendered data. |
dispose | public synchronized void dispose(Long id) throws RemoteException(Code) | | Disposes of any resouces allocated to the client object with
the specified ID.
|
getCompressedTile | public byte[] getCompressedTile(Long id, int x, int y) throws RemoteException(Code) | | Compresses tile (x, y) and returns the compressed tile's contents
as a byte array. Note that x and y are indices into the
tile array, not pixel locations. Unlike in the true RenderedImage
interface, the Raster that is returned should be considered a copy.
Parameters: id - An ID for the source which must be unique across all clients. Parameters: x - the x index of the requested tile in the tile array Parameters: y - the y index of the requested tile in the tile array a byte array containing the compressed tile contents. |
getData | public SerializableState getData(Long id, Rectangle bounds) throws RemoteException(Code) | | Returns an arbitrary rectangular region of the RenderedImage
in a Raster. The rectangle of interest will be clipped against
the image bounds.
Parameters: id - An ID for the source which must be unique across all clients. Parameters: rect - the region of the RenderedImage to be returned. a SerializableState containing a copy of the desired data. |
getInvalidRegion | public synchronized SerializableState getInvalidRegion(Long id, ParameterBlock oldParamBlock, SerializableState oldRHints, ParameterBlock newParamBlock, SerializableState newRHints) throws RemoteException(Code) | | Calculates the region over which two distinct renderings
of an operation may be expected to differ.
The class of the returned object will vary as a function of
the nature of the operation. For rendered and renderable two-
dimensional images this should be an instance of a class which
implements java.awt.Shape .
The region over which the data of two renderings of thisoperation may be expected to be invalid or null if there is no common region of validity. |
getMaxX | public int getMaxX(Long id) throws RemoteException(Code) | | Returns the smallest X coordinate to the right of the ImageServer.
|
getNumXTiles | public int getNumXTiles(Long id) throws RemoteException(Code) | | Returns the number of tiles along the tile grid in the horizontal
direction.
|
getNumYTiles | public int getNumYTiles(Long id) throws RemoteException(Code) | | Returns the number of tiles along the tile grid in the vertical
direction.
|
getOperationDescriptors | public List getOperationDescriptors() throws RemoteException(Code) | | Gets the OperationDescriptor s of the operations
supported on this server.
|
getProperty | public Object getProperty(Long id, String name) throws RemoteException(Code) | | Gets a property from the property set of this image. If the
property is undefined the constant NULL_PROPERTY is returned.
|
getPropertyNames | public String[] getPropertyNames(Long id) throws RemoteException(Code) | | Returns a list of names recognized by getProperty().
an array of Strings representing property names. |
getPropertyNames | public String[] getPropertyNames(String opName) throws RemoteException(Code) | | Returns a list of names recognized by getProperty().
an array of Strings representing property names. |
getRemoteID | public synchronized Long getRemoteID() throws RemoteException(Code) | | Returns the identifier of the remote image. This method should be
called to return an identifier before any other methods are invoked.
The same ID must be used in all subsequent references to the remote
image.
|
getRenderableHeight | public float getRenderableHeight(Long id) throws RemoteException(Code) | | Gets the height (in user coordinate space) of the
RenderableImage stored against the given ID.
the height of the renderable image in user coordinates. |
getRenderableMinX | public float getRenderableMinX(Long id) throws RemoteException(Code) | | Gets the minimum X coordinate of the rendering-independent image
stored against the given ID.
the minimum X coordinate of the rendering-independent imagedata. |
getRenderableMinY | public float getRenderableMinY(Long id) throws RemoteException(Code) | | Gets the minimum Y coordinate of the rendering-independent image
stored against the given ID.
the minimum X coordinate of the rendering-independent imagedata. |
getRenderableWidth | public float getRenderableWidth(Long id) throws RemoteException(Code) | | Gets the width (in user coordinate space) of the
RenderableImage stored against the given ID.
the width of the renderable image in user coordinates. |
getRendering | public boolean getRendering(Long id) throws RemoteException(Code) | | Calls for Rendering of the Op and returns true if the RenderedOp
could be rendered else false
|
getServerCapabilities | public synchronized NegotiableCapabilitySet getServerCapabilities()(Code) | | Returns the server's capabilities. Currently the only capabilities
that are reported are those dealing with TileCodecs.
|
getServerSupportedOperationNames | public String[] getServerSupportedOperationNames() throws RemoteException(Code) | | Gets the operation names supported on the Server
|
getTile | public SerializableState getTile(Long id, int tileX, int tileY) throws RemoteException(Code) | | Returns tile (x, y). Note that x and y are indices into the
tile array, not pixel locations. Unlike in the true RenderedImage
interface, the Raster that is returned should be considered a copy.
Parameters: id - An ID for the source which must be unique across all clients. Parameters: tileX - the X index of the requested tile in the tile array. Parameters: tileY - the Y index of the requested tile in the tile array. the tile as a Raster. |
getTileGridXOffset | public int getTileGridXOffset(Long id) throws RemoteException(Code) | | Returns the X coordinate of the upper-left pixel of tile (0, 0).
|
getTileGridYOffset | public int getTileGridYOffset(Long id) throws RemoteException(Code) | | Returns the Y coordinate of the upper-left pixel of tile (0, 0).
|
handleEvent | public synchronized Long handleEvent(Long renderedOpID, int srcIndex, SerializableState srcInvalidRegion, Object oldRendering) throws RemoteException(Code) | | A method that handles a change in one of it's source's rendering,
i.e. a change that would be signalled by RenderingChangeEvent.
|
incrementRefCount | public void incrementRefCount(Long id) throws RemoteException(Code) | | Increments the reference count for this id, i.e. increments the
number of RMIServerProxy objects that currently reference this id.
|
isDynamic | public boolean isDynamic(String opName) throws RemoteException(Code) | | Returns true if successive renderings with the same
arguments may produce different results for this opName
false indicating that the rendering is static. |
isDynamic | public boolean isDynamic(Long id) throws RemoteException(Code) | | Returns true if successive renderings with the same
arguments may produce different results for the node represented
by the given id.
|
main | public static void main(String[] args)(Code) | | Starts a server on a given port. The RMI registry must be running
on the server host.
The usage of this class is
java -Djava.rmi.server.codebase=file:$JAI/lib/jai.jar \
-Djava.rmi.server.useCodebaseOnly=false \
-Djava.security.policy=\
file:`pwd`/policy com.sun.media.jai.rmi.JAIRMIImageServer \
[-host hostName] [-port portNumber]
The default host is the local host and the default port is 1099.
Parameters: args - the port number as a command-line argument. |
mapDestRect | public Rectangle mapDestRect(Long id, Rectangle destRect, int sourceIndex) throws RemoteException(Code) | | Returns a conservative estimate of the region of a specified
source that is required in order to compute the pixels of a
given destination rectangle.
Parameters: id - A Long identifying the node for whomthe source region needs to be calculated . Parameters: destRect - The Rectangle in destination coordinates. Parameters: sourceIndex - The index of the source image. A Rectangle indicating the required source region. |
mapSourceRect | public Rectangle mapSourceRect(Long id, Rectangle sourceRect, int sourceIndex) throws RemoteException(Code) | | Returns a conservative estimate of the destination region that
can potentially be affected by the pixels of a rectangle of a
given source.
Parameters: id - A Long identifying the node for whomthe destination region needs to be calculated . Parameters: sourceRect - The Rectangle in source coordinates. Parameters: sourceIndex - The index of the source image. A Rectangle indicating the potentiallyaffected destination region, or null ifthe region is unknown. |
setRenderableRMIServerProxyAsSource | public synchronized void setRenderableRMIServerProxyAsSource(Long id, Long sourceId, String serverName, String opName, int index) throws RemoteException(Code) | | Sets the source of the image which is on a different
server
|
setRenderableSource | public synchronized void setRenderableSource(Long id, Long sourceId, int index) throws RemoteException(Code) | | Sets the source of the image which is on the same
server
|
setRenderableSource | public synchronized void setRenderableSource(Long id, Long sourceId, String serverName, String opName, int index) throws RemoteException(Code) | | Sets the source of the image which is on a different
server
|
setRenderableSource | public synchronized void setRenderableSource(Long id, RenderableOp source, int index) throws RemoteException(Code) | | when source is set to a RenderableOp and isnt supposed to be
rendered yet. like at the time of getBounds2D
Sets the source of the image as a RenderableOp on the server side
|
setRenderableSource | public synchronized void setRenderableSource(Long id, RenderedImage source, int index) throws RemoteException(Code) | | Sets the source of the image as a RenderedImage on the server side
|
setRenderedSource | public synchronized void setRenderedSource(Long id, RenderedImage source, int index) throws RemoteException(Code) | | Sets the source of the image as a RenderedImage on the server side
|
setRenderedSource | public synchronized void setRenderedSource(Long id, RenderedOp source, int index) throws RemoteException(Code) | | Sets the source of the image as a RenderedOp on the server side
|
setRenderedSource | public synchronized void setRenderedSource(Long id, Long sourceId, int index) throws RemoteException(Code) | | Sets the source of the image which is on the same
server
|
setRenderedSource | public synchronized void setRenderedSource(Long id, Long sourceId, String serverName, String opName, int index) throws RemoteException(Code) | | Sets the source of the image which is on a different
server
|
setServerNegotiatedValues | public void setServerNegotiatedValues(Long id, NegotiableCapabilitySet negotiatedValues) throws RemoteException(Code) | | Informs the server of the negotiated values that are the result of
a successful negotiation.
Parameters: negotiatedValues - The result of the negotiation. |
|
|