示例#1
1
mama_status
msgUtils_getIssueSymbol (mamaMsg msg, const char** result)
{
    mama_status status = MAMA_STATUS_OK;

    if(MAMA_STATUS_OK!=(status=mamaMsg_getString( msg, NULL, 305, result)))
    {
        mama_log (MAMA_LOG_LEVEL_FINE, "Could not get wIssueSymbol [%s]."
                  "Trying wIndexSymbol.", mamaMsgStatus_stringForStatus (status));
        /*The symbol might be in wIndexSymbol*/
        status = mamaMsg_getString (msg, NULL, 293, result);
    }

    return status;
}
int mamaCapture_openFile(mamaPlaybackCapture* mamaCapture,
                         const char* fileName)
{
    mama_status status = MAMA_STATUS_OK;
    mamaCaptureConfigImpl* impl = (mamaCaptureConfigImpl*)*mamaCapture;

    mamaCapture_setFileName (mamaCapture,&fileName);

    if ((impl->myPlayBackFileName[0] != '/') &&
        (impl->myPlayBackFileName[0] != '.'))
    {
        mama_log (MAMA_LOG_LEVEL_FINE,
                  "mamaCapture_openFile: opening file: %s",
                  impl->myPlayBackFileName);
        myPlaybackFile = fopen(impl->myPlayBackFileName,"w");

        mama_log (MAMA_LOG_LEVEL_FINE,
                  "mamaCapture_openFile: file  %s succesfully opened.",
                  impl->myPlayBackFileName);
    }
    if (!(myPlaybackFile))
    {
        status = MAMA_STATUS_INVALID_ARG;
        mama_log (MAMA_LOG_LEVEL_FINE,
                  "mamaCapture_openFile: %s error: unable to open file %s",
                  mamaMsgStatus_stringForStatus(status),
                  impl->myPlayBackFileName);
    }
    return  status;
}
示例#3
0
mama_status openWombatFile(
  const char*        fileName,
  const char*        mode,
  FILE**             file)
{ 
  FILE*        f          = NULL;
  mama_status status = MAMA_STATUS_OK;
  
  if ((fileName[0] != '/') && (fileName[0] != '.') && (fileName[1] != ':'))
  {
    /* Not an absolute pathname or an explicit relative pathname
     * so try to find it in $WOMBAT_PATH. */
    char* wombatPath = getenv ("WOMBAT_PATH");

    if (wombatPath)
    {
      char tmpFileName[1024];

      snprintf (tmpFileName, 1024, "%s%s%s", wombatPath, PATHSEP, fileName);
      mama_log (MAMA_LOG_LEVEL_FINE,
		"openWombatFile: checking for file: %s", 
		tmpFileName);
      f = fopen (tmpFileName, mode);
    }
  }
  if (!f)
  {
    mama_log (MAMA_LOG_LEVEL_FINE,
	      "openWombatFile: checking for file: %s", fileName);
    f = fopen (fileName, mode);
  }
  if (!f)
  {
    status = MAMA_STATUS_INVALID_ARG;
    mama_log (MAMA_LOG_LEVEL_FINE,
	      "openWombatFile: %s error: unable to open file %s", 
              mamaMsgStatus_stringForStatus(status), fileName);
  }
  else
  {
      mama_log (MAMA_LOG_LEVEL_FINE,
                "openWombatFile: sucessfully opened file %s", fileName);
      *file = f;
  }
  return status;
}
示例#4
0
static void 
processMsg( mamaDictionary dictionary, const mamaMsg msg )
{
    mamaMsgStatus     msgStatus = -1;
    mamaMsgType       msgType = -1;

    msgStatus = mamaMsgStatus_statusForMsg( msg ); 
    msgType   = mamaMsgType_typeForMsg( msg );

    if( msgStatus == MAMA_MSG_STATUS_TIMEOUT )
    {
        self->mCallbackSet.onTimeout( dictionary, self->mClosure );
        return;
    }

    if( msgStatus != MAMA_MSG_STATUS_OK && 
        msgType   != MAMA_MSG_TYPE_DDICT_SNAPSHOT &&
        msgType   != MAMA_MSG_TYPE_UPDATE ) 
    {
        char errBuf[1024];

        snprintf( errBuf, 1023, "Error: mamaDictionary: unexpected "
                                    "MsgType/MsgStatus: %s/%s\n",
               mamaMsgType_stringForType(msgType),
               mamaMsgStatus_stringForStatus(msgStatus));

        self->mCallbackSet.onError( dictionary, errBuf, self->mClosure );
        return;
    }

    mamaDictionary_buildDictionaryFromMessage( dictionary, msg );

    mamaSubscription_destroy (self->mSubscription);
    mamaSubscription_deallocate (self->mSubscription);
    self->mSubscription = NULL;

    /* do this last in case the dictionary transport is destroyed
       in the callback */
    self->mCallbackSet.onComplete( dictionary, self->mClosure );
}