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 TypeMethodDescriptionvoid
afterMessageProcessed
(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.boolean
SAP JCo.Server javadoc says: This function will be invoked when a transactional RFC is being called from a SAP R/3 system.void
SAP JCo.Server javadoc says: This function will be called after all RFC functions belonging to a certain transaction have been successfully completed.void
Configure this component.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.extractMessage
(RawMessageWrapper<M> rawMessageWrapper, Map<String, Object> context) Called by handler.processRawMessage, NEVER by handler.processRequest.protected String
We don't use functions when receiving SAP messagescom.sap.conn.idoc.jco.JCoIDocHandler
getIDocHandler
(com.sap.conn.idoc.jco.JCoIDocServerContext serverCtx) protected com.sap.conn.idoc.IDocXMLProcessor
void
handleRequest
(com.sap.conn.jco.server.JCoServerContext serverCtx, com.sap.conn.idoc.IDocDocumentList documentList) JCoIDocHandler M == Stringvoid
handleRequest
(com.sap.conn.jco.server.JCoServerContext jcoServerContext, com.sap.conn.jco.JCoFunction jcoFunction) JCoServerFunctionHandler M == JCoFunctionvoid
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.void
serverErrorOccurred
(com.sap.conn.jco.server.JCoServer server, String connectionID, com.sap.conn.jco.server.JCoServerContextInfo serverCtx, Error e) JCoServerErrorListenervoid
serverExceptionOccurred
(com.sap.conn.jco.server.JCoServer server, String connectionID, com.sap.conn.jco.server.JCoServerContextInfo serverCtx, Exception e) JCoServerExceptionListenervoid
setConnectionCount
(String connectionCount) The number of connections that should be registered at the gatewayvoid
setExceptionListener
(IbisExceptionListener listener) Set a (single) listener that will be notified of any exceptions.void
setHandler
(IMessageHandler<M> handler) Set the handler that will do the processing of the message.void
Name of the RFC-destination to be registered in the SAP systemvoid
setSapSystemName
(String string) Name of theSapSystem
used by this objectvoid
start()
Prepares the listener for receiving messages.void
stop()
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, setRequestFieldName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContext
Methods inherited from interface org.frankframework.core.HasApplicationContext
getApplicationContext, getConfigurationClassLoader
Methods inherited from interface org.frankframework.core.HasPhysicalDestination
getDomain
Methods 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:IConfigurable
Configure 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:
configure
in interfaceIConfigurable
- Overrides:
configure
in classSapFunctionFacade
- 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. -
stop
public void stop()Description copied from interface:IListener
Close 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:
getIDocHandler
in interfacecom.sap.conn.idoc.jco.JCoIDocHandlerFactory
-
getPhysicalDestinationName
- Specified by:
getPhysicalDestinationName
in interfaceHasPhysicalDestination
- Overrides:
getPhysicalDestinationName
in classSapFunctionFacade
-
wrapRawMessage
Description copied from interface:IPushingListener
Wrap a raw message in a MessageWrapper. PopulatePipeLineSession
with properties from the message.- Specified by:
wrapRawMessage
in interfaceIPushingListener<M>
- Parameters:
message
- The raw message data, unwrappedsession
-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 interfaceIListener<M>
- Parameters:
rawMessageWrapper
- TheRawMessageWrapper
from which to extract theMessage
.context
- Context to populate. Either aPipeLineSession
or aMap
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 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:
handleRequest
in 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:
handleRequest
in interfacecom.sap.conn.idoc.jco.JCoIDocHandler
-
setSapSystemName
Description copied from class:SapFunctionFacade
Name of theSapSystem
used by this object- Specified by:
setSapSystemName
in interfaceISapFunctionFacade
- Overrides:
setSapSystemName
in classSapFunctionFacade
-
setProgid
Name of the RFC-destination to be registered in the SAP system- Specified by:
setProgid
in interfaceISapListener<M>
-
setConnectionCount
The number of connections that should be registered at the gateway- Specified by:
setConnectionCount
in interfaceISapListener<M>
- Default value
- 2
-
setHandler
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 interfaceIPushingListener<M>
-
setExceptionListener
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 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:
serverExceptionOccurred
in 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:
serverErrorOccurred
in 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 returnfalse
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 interfacecom.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
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 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:
commit
in 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:
rollback
in interfacecom.sap.conn.jco.server.JCoServerTIDHandler
- Parameters:
tid
- the transaction ID
-
getFunctionName
We don't use functions when receiving SAP messages- Specified by:
getFunctionName
in classSapFunctionFacade
-
getIDocXMLProcessor
protected com.sap.conn.idoc.IDocXMLProcessor getIDocXMLProcessor()
-