Class SynapseConfiguration

    • Constructor Detail

      • SynapseConfiguration

        public SynapseConfiguration()
    • Method Detail

      • addSequence

        public void addSequence​(String key,
                                Mediator mediator)
        Add a named sequence into the local registry. If a sequence already exists by the specified key a runtime exception is thrown.
        Parameters:
        key - the name for the sequence
        mediator - a Sequence mediator
      • addSequenceTemplate

        public void addSequenceTemplate​(String key,
                                        TemplateMediator mediator)
        Add a sequence-template into the local registry. If a template already exists by the specified key a runtime exception is thrown.
        Parameters:
        key - the name for the sequence
        mediator - a Sequence mediator
      • updateSequenceTemplate

        public void updateSequenceTemplate​(String key,
                                           TemplateMediator mediator)
        Update a sequence-template into the local registry. If a template already exists by the specified key a runtime exception is thrown.
        Parameters:
        key - the name for the sequence
        mediator - a Sequence mediator
      • updateSequence

        public void updateSequence​(String key,
                                   Mediator mediator)
      • addSequence

        public void addSequence​(String key,
                                Entry entry)
        Deprecated.
        Allow a dynamic sequence to be cached and made available through the local registry. If a sequence already exists by the specified key a runtime exception is thrown.
        Parameters:
        key - the key to lookup the sequence from the remote registry
        entry - the Entry object which holds meta information and the cached resource
      • getDefinedSequences

        public Map<String,​SequenceMediator> getDefinedSequences()
        Returns the map of defined sequences in the configuration excluding the fetched sequences from remote registry.
        Returns:
        Map of SequenceMediators defined in the local configuration
      • getSequenceTemplates

        public Map<String,​TemplateMediator> getSequenceTemplates()
        Returns the map of defined synapse templates in the configuration excluding the fetched sequences from remote registry.
        Returns:
        Map of Templates defined in the local configuration
      • getEndpointTemplates

        public Map<String,​Template> getEndpointTemplates()
        Returns the map of defined synapse endpoint templates in the configuration excluding the fetched sequences from remote registry.
        Returns:
        Map of Templates defined in the local configuration
      • updateInboundEndpoint

        public void updateInboundEndpoint​(String name,
                                          InboundEndpoint inboundEndpoint)
      • removeInboundEndpoint

        public void removeInboundEndpoint​(String name)
      • addAPI

        public void addAPI​(String name,
                           API api)
      • addAPI

        public void addAPI​(String name,
                           API api,
                           boolean reOrder)
      • addSwaggerDefinition

        public void addSwaggerDefinition​(String apiName,
                                         String swaggerDefinition)
        Add swagger definition of an API.
        Parameters:
        apiName - name of the API.
        swaggerDefinition - Swagger definition as string.
      • validateSwaggerTable

        public void validateSwaggerTable()
        Remove swagger contents without corresponding API. This discrepancy can happen by a faulty CAPP.
      • getSwaggerOfTheAPI

        public String getSwaggerOfTheAPI​(String apiName)
        Get swagger definition of a given API.
        Parameters:
        apiName - deployed name of the API.
        Returns:
        Swagger definition on the API, else null.
      • updateAPI

        public void updateAPI​(String name,
                              API api)
      • getAPIs

        public Collection<API> getAPIs​(String bindTo)
        Get the API specifying the binds to option
        Parameters:
        bindTo - Name of inbound/binds-to
        Returns:
        list of APIs bound to the specified inbound
      • getAPI

        public API getAPI​(String name)
      • removeAPI

        public void removeAPI​(String name)
      • removeSwaggerFromTheAPI

        public void removeSwaggerFromTheAPI​(String name)
        Remove the swagger definition from Synapse Context if it exists.
        Parameters:
        name - artifact name of the API.
      • getSequenceTemplate

        public TemplateMediator getSequenceTemplate​(String key)
        Return the template specified with the given key
        Parameters:
        key - the key being referenced for the template
        Returns:
        the template referenced by the key from local/remote registry
      • getMandatorySequence

        public Mediator getMandatorySequence()
        Gets the mandatory sequence, from the direct reference. This is also available in the getSequence(String) but this method improves the performance hence this will be required for all messages
        Returns:
        mandatory sequence direct reference in the local configuration
      • setMandatorySequence

        public void setMandatorySequence​(Mediator mandatorySequence)
        Sets the mandatory sequence direct reference
        Parameters:
        mandatorySequence - to be set as the direct reference
      • getSequence

        public Mediator getSequence​(String key)
        Return the sequence specified with the given key
        Parameters:
        key - the key being referenced
        Returns:
        the sequence referenced by the key
      • getFormat

        public org.apache.axiom.om.OMElement getFormat​(String key)
        Return the format of the payload factory specified by the given key
        Parameters:
        key -
        Returns:
        OMElement
      • removeSequence

        public void removeSequence​(String key)
        Removes a sequence from the local registry
        Parameters:
        key - of the sequence to be removed
      • removeSequenceTemplate

        public void removeSequenceTemplate​(String name)
        Removes a template from the local registry
        Parameters:
        name - of the template to be removed
      • getMainSequence

        public Mediator getMainSequence()
        Return the main/default sequence to be executed. This is the sequence which will execute for all messages when message mediation takes place
        Returns:
        the main mediator sequence
      • getFaultSequence

        public Mediator getFaultSequence()
        Return the fault sequence to be executed when Synapse encounters a fault scenario during processing
        Returns:
        the fault sequence
      • addEntry

        public void addEntry​(String key,
                             Entry entry)
        Define a resource to the local registry. All static resources (e.g. URL source) are loaded during this definition phase, and the inability to load such a resource will not allow the definition of the resource to the local registry. If an entry already exists by the specified key a runtime exception is thrown.
        Parameters:
        key - the key associated with the resource
        entry - the Entry that holds meta information about the resource and its contents (or cached contents if the Entry refers to a dynamic resource off a remote registry)
      • updateEntry

        public void updateEntry​(String key,
                                Entry entry)
      • getCachedEntries

        public Map<String,​Entry> getCachedEntries()
        Gives the set of remote entries that are cached in localRegistry as mapping of entry key to the Entry definition
        Returns:
        Map of locally cached entries
      • getDefinedEntries

        public Map<String,​Entry> getDefinedEntries()
        Returns the map of defined entries in the configuration excluding the fetched entries from remote registry.
        Returns:
        Map of Entries defined in the local configuration
      • getLocalRegistryEntry

        public Object getLocalRegistryEntry​(String key)
        Get the resource from local registry
        Parameters:
        key - the key of the resource required
        Returns:
        value for the key
      • getEntry

        public Object getEntry​(String key)
        Get the resource with the given key
        Parameters:
        key - the key of the resource required
        Returns:
        its value
      • getEntryDefinition

        public Entry getEntryDefinition​(String key)
        Get the Entry object mapped to the given key
        Parameters:
        key - the key for which the Entry is required
        Returns:
        its value
      • removeEntry

        public void removeEntry​(String key)
        Deletes any reference mapped to the given key from the local registry
        Parameters:
        key - the key of the reference to be removed
      • clearCachedEntry

        public void clearCachedEntry​(String key)
        Clears the cache of the remote entry with the key specified
        Parameters:
        key - - String key of the entry
      • clearCache

        public void clearCache()
        Clears the cache of all the remote entries which has been cached in the configuration
      • addEndpoint

        public void addEndpoint​(String key,
                                Endpoint endpoint)
        Define a named endpoint with the given key. If an endpoint already exists by the specified name a runtime exception is thrown.
        Parameters:
        key - the key for the endpoint
        endpoint - the endpoint definition
      • updateEndpoint

        public void updateEndpoint​(String key,
                                   Endpoint endpoint)
      • addEndpoint

        public void addEndpoint​(String key,
                                Entry entry)
        Deprecated.
        Add a dynamic endpoint definition to the local registry. If an endpoint already exists by the specified name a runtime exception is thrown.
        Parameters:
        key - the key for the endpoint definition
        entry - the actual endpoint definition to be added
      • getDefinedEndpoints

        public Map<String,​Endpoint> getDefinedEndpoints()
        Returns the map of defined endpoints in the configuration excluding the fetched endpoints from remote registry
        Returns:
        Map of Endpoints defined in the local configuration
      • getEndpoint

        public Endpoint getEndpoint​(String key)
        Get the definition of the endpoint with the given key
        Parameters:
        key - the key of the endpoint
        Returns:
        the endpoint definition
      • removeEndpoint

        public void removeEndpoint​(String key)
        Deletes the endpoint with the given key. If an endpoint does not exist by the specified key a runtime exception is thrown.
        Parameters:
        key - of the endpoint to be deleted
      • addProxyService

        public void addProxyService​(String name,
                                    ProxyService proxy)
        Add a Proxy service to the configuration. If a proxy service already exists by the specified name a runtime exception is thrown.
        Parameters:
        name - the name of the Proxy service
        proxy - the Proxy service instance
      • getProxyService

        public ProxyService getProxyService​(String name)
        Get the Proxy service with the given name
        Parameters:
        name - the name being looked up
        Returns:
        the Proxy service
      • removeProxyService

        public void removeProxyService​(String name)
        Deletes the Proxy Service named with the given name. If a proxy service does not exist by the specified name a runtime exception is thrown.
        Parameters:
        name - of the Proxy Service to be deleted
      • getProxyServices

        public Collection<ProxyService> getProxyServices()
        Return the list of defined proxy services
        Returns:
        the proxy services defined
      • getLocalRegistry

        public Map getLocalRegistry()
        Return an unmodifiable copy of the local registry
        Returns:
        an unmodifiable copy of the local registry
      • getRegistry

        public Registry getRegistry()
        Get the remote registry defined (if any)
        Returns:
        the currently defined remote registry
      • setRegistry

        public void setRegistry​(Registry registry)
        Set the remote registry for the configuration
        Parameters:
        registry - the remote registry for the configuration
      • setAxisConfiguration

        public void setAxisConfiguration​(org.apache.axis2.engine.AxisConfiguration axisConfig)
        Set the Axis2 AxisConfiguration to the SynapseConfiguration
        Parameters:
        axisConfig - AxisConfiguration to be set
      • getAxisConfiguration

        public org.apache.axis2.engine.AxisConfiguration getAxisConfiguration()
        Get the Axis2 AxisConfiguration for the SynapseConfiguration
        Returns:
        AxisConfiguration of the Axis2
      • getPathToConfigFile

        public String getPathToConfigFile()
        The path to the currently loaded configuration file
        Returns:
        file path to synapse.xml
      • setPathToConfigFile

        public void setPathToConfigFile​(String pathToConfigFile)
        Set the path to the loaded synapse.xml
        Parameters:
        pathToConfigFile - path to the synapse.xml loaded
      • setDefaultQName

        public void setDefaultQName​(QName defaultQName)
        Set the default QName of the Synapse Configuration
        Parameters:
        defaultQName - QName specifying the default QName of the configuration
      • getDefaultQName

        public QName getDefaultQName()
        Get the default QName of the configuration.
        Returns:
        default QName of the configuration
      • getSynapseTimer

        public Timer getSynapseTimer()
        Get the timer object for the Synapse Configuration
        Returns:
        synapseTimer timer object of the configuration
      • setSynapseTimer

        public void setSynapseTimer​(Timer synapseTimer)
        Set the SynapseTimer of the Synapse Configuration
        Parameters:
        synapseTimer - SynapseTimer of the Synapse Configuration
      • getStartups

        public Collection<Startup> getStartups()
        Get the startup collection in the configuration
        Returns:
        collection of startup objects registered
      • getStartup

        public Startup getStartup​(String id)
        Get the Startup with the specified name
        Parameters:
        id - - String name of the startup to be retrieved
        Returns:
        Startup object with the specified name or null
      • addStartup

        public void addStartup​(Startup startup)
        Add a startup to the startups map in the configuration. If a startup already exists by the specified name a runtime exception is thrown.
        Parameters:
        startup - - Startup object to be added
      • updateStartup

        public void updateStartup​(Startup startup)
      • removeStartup

        public void removeStartup​(String name)
        Removes the startup specified by the name. If no startup exists by the specified name a runtime exception is thrown.
        Parameters:
        name - - name of the startup that needs to be removed
      • getProperties

        public Properties getProperties()
        Gets the properties to configure the Synapse environment.
        Returns:
        set of properties as Properties
      • setProperty

        public void setProperty​(String key,
                                String value)
        Sets the specified property to the Synapse configuration
        Parameters:
        key - Name of the property
        value - Value of the property to be set
      • setProperties

        public void setProperties​(Properties properties)
        Deprecated.
        Sets the properties to configure the Synapse environment.
        Parameters:
        properties - - Properties which needs to be set
      • getProperty

        public String getProperty​(String propKey,
                                  String def)
        Gets the String representation of the property value if there is a property for the given propKey or returns the default value passed
        Parameters:
        propKey - - key for the property lookup
        def - - default value
        Returns:
        String representation of the property value with the given key or the def value
      • getProperty

        public long getProperty​(String propKey,
                                long def)
        Gets the String representation of the property value if there is a property for the given propKey or returns the default value passed
        Parameters:
        propKey - - key for the property lookup
        def - - default value
        Returns:
        String representation of the property value with the given key or the def value
      • getProperty

        public String getProperty​(String propKey)
        Gets the property value if the property specified by the propKey is there or null else
        Parameters:
        propKey - - key for the property lookup
        Returns:
        String representation of the property value if found or null else
      • destroy

        public void destroy()
        This method will be called on the soft shutdown or destroying the configuration and will destroy all the stateful managed parts of the configuration.
        Specified by:
        destroy in interface ManagedLifecycle
      • destroy

        public void destroy​(boolean preserverState)
      • init

        public void init​(SynapseEnvironment se)
        This method will be called in the startup of Synapse or in an initiation and will initialize all the managed parts of the Synapse Configuration
        Specified by:
        init in interface ManagedLifecycle
        Parameters:
        se - SynapseEnvironment specifying the env to be initialized
      • addEventSource

        public void addEventSource​(String name,
                                   SynapseEventSource eventSource)
        Add an event source to the configuration. If an event source already exists by the specified name a runtime exception is thrown.
        Parameters:
        name - name of the event source
        eventSource - the event source to be added
      • removeEventSource

        public void removeEventSource​(String name)
        Remove an event source from the configuration. If the specified event source does not exist a runtime exception is thrown.
        Parameters:
        name - name of the event source to be removed
      • unregisterObserver

        public void unregisterObserver​(SynapseObserver observer)
      • addPriorityExecutor

        public void addPriorityExecutor​(String name,
                                        org.apache.synapse.commons.executors.PriorityExecutor executor)
        Add an executor
        Parameters:
        name - name of the executor
        executor - executor
      • updatePriorityExecutor

        public void updatePriorityExecutor​(String name,
                                           org.apache.synapse.commons.executors.PriorityExecutor executor)
      • getPriorityExecutors

        public Map<String,​org.apache.synapse.commons.executors.PriorityExecutor> getPriorityExecutors()
        Get the executors map
        Returns:
        executors map, stored as name of executor and executor
      • removeExecutor

        public org.apache.synapse.commons.executors.PriorityExecutor removeExecutor​(String name)
        Removes an executor from the configuration
        Parameters:
        name - name of the executor
        Returns:
        removed executor
      • getMessageStore

        public MessageStore getMessageStore​(String name)
        Get the Message store for the configuration with a given name.
        Parameters:
        name - Name of the message store
        Returns:
        a MessageStore instance or null
      • addMessageStore

        public void addMessageStore​(String name,
                                    MessageStore messageStore)
        Add MessageStore to the configuration with a given name.
        Parameters:
        name - Name of the message store
        messageStore - a MessageStore instance
      • getMessageStores

        public Map<String,​MessageStore> getMessageStores()
        Get Message stores defined
        Returns:
        message store map stored as name of the message store and message store
      • removeMessageStore

        public MessageStore removeMessageStore​(String name)
        Removes a Message store from the configuration
        Parameters:
        name - name of the message store
        Returns:
        The message store with the specified name
      • addMessageProcessor

        public void addMessageProcessor​(String name,
                                        MessageProcessor processor)
        Add message processor to the synapse configuration with given name
        Parameters:
        name - of the Message processor
        processor - instance
      • getMessageProcessors

        public Map<String,​MessageProcessor> getMessageProcessors()
        Get all Message processors in the Synapse configuration
        Returns:
        Return Map that contains all the message processors
      • removeMessageProcessor

        public MessageProcessor removeMessageProcessor​(String name)
        remove the message processor from the synapse configuration
        Parameters:
        name - of the message
        Returns:
        Removed Message processor instance
      • addSynapseLibrary

        public void addSynapseLibrary​(String name,
                                      Library library)
        Add Synapse library to configuration with given name
        Parameters:
        name - of synapse lib
        library - instance
      • getSynapseLibraries

        public Map<String,​Library> getSynapseLibraries()
        Get all Synapse libraries in the Synapse configuration
        Returns:
        Return Map that contains all the Synapse libraries
      • getDeployedLib

        public static Library getDeployedLib​(String name)
      • getDeployedLibCount

        public static int getDeployedLibCount​(String name)
      • removeOneDeployedLib

        public static void removeOneDeployedLib​(String name)
      • addNewDeployedLib

        public static void addNewDeployedLib​(String name,
                                             Library library)
      • removeSynapseLibrary

        public Library removeSynapseLibrary​(String name)
        remove the Synapse library from the synapse configuration
        Parameters:
        name - of the lib
        Returns:
        Removed Synapse library instance
      • addSynapseImport

        public void addSynapseImport​(String name,
                                     SynapseImport synImport)
        Add Synapse Import to a configuration with given name
        Parameters:
        name - of synapse lib
        synImport - instance
      • getSynapseImports

        public Map<String,​SynapseImport> getSynapseImports()
        Get all Synapse libraries in the Synapse configuration
        Returns:
        Return Map that contains all the Synapse libraries
      • removeSynapseImport

        public SynapseImport removeSynapseImport​(String name)
        remove the Synapse library from the synapse configuration
        Parameters:
        name - of the lib
        Returns:
        Removed Synapse library instance
      • setDescription

        public void setDescription​(String description)
        Sets the description of the configuration
        Specified by:
        setDescription in interface SynapseArtifact
        Parameters:
        description - tobe set to the artifact
      • getDescription

        public String getDescription()
        Gets the configuration description
        Specified by:
        getDescription in interface SynapseArtifact
        Returns:
        description of the configuration
      • getArtifactDeploymentStore

        public SynapseArtifactDeploymentStore getArtifactDeploymentStore()
        Get the SynapseArtifactDeploymentStore which is used to store the information about the deployed artifacts
        Returns:
        the SynapseArtifactDeploymentStore for this configuration
      • getDecryptedCacheMap

        public Map<String,​Object> getDecryptedCacheMap()
        Returns the map which contains the Decrypted values read via the secure vault provider
        Returns:
      • getTaskManager

        public org.apache.synapse.task.TaskManager getTaskManager()
      • setTaskManager

        public void setTaskManager​(org.apache.synapse.task.TaskManager taskManager)
      • addEndpointTemplate

        public void addEndpointTemplate​(String name,
                                        Template template)
      • updateEndpointTemplate

        public void updateEndpointTemplate​(String name,
                                           Template template)
      • removeEndpointTemplate

        public void removeEndpointTemplate​(String name)
      • getEndpointTemplate

        public Template getEndpointTemplate​(String key)
      • getDefaultConfiguration

        public Mediator getDefaultConfiguration​(String key)
      • isAllowHotUpdate

        public boolean isAllowHotUpdate()
      • setAllowHotUpdate

        public void setAllowHotUpdate​(boolean allowHotUpdate)
      • getCommentedTextList

        public List<String> getCommentedTextList()
        Returns CommentedText List
        Returns:
        ArrayList of String contains commented text segments
      • addToCommentedTextList

        public void addToCommentedTextList​(String comment)
        Add new comment text entry to the existing list*
        Parameters:
        comment - String comment
      • getCompletedStructureStore

        public CompletedStructureStore getCompletedStructureStore()
        This method returns the CompletedStructureStore responsible for collecting completed statistics for this synapse instance.
        Returns:
        CompletedStructureStore for this synapse instance
      • reconstructAPITable

        public void reconstructAPITable()
        This method reconstructs the apiTable, and inboundApiMappings in descending order of context