version 1.41.2.3, 2006/05/17 20:57:39
|
version 1.41.2.4, 2006/06/23 17:44:59
|
|
|
#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 |
| |
|
|
| |
CIMClass *pcls = new CIMClass (cls); | CIMClass *pcls = new CIMClass (cls); |
| |
JMPIjvm::checkException(env); |
|
|
|
jint jcls = DEBUG_ConvertCToJava (CIMClass*, jint, pcls); | jint jcls = DEBUG_ConvertCToJava (CIMClass*, jint, pcls); |
| |
jobject jCc=env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewI,jcls); | jobject jCc=env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewI,jcls); |
| |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
jobjectArray jAr = (jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
jobject jVec = env->CallObjectMethod ((jobject)pr.jProvider, |
id, | id, |
joc, | joc, |
jcop, | jcop, |
|
|
} | } |
| |
handler.processing(); | handler.processing(); |
if (jAr) { |
if (jVec) |
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
{ |
|
for (int i = 0, m = env->CallIntMethod (jVec, JMPIjvm::jv.VectorSize); i < m; i++) |
|
{ |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
jobject jciRet = env->GetObjectArrayElement(jAr,i); |
jobject jciRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleExecQueryRequest: jciRet = "<<jciRet<<PEGASUS_STD(endl)); |
| |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
|
|
handler.deliver(*ciRet); | handler.deliver(*ciRet); |
} | } |
} | } |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleExecQueryRequest: done!"<<PEGASUS_STD(endl)); |
handler.complete(); | handler.complete(); |
break; | break; |
} | } |
|
|
| |
jint jql = 0; // @BUG - how to convert? | jint jql = 0; // @BUG - how to convert? |
| |
jobjectArray jVec = (jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
jobject jVec = env->CallObjectMethod ((jobject)pr.jProvider, |
id, | id, |
jcop, | jcop, |
jquery, | jquery, |
|
|
| |
handler.processing(); | handler.processing(); |
if (jVec) { | if (jVec) { |
for (int i=0,m=env->GetArrayLength(jVec); i<m; i++) { |
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
jobject jciRet = env->GetObjectArrayElement(jVec,i); |
jobject jciRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
| |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
|
|
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, |
|
qContext, |
|
query, |
|
queryLanguage); |
|
|
|
if (!eSelx) |
|
{ |
|
return eSelx; |
|
} |
|
| |
for (Uint32 i = 0, n = classNames.size (); i < n; i++) |
try |
{ | { |
CIMObjectPath className (System::getHostName(), |
WQLParser::parse (query, *stmt); |
nameSpace, |
|
classNames[i]); |
|
|
|
eSelx->classNames.append (className); |
|
} | } |
|
catch (const Exception &e) |
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 ()); |
cerr << "Error: newSelectExp caught: " << e.getMessage () << endl; |
} |
|
|
|
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; |