try {
DmcClassInfo dci = DmcOmni.instance().getClassInfo(request.getFilter());
if (dci == null){
// If we don't recognize the class, we can't proceed
Response response = request.getErrorResponse();
response.setResponseText("Unknown class: " + request.getFilter());
response.setLastResponse(true);
sendMessage(response);
logger.error("Unknown filter class: " + request.getFilter() + " in GetRequest\n" + request.toOIF());
return;
}
if (request.isTrackingEnabled())
logger.trace("Retrieving objects from class index: " + dci.name);
synchronized(this){
// The set of objects we're sending back
Collection<DmwNamedObjectWrapper> objects = null;
// Establish the blocking factor i.e. how many objects we'll send back
// in a single response.
Integer bf = request.getBlockingFactor();
int blockingFactor = bf == null ? -1 : bf < 10 ? -1 : bf;
// The response container
GetResponse response = request.getResponse();
if (request.isRegisterForEvents()){
// The client wants events for the objects - we'll wind up adding a listener
// to the cache of the appropriate type.
CacheListener listener = null;
listener = new CacheIndexListener(cacheRegistration, this, request.getSliceInfo(), dci);
logger.trace("Registered cache index listener with ID: " + listener.getListenerID());
listeners.put(listener.getListenerID(), listener);
response.setListenerID(listener.getListenerID());
objects = listener.activateAndRetrieve();
}
else{
objects = cache.getIndex(dci);
}
if (objects.size() == 0){
response.setLastResponse(true);
response.setResponseText("No " + dci.name + " objects have been indexed.");
}
else{
if (request.isTrackingEnabled())
logger.trace(objects.size() + " objects to be sent");
for(DmwNamedObjectWrapper object: objects){
response.addObjectList(object);
if (response.getObjectListSize() == blockingFactor){
response.setLastResponse(false);
sendMessage(response);
response = request.getResponse();
}
}
}
response.setLastResponse(true);
sendMessage(response);
}
// logger.trace("Outside synch block");
}