Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

ImportDecodedRowListener.java

00001 /*
00002  *        OpenMobileIS - a free Java Framework for mobile applications
00003  *
00004  *   Copyright (C) 2002  Philippe Delrieu.
00005  *
00006  *   This program is free software; you can redistribute it and/or
00007  *   modify it under the terms of the GNU General Public
00008  *   License as published by the Free Software Foundation; either
00009  *   version 2 of the License, or (at your option) any later version.
00010  *
00011  *   This program is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *   General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU Library General Public
00017  *   License along with this library; if not, write to the Free
00018  *   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  * 
00020  * Philippe Delrieu kept the rigth to distribute all code Copyrighted by philippe Delrieu
00021  *  under other licence term even commercial one.
00022  *  
00023  *  Modifications :
00024  *  2002 Creation P.Delrieu
00025  * 
00026  */
00027 
00028 package org.openmobileis.synchro.openmsp.client.db;
00029 
00030 import org.openmobileis.common.util.log.*;
00031 import org.openmobileis.common.util.exception.SynchroException;
00032 //import org.openmobileis.embedded.syncho.db.*;
00033 
00043 public final class ImportDecodedRowListener implements DecodedRowListener {
00044 
00045   private ImportQueryManager importQM;
00046 
00047   public ImportDecodedRowListener(ImportQueryManager qm) {
00048     importQM = qm;
00049   }
00050 
00051   public void notifyNewRowDecoded(char action, String[] rowData) {
00052     try {
00053       //make query
00054       if (action == DBImportFileCoder.ADDAction)  {
00055         importQM.executeCreateQuery(rowData);
00056       } else if (action == DBImportFileCoder.REPLACEAction)  {
00057         importQM.executeUpdateQuery(rowData);
00058       } else if (action == DBImportFileCoder.DELETEAction)  {
00059         // get PDA uid for delete. TBD
00060         importQM.executeDeleteQuery(rowData);
00061       }
00062     } catch (Exception ex)  {
00063       LogManager.trace(new SynchroException("ImportDecodedRowListener Error in notifyNewRowDecoded", ex) );
00064     }
00065 
00066   }
00067 
00068   public void notifyError(int ligne, char errorCharacter) {
00069     LogManager.traceError(LogServices.SYNCHROSERVICE, "Error during decoding import Data file at line"+ligne+" for char '"+errorCharacter+"'" );
00070   }
00071 }

Generated on Wed Dec 14 21:05:33 2005 for OpenMobileIS by  doxygen 1.4.4