Package javax.media.jai.util

Examples of javax.media.jai.util.ImagingListener


        if(!SerializableStateImpl.class.isAssignableFrom(ssi)) {
            throw new IllegalArgumentException(JaiI18N.getString("SerializerImpl0"));
        }

        ImagingListener listener =
            ImageUtil.getImagingListener((RenderingHints)null);
        Class[] classes = null;
        try {
            Method m1 = ssi.getMethod("getSupportedClasses", null);
            classes = (Class[])m1.invoke(null, null);
        } catch(java.lang.NoSuchMethodException e) {
            String message = JaiI18N.getString("SerializerImpl1");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, e),
                                   SerializerImpl.class, false);
        } catch (java.lang.IllegalAccessException e) {
            String message = JaiI18N.getString("SerializerImpl1");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, e),
                                   SerializerImpl.class, false);
        } catch (java.lang.reflect.InvocationTargetException e) {
            String message = JaiI18N.getString("SerializerImpl1");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, e),
                                   SerializerImpl.class, false);
        }

        boolean supportsSubclasses = false;
        try {
            Method m2 = ssi.getMethod("permitsSubclasses", null);
            Boolean b = (Boolean)m2.invoke(null, null);
            supportsSubclasses = b.booleanValue();
        } catch(java.lang.NoSuchMethodException e) {
            String message = JaiI18N.getString("SerializerImpl4");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, e),
                                   SerializerImpl.class, false);
        } catch (java.lang.IllegalAccessException e) {
            String message = JaiI18N.getString("SerializerImpl4");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, e),
                                   SerializerImpl.class, false);
        } catch (java.lang.reflect.InvocationTargetException e) {
            String message = JaiI18N.getString("SerializerImpl4");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, e),
                                   SerializerImpl.class, false);
        }

        int numClasses = classes.length;
View Full Code Here


    public boolean permitsSubclasses() {
        return areSubclassesPermitted;
    }

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

      registry.registerServices(null);
      return registry;

  } catch (IOException ioe) {
            ImagingListener listener =
                JAI.getDefaultInstance().getImagingListener();
            String message = JaiI18N.getString("OperationRegistry2");
            listener.errorOccurred(message,
                                   new ImagingException(message, ioe),
                                   OperationRegistry.class, false);
            return null;

//      ioe.printStackTrace();
View Full Code Here

  if (it == null)
      return null;

  FactoryCache fc = getFactoryCache(modeName);
        ImagingListener listener =
            JAI.getDefaultInstance().getImagingListener();
        Exception savedOne = null;

  while (it.hasNext()) {

      Object factory = it.next();
      Object obj;

      try {
    if ((obj = fc.invoke(factory, args)) != null)
        return obj;
                savedOne = null;
      } catch (Exception e) {
                listener.errorOccurred(JaiI18N.getString("OperationRegistry6")+
                                       " \""+descriptorName+"\"",
                                       e, this, false);
                savedOne = e;
//    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

  Vector sources = oldPB.getSources();
  newPB.removeSources();

  // Create a new RenderableOp on the server
  ImageServer remoteImage = getImageServer(rop.getServerName());
        ImagingListener listener =
                ImageUtil.getImagingListener(rop.getRenderingHints());
  Long opID = new Long(0L);
  try {
      opID = remoteImage.getRemoteID();
      remoteImage.createRenderableOp(opID,
             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

    }

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

    public RMIImageImpl() throws RemoteException {
        super();
        try {
            UnicastRemoteObject.exportObject(this);
        } catch(RemoteException e) {
            ImagingListener listener =
                ImageUtil.getImagingListener((RenderingHints)null);
            String message = JaiI18N.getString("RMIImageImpl0");
            listener.errorOccurred(message,
                                   new RemoteImagingException(message, e),
                                   this, false);
/*
            e.printStackTrace();
            throw new RuntimeException(JaiI18N.getString("RMIImageImpl0") +
View Full Code Here

        Raster raster = null;
        try {
            raster = decoder.decodeAsRaster().createTranslatedChild(tx, ty);
        } catch(Exception e) {

            ImagingListener listener =
                ImageUtil.getImagingListener(renderHints);
            listener.errorOccurred(JaiI18N.getString("IIPResolutionOpImage3"),
                                   new ImagingException(e),
                                   this, false);
/*
            String msg = JaiI18N.getString("IIPResolutionOpImage3")+" "+
                e.getMessage();
View Full Code Here

     * If none is set (which should not happen) the message is simply
     * printed to <code>System.err</code>.
     */
    private static void forwardToListener(String message,
                                          Throwable thrown) {
        ImagingListener listener =
            JAI.getDefaultInstance().getImagingListener();

        if(listener != null) {
            listener.errorOccurred(message, thrown, MediaLibAccessor.class,
                                   false);
        } else {
            System.err.println(message);
        }
    }
View Full Code Here

TOP

Related Classes of javax.media.jai.util.ImagingListener

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.