com.tekann.webservice.client
Class WSHandler

java.lang.Object
  extended by com.tekann.webservice.client.WSHandler
All Implemented Interfaces:
TKNMSWSClient

public class WSHandler
extends java.lang.Object
implements TKNMSWSClient

Used to call methods from the Web Service generated by TKN Mobile Studio.

Author:
evandro

Field Summary
static int TIME_OUT
          Connection time out - GPRS.
static boolean useGPRS
          Used to make the connection call
 
Constructor Summary
WSHandler(java.lang.String uri)
          Default constructor.
WSHandler(java.lang.String url, java.lang.String service)
          Deprecated. Use public WSHandler(String uri)
 
Method Summary
static boolean connectGPRS()
          Connect the GPRS connection.
 int delete(com.tekann.codegen.pda.db.IDTO dto)
          Executes the delete method.
 int delete(java.lang.String tableName, java.lang.String whereClause)
          Executes the delete method
static boolean disconnectGPRS()
          Disconnect the GPRS connection.
 AppContext getAppContextTableData(java.lang.String dataExchangeProjectName)
          Gets the app context table data
 com.tekann.codegen.pda.ILogger getLogger()
          Get the logger.
 long getNextId(java.lang.String columnName, java.lang.String tableName)
          Executes the getNextID method.
 totalcross.util.Hashtable getRangesByPDAContext(java.lang.String dataExchangeProjectName)
          Gets the ranges XML of a PDA
 totalcross.util.Vector getSyncTables(java.lang.String dataExchangeProjectName)
          Gets the tables to synchronize
 totalcross.util.Vector getTablesMetaData(java.lang.String dataExchangeProjectName)
          Gets the table metadata according to the passed project name
 java.lang.String getURI()
          Gets the URI
 int insert(com.tekann.codegen.pda.db.IDTO dto)
          Executes the insert.
 int insert(totalcross.util.Vector dtos)
          Executes the insert.
 java.lang.Object select(com.tekann.codegen.pda.db.IDAO[] daos, java.lang.String tableGroupName, boolean scriptMode)
          Select for multiple tables.
 java.lang.Object select(java.lang.String query)
          Executes the select.
 java.lang.Object select(java.lang.String tableName, java.lang.String pdaTableName, java.lang.String whereClause)
          Executes the select.
 java.lang.Object select(java.lang.String tableName, java.lang.String pdaTableName, java.lang.String columns, java.lang.String whereClause)
          Executes the select.
 int sendData(totalcross.util.Vector dtos)
           
 void setLogger(com.tekann.codegen.pda.ILogger logger)
           
 void setURI(java.lang.String uri, java.lang.String service)
          Sets the URI
 java.lang.Object syncDBtoPDA(java.lang.String dataExchangeProjectName)
          Extract the database data from the server according to the synchronization project
 int syncPDAtoDB(java.lang.Object[] dtos, java.lang.String dataExchangeProjectName)
          Executes the syncPDAtoDB
 int update(com.tekann.codegen.pda.db.IDTO dto, java.lang.String whereClause)
          Executes the update.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TIME_OUT

public static int TIME_OUT
Connection time out - GPRS.


useGPRS

public static boolean useGPRS
Used to make the connection call

Constructor Detail

WSHandler

public WSHandler(java.lang.String url,
                 java.lang.String service)
Deprecated. Use public WSHandler(String uri)

Default constructor.

Parameters:
url - URI service.
service - Service name.

WSHandler

public WSHandler(java.lang.String uri)
Default constructor.

Parameters:
uri - URI service.
Method Detail

connectGPRS

public static boolean connectGPRS()
                           throws totalcross.io.IOException
Connect the GPRS connection.

Parameters:
timeout - Connection time out.
Throws:
totalcross.io.IOException

disconnectGPRS

public static boolean disconnectGPRS()
                              throws totalcross.io.IOException
Disconnect the GPRS connection.

Throws:
totalcross.io.IOException

select

public java.lang.Object select(java.lang.String query)
                        throws java.lang.Exception
Description copied from interface: TKNMSWSClient
Executes the select.

Specified by:
select in interface TKNMSWSClient
Returns:
A vector with the DTOs
Throws:
java.lang.Exception

select

public java.lang.Object select(java.lang.String tableName,
                               java.lang.String pdaTableName,
                               java.lang.String whereClause)
                        throws java.lang.Exception
Description copied from interface: TKNMSWSClient
Executes the select.

Specified by:
select in interface TKNMSWSClient
Returns:
A vector with the DTOs
Throws:
java.lang.Exception

select

public java.lang.Object select(java.lang.String tableName,
                               java.lang.String pdaTableName,
                               java.lang.String columns,
                               java.lang.String whereClause)
                        throws java.lang.Exception
Description copied from interface: TKNMSWSClient
Executes the select.

Specified by:
select in interface TKNMSWSClient
Returns:
A vector with the DTOs
Throws:
java.lang.Exception

select

public java.lang.Object select(com.tekann.codegen.pda.db.IDAO[] daos,
                               java.lang.String tableGroupName,
                               boolean scriptMode)
                        throws java.lang.Exception
Select for multiple tables.

Parameters:
daos -
tableGroupName -
scriptMode - True: file with inserts
False: XML with DTOs (work for BLOB type)
Returns:
Throws:
java.lang.Exception

update

public int update(com.tekann.codegen.pda.db.IDTO dto,
                  java.lang.String whereClause)
           throws java.lang.Exception
Description copied from interface: TKNMSWSClient
Executes the update.

Specified by:
update in interface TKNMSWSClient
Returns:
status code.
Throws:
java.lang.Exception

insert

public int insert(com.tekann.codegen.pda.db.IDTO dto)
           throws java.lang.Exception
Description copied from interface: TKNMSWSClient
Executes the insert.

Specified by:
insert in interface TKNMSWSClient
Returns:
status code
Throws:
java.lang.Exception

sendData

public int sendData(totalcross.util.Vector dtos)
             throws java.lang.Exception
Throws:
java.lang.Exception

insert

public int insert(totalcross.util.Vector dtos)
           throws java.lang.Exception
Description copied from interface: TKNMSWSClient
Executes the insert.

Specified by:
insert in interface TKNMSWSClient
Returns:
status code
Throws:
java.lang.Exception

delete

public int delete(com.tekann.codegen.pda.db.IDTO dto)
           throws java.lang.Exception
Description copied from interface: TKNMSWSClient
Executes the delete method.

Specified by:
delete in interface TKNMSWSClient
Returns:
status code.
Throws:
java.lang.Exception

delete

public int delete(java.lang.String tableName,
                  java.lang.String whereClause)
           throws java.lang.Exception
Description copied from interface: TKNMSWSClient
Executes the delete method

Specified by:
delete in interface TKNMSWSClient
Returns:
status code.
Throws:
java.lang.Exception

getAppContextTableData

public AppContext getAppContextTableData(java.lang.String dataExchangeProjectName)
                                  throws java.lang.Exception
Gets the app context table data

Parameters:
dataExchangeProjectName -
Returns:
Throws:
java.lang.Exception

getNextId

public long getNextId(java.lang.String columnName,
                      java.lang.String tableName)
               throws java.lang.Exception
Description copied from interface: TKNMSWSClient
Executes the getNextID method.

Specified by:
getNextId in interface TKNMSWSClient
Returns:
the generated ID
Throws:
java.lang.Exception

getRangesByPDAContext

public totalcross.util.Hashtable getRangesByPDAContext(java.lang.String dataExchangeProjectName)
                                                throws java.lang.Exception
Description copied from interface: TKNMSWSClient
Gets the ranges XML of a PDA

Specified by:
getRangesByPDAContext in interface TKNMSWSClient
Returns:
Throws:
java.lang.Exception

getSyncTables

public totalcross.util.Vector getSyncTables(java.lang.String dataExchangeProjectName)
                                     throws java.lang.Exception
Description copied from interface: TKNMSWSClient
Gets the tables to synchronize

Specified by:
getSyncTables in interface TKNMSWSClient
Returns:
A PDASyncTableSettings array.
Throws:
java.lang.Exception

getTablesMetaData

public totalcross.util.Vector getTablesMetaData(java.lang.String dataExchangeProjectName)
                                         throws java.lang.Exception
Gets the table metadata according to the passed project name

Parameters:
dataExchangeProjectName -
Returns:
Throws:
java.lang.Exception

getURI

public java.lang.String getURI()
Gets the URI

Returns:

setURI

public void setURI(java.lang.String uri,
                   java.lang.String service)
Sets the URI

Parameters:
uri -
service -

syncDBtoPDA

public java.lang.Object syncDBtoPDA(java.lang.String dataExchangeProjectName)
                             throws java.lang.Exception
Description copied from interface: TKNMSWSClient
Extract the database data from the server according to the synchronization project

Specified by:
syncDBtoPDA in interface TKNMSWSClient
Returns:
Throws:
java.lang.Exception

syncPDAtoDB

public int syncPDAtoDB(java.lang.Object[] dtos,
                       java.lang.String dataExchangeProjectName)
                throws java.lang.Exception
Description copied from interface: TKNMSWSClient
Executes the syncPDAtoDB

Specified by:
syncPDAtoDB in interface TKNMSWSClient
Parameters:
dtos - DTOs array to be synchronized
Throws:
java.lang.Exception

getLogger

public com.tekann.codegen.pda.ILogger getLogger()
Description copied from interface: TKNMSWSClient
Get the logger.

Specified by:
getLogger in interface TKNMSWSClient
Returns:

setLogger

public void setLogger(com.tekann.codegen.pda.ILogger logger)