1 /*
2 * Copyright (C) 2004 TiongHiang Lee
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Email: thlee@onemindsoft.org
19 */
20 package org.onemind.commons.relabean.serialize;
21
22
23 import java.io.InputStream;
24
25 import java.util.Collection;
26 import org.onemind.commons.relabean.RelationalBeanModel;
27
28
29 /***
30 * A model reader
31 * @author TiongHiang Lee (thlee@onemindsoft.org)
32 * @version $Id: BeanModelReader.java,v 1.2 2004/08/26 16:29:00 thlee Exp $ $Name: $
33 */
34 public abstract class BeanModelReader
35 {
36 /*** the model **/
37 private RelationalBeanModel _model;
38
39 /***
40 * Constructor
41 * @param model the model
42 */
43 public BeanModelReader(RelationalBeanModel model)
44 {
45 _model = model;
46 }
47
48 /***
49 * Read the metamodel from the stream
50 * @param instream the input stream
51 * @return the relational bean model
52 */
53 public abstract RelationalBeanModel readMetaModel(InputStream instream);
54
55 /***
56 * Read the model instance
57 * @param stream the input stream
58 * @return the model instance
59 */
60 public abstract Collection readModel(InputStream stream);
61
62 /***
63 * Get sax instance of the reader
64 * @return the reader
65 */
66 private BeanModelReader getSaxInstance()
67 {
68 /*
69 // Use an instance of ourselves as the SAX event handler
70 DefaultHandler handler = new Echo();
71 // Use the default (non-validating) parser
72 SAXParserFactory factory = SAXParserFactory.newInstance();
73 // Set up output stream
74 out = new OutputStreamWriter(System.out, "UTF8");
75 // Parse the input
76 SAXParser saxParser = factory.newSAXParser();
77 saxParser.parse(new File(argv[0]), handler);
78 */
79
80 //TODO: TBI
81 //@todo TBI
82 return null;
83 }
84 }