Package fr.paris.lutece.utils.sql
Class SqlRegexpHelper
- java.lang.Object
-
- fr.paris.lutece.utils.sql.SqlRegexpHelper
-
public class SqlRegexpHelper extends java.lang.ObjectHelper 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 Summary
Constructors Constructor Description SqlRegexpHelper(java.io.File propertiesFile, java.lang.String sgbdName)Constructs a new SqlRegexpHelper from a properties fileSqlRegexpHelper(java.util.concurrent.Callable<java.io.InputStream> propertiesSource, java.lang.String sgbdName)Constructs a new SqlRegexpHelper from a properties stream
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringfilter(java.lang.String line)Performs all substitutions on the given stringstatic java.lang.StringfindDbName(java.io.File dbProperties)Helper to find jdbc vendor from db.properties.static java.lang.StringfindDbName(java.lang.String jdbcUrl)Extracts the database type (mysql, oracle...) from the JDBC URL
-
-
-
Constructor Detail
-
SqlRegexpHelper
public SqlRegexpHelper(java.io.File propertiesFile, java.lang.String sgbdName) throws java.lang.ExceptionConstructs a new SqlRegexpHelper from a properties file- Parameters:
propertiesFile- contains the regexpssgbdName- rdbms vendor to use- Throws:
java.io.IOException- if something goes wrong with reading the config filejava.lang.Exception
-
SqlRegexpHelper
public SqlRegexpHelper(java.util.concurrent.Callable<java.io.InputStream> propertiesSource, java.lang.String sgbdName) throws java.lang.ExceptionConstructs a new SqlRegexpHelper from a properties stream- Parameters:
propertiesFile- contains the regexpssgbdName- rdbms vendor to use- Throws:
java.io.IOException- if something goes wrong with reading the streamjava.lang.Exception
-
-
Method Detail
-
findDbName
public static java.lang.String findDbName(java.io.File dbProperties) throws java.lang.ExceptionHelper 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:
java.lang.Exception- if vendor cannot be found for any reason
-
findDbName
public static java.lang.String findDbName(java.lang.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 java.lang.String filter(java.lang.String line)
Performs all substitutions on the given string- Parameters:
line- input- Returns:
- output, possibly modified by substitutions
-
-