Class CatalogOutputAdapter

java.lang.Object
org.codice.alliance.imaging.chip.transformer.CatalogOutputAdapter

public class CatalogOutputAdapter extends Object
Performs various conversion functions required to wire the CatalogFramework interface to the MetacardTransformer interface.
  • Constructor Details

    • CatalogOutputAdapter

      public CatalogOutputAdapter(Semaphore lock)
  • Method Details

    • getImage

      public BufferedImage getImage(ddf.catalog.operation.ResourceResponse resourceResponse) throws IOException
      Parameters:
      resourceResponse - a ResourceResponse object returned by CatalogFramework.
      Returns:
      the requested BufferedImage.
      Throws:
      IOException - when there's a problem reading the image from the ResourceResponse InputStream.
    • getBinaryContent

      public ddf.catalog.data.BinaryContent getBinaryContent(BufferedImage image) throws IOException, javax.activation.MimeTypeParseException
      Parameters:
      image - the BufferedImage to be converted.
      Returns:
      a BinaryContent object containing the image data.
      Throws:
      IOException - when the BufferedImage can't be written to temporary in-memory space.
      javax.activation.MimeTypeParseException - thrown if the mime type is invalid
    • getNitfSegmentsFlow

      public org.codice.imaging.nitf.fluent.NitfSegmentsFlow getNitfSegmentsFlow(ddf.catalog.operation.ResourceResponse resourceResponse) throws org.codice.imaging.nitf.core.common.NitfFormatException, IOException
      Parameters:
      resourceResponse - resource response from the catalog framework
      Returns:
      the nitf segments
      Throws:
      org.codice.imaging.nitf.core.common.NitfFormatException
      IOException
    • createTemporaryFileBackedOutputStream

      protected org.codice.ddf.platform.util.TemporaryFileBackedOutputStream createTemporaryFileBackedOutputStream()
      This method exists so unit tests can override and create a different TFBOS for testing exceptions.
    • getNitfBinaryContent

      public ddf.catalog.data.BinaryContent getNitfBinaryContent(BufferedImage chip, org.codice.imaging.nitf.fluent.NitfSegmentsFlow nitfSegmentsFlow, int sourceX, int sourceY) throws IOException, javax.activation.MimeTypeParseException, org.codice.imaging.nitf.core.common.NitfFormatException
      Create a NITF of a chip that extracted from another NITF.
      Parameters:
      chip - the image data for the chipped area
      nitfSegmentsFlow - the segments from the original nitf
      sourceX - the x pixel coordinates of the original nitf where the chip was extracted
      sourceY - the y pixel coordinates of the original nitf where the chip was extracted
      Returns:
      a nitf file containing the chip
      Throws:
      IOException
      javax.activation.MimeTypeParseException
      org.codice.imaging.nitf.core.common.NitfFormatException
    • wrapException

      public void wrapException(Exception exception) throws ddf.catalog.transform.CatalogTransformerException
      Parameters:
      exception - the exception to be wrapped.
      Throws:
      ddf.catalog.transform.CatalogTransformerException - in every case.