Class jabberwerx.ClientEntityCache (MINIMAL)
Extends
jabberwerx.EntitySet.
The client's collection of entities. This is the central repositories for entities within a client.
This class provides the following events:
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
localUser(jid)
Factory method for jabberwerx.LocalUser objects.
|
|
register(entity)
Registers the given entity to this cache.
|
|
server(serverDomain)
Factory method for jabberwerx.Server objects.
|
|
temporaryEntity(jid)
Factory method for jabberwerx.TemporaryEntity objects.
|
|
unregister(entity)
Unregisters the given entity from this cache.
|
- Methods borrowed from class jabberwerx.JWModel:
- applyEvent, event, shouldBeSavedWithGraph
- Methods borrowed from class jabberwerx.JWBase:
- destroy, getClassName, graphUnserialized, init, invocation, shouldBeSerializedInline, toString, wasUnserialized, willBeSerialized
Method Detail
{jabberwerx.LocalUser}
localUser(jid)
Factory method for jabberwerx.LocalUser objects. If a local object for
the passed JID already exists, that object is returned instead of a new object.
- Parameters:
- {jabberwerx.JID|String} jid
- The JID for this user.
- Throws:
- {TypeError}
- if {jid} is not a valid JID
- {jabberwerx.EntitySet.EntityAlreadyExistsError}
- if an entity for {jid} already exists, but is not a LocalUser
- Returns:
- {jabberwerx.LocalUser} A LocalUser for the given arguments
register(entity)
Registers the given entity to this cache. This method
overrides the base class to:
- Validate that another entity matching {entity} is not already registered (throwing a jabberwerx.EntitySet.EntityAlreadyExistsError).
- trigger the "entityCreated" event if this cache was changed as a result of this call
- Parameters:
- {jabberwerx.Entity} entity
- The entity to register
{jabberwerx.Server}
server(serverDomain)
Factory method for jabberwerx.Server objects. If a local object for
the passed JID already exists, that object is returned instead of a new object.
- Parameters:
- {String} serverDomain
- The domain for this server, eg, "jabber.com".
- Throws:
- {TypeError}
- if serverDomain is not a valid JID
- {jabberwerx.EntitySet.EntityAlreadyExistsError}
- if an entity for {serverDomain} already exists, but is not a Server.
- Returns:
- {jabberwerx.Server} A Server for the given arguments
{jabberwerx.TemporaryEntity}
temporaryEntity(jid)
Factory method for jabberwerx.TemporaryEntity objects. If a local object for
the passed JID already exists, that object is returned instead of a new object.
- Parameters:
- {jabberwerx.JID|String} jid
- The JID of the temporary entity object to get or create.
- Throws:
- {TypeError}
- if {jid} is not a valid JID
- {jabberwerx.EntitySet.EntityAlreadyExistsError}
- if an entity for {jid} already exists, but is not a TemporaryEntity
- Returns:
- {jabberwerx.TemporaryEntity} A TemporaryEntity for the given JID
unregister(entity)
Unregisters the given entity from this cache. This method
overrides the base class to trigger the "entityDestroyed" event.
- Parameters:
- {jabberwerx.Entity} entity
- The entity to unregister