[Snmap-developer] SNMAP/src/net/sf/snmap/cfg Configuration.java,1.1,1.2
Status: Planning
Brought to you by:
arden
|
From: arden l. <ar...@us...> - 2005-12-23 23:51:11
|
Update of /cvsroot/snmap/SNMAP/src/net/sf/snmap/cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8112/src/net/sf/snmap/cfg Modified Files: Configuration.java Log Message: Index: Configuration.java =================================================================== RCS file: /cvsroot/snmap/SNMAP/src/net/sf/snmap/cfg/Configuration.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Configuration.java 10 Dec 2005 06:12:15 -0000 1.1 --- Configuration.java 23 Dec 2005 23:51:02 -0000 1.2 *************** *** 20,23 **** --- 20,24 ---- import net.sf.snmap.MappingException; import net.sf.snmap.SnmapException; + import net.sf.snmap.util.CollectionHelper; import net.sf.snmap.util.XMLHelper; *************** *** 38,44 **** --- 39,54 ---- */ public Configuration() { + init(); } /** + * Initiate class member. + */ + protected void init() { + xmlHelper = new XMLHelper(); + properties = Environment.getProperties(); + } + + /** * * @param url *************** *** 179,183 **** throws MappingException { try { ! List errors = new ArrayList(); org.dom4j.Document doc = xmlHelper.createSAXReader( "XML InputStream", errors).read( --- 189,193 ---- throws MappingException { try { ! List<SAXParseException> errors = new ArrayList<SAXParseException>(); org.dom4j.Document doc = xmlHelper.createSAXReader( "XML InputStream", errors).read( *************** *** 186,191 **** throw new MappingException("invalid mapping", (Throwable) errors.get(0)); ! // TODO : ! // add( doc ); return this; } catch (MappingException me) { --- 196,200 ---- throw new MappingException("invalid mapping", (Throwable) errors.get(0)); ! add( doc ); return this; } catch (MappingException me) { *************** *** 202,204 **** --- 211,231 ---- } } + + protected void add(org.dom4j.Document doc) throws MappingException { + try { + SnmapBinder.bindRoot( doc, createMappings(), CollectionHelper.EMPTY_MAP ); // TODO: possibly get inheritable meta's from cfg.xml + } + catch ( MappingException me ) { + log.error( "Could not compile the mapping document", me ); + throw me; + } + } + + /** + * Create a new <tt>Mappings</tt> to add class and collection + * mappings to. + */ + public Mappings createMappings() { + return new Mappings(); + } } |