|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tomcat.bayeux.ChannelImpl
public class ChannelImpl
Field Summary | |
---|---|
protected java.util.LinkedList<DataFilter> |
filters
A list of the current filters |
protected java.lang.String |
id
The unique id of this channel |
protected boolean |
persistent
Is this channel persistent, default value is true |
protected java.util.LinkedList<Client> |
subscribers
A list of the current subscribers |
Constructor Summary | |
---|---|
protected |
ChannelImpl(java.lang.String id)
Creates a new channel |
Method Summary | |
---|---|
void |
addFilter(DataFilter filter)
Adds a data filter to this channel. |
java.lang.String |
getId()
returns the id of this channel |
java.util.List<Client> |
getSubscribers()
returns a non modifiable list of all the subscribers to this channel. |
boolean |
isPersistent()
Non persistent channels are removed when the last subscription is removed. |
boolean |
matches(java.lang.String pattern)
Returns true if this channel matches the pattern to its id. |
void |
publish(Message msg)
Publishes a message to all the subscribers of this channel. |
void |
publish(Message[] msgs)
Publishes more than one message to all the subscribers of this channel. |
DataFilter |
removeFilter(DataFilter filter)
Removes a filter from this channel. |
void |
setPersistent(boolean persistent)
|
void |
subscribe(Client subscriber)
Subscribes a client to a channel. |
java.lang.String |
toString()
|
Client |
unsubscribe(Client subscriber)
Unsubscribes a client from a channel |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String id
protected java.util.LinkedList<Client> subscribers
protected java.util.LinkedList<DataFilter> filters
protected boolean persistent
Constructor Detail |
---|
protected ChannelImpl(java.lang.String id)
id
- String - the id of the channel, can not be nullMethod Detail |
---|
public java.lang.String getId()
getId
in interface Channel
public boolean matches(java.lang.String pattern)
/service/mychannel
or it can be a wild card pattern like /service/app2/**
pattern
- String according to the Bayeux specification section 2.2.1 Channel Globbing, can not be null.
public java.util.List<Client> getSubscribers()
Channel
getSubscribers
in interface Channel
public boolean isPersistent()
Channel
isPersistent
in interface Channel
public void publish(Message msg)
Channel
from
is contained within the message, by calling
msg.getClient()
publish
in interface Channel
public void publish(Message[] msgs)
Channel
from
is contained within the message, by calling
msg[x].getClient()
publish
in interface Channel
public void setPersistent(boolean persistent)
setPersistent
in interface Channel
persistent
- true if the Channel will persist without any subscription.isPersistent
public void subscribe(Client subscriber)
Channel
subscribe
in interface Channel
subscriber
- - the client to be subscribed. If the client
already is subscribed, this call will not create a duplicate subscription.public Client unsubscribe(Client subscriber)
Channel
unsubscribe
in interface Channel
subscriber
- - the client to be subscribed.
public void addFilter(DataFilter filter)
Channel
addFilter
in interface Channel
filter
- Filterpublic DataFilter removeFilter(DataFilter filter)
Channel
removeFilter
in interface Channel
filter
- Filter
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |