jeremias 2005/02/10 02:47:11
Modified: src/java/org/apache/fop/pdf PDFEncryptionManager.java
src/java/org/apache/fop/render/pdf PDFRenderer.java
Log:
Remove dependency of pdf package to the FOP user agent.
Revision Changes Path
1.5 +6 -10
xml-fop/src/java/org/apache/fop/pdf/PDFEncryptionManager.java
Index: PDFEncryptionManager.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/pdf/PDFEncryptionManager.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PDFEncryptionManager.java 31 Mar 2004 10:55:06 -0000 1.4
+++ PDFEncryptionManager.java 10 Feb 2005 10:47:11 -0000 1.5
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,6 @@
import java.security.Security;
import org.apache.commons.logging.Log;
-import org.apache.fop.apps.FOUserAgent;
/**
* This class acts as a factory for PDF encryption support. It enables the
@@ -38,7 +37,7 @@
*/
public static boolean isJCEAvailable() {
try {
- Class clazz = Class.forName("javax.crypto.Cipher");
+ /*Class clazz =*/ Class.forName("javax.crypto.Cipher");
return true;
} catch (ClassNotFoundException e) {
return false;
@@ -71,20 +70,17 @@
* Sets up PDF encryption if PDF encryption is requested by registering
* a <code>PDFEncryptionParams</code> object with the user agent and if
* the necessary cryptographic support is available.
- * @param userAgent the user agent
+ * @param params the PDF encryption params or null to disable encryption
* @param pdf the PDF document to setup encryption for
* @param log the logger to send warnings to
*/
- public static void setupPDFEncryption(FOUserAgent userAgent,
+ public static void setupPDFEncryption(PDFEncryptionParams params,
PDFDocument pdf,
Log log) {
- if (userAgent == null) {
- throw new NullPointerException("User agent must not be null");
- }
if (pdf == null) {
throw new NullPointerException("PDF document must not be null");
}
- if (userAgent.getPDFEncryptionParams() != null) {
+ if (params != null) {
if (!checkAvailableAlgorithms()) {
if (isJCEAvailable()) {
log.warn("PDF encryption has been requested, JCE is "
@@ -97,7 +93,7 @@
+ "unavailable! The PDF won't be encrypted.");
}
}
- pdf.setEncryption(userAgent.getPDFEncryptionParams());
+ pdf.setEncryption(params);
}
}
1.78 +2 -1
xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java
Index: PDFRenderer.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- PDFRenderer.java 25 Jan 2005 12:53:29 -0000 1.77
+++ PDFRenderer.java 10 Feb 2005 10:47:11 -0000 1.78
@@ -257,7 +257,8 @@
this.pdfDoc.outputHeader(stream);
//Setup encryption if necessary
- PDFEncryptionManager.setupPDFEncryption(userAgent, this.pdfDoc,
getLogger());
+ PDFEncryptionManager.setupPDFEncryption(
+ userAgent.getPDFEncryptionParams(), this.pdfDoc,
getLogger());
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]