## org.red5.server.stream
Class BroadcastScope

    java.lang.Object
      org.red5.server.AttributeStore
          org.red5.server.PersistableAttributeStore
              org.red5.server.BasicScope
                  org.red5.server.stream.BroadcastScope

All Implemented Interfaces:
  Iterable<IBasicScope>, AttributeStoreMBean, IEventDispatcher, IEventHandler, IEventListener, IEventObservable, IAttributeStore, IBasicScope, ICastingAttributeStore, ICoreObject, IPersistable, IMessageInput, IMessageOutput, IPipe, IPipeConnectionListener, IBroadcastScope

    public class BroadcastScope

extends BasicScope
implements IBroadcastScope, IPipeConnectionListener

Scope type for publishing that deals with pipe connection events, like async message listening in JMS

Nested Class Summary

Nested classes/interfaces inherited from class org.red5.server.BasicScope
`BasicScope.EmptyBasicScopeIterator`

Field Summary
`protected Lock` `lock` Lock for critical sections, to prevent concurrent modification.

Fields inherited from class org.red5.server.BasicScope
`keepDelay, keepOnDisconnect, listeners, parent, persistenceClass`

Fields inherited from class org.red5.server.PersistableAttributeStore
`lastModified, name, path, persistent, store, type`

Fields inherited from class org.red5.server.AttributeStore
`attributes`

Fields inherited from interface org.red5.server.stream.IBroadcastScope
`STREAM_ATTRIBUTE, TYPE`

Fields inherited from interface org.red5.server.api.persistence.IPersistable
`TRANSIENT_PREFIX`

Constructor Summary
`BroadcastScope(IScope parent, String name)` Creates broadcast scope

Method Summary
`void` `addPipeConnectionListener(IPipeConnectionListener listener)` Register pipe connection event listener with this scope's pipe.
`List<IConsumer>` `getConsumers()` Getter for pipe consumers
`List<IProvider>` `getProviders()` Getter for providers list
`void` `lock()` Lock handling - attempts to obtain a lock
`void` `onPipeConnectionEvent(PipeConnectionEvent event)` Pipe connection event handler
`IMessage` `pullMessage()` Pull message from pipe
`IMessage` `pullMessage(long wait)` Pull message with timeout
`void` `pushMessage(IMessage message)` Push a message to this output endpoint.
`void` `removePipeConnectionListener(IPipeConnectionListener listener)` Unregisters pipe connection event listener with this scope's pipe
`void` `sendOOBControlMessage(IConsumer consumer, OOBControlMessage oobCtrlMsg)` Send out-of-band ("special") control message
`void` `sendOOBControlMessage(IProvider provider, OOBControlMessage oobCtrlMsg)` Send out-of-band ("special") control message
`boolean` `subscribe(IConsumer consumer, Map<String,Object> paramMap)` Connect scope's pipe to given consumer
`boolean` `subscribe(IProvider provider, Map<String,Object> paramMap)` Connect scope's pipe with given provider
`void` `unlock()` Lock handling - attempts to unlock a lock
`boolean` `unsubscribe(IConsumer consumer)` Disconnects scope's pipe from given consumer
`boolean` `unsubscribe(IProvider provider)` Disconnects scope's pipe from given provider

Methods inherited from class org.red5.server.BasicScope
`addEventListener, dispatchEvent, getDepth, getEventListeners, getParent, getPath, handleEvent, hasEventListeners, hasParent, iterator, notifyEvent, removeEventListener, setKeepDelay`

Methods inherited from class org.red5.server.PersistableAttributeStore
`deserialize, getAttribute, getLastModified, getName, getStore, getType, isPersistent, modified, removeAttribute, removeAttributes, serialize, setAttribute, setAttributes, setAttributes, setName, setPath, setPersistent, setStore`

Methods inherited from class org.red5.server.AttributeStore
`filterNull, getAttribute, getAttributeNames, getAttributes, getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute, hasAttribute`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.red5.server.api.IBasicScope
`getDepth, getName, getParent, getPath, getType, hasParent, setKeepDelay`

Methods inherited from interface org.red5.server.api.ICastingAttributeStore
`getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute`

Methods inherited from interface org.red5.server.api.IAttributeStore
`getAttribute, getAttribute, getAttributeNames, getAttributes, hasAttribute, removeAttribute, removeAttributes, setAttribute, setAttributes, setAttributes`

Methods inherited from interface org.red5.server.api.event.IEventDispatcher
`dispatchEvent`

Methods inherited from interface org.red5.server.api.event.IEventHandler
`handleEvent`

Methods inherited from interface org.red5.server.api.event.IEventListener
`notifyEvent`

Methods inherited from interface org.red5.server.api.event.IEventObservable
`addEventListener, getEventListeners, removeEventListener`

Methods inherited from interface java.lang.Iterable
`iterator`

Methods inherited from interface org.red5.server.api.persistence.IPersistable
`deserialize, getLastModified, getStore, isPersistent, serialize, setName, setPath, setPersistent, setStore`

Field Detail

### lock

    protected Lock lock

  Lock for critical sections, to prevent concurrent modification. A "fairness" policy is used wherein the longest waiting thread will be granted access before others.

Constructor Detail

### BroadcastScope

    public BroadcastScope(IScope parent,
                          String name)

  Creates broadcast scope

  Parameters:
    `parent` - Parent scope
    `name` - Scope name

Method Detail

### addPipeConnectionListener

    public void addPipeConnectionListener(IPipeConnectionListener listener)

  Register pipe connection event listener with this scope's pipe. A listener that wants to listen to events when provider/consumer connects to or disconnects from a specific pipe.

  Specified by:
    `addPipeConnectionListener` in interface `IPipe`
  Parameters:
    `listener` - Pipe connection event listener
  See Also:
    `IPipeConnectionListener`

### removePipeConnectionListener

    public void removePipeConnectionListener(IPipeConnectionListener listener)

  Unregisters pipe connection event listener with this scope's pipe

  Specified by:
    `removePipeConnectionListener` in interface `IPipe`
  Parameters:
    `listener` - Pipe connection event listener
  See Also:
    `IPipeConnectionListener`

### pullMessage

    public IMessage pullMessage()

  Pull message from pipe

  Specified by:
    `pullMessage` in interface `IMessageInput`
  Returns:
    Message object
  See Also:
    `IMessage`

### pullMessage

    public IMessage pullMessage(long wait)

  Pull message with timeout

  Specified by:
    `pullMessage` in interface `IMessageInput`
  Parameters:
    `wait` - Timeout
  Returns:
    Message object
  See Also:
    `IMessage`

### subscribe

    public boolean subscribe(IConsumer consumer,
                             Map<String,Object> paramMap)

  Connect scope's pipe to given consumer

  Specified by:
    `subscribe` in interface `IMessageInput`
  Parameters:
    `consumer` - Consumer
    `paramMap` - Parameters passed with connection
  Returns:
    `true` on success, `false` otherwise

### unsubscribe

    public boolean unsubscribe(IConsumer consumer)

  Disconnects scope's pipe from given consumer

  Specified by:
    `unsubscribe` in interface `IMessageInput`
  Parameters:
    `consumer` - Consumer
  Returns:
    `true` on success, `false` otherwise

### getConsumers

    public List<IConsumer> getConsumers()

  Getter for pipe consumers

  Specified by:
    `getConsumers` in interface `IMessageInput`
  Returns:
    Pipe consumers

### sendOOBControlMessage

    public void sendOOBControlMessage(IConsumer consumer,
                                      OOBControlMessage oobCtrlMsg)

  Send out-of-band ("special") control message

  Specified by:
    `sendOOBControlMessage` in interface `IMessageInput`
  Parameters:
    `consumer` - Consumer, may be used in concrete implementations
    `oobCtrlMsg` - Out-of-band control message

### pushMessage

    public void pushMessage(IMessage message)
                     throws IOException

  Push a message to this output endpoint. May block the pusher when output can't handle the message at the time.

  Specified by:
    `pushMessage` in interface `IMessageOutput`
  Parameters:
    `message` - Message to be pushed.
  Throws:
    `IOException` - If message could not be pushed.

### subscribe

    public boolean subscribe(IProvider provider,
                             Map<String,Object> paramMap)

  Connect scope's pipe with given provider

  Specified by:
    `subscribe` in interface `IMessageOutput`
  Parameters:
    `provider` - Provider
    `paramMap` - Parameters passed on connection
  Returns:
    `true` on success, `false` otherwise

### unsubscribe

    public boolean unsubscribe(IProvider provider)

  Disconnects scope's pipe from given provider

  Specified by:
    `unsubscribe` in interface `IMessageOutput`
  Parameters:
    `provider` - Provider
  Returns:
    `true` on success, `false` otherwise

### getProviders

    public List<IProvider> getProviders()

  Getter for providers list

  Specified by:
    `getProviders` in interface `IMessageOutput`
  Returns:
    List of providers

### sendOOBControlMessage

    public void sendOOBControlMessage(IProvider provider,
                                      OOBControlMessage oobCtrlMsg)

  Send out-of-band ("special") control message

  Specified by:
    `sendOOBControlMessage` in interface `IMessageOutput`
  Parameters:
    `provider` - Provider, may be used in concrete implementations
    `oobCtrlMsg` - Out-of-band control message

### onPipeConnectionEvent

    public void onPipeConnectionEvent(PipeConnectionEvent event)

  Pipe connection event handler

  Specified by:
    `onPipeConnectionEvent` in interface `IPipeConnectionListener`
  Parameters:
    `event` - Pipe connection event

### lock

    public void lock()

  Description copied from interface: `IBasicScope`
  Lock handling - attempts to obtain a lock

  Specified by:
    `lock` in interface `IBasicScope`

### unlock

    public void unlock()

  Description copied from interface: `IBasicScope`
  Lock handling - attempts to unlock a lock

  Specified by:
    `unlock` in interface `IBasicScope`

Copyright © 2006-2010 The Red5 Project