class Openwsman::EndPointReference

The EndPointReference is a stub to proxy server-side operations

Each WS-Management operation (Get, Enumerate, Invoke, …) has an associated end point reference, providing the actual implementation of the operation.

EndPointReference

Public Instance Methods

add_selector(p1, p2) click to toggle source

Add selector as key/value pair

void add_selector(const char *name, const char *text) {
    epr_add_selector_text($self, name, text);
  }

  /*
   * Serialization
   *
   * XML-serialize EndPointReference as child (with namespace and name) of node
   *
   */
  int serialize( WsXmlNodeH node, const char *ns, const char *epr_node_name, int embedded) {
    return epr_serialize(node, ns, epr_node_name, $self, embedded);
  }
  

  %alias cmp "==";
  %typemap(out) int cmp
    "$result = ($1 == 0) ? Qtrue : Qfalse;";

  /*
   * Compare two EndPointReferences
   *
   */
  int cmp(const epr_t *epr2) {
    return epr_cmp($self, epr2);
  }
  
  /*
   * String representation (XML syntax)
   *
   */
  char *to_xml( const char *ns = NULL, const char *epr_node_name = NULL) {
    return epr_to_txt($self, ns?ns:XML_NS_ADDRESSING, epr_node_name?epr_node_name:WSA_EPR);
  }



  %rename("to_s") string();

  %newobject string;
  /*
   * String representation (<uri>?<selector>,<selector>,...)
   *
   */
  char *string() {
    return epr_to_string($self);
  }

  /*
   * Number of selectors
   */
  int selector_count(void) {
    return epr_selector_count($self);
  }

  /*
   * The resource URI associated to this EndPointReference
   *
   */
  char *resource_uri(void) {
    return epr_get_resource_uri($self);
  }
  

  /*
   * Get value of selector by name
   * epr#selector converts any value passed to String
   *
   * ==== Shortcut
   * epr.selector("name") can also be abbreviated as epr.name
   *
   * ==== Examples
   *   epr.selector("name")
   *   epr.selector(value)
   *   epr.name
   */
  char *selector(VALUE v) {
    const char *name = as_string(v);

    return wsman_epr_selector_by_name($self, name);
  }

#if !defined(SWIGJAVA) /* Target_* undefined for Java in openwsman.i */
  /*
   * Return list of selector names
   */

  VALUE selector_names(void) {



    int i;
    Target_Type ary = Target_SizedArray($self->refparams.selectorset.count);
    key_value_t *p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      Target_ListSet(ary, i, SWIG_FromCharPtr(p->key));
      ++p;
    }

    return ary;

  }
#endif


  /*
   * enumerate over selectors as key,value pairs
   *
   * call-seq:
   *   epr.each { |key,value| ... }
   *
   */
  void each() {
    int i;
    key_value_t *p = NULL;
    VALUE value, ary;
    p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      ary = rb_ary_new2(2);
      rb_ary_store(ary, 0, SWIG_FromCharPtr(p->key));
      if (p->type == 0) {
        value = SWIG_FromCharPtr(p->v.text);
      } else {
        value = SWIG_NewPointerObj((void*) p->v.epr, SWIGTYPE_p_epr_t, 0);
      }
      rb_ary_store(ary, 1, value);
      rb_yield(ary);
      p++;
    }
  }


  %newobject classname;
  /*
   * Classname of EPR
   */
  char *classname(void) {
    return uri_classname($self->refparams.uri);
  }
 
  %newobject namespace;
  /*
   * Namespace of EPR
   */
  char *namespace(void) {
    char *classname;
    int classnamelen, namespacelen;
    const char *prefix;
    const char *uri;

    /* try to get namespace from selectors (WS-Management style) */
    char *ns = get_cimnamespace_from_selectorset(&($self->refparams.selectorset));
    if (ns) {
      return strdup(ns);
    }
    /* WMI style? - extract namespace from uri */

    uri = $self->refparams.uri;
    prefix = epr_prefix(uri);
    if (prefix == NULL) {
      return NULL; /* bad classname in URI */
    }
    classname = uri_classname(uri);
    if (classname == NULL)
      return NULL; /* bad URI */
    classnamelen = strlen(classname);
    free(classname);
    namespacelen = strlen(uri) - classnamelen - strlen(prefix) - 2; /* drop enclosing slashes */
    if (namespacelen <= 0)
      return strdup("");
    /* copy after prefix slash (+ 1) */
    return strndup(uri + strlen(prefix) + 1, namespacelen);
  }
  
  %newobject prefix;
  /*
   * Prefix of EPR
   */
  char *prefix(void) {
    return epr_prefix($self->refparams.uri);
  }
}
classname(p1) click to toggle source

Classname of EPR

char *classname(void) {
    return uri_classname($self->refparams.uri);
  }
 
  %newobject namespace;
  /*
   * Namespace of EPR
   */
  char *namespace(void) {
    char *classname;
    int classnamelen, namespacelen;
    const char *prefix;
    const char *uri;

    /* try to get namespace from selectors (WS-Management style) */
    char *ns = get_cimnamespace_from_selectorset(&($self->refparams.selectorset));
    if (ns) {
      return strdup(ns);
    }
    /* WMI style? - extract namespace from uri */

    uri = $self->refparams.uri;
    prefix = epr_prefix(uri);
    if (prefix == NULL) {
      return NULL; /* bad classname in URI */
    }
    classname = uri_classname(uri);
    if (classname == NULL)
      return NULL; /* bad URI */
    classnamelen = strlen(classname);
    free(classname);
    namespacelen = strlen(uri) - classnamelen - strlen(prefix) - 2; /* drop enclosing slashes */
    if (namespacelen <= 0)
      return strdup("");
    /* copy after prefix slash (+ 1) */
    return strndup(uri + strlen(prefix) + 1, namespacelen);
  }
  
  %newobject prefix;
  /*
   * Prefix of EPR
   */
  char *prefix(void) {
    return epr_prefix($self->refparams.uri);
  }
}
clone(p1) click to toggle source

clone the EndPointReference instance

epr_t *clone(const epr_t *epr) {
    return epr_copy(epr);
  }


  /*
   * Add selector as key/value pair
   *
   */
  void add_selector(const char *name, const char *text) {
    epr_add_selector_text($self, name, text);
  }

  /*
   * Serialization
   *
   * XML-serialize EndPointReference as child (with namespace and name) of node
   *
   */
  int serialize( WsXmlNodeH node, const char *ns, const char *epr_node_name, int embedded) {
    return epr_serialize(node, ns, epr_node_name, $self, embedded);
  }
  

  %alias cmp "==";
  %typemap(out) int cmp
    "$result = ($1 == 0) ? Qtrue : Qfalse;";

  /*
   * Compare two EndPointReferences
   *
   */
  int cmp(const epr_t *epr2) {
    return epr_cmp($self, epr2);
  }
  
  /*
   * String representation (XML syntax)
   *
   */
  char *to_xml( const char *ns = NULL, const char *epr_node_name = NULL) {
    return epr_to_txt($self, ns?ns:XML_NS_ADDRESSING, epr_node_name?epr_node_name:WSA_EPR);
  }



  %rename("to_s") string();

  %newobject string;
  /*
   * String representation (<uri>?<selector>,<selector>,...)
   *
   */
  char *string() {
    return epr_to_string($self);
  }

  /*
   * Number of selectors
   */
  int selector_count(void) {
    return epr_selector_count($self);
  }

  /*
   * The resource URI associated to this EndPointReference
   *
   */
  char *resource_uri(void) {
    return epr_get_resource_uri($self);
  }
  

  /*
   * Get value of selector by name
   * epr#selector converts any value passed to String
   *
   * ==== Shortcut
   * epr.selector("name") can also be abbreviated as epr.name
   *
   * ==== Examples
   *   epr.selector("name")
   *   epr.selector(value)
   *   epr.name
   */
  char *selector(VALUE v) {
    const char *name = as_string(v);

    return wsman_epr_selector_by_name($self, name);
  }

#if !defined(SWIGJAVA) /* Target_* undefined for Java in openwsman.i */
  /*
   * Return list of selector names
   */

  VALUE selector_names(void) {



    int i;
    Target_Type ary = Target_SizedArray($self->refparams.selectorset.count);
    key_value_t *p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      Target_ListSet(ary, i, SWIG_FromCharPtr(p->key));
      ++p;
    }

    return ary;

  }
#endif


  /*
   * enumerate over selectors as key,value pairs
   *
   * call-seq:
   *   epr.each { |key,value| ... }
   *
   */
  void each() {
    int i;
    key_value_t *p = NULL;
    VALUE value, ary;
    p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      ary = rb_ary_new2(2);
      rb_ary_store(ary, 0, SWIG_FromCharPtr(p->key));
      if (p->type == 0) {
        value = SWIG_FromCharPtr(p->v.text);
      } else {
        value = SWIG_NewPointerObj((void*) p->v.epr, SWIGTYPE_p_epr_t, 0);
      }
      rb_ary_store(ary, 1, value);
      rb_yield(ary);
      p++;
    }
  }


  %newobject classname;
  /*
   * Classname of EPR
   */
  char *classname(void) {
    return uri_classname($self->refparams.uri);
  }
 
  %newobject namespace;
  /*
   * Namespace of EPR
   */
  char *namespace(void) {
    char *classname;
    int classnamelen, namespacelen;
    const char *prefix;
    const char *uri;

    /* try to get namespace from selectors (WS-Management style) */
    char *ns = get_cimnamespace_from_selectorset(&($self->refparams.selectorset));
    if (ns) {
      return strdup(ns);
    }
    /* WMI style? - extract namespace from uri */

    uri = $self->refparams.uri;
    prefix = epr_prefix(uri);
    if (prefix == NULL) {
      return NULL; /* bad classname in URI */
    }
    classname = uri_classname(uri);
    if (classname == NULL)
      return NULL; /* bad URI */
    classnamelen = strlen(classname);
    free(classname);
    namespacelen = strlen(uri) - classnamelen - strlen(prefix) - 2; /* drop enclosing slashes */
    if (namespacelen <= 0)
      return strdup("");
    /* copy after prefix slash (+ 1) */
    return strndup(uri + strlen(prefix) + 1, namespacelen);
  }
  
  %newobject prefix;
  /*
   * Prefix of EPR
   */
  char *prefix(void) {
    return epr_prefix($self->refparams.uri);
  }
}
cmp(p1) click to toggle source

Compare two EndPointReferences

int cmp(const epr_t *epr2) {
    return epr_cmp($self, epr2);
  }
  
  /*
   * String representation (XML syntax)
   *
   */
  char *to_xml( const char *ns = NULL, const char *epr_node_name = NULL) {
    return epr_to_txt($self, ns?ns:XML_NS_ADDRESSING, epr_node_name?epr_node_name:WSA_EPR);
  }



  %rename("to_s") string();

  %newobject string;
  /*
   * String representation (<uri>?<selector>,<selector>,...)
   *
   */
  char *string() {
    return epr_to_string($self);
  }

  /*
   * Number of selectors
   */
  int selector_count(void) {
    return epr_selector_count($self);
  }

  /*
   * The resource URI associated to this EndPointReference
   *
   */
  char *resource_uri(void) {
    return epr_get_resource_uri($self);
  }
  

  /*
   * Get value of selector by name
   * epr#selector converts any value passed to String
   *
   * ==== Shortcut
   * epr.selector("name") can also be abbreviated as epr.name
   *
   * ==== Examples
   *   epr.selector("name")
   *   epr.selector(value)
   *   epr.name
   */
  char *selector(VALUE v) {
    const char *name = as_string(v);

    return wsman_epr_selector_by_name($self, name);
  }

#if !defined(SWIGJAVA) /* Target_* undefined for Java in openwsman.i */
  /*
   * Return list of selector names
   */

  VALUE selector_names(void) {



    int i;
    Target_Type ary = Target_SizedArray($self->refparams.selectorset.count);
    key_value_t *p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      Target_ListSet(ary, i, SWIG_FromCharPtr(p->key));
      ++p;
    }

    return ary;

  }
#endif


  /*
   * enumerate over selectors as key,value pairs
   *
   * call-seq:
   *   epr.each { |key,value| ... }
   *
   */
  void each() {
    int i;
    key_value_t *p = NULL;
    VALUE value, ary;
    p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      ary = rb_ary_new2(2);
      rb_ary_store(ary, 0, SWIG_FromCharPtr(p->key));
      if (p->type == 0) {
        value = SWIG_FromCharPtr(p->v.text);
      } else {
        value = SWIG_NewPointerObj((void*) p->v.epr, SWIGTYPE_p_epr_t, 0);
      }
      rb_ary_store(ary, 1, value);
      rb_yield(ary);
      p++;
    }
  }


  %newobject classname;
  /*
   * Classname of EPR
   */
  char *classname(void) {
    return uri_classname($self->refparams.uri);
  }
 
  %newobject namespace;
  /*
   * Namespace of EPR
   */
  char *namespace(void) {
    char *classname;
    int classnamelen, namespacelen;
    const char *prefix;
    const char *uri;

    /* try to get namespace from selectors (WS-Management style) */
    char *ns = get_cimnamespace_from_selectorset(&($self->refparams.selectorset));
    if (ns) {
      return strdup(ns);
    }
    /* WMI style? - extract namespace from uri */

    uri = $self->refparams.uri;
    prefix = epr_prefix(uri);
    if (prefix == NULL) {
      return NULL; /* bad classname in URI */
    }
    classname = uri_classname(uri);
    if (classname == NULL)
      return NULL; /* bad URI */
    classnamelen = strlen(classname);
    free(classname);
    namespacelen = strlen(uri) - classnamelen - strlen(prefix) - 2; /* drop enclosing slashes */
    if (namespacelen <= 0)
      return strdup("");
    /* copy after prefix slash (+ 1) */
    return strndup(uri + strlen(prefix) + 1, namespacelen);
  }
  
  %newobject prefix;
  /*
   * Prefix of EPR
   */
  char *prefix(void) {
    return epr_prefix($self->refparams.uri);
  }
}
each { |key,value| ... } click to toggle source

enumerate over selectors as key,value pairs

void each() {
    int i;
    key_value_t *p = NULL;
    VALUE value, ary;
    p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      ary = rb_ary_new2(2);
      rb_ary_store(ary, 0, SWIG_FromCharPtr(p->key));
      if (p->type == 0) {
        value = SWIG_FromCharPtr(p->v.text);
      } else {
        value = SWIG_NewPointerObj((void*) p->v.epr, SWIGTYPE_p_epr_t, 0);
      }
      rb_ary_store(ary, 1, value);
      rb_yield(ary);
      p++;
    }
  }


  %newobject classname;
  /*
   * Classname of EPR
   */
  char *classname(void) {
    return uri_classname($self->refparams.uri);
  }
 
  %newobject namespace;
  /*
   * Namespace of EPR
   */
  char *namespace(void) {
    char *classname;
    int classnamelen, namespacelen;
    const char *prefix;
    const char *uri;

    /* try to get namespace from selectors (WS-Management style) */
    char *ns = get_cimnamespace_from_selectorset(&($self->refparams.selectorset));
    if (ns) {
      return strdup(ns);
    }
    /* WMI style? - extract namespace from uri */

    uri = $self->refparams.uri;
    prefix = epr_prefix(uri);
    if (prefix == NULL) {
      return NULL; /* bad classname in URI */
    }
    classname = uri_classname(uri);
    if (classname == NULL)
      return NULL; /* bad URI */
    classnamelen = strlen(classname);
    free(classname);
    namespacelen = strlen(uri) - classnamelen - strlen(prefix) - 2; /* drop enclosing slashes */
    if (namespacelen <= 0)
      return strdup("");
    /* copy after prefix slash (+ 1) */
    return strndup(uri + strlen(prefix) + 1, namespacelen);
  }
  
  %newobject prefix;
  /*
   * Prefix of EPR
   */
  char *prefix(void) {
    return epr_prefix($self->refparams.uri);
  }
}
namespace(p1) click to toggle source

Namespace of EPR

char *namespace(void) {
    char *classname;
    int classnamelen, namespacelen;
    const char *prefix;
    const char *uri;

    /* try to get namespace from selectors (WS-Management style) */
    char *ns = get_cimnamespace_from_selectorset(&($self->refparams.selectorset));
    if (ns) {
      return strdup(ns);
    }
    /* WMI style? - extract namespace from uri */

    uri = $self->refparams.uri;
    prefix = epr_prefix(uri);
    if (prefix == NULL) {
      return NULL; /* bad classname in URI */
    }
    classname = uri_classname(uri);
    if (classname == NULL)
      return NULL; /* bad URI */
    classnamelen = strlen(classname);
    free(classname);
    namespacelen = strlen(uri) - classnamelen - strlen(prefix) - 2; /* drop enclosing slashes */
    if (namespacelen <= 0)
      return strdup("");
    /* copy after prefix slash (+ 1) */
    return strndup(uri + strlen(prefix) + 1, namespacelen);
  }
  
  %newobject prefix;
  /*
   * Prefix of EPR
   */
  char *prefix(void) {
    return epr_prefix($self->refparams.uri);
  }
}
prefix(p1) click to toggle source

Prefix of EPR

char *prefix(void) {
    return epr_prefix($self->refparams.uri);
  }
}
resource_uri(p1) click to toggle source

The resource URI associated to this EndPointReference

char *resource_uri(void) {
    return epr_get_resource_uri($self);
  }
  

  /*
   * Get value of selector by name
   * epr#selector converts any value passed to String
   *
   * ==== Shortcut
   * epr.selector("name") can also be abbreviated as epr.name
   *
   * ==== Examples
   *   epr.selector("name")
   *   epr.selector(value)
   *   epr.name
   */
  char *selector(VALUE v) {
    const char *name = as_string(v);

    return wsman_epr_selector_by_name($self, name);
  }

#if !defined(SWIGJAVA) /* Target_* undefined for Java in openwsman.i */
  /*
   * Return list of selector names
   */

  VALUE selector_names(void) {



    int i;
    Target_Type ary = Target_SizedArray($self->refparams.selectorset.count);
    key_value_t *p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      Target_ListSet(ary, i, SWIG_FromCharPtr(p->key));
      ++p;
    }

    return ary;

  }
#endif


  /*
   * enumerate over selectors as key,value pairs
   *
   * call-seq:
   *   epr.each { |key,value| ... }
   *
   */
  void each() {
    int i;
    key_value_t *p = NULL;
    VALUE value, ary;
    p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      ary = rb_ary_new2(2);
      rb_ary_store(ary, 0, SWIG_FromCharPtr(p->key));
      if (p->type == 0) {
        value = SWIG_FromCharPtr(p->v.text);
      } else {
        value = SWIG_NewPointerObj((void*) p->v.epr, SWIGTYPE_p_epr_t, 0);
      }
      rb_ary_store(ary, 1, value);
      rb_yield(ary);
      p++;
    }
  }


  %newobject classname;
  /*
   * Classname of EPR
   */
  char *classname(void) {
    return uri_classname($self->refparams.uri);
  }
 
  %newobject namespace;
  /*
   * Namespace of EPR
   */
  char *namespace(void) {
    char *classname;
    int classnamelen, namespacelen;
    const char *prefix;
    const char *uri;

    /* try to get namespace from selectors (WS-Management style) */
    char *ns = get_cimnamespace_from_selectorset(&($self->refparams.selectorset));
    if (ns) {
      return strdup(ns);
    }
    /* WMI style? - extract namespace from uri */

    uri = $self->refparams.uri;
    prefix = epr_prefix(uri);
    if (prefix == NULL) {
      return NULL; /* bad classname in URI */
    }
    classname = uri_classname(uri);
    if (classname == NULL)
      return NULL; /* bad URI */
    classnamelen = strlen(classname);
    free(classname);
    namespacelen = strlen(uri) - classnamelen - strlen(prefix) - 2; /* drop enclosing slashes */
    if (namespacelen <= 0)
      return strdup("");
    /* copy after prefix slash (+ 1) */
    return strndup(uri + strlen(prefix) + 1, namespacelen);
  }
  
  %newobject prefix;
  /*
   * Prefix of EPR
   */
  char *prefix(void) {
    return epr_prefix($self->refparams.uri);
  }
}
selector(p1) click to toggle source

Get value of selector by name epr#selector converts any value passed to String

Shortcut

epr.selector(“name”) can also be abbreviated as epr.name

Examples

epr.selector("name")
epr.selector(value)
epr.name
char *selector(VALUE v) {
    const char *name = as_string(v);

    return wsman_epr_selector_by_name($self, name);
  }

#if !defined(SWIGJAVA) /* Target_* undefined for Java in openwsman.i */
  /*
   * Return list of selector names
   */

  VALUE selector_names(void) {



    int i;
    Target_Type ary = Target_SizedArray($self->refparams.selectorset.count);
    key_value_t *p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      Target_ListSet(ary, i, SWIG_FromCharPtr(p->key));
      ++p;
    }

    return ary;

  }
#endif


  /*
   * enumerate over selectors as key,value pairs
   *
   * call-seq:
   *   epr.each { |key,value| ... }
   *
   */
  void each() {
    int i;
    key_value_t *p = NULL;
    VALUE value, ary;
    p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      ary = rb_ary_new2(2);
      rb_ary_store(ary, 0, SWIG_FromCharPtr(p->key));
      if (p->type == 0) {
        value = SWIG_FromCharPtr(p->v.text);
      } else {
        value = SWIG_NewPointerObj((void*) p->v.epr, SWIGTYPE_p_epr_t, 0);
      }
      rb_ary_store(ary, 1, value);
      rb_yield(ary);
      p++;
    }
  }


  %newobject classname;
  /*
   * Classname of EPR
   */
  char *classname(void) {
    return uri_classname($self->refparams.uri);
  }
 
  %newobject namespace;
  /*
   * Namespace of EPR
   */
  char *namespace(void) {
    char *classname;
    int classnamelen, namespacelen;
    const char *prefix;
    const char *uri;

    /* try to get namespace from selectors (WS-Management style) */
    char *ns = get_cimnamespace_from_selectorset(&($self->refparams.selectorset));
    if (ns) {
      return strdup(ns);
    }
    /* WMI style? - extract namespace from uri */

    uri = $self->refparams.uri;
    prefix = epr_prefix(uri);
    if (prefix == NULL) {
      return NULL; /* bad classname in URI */
    }
    classname = uri_classname(uri);
    if (classname == NULL)
      return NULL; /* bad URI */
    classnamelen = strlen(classname);
    free(classname);
    namespacelen = strlen(uri) - classnamelen - strlen(prefix) - 2; /* drop enclosing slashes */
    if (namespacelen <= 0)
      return strdup("");
    /* copy after prefix slash (+ 1) */
    return strndup(uri + strlen(prefix) + 1, namespacelen);
  }
  
  %newobject prefix;
  /*
   * Prefix of EPR
   */
  char *prefix(void) {
    return epr_prefix($self->refparams.uri);
  }
}
selector_count(p1) click to toggle source

Number of selectors

int selector_count(void) {
    return epr_selector_count($self);
  }

  /*
   * The resource URI associated to this EndPointReference
   *
   */
  char *resource_uri(void) {
    return epr_get_resource_uri($self);
  }
  

  /*
   * Get value of selector by name
   * epr#selector converts any value passed to String
   *
   * ==== Shortcut
   * epr.selector("name") can also be abbreviated as epr.name
   *
   * ==== Examples
   *   epr.selector("name")
   *   epr.selector(value)
   *   epr.name
   */
  char *selector(VALUE v) {
    const char *name = as_string(v);

    return wsman_epr_selector_by_name($self, name);
  }

#if !defined(SWIGJAVA) /* Target_* undefined for Java in openwsman.i */
  /*
   * Return list of selector names
   */

  VALUE selector_names(void) {



    int i;
    Target_Type ary = Target_SizedArray($self->refparams.selectorset.count);
    key_value_t *p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      Target_ListSet(ary, i, SWIG_FromCharPtr(p->key));
      ++p;
    }

    return ary;

  }
#endif


  /*
   * enumerate over selectors as key,value pairs
   *
   * call-seq:
   *   epr.each { |key,value| ... }
   *
   */
  void each() {
    int i;
    key_value_t *p = NULL;
    VALUE value, ary;
    p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      ary = rb_ary_new2(2);
      rb_ary_store(ary, 0, SWIG_FromCharPtr(p->key));
      if (p->type == 0) {
        value = SWIG_FromCharPtr(p->v.text);
      } else {
        value = SWIG_NewPointerObj((void*) p->v.epr, SWIGTYPE_p_epr_t, 0);
      }
      rb_ary_store(ary, 1, value);
      rb_yield(ary);
      p++;
    }
  }


  %newobject classname;
  /*
   * Classname of EPR
   */
  char *classname(void) {
    return uri_classname($self->refparams.uri);
  }
 
  %newobject namespace;
  /*
   * Namespace of EPR
   */
  char *namespace(void) {
    char *classname;
    int classnamelen, namespacelen;
    const char *prefix;
    const char *uri;

    /* try to get namespace from selectors (WS-Management style) */
    char *ns = get_cimnamespace_from_selectorset(&($self->refparams.selectorset));
    if (ns) {
      return strdup(ns);
    }
    /* WMI style? - extract namespace from uri */

    uri = $self->refparams.uri;
    prefix = epr_prefix(uri);
    if (prefix == NULL) {
      return NULL; /* bad classname in URI */
    }
    classname = uri_classname(uri);
    if (classname == NULL)
      return NULL; /* bad URI */
    classnamelen = strlen(classname);
    free(classname);
    namespacelen = strlen(uri) - classnamelen - strlen(prefix) - 2; /* drop enclosing slashes */
    if (namespacelen <= 0)
      return strdup("");
    /* copy after prefix slash (+ 1) */
    return strndup(uri + strlen(prefix) + 1, namespacelen);
  }
  
  %newobject prefix;
  /*
   * Prefix of EPR
   */
  char *prefix(void) {
    return epr_prefix($self->refparams.uri);
  }
}
selector_names(p1) click to toggle source

Return list of selector names

VALUE selector_names(void) {



    int i;
    Target_Type ary = Target_SizedArray($self->refparams.selectorset.count);
    key_value_t *p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      Target_ListSet(ary, i, SWIG_FromCharPtr(p->key));
      ++p;
    }

    return ary;

  }
#endif


  /*
   * enumerate over selectors as key,value pairs
   *
   * call-seq:
   *   epr.each { |key,value| ... }
   *
   */
  void each() {
    int i;
    key_value_t *p = NULL;
    VALUE value, ary;
    p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      ary = rb_ary_new2(2);
      rb_ary_store(ary, 0, SWIG_FromCharPtr(p->key));
      if (p->type == 0) {
        value = SWIG_FromCharPtr(p->v.text);
      } else {
        value = SWIG_NewPointerObj((void*) p->v.epr, SWIGTYPE_p_epr_t, 0);
      }
      rb_ary_store(ary, 1, value);
      rb_yield(ary);
      p++;
    }
  }


  %newobject classname;
  /*
   * Classname of EPR
   */
  char *classname(void) {
    return uri_classname($self->refparams.uri);
  }
 
  %newobject namespace;
  /*
   * Namespace of EPR
   */
  char *namespace(void) {
    char *classname;
    int classnamelen, namespacelen;
    const char *prefix;
    const char *uri;

    /* try to get namespace from selectors (WS-Management style) */
    char *ns = get_cimnamespace_from_selectorset(&($self->refparams.selectorset));
    if (ns) {
      return strdup(ns);
    }
    /* WMI style? - extract namespace from uri */

    uri = $self->refparams.uri;
    prefix = epr_prefix(uri);
    if (prefix == NULL) {
      return NULL; /* bad classname in URI */
    }
    classname = uri_classname(uri);
    if (classname == NULL)
      return NULL; /* bad URI */
    classnamelen = strlen(classname);
    free(classname);
    namespacelen = strlen(uri) - classnamelen - strlen(prefix) - 2; /* drop enclosing slashes */
    if (namespacelen <= 0)
      return strdup("");
    /* copy after prefix slash (+ 1) */
    return strndup(uri + strlen(prefix) + 1, namespacelen);
  }
  
  %newobject prefix;
  /*
   * Prefix of EPR
   */
  char *prefix(void) {
    return epr_prefix($self->refparams.uri);
  }
}
serialize(p1, p2, p3, p4) click to toggle source

Serialization

XML-serialize EndPointReference as child (with namespace and name) of node

int serialize( WsXmlNodeH node, const char *ns, const char *epr_node_name, int embedded) {
    return epr_serialize(node, ns, epr_node_name, $self, embedded);
  }
  

  %alias cmp "==";
  %typemap(out) int cmp
    "$result = ($1 == 0) ? Qtrue : Qfalse;";

  /*
   * Compare two EndPointReferences
   *
   */
  int cmp(const epr_t *epr2) {
    return epr_cmp($self, epr2);
  }
  
  /*
   * String representation (XML syntax)
   *
   */
  char *to_xml( const char *ns = NULL, const char *epr_node_name = NULL) {
    return epr_to_txt($self, ns?ns:XML_NS_ADDRESSING, epr_node_name?epr_node_name:WSA_EPR);
  }



  %rename("to_s") string();

  %newobject string;
  /*
   * String representation (<uri>?<selector>,<selector>,...)
   *
   */
  char *string() {
    return epr_to_string($self);
  }

  /*
   * Number of selectors
   */
  int selector_count(void) {
    return epr_selector_count($self);
  }

  /*
   * The resource URI associated to this EndPointReference
   *
   */
  char *resource_uri(void) {
    return epr_get_resource_uri($self);
  }
  

  /*
   * Get value of selector by name
   * epr#selector converts any value passed to String
   *
   * ==== Shortcut
   * epr.selector("name") can also be abbreviated as epr.name
   *
   * ==== Examples
   *   epr.selector("name")
   *   epr.selector(value)
   *   epr.name
   */
  char *selector(VALUE v) {
    const char *name = as_string(v);

    return wsman_epr_selector_by_name($self, name);
  }

#if !defined(SWIGJAVA) /* Target_* undefined for Java in openwsman.i */
  /*
   * Return list of selector names
   */

  VALUE selector_names(void) {



    int i;
    Target_Type ary = Target_SizedArray($self->refparams.selectorset.count);
    key_value_t *p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      Target_ListSet(ary, i, SWIG_FromCharPtr(p->key));
      ++p;
    }

    return ary;

  }
#endif


  /*
   * enumerate over selectors as key,value pairs
   *
   * call-seq:
   *   epr.each { |key,value| ... }
   *
   */
  void each() {
    int i;
    key_value_t *p = NULL;
    VALUE value, ary;
    p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      ary = rb_ary_new2(2);
      rb_ary_store(ary, 0, SWIG_FromCharPtr(p->key));
      if (p->type == 0) {
        value = SWIG_FromCharPtr(p->v.text);
      } else {
        value = SWIG_NewPointerObj((void*) p->v.epr, SWIGTYPE_p_epr_t, 0);
      }
      rb_ary_store(ary, 1, value);
      rb_yield(ary);
      p++;
    }
  }


  %newobject classname;
  /*
   * Classname of EPR
   */
  char *classname(void) {
    return uri_classname($self->refparams.uri);
  }
 
  %newobject namespace;
  /*
   * Namespace of EPR
   */
  char *namespace(void) {
    char *classname;
    int classnamelen, namespacelen;
    const char *prefix;
    const char *uri;

    /* try to get namespace from selectors (WS-Management style) */
    char *ns = get_cimnamespace_from_selectorset(&($self->refparams.selectorset));
    if (ns) {
      return strdup(ns);
    }
    /* WMI style? - extract namespace from uri */

    uri = $self->refparams.uri;
    prefix = epr_prefix(uri);
    if (prefix == NULL) {
      return NULL; /* bad classname in URI */
    }
    classname = uri_classname(uri);
    if (classname == NULL)
      return NULL; /* bad URI */
    classnamelen = strlen(classname);
    free(classname);
    namespacelen = strlen(uri) - classnamelen - strlen(prefix) - 2; /* drop enclosing slashes */
    if (namespacelen <= 0)
      return strdup("");
    /* copy after prefix slash (+ 1) */
    return strndup(uri + strlen(prefix) + 1, namespacelen);
  }
  
  %newobject prefix;
  /*
   * Prefix of EPR
   */
  char *prefix(void) {
    return epr_prefix($self->refparams.uri);
  }
}
to_s() click to toggle source

String representation (<uri>?<selector>,<selector>,…)

char *string() {
    return epr_to_string($self);
  }

  /*
   * Number of selectors
   */
  int selector_count(void) {
    return epr_selector_count($self);
  }

  /*
   * The resource URI associated to this EndPointReference
   *
   */
  char *resource_uri(void) {
    return epr_get_resource_uri($self);
  }
  

  /*
   * Get value of selector by name
   * epr#selector converts any value passed to String
   *
   * ==== Shortcut
   * epr.selector("name") can also be abbreviated as epr.name
   *
   * ==== Examples
   *   epr.selector("name")
   *   epr.selector(value)
   *   epr.name
   */
  char *selector(VALUE v) {
    const char *name = as_string(v);

    return wsman_epr_selector_by_name($self, name);
  }

#if !defined(SWIGJAVA) /* Target_* undefined for Java in openwsman.i */
  /*
   * Return list of selector names
   */

  VALUE selector_names(void) {



    int i;
    Target_Type ary = Target_SizedArray($self->refparams.selectorset.count);
    key_value_t *p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      Target_ListSet(ary, i, SWIG_FromCharPtr(p->key));
      ++p;
    }

    return ary;

  }
#endif


  /*
   * enumerate over selectors as key,value pairs
   *
   * call-seq:
   *   epr.each { |key,value| ... }
   *
   */
  void each() {
    int i;
    key_value_t *p = NULL;
    VALUE value, ary;
    p = $self->refparams.selectorset.selectors;
    for (i = 0; i < $self->refparams.selectorset.count; i++) {
      ary = rb_ary_new2(2);
      rb_ary_store(ary, 0, SWIG_FromCharPtr(p->key));
      if (p->type == 0) {
        value = SWIG_FromCharPtr(p->v.text);
      } else {
        value = SWIG_NewPointerObj((void*) p->v.epr, SWIGTYPE_p_epr_t, 0);
      }
      rb_ary_store(ary, 1, value);
      rb_yield(ary);
      p++;
    }
  }


  %newobject classname;
  /*
   * Classname of EPR
   */
  char *classname(void) {
    return uri_classname($self->refparams.uri);
  }
 
  %newobject namespace;
  /*
   * Namespace of EPR
   */
  char *namespace(void) {
    char *classname;
    int classnamelen, namespacelen;
    const char *prefix;
    const char *uri;

    /* try to get namespace from selectors (WS-Management style) */
    char *ns = get_cimnamespace_from_selectorset(&($self->refparams.selectorset));
    if (ns) {
      return strdup(ns);
    }
    /* WMI style? - extract namespace from uri */

    uri = $self->refparams.uri;
    prefix = epr_prefix(uri);
    if (prefix == NULL) {
      return NULL; /* bad classname in URI */
    }
    classname = uri_classname(uri);
    if (classname == NULL)
      return NULL; /* bad URI */
    classnamelen = strlen(classname);
    free(classname);
    namespacelen = strlen(uri) - classnamelen - strlen(prefix) - 2; /* drop enclosing slashes */
    if (namespacelen <= 0)
      return strdup("");
    /* copy after prefix slash (+ 1) */
    return strndup(uri + strlen(prefix) + 1, namespacelen);
  }
  
  %newobject prefix;
  /*
   * Prefix of EPR
   */
  char *prefix(void) {
    return epr_prefix($self->refparams.uri);
  }
}