*/
private ServiceContext unmarshal(Integer scId, byte[] data) {
ServiceContextRegistry scr = orb.getServiceContextRegistry();
ServiceContextData scd = scr.findServiceContextData(scId.intValue());
ServiceContext sc = null;
if (scd == null) {
if (orb.serviceContextDebugFlag) {
dprint("Could not find ServiceContextData for "
+ scId
+ " using UnknownServiceContext");
}
sc = new UnknownServiceContext(scId.intValue(), data);
} else {
if (orb.serviceContextDebugFlag) {
dprint("Found " + scd);
}
// REVISIT. GIOP version should be specified as
// part of a service context's definition, so should
// be accessible from ServiceContextData via
// its ServiceContext implementation class.
//
// Since we don't have that, yet, I'm using the GIOP
// version of the input stream, presuming that someone
// can't send a service context of a later GIOP
// version than its stream version.
//
// Note: As of Jan 2001, no standard OMG or Sun service contexts
// ship wchar data or are defined as using anything but GIOP 1.0 CDR.
EncapsInputStream eis
= EncapsInputStreamFactory.newEncapsInputStream(orb,
data,
data.length,
giopVersion,
codeBase);
eis.consumeEndian();
// Now the input stream passed to a ServiceContext
// constructor is already the encapsulation input
// stream with the endianness read off, so the
// service context should just unmarshal its own
// data.
sc = scd.makeServiceContext(eis, giopVersion);
if (sc == null)
throw wrapper.svcctxUnmarshalError(
CompletionStatus.COMPLETED_MAYBE);
}