public abstract class SettingsManager extends Object implements CapabilitiesExtensionManager
SettingDefinition
are loaded from
SettingDefinitionProvider
by the Java ServiceLoader
interface. Classes can subscribe to specific settings using the
Configurable
and Setting
annotations. To be recognized by the
SettingsManager configure(java.lang.Object)
has to be called for
every object that wants to recieve settings. This is automatically done for
all classes loaded by the Configurator
. All other classes have to
call configure(java.lang.Object)
manually.
AdministratorUser
,
SettingDefinition
,
SettingDefinitionProvider
,
SettingValue
,
Configurable
,
ConfiguringSingletonServiceLoader
,
AbstractConfiguringServiceLoaderRepository
Modifier and Type | Field and Description |
---|---|
private static ReentrantLock |
creationLock |
private static SettingsManager |
instance |
private static org.slf4j.Logger |
LOG |
Constructor and Description |
---|
SettingsManager() |
Modifier and Type | Method and Description |
---|---|
abstract void |
changeSetting(SettingValue<?> value)
Changes a setting.
|
abstract void |
cleanup()
Clean up this SettingsManager.
|
abstract void |
configure(Object o)
Configure
o with the required settings. |
abstract AdministratorUser |
createAdminUser(String username,
String password)
Creates a new
AdministratorUser . |
private static SettingsManager |
createInstance()
Creates a new
SettingsManager with the ServiceLoader
interface. |
abstract void |
deleteAdminUser(AdministratorUser user)
Deletes the user previously returned by
getAdminUser(java.lang.String) or getAdminUsers() . |
abstract void |
deleteAdminUser(String username)
Deletes the user with the specified username.
|
abstract void |
deleteAll()
Deletes all settings and users.
|
abstract void |
deleteSetting(SettingDefinition<?,?> setting)
Deletes the setting defined by
setting . |
abstract AdministratorUser |
getAdminUser(String username)
Gets the administrator user with the specified user name.
|
abstract Set<AdministratorUser> |
getAdminUsers()
Gets all registered administrator users.
|
abstract SettingDefinition<?,?> |
getDefinitionByKey(String key)
Get the definition that is defined with the specified key.
|
static SettingsManager |
getInstance()
Gets the singleton instance of the SettingsManager.
|
abstract <T> SettingValue<T> |
getSetting(SettingDefinition<?,T> key)
Gets the value of the setting defined by
key . |
abstract Set<SettingDefinition<?,?>> |
getSettingDefinitions()
Gets all
SettingDefinition s known by this class. |
abstract SettingValueFactory |
getSettingFactory() |
abstract Map<SettingDefinition<?,?>,SettingValue<?>> |
getSettings()
Gets all values for all definitions.
|
abstract boolean |
hasAdminUser()
Checks if a administrator user exists.
|
abstract boolean |
isActive(BindingKey bk)
Checks if the binding is active.
|
abstract boolean |
isActive(OfferingExtensionKey oek)
Checks if the offering extension is active.
|
abstract boolean |
isActive(OwsExtendedCapabilitiesKey oeck)
Checks if the extended capabilities is active.
|
abstract boolean |
isActive(ProcedureDescriptionFormatKey pdfkt)
Checks if the procedure description format is active for the specified
service and version.
|
abstract boolean |
isActive(RequestOperatorKey rokt)
Returns if a operation is active and should be offered by this SOS.
|
abstract boolean |
isActive(ResponseFormatKey rfkt)
Checks if the response format is active for the specified service and
version.
|
abstract void |
saveAdminUser(AdministratorUser user)
Saves a user previously returned by
getAdminUser(java.lang.String) or getAdminUsers() . |
abstract void |
setActive(BindingKey bk,
boolean active)
Sets the status of a binding.
|
abstract void |
setActive(OfferingExtensionKey oek,
boolean active)
Sets the status of a offering extension.
|
abstract void |
setActive(OfferingExtensionKey oek,
boolean active,
boolean updateRepository)
Sets the status of a offering extension.
|
abstract void |
setActive(OwsExtendedCapabilitiesKey oeck,
boolean active)
Sets the status of a extended capabilities.
|
abstract void |
setActive(OwsExtendedCapabilitiesKey oeck,
boolean active,
boolean updateRepository)
Sets the status of a extended capabilities.
|
abstract void |
setActive(ProcedureDescriptionFormatKey pdfkt,
boolean active)
Sets the status of a procedure description format for the specified
service and version.
|
abstract void |
setActive(RequestOperatorKey rokt,
boolean active)
Sets the status of an operation.
|
abstract void |
setActive(ResponseFormatKey rfkt,
boolean active)
Sets the status of a response format for the specified service and
version.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deleteCapabiltiesExtension, deleteOfferingExtension, deleteStaticCapabilities, disableCapabilitiesExtension, disableOfferingExtension, getActiveCapabilitiesExtensions, getActiveOfferingExtensions, getActiveStaticCapabilities, getActiveStaticCapabilitiesDocument, getAllCapabilitiesExtensions, getOfferingExtensions, getStaticCapabilities, getStaticCapabilities, isStaticCapabilitiesActive, saveCapabilitiesExtension, saveOfferingExtension, saveStaticCapabilities, setActiveStaticCapabilities
private static final org.slf4j.Logger LOG
private static final ReentrantLock creationLock
private static SettingsManager instance
public static SettingsManager getInstance() throws ConfigurationException
ConfigurationException
- if no implementation can be foundprivate static SettingsManager createInstance() throws ConfigurationException
SettingsManager
with the ServiceLoader
interface.
ConfigurationException
- if no implementation can be foundpublic abstract void configure(Object o) throws ConfigurationException
o
with the required settings. All changes to a setting
required by the object will be applied.
o
- the object to configure
ConfigurationException
- if there is a problem configuring the objectConfigurable
,
Setting
public abstract SettingDefinition<?,?> getDefinitionByKey(String key)
key
- the key
null
if there is no definition for the
keypublic abstract Set<SettingDefinition<?,?>> getSettingDefinitions()
SettingDefinition
s known by this class.
public abstract <T> SettingValue<T> getSetting(SettingDefinition<?,T> key) throws ConnectionProviderException
key
.
T
- the type of the setting and valuekey
- the definition of the setting
ConnectionProviderException
public abstract Map<SettingDefinition<?,?>,SettingValue<?>> getSettings() throws ConnectionProviderException
null
is added to the map.
ConnectionProviderException
public abstract void deleteSetting(SettingDefinition<?,?> setting) throws ConfigurationException, ConnectionProviderException
setting
.
setting
- the definition
ConfigurationException
- if there is a problem deleting the settingConnectionProviderException
public abstract void changeSetting(SettingValue<?> value) throws ConfigurationException, ConnectionProviderException
value
- the new value of the setting
ConfigurationException
- if there is a problem changing the setting.ConnectionProviderException
public abstract SettingValueFactory getSettingFactory()
SettingValueFactory
to produce valuespublic abstract Set<AdministratorUser> getAdminUsers() throws ConnectionProviderException
ConnectionProviderException
public abstract AdministratorUser getAdminUser(String username) throws ConnectionProviderException
username
- the usernamenull
if no user with the
specified name existsConnectionProviderException
public abstract boolean hasAdminUser() throws ConnectionProviderException
true
if there is a admin user, otherwise false
.ConnectionProviderException
public abstract AdministratorUser createAdminUser(String username, String password) throws ConnectionProviderException
AdministratorUser
. This method will fail if the
username is already used by another user.
username
- the proposed usernamepassword
- the proposed (hashed) password
ConnectionProviderException
public abstract void saveAdminUser(AdministratorUser user) throws ConnectionProviderException
getAdminUser(java.lang.String)
or getAdminUsers()
.
user
- the user to change
ConnectionProviderException
public abstract void deleteAdminUser(String username) throws ConnectionProviderException
username
- the username
ConnectionProviderException
public abstract void deleteAdminUser(AdministratorUser user) throws ConnectionProviderException
getAdminUser(java.lang.String)
or getAdminUsers()
.
user
- ConnectionProviderException
public abstract void deleteAll() throws ConnectionProviderException
ConnectionProviderException
public abstract void cleanup()
public abstract boolean isActive(RequestOperatorKey rokt) throws ConnectionProviderException
rokt
- the key identifying the operation
true
if the operation is active in this SOS
ConnectionProviderException
public abstract boolean isActive(ResponseFormatKey rfkt) throws ConnectionProviderException
rfkt
- the service/version/responseFormat combinationConnectionProviderException
public abstract boolean isActive(ProcedureDescriptionFormatKey pdfkt) throws ConnectionProviderException
pdfkt
- the service/version/procedure description combinationConnectionProviderException
public abstract void setActive(RequestOperatorKey rokt, boolean active) throws ConnectionProviderException
rokt
- the key identifying the operationactive
- whether the operation is active or not
ConnectionProviderException
public abstract void setActive(ResponseFormatKey rfkt, boolean active) throws ConnectionProviderException
rfkt
- the service/version/responseFormat combinationactive
- the statusConnectionProviderException
public abstract void setActive(ProcedureDescriptionFormatKey pdfkt, boolean active) throws ConnectionProviderException
pdfkt
- the service/version/procedure description combinationactive
- the statusConnectionProviderException
public abstract void setActive(BindingKey bk, boolean active) throws ConnectionProviderException
bk
- the bindingactive
- the statusConnectionProviderException
public abstract boolean isActive(BindingKey bk) throws ConnectionProviderException
bk
- the bindingConnectionProviderException
public abstract boolean isActive(OfferingExtensionKey oek) throws ConnectionProviderException
oek
- the offering extension keyConnectionProviderException
public abstract void setActive(OfferingExtensionKey oek, boolean active) throws ConnectionProviderException
oek
- the offering extensionactive
- the statusConnectionProviderException
public abstract void setActive(OfferingExtensionKey oek, boolean active, boolean updateRepository) throws ConnectionProviderException
oek
- the offering extensionactive
- the statusupdateRepository
- indicator if the repository should be updatedConnectionProviderException
public abstract boolean isActive(OwsExtendedCapabilitiesKey oeck) throws ConnectionProviderException
oeck
- the extended capabilities keyConnectionProviderException
public abstract void setActive(OwsExtendedCapabilitiesKey oeck, boolean active) throws ConnectionProviderException
oeck
- the extended capabilitiesactive
- the statusConnectionProviderException
public abstract void setActive(OwsExtendedCapabilitiesKey oeck, boolean active, boolean updateRepository) throws ConnectionProviderException
oeck
- the extended capabilitiesactive
- the statusupdateRepository
- indicator if the repository should be updatedConnectionProviderException
Copyright © 2012-2015 52north.org. All Rights Reserved.