Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Python

    Code Block
    languagepy
    linenumberstrue
    collapsetrue
    #By Name
    comp = self.getComponent("<Name>")
     
    #By Interface. Must be at least one component configured as default!
    comp = self.getDefaultComponent("IDL:<prefix>/<Module>/<Interface>:1.0")
    
    
    #Release Components
    self.releaseComponent(comp.name())
  • Java

    Code Block
    languagejava
    linenumberstrue
    collapsetrue
    //Shared
    import alma.<Module>.<Interface>;
    import alma.<Module>.<Interface>Helper;
     
    //By Name
    <Interface> comp = <Interface>Helper.narrow(this.m_containerServices.getComponent("<Name>"));
     
    //By Interface. Must be at least one component configured as default!
    <Interface> comp = <Interface>Helper.narrow(this.m_containerServices.getDefaultComponent("IDL:<prefix>/<Module>/<Interface>:1.0"));
     
    //Release Components
    m_containerServies.releaseComponent(comp.name());
  • C++

    Code Block
    languagecpp
    linenumberstrue
    collapsetrue
    //By Name
    <Module>::<Interface>_var comp = this->getContainerServices()->getComponent<<Module>::<Interface>>("<Name>");
    
    //By Interface. Must be at least one component configured as default!
    <Module>::<Interface>_var comp = this->getContainerServices()->getDefaultComponent<<Module>::<Interface>>("IDL:<prefix>/<Module>/<Interface>:1.0");
    
    //Release Components
    this->getContainerServices()->releaseComponent(comp->name());

Logging

ACS Logging has two main benefits:

  • Provides a standard mechanism for printing log messages
  • Logs go to the "Remote Logger" for distribution of logs and storage

Example Logging

  • Python

    Code Block
    logger = self.getLogger()
    logger.logTrace("...")
    logger.logDebug("...")
    logger.logInfo("...")
    logger.logWarning("...")
    logger.logError("...")
    
    #An example
    logger.info("A real log with a string '%s' and an int (%d)" % ("Log Entry", 3))
  • Java

    Code Block
    m_logger.finer("...");
    m_logger.fine("...");
    m_logger.info("...");
    m_logger.warning("...");
    m_logger.severe("...");
    
    
    #An example
    m_logger.info("A real log with a string '" + "Log Entry" + "' and an int (" + String.valueOf(3) + ")");
  • C++

    Code Block
    ACS_TRACE("...");
    ACS_DEBUG("...");
    ACS_SHORT_LOG((LM_INFO, "..."));
    ACS_SHORT_LOG((LM_WARNING, "..."));
    ACS_SHORT_LOG((LM_ERROR, "..."));
    
    
    //An example
    ACS_SHORT_LOG((LM_INFO, "A real log with a string '%s' and an int (%d)", "Log Entry", 3));

Error Handling

Error Handling in ACS Components has 4 pieces:

  • Error Definitions (XML)
  • Error Declarations (IDL)
  • Throwing Exceptions
  • Handling Exceptions

Error Definitions

Error Declarations

Throwing Exceptions

Handling Exceptions