Class SimplePropertiesWriter
- java.lang.Object
-
- org.apache.solr.handler.dataimport.DIHProperties
-
- org.apache.solr.handler.dataimport.SimplePropertiesWriter
-
- Direct Known Subclasses:
ZKPropertiesWriter
public class SimplePropertiesWriter extends DIHProperties
Writes properties using
Properties.store(java.io.Writer, java.lang.String). The special property "last_index_time" is converted to a formatted date. Users can configure the location, filename, locale and date format to use.
-
-
Field Summary
Fields Modifier and Type Field Description protected StringconfigDirstatic StringDATE_FORMATThe date format to use when writing values for "last_index_time" to the properties file.protected SimpleDateFormatdateFormatstatic StringDIRECTORYThe directory to save the properties file in.protected Stringfilenamestatic StringFILENAMEThe filename to save the properties file to.protected Localelocalestatic StringLOCALEThe locale to use when writing the properties file.
-
Constructor Summary
Constructors Constructor Description SimplePropertiesWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringconvertDateToString(Date d)protected DateconvertStringToDate(String s)protected voidfindDirectory(DataImporter dataImporter, Map<String,String> params)voidinit(DataImporter dataImporter, Map<String,String> params)booleanisWritable()protected PropertiesmapToProperties(Map<String,Object> propObjs)DocBuildersends the date as an Object because this class knows how to convert it to a Stringvoidpersist(Map<String,Object> propObjs)protected Map<String,Object>propertiesToMap(Properties p)We'll send everything back as Strings as this class has already converted them.Map<String,Object>readIndexerProperties()-
Methods inherited from class org.apache.solr.handler.dataimport.DIHProperties
getCurrentTimestamp
-
-
-
-
Field Detail
-
filename
protected String filename
-
configDir
protected String configDir
-
locale
protected Locale locale
-
dateFormat
protected SimpleDateFormat dateFormat
-
LOCALE
public static final String LOCALE
The locale to use when writing the properties file. Default isLocale.ROOT- See Also:
- Constant Field Values
-
DATE_FORMAT
public static final String DATE_FORMAT
The date format to use when writing values for "last_index_time" to the properties file. SeeSimpleDateFormatfor patterns. Default is yyyy-MM-dd HH:mm:ss .- See Also:
- Constant Field Values
-
DIRECTORY
public static final String DIRECTORY
The directory to save the properties file in. Default is the current core's "config" directory.- See Also:
- Constant Field Values
-
FILENAME
public static final String FILENAME
The filename to save the properties file to. Default is this Handler's name from solrconfig.xml.- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(DataImporter dataImporter, Map<String,String> params)
- Specified by:
initin classDIHProperties
-
findDirectory
protected void findDirectory(DataImporter dataImporter, Map<String,String> params)
-
isWritable
public boolean isWritable()
- Specified by:
isWritablein classDIHProperties
-
convertDateToString
public String convertDateToString(Date d)
- Specified by:
convertDateToStringin classDIHProperties
-
mapToProperties
protected Properties mapToProperties(Map<String,Object> propObjs)
DocBuildersends the date as an Object because this class knows how to convert it to a String
-
propertiesToMap
protected Map<String,Object> propertiesToMap(Properties p)
We'll send everything back as Strings as this class has already converted them.
-
persist
public void persist(Map<String,Object> propObjs)
- Specified by:
persistin classDIHProperties
-
readIndexerProperties
public Map<String,Object> readIndexerProperties()
- Specified by:
readIndexerPropertiesin classDIHProperties
-
-