Package com.lightcrafts.mediax.jai.remote

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


      return remoteImage.getPropertyNames(operationName);
  } catch (RemoteException e){
      // Should we be catching Exception or RemoteException
            String message = JaiI18N.getString("JAIRMICRIF8");
            sendExceptionToListener(null, message,
                                    new RemoteImagingException(message, e));
//      throw new RemoteImagingException(ImageUtil.getStackTraceString(e));
  }
        return null;
    }
View Full Code Here


      try {
    serverName = InetAddress.getLocalHost().getHostAddress();
      } catch(java.net.UnknownHostException e) {
                String message = JaiI18N.getString("RMIServerProxy11");
                sendExceptionToListener(null, message,
                                        new RemoteImagingException(message, e));
//    throw new RuntimeException(e.getMessage());
      }
  }

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

  // Look up the remote object.
  try {
      return (ImageServer)Naming.lookup(serviceName);
  } catch(java.rmi.NotBoundException e) {
            String message = JaiI18N.getString("RMIServerProxy12");
            sendExceptionToListener(null, message,
                                    new RemoteImagingException(message, e));
//      throw new RemoteImagingException(ImageUtil.getStackTraceString(e));
  } catch (java.net.MalformedURLException e) {
            String message = JaiI18N.getString("RMIServerProxy12");
            sendExceptionToListener(null, message,
                                    new RemoteImagingException(message, e));
        } catch (java.rmi.RemoteException e) {
            String message = JaiI18N.getString("RMIServerProxy12");
            sendExceptionToListener(null, message,
                                    new RemoteImagingException(message, e));
        }

        return null;
    }
View Full Code Here

  try {
      return remoteImage.isDynamic(operationName);
  } catch (RemoteException e){
            String message = JaiI18N.getString("JAIRMICRIF9");
            sendExceptionToListener(null, message,
                                    new RemoteImagingException(message, e));
//      throw new RemoteImagingException(ImageUtil.getStackTraceString(e));
  }
        return true;
    }
View Full Code Here

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

  // Now look at the sources of the RenderableOp
  if (sources != null) {

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

    Object source = sources.elementAt(i);

    if (source instanceof RemoteRenderedOp) {

        // If source is a RenderedOp on a remote machine, create
        // it on the remote machine.
        RMIServerProxy rmisp =
    (RMIServerProxy)(((RemoteRenderedOp)source).getRendering());

        try {
      if (rmisp.getServerName().equalsIgnoreCase(
              rop.getServerName())) {

          // Both the RenderableOp and this source are on
          // the same server.
          remoteImage.setRenderedSource(opID,
                rmisp.getRMIID(),
                i);
          newPB.setSource(rmisp, i);
      } else {

          // The RenderableOp and this source are on
          // different servers.
          remoteImage.setRenderedSource(
               opID,
               rmisp.getRMIID(),
               rmisp.getServerName(),
               rmisp.getOperationName(),
               i);
          newPB.setSource(rmisp, 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 RenderedOp) {

        // If the source is a local RenderedOp, then the only way
        // to access it from a remote machine is to render it and
        // create a SerializableRenderedImage wrapping the
        // rendering, which is set as the source of the remote op.
        RenderedImage ri = ((RenderedOp)source).getRendering();
        try {
      SerializableRenderedImage sri =
          new SerializableRenderedImage(ri);
      remoteImage.setRenderedSource(opID, sri, i);
      newPB.setSource(sri, 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) {

        // If the source is a local RenderedImage, then the only
        // way to access it from a remote machine is by wrapping
        // it in SerializableRenderedImage and then setting the
        // SRI as the source.
        RenderedImage ri = (RenderedImage)source;
        try {
      SerializableRenderedImage sri =
          new SerializableRenderedImage(ri);
      remoteImage.setRenderedSource(opID, sri, i);
      newPB.setSource(sri, 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 RemoteRenderableOp) {

        // If the source is a RenderableOp on a remote machine,
        // cause the RenderableOp to be created on the remote
        // machine.
        RenderableRMIServerProxy rrmisp =
      createProxy((RemoteRenderableOp)source);

        try {

      // If the source RenderableOp is on the same server
      // as the RenderableOp that represents the operation
      if (rrmisp.getServerName().equalsIgnoreCase(
              rop.getServerName())) {
          remoteImage.setRenderableSource(opID,
                  rrmisp.getRMIID(),
                  i);
          newPB.setSource(rrmisp, i);
      } else {
          // If the source RenderableOp is on a different
          // server than the RenderableOp that represents
          // the operation
          remoteImage.setRenderableRMIServerProxyAsSource(
                opID,
                rrmisp.getRMIID(),
                rrmisp.getServerName(),
                rrmisp.getOperationName(),
                i);
          newPB.setSource(rrmisp, 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 RenderableImage) {

        // If the source is a local RenderableImage, the only way
        // to access it from a remote machine is to wrap it in
        // a SerializableRenderableImage and then set the SRI as
        // the source on the remote operation.
        RenderableImage ri = (RenderableImage)source;
        try {
      SerializableRenderableImage sri =
          new SerializableRenderableImage(ri);
      remoteImage.setRenderableSource(opID, sri, i);
      newPB.setSource(sri, 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

                                         String message,
                                         Exception e) {
        ImagingListener listener =
            ImageUtil.getImagingListener(renderContext);
        listener.errorOccurred(message,
                               new RemoteImagingException(message, e),
                               this, false);
    }
View Full Code Here

            try {
                host = InetAddress.getLocalHost().getHostAddress();
            } catch(java.net.UnknownHostException e) {
                String message = JaiI18N.getString("RMIImageImpl1");
                sendExceptionToListener(message,
                                        new RemoteImagingException(message, e));
/*
                System.err.println(JaiI18N.getString("RMIImageImpl1") +
                                   e.getMessage());
                e.printStackTrace();
*/
            }
        }

        System.out.println(JaiI18N.getString("RMIImageImpl3")+" "+
                           host + ":" + rmiRegistryPort);

        try {
            JAIRMIImageServer im = new JAIRMIImageServer(serverport);
            String serverName =
    new String("rmi://" +
                           host + ":" + rmiRegistryPort + "/" +
                           JAIRMIDescriptor.IMAGE_SERVER_BIND_NAME);
            System.out.println(JaiI18N.getString("RMIImageImpl4")+" \""+
                               serverName+"\".");
            Naming.rebind(serverName, im);
            System.out.println(JaiI18N.getString("RMIImageImpl5"));
        } catch (Exception e) {
            String message = JaiI18N.getString("RMIImageImpl1");
            sendExceptionToListener(message,
                                   new RemoteImagingException(message, e));
/*
            System.err.println(JaiI18N.getString("RMIImageImpl0") +
                               e.getMessage());
            e.printStackTrace();
*/
 
View Full Code Here

    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

        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

  try {
      return remoteImage.getPropertyNames(id);
  } catch (RemoteException re) {
            String message = JaiI18N.getString("RMIServerProxy17");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, re),
                                   this, false);
//      throw new RemoteImagingException(ImageUtil.getStackTraceString(re));
  }

        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.