Interface RepositoryAdminSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
All Known Subinterfaces:
RepositoryBatchAdminSession

public interface RepositoryAdminSession extends OsidSession

This session creates, updates, and deletes Repositories . The data for create and update is provided by the consumer via the form object. OsidForms are requested for each create or update and may not be reused.

Create and update operations differ in their usage. To create a Repository , a RepositoryForm is requested using getRepositoryFormForCreate() specifying the desired record Types or none if no record Types are needed. The returned RepositoryForm will indicate that it is to be used with a create operation and can be used to examine metdata or validate data prior to creation. Once the RepositoryForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each RepositoryForm corresponds to an attempted transaction.

For updates, RepositoryForms are requested to the Repository Id that is to be updated using getRepositoryFormForUpdate() . Similarly, the RepositoryForm has metadata about the data that can be updated and it can perform validation before submitting the update. The RepositoryForm can only be used once for a successful update and cannot be reused.

The delete operations delete Repositories . This session includes an Id aliasing mechanism to assign an external Id to an internally assigned Id.

  • Method Details

    • canCreateRepositories

      boolean canCreateRepositories()
      Tests if this user can create Repositories . A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a Repository will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.
      Returns:
      false if Repository creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateRepositoryWithRecordTypes

      boolean canCreateRepositoryWithRecordTypes(Type[] repositoryRecordTypes)
      Tests if this user can create a single Repository using the desired record types. While RepositoryManager.getRepositoryRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Repository . Providing an empty array tests if a Repository can be created with no records.
      Parameters:
      repositoryRecordTypes - array of repository record types
      Returns:
      true if Repository creation using the specified Types is supported, false otherwise
      Throws:
      NullArgumentException - repositoryRecordTypes is null
      Compliance:
      mandatory - This method must be implemented.
    • getRepositoryFormForCreate

      RepositoryForm getRepositoryFormForCreate(Type[] repositoryRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the repository form for creating new repositories. A new form should be requested for each create transaction.
      Parameters:
      repositoryRecordTypes - array of repository record types
      Returns:
      the repository form
      Throws:
      NullArgumentException - repositoryRecordTypes is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - unable to get form for requested record types
      Compliance:
      mandatory - This method must be implemented.
    • createRepository

      Creates a new Repository .
      Parameters:
      repositoryForm - the form for this Repository
      Returns:
      the new Repository
      Throws:
      IllegalStateException - repositoryForm already used in a create transaction
      InvalidArgumentException - one or more of the form elements is invalid
      NullArgumentException - repositoryForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - repositoryForm did not originate from getRepositoryFormForCreate()
      Compliance:
      mandatory - This method must be implemented.
    • canUpdateRepositories

      boolean canUpdateRepositories()
      Tests if this user can update Repositories . A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a Repository will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.
      Returns:
      false if Repository modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getRepositoryFormForUpdate

      RepositoryForm getRepositoryFormForUpdate(Id repositoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Gets the repository form for updating an existing repository. A new repository form should be requested for each update transaction.
      Parameters:
      repositoryId - the Id of the Repository
      Returns:
      the repository form
      Throws:
      NotFoundException - repositoryId is not found
      NullArgumentException - repositoryId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • updateRepository

      void updateRepository(RepositoryForm repositoryForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing repository.
      Parameters:
      repositoryForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - repositoryForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - repositoryForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - repositoryForm did not originate from getRepositoryFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteRepositories

      boolean canDeleteRepositories()
      Tests if this user can delete Repositories . A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a Repository will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.
      Returns:
      false if Repository deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteRepository

      void deleteRepository(Id repositoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Deletes a Repository .
      Parameters:
      repositoryId - the Id of the Repository to remove
      Throws:
      NotFoundException - repositoryId not found
      NullArgumentException - repositoryId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageRepositoryAliases

      boolean canManageRepositoryAliases()
      Tests if this user can manage Id aliases for repositories. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.
      Returns:
      false if Repository aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasRepository

      void aliasRepository(Id repositoryId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
      Adds an Id to a Repository for the purpose of creating compatibility. The primary Id of the Repository is determined by the provider. The new Id is an alias to the primary Id . If the alias is a pointer to another repository, it is reassigned to the given repository Id .
      Parameters:
      repositoryId - the Id of a Repository
      aliasId - the alias Id
      Throws:
      AlreadyExistsException - aliasId is in use as a primary Id
      NotFoundException - repositoryId not found
      NullArgumentException - repositoryId or aliasId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.