Search in sources :

Example 1 with UnknownEncoding

use of org.omg.IOP.CodecFactoryPackage.UnknownEncoding in project Payara by payara.

the class ORBInitializerImpl method post_init.

public void post_init(ORBInitInfo info) {
    // get hold of the codec instance to pass onto interceptors.
    CodecFactory codecFactory = info.codec_factory();
    Encoding enc = new Encoding(ENCODING_CDR_ENCAPS.value, (byte) 1, (byte) 2);
    Codec codec = null;
    try {
        codec = codecFactory.create_codec(enc);
    } catch (UnknownEncoding e) {
        throw new INTERNAL(MinorCode.TSCreateFailed, CompletionStatus.COMPLETED_NO);
    }
    // get hold of PICurrent to allocate a slot for JTS service.
    Current pic = null;
    try {
        pic = (Current) info.resolve_initial_references("PICurrent");
    } catch (InvalidName e) {
        throw new INTERNAL(MinorCode.TSCreateFailed, CompletionStatus.COMPLETED_NO);
    }
    // allocate a PICurrent slotId for the transaction service.
    int[] slotIds = new int[2];
    try {
        slotIds[0] = info.allocate_slot_id();
        slotIds[1] = info.allocate_slot_id();
    } catch (BAD_INV_ORDER e) {
        throw new INTERNAL(MinorCode.TSCreateFailed, CompletionStatus.COMPLETED_NO);
    }
    // get hold of the TSIdentification instance to pass onto interceptors.
    TSIdentification tsi = null;
    try {
        tsi = (TSIdentification) info.resolve_initial_references("TSIdentification");
    } catch (InvalidName e) {
    // the TransactionService is unavailable.
    }
    try {
        info.register_policy_factory(OTS_POLICY_TYPE.value, new OTSPolicyFactory());
    } catch (BAD_INV_ORDER e) {
    // ignore, policy factory already exists.
    }
    try {
        info.register_policy_factory(INVOCATION_POLICY_TYPE.value, new InvocationPolicyFactory());
    } catch (BAD_INV_ORDER e) {
    // ignore, policy factory already exists.
    }
    try {
        info.add_ior_interceptor(new IORInterceptorImpl(codec));
        InterceptorImpl interceptor = new InterceptorImpl(pic, codec, slotIds, tsi);
        info.add_client_request_interceptor(interceptor);
        info.add_server_request_interceptor(interceptor);
    } catch (DuplicateName e) {
        throw new INTERNAL(MinorCode.TSCreateFailed, CompletionStatus.COMPLETED_NO);
    }
}
Also used : DuplicateName(org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName) UnknownEncoding(org.omg.IOP.CodecFactoryPackage.UnknownEncoding) UnknownEncoding(org.omg.IOP.CodecFactoryPackage.UnknownEncoding) InvalidName(org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName) Current(org.omg.PortableInterceptor.Current)

Aggregations

UnknownEncoding (org.omg.IOP.CodecFactoryPackage.UnknownEncoding)1 Current (org.omg.PortableInterceptor.Current)1 DuplicateName (org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName)1 InvalidName (org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName)1