Class SqlRegexpHelper

java.lang.Object
fr.paris.lutece.utils.sql.SqlRegexpHelper

public class SqlRegexpHelper extends Object
Helper class that knows how to locate, load and apply SQL regexps such as defined in build.properties and run by build.xml (from build-config)
  • Constructor Details

    • SqlRegexpHelper

      public SqlRegexpHelper(File propertiesFile, String sgbdName) throws Exception
      Constructs a new SqlRegexpHelper from a properties file
      Parameters:
      propertiesFile - contains the regexps
      sgbdName - rdbms vendor to use
      Throws:
      IOException - if something goes wrong with reading the config file
      Exception
    • SqlRegexpHelper

      public SqlRegexpHelper(Callable<InputStream> propertiesSource, String sgbdName) throws Exception
      Constructs a new SqlRegexpHelper from a properties stream
      Parameters:
      propertiesFile - contains the regexps
      sgbdName - rdbms vendor to use
      Throws:
      IOException - if something goes wrong with reading the stream
      Exception
  • Method Details

    • findDbName

      public static String findDbName(File dbProperties) throws Exception
      Helper to find jdbc vendor from db.properties. uses same regexp as build.xml from build-config
      Parameters:
      dbProperties - input path for db.properties
      Returns:
      'mysql' or any other vendor identifier
      Throws:
      Exception - if vendor cannot be found for any reason
    • findDbName

      public static String findDbName(String jdbcUrl)
      Extracts the database type (mysql, oracle...) from the JDBC URL
      Parameters:
      jdbcUrl - JDBC URL to be parsed
      Returns:
      databaseType for a URL such as jdbc:databaseType:someInfo
    • filter

      public String filter(String line)
      Performs all substitutions on the given string
      Parameters:
      line - input
      Returns:
      output, possibly modified by substitutions