00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 package org.openmobileis.examples.mycrm.server;
00026
00027 import java.io.File;
00028 import java.util.Properties;
00029
00030 import org.openmobileis.common.user.UserManager;
00031 import org.openmobileis.common.user.profile.ProfileDataManager;
00032 import org.openmobileis.common.user.profile.impl.XmlFileProfilDataFactory;
00033 import org.openmobileis.common.util.PropertiesManager;
00034 import org.openmobileis.common.util.database.JdbcPoolManagerDB;
00035 import org.openmobileis.common.util.database.ManagerDB;
00036 import org.openmobileis.common.util.exception.ServiceException;
00037 import org.openmobileis.common.util.log.FileLogManager;
00038 import org.openmobileis.common.util.log.LogManager;
00039 import org.openmobileis.database.fastobjectdb.synchro.server.FODBSynchroManager;
00040 import org.openmobileis.examples.mycrm.data.jdbc.MyCrmAccountSynchroTarget;
00041 import org.openmobileis.examples.mycrm.data.jdbc.MyCrmJDBCUserFactory;
00042 import org.openmobileis.examples.mycrm.data.jdbc.MyCrmLabelSynchroTarget;
00043 import org.openmobileis.examples.mycrm.data.jdbc.MyCrmLeadsSynchroTarget;
00044 import org.openmobileis.examples.mycrm.data.jdbc.MyCrmTerminalUserlQuery;
00045 import org.openmobileis.examples.mycrm.server.synchro.SampleFileSyncTarget;
00046 import org.openmobileis.modules.common.database.jdbc.JDBCTerminalUserFODBSyncTarget;
00047 import org.openmobileis.modules.common.log.server.LogSyncService;
00048 import org.openmobileis.services.servlet.OpenMISInit;
00049 import org.openmobileis.synchro.algo.replication.utils.DefaultSynchroAtomicObjectDelegate;
00050 import org.openmobileis.synchro.algo.replication.utils.SynchroAtomicObjectManager;
00051 import org.openmobileis.synchro.algo.replication.utils.impl.HSQLAtomicObjectQueryManager;
00052 import org.openmobileis.synchro.algo.syncnumber.SyncNumberManager;
00053 import org.openmobileis.synchro.algo.syncnumber.impl.DefaultSyncNumberManagerDelegate;
00054 import org.openmobileis.synchro.algo.syncnumber.impl.HSQLSyncNumberQueryManager;
00055 import org.openmobileis.synchro.openmsp.server.synctarget.SynchroTargerManager;
00056 import org.openmobileis.synchro.openmsp.server.synctarget.proxy.GenericProxySynchroTarget;
00057
00065 public final class MyCrmServerOpenMISInit implements OpenMISInit {
00066
00070 public MyCrmServerOpenMISInit() {
00071 super();
00072 }
00073
00074
00075
00076
00077 public void preLoadingInit() throws ServiceException {
00078
00079
00080 try {
00081 Properties props = new Properties();
00082 props.put("org.openmobileis.common.log.file", System.getProperty("user.dir")+"/WEB-INF/log/serverlog.txt");
00083 File file = new File(System.getProperty("user.dir")+"/WEB-INF/log");
00084 if (file.exists()) FileLogManager.registerLogManager(props);
00085 else LogManager.registerLogManager(null);
00086
00087
00088
00089
00090 PropertiesManager.getManager().addProperty("server.database.dbDriver", "org.hsqldb.jdbcDriver");
00091 PropertiesManager.getManager().addProperty("server.database.dbServer","jdbc:hsqldb:file:"+System.getProperty("user.dir")+"/hsql/basedb");
00092 PropertiesManager.getManager().addProperty("server.database.dbLogin","sa");
00093 PropertiesManager.getManager().addProperty("server.database.dbPassword","");
00094 PropertiesManager.getManager().addProperty("server.database.pool.monitorInterval", "300");
00095 PropertiesManager.getManager().addProperty("server.database.pool.maxConns", "10");
00096 PropertiesManager.getManager().addProperty("server.database.pool.idleTimeout", "300");
00097 PropertiesManager.getManager().addProperty("server.database.pool.checkoutTimeout", "120");
00098 PropertiesManager.getManager().addProperty("server.database.pool.maxCheckout", "3000");
00099 JdbcPoolManagerDB dbmanager = new JdbcPoolManagerDB();
00100 ManagerDB.registerManager(dbmanager);
00101
00102 PropertiesManager.getManager().addProperty("org.openmobileis.common.user.profil.xmlprofilfile.path",System.getProperty("user.dir") + "/WEB-INF/conf/defaultprofils.xml");
00103
00104
00105 UserManager.getManager().registerUserManagerFactoryForGroup("default", new MyCrmJDBCUserFactory());
00106
00107
00108 SyncNumberManager.getManager().registerDelegate(new DefaultSyncNumberManagerDelegate(new HSQLSyncNumberQueryManager()));
00109
00110
00111
00112
00113
00114
00115
00116 SynchroAtomicObjectManager.getManager().registerDelegateManager(
00117 new DefaultSynchroAtomicObjectDelegate(
00118 new HSQLAtomicObjectQueryManager()
00119 )
00120 );
00121
00122
00123
00124 ProfileDataManager.getManager().registerProfilDataFactoryForGroup("default", new XmlFileProfilDataFactory());
00125
00126
00127 FODBSynchroManager.getManager().registerCollection(new JDBCTerminalUserFODBSyncTarget(new MyCrmTerminalUserlQuery()));
00128
00129 FODBSynchroManager.getManager().registerCollection(new MyCrmLabelSynchroTarget());
00130 FODBSynchroManager.getManager().registerCollection(new MyCrmAccountSynchroTarget());
00131 FODBSynchroManager.getManager().registerCollection(new MyCrmLeadsSynchroTarget());
00132 SynchroTargerManager.getManager().addSynchroTargetListener(new SampleFileSyncTarget(), null, null);
00133 SynchroTargerManager.getManager().addSynchroTargetListener(new LogSyncService(), null, null);
00134
00135
00136 SynchroTargerManager.getManager().registerProxyTargetForTerminal(new GenericProxySynchroTarget(), null);
00137 } catch (Throwable ex) {
00138 throw new ServiceException(ex);
00139 }
00140
00141
00142 }
00143
00144
00145
00146
00147 public void postLoadingInit() throws ServiceException {
00148 }
00149
00150 }