// new conversation id so that stateful callbacks will be
// able to find it
if (conversational && callbackObject == null) {
// the component instance is already registered
// so add another registration
ScopeContainer scopeContainer = getConversationalScopeContainer(msg);
if (scopeContainer != null) {
scopeContainer.addWrapperReference(currentConversationID, to.getReferenceParameters()
.getConversationID());
}
}
ReferenceParameters parameters = msg.getTo().getReferenceParameters();
Interface interfaze = msg.getOperation().getInterface();
if (callbackObject != null) {
if (callbackObject instanceof ServiceReference) {
EndpointReference callbackRef = ((CallableReferenceImpl)callbackObject).getEndpointReference();
parameters.setCallbackReference(callbackRef);
} else {
if (interfaze != null) {
if (!interfaze.isConversational()) {
throw new IllegalArgumentException(
"Callback object for stateless callback is not a ServiceReference");
} else {
ScopeContainer scopeContainer = getConversationalScopeContainer(msg);
if (scopeContainer != null) {
InstanceWrapper wrapper = new CallbackObjectWrapper(callbackObject);
scopeContainer.registerWrapper(wrapper, conversation.getConversationID());
}
parameters.setCallbackObjectID("java:" + System.identityHashCode(callbackObject));
}
}
}