1. Informatique Mobile et Synchronisation Sébastien Letélié Ingénieur d’études et de développement [email_address]
2.
3.
4. L’évolution des terminaux Assistants personnels Livres électroniques Jeux électroniques Taille et poids Puissance et mémoire Terminaux voix Terminaux données Terminaux multimédias 1ère convergence Terminaux cible PC Portables PC de poche PC Le facteur de succès principal de l’Internet Mobile est l’ergonomie (Ubicco) Téléphones mobiles voix+données Lecteurs multimédias CD - MP3, DVD Téléphones mobiles voix Téléphone multimédia
30. Exemples (1) - Création d’un Hub private static final String m_CDriver = "com.pointbase.jdbc.jdbcUniversalDriver"; private static final String m_CURL = "jdbc:pointbase://localhost:9092/hubdb"; private static final String m_CUser = "pbpublic"; private static final String m_CPassword = "pbpublic"; private static final String PUB = "Pub1"; private static final String HUBNAME = "Hub1"; public void configureHub2() { try { // First get an instance of the SyncManager SyncManager l_SyncManager = SyncManager.getInstance(m_CURL, m_CDriver, m_CUser, m_CPassword); // Check if the Hub already exists Hub l_Hub = l_SyncManager.getHub(HUBNAME); if(l_Hub == null) { // Create the Hub from the SyncManager l_Hub = l_SyncManager.createHub(HUBNAME); l_Hub.startServer(); } // Publish specified tables String[] tableNames = new String[]{"SCOTT.TABLE1", "SCOTT.TABLE2"}; // Check if the Publication already exists Publication l_Pub = l_Hub.getPublication(PUB); if(l_Pub == null) { // Create a new Publication l_Pub = l_Hub.newPublication(PUB, SyncDataSource.DEFAULT, tableNames); // Save the Publication l_Hub.publish(l_Pub); } } catch(Exception e) { // Handle the exception here } }
31. Exemples (2) - Création d’un Spoke private static final String m_SDriver = "com.pointbase.jdbc.jdbcUniversalDriver"; private static final String m_SURL = "jdbc:pointbase://localhost:9093/spokedb"; private static final String m_SUser = "pbpublic"; private static final String m_SPassword = "pbpublic"; private static final String PUB = "Pub1"; private static final String SUB = "Sub1"; private static final String SPOKENAME = "Spoke1"; private static final String m_HubURL = "tcp://localhost:8123"; public void configureSpoke1() { try { // First get an instance of the SyncManager SyncManager l_SyncManager = SyncManager.getInstance(m_SURL, m_SDriver, m_SUser, m_SPassword); // Check if the Spoke already exists Spoke l_Spoke = l_SyncManager.getSpoke(SPOKENAME); if(l_Spoke == null) { // Create the Spoke from the SyncManager l_Spoke = l_SyncManager.createSpoke(SPOKENAME); // Save the URL to connect to the hub l_Spoke.saveHubURL(m_HubURL); } // Subscribe to Publication PUB. This should get all the SyncTables from the Publication // Check if the Subscription already exists Subscription l_Sub = l_Spoke.getSubscription(SUB); if(l_Sub == null) { SyncDataSource l_DataSource = l_SyncManager.getSyncDataSource(SyncDataSource.DEFAULT); // Get all the tablenames from schema "SCOTT" String[] tableNames = l_DataSource.getAllTableNames("SCOTT"); // Create a new Subscription l_Sub = l_Spoke.newSubscription(SUB, SyncDataSource.DEFAULT, PUB, tableNames); // Save the Subscription l_Spoke.subscribe(l_Sub); } // Get the full snapshot from the Hub l_Spoke.getSnapshot(SUB); } catch(Exception e) { // Handle the exception here } }