Interface ISharedObject

  • All Known Implementing Classes:
    SharedObject

    public interface ISharedObject

    ISharedObject: public interface to SharedObject class.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void acquire()
      Increment the reference count to this shared object.
      void addClient​(IClient client)
      Add a client to this shared object.
      void addSlotListener​(ISharedObjectSlotNotify slotListener)
      Add a slot listener.
      void clear()
      Clear all properties from a shared object
      void close()
      Force close this shared object (not implemented)
      boolean containsProperty​(String slotName)
      Returns true is slot/property name exists
      boolean containsSlot​(String slotName)
      Returns true is slot/property name exists
      void 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 object
      java.util.List<com.wowza.wms.sharedobject.SharedObjectClient> getClients()
      Get a list of client that are connected to this shared object.
      String getName()
      Get shared object name
      ISharedObjects getParent()
      Get the shared object container to which this shared object belongs.
      AMFData getProperty​(String slotName)
      Get slot (property) value.
      int getRefCount()
      Get the current reference (clients) connected to this shared object.
      ISharedObjectSlot getSlot​(String name)
      Get ISharedObjectSlot interface to a slot (property) by name
      java.util.List<String> getSlotNames()
      Get a list of slot (property) names
      java.util.List<ISharedObjectSlot> getSlots()
      Get a list of active slots
      String getStorageDir()
      Get path used to store shared object.
      int getVersion()
      Get the internval version number.
      boolean isClient​(IClient client)
      Is this client connected to shared object
      boolean isPersistent()
      Is this shared object being persisted.
      void lock()
      Lock a shared object for write access
      int purge​(int version)
      Purge all deleted properties older than the version number
      void 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 listener
      void send​(String handlerName)
      Call client side handler attached to shared object (no parameters).
      void send​(String handlerName, Object... params)
      Call client side handler attached to shared object.
      void setName​(String name)
      Set shared object name
      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, java.util.Date value)
      Set slot (property) value as a date value (will be wrapped in an AMFDataItem object)
      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 access
      void writeDeleteError​(IClient client, String soName, boolean isPersistent, String slotName, String errorMsg)
      Write an delete error message back to the client
      void writeSetValueError​(IClient client, String soName, boolean isPersistent, String slotName, String errorMsg)
      Write an set value error message back to the client
    • Field Detail

      • SHAREDOBJECT_CMD_CONNECT

        static final byte SHAREDOBJECT_CMD_CONNECT
        shared object command: connect
        See Also:
        Constant Field Values
      • SHAREDOBJECT_CMD_DISCONNECT

        static final byte SHAREDOBJECT_CMD_DISCONNECT
        shared object command: disconnect
        See Also:
        Constant Field Values
      • SHAREDOBJECT_CMD_SETVALUE

        static final byte SHAREDOBJECT_CMD_SETVALUE
        shared object command: setvalue
        See Also:
        Constant Field Values
      • SHAREDOBJECT_CMD_SEND

        static final byte SHAREDOBJECT_CMD_SEND
        shared object command: send
        See Also:
        Constant Field Values
      • SHAREDOBJECT_CMD_ERROR

        static final byte SHAREDOBJECT_CMD_ERROR
        shared object command: error
        See Also:
        Constant Field Values
      • SHAREDOBJECT_CMD_DELETE

        static final byte SHAREDOBJECT_CMD_DELETE
        shared object command: delete
        See Also:
        Constant Field Values
      • SHAREDOBJECT_CMD_CONNECTSUCCESS

        static final byte SHAREDOBJECT_CMD_CONNECTSUCCESS
        shared object command: clear
        See Also:
        Constant Field Values
      • SHAREDOBJECT_STATUS_CHANGE

        static final byte SHAREDOBJECT_STATUS_CHANGE
        shared object status: change
        See Also:
        Constant Field Values
      • SHAREDOBJECT_STATUS_SUCCESS

        static final byte SHAREDOBJECT_STATUS_SUCCESS
        shared object status: success
        See Also:
        Constant Field Values
      • SHAREDOBJECT_STATUS_CLEAR

        static final byte SHAREDOBJECT_STATUS_CLEAR
        shared object status: clear
        See Also:
        Constant Field Values
      • SHAREDOBJECT_STATUS_DELETE

        static final byte SHAREDOBJECT_STATUS_DELETE
        shared object status: delete
        See Also:
        Constant Field Values
    • Method Detail

      • getSlotNames

        java.util.List<String> getSlotNames()
        Get a list of slot (property) names
        Returns:
        list of slot (property) names
      • getSlot

        ISharedObjectSlot getSlot​(String name)
        Get ISharedObjectSlot interface to a slot (property) by name
        Parameters:
        name - slot (property) name
        Returns:
        ISharedObjectSlot interface
      • putSlot

        void putSlot​(String name,
                     ISharedObjectSlot slot)
        Add a new slot (property) to a shared object.
        Parameters:
        name - slot (property) name
        slot - new slot
      • getClients

        java.util.List<com.wowza.wms.sharedobject.SharedObjectClient> getClients()
        Get a list of client that are connected to this shared object.
        Returns:
        list of client that are connected to this shared object
      • isClient

        boolean isClient​(IClient client)
        Is this client connected to shared object
        Parameters:
        client - client
        Returns:
        true if client is conencted to shared object
      • addClient

        void addClient​(IClient client)
        Add a client to this shared object.
        Parameters:
        client - client
      • removeClient

        void removeClient​(IClient client)
        Remove a client from this shared object.
        Parameters:
        client - client
      • size

        int size()
        Get the number of active slot (properties). Deleted slots are not counted.
        Returns:
        number of active slot (properties). Deleted slots are not counted
      • acquire

        void acquire()
        Increment the reference count to this shared object.
      • release

        void release()
        Descrement the reference count to this shared object.
      • close

        void close()
        Force close this shared object (not implemented)
      • getRefCount

        int getRefCount()
        Get the current reference (clients) connected to this shared object. Includes unbalanced count of calls to acquire.
        Returns:
        the current reference (clients) connected to this shared object
      • isPersistent

        boolean isPersistent()
        Is this shared object being persisted.
        Returns:
        true if shared object is being persisted
      • setPersistent

        void setPersistent​(boolean isPersistent)
        Set is shared object persisted.
        Parameters:
        isPersistent - true if shared object is being persisted
      • getVersion

        int getVersion()
        Get the internval version number.
        Returns:
        internval version number
      • setVersion

        void setVersion​(int version)
        Set the internal version number.
        Parameters:
        version - internal version number
      • flush

        void flush()
        Flush (write to disk) shared object
      • deleteSlot

        void deleteSlot​(IClient client,
                        String slotName)
        Remove a slot (property)
        Parameters:
        client - client removing slot or null if server side code
        slotName - slot (property) name
      • deleteSlot

        void deleteSlot​(String slotName)
        Remove slot (property)
        Parameters:
        slotName - slot (property) name
      • getProperty

        AMFData getProperty​(String slotName)
        Get slot (property) value.
        Parameters:
        slotName - slot (property) name
        Returns:
        slot (property) value as AMFData object
      • setProperty

        void setProperty​(String slotName,
                         String value)
        Set slot (property) value as a string value (will be wrapped in an AMFDataItem object)
        Parameters:
        slotName - slot (property) name
        value - string value
      • setProperty

        void setProperty​(String slotName,
                         double value)
        Set slot (property) value as a double value (will be wrapped in an AMFDataItem object)
        Parameters:
        slotName - slot (property) name
        value - double value
      • setProperty

        void setProperty​(String slotName,
                         int value)
        Set slot (property) value as a int value (will be wrapped in an AMFDataItem object)
        Parameters:
        slotName - slot (property) name
        value - int value
      • setProperty

        void setProperty​(String slotName,
                         long value)
        Set slot (property) value as a long value (will be wrapped in an AMFDataItem object)
        Parameters:
        slotName - slot (property) name
        value - long value
      • setProperty

        void setProperty​(String slotName,
                         java.util.Date value)
        Set slot (property) value as a date value (will be wrapped in an AMFDataItem object)
        Parameters:
        slotName - slot (property) name
        value - date value
      • setProperty

        void setProperty​(String slotName,
                         boolean value)
        Set slot (property) value as a boolean value (will be wrapped in an AMFDataItem object)
        Parameters:
        slotName - slot (property) name
        value - boolean value
      • setProperty

        void setProperty​(String slotName,
                         AMFData data)
        Set slot (property) value as AMFData object.
        Parameters:
        slotName - slot (property) name
        data - slot value as AMFData object. Example: new AMFDataItem((double)1.234) or new AMFDataItem()
      • disconnect

        void disconnect​(IClient client)
        Disconnect client from shared object.
        Parameters:
        client - client to disconnect
      • getName

        String getName()
        Get shared object name
        Returns:
        shared object name
      • setName

        void setName​(String name)
        Set shared object name
        Parameters:
        name - shared object name
      • send

        void send​(String handlerName,
                  Object... params)
        Call client side handler attached to shared object.
        Parameters:
        handlerName - handler name
        params - variable argument list of parameters
      • send

        void send​(String handlerName)
        Call client side handler attached to shared object (no parameters).
        Parameters:
        handlerName - handler name
      • addSlotListener

        void addSlotListener​(ISharedObjectSlotNotify slotListener)
        Add a slot listener. Will receive the following events: onSlotSetValue and onSlotDelete
        Parameters:
        slotListener - slot listener
      • removeSlotListener

        void removeSlotListener​(ISharedObjectSlotNotify slotListener)
        Remove slot listener
        Parameters:
        slotListener - slot listener
      • getStorageDir

        String getStorageDir()
        Get path used to store shared object.
        Returns:
        path used to store shared object
      • setStorageDir

        void setStorageDir​(String storageDir)
        Set path used to store shared object.
        Parameters:
        storageDir - path used to store shared object
      • writeSetValueError

        void writeSetValueError​(IClient client,
                                String soName,
                                boolean isPersistent,
                                String slotName,
                                String errorMsg)
        Write an set value error message back to the client
        Parameters:
        client - client removing slot or null if server side code
        soName - sharedObject name
        isPersistent - is persistent
        slotName - slot name
        errorMsg - error message
      • writeDeleteError

        void writeDeleteError​(IClient client,
                              String soName,
                              boolean isPersistent,
                              String slotName,
                              String errorMsg)
        Write an delete error message back to the client
        Parameters:
        client - client removing slot or null if server side code
        soName - sharedObject name
        isPersistent - is persistent
        slotName - slot name
        errorMsg - error message
      • clear

        void clear()
        Clear all properties from a shared object
      • purge

        int purge​(int version)
        Purge all deleted properties older than the version number
        Returns:
        number of slots purged
      • getSlots

        java.util.List<ISharedObjectSlot> getSlots()
        Get a list of active slots
        Returns:
        list of active slots
      • containsProperty

        boolean containsProperty​(String slotName)
        Returns true is slot/property name exists
        Parameters:
        slotName - slot/property name
        Returns:
        true is slot/property name exists
      • containsSlot

        boolean containsSlot​(String slotName)
        Returns true is slot/property name exists
        Parameters:
        slotName - slot/property name
        Returns:
        true is slot/property name exists
      • lock

        void lock()
        Lock a shared object for write access
      • unlock

        void unlock()
        Unlock a shared object for write access
      • getParent

        ISharedObjects getParent()
        Get the shared object container to which this shared object belongs.
        Returns:
        shared object container