1 package org.naftulin.configmgr.content; 2 3 import org.naftulin.configmgr.parsers.ConfigEntryParser; 4 import org.naftulin.configmgr.parsers.XmlFileParserImpl; 5 import org.apache.commons.lang.builder.ToStringBuilder; 6 7 8 public class XmlRecordImpl extends AbstractRecordImpl { 9 private String className; 10 11 /*** 12 * Constructs a record without specifying the key or file name. 13 */ 14 public XmlRecordImpl() { 15 super(); 16 } 17 18 /*** 19 * Constructs a record with the key and file name specified. 20 * @param key the key associated with the record. 21 * @param fileName the file name associated with the record. 22 */ 23 public XmlRecordImpl(final String key, final String fileName, final String className) { 24 super(key, fileName); 25 this.className = className; 26 } 27 28 /*** 29 * Returns an instance of {@link org.naftulin.configmgr.parsers.PropertyFileParserImpl parser} 30 * that parses a property file and stores it as {@link java.util.Properties properties}. 31 * @return the parser that can parse the file to extract the configuration. 32 */ 33 public ConfigEntryParser getParser() { 34 return new XmlFileParserImpl(className); 35 } 36 37 38 public String getClassName() { 39 return className; 40 } 41 42 public void setClassName(final String className) { 43 this.className = className; 44 } 45 46 /*** 47 * Returns the string representation of the xml record. 48 * @return the string representation of the xml record. 49 */ 50 public String toString() { 51 return new ToStringBuilder(this).append("key", this.getKey()).append( 52 "parser", this.getParser()).append("fileName", 53 this.getFileName()).toString(); 54 } 55 56 57 58 }