From f3385ad3a868738f79a6f9ff53de1086e4a2cbd6 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Sun, 6 Oct 2002 02:37:58 +0000 Subject: [PATCH] Perform the permissions check. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1779 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../crowd/server/PlaceRegistry.java | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/java/com/threerings/crowd/server/PlaceRegistry.java b/src/java/com/threerings/crowd/server/PlaceRegistry.java index e314616d0..5f03a5d13 100644 --- a/src/java/com/threerings/crowd/server/PlaceRegistry.java +++ b/src/java/com/threerings/crowd/server/PlaceRegistry.java @@ -1,5 +1,5 @@ // -// $Id: PlaceRegistry.java,v 1.22 2002/10/06 00:44:58 mdb Exp $ +// $Id: PlaceRegistry.java,v 1.23 2002/10/06 02:37:58 mdb Exp $ package com.threerings.crowd.server; @@ -91,36 +91,38 @@ public class PlaceRegistry PlaceConfig config, CreationObserver observer) throws InstantiationException, InvocationException { + PlaceManager pmgr = null; + try { // load up the manager class Class pmgrClass = Class.forName(config.getManagerClassName()); // create a place manager for this place - PlaceManager pmgr = (PlaceManager)pmgrClass.newInstance(); + pmgr = (PlaceManager)pmgrClass.newInstance(); // let the pmgr know about us and its configuration pmgr.init(this, _invmgr, _omgr, config); - // give the manager an opportunity to abort the whole process - // if it fails any permissions checks - String errmsg = pmgr.checkPermissions(); - if (errmsg != null) { - throw new InvocationException(errmsg); - } - - // stick the manager on the creation queue because we know - // we'll get our calls to objectAvailable()/requestFailed() in - // the order that we call createObject() - _createq.append(new Tuple(pmgr, observer)); - - // and request to create the place object - _omgr.createObject(pmgr.getPlaceObjectClass(), this); - - return pmgr; - } catch (Exception e) { Log.logStackTrace(e); throw new InstantiationException( "Error creating place manager [config=" + config + "]."); } + + // give the manager an opportunity to abort the whole process + // if it fails any permissions checks + String errmsg = pmgr.checkPermissions(); + if (errmsg != null) { + throw new InvocationException(errmsg); + } + + // stick the manager on the creation queue because we know + // we'll get our calls to objectAvailable()/requestFailed() in + // the order that we call createObject() + _createq.append(new Tuple(pmgr, observer)); + + // and request to create the place object + _omgr.createObject(pmgr.getPlaceObjectClass(), this); + + return pmgr; } /**