use of org.omg.IOP.Encoding in project wildfly by wildfly.
the class TxServerInterceptorInitializer method post_init.
public void post_init(ORBInitInfo info) {
try {
// Use CDR encapsulation with GIOP 1.0 encoding
Encoding encoding = new Encoding(ENCODING_CDR_ENCAPS.value, (byte) 1, /* GIOP version */
(byte) 0);
Codec codec = info.codec_factory().create_codec(encoding);
// Get a reference to the PICurrent
org.omg.CORBA.Object obj = info.resolve_initial_references("PICurrent");
org.omg.PortableInterceptor.Current piCurrent = org.omg.PortableInterceptor.CurrentHelper.narrow(obj);
// Initialize the fields slot id, codec, and piCurrent
// in the interceptor class
TxServerInterceptor.init(info.allocate_slot_id(), codec, piCurrent);
// Create and register interceptor
TxServerInterceptor interceptor = new TxServerInterceptor();
info.add_server_request_interceptor(interceptor);
} catch (Exception e) {
throw IIOPLogger.ROOT_LOGGER.unexpectedException(e);
}
}
use of org.omg.IOP.Encoding in project Payara by payara.
the class IORAddrAnyInitializer method post_init.
/**
* Called during ORB initialization. If a service must resolve initial
* references as part of its initialization, it can assume that all
* initial references will be available at this point.
* <p>
* Calling the <code>post_init</code> operations is not the final
* task of ORB initialization. The final task, following the
* <code>post_init</code> calls, is attaching the lists of registered
* interceptors to the ORB. Therefore, the ORB does not contain the
* interceptors during calls to <code>post_init</code>. If an
* ORB-mediated call is made from within <code>post_init</code>, no
* request interceptors will be invoked on that call.
* Likewise, if an operation is performed which causes an IOR to be
* created, no IOR interceptors will be invoked.
*
* @param info provides initialization attributes and
* operations by which Interceptors can be registered.
*/
@Override
public void post_init(org.omg.PortableInterceptor.ORBInitInfo info) {
Codec codec = null;
CodecFactory cf = info.codec_factory();
byte major_version = 1;
byte minor_version = 2;
Encoding encoding = new Encoding(ENCODING_CDR_ENCAPS.value, major_version, minor_version);
try {
codec = cf.create_codec(encoding);
} catch (org.omg.IOP.CodecFactoryPackage.UnknownEncoding e) {
_logger.log(Level.WARNING, "UnknownEncoding from " + baseMsg, e);
}
try {
info.add_ior_interceptor(new IORAddrAnyInterceptor(codec));
} catch (DuplicateName ex) {
_logger.log(Level.WARNING, "DuplicateName from " + baseMsg, ex);
}
}
use of org.omg.IOP.Encoding in project narayana by jbosstm.
the class ContextORBInitializerImpl method pre_init.
public void pre_init(ORBInitInfo init_info) {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ContextORBInitializer.pre_init ()");
}
/*
* These value should be part of the standard.
*/
int localSlot = init_info.allocate_slot_id();
int receivedSlot = init_info.allocate_slot_id();
OTSManager.setLocalSlotId(localSlot);
OTSManager.setReceivedSlotId(receivedSlot);
/*
* Get the CDR codec; used for encoding/decoding the service
* context and IOR components.
*/
Codec cdr_codec = null;
try {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ContextORBInitializerImpl - getting reference to ENCODING_CDR_ENCAPS codec");
}
Encoding cdr_encoding = new Encoding(ENCODING_CDR_ENCAPS.value, (byte) 1, (byte) 2);
cdr_codec = init_info.codec_factory().create_codec(cdr_encoding);
} catch (UnknownEncoding ex) {
jtsLogger.i18NLogger.warn_orbspecific_javaidl_interceptors_context_codecerror("ContextORBInitializerImpl", "ENCODING_CDR_ENCAPS", ex);
throw new FatalError(jtsLogger.i18NLogger.get_orbspecific_javaidl_interceptors_context_codeccreate(), ex);
}
try {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ContextORBInitializerImpl - registering ClientRequestInterceptor");
}
ClientRequestInterceptor client_interceptor = new ContextClientRequestInterceptorImpl(localSlot, cdr_codec);
init_info.add_client_request_interceptor(client_interceptor);
} catch (DuplicateName ex) {
jtsLogger.i18NLogger.warn_orbspecific_javaidl_interceptors_context_duplicatename("ContextORBInitializerImpl", "ClientRequestInterceptor", ex);
throw new FatalError(jtsLogger.i18NLogger.get_orbspecific_javaidl_interceptors_context_cie(), ex);
}
try {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ContextORBInitializerImpl - registering ServerRequestInterceptor");
}
ServerRequestInterceptor server_interceptor = new ContextServerRequestInterceptorImpl(receivedSlot, cdr_codec);
init_info.add_server_request_interceptor(server_interceptor);
} catch (DuplicateName ex) {
jtsLogger.i18NLogger.warn_orbspecific_javaidl_interceptors_context_duplicatename("ContextORBInitializerImpl", "ServerRequestInterceptor", ex);
throw new FatalError(jtsLogger.i18NLogger.get_orbspecific_javaidl_interceptors_context_sie(), ex);
}
}
use of org.omg.IOP.Encoding in project narayana by jbosstm.
the class ContextORBInitializerImpl method pre_init.
public void pre_init(ORBInitInfo init_info) {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ContextORBInitializer.pre_init ()");
}
/*
* These value should be part of the standard.
*/
int localSlot = init_info.allocate_slot_id();
int receivedSlot = init_info.allocate_slot_id();
OTSManager.setLocalSlotId(localSlot);
OTSManager.setReceivedSlotId(receivedSlot);
/*
* Get the CDR codec; used for encoding/decoding the service
* context and IOR components.
*/
Codec cdr_codec = null;
try {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ContextORBInitializerImpl - getting reference to ENCODING_CDR_ENCAPS codec");
}
Encoding cdr_encoding = new Encoding(ENCODING_CDR_ENCAPS.value, (byte) 1, (byte) 2);
cdr_codec = init_info.codec_factory().create_codec(cdr_encoding);
} catch (UnknownEncoding ex) {
jtsLogger.i18NLogger.warn_orbspecific_javaidl_interceptors_context_codecerror("ContextORBInitializerImpl", "ENCODING_CDR_ENCAPS", ex);
throw new FatalError(jtsLogger.i18NLogger.get_orbspecific_javaidl_interceptors_context_codeccreate(), ex);
}
try {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ContextORBInitializerImpl - registering ClientRequestInterceptor");
}
ClientRequestInterceptor client_interceptor = new ContextClientRequestInterceptorImpl(localSlot, cdr_codec);
init_info.add_client_request_interceptor(client_interceptor);
} catch (DuplicateName ex) {
jtsLogger.i18NLogger.warn_orbspecific_javaidl_interceptors_context_duplicatename("ContextORBInitializerImpl", "ClientRequestInterceptor", ex);
throw new FatalError(jtsLogger.i18NLogger.get_orbspecific_javaidl_interceptors_context_cie(), ex);
}
try {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ContextORBInitializerImpl - registering ServerRequestInterceptor");
}
ServerRequestInterceptor server_interceptor = new ContextServerRequestInterceptorImpl(receivedSlot, cdr_codec);
init_info.add_server_request_interceptor(server_interceptor);
} catch (DuplicateName ex) {
jtsLogger.i18NLogger.warn_orbspecific_javaidl_interceptors_context_duplicatename("ContextORBInitializerImpl", "ServerRequestInterceptor", ex);
throw new FatalError(jtsLogger.i18NLogger.get_orbspecific_javaidl_interceptors_context_sie(), ex);
}
}
Aggregations