Java Code Examples for org.apache.commons.io.FileUtils#toFile()

The following examples show how to use org.apache.commons.io.FileUtils#toFile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VirtualFilesystemHandle.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public OutputStream openOutputStream() throws IOException{
	if (!isDirectory()) {
		File file = FileUtils.toFile(url);
		if (file != null) {
			return new FileOutputStream(file);
		}
		
		URLConnection openConnection = url.openConnection();
		if (openConnection != null) {
			return openConnection.getOutputStream();
		}
	}
	
	throw new IOException("Does not support outputstream on directory");
}
 
Example 2
Source File: LocalDocWriter.java    From TranskribusCore with GNU General Public License v3.0 6 votes vote down vote up
public static List<TrpTranscriptMetadata> updateTrpPageXml(JAXBPageTranscript tr) throws Exception {		
		File xmlFile = FileUtils.toFile(tr.getMd().getUrl());
		if (xmlFile == null) 
			throw new Exception("Cannot retrieve file url from: "+tr.getMd().getUrl());
		
		updateImageDimension(tr);
		
		//set last change date
		tr.getPageData().getMetadata().setLastChange(XmlUtils.getXmlGregCal());
		
		PageXmlUtils.marshalToFile(tr.getPageData(), xmlFile);
		
		List<TrpTranscriptMetadata> mds = new ArrayList<>();
		mds.add(tr.getMd());
		
		return mds;
//		PageXmlDao.writeJAXBPageTranscript(tr, xmlFile);
	}
 
Example 3
Source File: FinaliseTest.java    From RAMPART with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void test1() throws InterruptedException, ProcessExecutionException, IOException {

    File outputDir = temp.newFolder("test1");

    File test1File = FileUtils.toFile(this.getClass().getResource("/tools/finalise/test1.fa"));

    Finalise.Args args = new Finalise.Args();
    args.setOutputDir(outputDir);
    args.setMinN(5);
    args.setOutputPrefix("TGAC_TS_V1");
    args.setCompress(false);

    Finalise process = new Finalise(null, args);

    ExecutionResult result = process.execute(new DefaultExecutionContext());

    assertTrue(result.getExitCode() == 0);
    //assertTrue(new File(outputDir, "TGAC_TS_V1.tar.gz").exists());
}
 
Example 4
Source File: RampartConfigTest.java    From RAMPART with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testConfigLoad() throws IOException {

    File cfgFile = FileUtils.toFile(this.getClass().getResource("/config/test_rampart_config.xml"));
    File outDir = temp.newFolder("configTest");
    String jobPrefix = "configTestJob";

    RampartConfig args = new RampartConfig(cfgFile, outDir, jobPrefix, RampartStageList.parse("ALL"), null, null, true);

    Assert.assertTrue(true);
}
 
Example 5
Source File: ZipUtilsTests.java    From vividus with Apache License 2.0 5 votes vote down vote up
@Test
public void testReadArchiveEntryNamesFromBytes() throws IOException
{
    File file = FileUtils.toFile(ResourceUtils.findResource(getClass(), ZIP));
    Set<String> names = ZipUtils.readZipEntryNamesFromBytes(FileUtils.readFileToByteArray(file));
    assertThat(names, is(equalTo(Set.of("archive/text.txt", "archive/"))));
}
 
Example 6
Source File: SchemaToolTest.java    From kite with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void beforeClass() throws Exception {
  simpleSchema = AvroUtils.inputStreamToString(AvroDaoTest.class
      .getResourceAsStream("/SchemaTool/SimpleHBaseRecord.avsc"));
  simpleSchemaFile = FileUtils.toFile(AvroDaoTest.class
      .getResource("/SchemaTool/SimpleHBaseRecord.avsc"));
  
  HBaseTestUtils.getMiniCluster();
}
 
Example 7
Source File: VirtualFilesystemHandle.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean exists() throws IOException{
	File file = FileUtils.toFile(url);
	if (file != null) {
		return file.exists();
	}
	URLConnection connection = url.openConnection();
	if (connection instanceof SmbFile) {
		try (SmbFile smbFile = (SmbFile) connection) {
			return smbFile.exists();
		}
	}
	throw new IOException(ERROR_MESSAGE_CAN_NOT_HANDLE);
}
 
Example 8
Source File: ExiftoolUtilsTest.java    From TranskribusCore with GNU General Public License v3.0 5 votes vote down vote up
private void runExiftoolOnResource(final String resourceName) throws IOException, TimeoutException, InterruptedException {
	URL fileUrl = this.getClass().getClassLoader().getResource(resourceName);
	File file = FileUtils.toFile(fileUrl);
	logger.info("Found test resource: {}", file.exists());	
	
	String filename = file.getAbsolutePath();
	logger.info("Running exiftool on filename: {}", filename);
	
	ExiftoolUtil.runExiftool(file.getAbsolutePath());
}
 
Example 9
Source File: WriteBatcherJobReportTest.java    From java-client-api with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpBeforeClass() throws Exception {
	loadGradleProperties();
	server = getRestAppServerName();
    port = getRestAppServerPort();
    
	host = getRestAppServerHostName();
	hostNames = getHosts();
	createDB(dbName);
	Thread.currentThread().sleep(500L);
	int count = 1;
	for (String forestHost : hostNames) {
		createForestonHost(dbName + "-" + count, dbName, forestHost);
		count++;
		Thread.currentThread().sleep(500L);
	}
	// Create App Server if needed.
	createRESTServerWithDB(server, port);

	associateRESTServerWithDB(server, dbName);
	if (IsSecurityEnabled()) {
		enableSecurityOnRESTServer(server, dbName);
	}

	dbClient = getDatabaseClient(user, password, getConnType());
	dmManager = dbClient.newDataMovementManager();

	// JacksonHandle
	jsonNode = new ObjectMapper().readTree("{\"k1\":\"v1\"}");
	jacksonHandle = new JacksonHandle();
	jacksonHandle.set(jsonNode);

	// StringHandle
	stringTriple = "<abc>xml</abc>";
	stringHandle = new StringHandle(stringTriple);
	stringHandle.setFormat(Format.XML);

	// FileHandle
	fileJson = FileUtils.toFile(WriteHostBatcherTest.class.getResource(TEST_DIR_PREFIX + "dir.json"));
	fileHandle = new FileHandle(fileJson);
	fileHandle.setFormat(Format.JSON);

	// DomHandle
	DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
	DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
	docContent = docBuilder.parse(
			FileUtils.toFile(WriteHostBatcherTest.class.getResource(TEST_DIR_PREFIX + "xml-original-test.xml")));

	domHandle = new DOMHandle();
	domHandle.set(docContent);

	docMeta1 = new DocumentMetadataHandle().withCollections("Sample Collection 1").withProperty("docMeta-1", "true")
			.withQuality(1);
	docMeta1.setFormat(Format.XML);

	docMeta2 = new DocumentMetadataHandle().withCollections("Sample Collection 2").withProperty("docMeta-2", "true")
			.withQuality(0);
	docMeta2.setFormat(Format.XML);
}
 
Example 10
Source File: WriteHostBatcherTest.java    From java-client-api with Apache License 2.0 4 votes vote down vote up
@Test
public void testServerXQueryTransformFailure() throws Exception {
	System.out.println("In testServerXQueryTransformFailure method");
	
	final String query1 = "fn:count(fn:doc())";
	final AtomicInteger successCount = new AtomicInteger(0);

	final AtomicBoolean failState = new AtomicBoolean(false);
	final AtomicInteger failCount = new AtomicInteger(0);
	TransformExtensionsManager transMgr = dbClient.newServerConfigManager().newTransformExtensionsManager();
	ExtensionMetadata metadata = new ExtensionMetadata();
	metadata.setTitle("Adding attribute xquery Transform");
	metadata.setDescription("This plugin transforms an XML document by adding attribute to root node");
	metadata.setProvider("MarkLogic");
	metadata.setVersion("0.1");
	// get the transform file from add-attr-xquery-transform.xqy
	File transformFile = FileUtils
			.toFile(WriteHostBatcherTest.class.getResource(TEST_DIR_PREFIX + "add-attr-xquery-transform.xqy"));
	FileHandle transformHandle = new FileHandle(transformFile);
	transMgr.writeXQueryTransform("add-attr-xquery-transform", transformHandle, metadata);

	ServerTransform transform = new ServerTransform("add-attr-xquery-transform");
	transform.put("name", "Lang");
	transform.put("value", "English");

	String xmlStr1 = "<?xml  version=\"1.0\" encoding=\"UTF-8\"?><foo>This is so foo</foo>";
	String xmlStr2 = "<?xml  version=\"1.0\" encoding=\"UTF-8\"?><foo>This is so bar</foo";

	// Use WriteBatcher to write the same files.
	WriteBatcher ihb1 = dmManager.newWriteBatcher();
	ihb1.withBatchSize(1);
	ihb1.withTransform(transform);
	ihb1.onBatchSuccess(batch -> {

		successCount.getAndAdd(batch.getItems().length);

	}).onBatchFailure((batch, throwable) -> {
		failState.set(true);
		failCount.getAndAdd(batch.getItems().length);
	});

	StringHandle handleFoo = new StringHandle();
	handleFoo.set(xmlStr1);
	handleFoo.setFormat(Format.XML);

	StringHandle handleBar = new StringHandle();
	handleBar.set(xmlStr2);
	handleBar.setFormat(Format.XML);

	String uri1 = null;
	String uri2 = null;

	for (int i = 0; i < 4; i++) {
		uri1 = "foo" + i + ".xml";
		uri2 = "bar" + i + ".xml";
		ihb1.add(uri1, handleFoo).add(uri2, handleBar);
		;
	}
	// Flush
	ihb1.flushAndWait();
	Assert.assertTrue(dbClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 4);
	Assert.assertTrue(failState.get());
	Assert.assertTrue(successCount.intValue() == 4);
	Assert.assertTrue(failCount.intValue() == 4);

	clearDB(port);
	failCount.set(0);
	successCount.set(0);
	failState.set(false);

	// with non-existent transform

	ServerTransform transform1 = new ServerTransform("abcd");
	WriteBatcher ihb2 = dmManager.newWriteBatcher();
	ihb2.withBatchSize(1);
	ihb2.withTransform(transform1);
	ihb2.onBatchSuccess(batch -> {

		successCount.getAndAdd(batch.getItems().length);

	}).onBatchFailure((batch, throwable) -> {
		failState.set(true);
		failCount.getAndAdd(batch.getItems().length);
	});
	for (int i = 0; i < 4; i++) {
		uri1 = "foo" + i + ".xml";
		ihb2.add(uri1, handleFoo);
	}
	// Flush
	ihb2.flushAndWait();
	Assert.assertTrue(dbClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 0);
	Assert.assertTrue(failState.get());
	Assert.assertTrue(successCount.intValue() == 0);
	Assert.assertTrue(failCount.intValue() == 4);
}
 
Example 11
Source File: WriteHostBatcherTest.java    From java-client-api with Apache License 2.0 4 votes vote down vote up
@Test
public void testServerXQueryTransformSuccess() throws Exception {
	System.out.println("In testServerXQueryTransformSuccess method");
	
	final String query1 = "fn:count(fn:doc())";
	Assert.assertTrue(dbClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 0);
	final AtomicInteger successCount = new AtomicInteger(0);

	final AtomicBoolean failState = new AtomicBoolean(false);
	final AtomicInteger failCount = new AtomicInteger(0);
	TransformExtensionsManager transMgr = dbClient.newServerConfigManager().newTransformExtensionsManager();
	ExtensionMetadata metadata = new ExtensionMetadata();
	metadata.setTitle("Adding attribute xquery Transform");
	metadata.setDescription("This plugin transforms an XML document by adding attribute to root node");
	metadata.setProvider("MarkLogic");
	metadata.setVersion("0.1");
	// get the transform file from add-attr-xquery-transform.xqy
	File transformFile = FileUtils
			.toFile(WriteHostBatcherTest.class.getResource(TEST_DIR_PREFIX + "add-attr-xquery-transform.xqy"));
	FileHandle transformHandle = new FileHandle(transformFile);
	transMgr.writeXQueryTransform("add-attr-xquery-transform", transformHandle, metadata);

	ServerTransform transform = null;
	transform = new ServerTransform("add-attr-xquery-transform");
	transform.put("name", "Lang");
	transform.put("value", "English");

	String xmlStr1 = "<?xml  version=\"1.0\" encoding=\"UTF-8\"?><foo>This is so foo</foo>";
	String xmlStr2 = "<?xml  version=\"1.0\" encoding=\"UTF-8\"?><foo>This is so bar</foo>";

	// Use WriteBatcher to write the same files.
	WriteBatcher ihb1 = dmManager.newWriteBatcher();
	ihb1.withBatchSize(2);
	ihb1.withTransform(transform);
	ihb1.onBatchSuccess(batch -> {

		successCount.getAndAdd(batch.getItems().length);

	}).onBatchFailure((batch, throwable) -> {
		throwable.printStackTrace();
		failState.set(true);
		failCount.getAndAdd(batch.getItems().length);
	});
	dmManager.startJob(ihb1);
	StringHandle handleFoo = new StringHandle();
	handleFoo.set(xmlStr1);
	handleFoo.setFormat(Format.XML);

	StringHandle handleBar = new StringHandle();
	handleBar.set(xmlStr2);
	handleBar.setFormat(Format.XML);

	List<String> uris = new ArrayList<String>();
	String uri1 = null;
	String uri2 = null;

	for (int i = 0; i < 4; i++) {
		uri1 = "foo" + i + ".xml";
		uri2 = "bar" + i + ".xml";
		uris.add(uri1);
		uris.add(uri2);
		ihb1.addAs(uri1, handleFoo).addAs(uri2, handleBar);
	}
	ihb1.flushAndWait();
	dmManager.stopJob(ihb1);
	String[] uriArr = new String[8];
	uris.toArray(uriArr);
	int count = 0;
	DocumentPage page = dbClient.newDocumentManager().read(uriArr);
	DOMHandle dh = new DOMHandle();
	while (page.hasNext()) {
		DocumentRecord rec = page.next();
		rec.getContent(dh);
		if (dh.get().getElementsByTagName("foo").item(0).hasAttributes()) {
			System.out.println(dh.get().getElementsByTagName("foo").item(0).getTextContent());
			System.out.println(count);
			assertEquals("Attribute value should be English", "English",
					dh.get().getElementsByTagName("foo").item(0).getAttributes().item(0).getNodeValue());
			count++;
		}
	}

	Assert.assertFalse(failState.get());
	Assert.assertTrue(successCount.intValue() == 8);
	Assert.assertTrue(count == 8);
	Assert.assertTrue(dbClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 8);
}
 
Example 12
Source File: WriteBatcherJobReportTest.java    From java-client-api with Apache License 2.0 4 votes vote down vote up
@Test
public void testServerXQueryTransformSuccess() throws Exception {
	final String query1 = "fn:count(fn:doc())";
	Assert.assertTrue(dbClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 0);

	TransformExtensionsManager transMgr = dbClient.newServerConfigManager().newTransformExtensionsManager();
	ExtensionMetadata metadata = new ExtensionMetadata();
	metadata.setTitle("Adding attribute xquery Transform");
	metadata.setDescription("This plugin transforms an XML document by adding attribute to root node");
	metadata.setProvider("MarkLogic");
	metadata.setVersion("0.1");
	// get the transform file from add-attr-xquery-transform.xqy
	File transformFile = FileUtils
			.toFile(WriteHostBatcherTest.class.getResource(TEST_DIR_PREFIX + "add-attr-xquery-transform.xqy"));
	FileHandle transformHandle = new FileHandle(transformFile);
	transMgr.writeXQueryTransform("add-attr-xquery-transform", transformHandle, metadata);

	ServerTransform transform = new ServerTransform("add-attr-xquery-transform");
	transform.put("name", "Lang");
	transform.put("value", "English");

	String xmlStr1 = "<?xml  version=\"1.0\" encoding=\"UTF-8\"?><foo>This is so foo</foo>";
	String xmlStr2 = "<?xml  version=\"1.0\" encoding=\"UTF-8\"?><foo>This is so bar</foo>";

	// Use WriteBatcher to write the same files.

	WriteBatcher ihb1 = dmManager.newWriteBatcher();

	AtomicBoolean success = new AtomicBoolean(false);
	AtomicBoolean failure = new AtomicBoolean(false);

	ihb1.withBatchSize(10);
	ihb1.onBatchSuccess(batch -> {
		if (dmManager.getJobReport(writeTicket).getSuccessEventsCount() == 8) {
			if (dmManager.getJobReport(writeTicket).getSuccessBatchesCount() == 1) {
				if (dmManager.getJobReport(writeTicket).getFailureEventsCount() == 0) {
					if (dmManager.getJobReport(writeTicket).getFailureBatchesCount() == 0) {
						if (Math.abs(dmManager.getJobReport(writeTicket).getReportTimestamp().getTime().getTime()
								- Calendar.getInstance().getTime().getTime()) < 200) {
							System.out.println(dmManager.getJobReport(writeTicket).getReportTimestamp());
							success.set(true);
						}

					}
				}
			}
		}
	});
	ihb1.onBatchFailure((batch, throwable) -> {
		throwable.printStackTrace();
		failure.set(true);
	});

	writeTicket = dmManager.startJob(ihb1);

	StringHandle handleFoo = new StringHandle();
	handleFoo.set(xmlStr1);
	handleFoo.setFormat(Format.XML);

	StringHandle handleBar = new StringHandle();
	handleBar.set(xmlStr2);
	handleBar.setFormat(Format.XML);

	String uri1 = null;
	String uri2 = null;

	for (int i = 0; i < 4; i++) {
		uri1 = "foo" + i + ".xml";
		uri2 = "bar" + i + ".xml";
		ihb1.addAs(uri1, handleFoo).addAs(uri2, handleBar);
	}
	// Flush
	ihb1.flushAndWait();
	Assert.assertTrue(success.get());
	Assert.assertFalse(failure.get());
	Assert.assertTrue(dbClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 8);
}
 
Example 13
Source File: AgentDirBaseClassPathResolverTest.java    From pinpoint with Apache License 2.0 4 votes vote down vote up
private static String getClassLocation(Class<?> clazz) {
    URL location = CodeSourceUtils.getCodeLocation(clazz);
    logger.debug("codeSource.getCodeLocation:{}", location);
    File file = FileUtils.toFile(location);
    return file.getPath();
}
 
Example 14
Source File: MecqTest.java    From RAMPART with GNU General Public License v3.0 4 votes vote down vote up
@Test
public void testQT() throws InterruptedException, ProcessExecutionException, IOException, CommandExecutionException, ConanParameterException {

    File outputDir = temp.newFolder("qtTest");

    File cfgFile = FileUtils.toFile(this.getClass().getResource("/tools/test_rampart_1.cfg"));

    Mecq.Args mecqArgs = new Mecq.Args();
    mecqArgs.setOutputDir(outputDir);

    Mecq mecq = new Mecq(this.conanExecutorService, mecqArgs);

    when(conanExecutorService.getConanProcessService().execute(sickle, ec)).thenReturn(new DefaultExecutionResult("test", 0, null, null, -1));

    ReflectionTestUtils.setField(mecq, "conanExecutorService", conanExecutorService);

    ExecutionResult result = mecq.execute(ec);

    assertTrue(result.getExitCode() == 0);
}
 
Example 15
Source File: ImgFilenameFilterTest.java    From TranskribusCore with GNU General Public License v3.0 4 votes vote down vote up
@BeforeClass
public static void setup() {
	testDir = FileUtils.toFile(ImgFilenameFilterTest.class.getClassLoader().getResource("ImgFilenameFilterTest"));
}
 
Example 16
Source File: FixedInput.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private FileInputStream getFileInputStream( URL url ) throws FileNotFoundException {
  return new FileInputStream( FileUtils.toFile( url ) );
}
 
Example 17
Source File: LocalDocWriter.java    From TranskribusCore with GNU General Public License v3.0 4 votes vote down vote up
@Deprecated
	public static void createThumbsForDoc(TrpDoc doc, boolean overwrite) throws Exception {
		checkIfLocalDoc(doc);
		
		File thmbsDir = new File(doc.getMd().getLocalFolder().getAbsolutePath() + File.separator + LocalDocConst.THUMBS_FILE_SUB_FOLDER);
		FileUtils.forceMkdir(thmbsDir);
		
		int newHeight = LocalDocConst.THUMB_SIZE_HEIGHT;
		for (TrpPage p : doc.getPages()) {
			File imgFile = FileUtils.toFile(p.getUrl());
			if (imgFile == null) 
				throw new IOException("Cannot retrieve image url from: "+p.getUrl());
			
			File thumbsFile = FileUtils.toFile(p.getThumbUrl());
			if (thumbsFile == null)
				throw new IOException("Cannot retrieve thumbs url from: "+p.getThumbUrl());
			
			if (thumbsFile.exists() && !overwrite) // skip if already there and overwrite not specified 
				continue;
			
			logger.debug("creating thumb file: "+thumbsFile);
			long st = System.currentTimeMillis();
			
			if (true)  {
				
				
			}
			
			if (false) {
			BufferedImage originalImage = ImgUtils.readImage(imgFile);
			if (originalImage==null)
				throw new IOException("Cannot load image "+imgFile.getAbsolutePath());
			
			double sf = (double)newHeight / (double)originalImage.getHeight();
			int newWidth = (int)(sf * originalImage.getWidth());

			BufferedImage thmbImg = new BufferedImage(newWidth, newHeight, originalImage.getType());
			Graphics2D g = thmbImg.createGraphics();
			RenderingHints rh = new RenderingHints(
		             RenderingHints.KEY_INTERPOLATION,
		             RenderingHints.VALUE_INTERPOLATION_BICUBIC);
			g.setRenderingHints(rh);
			g.drawImage(originalImage, 0, 0, newWidth, newHeight, null);
			g.dispose();
//				logger.debug("thmbImg: "+originalImage+ " size: "+thmbImg.getWidth()+"x"+thmbImg.getHeight());
			
			if (!ImageIO.write(thmbImg, FilenameUtils.getExtension(thumbsFile.getName()), thumbsFile))
				throw new Exception("Could not write thumb file - no appropriate writer found!");
			}
			
		    logger.debug("created thumb file: "+thumbsFile.getAbsolutePath()+" time = "+(System.currentTimeMillis()-st));
		}
	}
 
Example 18
Source File: RampartConfigTest.java    From RAMPART with GNU General Public License v3.0 4 votes vote down vote up
@Test
public void setupTest() throws IOException, TaskExecutionException, InterruptedException {

    File testFile = FileUtils.toFile(RampartConfigTest.class.getResource("/config/rampart_config_1.xml"));

    /*RampartCLI rampart = new RampartCLI();
    rampart.setJobConfig(testFile);
    rampart.setSkipChecks(true);

    rampart.initialise();

    String kr0 = rampart.getArgs().getMassArgs().getMassJobArgList().get(0).getKmerRange().toString();   */



    //rampart.execute();

    assertTrue(true);
}
 
Example 19
Source File: ReportResources.java    From RAMPART with GNU General Public License v3.0 4 votes vote down vote up
public ReportResources() {
    this.templateFile = FileUtils.toFile(this.getClass().getResource("/data/report/template.tex"));
    this.imagesDir = FileUtils.toFile(this.getClass().getResource("/data/report/images/header.png")).getParentFile();
}
 
Example 20
Source File: ScalePageCoordinatesToImageDimension.java    From TranskribusCore with GNU General Public License v3.0 3 votes vote down vote up
private static void fixAltoMmToPx(final TrpDoc doc) throws IOException, JAXBException {
		

		for (TrpPage p : doc.getPages()) {

//			final double imgWidth = p.getWidth();
//			final double imgHeight = p.getHeight();

			File f = FileUtils.toFile(p.getCurrentTranscript().getUrl());
			PcGtsType pc = PageXmlUtils.unmarshal(f);
//			final double altoWidth = pc.getPage().getImageWidth();
//			final double altoHeight = pc.getPage().getImageHeight();

//			logger.info("Img: " + imgWidth + "x" + imgHeight + " | ALTO: " + altoWidth + "x" + altoHeight);
//			
//			double scaleX = (imgWidth / (altoWidth / 100f)) / 100f;
//			double scaleY = (imgHeight / (altoHeight / 100f)) / 100f;
			
//			logger.info("Scale factor X: " + scaleX);
//			logger.info("Scale factor Y: " + scaleY);
			
			TrpPageTypeUtils.applyAffineTransformation(pc.getPage(), 0, 0, 1.1811, 1.1811, 0);

			PageXmlUtils.marshalToFile(pc, f);
		}

	}