def __init__(self, identifier, execparams, propertydefs=(), loggerName=None): """propertydefs is a iterable of tuples that contain (propid, propname, type, mode, defaultvalue, units, action, kinds) defaultvalue should be None if there is no default, otherwise: simple - a single str, int, float, bool simple sequence - an iterable of str, int, float, or bool struct - a dictionary there the key is the "id" and the value is a tuple of (propname, type, mode) struct sequence - a iterable of dictionaries following the struct format """ self.propertySetAccess = threading.Lock() self._id = identifier self._started = False if loggerName == None: self._log = logging.getLogger(self._id) else: self._log = logging.getLogger(loggerName) self._name = execparams.get("NAME_BINDING", "") # The base resource class manages properties ... self._props = PropertyStorage(self, propertydefs, execparams) self._props.initialize() # ... and also manages ports self.__loadPorts() logging.trace("Initial property storage %s", self._props)
def __init__(self, identifier, execparams, propertydefs=(), loggerName=None): """propertydefs is a iterable of tuples that contain (propid, propname, type, mode, defaultvalue, units, action, kinds) defaultvalue should be None if there is no default, otherwise: simple - a single str, int, float, bool simple sequence - an iterable of str, int, float, or bool struct - a dictionary there the key is the "id" and the value is a tuple of (propname, type, mode) struct sequence - a iterable of dictionaries following the struct format """ #print "resource __init__:" #print "id:" + str(identifier) #print "loggerName:" + str(loggerName) #print "execparams:" + str(execparams) self.propertySetAccess = threading.Lock() self._id = identifier self._started = False self._domMgr = None self._ecm = None ## ## logging context for the resource ## self.logLevel = None self._logLevel = None self.logConfig = "" self.loggingMacros = ossie.logger.GetDefaultMacros() ossie.logger.ResolveHostInfo( self.loggingMacros ) self.loggingCtx = None self.loggingURL=None if loggerName == None: self._logid = execparams.get("NAME_BINDING", self._id ) self._logid = self._logid.rsplit("_", 1)[0] else: self._logid = loggerName self._logid = self._logid.replace(":","_") self._log = logging.getLogger(self._logid) loglevel = self._log.getEffectiveLevel() if loglevel == logging.NOTSET: self.logLevel = logging.INFO else: self.logLevel = loglevel self._logLevel = ossie.logger.ConvertLog4ToCFLevel( self.logLevel ) self.logListenerCallback=None self._name = execparams.get("NAME_BINDING", "") # The base resource class manages properties ... self._props = PropertyStorage(self, propertydefs, execparams) self._props.initialize() # property change listener registry and monitoring thread self._propChangeRegistry = {} self._propChangeThread = _PropertyChangeThread(self) self._propMonitors = {} # ... and also manages ports self.__loadPorts() logging.trace("Initial property storage %s", self._props) self.__initialized = False self.__propertiesInitialized = False