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

Class MetaMaker

source code

                   object --+                    
                            |                    
 base.structure.StructureBase --+                
                                |                
                   object --+   |                
                            |   |                
           base.common.Parser --+                
                                |                
base.structure.ParseableStructure --+            
                                    |            
             base.structure.Structure --+        
                                        |        
                           object --+   |        
                                    |   |        
      base.structure.RestrictionMixin --+        
                                        |        
                   rscdef.procdef.ProcDef --+    
                                            |    
                       rscdef.procdef.ProcApp --+
                                                |
                                               MetaMaker

A procedure application that generates metadata for datalink services.

The code must be generators (i.e., use yield statements) producing either svcs.InputKeys or protocols.datalink.LinkDef instances.

metaMaker see the data descriptor of the input data under the name descriptor.

The data attribute of the descriptor is always None for metaMakers, so you cannot use anything given there.

Within MetaMakers' code, you can access InputKey, Values, Option, and LinkDef without qualification, and there's the MS function to build structures. Hence, a metaMaker returning an InputKey could look like this:

       <metaMaker>
               <code>
                       yield MS(InputKey, name="format", type="text",
                               description="Output format desired",
                               values=MS(Values,
                                       options=[MS(Option, content_=descriptor.mime),
                                               MS(Option, content_="text/plain")]))
               </code>
       </metaMaker>

(of course, you should give more metadata -- ucds, better description, etc) in production).

It's ok to yield None; this will suppress a Datalink and is convenient when some component further down figures out that a link doesn't exist (e.g., because a file isn't there). Note that in many cases, it's more helpful to client components to handle such situations by yielding a DatalinkFault.NotFoundFault.

In addition to the usual names available to ProcApps, meta makers have:

Nested Classes

Inherited from base.structure.StructureBase: __metaclass__

Instance Methods

Inherited from rscdef.procdef.ProcApp: breakCircles, compile, completeElement, getBodySetupCode, getFuncCode, getLateSetupCode, getParSetupCode, getSetupCode, getSetupPars, onElementComplete, validate

Inherited from rscdef.procdef.ProcDef: getCode

Inherited from base.structure.Structure: __provides__, callCompletedCallbacks, finishElement

Inherited from base.structure.ParseableStructure: __init__, end_, feed, feedFrom, feedObject, getAttribute, iterEvents, start_, value_

Inherited from base.structure.StructureBase: __providedBy__, adopt, change, copy, getAttributes, getCopyableAttributes, getSourcePosition, iterChildren, setPosition

Inherited from base.common.Parser: feedEvent

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

Class Methods

Inherited from base.structure.StructureBase: fromStructure

Class Variables
  name_ = 'metaMaker'
hash(x)
  requiredType = 'metaMaker'
hash(x)
  formalArgs = 'self, descriptor'
  additionalNamesForProcs = {'DatalinkFault': <class 'gavo.proto...

Inherited from rscdef.procdef.ProcApp: attrSeq, managedAttrs

Inherited from base.structure.Structure: __implemented__

Inherited from base.structure.StructureBase: completedCallbacks

Properties

Inherited from object: __class__

Class Variable Details

additionalNamesForProcs

Value:
{'DatalinkFault': <class 'gavo.protocols.soda.DatalinkFault'>,
 'InputKey': <class 'gavo.svcs.inputdef.InputKey'>,
 'LinkDef': <class 'gavo.protocols.datalink.LinkDef'>,
 'MS': <__builtin__.function object>,
 'Option': <class 'gavo.rscdef.column.Option'>,
 'Values': <class 'gavo.rscdef.column.Values'>,
 'soda': <module 'gavo.protocols.soda' from '/home/msdemlei/gavo/trunk\
/gavo/protocols/soda.pyc'>}