*/
public synchronized Long handleEvent(Long renderedOpID, String propName,
Object oldValue, Object newValue)
throws RemoteException {
RenderedOp op = (RenderedOp)nodes.get(renderedOpID);
PlanarImage rendering = op.getRendering();
// Get a new unique ID
Long id = getRemoteID();
// Cache the old rendering against the new id
nodes.put(id, rendering);
// Put the op's negotiated result values for its rendering too.
setServerNegotiatedValues(id, (NegotiableCapabilitySet)
negotiated.get(renderedOpID));
// A PropertyChangeEventJAI with name "operationregistry",
// "protocolname", "protocolandservername" or "servername" should
// never be received here, since it is handled entirely on the
// client side, so we don't handle those here.
if (propName.equals("operationname")) {
op.setOperationName((String)newValue);
} else if (propName.equals("parameterblock")) {
ParameterBlock newPB = (ParameterBlock)newValue;
Vector newSrcs = newPB.getSources();
newPB.removeSources();
JAIRMIUtil.checkServerParameters(newPB, nodes);
Vector replacedSources =
JAIRMIUtil.replaceIdWithSources(newSrcs,
nodes,
op.getOperationName(),
op.getRenderingHints());
newPB.setSources(replacedSources);
op.setParameterBlock(newPB);
// Remove the newly created sinks of the srcs in the newPB
Vector newSources = newPB.getSources();
if(newSources != null && newSources.size() > 0) {
Iterator it = newSources.iterator();
while(it.hasNext()) {
Object src = it.next();
if(src instanceof PlanarImage) {
((PlanarImage)src).removeSinks();
} else if(src instanceof CollectionImage) {
((CollectionImage)src).removeSinks();
}
}
}
} else if (propName.equals("sources")) {
Vector replacedSources =
JAIRMIUtil.replaceIdWithSources((Vector)newValue,
nodes,
op.getOperationName(),
op.getRenderingHints());
op.setSources(replacedSources);
// Remove the newly created sinks for the replacedSources
if(replacedSources != null && replacedSources.size() > 0) {
Iterator it = replacedSources.iterator();
while(it.hasNext()) {
Object src = it.next();
if(src instanceof PlanarImage) {
((PlanarImage)src).removeSinks();
} else if(src instanceof CollectionImage) {
((CollectionImage)src).removeSinks();
}
}
}
} else if (propName.equals("parameters")) {
Vector parameters = (Vector)newValue;
JAIRMIUtil.checkServerParameters(parameters, nodes);
op.setParameters(parameters);
} else if (propName.equals("renderinghints")) {
SerializableState newState = (SerializableState)newValue;
op.setRenderingHints((RenderingHints)newState.getObject());
}
return id;
}