Class DialectUtil

java.lang.Object
org.alfresco.util.DialectUtil

public abstract class DialectUtil extends Object
  • Field Details

    • PLACEHOLDER_DIALECT

      public static final String PLACEHOLDER_DIALECT
      The placeholder for the configured Dialect class name: ${db.script.dialect}
      See Also:
  • Constructor Details

    • DialectUtil

      public DialectUtil()
  • Method Details

    • getDialectResource

      public static org.springframework.core.io.Resource getDialectResource(org.springframework.core.io.support.ResourcePatternResolver resourcePatternResolver, Class<?> dialectClass, String resourceUrl)
      Replaces the dialect placeholder in the resource URL and attempts to find a file for it. If not found, the dialect hierarchy will be walked until a compatible resource is found. This makes it possible to have resources that are generic to all dialects.
      Returns:
      The Resource, otherwise null
    • resolveDialectUrl

      public static String resolveDialectUrl(Class<?> dialectClass, String resourceUrl)
      Takes resource URL containing the dialect placeholder text and substitutes the placeholder with the name of the given dialect's class.

      For example:

       resolveDialectUrl(MySQLInnoDBDialect.class, "classpath:alfresco/db/${db.script.dialect}/myfile.xml")
       
      would give the following String:
         classpath:alfresco/db/org.hibernate.dialect.MySQLInnoDBDialect/myfile.xml