|Oracle® Fusion Middleware Developer's Guide for Oracle IRM Server
11g Release 1 (11.1.1)
Part Number E12326-02
When sealing content, it is useful to be able to look up the file extension that Oracle IRM Desktop uses. The content operations described later in this section provide useful operations for obtaining file extension information, such as looking up sealed file extensions.
Sealed content uses file extensions that differ from the ones used for unsealed files. For example, a PDF file has the file extension .pdf, whereas a sealed PDF file has the file extension .spdf. The sealed file extension allows Oracle IRM Desktop to identify what file format the sealed content is, and display appropriate sealed file icons. The table below shows some example file extensions and the corresponding sealed file extension.
Sealed content includes a MIME type in the sealed content metadata. This MIME type is used by Oracle IRM Desktop to identify the format of the unsealed content. The MIME type is an alternative way of detecting the file format when the content is not stored in a file (for example, a stream of data downloaded from a HTTP server). Unsealed MIME types vary and there are many examples where a single file format has more than one MIME type. For this reason the sealed content contains a sealed MIME type rather than the unsealed content MIME type. For example, a PDF file has the MIME type
application/pdf, whereas a sealed PDF file will have a MIME type of
application/vnd.sealedmedia.softseal.pdf added to the metadata.
Opening up sealed content in an editor will show that a sealed MIME type is added to the metadata. For example, the public header of a sealed PDF file:
<?xml version="1.0" ?> <content:PublicHeader xmlns:content="http://xmlns.oracle.com/irm/content" xmlns:classifications="http://xmlns.oracle.com/irm/classifications"> <contentDescription> ... <sealedMime>application/vnd.sealedmedia.softseal.pdf</sealedMime> ... </contentDescription> </content:PublicHeader>
The sealing server provides a web service that can be used to query file and MIME type information. Sealed content file format information is immutable, so consider retrieving this information once and using a local copy when processing sealed files. This will avoid potentially expensive remote calls to a sealing server.
When sealing a file a common scenario is to create the corresponding sealed file next to the original. The
getSealedFileName operation takes a path and file name or just a file name and provides the equivalent sealed file name.
ContentTypeOperations contentTypeOperations = new ContentTypeOperationsService().getContentTypeOperations(); String results = contentTypeOperations.getSealedFileName("/usr/home/john/sample.html");
In the example above the results of calling the method would be
A content type object contains all the file type information for content that can be sealed. The content type specifies the file extension(s), its sealed file extension, and the associated MIME types. Content type objects can be obtained using the file extension or the MIME type of the sealed or unsealed content.
ContentTypeOperations contentTypeOperations = new ContentTypeOperationsService().getContentTypeOperations(); ContentType results = contentTypeOperations.getContentTypeFromExtension("pdf");
The IRM Java API supplies a set of methods that can be used to query MIME type and file extension details when working with sealed content.
Given an unsealed file name, the corresponding sealed file name can be found using the
getSealedFileName operation. This method is useful when sealing content and deciding what the output file name should be.
import static oracle.irm.engine.content.type.ContentTypeOperationsInstance.getSealedFileName; .. String results = getSealedFileName("/usr/home/john/sample.html")
Given an unsealed or sealed file name, the MIME type and sealed file extension details can be found using the
import static oracle.irm.engine.content.type.ContentTypeOperationsInstance.getContentTypeFromExtension; import oracle.irm.engine.content.type.ContentType; .. ContentType results = getContentTypeFromExtension("pdf")