View Javadoc

1   package migratool.datasources;
2   
3   import migratool.definition.parser.MigBean;
4   import migratool.datasources.superDataSourceFactory.DataSourceFactoryIF;
5   
6   /**
7    * 
8    * MIGRATOOL Program to migrate spatial databsets.
9    * Copyright (C) 2007 Fábio Luiz Leite Júnior
10   * Universidade Federal de Campina Grande
11   * contact: fabioleite@gmail.com
12   *
13   * This program is free software; you can redistribute it and/or
14   * modify it under the terms of the GNU General Public License
15   * as published by the Free Software Foundation; either version 2
16   * of the License, or (at your option) any later version.
17   *
18   * This program is distributed in the hope that it will be useful,
19   * but WITHOUT ANY WARRANTY; without even the implied warranty of
20   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21   * GNU General Public License for more details.
22   *
23   * You should have received a copy of the GNU General Public License
24   * along with this program; if not, write to the Free Software
25   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
26   *
27   * @author fabio
28   *
29   */
30  
31  public class DataSourceFactory implements DataSourceFactoryIF{
32  	
33  	/** Singleton */
34  	private static DataSourceFactory singleton;
35  	private MigBean migDescription;
36  
37  
38  	private DataSourceFactory(MigBean migDescription){
39  		this.migDescription = migDescription; 
40  	}
41  
42  	/**
43  	 * M�todo que retorna a inst�ncia do Singleton
44  	 * @return Uma f�brica de Formatters SVG
45  	 */
46  	public static DataSourceFactory getInstance(MigBean migDescription) {
47  		if (singleton == null)
48  			singleton = new DataSourceFactory(migDescription);
49  		return singleton;
50  	}
51  
52  	public AbstractOriginDataSource getOriginDataSource() {
53  		return new OriginDataSource(migDescription.getSource());
54  	}
55  
56  	public AbstractDestinationDataSource getDestinationDataSource() {
57  		return new DestinationDataSource(migDescription.getDestination());
58  	}
59  	
60  	public String toString(){
61  		return "DataSourceFactory";
62  	}
63  }