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

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

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