Package com.lightcrafts.mediax.jai.remote

Examples of com.lightcrafts.mediax.jai.remote.RemoteImagingException


  try {
      return imageServer.createRendering(id, ss);
  } catch (RemoteException re) {
            String message = JaiI18N.getString("RMIServerProxy10");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, re),
                                   this, false);
//      throw new RemoteImagingException(ImageUtil.getStackTraceString(re));
  }
        return null;
    }
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.
      imageServer = null;
      try {
    imageServer = (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

      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

   try {
      return rmisp.getProperty(name);
  } catch(Exception e) {
            String message = JaiI18N.getString("JAIRMICRIF7");
            sendExceptionToListener(null, message,
                                    new RemoteImagingException(message, e));
//      throw new RemoteImagingException(ImageUtil.getStackTraceString(e));
  }
        return null;
    }
View Full Code Here

TOP

Related Classes of com.lightcrafts.mediax.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.