def buildComponent(self):
     '''build component class objects'''
     #log.debug("%s Building Component: %s %s" % (8*'#', self.d.component,8*'#'))
     construct = Prototype(self.zenpackroot, self.zenpackbase, self.indent)
     construct.addComponent(self.d.component, self.singular, self.plural, self.manual, self.compdata)
     construct.relmgr =  self.d.relmgr
     construct.relmgr.createFromRelations()
     for p in self.d.parentClasses:  
         construct.classdata['parents'].append(p)
         construct.classdata['_properties'] += p._properties
     
     construct.classdata['class'].update({'nameKey': self.d.componentData['displayed'],
                                          'primaryKey' : self.d.componentData['primaryKey'],
                                          'portal_type' : self.d.component,
                                          'meta_type' : self.d.component,
                                          })
     construct.getHelper()
     # add any custom methods
     for m in self.d.componentMethods:  setattr(construct.helper.classobject, m.__name__, m)
     for k,v in self.d.componentAttributes.items():  setattr(construct.helper.classobject, k, v)
     # backwards compatibility
     self.setBackwardsCompatVars(construct)
     if self.packs[self.zenpackname]['zenpack'] is None:  self.packs[self.zenpackname]['zenpack'] = construct
     self.packs[self.zenpackname]['constructs'][self.definition]['component'] = construct
     self.packs[self.zenpackname]['builder'].helpers[self.d.component]['component'] = construct
     self.updateZenPackClasses(construct)
 def buildDataSource(self):
     '''build datasource class objects'''
     #log.debug("%s Building DataSource: %s %s" % (8*'#',self.datasourceClass,8*'#'))
     construct = Prototype(self.zenpackroot, self.zenpackbase, self.indent)
     #for d in self.dsdata:
         #if d.isMethod == True:  
     #        print "removing %s from %s" % (d.id, self.datasourceClass)
     #        self.dsdata.remove(d)
     construct.addDataSource(self.datasourceClass, self.dsdata)
     construct.is_datasource = True
     construct.classdata['class'].update({
                                          'ZENPACKID': self.zenpackname,
                                          'DATASOURCE' : '%s'% self.d.component,
                                          'sourcetypes' : (self.d.component,),
                                          'sourcetype' : self.d.component,
                                          'component' : '${here/%s}' % self.d.componentData['displayed'],
                                          'cmdFile' : self.d.cmdFile,
                                          'dpoints' : self.d.datapoints,
                                          })
     construct.getHelper()
     for m in self.d.datasourceMethods:  setattr(construct.helper.classobject, m.__name__, m)
     for x in self.d.ignoreKeys:  construct.helper.classobject.ignoreKeys.append(x)
     self.packs[self.zenpackname]['constructs'][self.definition]['datasource'] = construct
     self.packs[self.zenpackname]['builder'].helpers[self.d.component]['datasource'] = construct
 def buildDataSource(self):
     '''build datasource class objects'''
     #log.debug("%s Building DataSource: %s %s" % (8*'#',self.datasourceClass,8*'#'))
     construct = Prototype(self.zenpackroot, self.zenpackbase, self.indent)
     construct.addDataSource(self.datasourceClass, self.dsdata)
     construct.is_datasource = True
     construct.classdata['class'].update({
                                          'ZENPACKID': self.zenpackname,
                                          'DATASOURCE' : '%s'% self.d.component,
                                          'sourcetypes' : (self.d.component,),
                                          'sourcetype' : self.d.component,
                                          'component' : '${here/%s}' % self.d.componentData['displayed'],
                                          'cmdFile' : self.d.cmdFile,
                                          'dpoints' : self.d.datapoints,
                                          })
     # start a new helper to build the class
     construct.getHelper()
     # append any overridden methods
     for m in self.d.datasourceMethods:  setattr(construct.helper.classobject, m.__name__, m)
     # update any properties that should be ignored by getCommand
     for x in self.d.ignoreKeys:  construct.helper.classobject.ignoreKeys.append(x)
     # update local packs data
     self.packs[self.zenpackname]['constructs'][self.definition]['datasource'] = construct
     self.packs[self.zenpackname]['builder'].helpers[self.d.component]['datasource'] = construct