/************************************************************************** * FUNCTION: U_printSaAmfCSIActiveDescriptor * TYPE: internal function * OVERVIEW: * INTERFACE: * parameters: TODO * returns: none * NOTE: *************************************************************************/ void U_printSaAmfCSIActiveDescriptor(const char *msg, const SaAmfCSIActiveDescriptorT *activeDescriptorPtr) { _TRACE_INLINE("%s", msg); _TRACE2("\t\ttransitionDescriptor: "); switch (activeDescriptorPtr->transitionDescriptor) { case SA_AMF_CSI_NEW_ASSIGN: _TRACE2("CSI NEW ASSIGN (%d)\n", activeDescriptorPtr->transitionDescriptor); break; case SA_AMF_CSI_QUIESCED: _TRACE2("CSI QUIESCED (%d)\n", activeDescriptorPtr->transitionDescriptor); break; case SA_AMF_CSI_NOT_QUIESCED: _TRACE2("CSI NOT QUIESCED (%d)\n", activeDescriptorPtr->transitionDescriptor); break; case SA_AMF_CSI_STILL_ACTIVE: _TRACE2("CSI STILL ACTIVE (%d)\n", activeDescriptorPtr->transitionDescriptor); break; default: _TRACE2("CSI INVALID!!! (%d)\n", activeDescriptorPtr->transitionDescriptor); break; } U_printSaName("\t\tactiveCompName: ", &activeDescriptorPtr->activeCompName); }
/************************************************************************** * FUNCTION: U_printSaAmfCSIDescriptor * TYPE: internal function * OVERVIEW: * INTERFACE: * parameters: TODO * returns: none * NOTE: *************************************************************************/ void U_printSaAmfCSIDescriptor(const char *msg, const SaAmfHAStateT haState, const SaAmfCSIDescriptorT *csiDescriptorPtr) { _TRACE_INLINE("%s", msg); U_printSaAmfCSIFlags("\tcsiFlags: ", csiDescriptorPtr->csiFlags); if (csiDescriptorPtr->csiFlags != SA_AMF_CSI_TARGET_ALL) { U_printSaName("\tcsiName: ", &csiDescriptorPtr->csiName); } if (haState == SA_AMF_HA_ACTIVE) { U_printSaAmfCSIActiveDescriptor("\tActive csiStateDescriptor: ", &(csiDescriptorPtr-> csiStateDescriptor. activeDescriptor)); } if (haState == SA_AMF_HA_STANDBY) { U_printSaAmfCSIStandbyDescriptor ("\tStandby csiStateDescriptor: ", &(csiDescriptorPtr->csiStateDescriptor.standbyDescriptor)); } if (csiDescriptorPtr->csiFlags == SA_AMF_CSI_ADD_ONE) { U_printSaAmfCSIAttributeList("\tcsi attributes: ", &(csiDescriptorPtr->csiAttr)); } }
/************************************************************************** * FUNCTION: U_printSaAmfCSIStandbyDescriptor * TYPE: internal function * OVERVIEW: * INTERFACE: * parameters: TODO * returns: none * NOTE: *************************************************************************/ void U_printSaAmfCSIStandbyDescriptor(const char *msg, const SaAmfCSIStandbyDescriptorT *standbyDescriptorPtr) { _TRACE_INLINE("%s", msg); U_printSaName("\t\tactiveCompName: ", &standbyDescriptorPtr->activeCompName); _TRACE2("\t\tstandbyRank: %u\n", (unsigned int)standbyDescriptorPtr->standbyRank); }
/************************************************************************** * FUNCTION: U_printSaClusterNode_4 * TYPE: internal function * OVERVIEW: * INTERFACE: * parameters: TODO * returns: none * NOTE: *************************************************************************/ void U_printSaClusterNode_4(const char *msg, const SaClmClusterNodeT_4 *saClusterNodePtr) { // BODY _TRACE_INLINE("%s", msg); _TRACE2("NATIVE: \t\t\tnodeId:%u\n", (unsigned int)saClusterNodePtr->nodeId); U_printSaNodeAddress("NATIVE: \t\t\tnodeAddress: ", &(saClusterNodePtr->nodeAddress)); U_printSaName("NATIVE: \t\t\tnodeName: ", &(saClusterNodePtr->nodeName)); _TRACE2("NATIVE: \t\t\tmember: %d\n", saClusterNodePtr->member); _TRACE2("NATIVE: \t\t\tbootTimestamp:%lu\n", (unsigned long)saClusterNodePtr->bootTimestamp); _TRACE2("NATIVE: \t\t\tinitialViewNumber:%lu\n", (unsigned long)saClusterNodePtr->initialViewNumber); }
/************************************************************************** * FUNCTION: Java_org_opensaf_ais_amf_CsiManagerImpl_getHaState * TYPE: native method * Class: ais_amf_CsiManager * Method: getHaState * Signature: (Ljava/lang/String;Ljava/lang/String;)Lorg/saforum/ais/amf/HaState; *************************************************************************/ JNIEXPORT jobject JNICALL Java_org_opensaf_ais_amf_CsiManagerImpl_getHaState(JNIEnv *jniEnv, jobject thisCsiManager, jstring componentName, jstring csiName) { // VARIABLES SaNameT _saComponentName; SaNameT *_saComponentNamePtr = &_saComponentName; SaNameT _saCsiName; SaNameT *_saCsiNamePtr = &_saCsiName; SaAmfHandleT _saAmfHandle; SaAmfHAStateT _saHaState = SA_AMF_HA_QUIESCING + 1; // this is an invalid value... SaAisErrorT _saStatus; // JNI jobject _amfLibraryHandle; jobject _haState; // BODY assert(thisCsiManager != NULL); _TRACE2 ("NATIVE: Executing Java_org_opensaf_ais_amf_CsiManagerImpl_getHaState()\n"); // get Java library handle _amfLibraryHandle = (*jniEnv)->GetObjectField(jniEnv, thisCsiManager, FID_amfLibraryHandle); assert(_amfLibraryHandle != NULL); // get native library handle _saAmfHandle = (SaAmfHandleT)(*jniEnv)->GetLongField(jniEnv, _amfLibraryHandle, FID_saAmfHandle); // copy Java component name object if (JNU_copyFromStringToSaNameT(jniEnv, componentName, &_saComponentNamePtr) != JNI_TRUE) { return NULL; // EXIT POINT! Exception pending... } U_printSaName("NATIVE: component name is ", _saComponentNamePtr); // copy Java CSI name object if (JNU_copyFromStringToSaNameT(jniEnv, csiName, &_saCsiNamePtr) != JNI_TRUE) { return NULL; // EXIT POINT! Exception pending... } U_printSaName("NATIVE: CSI name is ", _saCsiNamePtr); _TRACE2 ("NATIVE: _saHaState before calling saAmfHAStateGet(...) is: %d\n", _saHaState); // call saAmfHAStateGet _saStatus = saAmfHAStateGet(_saAmfHandle, _saComponentNamePtr, _saCsiNamePtr, &_saHaState); _TRACE2 ("NATIVE: _saHaState after saAmfHAStateGet(...) has returned is: %d\n", _saHaState); _TRACE2("NATIVE: saAmfHAStateGet(...) has returned with %d...\n", _saStatus); // error handling if (_saStatus != SA_AIS_OK) { switch (_saStatus) { case SA_AIS_ERR_LIBRARY: JNU_throwNewByName(jniEnv, "org/saforum/ais/AisLibraryException", AIS_ERR_LIBRARY_MSG); break; case SA_AIS_ERR_TIMEOUT: JNU_throwNewByName(jniEnv, "org/saforum/ais/AisTimeoutException", AIS_ERR_TIMEOUT_MSG); break; case SA_AIS_ERR_TRY_AGAIN: JNU_throwNewByName(jniEnv, "org/saforum/ais/AisTryAgainException", AIS_ERR_TRY_AGAIN_MSG); break; case SA_AIS_ERR_BAD_HANDLE: JNU_throwNewByName(jniEnv, "org/saforum/ais/AisBadHandleException", AIS_ERR_BAD_HANDLE_MSG); break; case SA_AIS_ERR_INVALID_PARAM: JNU_throwNewByName(jniEnv, "org/saforum/ais/AisInvalidParamException", AIS_ERR_INVALID_PARAM_MSG); break; case SA_AIS_ERR_NO_MEMORY: JNU_throwNewByName(jniEnv, "org/saforum/ais/AisNoMemoryException", AIS_ERR_NO_MEMORY_MSG); break; case SA_AIS_ERR_NO_RESOURCES: JNU_throwNewByName(jniEnv, "org/saforum/ais/AisNoResourcesException", AIS_ERR_NO_RESOURCES_MSG); break; case SA_AIS_ERR_NOT_EXIST: JNU_throwNewByName(jniEnv, "org/saforum/ais/AisNotExistException", AIS_ERR_NOT_EXIST_MSG); break; default: // this should not happen here! assert(JNI_FALSE); JNU_throwNewByName(jniEnv, "org/saforum/ais/AisLibraryException", AIS_ERR_LIBRARY_MSG); break; } return NULL; // EXIT POINT! Exception pending... } // return HA state _haState = JNU_HaState_getEnum(jniEnv, _saHaState); if (_haState == NULL) { // this should not happen here! _TRACE2("NATIVE ERROR: _haState is NULL\n"); return NULL; // AisLibraryException thrown already... } U_printSaAmfHAState ("NATIVE: Java_org_opensaf_ais_amf_CsiManagerImpl_getHaState(...) returning normally with HA state: ", _saHaState); return _haState; }
/************************************************************************** * FUNCTION: Java_org_opensaf_ais_amf_ComponentRegistryImpl_invokeSaAmfComponentNameGet * TYPE: native method * Class: ais_amf_ComponentRegistry * Method: invokeSaAmfComponentNameGet * Signature: ()Ljava/lang/String; *************************************************************************/ JNIEXPORT jstring JNICALL Java_org_opensaf_ais_amf_ComponentRegistryImpl_invokeSaAmfComponentNameGet( JNIEnv* jniEnv, jobject thisComponentRegistry ) { // VARIABLES SaNameT _saComponentName; SaAmfHandleT _saAmfHandle; SaAisErrorT _saStatus; // JNI jobject _amfLibraryHandle; jstring _thisComponentName; // BODY assert( thisComponentRegistry != NULL ); _TRACE2( "NATIVE: Executing Java_org_opensaf_ais_amf_ComponentRegistryImpl_invokeSaAmfComponentNameGet(...)\n" ); // get Java library handle _amfLibraryHandle = (*jniEnv)->GetObjectField( jniEnv, thisComponentRegistry, FID_amfLibraryHandle ); assert( _amfLibraryHandle != NULL ); // get native library handle _saAmfHandle = (SaAmfHandleT) (*jniEnv)->GetLongField( jniEnv, _amfLibraryHandle, FID_saAmfHandle ); // call saAmfComponentNameGet _saStatus = saAmfComponentNameGet( _saAmfHandle, &_saComponentName ); _TRACE2( "NATIVE: saAmfComponentNameGet(...) has returned with %d...\n", _saStatus ); // error handling if( _saStatus != SA_AIS_OK ){ switch( _saStatus ){ case SA_AIS_ERR_LIBRARY: JNU_throwNewByName( jniEnv, "org/saforum/ais/AisLibraryException", AIS_ERR_LIBRARY_MSG ); break; case SA_AIS_ERR_TIMEOUT: JNU_throwNewByName( jniEnv, "org/saforum/ais/AisTimeoutException", AIS_ERR_TIMEOUT_MSG ); break; case SA_AIS_ERR_TRY_AGAIN: JNU_throwNewByName( jniEnv, "org/saforum/ais/AisTryAgainException", AIS_ERR_TRY_AGAIN_MSG ); break; case SA_AIS_ERR_BAD_HANDLE: JNU_throwNewByName( jniEnv, "org/saforum/ais/AisBadHandleException", AIS_ERR_BAD_HANDLE_MSG ); break; case SA_AIS_ERR_INVALID_PARAM: assert( JNI_FALSE ); JNU_throwNewByName( jniEnv, "org/saforum/ais/AisLibraryException", AIS_ERR_LIBRARY_MSG ); break; case SA_AIS_ERR_NO_MEMORY: JNU_throwNewByName( jniEnv, "org/saforum/ais/AisNoMemoryException", AIS_ERR_NO_MEMORY_MSG ); break; case SA_AIS_ERR_NO_RESOURCES: JNU_throwNewByName( jniEnv, "org/saforum/ais/AisNoResourcesException", AIS_ERR_NO_RESOURCES_MSG ); break; case SA_AIS_ERR_NOT_EXIST: JNU_throwNewByName( jniEnv, "org/saforum/ais/AisNotExistException", AIS_ERR_NOT_EXIST_MSG ); break; default: // this should not happen here! assert( JNI_FALSE ); JNU_throwNewByName( jniEnv, "org/saforum/ais/AisLibraryException", AIS_ERR_LIBRARY_MSG ); break; } return NULL; // EXIT POINT! Exception pending... } // return Component name _thisComponentName = JNU_newStringFromSaNameT( jniEnv, &_saComponentName ); if( _thisComponentName == NULL ){ // this should not happen here! assert( JNI_FALSE ); JNU_throwNewByName( jniEnv, "org/saforum/ais/AisLibraryException", AIS_ERR_LIBRARY_MSG ); return NULL; // EXIT POINT! Exception pending... } U_printSaName( "NATIVE: Java_org_opensaf_ais_amf_ComponentRegistryImpl_invokeSaAmfComponentNameGet(...) returning normally with Component name: ", &_saComponentName ); return _thisComponentName; }