1 martin 1.6 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.7 //
|
3 martin 1.6 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.7 //
|
10 martin 1.6 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.7 //
|
17 martin 1.6 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.7 //
|
20 martin 1.6 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.7 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.6 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.7 //
|
28 martin 1.6 //////////////////////////////////////////////////////////////////////////
|
29 schuur 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #include <Pegasus/Common/Config.h>
33 #include <Pegasus/Common/String.h>
34
35 #include "QuerySupportRouter.h"
36
37 #include <Pegasus/Server/WQLOperationRequestDispatcher.h>
|
38 xinf.zhao 1.8 #include <Pegasus/Server/CQLOperationRequestDispatcher.h>
|
39 schuur 1.1
40 PEGASUS_NAMESPACE_BEGIN
41
|
42 karl 1.10 // Call the appropriate handleQueryRequest handler for the defined
43 // query language type or return false if the language type not supported.
|
44 schuur 1.1 Boolean QuerySupportRouter::routeHandleExecQueryRequest(
|
45 kumpf 1.5 CIMOperationRequestDispatcher* opThis,
|
46 karl 1.13 CIMExecQueryRequestMessage* msg,
47 CIMException& cimException,
48 EnumerationContext* enumerationContext)
|
49 kumpf 1.5 {
|
50 karl 1.13 bool rtnStat = false;
|
51 kumpf 1.5 if (msg->queryLanguage=="WQL")
|
52 karl 1.13 {
53 rtnStat = ((WQLOperationRequestDispatcher*)opThis)->handleQueryRequest(
54 msg,
55 cimException,
56 enumerationContext);
57 }
|
58 dev.meetei 1.9 #ifdef PEGASUS_ENABLE_CQL
|
59 xinf.zhao 1.8 else if(msg->queryLanguage == "DMTF:CQL")
|
60 karl 1.13 {
61 rtnStat = ((CQLOperationRequestDispatcher*)opThis)->handleQueryRequest(
62 msg,
63 cimException,
64 enumerationContext);
65 }
|
66 dev.meetei 1.9 #endif
|
67 karl 1.10 else
68 {
|
69 karl 1.13 if (msg->operationContext.contains(
70 SubscriptionFilterConditionContainer::NAME))
71 {
72 SubscriptionFilterConditionContainer sub_cntr =
73 msg->operationContext.get(
74 SubscriptionFilterConditionContainer::NAME);
75
76 cimException = PEGASUS_CIM_EXCEPTION(
77 CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED,
78 sub_cntr.getQueryLanguage());
79 }
80 else
81 {
82 cimException = PEGASUS_CIM_EXCEPTION(
83 CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED, msg->queryLanguage);
84 }
|
85 karl 1.10 return false;
86 }
|
87 schuur 1.1
|
88 karl 1.13 if (!rtnStat)
89 {
90 return false;
91 }
|
92 kumpf 1.5 return true;
|
93 schuur 1.1 }
94
|
95 karl 1.10 // Get pointer to the correct function. Note that since
96 // the queryLanguage has already been tested in
97 // routeHandleExecQueryRequest the assert should be unreachable.
|
98 dl.meetei 1.11
|
99 karl 1.10 applyQueryFunctionPtr QuerySupportRouter::getFunctPtr(
100 CIMOperationRequestDispatcher* opThis,
101 QueryExpressionRep* query)
|
102 kumpf 1.5 {
|
103 dl.meetei 1.11 if (query->getQueryLanguage() == "WQL")
|
104 karl 1.10 {
105 return &((WQLOperationRequestDispatcher*)opThis)->
106 applyQueryToEnumeration;
107 }
|
108 dev.meetei 1.9 #ifdef PEGASUS_ENABLE_CQL
|
109 xinf.zhao 1.8 else if(query->getQueryLanguage() == "DMTF:CQL")
|
110 karl 1.10 {
111 return &((CQLOperationRequestDispatcher*)opThis)->
112 applyQueryToEnumeration;
113 }
|
114 dl.meetei 1.11 #endif
|
115 karl 1.10 else
116 {
|
117 karl 1.13 PEGASUS_UNREACHABLE(PEGASUS_ASSERT(false);)
|
118 karl 1.10 }
|
119 schuur 1.1 }
120
121 PEGASUS_NAMESPACE_END
|