Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.red5.server.messaging
Class AbstractPipe

    java.lang.Object
      org.red5.server.messaging.AbstractPipe

All Implemented Interfaces:
  IMessageInput, IMessageOutput, IPipe

Direct Known Subclasses:
  InMemoryPullPullPipe, InMemoryPushPushPipe

    public abstract class AbstractPipe

extends Object
implements IPipe

Abstract pipe that books providers/consumers and listeners. Aim to ease the implementation of concrete pipes. For more information on what pipe is, see IPipe interface documentation.

Author:
  The Red5 Project (red5@osflash.org), Steven Gong (steven.gong@gmail.com)
See Also:
  `IPipe`

Field Summary
`protected CopyOnWriteArrayList<IConsumer>` | `consumers` Pipe consumers list
`protected CopyOnWriteArrayList<IPipeConnectionListener>` | `listeners` Event listeners
`protected CopyOnWriteArrayList<IProvider>` | `providers` Pipe providers list

Constructor Summary
`AbstractPipe()`

Method Summary
`void` | `addPipeConnectionListener(IPipeConnectionListener listener)` Registers pipe connect events listener
`void` | `close()` Close the pipe
`protected void` | `fireConsumerConnectionEvent(IConsumer consumer, int type, Map<String,Object> paramMap)` Broadcast consumer connection event
`protected void` | `firePipeConnectionEvent(PipeConnectionEvent event)` Fire any pipe connection event and run all it's tasks
`protected void` | `fireProviderConnectionEvent(IProvider provider, int type, Map<String,Object> paramMap)` Broadcast provider connection event
`List<IConsumer>` | `getConsumers()` Getter for consumers
`List<IPipeConnectionListener>` | `getListeners()` Getter for pipe connection events listeners
`List<IProvider>` | `getProviders()` Getter for providers
`void` | `removePipeConnectionListener(IPipeConnectionListener listener)` Removes pipe connection listener
`void` | `sendOOBControlMessage(IConsumer consumer, OOBControlMessage oobCtrlMsg)` Send out-of-band ("special") control message to all providers
`void` | `sendOOBControlMessage(IProvider provider, OOBControlMessage oobCtrlMsg)` Send out-of-band ("special") control message to all consumers
`void` | `setListeners(List<IPipeConnectionListener> newListeners)` Setter for pipe connection events listeners
`boolean` | `subscribe(IConsumer consumer, Map<String,Object> paramMap)` Connect consumer to this pipe.
`boolean` | `subscribe(IProvider provider, Map<String,Object> paramMap)` Connect provider to this pipe.
`boolean` | `unsubscribe(IConsumer consumer)` Disconnects consumer from this pipe.
`boolean` | `unsubscribe(IProvider provider)` Disconnects provider from this pipe.

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.messaging.IMessageInput
`pullMessage, pullMessage`

Methods inherited from interface org.red5.server.messaging.IMessageOutput
`pushMessage`

Field Detail

### consumers

    protected volatile CopyOnWriteArrayList<IConsumer> consumers

  Pipe consumers list

### providers

    protected volatile CopyOnWriteArrayList<IProvider> providers

  Pipe providers list

### listeners

    protected volatile CopyOnWriteArrayList<IPipeConnectionListener> listeners

  Event listeners

Constructor Detail

### AbstractPipe

    public AbstractPipe()

Method Detail

### subscribe

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

  Connect consumer to this pipe. Doesn't allow to connect one consumer twice. Does register event listeners if instance of IPipeConnectionListener is given.

  Specified by:
    `subscribe` in interface `IMessageInput`
  Parameters:
    `consumer` - Consumer
    `paramMap` - Parameters passed with connection, used in concrete pipe implementations
  Returns:
    `true` if consumer was added, `false` otherwise

### subscribe

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

  Connect provider to this pipe. Doesn't allow to connect one provider twice. Does register event listeners if instance of IPipeConnectionListener is given.

  Specified by:
    `subscribe` in interface `IMessageOutput`
  Parameters:
    `provider` - Provider
    `paramMap` - Parameters passed with connection, used in concrete pipe implementations
  Returns:
    `true` if provider was added, `false` otherwise

### unsubscribe

    public boolean unsubscribe(IProvider provider)

  Disconnects provider from this pipe. Fires pipe connection event.

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

### unsubscribe

    public boolean unsubscribe(IConsumer consumer)

  Disconnects consumer from this pipe. Fires pipe connection event.

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

### addPipeConnectionListener

    public void addPipeConnectionListener(IPipeConnectionListener listener)

  Registers pipe connect events listener

  Specified by:
    `addPipeConnectionListener` in interface `IPipe`
  Parameters:
    `listener` - Listener

### removePipeConnectionListener

    public void removePipeConnectionListener(IPipeConnectionListener listener)

  Removes pipe connection listener

  Specified by:
    `removePipeConnectionListener` in interface `IPipe`
  Parameters:
    `listener` - Listener

### sendOOBControlMessage

    public void sendOOBControlMessage(IProvider provider,
                                      OOBControlMessage oobCtrlMsg)

  Send out-of-band ("special") control message to all consumers

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

### sendOOBControlMessage

    public void sendOOBControlMessage(IConsumer consumer,
                                      OOBControlMessage oobCtrlMsg)

  Send out-of-band ("special") control message to all providers

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

### getListeners

    public List<IPipeConnectionListener> getListeners()

  Getter for pipe connection events listeners

  Returns:
    Listeners

### setListeners

    public void setListeners(List<IPipeConnectionListener> newListeners)

  Setter for pipe connection events listeners

  Parameters:
    `newListeners` - Listeners

### getProviders

    public List<IProvider> getProviders()

  Getter for providers

  Specified by:
    `getProviders` in interface `IMessageOutput`
  Returns:
    Providers list

### getConsumers

    public List<IConsumer> getConsumers()

  Getter for consumers

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

### fireConsumerConnectionEvent

    protected void fireConsumerConnectionEvent(IConsumer consumer,
                                               int type,
                                               Map<String,Object> paramMap)

  Broadcast consumer connection event

  Parameters:
    `consumer` - Consumer that has connected
    `type` - Event type
    `paramMap` - Parameters passed with connection

### fireProviderConnectionEvent

    protected void fireProviderConnectionEvent(IProvider provider,
                                               int type,
                                               Map<String,Object> paramMap)

  Broadcast provider connection event

  Parameters:
    `provider` - Provider that has connected
    `type` - Event type
    `paramMap` - Parameters passed with connection

### firePipeConnectionEvent

    protected void firePipeConnectionEvent(PipeConnectionEvent event)

  Fire any pipe connection event and run all it's tasks

  Parameters:
    `event` - Pipe connection event

### close

    public void close()

  Close the pipe

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2010 The Red5 Project