Interface ConfigManagerRemote


  • public interface ConfigManagerRemote
    Remote Interface for ConfigManager
    Loads and saves configuration files and their revisions using the Document Manager.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String checkinConfig​(java.lang.String sessionId, java.lang.String path, PluginConfigDataHandler config, java.lang.Class<?>... customClazz)
      Check-in a single configuration
      java.lang.String checkinConfig​(java.lang.String sessionId, java.lang.String path, PluginConfigDataHandler config, java.lang.String notificationMode, java.lang.Class<?>... customClazz)
      Check-in a single configuration with notification mode
      java.lang.String checkinConfigFile​(java.lang.String sessionId, DocumentContent document)
      Check-in a document
      void checkinListOfConfigFiles​(java.lang.String sessionId, PluginConfigCollection configurations, boolean validateXML)
      Check-in multiple files as String array
      PluginConfigDataHandler checkoutConfig​(java.lang.String sessionId, java.lang.String path, java.lang.Class<?>... customClazz)
      Checkout a single file String
      PluginConfigCollection checkoutListOfConfigFiles​(java.lang.String sessionId, java.util.List<java.lang.String> files, java.lang.Class<?>... customClazz)
      Check a list of files from the repository.
      java.lang.String createConfiguration​(java.lang.String sessionId, java.lang.String pluginName, java.lang.String customTypeName, java.util.Map<java.lang.String,​java.lang.Object> initialValues)
      Create and save a new configuration for a plug-in.
      void deleteFileOrFolder​(java.lang.String sessionId, java.lang.String path)
      Remove files and/or folders physically from the repository
      void deleteFileOrFolder​(java.lang.String sessionId, java.lang.String path, boolean updateDependencies)
      Remove files and/or folders physically from the repository
      java.util.List<java.lang.String> deleteListOfConfigFiles​(java.lang.String sessionId, java.util.List<java.lang.String> deletefiles)
      Delete configuration files from the provided list.
      java.util.List<java.lang.String> deleteListOfConfigFiles​(java.lang.String sessionId, java.util.List<java.lang.String> deletefiles, boolean updateDependencies)
      Delete configuration files from the provided list.
      void emptyConfigTrash​(java.lang.String sessionId)
      Clears the trash bin of the repository.
      void emptyTrash​(java.lang.String sessionId)
      Delete are configs from trash.
      boolean exists​(java.lang.String sessionId, java.lang.String path)
      Check whether a file or folder exists at the given path
      java.util.List<PluginConfig.Dependencies.PluginDependency> getAllDependencies​(java.lang.String sessionId, java.lang.String path, java.util.List<PluginConfig.Dependencies.PluginDependency> dependencies, boolean recursive)
      Read all dependencies of a configuration file.
      java.util.List<Client> getClients​(java.lang.String sessionId)
      Get a list of clients (tenants)
      PluginConfigDataHandler getConfig​(java.lang.String sessionId, java.lang.String path, java.lang.Class<?>... customClazz)
      Get the content of a configuration file from the Document Manager (HEAD Revision)
      ConfigFileProperties getConfigProperties​(java.lang.String sessionId, java.lang.String path)
      Get the configuration properties of a file at a specific location.
      PluginConfigDataHandler getConfigRevision​(java.lang.String sessionId, java.lang.String path, java.lang.String revision, java.lang.Class<?>... customClazz)
      Get the content of a specific revision of a configuration file from the Document Manager
      java.util.List<ConfigFileProperties> getConfigRevisionsProperties​(java.lang.String sessionId, java.lang.String path)
      Get properties of all revisions of this config file
      PluginConfigCollection getConfigs​(java.lang.String sessionId, java.lang.String folder, java.lang.Class<?>... customClazz)
      Get a collection of config files from 'folder'.
      java.util.List<java.lang.String> getConnectors​(java.lang.String sessionId)
      Get a list of connector plug-ins (i.e.
      int getCurrentId​(java.lang.String sessionId, boolean useServerId)
      Get the current value of this ID sequence.
      java.util.List<ConfigFileProperties> getFiles​(java.lang.String sessionId, java.lang.String folder)
      Get a list of files for a path (excluding sub-folders).
      int getNextId​(java.lang.String sessionId, boolean useServerId)
      Read the next ID from the data source.
      java.util.List<PluginInfo> getPlugins​(java.lang.String sessionId, boolean active)
      Gets a list of all plug-in libraries with their plug-ins and configurations.
      java.util.List<java.lang.String> getSubFolders​(java.lang.String sessionId, java.lang.String folderPath)
      Get List of sub folders
      java.util.List<ConfigFileProperties> getSubNodes​(java.lang.String sessionId, java.lang.String folderPath)
      Get a list of files and sub folders for a path.
      boolean isAlive​(java.lang.String sessionId, java.lang.String path)
      Check whether a file exists AND is alive, i.e.: the file is not deleted.
      void lockFile​(java.lang.String sessionId, java.lang.String path)
      Lock a single file
      void setMinimumInitialServerId​(java.lang.String sessionId, boolean useServerId, int minInitialValue)
      Set the sequence initial value on this machine to minimum minInitialValue.
      void unlockFile​(java.lang.String sessionId, java.lang.String path)
      Unlock a single file
      java.lang.String upload​(java.lang.String sessionId, java.io.InputStream content, java.lang.String path, ConfigFileProperties properties)
      Upload content stream to a config file at a specific location.
      java.lang.String upload​(java.lang.String sessionId, java.lang.String filePath, java.lang.String path, ConfigFileProperties properties)
      Upload a local config file to the repository
    • Method Detail

      • getConfig

        PluginConfigDataHandler getConfig​(java.lang.String sessionId,
                                          java.lang.String path,
                                          java.lang.Class<?>... customClazz)
                                   throws ConfigManagerException
        Get the content of a configuration file from the Document Manager (HEAD Revision)
        Parameters:
        sessionId - PubServer session ID
        path - Repository path (e.g. /pubserver/com.priint.plugin.demo/config_2.1.xml)
        customClazz - class representing an XML root element defined via JAXB
        Returns:
        String content (XML) of the configuration file.
        Throws:
        ConfigManagerException
      • getConfigRevision

        PluginConfigDataHandler getConfigRevision​(java.lang.String sessionId,
                                                  java.lang.String path,
                                                  java.lang.String revision,
                                                  java.lang.Class<?>... customClazz)
                                           throws ConfigManagerException
        Get the content of a specific revision of a configuration file from the Document Manager
        Parameters:
        sessionId - PubServer session ID
        path - Repository path (e.g. /pubserver/com.priint.plugin.demo/config_2.1.xml)
        revision - Revision number
        customClazz - class representing an XML root element defined via JAXB
        Returns:
        String content (XML) of the configuration file.
        Throws:
        ConfigManagerCheckinException
        ConfigManagerException
      • checkinConfig

        java.lang.String checkinConfig​(java.lang.String sessionId,
                                       java.lang.String path,
                                       PluginConfigDataHandler config,
                                       java.lang.Class<?>... customClazz)
                                throws ConfigManagerCheckinException
        Check-in a single configuration
        Parameters:
        sessionId -
        config -
        customClazz - class representing an XML root element defined via JAXB
        Returns:
        the path of the configuration checked in
        Throws:
        ConfigManagerCheckinException
      • checkinConfig

        java.lang.String checkinConfig​(java.lang.String sessionId,
                                       java.lang.String path,
                                       PluginConfigDataHandler config,
                                       java.lang.String notificationMode,
                                       java.lang.Class<?>... customClazz)
                                throws ConfigManagerCheckinException
        Check-in a single configuration with notification mode
        Parameters:
        sessionId -
        config -
        notificationMode - CREATE, UPDATE or DELETE
        customClazz - class representing an XML root element defined via JAXB
        Returns:
        the path of the configuration checked in
        Throws:
        ConfigManagerCheckinException
      • getConfigs

        PluginConfigCollection getConfigs​(java.lang.String sessionId,
                                          java.lang.String folder,
                                          java.lang.Class<?>... customClazz)
                                   throws ConfigManagerException
        Get a collection of config files from 'folder'.
        Parameters:
        sessionId - PubServer session ID
        folder - repository folder (e.g. /pubserver/com.priint.plugin.demo/myfolder/)
        customClazz - class representing an XML root element defined via JAXB
        Returns:
        Collection of config files Key: config file path in repository
        Throws:
        ConfigManagerException
      • getSubFolders

        java.util.List<java.lang.String> getSubFolders​(java.lang.String sessionId,
                                                       java.lang.String folderPath)
                                                throws ConfigManagerException
        Get List of sub folders
        Parameters:
        sessionId - PubServer session ID
        folderPath - repository folder (e.g. /pubserver/com.priint.plugin.demo/myfolder/)
        Returns:
        List of sub-folders (path)
        Throws:
        ConfigManagerException
      • exists

        boolean exists​(java.lang.String sessionId,
                       java.lang.String path)
                throws ConfigManagerException
        Check whether a file or folder exists at the given path
        Parameters:
        sessionId - PubServer session ID
        path -
        Returns:
        true if the configuration exists
        Throws:
        ConfigManagerException
      • isAlive

        boolean isAlive​(java.lang.String sessionId,
                        java.lang.String path)
                 throws ConfigManagerException
        Check whether a file exists AND is alive, i.e.: the file is not deleted.
        Parameters:
        sessionId - PubServer session ID
        path -
        Returns:
        true, if file exists and has not been tagged as deleted.
        Throws:
        ConfigManagerException
      • getPlugins

        java.util.List<PluginInfo> getPlugins​(java.lang.String sessionId,
                                              boolean active)
                                       throws ConfigManagerException
        Gets a list of all plug-in libraries with their plug-ins and configurations.
        Parameters:
        sessionId - PubServer session ID
        active - if true only active plug-in libraries are return, if false all plug-in libraries are returned
        Returns:
        list of configurations (empty list if nothing was found)
        Throws:
        ConfigManagerException
      • getNextId

        int getNextId​(java.lang.String sessionId,
                      boolean useServerId)
        Read the next ID from the data source.

        Note:
        Purpose of this method is to retrieve unique IDs for a single server instance or a server instance within a deployment environment (e.g. Developing Server, Integration Server, Test Server, Productive System).
        This will only work, if each of this server has a unique instance ID.
        Please take care to configure these values properly. See Constants.PUBSERVER_NUM_INSTANCES and Constants.PUBSERVER_INSTANCE_ID for more information.

        Parameters:
        sessionId - PubServer session ID
        useServerId -
        Returns:
        integer containing a sequential incrementing server dependent ID
      • getConnectors

        java.util.List<java.lang.String> getConnectors​(java.lang.String sessionId)
        Get a list of connector plug-ins (i.e. string IDs of the plug-ins)
        Parameters:
        sessionId - PubServer session ID
        Returns:
        a list of connector plug-ins
      • getClients

        java.util.List<Client> getClients​(java.lang.String sessionId)
        Get a list of clients (tenants)
        Parameters:
        sessionId - PubServer session ID
        Returns:
        a list of clients (tenants)
      • upload

        java.lang.String upload​(java.lang.String sessionId,
                                java.lang.String filePath,
                                java.lang.String path,
                                ConfigFileProperties properties)
                         throws ConfigManagerException,
                                java.io.FileNotFoundException
        Upload a local config file to the repository
        Parameters:
        sessionId - PubServer session ID
        filePath - local system path of the config file
        path - target folder in repository
        properties - properties of the config file
        Returns:
        target path
        Throws:
        ConfigManagerException
        java.io.FileNotFoundException
      • deleteFileOrFolder

        void deleteFileOrFolder​(java.lang.String sessionId,
                                java.lang.String path,
                                boolean updateDependencies)
                         throws ConfigManagerException
        Remove files and/or folders physically from the repository
        Parameters:
        sessionId - SessionId
        path - target file or folder in repository
        updateDependencies -
        Throws:
        ConfigManagerException
      • deleteFileOrFolder

        void deleteFileOrFolder​(java.lang.String sessionId,
                                java.lang.String path)
                         throws ConfigManagerException
        Remove files and/or folders physically from the repository
        Parameters:
        sessionId - SessionId
        path - target file or folder in repository
        Throws:
        ConfigManagerException
      • checkoutConfig

        PluginConfigDataHandler checkoutConfig​(java.lang.String sessionId,
                                               java.lang.String path,
                                               java.lang.Class<?>... customClazz)
                                        throws ConfigManagerCheckoutException
        Checkout a single file String
        Parameters:
        sessionId - SessionID
        path - Path to the config file in repository
        customClazz - class representing an XML root element defined via JAXB
        Returns:
        config file as String
        Throws:
        ConfigManagerCheckoutException
      • checkoutListOfConfigFiles

        PluginConfigCollection checkoutListOfConfigFiles​(java.lang.String sessionId,
                                                         java.util.List<java.lang.String> files,
                                                         java.lang.Class<?>... customClazz)
                                                  throws ConfigManagerCheckoutException
        Check a list of files from the repository. The files that are checked out are locked for other users
        Parameters:
        sessionId - valid PubServer SessionID
        files - List of config files for checking out (path in repository)
        customClazz - class representing an XML root element defined via JAXB
        Throws:
        ConfigManagerCheckoutException
      • checkinListOfConfigFiles

        void checkinListOfConfigFiles​(java.lang.String sessionId,
                                      PluginConfigCollection configurations,
                                      boolean validateXML)
                               throws ConfigManagerCheckinException
        Check-in multiple files as String array
        Parameters:
        sessionId - SessionID
        configurations - Collection of config files as String array. Key: path to the file in repository
        validateXML - validate XML files against the PluginConfig.xsd schema
        Throws:
        ConfigManagerCheckinException
      • getSubNodes

        java.util.List<ConfigFileProperties> getSubNodes​(java.lang.String sessionId,
                                                         java.lang.String folderPath)
                                                  throws ConfigManagerException
        Get a list of files and sub folders for a path.
        Parameters:
        sessionId - PubServer session ID
        folderPath -
        Returns:
        list of properties of the files
        Throws:
        ConfigManagerException
      • deleteListOfConfigFiles

        java.util.List<java.lang.String> deleteListOfConfigFiles​(java.lang.String sessionId,
                                                                 java.util.List<java.lang.String> deletefiles,
                                                                 boolean updateDependencies)
                                                          throws ConfigManagerDeleteException
        Delete configuration files from the provided list.
        Parameters:
        sessionId -
        deletefiles - Paths of the files to delete.
        updateDependencies - If true dependencies will be automatically updated.
        Returns:
        list of paths of files actually deleted
        Throws:
        ConfigManagerDeleteException
      • deleteListOfConfigFiles

        java.util.List<java.lang.String> deleteListOfConfigFiles​(java.lang.String sessionId,
                                                                 java.util.List<java.lang.String> deletefiles)
                                                          throws ConfigManagerDeleteException
        Delete configuration files from the provided list.
        Parameters:
        sessionId - PubServer session ID
        deletefiles - Paths of the files to delete.
        Returns:
        list of paths of files actually deleted
        Throws:
        ConfigManagerDeleteException
      • createConfiguration

        java.lang.String createConfiguration​(java.lang.String sessionId,
                                             java.lang.String pluginName,
                                             java.lang.String customTypeName,
                                             java.util.Map<java.lang.String,​java.lang.Object> initialValues)
                                      throws ConfigManagerException
        Create and save a new configuration for a plug-in. The resulting configuration XML will be returned.

        The actual config creation will be delegated to the plug-in itself.

        Parameters:
        sessionId - PubServer session ID
        pluginName - Mapped name of the plug-in. Used as first part of the full path to the configuration file.
        customTypeName - Plug-in specific type string.
        initialValues - HashMap of values to be used for the configuration creation. Interpretation of the entries is plugin specific.
        Returns:
        Created XML as string.
        Throws:
        ConfigManagerException
      • getConfigProperties

        ConfigFileProperties getConfigProperties​(java.lang.String sessionId,
                                                 java.lang.String path)
                                          throws ConfigManagerException
        Get the configuration properties of a file at a specific location.
        Parameters:
        sessionId - PubServer session ID
        path - location
        Returns:
        configuration properties
        Throws:
        ConfigManagerException
      • upload

        java.lang.String upload​(java.lang.String sessionId,
                                java.io.InputStream content,
                                java.lang.String path,
                                ConfigFileProperties properties)
                         throws ConfigManagerException
        Upload content stream to a config file at a specific location.
        Parameters:
        sessionId -
        content - stream
        path - location
        properties - additional properties of the configuration file
        Returns:
        path
        Throws:
        ConfigManagerException
      • getAllDependencies

        java.util.List<PluginConfig.Dependencies.PluginDependency> getAllDependencies​(java.lang.String sessionId,
                                                                                      java.lang.String path,
                                                                                      java.util.List<PluginConfig.Dependencies.PluginDependency> dependencies,
                                                                                      boolean recursive)
        Read all dependencies of a configuration file.
        Parameters:
        sessionId - PubServer session ID
        path - of the file
        dependencies - list of known dependencies
        recursive - if true, system performs a deep traversal of dependencies
        Returns:
        List of dependencies found
      • setMinimumInitialServerId

        void setMinimumInitialServerId​(java.lang.String sessionId,
                                       boolean useServerId,
                                       int minInitialValue)
        Set the sequence initial value on this machine to minimum minInitialValue.

        Warning!
        Use this function for sanity checks only. In normal operation there should be no need to manually change the sequence value. If anything, doing so is a dangerous operation and can cause ID conflicts later.
        Calling this method can be necessary after importing repository dumps into a newly installed system (with newly initialized ID sequences). In that case you would use the following code:

         // maximum ID calculated from the last import - in real life, this piece
         // of code will probably look more complex: 
         int maxId = 132456;
         
         ConfigManagerRemote configManager; // lookup etc.
         
         int currentSequenceId = configManager.getCurrentId(false);
         
         if (currentSequenceId < maxId) {
           // this is OK. The next time we call getNextID, the value
           // will be incremented before return:
           configManager.setMinimumInitialServerId(false, maxId);
         }
         
        Parameters:
        sessionId - PubServer session ID
        useServerId - if true, use instance name for the sequence name
        minInitialValue -
      • getCurrentId

        int getCurrentId​(java.lang.String sessionId,
                         boolean useServerId)
        Get the current value of this ID sequence. This is the value that was returned on the last call of getNextId(String, boolean) or the initial value of this sequence, if it has not been initialized yet.
        If you want to retrieve a unique ID for this server instance, use getNextId(String, boolean) instead.
        Parameters:
        sessionId - PubServer session ID
        useServerId - if true, use instance name for the sequence name
        Returns:
        the current value of sequence
      • emptyConfigTrash

        void emptyConfigTrash​(java.lang.String sessionId)
        Clears the trash bin of the repository. Files cannot be undeleted after this operation.