Date   

Re: OpenMAMA-2.3.3-rc1

Adrienne Ambrose <a.ambrose@...>
 

Hi Reed,

 

Thanks for the feedback, it is greatly appreciated.

Please keep us informed on the outcome of any further testing.

 

Thanks,

Adrienne

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Alpert, Reed
Sent: 27 May 2015 15:29
To: Gary Molloy; openmama-dev@...
Subject: Re: [Openmama-dev] OpenMAMA-2.3.3-rc1

 

We’ve been testing with this release and have no issues so far.

Testing C++ and Java clients.

Publish and subscribe.

Solace and Tick42 bridges.

 


Reed Alpert | Corporate & Investment Bank | Market Data Services | J.P. Morgan | 4 Metrotech Center, 23rd Floor, Brooklyn, NY 11245 | T: 718.242.5198  | M: 917.414.4613 | reed.alpert@...

Alternate Contact:  CIB PIM Trading Technology Solutions NA | CIB_PIM_Trading_Technology_Solutions_NA@...

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Gary Molloy
Sent: Tuesday, May 05, 2015 10:31 AM
To: openmama-dev@...
Subject: [Openmama-dev] OpenMAMA-2.3.3-rc1

 

Hi Guys,

 

I have cut the new OpenMAMA-2.3.3 branch and created the OpenMAMA-2.3.3-rc1 tag, this is now available for testing.  I would anticipate a test period of around 2-3 weeks with a view to making the release official by the end of the month.

 

This release has been cut from the next branch.

 

The following list of issues/features have been added for this release:

 

BZ-166 Wombat: wInterlocked_set inconsistent return value

BZ-164 MAMAJNI: MamaPublisher: Overloaded MamaPublisher create method

BZ-169  Wombat queue has no separate deallocate method

BZ-176  Missing actions for snapshot subscriptions transition to deactivate state

BZ-168 Complete support for Vector Bool and Vector Char field types

BZ-156 No value expansion of last property line in mama.properties

BZ-178 Problem with mamaDictionary_getDictionaryMessage when multiple bridges are loaded

BZ-182 MAMAJAVA: Add java MamaDateTime::getAsFormattedString() method

BZ-181 MAMAJAVA: Java subscription setup fix - it loses the closure

BZ-183 SCons: OpenMAMA will not build on windows

BZ-189 [MAMAC] mamaPlugin Feature

BZ-190 [MAMAC] Add ability to turn on/off entitlements on a per bridge basis

BZ-191 [MAMAC] mamaPublisherImpl_getTransportImpl() accessor

BZ-179 OpenMAMA mock RPM's fail to build

BZ-187 SCons: Include stdout for build commands using site scons logger

BZ-188 Scons: fixes for Windows and Linux

BZ-192 OpenMAMA RPM Release Scripts

 

 

Thanks,

Gary

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 

This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates (collectively, "JPMC"). This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Although this transmission and any attachments are believed to be free of any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMC for any loss or damage arising in any way from its use. Please note that any electronic communication that is conducted within or through JPMC's systems is subject to interception, monitoring, review, retention and external production in accordance with JPMC's policy and local laws, rules and regulations; may be stored or otherwise processed in countries other than the country in which you are located; and will be treated in accordance with JPMC policies and applicable laws and regulations. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


Re: OpenMAMA-2.3.3-rc1

Alpert, Reed <reed.alpert@...>
 

We’ve been testing with this release and have no issues so far.

Testing C++ and Java clients.

Publish and subscribe.

Solace and Tick42 bridges.

 


Reed Alpert | Corporate & Investment Bank | Market Data Services | J.P. Morgan | 4 Metrotech Center, 23rd Floor, Brooklyn, NY 11245 | T: 718.242.5198  | M: 917.414.4613 | reed.alpert@...

Alternate Contact:  CIB PIM Trading Technology Solutions NA | CIB_PIM_Trading_Technology_Solutions_NA@...

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Gary Molloy
Sent: Tuesday, May 05, 2015 10:31 AM
To: openmama-dev@...
Subject: [Openmama-dev] OpenMAMA-2.3.3-rc1

 

Hi Guys,

 

I have cut the new OpenMAMA-2.3.3 branch and created the OpenMAMA-2.3.3-rc1 tag, this is now available for testing.  I would anticipate a test period of around 2-3 weeks with a view to making the release official by the end of the month.

 

This release has been cut from the next branch.

 

The following list of issues/features have been added for this release:

 

BZ-166 Wombat: wInterlocked_set inconsistent return value

BZ-164 MAMAJNI: MamaPublisher: Overloaded MamaPublisher create method

BZ-169  Wombat queue has no separate deallocate method

BZ-176  Missing actions for snapshot subscriptions transition to deactivate state

BZ-168 Complete support for Vector Bool and Vector Char field types

BZ-156 No value expansion of last property line in mama.properties

BZ-178 Problem with mamaDictionary_getDictionaryMessage when multiple bridges are loaded

BZ-182 MAMAJAVA: Add java MamaDateTime::getAsFormattedString() method

BZ-181 MAMAJAVA: Java subscription setup fix - it loses the closure

BZ-183 SCons: OpenMAMA will not build on windows

BZ-189 [MAMAC] mamaPlugin Feature

BZ-190 [MAMAC] Add ability to turn on/off entitlements on a per bridge basis

BZ-191 [MAMAC] mamaPublisherImpl_getTransportImpl() accessor

BZ-179 OpenMAMA mock RPM's fail to build

BZ-187 SCons: Include stdout for build commands using site scons logger

BZ-188 Scons: fixes for Windows and Linux

BZ-192 OpenMAMA RPM Release Scripts

 

 

Thanks,

Gary

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 

This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates (collectively, "JPMC"). This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Although this transmission and any attachments are believed to be free of any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMC for any loss or damage arising in any way from its use. Please note that any electronic communication that is conducted within or through JPMC's systems is subject to interception, monitoring, review, retention and external production in accordance with JPMC's policy and local laws, rules and regulations; may be stored or otherwise processed in countries other than the country in which you are located; and will be treated in accordance with JPMC policies and applicable laws and regulations. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


[PATCH 2/2] [MAMADOTNET] Add getName() to MamaTransport

Gary Molloy <g.molloy@...>
 

Testing Strategy

--------------------

 

Modify the MamaPublisherCS.cs example application and add the following after you have created your publisher:

 

            publisher.create(transport, outboundTopic);

 

            MamaTransport aTransport = new MamaTransport();

            aTransport = publisher.getTransport();

            string tportName = aTransport.getName();

            Console.WriteLine("TEST:: getTransport name {0}.", tportName);

 

You can expect to see the following output:

 

> MamaPublisher.exe -m wmw -tport tcp_sub

Created inbound subscription.
TEST:: getTransport name tcp_sub. <--------------------------- test output
Publishing message to MAMA_TOPIC.
Publishing message to MAMA_TOPIC.
Publishing message to MAMA_TOPIC.
Publishing message to MAMA_TOPIC.

 

 

======================================================================================================================

 

From 3abc196ba5a09beecbe000463c015c086c86fbea Mon Sep 17 00:00:00 2001

From: Gary Molloy <g.molloy@...>

Date: Mon, 18 May 2015 13:55:43 +0100

Subject: [PATCH 2/2] [MAMADOTNET] Add getName() to MamaTransport

 

Function already exists for C / C++ / JNI

 

Signed-off-by: Gary Molloy <g.molloy@...>

---

mama/dotnet/src/cs/MamaTransport.cs | 15 +++++++++++++++

1 file changed, 15 insertions(+)

 

diff --git a/mama/dotnet/src/cs/MamaTransport.cs b/mama/dotnet/src/cs/MamaTransport.cs

index fee71cb..11a8f71 100644

--- a/mama/dotnet/src/cs/MamaTransport.cs

+++ b/mama/dotnet/src/cs/MamaTransport.cs

@@ -260,6 +260,18 @@ namespace Wombat

                                  GC.KeepAlive(callback);

       }        

 

+      /// <summary>

+      /// Get the name of the transport.

+      /// </summary>

+      public string getName()

+      {

+                             // Get the transport name from the native layer

+                               IntPtr ret = IntPtr.Zero;

+                               CheckResultCode(NativeMethods.mamaTransport_getName(nativeHandle, ref ret));

+

+                               // Convert to an ANSI string

+                               return Marshal.PtrToStringAnsi(ret);

+      }

 

                               #region Implementation details

 

@@ -430,6 +442,9 @@ namespace Wombat

             [DllImport(Mama.DllName, CallingConvention = CallingConvention.Cdecl)]

             public static extern int mamaTransport_getQuality(IntPtr transport,

                                                               ref MamaQuality qual);

+            [DllImport(Mama.DllName, CallingConvention = CallingConvention.Cdecl)]

+            public static extern int mamaTransport_getName(IntPtr transport,

+                                                           ref IntPtr ret);

                                }

 

                               // state

--

2.1.0

 

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 


[PATCH 1/2] [MAMA ALL] New accessor mamaPublisher_getTransport()

Gary Molloy <g.molloy@...>
 

Testing Strategy

--------------------

 

Modify the relevant mamaPublisher example applications to add the following (after you have created the publisher):

 

C

 

    mamaTransport aTransport = NULL;

    status = mamaPublisher_getTransport (gPublisher, &aTransport);

    if (MAMA_STATUS_OK == status)

    {

        const char* tportName = NULL;

        mamaTransport_getName (aTransport, &tportName);

        printf ("TEST: getTransport: %s\n", tportName);

    }

 

 

CPP

 

    MamaTransport* aTransport = NULL;

 

   aTransport = new MamaTransport ();

    aTransport = publisher.getTransport ();

    const char* tportName;

    tportName = aTransport ->getName ();

    printf ("TEST: getTransport: %s\n", tportName);

 

 

JNI

 

    MamaTransport aTransport = new MamaTransport();

    aTransport = myPublisher.getTransport();

    String tportName = aTransport.getName();

    System.out.println( "TEST: getTransport: " + tportName + "\n");

 

 

C#

 

    MamaTransport aTransport = new MamaTransport();

    aTransport = publisher.getTransport();

    string tportName = aTransport.getName();

    Console.WriteLine("TEST: getTransport: {0}", tportName);

 

From each you can expected the following output, for example:

 

$ mamapublisherc -m wmw -tport tcp_sub

Created inbound subscription.

TEST: getTransport: tcp_sub

Publishing message to MAMA_TOPIC.

 

 

There is also an update to the unittests.

Running UnitTestMamaC you can expect to see the following:

 

...

...

[----------] 2 tests from MamaPublisherTestC

[ RUN      ] MamaPublisherTestC.CreateDestroy

[       OK ] MamaPublisherTestC.CreateDestroy (16 ms)

[ RUN      ] MamaPublisherTestC.GetTransport                   <-------------- new unittest

[       OK ] MamaPublisherTestC.GetTransport (16 ms)

[----------] 2 tests from MamaPublisherTestC (32 ms total)

...

...

 

======================================================================================================================

 

From dbb860193ac5fd07c7116eb479fc41360b12b6cd Mon Sep 17 00:00:00 2001

From: Gary Molloy <g.molloy@...>

Date: Thu, 21 May 2015 17:27:10 +0100

Subject: [PATCH 1/2] [MAMA ALL] New accessor mamaPublisher_getTransport()

 

Replace the existing mamaPublisherImpl_getTransportImpl() function and add for all languages

 

Signed-off-by: Gary Molloy <g.molloy@...>

---

mama/c_cpp/src/c/mama/publisher.h               | 15 +++++++

mama/c_cpp/src/c/publisher.c                    | 12 ++++--

mama/c_cpp/src/c/publisherimpl.h                |  3 --

mama/c_cpp/src/cpp/MamaPublisher.cpp            | 10 ++++-

mama/c_cpp/src/cpp/mama/MamaPublisher.h         |  8 +++-

mama/c_cpp/src/gunittest/c/publishertest.cpp    | 33 ++++++++++++++++

mama/dotnet/src/cs/MamaPublisher.cs             | 32 ++++++++++++++-

mama/jni/src/c/mamapublisherjni.c               | 52 ++++++++++++++++++++++++-

mama/jni/src/com/wombat/mama/MamaPublisher.java | 28 +++++++++++++

mama/jni/src/com/wombat/mama/MamaTransport.java |  5 +++

10 files changed, 185 insertions(+), 13 deletions(-)

 

diff --git a/mama/c_cpp/src/c/mama/publisher.h b/mama/c_cpp/src/c/mama/publisher.h

index bb192c6..a4bbde1 100644

--- a/mama/c_cpp/src/c/mama/publisher.h

+++ b/mama/c_cpp/src/c/mama/publisher.h

@@ -181,6 +181,21 @@ MAMAExpDLL

extern mama_status

mamaPublisher_destroy (mamaPublisher publisher);

+/**

+ * @brief Return the <code>mamaTransport</code> for this publisher.

+ *

+ * @param[in] publisher     The mamaPublisher from which to retrieve the transport for.

+ * @param[out] transport    A pointer to hold the transport.

+ *

+ * @return mama_status return code can be one of:

+ *              MAMA_STATUS_NULL_ARG

+ *              MAMA_STATUS_OK

+ */

+MAMAExpDLL

+extern mama_status

+mamaPublisher_getTransport (mamaPublisher   publisher,

+                            mamaTransport*  transport);

+

#if defined( __cplusplus )

}

#endif /* defined( __cplusplus ) */

diff --git a/mama/c_cpp/src/c/publisher.c b/mama/c_cpp/src/c/publisher.c

index 2efd88d..89e4f5d 100644

--- a/mama/c_cpp/src/c/publisher.c

+++ b/mama/c_cpp/src/c/publisher.c

@@ -600,11 +600,15 @@ mama_status mamaPublisherImpl_clearTransport (mamaPublisher publisher)

     return mamaPublisherImpl_destroy((mamaPublisherImpl *)publisher);

}

-mamaTransport

-mamaPublisherImpl_getTransportImpl (mamaPublisher publisher)

+mama_status

+mamaPublisher_getTransport (mamaPublisher   publisher,

+                            mamaTransport*  transport)

{

     mamaPublisherImpl* impl   = (mamaPublisherImpl*)publisher;

-    if (!impl) return NULL;

-    return impl->mTport;

+    if (!impl) return MAMA_STATUS_NULL_ARG;

+    *transport = impl->mTport;

+

+    return MAMA_STATUS_OK;

}

+

diff --git a/mama/c_cpp/src/c/publisherimpl.h b/mama/c_cpp/src/c/publisherimpl.h

index b9b9c43..f336fd8 100644

--- a/mama/c_cpp/src/c/publisherimpl.h

+++ b/mama/c_cpp/src/c/publisherimpl.h

@@ -44,9 +44,6 @@ mamaPublisher_sendFromInboxByIndex (mamaPublisher publisher,

 mama_status mamaPublisherImpl_clearTransport (mamaPublisher publisher);

-extern mamaTransport

-mamaPublisherImpl_getTransportImpl (mamaPublisher publisher);

-

#if defined(__cplusplus)

}

#endif

diff --git a/mama/c_cpp/src/cpp/MamaPublisher.cpp b/mama/c_cpp/src/cpp/MamaPublisher.cpp

index 9e68f80..1a130a6 100644

--- a/mama/c_cpp/src/cpp/MamaPublisher.cpp

+++ b/mama/c_cpp/src/cpp/MamaPublisher.cpp

@@ -119,11 +119,11 @@ namespace Wombat

     }

     MamaPublisher::MamaPublisher (MamaPublisherImpl* impl)

-        : mPimpl (impl)

+        : mPimpl (impl)

     {

     }

-    MamaPublisher::MamaPublisher (void)

+    MamaPublisher::MamaPublisher (void)

         : mPimpl (new MamaPublisherImpl (this))

     {

     }

@@ -134,6 +134,7 @@ namespace Wombat

                                 const char*        root)

     {

         mPimpl->create (transport, topic, source, root);

+        mTransport = transport;

     }

     void MamaPublisher::send (MamaMsg* msg) const

@@ -178,6 +179,11 @@ namespace Wombat

         mPimpl->destroy ();

     }

+    MamaTransport* MamaPublisher::getTransport (void) const

+    {

+        return mTransport;

+    }

+

     void MamaPublisherImpl::send (MamaMsg *msg) const

     {

         mamaTry (mamaPublisher_send (mPublisher, msg->getUnderlyingMsg ()));

diff --git a/mama/c_cpp/src/cpp/mama/MamaPublisher.h b/mama/c_cpp/src/cpp/mama/MamaPublisher.h

index 1f6c9da..ed6be6e 100644

--- a/mama/c_cpp/src/cpp/mama/MamaPublisher.h

+++ b/mama/c_cpp/src/cpp/mama/MamaPublisher.h

@@ -89,10 +89,16 @@ namespace Wombat

         virtual void destroy (void);

+        /**

+         * Return the MamaTransport for the MamaPublisher.

+         */

+        virtual MamaTransport* getTransport (void) const;

+

     protected:

         MamaPublisher (MamaPublisherImpl*);

-       

+

         MamaPublisherImpl*  mPimpl;

+        MamaTransport*      mTransport;

     };

 } // namespace Wombat

diff --git a/mama/c_cpp/src/gunittest/c/publishertest.cpp b/mama/c_cpp/src/gunittest/c/publishertest.cpp

index 651613a..e58e24d 100644

--- a/mama/c_cpp/src/gunittest/c/publishertest.cpp

+++ b/mama/c_cpp/src/gunittest/c/publishertest.cpp

@@ -143,3 +143,36 @@ TEST_F (MamaPublisherTestC, DISABLED_Send)

     ASSERT_EQ (MAMA_STATUS_OK, mama_close());

}

+/*  Description:  Get the transport from the mamaPublisher and make sure its the same transport

+ *                that was used to create the publisher.

+ *

+ *  Expected Result: MAMA_STATUS_OK

+ */

+TEST_F (MamaPublisherTestC, GetTransport)

+{

+    mamaPublisher    publisher  = NULL;

+    mamaTransport    tport      = NULL;

+    const char*      source     = "SRC";

+    mamaTransport    aTransport = NULL;

+

+    ASSERT_EQ (MAMA_STATUS_OK,

+               mamaTransport_allocate (&tport));

+

+    ASSERT_EQ (MAMA_STATUS_OK,

+               mamaTransport_create (tport, "test_tport", mBridge));

+

+    ASSERT_EQ (MAMA_STATUS_OK,

+               mamaPublisher_create (&publisher, tport, source, NULL, NULL));

+

+    ASSERT_EQ (MAMA_STATUS_OK,

+               mamaPublisher_getTransport (publisher, &aTransport));

+

+    ASSERT_EQ (tport, aTransport);

+

+    ASSERT_EQ (MAMA_STATUS_OK,

+               mamaPublisher_destroy (publisher));

+

+    ASSERT_EQ (MAMA_STATUS_OK,

+               mamaTransport_destroy (tport));

+}

+

diff --git a/mama/dotnet/src/cs/MamaPublisher.cs b/mama/dotnet/src/cs/MamaPublisher.cs

index 14d1be8..e5e312e 100644

--- a/mama/dotnet/src/cs/MamaPublisher.cs

+++ b/mama/dotnet/src/cs/MamaPublisher.cs

@@ -39,7 +39,8 @@ namespace Wombat

         /// when using the throttle.

         /// </summary>

         private MamaCallbackStore<MamaSendCompleteCallback, MamaThrottledSendCompleteDelegate> mCallbackStore;

-                              private MamaMsg mReusableMsg;

+        private MamaMsg mReusableMsg;

+        private MamaTransport mReusableTransport;

         #endregion

@@ -424,6 +425,30 @@ namespace Wombat

                                               }

                               }

+        /// <summary>

+        /// Get the MamaTransport.

+        /// The result contains the reusable MamaTransport object of the

+        /// nativeHandle object. Applications calling this method will receive the same

+        /// reusable object for repeated calls on same nativeHandle object.

+        /// </summary>

+        public MamaTransport getTransport()

+        {

+            EnsurePeerCreated();

+            IntPtr transport = IntPtr.Zero;

+            int code = NativeMethods.mamaPublisher_getTransport(nativeHandle, ref transport);

+            CheckResultCode(code);

+

+            if (mReusableTransport == null)

+            {

+                mReusableTransport = new MamaTransport (transport);

+            }

+            else

+            {

+                mReusableTransport.setNativeHandle(transport);

+            }

+            return mReusableTransport;

+        }

+

                               // Interop API

                               private struct NativeMethods

                               {

@@ -469,6 +494,11 @@ namespace Wombat

                                                [DllImport(Mama.DllName, CallingConvention = CallingConvention.Cdecl)]

                                               public static extern int mamaPublisher_destroy(IntPtr publisher);

+

+            [DllImport(Mama.DllName, CallingConvention = CallingConvention.Cdecl)]

+            public static extern int mamaPublisher_getTransport(

+                IntPtr publisher,

+                ref IntPtr result);

                               }

                                private Hashtable mCallbacks = new Hashtable();

diff --git a/mama/jni/src/c/mamapublisherjni.c b/mama/jni/src/c/mamapublisherjni.c

index aa1c4c6..e7172a9 100644

--- a/mama/jni/src/c/mamapublisherjni.c

+++ b/mama/jni/src/c/mamapublisherjni.c

@@ -49,13 +49,14 @@ typedef struct sendMsgCallback_

/******************************************************************************

* Global/Static variables

*******************************************************************************/

-static  jfieldID    publisherPointerFieldId_g   =   NULL;

+static jfieldID     publisherPointerFieldId_g       =  NULL;

+static jfieldID     mamaTransportObjectFieldId_g    =  NULL;

 extern jfieldID     transportPointerFieldId_g;

extern jfieldID     messagePointerFieldId_g;

extern jfieldID     inboxPointerFieldId_g;

-static  jmethodID   sendCallbackMethod_g         =   NULL;

+static jmethodID   sendCallbackMethod_g             =  NULL;

 

 extern  JavaVM*     javaVM_g;

@@ -75,6 +76,47 @@ static void MAMACALLTYPE sendCompleteCB (mamaPublisher publisher,

*******************************************************************************/

/*

  * Class:     com_wombat_mama_MamaPublisher

+ * Method:    _getTransport

+ * Signature: ()V

+ */

+JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1getTransport

+(JNIEnv * env, jobject this)

+{

+    jlong           publisherPointer    = 0;

+    mamaTransport   c_result            = NULL;

+    jobject         result              = NULL;

+    mama_status     status              = MAMA_STATUS_OK;

+    char            errorString[UTILS_MAX_ERROR_STRING_LENGTH];

+

+    assert(publisherPointerFieldId_g!=NULL);

+    publisherPointer = (*env)->GetLongField(env,this,publisherPointerFieldId_g);

+    MAMA_THROW_NULL_PARAMETER_RETURN_VOID(publisherPointer,

+        "Null parameter, MamaPublisher may have already been destroyed.");

+

+    if(MAMA_STATUS_OK!=(mamaPublisher_getTransport(

+                    CAST_JLONG_TO_POINTER(mamaPublisher,publisherPointer),

+                    &c_result)))

+    {

+         utils_buildErrorStringForStatus(

+                errorString, UTILS_MAX_ERROR_STRING_LENGTH,

+                "Failed to get mamaTransport from publisher.", status);

+        utils_throwExceptionForMamaStatus(env,status,errorString);

+    }

+

+    /*re-use the existing field object */

+    if (c_result)

+    {

+        result = (*env)->GetObjectField(env,this,

+                                        mamaTransportObjectFieldId_g);

+        assert(NULL!=result);/*throws an exception*/

+

+        (*env)->SetLongField(env, result, transportPointerFieldId_g,

+                             CAST_POINTER_TO_JLONG(c_result));

+    }

+}

+

+/*

+ * Class:     com_wombat_mama_MamaPublisher

  * Method:    _create

  * Signature: (Lcom/wombat/mama/MamaTransport;Ljava/lang/String;Ljava/lang/String;)V

  */

@@ -444,6 +486,12 @@ JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher_initIDs

             class, "publisherPointer_i", UTILS_JAVA_POINTER_TYPE_SIGNATURE);

     if (!publisherPointerFieldId_g) return;/*Exception auto thrown*/

+    /*The MamaTransport object.*/

+    mamaTransportObjectFieldId_g = (*env)->GetFieldID(env,

+                              class,"mamaTransport_i",

+                              "Lcom/wombat/mama/MamaTransport;");

+    if(!mamaTransportObjectFieldId_g) return;

+

     /* get our callback class */

     sendCallbackClass = (*env)->FindClass(env,

                 "com/wombat/mama/MamaThrottleCallback");

diff --git a/mama/jni/src/com/wombat/mama/MamaPublisher.java b/mama/jni/src/com/wombat/mama/MamaPublisher.java

index ccd39fb..7a3c0f3 100644

--- a/mama/jni/src/com/wombat/mama/MamaPublisher.java

+++ b/mama/jni/src/com/wombat/mama/MamaPublisher.java

@@ -35,6 +35,9 @@ public class MamaPublisher

     /*A long value containing a pointer to the underlying C publisher structure*/

     private long    publisherPointer_i   =   0;

+    /* Reusable MamaTransport object. */

+    private MamaTransport mamaTransport_i = null;

+

               public void create (MamaTransport transport, String topic)

     {

         _create(transport,topic,null);

@@ -81,6 +84,31 @@ public class MamaPublisher

         _sendFromInbox(inbox,msg);

     }

+    public MamaTransport getTransport ()

+    {

+        /* Calls the native method first. This will

+           reuse the reusable mamaTransport in MamaPublisher

+           Only create the MamaTransport if we actually need to

+        */

+        if (mamaTransport_i == null)

+        {

+            mamaTransport_i = new MamaTransport();

+        }

+

+        mamaTransport_i.setPointerVal(0);

+

+        _getTransport ();

+

+        if (mamaTransport_i.getPointerVal() == 0)

+        {

+            return null;

+        }

+

+        return mamaTransport_i;

+    }

+

+    private native void  _getTransport ();

+

     private native void _create (MamaTransport transport, String topic, String source);

     private native void _send (MamaMsg msg);

diff --git a/mama/jni/src/com/wombat/mama/MamaTransport.java b/mama/jni/src/com/wombat/mama/MamaTransport.java

index aef2282..a9c9651 100644

--- a/mama/jni/src/com/wombat/mama/MamaTransport.java

+++ b/mama/jni/src/com/wombat/mama/MamaTransport.java

@@ -410,6 +410,11 @@ public class MamaTransport

         return transportPointer_i;

     }

+    protected void setPointerVal(long pointerVal)

+    {

+        transportPointer_i = pointerVal;

+    }

+

     public void create (MamaBridge bridge)

     {

         myBridge = bridge;

--

2.1.0

 

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 


Re: [PATCH 1/3] [MAMAC] mamaPlugin Feature - additional

Glenn McClements <g.mcclements@...>
 

Hi Keith,
Sorry forgot to follow this up on thread as we’ve caught up elsewhere, but for the benefit of everyone else on the list in answer to your question: 

-          What was the logic behind selection of the points where plug-in hooks can get called?



I think most of the answers are on another part of thread (copied below). For entitlements the first pass would be to remove the existing callouts to DART and replace them with plugin calls. This could then be extended to support server side entitlements as plugin hooks can be added easily. 

---
To give some background on this change, it’s a first pass at a plugin framework that I hope to build on to allow OpenMAMA to become much more of a flexible framework.

The initial hooks were there because of an immediate need, but I’d like to get feedback on where else people would find hooks useful. One area which I’d like to explore is for pluggable entitlements. Using the plugin framework rather than the bridge mechanism:

- the plugins are already dynamic in the sense that any can be loaded at runtime 
- there is the concept of optional functions, so that a plugin can implement as many or as few hooks as they wish. We can also add new hooks without breaking compatibility. 
- the hooks are multi purpose, and multiple plugins can be called from the same hook
----

Glenn 

From: <openmama-dev-bounces@...> on behalf of Keith Rudd
Date: Monday, 11 May 2015 14:30
To: Gary Molloy, "openmama-dev@..."
Subject: Re: [Openmama-dev] [PATCH 1/3] [MAMAC] mamaPlugin Feature - additional

Classification: Public

Thanks for forwarding the doc Gary.

 

I found the mamaPlugin details an interesting read.

 

One question:

-          What was the logic behind selection of the points where plug-in hooks can get called?

 

I was thinking of a case where you used this as a way of having a custom entitlements implementation.

In this sense, the hook at the point of mamaPublisher_send() makes sense because you could use that to implement publishing entitlements control, which is lacking in OpenMAMA.

 

However, there’s no hook at the point of mamaSubscription_create(), so you’d have to rely on the existing OpenMAMA hook (OEA Client interface) to check subscriber entitlements. It’s possible to do both of course but this leads to a rather in-elegant hybrid solution mixing the OEA client interface plus use of a custom hook library.

 

Probably better to be able to do one or the other entirely. (So extend OEAClient interface, or add plug in hook at ALL the points where entitlement checking might be relevant)

 

Were there some other particular use cases in mind that drove the selection of plugin hook points?

 

Regards,

Keith

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Gary Molloy
Sent: 01 May 2015 17:31
To: openmama-dev@...
Subject: Re: [Openmama-dev] [PATCH 1/3] [MAMAC] mamaPlugin Feature - additional

 

Hi Guys,

 

As promised, please find below a link to a document on the mamaPlugin feature:

https://docs.google.com/document/d/1HcV43uFJrV_pX0M0N7oDoZkWly0LjmyIxM9U-YpBtFQ/edit?usp=sharing

Thanks,

Gary

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 

From: Gary Molloy
Sent: 30 April 2015 10:58
To: openmama-dev@...
Subject: RE: [PATCH 1/3] [MAMAC] mamaPlugin Feature - additional

 

From 76a6db152998cbb32de58eb1cb9d6c1ab9307a1e Mon Sep 17 00:00:00 2001

From: Gary Molloy <g.molloy@...>

Date: Wed, 29 Apr 2015 13:05:23 -0400

Subject: [PATCH] [MAMAC] mamaPlugin Feature - addition

 

Addition to the existing mamaPlugin patch to remove references to internal shared objects and a missing null check.

 

Signed-off-by: Gary Molloy <g.molloy@...>

---

mama/c_cpp/src/c/plugin.c |   61 ++++++++++++++++++++------------------------

1 files changed, 28 insertions(+), 33 deletions(-)

 

diff --git a/mama/c_cpp/src/c/plugin.c b/mama/c_cpp/src/c/plugin.c

index b6475fe..303ab9f 100644

--- a/mama/c_cpp/src/c/plugin.c

+++ b/mama/c_cpp/src/c/plugin.c

@@ -216,9 +216,6 @@ mama_initPlugins(void)

         }

     }

 

-    mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising mamacenterprise");

-    mama_loadPlugin ("mamacenterprise");

-

     return MAMA_STATUS_OK;

}

 

@@ -243,15 +240,10 @@ mama_loadPlugin (const char* pluginName)

     if (pluginImpl == NULL)

     {

        /* The plugin name should be of the format mamaplugin<name> */

-        if (strncmp(pluginName, "mamacenterprise", MAX_PLUGIN_STRING) == 0)

-            snprintf(loadPluginName, MAX_PLUGIN_STRING,

-                "%s",

-                pluginName);

-        else

-            snprintf(loadPluginName, MAX_PLUGIN_STRING,

-                "%s%s",

-                PLUGIN_NAME,

-                pluginName);

+        snprintf(loadPluginName, MAX_PLUGIN_STRING,

+            "%s%s",

+            PLUGIN_NAME,

+            pluginName);

 

         pluginLib = openSharedLib (loadPluginName, NULL);

 

@@ -345,31 +337,34 @@ mama_shutdownPlugins (void)

 

     for (plugin = 0; plugin <= gPluginNo; plugin++)

     {

-        if (gPlugins[plugin]->mPluginHandle != NULL)

+        if (gPlugins[plugin] != NULL)

         {

-            /* Fire the user shutdown hook first - if one is present */

-            if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)

+            if (gPlugins[plugin]->mPluginHandle != NULL)

             {

-                gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);

-            }

+                /* Fire the user shutdown hook first - if one is present */

+                if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)

+                {

+                    gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);

+                }

 

-            ret = closeSharedLib (gPlugins[plugin]->mPluginHandle);

-            if (0!=ret)

-            {

-                 mama_log (MAMA_LOG_LEVEL_WARN,

-                            "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]",

-                            gPlugins[plugin]->mPluginName);

-            }

-            else

-            {

-                 mama_log (MAMA_LOG_LEVEL_WARN,

-                            "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed",

-                            gPlugins[plugin]->mPluginName);

-            }

+                ret = closeSharedLib (gPlugins[plugin]->mPluginHandle);

+                if (0!=ret)

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]",

+                                gPlugins[plugin]->mPluginName);

+                }

+                else

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed",

+                                gPlugins[plugin]->mPluginName);

+                }

 

-            free ((char*)gPlugins[plugin]->mPluginName);

-            free (gPlugins[plugin]);

-            gPlugins[plugin] = NULL;

+                free ((char*)gPlugins[plugin]->mPluginName);

+                free (gPlugins[plugin]);

+                gPlugins[plugin] = NULL;

+            }

         }

     }

     return status;

--

1.7.1

 

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Gary Molloy
Sent: 23 April 2015 17:54
To: openmama-dev@...
Subject: [Openmama-dev] [PATCH 1/3] [MAMAC] mamaPlugin Feature

 

Testing Strategy:-

Not middleware or O/S specific. 
 

Using the attached template you can create your own plugin and load it in via your mama.properties, for example:

 

mama.plugin.name_0=template

 

You can run up a mamaPublisher to test your plugin, for example:

 

mamapublisherc -tport pub -m wmw -l MAMA_INBOUND_TOPIC -v -v -v -v -v

 

You can expect to see output similar this if your plugin was loaded successfully:

 

2015-04-09 13:45:02: (f9018280) : mama_initPlugins(): Initialising [mama.plugin.name_0] template 

2015-04-09 13:45:02: (f9018280) : mama_loadPlugin(): Sucessfully registered plugin functions for [template] 

2015-04-09 13:45:02: (f9018280) : mama_loadPlugin(): Successfully run the init hook for mama plugin [template]  

 

If your plugin was not loaded successful you can expect to see output similar to this:

 

2015-04-09 13:45:02: (f9018280) : mama_initPlugins(): Initialising [mama.plugin.name_0] template 

2015-04-09 13:45:02: (f9018280) : mamaPlugin_registerFunctions(): Cannot load plugin, does not implement required function: [templateMamaPlugin_shutdownHook] 

2015-04-09 13:45:02: (f9018280) : mama_loadPlugin(): Failed to register plugin functions for [template] 

 

Further documentation on the mamaPlugin feature will be available shortly which will provide more details on the feature which will include the various hooks available etc...

 

 

=========================================================================================================

 

From e2a6a3f9c5750cee780cb6185a1310b4e4b70629 Mon Sep 17 00:00:00 2001

From: Gary Molloy <g.molloy@...>

Date: Thu, 23 Apr 2015 11:22:14 -0400

Subject: [PATCH 1/3] [MAMAC] mamaPlugin Feature

 

A new feature, mamaPlugin has been introduced that will allow you to

create and run your own code within 'hooks' into the MAMA codebase.

 

A mamaPlugin is essentially a shared object.

 

Signed-off-by: Gary Molloy <g.molloy@...>

---

mama/c_cpp/src/c/Makefile.am    |    1 +

mama/c_cpp/src/c/SConscript     |    1 +

mama/c_cpp/src/c/SConscript.win |    1 +

mama/c_cpp/src/c/mama.c         |   10 +-

mama/c_cpp/src/c/mama/types.h   |   10 +

mama/c_cpp/src/c/plugin.c       |  472 +++++++++++++++++++++++++++++++++++++++

mama/c_cpp/src/c/plugin.h       |   59 +++++

mama/c_cpp/src/c/publisher.c    |   10 +

mama/c_cpp/src/c/transport.c    |   21 ++-

9 files changed, 579 insertions(+), 6 deletions(-)

create mode 100644 mama/c_cpp/src/c/plugin.c

create mode 100644 mama/c_cpp/src/c/plugin.h

 

diff --git a/mama/c_cpp/src/c/Makefile.am b/mama/c_cpp/src/c/Makefile.am

index c831ce4..318c353 100644

--- a/mama/c_cpp/src/c/Makefile.am

+++ b/mama/c_cpp/src/c/Makefile.am

@@ -131,6 +131,7 @@ libmama_la_SOURCES = \

     mamaStrUtils.h \

     mamaStrUtils.c \

               marketdata.c \

+    plugin.c \

     middleware.c \

               msg.c \

               msgfield.c \

diff --git a/mama/c_cpp/src/c/SConscript b/mama/c_cpp/src/c/SConscript

index 4362f50..f47e18c 100644

--- a/mama/c_cpp/src/c/SConscript

+++ b/mama/c_cpp/src/c/SConscript

@@ -98,6 +98,7 @@ libmama_sources = \

     mama.c

     mamaStrUtils.c

               marketdata.c

+    plugin.c

     middleware.c

               msg.c

               msgfield.c

diff --git a/mama/c_cpp/src/c/SConscript.win b/mama/c_cpp/src/c/SConscript.win

index 77e3e18..9a6ff05 100644

--- a/mama/c_cpp/src/c/SConscript.win

+++ b/mama/c_cpp/src/c/SConscript.win

@@ -50,6 +50,7 @@ dqpublishermanager.c

inbox.c

msgtype.c

msgutils.c

+plugin.c

senderId.c

reservedfields.c

subscription.c

diff --git a/mama/c_cpp/src/c/mama.c b/mama/c_cpp/src/c/mama.c

index 33a0768..5e31856 100644

--- a/mama/c_cpp/src/c/mama.c

+++ b/mama/c_cpp/src/c/mama.c

@@ -35,6 +35,7 @@

#include <payloadbridge.h>

#include <property.h>

#include <platform.h>

+#include <plugin.h>

 

 #include "fileutils.h"

#include "reservedfieldsimpl.h"

@@ -42,7 +43,6 @@

#include <mama/stat.h>

#include <mama/statfields.h>

#include <statsgeneratorinternal.h>

-#include <statsgeneratorinternal.h>

#include <mama/statscollector.h>

#include "transportimpl.h"

 

@@ -740,6 +740,9 @@ mama_openWithPropertiesCount (const char* path,

                               }

     }

 

+    /* This will initialise all plugins */

+    mama_initPlugins();

+

     prop = properties_Get (gProperties, "mama.catchcallbackexceptions.enable");

     if (prop != NULL && strtobool(prop))

     {

@@ -1253,9 +1256,12 @@ mama_closeCount (unsigned int* count)

                 gImpl.myPayloadLibraries[(uint8_t)payload] = NULL;

             }

         }

-       

+

        gDefaultPayload = NULL;

 

+       /* This will shutdown all plugins */

+       mama_shutdownPlugins();

+

         /* Look for a bridge for each of the middlewares and close them */

         for (middleware = 0; middleware != MAMA_MIDDLEWARE_MAX; ++middleware)

         {

diff --git a/mama/c_cpp/src/c/mama/types.h b/mama/c_cpp/src/c/mama/types.h

index 50d6608..03f6da8 100644

--- a/mama/c_cpp/src/c/mama/types.h

+++ b/mama/c_cpp/src/c/mama/types.h

@@ -74,6 +74,16 @@ typedef struct mamaBridgeImpl_* mamaBridge;

typedef struct mamaPayloadBridgeImpl_* mamaPayloadBridge;

 

 /**

+ * @brief Container for holding a mama plugin object

+ */

+typedef struct mamaPluginImpl_*     mamaPlugin;

+

+/**

+ * @brief Container for holding a mama plugin info

+ */

+typedef void*       mamaPluginInfo;

+

+/**

  * Flexible date/time format

  */

typedef   mama_u64_t*   mamaDateTime;

diff --git a/mama/c_cpp/src/c/plugin.c b/mama/c_cpp/src/c/plugin.c

new file mode 100644

index 0000000..b6475fe

--- /dev/null

+++ b/mama/c_cpp/src/c/plugin.c

@@ -0,0 +1,472 @@

+/* $Id$

+ *

+ * OpenMAMA: The open middleware agnostic messaging API

+ * Copyright (C) 2011 NYSE Technologies, Inc.

+ *

+ * This library is free software; you can redistribute it and/or

+ * modify it under the terms of the GNU Lesser General Public

+ * License as published by the Free Software Foundation; either

+ * version 2.1 of the License, or (at your option) any later version.

+ *

+ * This library is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

+ * Lesser General Public License for more details.

+ *

+ * You should have received a copy of the GNU Lesser General Public

+ * License along with this library; if not, write to the Free Software

+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA

+ * 02110-1301 USA

+ */

+

+#include <string.h>

+#include <stdio.h>

+#include <limits.h>

+

+#include "wombat/port.h"

+#include "wombat/environment.h"

+#include "wombat/strutils.h"

+#include <wombat/wtable.h>

+

+#include <mama/mama.h>

+#include <mama/error.h>

+#include <mamainternal.h>

+#include <mama/version.h>

+#include <property.h>

+#include <plugin.h>

+#include <platform.h>

+

+#define PLUGIN_PROPERTY "mama.plugin.name_"

+#define PLUGIN_NAME "mamaplugin"

+

+#define MAX_PLUGINS 100

+#define MAX_PLUGIN_STRING 1024

+

+#define MAX_FUNC_STRING 256

+

+/**

+ * @brief Mechanism for registering required plugin functions.

+ *

+ * Taking a function string name search the shared library handle, using the

+ * loadLibFunc portability method, for the function. If it is found, set the

+ * appropriate function pointer in the plugin struct to the result. If not,

+ * log as an error the fact that the funciton cannot be found, and return

+ * MAMA_STATUS_PLATFORM

+ *

+ * @param FUNCSTRINGNAME The string function name.

+ * @param FUNCIMPLNAME The name of the function pointer in the plugin struct

+ * @param FUNCIMPLTYPE The type of the function pointer expected.

+ */

+#define REGISTER_PLUGIN_FUNCTION(FUNCSTRINGNAME, FUNCIMPLNAME, FUNCIMPLTYPE)    \

+do {                                                                            \

+    snprintf (functionName, MAX_FUNC_STRING, "%s"#FUNCSTRINGNAME, name);        \

+    result = loadLibFunc (pluginLib, functionName);                             \

+                                                                                \

+    if (NULL != result) {                                                       \

+        (pluginImpl)->FUNCIMPLNAME = *(FUNCIMPLTYPE*)&result;                   \

+        result = NULL;                                                          \

+    } else {                                                                    \

+        mama_log (MAMA_LOG_LEVEL_ERROR,                                         \

+                  "mamaPlugin_registerFunctions(): "                            \

+                  "Cannot load plugin, does not implement required function: [%s]",\

+                  functionName);                                                \

+        status = MAMA_STATUS_PLATFORM;                                          \

+        return status;                                                          \

+    }                                                                           \

+} while (0)

+

+/**

+ * @brief Mechanism for registering required plugin functions.

+ *

+ * Taking a function string name search the shared library handle, using the

+ * loadLibFunc portability method, for the function. If it is found, set the

+ * appropriate function pointer in the plugin struct to the result. If not

+ * log the fact that the function has not been found, and continue.

+ *

+ * @param FUNCSTRINGNAME The string function name.

+ * @param FUNCIMPLNAME The name of the function pointer in the plugin struct

+ * @param FUNCIMPLTYPE The type of the function pointer expected.

+ */

+#define REGISTER_OPTIONAL_PLUGIN_FUNCTION(FUNCSTRINGNAME,                       \

+                                          FUNCIMPLNAME,                         \

+                                          FUNCIMPLTYPE)                         \

+do {                                                                            \

+    snprintf (functionName, MAX_FUNC_STRING, "%s"#FUNCSTRINGNAME, name);        \

+    result = loadLibFunc (pluginLib, functionName);                             \

+                                                                                \

+    if (NULL != result) {                                                       \

+        (pluginImpl)->FUNCIMPLNAME = *(FUNCIMPLTYPE*)&result;                   \

+        result = NULL;                                                          \

+    } else {                                                                    \

+        mama_log (MAMA_LOG_LEVEL_FINE,                                          \

+                  "mamaPlugin_registerFunctions(): "                            \

+                  "Optional plugin function [%s] not found. Unavailable.",      \

+                  functionName);                                                \

+    }                                                                           \

+} while (0)

+

+typedef struct mamaPluginImpl_

+{

+    LIB_HANDLE          mPluginHandle;

+    char*               mPluginName;

+    mamaPluginInfo      mPluginInfo;

+

+    mamaPlugin_publisherPreSendHook     mamaPluginPublisherPreSendHook;

+    mamaPlugin_transportPostCreateHook  mamaPluginTransportPostCreateHook;

+    mamaPlugin_shutdownHook             mamaPluginShutdownHook;

+    mamaPlugin_initHook                 mamaPluginInitHook;

+

+} mamaPluginImpl;

+

+static mamaPluginImpl*      gPlugins[MAX_PLUGINS];

+static volatile int         gPluginNo = 0;

+

+/**

+ * @brief Used to load register all possible plugin functions to be

+ *        used within Mama.

+ *

+ * param[in] pluginLib

+ * param[in] name

+ * param[in] pluginImpl The plugin impl to be used

+ *

+ * @return mama_status return code can be one of:

+ *          MAMA_STATUS_OK

+ */

+mama_status

+mamaPlugin_registerFunctions   (LIB_HANDLE      pluginLib,

+                                const char*     name,

+                                mamaPluginInfo  pluginInfo,

+                                mamaPluginImpl* pluginImpl);

+

+/**

+ * @brief Used find a plugin using the library name

+ *

+ * param[in] name

+ *

+ * @return a valid mamaPluginImpl if found

+ */

+mamaPluginImpl*

+mamaPlugin_findPlugin (const char* name);

+

+/**

+ * @brief Used find a plugin using the library name

+ *

+ * param[in] pluginName

+ *

+ * @return mama_status return code can be one of:

+ *          MAMA_STATUS_OK

+ */

+mama_status

+mama_loadPlugin (const char* pluginName);

+

+

+/**

+ * Register function pointers associated with a specific plugin.

+ */

+mama_status

+mamaPlugin_registerFunctions (LIB_HANDLE      pluginLib,

+                              const char*     name,

+                              mamaPluginInfo  pluginInfo,

+                              mamaPluginImpl* pluginImpl)

+{

+    mama_status  status        = MAMA_STATUS_OK;

+    void*        result        = NULL;

+    char         functionName[MAX_FUNC_STRING];

+

+    /* Save off some informatin on the plugin */

+    pluginImpl->mPluginHandle = pluginLib;

+    pluginImpl->mPluginName = strdup(name);

+    pluginImpl->mPluginInfo = pluginInfo;

+

+

+    /* Required fuctions */

+    REGISTER_PLUGIN_FUNCTION (MamaPlugin_initHook, mamaPluginInitHook,

+                              mamaPlugin_initHook);

+    REGISTER_PLUGIN_FUNCTION (MamaPlugin_shutdownHook, mamaPluginShutdownHook,

+                              mamaPlugin_shutdownHook);

+

+

+    /* Optional fuctions */

+    REGISTER_OPTIONAL_PLUGIN_FUNCTION (MamaPlugin_publisherPreSendHook, mamaPluginPublisherPreSendHook,

+                                       mamaPlugin_publisherPreSendHook);

+    REGISTER_OPTIONAL_PLUGIN_FUNCTION (MamaPlugin_transportPostCreateHook, mamaPluginTransportPostCreateHook,

+                                       mamaPlugin_transportPostCreateHook);

+

+   return status;

+}

+

+mama_status

+mama_initPlugins(void)

+{

+    int             pluginCount      = 0;

+    const char*     prop             = NULL;

+    char            propString[MAX_PLUGIN_STRING];

+

+    for (pluginCount = 0; pluginCount < MAX_PLUGINS; pluginCount++)

+    {

+        snprintf(propString, MAX_PLUGIN_STRING,

+            PLUGIN_PROPERTY"%d",

+            pluginCount);

+

+        prop = properties_Get (mamaInternal_getProperties (), propString);

+        if (prop != NULL && strlen(prop)!= 0)

+        {

+            mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising [%s] %s", propString, prop);

+            mama_loadPlugin (prop);

+        }

+    }

+

+    mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising mamacenterprise");

+    mama_loadPlugin ("mamacenterprise");

+

+    return MAMA_STATUS_OK;

+}

+

+mama_status

+mama_loadPlugin (const char* pluginName)

+{

+    LIB_HANDLE              pluginLib       = NULL;

+    mamaPluginImpl*         pluginImpl      = NULL;

+    mama_status             status          = MAMA_STATUS_OK;

+    mamaPluginInfo          pluginInfo      = NULL;

+    char                    loadPluginName  [MAX_PLUGIN_STRING];

+    mamaPluginImpl*         aPluginImpl     = NULL;

+

+    if (!pluginName)

+        return MAMA_STATUS_NULL_ARG;

+

+    pluginImpl = mamaPlugin_findPlugin(pluginName);

+

+    /*

+     * Check to see if pluginImpl has already been loaded

+     */

+    if (pluginImpl == NULL)

+    {

+       /* The plugin name should be of the format mamaplugin<name> */

+        if (strncmp(pluginName, "mamacenterprise", MAX_PLUGIN_STRING) == 0)

+            snprintf(loadPluginName, MAX_PLUGIN_STRING,

+                "%s",

+                pluginName);

+        else

+            snprintf(loadPluginName, MAX_PLUGIN_STRING,

+                "%s%s",

+                PLUGIN_NAME,

+                pluginName);

+

+        pluginLib = openSharedLib (loadPluginName, NULL);

+

+        if (!pluginLib)

+        {

+

+           mama_log (MAMA_LOG_LEVEL_ERROR,

+                    "mama_loadPlugin(): "

+                    "Could not open plugin library [%s] [%s]",

+                    pluginName,

+                    getLibError());

+            return MAMA_STATUS_PLATFORM;

+        }

+

+        /* Create structure to hold plugin information */

+        aPluginImpl = (mamaPluginImpl*)calloc (1, sizeof(mamaPluginImpl));

+

+        status = mamaPlugin_registerFunctions (pluginLib,

+                                               pluginName,

+                                               pluginInfo,

+                                               aPluginImpl);

+

+        if (MAMA_STATUS_OK == status)

+        {

+            mama_log (MAMA_LOG_LEVEL_NORMAL,

+                     "mama_loadPlugin(): "

+                     "Sucessfully registered plugin functions for [%s]",

+                     pluginName);

+

+        }

+        else

+        {

+            mama_log (MAMA_LOG_LEVEL_WARN,

+                     "mama_loadPlugin(): "

+                     "Failed to register plugin functions for [%s]",

+                     pluginName);

+

+            closeSharedLib (aPluginImpl->mPluginHandle);

+

+            free ((char*)aPluginImpl->mPluginName);

+            free ((mamaPluginImpl*)aPluginImpl);

+

+            return status;

+        }

+

+        /* Invoke the init function */

+        status = aPluginImpl->mamaPluginInitHook (aPluginImpl->mPluginInfo);

+

+        if (MAMA_STATUS_OK == status)

+        {

+            mama_log (MAMA_LOG_LEVEL_NORMAL,

+                      "mama_loadPlugin(): Successfully run the init hook for mama plugin [%s]",

+                       aPluginImpl->mPluginName);

+        }

+        else

+        {

+            mama_log (MAMA_LOG_LEVEL_WARN,

+                      "mama_loadPlugin(): Init hook failed for mama plugin [%s]",

+                       aPluginImpl->mPluginName);

+

+            closeSharedLib (aPluginImpl->mPluginHandle);

+

+            free ((char*)aPluginImpl->mPluginName);

+            free ((mamaPluginImpl*)aPluginImpl);

+

+            return status;

+        }

+

+        /* Save off the plugin impl and increment the plugin counter */

+        gPlugins[gPluginNo] = aPluginImpl;

+        gPluginNo++;

+

+    }

+    else

+    {

+        mama_log (MAMA_LOG_LEVEL_NORMAL,

+                 "mama_loadPlugin(): "

+                 "Plugin [%s] has already been loaded and initialised",

+                 pluginName);

+    }

+

+    return MAMA_STATUS_OK;

+}

+

+mama_status

+mama_shutdownPlugins (void)

+{

+    mama_status  status = MAMA_STATUS_OK;

+    int          plugin = 0;

+    int          ret    = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin]->mPluginHandle != NULL)

+        {

+            /* Fire the user shutdown hook first - if one is present */

+            if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)

+            {

+                gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);

+            }

+

+            ret = closeSharedLib (gPlugins[plugin]->mPluginHandle);

+            if (0!=ret)

+            {

+                 mama_log (MAMA_LOG_LEVEL_WARN,

+                            "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]",

+                            gPlugins[plugin]->mPluginName);

+            }

+            else

+            {

+                 mama_log (MAMA_LOG_LEVEL_WARN,

+                            "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed",

+                            gPlugins[plugin]->mPluginName);

+            }

+

+            free ((char*)gPlugins[plugin]->mPluginName);

+            free (gPlugins[plugin]);

+            gPlugins[plugin] = NULL;

+        }

+    }

+    return status;

+}

+

+mama_status

+mamaPlugin_firePublisherPreSendHook (mamaPublisher publisher, mamaMsg message)

+{

+    mama_status  status = MAMA_STATUS_OK;

+    int          plugin = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin] != NULL)

+        {

+            if (gPlugins[plugin]->mamaPluginPublisherPreSendHook != NULL)

+            {

+                status = gPlugins[plugin]->mamaPluginPublisherPreSendHook (gPlugins[plugin]->mPluginInfo, publisher, message);

+

+                if (MAMA_STATUS_OK != status)

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mamaPlugin_firePublisherPreSendHook(): Publisher pre send hook failed for mama plugin [%s]",

+                                gPlugins[plugin]->mPluginName);

+                }

+            }

+        }

+    }

+    return status;

+}

+

+mama_status

+mamaPlugin_fireTransportPostCreateHook (mamaTransport transport)

+{

+    mama_status  status = MAMA_STATUS_OK;

+    int          plugin = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin] != NULL)

+        {

+            if (gPlugins[plugin]->mamaPluginTransportPostCreateHook != NULL)

+            {

+                status = gPlugins[plugin]->mamaPluginTransportPostCreateHook (gPlugins[plugin]->mPluginInfo, transport);

+

+                if (MAMA_STATUS_OK != status)

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mamaPlugin_fireTransportPostCreateHook(): Transport post create hook failed for mama plugin [%s]",

+                                gPlugins[plugin]->mPluginName);

+                }

+            }

+        }

+    }

+    return status;

+}

+

+mama_status

+mamaPlugin_fireShutdownHook (void)

+{

+    mama_status  status = MAMA_STATUS_OK;

+    int          plugin = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin] != NULL)

+        {

+            if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)

+            {

+                status = gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);

+

+                if (MAMA_STATUS_OK != status)

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mamaPlugin_fireShutdownHook(): Shutdown hook failed for mama plugin [%s]",

+                                gPlugins[plugin]->mPluginName);

+                }

+            }

+        }

+    }

+    return status;

+}

+

+mamaPluginImpl*

+mamaPlugin_findPlugin (const char* name)

+{

+    int plugin = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin])

+        {

+            if ((strncmp(gPlugins[plugin]->mPluginName, name, MAX_PLUGIN_STRING) == 0))

+            {

+                return gPlugins[plugin];

+            }

+        }

+    }

+    return NULL;

+}

diff --git a/mama/c_cpp/src/c/plugin.h b/mama/c_cpp/src/c/plugin.h

new file mode 100644

index 0000000..df43b27

--- /dev/null

+++ b/mama/c_cpp/src/c/plugin.h

@@ -0,0 +1,59 @@

+/* $Id$

+ *

+ * OpenMAMA: The open middleware agnostic messaging API

+ * Copyright (C) 2011 NYSE Technologies, Inc.

+ *

+ * This library is free software; you can redistribute it and/or

+ * modify it under the terms of the GNU Lesser General Public

+ * License as published by the Free Software Foundation; either

+ * version 2.1 of the License, or (at your option) any later version.

+ *

+ * This library is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

+ * Lesser General Public License for more details.

+ *

+ * You should have received a copy of the GNU Lesser General Public

+ * License along with this library; if not, write to the Free Software

+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA

+ * 02110-1301 USA

+ */

+

+#ifndef PluginH__

+#define PluginH__

+

+

+/**

+ * @brief Containers used within the mama plugin

+ */

+typedef mama_status (*mamaPlugin_publisherPreSendHook) (mamaPluginInfo pluginInfo, mamaPublisher publisher, mamaMsg message);

+typedef mama_status (*mamaPlugin_transportPostCreateHook) (mamaPluginInfo pluginInfo, mamaTransport transport);

+typedef mama_status (*mamaPlugin_shutdownHook) (mamaPluginInfo pluginInfo);

+typedef mama_status (*mamaPlugin_initHook) (mamaPluginInfo* pluginInfo);

+

+/**

+ * Initialize the internal plugin interface

+ *

+ * @return mama status code

+ */

+extern mama_status

+mama_initPlugins (void);

+

+/**

+ * Shutdown the internal plugin interface

+ *

+ * @return mama status code

+ */

+extern mama_status

+mama_shutdownPlugins (void);

+

+extern mama_status

+mamaPlugin_firePublisherPreSendHook (mamaPublisher publisher, mamaMsg message);

+

+extern mama_status

+mamaPlugin_fireTransportPostCreateHook (mamaTransport transport);

+

+extern mama_status

+mamaPlugin_fireShutdownHook (void);

+

+#endif /* PluginH__ */

diff --git a/mama/c_cpp/src/c/publisher.c b/mama/c_cpp/src/c/publisher.c

index 4612d17..6a7f92d 100644

--- a/mama/c_cpp/src/c/publisher.c

+++ b/mama/c_cpp/src/c/publisher.c

@@ -23,6 +23,7 @@

#include "mama/publisher.h"

 

 #include "bridge.h"

+#include "plugin.h"

#include "throttle.h"

#include "transportimpl.h"

 

@@ -245,6 +246,15 @@ mamaPublisher_send (mamaPublisher publisher,

     if (!impl->mMamaPublisherBridgeImpl) return MAMA_STATUS_INVALID_ARG;

     if (!impl->mBridgeImpl) return MAMA_STATUS_NO_BRIDGE_IMPL;

 

+    /* Calling plugin hook */

+    status = mamaPlugin_firePublisherPreSendHook (publisher, msg);

+    if (MAMA_STATUS_OK != status)

+    {

+        mama_log (MAMA_LOG_LEVEL_ERROR,

+                  "mamaPublisher_send(): PublisherPreSendHook failed. Not sending message.");

+        return status;

+    }

+

     status = impl->mBridgeImpl->bridgeMamaPublisherSend

         (impl->mMamaPublisherBridgeImpl,

          msg);

diff --git a/mama/c_cpp/src/c/transport.c b/mama/c_cpp/src/c/transport.c

index 339dbc0..622f47d 100644

--- a/mama/c_cpp/src/c/transport.c

+++ b/mama/c_cpp/src/c/transport.c

@@ -25,6 +25,7 @@

 

 #include "mama/mama.h"

#include "throttle.h"

+#include "plugin.h"

#include "list.h"

#include "transportimpl.h"

#include "bridge.h"

@@ -876,10 +877,22 @@ mamaTransport_create (mamaTransport transport,

 

     if ((!self->mDisableRefresh) && (!mamaTransportInternal_disableRefreshes(name)))

     {

-        return refreshTransport_create (&self->mRefreshTransport,

-                                    (mamaTransport)self,

-                                    self->mListeners,

-                                    self->mBridgeImpl);

+        status = refreshTransport_create (&self->mRefreshTransport,

+                                          (mamaTransport)self,

+                                          self->mListeners,

+                                          self->mBridgeImpl);

+

+        if (MAMA_STATUS_OK != status)

+            return status;

+    }

+

+    /* Calling plugin hook*/

+    status = mamaPlugin_fireTransportPostCreateHook (transport);

+    if (MAMA_STATUS_OK != status)

+    {

+        mama_log (MAMA_LOG_LEVEL_ERROR,

+                  "mamaTransport_create(): TransportPostCreateHook failed with a status of %s",

+                   mamaStatus_stringForStatus(status));

     }

 

     return MAMA_STATUS_OK;

--

1.7.1

 

 

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 



---
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures and to http://www.db.com/unitedkingdom/content/privacy.htm for information about privacy.


Re: subscription msg queueing question

Frank Quinn <f.quinn@...>
 

Hi Reed,

Preventing dereference of trashed memory certainly one of the benefits. MAMA in general will try and keep context local to a single thread where possible though to avoid having to lock in the interest of performance. I'm not sure what exactly you're doing though... When you say;

"The Tick42 bridge (and maybe others) send the sub msgs back in a thread that is not the same as the one that dequeues from the sub’s queue."

What are you defining as "the sub msgs" and where / what are you sending them to? A thread vs function diagram of your bridge would help if you have one too.

Cheers,
Frank

----- Reply message -----
From: "Alpert, Reed" <reed.alpert@...>
To: "openmama-dev@..." <openmama-dev@...>
Subject: [Openmama-dev] subscription msg queueing question
Date: Tue, May 19, 2015 19:50

Hi,

 

The pdf dev guide says to only destroy a subscription from the same thread as the onMsg callbacks, or use destoryEx, which puts the destroy request on the subscription’s queue.

 

The Tick42 bridge (and maybe others) send the sub msgs back in a thread that is not the same as the one that dequeues from the sub’s queue.

In this case the destoryEx does not protect against a cotemporal onMsg and onDestroy callback.

 

Does the Wombat bridge queue sub msgs so that this strategy works to prevent onMsg and onDestroy from colliding ?

 

Thanks,

 

Reed.

 


Reed Alpert | Corporate & Investment Bank | Market Data Services | J.P. Morgan | 4 Metrotech Center, 23rd Floor, Brooklyn, NY 11245 | T: 718.242.5198  | M: 917.414.4613 | reed.alpert@...

Alternate Contact:  CIB PIM Trading Technology Solutions NA | CIB_PIM_Trading_Technology_Solutions_NA@...

 

This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates (collectively, "JPMC"). This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Although this transmission and any attachments are believed to be free of any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMC for any loss or damage arising in any way from its use. Please note that any electronic communication that is conducted within or through JPMC's systems is subject to interception, monitoring, review, retention and external production in accordance with JPMC's policy and local laws, rules and regulations; may be stored or otherwise processed in countries other than the country in which you are located; and will be treated in accordance with JPMC policies and applicable laws and regulations. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


subscription msg queueing question

Alpert, Reed <reed.alpert@...>
 

Hi,

 

The pdf dev guide says to only destroy a subscription from the same thread as the onMsg callbacks, or use destoryEx, which puts the destroy request on the subscription’s queue.

 

The Tick42 bridge (and maybe others) send the sub msgs back in a thread that is not the same as the one that dequeues from the sub’s queue.

In this case the destoryEx does not protect against a cotemporal onMsg and onDestroy callback.

 

Does the Wombat bridge queue sub msgs so that this strategy works to prevent onMsg and onDestroy from colliding ?

 

Thanks,

 

Reed.

 


Reed Alpert | Corporate & Investment Bank | Market Data Services | J.P. Morgan | 4 Metrotech Center, 23rd Floor, Brooklyn, NY 11245 | T: 718.242.5198  | M: 917.414.4613 | reed.alpert@...

Alternate Contact:  CIB PIM Trading Technology Solutions NA | CIB_PIM_Trading_Technology_Solutions_NA@...

 

This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates (collectively, "JPMC"). This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Although this transmission and any attachments are believed to be free of any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMC for any loss or damage arising in any way from its use. Please note that any electronic communication that is conducted within or through JPMC's systems is subject to interception, monitoring, review, retention and external production in accordance with JPMC's policy and local laws, rules and regulations; may be stored or otherwise processed in countries other than the country in which you are located; and will be treated in accordance with JPMC policies and applicable laws and regulations. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


Re: OpenMAMA-2.3.3-rc1

Gary Molloy <g.molloy@...>
 

Hi Alireza,

 

Thanks for your email. 

 

We did not have a binary release of 2.3.2, however you can check that version out from the OpenMAMA git repository.  The next release, 2.3.3, will have a full binary release.

 

Thanks,

Gary

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 

From: Alireza Assadzadeh [mailto:Alireza.Assadzadeh@...]
Sent: 11 May 2015 19:18
To: Gary Molloy; openmama-dev@...
Subject: RE: OpenMAMA-2.3.3-rc1

 

Hi Gary,

 

Back in Jan/Feb we had OpenMAMA-2.3.2-rc1. As far as I know there was no official release of 2.3.2.

 

Now with 2.3.3-rc1 in May, do you know if there will still be a 2.3.2 release or is 2.3.2 superseded with 2.3.3?

 

Regards,

 

--Alireza

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Gary Molloy
Sent: Tuesday, May 05, 2015 10:31 AM
To: openmama-dev@...
Subject: [Openmama-dev] OpenMAMA-2.3.3-rc1

 

Hi Guys,

 

I have cut the new OpenMAMA-2.3.3 branch and created the OpenMAMA-2.3.3-rc1 tag, this is now available for testing.  I would anticipate a test period of around 2-3 weeks with a view to making the release official by the end of the month.

 

This release has been cut from the next branch.

 

The following list of issues/features have been added for this release:

 

BZ-166 Wombat: wInterlocked_set inconsistent return value

BZ-164 MAMAJNI: MamaPublisher: Overloaded MamaPublisher create method

BZ-169  Wombat queue has no separate deallocate method

BZ-176  Missing actions for snapshot subscriptions transition to deactivate state

BZ-168 Complete support for Vector Bool and Vector Char field types

BZ-156 No value expansion of last property line in mama.properties

BZ-178 Problem with mamaDictionary_getDictionaryMessage when multiple bridges are loaded

BZ-182 MAMAJAVA: Add java MamaDateTime::getAsFormattedString() method

BZ-181 MAMAJAVA: Java subscription setup fix - it loses the closure

BZ-183 SCons: OpenMAMA will not build on windows

BZ-189 [MAMAC] mamaPlugin Feature

BZ-190 [MAMAC] Add ability to turn on/off entitlements on a per bridge basis

BZ-191 [MAMAC] mamaPublisherImpl_getTransportImpl() accessor

BZ-179 OpenMAMA mock RPM's fail to build

BZ-187 SCons: Include stdout for build commands using site scons logger

BZ-188 Scons: fixes for Windows and Linux

BZ-192 OpenMAMA RPM Release Scripts

 

 

Thanks,

Gary

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 


Re: OpenMAMA-2.3.3-rc1

Alireza Assadzadeh <Alireza.Assadzadeh@...>
 

Hi Gary,

 

Back in Jan/Feb we had OpenMAMA-2.3.2-rc1. As far as I know there was no official release of 2.3.2.

 

Now with 2.3.3-rc1 in May, do you know if there will still be a 2.3.2 release or is 2.3.2 superseded with 2.3.3?

 

Regards,

 

--Alireza

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Gary Molloy
Sent: Tuesday, May 05, 2015 10:31 AM
To: openmama-dev@...
Subject: [Openmama-dev] OpenMAMA-2.3.3-rc1

 

Hi Guys,

 

I have cut the new OpenMAMA-2.3.3 branch and created the OpenMAMA-2.3.3-rc1 tag, this is now available for testing.  I would anticipate a test period of around 2-3 weeks with a view to making the release official by the end of the month.

 

This release has been cut from the next branch.

 

The following list of issues/features have been added for this release:

 

BZ-166 Wombat: wInterlocked_set inconsistent return value

BZ-164 MAMAJNI: MamaPublisher: Overloaded MamaPublisher create method

BZ-169  Wombat queue has no separate deallocate method

BZ-176  Missing actions for snapshot subscriptions transition to deactivate state

BZ-168 Complete support for Vector Bool and Vector Char field types

BZ-156 No value expansion of last property line in mama.properties

BZ-178 Problem with mamaDictionary_getDictionaryMessage when multiple bridges are loaded

BZ-182 MAMAJAVA: Add java MamaDateTime::getAsFormattedString() method

BZ-181 MAMAJAVA: Java subscription setup fix - it loses the closure

BZ-183 SCons: OpenMAMA will not build on windows

BZ-189 [MAMAC] mamaPlugin Feature

BZ-190 [MAMAC] Add ability to turn on/off entitlements on a per bridge basis

BZ-191 [MAMAC] mamaPublisherImpl_getTransportImpl() accessor

BZ-179 OpenMAMA mock RPM's fail to build

BZ-187 SCons: Include stdout for build commands using site scons logger

BZ-188 Scons: fixes for Windows and Linux

BZ-192 OpenMAMA RPM Release Scripts

 

 

Thanks,

Gary

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 


Re: [PATCH 1/3] [MAMAC] mamaPlugin Feature - additional

Keith Rudd
 

Classification: Public

Thanks for forwarding the doc Gary.

 

I found the mamaPlugin details an interesting read.

 

One question:

-          What was the logic behind selection of the points where plug-in hooks can get called?

 

I was thinking of a case where you used this as a way of having a custom entitlements implementation.

In this sense, the hook at the point of mamaPublisher_send() makes sense because you could use that to implement publishing entitlements control, which is lacking in OpenMAMA.

 

However, there’s no hook at the point of mamaSubscription_create(), so you’d have to rely on the existing OpenMAMA hook (OEA Client interface) to check subscriber entitlements. It’s possible to do both of course but this leads to a rather in-elegant hybrid solution mixing the OEA client interface plus use of a custom hook library.

 

Probably better to be able to do one or the other entirely. (So extend OEAClient interface, or add plug in hook at ALL the points where entitlement checking might be relevant)

 

Were there some other particular use cases in mind that drove the selection of plugin hook points?

 

Regards,

Keith

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Gary Molloy
Sent: 01 May 2015 17:31
To: openmama-dev@...
Subject: Re: [Openmama-dev] [PATCH 1/3] [MAMAC] mamaPlugin Feature - additional

 

Hi Guys,

 

As promised, please find below a link to a document on the mamaPlugin feature:

https://docs.google.com/document/d/1HcV43uFJrV_pX0M0N7oDoZkWly0LjmyIxM9U-YpBtFQ/edit?usp=sharing

Thanks,

Gary

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 

From: Gary Molloy
Sent: 30 April 2015 10:58
To: openmama-dev@...
Subject: RE: [PATCH 1/3] [MAMAC] mamaPlugin Feature - additional

 

From 76a6db152998cbb32de58eb1cb9d6c1ab9307a1e Mon Sep 17 00:00:00 2001

From: Gary Molloy <g.molloy@...>

Date: Wed, 29 Apr 2015 13:05:23 -0400

Subject: [PATCH] [MAMAC] mamaPlugin Feature - addition

 

Addition to the existing mamaPlugin patch to remove references to internal shared objects and a missing null check.

 

Signed-off-by: Gary Molloy <g.molloy@...>

---

mama/c_cpp/src/c/plugin.c |   61 ++++++++++++++++++++------------------------

1 files changed, 28 insertions(+), 33 deletions(-)

 

diff --git a/mama/c_cpp/src/c/plugin.c b/mama/c_cpp/src/c/plugin.c

index b6475fe..303ab9f 100644

--- a/mama/c_cpp/src/c/plugin.c

+++ b/mama/c_cpp/src/c/plugin.c

@@ -216,9 +216,6 @@ mama_initPlugins(void)

         }

     }

 

-    mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising mamacenterprise");

-    mama_loadPlugin ("mamacenterprise");

-

     return MAMA_STATUS_OK;

}

 

@@ -243,15 +240,10 @@ mama_loadPlugin (const char* pluginName)

     if (pluginImpl == NULL)

     {

        /* The plugin name should be of the format mamaplugin<name> */

-        if (strncmp(pluginName, "mamacenterprise", MAX_PLUGIN_STRING) == 0)

-            snprintf(loadPluginName, MAX_PLUGIN_STRING,

-                "%s",

-                pluginName);

-        else

-            snprintf(loadPluginName, MAX_PLUGIN_STRING,

-                "%s%s",

-                PLUGIN_NAME,

-                pluginName);

+        snprintf(loadPluginName, MAX_PLUGIN_STRING,

+            "%s%s",

+            PLUGIN_NAME,

+            pluginName);

 

         pluginLib = openSharedLib (loadPluginName, NULL);

 

@@ -345,31 +337,34 @@ mama_shutdownPlugins (void)

 

     for (plugin = 0; plugin <= gPluginNo; plugin++)

     {

-        if (gPlugins[plugin]->mPluginHandle != NULL)

+        if (gPlugins[plugin] != NULL)

         {

-            /* Fire the user shutdown hook first - if one is present */

-            if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)

+            if (gPlugins[plugin]->mPluginHandle != NULL)

             {

-                gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);

-            }

+                /* Fire the user shutdown hook first - if one is present */

+                if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)

+                {

+                    gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);

+                }

 

-            ret = closeSharedLib (gPlugins[plugin]->mPluginHandle);

-            if (0!=ret)

-            {

-                 mama_log (MAMA_LOG_LEVEL_WARN,

-                            "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]",

-                            gPlugins[plugin]->mPluginName);

-            }

-            else

-            {

-                 mama_log (MAMA_LOG_LEVEL_WARN,

-                            "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed",

-                            gPlugins[plugin]->mPluginName);

-            }

+                ret = closeSharedLib (gPlugins[plugin]->mPluginHandle);

+                if (0!=ret)

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]",

+                                gPlugins[plugin]->mPluginName);

+                }

+                else

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed",

+                                gPlugins[plugin]->mPluginName);

+                }

 

-            free ((char*)gPlugins[plugin]->mPluginName);

-            free (gPlugins[plugin]);

-            gPlugins[plugin] = NULL;

+                free ((char*)gPlugins[plugin]->mPluginName);

+                free (gPlugins[plugin]);

+                gPlugins[plugin] = NULL;

+            }

         }

     }

     return status;

--

1.7.1

 

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Gary Molloy
Sent: 23 April 2015 17:54
To: openmama-dev@...
Subject: [Openmama-dev] [PATCH 1/3] [MAMAC] mamaPlugin Feature

 

Testing Strategy:-

Not middleware or O/S specific. 
 

Using the attached template you can create your own plugin and load it in via your mama.properties, for example:

 

mama.plugin.name_0=template

 

You can run up a mamaPublisher to test your plugin, for example:

 

mamapublisherc -tport pub -m wmw -l MAMA_INBOUND_TOPIC -v -v -v -v -v

 

You can expect to see output similar this if your plugin was loaded successfully:

 

2015-04-09 13:45:02: (f9018280) : mama_initPlugins(): Initialising [mama.plugin.name_0] template 

2015-04-09 13:45:02: (f9018280) : mama_loadPlugin(): Sucessfully registered plugin functions for [template] 

2015-04-09 13:45:02: (f9018280) : mama_loadPlugin(): Successfully run the init hook for mama plugin [template]  

 

If your plugin was not loaded successful you can expect to see output similar to this:

 

2015-04-09 13:45:02: (f9018280) : mama_initPlugins(): Initialising [mama.plugin.name_0] template 

2015-04-09 13:45:02: (f9018280) : mamaPlugin_registerFunctions(): Cannot load plugin, does not implement required function: [templateMamaPlugin_shutdownHook] 

2015-04-09 13:45:02: (f9018280) : mama_loadPlugin(): Failed to register plugin functions for [template] 

 

Further documentation on the mamaPlugin feature will be available shortly which will provide more details on the feature which will include the various hooks available etc...

 

 

=========================================================================================================

 

From e2a6a3f9c5750cee780cb6185a1310b4e4b70629 Mon Sep 17 00:00:00 2001

From: Gary Molloy <g.molloy@...>

Date: Thu, 23 Apr 2015 11:22:14 -0400

Subject: [PATCH 1/3] [MAMAC] mamaPlugin Feature

 

A new feature, mamaPlugin has been introduced that will allow you to

create and run your own code within 'hooks' into the MAMA codebase.

 

A mamaPlugin is essentially a shared object.

 

Signed-off-by: Gary Molloy <g.molloy@...>

---

mama/c_cpp/src/c/Makefile.am    |    1 +

mama/c_cpp/src/c/SConscript     |    1 +

mama/c_cpp/src/c/SConscript.win |    1 +

mama/c_cpp/src/c/mama.c         |   10 +-

mama/c_cpp/src/c/mama/types.h   |   10 +

mama/c_cpp/src/c/plugin.c       |  472 +++++++++++++++++++++++++++++++++++++++

mama/c_cpp/src/c/plugin.h       |   59 +++++

mama/c_cpp/src/c/publisher.c    |   10 +

mama/c_cpp/src/c/transport.c    |   21 ++-

9 files changed, 579 insertions(+), 6 deletions(-)

create mode 100644 mama/c_cpp/src/c/plugin.c

create mode 100644 mama/c_cpp/src/c/plugin.h

 

diff --git a/mama/c_cpp/src/c/Makefile.am b/mama/c_cpp/src/c/Makefile.am

index c831ce4..318c353 100644

--- a/mama/c_cpp/src/c/Makefile.am

+++ b/mama/c_cpp/src/c/Makefile.am

@@ -131,6 +131,7 @@ libmama_la_SOURCES = \

     mamaStrUtils.h \

     mamaStrUtils.c \

               marketdata.c \

+    plugin.c \

     middleware.c \

               msg.c \

               msgfield.c \

diff --git a/mama/c_cpp/src/c/SConscript b/mama/c_cpp/src/c/SConscript

index 4362f50..f47e18c 100644

--- a/mama/c_cpp/src/c/SConscript

+++ b/mama/c_cpp/src/c/SConscript

@@ -98,6 +98,7 @@ libmama_sources = \

     mama.c

     mamaStrUtils.c

               marketdata.c

+    plugin.c

     middleware.c

               msg.c

               msgfield.c

diff --git a/mama/c_cpp/src/c/SConscript.win b/mama/c_cpp/src/c/SConscript.win

index 77e3e18..9a6ff05 100644

--- a/mama/c_cpp/src/c/SConscript.win

+++ b/mama/c_cpp/src/c/SConscript.win

@@ -50,6 +50,7 @@ dqpublishermanager.c

inbox.c

msgtype.c

msgutils.c

+plugin.c

senderId.c

reservedfields.c

subscription.c

diff --git a/mama/c_cpp/src/c/mama.c b/mama/c_cpp/src/c/mama.c

index 33a0768..5e31856 100644

--- a/mama/c_cpp/src/c/mama.c

+++ b/mama/c_cpp/src/c/mama.c

@@ -35,6 +35,7 @@

#include <payloadbridge.h>

#include <property.h>

#include <platform.h>

+#include <plugin.h>

 

 #include "fileutils.h"

#include "reservedfieldsimpl.h"

@@ -42,7 +43,6 @@

#include <mama/stat.h>

#include <mama/statfields.h>

#include <statsgeneratorinternal.h>

-#include <statsgeneratorinternal.h>

#include <mama/statscollector.h>

#include "transportimpl.h"

 

@@ -740,6 +740,9 @@ mama_openWithPropertiesCount (const char* path,

                               }

     }

 

+    /* This will initialise all plugins */

+    mama_initPlugins();

+

     prop = properties_Get (gProperties, "mama.catchcallbackexceptions.enable");

     if (prop != NULL && strtobool(prop))

     {

@@ -1253,9 +1256,12 @@ mama_closeCount (unsigned int* count)

                 gImpl.myPayloadLibraries[(uint8_t)payload] = NULL;

             }

         }

-       

+

        gDefaultPayload = NULL;

 

+       /* This will shutdown all plugins */

+       mama_shutdownPlugins();

+

         /* Look for a bridge for each of the middlewares and close them */

         for (middleware = 0; middleware != MAMA_MIDDLEWARE_MAX; ++middleware)

         {

diff --git a/mama/c_cpp/src/c/mama/types.h b/mama/c_cpp/src/c/mama/types.h

index 50d6608..03f6da8 100644

--- a/mama/c_cpp/src/c/mama/types.h

+++ b/mama/c_cpp/src/c/mama/types.h

@@ -74,6 +74,16 @@ typedef struct mamaBridgeImpl_* mamaBridge;

typedef struct mamaPayloadBridgeImpl_* mamaPayloadBridge;

 

 /**

+ * @brief Container for holding a mama plugin object

+ */

+typedef struct mamaPluginImpl_*     mamaPlugin;

+

+/**

+ * @brief Container for holding a mama plugin info

+ */

+typedef void*       mamaPluginInfo;

+

+/**

  * Flexible date/time format

  */

typedef   mama_u64_t*   mamaDateTime;

diff --git a/mama/c_cpp/src/c/plugin.c b/mama/c_cpp/src/c/plugin.c

new file mode 100644

index 0000000..b6475fe

--- /dev/null

+++ b/mama/c_cpp/src/c/plugin.c

@@ -0,0 +1,472 @@

+/* $Id$

+ *

+ * OpenMAMA: The open middleware agnostic messaging API

+ * Copyright (C) 2011 NYSE Technologies, Inc.

+ *

+ * This library is free software; you can redistribute it and/or

+ * modify it under the terms of the GNU Lesser General Public

+ * License as published by the Free Software Foundation; either

+ * version 2.1 of the License, or (at your option) any later version.

+ *

+ * This library is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

+ * Lesser General Public License for more details.

+ *

+ * You should have received a copy of the GNU Lesser General Public

+ * License along with this library; if not, write to the Free Software

+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA

+ * 02110-1301 USA

+ */

+

+#include <string.h>

+#include <stdio.h>

+#include <limits.h>

+

+#include "wombat/port.h"

+#include "wombat/environment.h"

+#include "wombat/strutils.h"

+#include <wombat/wtable.h>

+

+#include <mama/mama.h>

+#include <mama/error.h>

+#include <mamainternal.h>

+#include <mama/version.h>

+#include <property.h>

+#include <plugin.h>

+#include <platform.h>

+

+#define PLUGIN_PROPERTY "mama.plugin.name_"

+#define PLUGIN_NAME "mamaplugin"

+

+#define MAX_PLUGINS 100

+#define MAX_PLUGIN_STRING 1024

+

+#define MAX_FUNC_STRING 256

+

+/**

+ * @brief Mechanism for registering required plugin functions.

+ *

+ * Taking a function string name search the shared library handle, using the

+ * loadLibFunc portability method, for the function. If it is found, set the

+ * appropriate function pointer in the plugin struct to the result. If not,

+ * log as an error the fact that the funciton cannot be found, and return

+ * MAMA_STATUS_PLATFORM

+ *

+ * @param FUNCSTRINGNAME The string function name.

+ * @param FUNCIMPLNAME The name of the function pointer in the plugin struct

+ * @param FUNCIMPLTYPE The type of the function pointer expected.

+ */

+#define REGISTER_PLUGIN_FUNCTION(FUNCSTRINGNAME, FUNCIMPLNAME, FUNCIMPLTYPE)    \

+do {                                                                            \

+    snprintf (functionName, MAX_FUNC_STRING, "%s"#FUNCSTRINGNAME, name);        \

+    result = loadLibFunc (pluginLib, functionName);                             \

+                                                                                \

+    if (NULL != result) {                                                       \

+        (pluginImpl)->FUNCIMPLNAME = *(FUNCIMPLTYPE*)&result;                   \

+        result = NULL;                                                          \

+    } else {                                                                    \

+        mama_log (MAMA_LOG_LEVEL_ERROR,                                         \

+                  "mamaPlugin_registerFunctions(): "                            \

+                  "Cannot load plugin, does not implement required function: [%s]",\

+                  functionName);                                                \

+        status = MAMA_STATUS_PLATFORM;                                          \

+        return status;                                                          \

+    }                                                                           \

+} while (0)

+

+/**

+ * @brief Mechanism for registering required plugin functions.

+ *

+ * Taking a function string name search the shared library handle, using the

+ * loadLibFunc portability method, for the function. If it is found, set the

+ * appropriate function pointer in the plugin struct to the result. If not

+ * log the fact that the function has not been found, and continue.

+ *

+ * @param FUNCSTRINGNAME The string function name.

+ * @param FUNCIMPLNAME The name of the function pointer in the plugin struct

+ * @param FUNCIMPLTYPE The type of the function pointer expected.

+ */

+#define REGISTER_OPTIONAL_PLUGIN_FUNCTION(FUNCSTRINGNAME,                       \

+                                          FUNCIMPLNAME,                         \

+                                          FUNCIMPLTYPE)                         \

+do {                                                                            \

+    snprintf (functionName, MAX_FUNC_STRING, "%s"#FUNCSTRINGNAME, name);        \

+    result = loadLibFunc (pluginLib, functionName);                             \

+                                                                                \

+    if (NULL != result) {                                                       \

+        (pluginImpl)->FUNCIMPLNAME = *(FUNCIMPLTYPE*)&result;                   \

+        result = NULL;                                                          \

+    } else {                                                                    \

+        mama_log (MAMA_LOG_LEVEL_FINE,                                          \

+                  "mamaPlugin_registerFunctions(): "                            \

+                  "Optional plugin function [%s] not found. Unavailable.",      \

+                  functionName);                                                \

+    }                                                                           \

+} while (0)

+

+typedef struct mamaPluginImpl_

+{

+    LIB_HANDLE          mPluginHandle;

+    char*               mPluginName;

+    mamaPluginInfo      mPluginInfo;

+

+    mamaPlugin_publisherPreSendHook     mamaPluginPublisherPreSendHook;

+    mamaPlugin_transportPostCreateHook  mamaPluginTransportPostCreateHook;

+    mamaPlugin_shutdownHook             mamaPluginShutdownHook;

+    mamaPlugin_initHook                 mamaPluginInitHook;

+

+} mamaPluginImpl;

+

+static mamaPluginImpl*      gPlugins[MAX_PLUGINS];

+static volatile int         gPluginNo = 0;

+

+/**

+ * @brief Used to load register all possible plugin functions to be

+ *        used within Mama.

+ *

+ * param[in] pluginLib

+ * param[in] name

+ * param[in] pluginImpl The plugin impl to be used

+ *

+ * @return mama_status return code can be one of:

+ *          MAMA_STATUS_OK

+ */

+mama_status

+mamaPlugin_registerFunctions   (LIB_HANDLE      pluginLib,

+                                const char*     name,

+                                mamaPluginInfo  pluginInfo,

+                                mamaPluginImpl* pluginImpl);

+

+/**

+ * @brief Used find a plugin using the library name

+ *

+ * param[in] name

+ *

+ * @return a valid mamaPluginImpl if found

+ */

+mamaPluginImpl*

+mamaPlugin_findPlugin (const char* name);

+

+/**

+ * @brief Used find a plugin using the library name

+ *

+ * param[in] pluginName

+ *

+ * @return mama_status return code can be one of:

+ *          MAMA_STATUS_OK

+ */

+mama_status

+mama_loadPlugin (const char* pluginName);

+

+

+/**

+ * Register function pointers associated with a specific plugin.

+ */

+mama_status

+mamaPlugin_registerFunctions (LIB_HANDLE      pluginLib,

+                              const char*     name,

+                              mamaPluginInfo  pluginInfo,

+                              mamaPluginImpl* pluginImpl)

+{

+    mama_status  status        = MAMA_STATUS_OK;

+    void*        result        = NULL;

+    char         functionName[MAX_FUNC_STRING];

+

+    /* Save off some informatin on the plugin */

+    pluginImpl->mPluginHandle = pluginLib;

+    pluginImpl->mPluginName = strdup(name);

+    pluginImpl->mPluginInfo = pluginInfo;

+

+

+    /* Required fuctions */

+    REGISTER_PLUGIN_FUNCTION (MamaPlugin_initHook, mamaPluginInitHook,

+                              mamaPlugin_initHook);

+    REGISTER_PLUGIN_FUNCTION (MamaPlugin_shutdownHook, mamaPluginShutdownHook,

+                              mamaPlugin_shutdownHook);

+

+

+    /* Optional fuctions */

+    REGISTER_OPTIONAL_PLUGIN_FUNCTION (MamaPlugin_publisherPreSendHook, mamaPluginPublisherPreSendHook,

+                                       mamaPlugin_publisherPreSendHook);

+    REGISTER_OPTIONAL_PLUGIN_FUNCTION (MamaPlugin_transportPostCreateHook, mamaPluginTransportPostCreateHook,

+                                       mamaPlugin_transportPostCreateHook);

+

+   return status;

+}

+

+mama_status

+mama_initPlugins(void)

+{

+    int             pluginCount      = 0;

+    const char*     prop             = NULL;

+    char            propString[MAX_PLUGIN_STRING];

+

+    for (pluginCount = 0; pluginCount < MAX_PLUGINS; pluginCount++)

+    {

+        snprintf(propString, MAX_PLUGIN_STRING,

+            PLUGIN_PROPERTY"%d",

+            pluginCount);

+

+        prop = properties_Get (mamaInternal_getProperties (), propString);

+        if (prop != NULL && strlen(prop)!= 0)

+        {

+            mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising [%s] %s", propString, prop);

+            mama_loadPlugin (prop);

+        }

+    }

+

+    mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising mamacenterprise");

+    mama_loadPlugin ("mamacenterprise");

+

+    return MAMA_STATUS_OK;

+}

+

+mama_status

+mama_loadPlugin (const char* pluginName)

+{

+    LIB_HANDLE              pluginLib       = NULL;

+    mamaPluginImpl*         pluginImpl      = NULL;

+    mama_status             status          = MAMA_STATUS_OK;

+    mamaPluginInfo          pluginInfo      = NULL;

+    char                    loadPluginName  [MAX_PLUGIN_STRING];

+    mamaPluginImpl*         aPluginImpl     = NULL;

+

+    if (!pluginName)

+        return MAMA_STATUS_NULL_ARG;

+

+    pluginImpl = mamaPlugin_findPlugin(pluginName);

+

+    /*

+     * Check to see if pluginImpl has already been loaded

+     */

+    if (pluginImpl == NULL)

+    {

+       /* The plugin name should be of the format mamaplugin<name> */

+        if (strncmp(pluginName, "mamacenterprise", MAX_PLUGIN_STRING) == 0)

+            snprintf(loadPluginName, MAX_PLUGIN_STRING,

+                "%s",

+                pluginName);

+        else

+            snprintf(loadPluginName, MAX_PLUGIN_STRING,

+                "%s%s",

+                PLUGIN_NAME,

+                pluginName);

+

+        pluginLib = openSharedLib (loadPluginName, NULL);

+

+        if (!pluginLib)

+        {

+

+           mama_log (MAMA_LOG_LEVEL_ERROR,

+                    "mama_loadPlugin(): "

+                    "Could not open plugin library [%s] [%s]",

+                    pluginName,

+                    getLibError());

+            return MAMA_STATUS_PLATFORM;

+        }

+

+        /* Create structure to hold plugin information */

+        aPluginImpl = (mamaPluginImpl*)calloc (1, sizeof(mamaPluginImpl));

+

+        status = mamaPlugin_registerFunctions (pluginLib,

+                                               pluginName,

+                                               pluginInfo,

+                                               aPluginImpl);

+

+        if (MAMA_STATUS_OK == status)

+        {

+            mama_log (MAMA_LOG_LEVEL_NORMAL,

+                     "mama_loadPlugin(): "

+                     "Sucessfully registered plugin functions for [%s]",

+                     pluginName);

+

+        }

+        else

+        {

+            mama_log (MAMA_LOG_LEVEL_WARN,

+                     "mama_loadPlugin(): "

+                     "Failed to register plugin functions for [%s]",

+                     pluginName);

+

+            closeSharedLib (aPluginImpl->mPluginHandle);

+

+            free ((char*)aPluginImpl->mPluginName);

+            free ((mamaPluginImpl*)aPluginImpl);

+

+            return status;

+        }

+

+        /* Invoke the init function */

+        status = aPluginImpl->mamaPluginInitHook (aPluginImpl->mPluginInfo);

+

+        if (MAMA_STATUS_OK == status)

+        {

+            mama_log (MAMA_LOG_LEVEL_NORMAL,

+                      "mama_loadPlugin(): Successfully run the init hook for mama plugin [%s]",

+                       aPluginImpl->mPluginName);

+        }

+        else

+        {

+            mama_log (MAMA_LOG_LEVEL_WARN,

+                      "mama_loadPlugin(): Init hook failed for mama plugin [%s]",

+                       aPluginImpl->mPluginName);

+

+            closeSharedLib (aPluginImpl->mPluginHandle);

+

+            free ((char*)aPluginImpl->mPluginName);

+            free ((mamaPluginImpl*)aPluginImpl);

+

+            return status;

+        }

+

+        /* Save off the plugin impl and increment the plugin counter */

+        gPlugins[gPluginNo] = aPluginImpl;

+        gPluginNo++;

+

+    }

+    else

+    {

+        mama_log (MAMA_LOG_LEVEL_NORMAL,

+                 "mama_loadPlugin(): "

+                 "Plugin [%s] has already been loaded and initialised",

+                 pluginName);

+    }

+

+    return MAMA_STATUS_OK;

+}

+

+mama_status

+mama_shutdownPlugins (void)

+{

+    mama_status  status = MAMA_STATUS_OK;

+    int          plugin = 0;

+    int          ret    = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin]->mPluginHandle != NULL)

+        {

+            /* Fire the user shutdown hook first - if one is present */

+            if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)

+            {

+                gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);

+            }

+

+            ret = closeSharedLib (gPlugins[plugin]->mPluginHandle);

+            if (0!=ret)

+            {

+                 mama_log (MAMA_LOG_LEVEL_WARN,

+                            "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]",

+                            gPlugins[plugin]->mPluginName);

+            }

+            else

+            {

+                 mama_log (MAMA_LOG_LEVEL_WARN,

+                            "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed",

+                            gPlugins[plugin]->mPluginName);

+            }

+

+            free ((char*)gPlugins[plugin]->mPluginName);

+            free (gPlugins[plugin]);

+            gPlugins[plugin] = NULL;

+        }

+    }

+    return status;

+}

+

+mama_status

+mamaPlugin_firePublisherPreSendHook (mamaPublisher publisher, mamaMsg message)

+{

+    mama_status  status = MAMA_STATUS_OK;

+    int          plugin = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin] != NULL)

+        {

+            if (gPlugins[plugin]->mamaPluginPublisherPreSendHook != NULL)

+            {

+                status = gPlugins[plugin]->mamaPluginPublisherPreSendHook (gPlugins[plugin]->mPluginInfo, publisher, message);

+

+                if (MAMA_STATUS_OK != status)

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mamaPlugin_firePublisherPreSendHook(): Publisher pre send hook failed for mama plugin [%s]",

+                                gPlugins[plugin]->mPluginName);

+                }

+            }

+        }

+    }

+    return status;

+}

+

+mama_status

+mamaPlugin_fireTransportPostCreateHook (mamaTransport transport)

+{

+    mama_status  status = MAMA_STATUS_OK;

+    int          plugin = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin] != NULL)

+        {

+            if (gPlugins[plugin]->mamaPluginTransportPostCreateHook != NULL)

+            {

+                status = gPlugins[plugin]->mamaPluginTransportPostCreateHook (gPlugins[plugin]->mPluginInfo, transport);

+

+                if (MAMA_STATUS_OK != status)

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mamaPlugin_fireTransportPostCreateHook(): Transport post create hook failed for mama plugin [%s]",

+                                gPlugins[plugin]->mPluginName);

+                }

+            }

+        }

+    }

+    return status;

+}

+

+mama_status

+mamaPlugin_fireShutdownHook (void)

+{

+    mama_status  status = MAMA_STATUS_OK;

+    int          plugin = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin] != NULL)

+        {

+            if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)

+            {

+                status = gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);

+

+                if (MAMA_STATUS_OK != status)

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mamaPlugin_fireShutdownHook(): Shutdown hook failed for mama plugin [%s]",

+                                gPlugins[plugin]->mPluginName);

+                }

+            }

+        }

+    }

+    return status;

+}

+

+mamaPluginImpl*

+mamaPlugin_findPlugin (const char* name)

+{

+    int plugin = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin])

+        {

+            if ((strncmp(gPlugins[plugin]->mPluginName, name, MAX_PLUGIN_STRING) == 0))

+            {

+                return gPlugins[plugin];

+            }

+        }

+    }

+    return NULL;

+}

diff --git a/mama/c_cpp/src/c/plugin.h b/mama/c_cpp/src/c/plugin.h

new file mode 100644

index 0000000..df43b27

--- /dev/null

+++ b/mama/c_cpp/src/c/plugin.h

@@ -0,0 +1,59 @@

+/* $Id$

+ *

+ * OpenMAMA: The open middleware agnostic messaging API

+ * Copyright (C) 2011 NYSE Technologies, Inc.

+ *

+ * This library is free software; you can redistribute it and/or

+ * modify it under the terms of the GNU Lesser General Public

+ * License as published by the Free Software Foundation; either

+ * version 2.1 of the License, or (at your option) any later version.

+ *

+ * This library is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

+ * Lesser General Public License for more details.

+ *

+ * You should have received a copy of the GNU Lesser General Public

+ * License along with this library; if not, write to the Free Software

+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA

+ * 02110-1301 USA

+ */

+

+#ifndef PluginH__

+#define PluginH__

+

+

+/**

+ * @brief Containers used within the mama plugin

+ */

+typedef mama_status (*mamaPlugin_publisherPreSendHook) (mamaPluginInfo pluginInfo, mamaPublisher publisher, mamaMsg message);

+typedef mama_status (*mamaPlugin_transportPostCreateHook) (mamaPluginInfo pluginInfo, mamaTransport transport);

+typedef mama_status (*mamaPlugin_shutdownHook) (mamaPluginInfo pluginInfo);

+typedef mama_status (*mamaPlugin_initHook) (mamaPluginInfo* pluginInfo);

+

+/**

+ * Initialize the internal plugin interface

+ *

+ * @return mama status code

+ */

+extern mama_status

+mama_initPlugins (void);

+

+/**

+ * Shutdown the internal plugin interface

+ *

+ * @return mama status code

+ */

+extern mama_status

+mama_shutdownPlugins (void);

+

+extern mama_status

+mamaPlugin_firePublisherPreSendHook (mamaPublisher publisher, mamaMsg message);

+

+extern mama_status

+mamaPlugin_fireTransportPostCreateHook (mamaTransport transport);

+

+extern mama_status

+mamaPlugin_fireShutdownHook (void);

+

+#endif /* PluginH__ */

diff --git a/mama/c_cpp/src/c/publisher.c b/mama/c_cpp/src/c/publisher.c

index 4612d17..6a7f92d 100644

--- a/mama/c_cpp/src/c/publisher.c

+++ b/mama/c_cpp/src/c/publisher.c

@@ -23,6 +23,7 @@

#include "mama/publisher.h"

 

 #include "bridge.h"

+#include "plugin.h"

#include "throttle.h"

#include "transportimpl.h"

 

@@ -245,6 +246,15 @@ mamaPublisher_send (mamaPublisher publisher,

     if (!impl->mMamaPublisherBridgeImpl) return MAMA_STATUS_INVALID_ARG;

     if (!impl->mBridgeImpl) return MAMA_STATUS_NO_BRIDGE_IMPL;

 

+    /* Calling plugin hook */

+    status = mamaPlugin_firePublisherPreSendHook (publisher, msg);

+    if (MAMA_STATUS_OK != status)

+    {

+        mama_log (MAMA_LOG_LEVEL_ERROR,

+                  "mamaPublisher_send(): PublisherPreSendHook failed. Not sending message.");

+        return status;

+    }

+

     status = impl->mBridgeImpl->bridgeMamaPublisherSend

         (impl->mMamaPublisherBridgeImpl,

          msg);

diff --git a/mama/c_cpp/src/c/transport.c b/mama/c_cpp/src/c/transport.c

index 339dbc0..622f47d 100644

--- a/mama/c_cpp/src/c/transport.c

+++ b/mama/c_cpp/src/c/transport.c

@@ -25,6 +25,7 @@

 

 #include "mama/mama.h"

#include "throttle.h"

+#include "plugin.h"

#include "list.h"

#include "transportimpl.h"

#include "bridge.h"

@@ -876,10 +877,22 @@ mamaTransport_create (mamaTransport transport,

 

     if ((!self->mDisableRefresh) && (!mamaTransportInternal_disableRefreshes(name)))

     {

-        return refreshTransport_create (&self->mRefreshTransport,

-                                    (mamaTransport)self,

-                                    self->mListeners,

-                                    self->mBridgeImpl);

+        status = refreshTransport_create (&self->mRefreshTransport,

+                                          (mamaTransport)self,

+                                          self->mListeners,

+                                          self->mBridgeImpl);

+

+        if (MAMA_STATUS_OK != status)

+            return status;

+    }

+

+    /* Calling plugin hook*/

+    status = mamaPlugin_fireTransportPostCreateHook (transport);

+    if (MAMA_STATUS_OK != status)

+    {

+        mama_log (MAMA_LOG_LEVEL_ERROR,

+                  "mamaTransport_create(): TransportPostCreateHook failed with a status of %s",

+                   mamaStatus_stringForStatus(status));

     }

 

     return MAMA_STATUS_OK;

--

1.7.1

 

 

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 



---
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures and to http://www.db.com/unitedkingdom/content/privacy.htm for information about privacy.


OpenMAMA-2.3.3-rc1

Gary Molloy <g.molloy@...>
 

Hi Guys,

 

I have cut the new OpenMAMA-2.3.3 branch and created the OpenMAMA-2.3.3-rc1 tag, this is now available for testing.  I would anticipate a test period of around 2-3 weeks with a view to making the release official by the end of the month.

 

This release has been cut from the next branch.

 

The following list of issues/features have been added for this release:

 

BZ-166 Wombat: wInterlocked_set inconsistent return value

BZ-164 MAMAJNI: MamaPublisher: Overloaded MamaPublisher create method

BZ-169  Wombat queue has no separate deallocate method

BZ-176  Missing actions for snapshot subscriptions transition to deactivate state

BZ-168 Complete support for Vector Bool and Vector Char field types

BZ-156 No value expansion of last property line in mama.properties

BZ-178 Problem with mamaDictionary_getDictionaryMessage when multiple bridges are loaded

BZ-182 MAMAJAVA: Add java MamaDateTime::getAsFormattedString() method

BZ-181 MAMAJAVA: Java subscription setup fix - it loses the closure

BZ-183 SCons: OpenMAMA will not build on windows

BZ-189 [MAMAC] mamaPlugin Feature

BZ-190 [MAMAC] Add ability to turn on/off entitlements on a per bridge basis

BZ-191 [MAMAC] mamaPublisherImpl_getTransportImpl() accessor

BZ-179 OpenMAMA mock RPM's fail to build

BZ-187 SCons: Include stdout for build commands using site scons logger

BZ-188 Scons: fixes for Windows and Linux

BZ-192 OpenMAMA RPM Release Scripts

 

 

Thanks,

Gary

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 


Re: [PATCH 2/3] [MAMAC] Add ability to turn on/off entitlements on a per bridge basis - additional

Gary Molloy <g.molloy@...>
 

Hi Guys,

 

As promised, please find below a link to a document on the deferring entitlements feature:

https://docs.google.com/document/d/1HcV43uFJrV_pX0M0N7oDoZkWly0LjmyIxM9U-YpBtFQ/edit?usp=sharing

Thanks,

Gary

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 

From: Gary Molloy
Sent: 30 April 2015 18:01
To: openmama-dev@...
Subject: RE: [Openmama-dev] [PATCH 2/3] [MAMAC] Add ability to turn on/off entitlements on a per bridge basis - additional

 

 

From 5300628690cdbeb41dd2dc355e3469afc20caae3 Mon Sep 17 00:00:00 2001

From: A.Ambrose <a.ambrose@...>

Date: Thu, 30 Apr 2015 12:59:09 -0400

Subject: [PATCH 2/2] [MAMAC] Add ability to turn on/off entitlements on a per bridge basis - additional

 

Signed-off-by: A.Ambrose <a.ambrose@...>

---

mama/c_cpp/src/c/bridge.c             |    5 ++---

mama/c_cpp/src/c/bridge.h             |    2 +-

mama/c_cpp/src/c/bridge/qpid/bridge.c |    2 +-

3 files changed, 4 insertions(+), 5 deletions(-)

 

diff --git a/mama/c_cpp/src/c/bridge.c b/mama/c_cpp/src/c/bridge.c

index dd42a55..d7325af 100644

--- a/mama/c_cpp/src/c/bridge.c

+++ b/mama/c_cpp/src/c/bridge.c

@@ -149,7 +149,7 @@ mamaBridgeImpl_stopInternalEventQueue (mamaBridge bridgeImpl)

}

 

 mama_status

-mamaBridgeImpl_setReadOnlyProperty (mamaBridge bridgeImpl, const char* property, const char* value, mama_bool_t readOnly)

+mamaBridgeImpl_setReadOnlyProperty (mamaBridge bridgeImpl, const char* property, const char* value)

{

     mamaBridgeImpl_setProperty(bridgeImpl, property, value);

     bridgeImpl->mEntitleReadOnly = 1;

@@ -160,12 +160,11 @@ mama_status

mamaBridgeImpl_setProperty (mamaBridge bridgeImpl, const char* property, const char* value)

{

     char propString[MAX_PROP_STRING];

-    int retVal;

 

     mamaBridgeImpl* impl = (mamaBridgeImpl*)bridgeImpl;

 

     /* Check for mama.middleware.entitlements_deferred first */

-    retVal = snprintf(propString, MAX_PROP_STRING,

+    snprintf(propString, MAX_PROP_STRING,

         "mama.%s.%s",

         impl->bridgeGetName(),

         PROP_NAME_ENTITLEMENTS_DEFERRED);

diff --git a/mama/c_cpp/src/c/bridge.h b/mama/c_cpp/src/c/bridge.h

index 9bcd204..7a66d97 100644

--- a/mama/c_cpp/src/c/bridge.h

+++ b/mama/c_cpp/src/c/bridge.h

@@ -879,7 +879,7 @@ mamaBridgeImpl_stopInternalEventQueue (mamaBridge bridgeImpl);

 

 MAMAExpDLL

extern mama_status

-mamaBridgeImpl_setReadOnlyProperty (mamaBridge bridgeImpl, const char* property, const char* value, mama_bool_t readOnly);

+mamaBridgeImpl_setReadOnlyProperty (mamaBridge bridgeImpl, const char* property, const char* value);

 

 MAMAExpDLL

extern mama_status

diff --git a/mama/c_cpp/src/c/bridge/qpid/bridge.c b/mama/c_cpp/src/c/bridge/qpid/bridge.c

index 233c8ec..4955bca 100644

--- a/mama/c_cpp/src/c/bridge/qpid/bridge.c

+++ b/mama/c_cpp/src/c/bridge/qpid/bridge.c

@@ -86,7 +86,7 @@ void qpidBridge_createImpl (mamaBridge* result)

     /* Return the newly created bridge */

     *result = (mamaBridge) bridge;

 

-    mamaBridgeImpl_setReadOnlyProperty ((mamaBridge)bridge, "mama.qpid.entitlements.deferred", "false", 1);

+    mamaBridgeImpl_setReadOnlyProperty ((mamaBridge)bridge, "mama.qpid.entitlements.deferred", "false");

}

 

 mama_status

--

1.7.1

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Gary Molloy
Sent: 23 April 2015 17:54
To: openmama-dev@...
Subject: [Openmama-dev] [PATCH 2/3] [MAMAC] Add ability to turn on/off entitlements on a per bridge basis

 

Testing Strategy:-

Not middleware or O/S specific. 

This will require an entitled build and an entitlement server.

 

There are 4 tests that you can run using a standard mamalistenc. 

For each test you will have to add/modify the following within your middleware bridge code (when you create your bridge):

 

1) mamaBridgeImpl_setReadOnlyProperty ((mamaBridge)impl, "mama.<middleware>.entitlements.deferred", "true", 1);
- Deferred true, will run will addition entitlement logging.


2) mamaBridgeImpl_setReadOnlyProperty ((mamaBridge)impl, "mama.<middleware>.entitlements.deferred", "false", 1); <------default now in <middleware> bridge (This will be the standard setting)
- Deferred false, will connect to the normal entitlement server.


3) mamaBridgeImpl_setReadOnlyProperty ((mamaBridge)impl, "mama.TEST.entitlements.deferred", "true", 1); <---- Invalid property string (will not matter if deferred or not, will log error at very top & fail to connect to entitlements)
- This will fail whether set to deferred or not, logging seen at top is will look like this:-

mamaBridgeImpl_setProperty(): Unknown property string [mama.TEST.entitlements.deferred] entered.

 

4) mamaBridgeImpl_setReadOnlyProperty ((mamaBridge)impl, "mama.<middleware>.entitlements.deferred", "true", 1);
      mamaBridgeImpl_setReadOnlyProperty ((mamaBridge)impl, "mama.<middleware>.entitlements.deferred", "false", 1); <-----property called twice (true/false, or false/true).


With false/true -
Should follow the standard logic of it not being deferred - logging at top will read
“mamaBridgeImpl_setProperty(): Bridge property is read only, property can not be set. “
But this should connect to the normal entitlement server.

With true/false -
Should follow the standard logic if deferred is true - logging at top will look like this:
“mamaBridgeImpl_setProperty(): Bridge property is read only, property can not be set. “

But will continue.

 

Further documentation on the this feature will be available shortly which will provide more details on the feature which will include the various logging you can expect etc...

 

 

=========================================================================================================

 

From d016afce1b1cc4ffb6d65c1d032ddea41d56b62e Mon Sep 17 00:00:00 2001

From: Gary Molloy <g.molloy@...>

Date: Tue, 21 Apr 2015 09:56:52 -0400

Subject: [PATCH 2/3] [MAMAC] Add ability to turn on/off entitlements on a per bridge basis

 

Signed-off-by: Gary Molloy <g.molloy@...>

---

mama/c_cpp/src/c/bridge.c              |   67 ++++++++++++++++++++++++++++++++

mama/c_cpp/src/c/bridge.h              |   20 +++++++++

mama/c_cpp/src/c/bridge/qpid/bridge.c  |    2 +

mama/c_cpp/src/c/listenermsgcallback.c |   15 ++++++-

mama/c_cpp/src/c/mama.c                |   26 ++++++++++++

mama/c_cpp/src/c/subscription.c        |   38 ++++++++++++++----

6 files changed, 157 insertions(+), 11 deletions(-)

 

diff --git a/mama/c_cpp/src/c/bridge.c b/mama/c_cpp/src/c/bridge.c

index 01cbcc5..dd42a55 100644

--- a/mama/c_cpp/src/c/bridge.c

+++ b/mama/c_cpp/src/c/bridge.c

@@ -20,8 +20,12 @@

  */

 

 #include <mama/mama.h>

+#include <wombat/strutils.h>

#include "bridge.h"

 

+#define MAX_PROP_STRING                   1000

+#define PROP_NAME_ENTITLEMENTS_DEFERRED   "entitlements.deferred"

+

int mamaBridgeImpl_getDefaultQueueTimeout(void)

{

     /* Returns. */

@@ -143,3 +147,66 @@ mamaBridgeImpl_stopInternalEventQueue (mamaBridge bridgeImpl)

    

     return MAMA_STATUS_OK;

}

+

+mama_status

+mamaBridgeImpl_setReadOnlyProperty (mamaBridge bridgeImpl, const char* property, const char* value, mama_bool_t readOnly)

+{

+    mamaBridgeImpl_setProperty(bridgeImpl, property, value);

+    bridgeImpl->mEntitleReadOnly = 1;

+    return MAMA_STATUS_OK;

+}

+

+mama_status

+mamaBridgeImpl_setProperty (mamaBridge bridgeImpl, const char* property, const char* value)

+{

+    char propString[MAX_PROP_STRING];

+    int retVal;

+

+    mamaBridgeImpl* impl = (mamaBridgeImpl*)bridgeImpl;

+

+    /* Check for mama.middleware.entitlements_deferred first */

+    retVal = snprintf(propString, MAX_PROP_STRING,

+        "mama.%s.%s",

+        impl->bridgeGetName(),

+        PROP_NAME_ENTITLEMENTS_DEFERRED);

+

+    if(0 == strcmp(property, propString))

+    {

+        if (1 == bridgeImpl->mEntitleReadOnly)

+        {

+            mama_log (MAMA_LOG_LEVEL_WARN, "mamaBridgeImpl_setProperty(): "

+                      "Bridge is read only, property can not be set.");

+            return MAMA_STATUS_INVALID_ARG;

+        }

+        else

+        {

+            if (strtobool(value))

+                bridgeImpl->mEntitleDeferred = 1;

+            else

+                bridgeImpl->mEntitleDeferred = 0;

+        }

+    }

+    else

+    {

+        mama_log (MAMA_LOG_LEVEL_WARN, "mamaBridgeImpl_setProperty(): "

+            "Unknown property string [%s] entered.", property);

+        return MAMA_STATUS_INVALID_ARG;

+    }

+    return MAMA_STATUS_OK;

+}

+

+const char*

+mamaBridgeImpl_getProperty (mamaBridge bridgeImpl, const char* property)

+{

+    return NULL;

+}

+

+mama_bool_t

+mamaBridgeImpl_areEntitlementsDeferred (mamaBridge bridgeImpl)

+{

+    if (bridgeImpl)

+    {

+        return bridgeImpl->mEntitleDeferred;

+    }

+    return 0;

+}

diff --git a/mama/c_cpp/src/c/bridge.h b/mama/c_cpp/src/c/bridge.h

index c079819..9bcd204 100644

--- a/mama/c_cpp/src/c/bridge.h

+++ b/mama/c_cpp/src/c/bridge.h

@@ -715,6 +715,10 @@ typedef struct mamaBridgeImpl_

        used when getting the default queue */

     void*     mCppCallback;

 

+    /*Used in bridge.c*/

+    mama_bool_t  mEntitleDeferred;

+    mama_bool_t  mEntitleReadOnly;

+

     /*Used in mama.c*/

     bridge_open                                                 bridgeOpen;

     bridge_close                                                 bridgeClose;

@@ -873,6 +877,22 @@ MAMAExpDLL

mama_status

mamaBridgeImpl_stopInternalEventQueue (mamaBridge bridgeImpl);

 

+MAMAExpDLL

+extern mama_status

+mamaBridgeImpl_setReadOnlyProperty (mamaBridge bridgeImpl, const char* property, const char* value, mama_bool_t readOnly);

+

+MAMAExpDLL

+extern mama_status

+mamaBridgeImpl_setProperty (mamaBridge bridgeImpl, const char* property, const char* value);

+

+MAMAExpDLL

+extern const char*

+mamaBridgeImpl_getProperty (mamaBridge bridgeImpl, const char* property);

+

+MAMAExpDLL

+extern mama_bool_t

+mamaBridgeImpl_areEntitlementsDeferred (mamaBridge bridgeImpl);

+

#if defined(__cplusplus)

}

#endif

diff --git a/mama/c_cpp/src/c/bridge/qpid/bridge.c b/mama/c_cpp/src/c/bridge/qpid/bridge.c

index 4ab74c7..233c8ec 100644

--- a/mama/c_cpp/src/c/bridge/qpid/bridge.c

+++ b/mama/c_cpp/src/c/bridge/qpid/bridge.c

@@ -85,6 +85,8 @@ void qpidBridge_createImpl (mamaBridge* result)

 

     /* Return the newly created bridge */

     *result = (mamaBridge) bridge;

+

+    mamaBridgeImpl_setReadOnlyProperty ((mamaBridge)bridge, "mama.qpid.entitlements.deferred", "false", 1);

}

 

 mama_status

diff --git a/mama/c_cpp/src/c/listenermsgcallback.c b/mama/c_cpp/src/c/listenermsgcallback.c

index 85c3bf2..caeaa56 100644

--- a/mama/c_cpp/src/c/listenermsgcallback.c

+++ b/mama/c_cpp/src/c/listenermsgcallback.c

@@ -86,7 +86,8 @@ listenerMsgCallback_create( listenerMsgCallback *result,

     msgCallback* callback = (msgCallback*)calloc( 1, sizeof( msgCallback ) );

 

 #ifdef WITH_ENTITLEMENTS  /* No listener creation without a client. */

-    if( gEntitlementClient == 0 )

+    mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(subscription);

+    if( gEntitlementClient == 0 && !(mamaBridgeImpl_areEntitlementsDeferred(bridge)))

     {

         return MAMA_ENTITLE_NO_SERVERS_SPECIFIED;

     }

@@ -625,7 +626,6 @@ static void handleNoSubscribers (msgCallback *callback,

static int

checkEntitlement( msgCallback *callback, mamaMsg msg, SubjectContext* ctx )

{

-

#ifdef WITH_ENTITLEMENTS

     int result = 0;

     int32_t value;

@@ -634,6 +634,17 @@ checkEntitlement( msgCallback *callback, mamaMsg msg, SubjectContext* ctx )

         return 1;

     }

 

+    mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(self->mSubscription);

+

+    if (bridge && (mamaBridgeImpl_areEntitlementsDeferred(bridge)))

+    {

+        mama_log (MAMA_LOG_LEVEL_FINER,

+                       "Deferred checking injected entitlement to %s bridge [%p]",

+                        bridge->bridgeGetName(), bridge);

+        ctx->mEntitlementAlreadyVerified = 1;

+        return 1;

+    }

+

     if( MAMA_STATUS_OK == mamaMsg_getEntitleCode( msg,

                                                   &value ) )

     {

diff --git a/mama/c_cpp/src/c/mama.c b/mama/c_cpp/src/c/mama.c

index 5e31856..1815bc0 100644

--- a/mama/c_cpp/src/c/mama.c

+++ b/mama/c_cpp/src/c/mama.c

@@ -1707,6 +1707,8 @@ enableEntitlements (const char **servers)

     const char* altUserId;

     const char* altIp;

     const char* site;

+    mamaMiddleware middleware = 0;

+    int entitlementsRequired = 0; /*boolean*/

 

 

     if (gEntitlementClient != 0)

@@ -1715,6 +1717,30 @@ enableEntitlements (const char **servers)

         gEntitlementClient = 0;

     }

 

+    for (middleware=0; middleware != MAMA_MIDDLEWARE_MAX; ++middleware)

+    {

+        mamaBridgeImpl* impl = (mamaBridgeImpl*) gImpl.myBridges [middleware];

+        if (impl)

+        {

+            /* Check if entitlements are deferred to bridge */

+            if (mamaBridgeImpl_areEntitlementsDeferred(impl) == 1)

+            {

+                mama_log (MAMA_LOG_LEVEL_WARN,

+                    "Entitlements deferred on %s bridge.",

+                    mamaMiddleware_convertToString (middleware));

+            }

+            else

+            {

+                /* Entitlements are not deferred, continue with entitlement checking */

+                entitlementsRequired = 1;

+            }

+        }

+    }

+

+    /* Entitlements are deferred, do not continue with entitlement checking */

+    if (entitlementsRequired==0)

+        return MAMA_STATUS_OK;

+

     if (servers == NULL)

     {

         if (NULL == (servers = mdrvImpl_ParseServersProperty()))

diff --git a/mama/c_cpp/src/c/subscription.c b/mama/c_cpp/src/c/subscription.c

index 1f78746..42ad347 100644

--- a/mama/c_cpp/src/c/subscription.c

+++ b/mama/c_cpp/src/c/subscription.c

@@ -450,11 +450,19 @@ mamaSubscription_setupBasic (

                   "Could not get bridge impl from transport.");

         return MAMA_STATUS_NO_BRIDGE_IMPL;

     }

-       

+

#ifdef WITH_ENTITLEMENTS

-    self->mSubjectContext.mOeaSubscription = oeaClient_newSubscription (&entitlementStatus, gEntitlementClient);

+    mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(subscription);

+    if (gEntitlementClient == 0 || mamaBridgeImpl_areEntitlementsDeferred(bridge))

+    {

+        mama_log (MAMA_LOG_LEVEL_FINER,

+                    "Entitlements checking at subscription creation deferred to %s bridge [%p]",

+                    bridge->bridgeGetName(), bridge);

+    }

+    else

+        self->mSubjectContext.mOeaSubscription = oeaClient_newSubscription (&entitlementStatus, gEntitlementClient);

#endif

-   

+

     /*Up from entitlement check based on string compare on symbol*/

     if (!isEntitledToSymbol (source, symbol, self))

     {

@@ -476,7 +484,9 @@ mamaSubscription_setupBasic (

             if (!self->mRequiresInitial) return MAMA_STATUS_INVALID_ARG;

             subscMsgType = MAMA_SUBSC_SNAPSHOT;

#ifdef WITH_ENTITLEMENTS

-            oeaSubscription_setIsSnapshot (self->mSubjectContext.mOeaSubscription, 1);

+            mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(subscription);

+            if (!(gEntitlementClient == 0 || mamaBridgeImpl_areEntitlementsDeferred(bridge)))

+                oeaSubscription_setIsSnapshot (self->mSubjectContext.mOeaSubscription, 1);

#endif

             break;

         case MAMA_SERVICE_LEVEL_CONFLATED:/*fall through*/

@@ -1184,7 +1194,9 @@ mamaSubscription_getSubjectContext (mamaSubscription subscription,

         msgUtils_getIssueSymbol (msg, &issueSymbol);

         context->mSymbol = copyString (issueSymbol);

         #ifdef WITH_ENTITLEMENTS

-        context->mOeaSubscription = oeaClient_newSubscription (&entitlementStatus, gEntitlementClient);

+        mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(subscription);

+        if (!(gEntitlementClient == 0 || mamaBridgeImpl_areEntitlementsDeferred(bridge)))

+            context->mOeaSubscription = oeaClient_newSubscription (&entitlementStatus, gEntitlementClient);

         #endif

 

         wtable_insert (self->mSubjects, (char*)sendSubject, (void*)context);

@@ -2048,7 +2060,9 @@ mamaSubscription_processTportMsg( mamaSubscription subscription,

     }

 

 #ifdef WITH_ENTITLEMENTS

-    mamaMsg_getEntitleCode (msg, &entitleCode);

+    mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(subscription);

+    if (!(gEntitlementClient == 0 || mamaBridgeImpl_areEntitlementsDeferred(bridge)))

+        mamaMsg_getEntitleCode (msg, &entitleCode);

#endif

     if (entitleCode == 0)

     {

@@ -2100,7 +2114,9 @@ mamaSubscription_processWildCardMsg( mamaSubscription subscription,

     }

 

 #ifdef WITH_ENTITLEMENTS

-    mamaMsg_getEntitleCode (msg, &entitleCode);

+    mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(subscription);

+    if (!(gEntitlementClient == 0 || mamaBridgeImpl_areEntitlementsDeferred(bridge)))

+        mamaMsg_getEntitleCode (msg, &entitleCode);

#endif

     if (entitleCode == 0)

     {

@@ -2173,7 +2189,9 @@ mamaSubscription_processMsg (mamaSubscription subscription, mamaMsg msg)

     {

         int32_t entitleCode = 0;

#ifdef WITH_ENTITLEMENTS

-        mamaMsg_getEntitleCode (msg, &entitleCode);

+        mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(subscription);

+        if (!(gEntitlementClient == 0 || mamaBridgeImpl_areEntitlementsDeferred(bridge)))

+            mamaMsg_getEntitleCode (msg, &entitleCode);

#endif

         if (entitleCode == 0)

         {

@@ -2412,7 +2430,9 @@ isEntitledToSymbol (const char *source, const char*symbol, mamaSubscription subs

 

     snprintf (subject, WOMBAT_SUBJECT_MAX, "%s.%s", source, symbol);

 

-    if (gEntitlementClient == 0) /* Not enforcing entitlements. */

+    mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(subscription);

+

+    if (gEntitlementClient == 0 || mamaBridgeImpl_areEntitlementsDeferred(bridge)) /* Not enforcing entitlements. */

     {

         return 1;

     }

--

1.7.1

 

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 


Re: [PATCH 1/3] [MAMAC] mamaPlugin Feature - additional

Gary Molloy <g.molloy@...>
 

Hi Guys,

 

As promised, please find below a link to a document on the mamaPlugin feature:

https://docs.google.com/document/d/1HcV43uFJrV_pX0M0N7oDoZkWly0LjmyIxM9U-YpBtFQ/edit?usp=sharing

Thanks,

Gary

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 

From: Gary Molloy
Sent: 30 April 2015 10:58
To: openmama-dev@...
Subject: RE: [PATCH 1/3] [MAMAC] mamaPlugin Feature - additional

 

From 76a6db152998cbb32de58eb1cb9d6c1ab9307a1e Mon Sep 17 00:00:00 2001

From: Gary Molloy <g.molloy@...>

Date: Wed, 29 Apr 2015 13:05:23 -0400

Subject: [PATCH] [MAMAC] mamaPlugin Feature - addition

 

Addition to the existing mamaPlugin patch to remove references to internal shared objects and a missing null check.

 

Signed-off-by: Gary Molloy <g.molloy@...>

---

mama/c_cpp/src/c/plugin.c |   61 ++++++++++++++++++++------------------------

1 files changed, 28 insertions(+), 33 deletions(-)

 

diff --git a/mama/c_cpp/src/c/plugin.c b/mama/c_cpp/src/c/plugin.c

index b6475fe..303ab9f 100644

--- a/mama/c_cpp/src/c/plugin.c

+++ b/mama/c_cpp/src/c/plugin.c

@@ -216,9 +216,6 @@ mama_initPlugins(void)

         }

     }

 

-    mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising mamacenterprise");

-    mama_loadPlugin ("mamacenterprise");

-

     return MAMA_STATUS_OK;

}

 

@@ -243,15 +240,10 @@ mama_loadPlugin (const char* pluginName)

     if (pluginImpl == NULL)

     {

        /* The plugin name should be of the format mamaplugin<name> */

-        if (strncmp(pluginName, "mamacenterprise", MAX_PLUGIN_STRING) == 0)

-            snprintf(loadPluginName, MAX_PLUGIN_STRING,

-                "%s",

-                pluginName);

-        else

-            snprintf(loadPluginName, MAX_PLUGIN_STRING,

-                "%s%s",

-                PLUGIN_NAME,

-                pluginName);

+        snprintf(loadPluginName, MAX_PLUGIN_STRING,

+            "%s%s",

+            PLUGIN_NAME,

+            pluginName);

 

         pluginLib = openSharedLib (loadPluginName, NULL);

 

@@ -345,31 +337,34 @@ mama_shutdownPlugins (void)

 

     for (plugin = 0; plugin <= gPluginNo; plugin++)

     {

-        if (gPlugins[plugin]->mPluginHandle != NULL)

+        if (gPlugins[plugin] != NULL)

         {

-            /* Fire the user shutdown hook first - if one is present */

-            if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)

+            if (gPlugins[plugin]->mPluginHandle != NULL)

             {

-                gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);

-            }

+                /* Fire the user shutdown hook first - if one is present */

+                if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)

+                {

+                    gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);

+                }

 

-            ret = closeSharedLib (gPlugins[plugin]->mPluginHandle);

-            if (0!=ret)

-            {

-                 mama_log (MAMA_LOG_LEVEL_WARN,

-                            "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]",

-                            gPlugins[plugin]->mPluginName);

-            }

-            else

-            {

-                 mama_log (MAMA_LOG_LEVEL_WARN,

-                            "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed",

-                            gPlugins[plugin]->mPluginName);

-            }

+                ret = closeSharedLib (gPlugins[plugin]->mPluginHandle);

+                if (0!=ret)

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]",

+                                gPlugins[plugin]->mPluginName);

+                }

+                else

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed",

+                                gPlugins[plugin]->mPluginName);

+                }

 

-            free ((char*)gPlugins[plugin]->mPluginName);

-            free (gPlugins[plugin]);

-            gPlugins[plugin] = NULL;

+                free ((char*)gPlugins[plugin]->mPluginName);

+                free (gPlugins[plugin]);

+                gPlugins[plugin] = NULL;

+            }

         }

     }

     return status;

--

1.7.1

 

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Gary Molloy
Sent: 23 April 2015 17:54
To: openmama-dev@...
Subject: [Openmama-dev] [PATCH 1/3] [MAMAC] mamaPlugin Feature

 

Testing Strategy:-

Not middleware or O/S specific. 
 

Using the attached template you can create your own plugin and load it in via your mama.properties, for example:

 

mama.plugin.name_0=template

 

You can run up a mamaPublisher to test your plugin, for example:

 

mamapublisherc -tport pub -m wmw -l MAMA_INBOUND_TOPIC -v -v -v -v -v

 

You can expect to see output similar this if your plugin was loaded successfully:

 

2015-04-09 13:45:02: (f9018280) : mama_initPlugins(): Initialising [mama.plugin.name_0] template 

2015-04-09 13:45:02: (f9018280) : mama_loadPlugin(): Sucessfully registered plugin functions for [template] 

2015-04-09 13:45:02: (f9018280) : mama_loadPlugin(): Successfully run the init hook for mama plugin [template]  

 

If your plugin was not loaded successful you can expect to see output similar to this:

 

2015-04-09 13:45:02: (f9018280) : mama_initPlugins(): Initialising [mama.plugin.name_0] template 

2015-04-09 13:45:02: (f9018280) : mamaPlugin_registerFunctions(): Cannot load plugin, does not implement required function: [templateMamaPlugin_shutdownHook] 

2015-04-09 13:45:02: (f9018280) : mama_loadPlugin(): Failed to register plugin functions for [template] 

 

Further documentation on the mamaPlugin feature will be available shortly which will provide more details on the feature which will include the various hooks available etc...

 

 

=========================================================================================================

 

From e2a6a3f9c5750cee780cb6185a1310b4e4b70629 Mon Sep 17 00:00:00 2001

From: Gary Molloy <g.molloy@...>

Date: Thu, 23 Apr 2015 11:22:14 -0400

Subject: [PATCH 1/3] [MAMAC] mamaPlugin Feature

 

A new feature, mamaPlugin has been introduced that will allow you to

create and run your own code within 'hooks' into the MAMA codebase.

 

A mamaPlugin is essentially a shared object.

 

Signed-off-by: Gary Molloy <g.molloy@...>

---

mama/c_cpp/src/c/Makefile.am    |    1 +

mama/c_cpp/src/c/SConscript     |    1 +

mama/c_cpp/src/c/SConscript.win |    1 +

mama/c_cpp/src/c/mama.c         |   10 +-

mama/c_cpp/src/c/mama/types.h   |   10 +

mama/c_cpp/src/c/plugin.c       |  472 +++++++++++++++++++++++++++++++++++++++

mama/c_cpp/src/c/plugin.h       |   59 +++++

mama/c_cpp/src/c/publisher.c    |   10 +

mama/c_cpp/src/c/transport.c    |   21 ++-

9 files changed, 579 insertions(+), 6 deletions(-)

create mode 100644 mama/c_cpp/src/c/plugin.c

create mode 100644 mama/c_cpp/src/c/plugin.h

 

diff --git a/mama/c_cpp/src/c/Makefile.am b/mama/c_cpp/src/c/Makefile.am

index c831ce4..318c353 100644

--- a/mama/c_cpp/src/c/Makefile.am

+++ b/mama/c_cpp/src/c/Makefile.am

@@ -131,6 +131,7 @@ libmama_la_SOURCES = \

     mamaStrUtils.h \

     mamaStrUtils.c \

               marketdata.c \

+    plugin.c \

     middleware.c \

               msg.c \

               msgfield.c \

diff --git a/mama/c_cpp/src/c/SConscript b/mama/c_cpp/src/c/SConscript

index 4362f50..f47e18c 100644

--- a/mama/c_cpp/src/c/SConscript

+++ b/mama/c_cpp/src/c/SConscript

@@ -98,6 +98,7 @@ libmama_sources = \

     mama.c

     mamaStrUtils.c

               marketdata.c

+    plugin.c

     middleware.c

               msg.c

               msgfield.c

diff --git a/mama/c_cpp/src/c/SConscript.win b/mama/c_cpp/src/c/SConscript.win

index 77e3e18..9a6ff05 100644

--- a/mama/c_cpp/src/c/SConscript.win

+++ b/mama/c_cpp/src/c/SConscript.win

@@ -50,6 +50,7 @@ dqpublishermanager.c

inbox.c

msgtype.c

msgutils.c

+plugin.c

senderId.c

reservedfields.c

subscription.c

diff --git a/mama/c_cpp/src/c/mama.c b/mama/c_cpp/src/c/mama.c

index 33a0768..5e31856 100644

--- a/mama/c_cpp/src/c/mama.c

+++ b/mama/c_cpp/src/c/mama.c

@@ -35,6 +35,7 @@

#include <payloadbridge.h>

#include <property.h>

#include <platform.h>

+#include <plugin.h>

 

 #include "fileutils.h"

#include "reservedfieldsimpl.h"

@@ -42,7 +43,6 @@

#include <mama/stat.h>

#include <mama/statfields.h>

#include <statsgeneratorinternal.h>

-#include <statsgeneratorinternal.h>

#include <mama/statscollector.h>

#include "transportimpl.h"

 

@@ -740,6 +740,9 @@ mama_openWithPropertiesCount (const char* path,

                               }

     }

 

+    /* This will initialise all plugins */

+    mama_initPlugins();

+

     prop = properties_Get (gProperties, "mama.catchcallbackexceptions.enable");

     if (prop != NULL && strtobool(prop))

     {

@@ -1253,9 +1256,12 @@ mama_closeCount (unsigned int* count)

                 gImpl.myPayloadLibraries[(uint8_t)payload] = NULL;

             }

         }

-       

+

        gDefaultPayload = NULL;

 

+       /* This will shutdown all plugins */

+       mama_shutdownPlugins();

+

         /* Look for a bridge for each of the middlewares and close them */

         for (middleware = 0; middleware != MAMA_MIDDLEWARE_MAX; ++middleware)

         {

diff --git a/mama/c_cpp/src/c/mama/types.h b/mama/c_cpp/src/c/mama/types.h

index 50d6608..03f6da8 100644

--- a/mama/c_cpp/src/c/mama/types.h

+++ b/mama/c_cpp/src/c/mama/types.h

@@ -74,6 +74,16 @@ typedef struct mamaBridgeImpl_* mamaBridge;

typedef struct mamaPayloadBridgeImpl_* mamaPayloadBridge;

 

 /**

+ * @brief Container for holding a mama plugin object

+ */

+typedef struct mamaPluginImpl_*     mamaPlugin;

+

+/**

+ * @brief Container for holding a mama plugin info

+ */

+typedef void*       mamaPluginInfo;

+

+/**

  * Flexible date/time format

  */

typedef   mama_u64_t*   mamaDateTime;

diff --git a/mama/c_cpp/src/c/plugin.c b/mama/c_cpp/src/c/plugin.c

new file mode 100644

index 0000000..b6475fe

--- /dev/null

+++ b/mama/c_cpp/src/c/plugin.c

@@ -0,0 +1,472 @@

+/* $Id$

+ *

+ * OpenMAMA: The open middleware agnostic messaging API

+ * Copyright (C) 2011 NYSE Technologies, Inc.

+ *

+ * This library is free software; you can redistribute it and/or

+ * modify it under the terms of the GNU Lesser General Public

+ * License as published by the Free Software Foundation; either

+ * version 2.1 of the License, or (at your option) any later version.

+ *

+ * This library is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

+ * Lesser General Public License for more details.

+ *

+ * You should have received a copy of the GNU Lesser General Public

+ * License along with this library; if not, write to the Free Software

+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA

+ * 02110-1301 USA

+ */

+

+#include <string.h>

+#include <stdio.h>

+#include <limits.h>

+

+#include "wombat/port.h"

+#include "wombat/environment.h"

+#include "wombat/strutils.h"

+#include <wombat/wtable.h>

+

+#include <mama/mama.h>

+#include <mama/error.h>

+#include <mamainternal.h>

+#include <mama/version.h>

+#include <property.h>

+#include <plugin.h>

+#include <platform.h>

+

+#define PLUGIN_PROPERTY "mama.plugin.name_"

+#define PLUGIN_NAME "mamaplugin"

+

+#define MAX_PLUGINS 100

+#define MAX_PLUGIN_STRING 1024

+

+#define MAX_FUNC_STRING 256

+

+/**

+ * @brief Mechanism for registering required plugin functions.

+ *

+ * Taking a function string name search the shared library handle, using the

+ * loadLibFunc portability method, for the function. If it is found, set the

+ * appropriate function pointer in the plugin struct to the result. If not,

+ * log as an error the fact that the funciton cannot be found, and return

+ * MAMA_STATUS_PLATFORM

+ *

+ * @param FUNCSTRINGNAME The string function name.

+ * @param FUNCIMPLNAME The name of the function pointer in the plugin struct

+ * @param FUNCIMPLTYPE The type of the function pointer expected.

+ */

+#define REGISTER_PLUGIN_FUNCTION(FUNCSTRINGNAME, FUNCIMPLNAME, FUNCIMPLTYPE)    \

+do {                                                                            \

+    snprintf (functionName, MAX_FUNC_STRING, "%s"#FUNCSTRINGNAME, name);        \

+    result = loadLibFunc (pluginLib, functionName);                             \

+                                                                                \

+    if (NULL != result) {                                                       \

+        (pluginImpl)->FUNCIMPLNAME = *(FUNCIMPLTYPE*)&result;                   \

+        result = NULL;                                                          \

+    } else {                                                                    \

+        mama_log (MAMA_LOG_LEVEL_ERROR,                                         \

+                  "mamaPlugin_registerFunctions(): "                            \

+                  "Cannot load plugin, does not implement required function: [%s]",\

+                  functionName);                                                \

+        status = MAMA_STATUS_PLATFORM;                                          \

+        return status;                                                          \

+    }                                                                           \

+} while (0)

+

+/**

+ * @brief Mechanism for registering required plugin functions.

+ *

+ * Taking a function string name search the shared library handle, using the

+ * loadLibFunc portability method, for the function. If it is found, set the

+ * appropriate function pointer in the plugin struct to the result. If not

+ * log the fact that the function has not been found, and continue.

+ *

+ * @param FUNCSTRINGNAME The string function name.

+ * @param FUNCIMPLNAME The name of the function pointer in the plugin struct

+ * @param FUNCIMPLTYPE The type of the function pointer expected.

+ */

+#define REGISTER_OPTIONAL_PLUGIN_FUNCTION(FUNCSTRINGNAME,                       \

+                                          FUNCIMPLNAME,                         \

+                                          FUNCIMPLTYPE)                         \

+do {                                                                            \

+    snprintf (functionName, MAX_FUNC_STRING, "%s"#FUNCSTRINGNAME, name);        \

+    result = loadLibFunc (pluginLib, functionName);                             \

+                                                                                \

+    if (NULL != result) {                                                       \

+        (pluginImpl)->FUNCIMPLNAME = *(FUNCIMPLTYPE*)&result;                   \

+        result = NULL;                                                          \

+    } else {                                                                    \

+        mama_log (MAMA_LOG_LEVEL_FINE,                                          \

+                  "mamaPlugin_registerFunctions(): "                            \

+                  "Optional plugin function [%s] not found. Unavailable.",      \

+                  functionName);                                                \

+    }                                                                           \

+} while (0)

+

+typedef struct mamaPluginImpl_

+{

+    LIB_HANDLE          mPluginHandle;

+    char*               mPluginName;

+    mamaPluginInfo      mPluginInfo;

+

+    mamaPlugin_publisherPreSendHook     mamaPluginPublisherPreSendHook;

+    mamaPlugin_transportPostCreateHook  mamaPluginTransportPostCreateHook;

+    mamaPlugin_shutdownHook             mamaPluginShutdownHook;

+    mamaPlugin_initHook                 mamaPluginInitHook;

+

+} mamaPluginImpl;

+

+static mamaPluginImpl*      gPlugins[MAX_PLUGINS];

+static volatile int         gPluginNo = 0;

+

+/**

+ * @brief Used to load register all possible plugin functions to be

+ *        used within Mama.

+ *

+ * param[in] pluginLib

+ * param[in] name

+ * param[in] pluginImpl The plugin impl to be used

+ *

+ * @return mama_status return code can be one of:

+ *          MAMA_STATUS_OK

+ */

+mama_status

+mamaPlugin_registerFunctions   (LIB_HANDLE      pluginLib,

+                                const char*     name,

+                                mamaPluginInfo  pluginInfo,

+                                mamaPluginImpl* pluginImpl);

+

+/**

+ * @brief Used find a plugin using the library name

+ *

+ * param[in] name

+ *

+ * @return a valid mamaPluginImpl if found

+ */

+mamaPluginImpl*

+mamaPlugin_findPlugin (const char* name);

+

+/**

+ * @brief Used find a plugin using the library name

+ *

+ * param[in] pluginName

+ *

+ * @return mama_status return code can be one of:

+ *          MAMA_STATUS_OK

+ */

+mama_status

+mama_loadPlugin (const char* pluginName);

+

+

+/**

+ * Register function pointers associated with a specific plugin.

+ */

+mama_status

+mamaPlugin_registerFunctions (LIB_HANDLE      pluginLib,

+                              const char*     name,

+                              mamaPluginInfo  pluginInfo,

+                              mamaPluginImpl* pluginImpl)

+{

+    mama_status  status        = MAMA_STATUS_OK;

+    void*        result        = NULL;

+    char         functionName[MAX_FUNC_STRING];

+

+    /* Save off some informatin on the plugin */

+    pluginImpl->mPluginHandle = pluginLib;

+    pluginImpl->mPluginName = strdup(name);

+    pluginImpl->mPluginInfo = pluginInfo;

+

+

+    /* Required fuctions */

+    REGISTER_PLUGIN_FUNCTION (MamaPlugin_initHook, mamaPluginInitHook,

+                              mamaPlugin_initHook);

+    REGISTER_PLUGIN_FUNCTION (MamaPlugin_shutdownHook, mamaPluginShutdownHook,

+                              mamaPlugin_shutdownHook);

+

+

+    /* Optional fuctions */

+    REGISTER_OPTIONAL_PLUGIN_FUNCTION (MamaPlugin_publisherPreSendHook, mamaPluginPublisherPreSendHook,

+                                       mamaPlugin_publisherPreSendHook);

+    REGISTER_OPTIONAL_PLUGIN_FUNCTION (MamaPlugin_transportPostCreateHook, mamaPluginTransportPostCreateHook,

+                                       mamaPlugin_transportPostCreateHook);

+

+   return status;

+}

+

+mama_status

+mama_initPlugins(void)

+{

+    int             pluginCount      = 0;

+    const char*     prop             = NULL;

+    char            propString[MAX_PLUGIN_STRING];

+

+    for (pluginCount = 0; pluginCount < MAX_PLUGINS; pluginCount++)

+    {

+        snprintf(propString, MAX_PLUGIN_STRING,

+            PLUGIN_PROPERTY"%d",

+            pluginCount);

+

+        prop = properties_Get (mamaInternal_getProperties (), propString);

+        if (prop != NULL && strlen(prop)!= 0)

+        {

+            mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising [%s] %s", propString, prop);

+            mama_loadPlugin (prop);

+        }

+    }

+

+    mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising mamacenterprise");

+    mama_loadPlugin ("mamacenterprise");

+

+    return MAMA_STATUS_OK;

+}

+

+mama_status

+mama_loadPlugin (const char* pluginName)

+{

+    LIB_HANDLE              pluginLib       = NULL;

+    mamaPluginImpl*         pluginImpl      = NULL;

+    mama_status             status          = MAMA_STATUS_OK;

+    mamaPluginInfo          pluginInfo      = NULL;

+    char                    loadPluginName  [MAX_PLUGIN_STRING];

+    mamaPluginImpl*         aPluginImpl     = NULL;

+

+    if (!pluginName)

+        return MAMA_STATUS_NULL_ARG;

+

+    pluginImpl = mamaPlugin_findPlugin(pluginName);

+

+    /*

+     * Check to see if pluginImpl has already been loaded

+     */

+    if (pluginImpl == NULL)

+    {

+       /* The plugin name should be of the format mamaplugin<name> */

+        if (strncmp(pluginName, "mamacenterprise", MAX_PLUGIN_STRING) == 0)

+            snprintf(loadPluginName, MAX_PLUGIN_STRING,

+                "%s",

+                pluginName);

+        else

+            snprintf(loadPluginName, MAX_PLUGIN_STRING,

+                "%s%s",

+                PLUGIN_NAME,

+                pluginName);

+

+        pluginLib = openSharedLib (loadPluginName, NULL);

+

+        if (!pluginLib)

+        {

+

+           mama_log (MAMA_LOG_LEVEL_ERROR,

+                    "mama_loadPlugin(): "

+                    "Could not open plugin library [%s] [%s]",

+                    pluginName,

+                    getLibError());

+            return MAMA_STATUS_PLATFORM;

+        }

+

+        /* Create structure to hold plugin information */

+        aPluginImpl = (mamaPluginImpl*)calloc (1, sizeof(mamaPluginImpl));

+

+        status = mamaPlugin_registerFunctions (pluginLib,

+                                               pluginName,

+                                               pluginInfo,

+                                               aPluginImpl);

+

+        if (MAMA_STATUS_OK == status)

+        {

+            mama_log (MAMA_LOG_LEVEL_NORMAL,

+                     "mama_loadPlugin(): "

+                     "Sucessfully registered plugin functions for [%s]",

+                     pluginName);

+

+        }

+        else

+        {

+            mama_log (MAMA_LOG_LEVEL_WARN,

+                     "mama_loadPlugin(): "

+                     "Failed to register plugin functions for [%s]",

+                     pluginName);

+

+            closeSharedLib (aPluginImpl->mPluginHandle);

+

+            free ((char*)aPluginImpl->mPluginName);

+            free ((mamaPluginImpl*)aPluginImpl);

+

+            return status;

+        }

+

+        /* Invoke the init function */

+        status = aPluginImpl->mamaPluginInitHook (aPluginImpl->mPluginInfo);

+

+        if (MAMA_STATUS_OK == status)

+        {

+            mama_log (MAMA_LOG_LEVEL_NORMAL,

+                      "mama_loadPlugin(): Successfully run the init hook for mama plugin [%s]",

+                       aPluginImpl->mPluginName);

+        }

+        else

+        {

+            mama_log (MAMA_LOG_LEVEL_WARN,

+                      "mama_loadPlugin(): Init hook failed for mama plugin [%s]",

+                       aPluginImpl->mPluginName);

+

+            closeSharedLib (aPluginImpl->mPluginHandle);

+

+            free ((char*)aPluginImpl->mPluginName);

+            free ((mamaPluginImpl*)aPluginImpl);

+

+            return status;

+        }

+

+        /* Save off the plugin impl and increment the plugin counter */

+        gPlugins[gPluginNo] = aPluginImpl;

+        gPluginNo++;

+

+    }

+    else

+    {

+        mama_log (MAMA_LOG_LEVEL_NORMAL,

+                 "mama_loadPlugin(): "

+                 "Plugin [%s] has already been loaded and initialised",

+                 pluginName);

+    }

+

+    return MAMA_STATUS_OK;

+}

+

+mama_status

+mama_shutdownPlugins (void)

+{

+    mama_status  status = MAMA_STATUS_OK;

+    int          plugin = 0;

+    int          ret    = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin]->mPluginHandle != NULL)

+        {

+            /* Fire the user shutdown hook first - if one is present */

+            if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)

+            {

+                gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);

+            }

+

+            ret = closeSharedLib (gPlugins[plugin]->mPluginHandle);

+            if (0!=ret)

+            {

+                 mama_log (MAMA_LOG_LEVEL_WARN,

+                            "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]",

+                            gPlugins[plugin]->mPluginName);

+            }

+            else

+            {

+                 mama_log (MAMA_LOG_LEVEL_WARN,

+                            "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed",

+                            gPlugins[plugin]->mPluginName);

+            }

+

+            free ((char*)gPlugins[plugin]->mPluginName);

+            free (gPlugins[plugin]);

+            gPlugins[plugin] = NULL;

+        }

+    }

+    return status;

+}

+

+mama_status

+mamaPlugin_firePublisherPreSendHook (mamaPublisher publisher, mamaMsg message)

+{

+    mama_status  status = MAMA_STATUS_OK;

+    int          plugin = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin] != NULL)

+        {

+            if (gPlugins[plugin]->mamaPluginPublisherPreSendHook != NULL)

+            {

+                status = gPlugins[plugin]->mamaPluginPublisherPreSendHook (gPlugins[plugin]->mPluginInfo, publisher, message);

+

+                if (MAMA_STATUS_OK != status)

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mamaPlugin_firePublisherPreSendHook(): Publisher pre send hook failed for mama plugin [%s]",

+                                gPlugins[plugin]->mPluginName);

+                }

+            }

+        }

+    }

+    return status;

+}

+

+mama_status

+mamaPlugin_fireTransportPostCreateHook (mamaTransport transport)

+{

+    mama_status  status = MAMA_STATUS_OK;

+    int          plugin = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin] != NULL)

+        {

+            if (gPlugins[plugin]->mamaPluginTransportPostCreateHook != NULL)

+            {

+                status = gPlugins[plugin]->mamaPluginTransportPostCreateHook (gPlugins[plugin]->mPluginInfo, transport);

+

+                if (MAMA_STATUS_OK != status)

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mamaPlugin_fireTransportPostCreateHook(): Transport post create hook failed for mama plugin [%s]",

+                                gPlugins[plugin]->mPluginName);

+                }

+            }

+        }

+    }

+    return status;

+}

+

+mama_status

+mamaPlugin_fireShutdownHook (void)

+{

+    mama_status  status = MAMA_STATUS_OK;

+    int          plugin = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin] != NULL)

+        {

+            if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)

+            {

+                status = gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);

+

+                if (MAMA_STATUS_OK != status)

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mamaPlugin_fireShutdownHook(): Shutdown hook failed for mama plugin [%s]",

+                                gPlugins[plugin]->mPluginName);

+                }

+            }

+        }

+    }

+    return status;

+}

+

+mamaPluginImpl*

+mamaPlugin_findPlugin (const char* name)

+{

+    int plugin = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin])

+        {

+            if ((strncmp(gPlugins[plugin]->mPluginName, name, MAX_PLUGIN_STRING) == 0))

+            {

+                return gPlugins[plugin];

+            }

+        }

+    }

+    return NULL;

+}

diff --git a/mama/c_cpp/src/c/plugin.h b/mama/c_cpp/src/c/plugin.h

new file mode 100644

index 0000000..df43b27

--- /dev/null

+++ b/mama/c_cpp/src/c/plugin.h

@@ -0,0 +1,59 @@

+/* $Id$

+ *

+ * OpenMAMA: The open middleware agnostic messaging API

+ * Copyright (C) 2011 NYSE Technologies, Inc.

+ *

+ * This library is free software; you can redistribute it and/or

+ * modify it under the terms of the GNU Lesser General Public

+ * License as published by the Free Software Foundation; either

+ * version 2.1 of the License, or (at your option) any later version.

+ *

+ * This library is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

+ * Lesser General Public License for more details.

+ *

+ * You should have received a copy of the GNU Lesser General Public

+ * License along with this library; if not, write to the Free Software

+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA

+ * 02110-1301 USA

+ */

+

+#ifndef PluginH__

+#define PluginH__

+

+

+/**

+ * @brief Containers used within the mama plugin

+ */

+typedef mama_status (*mamaPlugin_publisherPreSendHook) (mamaPluginInfo pluginInfo, mamaPublisher publisher, mamaMsg message);

+typedef mama_status (*mamaPlugin_transportPostCreateHook) (mamaPluginInfo pluginInfo, mamaTransport transport);

+typedef mama_status (*mamaPlugin_shutdownHook) (mamaPluginInfo pluginInfo);

+typedef mama_status (*mamaPlugin_initHook) (mamaPluginInfo* pluginInfo);

+

+/**

+ * Initialize the internal plugin interface

+ *

+ * @return mama status code

+ */

+extern mama_status

+mama_initPlugins (void);

+

+/**

+ * Shutdown the internal plugin interface

+ *

+ * @return mama status code

+ */

+extern mama_status

+mama_shutdownPlugins (void);

+

+extern mama_status

+mamaPlugin_firePublisherPreSendHook (mamaPublisher publisher, mamaMsg message);

+

+extern mama_status

+mamaPlugin_fireTransportPostCreateHook (mamaTransport transport);

+

+extern mama_status

+mamaPlugin_fireShutdownHook (void);

+

+#endif /* PluginH__ */

diff --git a/mama/c_cpp/src/c/publisher.c b/mama/c_cpp/src/c/publisher.c

index 4612d17..6a7f92d 100644

--- a/mama/c_cpp/src/c/publisher.c

+++ b/mama/c_cpp/src/c/publisher.c

@@ -23,6 +23,7 @@

#include "mama/publisher.h"

 

 #include "bridge.h"

+#include "plugin.h"

#include "throttle.h"

#include "transportimpl.h"

 

@@ -245,6 +246,15 @@ mamaPublisher_send (mamaPublisher publisher,

     if (!impl->mMamaPublisherBridgeImpl) return MAMA_STATUS_INVALID_ARG;

     if (!impl->mBridgeImpl) return MAMA_STATUS_NO_BRIDGE_IMPL;

 

+    /* Calling plugin hook */

+    status = mamaPlugin_firePublisherPreSendHook (publisher, msg);

+    if (MAMA_STATUS_OK != status)

+    {

+        mama_log (MAMA_LOG_LEVEL_ERROR,

+                  "mamaPublisher_send(): PublisherPreSendHook failed. Not sending message.");

+        return status;

+    }

+

     status = impl->mBridgeImpl->bridgeMamaPublisherSend

         (impl->mMamaPublisherBridgeImpl,

          msg);

diff --git a/mama/c_cpp/src/c/transport.c b/mama/c_cpp/src/c/transport.c

index 339dbc0..622f47d 100644

--- a/mama/c_cpp/src/c/transport.c

+++ b/mama/c_cpp/src/c/transport.c

@@ -25,6 +25,7 @@

 

 #include "mama/mama.h"

#include "throttle.h"

+#include "plugin.h"

#include "list.h"

#include "transportimpl.h"

#include "bridge.h"

@@ -876,10 +877,22 @@ mamaTransport_create (mamaTransport transport,

 

     if ((!self->mDisableRefresh) && (!mamaTransportInternal_disableRefreshes(name)))

     {

-        return refreshTransport_create (&self->mRefreshTransport,

-                                    (mamaTransport)self,

-                                    self->mListeners,

-                                    self->mBridgeImpl);

+        status = refreshTransport_create (&self->mRefreshTransport,

+                                          (mamaTransport)self,

+                                          self->mListeners,

+                                          self->mBridgeImpl);

+

+        if (MAMA_STATUS_OK != status)

+            return status;

+    }

+

+    /* Calling plugin hook*/

+    status = mamaPlugin_fireTransportPostCreateHook (transport);

+    if (MAMA_STATUS_OK != status)

+    {

+        mama_log (MAMA_LOG_LEVEL_ERROR,

+                  "mamaTransport_create(): TransportPostCreateHook failed with a status of %s",

+                   mamaStatus_stringForStatus(status));

     }

 

     return MAMA_STATUS_OK;

--

1.7.1

 

 

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 


Re: [PATCH 2/3] [MAMAC] Add ability to turn on/off entitlements on a per bridge basis - additional

Gary Molloy <g.molloy@...>
 

 

From 5300628690cdbeb41dd2dc355e3469afc20caae3 Mon Sep 17 00:00:00 2001

From: A.Ambrose <a.ambrose@...>

Date: Thu, 30 Apr 2015 12:59:09 -0400

Subject: [PATCH 2/2] [MAMAC] Add ability to turn on/off entitlements on a per bridge basis - additional

 

Signed-off-by: A.Ambrose <a.ambrose@...>

---

mama/c_cpp/src/c/bridge.c             |    5 ++---

mama/c_cpp/src/c/bridge.h             |    2 +-

mama/c_cpp/src/c/bridge/qpid/bridge.c |    2 +-

3 files changed, 4 insertions(+), 5 deletions(-)

 

diff --git a/mama/c_cpp/src/c/bridge.c b/mama/c_cpp/src/c/bridge.c

index dd42a55..d7325af 100644

--- a/mama/c_cpp/src/c/bridge.c

+++ b/mama/c_cpp/src/c/bridge.c

@@ -149,7 +149,7 @@ mamaBridgeImpl_stopInternalEventQueue (mamaBridge bridgeImpl)

}

 mama_status

-mamaBridgeImpl_setReadOnlyProperty (mamaBridge bridgeImpl, const char* property, const char* value, mama_bool_t readOnly)

+mamaBridgeImpl_setReadOnlyProperty (mamaBridge bridgeImpl, const char* property, const char* value)

{

     mamaBridgeImpl_setProperty(bridgeImpl, property, value);

     bridgeImpl->mEntitleReadOnly = 1;

@@ -160,12 +160,11 @@ mama_status

mamaBridgeImpl_setProperty (mamaBridge bridgeImpl, const char* property, const char* value)

{

     char propString[MAX_PROP_STRING];

-    int retVal;

     mamaBridgeImpl* impl = (mamaBridgeImpl*)bridgeImpl;

     /* Check for mama.middleware.entitlements_deferred first */

-    retVal = snprintf(propString, MAX_PROP_STRING,

+    snprintf(propString, MAX_PROP_STRING,

         "mama.%s.%s",

         impl->bridgeGetName(),

         PROP_NAME_ENTITLEMENTS_DEFERRED);

diff --git a/mama/c_cpp/src/c/bridge.h b/mama/c_cpp/src/c/bridge.h

index 9bcd204..7a66d97 100644

--- a/mama/c_cpp/src/c/bridge.h

+++ b/mama/c_cpp/src/c/bridge.h

@@ -879,7 +879,7 @@ mamaBridgeImpl_stopInternalEventQueue (mamaBridge bridgeImpl);

 MAMAExpDLL

extern mama_status

-mamaBridgeImpl_setReadOnlyProperty (mamaBridge bridgeImpl, const char* property, const char* value, mama_bool_t readOnly);

+mamaBridgeImpl_setReadOnlyProperty (mamaBridge bridgeImpl, const char* property, const char* value);

 MAMAExpDLL

extern mama_status

diff --git a/mama/c_cpp/src/c/bridge/qpid/bridge.c b/mama/c_cpp/src/c/bridge/qpid/bridge.c

index 233c8ec..4955bca 100644

--- a/mama/c_cpp/src/c/bridge/qpid/bridge.c

+++ b/mama/c_cpp/src/c/bridge/qpid/bridge.c

@@ -86,7 +86,7 @@ void qpidBridge_createImpl (mamaBridge* result)

     /* Return the newly created bridge */

     *result = (mamaBridge) bridge;

-    mamaBridgeImpl_setReadOnlyProperty ((mamaBridge)bridge, "mama.qpid.entitlements.deferred", "false", 1);

+    mamaBridgeImpl_setReadOnlyProperty ((mamaBridge)bridge, "mama.qpid.entitlements.deferred", "false");

}

 mama_status

--

1.7.1

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Gary Molloy
Sent: 23 April 2015 17:54
To: openmama-dev@...
Subject: [Openmama-dev] [PATCH 2/3] [MAMAC] Add ability to turn on/off entitlements on a per bridge basis

 

Testing Strategy:-

Not middleware or O/S specific. 

This will require an entitled build and an entitlement server.

 

There are 4 tests that you can run using a standard mamalistenc. 

For each test you will have to add/modify the following within your middleware bridge code (when you create your bridge):

 

1) mamaBridgeImpl_setReadOnlyProperty ((mamaBridge)impl, "mama.<middleware>.entitlements.deferred", "true", 1);
- Deferred true, will run will addition entitlement logging.


2) mamaBridgeImpl_setReadOnlyProperty ((mamaBridge)impl, "mama.<middleware>.entitlements.deferred", "false", 1); <------default now in <middleware> bridge (This will be the standard setting)
- Deferred false, will connect to the normal entitlement server.


3) mamaBridgeImpl_setReadOnlyProperty ((mamaBridge)impl, "mama.TEST.entitlements.deferred", "true", 1); <---- Invalid property string (will not matter if deferred or not, will log error at very top & fail to connect to entitlements)
- This will fail whether set to deferred or not, logging seen at top is will look like this:-

mamaBridgeImpl_setProperty(): Unknown property string [mama.TEST.entitlements.deferred] entered.

 

4) mamaBridgeImpl_setReadOnlyProperty ((mamaBridge)impl, "mama.<middleware>.entitlements.deferred", "true", 1);
      mamaBridgeImpl_setReadOnlyProperty ((mamaBridge)impl, "mama.<middleware>.entitlements.deferred", "false", 1); <-----property called twice (true/false, or false/true).


With false/true -
Should follow the standard logic of it not being deferred - logging at top will read
“mamaBridgeImpl_setProperty(): Bridge property is read only, property can not be set. “
But this should connect to the normal entitlement server.

With true/false -
Should follow the standard logic if deferred is true - logging at top will look like this:
“mamaBridgeImpl_setProperty(): Bridge property is read only, property can not be set. “

But will continue.

 

Further documentation on the this feature will be available shortly which will provide more details on the feature which will include the various logging you can expect etc...

 

 

=========================================================================================================

 

From d016afce1b1cc4ffb6d65c1d032ddea41d56b62e Mon Sep 17 00:00:00 2001

From: Gary Molloy <g.molloy@...>

Date: Tue, 21 Apr 2015 09:56:52 -0400

Subject: [PATCH 2/3] [MAMAC] Add ability to turn on/off entitlements on a per bridge basis

 

Signed-off-by: Gary Molloy <g.molloy@...>

---

mama/c_cpp/src/c/bridge.c              |   67 ++++++++++++++++++++++++++++++++

mama/c_cpp/src/c/bridge.h              |   20 +++++++++

mama/c_cpp/src/c/bridge/qpid/bridge.c  |    2 +

mama/c_cpp/src/c/listenermsgcallback.c |   15 ++++++-

mama/c_cpp/src/c/mama.c                |   26 ++++++++++++

mama/c_cpp/src/c/subscription.c        |   38 ++++++++++++++----

6 files changed, 157 insertions(+), 11 deletions(-)

 

diff --git a/mama/c_cpp/src/c/bridge.c b/mama/c_cpp/src/c/bridge.c

index 01cbcc5..dd42a55 100644

--- a/mama/c_cpp/src/c/bridge.c

+++ b/mama/c_cpp/src/c/bridge.c

@@ -20,8 +20,12 @@

  */

 

 #include <mama/mama.h>

+#include <wombat/strutils.h>

#include "bridge.h"

 

+#define MAX_PROP_STRING                   1000

+#define PROP_NAME_ENTITLEMENTS_DEFERRED   "entitlements.deferred"

+

int mamaBridgeImpl_getDefaultQueueTimeout(void)

{

     /* Returns. */

@@ -143,3 +147,66 @@ mamaBridgeImpl_stopInternalEventQueue (mamaBridge bridgeImpl)

    

     return MAMA_STATUS_OK;

}

+

+mama_status

+mamaBridgeImpl_setReadOnlyProperty (mamaBridge bridgeImpl, const char* property, const char* value, mama_bool_t readOnly)

+{

+    mamaBridgeImpl_setProperty(bridgeImpl, property, value);

+    bridgeImpl->mEntitleReadOnly = 1;

+    return MAMA_STATUS_OK;

+}

+

+mama_status

+mamaBridgeImpl_setProperty (mamaBridge bridgeImpl, const char* property, const char* value)

+{

+    char propString[MAX_PROP_STRING];

+    int retVal;

+

+    mamaBridgeImpl* impl = (mamaBridgeImpl*)bridgeImpl;

+

+    /* Check for mama.middleware.entitlements_deferred first */

+    retVal = snprintf(propString, MAX_PROP_STRING,

+        "mama.%s.%s",

+        impl->bridgeGetName(),

+        PROP_NAME_ENTITLEMENTS_DEFERRED);

+

+    if(0 == strcmp(property, propString))

+    {

+        if (1 == bridgeImpl->mEntitleReadOnly)

+        {

+            mama_log (MAMA_LOG_LEVEL_WARN, "mamaBridgeImpl_setProperty(): "

+                      "Bridge is read only, property can not be set.");

+            return MAMA_STATUS_INVALID_ARG;

+        }

+        else

+        {

+            if (strtobool(value))

+                bridgeImpl->mEntitleDeferred = 1;

+            else

+                bridgeImpl->mEntitleDeferred = 0;

+        }

+    }

+    else

+    {

+        mama_log (MAMA_LOG_LEVEL_WARN, "mamaBridgeImpl_setProperty(): "

+            "Unknown property string [%s] entered.", property);

+        return MAMA_STATUS_INVALID_ARG;

+    }

+    return MAMA_STATUS_OK;

+}

+

+const char*

+mamaBridgeImpl_getProperty (mamaBridge bridgeImpl, const char* property)

+{

+    return NULL;

+}

+

+mama_bool_t

+mamaBridgeImpl_areEntitlementsDeferred (mamaBridge bridgeImpl)

+{

+    if (bridgeImpl)

+    {

+        return bridgeImpl->mEntitleDeferred;

+    }

+    return 0;

+}

diff --git a/mama/c_cpp/src/c/bridge.h b/mama/c_cpp/src/c/bridge.h

index c079819..9bcd204 100644

--- a/mama/c_cpp/src/c/bridge.h

+++ b/mama/c_cpp/src/c/bridge.h

@@ -715,6 +715,10 @@ typedef struct mamaBridgeImpl_

        used when getting the default queue */

     void*     mCppCallback;

 

+    /*Used in bridge.c*/

+    mama_bool_t  mEntitleDeferred;

+    mama_bool_t  mEntitleReadOnly;

+

     /*Used in mama.c*/

     bridge_open                                                 bridgeOpen;

     bridge_close                                                 bridgeClose;

@@ -873,6 +877,22 @@ MAMAExpDLL

mama_status

mamaBridgeImpl_stopInternalEventQueue (mamaBridge bridgeImpl);

 

+MAMAExpDLL

+extern mama_status

+mamaBridgeImpl_setReadOnlyProperty (mamaBridge bridgeImpl, const char* property, const char* value, mama_bool_t readOnly);

+

+MAMAExpDLL

+extern mama_status

+mamaBridgeImpl_setProperty (mamaBridge bridgeImpl, const char* property, const char* value);

+

+MAMAExpDLL

+extern const char*

+mamaBridgeImpl_getProperty (mamaBridge bridgeImpl, const char* property);

+

+MAMAExpDLL

+extern mama_bool_t

+mamaBridgeImpl_areEntitlementsDeferred (mamaBridge bridgeImpl);

+

#if defined(__cplusplus)

}

#endif

diff --git a/mama/c_cpp/src/c/bridge/qpid/bridge.c b/mama/c_cpp/src/c/bridge/qpid/bridge.c

index 4ab74c7..233c8ec 100644

--- a/mama/c_cpp/src/c/bridge/qpid/bridge.c

+++ b/mama/c_cpp/src/c/bridge/qpid/bridge.c

@@ -85,6 +85,8 @@ void qpidBridge_createImpl (mamaBridge* result)

 

     /* Return the newly created bridge */

     *result = (mamaBridge) bridge;

+

+    mamaBridgeImpl_setReadOnlyProperty ((mamaBridge)bridge, "mama.qpid.entitlements.deferred", "false", 1);

}

 

 mama_status

diff --git a/mama/c_cpp/src/c/listenermsgcallback.c b/mama/c_cpp/src/c/listenermsgcallback.c

index 85c3bf2..caeaa56 100644

--- a/mama/c_cpp/src/c/listenermsgcallback.c

+++ b/mama/c_cpp/src/c/listenermsgcallback.c

@@ -86,7 +86,8 @@ listenerMsgCallback_create( listenerMsgCallback *result,

     msgCallback* callback = (msgCallback*)calloc( 1, sizeof( msgCallback ) );

 

 #ifdef WITH_ENTITLEMENTS  /* No listener creation without a client. */

-    if( gEntitlementClient == 0 )

+    mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(subscription);

+    if( gEntitlementClient == 0 && !(mamaBridgeImpl_areEntitlementsDeferred(bridge)))

     {

         return MAMA_ENTITLE_NO_SERVERS_SPECIFIED;

     }

@@ -625,7 +626,6 @@ static void handleNoSubscribers (msgCallback *callback,

static int

checkEntitlement( msgCallback *callback, mamaMsg msg, SubjectContext* ctx )

{

-

#ifdef WITH_ENTITLEMENTS

     int result = 0;

     int32_t value;

@@ -634,6 +634,17 @@ checkEntitlement( msgCallback *callback, mamaMsg msg, SubjectContext* ctx )

         return 1;

     }

 

+    mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(self->mSubscription);

+

+    if (bridge && (mamaBridgeImpl_areEntitlementsDeferred(bridge)))

+    {

+        mama_log (MAMA_LOG_LEVEL_FINER,

+                       "Deferred checking injected entitlement to %s bridge [%p]",

+                        bridge->bridgeGetName(), bridge);

+        ctx->mEntitlementAlreadyVerified = 1;

+        return 1;

+    }

+

     if( MAMA_STATUS_OK == mamaMsg_getEntitleCode( msg,

                                                   &value ) )

     {

diff --git a/mama/c_cpp/src/c/mama.c b/mama/c_cpp/src/c/mama.c

index 5e31856..1815bc0 100644

--- a/mama/c_cpp/src/c/mama.c

+++ b/mama/c_cpp/src/c/mama.c

@@ -1707,6 +1707,8 @@ enableEntitlements (const char **servers)

     const char* altUserId;

     const char* altIp;

     const char* site;

+    mamaMiddleware middleware = 0;

+    int entitlementsRequired = 0; /*boolean*/

 

 

     if (gEntitlementClient != 0)

@@ -1715,6 +1717,30 @@ enableEntitlements (const char **servers)

         gEntitlementClient = 0;

     }

 

+    for (middleware=0; middleware != MAMA_MIDDLEWARE_MAX; ++middleware)

+    {

+        mamaBridgeImpl* impl = (mamaBridgeImpl*) gImpl.myBridges [middleware];

+        if (impl)

+        {

+            /* Check if entitlements are deferred to bridge */

+            if (mamaBridgeImpl_areEntitlementsDeferred(impl) == 1)

+            {

+                mama_log (MAMA_LOG_LEVEL_WARN,

+                    "Entitlements deferred on %s bridge.",

+                    mamaMiddleware_convertToString (middleware));

+            }

+            else

+            {

+                /* Entitlements are not deferred, continue with entitlement checking */

+                entitlementsRequired = 1;

+            }

+        }

+    }

+

+    /* Entitlements are deferred, do not continue with entitlement checking */

+    if (entitlementsRequired==0)

+        return MAMA_STATUS_OK;

+

     if (servers == NULL)

     {

         if (NULL == (servers = mdrvImpl_ParseServersProperty()))

diff --git a/mama/c_cpp/src/c/subscription.c b/mama/c_cpp/src/c/subscription.c

index 1f78746..42ad347 100644

--- a/mama/c_cpp/src/c/subscription.c

+++ b/mama/c_cpp/src/c/subscription.c

@@ -450,11 +450,19 @@ mamaSubscription_setupBasic (

                   "Could not get bridge impl from transport.");

         return MAMA_STATUS_NO_BRIDGE_IMPL;

     }

-       

+

#ifdef WITH_ENTITLEMENTS

-    self->mSubjectContext.mOeaSubscription = oeaClient_newSubscription (&entitlementStatus, gEntitlementClient);

+    mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(subscription);

+    if (gEntitlementClient == 0 || mamaBridgeImpl_areEntitlementsDeferred(bridge))

+    {

+        mama_log (MAMA_LOG_LEVEL_FINER,

+                    "Entitlements checking at subscription creation deferred to %s bridge [%p]",

+                    bridge->bridgeGetName(), bridge);

+    }

+    else

+        self->mSubjectContext.mOeaSubscription = oeaClient_newSubscription (&entitlementStatus, gEntitlementClient);

#endif

-   

+

     /*Up from entitlement check based on string compare on symbol*/

     if (!isEntitledToSymbol (source, symbol, self))

     {

@@ -476,7 +484,9 @@ mamaSubscription_setupBasic (

             if (!self->mRequiresInitial) return MAMA_STATUS_INVALID_ARG;

             subscMsgType = MAMA_SUBSC_SNAPSHOT;

#ifdef WITH_ENTITLEMENTS

-            oeaSubscription_setIsSnapshot (self->mSubjectContext.mOeaSubscription, 1);

+            mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(subscription);

+            if (!(gEntitlementClient == 0 || mamaBridgeImpl_areEntitlementsDeferred(bridge)))

+                oeaSubscription_setIsSnapshot (self->mSubjectContext.mOeaSubscription, 1);

#endif

             break;

         case MAMA_SERVICE_LEVEL_CONFLATED:/*fall through*/

@@ -1184,7 +1194,9 @@ mamaSubscription_getSubjectContext (mamaSubscription subscription,

         msgUtils_getIssueSymbol (msg, &issueSymbol);

         context->mSymbol = copyString (issueSymbol);

         #ifdef WITH_ENTITLEMENTS

-        context->mOeaSubscription = oeaClient_newSubscription (&entitlementStatus, gEntitlementClient);

+        mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(subscription);

+        if (!(gEntitlementClient == 0 || mamaBridgeImpl_areEntitlementsDeferred(bridge)))

+            context->mOeaSubscription = oeaClient_newSubscription (&entitlementStatus, gEntitlementClient);

         #endif

 

         wtable_insert (self->mSubjects, (char*)sendSubject, (void*)context);

@@ -2048,7 +2060,9 @@ mamaSubscription_processTportMsg( mamaSubscription subscription,

     }

 

 #ifdef WITH_ENTITLEMENTS

-    mamaMsg_getEntitleCode (msg, &entitleCode);

+    mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(subscription);

+    if (!(gEntitlementClient == 0 || mamaBridgeImpl_areEntitlementsDeferred(bridge)))

+        mamaMsg_getEntitleCode (msg, &entitleCode);

#endif

     if (entitleCode == 0)

     {

@@ -2100,7 +2114,9 @@ mamaSubscription_processWildCardMsg( mamaSubscription subscription,

     }

 

 #ifdef WITH_ENTITLEMENTS

-    mamaMsg_getEntitleCode (msg, &entitleCode);

+    mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(subscription);

+    if (!(gEntitlementClient == 0 || mamaBridgeImpl_areEntitlementsDeferred(bridge)))

+        mamaMsg_getEntitleCode (msg, &entitleCode);

#endif

     if (entitleCode == 0)

     {

@@ -2173,7 +2189,9 @@ mamaSubscription_processMsg (mamaSubscription subscription, mamaMsg msg)

     {

         int32_t entitleCode = 0;

#ifdef WITH_ENTITLEMENTS

-        mamaMsg_getEntitleCode (msg, &entitleCode);

+        mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(subscription);

+        if (!(gEntitlementClient == 0 || mamaBridgeImpl_areEntitlementsDeferred(bridge)))

+            mamaMsg_getEntitleCode (msg, &entitleCode);

#endif

         if (entitleCode == 0)

         {

@@ -2412,7 +2430,9 @@ isEntitledToSymbol (const char *source, const char*symbol, mamaSubscription subs

 

     snprintf (subject, WOMBAT_SUBJECT_MAX, "%s.%s", source, symbol);

 

-    if (gEntitlementClient == 0) /* Not enforcing entitlements. */

+    mamaBridgeImpl* bridge = mamaSubscription_getBridgeImpl(subscription);

+

+    if (gEntitlementClient == 0 || mamaBridgeImpl_areEntitlementsDeferred(bridge)) /* Not enforcing entitlements. */

     {

         return 1;

     }

--

1.7.1

 

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 


Re: [PATCH 1/3] [MAMAC] mamaPlugin Feature - additional

Gary Molloy <g.molloy@...>
 

From 76a6db152998cbb32de58eb1cb9d6c1ab9307a1e Mon Sep 17 00:00:00 2001

From: Gary Molloy <g.molloy@...>

Date: Wed, 29 Apr 2015 13:05:23 -0400

Subject: [PATCH] [MAMAC] mamaPlugin Feature - addition

 

Addition to the existing mamaPlugin patch to remove references to internal shared objects and a missing null check.

 

Signed-off-by: Gary Molloy <g.molloy@...>

---

mama/c_cpp/src/c/plugin.c |   61 ++++++++++++++++++++------------------------

1 files changed, 28 insertions(+), 33 deletions(-)

 

diff --git a/mama/c_cpp/src/c/plugin.c b/mama/c_cpp/src/c/plugin.c

index b6475fe..303ab9f 100644

--- a/mama/c_cpp/src/c/plugin.c

+++ b/mama/c_cpp/src/c/plugin.c

@@ -216,9 +216,6 @@ mama_initPlugins(void)

         }

     }

-    mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising mamacenterprise");

-    mama_loadPlugin ("mamacenterprise");

-

     return MAMA_STATUS_OK;

}

@@ -243,15 +240,10 @@ mama_loadPlugin (const char* pluginName)

     if (pluginImpl == NULL)

     {

        /* The plugin name should be of the format mamaplugin<name> */

-        if (strncmp(pluginName, "mamacenterprise", MAX_PLUGIN_STRING) == 0)

-            snprintf(loadPluginName, MAX_PLUGIN_STRING,

-                "%s",

-                pluginName);

-        else

-            snprintf(loadPluginName, MAX_PLUGIN_STRING,

-                "%s%s",

-                PLUGIN_NAME,

-                pluginName);

+        snprintf(loadPluginName, MAX_PLUGIN_STRING,

+            "%s%s",

+            PLUGIN_NAME,

+            pluginName);

         pluginLib = openSharedLib (loadPluginName, NULL);

@@ -345,31 +337,34 @@ mama_shutdownPlugins (void)

     for (plugin = 0; plugin <= gPluginNo; plugin++)

     {

-        if (gPlugins[plugin]->mPluginHandle != NULL)

+        if (gPlugins[plugin] != NULL)

         {

-            /* Fire the user shutdown hook first - if one is present */

-            if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)

+            if (gPlugins[plugin]->mPluginHandle != NULL)

             {

-                gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);

-            }

+                /* Fire the user shutdown hook first - if one is present */

+                if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)

+                {

+                    gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);

+                }

-            ret = closeSharedLib (gPlugins[plugin]->mPluginHandle);

-            if (0!=ret)

-            {

-                 mama_log (MAMA_LOG_LEVEL_WARN,

-                            "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]",

-                            gPlugins[plugin]->mPluginName);

-            }

-            else

-            {

-                 mama_log (MAMA_LOG_LEVEL_WARN,

-                            "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed",

-                            gPlugins[plugin]->mPluginName);

-            }

+                ret = closeSharedLib (gPlugins[plugin]->mPluginHandle);

+                if (0!=ret)

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]",

+                                gPlugins[plugin]->mPluginName);

+                }

+                else

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed",

+                                gPlugins[plugin]->mPluginName);

+                }

-            free ((char*)gPlugins[plugin]->mPluginName);

-            free (gPlugins[plugin]);

-            gPlugins[plugin] = NULL;

+                free ((char*)gPlugins[plugin]->mPluginName);

+                free (gPlugins[plugin]);

+                gPlugins[plugin] = NULL;

+            }

         }

     }

     return status;

--

1.7.1

 

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Gary Molloy
Sent: 23 April 2015 17:54
To: openmama-dev@...
Subject: [Openmama-dev] [PATCH 1/3] [MAMAC] mamaPlugin Feature

 

Testing Strategy:-

Not middleware or O/S specific. 
 

Using the attached template you can create your own plugin and load it in via your mama.properties, for example:

 

mama.plugin.name_0=template

 

You can run up a mamaPublisher to test your plugin, for example:

 

mamapublisherc -tport pub -m wmw -l MAMA_INBOUND_TOPIC -v -v -v -v -v

 

You can expect to see output similar this if your plugin was loaded successfully:

 

2015-04-09 13:45:02: (f9018280) : mama_initPlugins(): Initialising [mama.plugin.name_0] template 

2015-04-09 13:45:02: (f9018280) : mama_loadPlugin(): Sucessfully registered plugin functions for [template] 

2015-04-09 13:45:02: (f9018280) : mama_loadPlugin(): Successfully run the init hook for mama plugin [template]  

 

If your plugin was not loaded successful you can expect to see output similar to this:

 

2015-04-09 13:45:02: (f9018280) : mama_initPlugins(): Initialising [mama.plugin.name_0] template 

2015-04-09 13:45:02: (f9018280) : mamaPlugin_registerFunctions(): Cannot load plugin, does not implement required function: [templateMamaPlugin_shutdownHook] 

2015-04-09 13:45:02: (f9018280) : mama_loadPlugin(): Failed to register plugin functions for [template] 

 

Further documentation on the mamaPlugin feature will be available shortly which will provide more details on the feature which will include the various hooks available etc...

 

 

=========================================================================================================

 

From e2a6a3f9c5750cee780cb6185a1310b4e4b70629 Mon Sep 17 00:00:00 2001

From: Gary Molloy <g.molloy@...>

Date: Thu, 23 Apr 2015 11:22:14 -0400

Subject: [PATCH 1/3] [MAMAC] mamaPlugin Feature

 

A new feature, mamaPlugin has been introduced that will allow you to

create and run your own code within 'hooks' into the MAMA codebase.

 

A mamaPlugin is essentially a shared object.

 

Signed-off-by: Gary Molloy <g.molloy@...>

---

mama/c_cpp/src/c/Makefile.am    |    1 +

mama/c_cpp/src/c/SConscript     |    1 +

mama/c_cpp/src/c/SConscript.win |    1 +

mama/c_cpp/src/c/mama.c         |   10 +-

mama/c_cpp/src/c/mama/types.h   |   10 +

mama/c_cpp/src/c/plugin.c       |  472 +++++++++++++++++++++++++++++++++++++++

mama/c_cpp/src/c/plugin.h       |   59 +++++

mama/c_cpp/src/c/publisher.c    |   10 +

mama/c_cpp/src/c/transport.c    |   21 ++-

9 files changed, 579 insertions(+), 6 deletions(-)

create mode 100644 mama/c_cpp/src/c/plugin.c

create mode 100644 mama/c_cpp/src/c/plugin.h

 

diff --git a/mama/c_cpp/src/c/Makefile.am b/mama/c_cpp/src/c/Makefile.am

index c831ce4..318c353 100644

--- a/mama/c_cpp/src/c/Makefile.am

+++ b/mama/c_cpp/src/c/Makefile.am

@@ -131,6 +131,7 @@ libmama_la_SOURCES = \

     mamaStrUtils.h \

     mamaStrUtils.c \

               marketdata.c \

+    plugin.c \

     middleware.c \

               msg.c \

               msgfield.c \

diff --git a/mama/c_cpp/src/c/SConscript b/mama/c_cpp/src/c/SConscript

index 4362f50..f47e18c 100644

--- a/mama/c_cpp/src/c/SConscript

+++ b/mama/c_cpp/src/c/SConscript

@@ -98,6 +98,7 @@ libmama_sources = \

     mama.c

     mamaStrUtils.c

               marketdata.c

+    plugin.c

     middleware.c

               msg.c

               msgfield.c

diff --git a/mama/c_cpp/src/c/SConscript.win b/mama/c_cpp/src/c/SConscript.win

index 77e3e18..9a6ff05 100644

--- a/mama/c_cpp/src/c/SConscript.win

+++ b/mama/c_cpp/src/c/SConscript.win

@@ -50,6 +50,7 @@ dqpublishermanager.c

inbox.c

msgtype.c

msgutils.c

+plugin.c

senderId.c

reservedfields.c

subscription.c

diff --git a/mama/c_cpp/src/c/mama.c b/mama/c_cpp/src/c/mama.c

index 33a0768..5e31856 100644

--- a/mama/c_cpp/src/c/mama.c

+++ b/mama/c_cpp/src/c/mama.c

@@ -35,6 +35,7 @@

#include <payloadbridge.h>

#include <property.h>

#include <platform.h>

+#include <plugin.h>

 

 #include "fileutils.h"

#include "reservedfieldsimpl.h"

@@ -42,7 +43,6 @@

#include <mama/stat.h>

#include <mama/statfields.h>

#include <statsgeneratorinternal.h>

-#include <statsgeneratorinternal.h>

#include <mama/statscollector.h>

#include "transportimpl.h"

 

@@ -740,6 +740,9 @@ mama_openWithPropertiesCount (const char* path,

                               }

     }

 

+    /* This will initialise all plugins */

+    mama_initPlugins();

+

     prop = properties_Get (gProperties, "mama.catchcallbackexceptions.enable");

     if (prop != NULL && strtobool(prop))

     {

@@ -1253,9 +1256,12 @@ mama_closeCount (unsigned int* count)

                 gImpl.myPayloadLibraries[(uint8_t)payload] = NULL;

             }

         }

-       

+

        gDefaultPayload = NULL;

 

+       /* This will shutdown all plugins */

+       mama_shutdownPlugins();

+

         /* Look for a bridge for each of the middlewares and close them */

         for (middleware = 0; middleware != MAMA_MIDDLEWARE_MAX; ++middleware)

         {

diff --git a/mama/c_cpp/src/c/mama/types.h b/mama/c_cpp/src/c/mama/types.h

index 50d6608..03f6da8 100644

--- a/mama/c_cpp/src/c/mama/types.h

+++ b/mama/c_cpp/src/c/mama/types.h

@@ -74,6 +74,16 @@ typedef struct mamaBridgeImpl_* mamaBridge;

typedef struct mamaPayloadBridgeImpl_* mamaPayloadBridge;

 

 /**

+ * @brief Container for holding a mama plugin object

+ */

+typedef struct mamaPluginImpl_*     mamaPlugin;

+

+/**

+ * @brief Container for holding a mama plugin info

+ */

+typedef void*       mamaPluginInfo;

+

+/**

  * Flexible date/time format

  */

typedef   mama_u64_t*   mamaDateTime;

diff --git a/mama/c_cpp/src/c/plugin.c b/mama/c_cpp/src/c/plugin.c

new file mode 100644

index 0000000..b6475fe

--- /dev/null

+++ b/mama/c_cpp/src/c/plugin.c

@@ -0,0 +1,472 @@

+/* $Id$

+ *

+ * OpenMAMA: The open middleware agnostic messaging API

+ * Copyright (C) 2011 NYSE Technologies, Inc.

+ *

+ * This library is free software; you can redistribute it and/or

+ * modify it under the terms of the GNU Lesser General Public

+ * License as published by the Free Software Foundation; either

+ * version 2.1 of the License, or (at your option) any later version.

+ *

+ * This library is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

+ * Lesser General Public License for more details.

+ *

+ * You should have received a copy of the GNU Lesser General Public

+ * License along with this library; if not, write to the Free Software

+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA

+ * 02110-1301 USA

+ */

+

+#include <string.h>

+#include <stdio.h>

+#include <limits.h>

+

+#include "wombat/port.h"

+#include "wombat/environment.h"

+#include "wombat/strutils.h"

+#include <wombat/wtable.h>

+

+#include <mama/mama.h>

+#include <mama/error.h>

+#include <mamainternal.h>

+#include <mama/version.h>

+#include <property.h>

+#include <plugin.h>

+#include <platform.h>

+

+#define PLUGIN_PROPERTY "mama.plugin.name_"

+#define PLUGIN_NAME "mamaplugin"

+

+#define MAX_PLUGINS 100

+#define MAX_PLUGIN_STRING 1024

+

+#define MAX_FUNC_STRING 256

+

+/**

+ * @brief Mechanism for registering required plugin functions.

+ *

+ * Taking a function string name search the shared library handle, using the

+ * loadLibFunc portability method, for the function. If it is found, set the

+ * appropriate function pointer in the plugin struct to the result. If not,

+ * log as an error the fact that the funciton cannot be found, and return

+ * MAMA_STATUS_PLATFORM

+ *

+ * @param FUNCSTRINGNAME The string function name.

+ * @param FUNCIMPLNAME The name of the function pointer in the plugin struct

+ * @param FUNCIMPLTYPE The type of the function pointer expected.

+ */

+#define REGISTER_PLUGIN_FUNCTION(FUNCSTRINGNAME, FUNCIMPLNAME, FUNCIMPLTYPE)    \

+do {                                                                            \

+    snprintf (functionName, MAX_FUNC_STRING, "%s"#FUNCSTRINGNAME, name);        \

+    result = loadLibFunc (pluginLib, functionName);                             \

+                                                                                \

+    if (NULL != result) {                                                       \

+        (pluginImpl)->FUNCIMPLNAME = *(FUNCIMPLTYPE*)&result;                   \

+        result = NULL;                                                          \

+    } else {                                                                    \

+        mama_log (MAMA_LOG_LEVEL_ERROR,                                         \

+                  "mamaPlugin_registerFunctions(): "                            \

+                  "Cannot load plugin, does not implement required function: [%s]",\

+                  functionName);                                                \

+        status = MAMA_STATUS_PLATFORM;                                          \

+        return status;                                                          \

+    }                                                                           \

+} while (0)

+

+/**

+ * @brief Mechanism for registering required plugin functions.

+ *

+ * Taking a function string name search the shared library handle, using the

+ * loadLibFunc portability method, for the function. If it is found, set the

+ * appropriate function pointer in the plugin struct to the result. If not

+ * log the fact that the function has not been found, and continue.

+ *

+ * @param FUNCSTRINGNAME The string function name.

+ * @param FUNCIMPLNAME The name of the function pointer in the plugin struct

+ * @param FUNCIMPLTYPE The type of the function pointer expected.

+ */

+#define REGISTER_OPTIONAL_PLUGIN_FUNCTION(FUNCSTRINGNAME,                       \

+                                          FUNCIMPLNAME,                         \

+                                          FUNCIMPLTYPE)                         \

+do {                                                                            \

+    snprintf (functionName, MAX_FUNC_STRING, "%s"#FUNCSTRINGNAME, name);        \

+    result = loadLibFunc (pluginLib, functionName);                             \

+                                                                                \

+    if (NULL != result) {                                                       \

+        (pluginImpl)->FUNCIMPLNAME = *(FUNCIMPLTYPE*)&result;                   \

+        result = NULL;                                                          \

+    } else {                                                                    \

+        mama_log (MAMA_LOG_LEVEL_FINE,                                          \

+                  "mamaPlugin_registerFunctions(): "                            \

+                  "Optional plugin function [%s] not found. Unavailable.",      \

+                  functionName);                                                \

+    }                                                                           \

+} while (0)

+

+typedef struct mamaPluginImpl_

+{

+    LIB_HANDLE          mPluginHandle;

+    char*               mPluginName;

+    mamaPluginInfo      mPluginInfo;

+

+    mamaPlugin_publisherPreSendHook     mamaPluginPublisherPreSendHook;

+    mamaPlugin_transportPostCreateHook  mamaPluginTransportPostCreateHook;

+    mamaPlugin_shutdownHook             mamaPluginShutdownHook;

+    mamaPlugin_initHook                 mamaPluginInitHook;

+

+} mamaPluginImpl;

+

+static mamaPluginImpl*      gPlugins[MAX_PLUGINS];

+static volatile int         gPluginNo = 0;

+

+/**

+ * @brief Used to load register all possible plugin functions to be

+ *        used within Mama.

+ *

+ * param[in] pluginLib

+ * param[in] name

+ * param[in] pluginImpl The plugin impl to be used

+ *

+ * @return mama_status return code can be one of:

+ *          MAMA_STATUS_OK

+ */

+mama_status

+mamaPlugin_registerFunctions   (LIB_HANDLE      pluginLib,

+                                const char*     name,

+                                mamaPluginInfo  pluginInfo,

+                                mamaPluginImpl* pluginImpl);

+

+/**

+ * @brief Used find a plugin using the library name

+ *

+ * param[in] name

+ *

+ * @return a valid mamaPluginImpl if found

+ */

+mamaPluginImpl*

+mamaPlugin_findPlugin (const char* name);

+

+/**

+ * @brief Used find a plugin using the library name

+ *

+ * param[in] pluginName

+ *

+ * @return mama_status return code can be one of:

+ *          MAMA_STATUS_OK

+ */

+mama_status

+mama_loadPlugin (const char* pluginName);

+

+

+/**

+ * Register function pointers associated with a specific plugin.

+ */

+mama_status

+mamaPlugin_registerFunctions (LIB_HANDLE      pluginLib,

+                              const char*     name,

+                              mamaPluginInfo  pluginInfo,

+                              mamaPluginImpl* pluginImpl)

+{

+    mama_status  status        = MAMA_STATUS_OK;

+    void*        result        = NULL;

+    char         functionName[MAX_FUNC_STRING];

+

+    /* Save off some informatin on the plugin */

+    pluginImpl->mPluginHandle = pluginLib;

+    pluginImpl->mPluginName = strdup(name);

+    pluginImpl->mPluginInfo = pluginInfo;

+

+

+    /* Required fuctions */

+    REGISTER_PLUGIN_FUNCTION (MamaPlugin_initHook, mamaPluginInitHook,

+                              mamaPlugin_initHook);

+    REGISTER_PLUGIN_FUNCTION (MamaPlugin_shutdownHook, mamaPluginShutdownHook,

+                              mamaPlugin_shutdownHook);

+

+

+    /* Optional fuctions */

+    REGISTER_OPTIONAL_PLUGIN_FUNCTION (MamaPlugin_publisherPreSendHook, mamaPluginPublisherPreSendHook,

+                                       mamaPlugin_publisherPreSendHook);

+    REGISTER_OPTIONAL_PLUGIN_FUNCTION (MamaPlugin_transportPostCreateHook, mamaPluginTransportPostCreateHook,

+                                       mamaPlugin_transportPostCreateHook);

+

+   return status;

+}

+

+mama_status

+mama_initPlugins(void)

+{

+    int             pluginCount      = 0;

+    const char*     prop             = NULL;

+    char            propString[MAX_PLUGIN_STRING];

+

+    for (pluginCount = 0; pluginCount < MAX_PLUGINS; pluginCount++)

+    {

+        snprintf(propString, MAX_PLUGIN_STRING,

+            PLUGIN_PROPERTY"%d",

+            pluginCount);

+

+        prop = properties_Get (mamaInternal_getProperties (), propString);

+        if (prop != NULL && strlen(prop)!= 0)

+        {

+            mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising [%s] %s", propString, prop);

+            mama_loadPlugin (prop);

+        }

+    }

+

+    mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising mamacenterprise");

+    mama_loadPlugin ("mamacenterprise");

+

+    return MAMA_STATUS_OK;

+}

+

+mama_status

+mama_loadPlugin (const char* pluginName)

+{

+    LIB_HANDLE              pluginLib       = NULL;

+    mamaPluginImpl*         pluginImpl      = NULL;

+    mama_status             status          = MAMA_STATUS_OK;

+    mamaPluginInfo          pluginInfo      = NULL;

+    char                    loadPluginName  [MAX_PLUGIN_STRING];

+    mamaPluginImpl*         aPluginImpl     = NULL;

+

+    if (!pluginName)

+        return MAMA_STATUS_NULL_ARG;

+

+    pluginImpl = mamaPlugin_findPlugin(pluginName);

+

+    /*

+     * Check to see if pluginImpl has already been loaded

+     */

+    if (pluginImpl == NULL)

+    {

+       /* The plugin name should be of the format mamaplugin<name> */

+        if (strncmp(pluginName, "mamacenterprise", MAX_PLUGIN_STRING) == 0)

+            snprintf(loadPluginName, MAX_PLUGIN_STRING,

+                "%s",

+                pluginName);

+        else

+            snprintf(loadPluginName, MAX_PLUGIN_STRING,

+                "%s%s",

+                PLUGIN_NAME,

+                pluginName);

+

+        pluginLib = openSharedLib (loadPluginName, NULL);

+

+        if (!pluginLib)

+        {

+

+           mama_log (MAMA_LOG_LEVEL_ERROR,

+                    "mama_loadPlugin(): "

+                    "Could not open plugin library [%s] [%s]",

+                    pluginName,

+                    getLibError());

+            return MAMA_STATUS_PLATFORM;

+        }

+

+        /* Create structure to hold plugin information */

+        aPluginImpl = (mamaPluginImpl*)calloc (1, sizeof(mamaPluginImpl));

+

+        status = mamaPlugin_registerFunctions (pluginLib,

+                                               pluginName,

+                                               pluginInfo,

+                                               aPluginImpl);

+

+        if (MAMA_STATUS_OK == status)

+        {

+            mama_log (MAMA_LOG_LEVEL_NORMAL,

+                     "mama_loadPlugin(): "

+                     "Sucessfully registered plugin functions for [%s]",

+                     pluginName);

+

+        }

+        else

+        {

+            mama_log (MAMA_LOG_LEVEL_WARN,

+                     "mama_loadPlugin(): "

+                     "Failed to register plugin functions for [%s]",

+                     pluginName);

+

+            closeSharedLib (aPluginImpl->mPluginHandle);

+

+            free ((char*)aPluginImpl->mPluginName);

+            free ((mamaPluginImpl*)aPluginImpl);

+

+            return status;

+        }

+

+        /* Invoke the init function */

+        status = aPluginImpl->mamaPluginInitHook (aPluginImpl->mPluginInfo);

+

+        if (MAMA_STATUS_OK == status)

+        {

+            mama_log (MAMA_LOG_LEVEL_NORMAL,

+                      "mama_loadPlugin(): Successfully run the init hook for mama plugin [%s]",

+                       aPluginImpl->mPluginName);

+        }

+        else

+        {

+            mama_log (MAMA_LOG_LEVEL_WARN,

+                      "mama_loadPlugin(): Init hook failed for mama plugin [%s]",

+                       aPluginImpl->mPluginName);

+

+            closeSharedLib (aPluginImpl->mPluginHandle);

+

+            free ((char*)aPluginImpl->mPluginName);

+            free ((mamaPluginImpl*)aPluginImpl);

+

+            return status;

+        }

+

+        /* Save off the plugin impl and increment the plugin counter */

+        gPlugins[gPluginNo] = aPluginImpl;

+        gPluginNo++;

+

+    }

+    else

+    {

+        mama_log (MAMA_LOG_LEVEL_NORMAL,

+                 "mama_loadPlugin(): "

+                 "Plugin [%s] has already been loaded and initialised",

+                 pluginName);

+    }

+

+    return MAMA_STATUS_OK;

+}

+

+mama_status

+mama_shutdownPlugins (void)

+{

+    mama_status  status = MAMA_STATUS_OK;

+    int          plugin = 0;

+    int          ret    = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin]->mPluginHandle != NULL)

+        {

+            /* Fire the user shutdown hook first - if one is present */

+            if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)

+            {

+                gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);

+            }

+

+            ret = closeSharedLib (gPlugins[plugin]->mPluginHandle);

+            if (0!=ret)

+            {

+                 mama_log (MAMA_LOG_LEVEL_WARN,

+                            "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]",

+                            gPlugins[plugin]->mPluginName);

+            }

+            else

+            {

+                 mama_log (MAMA_LOG_LEVEL_WARN,

+                            "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed",

+                            gPlugins[plugin]->mPluginName);

+            }

+

+            free ((char*)gPlugins[plugin]->mPluginName);

+            free (gPlugins[plugin]);

+            gPlugins[plugin] = NULL;

+        }

+    }

+    return status;

+}

+

+mama_status

+mamaPlugin_firePublisherPreSendHook (mamaPublisher publisher, mamaMsg message)

+{

+    mama_status  status = MAMA_STATUS_OK;

+    int          plugin = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin] != NULL)

+        {

+            if (gPlugins[plugin]->mamaPluginPublisherPreSendHook != NULL)

+            {

+                status = gPlugins[plugin]->mamaPluginPublisherPreSendHook (gPlugins[plugin]->mPluginInfo, publisher, message);

+

+                if (MAMA_STATUS_OK != status)

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mamaPlugin_firePublisherPreSendHook(): Publisher pre send hook failed for mama plugin [%s]",

+                                gPlugins[plugin]->mPluginName);

+                }

+            }

+        }

+    }

+    return status;

+}

+

+mama_status

+mamaPlugin_fireTransportPostCreateHook (mamaTransport transport)

+{

+    mama_status  status = MAMA_STATUS_OK;

+    int          plugin = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin] != NULL)

+        {

+            if (gPlugins[plugin]->mamaPluginTransportPostCreateHook != NULL)

+            {

+                status = gPlugins[plugin]->mamaPluginTransportPostCreateHook (gPlugins[plugin]->mPluginInfo, transport);

+

+                if (MAMA_STATUS_OK != status)

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mamaPlugin_fireTransportPostCreateHook(): Transport post create hook failed for mama plugin [%s]",

+                                gPlugins[plugin]->mPluginName);

+                }

+            }

+        }

+    }

+    return status;

+}

+

+mama_status

+mamaPlugin_fireShutdownHook (void)

+{

+    mama_status  status = MAMA_STATUS_OK;

+    int          plugin = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin] != NULL)

+        {

+            if (gPlugins[plugin]->mamaPluginShutdownHook != NULL)

+            {

+                status = gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo);

+

+                if (MAMA_STATUS_OK != status)

+                {

+                     mama_log (MAMA_LOG_LEVEL_WARN,

+                                "mamaPlugin_fireShutdownHook(): Shutdown hook failed for mama plugin [%s]",

+                                gPlugins[plugin]->mPluginName);

+                }

+            }

+        }

+    }

+    return status;

+}

+

+mamaPluginImpl*

+mamaPlugin_findPlugin (const char* name)

+{

+    int plugin = 0;

+

+    for (plugin = 0; plugin <= gPluginNo; plugin++)

+    {

+        if (gPlugins[plugin])

+        {

+            if ((strncmp(gPlugins[plugin]->mPluginName, name, MAX_PLUGIN_STRING) == 0))

+            {

+                return gPlugins[plugin];

+            }

+        }

+    }

+    return NULL;

+}

diff --git a/mama/c_cpp/src/c/plugin.h b/mama/c_cpp/src/c/plugin.h

new file mode 100644

index 0000000..df43b27

--- /dev/null

+++ b/mama/c_cpp/src/c/plugin.h

@@ -0,0 +1,59 @@

+/* $Id$

+ *

+ * OpenMAMA: The open middleware agnostic messaging API

+ * Copyright (C) 2011 NYSE Technologies, Inc.

+ *

+ * This library is free software; you can redistribute it and/or

+ * modify it under the terms of the GNU Lesser General Public

+ * License as published by the Free Software Foundation; either

+ * version 2.1 of the License, or (at your option) any later version.

+ *

+ * This library is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

+ * Lesser General Public License for more details.

+ *

+ * You should have received a copy of the GNU Lesser General Public

+ * License along with this library; if not, write to the Free Software

+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA

+ * 02110-1301 USA

+ */

+

+#ifndef PluginH__

+#define PluginH__

+

+

+/**

+ * @brief Containers used within the mama plugin

+ */

+typedef mama_status (*mamaPlugin_publisherPreSendHook) (mamaPluginInfo pluginInfo, mamaPublisher publisher, mamaMsg message);

+typedef mama_status (*mamaPlugin_transportPostCreateHook) (mamaPluginInfo pluginInfo, mamaTransport transport);

+typedef mama_status (*mamaPlugin_shutdownHook) (mamaPluginInfo pluginInfo);

+typedef mama_status (*mamaPlugin_initHook) (mamaPluginInfo* pluginInfo);

+

+/**

+ * Initialize the internal plugin interface

+ *

+ * @return mama status code

+ */

+extern mama_status

+mama_initPlugins (void);

+

+/**

+ * Shutdown the internal plugin interface

+ *

+ * @return mama status code

+ */

+extern mama_status

+mama_shutdownPlugins (void);

+

+extern mama_status

+mamaPlugin_firePublisherPreSendHook (mamaPublisher publisher, mamaMsg message);

+

+extern mama_status

+mamaPlugin_fireTransportPostCreateHook (mamaTransport transport);

+

+extern mama_status

+mamaPlugin_fireShutdownHook (void);

+

+#endif /* PluginH__ */

diff --git a/mama/c_cpp/src/c/publisher.c b/mama/c_cpp/src/c/publisher.c

index 4612d17..6a7f92d 100644

--- a/mama/c_cpp/src/c/publisher.c

+++ b/mama/c_cpp/src/c/publisher.c

@@ -23,6 +23,7 @@

#include "mama/publisher.h"

 

 #include "bridge.h"

+#include "plugin.h"

#include "throttle.h"

#include "transportimpl.h"

 

@@ -245,6 +246,15 @@ mamaPublisher_send (mamaPublisher publisher,

     if (!impl->mMamaPublisherBridgeImpl) return MAMA_STATUS_INVALID_ARG;

     if (!impl->mBridgeImpl) return MAMA_STATUS_NO_BRIDGE_IMPL;

 

+    /* Calling plugin hook */

+    status = mamaPlugin_firePublisherPreSendHook (publisher, msg);

+    if (MAMA_STATUS_OK != status)

+    {

+        mama_log (MAMA_LOG_LEVEL_ERROR,

+                  "mamaPublisher_send(): PublisherPreSendHook failed. Not sending message.");

+        return status;

+    }

+

     status = impl->mBridgeImpl->bridgeMamaPublisherSend

         (impl->mMamaPublisherBridgeImpl,

          msg);

diff --git a/mama/c_cpp/src/c/transport.c b/mama/c_cpp/src/c/transport.c

index 339dbc0..622f47d 100644

--- a/mama/c_cpp/src/c/transport.c

+++ b/mama/c_cpp/src/c/transport.c

@@ -25,6 +25,7 @@

 

 #include "mama/mama.h"

#include "throttle.h"

+#include "plugin.h"

#include "list.h"

#include "transportimpl.h"

#include "bridge.h"

@@ -876,10 +877,22 @@ mamaTransport_create (mamaTransport transport,

 

     if ((!self->mDisableRefresh) && (!mamaTransportInternal_disableRefreshes(name)))

     {

-        return refreshTransport_create (&self->mRefreshTransport,

-                                    (mamaTransport)self,

-                                    self->mListeners,

-                                    self->mBridgeImpl);

+        status = refreshTransport_create (&self->mRefreshTransport,

+                                          (mamaTransport)self,

+                                          self->mListeners,

+                                          self->mBridgeImpl);

+

+        if (MAMA_STATUS_OK != status)

+            return status;

+    }

+

+    /* Calling plugin hook*/

+    status = mamaPlugin_fireTransportPostCreateHook (transport);

+    if (MAMA_STATUS_OK != status)

+    {

+        mama_log (MAMA_LOG_LEVEL_ERROR,

+                  "mamaTransport_create(): TransportPostCreateHook failed with a status of %s",

+                   mamaStatus_stringForStatus(status));

     }

 

     return MAMA_STATUS_OK;

--

1.7.1

 

 

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 


Re: [Patch 2.3.2] Scons: fixes for Windows and Linux

Alpert, Reed <reed.alpert@...>
 

Yes, that looks fine, do you want me to resubmit the patch with the changes?

 

Thanks,

 

Reed.

 


Reed Alpert | Corporate & Investment Bank | Market Data Services | J.P. Morgan | 4 Metrotech Center, 23rd Floor, Brooklyn, NY 11245 | T: 718.242.5198  | M: 917.414.4613 | reed.alpert@...

Alternate Contact:  CIB PIM Trading Technology Solutions NA | CIB_PIM_Trading_Technology_Solutions_NA@...

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Gary Molloy
Sent: Monday, April 27, 2015 6:17 PM
To: Reed Alpert; openmama-dev@...
Subject: Re: [Openmama-dev] [Patch 2.3.2] Scons: fixes for Windows and Linux

 

Hi Reed,

 

I was just wondering if you had time to review my comments?

 

Thanks,

Gary

 

From: Gary Molloy
Sent: 17 April 2015 18:01
To: Reed Alpert; openmama-dev@...
Subject: RE: [Openmama-dev] [Patch 2.3.2] Scons: fixes for Windows and Linux

 

Hey Reed,

 

Thank you for your patch.  I have logged this as BZ-188 for you.

 

Your patch looks good.  I noticed just a few minor things:

 

The following can just be “./src/c/mama”:

 

-INPUT                  = ./src/c/mama ./src/enterprise/c/mama

+INPUT                  = ./src/c/mama ./src/c/mama

 

And the same could be applied to mama/c_cpp/doxyconfig-cpp.in

 

Thanks,

Gary

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

Tel: +44 28 9099 7580  Ext 3397

g.molloy@...

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Reed Alpert
Sent: 28 March 2015 21:19
To: openmama-dev@...
Subject: [Openmama-dev] [Patch 2.3.2] Scons: fixes for Windows and Linux

 

Hi,

 

These are against the next branch.

 

Fixes for Windows build using docs, testtools, and unittests.
Fixes for using DOS commands instead of GNU/Linux commands.
Remove reference to 'enterprise' in path names.
Add junit_home as a cmd line parm.
Add Visual Studio 11 and 12 as options (leave 10 as default).
Add MSVS_VERSION (along with existing MSVC_VERSION) to tell scons what Visual Studio version to use.

 

Thanks,

 

Reed.

 

 

diff --git a/mama/c_cpp/SConscript.win b/mama/c_cpp/SConscript.win

index 77e3157..ece0710 100644

--- a/mama/c_cpp/SConscript.win

+++ b/mama/c_cpp/SConscript.win

@@ -121,14 +121,13 @@ if env['with_testtools'] == True and 'dynamic' in env['build']:

 if (    not Media.has_key('mama/c_cpp/docs')

         and env['build'] == 'dynamic'

         and not env.GetOption('clean')

+        and env['product'] == 'mama'

         and env['with_docs'] == True ):

 

     cdoc = env.Doxygen('doxyconfig-c.in')

     cppdoc = env.Doxygen('doxyconfig-cpp.in')

 

-    env.Command( '$prefix/doc/mama/images', cdoc, 'mkdir $TARGET && cp -rf %s\mama\c_cpp\doc\images\* $TARGET' % ( env['TOPLEVEL'] ) )

-    env.Command( '$prefix/doc/mama/c/html', cdoc, 'mkdir $TARGET && cp -rf %s\mama\c_cpp\doc\c\html\* $TARGET' % ( env['TOPLEVEL'] ) )

-    env.Command( '$prefix/doc/mama/cpp/html', cppdoc, 'mkdir $TARGET && cp -rf %s\mama\c_cpp\doc\cpp\html\* $TARGET' % ( env['TOPLEVEL'] ) )

+    env.Command( '$prefix/doc/mama', '', 'mkdir $TARGET && xcopy /q /s /e /y %s\mama\c_cpp\doc\* $TARGET' % ( env['TOPLEVEL'] ) )

 

     env.Clean( cdoc, '%s/mama/c_cpp/doc/c' % (env['TOPLEVEL']) )

     env.Clean( cppdoc, '%s/mama/c_cpp/doc/cpp' % (env['TOPLEVEL']) )

diff --git a/mama/c_cpp/doxyconfig-c.in b/mama/c_cpp/doxyconfig-c.in

index 9e03518..b92b005 100644

--- a/mama/c_cpp/doxyconfig-c.in

+++ b/mama/c_cpp/doxyconfig-c.in

@@ -754,7 +754,7 @@ WARN_LOGFILE           =

 # spaces.

 # Note: If this tag is empty the current directory is searched.

 

-INPUT                  = ./src/c/mama ./src/enterprise/c/mama

+INPUT                  = ./src/c/mama ./src/c/mama

 

 # This tag can be used to specify the character encoding of the source files

 # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

diff --git a/mama/jni/SConscript b/mama/jni/SConscript

index 6d4173d..61a3570 100644

--- a/mama/jni/SConscript

+++ b/mama/jni/SConscript

@@ -20,6 +20,9 @@ testtools_source = Split("""

 

 testtools = []

 

+unittest_source = Glob('src/junittests')

+unittest = []

+

 jExamples = Glob('src/com/wombat/mama/examples/*java')

 

 version = env['versions']['mama']['releaseString']

@@ -43,14 +46,20 @@ if env['with_testtools'] == True:

     for t in testtools_source:

         testtools.append( env.Java( 'classes', t ) )

 

+if env['with_unittest'] == True:

+    for t in unittest_source:

+        unittest.append( env.Java( 'classes', t ) )

+        env.Append(JAVACLASSPATH = ('$junit_home/junit.jar'))

+

 env.Depends( mama_classes, common_classes )

 env.Depends( testtools, mama_classes )

+env.Depends( unittest, mama_classes )

 

 # Builds all of the header files which is unnecessary but no reason not to

 # do this

 headers = env.JavaH(target=Dir('src/c/mamajni').abspath,source= [ mama_classes, common_classes ])

 

-env.Depends( headers, [ mama_classes, common_classes, testtools ] )

+env.Depends( headers, [ mama_classes, common_classes, testtools, unittest ] )

 

 jar = env.Jar(target='mamajni.jar', source='classes', JARCHDIR = Dir('classes').abspath  )

 

diff --git a/mamda/c_cpp/SConscript.win b/mamda/c_cpp/SConscript.win

index 4c63b51..0a67d48 100644

--- a/mamda/c_cpp/SConscript.win

+++ b/mamda/c_cpp/SConscript.win

@@ -113,7 +113,7 @@ if env['with_unittest'] == True:

 if ( env['with_docs'] == True and not Media.has_key('mamda/c_cpp/docs') and env['build'] == 'dynamic' and not env.GetOption('clean') ):

    cppdoc = env.Doxygen('doxyconfig-cpp.in')

 

-   env.Command( '$prefix/doc/mamda/cpp/html', cppdoc, 'mkdir $TARGET && cp -rf %s\mamda\c_cpp\doc\cpp\html\* $TARGET' % ( env['TOPLEVEL'] ) )

+   env.Command( '$prefix/doc/mamda', cppdoc, 'mkdir $TARGET && xcopy /q /s /e /y  %s\mamda\c_cpp\doc\* $TARGET' % ( env['TOPLEVEL'] ) )

 

    env.Clean( cppdoc, '%s/mamda/c_cpp/doc/cpp' % (env['TOPLEVEL']) )

 

diff --git a/site_scons/community/command_line.py b/site_scons/community/command_line.py

index e1791e2..4bbacc5 100644

--- a/site_scons/community/command_line.py

+++ b/site_scons/community/command_line.py

@@ -26,6 +26,7 @@ def get_command_line_opts( host, products, VERSIONS ):

        BoolVariable('with_examples','Build with test tools',True),

        BoolVariable('entitled','Whether the build is entitled or unentitled',False),

        PathVariable('gtest_home','Path to Google Test home',None, PathVariable.PathIsDir),

+       PathVariable('junit_home','Path to Junit home',None, PathVariable.PathIsDir),

        ListVariable('middleware','Middleware(s) to be compiled in', 'avis', names = ['avis', 'qpid'] ),

        ('jobs', 'Number of scons threads to spawn, if n is passed the number of availabe cores is calculated and used', '1'),

 

@@ -39,7 +40,7 @@ def get_command_line_opts( host, products, VERSIONS ):

             PathVariable('qpid_home', 'Path to QPID Proton Libraries',

                           'c:\\proton', PathVariable.PathAccept),

             EnumVariable('vsver','Visual Studio Version to use', '10.0',

-                allowed_values=('8.0','9.0','10.0')),

+                allowed_values=('8.0','9.0','10.0','11.0','12.0')),

             EnumVariable('product', 'Product to be built', 'mamda',

                      allowed_values=( products )),

             EnumVariable('dotnet_version', 'Dotnet Version used to determine framework directory', '2.0',

@@ -63,6 +64,8 @@ def get_command_line_opts( host, products, VERSIONS ):

             EnumVariable('product', 'Product to be built', 'mamda',

                          #mamda all is a windows only build

                          allowed_values=( [ x for x in products if x != "mamdaall" ] )),

+            EnumVariable('target_arch', 'Specifies if the build should target 32 or 64 bit architectures.',

+                          host['arch'], allowed_values=['x86', 'x86_64']),

             EnumVariable( 'compiler', 'Compiler to use for building OpenMAMA',

                          'default', allowed_values=('default', 'gcc', 'clang', 'clang-analyzer')),

         )

diff --git a/site_scons/community/windows.py b/site_scons/community/windows.py

index 362f697..80c241d 100644

--- a/site_scons/community/windows.py

+++ b/site_scons/community/windows.py

@@ -64,8 +64,10 @@ class Windows:

             env = Environment(ENV={

                 'JAVA_HOME': '%s' % (optsEnv['java_home']),

                 'PATH': '%s:%s\\bin' % (os.environ['PATH'], optsEnv['java_home']),

-                'MSVC_VERSION' : '%s' %(optsEnv['vsver'])},

+                },

                 tools = tools,

+                MSVC_VERSION = optsEnv['vsver'],

+                MSVS_VERSION = optsEnv['vsver'],

                 TARGET_ARCH = optsEnv['target_arch'])

 

             #ConfigureJNI searches os.env for java_home not env['ENV']['JAVA_HOME'] 

@@ -78,7 +80,7 @@ class Windows:

             env['JAVAH'] = 'javah'

 

         else:

-            env = Environment(ENV={'PATH': '%s' % (os.environ['PATH'])}, MSVC_VERSION = optsEnv['vsver'], tools = tools, TARGET_ARCH = optsEnv['target_arch'])

+            env = Environment(ENV={'PATH': '%s' % (os.environ['PATH'])}, MSVC_VERSION = optsEnv['vsver'], MSVS_VERSION = optsEnv['vsver'], tools = tools, TARGET_ARCH = optsEnv['target_arch'])

 

         env['SPAWN'] = logger.log_output

         env['PRINT_CMD_LINE_FUNC'] = logger.log_command

@@ -196,7 +198,7 @@ class Windows:

     # Configures all of the appropriate environment variables for windows.

     def configure(self, env ):

         env.Append( CPPDEFINES = ['WIN32'] )

-        env.Append( CCFLAGS = ['-EHsc','/GR','/FIwombat\\targetsxs.h'] )

+        env.Append( CCFLAGS = ['/EHsc','/GR','/FIwombat\\targetsxs.h'] )

         env.Append( LINKFLAGS =['/MANIFEST'] )

         env.Append( CCPDBFLAGS = '/Fd${TARGET}.pdb' )

         env.Append( PDB = '${TARGET.base}.pdb')

 

This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates (collectively, "JPMC"). This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Although this transmission and any attachments are believed to be free of any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMC for any loss or damage arising in any way from its use. Please note that any electronic communication that is conducted within or through JPMC's systems is subject to interception, monitoring, review, retention and external production in accordance with JPMC's policy and local laws, rules and regulations; may be stored or otherwise processed in countries other than the country in which you are located; and will be treated in accordance with JPMC policies and applicable laws and regulations. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


Re: OpenMAMA-2.3.3

Keith Rudd
 

Classification: Public

Thanks Gavin.

We’ll take a look at it then.

 

Cheers,

Keith

 

From: Gary Molloy [mailto:g.molloy@...]
Sent: 27 April 2015 16:22
To: Keith Rudd; Openmama-dev@...
Subject: RE: OpenMAMA-2.3.3

 

Hi Keith,

 

Thanks for your email.

 

The plan is to try to finish up the issues for the next release by the end of this week (beginning of next week) and then cut the next branch so that the community can begin testing it with the view to have it completed by the end of May.

 

Thanks,

Gary

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 

From: Keith Rudd [mailto:keith.rudd@...]
Sent: 27 April 2015 14:58
To: Gary Molloy; Openmama-dev@...
Subject: RE: OpenMAMA-2.3.3

 

Classification: Public

Is there a planned/target release date for OpenMAMA 2.3.3 ?

 

Regards,

Keith

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Gary Molloy
Sent: 24 February 2015 12:16
To: Openmama-dev@...
Subject: Re: [Openmama-dev] OpenMAMA-2.3.3

 

Hi Guys,

 

We have updated some of the tickets being considered for this release asking for some addition information. 

 

If you would like to have other issues to be considered for this upcoming release we will require a Bugzilla ticket to be submitted first (following the submission guidelines, http://wiki.openmama.org/index.php/Patch_submission)

 

We would appreciate your timely responses on these.

 

Thanks,

Gary

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 

From: Gary Molloy
Sent: 23 February 2015 15:47
To: Openmama-dev@...
Subject: OpenMAMA-2.3.3

 

Hi Guys,

 

We are currently planning the next release of OpenMAMA - OpenMAMA-2.3.3.

 

Please find below the initial list of issues that are currently scheduled for inclusion in this release:

 

BZ166    Make wInterlocked_set return the prior value

BZ164    MAMAJNI: MamaPublisher: Overload the MamaPublisher Create Method

BZ169    Wombat queue has no separate deallocate method

BZ176    MAMAC: Missing actions for snapshot subscriptions transition to deactivate state

BZ168    MAMA: Complete support for Vector Bool and Vector Char field types

BZ156    COMMON: Variable expansion in property value on the last line of properties file fails

BZ125    Payload and Middleware Unit-test in Visual Studio

BZ-114  MAMA JNI crash in MamaListen.java when using platformInfo.toString()

BZ-178  Problem with mamaDictionary_getDictionaryMessage when multiple bridges are loaded

BZ-179  OpenMAMA mock RPM's fail to build

 

If there are any issues in particular you would like to see included in the next release, please feel free to reply (with a prioritised list) and we can review them for inclusion.

 

Thanks,

Gary

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 



---
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures and to http://www.db.com/unitedkingdom/content/privacy.htm for information about privacy.



---
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures and to http://www.db.com/unitedkingdom/content/privacy.htm for information about privacy.


Re: [Patch 2.3.2] Scons: fixes for Windows and Linux

Gary Molloy <g.molloy@...>
 

Hi Reed,

 

I was just wondering if you had time to review my comments?

 

Thanks,

Gary

 

From: Gary Molloy
Sent: 17 April 2015 18:01
To: Reed Alpert; openmama-dev@...
Subject: RE: [Openmama-dev] [Patch 2.3.2] Scons: fixes for Windows and Linux

 

Hey Reed,

 

Thank you for your patch.  I have logged this as BZ-188 for you.

 

Your patch looks good.  I noticed just a few minor things:

 

The following can just be “./src/c/mama”:

 

-INPUT                  = ./src/c/mama ./src/enterprise/c/mama

+INPUT                  = ./src/c/mama ./src/c/mama

 

And the same could be applied to mama/c_cpp/doxyconfig-cpp.in

 

Thanks,

Gary

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

Tel: +44 28 9099 7580  Ext 3397

g.molloy@...

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Reed Alpert
Sent: 28 March 2015 21:19
To: openmama-dev@...
Subject: [Openmama-dev] [Patch 2.3.2] Scons: fixes for Windows and Linux

 

Hi,

 

These are against the next branch.

 

Fixes for Windows build using docs, testtools, and unittests.
Fixes for using DOS commands instead of GNU/Linux commands.
Remove reference to 'enterprise' in path names.
Add junit_home as a cmd line parm.
Add Visual Studio 11 and 12 as options (leave 10 as default).
Add MSVS_VERSION (along with existing MSVC_VERSION) to tell scons what Visual Studio version to use.

 

Thanks,

 

Reed.

 

 

diff --git a/mama/c_cpp/SConscript.win b/mama/c_cpp/SConscript.win

index 77e3157..ece0710 100644

--- a/mama/c_cpp/SConscript.win

+++ b/mama/c_cpp/SConscript.win

@@ -121,14 +121,13 @@ if env['with_testtools'] == True and 'dynamic' in env['build']:

 if (    not Media.has_key('mama/c_cpp/docs')

         and env['build'] == 'dynamic'

         and not env.GetOption('clean')

+        and env['product'] == 'mama'

         and env['with_docs'] == True ):

 

     cdoc = env.Doxygen('doxyconfig-c.in')

     cppdoc = env.Doxygen('doxyconfig-cpp.in')

 

-    env.Command( '$prefix/doc/mama/images', cdoc, 'mkdir $TARGET && cp -rf %s\mama\c_cpp\doc\images\* $TARGET' % ( env['TOPLEVEL'] ) )

-    env.Command( '$prefix/doc/mama/c/html', cdoc, 'mkdir $TARGET && cp -rf %s\mama\c_cpp\doc\c\html\* $TARGET' % ( env['TOPLEVEL'] ) )

-    env.Command( '$prefix/doc/mama/cpp/html', cppdoc, 'mkdir $TARGET && cp -rf %s\mama\c_cpp\doc\cpp\html\* $TARGET' % ( env['TOPLEVEL'] ) )

+    env.Command( '$prefix/doc/mama', '', 'mkdir $TARGET && xcopy /q /s /e /y %s\mama\c_cpp\doc\* $TARGET' % ( env['TOPLEVEL'] ) )

 

     env.Clean( cdoc, '%s/mama/c_cpp/doc/c' % (env['TOPLEVEL']) )

     env.Clean( cppdoc, '%s/mama/c_cpp/doc/cpp' % (env['TOPLEVEL']) )

diff --git a/mama/c_cpp/doxyconfig-c.in b/mama/c_cpp/doxyconfig-c.in

index 9e03518..b92b005 100644

--- a/mama/c_cpp/doxyconfig-c.in

+++ b/mama/c_cpp/doxyconfig-c.in

@@ -754,7 +754,7 @@ WARN_LOGFILE           =

 # spaces.

 # Note: If this tag is empty the current directory is searched.

 

-INPUT                  = ./src/c/mama ./src/enterprise/c/mama

+INPUT                  = ./src/c/mama ./src/c/mama

 

 # This tag can be used to specify the character encoding of the source files

 # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

diff --git a/mama/jni/SConscript b/mama/jni/SConscript

index 6d4173d..61a3570 100644

--- a/mama/jni/SConscript

+++ b/mama/jni/SConscript

@@ -20,6 +20,9 @@ testtools_source = Split("""

 

 testtools = []

 

+unittest_source = Glob('src/junittests')

+unittest = []

+

 jExamples = Glob('src/com/wombat/mama/examples/*java')

 

 version = env['versions']['mama']['releaseString']

@@ -43,14 +46,20 @@ if env['with_testtools'] == True:

     for t in testtools_source:

         testtools.append( env.Java( 'classes', t ) )

 

+if env['with_unittest'] == True:

+    for t in unittest_source:

+        unittest.append( env.Java( 'classes', t ) )

+        env.Append(JAVACLASSPATH = ('$junit_home/junit.jar'))

+

 env.Depends( mama_classes, common_classes )

 env.Depends( testtools, mama_classes )

+env.Depends( unittest, mama_classes )

 

 # Builds all of the header files which is unnecessary but no reason not to

 # do this

 headers = env.JavaH(target=Dir('src/c/mamajni').abspath,source= [ mama_classes, common_classes ])

 

-env.Depends( headers, [ mama_classes, common_classes, testtools ] )

+env.Depends( headers, [ mama_classes, common_classes, testtools, unittest ] )

 

 jar = env.Jar(target='mamajni.jar', source='classes', JARCHDIR = Dir('classes').abspath  )

 

diff --git a/mamda/c_cpp/SConscript.win b/mamda/c_cpp/SConscript.win

index 4c63b51..0a67d48 100644

--- a/mamda/c_cpp/SConscript.win

+++ b/mamda/c_cpp/SConscript.win

@@ -113,7 +113,7 @@ if env['with_unittest'] == True:

 if ( env['with_docs'] == True and not Media.has_key('mamda/c_cpp/docs') and env['build'] == 'dynamic' and not env.GetOption('clean') ):

    cppdoc = env.Doxygen('doxyconfig-cpp.in')

 

-   env.Command( '$prefix/doc/mamda/cpp/html', cppdoc, 'mkdir $TARGET && cp -rf %s\mamda\c_cpp\doc\cpp\html\* $TARGET' % ( env['TOPLEVEL'] ) )

+   env.Command( '$prefix/doc/mamda', cppdoc, 'mkdir $TARGET && xcopy /q /s /e /y  %s\mamda\c_cpp\doc\* $TARGET' % ( env['TOPLEVEL'] ) )

 

    env.Clean( cppdoc, '%s/mamda/c_cpp/doc/cpp' % (env['TOPLEVEL']) )

 

diff --git a/site_scons/community/command_line.py b/site_scons/community/command_line.py

index e1791e2..4bbacc5 100644

--- a/site_scons/community/command_line.py

+++ b/site_scons/community/command_line.py

@@ -26,6 +26,7 @@ def get_command_line_opts( host, products, VERSIONS ):

        BoolVariable('with_examples','Build with test tools',True),

        BoolVariable('entitled','Whether the build is entitled or unentitled',False),

        PathVariable('gtest_home','Path to Google Test home',None, PathVariable.PathIsDir),

+       PathVariable('junit_home','Path to Junit home',None, PathVariable.PathIsDir),

        ListVariable('middleware','Middleware(s) to be compiled in', 'avis', names = ['avis', 'qpid'] ),

        ('jobs', 'Number of scons threads to spawn, if n is passed the number of availabe cores is calculated and used', '1'),

 

@@ -39,7 +40,7 @@ def get_command_line_opts( host, products, VERSIONS ):

             PathVariable('qpid_home', 'Path to QPID Proton Libraries',

                           'c:\\proton', PathVariable.PathAccept),

             EnumVariable('vsver','Visual Studio Version to use', '10.0',

-                allowed_values=('8.0','9.0','10.0')),

+                allowed_values=('8.0','9.0','10.0','11.0','12.0')),

             EnumVariable('product', 'Product to be built', 'mamda',

                      allowed_values=( products )),

             EnumVariable('dotnet_version', 'Dotnet Version used to determine framework directory', '2.0',

@@ -63,6 +64,8 @@ def get_command_line_opts( host, products, VERSIONS ):

             EnumVariable('product', 'Product to be built', 'mamda',

                          #mamda all is a windows only build

                          allowed_values=( [ x for x in products if x != "mamdaall" ] )),

+            EnumVariable('target_arch', 'Specifies if the build should target 32 or 64 bit architectures.',

+                          host['arch'], allowed_values=['x86', 'x86_64']),

             EnumVariable( 'compiler', 'Compiler to use for building OpenMAMA',

                          'default', allowed_values=('default', 'gcc', 'clang', 'clang-analyzer')),

         )

diff --git a/site_scons/community/windows.py b/site_scons/community/windows.py

index 362f697..80c241d 100644

--- a/site_scons/community/windows.py

+++ b/site_scons/community/windows.py

@@ -64,8 +64,10 @@ class Windows:

             env = Environment(ENV={

                 'JAVA_HOME': '%s' % (optsEnv['java_home']),

                 'PATH': '%s:%s\\bin' % (os.environ['PATH'], optsEnv['java_home']),

-                'MSVC_VERSION' : '%s' %(optsEnv['vsver'])},

+                },

                 tools = tools,

+                MSVC_VERSION = optsEnv['vsver'],

+                MSVS_VERSION = optsEnv['vsver'],

                 TARGET_ARCH = optsEnv['target_arch'])

 

             #ConfigureJNI searches os.env for java_home not env['ENV']['JAVA_HOME'] 

@@ -78,7 +80,7 @@ class Windows:

             env['JAVAH'] = 'javah'

 

         else:

-            env = Environment(ENV={'PATH': '%s' % (os.environ['PATH'])}, MSVC_VERSION = optsEnv['vsver'], tools = tools, TARGET_ARCH = optsEnv['target_arch'])

+            env = Environment(ENV={'PATH': '%s' % (os.environ['PATH'])}, MSVC_VERSION = optsEnv['vsver'], MSVS_VERSION = optsEnv['vsver'], tools = tools, TARGET_ARCH = optsEnv['target_arch'])

 

         env['SPAWN'] = logger.log_output

         env['PRINT_CMD_LINE_FUNC'] = logger.log_command

@@ -196,7 +198,7 @@ class Windows:

     # Configures all of the appropriate environment variables for windows.

     def configure(self, env ):

         env.Append( CPPDEFINES = ['WIN32'] )

-        env.Append( CCFLAGS = ['-EHsc','/GR','/FIwombat\\targetsxs.h'] )

+        env.Append( CCFLAGS = ['/EHsc','/GR','/FIwombat\\targetsxs.h'] )

         env.Append( LINKFLAGS =['/MANIFEST'] )

         env.Append( CCPDBFLAGS = '/Fd${TARGET}.pdb' )

         env.Append( PDB = '${TARGET.base}.pdb')

 


Re: [PATCH 3/3] [MAMAC] mamaPublisherImpl_getTransportImpl() accessor

Alireza Assadzadeh <Alireza.Assadzadeh@...>
 

Hi Gary,

Thanks for the patch. I had some minor comments which I marked inline below with [AA:]

--Alireza

-----Original Message-----
From: openmama-dev-bounces@lists.openmama.org [mailto:openmama-
dev-bounces@lists.openmama.org] On Behalf Of Gary Molloy
Sent: Thursday, April 23, 2015 12:54 PM
To: openmama-dev@lists.openmama.org
Subject: [Openmama-dev] [PATCH 3/3] [MAMAC]
mamaPublisherImpl_getTransportImpl() accessor

[snip]

Added a new mamaPublisherImpl_getTransportImpl() accessor method
that will return the mamaTransport from the mamaPublisher.
[AA:] I suggest dropping the 'Impl' in the new function name and making it part of the public API. So, calling it mamaPublisher_getTransport.

Signed-off-by: Gary Molloy <g.molloy@srtechlabs.com>
---
mama/c_cpp/src/c/publisher.c     |    7 +++++++
mama/c_cpp/src/c/publisherimpl.h |    3 +++
2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/mama/c_cpp/src/c/publisher.c b/mama/c_cpp/src/c/publisher.c
index 281b054..e09017c 100644
--- a/mama/c_cpp/src/c/publisher.c
+++ b/mama/c_cpp/src/c/publisher.c
@@ -600,4 +600,11 @@ mama_status mamaPublisherImpl_clearTransport
(mamaPublisher publisher)
     return mamaPublisherImpl_destroy((mamaPublisherImpl *)publisher);
}

+mamaTransport
+mamaPublisherImpl_getTransportImpl (mamaPublisher publisher)
+{
+    mamaPublisherImpl* impl   = (mamaPublisherImpl*)publisher;

+    if (!impl) return NULL;
+    return impl->mTport;
+}
[AA:] Can the symantics be changed to the following instead?

MAMAExpDLL
extern mama_status
mamaSubscription_getTransport (
mamaPublisher publisher,
mamaTransport *transport);

This makes it also consistent with the similar function mamaSubscription_getTransport

diff --git a/mama/c_cpp/src/c/publisherimpl.h
b/mama/c_cpp/src/c/publisherimpl.h
index f336fd8..b9b9c43 100644
--- a/mama/c_cpp/src/c/publisherimpl.h
+++ b/mama/c_cpp/src/c/publisherimpl.h
@@ -44,6 +44,9 @@ mamaPublisher_sendFromInboxByIndex
(mamaPublisher publisher,

 mama_status mamaPublisherImpl_clearTransport (mamaPublisher
publisher);

+extern mamaTransport
+mamaPublisherImpl_getTransportImpl (mamaPublisher publisher);
+
[AA:] I suggest moving the function declaration to the public API header mama/c_cpp/src/c/mama/publisher.h instead of mama/c_cpp/src/c/publisherimpl.h.

The function can be generally useful to the API users. On the subscription side we have the mamaSubscription_getTransport which is similar.

[snip]


[PATCH] OpenMAMA RPM Release Scripts

Gary Molloy <g.molloy@...>
 

 

From 8eda359358a6d3bb466ede459d719c927f9d7e0e Mon Sep 17 00:00:00 2001

From: Gary Molloy <g.molloy@...>

Date: Mon, 27 Apr 2015 12:45:39 -0400

Subject: [PATCH] OpenMAMA RPM Release Scripts

 

The name of the directory "release" clashes with the name of the output directory

for Visual Studio.

 

Signed-off-by: Gary Molloy <g.molloy@...>

---

release/helper-functions.sh         |   61 -------

release/openmama-rpm.sh             |  315 -----------------------------------

release/openmama.spec               |   73 --------

release_scripts/helper-functions.sh |   61 +++++++

release_scripts/openmama-rpm.sh     |  315 +++++++++++++++++++++++++++++++++++

release_scripts/openmama.spec       |   73 ++++++++

6 files changed, 449 insertions(+), 449 deletions(-)

delete mode 100644 release/helper-functions.sh

delete mode 100755 release/openmama-rpm.sh

delete mode 100644 release/openmama.spec

create mode 100644 release_scripts/helper-functions.sh

create mode 100755 release_scripts/openmama-rpm.sh

create mode 100644 release_scripts/openmama.spec

 

diff --git a/release/helper-functions.sh b/release/helper-functions.sh

deleted file mode 100644

index 458dedf..0000000

--- a/release/helper-functions.sh

+++ /dev/null

@@ -1,61 +0,0 @@

-# The below functions have been pulled from the following Stack Overflow

-# answer: http://stackoverflow.com/a/5196220/3898812 from the user John Kugleman

-# and they are all kinds of awesome.

-

-. /etc/init.d/functions

-

-# Use step(), try(), and next() to perform a series of commands and print

-# [  OK  ] or [FAILED] at the end. The step as a whole fails if any individual

-# command fails.

-#

-# Example:

-#     step "Remounting / and /boot as read-write:"

-#     try mount -o remount,rw /

-#     try mount -o remount,rw /boot

-#     next

-step() {

-    echo -n "$@"

-

-    STEP_OK=0

-    [[ -w /tmp ]] && echo $STEP_OK > /tmp/step.$$

-}

-

-try() {

-    # Check for `-b' argument to run command in the background.

-    local BG=

-

-    [[ $1 == -b ]] && { BG=1; shift; }

-    [[ $1 == -- ]] && {       shift; }

-

-    # Run the command.

-    if [[ -z $BG ]]; then

-        "$@"

-    else

-        "$@" &

-    fi

-

-    # Check if command failed and update $STEP_OK if so.

-    local EXIT_CODE=$?

-

-    if [[ $EXIT_CODE -ne 0 ]]; then

-        STEP_OK=$EXIT_CODE

-        [[ -w /tmp ]] && echo $STEP_OK > /tmp/step.$$

-

-        if [[ -n $LOG_STEPS ]]; then

-            local FILE=$(readlink -m "${BASH_SOURCE[1]}")

-            local LINE=${BASH_LINENO[0]}

-

-            echo "$FILE: line $LINE: Command \`$*' failed with exit code $EXIT_CODE." >> "$LOG_STEPS"

-        fi

-    fi

-

-    return $EXIT_CODE

-}

-

-next() {

-    [[ -f /tmp/step.$$ ]] && { STEP_OK=$(< /tmp/step.$$); rm -f /tmp/step.$$; }

-    [[ $STEP_OK -eq 0 ]]  && echo_success || echo_failure

-    echo

-

-    return $STEP_OK

-}

diff --git a/release/openmama-rpm.sh b/release/openmama-rpm.sh

deleted file mode 100755

index 191678c..0000000

--- a/release/openmama-rpm.sh

+++ /dev/null

@@ -1,315 +0,0 @@

-#!/bin/bash

-

-# We don't want anyone running this as root.

-if [ "$EUID" -eq 0 ]; then

-    echo "This script is not intended to be run as root. We don't sanitize input "

-    echo "and delete entire directories on a regular basis. We REALLY REALLY REALLY"

-    echo "recommend you run as an unprivilaged user."

-    exit 1

-fi

-

-# Import a few helper functions...

-. helper-functions.sh

-

-print_help () {

-cat <<EOF

-usage: `basename $0` [-n|--next] [-v|--version <version>]

-                       [-b|--build-number <build-number>]

-                       [-B|--build-dir <build directory>]

-                       [-d|--data-dir <data directory>]

-                       [-s|--source-dir <source directory>]

-                       [-r|--release-dir <release directory>]

-                       [--env-only] [--clone-src-only] [--clone-data-only]

-                       [--tar-source-only] [--rpm-only] [--mock-only]

-                       [--package-only] [-h|-?|--help]

-

-    -n|--next           Build the next branch.

-    -V|--build-version  OpenMAMA Version to build.

-    -b|--build-number   The build number (used for multiple builds of the same version).

-    -B|--build-dir      The location of the build files. Defaults to {pwd}/build.

-    -d|--data-dir       The location of the additional files used by the build. Defaults

-                        to the current directory.

-    -s|--source-dir     The location to which the source code is to be cloned. Defaults

-                        to {pwd}/src.

-    -r|--release-dir    The location into which the artifacts are to be moved once the build

-                        has completed. Defaults to {pwd}/release.

-    --env-only          Only prepare a new RPM build environment.

-    --clone-src-only    Only clone down the OpenMAMA source. (Assumes the environment already exists.)

-    --clone-data-only   Only clone down the sample data. (Assumes the environment already exists.)

-    --tar-source-only   Only tar up the source code. (Assumes the source is already available.)

-    --rpm-only          Only run the RPM build commands. (Assumes the source and env are available.)

-    --mock-only         Only run the mock build commands. (Assumes the source RPM is available.)

-    --package-only      Only package the build artifacts. (Assumes the RPMs, mock builds etc, are available.)

-    -h|-?|--help        Displays this help text.

-EOF

-}

-

-# Set the stages which must be performed:

-BUILD_ENV=1

-CLONE_SOURCE=1

-CLONE_DATA=1

-TAR_SOURCE=1

-RPM_BUILD=1

-MOCK_BUILD=1

-PACKAGE_RELEASE=1

-

-# Set the default values

-VERSION="nightly"

-BRANCH="next"

-BUILD_NUMBER=1

-

-# Setting the build directory to the current dir...

-DATA_DIR=`pwd`/data

-BUILD_DIR=`pwd`/build

-SOURCE_DIR=`pwd`/src

-RELEASE_DIR=`pwd`/release

-

-# Set the return from each stage

-RETURN_CODE=0

-

-# Sort the command line options

-while [[ $# > 0 ]]

-do

-key="$1"

-shift

-

-case $key in

-    -n|--next)

-    NEXT=YES

-    VERSION="nightly"

-    BRANCH="next"

-    ;;

-    -v|--version)

-    VERSION="$1"

-    BRANCH=OpenMAMA-${VERSION}

-    shift

-    ;;

-    -b|--build-number)

-    BUILD_NUMBER="$1"

-    shift

-    ;;

-    -B|--build-dir)

-    BUILD_DIR="$1"

-    shift

-    ;;

-    -d|--data-dir)

-    DATA_DIR="$1"

-    shift

-    ;;

-    -s|--source-dir)

-    SOURCE_DIR="$1"

-    shift

-    ;;

-    -r|--release-dir)

-    RELEASE_DIR="$1"

-    shift

-    ;;

-    --env-only)

-    BUILD_ENV=1

-    CLONE_SOURCE=0

-    CLONE_DATA=0

-    TAR_SOURCE=0

-    RPM_BUILD=0

-    MOCK_BUILD=0

-    PACKAGE_RELEASE=0

-    ;;

-    --clone-src-only)

-    BUILD_ENV=0

-    CLONE_SOURCE=1

-    CLONE_DATA=0

-    TAR_SOURCE=0

-    RPM_BUILD=0

-    MOCK_BUILD=0

-    PACKAGE_RELEASE=0

-    ;;

-    --clone-data-only)

-    BUILD_ENV=0

-    CLONE_SOURCE=0

-    CLONE_DATA=1

-    TAR_SOURCE=0

-    RPM_BUILD=0

-    MOCK_BUILD=0

-    PACKAGE_RELEASE=0

-    ;;

-    --tar-source-only)

-    BUILD_ENV=0

-    CLONE_SOURCE=0

-    CLONE_DATA=0

-    TAR_SOURCE=1

-    RPM_BUILD=0

-    MOCK_BUILD=0

-    PACKAGE_RELEASE=0

-    ;;

-    --rpm-only)

-    BUILD_ENV=0

-    CLONE_SOURCE=0

-    CLONE_DATA=0

-    TAR_SOURCE=0

-    RPM_BUILD=1

-    MOCK_BUILD=0

-    PACKAGE_RELEASE=0

-    ;;

-    --mock-only)

-    BUILD_ENV=0

-    CLONE_SOURCE=0

-    CLONE_DATA=0

-    TAR_SOURCE=0

-    RPM_BUILD=0

-    MOCK_BUILD=1

-    PACKAGE_RELEASE=0

-    ;;

-    --package-only)

-    BUILD_ENV=0

-    CLONE_SOURCE=0

-    CLONE_DATA=0

-    TAR_SOURCE=0

-    RPM_BUILD=0

-    MOCK_BUILD=0

-    PACKAGE_RELEASE=1

-    ;;

-    -h|-?|--help)

-    print_help

-    exit

-    ;;

-    *) # Unknown argument

-    echo "Unknown argument. "

-    print_help

-    exit

-    ;;

-esac

-done

-

-echo BUILD DIR       = "${BUILD_DIR}"

-echo SRC_DIR         = "${SOURCE_DIR}"

-echo DATA_DIR        = "${DATA_DIR}"

-echo VERSION         = "${VERSION}"

-echo BRANCH          = "${BRANCH}"

-echo BUILD NUMBER    = "${BUILD_NUMBER}"

-

-if [ $BUILD_ENV -eq 1 ]; then

-    step "Setup build environment. "

-

-    if [ -d "${BUILD_DIR}" ]; then

-        try rm -rf ${BUILD_DIR}

-    fi

-

-    # First step is to create a completely clean build structure:

-    try mkdir -p ${BUILD_DIR}/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}

-

-    # And tell rpmbuild where it's located...

-    try echo '%_topdir '${BUILD_DIR} > ~/.rpmmacros

-    try cp openmama.spec ${BUILD_DIR}/SPECS/

-

-    next

-    RETURN_CODE=$?

-fi

-

-if [ $CLONE_SOURCE -eq 1 ] && [ $RETURN_CODE -eq 0 ]; then

-    step "Checking out clean source tree "

-

-    if [ -d "${SOURCE_DIR}" ]; then

-        try rm -rf ${SOURCE_DIR}

-    fi

-

-    try mkdir -p ${SOURCE_DIR}

-    try cd ${SOURCE_DIR}

-

-    # Read only clone, depth 1

-    try git clone -q --depth=1 -b ${BRANCH} http://git.openmama.org/OpenMAMA.git

-

-    # Remove the .git folder (for packaging)

-    try rm -rf OpenMAMA/.git

-    next

-    RETURN_CODE=$?

-fi

-

-if [ $CLONE_DATA -eq 1 ] && [ $RETURN_CODE -eq 0 ]; then

-    step "Checking out the OpenMAMA sample data."

-

-    if [ -d "${DATA_DIR}" ]; then

-        try rm -rf ${DATA_DIR}

-    fi

-

-    try git clone -q --depth=1 http://git.openmama.org/OpenMAMA-test-data.git

-    try mv OpenMAMA-test-data ${DATA_DIR}

-    try rm -rf ${DATA_DIR}/.git

-    next

-    RETURN_CODE=$?

-fi

-

-if [ $TAR_SOURCE -eq 1 ] && [ $RETURN_CODE -eq 0 ]; then

-    step "Create the source tarball"

-    try mv OpenMAMA openmama-${VERSION}

-    try cp -r ${DATA_DIR} openmama-${VERSION}

-    try tar -zcf openmama-${VERSION}.tgz openmama-${VERSION}

-    try cp openmama-${VERSION}.tgz ${BUILD_DIR}/SOURCES/

-    next

-    RETURN_CODE=$?

-fi

-

-if [ $RPM_BUILD -eq 1 ] && [ $RETURN_CODE -eq 0 ]; then

-    step "Perform the RPM Build"

-    try cd ${BUILD_DIR}/SPECS

-    try rpmbuild -ba --define "BUILD_VERSION "${VERSION} --define "BUILD_NUMBER "${BUILD_NUMBER} openmama.spec > ${BUILD_DIR}/rpmbuild.log 2>&1

-    next

-    RETURN_CODE=$?

-fi

-

-if [ $MOCK_BUILD -eq 1 ] && [ $RETURN_CODE -eq 0 ]; then

-    step "Build multiplatform RPMs"

-    try cd ${BUILD_DIR}/SRPMS

-    try /usr/bin/mock -r epel-6-i386 --define 'BUILD_VERSION '${VERSION} --define 'BUILD_NUMBER '${BUILD_NUMBER} openmama-${VERSION}-${BUILD_NUMBER}.*.src.rpm > ${BUILD_DIR}/mock-el6-i386.log 2>&1

-    try /usr/bin/mock -r epel-6-x86_64 --define 'BUILD_VERSION '${VERSION} --define 'BUILD_NUMBER '${BUILD_NUMBER} openmama-${VERSION}-${BUILD_NUMBER}.*.src.rpm > ${BUILD_DIR}/mock-el6-x64.log 2>&1

-    try /usr/bin/mock -r fedora-19-x86_64 --define 'BUILD_VERSION '${VERSION} --define 'BUILD_NUMBER '${BUILD_NUMBER} openmama-${VERSION}-${BUILD_NUMBER}.*.src.rpm > ${BUILD_DIR}/mock-f19-x64.log 2>&1

-    try /usr/bin/mock -r fedora-20-x86_64 --define 'BUILD_VERSION '${VERSION} --define 'BUILD_NUMBER '${BUILD_NUMBER} openmama-${VERSION}-${BUILD_NUMBER}.*.src.rpm > ${BUILD_DIR}/mock-f20-x64.log 2>&1

-    next

-    RETURN_CODE=$?

-fi

-

-if [ $PACKAGE_RELEASE -eq 1 ] && [ $RETURN_CODE -eq 0 ]; then

-    step "Packaging release"

-

-    if [ -d "${RELEASE_DIR}" ]; then

-        try rm -rf ${RELEASE_DIR}

-    fi

-

-    try mkdir -p ${RELEASE_DIR}

-

-    # Copy in and rename the source tarball

-    try cp ${SOURCE_DIR}/openmama-${VERSION}.tgz ${RELEASE_DIR}/openmama-${VERSION}-src.tar.gz

-

-    # Copy in the Source RPM

-    try cp ${BUILD_DIR}/SRPMS/openmama-${VERSION}-${BUILD_NUMBER}.*.src.rpm ${RELEASE_DIR}

-

-    # These paths are hard coded, since they should always remain there. We may

-    # want to update them periodically, especially with EL7, and newer Fedora

-    # versions.

-    try cp /var/lib/mock/epel-6-i386/result/openmama-${VERSION}-${BUILD_NUMBER}.el6.i686.rpm ${RELEASE_DIR}

-    try cp /var/lib/mock/epel-6-x86_64/result/openmama-${VERSION}-${BUILD_NUMBER}.el6.x86_64.rpm ${RELEASE_DIR}

-    try cp /var/lib/mock/fedora-19-x86_64/result/openmama-${VERSION}-${BUILD_NUMBER}.fc19.x86_64.rpm ${RELEASE_DIR}

-    try cp /var/lib/mock/fedora-20-x86_64/result/openmama-${VERSION}-${BUILD_NUMBER}.fc20.x86_64.rpm ${RELEASE_DIR}

-

-    # Build and tar the binary release

-    if [ -d ${BUILD_DIR}/binary ]; then

-        try rm -rf ${BUILD_DIR}/binary

-    fi

-

-    BINARY_DIR=${BUILD_DIR}/binary/openmama-${VERSION}

-    try mkdir -p ${BINARY_DIR}

-    try mkdir ${BINARY_DIR}/data

-    try mkdir ${BINARY_DIR}/config

-    try cp -r ${BUILD_DIR}/BUILD/openmama-${VERSION}/data/* ${BINARY_DIR}/data/

-    try cp -r ${BUILD_DIR}/BUILD/openmama-${VERSION}/openmama_install*/* ${BINARY_DIR}/

-    try cp ${BUILD_DIR}/BUILD/openmama-${VERSION}/data/profiles/profile.openmama ${BINARY_DIR}/config/

-    try cp ${BUILD_DIR}/BUILD/openmama-${VERSION}/README ${BINARY_DIR}/

-    try cp ${BUILD_DIR}/BUILD/openmama-${VERSION}/COPYING ${BINARY_DIR}/

-    try cp ${BUILD_DIR}/BUILD/openmama-${VERSION}/mama/c_cpp/src/examples/mama.properties ${BINARY_DIR}/config/

-

-    try cd ${BUILD_DIR}/binary/

-    try tar -zcf ${RELEASE_DIR}/openmama-${VERSION}-x86_64.tar.gz openmama-${VERSION}

-

-    next

-    RETURN_CODE=$?

-fi

-

-exit $RETURN_CODE

diff --git a/release/openmama.spec b/release/openmama.spec

deleted file mode 100644

index d5ec35d..0000000

--- a/release/openmama.spec

+++ /dev/null

@@ -1,73 +0,0 @@

-Summary: An abstraction layer which sits on top of multiple message oriented middlewares

-Name:       openmama

-Version:    %{?BUILD_VERSION}

-Release:    %{?BUILD_NUMBER}%{?dist}

-License:    LGPLv2

-URL:        http://www.openmama.org

-Group:      Development/Libraries

-Source:     %{name}-%{version}.tgz

-BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

-

-BuildRequires: libtool autoconf automake ant libuuid-devel flex doxygen qpid-proton-c-devel scons libevent-devel ncurses-devel

-Requires: libuuid qpid-proton-c libevent ncurses

-

-%if 0%{?fedora}

-BuildRequires: java-1.7.0-openjdk-devel

-Requires: java-1.7.0-openjdk

-%define java_home /usr/lib/jvm/java/

-%endif

-

-%if 0%{?rhel}

-BuildRequires: java

-Requires: java

-%define java_home /usr/lib/jvm/java/

-%endif

-

-%description

-OpenMAMA is a high performance abstraction layer for message oriented

-middlewares, where MAMA stands for Middleware Agnostic Messaging API.

-

-%prep

-%setup -q

-

-%build

-scons middleware=qpid product=mamdajni java_home=%{java_home} with_testtools=yes jobs=n

-# prefix=%{buildroot}/opt/openmama/

-

-%install

-# scons install

-rm -rf %{buildroot}

-mkdir -p %{buildroot}/opt/openmama/

-mkdir %{buildroot}/opt/openmama/data

-mkdir %{buildroot}/opt/openmama/config

-cp -r %{_builddir}/%{name}-%{version}/data/* %{buildroot}/opt/openmama/data/

-cp -r %{_builddir}/%{name}-%{version}/openmama_install_*/* %{buildroot}/opt/openmama

-cp %{_builddir}/%{name}-%{version}/data/profiles/profile.openmama %{buildroot}/opt/openmama/config/

-cp %{_builddir}/%{name}-%{version}/README %{buildroot}/opt/openmama/

-cp %{_builddir}/%{name}-%{version}/COPYING %{buildroot}/opt/openmama/

-cp %{_builddir}/%{name}-%{version}/mama/c_cpp/src/examples/mama.properties %{buildroot}/opt/openmama/config

-

-%clean

-rm -rf %{buildroot}

-

-%files

-%defattr(-,root,root,-)

-/opt/openmama/bin/*

-/opt/openmama/lib/*

-/opt/openmama/examples/*

-/opt/openmama/config/*

-/opt/openmama/data/*

-/opt/openmama/include/destroyHandle.h

-/opt/openmama/include/list.h

-/opt/openmama/include/lookup2.h

-/opt/openmama/include/platform.h

-/opt/openmama/include/timers.h

-/opt/openmama/include/property.h

-/opt/openmama/include/wlock.h

-/opt/openmama/include/wombat

-/opt/openmama/include/mama

-/opt/openmama/include/mamda

-/opt/openmama/README

-/opt/openmama/COPYING

-

-%changelog

diff --git a/release_scripts/helper-functions.sh b/release_scripts/helper-functions.sh

new file mode 100644

index 0000000..458dedf

--- /dev/null

+++ b/release_scripts/helper-functions.sh

@@ -0,0 +1,61 @@

+# The below functions have been pulled from the following Stack Overflow

+# answer: http://stackoverflow.com/a/5196220/3898812 from the user John Kugleman

+# and they are all kinds of awesome.

+

+. /etc/init.d/functions

+

+# Use step(), try(), and next() to perform a series of commands and print

+# [  OK  ] or [FAILED] at the end. The step as a whole fails if any individual

+# command fails.

+#

+# Example:

+#     step "Remounting / and /boot as read-write:"

+#     try mount -o remount,rw /

+#     try mount -o remount,rw /boot

+#     next

+step() {

+    echo -n "$@"

+

+    STEP_OK=0

+    [[ -w /tmp ]] && echo $STEP_OK > /tmp/step.$$

+}

+

+try() {

+    # Check for `-b' argument to run command in the background.

+    local BG=

+

+    [[ $1 == -b ]] && { BG=1; shift; }

+    [[ $1 == -- ]] && {       shift; }

+

+    # Run the command.

+    if [[ -z $BG ]]; then

+        "$@"

+    else

+        "$@" &

+    fi

+

+    # Check if command failed and update $STEP_OK if so.

+    local EXIT_CODE=$?

+

+    if [[ $EXIT_CODE -ne 0 ]]; then

+        STEP_OK=$EXIT_CODE

+        [[ -w /tmp ]] && echo $STEP_OK > /tmp/step.$$

+

+        if [[ -n $LOG_STEPS ]]; then

+            local FILE=$(readlink -m "${BASH_SOURCE[1]}")

+            local LINE=${BASH_LINENO[0]}

+

+            echo "$FILE: line $LINE: Command \`$*' failed with exit code $EXIT_CODE." >> "$LOG_STEPS"

+        fi

+    fi

+

+    return $EXIT_CODE

+}

+

+next() {

+    [[ -f /tmp/step.$$ ]] && { STEP_OK=$(< /tmp/step.$$); rm -f /tmp/step.$$; }

+    [[ $STEP_OK -eq 0 ]]  && echo_success || echo_failure

+    echo

+

+    return $STEP_OK

+}

diff --git a/release_scripts/openmama-rpm.sh b/release_scripts/openmama-rpm.sh

new file mode 100755

index 0000000..191678c

--- /dev/null

+++ b/release_scripts/openmama-rpm.sh

@@ -0,0 +1,315 @@

+#!/bin/bash

+

+# We don't want anyone running this as root.

+if [ "$EUID" -eq 0 ]; then

+    echo "This script is not intended to be run as root. We don't sanitize input "

+    echo "and delete entire directories on a regular basis. We REALLY REALLY REALLY"

+    echo "recommend you run as an unprivilaged user."

+    exit 1

+fi

+

+# Import a few helper functions...

+. helper-functions.sh

+

+print_help () {

+cat <<EOF

+usage: `basename $0` [-n|--next] [-v|--version <version>]

+                       [-b|--build-number <build-number>]

+                       [-B|--build-dir <build directory>]

+                       [-d|--data-dir <data directory>]

+                       [-s|--source-dir <source directory>]

+                       [-r|--release-dir <release directory>]

+                       [--env-only] [--clone-src-only] [--clone-data-only]

+                       [--tar-source-only] [--rpm-only] [--mock-only]

+                       [--package-only] [-h|-?|--help]

+

+    -n|--next           Build the next branch.

+    -V|--build-version  OpenMAMA Version to build.

+    -b|--build-number   The build number (used for multiple builds of the same version).

+    -B|--build-dir      The location of the build files. Defaults to {pwd}/build.

+    -d|--data-dir       The location of the additional files used by the build. Defaults

+                        to the current directory.

+    -s|--source-dir     The location to which the source code is to be cloned. Defaults

+                        to {pwd}/src.

+    -r|--release-dir    The location into which the artifacts are to be moved once the build

+                        has completed. Defaults to {pwd}/release.

+    --env-only          Only prepare a new RPM build environment.

+    --clone-src-only    Only clone down the OpenMAMA source. (Assumes the environment already exists.)

+    --clone-data-only   Only clone down the sample data. (Assumes the environment already exists.)

+    --tar-source-only   Only tar up the source code. (Assumes the source is already available.)

+    --rpm-only          Only run the RPM build commands. (Assumes the source and env are available.)

+    --mock-only         Only run the mock build commands. (Assumes the source RPM is available.)

+    --package-only      Only package the build artifacts. (Assumes the RPMs, mock builds etc, are available.)

+    -h|-?|--help        Displays this help text.

+EOF

+}

+

+# Set the stages which must be performed:

+BUILD_ENV=1

+CLONE_SOURCE=1

+CLONE_DATA=1

+TAR_SOURCE=1

+RPM_BUILD=1

+MOCK_BUILD=1

+PACKAGE_RELEASE=1

+

+# Set the default values

+VERSION="nightly"

+BRANCH="next"

+BUILD_NUMBER=1

+

+# Setting the build directory to the current dir...

+DATA_DIR=`pwd`/data

+BUILD_DIR=`pwd`/build

+SOURCE_DIR=`pwd`/src

+RELEASE_DIR=`pwd`/release

+

+# Set the return from each stage

+RETURN_CODE=0

+

+# Sort the command line options

+while [[ $# > 0 ]]

+do

+key="$1"

+shift

+

+case $key in

+    -n|--next)

+    NEXT=YES

+    VERSION="nightly"

+    BRANCH="next"

+    ;;

+    -v|--version)

+    VERSION="$1"

+    BRANCH=OpenMAMA-${VERSION}

+    shift

+    ;;

+    -b|--build-number)

+    BUILD_NUMBER="$1"

+    shift

+    ;;

+    -B|--build-dir)

+    BUILD_DIR="$1"

+    shift

+    ;;

+    -d|--data-dir)

+    DATA_DIR="$1"

+    shift

+    ;;

+    -s|--source-dir)

+    SOURCE_DIR="$1"

+    shift

+    ;;

+    -r|--release-dir)

+    RELEASE_DIR="$1"

+    shift

+    ;;

+    --env-only)

+    BUILD_ENV=1

+    CLONE_SOURCE=0

+    CLONE_DATA=0

+    TAR_SOURCE=0

+    RPM_BUILD=0

+    MOCK_BUILD=0

+    PACKAGE_RELEASE=0

+    ;;

+    --clone-src-only)

+    BUILD_ENV=0

+    CLONE_SOURCE=1

+    CLONE_DATA=0

+    TAR_SOURCE=0

+    RPM_BUILD=0

+    MOCK_BUILD=0

+    PACKAGE_RELEASE=0

+    ;;

+    --clone-data-only)

+    BUILD_ENV=0

+    CLONE_SOURCE=0

+    CLONE_DATA=1

+    TAR_SOURCE=0

+    RPM_BUILD=0

+    MOCK_BUILD=0

+    PACKAGE_RELEASE=0

+    ;;

+    --tar-source-only)

+    BUILD_ENV=0

+    CLONE_SOURCE=0

+    CLONE_DATA=0

+    TAR_SOURCE=1

+    RPM_BUILD=0

+    MOCK_BUILD=0

+    PACKAGE_RELEASE=0

+    ;;

+    --rpm-only)

+    BUILD_ENV=0

+    CLONE_SOURCE=0

+    CLONE_DATA=0

+    TAR_SOURCE=0

+    RPM_BUILD=1

+    MOCK_BUILD=0

+    PACKAGE_RELEASE=0

+    ;;

+    --mock-only)

+    BUILD_ENV=0

+    CLONE_SOURCE=0

+    CLONE_DATA=0

+    TAR_SOURCE=0

+    RPM_BUILD=0

+    MOCK_BUILD=1

+    PACKAGE_RELEASE=0

+    ;;

+    --package-only)

+    BUILD_ENV=0

+    CLONE_SOURCE=0

+    CLONE_DATA=0

+    TAR_SOURCE=0

+    RPM_BUILD=0

+    MOCK_BUILD=0

+    PACKAGE_RELEASE=1

+    ;;

+    -h|-?|--help)

+    print_help

+    exit

+    ;;

+    *) # Unknown argument

+    echo "Unknown argument. "

+    print_help

+    exit

+    ;;

+esac

+done

+

+echo BUILD DIR       = "${BUILD_DIR}"

+echo SRC_DIR         = "${SOURCE_DIR}"

+echo DATA_DIR        = "${DATA_DIR}"

+echo VERSION         = "${VERSION}"

+echo BRANCH          = "${BRANCH}"

+echo BUILD NUMBER    = "${BUILD_NUMBER}"

+

+if [ $BUILD_ENV -eq 1 ]; then

+    step "Setup build environment. "

+

+    if [ -d "${BUILD_DIR}" ]; then

+        try rm -rf ${BUILD_DIR}

+    fi

+

+    # First step is to create a completely clean build structure:

+    try mkdir -p ${BUILD_DIR}/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}

+

+    # And tell rpmbuild where it's located...

+    try echo '%_topdir '${BUILD_DIR} > ~/.rpmmacros

+    try cp openmama.spec ${BUILD_DIR}/SPECS/

+

+    next

+    RETURN_CODE=$?

+fi

+

+if [ $CLONE_SOURCE -eq 1 ] && [ $RETURN_CODE -eq 0 ]; then

+    step "Checking out clean source tree "

+

+    if [ -d "${SOURCE_DIR}" ]; then

+        try rm -rf ${SOURCE_DIR}

+    fi

+

+    try mkdir -p ${SOURCE_DIR}

+    try cd ${SOURCE_DIR}

+

+    # Read only clone, depth 1

+    try git clone -q --depth=1 -b ${BRANCH} http://git.openmama.org/OpenMAMA.git

+

+    # Remove the .git folder (for packaging)

+    try rm -rf OpenMAMA/.git

+    next

+    RETURN_CODE=$?

+fi

+

+if [ $CLONE_DATA -eq 1 ] && [ $RETURN_CODE -eq 0 ]; then

+    step "Checking out the OpenMAMA sample data."

+

+    if [ -d "${DATA_DIR}" ]; then

+        try rm -rf ${DATA_DIR}

+    fi

+

+    try git clone -q --depth=1 http://git.openmama.org/OpenMAMA-test-data.git

+    try mv OpenMAMA-test-data ${DATA_DIR}

+    try rm -rf ${DATA_DIR}/.git

+    next

+    RETURN_CODE=$?

+fi

+

+if [ $TAR_SOURCE -eq 1 ] && [ $RETURN_CODE -eq 0 ]; then

+    step "Create the source tarball"

+    try mv OpenMAMA openmama-${VERSION}

+    try cp -r ${DATA_DIR} openmama-${VERSION}

+    try tar -zcf openmama-${VERSION}.tgz openmama-${VERSION}

+    try cp openmama-${VERSION}.tgz ${BUILD_DIR}/SOURCES/

+    next

+    RETURN_CODE=$?

+fi

+

+if [ $RPM_BUILD -eq 1 ] && [ $RETURN_CODE -eq 0 ]; then

+    step "Perform the RPM Build"

+    try cd ${BUILD_DIR}/SPECS

+    try rpmbuild -ba --define "BUILD_VERSION "${VERSION} --define "BUILD_NUMBER "${BUILD_NUMBER} openmama.spec > ${BUILD_DIR}/rpmbuild.log 2>&1

+    next

+    RETURN_CODE=$?

+fi

+

+if [ $MOCK_BUILD -eq 1 ] && [ $RETURN_CODE -eq 0 ]; then

+    step "Build multiplatform RPMs"

+    try cd ${BUILD_DIR}/SRPMS

+    try /usr/bin/mock -r epel-6-i386 --define 'BUILD_VERSION '${VERSION} --define 'BUILD_NUMBER '${BUILD_NUMBER} openmama-${VERSION}-${BUILD_NUMBER}.*.src.rpm > ${BUILD_DIR}/mock-el6-i386.log 2>&1

+    try /usr/bin/mock -r epel-6-x86_64 --define 'BUILD_VERSION '${VERSION} --define 'BUILD_NUMBER '${BUILD_NUMBER} openmama-${VERSION}-${BUILD_NUMBER}.*.src.rpm > ${BUILD_DIR}/mock-el6-x64.log 2>&1

+    try /usr/bin/mock -r fedora-19-x86_64 --define 'BUILD_VERSION '${VERSION} --define 'BUILD_NUMBER '${BUILD_NUMBER} openmama-${VERSION}-${BUILD_NUMBER}.*.src.rpm > ${BUILD_DIR}/mock-f19-x64.log 2>&1

+    try /usr/bin/mock -r fedora-20-x86_64 --define 'BUILD_VERSION '${VERSION} --define 'BUILD_NUMBER '${BUILD_NUMBER} openmama-${VERSION}-${BUILD_NUMBER}.*.src.rpm > ${BUILD_DIR}/mock-f20-x64.log 2>&1

+    next

+    RETURN_CODE=$?

+fi

+

+if [ $PACKAGE_RELEASE -eq 1 ] && [ $RETURN_CODE -eq 0 ]; then

+    step "Packaging release"

+

+    if [ -d "${RELEASE_DIR}" ]; then

+        try rm -rf ${RELEASE_DIR}

+    fi

+

+    try mkdir -p ${RELEASE_DIR}

+

+    # Copy in and rename the source tarball

+    try cp ${SOURCE_DIR}/openmama-${VERSION}.tgz ${RELEASE_DIR}/openmama-${VERSION}-src.tar.gz

+

+    # Copy in the Source RPM

+    try cp ${BUILD_DIR}/SRPMS/openmama-${VERSION}-${BUILD_NUMBER}.*.src.rpm ${RELEASE_DIR}

+

+    # These paths are hard coded, since they should always remain there. We may

+    # want to update them periodically, especially with EL7, and newer Fedora

+    # versions.

+    try cp /var/lib/mock/epel-6-i386/result/openmama-${VERSION}-${BUILD_NUMBER}.el6.i686.rpm ${RELEASE_DIR}

+    try cp /var/lib/mock/epel-6-x86_64/result/openmama-${VERSION}-${BUILD_NUMBER}.el6.x86_64.rpm ${RELEASE_DIR}

+    try cp /var/lib/mock/fedora-19-x86_64/result/openmama-${VERSION}-${BUILD_NUMBER}.fc19.x86_64.rpm ${RELEASE_DIR}

+    try cp /var/lib/mock/fedora-20-x86_64/result/openmama-${VERSION}-${BUILD_NUMBER}.fc20.x86_64.rpm ${RELEASE_DIR}

+

+    # Build and tar the binary release

+    if [ -d ${BUILD_DIR}/binary ]; then

+        try rm -rf ${BUILD_DIR}/binary

+    fi

+

+    BINARY_DIR=${BUILD_DIR}/binary/openmama-${VERSION}

+    try mkdir -p ${BINARY_DIR}

+    try mkdir ${BINARY_DIR}/data

+    try mkdir ${BINARY_DIR}/config

+    try cp -r ${BUILD_DIR}/BUILD/openmama-${VERSION}/data/* ${BINARY_DIR}/data/

+    try cp -r ${BUILD_DIR}/BUILD/openmama-${VERSION}/openmama_install*/* ${BINARY_DIR}/

+    try cp ${BUILD_DIR}/BUILD/openmama-${VERSION}/data/profiles/profile.openmama ${BINARY_DIR}/config/

+    try cp ${BUILD_DIR}/BUILD/openmama-${VERSION}/README ${BINARY_DIR}/

+    try cp ${BUILD_DIR}/BUILD/openmama-${VERSION}/COPYING ${BINARY_DIR}/

+    try cp ${BUILD_DIR}/BUILD/openmama-${VERSION}/mama/c_cpp/src/examples/mama.properties ${BINARY_DIR}/config/

+

+    try cd ${BUILD_DIR}/binary/

+    try tar -zcf ${RELEASE_DIR}/openmama-${VERSION}-x86_64.tar.gz openmama-${VERSION}

+

+    next

+    RETURN_CODE=$?

+fi

+

+exit $RETURN_CODE

diff --git a/release_scripts/openmama.spec b/release_scripts/openmama.spec

new file mode 100644

index 0000000..d5ec35d

--- /dev/null

+++ b/release_scripts/openmama.spec

@@ -0,0 +1,73 @@

+Summary: An abstraction layer which sits on top of multiple message oriented middlewares

+Name:       openmama

+Version:    %{?BUILD_VERSION}

+Release:    %{?BUILD_NUMBER}%{?dist}

+License:    LGPLv2

+URL:        http://www.openmama.org

+Group:      Development/Libraries

+Source:     %{name}-%{version}.tgz

+BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

+

+BuildRequires: libtool autoconf automake ant libuuid-devel flex doxygen qpid-proton-c-devel scons libevent-devel ncurses-devel

+Requires: libuuid qpid-proton-c libevent ncurses

+

+%if 0%{?fedora}

+BuildRequires: java-1.7.0-openjdk-devel

+Requires: java-1.7.0-openjdk

+%define java_home /usr/lib/jvm/java/

+%endif

+

+%if 0%{?rhel}

+BuildRequires: java

+Requires: java

+%define java_home /usr/lib/jvm/java/

+%endif

+

+%description

+OpenMAMA is a high performance abstraction layer for message oriented

+middlewares, where MAMA stands for Middleware Agnostic Messaging API.

+

+%prep

+%setup -q

+

+%build

+scons middleware=qpid product=mamdajni java_home=%{java_home} with_testtools=yes jobs=n

+# prefix=%{buildroot}/opt/openmama/

+

+%install

+# scons install

+rm -rf %{buildroot}

+mkdir -p %{buildroot}/opt/openmama/

+mkdir %{buildroot}/opt/openmama/data

+mkdir %{buildroot}/opt/openmama/config

+cp -r %{_builddir}/%{name}-%{version}/data/* %{buildroot}/opt/openmama/data/

+cp -r %{_builddir}/%{name}-%{version}/openmama_install_*/* %{buildroot}/opt/openmama

+cp %{_builddir}/%{name}-%{version}/data/profiles/profile.openmama %{buildroot}/opt/openmama/config/

+cp %{_builddir}/%{name}-%{version}/README %{buildroot}/opt/openmama/

+cp %{_builddir}/%{name}-%{version}/COPYING %{buildroot}/opt/openmama/

+cp %{_builddir}/%{name}-%{version}/mama/c_cpp/src/examples/mama.properties %{buildroot}/opt/openmama/config

+

+%clean

+rm -rf %{buildroot}

+

+%files

+%defattr(-,root,root,-)

+/opt/openmama/bin/*

+/opt/openmama/lib/*

+/opt/openmama/examples/*

+/opt/openmama/config/*

+/opt/openmama/data/*

+/opt/openmama/include/destroyHandle.h

+/opt/openmama/include/list.h

+/opt/openmama/include/lookup2.h

+/opt/openmama/include/platform.h

+/opt/openmama/include/timers.h

+/opt/openmama/include/property.h

+/opt/openmama/include/wlock.h

+/opt/openmama/include/wombat

+/opt/openmama/include/mama

+/opt/openmama/include/mamda

+/opt/openmama/README

+/opt/openmama/COPYING

+

+%changelog

--

1.7.1

 

 

 

 

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

Tel: +44 28 9099 7580  Ext 3397

g.molloy@...

 

801 - 820 of 2305