Annotation of bookie/Java/bookie/sbtp/SbtpServiceManager.java, revision 1.1

1.1     ! will        1: ///###////////////////////////////////////////////////////////////////////////
        !             2: //
        !             3: // Copyright (C) 2000 Will Sargent
        !             4: // $Id: DebugPrintWriter.java,v 1.3 1998/03/05 13:55:31 brian Exp $
        !             5: //
        !             6: // This program is free software; you can redistribute it and/or modify
        !             7: // it under the terms of the GNU General Public License as published by
        !             8: // the Free Software Foundation; either version 2 of the License, or
        !             9: // (at your option) any later version.
        !            10: //
        !            11: // This program is distributed in the hope that it will be useful,
        !            12: // but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            13: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            14: // GNU General Public License for more details.
        !            15: //
        !            16: // You should have received a copy of the GNU General Public License
        !            17: // along with this program; see the file COPYING.  If not, write to
        !            18: // the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
        !            19: // Boston, MA 02111-1307, USA.
        !            20: //
        !            21: /**
        !            22:  * The main service manager.  This is picked up by the server tool.
        !            23:  */
        !            24: 
        !            25: package bookie.sbtp;
        !            26: 
        !            27: import java.io.*;
        !            28: import java.util.*;
        !            29: import freeware.coffee_server.pub.*;
        !            30: 
        !            31: import bookie.sbtp.pub.*;
        !            32: import bookie.sbtp.protocol.*;
        !            33: 
        !            34: import bookie.sbtp.database.*;
        !            35: 
        !            36: /**
        !            37:  *
        !            38:  */
        !            39: public
        !            40: class SbtpServiceManager 
        !            41:     implements CoffeeServiceManager, LogConstants
        !            42: {
        !            43:     private BookmarksFactory m_BookmarksFactory;
        !            44: 
        !            45:     public SbtpServiceManager()
        !            46:     {
        !            47:        m_BookmarksFactory = null;
        !            48:     }
        !            49: 
        !            50:     /**
        !            51:      * Create the service manager with the factory.
        !            52:      */
        !            53:     public SbtpServiceManager(BookmarksFactory factory)
        !            54:     {
        !            55:        Log.setCurrentLevel(DEBUG);
        !            56:        m_BookmarksFactory = factory;
        !            57:     }
        !            58:     
        !            59:     public CoffeeService newServiceInstance()
        !            60:     {
        !            61:        SbtpService service = new SbtpService();
        !            62: 
        !            63:        service.setBookmarksFactory(m_BookmarksFactory);
        !            64: 
        !            65:        // General commands
        !            66:        service.addCommand("help", new SbtpService_HELP());
        !            67:        service.addCommand("quit", new SbtpService_QUIT());
        !            68:        service.addCommand("shut", new SbtpService_SHUT());
        !            69: 
        !            70:        // Bookmark commands
        !            71:        service.addCommand("addb", new SbtpService_ADDB());
        !            72:        service.addCommand("getb", new SbtpService_GETB());
        !            73:        service.addCommand("delb", new SbtpService_DELB());
        !            74:        service.addCommand("chgb", new SbtpService_CHGB());
        !            75: 
        !            76:        // Folder commands
        !            77:        service.addCommand("addf", new SbtpService_ADDF());
        !            78:        service.addCommand("getf", new SbtpService_GETF());
        !            79:        service.addCommand("delf", new SbtpService_DELF());
        !            80:        service.addCommand("chgf", new SbtpService_CHGF());
        !            81: 
        !            82:        // Get children
        !            83:        service.addCommand("getc", new SbtpService_GETC());
        !            84: 
        !            85:        // Separator commands
        !            86:        service.addCommand("adds", new SbtpService_ADDS());
        !            87:        service.addCommand("dels", new SbtpService_DELS());
        !            88: 
        !            89:        log(DEBUG, "returning service");
        !            90:        return service;
        !            91:     }
        !            92: 
        !            93:     public void configure(Properties configuration)
        !            94:        throws CoffeeServiceException
        !            95:     {
        !            96:        if (configuration == null)
        !            97:        {
        !            98:            throw new CoffeeServiceException("no configuration file");
        !            99:        }
        !           100:        
        !           101:        m_BookmarksFactory = new DatabaseBookmarksFactory();
        !           102:        m_BookmarksFactory.configure(configuration);
        !           103:     }
        !           104: 
        !           105:     protected void log(int level, String msg)
        !           106:     {
        !           107:        Log.log(this, level, msg);
        !           108:     }
        !           109: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>