From 49996770e4878592a3ceca9c48736a4d9774b873 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 3 Mar 2008 14:39:44 +0000 Subject: - new filter API added and used - Added assoicatiors and references actions instead of having them as options --- src/wseventmgr.c | 9 ++++----- src/wsman.c | 42 ++++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/wseventmgr.c b/src/wseventmgr.c index 3822b91..eb6d920 100644 --- a/src/wseventmgr.c +++ b/src/wseventmgr.c @@ -414,7 +414,7 @@ int main(int argc, char **argv) if (!wsman_parse_options(argc, argv)) { exit(EXIT_FAILURE); } - + initialize_logging(); // wsmc_transport_init(NULL); options = wsmc_options_init(); @@ -485,10 +485,7 @@ int main(int argc, char **argv) wsmc_set_action_option(options, FLAG_DUMP_REQUEST); } if (wsm_filter) { - options->filter = wsm_filter; - } - if (wsm_dialect) { - options->dialect = wsm_dialect; + options->filter = filter_create_simple(wsm_dialect, wsm_filter ); } options->cim_ns = cim_namespace; @@ -523,8 +520,10 @@ int main(int argc, char **argv) options->heartbeat_interval = event_heartbeat; if(event_subscription_expire) options->expires = event_subscription_expire; + /* if(wsm_dialect) options->dialect = wsm_dialect; + */ if(event_reference_properties) options->reference = event_reference_properties; rqstDoc = wsmc_action_subscribe(cl, resource_uri, options); diff --git a/src/wsman.c b/src/wsman.c index 4abda24..5ad0d5c 100644 --- a/src/wsman.c +++ b/src/wsman.c @@ -86,8 +86,6 @@ char dump_request = 0; char step = 0; char request_only = 0; char cim_extensions = 0; -char cim_references = 0; -char cim_associators = 0; static char *enum_mode = NULL; static char *binding_enum_mode = NULL; static char *enum_context = NULL; @@ -139,6 +137,8 @@ WsActions action_data[] = { {"subscribe", WSMAN_ACTION_SUBSCRIBE}, {"unsubscribe", WSMAN_ACTION_UNSUBSCRIBE}, {"renew", WSMAN_ACTION_RENEW}, + {"associators", WSMAN_ACTION_ASSOCIATORS}, + {"references", WSMAN_ACTION_REFERENCES}, {"test", WSMAN_ACTION_TEST}, {NULL, 0}, }; @@ -309,10 +309,6 @@ static char wsman_parse_options(int argc, char **argv) "CIM binding Enumeration Mode", "none|include|exclude"}, {"cim-extensions", 'T', U_OPTION_ARG_NONE, &cim_extensions, "Show CIM Extensions", NULL}, - {"references", 'W', U_OPTION_ARG_NONE, &cim_references, - "CIM References", NULL}, - {"associators", 'w', U_OPTION_ARG_NONE, &cim_associators, - "CIM Associators", NULL}, {NULL} }; @@ -645,12 +641,7 @@ int main(int argc, char **argv) if (fragment) { options->fragment = fragment; } - if (wsm_filter) { - options->filter = wsm_filter; - } - if (wsm_dialect) { - options->dialect = wsm_dialect; - } + options->properties = wsman_options_get_properties(); options->cim_ns = cim_namespace; if (cim_extensions) { @@ -753,7 +744,22 @@ int main(int argc, char **argv) ws_xml_destroy_doc(doc); } break; + case WSMAN_ACTION_ASSOCIATORS: + case WSMAN_ACTION_REFERENCES: case WSMAN_ACTION_ENUMERATION: + if ( op == WSMAN_ACTION_REFERENCES || op == WSMAN_ACTION_ASSOCIATORS ) { + if (wsm_filter) { + epr_t *epr = epr_from_string(wsm_filter); + if(options->cim_ns) { + epr_add_selector_text(epr, CIM_NAMESPACE_SELECTOR, options->cim_ns); + } + if (epr) { + options->filter = filter_create_assoc(epr, (op == WSMAN_ACTION_REFERENCES )?0:1, NULL, NULL, NULL, NULL, NULL, 0 ); + } + } else { + error("Filter Requied"); + } + } enumeration_mode = enum_mode; binding_enumeration_mode = @@ -782,16 +788,6 @@ int main(int argc, char **argv) wsmc_set_action_option(options, FLAG_POLYMORPHISM_NONE); } - if (cim_references) { - wsmc_set_action_option(options, - FLAG_CIM_REFERENCES); - wsmc_set_dialect(WSM_ASSOCIATION_FILTER_DIALECT, options); - } - if (cim_associators) { - wsmc_set_action_option(options, - FLAG_CIM_ASSOCIATORS); - wsmc_set_dialect(WSM_ASSOCIATION_FILTER_DIALECT, options); - } if (enum_optimize) { wsmc_set_action_option(options, FLAG_ENUMERATION_OPTIMIZATION); @@ -860,8 +856,10 @@ int main(int argc, char **argv) options->heartbeat_interval = event_heartbeat; if(event_subscription_expire) options->expires = event_subscription_expire; + /* if(wsm_dialect) options->dialect = wsm_dialect; + */ if(event_reference_properties) options->reference = event_reference_properties; rqstDoc = wsmc_action_subscribe(cl, resource_uri, options); -- cgit