Search in sources :

Example 1 with Codec

use of org.omg.IOP.Codec in project wildfly by wildfly.

the class ElytronSASInitializer method post_init.

@Override
public void post_init(ORBInitInfo info) {
    try {
        org.omg.CORBA.Object obj;
        // Use CDR encapsulations 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);
        // Create and register client interceptor.
        obj = info.resolve_initial_references("SASCurrent");
        SASCurrentImpl sasCurrentImpl = (SASCurrentImpl) obj;
        ElytronSASClientInterceptor clientInterceptor = new ElytronSASClientInterceptor(codec);
        info.add_client_request_interceptor(clientInterceptor);
        // Create and register server interceptor.
        SASTargetInterceptor serverInterceptor = new SASTargetInterceptor(codec);
        info.add_server_request_interceptor(serverInterceptor);
        // Initialize the SASCurrent implementation.
        sasCurrentImpl.init(serverInterceptor);
    } catch (Exception e) {
        throw IIOPLogger.ROOT_LOGGER.unexpectedException(e);
    }
}
Also used : Codec(org.omg.IOP.Codec) Encoding(org.omg.IOP.Encoding)

Example 2 with Codec

use of org.omg.IOP.Codec in project wildfly by wildfly.

the class SASClientInitializer method post_init.

@Override
public void post_init(ORBInitInfo info) {
    try {
        org.omg.CORBA.Object obj;
        // Use CDR encapsulations 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);
        // Create and register client interceptor.
        obj = info.resolve_initial_references("SASCurrent");
        SASCurrentImpl sasCurrentImpl = (SASCurrentImpl) obj;
        SASClientInterceptor clientInterceptor = new SASClientInterceptor(codec);
        info.add_client_request_interceptor(clientInterceptor);
        // Create and register server interceptor.
        SASTargetInterceptor serverInterceptor = new SASTargetInterceptor(codec);
        info.add_server_request_interceptor(serverInterceptor);
        // Initialize the SASCurrent implementation.
        sasCurrentImpl.init(serverInterceptor);
    } catch (Exception e) {
        throw IIOPLogger.ROOT_LOGGER.unexpectedException(e);
    }
}
Also used : Codec(org.omg.IOP.Codec) Encoding(org.omg.IOP.Encoding)

Example 3 with Codec

use of org.omg.IOP.Codec 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)

Example 4 with Codec

use of org.omg.IOP.Codec in project wildfly by wildfly.

the class CSIv2Initializer method post_init.

@Override
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);
        // add IOR interceptor for CSIv2.
        info.add_ior_interceptor(new CSIv2IORInterceptor(codec));
        // register CSIv2-related policy factories.
        info.register_policy_factory(CSIv2Policy.TYPE, new CSIv2PolicyFactory(codec));
    } catch (Exception e) {
        throw IIOPLogger.ROOT_LOGGER.unexpectedException(e);
    }
}
Also used : Codec(org.omg.IOP.Codec) Encoding(org.omg.IOP.Encoding)

Example 5 with Codec

use of org.omg.IOP.Codec in project wildfly by wildfly.

the class SASInitializer method post_init.

@Override
public void post_init(ORBInitInfo info) {
    try {
        // use CDR encapsulations 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);
        // create and register client interceptor.
        SASClientIdentityInterceptor clientInterceptor = new SASClientIdentityInterceptor(codec);
        info.add_client_request_interceptor(clientInterceptor);
        // create and register server interceptor.
        SASTargetInterceptor serverInterceptor = new SASTargetInterceptor(codec);
        info.add_server_request_interceptor(serverInterceptor);
        // initialize the SASCurrent implementation.
        org.omg.CORBA.Object obj = info.resolve_initial_references("SASCurrent");
        final SASCurrentImpl sasCurrentImpl = (SASCurrentImpl) obj;
        sasCurrentImpl.init(serverInterceptor);
    // Create and register an AuthenticationObserver to be called by the SecurityInterceptor
    //         Registry.bind(SecurityInterceptor.AuthenticationObserver.KEY,
    //                       new SecurityInterceptor.AuthenticationObserver() {
    //                          public void authenticationFailed()
    //                          {
    //                             sasCurrentImpl.reject_incoming_context();
    //                          }
    //                       });
    } catch (Exception e) {
        throw IIOPLogger.ROOT_LOGGER.unexpectedException(e);
    }
}
Also used : Codec(org.omg.IOP.Codec) Encoding(org.omg.IOP.Encoding)

Aggregations

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