Class 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
    The default property file is alfresco/client/config/repo-clients-apps.properties which could be overridden (or add new clients) by alfresco-global properties file.
    Author:
    Jamal Kaabi-Mofrad
    • Constructor Detail

      • ClientAppConfig

        public ClientAppConfig()
    • Method Detail

      • setDefaultProperties

        public void setDefaultProperties​(Properties defaultProperties)
      • setGlobalProperties

        public void setGlobalProperties​(Properties globalProperties)
      • init

        public void init()
      • getClient

        public ClientAppConfig.ClientApp getClient​(String name)
        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:
        onBootstrap in class org.springframework.extensions.surf.util.AbstractLifecycleBean
      • onShutdown

        protected void onShutdown​(org.springframework.context.ApplicationEvent event)
        Specified by:
        onShutdown in class org.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 properties
        clientsNames - a set of strings which will be populated with client names
        propsNames - 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 of ClientApp with the client's name as the key.
        Parameters:
        clientsNames - the processed clients' names
        propsNames - the processed properties names
        allProps - the merged properties
        Returns:
        a map of ClientApp with the client's name as the key.
      • getAndMergeProperties

        protected Map<String,​String> getAndMergeProperties()
        Converts and merges the given Java properties into a java.util.Map.