1 10 package org.mmbase.util.images; 11 12 import java.util.List ; 13 import org.mmbase.util.logging.*; 14 import org.mmbase.module.core.MMObjectNode; 15 16 23 public class ImageConversionRequest { 24 25 private static final Logger log = Logging.getLoggerInstance(ImageConversionRequest.class); 26 27 private boolean ready = false; 28 private List params; 29 private byte[] in; 30 private int count = 0; 31 private MMObjectNode icacheNode; 32 private String format; 33 34 37 public ImageConversionRequest(List params, byte[] in, String format, MMObjectNode icacheNode) { 38 this.in = in; 39 this.params = params; 40 this.icacheNode = icacheNode; 41 this.format = format; 42 } 43 44 47 public List getParams() { 48 return params; 49 } 50 51 54 public byte[] getInput() { 55 return in; 56 } 57 58 61 public MMObjectNode getNode() { 62 return icacheNode; 63 } 64 public String getInputFormat() { 65 return format; 66 } 67 68 69 72 public synchronized void waitForConversion() { 73 if (! ready) { log.service("Waiting for " + toString()); 75 count++; 76 try { 77 wait(); 78 } catch (InterruptedException e) { 79 } 80 log.service("Ready " + toString()); 81 } 82 } 83 84 85 public synchronized void ready() { 86 count = 0; 87 ready = true; 88 notifyAll(); 89 } 90 91 94 public int count() { 95 return count; 96 } 97 98 public String toString() { 100 return icacheNode.getStringValue("id") + " --> " + icacheNode.getNumber() + " " + params; 101 } 102 } 103 | Popular Tags |