Class ServiceContextsImpl
- java.lang.Object
-
- com.sun.corba.ee.impl.servicecontext.ServiceContextsImpl
-
- All Implemented Interfaces:
ServiceContexts
public class ServiceContextsImpl extends java.lang.Object implements ServiceContexts
-
-
Field Summary
Fields Modifier and Type Field Description private CodeBase
codeBase
private static java.util.concurrent.atomic.AtomicInteger
creationCount
private GIOPVersion
giopVersion
private ORB
orb
private java.util.Map<java.lang.Integer,java.lang.Object>
scMap
Map of all ServiceContext objects in this container.private static ORBUtilSystemException
wrapper
-
Constructor Summary
Constructors Modifier Constructor Description private
ServiceContextsImpl(ServiceContextsImpl scimpl)
ServiceContextsImpl(ORB orb)
ServiceContextsImpl(InputStream s)
Read the Service contexts from the input stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServiceContexts
copy()
send back a shallow copy of the ServiceContexts containerprivate void
couldNotFindServiceContextFactory(int scid)
private void
createMapFromInputStream(InputStream is)
Given the input stream, this fills our service context map.void
delete(int scId)
Remove the service context with the id, if any.private void
foundServiceContextFactory(int scid)
ServiceContext
get(int id)
Return the service context with scId, or null if not found.private java.lang.String
getValidSCIds()
private void
numberValid(int num)
void
put(ServiceContext sc)
Add a service context.private void
readingServiceContextId(int id)
private void
serviceContextIdFound(int id)
private void
serviceContextIdNotFound(int id)
private void
serviceContextLength(int len)
private ServiceContext
unmarshal(int scId, byte[] data)
Find the ServiceContextData for a given scId and unmarshal the bytes.private void
unmarshallingServiceContext(int id)
void
write(OutputStream os, GIOPVersion gv)
Write the service contexts to the output stream.private void
writeMapEntry(OutputStream os, int id, java.lang.Object scObj, GIOPVersion gv)
Write the given entry from the scMap to the OutputStream.private void
writeServiceContextsInOrder(OutputStream os, GIOPVersion gv)
Write the service contexts in scMap in a desired order.private void
writingServiceContext(ServiceContext sc)
private void
writingServiceContextBytesFor(int id)
-
-
-
Field Detail
-
wrapper
private static final ORBUtilSystemException wrapper
-
creationCount
private static final java.util.concurrent.atomic.AtomicInteger creationCount
-
orb
private final ORB orb
-
scMap
private final java.util.Map<java.lang.Integer,java.lang.Object> scMap
Map of all ServiceContext objects in this container. Keys are java.lang.Integers for service context IDs. Values are either instances of ServiceContext or the unmarshaled byte arrays (unmarshaled on first use). This provides a mild optimization if we don't happen to use a given service context, but it's main advantage is that it allows us to change the order in which we unmarshal them. We need to do the UnknownExceptionInfo service context after the SendingContextRunTime service context so that we can get the CodeBase if necessary.
-
codeBase
private CodeBase codeBase
-
giopVersion
private GIOPVersion giopVersion
-
-
Constructor Detail
-
ServiceContextsImpl
public ServiceContextsImpl(ORB orb)
-
ServiceContextsImpl
public ServiceContextsImpl(InputStream s)
Read the Service contexts from the input stream.- Parameters:
s
- Stream to get context from
-
ServiceContextsImpl
private ServiceContextsImpl(ServiceContextsImpl scimpl)
-
-
Method Detail
-
getValidSCIds
private java.lang.String getValidSCIds()
-
numberValid
@InfoMethod private void numberValid(int num)
-
readingServiceContextId
@InfoMethod private void readingServiceContextId(int id)
-
serviceContextLength
@InfoMethod private void serviceContextLength(int len)
-
createMapFromInputStream
private void createMapFromInputStream(InputStream is)
Given the input stream, this fills our service context map. See the definition of scMap for details. Creates a HashMap. Note that we don't actually unmarshal the bytes of the service contexts here. That is done when they are actually requested via get(int).
-
couldNotFindServiceContextFactory
@InfoMethod private void couldNotFindServiceContextFactory(int scid)
-
foundServiceContextFactory
@InfoMethod private void foundServiceContextFactory(int scid)
-
unmarshal
private ServiceContext unmarshal(int scId, byte[] data)
Find the ServiceContextData for a given scId and unmarshal the bytes.
-
write
public void write(OutputStream os, GIOPVersion gv)
Write the service contexts to the output stream. If they haven't been unmarshaled, we don't have to unmarshal them.- Specified by:
write
in interfaceServiceContexts
- Parameters:
os
- stream to write togv
- version to use
-
writeServiceContextsInOrder
private void writeServiceContextsInOrder(OutputStream os, GIOPVersion gv)
Write the service contexts in scMap in a desired order. Right now, the only special case we have is UnknownExceptionInfo, so I'm merely writing it last if present.
-
writingServiceContextBytesFor
@InfoMethod private void writingServiceContextBytesFor(int id)
-
writingServiceContext
@InfoMethod private void writingServiceContext(ServiceContext sc)
-
writeMapEntry
private void writeMapEntry(OutputStream os, int id, java.lang.Object scObj, GIOPVersion gv)
Write the given entry from the scMap to the OutputStream. See note on giopVersion. The service context should know the GIOP version it is meant for.
-
put
public void put(ServiceContext sc)
Description copied from interface:ServiceContexts
Add a service context. Silently replaces an existing service context with the same id.- Specified by:
put
in interfaceServiceContexts
- Parameters:
sc
- service context to use
-
delete
public void delete(int scId)
Description copied from interface:ServiceContexts
Remove the service context with the id, if any.- Specified by:
delete
in interfaceServiceContexts
- Parameters:
scId
- service context id
-
serviceContextIdFound
@InfoMethod private void serviceContextIdFound(int id)
-
serviceContextIdNotFound
@InfoMethod private void serviceContextIdNotFound(int id)
-
unmarshallingServiceContext
@InfoMethod private void unmarshallingServiceContext(int id)
-
get
public ServiceContext get(int id)
Description copied from interface:ServiceContexts
Return the service context with scId, or null if not found.- Specified by:
get
in interfaceServiceContexts
- Parameters:
id
- service context id- Returns:
- ServiceContext with the specified ID
-
copy
public ServiceContexts copy()
send back a shallow copy of the ServiceContexts container- Specified by:
copy
in interfaceServiceContexts
-
-