OSID Logo
OSID Specifications
resource package
Version 3.0.0
Release Candidate Preview
Interfaceosid.resource.ResourceAdminSession
Implementsosid.OsidSession
Description

This session creates, updates, and deletes Resources. 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 Resource, a ResourceForm is requested using getResourceFormForCreate() specifying desired record Types or none if no record Types are needed. The returned ResourceForm 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 ResourceForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each ResourceForm corresponds to an attempted transaction.

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

The delete operations delete Resources. To unmap a Resource from the current Bin, the ResourceBinAssignmentSession should be used. These delete operations attempt to remove the Resource itself thus removing it from all known Bin catalogs.

This session includes an Id aliasing mechanism to assign an external Id to an internally assigned Id.

MethodgetBinId
Description

Gets the Bin Id associated with this session.

Returnosid.id.Idthe Bin Id associated with this session
CompliancemandatoryThis method must be implemented.
MethodgetBin
Description

Gets the Bin associated with this session.

Returnosid.resource.Binthe Bin associated with this session
ErrorsOPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodcanCreateResources
Description

Tests if this user can create Resources. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a Resource will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.

Returnboolean false if Resource creation is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodcanCreateResourceWithRecordTypes
Description

Tests if this user can create a single Resource using the desired record types. While ResourceManager.getResourceRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Resource. Providing an empty array tests if a Resource can be created with no records.

Parametersosid.type.Type[]resourceRecordTypesarray of resource record types
Returnboolean true if Resource creation using the specified Types is supported, false otherwise
ErrorsNULL_ARGUMENT resourceRecordTypes is null
CompliancemandatoryThis method must be implemented.
MethodgetResourceFormForCreate
Description

Gets the resource form for creating new resources. A new form should be requested for each create transaction.

Parametersosid.type.Type[]resourceRecordTypesarray of resource record types
Returnosid.resource.ResourceFormthe resource form
ErrorsNULL_ARGUMENT resourceRecordTypes is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTEDunable to get form with requested record types
CompliancemandatoryThis method must be implemented.
MethodcreateResource
Description

Creates a new Resource.

Parametersosid.resource.ResourceFormresourceFormthe form for this Resource
Returnosid.resource.Resourcethe new Resource
ErrorsILLEGAL_STATE resourceForm already used in a create transaction
INVALID_ARGUMENTone or more of the form elements is invalid
NULL_ARGUMENT resourceForm is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED resourceForm did not originate from getResourceFormForCreate()
CompliancemandatoryThis method must be implemented.
MethodcanUpdateResources
Description

Tests if this user can update Resources. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a Resource will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.

Returnboolean false if Resource modification is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodgetResourceFormForUpdate
Description

Gets the resource form for updating an existing resource. A new resource form should be requested for each update transaction.

Parametersosid.id.IdresourceIdthe Id of the Resource
Returnosid.resource.ResourceFormthe resource form
ErrorsNOT_FOUND resourceId is not found
NULL_ARGUMENT resourceId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodupdateResource
Description

Updates an existing resource.

Parametersosid.resource.ResourceFormresourceFormthe form containing the elements to be updated
ErrorsILLEGAL_STATE resourceForm already used in an update transaction
INVALID_ARGUMENTthe form contains an invalid value
NULL_ARGUMENT resourceForm is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED resourceForm did not originate from getResourceFormForUpdate()
CompliancemandatoryThis method must be implemented.
MethodcanDeleteResources
Description

Tests if this user can delete Resources. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a Resource will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.

Returnboolean false if Resource deletion is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethoddeleteResource
Description

Deletes a Resource.

Parametersosid.id.IdresourceIdthe Id of the Resource to remove
ErrorsNOT_FOUND resourceId not found
NULL_ARGUMENT resourceId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodcanManageResourceAliases
Description

Tests if this user can manage Id aliases for Resources. 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.

Returnboolean false if Resource aliasing is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodaliasResource
Description

Adds an Id to a Resource for the purpose of creating compatibility. The primary Id of the Resource is determined by the provider. The new Id performs as an alias to the primary Id. If the alias is a pointer to another resource it is reassigned to the given resource Id.

Parametersosid.id.IdresourceIdthe Id of a Resource
osid.id.IdaliasIdthe alias Id
ErrorsALREADY_EXISTS aliasId is already assigned
NOT_FOUND resourceId not found
NULL_ARGUMENT aliasId or resourceId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.