Class DatabaseConfigService


  • public class DatabaseConfigService
    extends CayenneService
    Provides a utility to load database configurations from specified XML.
    • Constructor Detail

      • DatabaseConfigService

        public DatabaseConfigService()
    • Method Detail

      • init

        public void init()
                  throws Exception
        Initialize the database configuration.
        Throws:
        Exception - if an error occurs
      • loadConfiguration

        public void loadConfiguration​(SchedulerService schedulerService,
                                      ServletContext servletContext,
                                      boolean debugFlag)
        Load configuration from database given the scheduler service instance and the servlet context This method loads a number of db-config files.

        They are loaded by order from 0 to 5. The default one is db-config1.xml.

        Newly added configuration should start from 2 and Override configuration should be defined in db-config0.xml.

        Parameters:
        schedulerService - the scheduler service instance
        servletContext - the servlet context
        debugFlag - whether debug mode is on (used during standalone initialization)
      • loadCoreConfiguration

        public void loadCoreConfiguration​(SchedulerService schedulerService,
                                          boolean debugFlag)
        Load the core configuration file (core-config.xml). Used by the configuration initializer at startup.
        Parameters:
        schedulerService - the scheduler service (required)
        debugFlag - whether to log more detailed error messages for service instantiation failure
      • getServiceTypes

        public Set<String> getServiceTypes()
        Load the set of service types from core-config.xml and core-templates.xml
        Returns:
        the set of service types used in core-config.xml and core-templates.xml
      • getTemplateServiceTypes

        public Set<String> getTemplateServiceTypes()
        Load the set of service types from core-templates.xml
        Returns:
        the set of service types used in core-templates.xml
      • getServiceDefinitionTemplateNames

        public List<String> getServiceDefinitionTemplateNames​(boolean hasServiceEditPermission,
                                                              String typeFilter)
        Return the list of available Groovy service template names.
        Parameters:
        hasServiceEditPermission - the user has the
        typeFilter - the service type filter
        Returns:
        the list of service names
      • getAuthenticationProviderTemplateNames

        public List<String> getAuthenticationProviderTemplateNames()
        Returns:
        the list of Authentication Provider Template names.
      • getSecurityManagerTemplateNames

        public List<String> getSecurityManagerTemplateNames()
        Returns:
        the list of Security Manager Template names.
      • createServiceDefinitionFromTemplate

        public ServiceDefinition createServiceDefinitionFromTemplate​(String serviceName,
                                                                     String templateServiceName)
        Deprecated.
        use createServiceDefinitionFromTemplate(String, int, String) instead
        Create a new Groovy service from the Groovy service templates using the service name and template service name.
        Parameters:
        serviceName - the service name
        templateServiceName - the service type
        Returns:
        a new Groovy service based on the specified service type template
      • createServiceDefinitionFromTemplate

        @Deprecated
        public ServiceDefinition createServiceDefinitionFromTemplate​(String serviceName,
                                                                     int versionNumber,
                                                                     String templateServiceName)
        Deprecated.
        Create a new Groovy service from the Groovy service templates using the service name and template service name.
        Parameters:
        serviceName - the service name
        versionNumber - the version number
        templateServiceName - the service type
        Returns:
        a new Groovy service based on the specified service type template
        Since:
        4.3.0
      • createServiceDefinitionFromTemplate

        public ServiceDefinition createServiceDefinitionFromTemplate​(String serviceName,
                                                                     String version,
                                                                     String templateServiceName)
        Create a new Groovy service from the Groovy service templates using the service name and template service name.
        Parameters:
        serviceName - the service name
        version - the version
        templateServiceName - the service type
        Returns:
        a new Groovy service based on the specified service type template
        Since:
        17.10.0
      • createSecurityManagerFromTemplate

        public SecurityManager createSecurityManagerFromTemplate​(String newSecurityManagerName,
                                                                 String templateName)
        Creates the security manager from template.
        Parameters:
        newSecurityManagerName - the security manager name
        templateName - the security manager type
        Returns:
        the security manager
      • createAuthenticationProviderFromTemplate

        public AuthenticationProvider createAuthenticationProviderFromTemplate​(String newProviderName,
                                                                               String templateName)
        Create an AuthenticationProvider with the given name based on the provided template name.
        Parameters:
        newProviderName - the name to give the new AuthenticationProvider
        templateName - the provider template name
        Returns:
        the newly create AuthenticationProvider
      • getFormPageTrackingTemplate

        public Map<String,​String> getFormPageTrackingTemplate()
        Returns:
        a sorted map of Form Page Tracking templates keyed on the template name.
      • addToTemplateNames

        protected void addToTemplateNames​(List<String> templateNames,
                                          String fileName,
                                          String rootElementName,
                                          String childElementName,
                                          boolean isFluentTemplate)
        Retrieves template names adding to the collection via the filename for all elements within the root/child
        Parameters:
        templateNames - collection to store the template names within
        fileName - file name to retrieve elements from
        rootElementName - node block within to select
        childElementName - child elements to retrieve
        isFluentTemplate - if true then add all elements by default else if secure api & always on flag or core then add
        Throws:
        RuntimeException - if element already exists
        Since:
        19.11.0
      • getTemplateFromConfig

        protected Element getTemplateFromConfig​(String templateName,
                                                String rootElementName,
                                                String childElementName,
                                                String... configNames)
        Retrieves an element based on template name from within the config names
        Parameters:
        templateName - template name to retrieve
        rootElementName - node block within to select
        childElementName - child elements to search within
        configNames - config names to retrieve elements from
        Returns:
        Element template if found, null if not found
        Since:
        19.11.0