Interface ConfigManagerRemote
Loads and saves configuration files and their revisions using the Document Manager.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptioncheckinConfig(String sessionId, String path, PluginConfigDataHandler config, Class<?>... customClazz) Check-in a single configurationcheckinConfig(String sessionId, String path, PluginConfigDataHandler config, String notificationMode, Class<?>... customClazz) Check-in a single configuration with notification modecheckinConfigFile(String sessionId, DocumentContent document) Check-in a documentvoidcheckinListOfConfigFiles(String sessionId, PluginConfigCollection configurations, boolean validateXML) Check-in multiple files as String arraycheckoutConfig(String sessionId, String path, Class<?>... customClazz) Checkout a single file StringcheckoutListOfConfigFiles(String sessionId, List<String> files, Class<?>... customClazz) Check a list of files from the repository.createConfiguration(String sessionId, String pluginName, String customTypeName, Map<String, Object> initialValues) Create and save a new configuration for a plug-in.voiddeleteFileOrFolder(String sessionId, String path) Remove files and/or folders physically from the repositoryvoiddeleteFileOrFolder(String sessionId, String path, boolean updateDependencies) Remove files and/or folders physically from the repositorydeleteListOfConfigFiles(String sessionId, List<String> deletefiles) Delete configuration files from the provided list.deleteListOfConfigFiles(String sessionId, List<String> deletefiles, boolean updateDependencies) Delete configuration files from the provided list.voidemptyConfigTrash(String sessionId) Clears the trash bin of the repository.voidemptyTrash(String sessionId) Delete are configs from trash.booleanCheck whether a file or folder exists at the given pathgetAllDependencies(String sessionId, String path, List<PluginConfig.Dependencies.PluginDependency> dependencies, boolean recursive) Read all dependencies of a configuration file.getClients(String sessionId) Get a list of clients (tenants)Get the content of a configuration file from the Document Manager (HEAD Revision)getConfigProperties(String sessionId, String path) Get the configuration properties of a file at a specific location.getConfigRevision(String sessionId, String path, String revision, Class<?>... customClazz) Get the content of a specific revision of a configuration file from the Document ManagergetConfigRevisionsProperties(String sessionId, String path) Get properties of all revisions of this config filegetConfigs(String sessionId, String folder, Class<?>... customClazz) Get a collection of config files from 'folder'.getConnectors(String sessionId) Get a list of connector plug-ins (i.e.intgetCurrentId(String sessionId, boolean useServerId) Get the current value of this ID sequence.Get a list of files for a path (excluding sub-folders).intRead the next ID from the data source.getPlugins(String sessionId, boolean active) Gets a list of all plug-in libraries with their plug-ins and configurations.getSubFolders(String sessionId, String folderPath) Get List of sub foldersgetSubNodes(String sessionId, String folderPath) Get a list of files and sub folders for a path.booleanCheck whether a file exists AND is alive, i.e.: the file is not deleted.voidLock a single filevoidsetMinimumInitialServerId(String sessionId, boolean useServerId, int minInitialValue) Set the sequence initial value on this machine to minimum minInitialValue.voidunlockFile(String sessionId, String path) Unlock a single fileupload(String sessionId, InputStream content, String path, ConfigFileProperties properties) Upload content stream to a config file at a specific location.upload(String sessionId, String filePath, String path, ConfigFileProperties properties) Upload a local config file to the repository
-
Field Details
-
FILE_NOT_FOUND
static final int FILE_NOT_FOUND- See Also:
-
INVALID_PUBSERVER_SESSIONID
static final int INVALID_PUBSERVER_SESSIONID- See Also:
-
TRANSACTION_ERROR
static final int TRANSACTION_ERROR- See Also:
-
FILE_NOT_EXIST
static final int FILE_NOT_EXIST- See Also:
-
FILE_LOCKED
static final int FILE_LOCKED- See Also:
-
VALIDATION_FAILED
static final int VALIDATION_FAILED- See Also:
-
INVALID_JCR_SESSION
static final int INVALID_JCR_SESSION- See Also:
-
REPOSITORY_ACCESS_FAILED
static final int REPOSITORY_ACCESS_FAILED- See Also:
-
JAXB_ERROR
static final int JAXB_ERROR- See Also:
-
CONVERT_INPUT_STREAM_FAILED
static final int CONVERT_INPUT_STREAM_FAILED- See Also:
-
PLUGIN_VALIDATION_EXCEPTION
static final int PLUGIN_VALIDATION_EXCEPTION- See Also:
-
CONFIGS_MERGE_EXCEPTION
static final int CONFIGS_MERGE_EXCEPTION- See Also:
-
-
Method Details
-
getConfig
PluginConfigDataHandler getConfig(String sessionId, String path, Class<?>... customClazz) throws ConfigManagerException Get the content of a configuration file from the Document Manager (HEAD Revision)- Parameters:
sessionId- PubServer session IDpath- 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(String sessionId, String path, String revision, Class<?>... customClazz) throws ConfigManagerException Get the content of a specific revision of a configuration file from the Document Manager- Parameters:
sessionId- PubServer session IDpath- Repository path (e.g. /pubserver/com.priint.plugin.demo/config_2.1.xml)revision- Revision numbercustomClazz- class representing an XML root element defined via JAXB- Returns:
- String content (XML) of the configuration file.
- Throws:
ConfigManagerCheckinExceptionConfigManagerException
-
checkinConfig
String checkinConfig(String sessionId, String path, PluginConfigDataHandler config, 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
String checkinConfig(String sessionId, String path, PluginConfigDataHandler config, String notificationMode, Class<?>... customClazz) throws ConfigManagerCheckinException Check-in a single configuration with notification mode- Parameters:
sessionId-config-notificationMode- CREATE, UPDATE or DELETEcustomClazz- class representing an XML root element defined via JAXB- Returns:
- the path of the configuration checked in
- Throws:
ConfigManagerCheckinException
-
getConfigRevisionsProperties
List<ConfigFileProperties> getConfigRevisionsProperties(String sessionId, String path) throws ConfigManagerException Get properties of all revisions of this config file- Parameters:
sessionId- PubServer session IDpath-- Returns:
- List of config file properties
- Throws:
ConfigManagerCheckinExceptionConfigManagerException
-
getConfigs
PluginConfigCollection getConfigs(String sessionId, String folder, Class<?>... customClazz) throws ConfigManagerException Get a collection of config files from 'folder'.- Parameters:
sessionId- PubServer session IDfolder- 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
Get List of sub folders- Parameters:
sessionId- PubServer session IDfolderPath- repository folder (e.g. /pubserver/com.priint.plugin.demo/myfolder/)- Returns:
- List of sub-folders (path)
- Throws:
ConfigManagerException
-
exists
Check whether a file or folder exists at the given path- Parameters:
sessionId- PubServer session IDpath-- Returns:
- true if the configuration exists
- Throws:
ConfigManagerException
-
isAlive
Check whether a file exists AND is alive, i.e.: the file is not deleted.- Parameters:
sessionId- PubServer session IDpath-- Returns:
- true, if file exists and has not been tagged as deleted.
- Throws:
ConfigManagerException
-
getPlugins
Gets a list of all plug-in libraries with their plug-ins and configurations.- Parameters:
sessionId- PubServer session IDactive- 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
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. SeeConstants.PUBSERVER_NUM_INSTANCESandConstants.PUBSERVER_INSTANCE_IDfor more information.- Parameters:
sessionId- PubServer session IDuseServerId-- Returns:
- integer containing a sequential incrementing server dependent ID
-
getConnectors
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
Get a list of clients (tenants)- Parameters:
sessionId- PubServer session ID- Returns:
- a list of clients (tenants)
-
upload
String upload(String sessionId, String filePath, String path, ConfigFileProperties properties) throws ConfigManagerException, FileNotFoundException Upload a local config file to the repository- Parameters:
sessionId- PubServer session IDfilePath- local system path of the config filepath- target folder in repositoryproperties- properties of the config file- Returns:
- target path
- Throws:
ConfigManagerExceptionFileNotFoundException
-
deleteFileOrFolder
void deleteFileOrFolder(String sessionId, String path, boolean updateDependencies) throws ConfigManagerException Remove files and/or folders physically from the repository- Parameters:
sessionId- SessionIdpath- target file or folder in repositoryupdateDependencies-- Throws:
ConfigManagerException
-
deleteFileOrFolder
Remove files and/or folders physically from the repository- Parameters:
sessionId- SessionIdpath- target file or folder in repository- Throws:
ConfigManagerException
-
checkoutConfig
PluginConfigDataHandler checkoutConfig(String sessionId, String path, Class<?>... customClazz) throws ConfigManagerCheckoutException Checkout a single file String- Parameters:
sessionId- SessionIDpath- Path to the config file in repositorycustomClazz- class representing an XML root element defined via JAXB- Returns:
- config file as String
- Throws:
ConfigManagerCheckoutException
-
checkoutListOfConfigFiles
PluginConfigCollection checkoutListOfConfigFiles(String sessionId, List<String> files, 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 SessionIDfiles- 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(String sessionId, PluginConfigCollection configurations, boolean validateXML) throws ConfigManagerCheckinException Check-in multiple files as String array- Parameters:
sessionId- SessionIDconfigurations- Collection of config files as String array. Key: path to the file in repositoryvalidateXML- validate XML files against the PluginConfig.xsd schema- Throws:
ConfigManagerCheckinException
-
lockFile
Lock a single file- Parameters:
sessionId-path-- Throws:
ConfigManagerException
-
unlockFile
Unlock a single file- Parameters:
sessionId-path-- Throws:
ConfigManagerException
-
getSubNodes
List<ConfigFileProperties> getSubNodes(String sessionId, String folderPath) throws ConfigManagerException Get a list of files and sub folders for a path.- Parameters:
sessionId- PubServer session IDfolderPath-- Returns:
- list of properties of the files
- Throws:
ConfigManagerException
-
deleteListOfConfigFiles
List<String> deleteListOfConfigFiles(String sessionId, List<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
List<String> deleteListOfConfigFiles(String sessionId, List<String> deletefiles) throws ConfigManagerDeleteException Delete configuration files from the provided list.- Parameters:
sessionId- PubServer session IDdeletefiles- Paths of the files to delete.- Returns:
- list of paths of files actually deleted
- Throws:
ConfigManagerDeleteException
-
emptyTrash
Delete are configs from trash.- Throws:
ConfigManagerDeleteException
-
createConfiguration
String createConfiguration(String sessionId, String pluginName, String customTypeName, Map<String, Object> initialValues) throws ConfigManagerExceptionCreate 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 IDpluginName- 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(String sessionId, String path) throws ConfigManagerException Get the configuration properties of a file at a specific location.- Parameters:
sessionId- PubServer session IDpath- location- Returns:
- configuration properties
- Throws:
ConfigManagerException
-
getFiles
Get a list of files for a path (excluding sub-folders).- Parameters:
sessionId-folder-- Returns:
- list of properties of the files
- Throws:
ConfigManagerException
-
upload
String upload(String sessionId, InputStream content, String path, ConfigFileProperties properties) throws ConfigManagerException Upload content stream to a config file at a specific location.- Parameters:
sessionId-content- streampath- locationproperties- additional properties of the configuration file- Returns:
- path
- Throws:
ConfigManagerException
-
checkinConfigFile
String checkinConfigFile(String sessionId, DocumentContent document) throws ConfigManagerCheckinException Check-in a document- Parameters:
sessionId-document-- Returns:
- path
- Throws:
ConfigManagerCheckinException
-
getAllDependencies
List<PluginConfig.Dependencies.PluginDependency> getAllDependencies(String sessionId, String path, List<PluginConfig.Dependencies.PluginDependency> dependencies, boolean recursive) Read all dependencies of a configuration file.- Parameters:
sessionId- PubServer session IDpath- of the filedependencies- list of known dependenciesrecursive- if true, system performs a deep traversal of dependencies- Returns:
- List of dependencies found
-
setMinimumInitialServerId
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 IDuseServerId- if true, use instance name for the sequence nameminInitialValue-
-
getCurrentId
Get the current value of this ID sequence. This is the value that was returned on the last call ofgetNextId(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, usegetNextId(String, boolean)instead.- Parameters:
sessionId- PubServer session IDuseServerId- if true, use instance name for the sequence name- Returns:
- the current value of sequence
-
emptyConfigTrash
Clears the trash bin of the repository. Files cannot be undeleted after this operation.
-