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

1.1       will        1: ///###////////////////////////////////////////////////////////////////////////
                      2: //
                      3: // Copyright (C) 2000 Will Sargent
1.2     ! will        4: // $Id: SbtpServiceManager.java,v 1.1 2000/11/27 00:33:36 will Exp $
1.1       will        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: 
1.2     ! will       36: import org.log4j.*;
        !            37: 
1.1       will       38: /**
                     39:  *
                     40:  */
                     41: public
                     42: class SbtpServiceManager 
1.2     ! will       43:     implements CoffeeServiceManager
1.1       will       44: {
                     45:     private BookmarksFactory m_BookmarksFactory;
                     46: 
1.2     ! will       47:     Category mLogger = Category.getInstance("bookie.sbtp");
        !            48: 
1.1       will       49:     public SbtpServiceManager()
                     50:     {
                     51:        m_BookmarksFactory = null;
                     52:     }
                     53: 
                     54:     /**
                     55:      * Create the service manager with the factory.
                     56:      */
                     57:     public SbtpServiceManager(BookmarksFactory factory)
                     58:     {
                     59:        m_BookmarksFactory = factory;
                     60:     }
                     61:     
                     62:     public CoffeeService newServiceInstance()
                     63:     {
                     64:        SbtpService service = new SbtpService();
                     65: 
                     66:        service.setBookmarksFactory(m_BookmarksFactory);
                     67: 
                     68:        // General commands
                     69:        service.addCommand("help", new SbtpService_HELP());
                     70:        service.addCommand("quit", new SbtpService_QUIT());
                     71:        service.addCommand("shut", new SbtpService_SHUT());
                     72: 
                     73:        // Bookmark commands
                     74:        service.addCommand("addb", new SbtpService_ADDB());
                     75:        service.addCommand("getb", new SbtpService_GETB());
                     76:        service.addCommand("delb", new SbtpService_DELB());
                     77:        service.addCommand("chgb", new SbtpService_CHGB());
                     78: 
                     79:        // Folder commands
                     80:        service.addCommand("addf", new SbtpService_ADDF());
                     81:        service.addCommand("getf", new SbtpService_GETF());
                     82:        service.addCommand("delf", new SbtpService_DELF());
                     83:        service.addCommand("chgf", new SbtpService_CHGF());
                     84: 
                     85:        // Get children
                     86:        service.addCommand("getc", new SbtpService_GETC());
                     87: 
                     88:        // Separator commands
                     89:        service.addCommand("adds", new SbtpService_ADDS());
                     90:        service.addCommand("dels", new SbtpService_DELS());
                     91: 
1.2     ! will       92:        mLogger.debug("returning service");
        !            93:        
1.1       will       94:        return service;
                     95:     }
                     96: 
                     97:     public void configure(Properties configuration)
                     98:        throws CoffeeServiceException
                     99:     {
                    100:        if (configuration == null)
                    101:        {
                    102:            throw new CoffeeServiceException("no configuration file");
                    103:        }
                    104:        
                    105:        m_BookmarksFactory = new DatabaseBookmarksFactory();
                    106:        m_BookmarksFactory.configure(configuration);
                    107:     }
                    108: 
                    109: }

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