Search in sources :

Example 1 with IIOPInterceptorFactory

use of org.glassfish.enterprise.iiop.api.IIOPInterceptorFactory 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);
    }
}
Also used : Codec(org.omg.IOP.Codec) ClientRequestInterceptor(org.omg.PortableInterceptor.ClientRequestInterceptor) IIOPInterceptorFactory(org.glassfish.enterprise.iiop.api.IIOPInterceptorFactory) Encoding(org.omg.IOP.Encoding) CodecFactory(org.omg.IOP.CodecFactory) IIOPUtils(org.glassfish.enterprise.iiop.util.IIOPUtils) ServerRequestInterceptor(org.omg.PortableInterceptor.ServerRequestInterceptor)

Aggregations

IIOPInterceptorFactory (org.glassfish.enterprise.iiop.api.IIOPInterceptorFactory)1 IIOPUtils (org.glassfish.enterprise.iiop.util.IIOPUtils)1 Codec (org.omg.IOP.Codec)1 CodecFactory (org.omg.IOP.CodecFactory)1 Encoding (org.omg.IOP.Encoding)1 ClientRequestInterceptor (org.omg.PortableInterceptor.ClientRequestInterceptor)1 ServerRequestInterceptor (org.omg.PortableInterceptor.ServerRequestInterceptor)1