29    : type_(type), name_(name), url_(url) {
 
 
   36    } 
else if (type == 
"http") {
 
   38    } 
else if (type == 
"stdout") {
 
 
   75    : model_(model), boot_update_(true), subscribe_changes_(true),
 
   76      subscribe_notifications_(true), validate_changes_(true),
 
   77      control_socket_(ctrl_sock) {
 
 
   83    s << 
"model: " << model_ << 
", control socker: ";
 
   84    if (!control_socket_) {
 
   87        switch (control_socket_->getType()) {
 
   89            s << 
"UNIX:'" << control_socket_->getName() << 
"'";
 
   92            s << 
"HTTP:'" << control_socket_->getUrl().toText() << 
"'";
 
 
  116    if (control_socket_) {
 
  117        result->set(
"control-socket", control_socket_->toElement());
 
 
  135    string type_str = 
getString(ctrl_sock_config, 
"socket-type");
 
  136    string name = 
getString(ctrl_sock_config, 
"socket-name");
 
  137    string url_str = 
getString(ctrl_sock_config, 
"socket-url");
 
  144    } 
catch (exception 
const& ex) {
 
  146                  << 
getPosition(
"socket-type", ctrl_sock_config)  << 
")");
 
  154                  << 
getPosition(
"socket-url", ctrl_sock_config)  << 
")");
 
  160    } 
catch (exception 
const& ex) {
 
  162                  << ctrl_sock_config->getPosition() << 
")");
 
  167        result->setContext(user_context);
 
 
  178    string model = 
getString(server_config, 
"model");
 
  180    ConstElementPtr ctrl_sock_config = server_config->get(
"control-socket");
 
  182    if (ctrl_sock_config) {
 
  184        ctrl_sock = parser.
parse(ctrl_sock_config);
 
  187        result.reset(
new CfgServer(model, ctrl_sock));
 
  188    } 
catch (exception 
const& ex) {
 
  190                  << server_config->getPosition() << 
")");
 
  194    result->setBootUpdate(
getBoolean(server_config, 
"boot-update"));
 
  195    result->setSubscribeChanges(
getBoolean(server_config, 
"subscribe-changes"));
 
  196    result->setValidateChanges(
getBoolean(server_config, 
"validate-changes"));
 
  200        result->setContext(user_context);
 
 
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
An exception that is thrown if an error occurs while configuring any server.
static const data::Element::Position & getPosition(const std::string &name, const data::ConstElementPtr parent)
Utility method that returns position of an element.
static std::string getString(isc::data::ConstElementPtr scope, const std::string &name)
Returns a string parameter from a scope.
static bool getBoolean(isc::data::ConstElementPtr scope, const std::string &name)
Returns a boolean parameter from a scope.
std::string getErrorMessage() const
Returns parsing error message.
bool isValid() const
Checks if the URL is valid.
Represents a Control Socket.
isc::data::ElementPtr toElement() const override final
Unparse a configuration object.
Type
Defines the list of possible control socket types.
CfgControlSocket(Type type, const std::string &name, const isc::http::Url &url)
Constructor.
static const std::string typeToString(CfgControlSocket::Type type)
Converts CfgControlSocket::Type to string.
static Type stringToType(const std::string &type)
Converts socket type name to CfgControlSocket::Type.
Represents a Managed CfgServer.
CfgServer(const std::string &model, CfgControlSocketPtr ctrl_sock)
Constructor.
isc::data::ElementPtr toElement() const override final
Unparse a configuration object.
std::string toText() const
Returns a text representation for the server.
Parser for CfgControlSocket.
CfgControlSocketPtr parse(data::ConstElementPtr ctrl_sock_config)
Performs the actual parsing of the given "control-socket" element.
CfgServerPtr parse(data::ConstElementPtr server_config)
Performs the actual parsing of the given value from the "managed-servers" map.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
ostream & operator<<(ostream &os, const CfgServer &server)
Dumps the contents of a CfgServer as text to a output stream.
std::shared_ptr< CfgServer > CfgServerPtr
Defines a pointer for CfgServer instances.
std::shared_ptr< CfgControlSocket > CfgControlSocketPtr
Defines a pointer for CfgControlSocket instances.
Defines the logger used by the top-level component of kea-lfc.
Contains declarations for loggers used by the Kea netconf agent.
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.