ProcessorAdapter { static String getDatePart(Path inputProductPath) { Path day = inputProductPath.getParent(); if (day != null && !day.getName().isEmpty()) { Path month = day.getParent(); if (month != null && !month.getName().isEmpty()) { Path year = month.getParent(); if (year != null && !year.getName().isEmpty()) { return year.getName() + "/" + month.getName() + "/" + day.getName(); } } } return null; } ProcessorAdapter(MapContext mapContext); void prepareProcessing(); boolean canSkipInputProduct(); abstract boolean processSourceProduct(MODE mode, ProgressMonitor pm); abstract Product openProcessedProduct(); abstract void saveProcessedProducts(ProgressMonitor pm); abstract Path getOutputProductPath(); abstract boolean supportsPullProcessing(); Product getProcessedProduct(ProgressMonitor pm); void setProcessingRectangle(Rectangle roiRectangle); Path getInputPath(); String[] getInputParameters(); Rectangle getInputRectangle(); AffineTransform getInput2OutputTransform(); void setInput2OutputTransform(AffineTransform input2OutputTransform); Product getInputProduct(); void setInputFile(File inputFile); File getInputFile(); void dispose(); void closeInputProduct(); static boolean hasInvalidStartAndStopTime(Product product); static void copySceneRasterStartAndStopTime(Product sourceProduct, Product targetProduct,
                                                       Rectangle inputRectangle); static final String[] EMPTY_PARAMETERS; }
@Test public void testGetDatePart() throws Exception { assertEquals("2005/06/09", ProcessorAdapter.getDatePart(new Path("/foo/2005/06/09/MER.N1"))); assertEquals("2005/06/09", ProcessorAdapter.getDatePart(new Path("foo/2005/06/09/MER.N1"))); assertEquals("2005/06/09", ProcessorAdapter.getDatePart(new Path("/2005/06/09/MER.N1"))); assertEquals("2005/06/09", ProcessorAdapter.getDatePart(new Path("2005/06/09/MER.N1"))); assertNull(ProcessorAdapter.getDatePart(new Path("/06/09/MER.N1"))); assertNull(ProcessorAdapter.getDatePart(new Path("/09/MER.N1"))); assertNull(ProcessorAdapter.getDatePart(new Path("09/MER.N1"))); assertNull(ProcessorAdapter.getDatePart(new Path("/MER.N1"))); assertNull(ProcessorAdapter.getDatePart(new Path("MER.N1"))); }