Package gavo :: Package protocols :: Module datalink :: Class ProductDescriptor
[frames] | no frames]

Class ProductDescriptor

source code

object --+
         |
        ProductDescriptor
Known Subclasses:

An encapsulation of information about some "product" (i.e., file).

This is basically equivalent to a line in the product table; the arguments of the constructor are all available as same-named attributes.

It also has an attribute data defaulting to None. DataGenerators set it, DataFilters potentially change it.

If you inherit from this method and you have a way to guess the size of what the descriptor describes, override the estimateSize() method. The default will return a file size if accessPath points to an existing file, None otherwise.

Instance Methods
 
__init__(self, pubDID, accref, accessPath, mime, owner=None, embargo=None, sourceTable=None, datalink=None, preview=None, preview_mime=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
estimateSize(self) source code
 
makeLink(self, url, **kwargs)
returns a LinkDef for this descriptor for url.
source code
 
makeLinkFromFile(self, localPath, description, semantics, service=None, contentType=None, suppressMissing=False)
returns a LinkDef for a local file.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods
 
fromAccref(cls, pubDID, accref, accrefPrefix=None, **moreKWs)
returns a product descriptor for an access reference.
source code
Class Variables
  data = None
hash(x)
Properties

Inherited from object: __class__

Method Details

__init__(self, pubDID, accref, accessPath, mime, owner=None, embargo=None, sourceTable=None, datalink=None, preview=None, preview_mime=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

fromAccref(cls, pubDID, accref, accrefPrefix=None, **moreKWs)
Class Method

source code 

returns a product descriptor for an access reference.

If an accrefPrefix is passed in, an AuthenticationFault (for want of something better fitting) is returned when the accref doesn't start with accrefPrefix.

makeLink(self, url, **kwargs)

source code 

returns a LinkDef for this descriptor for url.

kwargs are passed on to LinkDef and include, in particular, semantics, contentType, contentLength, and description.

makeLinkFromFile(self, localPath, description, semantics, service=None, contentType=None, suppressMissing=False)

source code 

returns a LinkDef for a local file.

Arguments are as for LinkDef.fromFile, except you don't have to pass in service if you're using the datalink service itself to access the file; this method will try to find the service by itself.