public class

CRC32Module

extends Object
java.lang.Object
   ↳ org.mule.modules.security.crc32.CRC32Module
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

A cyclic redundancy check (CRC) is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to raw data. CRCs are specifically designed to protect against common types of errors on communication channels, where they can provide quick and reasonable assurance of the integrity of messages delivered.

{@sample.config INCLUDE_ERROR} {@sample.config INCLUDE_ERROR}

Summary

Fields
private static final Logger LOGGER
private ExpressionManager expressionManager
private String targetExpression The expression where to store the result of the calculated CRC32 produced by this#calculate(Object, MuleEvent)
private boolean targetExpressionValidated
Public Constructors
CRC32Module()
Public Methods
void calculate(Object input, MuleEvent muleEvent)
Calculates the CRC32 checksum for the given input and stores that value in the targetExpression defined in this#targetExpression To calculate the checksum on the input, it's going to transform it to a byte array by invoking the toByteArray on the object, if one exists, or by serializing it.
void checkLicense()
Object filter(long expectedChecksum, Object input, SourceCallback afterChain)
Filters objects with a different checksum than the expected one.
String getTargetExpression()
void setExpressionManager(ExpressionManager expressionManager)
void setTargetExpression(String targetExpression)
[Expand]
Inherited Methods
From class java.lang.Object

Fields

private static final Logger LOGGER

private ExpressionManager expressionManager

private String targetExpression

The expression where to store the result of the calculated CRC32 produced by this#calculate(Object, MuleEvent)

private boolean targetExpressionValidated

Public Constructors

public CRC32Module ()

Public Methods

public void calculate (Object input, MuleEvent muleEvent)

Calculates the CRC32 checksum for the given input and stores that value in the targetExpression defined in this#targetExpression To calculate the checksum on the input, it's going to transform it to a byte array by invoking the toByteArray on the object, if one exists, or by serializing it.

Parameters
input The object on which to calculate the checksum
muleEvent The muleEvent to process
Throws
IOException if an error occurs while calculating the checksum

public void checkLicense ()

Throws
InitialisationException

public Object filter (long expectedChecksum, Object input, SourceCallback afterChain)

Filters objects with a different checksum than the expected one. To calculate the checksum on the input, it's going to transform it to a byte array by invoking the toByteArray on the object, if one exists, or by serializing it.

Parameters
expectedChecksum The expected checksum value for the given input
input Input to be validated
afterChain MP chain
Returns
  • returns null if the validation fails
Throws
Exception in case of error calculating the input checksum

public String getTargetExpression ()

public void setExpressionManager (ExpressionManager expressionManager)

Parameters
expressionManager

public void setTargetExpression (String targetExpression)

Parameters
targetExpression