01: //** Copyright Statement ***************************************************
02: //The Salmon Open Framework for Internet Applications (SOFIA)
03: // Copyright (C) 1999 - 2002, Salmon LLC
04: //
05: // This program is free software; you can redistribute it and/or
06: // modify it under the terms of the GNU General Public License version 2
07: // as published by the Free Software Foundation;
08: //
09: // This program is distributed in the hope that it will be useful,
10: // but WITHOUT ANY WARRANTY; without even the implied warranty of
11: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: // GNU General Public License for more details.
13: //
14: // You should have received a copy of the GNU General Public License
15: // along with this program; if not, write to the Free Software
16: // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: //
18: // For more information please visit http://www.salmonllc.com
19: //** End Copyright Statement ***************************************************
20: package com.salmonllc.personalization;
21:
22: import com.salmonllc.properties.Props;
23: import com.salmonllc.util.MessageLog;
24:
25: /**
26: * The base class for all SkinManager classes. The skin manager loads and saves skins to and from a storage medium
27: */
28: public abstract class SkinManager {
29: /*Use instead of the constructor to get the correct skin manager type for the application*/
30: public static SkinManager getSkinManager(String appName) {
31: Props p = Props.getProps(appName, null);
32: String className = p.getProperty(Props.SKIN_MANAGER_CLASS,
33: "com.salmonllc.personalization.FileSkinManager");
34: try {
35: Class c = Class.forName(className);
36: SkinManager man = (SkinManager) c.newInstance();
37: man.init(appName);
38: return man;
39: } catch (Exception e) {
40: MessageLog.writeErrorMessage(
41: "SkinManager.getSkinManager()", e, null);
42: return null;
43: }
44: }
45:
46: abstract void init(String appName);
47:
48: /*Loads the data for a skin with the specified name and append its attributes to the current skin*/
49: public abstract void load(String name, Skin skin);
50:
51: /*Saves a skin under the specified name, if it exists it is overwritten*/
52: public abstract void save(String name, Skin skin);
53:
54: /*Gets an array of available skin names*/
55: public abstract String[] getSkinNames();
56:
57: }
|