ModulesOpenMISInit.java

00001 /*
00002  * OpenMobileIS - a free Java(TM) Framework for mobile applications Java(TM)
00003  * Copyright (C) 2004-2006 Philippe Delrieu
00004  * All rights reserved.
00005  * Contact: pdelrieu@openmobileis.org
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00020  * USA
00021  *
00022  *  Author : Philippe Delrieu
00023  *  
00024  *  Modifications :
00025  *  Creation P.Delrieu
00026  * 
00027  */
00028 
00029 package org.openmobileis.module;
00030 
00031 import java.io.File;
00032 import java.util.Properties;
00033 
00034 import org.openmobileis.common.intl.IntlResourceManager;
00035 import org.openmobileis.common.util.PropertiesManager;
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.services.servlet.OpenMISInit;
00040 
00041 public class ModulesOpenMISInit implements OpenMISInit {
00042 
00043   public ModulesOpenMISInit() {
00044     super();
00045   }
00046 
00047   public void preLoadingInit() throws ServiceException {
00048     Properties  props = new Properties();
00049     props.put("LOGFILE", System.getProperty("user.dir")+"/WEB-INF/log/pdalog.txt");
00050     File file = new File(System.getProperty("user.dir")+"/WEB-INF/log");
00051     if (file.exists())   FileLogManager.registerLogManager(props); //log to a file
00052     else LogManager.registerLogManager(null); //log to a file
00053     
00054     //init db propeties.
00055     PropertiesManager.getManager().addProperty("fastobjectdb.database.path", System.getProperty("user.dir")+"/database");
00056     PropertiesManager.getManager().addProperty("fastobjectdb.database.name", "db");
00057 
00058     try {
00059       String locale = IntlResourceManager.getManager().getSystemDefaultLocale();
00060       IntlResourceManager.getManager().addLocalizedProperties(System.getProperty("user.dir")+"/WEB-INF/conf/properties/systemmessages.properties", locale);
00061     } catch (Throwable ex)      {
00062       throw new ServiceException(ex);
00063     }
00064     
00065     String numsyncpropsfile = PropertiesManager.getManager().getProperty("org.openmobileis.synchro.client.openmsp.numsyncpropsfile");
00066     if (numsyncpropsfile == null) {
00067       PropertiesManager.getManager().addProperty("org.openmobileis.synchro.client.openmsp.numsyncpropsfile",System.getProperty("user.dir") + "/WEB-INF/conf/numsync.txt");
00068     }
00069     System.out.println();
00070        
00071  }
00072 
00073   public void postLoadingInit() throws ServiceException {
00074   }
00075 
00076 }

Generated on Mon Dec 4 11:03:28 2006 for OpenMobileIS by  doxygen 1.5.1-p1