Package javax.media.jai.remote

Examples of javax.media.jai.remote.RemoteImagingException


    private static void sendExceptionToListener(String message, Exception e) {
        ImagingListener listener =
            ImageUtil.getImagingListener((RenderingHints)null);
        listener.errorOccurred(message,
                               new RemoteImagingException(message, e),
                               JAIRMIImageServer.class, false);
    }
View Full Code Here


      SerializableState rhs = SerializerFactory.getState(hints, null);
      remoteImage.createRenderedOp(id, operationName, newPB, rhs);
  } catch (RemoteException e) {
            String message = JaiI18N.getString("RMIServerProxy5");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, e),
                                   this,
                                   false);
//      throw new RemoteImagingException(ImageUtil.getStackTraceString(e));
  }

  RenderedImage source;

  int size = getNumSources();
  for (int i=0; i < size; i++) {

      source = getSource(i);

      if (source instanceof RMIServerProxy) {
    try {
        RMIServerProxy rop = (RMIServerProxy)source;
        if (rop.serverName.equalsIgnoreCase(this.serverName)){
      // Send the id of the source
      remoteImage.setRenderedSource(id, rop.getRMIID(), i);
        } else {
      remoteImage.setRenderedSource(id,
                  rop.getRMIID(),
                  rop.serverName,
                  rop.operationName,
                  i);
        }
    } catch (RemoteException e) {
                    String message = JaiI18N.getString("RMIServerProxy6");
                    listener.errorOccurred(message,
                                           new RemoteImagingException(e),
                                           this, false);
//        throw new RemoteImagingException(ImageUtil.getStackTraceString(e));
    }

      } else if (source instanceof RenderedOp) {
    /// XXX This should not happen, since by the time a
    // RMIServerProxy is created, all its sources should already
    // have been rendered. In any case, the following deals
    // correctly with the situation if it should arise.

    RenderedOp rop = (RenderedOp)source;
    RenderedImage rendering = rop.getRendering();
    if (!(rendering instanceof Serializable))
        rendering = new SerializableRenderedImage(rendering);

    try {
        remoteImage.setRenderedSource(id, rendering, i);
    } catch(RemoteException e) {
                    String message = JaiI18N.getString("RMIServerProxy6");
                    listener.errorOccurred(message,
                                           new RemoteImagingException(message, e),
                                           this, false);

/*
        throw new RemoteImagingException(
              ImageUtil.getStackTraceString(e));
*/
    }
      } else if (source instanceof RenderedImage) {
    try {
        if (source instanceof Serializable) {
      remoteImage.setRenderedSource(id, source, i);
        } else {
      remoteImage.setRenderedSource(
               id,
               new SerializableRenderedImage(source),
               i);
        }

    } catch(RemoteException e) {
                    String message = JaiI18N.getString("RMIServerProxy6");
                    listener.errorOccurred(message,
                                           new RemoteImagingException(message, e),
                                           this, false);
/*
        throw new RemoteImagingException(
               ImageUtil.getStackTraceString(e));
*/
 
View Full Code Here

              shapeState,
              oldSrc);
      } catch (RemoteException re) {
                String message = JaiI18N.getString("RMIServerProxy7");
                listener.errorOccurred(message,
                                       new RemoteImagingException(message, re),
                                       this, false);

//    throw new RemoteImagingException(ImageUtil.getStackTraceString(re));
      }

      oldRMISP.id = oldRenderingID;
      this.id = opID;

  } else {

      // Changes to operationName, operationRegistry, protocolName
      // and protocolAndServerName should never be sent to this
      // constructor and thus don't need to be handled here.

      // Changes to serverName should be sent only to the previous
      // constructor and thus do not need to be handled here.

      Object oldValue = null, newValue = null;

      if (propName.equals("operationname")) {

    oldValue = event.getOldValue();
    newValue = event.getNewValue();

      } else if (propName.equals("parameterblock")) {

    ParameterBlock oldPB = (ParameterBlock)event.getOldValue();
    Vector oldSrcs = oldPB.getSources();
    oldPB.removeSources();

    ParameterBlock newPB = (ParameterBlock)event.getNewValue();
    Vector newSrcs = newPB.getSources();
    newPB.removeSources();

    // XXX Check serverName is correct thing to pass
    JAIRMIUtil.checkClientParameters(oldPB, serverName);
    JAIRMIUtil.checkClientParameters(newPB, serverName);

    oldPB.setSources(JAIRMIUtil.replaceSourcesWithId(oldSrcs,
                 serverName));
    newPB.setSources(JAIRMIUtil.replaceSourcesWithId(newSrcs,
                 serverName));

    oldValue = oldPB;
    newValue = newPB;

      } else if (propName.equals("sources")) {

    Vector oldSrcs = (Vector)event.getOldValue();
    Vector newSrcs = (Vector)event.getNewValue();

    oldValue = JAIRMIUtil.replaceSourcesWithId(oldSrcs,
                 serverName);
    newValue = JAIRMIUtil.replaceSourcesWithId(newSrcs,
                 serverName);

      } else if (propName.equals("parameters")) {

    Vector oldParameters = (Vector)event.getOldValue();
    Vector newParameters = (Vector)event.getNewValue();

    // XXX Check serverName is correct thing to pass
    JAIRMIUtil.checkClientParameters(oldParameters, serverName);
    JAIRMIUtil.checkClientParameters(newParameters, serverName);

    oldValue = oldParameters;
    newValue = newParameters;

      } else if (propName.equals("renderinghints")) {

    RenderingHints oldRH = (RenderingHints)event.getOldValue();
    RenderingHints newRH = (RenderingHints)event.getNewValue();

    oldValue = SerializerFactory.getState(oldRH, null);
    newValue = SerializerFactory.getState(newRH, null);
      } else {
    throw new RemoteImagingException(
           JaiI18N.getString("RMIServerProxy4"));
      }

      Long oldRenderingID = null;

      try {
    oldRenderingID = remoteImage.handleEvent(opID,
               propName,
               oldValue,
               newValue);
    // Increment the reference count for this id on the server
    remoteImage.incrementRefCount(oldRenderingID);
      } catch (RemoteException re) {
                String message = JaiI18N.getString("RMIServerProxy7");
                listener.errorOccurred(message,
                                       new RemoteImagingException(message, re),
                                       this, false);
//    throw new RemoteImagingException(ImageUtil.getStackTraceString(re));
      }

      oldRMISP.id = oldRenderingID;
View Full Code Here

  try {
      remoteImage.createRenderableOp(id, operationName, newPB);
  } catch(RemoteException e) {
            String message = JaiI18N.getString("RMIServerProxy8");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, e),
                                   this, false);
//      throw new RemoteImagingException(ImageUtil.getStackTraceString(e));
  }

  Object source;
  int size = getNumSources();

  for (int i=0; i < size; i++) {

      Vector sources = paramBlock.getSources();
      source =  sources.elementAt(i);

      if (source instanceof RMIServerProxy) {
    try {
        RMIServerProxy rop = (RMIServerProxy)source;
        // Send the id of the source
        if ((rop.serverName).equals(this.serverName)){
      remoteImage.setRenderableSource(id, rop.getRMIID(), i);
        } else {
      remoteImage.setRenderableSource(id, rop.getRMIID(),
              rop.serverName,
              rop.operationName, i);
        }
    } catch (RemoteException e) {
                    String message = JaiI18N.getString("RMIServerProxy6");
                    listener.errorOccurred(message,
                                       new RemoteImagingException(message, e),
                                       this, false);
/*
        throw new RemoteImagingException(
                   ImageUtil.getStackTraceString(e));
*/
    }
      } else
    if (source instanceof RenderableOp) {
        try {
      remoteImage.setRenderableSource(id,
              (RenderableOp)source,
              i);
        } catch(RemoteException e) {
                        String message = JaiI18N.getString("RMIServerProxy6");
                        listener.errorOccurred(message,
                                       new RemoteImagingException(message, e),
                                       this, false);
/*
      throw new RemoteImagingException(
              ImageUtil.getStackTraceString(e));
*/
        }
    }
    else if (source instanceof RenderedImage) {
        try {
      remoteImage.setRenderableSource(
        id,
        new SerializableRenderedImage((RenderedImage)source),
        i);

        } catch(RemoteException e) {
                        String message = JaiI18N.getString("RMIServerProxy6");
                        listener.errorOccurred(message,
                                       new RemoteImagingException(message, e),
                                       this, false);
/*
      throw new RemoteImagingException(
              ImageUtil.getStackTraceString(e));
*/
        }
    }
  }

  try {
      // Increment the reference count for this id on the server
      remoteImage.incrementRefCount(id);
  } catch (RemoteException e) {
            String message = JaiI18N.getString("RMIServerProxy9");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, e),
                                   this, false);
//      throw new RemoteImagingException(ImageUtil.getStackTraceString(e));
  }

  // If this was a call for Rendering of this RenderableOp
  // then render it and store the associated id in
  // renderingID and then RMICRIF will return a new RMISP with reference
  // to that rendering ID
  // This will not be executed at the time of calls to getBounds2D and
  // mapRenderContext

  if (isRender){
      try {
    renderingID =
        remoteImage.getRendering(id,
               SerializerFactory.getState(rc,
                  null));
    // Increment the reference count for this id on the server
    remoteImage.incrementRefCount(renderingID);
      } catch (RemoteException e) {
                String message = JaiI18N.getString("RMIServerProxy10");
                listener.errorOccurred(message,
                                       new RemoteImagingException(message, e),
                                       this, false);
//    throw new RemoteImagingException(ImageUtil.getStackTraceString(e));
      }
  }
    }
View Full Code Here

    try {
        serverName = InetAddress.getLocalHost().getHostAddress();
    } catch(Exception e) {
                    String message = JaiI18N.getString("RMIServerProxy11");
                    listener.errorOccurred(message,
                                           new RemoteImagingException(message, e),
                                           this, false);
//        throw new RemoteImagingException(ImageUtil.getStackTraceString(e));
    }
            }

      // Derive the service name.
      String serviceName =
    new String("rmi://"+serverName+"/"+
         JAIRMIDescriptor.IMAGE_SERVER_BIND_NAME);

      // Look up the remote object.
      remoteImage = null;
      try {
    remoteImage = (ImageServer)Naming.lookup(serviceName);
      } catch(Exception e) {
                String message = JaiI18N.getString("RMIServerProxy12");
                listener.errorOccurred(message,
                                       new RemoteImagingException(message, e),
                                       this, false);
//    throw new RemoteImagingException(ImageUtil.getStackTraceString(e));
      }
  }
View Full Code Here

      id = remoteImage.getRemoteID();
      return id;
  } catch(Exception e) {
            String message = JaiI18N.getString("RMIServerProxy13");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, e),
                                   this, false);
//      throw new RemoteImagingException(ImageUtil.getStackTraceString(e));
  }

        return id;
View Full Code Here

  try {
      cbr =  remoteImage.getRendering(getRMIID());
  } catch (RemoteException re){
            String message = JaiI18N.getString("RMIServerProxy10");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, re),
                                   this, false);
//      throw new RemoteImagingException(ImageUtil.getStackTraceString(re));
  }

  return cbr;
View Full Code Here

      layout.setColorModel((ColorModel)(cmState.getObject()));
            return layout;
  } catch (RemoteException re) {
            String message = JaiI18N.getString("RMIServerProxy14");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, re),
                                   this, false);
            return null;
//      throw new RemoteImagingException(ImageUtil.getStackTraceString(re));
  }
    }
View Full Code Here

        TileDecoderFactory.class.isAssignableFrom(factory)) {

        try {
      tdf = (TileDecoderFactory)factory.newInstance();
        } catch (InstantiationException ie) {
      throw new RemoteImagingException(ImageUtil.getStackTraceString(ie));
        } catch (IllegalAccessException iae) {
      throw new RemoteImagingException(ImageUtil.getStackTraceString(iae));
        }
    }
      }

      if (tdf == null) {
    throw new RemoteImagingException(
             JaiI18N.getString("RMIServerProxy0"));
      }

      TileCodecDescriptor tcd =
    (TileCodecDescriptor)registry.getDescriptor("tileDecoder",
                  capabilityName);

      if (tcd.includesSampleModelInfo() == false ||
    tcd.includesLocationInfo() == false) {
    throw new RemoteImagingException(
             JaiI18N.getString("RMIServerProxy1"));
      }

      ParameterListDescriptor pld =
    tcd.getParameterListDescriptor("tileDecoder");

      tcpl = new TileCodecParameterList(capabilityName,
                new String[] {"tileDecoder"},
                pld);

      // Set parameters on TileCodecParameterList only if there are any
      // parameters defined.
      if (pld != null) {

    String paramNames[] = pld.getParamNames();
    String currParam;
    Object currValue;
    if (paramNames != null) {
        for (int i=0; i<paramNames.length; i++) {
      currParam = paramNames[i];
      try {
          currValue = codecCap.getNegotiatedValue(currParam);
      } catch (IllegalArgumentException iae) {
          // If this parameter is not defined on the
          // NegotiableCapability, then move onto the next
          continue;
      }

      tcpl.setParameter(currParam, currValue);
        }
    }
      }
  }

  try {
      // If a compression hint was set, use it
      if (codecCap != null) {
    byte ctile[] = remoteImage.getCompressedTile(id,
                   tileX,
                   tileY);
    ByteArrayInputStream stream = new ByteArrayInputStream(ctile);
    TileDecoder decoder = tdf.createDecoder(stream, tcpl);
    try {
        return decoder.decode();
    } catch (java.io.IOException ioe) {
        throw new RemoteImagingException(ImageUtil.getStackTraceString(ioe));
    }
      } else {
    // Ask for uncompressed tiles.
    SerializableState rp = remoteImage.getTile(id, tileX, tileY);
    return (Raster)(rp.getObject());
      }
  } catch (RemoteException e) {
            String message = JaiI18N.getString("RMIServerProxy15");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, e),
                                   this, false);
//      throw new RemoteImagingException(ImageUtil.getStackTraceString(e));
  }

        return null;
View Full Code Here

      }
      return property;
  } catch (RemoteException re) {
            String message = JaiI18N.getString("RMIServerProxy16");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, re),
                                   this, false);
//      throw new RemoteImagingException(ImageUtil.getStackTraceString(re));
  }

        return Image.UndefinedProperty;
View Full Code Here

TOP

Related Classes of javax.media.jai.remote.RemoteImagingException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.