Package com.lightcrafts.mediax.jai

Examples of com.lightcrafts.mediax.jai.OperationRegistry


     * Returns the server's capabilities. Currently the only capabilities
     * that are reported are those dealing with TileCodecs.
     */
    public synchronized NegotiableCapabilitySet getServerCapabilities() {

  OperationRegistry registry =
      JAI.getDefaultInstance().getOperationRegistry();

  // Note that only the tileEncoder capabilities are returned from
  // this method since there is no way to distinguish between NC's
  // for the encoder and the decoder.
  String modeName = "tileEncoder";
  String[] descriptorNames = registry.getDescriptorNames(modeName);
  TileEncoderFactory tef = null;

  // Only non-preference NC's can be added.
  NegotiableCapabilitySet capabilities =
      new NegotiableCapabilitySet(false);

  Iterator it;
  for (int i=0; i<descriptorNames.length; i++) {

      it = registry.getFactoryIterator(modeName, descriptorNames[i]);
      for (; it.hasNext(); ) {
    tef = (TileEncoderFactory)it.next();
    capabilities.add(tef.getEncodeCapability());
      }
  }
View Full Code Here


    /**
     * Returns the set of capabilities supported by the client object.
     */
    public  NegotiableCapabilitySet getClientCapabilities() {

       OperationRegistry registry =
           JAI.getDefaultInstance().getOperationRegistry();
       String modeName = "tileDecoder";
       String[] descriptorNames = registry.getDescriptorNames(modeName);
       TileDecoderFactory tdf = null;

       // Only non-preference NegotiableCapability objects can be added
       // to this NCS, which is ok, since these represent the capabilities
       // of the client and thus are not preferences as much as they are
       // hard capabilities (i.e. non-preferences)
       NegotiableCapabilitySet capabilities =
           new NegotiableCapabilitySet(false);

       // Note that tileEncoder capabilities cannot be added since there is
       // no way to differentiate between a encoding and a decoding capability
       // within an NCS, and since the client should only be expected to
       // decode, this should be ok.

       Iterator it;
       for (int i=0; i<descriptorNames.length; i++) {

     it = registry.getFactoryIterator(modeName, descriptorNames[i]);
     for (; it.hasNext(); ) {
         tdf = (TileDecoderFactory)it.next();
         capabilities.add(tdf.getDecodeCapability());
     }
       }
View Full Code Here

            param = (ImageDecodeParam)paramBlock.getObjectParameter(1);
        }

        String[] names = ImageCodec.getDecoderNames(src);

        OperationRegistry registry =
            JAI.getDefaultInstance().getOperationRegistry();
        int bound = OpImage.OP_IO_BOUND;
        ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);

        if (renderHints != null) {
View Full Code Here

  negotiated = negotiate(preferences);
    }

    private NegotiableCapabilitySet negotiate(NegotiableCapabilitySet prefs) {

  OperationRegistry registry = nodeSupport.getRegistry();

  NegotiableCapabilitySet serverCap = null;

  // Get the RemoteDescriptor for protocolName
  RemoteDescriptor descriptor = (RemoteDescriptor)
      registry.getDescriptor(RemoteDescriptor.class, protocolName);

  if (descriptor == null) {
      Object[] msgArg0 = {new String(protocolName)};
      MessageFormat formatter = new MessageFormat("");
      formatter.setLocale(Locale.getDefault());
      formatter.applyPattern(JaiI18N.getString("RemoteJAI16"));
      throw new RuntimeException(formatter.format(msgArg0));
  }

  int count=0;
  int numRetries = getNumRetries();
  int retryInterval = getRetryInterval();

  Exception rieSave = null;
  while (count++ < numRetries) {
      try {
    serverCap = descriptor.getServerCapabilities(serverName);
    break;
      } catch (RemoteImagingException rie) {
    // Print that an Exception occured
    System.err.println(JaiI18N.getString("RemoteJAI24"));
    rieSave = rie;
    // Sleep for retryInterval milliseconds
    try {
        Thread.sleep(retryInterval);
    } catch (InterruptedException ie) {
//        throw new RuntimeException(ie.toString());
                    sendExceptionToListener(JaiI18N.getString("Generic5"),
                                            new ImagingException(JaiI18N.getString("Generic5"), ie));
    }
      }
  }

  if (serverCap == null && count > numRetries) {
            sendExceptionToListener(JaiI18N.getString("RemoteJAI18"), rieSave);
//      throw new RemoteImagingException(JaiI18N.getString("RemoteJAI18")
//               + "\n" + rieSave.getMessage());
  }

  RemoteRIF rrif = (RemoteRIF)registry.getFactory("remoteRenderable",
              protocolName);

  return RemoteJAI.negotiate(prefs,
           serverCap,
           rrif.getClientCapabilities());
View Full Code Here

                if (checkInvalidRegion) {
                    // Set event flag.
                    shouldFireEvent = true;

                    // Get the associated RemoteDescriptor.
                    OperationRegistry registry = nodeSupport.getRegistry();
                    RemoteDescriptor odesc = (RemoteDescriptor)
                        registry.getDescriptor(RemoteDescriptor.class,
                                               protocolName);

        // XXX
                    // Evaluate any DeferredData parameters.
                    oldPB = ImageUtil.evaluateParameters(oldPB);
View Full Code Here

    }

    // do the negotiation
    private NegotiableCapabilitySet negotiate(NegotiableCapabilitySet prefs) {

  OperationRegistry registry = nodeSupport.getRegistry();

  NegotiableCapabilitySet serverCap = null;

  // Get the RemoteDescriptor for protocolName
  RemoteDescriptor descriptor = (RemoteDescriptor)
      registry.getDescriptor(RemoteDescriptor.class, protocolName);

  if (descriptor == null) {
      Object[] msgArg0 = {new String(protocolName)};
      MessageFormat formatter = new MessageFormat("");
      formatter.setLocale(Locale.getDefault());
      formatter.applyPattern(JaiI18N.getString("RemoteJAI16"));
      throw new ImagingException(formatter.format(msgArg0));
  }

  int count=0;
  int numRetries = getNumRetries();
  int retryInterval = getRetryInterval();

  Exception rieSave = null;
  while (count++ < numRetries) {
      try {
    serverCap = descriptor.getServerCapabilities(serverName);
    break;
      } catch (RemoteImagingException rie) {
    // Print that an Exception occured
    System.err.println(JaiI18N.getString("RemoteJAI24"));
    rieSave = rie;
    // Sleep for retryInterval milliseconds
    try {
        Thread.sleep(retryInterval);
    } catch (InterruptedException ie) {
//        throw new RuntimeException(ie.toString());
                    sendExceptionToListener(JaiI18N.getString("Generic5"),
                                            new ImagingException(JaiI18N.getString("Generic5"), ie));
    }
      }
  }

  if (serverCap == null && count > numRetries) {
            sendExceptionToListener(JaiI18N.getString("RemoteJAI18"), rieSave);
//      throw new RemoteImagingException(JaiI18N.getString("RemoteJAI18")+"\n"+rieSave.getMessage());
  }

  RemoteRIF rrif = (RemoteRIF)registry.getFactory("remoteRendered",
              protocolName);

  return RemoteJAI.negotiate(prefs,
           serverCap,
           rrif.getClientCapabilities());
View Full Code Here

        ParameterBlock pb = new ParameterBlock();
        pb.addSource(paramBlock.getSource(0));
  pb.add(stream).add(format).add(param);

        // Get the default registry.
        OperationRegistry registry = (renderHints == null) ? null :
      (OperationRegistry)renderHints.get(JAI.KEY_OPERATION_REGISTRY);

        PlanarImage im = new FileStoreImage(RIFRegistry.create
          (registry, "encode", pb, renderHints), stream);
View Full Code Here

                renderHints.put(key, new Integer(bound));
            }

            // Get the registry from the hints, if any.
            // Don't check for null hints as it cannot be null here.
            OperationRegistry registry =
                (OperationRegistry)renderHints.get(JAI.KEY_OPERATION_REGISTRY);

            // Create the image using the most preferred RIF for "stream".
            RenderedImage image =
                RIFRegistry.create(registry, "stream", newParamBlock, renderHints);
View Full Code Here

                hints.put(key, new Integer(bound));
            }

            // Get the registry from the hints, if any.
            // Don't check for null hints as it cannot be null here.
            OperationRegistry registry =
                (OperationRegistry)hints.get(JAI.KEY_OPERATION_REGISTRY);

            // Create the image using the most preferred RIF for "stream".
            RenderedImage image =
    RIFRegistry.create(registry, "stream", newArgs, hints);
View Full Code Here

TOP

Related Classes of com.lightcrafts.mediax.jai.OperationRegistry

Copyright © 2015 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.