예제 #1
0
파일: CDB.py 프로젝트: ydc92546169/ACS
    def handleCDB(self, name):
        '''
        Handles an individual CDB entry. This means that if parameter, "name",
        exists within the ACS CDB; we take all info found within the CDB XML
        and add it to this object instance overriding previous 
        method/attribute defininitions where applicable.
        
        Parameters: name is the name of the CDB XML within the /alma/simulated
        section we are searching for.
        
        Returns: True if the current XML allows us to look at superinterfaces.
        False otherwise.
        
        Raises: Nothing
        '''
        ret_val = True

        #create an xml helper object
        xml_obj = getComponentXMLObj(name)

        # self.__logger.logInfo("xml_obj: " + xml_obj.toxml())
        # work around for some odd behaviour of the CDB. If the simulated component
        # node has sub nodes, then the SimulatedComponent element is replaced by the
        # name of the root component
        if xml_obj is not None:
            try:
                xml_obj.SimulatedComponent
            except AttributeError:
                new_el = xml_obj.createElement("SimulatedComponent")
                for item in xml_obj.firstChild.attributes.items():
                    new_el.setAttribute(item[0], item[1])
                for n in xml_obj.firstChild.childNodes:
                    if n.nodeType == xml_obj.ELEMENT_NODE:
                        new_el.appendChild(n)
                xml_obj.removeChild(xml_obj.firstChild)
                xml_obj.appendChild(new_el)
                xml_obj = XmlObject(xml_obj.toxml())

        if xml_obj != None:
            #at least one entry exists. good!
            self.exists = 1

            #get the corba methods
            self.getCorbaMethods(xml_obj)

            #get the corba attributes
            self.getCorbaAttributes(xml_obj)

            #setup the lifecycle methods
            self.setupLifecyleMethods(xml_obj)

            #allow inheritance?
            ret_val = xml_obj.SimulatedComponent.getAttribute(
                'AllowInheritance')
#            self.__logger.logInfo("returning: " + str(ret_val))

        return ret_val
예제 #2
0
파일: CDB.py 프로젝트: ACS-Community/ACS
    def handleCDB(self, name):
        '''
        Handles an individual CDB entry. This means that if parameter, "name",
        exists within the ACS CDB; we take all info found within the CDB XML
        and add it to this object instance overriding previous 
        method/attribute defininitions where applicable.
        
        Parameters: name is the name of the CDB XML within the /alma/simulated
        section we are searching for.
        
        Returns: True if the current XML allows us to look at superinterfaces.
        False otherwise.
        
        Raises: Nothing
        '''
        ret_val = True
        
        #create an xml helper object
        xml_obj = getComponentXMLObj(name)
       
        # self.__logger.logInfo("xml_obj: " + xml_obj.toxml())
        # work around for some odd behaviour of the CDB. If the simulated component
        # node has sub nodes, then the SimulatedComponent element is replaced by the
        # name of the root component
        if xml_obj is not None:
            try:
                xml_obj.SimulatedComponent
            except AttributeError:
                new_el = xml_obj.createElement("SimulatedComponent")
                for item in xml_obj.firstChild.attributes.items():
                    new_el.setAttribute(item[0], item[1])
                for n in xml_obj.firstChild.childNodes:
                    if n.nodeType == xml_obj.ELEMENT_NODE:
                        new_el.appendChild(n)
                xml_obj.removeChild(xml_obj.firstChild)
                xml_obj.appendChild(new_el)
                xml_obj = XmlObject(xml_obj.toxml())
 
        if xml_obj!=None:
            #at least one entry exists. good!
            self.exists = 1
            
            #get the corba methods
            self.getCorbaMethods(xml_obj)

            #get the corba attributes
            self.getCorbaAttributes(xml_obj)
            
            #setup the lifecycle methods
            self.setupLifecyleMethods(xml_obj)
            
            #allow inheritance?
            ret_val = xml_obj.SimulatedComponent.getAttribute('AllowInheritance')
#            self.__logger.logInfo("returning: " + str(ret_val))
            
        return ret_val
예제 #3
0
    def setupEventDispatching(self):
        '''
        Helper method sets up event dispatching using info found in the
        ACS CDB.
        '''
        self.logger.logInfo("Setting up event dispatching.")

        #get the xml object which describes the event frequencies and
        #reponses
        xml_obj = getComponentXMLObj(self.comp_name)

        #sanity check
        if xml_obj == None:
            self.logger.logDebug("No CDB entry found. Bailing.")
            return

        #just delegate to other helper methods
        self.handleFrequencies(xml_obj)
        self.handleResponses(xml_obj)
예제 #4
0
 def setupEventDispatching(self):
     '''
     Helper method sets up event dispatching using info found in the
     ACS CDB.
     '''
     self.logger.logInfo("Setting up event dispatching.")
     
     #get the xml object which describes the event frequencies and
     #reponses
     xml_obj = getComponentXMLObj(self.comp_name)
     
     #sanity check
     if xml_obj == None:
         self.logger.logDebug("No CDB entry found. Bailing.")
         return
     
     #just delegate to other helper methods
     self.handleFrequencies(xml_obj)
     self.handleResponses(xml_obj)