Open Data Catalog v2.0.0
Drupal\metastore\ResourceMapper Class Reference

Public Member Functions

 __construct (DatabaseTableInterface $store)
 
 register (Resource $resource)
 
 registerNewPerspective (Resource $resource)
 
 registerNewVersion (Resource $resource)
 
 get (string $identifier, $perspective=Resource::DEFAULT_SOURCE_PERSPECTIVE, $version=NULL)
 
 remove (Resource $resource)
 
 filePathExists ($filePath)
 
 getStore ()
 

Static Public Member Functions

static newRevision ()
 

Public Attributes

const EVENT_REGISTRATION = 'dkan_metastore_resource_mapper_registration'
 
const EVENT_RESOURCE_MAPPER_PRE_REMOVE_SOURCE = 'dkan_metastore_pre_remove_source'
 
const DEREFERENCE_NO = 0
 
const DEREFERENCE_YES = 1
 

Protected Member Functions

 validateNewVersion (Resource $resource)
 

Detailed Description

Map resource URLs to local files.

Definition at line 15 of file ResourceMapper.php.

Constructor & Destructor Documentation

◆ __construct()

Drupal\metastore\ResourceMapper::__construct ( DatabaseTableInterface  $store)

Constructor.

Definition at line 41 of file ResourceMapper.php.

Member Function Documentation

◆ filePathExists()

Drupal\metastore\ResourceMapper::filePathExists (   $filePath)

Check if a file path exists.

Parameters
string$filePathThe path to check.
Returns
bool FALSE of the path does not exist.
Exceptions

Definition at line 228 of file ResourceMapper.php.

◆ get()

Drupal\metastore\ResourceMapper::get ( string  $identifier,
  $perspective = Resource::DEFAULT_SOURCE_PERSPECTIVE,
  $version = NULL 
)

Retrieve.

Definition at line 134 of file ResourceMapper.php.

◆ getStore()

Drupal\metastore\ResourceMapper::getStore ( )

Get the storage class.

Returns
\Drupal\common\Storage\DatabaseTableInterface A DB storage service.

Definition at line 252 of file ResourceMapper.php.

◆ newRevision()

static Drupal\metastore\ResourceMapper::newRevision ( )
static

Helper method to retrieve the static value for a resource's display.

Returns
string A resource perspective.

Definition at line 51 of file ResourceMapper.php.

◆ register()

Drupal\metastore\ResourceMapper::register ( Resource  $resource)

Register a new url for mapping.

Todo:
the Resource class currently lives in datastore, we should move it to a more neutral place.

Definition at line 61 of file ResourceMapper.php.

◆ registerNewPerspective()

Drupal\metastore\ResourceMapper::registerNewPerspective ( Resource  $resource)

Register new resource perspective.

Parameters
\Drupal\common\Resource$resourceResource for which to register new perspective.

Definition at line 75 of file ResourceMapper.php.

◆ registerNewVersion()

Drupal\metastore\ResourceMapper::registerNewVersion ( Resource  $resource)

Register new version.

Definition at line 104 of file ResourceMapper.php.

◆ remove()

Drupal\metastore\ResourceMapper::remove ( Resource  $resource)

Remove.

Definition at line 155 of file ResourceMapper.php.

◆ validateNewVersion()

Drupal\metastore\ResourceMapper::validateNewVersion ( Resource  $resource)
protected

Private.

Definition at line 113 of file ResourceMapper.php.

Member Data Documentation

◆ DEREFERENCE_NO

const Drupal\metastore\ResourceMapper::DEREFERENCE_NO = 0

Definition at line 21 of file ResourceMapper.php.

◆ DEREFERENCE_YES

const Drupal\metastore\ResourceMapper::DEREFERENCE_YES = 1

Definition at line 22 of file ResourceMapper.php.

◆ EVENT_REGISTRATION

const Drupal\metastore\ResourceMapper::EVENT_REGISTRATION = 'dkan_metastore_resource_mapper_registration'

Definition at line 18 of file ResourceMapper.php.

◆ EVENT_RESOURCE_MAPPER_PRE_REMOVE_SOURCE

const Drupal\metastore\ResourceMapper::EVENT_RESOURCE_MAPPER_PRE_REMOVE_SOURCE = 'dkan_metastore_pre_remove_source'

Definition at line 19 of file ResourceMapper.php.