On second thought, let's configure the standalone client reference via an

optional injection.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6414 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Andrzej Kapolka
2011-01-05 02:03:25 +00:00
parent 0c28d31357
commit f9ce9f6939
@@ -42,7 +42,7 @@ import com.samskivert.util.StringUtil;
import com.threerings.io.Streamable;
import com.threerings.presents.client.InvocationDirector;
import com.threerings.presents.client.Client;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.data.InvocationCodes;
import com.threerings.presents.data.InvocationMarshaller;
@@ -94,17 +94,6 @@ public class InvocationManager
log.debug("Created invocation service object", "oid", _invoid);
}
/**
* Sets the invocation director to install in created marshallers. This is used in standalone
* mode, where marshallers are not streamed (usually, the director reference is set on
* unstreaming).
*/
public void setInvocationDirector (InvocationDirector invdir)
{
// TODO: change references in existing marshallers?
_invdir = invdir;
}
/**
* Returns the object id of the invocation services object.
*/
@@ -184,7 +173,8 @@ public class InvocationManager
T marsh;
try {
marsh = mclass.newInstance();
marsh.init(_invoid, invCode, _invdir);
marsh.init(_invoid, invCode, _standaloneClient == null ?
null : _standaloneClient.getInvocationDirector());
} catch (IllegalAccessException ie) {
throw new RuntimeException(ie);
} catch (InstantiationException ie) {
@@ -284,7 +274,8 @@ public class InvocationManager
// create the marshaller and initialize it
T marsh = dispatcher.createMarshaller();
marsh.init(_invoid, invCode, _invdir);
marsh.init(_invoid, invCode, _standaloneClient == null ?
null : _standaloneClient.getInvocationDirector());
// register the dispatcher
_dispatchers.put(invCode, dispatcher);
@@ -450,8 +441,8 @@ public class InvocationManager
/** Used to generate monotonically increasing provider ids. */
protected int _invCode;
/** The invocation director reference to install in created marshallers (if any). */
protected InvocationDirector _invdir;
/** A reference to the standalone client, if any. */
@Inject(optional=true) protected Client _standaloneClient;
/** The distributed object manager we're working with. */
protected PresentsDObjectMgr _omgr;