Package org.apache.synapse.message.store
Class AbstractMessageStore
- java.lang.Object
-
- org.apache.synapse.message.store.AbstractMessageStore
-
- All Implemented Interfaces:
ManagedLifecycle
,MessageStore
,Nameable
,SynapseArtifact
- Direct Known Subclasses:
InMemoryStore
,JDBCMessageStore
,JmsStore
,RabbitMQStore
public abstract class AbstractMessageStore extends Object implements MessageStore
-
-
Field Summary
Fields Modifier and Type Field Description protected String
description
Message Store descriptionprotected String
fileName
Name of the file where this message store is definedprotected Lock
lock
protected MessageStoreView
messageStoreMBean
Message store JMX viewprotected List<MessageStoreObserver>
messageStoreObservers
List that holds the MessageStore observers registered with the Message Storeprotected String
name
message store nameprotected Map<String,String>
parameterKeyMap
Message store parameters with registry keysprotected Map<String,Object>
parameters
Message store parametersprotected String
sequence
name of the sequence to be executed before storing the messageprotected SynapseConfiguration
synapseConfiguration
synapse configuration referenceprotected SynapseEnvironment
synapseEnvironment
synapse environment reference
-
Constructor Summary
Constructors Constructor Description AbstractMessageStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addParameter(String name, String key)
Adds message store specific parametersvoid
addParameterKey(String name, String key)
Adds message store parameter registry keysvoid
dequeued()
void
destroy()
This method should implement the destroying of the implemented parts of the configuration.long
difference()
void
enqueued()
String
getArtifactContainerName()
Get the name of the artifact container from which the message store deployedString
getDescription()
Retrieves the description of the artifactString
getFileName()
get the file name that the message store is configuredLock
getLock()
String
getName()
Get the name of an abstractionString
getParameterKey(String name)
Gets parameter registry key from the parameter nameMap<String,String>
getParameterKeyMap()
Gets registry key mappings for the parametersMap<String,Object>
getParameters()
get the implementation specific parameters of the Message storeint
getType()
Returns the type of this message store.void
init(SynapseEnvironment se)
This method should implement the initialization of the implemented parts of the configuration.boolean
isEdited()
Whether the message store edited through the management consoleint
nextConsumerId()
int
nextProducerId()
protected void
notifyMessageAddition(String messageId)
Notify Message Addition to the observersprotected void
notifyMessageRemoval(String messageId)
Notify Message removal to the observersvoid
registerObserver(MessageStoreObserver observer)
void
setArtifactContainerName(String artifactContainerName)
Set the name of the artifact container from which the message store deployedvoid
setDescription(String description)
Set the description of the artifactvoid
setFileName(String filename)
Set the name of the file that the Message store is configuredvoid
setIsEdited(boolean isEdited)
Set whether the message store edited through the management consolevoid
setName(String name)
Set the name of an abstractionvoid
setParameters(Map<String,Object> parameters)
set the implementation specific parametersint
size()
Returns the number of Messages in this store.void
unregisterObserver(MessageStoreObserver observer)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.synapse.message.store.MessageStore
clear, get, get, getAll, getConsumer, getProducer, remove, remove
-
-
-
-
Field Detail
-
name
protected String name
message store name
-
sequence
protected String sequence
name of the sequence to be executed before storing the message
-
messageStoreMBean
protected MessageStoreView messageStoreMBean
Message store JMX view
-
synapseConfiguration
protected SynapseConfiguration synapseConfiguration
synapse configuration reference
-
synapseEnvironment
protected SynapseEnvironment synapseEnvironment
synapse environment reference
-
parameterKeyMap
protected Map<String,String> parameterKeyMap
Message store parameters with registry keys
-
description
protected String description
Message Store description
-
fileName
protected String fileName
Name of the file where this message store is defined
-
messageStoreObservers
protected List<MessageStoreObserver> messageStoreObservers
List that holds the MessageStore observers registered with the Message Store
-
lock
protected Lock lock
-
-
Method Detail
-
init
public void init(SynapseEnvironment se)
Description copied from interface:ManagedLifecycle
This method should implement the initialization of the implemented parts of the configuration.- Specified by:
init
in interfaceManagedLifecycle
- Parameters:
se
- SynapseEnvironment to be used for initialization
-
getName
public String getName()
Description copied from interface:Nameable
Get the name of an abstraction
-
setName
public void setName(String name)
Description copied from interface:Nameable
Set the name of an abstraction
-
registerObserver
public void registerObserver(MessageStoreObserver observer)
-
unregisterObserver
public void unregisterObserver(MessageStoreObserver observer)
-
notifyMessageAddition
protected void notifyMessageAddition(String messageId)
Notify Message Addition to the observers- Parameters:
messageId
- of the Message added.
-
notifyMessageRemoval
protected void notifyMessageRemoval(String messageId)
Notify Message removal to the observers- Parameters:
messageId
- of the Message added
-
size
public int size()
Description copied from interface:MessageStore
Returns the number of Messages in this store.- Specified by:
size
in interfaceMessageStore
- Returns:
- the number of Messages in this Store
-
getParameters
public Map<String,Object> getParameters()
Description copied from interface:MessageStore
get the implementation specific parameters of the Message store- Specified by:
getParameters
in interfaceMessageStore
- Returns:
- a properties map
-
setParameters
public void setParameters(Map<String,Object> parameters)
Description copied from interface:MessageStore
set the implementation specific parameters- Specified by:
setParameters
in interfaceMessageStore
- Parameters:
parameters
- A map of parameters or null
-
addParameter
public void addParameter(String name, String key)
Description copied from interface:MessageStore
Adds message store specific parameters- Specified by:
addParameter
in interfaceMessageStore
- Parameters:
name
- parameter namekey
- parameter key value
-
addParameterKey
public void addParameterKey(String name, String key)
Description copied from interface:MessageStore
Adds message store parameter registry keys- Specified by:
addParameterKey
in interfaceMessageStore
- Parameters:
name
- parameter namekey
- parameter registry key value
-
getParameterKey
public String getParameterKey(String name)
Description copied from interface:MessageStore
Gets parameter registry key from the parameter name- Specified by:
getParameterKey
in interfaceMessageStore
- Parameters:
name
- parameter name- Returns:
- registry key of parameter value
-
getParameterKeyMap
public Map<String,String> getParameterKeyMap()
Description copied from interface:MessageStore
Gets registry key mappings for the parameters- Specified by:
getParameterKeyMap
in interfaceMessageStore
- Returns:
- registry key maps for parameter values
-
destroy
public void destroy()
Description copied from interface:ManagedLifecycle
This method should implement the destroying of the implemented parts of the configuration.- Specified by:
destroy
in interfaceManagedLifecycle
-
setDescription
public void setDescription(String description)
Description copied from interface:SynapseArtifact
Set the description of the artifact- Specified by:
setDescription
in interfaceSynapseArtifact
- Parameters:
description
- tobe set to the artifact
-
getDescription
public String getDescription()
Description copied from interface:SynapseArtifact
Retrieves the description of the artifact- Specified by:
getDescription
in interfaceSynapseArtifact
- Returns:
- description of the artifact
-
setFileName
public void setFileName(String filename)
Description copied from interface:MessageStore
Set the name of the file that the Message store is configured- Specified by:
setFileName
in interfaceMessageStore
- Parameters:
filename
- Name of the file where this artifact is defined
-
getFileName
public String getFileName()
Description copied from interface:MessageStore
get the file name that the message store is configured- Specified by:
getFileName
in interfaceMessageStore
- Returns:
- Name of the file where this artifact is defined
-
getType
public int getType()
Description copied from interface:MessageStore
Returns the type of this message store.
The type of a message store can be one of following types,
Constants.JMS_MS
,Constants.INMEMORY_MS
, orConstants.JDBC_MS
- Specified by:
getType
in interfaceMessageStore
- Returns:
- Type of the message store.
-
getLock
public Lock getLock()
-
nextProducerId
public int nextProducerId()
-
nextConsumerId
public int nextConsumerId()
-
enqueued
public void enqueued()
-
dequeued
public void dequeued()
-
difference
public long difference()
-
isEdited
public boolean isEdited()
Whether the message store edited through the management console- Specified by:
isEdited
in interfaceMessageStore
- Returns:
- isEdited
-
setIsEdited
public void setIsEdited(boolean isEdited)
Set whether the message store edited through the management console- Specified by:
setIsEdited
in interfaceMessageStore
- Parameters:
isEdited
-
-
getArtifactContainerName
public String getArtifactContainerName()
Get the name of the artifact container from which the message store deployed- Specified by:
getArtifactContainerName
in interfaceMessageStore
- Returns:
- artifactContainerName
-
setArtifactContainerName
public void setArtifactContainerName(String artifactContainerName)
Set the name of the artifact container from which the message store deployed- Specified by:
setArtifactContainerName
in interfaceMessageStore
- Parameters:
artifactContainerName
-
-
-