/** * @brief Return module $name:$stream:$version:$context:$arch. * * @return std::string */ std::string ModulePackage::getFullIdentifier() const { std::ostringstream ss; ss << getName() << ":" << getStream() << ":" << getVersion() << ":" << getContext() << ":" << getArch(); return ss.str(); }
static PyObject * iter(_NevraObject *self) { PyObject *res; auto nevra = self->nevra; if (nevra->getEpoch() == -1) { Py_INCREF(Py_None); res = Py_BuildValue("zOzzz", nevra->getName().c_str(), Py_None, nevra->getVersion().c_str(), nevra->getRelease().c_str(), nevra->getArch().c_str()); } else res = Py_BuildValue("zizzz", nevra->getName().c_str(), nevra->getEpoch(), nevra->getVersion().c_str(), nevra->getRelease().c_str(), nevra->getArch().c_str()); PyObject *iter = PyObject_GetIter(res); Py_DECREF(res); return iter; }
static RPMItemPtr nevraToRPMItem(SQLite3Ptr conn, std::string nevra) { auto nevraObject = new Nevra; if (hy_nevra_possibility(nevra.c_str(), HY_FORM_NEVRA, nevraObject)) { return nullptr; } if (nevraObject->getEpoch() < 0) { nevraObject->setEpoch(0); } auto rpm = std::make_shared< RPMItem >(conn); rpm->setName(nevraObject->getName()); rpm->setEpoch(nevraObject->getEpoch()); rpm->setVersion(nevraObject->getVersion()); rpm->setRelease(nevraObject->getRelease()); rpm->setArch(nevraObject->getArch()); return rpm; }
/* * This method will initialize the JVM. If there is already an active JVM * running, it will just attach to it. If there isn't an active JVM, it will * create and start a new one */ void Runtime::initializeJVM() throw( HLA::RTIinternalError ) { logger->debug( "Initialize the JVM" ); /////////////////////////////////////////// // 1. get the classpath and library path // /////////////////////////////////////////// pair<string,string> paths = this->generatePaths(); logger->debug( "Using Classpath : %s", paths.first.c_str() ); logger->debug( "Using Library Path: %s", paths.second.c_str() ); ///////////////////////////////////////////// // 2. check to see if a JVM already exists // ///////////////////////////////////////////// // other jvm options - remember to increment the option array size // if you are going to add more string stackSize( "-Xss8m" ); string mode = getMode(); string compiler = getCompiler(); string hlaVersion = getHlaVersion(); string architecture = getArch(); // before we can create or connect to the JVM, we need to specify its environment JavaVMInitArgs vmargs; JavaVMOption options[7]; options[0].optionString = const_cast<char*>(paths.first.c_str()); options[1].optionString = const_cast<char*>(paths.second.c_str()); options[2].optionString = const_cast<char*>(mode.c_str()); // build mode options[3].optionString = const_cast<char*>(compiler.c_str()); // compiler version options[4].optionString = const_cast<char*>(hlaVersion.c_str()); // hla interface version options[5].optionString = const_cast<char*>(architecture.c_str()); // architecture options[6].optionString = const_cast<char*>(stackSize.c_str()); vmargs.nOptions = 7; vmargs.version = JNI_VERSION_1_6; vmargs.options = options; vmargs.ignoreUnrecognized = JNI_TRUE; // Before we create the JVM, we will check to see if one already exists or // not. If there is an existing one, we will just attach to it rather than // creating a separate one. jint result; jsize jvmCount = 0; result = JNI_GetCreatedJavaVMs( &jvm, 1, &jvmCount ); if( this->jvm != NULL && jvmCount > 0 && result == JNI_OK ) { /////////////////////////////////////////////////////////////// // JVM already exists, just attach to the existing reference // /////////////////////////////////////////////////////////////// logger->debug( "[check] JVM already exists, attaching to it" ); result = jvm->AttachCurrentThread( (void**)&jvmenv, &vmargs ); // check the result if( result < 0 ) { logger->fatal( "*** JVM already existed, but we failed to attach ***" ); logger->fatal( " result=%d", result ); throw HLA::RTIinternalError( "*** JVM already existed, but we failed to attach ***" ); } // we're all attached just fine, so let's get out of here this->attached = true; return; } ////////////////////////////////// // 3. create a new JVM instance // ////////////////////////////////// // JVM doesn't exist yet, create a new one to work with logger->debug( "[check] JVM doesn't exist, creating a new one" ); result = JNI_CreateJavaVM( &jvm, (void**)&jvmenv, &vmargs ); if( result < 0 ) { logger->fatal( "*** Couldn't create a new JVM! *** result=%d", result ); throw HLA::RTIinternalError( "*** Couldn't create a new JVM! ***" ); } logger->info( "New JVM has been created" ); }