Package com.wombat.mama
Class Mama
- java.lang.Object
-
- com.wombat.mama.Mama
-
public class Mama extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclose()Close MAMA and free all associated resource.static voiddisableLogging()static voidenableLogging(java.util.logging.Level level)static voidenableLogging(java.util.logging.Level level, java.lang.String file)static java.lang.StringgetApplicationClassName()static java.lang.StringgetApplicationName()static java.lang.StringgetCHostName()static java.lang.StringgetCUserName()static MamaQueuegetDefaultQueue(MamaBridge bridge)static java.lang.StringgetHostName()getHostName get the host name of the machinestatic java.lang.StringgetIpAddress()getIpAddress get the ip address of the machinestatic intgetLastErrorCode()static java.lang.StringgetLastErrorText()static java.util.logging.LevelgetLogLevel()static intgetMamaLevelForLevel(java.util.logging.Level level)static MamaLogLevelgetMamaLogLevelForLevel(java.util.logging.Level level)static java.lang.StringgetProperty(java.lang.String name)static java.lang.StringgetUserName()getUserName get the user name for the applicationstatic java.lang.StringgetVersion(MamaBridge bridge)static MamaBridgeloadBridge(java.lang.String middleware)static MamaBridgeloadBridge(java.lang.String middleware, java.lang.String path)static MamaPayloadBridgeloadPayloadBridge(java.lang.String name)static voidlog(MamaLogLevel level, java.lang.String message)static booleanloggingToFile()static voidlogToFile(java.lang.String file, java.util.logging.Level level)static voidopen()Initialize MAMA.static voidopen(java.lang.String path, java.lang.String filename)Initialize MAMA.static voidsetAppendToLogFile(boolean append)static voidsetApplicationClassName(java.lang.String applicationClassName)static voidsetApplicationName(java.lang.String applicationName)static voidsetLogCallback(MamaLogFileCallback2 callback)static voidsetLogFilePolicy(MamaLogFilePolicy policy)static voidsetLogLevel(java.util.logging.Level level)static voidsetLogSize(long size)static voidsetLogSizeCb(MamaLogFileCallback callback)static voidsetNumLogFiles(int numFiles)static voidsetProperty(java.lang.String name, java.lang.String value)static voidstart(MamaBridge bridge)Start processing messages on the internal queue.static voidstartBackground(MamaBridge bridge, MamaStartBackgroundCallback callback)Start processing MAMA internal events in the background.static voidstop(MamaBridge bridge)Stop dispatching on the default event queue for the specified bridge.
-
-
-
Method Detail
-
loadBridge
public static MamaBridge loadBridge(java.lang.String middleware, java.lang.String path)
-
loadBridge
public static MamaBridge loadBridge(java.lang.String middleware)
-
loadPayloadBridge
public static MamaPayloadBridge loadPayloadBridge(java.lang.String name)
-
getDefaultQueue
public static MamaQueue getDefaultQueue(MamaBridge bridge)
-
open
public static void open()
Initialize MAMA. MAMA employs a reference count to track multiple calls to Mama.open() and Mama.close(). The count is incremented every time Mama.open() is called and decremented when Mama.close() is called. The resources are not actually released until the count reaches zero. If entitlements are enabled for the library, the available entitlement server names are read from the entitlement.servers property in the mama.properties file located in the \$WOMBAT_PATH directory. This function is thread safe.
-
open
public static void open(java.lang.String path, java.lang.String filename)Initialize MAMA. Allows users of the API to override the default behavior of Mama.open() where a file mama.properties is required to be located in the directory specified by \$WOMBAT_PATH. The properties file must have the same structure as a standard mama.properties file. If null is passed as the path the API will look for the properties file on the \$WOMBAT_PATH. If null is passed as the filename the API will look for the default filename of mama.properties.
-
start
public static void start(MamaBridge bridge)
Start processing messages on the internal queue. This starts Mama's internal throttle, refresh logic, and other internal Mama processes as well as dispatching messages from the internal queue.Mama.start( ) blocks until an invocation of Mama.stop() occurs. MAMA employs a reference count to track multiple calls to Mama.start() and Mama.stop(). The count is incremented every time Mama.start() is called and decremented when Mama.stop() is called. The first Mama.start() call does not unblock until the count reaches zero. This function is thread safe.
-
startBackground
public static void startBackground(MamaBridge bridge, MamaStartBackgroundCallback callback)
Start processing MAMA internal events in the background. This method invokes Mama::start () in a separate thread.
-
stop
public static void stop(MamaBridge bridge)
Stop dispatching on the default event queue for the specified bridge. MAMA employs a reference count to track multiple calls to Mama.start() and Mama.stop(). The count is incremented every time Mama.start() is called and decremented when Mama.stop() is called. The first Mama.start() call does not unblock until the count reaches zero. This function is thread safe.
-
close
public static void close()
Close MAMA and free all associated resource. MAMA employs a reference count to track multiple calls to Mama.open() and Mama.close(). The count is incremented every time Mama.open() is called and decremented when Mama.close() is called. The resources are not actually released until the count reaches zero. This function is thread safe.
-
enableLogging
public static void enableLogging(java.util.logging.Level level)
-
setLogCallback
public static void setLogCallback(MamaLogFileCallback2 callback) throws java.lang.IllegalArgumentException
- Throws:
java.lang.IllegalArgumentException
-
log
public static void log(MamaLogLevel level, java.lang.String message)
-
enableLogging
public static void enableLogging(java.util.logging.Level level, java.lang.String file) throws java.io.FileNotFoundException- Throws:
java.io.FileNotFoundException
-
logToFile
public static void logToFile(java.lang.String file, java.util.logging.Level level) throws java.io.FileNotFoundException- Throws:
java.io.FileNotFoundException
-
disableLogging
public static void disableLogging()
-
getLogLevel
public static java.util.logging.Level getLogLevel()
-
setLogLevel
public static void setLogLevel(java.util.logging.Level level)
-
setLogFilePolicy
public static void setLogFilePolicy(MamaLogFilePolicy policy)
-
getProperty
public static java.lang.String getProperty(java.lang.String name)
-
setProperty
public static void setProperty(java.lang.String name, java.lang.String value)
-
setLogSize
public static void setLogSize(long size)
-
setNumLogFiles
public static void setNumLogFiles(int numFiles)
-
setAppendToLogFile
public static void setAppendToLogFile(boolean append)
-
loggingToFile
public static boolean loggingToFile()
-
setLogSizeCb
public static void setLogSizeCb(MamaLogFileCallback callback)
-
getMamaLogLevelForLevel
public static MamaLogLevel getMamaLogLevelForLevel(java.util.logging.Level level)
-
getMamaLevelForLevel
public static int getMamaLevelForLevel(java.util.logging.Level level)
-
setApplicationName
public static void setApplicationName(java.lang.String applicationName)
-
setApplicationClassName
public static void setApplicationClassName(java.lang.String applicationClassName)
-
getApplicationName
public static java.lang.String getApplicationName()
-
getApplicationClassName
public static java.lang.String getApplicationClassName()
-
getCUserName
public static java.lang.String getCUserName()
-
getCHostName
public static java.lang.String getCHostName()
-
getUserName
public static java.lang.String getUserName()
getUserName get the user name for the application- Returns:
- String the user name
-
getHostName
public static java.lang.String getHostName()
getHostName get the host name of the machine- Returns:
- String the hostname
-
getIpAddress
public static java.lang.String getIpAddress()
getIpAddress get the ip address of the machine- Returns:
- String the IP address
-
getVersion
public static java.lang.String getVersion(MamaBridge bridge)
-
getLastErrorCode
public static int getLastErrorCode()
-
getLastErrorText
public static java.lang.String getLastErrorText()
-
-