|
|||||||||||||||||||
| 30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| PlsqlDbCommand.java | 0% | 16,7% | 40% | 21,1% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* Replica is published under the terms
|
|
| 3 |
* of the Apache Software License.
|
|
| 4 |
*/
|
|
| 5 |
package replica.database.commands.plsql;
|
|
| 6 |
|
|
| 7 |
import java.io.StringReader;
|
|
| 8 |
import java.sql.SQLException;
|
|
| 9 |
import java.util.logging.Level;
|
|
| 10 |
|
|
| 11 |
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
|
| 12 |
|
|
| 13 |
import mobisnap.mobile_trx.MobisnapInterpreter;
|
|
| 14 |
import replica.database.commands.DatabaseCommand;
|
|
| 15 |
import replica.database.commands.DatabaseCommandVO;
|
|
| 16 |
import replica.server.commands.PrintCommand;
|
|
| 17 |
|
|
| 18 |
/**
|
|
| 19 |
*
|
|
| 20 |
* @author Pedro Costa
|
|
| 21 |
* @author Helder Silva
|
|
| 22 |
* @since 30/Jan/2004
|
|
| 23 |
*/
|
|
| 24 |
public class PlsqlDbCommand extends DatabaseCommand { |
|
| 25 |
|
|
| 26 |
MobisnapInterpreter mobisnapInterpreter; |
|
| 27 |
DriverManagerDataSource dataSource; |
|
| 28 |
|
|
| 29 |
/**
|
|
| 30 |
*
|
|
| 31 |
*/
|
|
| 32 | 1 |
public PlsqlDbCommand() {
|
| 33 | 1 |
super();
|
| 34 |
} |
|
| 35 |
|
|
| 36 | 0 |
public void init(){ |
| 37 | 0 |
try{
|
| 38 | 0 |
mobisnapInterpreter = new MobisnapInterpreter(dataSource.getDriverClassName(),
|
| 39 |
dataSource.getUrl(), dataSource.getUsername(), dataSource.getPassword()); |
|
| 40 |
} |
|
| 41 |
catch(SQLException e){
|
|
| 42 | 0 |
throw new RuntimeException(e); |
| 43 |
} |
|
| 44 |
} |
|
| 45 |
|
|
| 46 |
/* (non-Javadoc)
|
|
| 47 |
* @see replica.database.commands.DatabaseCommand#execute(replica.database.commands.DatabaseCommandVO)
|
|
| 48 |
*/
|
|
| 49 | 0 |
protected Object execute(DatabaseCommandVO c) {
|
| 50 | 0 |
if( mobisnapInterpreter == null ) |
| 51 | 0 |
init(); |
| 52 |
|
|
| 53 | 0 |
try{
|
| 54 | 0 |
return PrintCommand.NAME + " " + mobisnapInterpreter.processMSQLTrx(new StringReader(c.getCommand())); |
| 55 |
} |
|
| 56 |
catch(Exception e){
|
|
| 57 | 0 |
getLogger().log(Level.SEVERE, e.getMessage(), e); |
| 58 | 0 |
return PrintCommand.NAME + " " + e.getMessage(); |
| 59 |
} |
|
| 60 |
} |
|
| 61 |
|
|
| 62 |
/**
|
|
| 63 |
* @return
|
|
| 64 |
*/
|
|
| 65 | 0 |
public DriverManagerDataSource getDataSource() {
|
| 66 | 0 |
return dataSource;
|
| 67 |
} |
|
| 68 |
|
|
| 69 |
/**
|
|
| 70 |
* @param source
|
|
| 71 |
*/
|
|
| 72 | 1 |
public void setDataSource(DriverManagerDataSource source) { |
| 73 | 1 |
dataSource = source; |
| 74 |
} |
|
| 75 |
|
|
| 76 |
} |
|
| 77 |
|
|
||||||||||