00001 /* 00002 * OpenMobileIS - a free Java Framework for mobile applications 00003 * 00004 * Copyright (C) 2004 Philippe Delrieu. 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public 00017 * License along with this library; if not, write to the Free 00018 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 * 00020 * Philippe Delrieu kept the rigth to distribute all code Copyrighted by philippe Delrieu 00021 * under other licence term even commercial one. 00022 * 00023 * Modifications : 00024 * 2004 Creation P.Delrieu 00025 * 00026 */ 00027 package org.openmobileis.modules.crm.data.common; 00028 00029 import org.openmobileis.common.context.ApplicationContextManager; 00030 import org.openmobileis.common.util.collection.Array; 00031 import org.openmobileis.common.util.exception.ServiceException; 00032 import org.openmobileis.database.DatabaseException; 00033 00042 public class GlobalPropertyManager { 00043 00044 00045 private static GlobalPropertyManager manager; 00046 private GlobalPropertyFactory factory; 00050 public GlobalPropertyManager(GlobalPropertyFactory factory) { 00051 super(); 00052 this.factory = factory; 00053 } 00054 00055 public static void registerManager(GlobalPropertyManager m) { 00056 manager = m; 00057 ApplicationContextManager.getManager().addManager(manager); 00058 } 00059 00060 public static GlobalPropertyManager getManager() { 00061 return manager; 00062 } 00063 00064 public static void removeManager() { 00065 manager = null; 00066 } 00067 00068 public GlobalPropertyFactory getFactory() { 00069 return this.factory; 00070 } 00071 00072 public GlobalProperty getProperty(String service, String key) throws ServiceException { 00073 return this.factory.getProperty(service, key); 00074 } 00075 00076 public Array getPropertiesForService(String service) throws ServiceException { 00077 return this.factory.getPropertiesForService(service); 00078 } 00079 00080 public Array getAllGlobalProperties() throws ServiceException { 00081 return this.factory.getAllGlobalProperties(); 00082 } 00083 00084 public void storeProperty(GlobalProperty property) throws DatabaseException { 00085 this.factory.storeProperty(property); 00086 } 00087 00088 public void deleteProperty(String service, String key) throws DatabaseException { 00089 this.factory.deleteProperty(service, key); 00090 } 00091 00092 00093 }