Public Member Functions | |
__construct ($file_path, $mime_type, $perspective=self::DEFAULT_SOURCE_PERSPECTIVE) | |
createNewVersion () | |
createNewPerspective ($perspective, $uri) | |
changeFilePath ($newPath) | |
getIdentifier () | |
getFilePath () | |
getFolder () | |
getMimeType () | |
getVersion () | |
getPerspective () | |
getUniqueIdentifier () | |
jsonSerialize () | |
Static Public Member Functions | |
static | parseUniqueIdentifier (string $uid) |
static | getIdentifierAndVersion ($string) |
Public Attributes | |
const | DEFAULT_SOURCE_PERSPECTIVE = 'source' |
A resource models a means to get data. URLs to data/files, API endpoints, paths to files stored locally in the server, are all possible forms of resources.
This class not only models a resource, but it helps model other properties necessary for other systems like the Drupal::metastore::ResourceMapper and Drupal::datastore::Service::ResourceLocalizer to enhance DKAN's capabilities around resources.
These properties are version and perspective.
For more details refer to the methods governing these behaviors:
Resource::createNewPerspective()
Definition at line 28 of file Resource.php.
Drupal\common\Resource::__construct | ( | $file_path, | |
$mime_type, | |||
$perspective = self::DEFAULT_SOURCE_PERSPECTIVE |
|||
) |
Constructor.
Definition at line 42 of file Resource.php.
Drupal\common\Resource::changeFilePath | ( | $newPath | ) |
Change file path.
Definition at line 92 of file Resource.php.
Drupal\common\Resource::createNewPerspective | ( | $perspective, | |
$uri | |||
) |
Create a new perspective.
Perspectives are useful to represent clusters of connected resources.
For example, a CSV file might also have an API endpoint that makes the data available. In this circumstance we could create the API endpoint resource as a new perspective of the file resource to make the system aware of the new resource, the API endpoint, and maintain the relatioship between the 2 resources.
Definition at line 83 of file Resource.php.
Drupal\common\Resource::createNewVersion | ( | ) |
Create a new version.
Versions are, simply, a unique "string" used to represent changes in a resource. For example, when new data is added to a file/resource a new version of the resource should be created.
This class does not have any functionality that keeps track of changes in resources, it simply models the behavior to allow other parts of the system to create new versions of resources when they deem it necessary.
Definition at line 63 of file Resource.php.
Drupal\common\Resource::getFilePath | ( | ) |
Getter.
Definition at line 118 of file Resource.php.
Drupal\common\Resource::getFolder | ( | ) |
Getter.
Definition at line 125 of file Resource.php.
Drupal\common\Resource::getIdentifier | ( | ) |
Getter.
Definition at line 111 of file Resource.php.
|
static |
Get Identifier and Version.
string | $string | The string given could be a unique identifier, or a partial identifier (no perspective), or a distribution uuid. |
Definition at line 197 of file Resource.php.
Drupal\common\Resource::getMimeType | ( | ) |
Getter.
Definition at line 132 of file Resource.php.
Drupal\common\Resource::getPerspective | ( | ) |
Getter.
Definition at line 146 of file Resource.php.
Drupal\common\Resource::getUniqueIdentifier | ( | ) |
Getter.
Definition at line 153 of file Resource.php.
Drupal\common\Resource::getVersion | ( | ) |
Getter.
Definition at line 139 of file Resource.php.
Drupal\common\Resource::jsonSerialize | ( | ) |
Inherited.
Definition at line 162 of file Resource.php.
|
static |
Parse unique identifier.
string | $uid | A string with the form <identifier>__<version>__perspective. |
Definition at line 178 of file Resource.php.
const Drupal\common\Resource::DEFAULT_SOURCE_PERSPECTIVE = 'source' |
Definition at line 31 of file Resource.php.