View Javadoc

1   package migratool;
2   
3   import java.io.FileNotFoundException;
4   import java.io.FileReader;
5   
6   import migratool.definition.parser.MigBean;
7   import migratool.definition.parser.MigParser;
8   import migratool.definition.parser.ParserException;
9   
10  /**
11   * 
12   * MIGRATOOL Program to migrate spatial databsets.
13   * Copyright (C) 2007 Fábio Luiz Leite Júnior
14   * Universidade Federal de Campina Grande
15   * contact: fabioleite@gmail.com
16   *
17   * This program is free software; you can redistribute it and/or
18   * modify it under the terms of the GNU General Public License
19   * as published by the Free Software Foundation; either version 2
20   * of the License, or (at your option) any later version.
21   *
22   * This program is distributed in the hope that it will be useful,
23   * but WITHOUT ANY WARRANTY; without even the implied warranty of
24   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25   * GNU General Public License for more details.
26   *
27   * You should have received a copy of the GNU General Public License
28   * along with this program; if not, write to the Free Software
29   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
30   *
31   * @author fabio
32   * 
33   * Classe responsavel por gerenciar a criaçâo dos beans de descriçâo
34   * dos bancos para a lógica do sistema, terá duas opções xml via métodos
35   * diretos. Caso seja xml deve-se passar o caminho do arquivo, se for do
36   * modo direto deve-se passar as informações para que se crie as descrições.
37   *
38   */
39   
40  public class BDbeansGenerator {
41  	
42  	private MigParser parser = null;
43  	
44  	public BDbeansGenerator(){
45  		parser = new MigParser();
46  	}
47  	
48  	public MigBean getDefinitions(String path){
49  		MigBean migBean = new MigBean();
50  		try {
51  			FileReader fileReader = new FileReader(path);
52  			migBean = parser.getMigDefinition(fileReader);
53  		} catch (ParserException e) {
54  			e.printStackTrace();
55  		} catch (FileNotFoundException e) {
56  			e.printStackTrace();
57  		}
58  		return migBean;
59  	}
60  
61  }