(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.12

version 1.1, 2004/04/30 10:27:25 version 1.12, 2006/01/30 16:18:10
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%2006////////////////////////////////////////////////////////////////////////
 // //
 // 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.
   // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; Symantec 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 44 
 #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 63 
      _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 76 
     _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 72 
Line 90 
  
 JMPIProvider::Status JMPIProvider::getStatus(void) const JMPIProvider::Status JMPIProvider::getStatus(void) const
 { {
       AutoMutex lock(_statusMutex);
     return(_status);     return(_status);
 } }
  
Line 88 
Line 107 
 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",  
       if (!env)
       {
           throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED,
                                          MessageLoaderParms("ProviderManager.JMPI.INIT_JVM_FAILED",
                                                             "Could not initialize the JVM (Java Virtual Machine) runtime environment."));
       }
   
       // 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");
   
       DDD(PEGASUS_STD(cout)
           <<"--- JMPIProvider::Initialize:id = "
           <<PEGASUS_STD(hex)
           <<(int)id
           <<PEGASUS_STD(dec)
           <<PEGASUS_STD(endl));
   
     JMPIjvm::checkException(env);     JMPIjvm::checkException(env);
     jobject hdl=env->NewObject(jv->CIMOMHandleClassRef,jv->CIMOMHandleNewI,(jint)&cimom);  
     env->CallVoidMethod((jobject)jProvider,id,hdl);      if (id != NULL)
       {
          jstring jName = env->NewStringUTF(_name.getCString());
   
          JMPIjvm::checkException(env);
   
          jint    jCimomRef = DEBUG_ConvertCToJava (CIMOMHandle*, jint, &cimom);
          jobject jch       = env->NewObject(jv->CIMOMHandleClassRef,
                                             JMPIjvm::jv.CIMOMHandleNewISt,
                                             jCimomRef,
                                             jName);
   
          JMPIjvm::checkException(env);
   
          env->CallVoidMethod((jobject)jProvider,id,jch);
   
          JMPIjvm::checkException(env);
       }
       env->ExceptionClear();
   
     JMPIjvm::detachThread();     JMPIjvm::detachThread();
  
     _status = INITIALIZED;     _status = INITIALIZED;
Line 169 
Line 227 
   // _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.12

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2