public abstract class AbstractConsumerRegistry extends Object implements ConsumerRegistrySPI
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractConsumerRegistry.InMemoryConsumerCache
Implements a local cache for consumers.
|
protected class |
AbstractConsumerRegistry.ProducerInfoIterator |
| Modifier and Type | Field and Description |
|---|---|
protected ConsumerCache |
consumerCache
Caches consumers to avoid having to recreate them if possible as the lifecycle transitions might be a little complex and not completely possible to restore from persistence
|
protected static org.slf4j.Logger |
log |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractConsumerRegistry() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
activateConsumer(WSRPConsumer consumer) |
void |
activateConsumerWith(String id)
Activates the consumer associated with the specified identifier if and only if access to the remote producer is properly setup (i.e.
|
boolean |
containsConsumer(String id)
Whether or not this registry knows about a consumer with the specified identifier.
|
WSRPConsumer |
createConsumer(String id,
Integer expirationCacheSeconds,
String wsdlURL)
Creates a consumer with the specified associated producer identifier, caching producer metadata for the specified time in seconds and accessing the related producer via the
specified WSDL location.
|
WSRPConsumer |
createConsumerFrom(ProducerInfo producerInfo,
boolean putInCache)
Creates a consumer from the specified ProducerInfo, caching it if so specified.
|
protected void |
deactivateConsumer(WSRPConsumer consumer) |
void |
deactivateConsumerWith(String id)
Desactivates the consumer, unregistering it from the FederatingPortletInvoker, meaning that it cannot be interacted with anymore by the portal in which WSRP is running.
|
void |
deregisterWithFederatingPortletInvoker(WSRPConsumer consumer)
Deregisters the specified WSRPConsumer with the FederatingPortletInvoker.
|
void |
destroyConsumer(String id)
Destroys the specified consumer taking care of cleaning (if needed) things up at the same time, meaning: unregistering if registered, deactivating if activated and removing
the
consumer from persistent storage.
|
int |
getConfiguredConsumerNumber()
Retrieves the number of configured consumers.
|
List<WSRPConsumer> |
getConfiguredConsumers()
Retrieves the list of configured consumers.
|
WSRPConsumer |
getConsumer(String id)
Retrieves the consumer associated with the specified producer identifier.
|
protected List<WSRPConsumer> |
getConsumers(boolean startConsumers) |
org.gatein.pc.federation.FederatingPortletInvoker |
getFederatingPortletInvoker()
Retrieves the
FederatingPortletInvoker used by this ConsumerRegistry to register / unregister consumers as PortletInvokers. |
MigrationService |
getMigrationService() |
long |
getPersistedLastModifiedForProducerInfoWith(String id)
Checks the last modification time that was persisted for the ProducerInfo identified by the specified identifier.
|
SessionRegistry |
getSessionRegistry() |
protected abstract void |
initConsumerCache()
Initializes the ConsumerCache so that subclasses have the opportunity to do some specific processing.
|
void |
registerOrDeregisterConsumerWith(String id,
boolean register)
Attempts to register (if the specified boolean is
true) or deregister (otherwise) the consumer associated with the specified identifier with the associated
remote producer. |
void |
registerWithFederatingPortletInvoker(WSRPConsumer consumer)
Registers the specified WSRPConsumer with the FederatingPortletInvoker.
|
void |
reloadConsumers()
Reloads consumers from persistence, re-initializing any cache from the persisted state.
|
void |
setConsumerCache(ConsumerCache consumers) |
void |
setFederatingPortletInvoker(org.gatein.pc.federation.FederatingPortletInvoker federatingPortletInvoker) |
void |
setMigrationService(MigrationService migrationService) |
void |
setSessionEventBroadcaster(SessionEventBroadcaster sessionEventBroadcaster) |
void |
setSessionRegistry(SessionRegistry sessionRegistry) |
void |
start()
Gets this ConsumerRegistry ready to work, in particular, loads the consumers from persistence and starts them, registering the active ones with the FederatingPortletInvoker.
|
void |
stop()
Stops all consumers, deregistering them with the FederatingPortletInvoker.
|
String |
updateProducerInfo(ProducerInfo producerInfo)
Persists the changes made to ProducerInfo.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdelete, getProducerInfosFromStorage, loadProducerInfo, save, updategetConfiguredConsumersIdsprotected static final org.slf4j.Logger log
protected ConsumerCache consumerCache
protected abstract void initConsumerCache()
public void setConsumerCache(ConsumerCache consumers)
public void setSessionRegistry(SessionRegistry sessionRegistry)
setSessionRegistry in interface ConsumerRegistrySPIpublic SessionRegistry getSessionRegistry()
getSessionRegistry in interface ConsumerRegistrySPIpublic org.gatein.pc.federation.FederatingPortletInvoker getFederatingPortletInvoker()
ConsumerRegistryFederatingPortletInvoker used by this ConsumerRegistry to register / unregister consumers as PortletInvokers. This is how the portal in which WSRP is
running can interact with remote portlets.getFederatingPortletInvoker in interface ConsumerRegistryFederatingPortletInvoker used by this ConsumerRegistrypublic void setSessionEventBroadcaster(SessionEventBroadcaster sessionEventBroadcaster)
setSessionEventBroadcaster in interface ConsumerRegistrySPIpublic MigrationService getMigrationService()
getMigrationService in interface ConsumerRegistrySPIpublic void setMigrationService(MigrationService migrationService)
setMigrationService in interface ConsumerRegistrySPIpublic WSRPConsumer createConsumer(String id, Integer expirationCacheSeconds, String wsdlURL)
ConsumerRegistrycreateConsumer in interface ConsumerRegistryid - the producer identifier associated with this consumerexpirationCacheSeconds - the number of seconds before cached producer metadata is considered obsolete and needs to be retrieved again from the remote producerwsdlURL - the String representation of the URL where the producer WSDL is locatedpublic void destroyConsumer(String id)
ConsumerRegistrydestroyConsumer in interface ConsumerRegistryid - the identifier associated with the consumer to destroypublic void setFederatingPortletInvoker(org.gatein.pc.federation.FederatingPortletInvoker federatingPortletInvoker)
setFederatingPortletInvoker in interface ConsumerRegistrySPIpublic WSRPConsumer createConsumerFrom(ProducerInfo producerInfo, boolean putInCache)
ConsumerRegistrySPIcreateConsumerFrom in interface ConsumerRegistrySPIproducerInfo - the ProducerInfo to create a consumer fromputInCache - whether to cache the newly created consumerpublic void activateConsumerWith(String id) throws ConsumerException
ConsumerRegistryactivateConsumerWith in interface ConsumerRegistryid - the identifier of the consumer to be activatedConsumerExceptionprotected void activateConsumer(WSRPConsumer consumer)
public void deactivateConsumerWith(String id) throws ConsumerException
ConsumerRegistrydeactivateConsumerWith in interface ConsumerRegistryid - the identifier associated with the consumer to deactivateConsumerExceptionprotected void deactivateConsumer(WSRPConsumer consumer)
public void registerWithFederatingPortletInvoker(WSRPConsumer consumer)
ConsumerRegistrySPIregisterWithFederatingPortletInvoker in interface ConsumerRegistrySPIconsumer - the WSRPConsumer to registerpublic void deregisterWithFederatingPortletInvoker(WSRPConsumer consumer)
ConsumerRegistrySPIderegisterWithFederatingPortletInvoker in interface ConsumerRegistrySPIconsumer - the WSRPConsumer to deregisterpublic long getPersistedLastModifiedForProducerInfoWith(String id)
ConsumerRegistrySPIgetPersistedLastModifiedForProducerInfoWith in interface ConsumerRegistrySPIid - the identifier of the ProducerInfo we want to checkpublic String updateProducerInfo(ProducerInfo producerInfo)
ConsumerRegistryupdateProducerInfo in interface ConsumerRegistryproducerInfo - the ProducerInfo to persistnull otherwisepublic void start()
throws Exception
ConsumerRegistrySPIstart in interface ConsumerRegistrySPIExceptionpublic void reloadConsumers()
ConsumerRegistryreloadConsumers in interface ConsumerRegistrypublic void stop()
throws Exception
ConsumerRegistrySPIstop in interface ConsumerRegistrySPIExceptionpublic List<WSRPConsumer> getConfiguredConsumers()
ConsumerRegistrygetConfiguredConsumers in interface ConsumerRegistrypublic WSRPConsumer getConsumer(String id)
ConsumerRegistrygetConsumer in interface ConsumerRegistryid - the producer identifier of the consumer we want to retrievepublic boolean containsConsumer(String id)
ConsumerRegistrycontainsConsumer in interface ConsumerRegistryid - the identifier of a consumer whose existence we want to check with this registrypublic int getConfiguredConsumerNumber()
ConsumerRegistrygetConfiguredConsumerNumber in interface ConsumerRegistrypublic void registerOrDeregisterConsumerWith(String id, boolean register)
ConsumerRegistrytrue) or deregister (otherwise) the consumer associated with the specified identifier with the associated
remote producer.registerOrDeregisterConsumerWith in interface ConsumerRegistryid - the identifier of the consumer to de-/registerregister - true if a registration should be attempted, false if we want to deregister the specified consumerprotected List<WSRPConsumer> getConsumers(boolean startConsumers)
Copyright © 2006-2014 GateIn. All Rights Reserved.