568b1f6ab2
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@400 c613c5cb-e716-0410-b11b-feb51c14d237
75 lines
2.5 KiB
Java
75 lines
2.5 KiB
Java
//
|
|
// $Id$
|
|
//
|
|
// Vilya library - tools for developing networked games
|
|
// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
|
|
// http://www.threerings.net/code/vilya/
|
|
//
|
|
// This library is free software; you can redistribute it and/or modify it
|
|
// under the terms of the GNU Lesser General Public License as published
|
|
// by the Free Software Foundation; either version 2.1 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This library 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
|
|
// Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
// License along with this library; if not, write to the Free Software
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
package com.threerings.whirled.server;
|
|
|
|
import com.threerings.util.Name;
|
|
|
|
import com.threerings.presents.net.AuthRequest;
|
|
import com.threerings.presents.server.ClientFactory;
|
|
import com.threerings.presents.server.ClientResolver;
|
|
import com.threerings.presents.server.PresentsClient;
|
|
|
|
import com.threerings.crowd.server.CrowdServer;
|
|
|
|
import com.threerings.whirled.Log;
|
|
import com.threerings.whirled.server.persist.SceneRepository;
|
|
import com.threerings.whirled.util.SceneFactory;
|
|
|
|
/**
|
|
* The Whirled server extends the {@link CrowdServer} and provides access to managers and the like
|
|
* that are needed by the Whirled serviecs.
|
|
*/
|
|
public abstract class WhirledServer extends CrowdServer
|
|
{
|
|
/** The scene registry. */
|
|
public static SceneRegistry screg;
|
|
|
|
/**
|
|
* Initializes all of the server services and prepares for operation.
|
|
*/
|
|
public void init ()
|
|
throws Exception
|
|
{
|
|
// do the base server initialization
|
|
super.init();
|
|
|
|
// configure the client to use our whirled client
|
|
clmgr.setClientFactory(new ClientFactory() {
|
|
public PresentsClient createClient (AuthRequest areq) {
|
|
return new WhirledClient();
|
|
}
|
|
public ClientResolver createClientResolver (Name username) {
|
|
return new ClientResolver();
|
|
}
|
|
});
|
|
|
|
// create our scene registry
|
|
screg = createSceneRegistry();
|
|
}
|
|
|
|
/**
|
|
* Creates the scene registry to be used on this server.
|
|
*/
|
|
protected abstract SceneRegistry createSceneRegistry ()
|
|
throws Exception;
|
|
}
|