FileDocCategorySizeDatePackage
MethodStartAccessObjectImpl.javaAPI DocGlassfish v2 API6263Fri May 04 22:24:18 BST 2007com.sun.enterprise.admin.monitor.callflow

MethodStartAccessObjectImpl

public class MethodStartAccessObjectImpl extends AbstractTableAccessObject
author
Harpreet Singh

Fields Summary
private static final Logger
logger
private static MethodStartAccessObjectImpl
_singletonMS
Constructors Summary
private MethodStartAccessObjectImpl()
Creates a new instance of MethodStartAccessObjectImpl

    
           
      
        String serverName = super.getServerInstanceName();
        super.tableName = TableInfo.METHOD_START_TABLE_NAME +
                serverName.toUpperCase();
        super.setName ("MethodStart");
        
    
Methods Summary
public booleancreateTable(java.sql.Connection connection)

        super.con = connection;        
        return super.createTable(
                TableInfo.CREATE_TABLE_METHOD_START_SQL, 
                TableInfo.METHOD_START_TABLE_NAME);
    
public booleandropTable(java.sql.Connection connection)

        super.con = connection;        
        return super.createStatmentAndExecuteUpdate(    
                TableInfo.DROP_TABLE_METHOD_START_SQL, 
                TableInfo.METHOD_START_TABLE_NAME);
    
public java.lang.StringgetDeleteSQL()

        String newsql = super.updateSqlWithTableName (
                TableInfo.DELETE_FROM_TABLE_METHOD_START_SQL,
                TableInfo.METHOD_START_TABLE_NAME);
        return newsql;
    
public java.lang.StringgetInsertSQL()

        String newsql = super.updateSqlWithTableName(
                TableInfo.INSERT_INTO_TABLE_METHOD_START_SQL, 
                TableInfo.METHOD_START_TABLE_NAME);
        return newsql;        
    
public static synchronized TableAccessObjectgetInstance()

        return _singletonMS;
    
public booleaninsert(java.sql.PreparedStatement pstmt, TransferObject[] transferObject)

      // sanity
        if (pstmt == null)
            return false;
        boolean result = false;
        try{
            
            for (int i = 0 ; i<transferObject.length; i++) {
                MethodStartTO methodStartTO = (MethodStartTO)transferObject[i];
                pstmt.setString(1, methodStartTO.getRequestId());
                pstmt.setLong(2, methodStartTO.getTimeStamp());
                
                if (methodStartTO.getComponentType() != null)
                    pstmt.setString(3, methodStartTO.getComponentType().toString());
                else
                    pstmt.setString(3, null);

                pstmt.setString(4, methodStartTO.getComponentName());
                pstmt.setString(5, methodStartTO.getAppName());
                pstmt.setString(6, methodStartTO.getMethodName());

                pstmt.setString(7, methodStartTO.getModuleName());
                pstmt.setString(8, methodStartTO.getThreadId());
                pstmt.setString(9, methodStartTO.getTransactionId());

                pstmt.setString(10, methodStartTO.getSecurityId());
                pstmt.addBatch();
            }
            int[] updated = pstmt.executeBatch();
            result =  (updated.length == transferObject.length)? true : false;
            addTotalEntriesProcessed(updated.length);            
            if (isTraceOn()){
                logger.log(Level.INFO, "Callflow: MethodStartAccessObjectImpl " +
                        " Attempting to Insert : " + transferObject.length +
                        " Inserted "+updated.length+ " rows." + 
                        " Total Entries written so far : "+ getTotalEntriesProcessed());
            }
            
        }  catch(BatchUpdateException bue) {
            // log it
            logger.log(Level.FINE, "Error inserting data into CallFlow tables", bue);
            result = false;
        }catch (SQLException se) {
            // log it
            logger.log(Level.FINE, "Error inserting data into CallFlow tables", se);
            result = false;
        }
        return result;