Class ServicesFactory

java.lang.Object
com.softwaremining.logic.ServicesFactory

public class ServicesFactory extends Object
Manages Creation and Cancellation of programs using Factory pattern. Additionally manages loading of Transaction-Id=ProgramName for CICS applications from file services.properties
  • Field Details

    • totalRuntime

      public static long totalRuntime
      for internal use only ... profiling information
  • Constructor Details

    • ServicesFactory

      public ServicesFactory()
  • Method Details

    • transferSessionId

      public static void transferSessionId(Long prevSessionId, Long newSessId)
    • forceReleaseSessionId

      public static void forceReleaseSessionId(Long sid)
      This method is to allow manual forcing to release of the memory associated with a session. In some cases, depending on how programs are started and released, some programs may never have been removed, causing a memory leak / ever increasing memory requirement by the runtime application.
      Parameters:
      sid -
    • create

      public static BaseService create(ISMObject classNameVar, IBaseService parent)
      create an instance of the target class. This is used during translation of cobol's CALL Statements.
      NOTE: Unless the ServicesFactory.cancel method is used to cancel the called program (by the caller), the system will cache the called-program and the next call to ServicesFactory.create (from same session) will return the same instance of the called-program, with all the data preserved.
      Parameters:
      parent - : Calling object Used to retrieve Session information, screen information, etc.
      _className - : full packageName and class name. E.g. com.softwaremining.examples.Class1, or
      just the name e.g. CLASS1 - in this case the system will use the "parent" package, and capitalize "CLASS1" to produce com.softwaremining.examples.Class1 .
      Alternatively the package name may supplied by Config.EXTERNAL_SERVICES_PACKAGE_NAME (from entry in softwaremining.properties).
      Returns:
    • create

      public static BaseService create(String _className, IBaseService parent)
      create an instance of the target class. This is used during translation of cobol's CALL Statements.
      NOTE: Unless the ServicesFactory.cancel method is used to cancel the called program (by the caller), the system will cache the called-program and the next call to ServicesFactory.create (from same session) will return the same instance of the called-program, with all the data preserved.
      Parameters:
      _className - : full packageName and class name. E.g. com.softwaremining.examples.Class1, or
      just the name e.g. CLASS1 - in this case the system will use the "parent" package, and capitalize "CLASS1" to produce com.softwaremining.examples.Class1 .
      Alternatively the package name may supplied by Config.EXTERNAL_SERVICES_PACKAGE_NAME (from entry in softwaremining.properties).
      parent - : Calling object Used to retrieve Session information, screen information, etc.
      Returns:
    • cancelService

      public static void cancelService(String className, IBaseService parent)
      remove service from cached program. Next call to ServicesFactory.create will create a fresh instance of the program
      Parameters:
      className -
      parent -
    • cancelCicsCalledPrograms

      public static void cancelCicsCalledPrograms(IBaseService progInstance)
    • removeSession

      public static void removeSession(BaseService parent)
      For internal use only.
      Used by Conversational Servlet engine once application has finished
    • getNameToServiceMappingProperties

      public static Properties getNameToServiceMappingProperties(boolean throwExceptionIfNotFound)
      Used internally by CICS applications - Attempt to locate and load "services.properties" This property file will contain a mapping between name of a program, and an equivalent java-class.
      for example:
      prog1=Program1
      prog2=Program2
      Returns:
    • printStats

      public static String printStats()