Package com.avoka.fc.core.service
Class DatabaseConfigService
java.lang.Object
com.avoka.fc.core.service.BaseService
com.avoka.fc.core.service.CayenneService
com.avoka.fc.core.service.DatabaseConfigService
Provides a utility to load database configurations from specified XML.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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/childcreateAuthenticationProviderFromTemplate
(String newProviderName, String templateName) Create an AuthenticationProvider with the given name based on the provided template name.createSecurityManagerFromTemplate
(String newSecurityManagerName, String templateName) Creates the security manager from template.createServiceDefinitionFromTemplate
(String serviceName, int versionNumber, String templateServiceName) Deprecated.createServiceDefinitionFromTemplate
(String serviceName, String templateServiceName) Deprecated.use createServiceDefinitionFromTemplate(String, int, String) insteadcreateServiceDefinitionFromTemplate
(String serviceName, String version, String templateServiceName) Create a new Groovy service from the Groovy service templates using the service name and template service name.getServiceDefinitionTemplateNames
(boolean hasServiceEditPermission, String typeFilter) Return the list of available Groovy service template names.Load the set of service types from core-config.xml and core-templates.xmlprotected Element
getTemplateFromConfig
(String templateName, String rootElementName, String childElementName, String... configNames) Retrieves an element based on template name from within the config namesLoad the set of service types from core-templates.xmlvoid
init()
Initialize the database configuration.void
loadConfiguration
(SchedulerService schedulerService, jakarta.servlet.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.void
loadCoreConfiguration
(SchedulerService schedulerService, boolean debugFlag) Load the core configuration file (core-config.xml).Methods inherited from class com.avoka.fc.core.service.CayenneService
commitChanges, deleteObject, deleteObjects, findObject, getDataContext, getDataDomain, getObjectForPK, getObjectStore, newObject, performNamedQuery, performNamedQuery, performNamedQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performQuery, performQuery, refetchEntity, refetchObject, registerNewObject, rollbackChanges, toMap, toMap
Methods inherited from class com.avoka.fc.core.service.BaseService
getLogger
-
Constructor Details
-
DatabaseConfigService
public DatabaseConfigService()
-
-
Method Details
-
init
Initialize the database configuration.- Throws:
Exception
- if an error occurs
-
loadConfiguration
public void loadConfiguration(SchedulerService schedulerService, jakarta.servlet.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 instanceservletContext
- the servlet contextdebugFlag
- whether debug mode is on (used during standalone initialization)
-
loadCoreConfiguration
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
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
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 thetypeFilter
- the service type filter- Returns:
- the list of service names
-
getAuthenticationProviderTemplateNames
- Returns:
- the list of Authentication Provider Template names.
-
getSecurityManagerTemplateNames
- Returns:
- the list of Security Manager Template names.
-
createServiceDefinitionFromTemplate
public ServiceDefinition createServiceDefinitionFromTemplate(String serviceName, String templateServiceName) Deprecated.use createServiceDefinitionFromTemplate(String, int, String) insteadCreate a new Groovy service from the Groovy service templates using the service name and template service name.- Parameters:
serviceName
- the service nametemplateServiceName
- 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 nameversionNumber
- the version numbertemplateServiceName
- 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 nameversion
- the versiontemplateServiceName
- 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 nametemplateName
- 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 AuthenticationProvidertemplateName
- the provider template name- Returns:
- the newly create AuthenticationProvider
-
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 withinfileName
- file name to retrieve elements fromrootElementName
- node block within to selectchildElementName
- child elements to retrieveisFluentTemplate
- if true then add all elements by default else if secure api invalid input: '&' 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 retrieverootElementName
- node block within to selectchildElementName
- child elements to search withinconfigNames
- config names to retrieve elements from- Returns:
- Element template if found, null if not found
- Since:
- 19.11.0
-