public interface PersistenceManager
Modifier and Type | Method and Description |
---|---|
void |
addConfigListener(ConfigListener listener) |
void |
deleteConfigProfile(java.lang.String profileId)
Delete a Configuration Profile
|
void |
deleteContextConfiguration(java.lang.String contextId)
Used when a configuration context unregisters from the system.
|
void |
deleteTenantConfiguration(java.lang.String tenantId)
Used when a tenant unregisters from the system.
|
void |
exportConfiguration(java.lang.String contextId, java.io.OutputStream stream) |
void |
exportProfile(java.lang.String profileId, java.io.OutputStream stream)
Export the configuration of a Profile to the outputstream.
|
java.util.List<java.lang.String> |
getContextConfigurationIds() |
java.util.List<java.lang.String> |
getContextConfigurationIds(java.lang.String profileId) |
java.lang.String |
getContextId(java.lang.String contextName) |
java.lang.String |
getContextName(java.lang.String contextId) |
java.util.List<java.lang.String> |
getProfileIds() |
ConfigurationManagementService.CONFIG_STATE |
getState(java.lang.String contextId) |
boolean |
getTenantActivationStatus(java.lang.String tenantId) |
java.util.List<java.lang.String> |
getTenants() |
boolean |
isRegistered(java.lang.String contextId) |
JpsConfigurationP |
load()
An XML based PM might use all the information from jps-config.xml.
|
java.beans.PropertyChangeEvent[] |
loadConfigChanges()
Once loaded a second call to this method should return null unless there were further changes.
|
PersistenceConfiguration |
loadContextConfiguration(java.lang.String contextId)
This method populates the Services Configuration and BootConfiguration for the supplied context
|
TenantConfig |
loadTenantConfiguration(java.lang.String tenantId)
This method populates the Tenant;s Service Configuration and BootConfiguration in the supplied method parameters.
|
<T extends ConfigPersistenceElement> |
persist(T element)
API to store a particular Persistence Layer Configuration Element.
|
void |
persistConfigChanges(java.beans.PropertyChangeEvent[] changes)
Persist the Property changes.
|
void |
persistConfigProfile(java.lang.String profileId, java.io.InputStream config)
Persist a Configuration Profile
|
void |
persistContextConfiguration(java.lang.String contextId, java.util.List<ServiceInstanceP> serviceConfig, java.util.List<ServiceInstanceP> bootConfig)
Persist an explicitly defined context configuration TODO: we may not require this if the proposed Template Approach is sufficient for end customer usecases.
|
void |
persistContextConfiguration(java.lang.String contextId, java.lang.String profileId, javax.security.auth.callback.CallbackHandler customizationHandler)
Persist a Context Configuration as a customization of a Profile
|
void |
persistContextConfiguration(java.lang.String contextId, java.lang.String profileId, java.util.List<ConfigurationManagementService.ConfigCustomization> customization, java.util.List<ConfigurationManagementService.ConfigCustomization> bootCustomization)
Persist a Context Configuration as a customization of a Profile
|
void |
persistTenantConfiguration(java.lang.String tenantId, java.util.List<ServiceInstanceP> serviceConfig, java.util.List<ServiceInstanceP> bootConfig) |
void |
removeConfigListener(ConfigListener listener) |
void |
setContextName(java.lang.String contextId, java.lang.String contextName)
Sets a context name for the identified Context.
|
void |
setState(java.lang.String contextId, ConfigurationManagementService.CONFIG_STATE state)
Sets the Activation State
|
void |
setTenantActivationStatus(java.lang.String tenantId, boolean status)
Sets the tenant's Activation Status
|
java.lang.String |
unsetContextName(java.lang.String contextId)
Unset the name (if any) of the identified Context.
|
void |
updateContextConfiguration(java.lang.String contextId, javax.security.auth.callback.CallbackHandler customizationHandler, boolean replace, boolean complete)
Update an existing Context Configuration with additional Customizations or replace the existing customization with the ones supplied.
|
void |
updateContextConfiguration(java.lang.String contextId, java.util.List<ConfigurationManagementService.ConfigCustomization> customization, java.util.List<ConfigurationManagementService.ConfigCustomization> bootCustomization, boolean replace, boolean complete)
Update an existing Context Configuration with additional Customizations or replace the existing customization with the ones supplied.
|
<T extends ConfigPersistenceElement> void persist(T element) throws ConfigurationPersistenceException
Depending on the particular DataStore type used it may or maynot be possible to store a particular kind of Configuration Element. For example the only Configuration Element that can be stored by an XML Persistence Manager is the root element JpsConfigurationP. Whereas a DB based Persistence Manager can store child named child elements like JpsContextP or a ServiceInstanceP.
element
- the configuration element to storeConfigurationPersistenceException
- if there was an error during persistencejava.lang.UnsupportedOperationException
- if the Persistence Manager does not support persisting the particular element.JpsConfigurationP load() throws ConfigurationPersistenceException
A Hybrid PM might be useful in most scenarios where it will pickup the ServiceProvider definitions from a jps-config.xml but should be able to pickup a set of ServiceInstanceP configurations (or a JpsContextP configuration) from a DB/LDAP DataStore.
ConfigurationPersistenceException
- if there was an error in loading configuration.void deleteContextConfiguration(java.lang.String contextId) throws ConfigurationPersistenceException
contextId
-ConfigurationPersistenceException
- if there was an error while deleting the configPersistenceConfiguration loadContextConfiguration(java.lang.String contextId) throws ConfigurationPersistenceException
contextId
- the contextId for which the configuration needs to be loadedConfigurationPersistenceException
- if there was an error while getting the configurationvoid persistContextConfiguration(java.lang.String contextId, java.util.List<ServiceInstanceP> serviceConfig, java.util.List<ServiceInstanceP> bootConfig) throws ConfigurationPersistenceException
contextId
- the contextId for which the configuration needs to be persistedserviceConfig
- the service configuration.bootConfig
- the boot configuration.ConfigurationPersistenceException
- if there was an error while persisting the configurationvoid persistConfigProfile(java.lang.String profileId, java.io.InputStream config) throws ConfigurationPersistenceException, java.io.IOException
profileId
- the name of the configuration profileconfig
-ConfigurationPersistenceException
- if there was an error in persistingjava.io.IOException
- if there was an issue in reading from the Streamvoid deleteConfigProfile(java.lang.String profileId) throws ConfigurationPersistenceException
profileId
-ConfigurationPersistenceException
- if there was an error in deleting the configuration profilevoid persistContextConfiguration(java.lang.String contextId, java.lang.String profileId, java.util.List<ConfigurationManagementService.ConfigCustomization> customization, java.util.List<ConfigurationManagementService.ConfigCustomization> bootCustomization) throws ConfigurationPersistenceException
contextId
- the name of the Context Configuration being persistedprofileId
- the configuration profile that will be used as the basecustomization
- the customizations to be applied for the service configurationsbootCustomization
- the customizations to be applied for the bootstrap configurationConfigurationPersistenceException
void persistContextConfiguration(java.lang.String contextId, java.lang.String profileId, javax.security.auth.callback.CallbackHandler customizationHandler) throws ConfigurationPersistenceException
contextId
- the name of the Context Configuration being persistedprofileId
- the configuration profile that will be used as the basecustomizationHandler
- A CallBackHandler that can handle the CustomizationCallback to obtain the base Configuration as a DOM element on which it can perform the required Customizations.ConfigurationPersistenceException
void updateContextConfiguration(java.lang.String contextId, java.util.List<ConfigurationManagementService.ConfigCustomization> customization, java.util.List<ConfigurationManagementService.ConfigCustomization> bootCustomization, boolean replace, boolean complete) throws ConfigurationPersistenceException
contextId
- the name of the Context Configuration being persistedcustomization
- the customizations to be applied for the service configurationsbootCustomization
- the customizations to be applied for the bootstrap configurationreplace
- a boolean flag indicating whether to apply the customization on top of existing customization or replace the existing one with what is supplied.complete
- when true it sets the configuration state to complete post this operationConfigurationPersistenceException
void updateContextConfiguration(java.lang.String contextId, javax.security.auth.callback.CallbackHandler customizationHandler, boolean replace, boolean complete) throws ConfigurationPersistenceException
contextId
- the name of the Context Configuration being persistedcustomizationHandler
- A CallBackHandler that can handle the CustomizationCallback to obtain the base Configuration as a DOM element on which it can perform the required Customizations.replace
- a boolean flag indicating whether to apply the customization on top of existing customization or replace the existing one with what is supplied.complete
- when true it sets the configuration state to complete post this operationConfigurationPersistenceException
void setState(java.lang.String contextId, ConfigurationManagementService.CONFIG_STATE state) throws ConfigurationPersistenceException
contextId
- the name of the Context ConfigurationConfigurationPersistenceException
ConfigurationManagementService.CONFIG_STATE getState(java.lang.String contextId) throws ConfigurationPersistenceException
contextId
- the name of the Context ConfigurationConfigurationPersistenceException
boolean isRegistered(java.lang.String contextId) throws ConfigurationPersistenceException
contextId
- the name of the Context ConfigurationConfigurationPersistenceException
- if there was an error in querying the statusjava.util.List<java.lang.String> getContextConfigurationIds() throws ConfigurationPersistenceException
ConfigurationPersistenceException
java.util.List<java.lang.String> getContextConfigurationIds(java.lang.String profileId) throws ConfigurationPersistenceException
profileId
- the profile under which the configurations are to be fetchedConfigurationPersistenceException
java.util.List<java.lang.String> getProfileIds() throws ConfigurationPersistenceException
ConfigurationPersistenceException
void addConfigListener(ConfigListener listener) throws ConfigurationPersistenceException
listener
- the listener to be notified for config state changesAccessControlException
- if the code does not have permission to invoke this operationConfigurationPersistenceException
- if there was an error in registering the listenerjava.lang.IllegalArgumentException
- if the listener was supplied as null;void removeConfigListener(ConfigListener listener) throws ConfigurationPersistenceException
listener
- the listener to be removed from the notification serviceConfigurationPersistenceException
- if there was an error in un-registering the listener or if the listener was not registered.void persistConfigChanges(java.beans.PropertyChangeEvent[] changes) throws ConfigurationPersistenceException
Currently all Persistence Managers are expected to produce this. Primarily because the Portable JMX Framework API's require the results of a change to be reflected in a file that is then propagated to the ManagedServers.
TBD: need to revisit this in the next release.changes
- the property changesConfigurationPersistenceException
- if there was an error while persisting the changesjava.beans.PropertyChangeEvent[] loadConfigChanges() throws ConfigurationPersistenceException
TODO : revisit the semantics
ConfigurationPersistenceException
- if there was an error while persisting the changesvoid deleteTenantConfiguration(java.lang.String tenantId) throws ConfigurationPersistenceException
tenantId
- : the ID of the tenant whose configuration needs to be deleted from a system.ConfigurationPersistenceException
- if there was an error while deleting the configTenantConfig loadTenantConfiguration(java.lang.String tenantId) throws ConfigurationPersistenceException
tenantId
-serviceConfig
- the tenant's service configuration.bootConfig
- the tenant;s boot configuration.ConfigurationPersistenceException
- if there was an error while getting the configurationvoid persistTenantConfiguration(java.lang.String tenantId, java.util.List<ServiceInstanceP> serviceConfig, java.util.List<ServiceInstanceP> bootConfig) throws ConfigurationPersistenceException
tenantId
-serviceConfig
- the tenant's service configuration.bootConfig
- the tenant;s boot configuration.ConfigurationPersistenceException
- if there was an error while persisting the configurationvoid setTenantActivationStatus(java.lang.String tenantId, boolean status)
tenantId
-status
- true indicates activate the tenant, false indicates deactivateboolean getTenantActivationStatus(java.lang.String tenantId)
tenantId
-java.util.List<java.lang.String> getTenants() throws ConfigurationPersistenceException
void setContextName(java.lang.String contextId, java.lang.String contextName) throws ConfigurationPersistenceException
contextId
- the context whose name has to be setcontextName
- the name for the contexIdConfigurationPersistenceException
- if there was a problem in setting the namejava.lang.String unsetContextName(java.lang.String contextId) throws ConfigurationPersistenceException
contextId
- the context whose name has to be unsetConfigurationPersistenceException
- if there was a problem in unsetting the namejava.lang.String getContextName(java.lang.String contextId) throws ConfigurationPersistenceException
contextId
-ConfigurationPersistenceException
- if there was a problem in getting the namejava.lang.String getContextId(java.lang.String contextName) throws ConfigurationPersistenceException
contextName
-ConfigurationPersistenceException
- if there was a problem in getting the namevoid exportProfile(java.lang.String profileId, java.io.OutputStream stream) throws ConfigurationPersistenceException, java.io.IOException
profileId
- the id of the profile whose configuration has to be exportedstream
- the outputstream to which the profile needs to be written toConfigurationPersistenceException
- if there was a problem in retrieving the configurationjava.io.IOException
- if there was a problem in writing to the streamvoid exportConfiguration(java.lang.String contextId, java.io.OutputStream stream) throws ConfigurationPersistenceException, java.io.IOException
contextId
- the contextId whose complete configuration and bootstrap configuration is desiredstream
- the outputstream to which the configuration needs to be written toConfigurationPersistenceException
- if there was a problem in retrieving the configurationjava.io.IOException
- if there was a problem in writing to the stream