FileDocCategorySizeDatePackage
ORBInitializerImpl.javaAPI DocGlassfish v2 API5741Fri May 04 22:36:42 BST 2007com.sun.jts.pi

ORBInitializerImpl

public class ORBInitializerImpl extends LocalObject implements ORBInitializer
This class implements the ORBInitializer for JTS. When an instance of this class is called during ORB initialization, it registers the IORInterceptors and the JTS request/reply interceptors with the ORB.
author
Ram Jeyaraman 11/11/2000
version
1.0

Fields Summary
Constructors Summary
public ORBInitializerImpl()

Methods Summary
public voidpost_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.
        }

        // register the policy factories.

        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.
        }

        // register the interceptors.

        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);
        }
    
public voidpre_init(ORBInitInfo info)