Package com.wowza.wms.sharedobject
Class SharedObject
- Object
- 
- com.wowza.wms.sharedobject.SharedObject
 
- 
- All Implemented Interfaces:
- ISharedObject
 
 public class SharedObject extends Object implements ISharedObject 
- 
- 
Field SummaryFields Modifier and Type Field Description static intREADACCESSstatic intWRITEACCESS- 
Fields inherited from interface com.wowza.wms.sharedobject.ISharedObjectFILEEXTENSION, 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 SummaryConstructors Constructor Description SharedObject(String name)Create new shared objectSharedObject(String name, boolean isPersistent, String storageDir)Create new shared object
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacquire()Increment the reference count to this shared object.voidaddClient(IClient client)Add a client to this shared object.voidaddSlotListener(ISharedObjectSlotNotify slotListener)Add a slot listener.voidclear()Clear all properties from a shared objectvoidclose()Force close this shared object (not implemented)booleancontainsProperty(String slotName)Returns true is slot/property name existsbooleancontainsSlot(String slotName)Returns true is slot/property name existsvoiddeleteSlot(IClient client, String slotName)Remove a slot (property)voiddeleteSlot(String slotName)Remove slot (property)voiddisconnect(IClient client)Disconnect client from shared object.voidflush()Flush (write to disk) shared objectstatic boolean[]getAccess(IClient client, String soName)java.util.List<com.wowza.wms.sharedobject.SharedObjectClient>getClients()Get a list of client that are connected to this shared object.voidgetClientUpdates(IClient client)StringgetName()Get shared object nameISharedObjectsgetParent()Get the shared object container to which this shared object belongs.AMFDatagetProperty(String slotName)Get slot (property) value.intgetRefCount()Get the current reference (clients) connected to this shared object.ISharedObjectSlotgetSlot(String name)Get ISharedObjectSlot interface to a slot (property) by namejava.util.List<String>getSlotNames()Get a list of slot (property) namesjava.util.List<ISharedObjectSlot>getSlots()Get a list of active slotsStringgetStorageDir()Get path used to store shared object.intgetVersion()Get the internval version number.booleanisClient(IClient client)Is this client connected to shared objectbooleanisPersistent()Is this shared object being persisted.voidload()voidlock()Lock a shared object for write accessvoidnotifySlotDelete(ISharedObjectSlot slot)voidnotifySlotSetValue(ISharedObjectSlot slot)intpurge(int version)Purge all deleted properties older than the version numbervoidputSlot(String name, ISharedObjectSlot slot)Add a new slot (property) to a shared object.voidrelease()Descrement the reference count to this shared object.voidremoveClient(IClient client)Remove a client from this shared object.voidremoveSlotListener(ISharedObjectSlotNotify slotListener)Remove slot listenervoidsend(String handlerName)Call client side handler attached to shared object (no parameters).voidsend(String handlerName, Object... params)Call client side handler attached to shared object.voidsendInternal(IClient client, String handlerName, byte[] msgBytes)voidsendInternal(IClient client, String handlerName, byte[] msgBytes, AMFDataContextDeserialize context)voidsendInternal(String handlerName, AMFData[] params)voidsetName(String name)Set shared object namevoidsetParent(ISharedObjects parent)voidsetPersistent(boolean isPersistent)Set is shared object persisted.voidsetProperty(String slotName, boolean value)Set slot (property) value as a boolean value (will be wrapped in an AMFDataItem object)voidsetProperty(String slotName, double value)Set slot (property) value as a double value (will be wrapped in an AMFDataItem object)voidsetProperty(String slotName, int value)Set slot (property) value as a int value (will be wrapped in an AMFDataItem object)voidsetProperty(String slotName, long value)Set slot (property) value as a long value (will be wrapped in an AMFDataItem object)voidsetProperty(String slotName, AMFData data)Set slot (property) value as AMFData object.voidsetProperty(String slotName, String value)Set slot (property) value as a string value (will be wrapped in an AMFDataItem object)voidsetProperty(String slotName, java.util.Date value)Set slot (property) value as a date value (will be wrapped in an AMFDataItem object)voidsetSlotValue(IClient client, String slotName, byte[] byteData)voidsetSlotValue(IClient client, String slotName, byte[] byteData, AMFData amfData)voidsetSlotValue(IClient client, String slotName, byte[] byteData, AMFDataContextDeserialize context)voidsetSlotValue(IClient client, String slotName, byte[] byteData, AMFData amfData, AMFDataContextDeserialize context)voidsetSlotValue(IClient client, String slotName, AMFData amfData)voidsetStorageDir(String storageDir)Set path used to store shared object.voidsetVersion(int version)Set the internal version number.intsize()Get the number of active slot (properties).voidunlock()Unlock a shared object for write accessvoidwriteDeleteError(IClient client, String soName, boolean isPersistent, String slotName, String errorMsg)Write an delete error message back to the clientstatic voidwriteError(IClient client, String soName, boolean isPersistent, String errorMsg, boolean isConnect)voidwriteSetValueError(IClient client, String soName, boolean isPersistent, String slotName, String errorMsg)Write an set value error message back to the client
 
- 
- 
- 
Field Detail- 
READACCESSpublic static final int READACCESS - See Also:
- Constant Field Values
 
 - 
WRITEACCESSpublic static final int WRITEACCESS - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
SharedObjectpublic SharedObject(String name) Create new shared object- Parameters:
- name- shared object name
 
 - 
SharedObjectpublic SharedObject(String name, boolean isPersistent, String storageDir)Create new shared object- Parameters:
- name- shared object name
- isPersistent- is persistent
- storageDir- storage directory for persistent shared object
 
 
- 
 - 
Method Detail- 
sizepublic int size() Description copied from interface:ISharedObjectGet the number of active slot (properties). Deleted slots are not counted.- Specified by:
- sizein interface- ISharedObject
- Returns:
- number of active slot (properties). Deleted slots are not counted
 
 - 
purgepublic int purge(int version) Description copied from interface:ISharedObjectPurge all deleted properties older than the version number- Specified by:
- purgein interface- ISharedObject
- Returns:
- number of slots purged
 
 - 
clearpublic void clear() Description copied from interface:ISharedObjectClear all properties from a shared object- Specified by:
- clearin interface- ISharedObject
 
 - 
getSlotspublic java.util.List<ISharedObjectSlot> getSlots() Description copied from interface:ISharedObjectGet a list of active slots- Specified by:
- getSlotsin interface- ISharedObject
- Returns:
- list of active slots
 
 - 
getSlotNamespublic java.util.List<String> getSlotNames() Description copied from interface:ISharedObjectGet a list of slot (property) names- Specified by:
- getSlotNamesin interface- ISharedObject
- Returns:
- list of slot (property) names
 
 - 
getSlotpublic ISharedObjectSlot getSlot(String name) Description copied from interface:ISharedObjectGet ISharedObjectSlot interface to a slot (property) by name- Specified by:
- getSlotin interface- ISharedObject
- Parameters:
- name- slot (property) name
- Returns:
- ISharedObjectSlot interface
 
 - 
putSlotpublic void putSlot(String name, ISharedObjectSlot slot)Description copied from interface:ISharedObjectAdd a new slot (property) to a shared object.- Specified by:
- putSlotin interface- ISharedObject
- Parameters:
- name- slot (property) name
- slot- new slot
 
 - 
getClientspublic java.util.List<com.wowza.wms.sharedobject.SharedObjectClient> getClients() Description copied from interface:ISharedObjectGet a list of client that are connected to this shared object.- Specified by:
- getClientsin interface- ISharedObject
- Returns:
- list of client that are connected to this shared object
 
 - 
isClientpublic boolean isClient(IClient client) Description copied from interface:ISharedObjectIs this client connected to shared object- Specified by:
- isClientin interface- ISharedObject
- Parameters:
- client- client
- Returns:
- true if client is conencted to shared object
 
 - 
addClientpublic void addClient(IClient client) Description copied from interface:ISharedObjectAdd a client to this shared object.- Specified by:
- addClientin interface- ISharedObject
- Parameters:
- client- client
 
 - 
removeClientpublic void removeClient(IClient client) Description copied from interface:ISharedObjectRemove a client from this shared object.- Specified by:
- removeClientin interface- ISharedObject
- Parameters:
- client- client
 
 - 
acquirepublic void acquire() Description copied from interface:ISharedObjectIncrement the reference count to this shared object.- Specified by:
- acquirein interface- ISharedObject
 
 - 
releasepublic void release() Description copied from interface:ISharedObjectDescrement the reference count to this shared object.- Specified by:
- releasein interface- ISharedObject
 
 - 
getRefCountpublic int getRefCount() Description copied from interface:ISharedObjectGet the current reference (clients) connected to this shared object. Includes unbalanced count of calls to acquire.- Specified by:
- getRefCountin interface- ISharedObject
- Returns:
- the current reference (clients) connected to this shared object
 
 - 
isPersistentpublic boolean isPersistent() Description copied from interface:ISharedObjectIs this shared object being persisted.- Specified by:
- isPersistentin interface- ISharedObject
- Returns:
- true if shared object is being persisted
 
 - 
setPersistentpublic void setPersistent(boolean isPersistent) Description copied from interface:ISharedObjectSet is shared object persisted.- Specified by:
- setPersistentin interface- ISharedObject
- Parameters:
- isPersistent- true if shared object is being persisted
 
 - 
getVersionpublic int getVersion() Description copied from interface:ISharedObjectGet the internval version number.- Specified by:
- getVersionin interface- ISharedObject
- Returns:
- internval version number
 
 - 
setVersionpublic void setVersion(int version) Description copied from interface:ISharedObjectSet the internal version number.- Specified by:
- setVersionin interface- ISharedObject
- Parameters:
- version- internal version number
 
 - 
deleteSlotpublic void deleteSlot(String slotName) Description copied from interface:ISharedObjectRemove slot (property)- Specified by:
- deleteSlotin interface- ISharedObject
- Parameters:
- slotName- slot (property) name
 
 - 
containsPropertypublic boolean containsProperty(String slotName) Description copied from interface:ISharedObjectReturns true is slot/property name exists- Specified by:
- containsPropertyin interface- ISharedObject
- Parameters:
- slotName- slot/property name
- Returns:
- true is slot/property name exists
 
 - 
containsSlotpublic boolean containsSlot(String slotName) Description copied from interface:ISharedObjectReturns true is slot/property name exists- Specified by:
- containsSlotin interface- ISharedObject
- Parameters:
- slotName- slot/property name
- Returns:
- true is slot/property name exists
 
 - 
deleteSlotpublic void deleteSlot(IClient client, String slotName) Description copied from interface:ISharedObjectRemove a slot (property)- Specified by:
- deleteSlotin interface- ISharedObject
- Parameters:
- client- client removing slot or null if server side code
- slotName- slot (property) name
 
 - 
getPropertypublic AMFData getProperty(String slotName) Description copied from interface:ISharedObjectGet slot (property) value.- Specified by:
- getPropertyin interface- ISharedObject
- Parameters:
- slotName- slot (property) name
- Returns:
- slot (property) value as AMFData object
 
 - 
setPropertypublic void setProperty(String slotName, boolean value)Description copied from interface:ISharedObjectSet slot (property) value as a boolean value (will be wrapped in an AMFDataItem object)- Specified by:
- setPropertyin interface- ISharedObject
- Parameters:
- slotName- slot (property) name
- value- boolean value
 
 - 
setPropertypublic void setProperty(String slotName, java.util.Date value)Description copied from interface:ISharedObjectSet slot (property) value as a date value (will be wrapped in an AMFDataItem object)- Specified by:
- setPropertyin interface- ISharedObject
- Parameters:
- slotName- slot (property) name
- value- date value
 
 - 
setPropertypublic void setProperty(String slotName, double value)Description copied from interface:ISharedObjectSet slot (property) value as a double value (will be wrapped in an AMFDataItem object)- Specified by:
- setPropertyin interface- ISharedObject
- Parameters:
- slotName- slot (property) name
- value- double value
 
 - 
setPropertypublic void setProperty(String slotName, long value)Description copied from interface:ISharedObjectSet slot (property) value as a long value (will be wrapped in an AMFDataItem object)- Specified by:
- setPropertyin interface- ISharedObject
- Parameters:
- slotName- slot (property) name
- value- long value
 
 - 
setPropertypublic void setProperty(String slotName, int value)Description copied from interface:ISharedObjectSet slot (property) value as a int value (will be wrapped in an AMFDataItem object)- Specified by:
- setPropertyin interface- ISharedObject
- Parameters:
- slotName- slot (property) name
- value- int value
 
 - 
setPropertypublic void setProperty(String slotName, String value)Description copied from interface:ISharedObjectSet slot (property) value as a string value (will be wrapped in an AMFDataItem object)- Specified by:
- setPropertyin interface- ISharedObject
- Parameters:
- slotName- slot (property) name
- value- string value
 
 - 
setPropertypublic void setProperty(String slotName, AMFData data)Description copied from interface:ISharedObjectSet slot (property) value as AMFData object.- Specified by:
- setPropertyin interface- ISharedObject
- Parameters:
- slotName- slot (property) name
- data- slot value as AMFData object. Example: new AMFDataItem((double)1.234) or new AMFDataItem()
 
 - 
setSlotValuepublic void setSlotValue(IClient client, String slotName, byte[] byteData) 
 - 
setSlotValuepublic void setSlotValue(IClient client, String slotName, byte[] byteData, AMFDataContextDeserialize context) 
 - 
setSlotValuepublic void setSlotValue(IClient client, String slotName, byte[] byteData, AMFData amfData) 
 - 
setSlotValuepublic void setSlotValue(IClient client, String slotName, byte[] byteData, AMFData amfData, AMFDataContextDeserialize context) 
 - 
writeErrorpublic static void writeError(IClient client, String soName, boolean isPersistent, String errorMsg, boolean isConnect) 
 - 
writeSetValueErrorpublic void writeSetValueError(IClient client, String soName, boolean isPersistent, String slotName, String errorMsg) Description copied from interface:ISharedObjectWrite an set value error message back to the client- Specified by:
- writeSetValueErrorin interface- ISharedObject
- Parameters:
- client- client removing slot or null if server side code
- soName- sharedObject name
- isPersistent- is persistent
- slotName- slot name
- errorMsg- error message
 
 - 
writeDeleteErrorpublic void writeDeleteError(IClient client, String soName, boolean isPersistent, String slotName, String errorMsg) Description copied from interface:ISharedObjectWrite an delete error message back to the client- Specified by:
- writeDeleteErrorin interface- ISharedObject
- Parameters:
- client- client removing slot or null if server side code
- soName- sharedObject name
- isPersistent- is persistent
- slotName- slot name
- errorMsg- error message
 
 - 
getClientUpdatespublic void getClientUpdates(IClient client) 
 - 
disconnectpublic void disconnect(IClient client) Description copied from interface:ISharedObjectDisconnect client from shared object.- Specified by:
- disconnectin interface- ISharedObject
- Parameters:
- client- client to disconnect
 
 - 
getNamepublic String getName() Description copied from interface:ISharedObjectGet shared object name- Specified by:
- getNamein interface- ISharedObject
- Returns:
- shared object name
 
 - 
setNamepublic void setName(String name) Description copied from interface:ISharedObjectSet shared object name- Specified by:
- setNamein interface- ISharedObject
- Parameters:
- name- shared object name
 
 - 
sendpublic void send(String handlerName, Object... params)Description copied from interface:ISharedObjectCall client side handler attached to shared object.- Specified by:
- sendin interface- ISharedObject
- Parameters:
- handlerName- handler name
- params- variable argument list of parameters
 
 - 
sendpublic void send(String handlerName) Description copied from interface:ISharedObjectCall client side handler attached to shared object (no parameters).- Specified by:
- sendin interface- ISharedObject
- Parameters:
- handlerName- handler name
 
 - 
sendInternalpublic void sendInternal(String handlerName, AMFData[] params)
 - 
sendInternalpublic void sendInternal(IClient client, String handlerName, byte[] msgBytes) 
 - 
sendInternalpublic void sendInternal(IClient client, String handlerName, byte[] msgBytes, AMFDataContextDeserialize context) 
 - 
addSlotListenerpublic void addSlotListener(ISharedObjectSlotNotify slotListener) Description copied from interface:ISharedObjectAdd a slot listener. Will receive the following events: onSlotSetValue and onSlotDelete- Specified by:
- addSlotListenerin interface- ISharedObject
- Parameters:
- slotListener- slot listener
 
 - 
removeSlotListenerpublic void removeSlotListener(ISharedObjectSlotNotify slotListener) Description copied from interface:ISharedObjectRemove slot listener- Specified by:
- removeSlotListenerin interface- ISharedObject
- Parameters:
- slotListener- slot listener
 
 - 
notifySlotSetValuepublic void notifySlotSetValue(ISharedObjectSlot slot) 
 - 
notifySlotDeletepublic void notifySlotDelete(ISharedObjectSlot slot) 
 - 
getStorageDirpublic String getStorageDir() Description copied from interface:ISharedObjectGet path used to store shared object.- Specified by:
- getStorageDirin interface- ISharedObject
- Returns:
- path used to store shared object
 
 - 
setStorageDirpublic void setStorageDir(String storageDir) Description copied from interface:ISharedObjectSet path used to store shared object.- Specified by:
- setStorageDirin interface- ISharedObject
- Parameters:
- storageDir- path used to store shared object
 
 - 
flushpublic void flush() Description copied from interface:ISharedObjectFlush (write to disk) shared object- Specified by:
- flushin interface- ISharedObject
 
 - 
loadpublic void load() 
 - 
closepublic void close() Description copied from interface:ISharedObjectForce close this shared object (not implemented)- Specified by:
- closein interface- ISharedObject
 
 - 
lockpublic void lock() Description copied from interface:ISharedObjectLock a shared object for write access- Specified by:
- lockin interface- ISharedObject
 
 - 
unlockpublic void unlock() Description copied from interface:ISharedObjectUnlock a shared object for write access- Specified by:
- unlockin interface- ISharedObject
 
 - 
setParentpublic void setParent(ISharedObjects parent) 
 - 
getParentpublic ISharedObjects getParent() Description copied from interface:ISharedObjectGet the shared object container to which this shared object belongs.- Specified by:
- getParentin interface- ISharedObject
- Returns:
- shared object container
 
 - 
getAccesspublic static boolean[] getAccess(IClient client, String soName) 
 
- 
 
-