Package com.lightcrafts.mediax.jai.remote

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


      return null;
  }

  // Since "tileCodec" is the only category that we care about or honor
  // currently in the remote communication.
  NegotiableCapability codecCap = getNegotiatedValue("tileCodec");

  TileDecoderFactory tdf = null;
  TileCodecParameterList tcpl = null;

  if (codecCap != null) {

      String category = codecCap.getCategory();
      String capabilityName = codecCap.getCapabilityName();
      List generators = codecCap.getGenerators();

      Class factory;
      for (Iterator i=generators.iterator(); i.hasNext(); ) {
    factory = (Class)i.next();
    if (tdf == null &&
        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;
      }
View Full Code Here


    public byte[] getCompressedTile(Long id, int x, int y)
  throws RemoteException {

  TileCodecParameterList tcpl = null;
  TileEncoderFactory tef = null;
  NegotiableCapability codecCap = null;

  if (negotiated != null) {
      codecCap = ((NegotiableCapabilitySet)negotiated.get(id)).
    getNegotiatedValue("tileCodec");
  }

  if (codecCap != null) {

      String category = codecCap.getCategory();
      String capabilityName = codecCap.getCapabilityName();
      List generators = codecCap.getGenerators();

      Class factory;
      for (Iterator i=generators.iterator(); i.hasNext(); ) {

    factory = (Class)i.next();
    if (tef == null &&
        TileEncoderFactory.class.isAssignableFrom(factory)) {
        try {
      tef = (TileEncoderFactory)factory.newInstance();
        } catch (InstantiationException ie) {
      throw new RuntimeException(ie.getMessage());
        } catch (IllegalAccessException iae) {
      throw new RuntimeException(iae.getMessage());
        }
    }
      }

      if (tef == null) {
    throw new RuntimeException(
             JaiI18N.getString("JAIRMIImageServer0"));
      }

      TileCodecDescriptor tcd =
    (TileCodecDescriptor)JAI.getDefaultInstance().
    getOperationRegistry().getDescriptor("tileEncoder",
                 capabilityName);

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

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

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

      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) {
          continue;
      }
      tcpl.setParameter(currParam, currValue);
        }
View Full Code Here

    public NegotiableCapability getDecodeCapability() {

  Vector generators = new Vector();
  generators.add(GZIPTileDecoderFactory.class);

  return new NegotiableCapability("tileCodec",
          "gzip",
          generators,
          new ParameterListDescriptorImpl(null,
                  null,
                  null,
View Full Code Here

      negCollection,
      negCollection,
      negCollection
  };

  NegotiableCapability decodeCap =
      new NegotiableCapability("tileCodec",
             "jpeg",
             generators,
             new ParameterListDescriptorImpl(
               null, //descriptor
               paramNames,
               paramClasses,
               defaults,
               null), // validValues
             false); // non-preference

  // Set the Negotiables representing the valid values on the capability
  decodeCap.setParameter(paramNames[0], nnr1);
  decodeCap.setParameter(paramNames[1], negCollection);
  decodeCap.setParameter(paramNames[2], nnr2);
  decodeCap.setParameter(paramNames[3], negCollection);
  decodeCap.setParameter(paramNames[4], negCollection);
  decodeCap.setParameter(paramNames[5], negCollection);

  return decodeCap;
    }
View Full Code Here

    public NegotiableCapability getDecodeCapability() {

  Vector generators = new Vector();
  generators.add(RawTileDecoderFactory.class);

  return new NegotiableCapability("tileCodec",
          "raw",
          generators,
          new ParameterListDescriptorImpl(null,
                  null,
                  null,
View Full Code Here

    public NegotiableCapability getEncodeCapability() {

  Vector generators = new Vector();
  generators.add(GZIPTileEncoderFactory.class);

  return new NegotiableCapability("tileCodec",
          "gzip",
          generators,
          new ParameterListDescriptorImpl(null,
                  null,
                  null,
View Full Code Here

      negCollection,
      negCollection,
      negCollection
  };

  NegotiableCapability encodeCap =
      new NegotiableCapability("tileCodec",
             "jpeg",
             generators,
             new ParameterListDescriptorImpl(
                null, // descriptor
                paramNames,
                paramClasses,
                defaults,
                null), // validValues
             false); // a non-preference

  // Set the Negotiables representing the valid values on the capability
  encodeCap.setParameter(paramNames[0], nnr1);
  encodeCap.setParameter(paramNames[1], negCollection);
  encodeCap.setParameter(paramNames[2], nnr2);
  encodeCap.setParameter(paramNames[3], negCollection);
  encodeCap.setParameter(paramNames[4], negCollection);
  encodeCap.setParameter(paramNames[5], negCollection);

  return encodeCap;
    }
View Full Code Here

    public NegotiableCapability getEncodeCapability() {

  Vector generators = new Vector();
  generators.add(RawTileEncoderFactory.class);

  return new NegotiableCapability("tileCodec",
          "raw",
          generators,
          new ParameterListDescriptorImpl(null,
                  null,
                  null,
View Full Code Here

TOP

Related Classes of com.lightcrafts.mediax.jai.remote.NegotiableCapability

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.