public final class Repositories extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
addRepository(Repository repository)
Adds the specified repository.
|
static void |
check(String repositoryName,
JSONObject jsonObject,
String... ignoredKeys)
Determines whether the specified json object can not be persisted (add or update) into an repository which specified
by the given repository name.
|
static boolean |
getReposirotiesWritable()
Whether all repositories is writable.
|
static JSONObject |
getRepositoriesDescription()
Gets repositories description.
|
static Repository |
getRepository(String repositoryName)
Gets a repository with the specified repository name.
|
static JSONObject |
getRepositoryDef(String repositoryName)
Gets the repository definition of an repository specified by the given repository name.
|
static JSONArray |
getRepositoryKeysDef(String repositoryName)
Gets the keys definition of an repository specified by the given repository name.
|
static JSONArray |
getRepositoryNames()
Gets repository names.
|
static void |
setRepositoriesWritable(boolean writable)
Sets all repositories whether is writable with the specified flag.
|
public static boolean getReposirotiesWritable()
true if they are writable, returns false otherwisepublic static void setRepositoriesWritable(boolean writable)
writable - the specified flat, true for writable, false otherwisepublic static JSONArray getRepositoryNames()
[
"repository1", "repository2", ....
]
public static JSONObject getRepositoriesDescription()
null if not found or
parse the description failedpublic static void check(String repositoryName, JSONObject jsonObject, String... ignoredKeys) throws RepositoryException
A valid json object to persist must match keys definitions (including type and length if had) in the repository description (repository.json) with the json object names itself.
The specified keys to ignore will be bypassed, regardless of matching keys definitions.
repositoryName - the given repository name (maybe with table name prefix)jsonObject - the specified json objectignoredKeys - the specified keys to ignoreRepositoryException - if the specified json object can not be persistedRepository.add(org.json.JSONObject),
Repository#update(java.lang.String, org.json.JSONObject)public static JSONObject getRepositoryDef(String repositoryName)
repositoryName - the given repository name (maybe with table name prefix)null if not foundpublic static JSONArray getRepositoryKeysDef(String repositoryName)
repositoryName - the given repository name (maybe with table name prefix)null if not foundpublic static Repository getRepository(String repositoryName)
repositoryName - the specified repository namenull if not foundpublic static void addRepository(Repository repository)
repository - the specified repositoryCopyright © 2009–2019 B3log. All rights reserved.