use of org.omg.IOP.CodecFactory in project Payara by payara.
the class GlassFishORBInitializer method post_init.
/**
* This method is called during ORB initialization.
*
* @param info object that provides initialization attributes
* and operations by which interceptors are registered.
*/
@Override
public void post_init(org.omg.PortableInterceptor.ORBInitInfo info) {
Codec codec = null;
fineLog("J2EE Initializer post_init");
fineLog("Creating Codec for CDR encoding");
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);
IIOPUtils iiopUtils = IIOPUtils.getInstance();
Collection<IIOPInterceptorFactory> interceptorFactories = iiopUtils.getAllIIOPInterceptrFactories();
for (IIOPInterceptorFactory factory : interceptorFactories) {
fineLog("Processing interceptor factory: {0}", factory);
ClientRequestInterceptor clientReq = factory.createClientRequestInterceptor(info, codec);
ServerRequestInterceptor serverReq = factory.createServerRequestInterceptor(info, codec);
if (clientReq != null) {
fineLog("Registering client interceptor: {0}", clientReq);
info.add_client_request_interceptor(clientReq);
}
if (serverReq != null) {
fineLog("Registering server interceptor: {0}", serverReq);
info.add_server_request_interceptor(serverReq);
}
}
} catch (Exception e) {
if (_logger.isLoggable(Level.WARNING)) {
_logger.log(Level.WARNING, "Exception registering interceptors", e);
}
throw new RuntimeException(e.getMessage(), e);
}
}
use of org.omg.IOP.CodecFactory 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);
}
}
Aggregations