TestSynchroTerminal.java

00001 package org.openmobileis.module.test.terminal;
00002 
00003 import org.openmobileis.common.util.PropertiesManager;
00004 import org.openmobileis.common.util.log.LogManager;
00005 import org.openmobileis.module.terminal.ModuleManager;
00006 import org.openmobileis.synchro.client.SynchroDescriptor;
00007 import org.openmobileis.synchro.client.SynchroManager;
00008 import org.openmobileis.synchro.openmsp.client.OpenMSPSynchroManager;
00009 import org.openmobileis.synchro.openmsp.client.conduit.ApacheHTTPClientSynchroConduit;
00010 import org.openmobileis.synchro.security.auth.Credential;
00011 
00012 public final class TestSynchroTerminal {
00013 
00014         public TestSynchroTerminal() {
00015                 // TODO Auto-generated constructor stub
00016         }
00017 
00021         public static void main(String[] args) {
00022                 LogManager.registerLogManager(null);
00023                 try     {
00024                         
00025                         PropertiesManager.getManager().addProperty("org.openmobileis.synchro.client.openmsp.numsyncpropsfile", System.getProperty("user.dir")+"/WEB-INF/conf/numsync.properties");
00026             //init db propeties.
00027             PropertiesManager.getManager().addProperty("fastobjectdb.database.path", System.getProperty("user.dir")+"/database");
00028             PropertiesManager.getManager().addProperty("fastobjectdb.database.name", "db");
00029                         
00030                         SynchroDescriptor descriptor = new SynchroDescriptor();
00031             descriptor.addProperty("OpenMSPsynchrotype", "DR"); // to say direct synchro not mandatory. Can be use if you have different type of synchronisation. To identify them on the server side.
00032             String useragent = OpenMSPSynchroManager.getManager().getSynchroUserAgent(descriptor);
00033             
00034          //   OpenMSPSynchroManager.getManager().addListener(new TestOpenMSPSyncListener(), null);
00035             
00036                 ApacheHTTPClientSynchroConduit conduit = new ApacheHTTPClientSynchroConduit();
00037                 conduit.setSynchroPath(System.getProperty("user.dir")+"/synchro");  //path where synchro file are stored
00038                 conduit.setSynchroUserAgent(useragent); // synchro client user agent. Use to identify the terminal type on the server side
00039                 descriptor.setSynchroConduit(conduit);
00040                 descriptor.setSynchroGroup("default");
00041                 descriptor.setServerURL("http://localhost:9091/services/openmspservice");
00042                 
00043             Credential cred = new Credential("test", "test");
00044             SynchroManager.getManager().registerSynchroProcessor(OpenMSPSynchroManager.getManager());
00045             
00046             //init module management
00047             ModuleManager.getManager().initModule();
00048             
00049             SynchroManager.getManager().doSynchro(cred, descriptor);
00050             int status = OpenMSPSynchroManager.getManager().getGlobalSynchroStatut();
00051             LogManager.traceInfo(0, "Synchro result :"+status);
00052                 } catch (Throwable ex)  {
00053                         LogManager.traceError(0, ex);
00054                 }
00055         
00056         }
00057 
00058 }

Generated on Mon Jan 11 21:19:17 2010 for OpenMobileIS by  doxygen 1.5.4