author | František Kučera <franta-hg@frantovo.cz> |
Fri, 01 Jan 2010 16:44:46 +0100 | |
changeset 4 | 5816c7f61a2a |
parent 2 | 2f02db6cd698 |
child 5 | ed73b8912549 |
permissions | -rw-r--r-- |
franta-hg@2 | 1 |
package cz.frantovo.abcDrupal; |
franta-hg@2 | 2 |
|
franta-hg@4 | 3 |
import java.sql.Connection; |
franta-hg@4 | 4 |
import java.sql.DriverManager; |
franta-hg@4 | 5 |
import java.sql.SQLException; |
franta-hg@2 | 6 |
import java.util.Date; |
franta-hg@2 | 7 |
|
franta-hg@2 | 8 |
/** |
franta-hg@2 | 9 |
* Řídící třída, stará se o konverzi z databáze Drupalu do databáze ABC. |
franta-hg@2 | 10 |
* @author fiki |
franta-hg@2 | 11 |
*/ |
franta-hg@2 | 12 |
public class Konvertor { |
franta-hg@2 | 13 |
|
franta-hg@4 | 14 |
private PosluchacLogu posluchacLogu; |
franta-hg@2 | 15 |
private String jdbcZdroj; |
franta-hg@2 | 16 |
private String jdbcCil; |
franta-hg@4 | 17 |
private Connection dbZdroj; |
franta-hg@4 | 18 |
private Connection dbCil; |
franta-hg@2 | 19 |
|
franta-hg@2 | 20 |
public Konvertor(String jdbcZdroj, String jdbcCil, PosluchacLogu posluchacLogu) { |
franta-hg@2 | 21 |
this.jdbcZdroj = jdbcZdroj; |
franta-hg@2 | 22 |
this.jdbcCil = jdbcCil; |
franta-hg@2 | 23 |
this.posluchacLogu = posluchacLogu; |
franta-hg@2 | 24 |
} |
franta-hg@2 | 25 |
|
franta-hg@2 | 26 |
public void konvertuj() { |
franta-hg@2 | 27 |
vypis("Začíná migrace"); |
franta-hg@4 | 28 |
|
franta-hg@4 | 29 |
|
franta-hg@4 | 30 |
|
franta-hg@4 | 31 |
|
franta-hg@2 | 32 |
vypis("Migrace dokončena"); |
franta-hg@2 | 33 |
} |
franta-hg@4 | 34 |
|
franta-hg@4 | 35 |
private void nastavDBspojeni() throws SQLException { |
franta-hg@4 | 36 |
dbZdroj = DriverManager.getConnection(""); |
franta-hg@4 | 37 |
} |
franta-hg@4 | 38 |
|
franta-hg@2 | 39 |
|
franta-hg@2 | 40 |
private void vypis(String zprava) { |
franta-hg@2 | 41 |
if (posluchacLogu != null) { |
franta-hg@2 | 42 |
posluchacLogu.vypis(new Date() + " " + zprava); |
franta-hg@2 | 43 |
} |
franta-hg@2 | 44 |
} |
franta-hg@2 | 45 |
} |