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
-
public class DatabaseConfigService extends CayenneService
Provides a utility to load database configurations from specified XML.
-
-
Constructor Summary
Constructors Constructor Description DatabaseConfigService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddToTemplateNames(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/childAuthenticationProvidercreateAuthenticationProviderFromTemplate(String newProviderName, String templateName)Create an AuthenticationProvider with the given name based on the provided template name.SecurityManagercreateSecurityManagerFromTemplate(String newSecurityManagerName, String templateName)Creates the security manager from template.ServiceDefinitioncreateServiceDefinitionFromTemplate(String serviceName, int versionNumber, String templateServiceName)Deprecated.ServiceDefinitioncreateServiceDefinitionFromTemplate(String serviceName, String templateServiceName)Deprecated.use createServiceDefinitionFromTemplate(String, int, String) insteadServiceDefinitioncreateServiceDefinitionFromTemplate(String serviceName, String version, String templateServiceName)Create a new Groovy service from the Groovy service templates using the service name and template service name.List<String>getAuthenticationProviderTemplateNames()Map<String,String>getFormPageTrackingTemplate()List<String>getSecurityManagerTemplateNames()List<String>getServiceDefinitionTemplateNames(boolean hasServiceEditPermission, String typeFilter)Return the list of available Groovy service template names.Set<String>getServiceTypes()Load the set of service types from core-config.xml and core-templates.xmlprotected ElementgetTemplateFromConfig(String templateName, String rootElementName, String childElementName, String... configNames)Retrieves an element based on template name from within the config namesSet<String>getTemplateServiceTypes()Load the set of service types from core-templates.xmlvoidinit()Initialize the database configuration.voidloadConfiguration(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.voidloadCoreConfiguration(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
-
-
-
-
Method Detail
-
init
public void init() throws ExceptionInitialize 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 instanceservletContext- the servlet contextdebugFlag- 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 thetypeFilter- 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) 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
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 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 & 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
-
-