| org.outerj.daisy.repository.Repository
All known Subclasses: org.outerj.daisy.repository.commonimpl.RepositoryImpl,
Repository | public interface Repository (Code) | | Start point for a user to access the repository.
An instance of this object is obtained from the
RepositoryManager and
is contextualized for a certain user. Thus instead of having to supply
credentials to each method, you authenticate once via the RepositoryManager
and can then do all further operations on this Repository object.
A Repository object should not be assumed to be thread safe.
|
Method Summary | |
void | addListener(RepositoryListener listener) Add an event listener.
See also the comments in
RepositoryListener .
Not all events are per-se also implemented in the repository client,
and for so far as they are, they only provide events for operations done
through that client, and not other ones happening on the server or through
other clients.
This listener functionality is mostly meant for internal use, usually
to clear caches. | Document | createDocument(String name, long documentTypeId, long branchId, long languageId) Creates a new document. | Document | createDocument(String name, String documentTypeName, String branchName, String languageName) Same as
Repository.createDocument(String,long,long,long) but takes names instead
of ids. | Document | createDocument(String name, long documentTypeId) Same as
Repository.createDocument(String,long,long,long) but assumes branch id 1
and language id 1. | Document | createDocument(String name, String documentTypeName) Same as
Repository.createDocument(String,long) but takes a document type
name instead of an id. | Document | createVariant(String documentId, long startBranchId, long startLanguageId, long startVersionId, long newBranchId, long newLanguageId, boolean copyContent) Creates a new variant on a document. | Document | createVariant(String documentId, String startBranchName, String startLanguageName, long startVersionId, String newBranchName, String newLanguageName, boolean copyContent) | void | deleteDocument(String documentId) Deletes a document permanently (unrecoverable) from the repository
(including all its variants). | void | deleteVariant(String documentId, long branchId, long languageId) | void | deleteVariant(VariantKey variantKey) Deletes a document variant permanently (unrecoverable) from the repository. | AccessManager | getAccessManager() | long[] | getActiveRoleIds() The roles of the user that are currently active. | String[] | getActiveRolesDisplayNames() Returns the names of the active roles. | long[] | getAvailableRoles() The id's of the available roles of the user. | AvailableVariants | getAvailableVariants(String documentId) Gets the available variants of a document. | String | getClientVersion() Gets the version of the Daisy client API. | CollectionManager | getCollectionManager() Returns the Collection Manager for this Repository. | CommentManager | getCommentManager() | Document | getDocument(String documentId, long branchId, long languageId, boolean updateable) Gets a document from the repository.
Parameters: updateable - if false, you won't be able to make modificationsto the document (and thus to save it). | Document | getDocument(String documentId, String branchName, String languageName, boolean updateable) Gets a document from the repository. | Document | getDocument(VariantKey key, boolean updateable) Gets a document from the repository. | Document | getDocument(String documentId, boolean updateable) | Document | getDocument(long documentId, boolean updateable) | Object | getExtension(String name) Retrieves an extension of the standard repository functionality. | String | getNamespace() Returns the namespace for the current repository. | NamespaceManager | getNamespaceManager() | InputStream | getPartData(String documentId, long branchId, long languageId, long versionId, long partTypeId) Retrieves the specified blob without the need to go through the Document object. | InputStream | getPartData(String documentId, long versionId, long partTypeId) Retrieves part data for the branch "main", language "default". | QueryManager | getQueryManager() | RepositorySchema | getRepositorySchema() | String | getServerVersion() Returns the version number of the Daisy repository server. | String | getUserDisplayName() The name of the user with who this Repository instance is associated, the
same as returned from
org.outerj.daisy.repository.user.User.getDisplayName . | long | getUserId() Id of the user with who this Repository instance is associated. | UserInfoDocument | getUserInfoAsXml() Returns an XML document containing some information about the user
with which this Repository instance is associated. | String | getUserLogin() The login of the user with who this Repository instance is associated. | UserManager | getUserManager() | VariantManager | getVariantManager() | boolean | hasExtension(String name) | boolean | isInRole(long roleId) | boolean | isInRole(String roleName) | String | normalizeDocumentId(String documentId) Makes sure the document ID is of the form "docSeqId-namespace", if the
namespace is missing the default repository namespace is added. | void | removeListener(RepositoryListener listener) Removes an event listener. | void | setActiveRoleIds(long[] roleIds) Sets the active roles of the user. | void | switchRole(long roleId) Changes the user's role for this Repository instance. |
addListener | void addListener(RepositoryListener listener)(Code) | | Add an event listener.
See also the comments in
RepositoryListener .
Not all events are per-se also implemented in the repository client,
and for so far as they are, they only provide events for operations done
through that client, and not other ones happening on the server or through
other clients.
This listener functionality is mostly meant for internal use, usually
to clear caches. For most usecases you should use the JMS-based (assynchronous)
event notification system.
A listener stays in effect until it is removed using
Repository.removeListener(org.outerj.daisy.repository.RepositoryListener) .
|
createDocument | Document createDocument(String name, long documentTypeId, long branchId, long languageId)(Code) | | Creates a new document. You need to supply:
- a name for the document (which is not required to be unique)
- a document type id. This is the id of one of the document types defined in the
RepositorySchema .
- a branch id
- a language id
The document will not be stored physically
in the repository until
Document.save is called. Thus
calling this method has no permanent side effects.
|
createVariant | Document createVariant(String documentId, long startBranchId, long startLanguageId, long startVersionId, long newBranchId, long newLanguageId, boolean copyContent) throws RepositoryException(Code) | | Creates a new variant on a document. If the copyContent argument is true,
the new variant will be immediately persisted and its first version will
be initialiased with the data from the start variant. The start variant
and version will also be stored in the variant (retrievable via
Document.getVariantCreatedFromBranchId etc. methods).
If copyContent is false, a document object for the new variant will
be returned, with no data copied from the start variant (except for
the document name), and the new variant will not yet be persisted
(i.o.w. you need to call save on the returned Document object to do
this). Thus using copyContent = false allows to create a variant
from scratch, while copyContent = true branches of from an existing
variant.
Parameters: startVersionId - -1 for last version, -2 for live version |
deleteDocument | void deleteDocument(String documentId) throws RepositoryException(Code) | | Deletes a document permanently (unrecoverable) from the repository
(including all its variants).
|
getActiveRolesDisplayNames | String[] getActiveRolesDisplayNames()(Code) | | Returns the names of the active roles.
|
getAvailableRoles | long[] getAvailableRoles()(Code) | | The id's of the available roles of the user.
|
getAvailableVariants | AvailableVariants getAvailableVariants(String documentId) throws RepositoryException(Code) | | Gets the available variants of a document. This returns all variants, also the
variants the user may not have access too, and retired variants. Everyone can retrieve the list
of available variants of each document, there is no security constraint to
this. This information is not really sensitive, and access control works on
document variants and not on documents, so it would be a bit difficult to do this.
|
getClientVersion | String getClientVersion()(Code) | | Gets the version of the Daisy client API. Inside the repository server,
this will be the same as
Repository.getServerVersion() .
At the time of this writing, in the remote API implementation this
will usually also be the same, as the client and server API implementations
evolve together and get the same version numbers assigned.
|
getCollectionManager | CollectionManager getCollectionManager()(Code) | | Returns the Collection Manager for this Repository.
|
getDocument | Document getDocument(String documentId, String branchName, String languageName, boolean updateable) throws RepositoryException(Code) | | Gets a document from the repository.
In case the branch or language does not exist, this will throw a Branch/LanugageNotFoundexception.
Parameters: branchName - a branch name, or a branch id as string Parameters: languageName - a language name, or a language id as string |
getDocument | Document getDocument(VariantKey key, boolean updateable) throws RepositoryException(Code) | | Gets a document from the repository.
In case the branch or language ID specified in the VariantKey do not exist, this
will not throw a Branch/LanguageNotFoundException, rather a Document(Variant)NotFoundException.
|
getExtension | Object getExtension(String name)(Code) | | Retrieves an extension of the standard repository functionality.
Extensions are additional available repository services.
What these services are is not defined by this API.
The reason for making this extension functionality part of the
Repository API, instead of using completely separate and standalone
components, is that in this way the extensions can operate in the
authenticated context of the current user (ie Repository instance).
So, for as far as the extension performs any operations that depend
on the current user and its role, the extension will operate using the
same credentials as associated with the Repository object from which
the extension instance has been retrieved.
|
getNamespace | String getNamespace()(Code) | | Returns the namespace for the current repository. All entities
(documents) created in this repository are by default created in
this namespace.
since: Daisy 2.0 |
getPartData | InputStream getPartData(String documentId, long branchId, long languageId, long versionId, long partTypeId) throws RepositoryException(Code) | | Retrieves the specified blob without the need to go through the Document object.
Of course, all access control checks still apply.
throws: DocumentReadDeniedException - if read access to the document is denied. |
getServerVersion | String getServerVersion()(Code) | | Returns the version number of the Daisy repository server.
Usually follows the format "major.minor.patch", in which the ".patch"
is optional, and the version string can be followed with
a suffix like "-dev".
|
getUserId | long getUserId()(Code) | | Id of the user with who this Repository instance is associated.
|
getUserInfoAsXml | UserInfoDocument getUserInfoAsXml()(Code) | | Returns an XML document containing some information about the user
with which this Repository instance is associated.
|
getUserLogin | String getUserLogin()(Code) | | The login of the user with who this Repository instance is associated.
|
getUserManager | UserManager getUserManager()(Code) | | Returns the User Manager for this Repository
|
isInRole | boolean isInRole(long roleId)(Code) | | |
normalizeDocumentId | String normalizeDocumentId(String documentId)(Code) | | Makes sure the document ID is of the form "docSeqId-namespace", if the
namespace is missing the default repository namespace is added. It is not
checked whether the namespace in the document ID actually exists.
Whitespace around the input string is not trimmed, the presence of
such whitespace will cause the documentID to be considered invalid.
This is an utility method.
throws: IllegalArgumentException - if a null documentId is supplied throws: InvalidDocumentIdException - if the document ID is not validly structured. |
setActiveRoleIds | void setActiveRoleIds(long[] roleIds)(Code) | | Sets the active roles of the user.
Parameters: roleIds - a subset of, or equal to, the roles returned by Repository.getAvailableRoles(). |
|
|