<commit_before>#<< AppEngine/Helpers/Logger

#create a registry for the application and the components that can be registered by a class name
AppEngine = __t('AppEngine')
AppEngine.componentRegistry = {}
logger = null

AppEngine.registerComponent = (className, component) ->
  if AppEngine.componentRegistry[className]
    logger.debug "RegisterComponent: Overriding component #{AppEngine.componentRegistry[className].getName()} with selector '#{className}' for component #{component.getName()}"
  else
    logger.debug "RegisterComponent: Setting component #{component.getName()} by selector '#{className}'"

  AppEngine.componentRegistry[className] = component


AppEngine.registryGetTypeFromTypeShortName = (name) ->
  return AppEngine.componentRegistry[name] if AppEngine.componentRegistry[name]
  return null


AppEngine.initialiseComponentRegistry = (scopes) ->
  #taverse all components and add to registry
  logger = new AppEngine.Helpers.Logger(@)

  scopes = [scopes] if !_.isArray(scopes)

  loopEachObject = (component, checkedList) ->
    if component and !component.__has_been_checked and _.isObject component
      component.__has_been_checked = true
      checkedList.push(component)

      #check all functions
      if component.prototype instanceof AppEngine.Components.AppEngineComponent
        if !component.prototype.constructor.isAbstract()
          #this is the function for getting the Component Identification
          #eg. Objects['Page']['getShortNameIdentification']()
          if component.prototype.constructor.getShortNameIdentification
            try 
              className = component.prototype.constructor.getShortNameIdentification()

              if className
                AppEngine.registerComponent(className, component)
              else
                logger.warn "RegisterComponent: Component #{component.getName()} does not have a short name, not adding to registry"
            catch e
              throw new AppEngine.Helpers.Error "Cannot get the correct IdentificationClass for the component: '#{component.getName()}'", e
          else <commit_msg>Change the logger name of ComponentRegistry<commit_after>#<< AppEngine/Helpers/Logger

#create a registry for the application and the components that can be registered by a class name
AppEngine = __t('AppEngine')
AppEngine.componentRegistry = {}
logger = null

AppEngine.registerComponent = (className, component) ->
  if AppEngine.componentRegistry[className]
    logger.debug "RegisterComponent: Overriding component #{AppEngine.componentRegistry[className].getName()} with selector '#{className}' for component #{component.getName()}"
  else
    logger.debug "RegisterComponent: Setting component #{component.getName()} by selector '#{className}'"

  AppEngine.componentRegistry[className] = component


AppEngine.registryGetTypeFromTypeShortName = (name) ->
  return AppEngine.componentRegistry[name] if AppEngine.componentRegistry[name]
  return null


AppEngine.initialiseComponentRegistry = (scopes) ->
  #taverse all components and add to registry
  logger = new AppEngine.Helpers.Logger("ComponentRegistry")

  scopes = [scopes] if !_.isArray(scopes)

  loopEachObject = (component, checkedList) ->
    if component and !component.__has_been_checked and _.isObject component
      component.__has_been_checked = true
      checkedList.push(component)

      #check all functions
      if component.prototype instanceof AppEngine.Components.AppEngineComponent
        if !component.prototype.constructor.isAbstract()
          #this is the function for getting the Component Identification
          #eg. Objects['Page']['getShortNameIdentification']()
          if component.prototype.constructor.getShortNameIdentification
            try 
              className = component.prototype.constructor.getShortNameIdentification()

              if className
                AppEngine.registerComponent(className, component)
              else
                logger.warn "RegisterComponent: Component #{component.getName()} does not have a short name, not adding to registry"
            catch e
              throw new AppEngine.Helpers.Error "Cannot get the correct IdentificationClass for the component: '#{component.getName()}'", e
          else 
{'fraction_non_alphanumeric': 0.08411433926897845, 'fraction_numerical': 0.0, 'mean_word_length': 3.8511363636363636, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3003863', 'n_tokens_mistral': 1010, 'n_tokens_neox': 995, 'n_words': 303}