01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.object.handler;
06:
07: import com.tc.async.api.AbstractEventHandler;
08: import com.tc.async.api.ConfigurationContext;
09: import com.tc.async.api.EventContext;
10: import com.tc.object.ClientConfigurationContext;
11: import com.tc.object.RemoteObjectManager;
12: import com.tc.object.msg.ObjectsNotFoundMessage;
13: import com.tc.object.msg.RequestManagedObjectResponseMessage;
14:
15: /**
16: * @author steve
17: */
18: public class ReceiveObjectHandler extends AbstractEventHandler {
19: private RemoteObjectManager objectManager;
20:
21: public void handleEvent(EventContext context) {
22: if (context instanceof RequestManagedObjectResponseMessage) {
23: RequestManagedObjectResponseMessage m = (RequestManagedObjectResponseMessage) context;
24: objectManager.addAllObjects(m.getLocalSessionID(), m
25: .getBatchID(), m.getObjects());
26: } else {
27: ObjectsNotFoundMessage notFound = (ObjectsNotFoundMessage) context;
28: objectManager.objectsNotFoundFor(notFound
29: .getLocalSessionID(), notFound.getBatchID(),
30: notFound.getMissingObjectIDs());
31: }
32: }
33:
34: public void initialize(ConfigurationContext context) {
35: super .initialize(context);
36: ClientConfigurationContext ccc = (ClientConfigurationContext) context;
37: this.objectManager = ccc.getObjectManager();
38: }
39:
40: }
|