Package org.alfresco.repo.client.config
Class ClientAppConfig
java.lang.Object
org.springframework.extensions.surf.util.AbstractLifecycleBean
org.alfresco.repo.client.config.ClientAppConfig
- All Implemented Interfaces:
EventListener,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationListener
public class ClientAppConfig
extends org.springframework.extensions.surf.util.AbstractLifecycleBean
This class picks up all the loaded properties passed to it and uses a naming
convention to isolate the client's name and the related values.
The naming convention must confirm to the following:
repo.client-app.<client-name>.<propertyName>
Also, the client-name or property name (<propertyName>) must not contain a dot ('.')
Note also, that any property without a value is ignored and the client will not be registered if all the properties of that client have no values.
So, if a new client (e.g. MyClientName) is required to send a shared-link email and the service or the API requires, for example, sharedLinkBaseUrl and templateAssetsUrl properties, then the following needs to be put into a properties file.
- repo.client-app.MyClientName.sharedLinkBaseUrl=http://localhost:8080/MyClientName/s
- repo.client-app.MyClientName.templateAssetsUrl=http://localhost:8080/MyClientName/assets
- Author:
- Jamal Kaabi-Mofrad
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class org.springframework.extensions.surf.util.AbstractLifecycleBean
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConverts and merges the given Java properties into ajava.util.Map.Returns the named client or null if no client exists with the given name.Returns an unmodifiable view of the clients map.voidinit()protected voidonBootstrap(org.springframework.context.ApplicationEvent event) protected voidonShutdown(org.springframework.context.ApplicationEvent event) protected Map<String,ClientAppConfig.ClientApp> Processes the given properties and if the properties' values are valid, creates a map ofClientAppwith the client's name as the key.protected voidProcesses the property's key and extracts the clients' names.voidsetDefaultProperties(Properties defaultProperties) voidsetGlobalProperties(Properties globalProperties) Methods inherited from class org.springframework.extensions.surf.util.AbstractLifecycleBean
getApplicationContext, onApplicationEvent, setApplicationContext
-
Field Details
-
PREFIX
- See Also:
-
PROP_TEMPLATE_ASSETS_URL
- See Also:
-
-
Constructor Details
-
ClientAppConfig
public ClientAppConfig()
-
-
Method Details
-
setDefaultProperties
-
setGlobalProperties
-
init
public void init() -
getClients
Returns an unmodifiable view of the clients map. Never null. -
getClient
Returns the named client or null if no client exists with the given name.- Parameters:
name- the name of the client to retrieve
-
onBootstrap
protected void onBootstrap(org.springframework.context.ApplicationEvent event) - Specified by:
onBootstrapin classorg.springframework.extensions.surf.util.AbstractLifecycleBean
-
onShutdown
protected void onShutdown(org.springframework.context.ApplicationEvent event) - Specified by:
onShutdownin classorg.springframework.extensions.surf.util.AbstractLifecycleBean
-
processPropertyKeys
protected void processPropertyKeys(Map<String, String> allProps, Set<String> clientsNames, Set<String> propsNames) Processes the property's key and extracts the clients' names.- Parameters:
allProps- the merged propertiesclientsNames- a set of strings which will be populated with client namespropsNames- a set of strings which will be populated with properties names (i.e.the property after the client name)
-
processClients
protected Map<String,ClientAppConfig.ClientApp> processClients(Set<String> clientsNames, Set<String> propsNames, Map<String, String> allProps) Processes the given properties and if the properties' values are valid, creates a map ofClientAppwith the client's name as the key.- Parameters:
clientsNames- the processed clients' namespropsNames- the processed properties namesallProps- the merged properties- Returns:
- a map of
ClientAppwith the client's name as the key.
-
getAndMergeProperties
Converts and merges the given Java properties into ajava.util.Map.
-