Package com.wowza.wms.sharedobject
Class SharedObject
Object
com.wowza.wms.sharedobject.SharedObject
- All Implemented Interfaces:
ISharedObject
-
Field Summary
FieldsFields inherited from interface com.wowza.wms.sharedobject.ISharedObject
FILEEXTENSION, SHAREDOBJECT_CMD_CONNECT, SHAREDOBJECT_CMD_CONNECTSUCCESS, SHAREDOBJECT_CMD_DELETE, SHAREDOBJECT_CMD_DISCONNECT, SHAREDOBJECT_CMD_ERROR, SHAREDOBJECT_CMD_SEND, SHAREDOBJECT_CMD_SETVALUE, SHAREDOBJECT_STATUS_CHANGE, SHAREDOBJECT_STATUS_CLEAR, SHAREDOBJECT_STATUS_DELETE, SHAREDOBJECT_STATUS_SUCCESS
-
Constructor Summary
ConstructorsConstructorDescriptionSharedObject
(String name) Create new shared objectSharedObject
(String name, boolean isPersistent, String storageDir) Create new shared object -
Method Summary
Modifier and TypeMethodDescriptionvoid
acquire()
Increment the reference count to this shared object.void
Add a client to this shared object.void
addSlotListener
(ISharedObjectSlotNotify slotListener) Add a slot listener.void
clear()
Clear all properties from a shared objectvoid
close()
Force close this shared object (not implemented)boolean
containsProperty
(String slotName) Returns true is slot/property name existsboolean
containsSlot
(String slotName) Returns true is slot/property name existsvoid
deleteSlot
(IClient client, String slotName) Remove a slot (property)void
deleteSlot
(String slotName) Remove slot (property)void
disconnect
(IClient client) Disconnect client from shared object.void
flush()
Flush (write to disk) shared objectstatic boolean[]
List<com.wowza.wms.sharedobject.SharedObjectClient>
Get a list of client that are connected to this shared object.void
getClientUpdates
(IClient client) getName()
Get shared object nameGet the shared object container to which this shared object belongs.getProperty
(String slotName) Get slot (property) value.int
Get the current reference (clients) connected to this shared object.Get ISharedObjectSlot interface to a slot (property) by nameGet a list of slot (property) namesgetSlots()
Get a list of active slotsGet path used to store shared object.int
Get the internval version number.boolean
Is this client connected to shared objectboolean
Is this shared object being persisted.void
load()
void
lock()
Lock a shared object for write accessvoid
void
int
purge
(int version) Purge all deleted properties older than the version numbervoid
putSlot
(String name, ISharedObjectSlot slot) Add a new slot (property) to a shared object.void
release()
Descrement the reference count to this shared object.void
removeClient
(IClient client) Remove a client from this shared object.void
removeSlotListener
(ISharedObjectSlotNotify slotListener) Remove slot listenervoid
Call client side handler attached to shared object (no parameters).void
Call client side handler attached to shared object.void
sendInternal
(IClient client, String handlerName, byte[] msgBytes) void
sendInternal
(IClient client, String handlerName, byte[] msgBytes, AMFDataContextDeserialize context) void
sendInternal
(String handlerName, AMFData[] params) void
Set shared object namevoid
setParent
(ISharedObjects parent) void
setPersistent
(boolean isPersistent) Set is shared object persisted.void
setProperty
(String slotName, boolean value) Set slot (property) value as a boolean value (will be wrapped in an AMFDataItem object)void
setProperty
(String slotName, double value) Set slot (property) value as a double value (will be wrapped in an AMFDataItem object)void
setProperty
(String slotName, int value) Set slot (property) value as a int value (will be wrapped in an AMFDataItem object)void
setProperty
(String slotName, long value) Set slot (property) value as a long value (will be wrapped in an AMFDataItem object)void
setProperty
(String slotName, AMFData data) Set slot (property) value as AMFData object.void
setProperty
(String slotName, String value) Set slot (property) value as a string value (will be wrapped in an AMFDataItem object)void
setProperty
(String slotName, Date value) Set slot (property) value as a date value (will be wrapped in an AMFDataItem object)void
setSlotValue
(IClient client, String slotName, byte[] byteData) void
setSlotValue
(IClient client, String slotName, byte[] byteData, AMFData amfData) void
setSlotValue
(IClient client, String slotName, byte[] byteData, AMFDataContextDeserialize context) void
setSlotValue
(IClient client, String slotName, byte[] byteData, AMFData amfData, AMFDataContextDeserialize context) void
setSlotValue
(IClient client, String slotName, AMFData amfData) void
setStorageDir
(String storageDir) Set path used to store shared object.void
setVersion
(int version) Set the internal version number.int
size()
Get the number of active slot (properties).void
unlock()
Unlock a shared object for write accessvoid
writeDeleteError
(IClient client, String soName, boolean isPersistent, String slotName, String errorMsg) Write an delete error message back to the clientstatic void
writeError
(IClient client, String soName, boolean isPersistent, String errorMsg, boolean isConnect) void
writeSetValueError
(IClient client, String soName, boolean isPersistent, String slotName, String errorMsg) Write an set value error message back to the client
-
Field Details
-
READACCESS
public static final int READACCESS- See Also:
-
WRITEACCESS
public static final int WRITEACCESS- See Also:
-
-
Constructor Details
-
SharedObject
Create new shared object- Parameters:
name
- shared object name
-
SharedObject
Create new shared object- Parameters:
name
- shared object nameisPersistent
- is persistentstorageDir
- storage directory for persistent shared object
-
-
Method Details
-
size
public int size()Description copied from interface:ISharedObject
Get the number of active slot (properties). Deleted slots are not counted.- Specified by:
size
in interfaceISharedObject
- Returns:
- number of active slot (properties). Deleted slots are not counted
-
purge
public int purge(int version) Description copied from interface:ISharedObject
Purge all deleted properties older than the version number- Specified by:
purge
in interfaceISharedObject
- Returns:
- number of slots purged
-
clear
public void clear()Description copied from interface:ISharedObject
Clear all properties from a shared object- Specified by:
clear
in interfaceISharedObject
-
getSlots
Description copied from interface:ISharedObject
Get a list of active slots- Specified by:
getSlots
in interfaceISharedObject
- Returns:
- list of active slots
-
getSlotNames
Description copied from interface:ISharedObject
Get a list of slot (property) names- Specified by:
getSlotNames
in interfaceISharedObject
- Returns:
- list of slot (property) names
-
getSlot
Description copied from interface:ISharedObject
Get ISharedObjectSlot interface to a slot (property) by name- Specified by:
getSlot
in interfaceISharedObject
- Parameters:
name
- slot (property) name- Returns:
- ISharedObjectSlot interface
-
getClients
Description copied from interface:ISharedObject
Get a list of client that are connected to this shared object.- Specified by:
getClients
in interfaceISharedObject
- Returns:
- list of client that are connected to this shared object
-
isClient
Description copied from interface:ISharedObject
Is this client connected to shared object- Specified by:
isClient
in interfaceISharedObject
- Parameters:
client
- client- Returns:
- true if client is conencted to shared object
-
addClient
Description copied from interface:ISharedObject
Add a client to this shared object.- Specified by:
addClient
in interfaceISharedObject
- Parameters:
client
- client
-
removeClient
Description copied from interface:ISharedObject
Remove a client from this shared object.- Specified by:
removeClient
in interfaceISharedObject
- Parameters:
client
- client
-
acquire
public void acquire()Description copied from interface:ISharedObject
Increment the reference count to this shared object.- Specified by:
acquire
in interfaceISharedObject
-
release
public void release()Description copied from interface:ISharedObject
Descrement the reference count to this shared object.- Specified by:
release
in interfaceISharedObject
-
getRefCount
public int getRefCount()Description copied from interface:ISharedObject
Get the current reference (clients) connected to this shared object. Includes unbalanced count of calls to acquire.- Specified by:
getRefCount
in interfaceISharedObject
- Returns:
- the current reference (clients) connected to this shared object
-
isPersistent
public boolean isPersistent()Description copied from interface:ISharedObject
Is this shared object being persisted.- Specified by:
isPersistent
in interfaceISharedObject
- Returns:
- true if shared object is being persisted
-
setPersistent
public void setPersistent(boolean isPersistent) Description copied from interface:ISharedObject
Set is shared object persisted.- Specified by:
setPersistent
in interfaceISharedObject
- Parameters:
isPersistent
- true if shared object is being persisted
-
getVersion
public int getVersion()Description copied from interface:ISharedObject
Get the internval version number.- Specified by:
getVersion
in interfaceISharedObject
- Returns:
- internval version number
-
setVersion
public void setVersion(int version) Description copied from interface:ISharedObject
Set the internal version number.- Specified by:
setVersion
in interfaceISharedObject
- Parameters:
version
- internal version number
-
deleteSlot
Description copied from interface:ISharedObject
Remove slot (property)- Specified by:
deleteSlot
in interfaceISharedObject
- Parameters:
slotName
- slot (property) name
-
containsProperty
Description copied from interface:ISharedObject
Returns true is slot/property name exists- Specified by:
containsProperty
in interfaceISharedObject
- Parameters:
slotName
- slot/property name- Returns:
- true is slot/property name exists
-
containsSlot
Description copied from interface:ISharedObject
Returns true is slot/property name exists- Specified by:
containsSlot
in interfaceISharedObject
- Parameters:
slotName
- slot/property name- Returns:
- true is slot/property name exists
-
deleteSlot
Description copied from interface:ISharedObject
Remove a slot (property)- Specified by:
deleteSlot
in interfaceISharedObject
- Parameters:
client
- client removing slot or null if server side codeslotName
- slot (property) name
-
getProperty
Description copied from interface:ISharedObject
Get slot (property) value.- Specified by:
getProperty
in interfaceISharedObject
- Parameters:
slotName
- slot (property) name- Returns:
- slot (property) value as AMFData object
-
setProperty
Description copied from interface:ISharedObject
Set slot (property) value as a boolean value (will be wrapped in an AMFDataItem object)- Specified by:
setProperty
in interfaceISharedObject
- Parameters:
slotName
- slot (property) namevalue
- boolean value
-
setProperty
Description copied from interface:ISharedObject
Set slot (property) value as a date value (will be wrapped in an AMFDataItem object)- Specified by:
setProperty
in interfaceISharedObject
- Parameters:
slotName
- slot (property) namevalue
- date value
-
setProperty
Description copied from interface:ISharedObject
Set slot (property) value as a double value (will be wrapped in an AMFDataItem object)- Specified by:
setProperty
in interfaceISharedObject
- Parameters:
slotName
- slot (property) namevalue
- double value
-
setProperty
Description copied from interface:ISharedObject
Set slot (property) value as a long value (will be wrapped in an AMFDataItem object)- Specified by:
setProperty
in interfaceISharedObject
- Parameters:
slotName
- slot (property) namevalue
- long value
-
setProperty
Description copied from interface:ISharedObject
Set slot (property) value as a int value (will be wrapped in an AMFDataItem object)- Specified by:
setProperty
in interfaceISharedObject
- Parameters:
slotName
- slot (property) namevalue
- int value
-
setProperty
Description copied from interface:ISharedObject
Set slot (property) value as a string value (will be wrapped in an AMFDataItem object)- Specified by:
setProperty
in interfaceISharedObject
- Parameters:
slotName
- slot (property) namevalue
- string value
-
setProperty
Description copied from interface:ISharedObject
Set slot (property) value as AMFData object.- Specified by:
setProperty
in interfaceISharedObject
- Parameters:
slotName
- slot (property) namedata
- slot value as AMFData object. Example: new AMFDataItem((double)1.234) or new AMFDataItem()
-
setSlotValue
-
setSlotValue
-
setSlotValue
public void setSlotValue(IClient client, String slotName, byte[] byteData, AMFDataContextDeserialize context) -
setSlotValue
-
setSlotValue
public void setSlotValue(IClient client, String slotName, byte[] byteData, AMFData amfData, AMFDataContextDeserialize context) -
writeError
-
writeSetValueError
public void writeSetValueError(IClient client, String soName, boolean isPersistent, String slotName, String errorMsg) Description copied from interface:ISharedObject
Write an set value error message back to the client- Specified by:
writeSetValueError
in interfaceISharedObject
- Parameters:
client
- client removing slot or null if server side codesoName
- sharedObject nameisPersistent
- is persistentslotName
- slot nameerrorMsg
- error message
-
writeDeleteError
public void writeDeleteError(IClient client, String soName, boolean isPersistent, String slotName, String errorMsg) Description copied from interface:ISharedObject
Write an delete error message back to the client- Specified by:
writeDeleteError
in interfaceISharedObject
- Parameters:
client
- client removing slot or null if server side codesoName
- sharedObject nameisPersistent
- is persistentslotName
- slot nameerrorMsg
- error message
-
getClientUpdates
-
disconnect
Description copied from interface:ISharedObject
Disconnect client from shared object.- Specified by:
disconnect
in interfaceISharedObject
- Parameters:
client
- client to disconnect
-
getName
Description copied from interface:ISharedObject
Get shared object name- Specified by:
getName
in interfaceISharedObject
- Returns:
- shared object name
-
setName
Description copied from interface:ISharedObject
Set shared object name- Specified by:
setName
in interfaceISharedObject
- Parameters:
name
- shared object name
-
send
Description copied from interface:ISharedObject
Call client side handler attached to shared object.- Specified by:
send
in interfaceISharedObject
- Parameters:
handlerName
- handler nameparams
- variable argument list of parameters
-
send
Description copied from interface:ISharedObject
Call client side handler attached to shared object (no parameters).- Specified by:
send
in interfaceISharedObject
- Parameters:
handlerName
- handler name
-
sendInternal
-
sendInternal
-
sendInternal
public void sendInternal(IClient client, String handlerName, byte[] msgBytes, AMFDataContextDeserialize context) -
getStorageDir
Description copied from interface:ISharedObject
Get path used to store shared object.- Specified by:
getStorageDir
in interfaceISharedObject
- Returns:
- path used to store shared object
-
setStorageDir
Description copied from interface:ISharedObject
Set path used to store shared object.- Specified by:
setStorageDir
in interfaceISharedObject
- Parameters:
storageDir
- path used to store shared object
-
flush
public void flush()Description copied from interface:ISharedObject
Flush (write to disk) shared object- Specified by:
flush
in interfaceISharedObject
-
load
public void load() -
close
public void close()Description copied from interface:ISharedObject
Force close this shared object (not implemented)- Specified by:
close
in interfaceISharedObject
-
lock
public void lock()Description copied from interface:ISharedObject
Lock a shared object for write access- Specified by:
lock
in interfaceISharedObject
-
unlock
public void unlock()Description copied from interface:ISharedObject
Unlock a shared object for write access- Specified by:
unlock
in interfaceISharedObject
-
getParent
Description copied from interface:ISharedObject
Get the shared object container to which this shared object belongs.- Specified by:
getParent
in interfaceISharedObject
- Returns:
- shared object container
-
getAccess
-