Class SapListenerImpl<M>

java.lang.Object
org.frankframework.extensions.sap.jco3.SapFunctionFacade
org.frankframework.extensions.sap.jco3.SapListenerImpl<M>
All Implemented Interfaces:
com.sap.conn.idoc.jco.JCoIDocHandler, com.sap.conn.idoc.jco.JCoIDocHandlerFactory, com.sap.conn.jco.server.JCoServerErrorListener, com.sap.conn.jco.server.JCoServerExceptionListener, com.sap.conn.jco.server.JCoServerFunctionHandler, com.sap.conn.jco.server.JCoServerTIDHandler, FrankElement, HasApplicationContext, HasName, HasPhysicalDestination, IConfigurable, IListener<M>, IPushingListener<M>, IScopeProvider, NameAware, ISapFunctionFacade, ISapListener<M>, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
SapListener, SapListener

public abstract class SapListenerImpl<M> extends SapFunctionFacade implements ISapListener<M>, com.sap.conn.jco.server.JCoServerFunctionHandler, com.sap.conn.jco.server.JCoServerTIDHandler, com.sap.conn.idoc.jco.JCoIDocHandlerFactory, com.sap.conn.idoc.jco.JCoIDocHandler, com.sap.conn.jco.server.JCoServerExceptionListener, com.sap.conn.jco.server.JCoServerErrorListener
Implementation of a IPushingListener, that enables a Receiver to receive messages from SAP-systems. In SAP, the function to be called is an RFC-function to the destination that is registered using progid. N.B. If no requestFieldIndex or requestFieldName is specified, input is converted to xml; If no replyFieldIndex or replyFieldName is specified, output is converted from xml.

Since:
5.0
Author:
Gerrit van Brakel, Jaco de Groot
See Also:
  • "http://help.sap.com/saphelp_nw04/helpdata/en/09/c88442a07b0e53e10000000a155106/frameset.htm"
  • Constructor Details

    • SapListenerImpl

      public SapListenerImpl()
  • Method Details

    • configure

      public void configure() throws ConfigurationException
      Description copied from interface: IConfigurable
      Configure this component.

      configure() is called once at startup of the framework in the configure method of the owner of this IConfigurable. Purpose of this method is to check whether the static configuration of the object is correct. As much as possible class-instantiating should take place in the configure(), to improve performance.

      In the case of a container, this will propagate the configure signal to all components that apply.

      Specified by:
      configure in interface IConfigurable
      Overrides:
      configure in class SapFunctionFacade
      Throws:
      ConfigurationException - in case it was not able to configure the component.
    • start

      public void start()
      Description copied from interface: IListener
      Prepares the listener for receiving messages. start() is called once each time the listener is started.
      Specified by:
      start in interface IListener<M>
    • stop

      public void stop()
      Description copied from interface: IListener
      Close all resources used for listening. Called once each time the listener is stopped.
      Specified by:
      stop in interface IListener<M>
    • getIDocHandler

      public com.sap.conn.idoc.jco.JCoIDocHandler getIDocHandler(com.sap.conn.idoc.jco.JCoIDocServerContext serverCtx)
      Specified by:
      getIDocHandler in interface com.sap.conn.idoc.jco.JCoIDocHandlerFactory
    • getPhysicalDestinationName

      public String getPhysicalDestinationName()
      Specified by:
      getPhysicalDestinationName in interface HasPhysicalDestination
      Overrides:
      getPhysicalDestinationName in class SapFunctionFacade
    • wrapRawMessage

      public RawMessageWrapper<M> wrapRawMessage(M message, PipeLineSession session)
      Description copied from interface: IPushingListener
      Wrap a raw message in a MessageWrapper. Populate PipeLineSession with properties from the message.
      Specified by:
      wrapRawMessage in interface IPushingListener<M>
      Parameters:
      message - The raw message data, unwrapped
      session - PipeLineSession to populate with properties from the message.
      Returns:
      Wrapped raw message
    • extractMessage

      public Message extractMessage(@Nonnull RawMessageWrapper<M> rawMessageWrapper, @Nonnull Map<String,Object> context)
      Called by handler.processRawMessage, NEVER by handler.processRequest. M == ALWAYS JCoFunction
      Specified by:
      extractMessage in interface IListener<M>
      Parameters:
      rawMessageWrapper - The RawMessageWrapper from which to extract the Message.
      context - Context to populate. Either a PipeLineSession or a Map threadContext depending on caller.
      Returns:
      input Message for adapter.
    • afterMessageProcessed

      public void afterMessageProcessed(PipeLineResult processResult, RawMessageWrapper<M> rawMessageWrapper, PipeLineSession pipeLineSession) throws ListenerException
      Description copied from interface: IListener
      Called to perform actions (like committing or sending a reply) after a message has been processed by the Pipeline.
      Specified by:
      afterMessageProcessed in interface IListener<M>
      Throws:
      ListenerException
    • handleRequest

      public void handleRequest(com.sap.conn.jco.server.JCoServerContext jcoServerContext, com.sap.conn.jco.JCoFunction jcoFunction) throws com.sap.conn.jco.AbapException
      JCoServerFunctionHandler M == JCoFunction
      Specified by:
      handleRequest in interface com.sap.conn.jco.server.JCoServerFunctionHandler
      Throws:
      com.sap.conn.jco.AbapException
    • handleRequest

      public void handleRequest(com.sap.conn.jco.server.JCoServerContext serverCtx, com.sap.conn.idoc.IDocDocumentList documentList)
      JCoIDocHandler M == String
      Specified by:
      handleRequest in interface com.sap.conn.idoc.jco.JCoIDocHandler
    • setSapSystemName

      @Mandatory public void setSapSystemName(String string)
      Description copied from class: SapFunctionFacade
      Name of the SapSystem used by this object
      Specified by:
      setSapSystemName in interface ISapFunctionFacade
      Overrides:
      setSapSystemName in class SapFunctionFacade
    • setProgid

      @Mandatory public void setProgid(String string)
      Name of the RFC-destination to be registered in the SAP system
      Specified by:
      setProgid in interface ISapListener<M>
    • setConnectionCount

      public void setConnectionCount(String connectionCount)
      The number of connections that should be registered at the gateway
      Specified by:
      setConnectionCount in interface ISapListener<M>
      Default value
      2
    • setHandler

      public void setHandler(IMessageHandler<M> handler)
      Description copied from interface: IPushingListener
      Set the handler that will do the processing of the message. Each of the received messages must be pushed through handler.processMessage()
      Specified by:
      setHandler in interface IPushingListener<M>
    • setExceptionListener

      public void setExceptionListener(IbisExceptionListener listener)
      Description copied from interface: IPushingListener
      Set a (single) listener that will be notified of any exceptions. The listener should use this listener to notify the receiver of any exception that occurs outside the processing of a message.
      Specified by:
      setExceptionListener in interface IPushingListener<M>
    • serverExceptionOccurred

      public void serverExceptionOccurred(com.sap.conn.jco.server.JCoServer server, String connectionID, com.sap.conn.jco.server.JCoServerContextInfo serverCtx, Exception e)
      JCoServerExceptionListener
      Specified by:
      serverExceptionOccurred in interface com.sap.conn.jco.server.JCoServerExceptionListener
    • serverErrorOccurred

      public void serverErrorOccurred(com.sap.conn.jco.server.JCoServer server, String connectionID, com.sap.conn.jco.server.JCoServerContextInfo serverCtx, Error e)
      JCoServerErrorListener
      Specified by:
      serverErrorOccurred in interface com.sap.conn.jco.server.JCoServerErrorListener
    • checkTID

      public boolean checkTID(com.sap.conn.jco.server.JCoServerContext serverCtx, String tid)
      SAP JCo.Server javadoc says: This function will be invoked when a transactional RFC is being called from a SAP R/3 system. The function has to store the TID in permanent storage and return true. The method has to return false if the a transaction with this ID has already been process. Throw an exception if anything goes wrong. The transaction processing will be aborted thereafter. Derived servers must override this method to actually implement the transaction ID management.
      Specified by:
      checkTID in interface com.sap.conn.jco.server.JCoServerTIDHandler
      Parameters:
      tid - the transaction ID
      Returns:
      true if the ID is valid and not in use otherwise, false otherwise
    • confirmTID

      public void confirmTID(com.sap.conn.jco.server.JCoServerContext serverCtx, String tid)
      SAP JCo.Server javadoc says: This function will be called after the local transaction has been completed. All resources assiciated with this TID can be released. Derived servers must override this method to actually implement the transaction ID management.
      Specified by:
      confirmTID in interface com.sap.conn.jco.server.JCoServerTIDHandler
      Parameters:
      tid - the transaction ID
    • commit

      public void commit(com.sap.conn.jco.server.JCoServerContext serverCtx, String tid)
      SAP JCo.Server javadoc says: This function will be called after all RFC functions belonging to a certain transaction have been successfully completed. Derived servers can override this method to locally commit the transaction.
      Specified by:
      commit in interface com.sap.conn.jco.server.JCoServerTIDHandler
      Parameters:
      tid - the transaction ID
    • rollback

      public void rollback(com.sap.conn.jco.server.JCoServerContext serverCtx, String tid)
      SAP JCo.Server javadoc says: This function will be called if an error in one of the RFC functions belonging to a certain transaction has occurred. Derived servers can override this method to locally rollback the transaction.
      Specified by:
      rollback in interface com.sap.conn.jco.server.JCoServerTIDHandler
      Parameters:
      tid - the transaction ID
    • getFunctionName

      protected String getFunctionName()
      We don't use functions when receiving SAP messages
      Specified by:
      getFunctionName in class SapFunctionFacade
    • getIDocXMLProcessor

      protected com.sap.conn.idoc.IDocXMLProcessor getIDocXMLProcessor()