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 void
close()
Close MAMA and free all associated resource.static void
disableLogging()
static void
enableLogging(java.util.logging.Level level)
static void
enableLogging(java.util.logging.Level level, java.lang.String file)
static java.lang.String
getApplicationClassName()
static java.lang.String
getApplicationName()
static java.lang.String
getCHostName()
static java.lang.String
getCUserName()
static MamaQueue
getDefaultQueue(MamaBridge bridge)
static java.lang.String
getHostName()
getHostName get the host name of the machinestatic java.lang.String
getIpAddress()
getIpAddress get the ip address of the machinestatic int
getLastErrorCode()
static java.lang.String
getLastErrorText()
static java.util.logging.Level
getLogLevel()
static int
getMamaLevelForLevel(java.util.logging.Level level)
static MamaLogLevel
getMamaLogLevelForLevel(java.util.logging.Level level)
static java.lang.String
getProperty(java.lang.String name)
static java.lang.String
getUserName()
getUserName get the user name for the applicationstatic java.lang.String
getVersion(MamaBridge bridge)
static MamaBridge
loadBridge(java.lang.String middleware)
static MamaBridge
loadBridge(java.lang.String middleware, java.lang.String path)
static MamaPayloadBridge
loadPayloadBridge(java.lang.String name)
static void
log(MamaLogLevel level, java.lang.String message)
static boolean
loggingToFile()
static void
logToFile(java.lang.String file, java.util.logging.Level level)
static void
open()
Initialize MAMA.static void
open(java.lang.String path, java.lang.String filename)
Initialize MAMA.static void
setAppendToLogFile(boolean append)
static void
setApplicationClassName(java.lang.String applicationClassName)
static void
setApplicationName(java.lang.String applicationName)
static void
setLogCallback(MamaLogFileCallback2 callback)
static void
setLogFilePolicy(MamaLogFilePolicy policy)
static void
setLogLevel(java.util.logging.Level level)
static void
setLogSize(long size)
static void
setLogSizeCb(MamaLogFileCallback callback)
static void
setNumLogFiles(int numFiles)
static void
setProperty(java.lang.String name, java.lang.String value)
static void
start(MamaBridge bridge)
Start processing messages on the internal queue.static void
startBackground(MamaBridge bridge, MamaStartBackgroundCallback callback)
Start processing MAMA internal events in the background.static void
stop(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()
-
-