Class JCoConnectionImpl

java.lang.Object
de.hybris.platform.sap.core.jco.connection.impl.JCoConnectionImpl
All Implemented Interfaces:
JCoConnection
Direct Known Subclasses:
JCoConnectionStateful, JCoConnectionStateless

public class JCoConnectionImpl extends Object implements JCoConnection
Base class for a managed connection.
  • Field Details

    • properties

      protected Properties properties
      Properties filled by spring definition in constructor.
    • connectionParameters

      protected JCoConnectionParameters connectionParameters
      Connection parameters.
    • destroyed

      protected boolean destroyed
      Indicator that connections has already been destroyed.
    • jcoManagedConnectionContainer

      protected JCoManagedConnectionContainer jcoManagedConnectionContainer
      JCoManagedConnectionContainer.
    • rfcDestinationService

      protected RFCDestinationService rfcDestinationService
      RFCDestinationService.
    • scopeType

      protected String scopeType
      Scope type.
  • Constructor Details

  • Method Details

    • setConnectionParameters

      public void setConnectionParameters(JCoConnectionParameters connectionParameters)
      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

      public void setRfcDestinationService(RFCDestinationService rfcDestinationService)
      Injection setter for RFCDestinationService.
      Parameters:
      rfcDestinationService - RFCDestinationService
    • init

      public void init() throws BackendException
      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

      public com.sap.conn.jco.JCoFunction getFunction(String functionName) throws BackendException
      Description copied from interface: JCoConnection
      Returns a JCoFunction object for the given function name.
      Specified by:
      getFunction in interface JCoConnection
      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

      protected String getReplacedFunctionModuleName(String functionName)
      Replaces origin function name with function name defined in connection parameters.
      Parameters:
      functionName - origin function name
      Returns:
      replaced function name
    • execute

      public void execute(com.sap.conn.jco.JCoFunction function) throws BackendException
      Description copied from interface: JCoConnection
      This method is used to execute a JCoFunction on behalf of this connection.
      Specified by:
      execute in interface JCoConnection
      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

      protected boolean isFunctionCached(JCoManagedFunction managedFunction)
      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 destination
      function - rfc function
      Throws:
      BackendException - BackendException
    • preProcessingExecute

      protected void preProcessingExecute(JCoManagedFunction function)
      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

      protected void postProcessingExecute(JCoManagedFunction function)
      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

      public boolean isFunctionAvailable(String functionName) throws BackendException
      Description copied from interface: JCoConnection
      Returns true if the JCo Function is available on the SAP system the connection is connected to.
      Specified by:
      isFunctionAvailable in interface JCoConnection
      Parameters:
      functionName - function name
      Returns:
      true if the JCo Function is available, otherwise false
      Throws:
      BackendException - BackendException
    • isStateful

      protected boolean isStateful() throws BackendException
      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

      protected void checkInternalStatus() throws BackendException
      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

      public void setCallerId(String callerID)
      Description copied from interface: JCoConnection
      Sets the caller id.
      Specified by:
      setCallerId in interface JCoConnection
      Parameters:
      callerID - caller id.
    • getCallerId

      public String getCallerId()
      Getter for caller id.
      Returns:
      caller id
    • getScopeType

      public String getScopeType()
      Getter for scope type.
      Returns:
      the scopeType
    • setScopeType

      public void setScopeType(String scopeType)
      Setter for scope type.
      Parameters:
      scopeType - the scopeType to set
    • isBackendAvailable

      public boolean isBackendAvailable() throws BackendException
      Description copied from interface: JCoConnection
      Returns true if the backend is available the connection is connected to.
      Specified by:
      isBackendAvailable in interface JCoConnection
      Returns:
      true if the backend is available, otherwise false
      Throws:
      BackendException - BackendException
    • isBackendOffline

      public boolean isBackendOffline() throws BackendException
      Description copied from interface: JCoConnection
      Returns true if the backend is switched offline the connection is connected to.
      Specified by:
      isBackendOffline in interface JCoConnection
      Returns:
      true if the backend is switched offline, otherwise false
      Throws:
      BackendException - BackendException
    • handleCommunicationExceptionAndDestroyConnection

      protected void handleCommunicationExceptionAndDestroyConnection(Exception e)
      Handles the Communication JCoException and destroy Stateful connection.
      Parameters:
      e - JCoException
    • getRFCDestination

      protected RFCDestination getRFCDestination(String destinationName)
      Returns the RFC Destination for the requested name.
      Parameters:
      destinationName - destination name
      Returns:
      RFCDestination