Search in sources :

Example 1 with DuplicateName

use of org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName in project Payara by payara.

the class SecurityIIOPInterceptorFactory method createServerRequestInterceptor.

@Override
public ServerRequestInterceptor createServerRequestInterceptor(ORBInitInfo info, Codec codec) {
    ServerRequestInterceptor ret = null;
    try {
        if (!penv.getProcessType().isServer()) {
            return null;
        }
        if (altSecFactory != null || (interceptorFactory != null && createAlternateSecurityInterceptorFactory())) {
            ret = altSecFactory.getServerRequestInterceptor(codec);
        } else {
            ret = getServerInterceptorInstance(codec);
        }
        // also register the IOR Interceptor here
        if (info instanceof com.sun.corba.ee.spi.legacy.interceptor.ORBInitInfoExt) {
            com.sun.corba.ee.spi.legacy.interceptor.ORBInitInfoExt infoExt = (com.sun.corba.ee.spi.legacy.interceptor.ORBInitInfoExt) info;
            IORInterceptor secIOR = getSecIORInterceptorInstance(codec, infoExt.getORB());
            info.add_ior_interceptor(secIOR);
        }
    } catch (DuplicateName ex) {
        _logger.log(Level.SEVERE, null, ex);
        throw new RuntimeException(ex);
    }
    return ret;
}
Also used : DuplicateName(org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName) ServerRequestInterceptor(org.omg.PortableInterceptor.ServerRequestInterceptor) IORInterceptor(org.omg.PortableInterceptor.IORInterceptor)

Example 2 with DuplicateName

use of org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName 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);
    }
}
Also used : Codec(org.omg.IOP.Codec) DuplicateName(org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName) Encoding(org.omg.IOP.Encoding) CodecFactory(org.omg.IOP.CodecFactory)

Example 3 with DuplicateName

use of org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName 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

DuplicateName (org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName)3 Codec (org.omg.IOP.Codec)1 CodecFactory (org.omg.IOP.CodecFactory)1 UnknownEncoding (org.omg.IOP.CodecFactoryPackage.UnknownEncoding)1 Encoding (org.omg.IOP.Encoding)1 Current (org.omg.PortableInterceptor.Current)1 IORInterceptor (org.omg.PortableInterceptor.IORInterceptor)1 InvalidName (org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName)1 ServerRequestInterceptor (org.omg.PortableInterceptor.ServerRequestInterceptor)1