Class JCoConnectionImpl
java.lang.Object
de.hybris.platform.sap.core.jco.connection.impl.JCoConnectionImpl
- All Implemented Interfaces:
JCoConnection
- Direct Known Subclasses:
JCoConnectionStateful,JCoConnectionStateless
Base class for a managed connection.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JCoConnectionParametersConnection parameters.protected booleanIndicator that connections has already been destroyed.protected JCoManagedConnectionContainerJCoManagedConnectionContainer.protected PropertiesProperties filled by spring definition in constructor.protected RFCDestinationServiceRFCDestinationService.protected StringScope type.Fields inherited from interface de.hybris.platform.sap.core.jco.connection.JCoConnection
JCO_DESTINATION, JCO_LANG, JCO_SCOPE_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidChecks internal status of the connection.voidexecute(com.sap.conn.jco.JCoFunction function) This method is used to execute a JCoFunction on behalf of this connection.protected voidexecuteCachedFunction(com.sap.conn.jco.JCoDestination destination, JCoManagedFunction function) Executes function on cache result.Getter for caller id.protected com.sap.conn.jco.JCoCustomDestinationGetter for destination.com.sap.conn.jco.JCoFunctiongetFunction(String functionName) Returns a JCoFunction object for the given function name.protected StringgetReplacedFunctionModuleName(String functionName) Replaces origin function name with function name defined in connection parameters.protected RFCDestinationgetRFCDestination(String destinationName) Returns the RFC Destination for the requested name.Getter for scope type.protected voidHandles the Communication JCoException and destroy Stateful connection.voidinit()Init method called by spring init method definition.booleanReturnstrueif the backend is available the connection is connected to.booleanReturnstrueif the backend is switched offline the connection is connected to.booleanisFunctionAvailable(String functionName) Returnstrueif the JCo Function is available on the SAP system the connection is connected to.protected booleanisFunctionCached(JCoManagedFunction managedFunction) Checks if function result is cached.protected booleanCheck if the destination is stateful.protected voidpostProcessingExecute(JCoManagedFunction function) Called after JCO execution.protected voidpreProcessingExecute(JCoManagedFunction function) Called before JCO execution.voidsetCallerId(String callerID) Sets the caller id.voidsetConnectionParameters(JCoConnectionParameters connectionParameters) Setter for connection parameters.voidDestroy method which cleans up the object.voidsetJcoManagedConnectionContainer(JCoManagedConnectionContainer jcoManagedConnectionContainer) Setter for JCo Managed Connection Container.voidsetRfcDestinationService(RFCDestinationService rfcDestinationService) Injection setter forRFCDestinationService.voidsetScopeType(String scopeType) Setter for scope type.
-
Field Details
-
properties
Properties filled by spring definition in constructor. -
connectionParameters
Connection parameters. -
destroyed
protected boolean destroyedIndicator that connections has already been destroyed. -
jcoManagedConnectionContainer
JCoManagedConnectionContainer. -
rfcDestinationService
RFCDestinationService. -
scopeType
Scope type.
-
-
Constructor Details
-
JCoConnectionImpl
Constructor.- Parameters:
properties- properties for this instance with the following keysJCoConnection.JCO_DESTINATION(destination)JCoConnection.JCO_SCOPE_TYPE(jcoScopeType)JCoConnection.JCO_LANG(jco.client.lang)
-
-
Method Details
-
setConnectionParameters
Setter for connection parameters.- Parameters:
connectionParameters- connection parameters.
-
setJcoManagedConnectionContainer
public void setJcoManagedConnectionContainer(JCoManagedConnectionContainer jcoManagedConnectionContainer) Setter for JCo Managed Connection Container.- Parameters:
jcoManagedConnectionContainer- JCo Managed Connection Container
-
setRfcDestinationService
Injection setter forRFCDestinationService.- Parameters:
rfcDestinationService-RFCDestinationService
-
init
Init method called by spring init method definition.- Throws:
BackendException- Exception in case of failure.
-
setDestroyed
public void setDestroyed()Destroy method which cleans up the object. -
getFunction
Description copied from interface:JCoConnectionReturns a JCoFunction object for the given function name.- Specified by:
getFunctionin interfaceJCoConnection- Parameters:
functionName- name of remote callable function module on the SAP system- Returns:
- JCoFunction
- Throws:
BackendException- when something goes wrong while retrieving meta data
-
getReplacedFunctionModuleName
Replaces origin function name with function name defined in connection parameters.- Parameters:
functionName- origin function name- Returns:
- replaced function name
-
execute
Description copied from interface:JCoConnectionThis method is used to execute a JCoFunction on behalf of this connection.- Specified by:
executein interfaceJCoConnection- Parameters:
function- a JCoFunction which should be executed- Throws:
BackendException- thrown if something goes wrong in the EAI layer or if an JCoException is thrown by the SAP Java Connector.
-
isFunctionCached
Checks if function result is cached.- Parameters:
managedFunction- requested function- Returns:
- true, if result is cached
-
executeCachedFunction
protected void executeCachedFunction(com.sap.conn.jco.JCoDestination destination, JCoManagedFunction function) throws BackendException Executes function on cache result.- Parameters:
destination- rfc destinationfunction- rfc function- Throws:
BackendException-BackendException
-
preProcessingExecute
Called before JCO execution. Calls event listeners and tracing.
This method is only called if parameters are defined for that function.- Parameters:
function- function which is called.
-
postProcessingExecute
Called after JCO execution. Calls event listeners and tracing.
This method is only called if parameters are defined for that function.- Parameters:
function- function which is called.
-
isFunctionAvailable
Description copied from interface:JCoConnectionReturnstrueif the JCo Function is available on the SAP system the connection is connected to.- Specified by:
isFunctionAvailablein interfaceJCoConnection- Parameters:
functionName- function name- Returns:
trueif the JCo Function is available, otherwisefalse- Throws:
BackendException-BackendException
-
isStateful
Check if the destination is stateful.- Returns:
- true if stateful, false otherwise.
- Throws:
BackendException- BackendException
-
getDestination
protected com.sap.conn.jco.JCoCustomDestination getDestination()Getter for destination.- Returns:
- the destination
-
checkInternalStatus
Checks internal status of the connection.
After the object is destroyed the destination is set to null. No more function execution is possible. Throws BackendRuntimeException in case of object was already destroyed.- Throws:
BackendException-BackendException
-
setCallerId
Description copied from interface:JCoConnectionSets the caller id.- Specified by:
setCallerIdin interfaceJCoConnection- Parameters:
callerID- caller id.
-
getCallerId
Getter for caller id.- Returns:
- caller id
-
getScopeType
Getter for scope type.- Returns:
- the scopeType
-
setScopeType
Setter for scope type.- Parameters:
scopeType- the scopeType to set
-
isBackendAvailable
Description copied from interface:JCoConnectionReturnstrueif the backend is available the connection is connected to.- Specified by:
isBackendAvailablein interfaceJCoConnection- Returns:
trueif the backend is available, otherwisefalse- Throws:
BackendException-BackendException
-
isBackendOffline
Description copied from interface:JCoConnectionReturnstrueif the backend is switched offline the connection is connected to.- Specified by:
isBackendOfflinein interfaceJCoConnection- Returns:
trueif the backend is switched offline, otherwisefalse- Throws:
BackendException-BackendException
-
handleCommunicationExceptionAndDestroyConnection
Handles the Communication JCoException and destroy Stateful connection.- Parameters:
e- JCoException
-
getRFCDestination
Returns the RFC Destination for the requested name.- Parameters:
destinationName- destination name- Returns:
RFCDestination
-