本文整理汇总了Java中com.sun.corba.se.spi.servicecontext.ServiceContexts类的典型用法代码示例。如果您正苦于以下问题:Java ServiceContexts类的具体用法?Java ServiceContexts怎么用?Java ServiceContexts使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceContexts类属于com.sun.corba.se.spi.servicecontext包,在下文中一共展示了ServiceContexts类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStreamFormatVersionForReply
import com.sun.corba.se.spi.servicecontext.ServiceContexts; //导入依赖的package包/类
/**
* If the RMI-IIOP maximum stream format version service context
* is present, it indicates the maximum stream format version we
* could use for the reply. If it isn't present, the default is
* 2 for GIOP 1.3 or greater, 1 for lower.
*
* This is only sent on requests. Clients can find out the
* server's maximum by looking for a tagged component in the IOR.
*/
public byte getStreamFormatVersionForReply() {
// NOTE: The request service contexts may indicate the max.
ServiceContexts svc = getRequestServiceContexts();
MaxStreamFormatVersionServiceContext msfvsc
= (MaxStreamFormatVersionServiceContext)svc.get(
MaxStreamFormatVersionServiceContext.SERVICE_CONTEXT_ID);
if (msfvsc != null) {
byte localMaxVersion = ORBUtility.getMaxStreamFormatVersion();
byte remoteMaxVersion = msfvsc.getMaximumStreamFormatVersion();
return (byte)Math.min(localMaxVersion, remoteMaxVersion);
} else {
// Defaults to 1 for GIOP 1.2 or less, 2 for
// GIOP 1.3 or higher.
if (getGIOPVersion().lessThan(GIOPVersion.V1_3))
return ORBConstants.STREAM_FORMAT_VERSION_1;
else
return ORBConstants.STREAM_FORMAT_VERSION_2;
}
}
示例2: addExceptionDetailMessage
import com.sun.corba.se.spi.servicecontext.ServiceContexts; //导入依赖的package包/类
private void addExceptionDetailMessage(CorbaMessageMediator mediator,
SystemException ex,
ServiceContexts serviceContexts)
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintWriter pw = new PrintWriter(baos);
ex.printStackTrace(pw);
pw.flush(); // NOTE: you must flush or baos will be empty.
EncapsOutputStream encapsOutputStream =
sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)mediator.getBroker());
encapsOutputStream.putEndian();
encapsOutputStream.write_wstring(baos.toString());
UnknownServiceContext serviceContext =
new UnknownServiceContext(ExceptionDetailMessage.value,
encapsOutputStream.toByteArray());
serviceContexts.put(serviceContext);
}
示例3: read
import com.sun.corba.se.spi.servicecontext.ServiceContexts; //导入依赖的package包/类
public void read(org.omg.CORBA.portable.InputStream istream) {
super.read(istream);
this.service_contexts
= new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream);
this.request_id = istream.read_ulong();
this.response_expected = istream.read_boolean();
this.reserved = new byte[3];
for (int _o0 = 0;_o0 < (3); ++_o0) {
this.reserved[_o0] = istream.read_octet();
}
int _len1 = istream.read_long();
this.object_key = new byte[_len1];
istream.read_octet_array(this.object_key, 0, _len1);
this.operation = istream.read_string();
this.requesting_principal = istream.read_Principal();
}
示例4: read
import com.sun.corba.se.spi.servicecontext.ServiceContexts; //导入依赖的package包/类
public void read(org.omg.CORBA.portable.InputStream istream) {
super.read(istream);
this.request_id = istream.read_ulong();
this.response_flags = istream.read_octet();
this.reserved = new byte[3];
for (int _o0 = 0;_o0 < (3); ++_o0) {
this.reserved[_o0] = istream.read_octet();
}
this.target = TargetAddressHelper.read(istream);
getObjectKey(); // this does AddressingDisposition check
this.operation = istream.read_string();
this.service_contexts
= new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream);
// CORBA formal 00-11-0 15.4.2.2 GIOP 1.2 body must be
// aligned on an 8 octet boundary.
// Ensures that the first read operation called from the stub code,
// during body deconstruction, would skip the header padding, that was
// inserted to ensure that the body was aligned on an 8-octet boundary.
((CDRInputStream)istream).setHeaderPadding(true);
}
示例5: write
import com.sun.corba.se.spi.servicecontext.ServiceContexts; //导入依赖的package包/类
public void write(org.omg.CORBA.portable.OutputStream ostream) {
super.write(ostream);
if (this.service_contexts != null) {
service_contexts.write(
(org.omg.CORBA_2_3.portable.OutputStream) ostream,
GIOPVersion.V1_0);
} else {
ServiceContexts.writeNullServiceContext(
(org.omg.CORBA_2_3.portable.OutputStream) ostream);
}
ostream.write_ulong(this.request_id);
ostream.write_boolean(this.response_expected);
nullCheck(this.object_key);
ostream.write_long(this.object_key.length);
ostream.write_octet_array(this.object_key, 0, this.object_key.length);
ostream.write_string(this.operation);
if (this.requesting_principal != null) {
ostream.write_Principal(this.requesting_principal);
} else {
ostream.write_long(0);
}
}
示例6: createReply
import com.sun.corba.se.spi.servicecontext.ServiceContexts; //导入依赖的package包/类
public static ReplyMessage createReply(
ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
int reply_status, ServiceContexts service_contexts, IOR ior) {
if (gv.equals(GIOPVersion.V1_0)) { // 1.0
return new ReplyMessage_1_0(orb, service_contexts, request_id,
reply_status, ior);
} else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
return new ReplyMessage_1_1(orb, service_contexts, request_id,
reply_status, ior);
} else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
ReplyMessage msg =
new ReplyMessage_1_2(orb, request_id, reply_status,
service_contexts, ior);
msg.setEncodingVersion(encodingVersion);
return msg;
} else {
throw wrapper.giopVersionError(
CompletionStatus.COMPLETED_MAYBE);
}
}
示例7: RequestMessage_1_1
import com.sun.corba.se.spi.servicecontext.ServiceContexts; //导入依赖的package包/类
RequestMessage_1_1(ORB orb, ServiceContexts _service_contexts,
int _request_id, boolean _response_expected, byte[] _reserved,
byte[] _object_key, String _operation,
Principal _requesting_principal) {
super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN,
Message.GIOPRequest, 0);
this.orb = orb;
this.wrapper = ORBUtilSystemException.get( orb,
CORBALogDomains.RPC_PROTOCOL ) ;
service_contexts = _service_contexts;
request_id = _request_id;
response_expected = _response_expected;
reserved = _reserved;
object_key = _object_key;
operation = _operation;
requesting_principal = _requesting_principal;
}
示例8: write
import com.sun.corba.se.spi.servicecontext.ServiceContexts; //导入依赖的package包/类
public void write(org.omg.CORBA.portable.OutputStream ostream) {
super.write(ostream);
ostream.write_ulong(this.request_id);
ostream.write_long(this.reply_status);
if (this.service_contexts != null) {
service_contexts.write(
(org.omg.CORBA_2_3.portable.OutputStream) ostream,
GIOPVersion.V1_2);
} else {
ServiceContexts.writeNullServiceContext(
(org.omg.CORBA_2_3.portable.OutputStream) ostream);
}
// CORBA formal 00-11-0 15.4.2.2 GIOP 1.2 body must be
// aligned on an 8 octet boundary.
// Ensures that the first write operation called from the stub code,
// during body construction, would insert a header padding, such that
// the body is aligned on an 8-octet boundary.
((CDROutputStream)ostream).setHeaderPadding(true);
}
示例9: RequestMessage_1_2
import com.sun.corba.se.spi.servicecontext.ServiceContexts; //导入依赖的package包/类
RequestMessage_1_2(ORB orb, int _request_id, byte _response_flags,
byte[] _reserved, TargetAddress _target,
String _operation, ServiceContexts _service_contexts) {
super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN,
Message.GIOPRequest, 0);
this.orb = orb;
this.wrapper = ORBUtilSystemException.get( orb,
CORBALogDomains.RPC_PROTOCOL ) ;
request_id = _request_id;
response_flags = _response_flags;
reserved = _reserved;
target = _target;
operation = _operation;
service_contexts = _service_contexts;
}
示例10: addServiceContexts
import com.sun.corba.se.spi.servicecontext.ServiceContexts; //导入依赖的package包/类
protected void addServiceContexts(CorbaMessageMediator messageMediator)
{
ORB orb = (ORB)messageMediator.getBroker();
CorbaConnection c = (CorbaConnection) messageMediator.getConnection();
GIOPVersion giopVersion = messageMediator.getGIOPVersion();
ServiceContexts contexts = messageMediator.getRequestServiceContexts();
addCodeSetServiceContext(c, contexts, giopVersion);
// Add the RMI-IIOP max stream format version
// service context to every request. Once we have GIOP 1.3,
// we could skip it since we now support version 2, but
// probably safer to always send it.
contexts.put(MaxStreamFormatVersionServiceContext.singleton);
// ORBVersion servicecontext needs to be sent
ORBVersionServiceContext ovsc = new ORBVersionServiceContext(
ORBVersionFactory.getORBVersion() ) ;
contexts.put( ovsc ) ;
// NOTE : We only want to send the runtime context the first time
if ((c != null) && !c.isPostInitialContexts()) {
// Do not do c.setPostInitialContexts() here.
// If a client interceptor send_request does a ForwardRequest
// which ends up using the same connection then the service
// context would not be sent.
SendingContextServiceContext scsc =
new SendingContextServiceContext( orb.getFVDCodeBaseIOR() ) ; //d11638
contexts.put( scsc ) ;
}
}
示例11: CorbaMessageMediatorImpl
import com.sun.corba.se.spi.servicecontext.ServiceContexts; //导入依赖的package包/类
public CorbaMessageMediatorImpl(ORB orb,
ContactInfo contactInfo,
Connection connection,
GIOPVersion giopVersion,
IOR ior,
int requestId,
short addrDisposition,
String operationName,
boolean isOneWay)
{
this( orb, connection ) ;
this.contactInfo = (CorbaContactInfo) contactInfo;
this.addrDisposition = addrDisposition;
streamFormatVersion =
getStreamFormatVersionForThisRequest(
((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR(),
giopVersion);
streamFormatVersionSet = true;
requestHeader = (RequestMessage) MessageBase.createRequest(
this.orb,
giopVersion,
ORBUtility.getEncodingVersion(orb, ior),
requestId,
!isOneWay,
((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR(),
this.addrDisposition,
operationName,
new ServiceContexts(orb),
null);
}
示例12: ReplyMessage_1_1
import com.sun.corba.se.spi.servicecontext.ServiceContexts; //导入依赖的package包/类
ReplyMessage_1_1(ORB orb, ServiceContexts _service_contexts,
int _request_id, int _reply_status, IOR _ior) {
super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN,
Message.GIOPReply, 0);
this.orb = orb;
this.wrapper = ORBUtilSystemException.get( orb,
CORBALogDomains.RPC_PROTOCOL ) ;
service_contexts = _service_contexts;
request_id = _request_id;
reply_status = _reply_status;
ior = _ior;
}
示例13: createExceptionReply
import com.sun.corba.se.spi.servicecontext.ServiceContexts; //导入依赖的package包/类
public org.omg.CORBA.portable.OutputStream createExceptionReply()
{
// Note: relies on side-effect of setting mediator output field.
// REVISIT - cast - need interface
getProtocolHandler().createUserExceptionResponse(this, (ServiceContexts) null);
return (OutputStream) getOutputObject();
}
示例14: createResponse
import com.sun.corba.se.spi.servicecontext.ServiceContexts; //导入依赖的package包/类
public CorbaMessageMediator createResponse(
CorbaMessageMediator messageMediator,
ServiceContexts svc)
{
// REVISIT: ignore service contexts during framework transition.
// They are set in SubcontractResponseHandler to the wrong connection.
// Then they would be set again here and a duplicate contexts
// exception occurs.
return createResponseHelper(
messageMediator,
getServiceContextsForReply(messageMediator, null));
}
示例15: createUserExceptionResponse
import com.sun.corba.se.spi.servicecontext.ServiceContexts; //导入依赖的package包/类
public CorbaMessageMediator createUserExceptionResponse(
CorbaMessageMediator messageMediator, ServiceContexts svc)
{
// REVISIT - same as above
return createResponseHelper(
messageMediator,
getServiceContextsForReply(messageMediator, null),
true);
}