(file) Return to JMPIProvider.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / ProviderManager2 / JMPI

Diff for /pegasus/src/Pegasus/ProviderManager2/JMPI/JMPIProvider.cpp between version 1.1 and 1.9

version 1.1, 2004/04/30 10:27:25 version 1.9, 2005/06/02 20:36:40
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%2005////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,  // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // The Open Group, Tivoli Systems  // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
   // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation, The Open Group.
   // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; VERITAS Software Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 36 
Line 42 
 #include <Pegasus/ProviderManager2/JMPI/JMPIProviderModule.h> #include <Pegasus/ProviderManager2/JMPI/JMPIProviderModule.h>
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
   PEGASUS_USING_STD;
   
   #ifdef PEGASUS_DEBUG
   #define DDD(x) if (JMPIjvm::trace) x;
   #else
   #define DDD(x)
   #endif
  
   #include "Convert.h"
  
 // set current operations to 1 to prevent an unload // set current operations to 1 to prevent an unload
 // until the provider has had a chance to initialize // until the provider has had a chance to initialize
Line 47 
Line 61 
      _no_unload(0), _rm(0)      _no_unload(0), _rm(0)
 { {
    _current_operations = 1;    _current_operations = 1;
      _currentSubscriptions = 0;
    miVector=*mv;    miVector=*mv;
    jProvider=mv->jProvider;    jProvider=mv->jProvider;
    jProviderClass=mv->jProviderClass;    jProviderClass=mv->jProviderClass;
Line 59 
Line 74 
     _no_unload(0), _rm(0)     _no_unload(0), _rm(0)
 { {
    _current_operations = 1;    _current_operations = 1;
      _currentSubscriptions = 0;
    miVector=pr->miVector;    miVector=pr->miVector;
    _cimom_handle=new CIMOMHandle();    _cimom_handle=new CIMOMHandle();
    noUnload=pr->noUnload;    noUnload=pr->noUnload;
Line 88 
Line 104 
 void JMPIProvider::initialize(CIMOMHandle& cimom) void JMPIProvider::initialize(CIMOMHandle& cimom)
 { {
     _status = INITIALIZING;     _status = INITIALIZING;
   
     _cimom_handle=&cimom;     _cimom_handle=&cimom;
     JvmVector *jv;  
     std::cerr<<"--- JMPIProvider::Initialize()"<<std::endl;      DDD(PEGASUS_STD(cout)<<"--- JMPIProvider::Initialize()"<<PEGASUS_STD(endl));
   
       JvmVector *jv  = 0;
     JNIEnv *env=JMPIjvm::attachThread(&jv);     JNIEnv *env=JMPIjvm::attachThread(&jv);
     jmethodID id=env->GetMethodID((jclass)jProviderClass,"initialize",  
       // public abstract void initialize (org.pegasus.jmpi.CIMOMHandle ch)
       //        throws org.pegasus.jmpi.CIMException
       jmethodID id = env->GetMethodID((jclass)jProviderClass,
                                       "initialize",
        "(Lorg/pegasus/jmpi/CIMOMHandle;)V");        "(Lorg/pegasus/jmpi/CIMOMHandle;)V");
   
     JMPIjvm::checkException(env);     JMPIjvm::checkException(env);
     jobject hdl=env->NewObject(jv->CIMOMHandleClassRef,jv->CIMOMHandleNewI,(jint)&cimom);  
       jstring jName = env->NewStringUTF(_name.getCString());
   
       JMPIjvm::checkException(env);
   
       jint    jCimom = DEBUG_ConvertCToJava (CIMOMHandle*, jint, &cimom); //@BUG? Is cimom stack allocated?  If so, needs to be newed!
       jobject hdl    = env->NewObject(jv->CIMOMHandleClassRef,JMPIjvm::jv.CIMOMHandleNewISt,jCimom,jName);
   
     env->CallVoidMethod((jobject)jProvider,id,hdl);     env->CallVoidMethod((jobject)jProvider,id,hdl);
   
     JMPIjvm::detachThread();     JMPIjvm::detachThread();
  
     _status = INITIALIZED;     _status = INITIALIZED;
Line 169 
Line 199 
   // _no_unload--;   // _no_unload--;
 } }
  
   Boolean JMPIProvider::testIfZeroAndIncrementSubscriptions ()
   {
       AutoMutex lock (_currentSubscriptionsMutex);
       Boolean isZero = (_currentSubscriptions == 0);
       _currentSubscriptions++;
   
       return isZero;
   }
   
   Boolean JMPIProvider::decrementSubscriptionsAndTestIfZero ()
   {
       AutoMutex lock (_currentSubscriptionsMutex);
       _currentSubscriptions--;
       Boolean isZero = (_currentSubscriptions == 0);
   
       return isZero;
   }
   
   Boolean JMPIProvider::testSubscriptions ()
   {
       AutoMutex lock (_currentSubscriptionsMutex);
       Boolean currentSubscriptions = (_currentSubscriptions > 0);
   
       return currentSubscriptions;
   }
   
   void JMPIProvider::resetSubscriptions ()
   {
       AutoMutex lock (_currentSubscriptionsMutex);
       _currentSubscriptions = 0;
   }
   
   void JMPIProvider::setProviderInstance (const CIMInstance & instance)
   {
       _providerInstance = instance;
   }
   
   CIMInstance JMPIProvider::getProviderInstance ()
   {
       return _providerInstance;
   }
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.1  
changed lines
  Added in v.1.9

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2