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:
-
Field Summary
Fields inherited from class org.frankframework.extensions.sap.jco3.SapFunctionFacade
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterMessageProcessed(PipeLineResult processResult, RawMessageWrapper<M> rawMessageWrapper, PipeLineSession pipeLineSession) Called to perform actions (like committing or sending a reply) after a message has been processed by the Pipeline.booleanSAP JCo.Server javadoc says: This function will be invoked when a transactional RFC is being called from a SAP R/3 system.voidSAP JCo.Server javadoc says: This function will be called after all RFC functions belonging to a certain transaction have been successfully completed.voidConfigure this component.voidconfirmTID(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.extractMessage(RawMessageWrapper<M> rawMessageWrapper, Map<String, Object> context) Called by handler.processRawMessage, NEVER by handler.processRequest.protected StringWe don't use functions when receiving SAP messagescom.sap.conn.idoc.jco.JCoIDocHandlergetIDocHandler(com.sap.conn.idoc.jco.JCoIDocServerContext serverCtx) protected com.sap.conn.idoc.IDocXMLProcessorvoidhandleRequest(com.sap.conn.jco.server.JCoServerContext serverCtx, com.sap.conn.idoc.IDocDocumentList documentList) JCoIDocHandler M == StringvoidhandleRequest(com.sap.conn.jco.server.JCoServerContext jcoServerContext, com.sap.conn.jco.JCoFunction jcoFunction) JCoServerFunctionHandler M == JCoFunctionvoidSAP 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.voidserverErrorOccurred(com.sap.conn.jco.server.JCoServer server, String connectionID, com.sap.conn.jco.server.JCoServerContextInfo serverCtx, Error e) JCoServerErrorListenervoidserverExceptionOccurred(com.sap.conn.jco.server.JCoServer server, String connectionID, com.sap.conn.jco.server.JCoServerContextInfo serverCtx, Exception e) JCoServerExceptionListenervoidsetConnectionCount(String connectionCount) The number of connections that should be registered at the gatewayvoidsetExceptionListener(IbisExceptionListener listener) Set a (single) listener that will be notified of any exceptions.voidsetHandler(IMessageHandler<M> handler) Set the handler that will do the processing of the message.voidName of the RFC-destination to be registered in the SAP systemvoidsetSapSystemName(String string) Name of theSapSystemused by this objectvoidstart()Prepares the listener for receiving messages.voidstop()Close all resources used for listening.wrapRawMessage(M message, PipeLineSession session) Wrap a raw message in a MessageWrapper.Methods inherited from class org.frankframework.extensions.sap.jco3.SapFunctionFacade
calculateStaticFieldIndices, closeFacade, findFieldIndex, functionCall2message, functionResult2message, getCorrelationIdFromField, getFunctionTemplate, getFunctionTemplate, getLogPrefix, getSapSystem, getSapSystem, message2FunctionCall, message2FunctionResult, openFacade, setCorrelationIdFieldIndex, setCorrelationIdFieldName, setName, setParameters, setReplyFieldIndex, setReplyFieldName, setRequestFieldIndex, setRequestFieldNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContextMethods inherited from interface org.frankframework.core.FrankElement
addConfigWarningMethods inherited from interface org.frankframework.core.HasApplicationContext
getApplicationContext, getConfigurationClassLoaderMethods inherited from interface org.frankframework.extensions.sap.ISapFunctionFacade
setCorrelationIdFieldIndex, setCorrelationIdFieldName, setReplyFieldIndex, setReplyFieldName, setRequestFieldIndex, setRequestFieldName
-
Constructor Details
-
SapListenerImpl
public SapListenerImpl()
-
-
Method Details
-
configure
Description copied from interface:IConfigurableConfigure this component.configure()is called once at startup of the framework in the configure method of the owner of thisIConfigurable. 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 theconfigure(), to improve performance.In the case of a container, this will propagate the configure signal to all components that apply.
- Specified by:
configurein interfaceIConfigurable- Overrides:
configurein classSapFunctionFacade- Throws:
ConfigurationException- in case it was not able to configure the component.
-
start
public void start()Description copied from interface:IListenerPrepares the listener for receiving messages.start()is called once each time the listener is started. -
stop
public void stop()Description copied from interface:IListenerClose all resources used for listening. Called once each time the listener is stopped. -
getIDocHandler
public com.sap.conn.idoc.jco.JCoIDocHandler getIDocHandler(com.sap.conn.idoc.jco.JCoIDocServerContext serverCtx) - Specified by:
getIDocHandlerin interfacecom.sap.conn.idoc.jco.JCoIDocHandlerFactory
-
getPhysicalDestinationName
- Specified by:
getPhysicalDestinationNamein interfaceHasPhysicalDestination- Overrides:
getPhysicalDestinationNamein classSapFunctionFacade
-
wrapRawMessage
Description copied from interface:IPushingListenerWrap a raw message in a MessageWrapper. PopulatePipeLineSessionwith properties from the message.- Specified by:
wrapRawMessagein interfaceIPushingListener<M>- Parameters:
message- The raw message data, unwrappedsession-PipeLineSessionto 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:
extractMessagein interfaceIListener<M>- Parameters:
rawMessageWrapper- TheRawMessageWrapperfrom which to extract theMessage.context- Context to populate. Either aPipeLineSessionor aMapthreadContext depending on caller.- Returns:
- input
Messagefor adapter.
-
afterMessageProcessed
public void afterMessageProcessed(PipeLineResult processResult, RawMessageWrapper<M> rawMessageWrapper, PipeLineSession pipeLineSession) throws ListenerException Description copied from interface:IListenerCalled to perform actions (like committing or sending a reply) after a message has been processed by the Pipeline.- Specified by:
afterMessageProcessedin interfaceIListener<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:
handleRequestin interfacecom.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:
handleRequestin interfacecom.sap.conn.idoc.jco.JCoIDocHandler
-
setSapSystemName
Description copied from class:SapFunctionFacadeName of theSapSystemused by this object- Specified by:
setSapSystemNamein interfaceISapFunctionFacade- Overrides:
setSapSystemNamein classSapFunctionFacade
-
setProgid
Name of the RFC-destination to be registered in the SAP system- Specified by:
setProgidin interfaceISapListener<M>
-
setConnectionCount
The number of connections that should be registered at the gateway- Specified by:
setConnectionCountin interfaceISapListener<M>- Default value
- 2
-
setHandler
Description copied from interface:IPushingListenerSet the handler that will do the processing of the message. Each of the received messages must be pushed through handler.processMessage()- Specified by:
setHandlerin interfaceIPushingListener<M>
-
setExceptionListener
Description copied from interface:IPushingListenerSet 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:
setExceptionListenerin interfaceIPushingListener<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:
serverExceptionOccurredin interfacecom.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:
serverErrorOccurredin interfacecom.sap.conn.jco.server.JCoServerErrorListener
-
checkTID
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 returntrue. The method has to returnfalseif 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:
checkTIDin interfacecom.sap.conn.jco.server.JCoServerTIDHandler- Parameters:
tid- the transaction ID- Returns:
trueif the ID is valid and not in use otherwise,falseotherwise
-
confirmTID
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:
confirmTIDin interfacecom.sap.conn.jco.server.JCoServerTIDHandler- Parameters:
tid- the transaction ID
-
commit
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:
commitin interfacecom.sap.conn.jco.server.JCoServerTIDHandler- Parameters:
tid- the transaction ID
-
rollback
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:
rollbackin interfacecom.sap.conn.jco.server.JCoServerTIDHandler- Parameters:
tid- the transaction ID
-
getFunctionName
We don't use functions when receiving SAP messages- Specified by:
getFunctionNamein classSapFunctionFacade
-
getIDocXMLProcessor
protected com.sap.conn.idoc.IDocXMLProcessor getIDocXMLProcessor()
-