org.atmosphere.cpr
Interface AtmosphereResourceFactory

All Superinterfaces:
AtmosphereConfigAware
All Known Implementing Classes:
DefaultAtmosphereResourceFactory

public interface AtmosphereResourceFactory
extends AtmosphereConfigAware

A Factory used to manage AtmosphereResource instances. You can use this factory to create, remove and find AtmosphereResource instances that are associated with one or several Broadcasters.

Author:
Jeanfrancois Arcand

Nested Class Summary
static interface AtmosphereResourceFactory.Async
          An interface to use in order to retrieve an AtmosphereResource inside a cluster.
 
Method Summary
 Set<Broadcaster> broadcasters(String uuid)
          Deprecated. Use find(String).broadcasters() instead
 void configure(AtmosphereConfig config)
          Configure an AtmosphereFramework object.
 AtmosphereResource create(AtmosphereConfig config, AtmosphereRequest request, AtmosphereResponse response, AsyncSupport<?> a)
          Create an AtmosphereResourceImpl
 AtmosphereResource create(AtmosphereConfig config, AtmosphereResponse response, AsyncSupport<?> a)
          Create an AtmosphereResourceImpl.
 AtmosphereResource create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereRequest request, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler)
          Create an AtmosphereResourceImpl.
 AtmosphereResource create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereRequest request, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler, AtmosphereResource.TRANSPORT t)
          Create an AtmosphereResourceImpl.
 AtmosphereResource create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler)
          Create an AtmosphereResourceImpl.
 AtmosphereResource create(AtmosphereConfig config, Broadcaster broadcaster, AtmosphereResponse response, AsyncSupport<?> a, AtmosphereHandler handler, AtmosphereResource.TRANSPORT t)
           
 AtmosphereResource create(AtmosphereConfig config, String uuid)
          Create an AtmosphereResource associated with the uuid.
 AtmosphereResource create(AtmosphereConfig config, String uuid, AtmosphereRequest request)
          Create an AtmosphereResource associated with the uuid.
 void destroy()
           
 AtmosphereResource find(String uuid)
          Find an AtmosphereResource based on its AtmosphereResource.uuid().
 Collection<AtmosphereResource> findAll()
           
 void locate(String uuid, AtmosphereResourceFactory.Async async)
          Locate an AtmosphereResource, based on its AtmosphereResource.uuid(), in a cluster.
 void registerUuidForFindCandidate(AtmosphereResource r)
          Register an AtmosphereResource for being a candidate to find(String) operation.
 AtmosphereResource remove(String uuid)
          Remove the AtmosphereResource from all instances of Broadcaster.
 ConcurrentMap<String,AtmosphereResource> resources()
           
 void unRegisterUuidForFindCandidate(AtmosphereResource r)
          Un register an AtmosphereResource for being a candidate to find(String) operation.
 

Method Detail

configure

void configure(AtmosphereConfig config)
Description copied from interface: AtmosphereConfigAware
Configure an AtmosphereFramework object.

Specified by:
configure in interface AtmosphereConfigAware
Parameters:
config - AtmosphereConfig

create

AtmosphereResource create(AtmosphereConfig config,
                          AtmosphereRequest request,
                          AtmosphereResponse response,
                          AsyncSupport<?> a)
Create an AtmosphereResourceImpl

Parameters:
config - an AtmosphereConfig
request - an AtmosphereResponse
a - AsyncSupport
Returns:
an AtmosphereResourceImpl

create

AtmosphereResource create(AtmosphereConfig config,
                          Broadcaster broadcaster,
                          AtmosphereRequest request,
                          AtmosphereResponse response,
                          AsyncSupport<?> a,
                          AtmosphereHandler handler)
Create an AtmosphereResourceImpl.

Parameters:
config - an AtmosphereConfig
broadcaster - a Broadcaster
response - an AtmosphereResponse
a - AsyncSupport
handler - an AtmosphereHandler
Returns:
an AtmosphereResourceImpl

create

AtmosphereResource create(AtmosphereConfig config,
                          Broadcaster broadcaster,
                          AtmosphereRequest request,
                          AtmosphereResponse response,
                          AsyncSupport<?> a,
                          AtmosphereHandler handler,
                          AtmosphereResource.TRANSPORT t)
Create an AtmosphereResourceImpl.

Parameters:
config - an AtmosphereConfig
broadcaster - a Broadcaster
response - an AtmosphereResponse
a - AsyncSupport
handler - an AtmosphereHandler
t - an AtmosphereResource.TRANSPORT
Returns:
an AtmosphereResourceImpl

create

AtmosphereResource create(AtmosphereConfig config,
                          Broadcaster broadcaster,
                          AtmosphereResponse response,
                          AsyncSupport<?> a,
                          AtmosphereHandler handler)
Create an AtmosphereResourceImpl.

Parameters:
config - an AtmosphereConfig
broadcaster - a Broadcaster
response - an AtmosphereResponse
a - AsyncSupport
handler - an AtmosphereHandler
Returns:
an AtmosphereResourceImpl

create

AtmosphereResource create(AtmosphereConfig config,
                          Broadcaster broadcaster,
                          AtmosphereResponse response,
                          AsyncSupport<?> a,
                          AtmosphereHandler handler,
                          AtmosphereResource.TRANSPORT t)

create

AtmosphereResource create(AtmosphereConfig config,
                          AtmosphereResponse response,
                          AsyncSupport<?> a)
Create an AtmosphereResourceImpl.

Parameters:
config - an AtmosphereConfig
response - an AtmosphereResponse
a - AsyncSupport
Returns:
an AtmosphereResourceImpl

create

AtmosphereResource create(AtmosphereConfig config,
                          String uuid)
Create an AtmosphereResource associated with the uuid.

Parameters:
config - an AtmosphereConfig
uuid - a String representing a UUID
Returns:

create

AtmosphereResource create(AtmosphereConfig config,
                          String uuid,
                          AtmosphereRequest request)
Create an AtmosphereResource associated with the uuid.

Parameters:
config - an AtmosphereConfig
uuid - a String representing a UUID
request - a AtmosphereRequest
Returns:

remove

AtmosphereResource remove(String uuid)
Remove the AtmosphereResource from all instances of Broadcaster.

Parameters:
uuid - the AtmosphereResource.uuid()
Returns:
the AtmosphereResource, or null if not found.

find

AtmosphereResource find(String uuid)
Find an AtmosphereResource based on its AtmosphereResource.uuid().

Parameters:
uuid - the AtmosphereResource.uuid()
Returns:
the AtmosphereResource, or null if not found.

locate

void locate(String uuid,
            AtmosphereResourceFactory.Async async)
Locate an AtmosphereResource, based on its AtmosphereResource.uuid(), in a cluster. If the AtmosphereResource is available in the cluster, the AtmosphereResourceFactory.Async.available(org.atmosphere.cpr.AtmosphereResource) callback will be invoked. If not, the org.atmosphere.cpr.AtmosphereResourceFactory.Async#notAvailable

Parameters:
uuid - the AtmosphereResource.uuid()
async - an AtmosphereResourceFactory.Async

broadcasters

@Deprecated
Set<Broadcaster> broadcasters(String uuid)
Deprecated. Use find(String).broadcasters() instead

Return all Broadcaster associated with a AtmosphereResource.uuid(), e.g for which Broadcaster.addAtmosphereResource(AtmosphereResource) has been called. Note that this method is not synchronized and may not return all the Broadcaster in case Broadcaster.addAtmosphereResource(AtmosphereResource) is being called concurrently.

Parameters:
uuid - the AtmosphereResource.uuid()
Returns:
all Broadcaster associated with a AtmosphereResource.uuid()

registerUuidForFindCandidate

void registerUuidForFindCandidate(AtmosphereResource r)
Register an AtmosphereResource for being a candidate to find(String) operation.

Parameters:
r - AtmosphereResource

unRegisterUuidForFindCandidate

void unRegisterUuidForFindCandidate(AtmosphereResource r)
Un register an AtmosphereResource for being a candidate to find(String) operation.

Parameters:
r - AtmosphereResource

destroy

void destroy()

resources

ConcurrentMap<String,AtmosphereResource> resources()

findAll

Collection<AtmosphereResource> findAll()


Copyright © 2015. All Rights Reserved.