Package javax.media.jai

Examples of javax.media.jai.ParameterListDescriptor


  } else {

      // If the supplied parameterList is null and the default one is
      // null too, then check whether this format supports no parameters
      ParameterListDescriptor pld =
    tcd.getParameterListDescriptor("tileDecoder");

      // Check whether a non-null samplemodel value is needed
      if (tcd.includesSampleModelInfo() == false) {
    // SampleModel must be specified via the parameter list
    throw new IllegalArgumentException(
            JaiI18N.getString("TileDecoderImpl5"));
      }

      // If the PLD is not null and says that there are supposed to
      // be some parameters (numParameters returns non-zero value)
      // throw an IllegalArgumentException
      if (pld != null && pld.getNumParameters() != 0) {
    throw new IllegalArgumentException(
          JaiI18N.getString("TileDecoderImpl6"));
      }
  }
View Full Code Here


  } else {

      // If the supplied parameterList is null and the default one is
      // null too, then check whether this format supports no parameters
      ParameterListDescriptor pld =
    tcd.getParameterListDescriptor("tileEncoder");

      // If the PLD is not null and says that there are supposed to
      // be some parameters (numParameters returns non-zero value)
      // throw an IllegalArgumentException
      if (pld != null && pld.getNumParameters() != 0) {
    throw new IllegalArgumentException(
          JaiI18N.getString("TileDecoderImpl6"));
      }
  }
View Full Code Here

/*  885 */       if ((!tcd.includesSampleModelInfo()) || (!tcd.includesLocationInfo()))
/*      */       {
/*  887 */         throw new RemoteImagingException(JaiI18N.getString("RMIServerProxy1"));
/*      */       }
/*      */
/*  891 */       ParameterListDescriptor pld = tcd.getParameterListDescriptor("tileDecoder");
/*      */
/*  894 */       tcpl = new TileCodecParameterList(capabilityName, new String[] { "tileDecoder" }, pld);
/*      */
/*  900 */       if (pld != null)
/*      */       {
/*  902 */         String[] paramNames = pld.getParamNames();
/*      */
/*  905 */         if (paramNames != null) {
/*  906 */           for (int i = 0; i < paramNames.length; i++) { String currParam = paramNames[i];
/*      */             Object currValue;
/*      */             try { currValue = codecCap.getNegotiatedValue(currParam); }
View Full Code Here

/*  466 */       if ((!tcd.includesSampleModelInfo()) || (!tcd.includesLocationInfo()))
/*      */       {
/*  468 */         throw new RuntimeException(JaiI18N.getString("JAIRMIImageServer1"));
/*      */       }
/*      */
/*  472 */       ParameterListDescriptor pld = tcd.getParameterListDescriptor("tileEncoder");
/*      */
/*  475 */       tcpl = new TileCodecParameterList(capabilityName, new String[] { "tileEncoder" }, pld);
/*      */
/*  479 */       if (pld != null)
/*      */       {
/*  481 */         String[] paramNames = pld.getParamNames();
/*      */
/*  485 */         if (paramNames != null) {
/*  486 */           for (int i = 0; i < paramNames.length; i++) { String currParam = paramNames[i];
/*      */             Object currValue;
/*      */             try { currValue = codecCap.getNegotiatedValue(currParam);
View Full Code Here

/*      */
/*  262 */     if (capabilityName == null) {
/*  263 */       throw new IllegalArgumentException(JaiI18N.getString("NegotiableCapability1"));
/*      */     }
/*      */
/*  267 */     ParameterListDescriptor desc = getParameterListDescriptor();
/*  268 */     int numParams = desc.getNumParameters();
/*  269 */     String[] names = desc.getParamNames();
/*  270 */     Class[] classes = desc.getParamClasses();
/*  271 */     Object[] defaults = desc.getParamDefaults();
/*      */
/*  273 */     for (int i = 0; i < numParams; i++)
/*      */     {
/*  276 */       if (!Negotiable.class.isAssignableFrom(classes[i])) {
/*  277 */         throw new IllegalArgumentException(JaiI18N.getString("NegotiableCapability4"));
View Full Code Here

/*      */       else {
/*  468 */         negStatus = 3;
/*      */       }
/*      */     }
/*      */
/*  472 */     ParameterListDescriptor pld = getParameterListDescriptor();
/*  473 */     ParameterListDescriptor otherPld = capability.getParameterListDescriptor();
/*      */
/*  475 */     String[] thisNames = pld.getParamNames();
/*  476 */     if (thisNames == null)
/*  477 */       thisNames = new String[0];
/*  478 */     String[] otherNames = otherPld.getParamNames();
/*  479 */     if (otherNames == null)
/*  480 */       otherNames = new String[0];
/*  481 */     Hashtable thisHash = hashNames(thisNames);
/*  482 */     Hashtable otherHash = hashNames(otherNames);
/*      */
/*  484 */     Class[] thisClasses = pld.getParamClasses();
/*  485 */     Class[] otherClasses = otherPld.getParamClasses();
/*  486 */     Object[] thisDefaults = pld.getParamDefaults();
/*  487 */     Object[] otherDefaults = otherPld.getParamDefaults();
/*      */
/*  489 */     NegotiableCapability result = null;
/*      */
/*  492 */     ArrayList resultGenerators = new ArrayList();
/*  493 */     if (this.generators != null)
/*  494 */       resultGenerators.addAll(this.generators);
/*  495 */     if (capability.getGenerators() != null)
/*  496 */       resultGenerators.addAll(capability.getGenerators());
/*      */     Vector commonNames;
/*      */     Hashtable commonHash;
/*      */     Vector thisExtras;
/*      */     Vector otherExtras;
/*      */     Vector resultParams;
/*      */     int resultLength;
/*      */     String[] resultNames;
/*      */     Class[] resultClasses;
/*      */     Object[] resultDefaults;
/*      */     Object[] resultValidValues;
/*      */     int count;
/*      */     ParameterListDescriptorImpl resultPLD;
/*  498 */     switch (negStatus)
/*      */     {
/*      */     case 0:
/*  502 */       commonNames = commonElements(thisHash, otherHash);
/*  503 */       commonHash = hashNames(commonNames);
/*  504 */       thisExtras = removeAll(thisHash, commonHash);
/*  505 */       otherExtras = removeAll(otherHash, commonHash);
/*      */
/*  507 */       int thisExtraLength = thisExtras.size();
/*  508 */       int otherExtraLength = otherExtras.size();
/*      */
/*  512 */       resultParams = new Vector(commonNames);
/*  513 */       resultParams.addAll(thisExtras);
/*  514 */       resultParams.addAll(otherExtras);
/*  515 */       resultLength = resultParams.size();
/*  516 */       resultNames = new String[resultLength];
/*  517 */       for (int i = 0; i < resultLength; i++) {
/*  518 */         resultNames[i] = ((String)resultParams.elementAt(i));
/*      */       }
/*      */
/*  521 */       resultClasses = new Class[resultLength];
/*  522 */       resultDefaults = new Object[resultLength];
/*  523 */       resultValidValues = new Object[resultLength];
/*      */
/*  526 */       for (count = 0; count < commonNames.size(); count++) {
/*  527 */         String name = (String)commonNames.elementAt(count);
/*  528 */         resultClasses[count] = thisClasses[getIndex(thisHash, name)];
/*  529 */         resultDefaults[count] = thisDefaults[getIndex(thisHash, name)];
/*  530 */         resultValidValues[count] = pld.getParamValueRange(name);
/*      */       }
/*  532 */       for (int i = 0; i < thisExtraLength; i++) {
/*  533 */         String name = (String)thisExtras.elementAt(i);
/*  534 */         resultClasses[(count + i)] = thisClasses[getIndex(thisHash, name)];
/*  535 */         resultDefaults[(count + i)] = thisDefaults[getIndex(thisHash, name)];
/*      */
/*  537 */         resultValidValues[(count + i)] = pld.getParamValueRange(name);
/*      */       }
/*  539 */       count += thisExtraLength;
/*  540 */       for (int i = 0; i < otherExtraLength; i++) {
/*  541 */         String name = (String)otherExtras.elementAt(i);
/*  542 */         resultClasses[(i + count)] = otherClasses[getIndex(otherHash, name)];
/*      */
/*  544 */         resultDefaults[(i + count)] = otherDefaults[getIndex(otherHash, name)];
/*      */
/*  546 */         resultValidValues[(i + count)] = otherPld.getParamValueRange(name);
/*      */       }
/*      */
/*  549 */       resultPLD = new ParameterListDescriptorImpl(null, resultNames, resultClasses, resultDefaults, resultValidValues);
/*      */
/*  557 */       result = new NegotiableCapability(this.category, this.capabilityName, resultGenerators, resultPLD, true);
/*      */
/*  563 */       for (int i = 0; i < commonNames.size(); i++) {
/*  564 */         String currParam = (String)commonNames.elementAt(i);
/*  565 */         Negotiable thisValue = (Negotiable)getObjectParameter(currParam);
/*  566 */         Negotiable otherValue = (Negotiable)capability.getObjectParameter(currParam);
/*      */
/*  576 */         if (thisValue == null) {
/*  577 */           result.setParameter(currParam, otherValue);
/*      */         }
/*  581 */         else if (otherValue == null) {
/*  582 */           result.setParameter(currParam, thisValue);
/*      */         }
/*      */         else
/*      */         {
/*  590 */           Negotiable resultValue = thisValue.negotiate(otherValue);
/*  591 */           if (resultValue == null) {
/*  592 */             return null;
/*      */           }
/*      */
/*  595 */           result.setParameter(currParam, resultValue);
/*      */         }
/*      */       }
/*      */
/*  599 */       for (int i = 0; i < thisExtraLength; i++) {
/*  600 */         String currParam = (String)thisExtras.elementAt(i);
/*  601 */         result.setParameter(currParam, (Negotiable)getObjectParameter(currParam));
/*      */       }
/*      */
/*  605 */       for (int i = 0; i < otherExtraLength; i++) {
/*  606 */         String currParam = (String)otherExtras.elementAt(i);
/*  607 */         result.setParameter(currParam, (Negotiable)capability.getObjectParameter(currParam));
/*      */       }
/*      */
/*  611 */       break;
/*      */     case 1:
/*  616 */       commonNames = commonElements(thisHash, otherHash);
/*  617 */       commonHash = hashNames(commonNames);
/*  618 */       thisExtras = removeAll(thisHash, commonHash);
/*      */
/*  622 */       resultParams = new Vector(commonNames);
/*  623 */       resultParams.addAll(thisExtras);
/*  624 */       resultLength = resultParams.size();
/*  625 */       resultNames = new String[resultLength];
/*  626 */       for (int i = 0; i < resultLength; i++) {
/*  627 */         resultNames[i] = ((String)resultParams.elementAt(i));
/*      */       }
/*      */
/*  630 */       resultClasses = new Class[resultLength];
/*  631 */       resultDefaults = new Object[resultLength];
/*  632 */       resultValidValues = new Object[resultLength];
/*      */
/*  634 */       count = 0;
/*  635 */       for (count = 0; count < commonNames.size(); count++) {
/*  636 */         String name = (String)commonNames.elementAt(count);
/*  637 */         resultClasses[count] = thisClasses[getIndex(thisHash, name)];
/*  638 */         resultDefaults[count] = thisDefaults[getIndex(thisHash, name)];
/*  639 */         resultValidValues[count] = pld.getParamValueRange(name);
/*      */       }
/*  641 */       for (int i = 0; i < thisExtras.size(); i++) {
/*  642 */         String name = (String)thisExtras.elementAt(i);
/*  643 */         resultClasses[(i + count)] = thisClasses[getIndex(thisHash, name)];
/*  644 */         resultDefaults[(i + count)] = thisDefaults[getIndex(thisHash, name)];
/*      */
/*  646 */         resultValidValues[(i + count)] = pld.getParamValueRange(name);
/*      */       }
/*      */
/*  649 */       resultPLD = new ParameterListDescriptorImpl(null, resultNames, resultClasses, resultDefaults, resultValidValues);
/*      */
/*  655 */       result = new NegotiableCapability(this.category, this.capabilityName, resultGenerators, resultPLD, false);
/*      */
/*  661 */       for (int i = 0; i < commonNames.size(); i++) {
/*  662 */         String currParam = (String)commonNames.elementAt(i);
/*  663 */         Negotiable thisValue = (Negotiable)getObjectParameter(currParam);
/*  664 */         Negotiable otherValue = (Negotiable)capability.getObjectParameter(currParam);
/*      */
/*  667 */         if (thisValue == null)
/*      */         {
/*  670 */           return null;
/*      */         }
/*      */
/*  673 */         if (otherValue == null)
/*      */         {
/*  678 */           result.setParameter(currParam, thisValue);
/*      */         }
/*      */         else {
/*  681 */           Negotiable resultValue = thisValue.negotiate(otherValue);
/*      */
/*  683 */           if (resultValue == null)
/*      */           {
/*  687 */             return null;
/*      */           }
/*  689 */           result.setParameter(currParam, resultValue);
/*      */         }
/*      */
/*      */       }
/*      */
/*  695 */       for (int i = 0; i < thisExtras.size(); i++) {
/*  696 */         String currParam = (String)thisExtras.elementAt(i);
/*  697 */         Negotiable resultValue = (Negotiable)getObjectParameter(currParam);
/*  698 */         if (resultValue == null)
/*  699 */           return null;
/*  700 */         result.setParameter(currParam, resultValue);
/*      */       }
/*      */
/*  703 */       break;
/*      */     case 2:
/*  708 */       commonNames = commonElements(thisHash, otherHash);
/*  709 */       commonHash = hashNames(commonNames);
/*  710 */       otherExtras = removeAll(otherHash, commonHash);
/*      */
/*  714 */       resultParams = new Vector(commonNames);
/*  715 */       resultParams.addAll(otherExtras);
/*  716 */       resultLength = resultParams.size();
/*  717 */       resultNames = new String[resultLength];
/*  718 */       for (int i = 0; i < resultLength; i++) {
/*  719 */         resultNames[i] = ((String)resultParams.elementAt(i));
/*      */       }
/*      */
/*  722 */       resultClasses = new Class[resultLength];
/*  723 */       resultDefaults = new Object[resultLength];
/*  724 */       resultValidValues = new Object[resultLength];
/*  725 */       count = 0;
/*  726 */       for (count = 0; count < commonNames.size(); count++) {
/*  727 */         String name = (String)commonNames.elementAt(count);
/*  728 */         resultClasses[count] = thisClasses[getIndex(thisHash, name)];
/*  729 */         resultDefaults[count] = thisDefaults[getIndex(thisHash, name)];
/*  730 */         resultValidValues[count] = pld.getParamValueRange(name);
/*      */       }
/*      */
/*  733 */       for (int i = 0; i < otherExtras.size(); i++) {
/*  734 */         String name = (String)otherExtras.elementAt(i);
/*  735 */         resultClasses[(i + count)] = otherClasses[getIndex(otherHash, name)];
/*      */
/*  737 */         resultDefaults[(i + count)] = otherDefaults[getIndex(otherHash, name)];
/*      */
/*  739 */         resultValidValues[(i + count)] = otherPld.getParamValueRange(name);
/*      */       }
/*      */
/*  742 */       resultPLD = new ParameterListDescriptorImpl(null, resultNames, resultClasses, resultDefaults, resultValidValues);
/*      */
/*  748 */       result = new NegotiableCapability(this.category, this.capabilityName, resultGenerators, resultPLD, false);
View Full Code Here

/*      */   {
/*  856 */     if (other == null) {
/*  857 */       throw new IllegalArgumentException(JaiI18N.getString("NegotiableCapability6"));
/*      */     }
/*      */
/*  861 */     ParameterListDescriptor thisDesc = getParameterListDescriptor();
/*  862 */     ParameterListDescriptor otherDesc = other.getParameterListDescriptor();
/*      */
/*  864 */     String[] thisNames = thisDesc.getParamNames();
/*  865 */     if (thisNames == null)
/*  866 */       thisNames = new String[0];
/*  867 */     String[] otherNames = otherDesc.getParamNames();
/*  868 */     if (otherNames == null)
/*  869 */       otherNames = new String[0];
/*  870 */     Hashtable thisHash = hashNames(thisNames);
/*  871 */     Hashtable otherHash = hashNames(otherNames);
/*      */
/*  873 */     if ((!this.isPreference) && (!other.isPreference()))
/*      */     {
/*  876 */       if (thisDesc.getNumParameters() != otherDesc.getNumParameters()) {
/*  877 */         return false;
/*      */       }
/*      */
/*  880 */       if (!containsAll(thisHash, otherHash)) {
/*  881 */         return false;
/*      */       }
/*  883 */       Class[] thisParamClasses = thisDesc.getParamClasses();
/*  884 */       Class[] otherParamClasses = otherDesc.getParamClasses();
/*  885 */       for (int i = 0; i < thisNames.length; i++) {
/*  886 */         if (thisParamClasses[i] != otherParamClasses[getIndex(otherHash, thisNames[i])])
/*      */         {
/*  888 */           return false;
/*      */         }
/*      */       }
/*  891 */       return true;
/*      */     }
/*      */
/*  895 */     Vector commonNames = commonElements(thisHash, otherHash);
/*      */
/*  897 */     Class[] thisParamClasses = thisDesc.getParamClasses();
/*  898 */     Class[] otherParamClasses = otherDesc.getParamClasses();
/*      */
/*  900 */     for (int i = 0; i < commonNames.size(); i++) {
/*  901 */       String currName = (String)commonNames.elementAt(i);
/*  902 */       if (thisParamClasses[getIndex(thisHash, currName)] != otherParamClasses[getIndex(otherHash, currName)])
/*      */       {
View Full Code Here

/* 332 */       throw new IllegalArgumentException(JaiI18N.getString("JAIRMIDescriptor1"));
/*     */     }
/*     */
/* 335 */     int numSources = oldOD.getNumSources();
/*     */
/* 341 */     ParameterListDescriptor oldPLD = null;
/* 342 */     if (registryModeName.equalsIgnoreCase("remoteRendered"))
/* 343 */       oldPLD = oldOD.getParameterListDescriptor("rendered");
/* 344 */     else if (registryModeName.equalsIgnoreCase("remoteRenderable"))
/* 345 */       oldPLD = oldOD.getParameterListDescriptor("renderable");
/*     */     else {
/* 347 */       oldPLD = oldOD.getParameterListDescriptor(registryModeName);
/*     */     }
/*     */
/* 350 */     int numParams = oldPLD.getNumParameters();
/*     */
/* 353 */     if (oldServerName != newServerName)
/*     */     {
/* 357 */       OperationDescriptor[] newDescs = getServerSupportedOperationList(newServerName);
/*     */       OperationDescriptor newOD;
/* 361 */       if ((newOD = getOperationDescriptor(newDescs, operationName)) == null)
/*     */       {
/* 363 */         throw new IllegalArgumentException(JaiI18N.getString("JAIRMIDescriptor2"));
/*     */       }
/*     */
/* 369 */       if (numSources != newOD.getNumSources()) {
/* 370 */         throw new IllegalArgumentException(JaiI18N.getString("JAIRMIDescriptor3"));
/*     */       }
/*     */
/* 374 */       ParameterListDescriptor newPLD = newOD.getParameterListDescriptor(registryModeName);
/*     */
/* 377 */       if (numParams != newPLD.getNumParameters()) {
/* 378 */         throw new IllegalArgumentException(JaiI18N.getString("JAIRMIDescriptor4"));
/*     */       }
/*     */
/* 382 */       String[] oldParamNames = oldPLD.getParamNames();
/* 383 */       if (oldParamNames == null)
/* 384 */         oldParamNames = new String[0];
/* 385 */       String[] newParamNames = newPLD.getParamNames();
/* 386 */       if (newParamNames == null) {
/* 387 */         newParamNames = new String[0];
/*     */       }
/* 389 */       Hashtable oldHash = hashNames(oldParamNames);
/* 390 */       Hashtable newHash = hashNames(newParamNames);
/*     */
/* 393 */       if (!containsAll(oldHash, newHash)) {
/* 394 */         throw new IllegalArgumentException(JaiI18N.getString("JAIRMIDescriptor8"));
/*     */       }
/*     */
/* 398 */       Class[] thisParamClasses = oldPLD.getParamClasses();
/* 399 */       Class[] otherParamClasses = newPLD.getParamClasses();
/* 400 */       for (int i = 0; i < oldParamNames.length; i++) {
/* 401 */         if (thisParamClasses[i] != otherParamClasses[getIndex(newHash, oldParamNames[i])])
/*     */         {
/* 403 */           throw new IllegalArgumentException(JaiI18N.getString("JAIRMIDescriptor9"));
/*     */         }
View Full Code Here

/* 1228 */       TileCodecParameterList temp = this.decodingParam;
/*      */
/* 1230 */       if (temp != null) {
/* 1231 */         TileCodecDescriptor tcd = getTileCodecDescriptor("tileDecoder", this.formatName);
/*      */
/* 1233 */         ParameterListDescriptor pld = tcd.getParameterListDescriptor("tileDecoder");
/*      */
/* 1235 */         this.decodingParam = new TileCodecParameterList(this.formatName, new String[] { "tileDecoder" }, pld);
/*      */
/* 1239 */         String[] names = pld.getParamNames();
/*      */
/* 1241 */         if (names != null)
/* 1242 */           for (int i = 0; i < names.length; i++)
/* 1243 */             this.decodingParam.setParameter(names[i], temp.getObjectParameter(names[i]));
/*      */       }
View Full Code Here

/*     */   public NegotiableCapability getDecodeCapability()
/*     */   {
/* 100 */     Vector generators = new Vector();
/* 101 */     generators.add(JPEGTileDecoderFactory.class);
/*     */
/* 103 */     ParameterListDescriptor jpegPld = JAI.getDefaultInstance().getOperationRegistry().getDescriptor("tileDecoder", "jpeg").getParameterListDescriptor("tileDecoder");
/*     */
/* 105 */     Class[] paramClasses = { NegotiableNumericRange.class, NegotiableCollection.class, NegotiableNumericRange.class, NegotiableCollection.class, NegotiableCollection.class, NegotiableCollection.class };
/*     */
/* 123 */     String[] paramNames = { "quality", "qualitySet", "restartInterval", "writeImageInfo", "writeTableInfo", "writeJFIFHeader" };
/*     */
/* 134 */     Vector v = new Vector();
/* 135 */     v.add(new Boolean(true));
/* 136 */     v.add(new Boolean(false));
/* 137 */     NegotiableCollection negCollection = new NegotiableCollection(v);
/*     */
/* 139 */     NegotiableNumericRange nnr1 = new NegotiableNumericRange(jpegPld.getParamValueRange(paramNames[0]));
/*     */
/* 143 */     NegotiableNumericRange nnr2 = new NegotiableNumericRange(jpegPld.getParamValueRange(paramNames[2]));
/*     */
/* 148 */     Object[] defaults = { nnr1, negCollection, nnr2, negCollection, negCollection, negCollection };
/*     */
/* 157 */     NegotiableCapability decodeCap = new NegotiableCapability("tileCodec", "jpeg", generators, new ParameterListDescriptorImpl(null, paramNames, paramClasses, defaults, null), false);
/*     */
View Full Code Here

TOP

Related Classes of javax.media.jai.ParameterListDescriptor

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.