public final File getBuildFileFor ( final Configuration configuration , final File jasperFileXml , final String extension , final Logger logger ) { final String configurationAbsolutePath = configuration . getDirectory ( ) . getPath ( ) ; final int prefixToConfiguration = configurationAbsolutePath . length ( ) + 1 ; final String parentDir = jasperFileXml . getAbsoluteFile ( ) . getParent ( ) ; final String relativePathToFile ; if ( configurationAbsolutePath . equals ( parentDir ) ) { relativePathToFile = FilenameUtils . getBaseName ( jasperFileXml . getName ( ) ) ; } else { final String relativePathToContainingDirectory = parentDir . substring ( prefixToConfiguration ) ; relativePathToFile = relativePathToContainingDirectory + File . separator + FilenameUtils . getBaseName ( jasperFileXml . getName ( ) ) ; } final File buildFile = new File ( getJasperCompilation ( configuration ) , relativePathToFile + extension ) ; if ( ! buildFile . getParentFile ( ) . exists ( ) && ! buildFile . getParentFile ( ) . mkdirs ( ) ) { logger . error ( "Unable to create directory for containing compiled jasper report templates: {}" , buildFile . getParentFile ( ) ) ; } return buildFile ; }
Calculate the file to compile a jasper report template to .