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.modules.common.database.jdbc.JDBCTerminalUserFODBSyncTarget;
00046 import org.openmobileis.services.servlet.OpenMISInit;
00047 import org.openmobileis.synchro.algo.replication.utils.DefaultSynchroAtomicObjectDelegate;
00048 import org.openmobileis.synchro.algo.replication.utils.SynchroAtomicObjectManager;
00049 import org.openmobileis.synchro.algo.replication.utils.impl.HSQLAtomicObjectQueryManager;
00050 import org.openmobileis.synchro.algo.syncnumber.SyncNumberManager;
00051 import org.openmobileis.synchro.algo.syncnumber.impl.DefaultSyncNumberManagerDelegate;
00052 import org.openmobileis.synchro.algo.syncnumber.impl.HSQLSyncNumberQueryManager;
00053 import org.openmobileis.synchro.openmsp.server.synctarget.SynchroTargerManager;
00054 import org.openmobileis.synchro.openmsp.server.synctarget.proxy.GenericProxySynchroTarget;
00055
00063 public final class MyCrmServerOpenMISInit implements OpenMISInit {
00064
00068 public MyCrmServerOpenMISInit() {
00069 super();
00070 }
00071
00072
00073
00074
00075 public void preLoadingInit() throws ServiceException {
00076
00077
00078 try {
00079 Properties props = new Properties();
00080 props.put("org.openmobileis.common.log.file", System.getProperty("user.dir")+"/WEB-INF/log/serverlog.txt");
00081 File file = new File(System.getProperty("user.dir")+"/WEB-INF/log");
00082 if (file.exists()) FileLogManager.registerLogManager(props);
00083 else LogManager.registerLogManager(null);
00084
00085
00086
00087
00088 PropertiesManager.getManager().addProperty("server.database.dbDriver", "org.hsqldb.jdbcDriver");
00089 PropertiesManager.getManager().addProperty("server.database.dbServer","jdbc:hsqldb:file:"+System.getProperty("user.dir")+"/hsql/basedb");
00090 PropertiesManager.getManager().addProperty("server.database.dbLogin","sa");
00091 PropertiesManager.getManager().addProperty("server.database.dbPassword","");
00092 PropertiesManager.getManager().addProperty("server.database.pool.monitorInterval", "300");
00093 PropertiesManager.getManager().addProperty("server.database.pool.maxConns", "10");
00094 PropertiesManager.getManager().addProperty("server.database.pool.idleTimeout", "300");
00095 PropertiesManager.getManager().addProperty("server.database.pool.checkoutTimeout", "120");
00096 PropertiesManager.getManager().addProperty("server.database.pool.maxCheckout", "3000");
00097 JdbcPoolManagerDB dbmanager = new JdbcPoolManagerDB();
00098 ManagerDB.registerManager(dbmanager);
00099
00100 PropertiesManager.getManager().addProperty("org.openmobileis.common.user.profil.xmlprofilfile.path",System.getProperty("user.dir") + "/WEB-INF/conf/defaultprofils.xml");
00101
00102
00103 UserManager.getManager().registerUserManagerFactoryForGroup("default", new MyCrmJDBCUserFactory());
00104
00105
00106 SyncNumberManager.getManager().registerDelegate(new DefaultSyncNumberManagerDelegate(new HSQLSyncNumberQueryManager()));
00107
00108
00109
00110
00111
00112
00113
00114 SynchroAtomicObjectManager.getManager().registerDelegateManager(
00115 new DefaultSynchroAtomicObjectDelegate(
00116 new HSQLAtomicObjectQueryManager()
00117 )
00118 );
00119
00120
00121
00122 ProfileDataManager.getManager().registerProfilDataFactoryForGroup("default", new XmlFileProfilDataFactory());
00123
00124
00125 FODBSynchroManager.getManager().registerCollection(new JDBCTerminalUserFODBSyncTarget(new MyCrmTerminalUserlQuery()));
00126
00127 FODBSynchroManager.getManager().registerCollection(new MyCrmLabelSynchroTarget());
00128 FODBSynchroManager.getManager().registerCollection(new MyCrmAccountSynchroTarget());
00129 FODBSynchroManager.getManager().registerCollection(new MyCrmLeadsSynchroTarget());
00130
00131
00132 SynchroTargerManager.getManager().registerProxyTargetForTerminal(new GenericProxySynchroTarget(), null);
00133 } catch (Throwable ex) {
00134 throw new ServiceException(ex);
00135 }
00136
00137
00138 }
00139
00140
00141
00142
00143 public void postLoadingInit() throws ServiceException {
00144 }
00145
00146 }