Class SwiftMxDataFormat

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.DataFormat, org.apache.camel.spi.DataFormatName, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

    @Dataformat("swiftMx")
    @Metadata(firstVersion="3.20.0",
              title="SWIFT MX")
    public class SwiftMxDataFormat
    extends org.apache.camel.support.service.ServiceSupport
    implements org.apache.camel.spi.DataFormat, org.apache.camel.spi.DataFormatName
    SwiftMxDataFormat is a specific DataFormat leveraging Prowide ISO 20022 to encode and decode SWIFT MX messages.
    • Field Summary

      • Fields inherited from class org.apache.camel.support.service.BaseService

        BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
    • Constructor Summary

      Constructors 
      Constructor Description
      SwiftMxDataFormat()
      Constructs a SwiftMxDataFormat with the default configuration.
      SwiftMxDataFormat​(boolean writeInJson, com.prowidesoftware.swift.model.MxId readMessageId, com.prowidesoftware.swift.model.mx.MxReadConfiguration readConfig)
      Constructs a SwiftMxDataFormat with the given parameters.
      SwiftMxDataFormat​(com.prowidesoftware.swift.model.mx.MxWriteConfiguration writeConfig, com.prowidesoftware.swift.model.MxId readMessageId, com.prowidesoftware.swift.model.mx.MxReadConfiguration readConfig)
      Constructs a SwiftMxDataFormat with the given parameters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String getDataFormatName()  
      com.prowidesoftware.swift.model.mx.MxReadConfiguration getReadConfig()  
      com.prowidesoftware.swift.model.MxId getReadMessageId()  
      com.prowidesoftware.swift.model.mx.MxWriteConfiguration getWriteConfig()  
      void init()  
      boolean isWriteInJson()  
      void marshal​(org.apache.camel.Exchange exchange, Object object, OutputStream stream)  
      void setReadConfig​(Object readConfig)  
      void setReadMessageId​(com.prowidesoftware.swift.model.MxId readMessageId)  
      void setWriteConfig​(Object writeConfig)  
      void setWriteInJson​(boolean writeInJson)  
      Object unmarshal​(org.apache.camel.Exchange exchange, InputStream stream)  
      • Methods inherited from class org.apache.camel.support.service.BaseService

        build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getStatus, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
      • Methods inherited from interface org.apache.camel.Service

        build, close, start, stop
      • Methods inherited from interface org.apache.camel.ShutdownableService

        shutdown
      • Methods inherited from interface org.apache.camel.StatefulService

        getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
      • Methods inherited from interface org.apache.camel.SuspendableService

        isSuspended, resume, suspend
    • Constructor Detail

      • SwiftMxDataFormat

        public SwiftMxDataFormat()
        Constructs a SwiftMxDataFormat with the default configuration.
      • SwiftMxDataFormat

        public SwiftMxDataFormat​(boolean writeInJson,
                                 com.prowidesoftware.swift.model.MxId readMessageId,
                                 com.prowidesoftware.swift.model.mx.MxReadConfiguration readConfig)
        Constructs a SwiftMxDataFormat with the given parameters.
        Parameters:
        writeInJson - the flag indicating that messages must be marshalled in a JSON format.
        readMessageId - the type of MX message to produce when unmarshalling an input stream. If not set, it will be automatically detected from the namespace used.
        readConfig - the specific configuration to use when unmarshalling an input stream.
      • SwiftMxDataFormat

        public SwiftMxDataFormat​(com.prowidesoftware.swift.model.mx.MxWriteConfiguration writeConfig,
                                 com.prowidesoftware.swift.model.MxId readMessageId,
                                 com.prowidesoftware.swift.model.mx.MxReadConfiguration readConfig)
        Constructs a SwiftMxDataFormat with the given parameters.
        Parameters:
        writeConfig - the specific configuration to use when marshalling a message.
        readMessageId - the type of MX message to produce when unmarshalling an input stream. If not set, it will be automatically detected from the namespace used.
        readConfig - the specific configuration to use when unmarshalling an input stream.
    • Method Detail

      • getDataFormatName

        public String getDataFormatName()
        Specified by:
        getDataFormatName in interface org.apache.camel.spi.DataFormatName
      • marshal

        public void marshal​(org.apache.camel.Exchange exchange,
                            Object object,
                            OutputStream stream)
                     throws Exception
        Specified by:
        marshal in interface org.apache.camel.spi.DataFormat
        Throws:
        Exception
      • unmarshal

        public Object unmarshal​(org.apache.camel.Exchange exchange,
                                InputStream stream)
                         throws Exception
        Specified by:
        unmarshal in interface org.apache.camel.spi.DataFormat
        Throws:
        Exception
      • init

        public void init()
        Specified by:
        init in interface org.apache.camel.Service
        Overrides:
        init in class org.apache.camel.support.service.BaseService
      • getWriteConfig

        public com.prowidesoftware.swift.model.mx.MxWriteConfiguration getWriteConfig()
        Returns:
        the specific configuration to use when marshalling a message. Ignored if writeInJson is set to true.
      • setWriteConfig

        public void setWriteConfig​(Object writeConfig)
      • getReadMessageId

        public com.prowidesoftware.swift.model.MxId getReadMessageId()
        Returns:
        the type of MX message to produce when unmarshalling an input stream. If not set, it will be automatically detected from the namespace used.
      • setReadMessageId

        public void setReadMessageId​(com.prowidesoftware.swift.model.MxId readMessageId)
      • getReadConfig

        public com.prowidesoftware.swift.model.mx.MxReadConfiguration getReadConfig()
        Returns:
        the specific configuration to use when unmarshalling an input stream.
      • setReadConfig

        public void setReadConfig​(Object readConfig)
      • isWriteInJson

        public boolean isWriteInJson()
        Returns:
        true if messages must be marshalled in a JSON format, false otherwise.
      • setWriteInJson

        public void setWriteInJson​(boolean writeInJson)