version 1.51, 2006/05/24 20:42:21
|
version 1.52, 2006/06/21 21:54:56
|
|
|
#include <Pegasus/ProviderManager2/JMPI/JMPIProviderModule.h> | #include <Pegasus/ProviderManager2/JMPI/JMPIProviderModule.h> |
#include <Pegasus/ProviderManager2/ProviderManagerService.h> | #include <Pegasus/ProviderManager2/ProviderManagerService.h> |
| |
#include <Pegasus/ProviderManager2/CMPI/CMPI_SelectExp.h> |
|
|
|
|
|
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
return 0; | return 0; |
} | } |
| |
CMPI_SelectExp * |
WQLSelectStatement * |
newSelectExp (CIMOMHandleQueryContext *qContext, |
newSelectExp (String& query, |
OperationContext *ctx, |
String& queryLanguage) |
String& query, |
|
String& queryLanguage, |
|
CIMNamespaceName& nameSpace, |
|
Array<CIMName>& classNames, |
|
CIMPropertyList& propertyList) |
|
{ | { |
CMPI_SelectExp *eSelx = NULL; |
WQLSelectStatement *stmt = new WQLSelectStatement (queryLanguage, query); |
| |
eSelx = new CMPI_SelectExp (*ctx, |
try |
qContext, |
|
query, |
|
queryLanguage); |
|
|
|
if (!eSelx) |
|
{ | { |
return eSelx; |
WQLParser::parse (query, *stmt); |
} | } |
|
catch (const Exception &e) |
for (Uint32 i = 0, n = classNames.size (); i < n; i++) |
|
{ | { |
CIMObjectPath className (System::getHostName(), |
cerr << "Error: newSelectExp caught: " << e.getMessage () << endl; |
nameSpace, |
|
classNames[i]); |
|
|
|
eSelx->classNames.append (className); |
|
} |
|
|
|
if (!propertyList.isNull ()) |
|
{ |
|
Array<CIMName> p = propertyList.getPropertyNameArray (); |
|
int pCount = p.size (); |
|
|
|
eSelx->props = (const char**)malloc ((1 + pCount) * sizeof (char*)); |
|
|
|
for (int i = 0; i < pCount; i++) |
|
{ |
|
eSelx->props[i] = strdup (p[i].getString ().getCString ()); |
|
} |
|
|
|
eSelx->props[pCount] = NULL; |
|
} | } |
| |
return eSelx; |
return stmt; |
} | } |
| |
Message * JMPIProviderManager::handleCreateSubscriptionRequest(const Message * message) throw() | Message * JMPIProviderManager::handleCreateSubscriptionRequest(const Message * message) throw() |
|
|
| |
CIMOMHandleQueryContext *qContext = new CIMOMHandleQueryContext (CIMNamespaceName (request->nameSpace.getString ()), | CIMOMHandleQueryContext *qContext = new CIMOMHandleQueryContext (CIMNamespaceName (request->nameSpace.getString ()), |
*pr._cimom_handle); | *pr._cimom_handle); |
CMPI_SelectExp *eSelx = newSelectExp (qContext, |
|
prec->ctx, |
|
srec->query, |
|
srec->queryLanguage, |
|
request->nameSpace, |
|
request->classNames, |
|
srec->propertyList); |
|
|
|
srec->eSelx = eSelx; |
|
srec->qContext = qContext; | srec->qContext = qContext; |
| |
CIMObjectPath sPath (request->subscriptionInstance.getPath ().getClassName ().getString ()); | CIMObjectPath sPath (request->subscriptionInstance.getPath ().getClassName ().getString ()); |
|
|
| |
selxTab.insert (sPath.toString (), srec); | selxTab.insert (sPath.toString (), srec); |
| |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateSubscriptionRequest: For selxTab "<<sPath.toString ()<<", srec = "<<PEGASUS_STD(hex)<<(int)srec<<PEGASUS_STD(dec)<<", eSelx = "<<PEGASUS_STD(hex)<<(int)eSelx<<PEGASUS_STD(dec)<<", qContext = "<<PEGASUS_STD(hex)<<(int)qContext<<PEGASUS_STD(dec)<<PEGASUS_STD(endl)); |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateSubscriptionRequest: For selxTab "<<sPath.toString ()<<", srec = "<<PEGASUS_STD(hex)<<(int)srec<<PEGASUS_STD(dec)<<", qContext = "<<PEGASUS_STD(hex)<<(int)qContext<<PEGASUS_STD(dec)<<PEGASUS_STD(endl)); |
} | } |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.createSubscriptionRequest: " + pr.getName()); | PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.createSubscriptionRequest: " + pr.getName()); |
|
|
{ | { |
case METHOD_EVENTPROVIDER: | case METHOD_EVENTPROVIDER: |
{ | { |
CMPI_SelectExp *eSelx = newSelectExp (srec->qContext, |
WQLSelectStatement *stmt = newSelectExp (srec->query, |
prec->ctx, |
srec->queryLanguage); |
srec->query, |
jint jStmtRef = DEBUG_ConvertCToJava (CMPI_SelectExp*, jint, stmt); |
srec->queryLanguage, |
jobject jSelectExp = env->NewObject(jv->SelectExpClassRef,jv->SelectExpNewI,jStmtRef); |
request->nameSpace, |
|
request->classNames, |
|
srec->propertyList); |
|
jint jEselxRef = DEBUG_ConvertCToJava (CMPI_SelectExp*, jint, eSelx); |
|
jobject jEselx = env->NewObject(jv->SelectExpClassRef,jv->SelectExpNewI,jEselxRef); |
|
| |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
|
|
| |
env->CallVoidMethod ((jobject)pr.jProvider, | env->CallVoidMethod ((jobject)pr.jProvider, |
id, | id, |
jEselx, |
jSelectExp, |
jType, | jType, |
jcop, | jcop, |
(jboolean)fNewPrec); | (jboolean)fNewPrec); |
|
|
jint jocRef = DEBUG_ConvertCToJava (OperationContext*, jint, &request->operationContext); | jint jocRef = DEBUG_ConvertCToJava (OperationContext*, jint, &request->operationContext); |
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewI,jocRef); | jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewI,jocRef); |
| |
CMPI_SelectExp *eSelx = newSelectExp (srec->qContext, |
WQLSelectStatement *stmt = newSelectExp (srec->query, |
prec->ctx, |
srec->queryLanguage); |
srec->query, |
jint jStmtRef = DEBUG_ConvertCToJava (CMPI_SelectExp*, jint, stmt); |
srec->queryLanguage, |
jobject jSelectExp = env->NewObject(jv->SelectExpClassRef,jv->SelectExpNewI,jStmtRef); |
request->nameSpace, |
|
request->classNames, |
|
srec->propertyList); |
|
jint jEselxRef = DEBUG_ConvertCToJava (CMPI_SelectExp*, jint, eSelx); |
|
jobject jEselx = env->NewObject(jv->SelectExpClassRef,jv->SelectExpNewI,jEselxRef); |
|
| |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
|
|
env->CallVoidMethod ((jobject)pr.jProvider, | env->CallVoidMethod ((jobject)pr.jProvider, |
id, | id, |
joc, | joc, |
jEselx, |
jSelectExp, |
jType, | jType, |
jcop, | jcop, |
(jboolean)fNewPrec); | (jboolean)fNewPrec); |
|
|
| |
selxTab.lookup (sPathString, srec); | selxTab.lookup (sPathString, srec); |
| |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: For selxTab "<<sPathString<<", srec = "<<PEGASUS_STD(hex)<<(int)srec<<PEGASUS_STD(dec)<<", eSelx = "<<PEGASUS_STD(hex)<<(int)srec->eSelx<<PEGASUS_STD(dec)<<", qContext = "<<PEGASUS_STD(hex)<<(int)srec->qContext<<PEGASUS_STD(dec)<<PEGASUS_STD(endl)); |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: For selxTab "<<sPathString<<", srec = "<<PEGASUS_STD(hex)<<(int)srec<<PEGASUS_STD(dec)<<", qContext = "<<PEGASUS_STD(hex)<<(int)srec->qContext<<PEGASUS_STD(dec)<<PEGASUS_STD(endl)); |
| |
selxTab.remove (sPathString); | selxTab.remove (sPathString); |
} | } |
|
|
{ | { |
case METHOD_EVENTPROVIDER: | case METHOD_EVENTPROVIDER: |
{ | { |
CMPI_SelectExp *eSelx = newSelectExp (srec->qContext, |
WQLSelectStatement *stmt = newSelectExp (srec->query, |
prec->ctx, |
srec->queryLanguage); |
srec->query, |
jint jStmtRef = DEBUG_ConvertCToJava (CMPI_SelectExp*, jint, stmt); |
srec->queryLanguage, |
jobject jSelectExp = env->NewObject(jv->SelectExpClassRef,jv->SelectExpNewI,jStmtRef); |
request->nameSpace, |
|
request->classNames, |
|
srec->propertyList); |
|
jint jEselxRef = DEBUG_ConvertCToJava (CMPI_SelectExp*, jint, eSelx); |
|
jobject jEselx = env->NewObject(jv->SelectExpClassRef,jv->SelectExpNewI,jEselxRef); |
|
| |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
|
|
| |
env->CallVoidMethod ((jobject)pr.jProvider, | env->CallVoidMethod ((jobject)pr.jProvider, |
id, | id, |
jEselx, |
jSelectExp, |
jType, | jType, |
jcop, | jcop, |
(jboolean)fFreePrec); | (jboolean)fFreePrec); |
|
|
jint jocRef = DEBUG_ConvertCToJava (OperationContext*, jint, &request->operationContext); | jint jocRef = DEBUG_ConvertCToJava (OperationContext*, jint, &request->operationContext); |
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewI,jocRef); | jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewI,jocRef); |
| |
CMPI_SelectExp *eSelx = newSelectExp (srec->qContext, |
WQLSelectStatement *stmt = newSelectExp (srec->query, |
prec->ctx, |
srec->queryLanguage); |
srec->query, |
jint jStmtRef = DEBUG_ConvertCToJava (CMPI_SelectExp*, jint, stmt); |
srec->queryLanguage, |
jobject jSelectExp = env->NewObject(jv->SelectExpClassRef,jv->SelectExpNewI,jStmtRef); |
request->nameSpace, |
|
request->classNames, |
|
srec->propertyList); |
|
jint jEselxRef = DEBUG_ConvertCToJava (CMPI_SelectExp*, jint, eSelx); |
|
jobject jEselx = env->NewObject(jv->SelectExpClassRef,jv->SelectExpNewI,jEselxRef); |
|
| |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
|
|
env->CallVoidMethod ((jobject)pr.jProvider, | env->CallVoidMethod ((jobject)pr.jProvider, |
id, | id, |
joc, | joc, |
jEselx, |
jSelectExp, |
jType, | jType, |
jcop, | jcop, |
(jboolean)fFreePrec); | (jboolean)fFreePrec); |
|
|
| |
if (srec) | if (srec) |
{ | { |
if ( srec->eSelx |
|
&& srec->eSelx->props |
|
) |
|
{ |
|
const char **props = srec->eSelx->props; |
|
|
|
while (*props) |
|
{ |
|
const char *prop = *props; |
|
|
|
props++; |
|
|
|
if (prop) |
|
{ |
|
free ((void *)prop); |
|
} |
|
} |
|
|
|
free ((void *)srec->eSelx->props); |
|
} |
|
delete srec->eSelx; |
|
delete srec->qContext; | delete srec->qContext; |
} | } |
delete srec; | delete srec; |