File:  [mozdev] / bookie / Java / bookie / sbtp / Attic / SbtpServiceManager.java
Revision 1.3: download - view: text, annotated - select for diffs - revision graph
Sun Dec 3 09:38:27 2000 UTC (18 years, 2 months ago) by will
Branches: MAIN
CVS tags: HEAD
Improved logging, I think.  Can't remember what I did to this.

///###////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2000 Will Sargent
// $Id: SbtpServiceManager.java,v 1.3 2000/12/03 09:38:27 will Exp $
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; see the file COPYING.  If not, write to
// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
//
/**
 * The main service manager.  This is picked up by the server tool.
 */

package bookie.sbtp;

import java.io.*;
import java.util.*;
import freeware.coffee_server.pub.*;

import bookie.sbtp.pub.*;
import bookie.sbtp.protocol.*;

import bookie.sbtp.database.*;

import org.log4j.*;

/**
 *
 */
public class SbtpServiceManager 
implements CoffeeServiceManager
{
    private BookmarksFactory m_BookmarksFactory;

    Category mLogger = Category.getInstance("bookie.sbtp");

    public SbtpServiceManager()
    {
	m_BookmarksFactory = null;
    }

    /**
     * Create the service manager with the factory.
     */
    public SbtpServiceManager(BookmarksFactory factory)
    {
	m_BookmarksFactory = factory;
    }
    
    public CoffeeService newServiceInstance()
    {
	SbtpService service = new SbtpService();

	service.setBookmarksFactory(m_BookmarksFactory);

	// General commands
  	service.addCommand("help", new SbtpService_HELP());
  	service.addCommand("quit", new SbtpService_QUIT());
	service.addCommand("shut", new SbtpService_SHUT());

	// Bookmark commands
	service.addCommand("addb", new SbtpService_ADDB());
	service.addCommand("getb", new SbtpService_GETB());
	service.addCommand("delb", new SbtpService_DELB());
	service.addCommand("chgb", new SbtpService_CHGB());

	// Folder commands
	service.addCommand("addf", new SbtpService_ADDF());
	service.addCommand("getf", new SbtpService_GETF());
	service.addCommand("delf", new SbtpService_DELF());
	service.addCommand("chgf", new SbtpService_CHGF());

	// Get children
	service.addCommand("getc", new SbtpService_GETC());

	// Separator commands
	service.addCommand("adds", new SbtpService_ADDS());
	service.addCommand("dels", new SbtpService_DELS());

	mLogger.debug("returning service");
	
	return service;
    }

    public void configure(Properties configuration)
	throws CoffeeServiceException
    {
	if (configuration == null)
	{
	    throw new CoffeeServiceException("no configuration file");
	}
	
	m_BookmarksFactory = new DatabaseBookmarksFactory();
	m_BookmarksFactory.configure(configuration);
    }

}

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