View Javadoc

1   
2   package migratool.datasources.geometric.textFile;
3   
4   import migratool.datasources.AbstractDestinationDataSource;
5   import migratool.datasources.AbstractOriginDataSource;
6   import migratool.datasources.DataSourceException;
7   import migratool.datasources.superDataSourceFactory.DataSourceFactoryIF;
8   import migratool.definition.parser.MigBean;
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   */
34  
35  public class GeomTextFileDataSourceFactory implements DataSourceFactoryIF{
36  
37  	/** Singleton */
38  	private static GeomTextFileDataSourceFactory singleton;
39  	private MigBean migDescription;
40  
41  
42  	private GeomTextFileDataSourceFactory(MigBean migDescription){
43  		this.migDescription = migDescription; 
44  	}
45  
46  	/**
47  	 * M�todo que retorna a inst�ncia do Singleton
48  	 * @return Uma f�brica de Formatters SVG
49  	 */
50  	public static GeomTextFileDataSourceFactory getInstance(MigBean migDescription) {
51  		if (singleton == null)
52  			singleton = new GeomTextFileDataSourceFactory(migDescription);
53  		return singleton;
54  	}
55  
56  	public AbstractOriginDataSource getOriginDataSource() {
57  		return new GeomTextFileOriginDataSource(migDescription.getSource());
58  	}
59  
60  	public AbstractDestinationDataSource getDestinationDataSource() throws DataSourceException{
61  		return new GeomTextFileDestinationDataSource(migDescription.getDestination());
62  	}
63  	
64  	public String toString(){
65  		return "GeomTextFileDataSourceFactory";
66  	}
67  
68  }