Package com.wowza.wms.module
Class ModuleBase
- Object
-
- com.wowza.wms.module.ModuleBase
-
- Direct Known Subclasses:
ModuleClientLogging
,ModuleCore
,ModuleMediaCaster
public abstract class ModuleBase extends Object
ModuleBase: Base class that all server side modules should extend. Provides basic utility functionality for handling function parameters and return data. Also provides a simplified API for logging.
-
-
Field Summary
Fields Modifier and Type Field Description static int
CALLBACK_PARAM1
Callback param: param1static int
CALLBACK_PARAM10
Callback param: param10static int
CALLBACK_PARAM2
Callback param: param2static int
CALLBACK_PARAM3
Callback param: param3static int
CALLBACK_PARAM4
Callback param: param4static int
CALLBACK_PARAM5
Callback param: param5static int
CALLBACK_PARAM6
Callback param: param6static int
CALLBACK_PARAM7
Callback param: param7static int
CALLBACK_PARAM8
Callback param: param8static int
CALLBACK_PARAM9
Callback param: param9static int
PARAM1
Method param: param1static int
PARAM10
Method param: param10static int
PARAM2
Method param: param2static int
PARAM3
Method param: param3static int
PARAM4
Method param: param4static int
PARAM5
Method param: param5static int
PARAM6
Method param: param6static int
PARAM7
Method param: param7static int
PARAM8
Method param: param8static int
PARAM9
Method param: param9static int
PARAMMETHODNAME
Method: method namestatic int
PLAYTRANSITION_APPEND
static int
PLAYTRANSITION_APPEND_IMMEDIATE
static int
PLAYTRANSITION_RESET
static int
PLAYTRANSITION_RESET_IMMEDIATE
static int
PLAYTRANSITION_STOP
static int
PLAYTRANSITION_SWAP
static int
PLAYTRANSITION_SWITCH
static int
PLAYTRANSITION_UNKNOWN
static String
PLAYTRANSITIONSTR_APPEND
Play2 transition: APPENDstatic String
PLAYTRANSITIONSTR_RESET
Play2 transition: RESETstatic String
PLAYTRANSITIONSTR_STOP
Play2 transition: STOPstatic String
PLAYTRANSITIONSTR_SWAP
Play2 transition: SWAPstatic String
PLAYTRANSITIONSTR_SWITCH
Play2 transition: SWITCHstatic String
PLAYTRANSITIONSTR_UNKNOWN
Play2 transition: UNKNOWN
-
Constructor Summary
Constructors Constructor Description ModuleBase()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static IApplicationInstance
getAppInstance(IClient client)
Get applicationInstace of a client.protected static IApplication
getApplication(IClient client)
Get application of a client.protected static int
getCallbackParamCount(AMFDataList params)
Get the total number of parameters passed to callback.protected static WMSLogger
getLogger()
Get the logging interface.protected static WMSLogger
getLogger(Class classObj)
Get the logging interface.protected static WMSLogger
getLogger(Class classObj, IApplicationInstance appInstance)
Get the logging interface.protected static AMFData
getParam(AMFDataList params, int index)
Get parameter by index.protected static boolean
getParamBoolean(AMFDataList params, int index)
Get parameter by index, Return as boolean.protected static boolean
getParamBoolean(AMFDataList params, int index, boolean defaultVal)
Get parameter by index, Return as boolean.protected static int
getParamCount(AMFDataList params)
Get the total number of parameters passed to method.protected static java.util.Date
getParamDate(AMFDataList params, int index)
Get parameter by index, Return as Date.protected static double
getParamDouble(AMFDataList params, int index)
Get parameter by index, Return as double.protected static double
getParamDouble(AMFDataList params, int index, double defaultVal)
Get parameter by index, Return as double.protected static int
getParamInt(AMFDataList params, int index)
Get parameter by index, Return as int.protected static int
getParamInt(AMFDataList params, int index, int defaultVal)
Get parameter by index, Return as int.protected static long
getParamLong(AMFDataList params, int index)
Get parameter by index, Return as long.protected static long
getParamLong(AMFDataList params, int index, long defaultVal)
Get parameter by index, Return as long.protected static AMFDataMixedArray
getParamMixedArray(AMFDataList params, int index)
Get parameter by index, Return as AMFDataMixedArray.protected static AMFDataObj
getParamObj(AMFDataList params, int index)
Get parameter by index, Return as Object.protected static String
getParamString(AMFDataList params, int index)
Get parameter by index, Return as String.protected static String
getParamString(AMFDataList params, int index, String defaultVal)
Get parameter by index, Return as String.protected static int
getParamType(AMFDataList params, int index)
Get parameter type.protected static IMediaStream
getStream(IClient client, com.wowza.wms.request.RequestFunction function)
For methods called from the client side object NetStream (publish, play, deleteStream) get the IMediaStream object associated with the call.protected static IVHost
getVHost(IClient client)
Get vHost of a client.protected void
invokePrevious(IClient client, com.wowza.wms.request.RequestFunction function, AMFDataList params)
Wowza Pro will determine command priority based on the order of the modules in the module list.protected static void
invokePrevious(Object instance, IClient client, com.wowza.wms.request.RequestFunction function, AMFDataList params)
Wowza Pro will determine command priority based on the order of the modules in the module list.protected static boolean
isSendResult(AMFDataList params)
Is this method call expecting sendResult to be called.protected static void
sendClientOnStatusError(IClient client, String code, String description)
Send an error message to the client-side client.onStatus handlerprotected static boolean
sendResult(IClient client, AMFDataList params, boolean value)
Send a result to client method call as a single boolean value.protected static boolean
sendResult(IClient client, AMFDataList params, double value)
Send a result to client method call as a single double value.protected static boolean
sendResult(IClient client, AMFDataList params, int value)
Send a result to client method call as a single int value.protected static boolean
sendResult(IClient client, AMFDataList params, AMFData data)
Send a result to client method call as a AMFData object.protected static boolean
sendResult(IClient client, AMFDataList params, String value)
Send a result to client method call as a single String value.protected static void
sendStreamOnStatusError(IMediaStream stream, String code, String description)
Send an error to the client-side NetStream.onStatus handler
-
-
-
Field Detail
-
PARAMMETHODNAME
public static final int PARAMMETHODNAME
Method: method name- See Also:
- Constant Field Values
-
PARAM1
public static final int PARAM1
Method param: param1- See Also:
- Constant Field Values
-
PARAM2
public static final int PARAM2
Method param: param2- See Also:
- Constant Field Values
-
PARAM3
public static final int PARAM3
Method param: param3- See Also:
- Constant Field Values
-
PARAM4
public static final int PARAM4
Method param: param4- See Also:
- Constant Field Values
-
PARAM5
public static final int PARAM5
Method param: param5- See Also:
- Constant Field Values
-
PARAM6
public static final int PARAM6
Method param: param6- See Also:
- Constant Field Values
-
PARAM7
public static final int PARAM7
Method param: param7- See Also:
- Constant Field Values
-
PARAM8
public static final int PARAM8
Method param: param8- See Also:
- Constant Field Values
-
PARAM9
public static final int PARAM9
Method param: param9- See Also:
- Constant Field Values
-
PARAM10
public static final int PARAM10
Method param: param10- See Also:
- Constant Field Values
-
CALLBACK_PARAM1
public static final int CALLBACK_PARAM1
Callback param: param1- See Also:
- Constant Field Values
-
CALLBACK_PARAM2
public static final int CALLBACK_PARAM2
Callback param: param2- See Also:
- Constant Field Values
-
CALLBACK_PARAM3
public static final int CALLBACK_PARAM3
Callback param: param3- See Also:
- Constant Field Values
-
CALLBACK_PARAM4
public static final int CALLBACK_PARAM4
Callback param: param4- See Also:
- Constant Field Values
-
CALLBACK_PARAM5
public static final int CALLBACK_PARAM5
Callback param: param5- See Also:
- Constant Field Values
-
CALLBACK_PARAM6
public static final int CALLBACK_PARAM6
Callback param: param6- See Also:
- Constant Field Values
-
CALLBACK_PARAM7
public static final int CALLBACK_PARAM7
Callback param: param7- See Also:
- Constant Field Values
-
CALLBACK_PARAM8
public static final int CALLBACK_PARAM8
Callback param: param8- See Also:
- Constant Field Values
-
CALLBACK_PARAM9
public static final int CALLBACK_PARAM9
Callback param: param9- See Also:
- Constant Field Values
-
CALLBACK_PARAM10
public static final int CALLBACK_PARAM10
Callback param: param10- See Also:
- Constant Field Values
-
PLAYTRANSITIONSTR_APPEND
public static final String PLAYTRANSITIONSTR_APPEND
Play2 transition: APPEND- See Also:
- Constant Field Values
-
PLAYTRANSITIONSTR_RESET
public static final String PLAYTRANSITIONSTR_RESET
Play2 transition: RESET- See Also:
- Constant Field Values
-
PLAYTRANSITIONSTR_STOP
public static final String PLAYTRANSITIONSTR_STOP
Play2 transition: STOP- See Also:
- Constant Field Values
-
PLAYTRANSITIONSTR_SWAP
public static final String PLAYTRANSITIONSTR_SWAP
Play2 transition: SWAP- See Also:
- Constant Field Values
-
PLAYTRANSITIONSTR_SWITCH
public static final String PLAYTRANSITIONSTR_SWITCH
Play2 transition: SWITCH- See Also:
- Constant Field Values
-
PLAYTRANSITIONSTR_UNKNOWN
public static final String PLAYTRANSITIONSTR_UNKNOWN
Play2 transition: UNKNOWN- See Also:
- Constant Field Values
-
PLAYTRANSITION_APPEND
public static final int PLAYTRANSITION_APPEND
- See Also:
- Constant Field Values
-
PLAYTRANSITION_RESET
public static final int PLAYTRANSITION_RESET
- See Also:
- Constant Field Values
-
PLAYTRANSITION_APPEND_IMMEDIATE
public static final int PLAYTRANSITION_APPEND_IMMEDIATE
- See Also:
- Constant Field Values
-
PLAYTRANSITION_RESET_IMMEDIATE
public static final int PLAYTRANSITION_RESET_IMMEDIATE
- See Also:
- Constant Field Values
-
PLAYTRANSITION_STOP
public static final int PLAYTRANSITION_STOP
- See Also:
- Constant Field Values
-
PLAYTRANSITION_SWAP
public static final int PLAYTRANSITION_SWAP
- See Also:
- Constant Field Values
-
PLAYTRANSITION_SWITCH
public static final int PLAYTRANSITION_SWITCH
- See Also:
- Constant Field Values
-
PLAYTRANSITION_UNKNOWN
public static final int PLAYTRANSITION_UNKNOWN
- See Also:
- Constant Field Values
-
-
Method Detail
-
getParamCount
protected static int getParamCount(AMFDataList params)
Get the total number of parameters passed to method.- Parameters:
params
- parameters- Returns:
- total number of parameters
-
getCallbackParamCount
protected static int getCallbackParamCount(AMFDataList params)
Get the total number of parameters passed to callback.- Parameters:
params
- parameters- Returns:
- total number of parameters
-
getParamType
protected static int getParamType(AMFDataList params, int index)
Get parameter type.- Parameters:
params
- parametersindex
- parameter index- Returns:
- parameter type (AMFData.DATA_TYPE_*)
-
getParam
protected static AMFData getParam(AMFDataList params, int index)
Get parameter by index. Return as AMFData object.- Parameters:
params
- parametersindex
- parameter index- Returns:
- parameter value as AMFData object, null if out of bounds
-
getParamMixedArray
protected static AMFDataMixedArray getParamMixedArray(AMFDataList params, int index)
Get parameter by index, Return as AMFDataMixedArray.- Parameters:
params
- parametersindex
- parameter index- Returns:
- parameter value as AMFDataMixedArray object, null if out of bounds
-
getParamObj
protected static AMFDataObj getParamObj(AMFDataList params, int index)
Get parameter by index, Return as Object.- Parameters:
params
- parametersindex
- parameter index- Returns:
- parameter value as Object object, null if out of bounds
-
getParamString
protected static String getParamString(AMFDataList params, int index)
Get parameter by index, Return as String.- Parameters:
params
- parametersindex
- parameter index- Returns:
- parameter value as String object, null if out of bounds
-
getParamString
protected static String getParamString(AMFDataList params, int index, String defaultVal)
Get parameter by index, Return as String.- Parameters:
params
- parametersindex
- parameter indexdefaultVal
- default value- Returns:
- parameter value as String object, defaultVal if out of bounds
-
getParamDate
protected static java.util.Date getParamDate(AMFDataList params, int index)
Get parameter by index, Return as Date.- Parameters:
params
- parametersindex
- parameter index- Returns:
- parameter value as Date object, null if out of bounds
-
getParamInt
protected static int getParamInt(AMFDataList params, int index)
Get parameter by index, Return as int.- Parameters:
params
- parametersindex
- parameter index- Returns:
- parameter value as int, 0 if out of bounds
-
getParamInt
protected static int getParamInt(AMFDataList params, int index, int defaultVal)
Get parameter by index, Return as int.- Parameters:
params
- parametersindex
- parameter indexdefaultVal
- default value- Returns:
- parameter value as int, defaultVal if out of bounds
-
getParamDouble
protected static double getParamDouble(AMFDataList params, int index)
Get parameter by index, Return as double.- Parameters:
params
- parametersindex
- parameter index- Returns:
- parameter value as double, 0 if out of bounds
-
getParamDouble
protected static double getParamDouble(AMFDataList params, int index, double defaultVal)
Get parameter by index, Return as double.- Parameters:
params
- parametersindex
- parameter indexdefaultVal
- default value- Returns:
- parameter value as double, 0 if out of bounds
-
getParamLong
protected static long getParamLong(AMFDataList params, int index)
Get parameter by index, Return as long.- Parameters:
params
- parametersindex
- parameter index- Returns:
- parameter value as long, 0 if out of bounds
-
getParamLong
protected static long getParamLong(AMFDataList params, int index, long defaultVal)
Get parameter by index, Return as long.- Parameters:
params
- parametersindex
- parameter indexdefaultVal
- default value- Returns:
- parameter value as long, defaultVal if out of bounds
-
getParamBoolean
protected static boolean getParamBoolean(AMFDataList params, int index)
Get parameter by index, Return as boolean.- Parameters:
params
- parametersindex
- parameter index- Returns:
- parameter value as boolean, false if out of bounds
-
getParamBoolean
protected static boolean getParamBoolean(AMFDataList params, int index, boolean defaultVal)
Get parameter by index, Return as boolean.- Parameters:
params
- parametersindex
- parameter indexdefaultVal
- default value- Returns:
- parameter value as boolean, defaultVal if out of bounds
-
getAppInstance
protected static IApplicationInstance getAppInstance(IClient client)
Get applicationInstace of a client.- Parameters:
client
- client- Returns:
- applicationInstance
-
getApplication
protected static IApplication getApplication(IClient client)
Get application of a client.- Parameters:
client
- client- Returns:
- application
-
isSendResult
protected static boolean isSendResult(AMFDataList params)
Is this method call expecting sendResult to be called. If on the client side the call toNetConnection.call("handlerName", resultObj, param1...);
had a value for resultObj (non-null), then the method is expecting some type of result or return data. Calling a variant of sendResult will provide this callback.- Parameters:
params
- parameters- Returns:
- true if client side call is expecting call to sendResult
-
getVHost
protected static IVHost getVHost(IClient client)
Get vHost of a client.- Parameters:
client
- client- Returns:
- vHost
-
sendResult
protected static boolean sendResult(IClient client, AMFDataList params, String value)
Send a result to client method call as a single String value.- Parameters:
client
- clientparams
- parametersvalue
- return value- Returns:
- true if client side call is expecting call to sendResult
-
sendResult
protected static boolean sendResult(IClient client, AMFDataList params, boolean value)
Send a result to client method call as a single boolean value.- Parameters:
client
- clientparams
- parametersvalue
- return value- Returns:
- true if client side call is expecting call to sendResult
-
sendResult
protected static boolean sendResult(IClient client, AMFDataList params, int value)
Send a result to client method call as a single int value.- Parameters:
client
- clientparams
- parametersvalue
- return value- Returns:
- true if client side call is expecting call to sendResult
-
sendResult
protected static boolean sendResult(IClient client, AMFDataList params, double value)
Send a result to client method call as a single double value.- Parameters:
client
- clientparams
- parametersvalue
- return value- Returns:
- true if client side call is expecting call to sendResult
-
sendResult
protected static boolean sendResult(IClient client, AMFDataList params, AMFData data)
Send a result to client method call as a AMFData object. This can be a single AMFData value likenew AMFDataItem((double)1.234)
or a complex type like AMFDataMixedArray, AMFDataArray or AMFDataObj.- Parameters:
client
- clientparams
- parametersdata
- return value- Returns:
- true if client side call is expecting call to sendResult
-
getLogger
protected static WMSLogger getLogger()
Get the logging interface.- Returns:
- logging interface
-
getLogger
protected static WMSLogger getLogger(Class classObj)
Get the logging interface.- Parameters:
classObj
- class object- Returns:
- logging interface
-
getLogger
protected static WMSLogger getLogger(Class classObj, IApplicationInstance appInstance)
Get the logging interface.- Parameters:
classObj
- class objectappInstance
- application instance- Returns:
- logging interface
-
getStream
protected static IMediaStream getStream(IClient client, com.wowza.wms.request.RequestFunction function)
For methods called from the client side object NetStream (publish, play, deleteStream) get the IMediaStream object associated with the call.- Parameters:
client
- clientfunction
- functions- Returns:
- media stream
-
invokePrevious
protected static void invokePrevious(Object instance, IClient client, com.wowza.wms.request.RequestFunction function, AMFDataList params)
Wowza Pro will determine command priority based on the order of the modules in the module list. Wowza Pro by default will only invoke the last module that defines a given command. This method enables you to call the method by the same name in the previous module that defines that command. For example if you have three modules defined in the module list; ModuleCore, ModuleSecureURLParams and ModuleMyModule and all three modules implement the "play" command. When "play" is invoked it will invoke the "play" command in ModuleMyModule. If in ModuleMyModule you would like to call the "play" command in ModuleSecureURLParams, you can call: invokePrevious(this, client, function, params); and it will invoke the "play" command defined in ModuleSecureURLParams.- Parameters:
instance
- instance of the current moduleclient
- client object passed into commandfunction
- function passed into commandparams
- parameters passed into command
-
invokePrevious
protected void invokePrevious(IClient client, com.wowza.wms.request.RequestFunction function, AMFDataList params)
Wowza Pro will determine command priority based on the order of the modules in the module list. Wowza Pro by default will only invoke the last module that defines a given command. This method enables you to call the method by the same name in the previous module that defines that command. For example if you have three modules defined in the module list; ModuleCore, ModuleSecureURLParams and ModuleMyModule and all three modules implement the "play" command. When "play" is invoked it will invoke the "play" command in ModuleMyModule. If in ModuleMyModule you would like to call the "play" command in ModuleSecureURLParams, you can call: this.invokePrevious(client, function, params); and it will invoke the "play" command defined in ModuleSecureURLParams.- Parameters:
client
- client object passed into commandfunction
- function passed into commandparams
- parameters passed into command
-
sendClientOnStatusError
protected static void sendClientOnStatusError(IClient client, String code, String description)
Send an error message to the client-side client.onStatus handler- Parameters:
client
- destination clientcode
- codedescription
- description
-
sendStreamOnStatusError
protected static void sendStreamOnStatusError(IMediaStream stream, String code, String description)
Send an error to the client-side NetStream.onStatus handler- Parameters:
stream
- destination streamcode
- codedescription
- description
-
-