Search in sources :

Example 6 with FatalError

use of com.arjuna.ats.arjuna.exceptions.FatalError in project narayana by jbosstm.

the class InterpositionORBInitializerImpl method pre_init.

public void pre_init(ORBInitInfo init_info) {
    if (jtsLogger.logger.isTraceEnabled()) {
        jtsLogger.logger.trace("InterpositionORBInitializer.pre_init ()");
    }
    /*
	 * These value should be part of the standard.
	 */
    int localSlot = init_info.allocate_slot_id();
    int receivedSlot = init_info.allocate_slot_id();
    OTSManager.setLocalSlotId(localSlot);
    OTSManager.setReceivedSlotId(receivedSlot);
    /*
	 * Get the CDR codec; used for encoding/decoding the service
	 * context and IOR components.
	 */
    Codec cdr_codec = null;
    try {
        if (jtsLogger.logger.isTraceEnabled()) {
            jtsLogger.logger.trace("InterpositionORBInitializerImpl - getting reference to ENCODING_CDR_ENCAPS codec");
        }
        Encoding cdr_encoding = new Encoding(ENCODING_CDR_ENCAPS.value, (byte) 1, (byte) 2);
        cdr_codec = init_info.codec_factory().create_codec(cdr_encoding);
    } catch (UnknownEncoding ex) {
        jtsLogger.i18NLogger.warn_orbspecific_javaidl_interceptors_interposition_codecerror("InterpositionORBInitializerImpl", "ENCODING_CDR_ENCAPS", ex);
        throw new FatalError(jtsLogger.i18NLogger.get_orbspecific_javaidl_interceptors_interposition_codeccreate(), ex);
    }
    try {
        if (jtsLogger.logger.isTraceEnabled()) {
            jtsLogger.logger.trace("InterpositionORBInitializerImpl - registering ClientRequestInterceptor");
        }
        ClientRequestInterceptor client_interceptor = new InterpositionClientRequestInterceptorImpl(localSlot, cdr_codec);
        init_info.add_client_request_interceptor(client_interceptor);
    } catch (DuplicateName ex) {
        jtsLogger.i18NLogger.warn_orbspecific_javaidl_interceptors_interposition_duplicatename("InterpositionORBInitializerImpl", "ClientRequestInterceptor", ex);
        throw new FatalError(jtsLogger.i18NLogger.get_orbspecific_javaidl_interceptors_interposition_cie(), ex);
    }
    try {
        if (jtsLogger.logger.isTraceEnabled()) {
            jtsLogger.logger.trace("InterpositionORBInitializerImpl - registering ServerRequestInterceptor");
        }
        ServerRequestInterceptor server_interceptor = new InterpositionServerRequestInterceptorImpl(receivedSlot, cdr_codec);
        init_info.add_server_request_interceptor(server_interceptor);
    } catch (DuplicateName ex) {
        jtsLogger.i18NLogger.warn_orbspecific_javaidl_interceptors_interposition_duplicatename("InterpositionORBInitializerImpl", "ServerRequestInterceptor", ex);
        throw new FatalError(jtsLogger.i18NLogger.get_orbspecific_javaidl_interceptors_interposition_sie(), ex);
    }
}
Also used : FatalError(com.arjuna.ats.arjuna.exceptions.FatalError) Codec(org.omg.IOP.Codec) ClientRequestInterceptor(org.omg.PortableInterceptor.ClientRequestInterceptor) UnknownEncoding(org.omg.IOP.CodecFactoryPackage.UnknownEncoding) DuplicateName(org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName) Encoding(org.omg.IOP.Encoding) UnknownEncoding(org.omg.IOP.CodecFactoryPackage.UnknownEncoding) ServerRequestInterceptor(org.omg.PortableInterceptor.ServerRequestInterceptor)

Example 7 with FatalError

use of com.arjuna.ats.arjuna.exceptions.FatalError in project narayana by jbosstm.

the class ContextORBInitializerImpl method pre_init.

public void pre_init(ORBInitInfo init_info) {
    if (jtsLogger.logger.isTraceEnabled()) {
        jtsLogger.logger.trace("ContextORBInitializer.pre_init ()");
    }
    /*
	 * These value should be part of the standard.
	 */
    int localSlot = init_info.allocate_slot_id();
    int receivedSlot = init_info.allocate_slot_id();
    OTSManager.setLocalSlotId(localSlot);
    OTSManager.setReceivedSlotId(receivedSlot);
    /*
	 * Get the CDR codec; used for encoding/decoding the service
	 * context and IOR components.
	 */
    Codec cdr_codec = null;
    try {
        if (jtsLogger.logger.isTraceEnabled()) {
            jtsLogger.logger.trace("ContextORBInitializerImpl - getting reference to ENCODING_CDR_ENCAPS codec");
        }
        Encoding cdr_encoding = new Encoding(ENCODING_CDR_ENCAPS.value, (byte) 1, (byte) 0);
        cdr_codec = init_info.codec_factory().create_codec(cdr_encoding);
    } catch (UnknownEncoding ex) {
        jtsLogger.i18NLogger.warn_orbspecific_jacorb_interceptors_context_codecerror("ContextORBInitializerImpl", "ENCODING_CDR_ENCAPS", ex);
        throw new FatalError(jtsLogger.i18NLogger.get_orbspecific_jacorb_interceptors_context_codeccreate(), ex);
    }
    try {
        if (jtsLogger.logger.isTraceEnabled()) {
            jtsLogger.logger.trace("ContextORBInitializerImpl - registering ClientRequestInterceptor");
        }
        ClientRequestInterceptor client_interceptor = new ContextClientRequestInterceptorImpl(localSlot, cdr_codec);
        init_info.add_client_request_interceptor(client_interceptor);
    } catch (DuplicateName ex) {
        jtsLogger.i18NLogger.warn_orbspecific_jacorb_interceptors_context_duplicatename("ContextORBInitializerImpl", "ClientRequestInterceptor", ex);
        throw new FatalError(jtsLogger.i18NLogger.get_orbspecific_jacorb_interceptors_context_cie(), ex);
    }
    try {
        if (jtsLogger.logger.isTraceEnabled()) {
            jtsLogger.logger.trace("ContextORBInitializerImpl - registering ServerRequestInterceptor");
        }
        ServerRequestInterceptor server_interceptor = new ContextServerRequestInterceptorImpl(receivedSlot, cdr_codec);
        init_info.add_server_request_interceptor(server_interceptor);
    } catch (DuplicateName ex) {
        jtsLogger.i18NLogger.warn_orbspecific_jacorb_interceptors_context_duplicatename("ContextORBInitializerImpl", "ServerRequestInterceptor", ex);
        throw new FatalError(jtsLogger.i18NLogger.get_orbspecific_jacorb_interceptors_context_sie(), ex);
    }
}
Also used : FatalError(com.arjuna.ats.arjuna.exceptions.FatalError) Codec(org.omg.IOP.Codec) ClientRequestInterceptor(org.omg.PortableInterceptor.ClientRequestInterceptor) UnknownEncoding(org.omg.IOP.CodecFactoryPackage.UnknownEncoding) DuplicateName(org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName) Encoding(org.omg.IOP.Encoding) UnknownEncoding(org.omg.IOP.CodecFactoryPackage.UnknownEncoding) ServerRequestInterceptor(org.omg.PortableInterceptor.ServerRequestInterceptor)

Example 8 with FatalError

use of com.arjuna.ats.arjuna.exceptions.FatalError in project narayana by jbosstm.

the class InterpositionORBInitializerImpl method pre_init.

public void pre_init(ORBInitInfo init_info) {
    if (jtsLogger.logger.isTraceEnabled()) {
        jtsLogger.logger.trace("InterpositionORBInitializer.pre_init ()");
    }
    /*
	 * These value should be part of the standard.
	 */
    int localSlot = init_info.allocate_slot_id();
    int receivedSlot = init_info.allocate_slot_id();
    OTSManager.setLocalSlotId(localSlot);
    OTSManager.setReceivedSlotId(receivedSlot);
    /*
	 * Get the CDR codec; used for encoding/decoding the service
	 * context and IOR components.
	 */
    Codec cdr_codec = null;
    try {
        if (jtsLogger.logger.isTraceEnabled()) {
            jtsLogger.logger.trace("InterpositionORBInitializerImpl - getting reference to ENCODING_CDR_ENCAPS codec");
        }
        Encoding cdr_encoding = new Encoding(ENCODING_CDR_ENCAPS.value, (byte) 1, (byte) 0);
        cdr_codec = init_info.codec_factory().create_codec(cdr_encoding);
    } catch (UnknownEncoding ex) {
        jtsLogger.i18NLogger.warn_orbspecific_jacorb_interceptors_interposition_codecerror("InterpositionORBInitializerImpl", "ENCODING_CDR_ENCAPS", ex);
        throw new FatalError(jtsLogger.i18NLogger.get_orbspecific_jacorb_interceptors_interposition_codeccreate(), ex);
    }
    try {
        if (jtsLogger.logger.isTraceEnabled()) {
            jtsLogger.logger.trace("InterpositionORBInitializerImpl - registering ClientRequestInterceptor");
        }
        ClientRequestInterceptor client_interceptor = new InterpositionClientRequestInterceptorImpl(localSlot, cdr_codec);
        init_info.add_client_request_interceptor(client_interceptor);
    } catch (DuplicateName ex) {
        jtsLogger.i18NLogger.warn_orbspecific_jacorb_interceptors_interposition_duplicatename("InterpositionORBInitializerImpl", "ClientRequestInterceptor", ex);
        throw new FatalError(jtsLogger.i18NLogger.get_orbspecific_jacorb_interceptors_interposition_cie(), ex);
    }
    try {
        if (jtsLogger.logger.isTraceEnabled()) {
            jtsLogger.logger.trace("InterpositionORBInitializerImpl - registering ServerRequestInterceptor");
        }
        ServerRequestInterceptor server_interceptor = new InterpositionServerRequestInterceptorImpl(receivedSlot, cdr_codec);
        init_info.add_server_request_interceptor(server_interceptor);
    } catch (DuplicateName ex) {
        jtsLogger.i18NLogger.warn_orbspecific_jacorb_interceptors_interposition_duplicatename("InterpositionORBInitializerImpl", "ServerRequestInterceptor", ex);
        throw new FatalError(jtsLogger.i18NLogger.get_orbspecific_jacorb_interceptors_interposition_sie(), ex);
    }
}
Also used : FatalError(com.arjuna.ats.arjuna.exceptions.FatalError) Codec(org.omg.IOP.Codec) ClientRequestInterceptor(org.omg.PortableInterceptor.ClientRequestInterceptor) UnknownEncoding(org.omg.IOP.CodecFactoryPackage.UnknownEncoding) DuplicateName(org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName) Encoding(org.omg.IOP.Encoding) UnknownEncoding(org.omg.IOP.CodecFactoryPackage.UnknownEncoding) ServerRequestInterceptor(org.omg.PortableInterceptor.ServerRequestInterceptor)

Example 9 with FatalError

use of com.arjuna.ats.arjuna.exceptions.FatalError in project narayana by jbosstm.

the class StoreManager method initStore.

private static final ObjectStoreAPI initStore(String name) {
    ObjectStoreEnvironmentBean storeEnvBean = BeanPopulator.getNamedInstance(ObjectStoreEnvironmentBean.class, name);
    String storeType = storeEnvBean.getObjectStoreType();
    ObjectStoreAPI store;
    try {
        store = ClassloadingUtility.loadAndInstantiateClass(ObjectStoreAPI.class, storeType, name);
    } catch (final Throwable ex) {
        throw new FatalError(tsLogger.i18NLogger.get_StoreManager_invalidtype() + " " + storeType, ex);
    }
    store.start();
    return store;
}
Also used : ObjectStoreEnvironmentBean(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean) FatalError(com.arjuna.ats.arjuna.exceptions.FatalError)

Example 10 with FatalError

use of com.arjuna.ats.arjuna.exceptions.FatalError in project narayana by jbosstm.

the class UidUnitTest method testInvalid.

@Test
public void testInvalid() throws Exception {
    Uid u = null;
    try {
        u = new Uid(null, 0, 0, 0);
        fail();
    } catch (final FatalError ex) {
    }
    try {
        u = new Uid("hello world", false);
        fail();
    } catch (final FatalError ex) {
    }
    try {
        u = new Uid((String) null);
        fail();
    } catch (final IllegalArgumentException ex) {
    }
    try {
        u = new Uid((byte[]) null);
        fail();
    } catch (final IllegalArgumentException ex) {
    }
    byte[] b = { 0, 0 };
    u = new Uid(b);
    assertEquals(u.valid(), false);
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid) FatalError(com.arjuna.ats.arjuna.exceptions.FatalError) Test(org.junit.Test)

Aggregations

FatalError (com.arjuna.ats.arjuna.exceptions.FatalError)19 Codec (org.omg.IOP.Codec)6 UnknownEncoding (org.omg.IOP.CodecFactoryPackage.UnknownEncoding)6 Encoding (org.omg.IOP.Encoding)6 ClientRequestInterceptor (org.omg.PortableInterceptor.ClientRequestInterceptor)6 DuplicateName (org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName)6 ServerRequestInterceptor (org.omg.PortableInterceptor.ServerRequestInterceptor)6 IOException (java.io.IOException)4 Test (org.junit.Test)3 ObjectStoreEnvironmentBean (com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean)2 CurrentImple (com.arjuna.ats.internal.jts.orbspecific.CurrentImple)2 File (java.io.File)2 Uid (com.arjuna.ats.arjuna.common.Uid)1 ObjectStoreError (com.arjuna.ats.arjuna.exceptions.ObjectStoreError)1 ObjectStoreException (com.arjuna.ats.arjuna.exceptions.ObjectStoreException)1 TwoPhaseVolatileStore (com.arjuna.ats.internal.arjuna.objectstore.TwoPhaseVolatileStore)1 TransactionFactoryImple (com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple)1 ORB (com.arjuna.orbportability.ORB)1 RootOA (com.arjuna.orbportability.RootOA)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1