///////////////////////////////////////////////////////////////////////////
// OBJECT CREATION HANDLING
private void processCreateRequest(CreateRequest request){
CreateResponse response = null;
if (request.isTrackingEnabled())
logger.trace("Processing create request for: " + request.getNewObject().getConstructionClassName());
DmwNamedObjectWrapper wrapper = (DmwNamedObjectWrapper) request.getNewObjectWrapped();
if (wrapper.getObjectName() == null){
// The object doesn't have a name, we'll try to generate one for it
synchronized (nameGenerators) {
NameGeneratorIF ng = nameGenerators.get(wrapper.getConstructionClassInfo());
if (ng == null){
// Not good, we don't have a name generator, so we can't proceed
response = (CreateResponse) request.getErrorResponse();
response.setResponseText("No name generator was available for objects of type: " + wrapper.getConstructionClassName());
}
else{
ng.createNameForObject(wrapper);
}
}
}
// We attempt to resolve references in the object, this includes its class
// information and references to other objects
try {
wrapper.resolveReferences(this);
} catch (DmcValueExceptionSet e) {
response = (CreateResponse) request.getErrorResponse();
response.setResponseText(e.toString());
}
// We add the object to the cache - if anything goes wrong, an error response will be returned
response = addAndComplainIfNeeded(request, wrapper);
if (response == null){
// The response will have been instantiated if we have an error condition e.g. no name generator
response = request.getResponse();
response.addObjectList(wrapper.getDmcObject());
}
// Fire back the response
requestTracker.processResponse(response);