Sun Java System Messaging Server 6 2005Q4 Administration Guide

Conversion Channel Example

The CONVERSIONS mapping and set of conversion rules seen in examples below cause GIF, JPEG, and BITMAP files sent to the hypothetical channel tcp_docuprint to be converted into PostScript automatically. Several of these conversions use the hypothetical /usr/bin/ps-converter.sh to make that transformation. An additional rule that converts WordPerfect 5.1 files into Microsoft Word files is included.


CONVERSIONS  

    IN-CHAN=*;OUT-CHAN=tcp_docuprint;CONVERT    Yes

out-chan=ims-ms; in-type=application; in-subtype=wordperfect5.1; 
  out-type=application; out-subtype=msword; out-mode=block; 
  command="/bin/doc-convert -in=wp -out=msw   ’INPUT_FILE’  ’OUTPUT_FILE’"

out-chan=tcp_docuprint; in-type=image; in-subtype=gif; 
  out-type=application; out-subtype=postscript; out-mode=text; 
  command="/bin/ps-convert -in=gif -out=ps   ’INPUT_FILE’  ’OUTPUT_FILE’"

out-chan=tcp_docuprint; in-type=image; in-subtype=jpeg; 
  out-type=application; out-subtype=postscript; out-mode=text; 
  command="/bin/ps-convert -in=jpeg -out=ps  ’INPUT_FILE’  ’OUTPUT_FILE’"

out-chan=tcp_docuprint; in-type=image; in-subtype=bitmap; 
  out-type=application; out-subtype=postscript; out-mode=text; 
  command="/bin/ps-convert -in=bmp -out=ps   ’INPUT_FILE’  ’OUTPUT_FILE’"

The conversion parameters are shown below:

Table 13–6 Conversion Parameters

Parameter  

Description  

Qualifying Parameters (Specifies the parameters for which the message must match before it will be converted.)

OUT-CHAN,OUT-CHANNEL

Output channel to match for conversion (wildcards allowed). The conversion specified by this entry is performed only if the message is destined for this specified channel. 

IN-CHAN,IN-CHANNEL

Input channel to match for conversion (wildcards allowed). The conversion specified by this entry is only performed if the message is coming from the specified channel. 

IN-TYPE

Input MIME type to match for conversion (wildcards allowed). The conversion specified is performed only if this field matches the MIME type of the body part. 

IN-SUBTYPE

Input MIME subtype to match for conversion (wildcards allowed). The conversion specified by this entry is performed only if this field matches the MIME subtype of the body part. 

IN-PARAMETER-NAME-n

Input MIME Content-Type parameter name that must match for conversion; n = 0, 1, 2.... This parameter can be used with IN-PARAMETER-VALUE-n to distinctly identify a parameter by its name and the value that it holds.

IN-PARAMETER-VALUE-n

Input MIME Content-Type parameter value of corresponding IN-PARAMETER-NAME that must match for conversion. The conversion specified by this entry is performed only if this field matches the corresponding parameter in the body part's Content-Type parameter list. Wildcards allowed.

IN-PARAMETER-DEFAULT-n

Input MIME Content-Type parameter value default if parameter is not present. This value is used as a default for the IN-PARAMETER-VALUE-n test when no such parameter is specified in the body part.

IN-DISPOSITION

Input MIME Content-Disposition to match for conversion.

IN-DPARAMETER-NAME-n

Input MIME Content-Disposition parameter name that must match for conversion; n = 0, 1, 2.... This parameter can be used with IN-DPARAMETER-VALUE-n to distinctly identify a parameter by its name and the value that it holds.

IN-DPARAMETER-VALUE-n

Input MIME Content-Disposition parameter value of corresponding IN-DPARAMETER-NAME that must match for conversion. The conversion specified by this entry is performed only if this field matches the corresponding parameter in the body part's Content-Disposition: parameter list. Wildcards allowed.

IN-DPARAMETER-DEFAULT-n

Input MIME Content-Disposition parameter value default if parameter is not present. This value is used as a default for the IN-DPARAMETER-VALUE-n test when no such parameter is specified in the body part.

IN-DESCRIPTION

Input MIME Content-Description to match for conversion.

IN-SUBJECT

Input Subject from enclosing MESSAGE/RFC822 part.

TAG

Input tag, as set by a mail list CONVERSION_TAG parameter.

Output Parameters (Specify the body part’s post-conversion output settings.)

OUT-TYPE

Output MIME type if it is different than the input type. 

OUT-SUBTYPE

Output MIME subtype if it is different than the input subtype. 

OUT-PARAMETER-NAME-n

Output MIME Content-Type parameter name; n = 0, 1, 2...

OUT-PARAMETER-VALUE-n

Output MIME Content-Type parameter value corresponding to OUT-PARAMETER-NAME-n.

PARAMETER-COPY-n

A list of the Content-Type parameters to copy from the input body part's Content-Type parameter list to the output body part's Content-Type: parameter list; n=0, 1, 2... Uses the same name of the MIME parameter to copy, as matched by an IN-PARAMETER-NAME-n clause.

OUT-DISPOSITION

Output MIME Content-Disposition if it is different than the input MIME Content-Disposition.

OUT-DPARAMETER-NAME-n

Output MIME Content-Disposition parameter name; n=0, 1, 2...

OUT-DPARAMETER-VALUE-n

Output MIME Content-Disposition parameter value corresponding to OUT-DPARAMETER-NAME-n.

DPARAMETER-COPY-n

A list of the Content-Disposition: parameters to copy from the input body part’s Content-Disposition: parameter list to the output body part’s Content-Disposition: parameter list; n = 0, 1, 2,... Takes as argument the name of the MIME parameter to copy, as matched by an IN-PARAMETER-NAME-n clause. Wildcards may be used in the argument. In particular, an argument of * means to copy all the original Content-Disposition: parameters.

OUT-DESCRIPTION

Output MIME Content-Description if it is different than the input MIME Content-Description.

OUT-MODE

Mode in which to read and store the converted file. This should be BLOCK (binaries and executables) or TEXT.

OUT-ENCODING

Encoding to apply to the converted file when the message is reassembled. 

Action Parameters (Specify an action to take on a message part.)

COMMAND

Command to execute to perform conversion. Command to execute to perform conversion. This parameter is required; if no command is specified, the entry is ignored. Use / to specify paths, not \. Example: command="D:/tmp/mybat.bat"

DELETE

0 or 1. If this flag is set, the message part is deleted. (If this is the only part in a message, then a single empty text part is substituted.) 

RELABEL

RELABEL=1 will relabel the MIME label to whatever is specified by the Output parameters. Relabel=0 does nothing. Usually relabelling is done on mislabeled parts (example: from Content-type: application/octet-stream to Content-type: application/msword) so users can “doubleclick” to open a part, rather than having to save the part to a file and open it with a program.

SERVICE-COMMAND

SERVICE-COMMAND=command will execute a site-supplied procedure that will operate on entire MIME message (MIME headers and content body part). Also, unlike other CHARSET-CONVERSION operations or conversion channel operations, the service-command are expected to do their own MIME disassembly, decoding, re-encoding, and reassembly. Note that this flag causes an entry to be ignored during conversion channel processing; SERVICE-COMMAND entries are instead performed during character set conversion processing. Use / to specify paths, not \. Example: command="D:/tmp/mybat.bat"

Information Passing Parameters (Used to pass information to and from the site-supplied program.)

DPARAMETER-SYMBOL-n

Environment variable into which the Content-disposition parameter value, if present, will be stored; n = 0, 1, 2,... Each DPARAMETER-SYMBOL-n is extracted from the Content-Disposition: parameter list in order (n=0 is first parameter, n=2 second, etc.) and placed in the specified environment variable prior to executing the site-supplied program.

PARAMETER-SYMBOL-n

Environment variable into which the Content-Type parameter value, if present, will be stored; n = 0, 1, 2... Each PARAMETER-SYMBOL-n is extracted from the Content-Type: parameter list in order (n=0 is first parameter, n=2 second, etc.) and placed in an environment variable of the same name prior to executing the site-supplied program. Takes as argument the variable name into which the MIME parameter to convert, as matched by an IN-PARAMETER-NAME-n clause.

MESSAGE-HEADER-FILE

Writes all, part, or none of the original header of a message to the file specified by the environmental variable MESSAGE_HEADERS. If set to 1, the original header of the immediately enclosing body part are written to the file specified by the environmental variable MESSAGE_HEADERS. If set to 2, the original header of the message as a whole (the outermost message header) are written to the file.

ORIGINAL-HEADER-FILE

0 or 1. If set to 1, the original header of the enclosing MESSAGE/RFC822 part (not just the body part) are written to the file represented by the environmental variable ORIGINAL_HEADERS.

OVERRIDE-HEADER-FILE

0 or 1. If set to 1, then MIME header lines are read by the conversion channel from the environmental variable OUTPUT_HEADERS, overriding the original header lines in the enclosing MIME part.

OVERRIDE-OPTION-FILE

If OVERRIDE-OPTION-FILE=1, the conversion channel reads options from the OUTPUT_OPTIONS environmental variable.

PART-NUMBER

Dotted integers: a. b. c... The part number of the MIME body part.