Home    |    Concepts   |   API   |   Samples
Concepts > Rasters > Basic Principles
Raster Producer/Consumer Architecture
The ArcSDE Java Raster API Producer/Consumer model is similar to the standard Java 2D API’s Producer/Consumer model.

In the standard Java 2D model, an image object relies on the ImageProducer to supply image data while the ImageConsumer consumes this image data and is responsible for displaying the image. Similarly, in the Raster Java API, the SeRasterProducer object (also called producer) uses an SeRasterAttr object and supplies raster data to SeRasterConsumer (also called consumer) object. The producer supplies raster data to the consumer in the form of Scanlines which are then transferred to ArcSDE.

The raster can be retrieved from the database by standard table query operations. These operations include creating SeQuery, preparing it, executing the query, and then fetching a single SeRow from the SeQuery.

The producer receives the data from SeRasterAttr, supplies it to SeRasterConsumer whenever required, in chunks of bytes (arrays). This data is sent to the server in the form of tiles or scanlines by the consumer (SeRasterRenderedTile and SeRasterRenderedImage), at the API level. This operation is not visible to the user/developer. Thus there is no need to create a consumer object at the user level because the API creates a SeRasterConsumer object depending on the type of data sent by the producer. Thus, this mechanism works only at the API level.

To obtain data sent to the ArcSDE server by the producer through the consumer, the user must use the usual SeQuery methods. For example, use SqlConstruct (this should have the attribute information) with SeQuery, retreive SeRow from SeQuery, SeRasterTile from SeRow and then construct a data buffer using data from SeRasterTile, and construct an image from this data buffer.

SeRasterAttr attr = RasterUtil.createRasterAttr(buffImage);

RasterProducerImpl producer = new RasterProducerImpl(attr, BufferedImageData.MASK_ALL_ON, 4 buffImage);
attr.setRasterProducer(producer);
SeRasterProducer and SeRasterCallBack classes are mutually exclusive. Therefore, if both methods are called, the one called last will take effect.
feedback | privacy | legal