示例#1
0
//______________________________________________________________________________
void CopyCDB(Int_t runnr, const char* fromURI, const char* toURI)
{
  TString allowedObjects;

//  allowedObjects += " HLT/ConfigMUON/DecisionComponent";
//  allowedObjects += " HLT/ConfigMUON/FieldIntegrals";
//  allowedObjects += " HLT/ConfigMUON/HitReconstructor";
//  allowedObjects += " HLT/ConfigMUON/MansoTrackerFSM";
//  allowedObjects += " HLT/ConfigMUON/TriggerReconstructor";
  
  /*
   
  allowedObjects += " GRP/Geometry/Data";
  allowedObjects += " GRP/CTP/Config";
  allowedObjects += " GRP/GRP/LHCData";
  allowedObjects += " GRP/CTP/Scalers";
  allowedObjects += " GRP/GRP/Data";
  allowedObjects += " GRP/Calib/MeanVertexSPD";
  allowedObjects += " GRP/CTP/Aliases";

  allowedObjects += " MUON/Calib/GlobalTriggerCrateConfig";
  allowedObjects += " MUON/Calib/LocalTriggerBoardMasks";
  allowedObjects += " MUON/Calib/MappingData";
  allowedObjects += " MUON/Calib/RegionalTriggerConfig";
  allowedObjects += " MUON/Calib/TriggerLut";
   
  allowedObjects += " MUON/Calib/Config";
  allowedObjects += " MUON/Calib/Gains";
  allowedObjects += " MUON/Calib/GlobalTriggerCrateConfig";
  allowedObjects += " MUON/Calib/HV";
  allowedObjects += " MUON/Calib/LocalTriggerBoardMasks";
  allowedObjects += " MUON/Calib/MappingRunData";
  allowedObjects += " MUON/Calib/Neighbours";
  allowedObjects += " MUON/Calib/OccupancyMap";
  allowedObjects += " MUON/Calib/Pedestals";
  allowedObjects += " MUON/Calib/RecoParam";
  allowedObjects += " MUON/Calib/RegionalTriggerConfig";
  allowedObjects += " MUON/Calib/RejectList";
  allowedObjects += " MUON/Calib/TriggerDCS";
  allowedObjects += " MUON/Calib/TriggerEfficiency";
  allowedObjects += " MUON/Calib/TriggerLut";
  allowedObjects += " MUON/Calib/MappingData";

  allowedObjects += " MUON/Align/Data";

  allowedObjects += " GRP/Align/Data";
  allowedObjects += " ITS/Align/Data";
  allowedObjects += " VZERO/Align/Data";
  allowedObjects += " FMD/Align/Data";  
  allowedObjects += " T0/Align/Data";
  allowedObjects += " TPC/Align/Data";
  allowedObjects += " TRD/Align/Data";
  allowedObjects += " TOF/Align/Data";
  allowedObjects += " ACORDE/Align/Data";

  allowedObjects += " HLT/Calib/esdLayout";
  allowedObjects += " HLT/Calib/RecoParam";
  allowedObjects += " HLT/Calib/StreamerInfo";
  allowedObjects += " PHOS/Align/Data";
  allowedObjects += " EMCAL/Align/Data";
  allowedObjects += " HMPID/Align/Data";
   allowedObjects += " ZDC/Align/Data";
   allowedObjects += " PMD/Align/Data";
   
   
  
  allowedObjects += " GRP/Calib/MeanVertexTPC";
  allowedObjects += " GRP/Calib/CosmicTriggers";
  allowedObjects += " GRP/Calib/LHCClockPhase";
  allowedObjects += " GRP/CTP/CTPtiming";
  allowedObjects += " GRP/CTP/TimeAlign";
  allowedObjects += " GRP/Calib/RecoParam";
  allowedObjects += " GRP/CTP/Aliases";

  allowedObjects += " ITS/Calib/RecoParam";
  allowedObjects += " ITS/Calib/SPDNoisy";
  allowedObjects += " ITS/Calib/SPDDead";
  allowedObjects += " ITS/Calib/SPDSparseDead";
  allowedObjects += " ITS/Calib/CalibSDD";
  allowedObjects += " ITS/Calib/RespSDD";
  allowedObjects += " ITS/Calib/DriftSpeedSDD";
  allowedObjects += " ITS/Calib/DDLMapSDD";
  allowedObjects += " ITS/Calib/MapsTimeSDD";
  allowedObjects += " ITS/Calib/NoiseSSD";
  allowedObjects += " ITS/Calib/GainSSD";
  allowedObjects += " ITS/Calib/BadChannelsSSD";
  allowedObjects += " ITS/Calib/SPDFOEfficiency";
  
  allowedObjects += " ITS/Calib/SPDFONoise";
  
  allowedObjects += " TRIGGER/SPD/PITConditions";
  
  allowedObjects += " AD/Align/Data";
  */
  
  AliCDBManager* cdb = AliCDBManager::Instance();
  // determine dynamically the current year
  TString fromUri(fromURI);
  cdb->SetDefaultStorage(fromUri.Data());
  cdb->SetRun(runnr);
  cdb->SetDrain(toURI);
  TString toUri(toURI);
  
  AliCDBStorage *defaultStorage = cdb->GetDefaultStorage();
  defaultStorage->QueryCDB(runnr);
  TObjArray* allIdsForRun = defaultStorage->GetQueryCDBList();
  TIter next(allIdsForRun);
  AliCDBId* id = 0;
  while ((id = dynamic_cast<AliCDBId*>(next())))
  {
    TString path(id->GetPath());
    if ( !allowedObjects.Contains(path.Data() ) ) continue;

    cdb->Get(path,cdb->GetRun());
  }
  
}
示例#2
0
int main(int argc, char* argv[])
{
    int port;
    int expiration;
    char* targetURI;
    char* eventType;
    char* contentType;
    char* realm;
    char* user;
    char* password;

   // Initialize logging.
   OsSysLog::initialize(0, "test");
   OsSysLog::setOutputFile(0, "log");
   OsSysLog::setLoggingPriority(PRI_DEBUG);
   OsSysLog::setLoggingPriorityForFacility(FAC_SIP_INCOMING_PARSED, PRI_ERR);

   if (!parseArgs(argc, argv, &port, &expiration,
                  &targetURI, &eventType, &contentType,
                  &realm, &user, &password))
   {
       usage(argv[0]);
       exit(1);
   }

   // The domain name to call myself, obtained from the gethostname()
   // system call.
   char buffer[100];
   memset(buffer, 0, sizeof (buffer));
   // Do not allow gethostname to write over the last NUL in buffer[].
   gethostname(buffer, (sizeof (buffer)) - 1);
   UtlString myDomainName(buffer, strlen(buffer));
   // Use "example.com" if gethostname() failed.
   if (myDomainName.isNull())
   {
      myDomainName = "example.com";
   }

   UtlString fromString = "sip:dialogwatch@" + myDomainName;
   Url fromUri(fromString, TRUE);

   // Create the SIP Subscribe Client

   SipLineMgr lineMgr;

   // Add credentials if they were specified.
   if (realm)
   {
      UtlString id;
      id += "sip:";
      id += user;
      id += "@";
      id += realm;
      Url identity(id, TRUE);

      SipLine line( fromUri  // user entered url
                   ,identity // identity url
                   ,user     // user
                   ,TRUE     // visible
                   ,SipLine::LINE_STATE_PROVISIONED
                   ,TRUE     // auto enable
                   ,FALSE    // use call handling
         );

      lineMgr.addLine(line);

      UtlString cred_input;
      UtlString cred_digest;

      cred_input.append(user);
      cred_input.append(":");
      cred_input.append(realm);
      cred_input.append(":");
      cred_input.append(password);

      NetMd5Codec::encode(cred_input.data(), cred_digest);

      fprintf(stderr,
              "Adding identity '%s': user='******' realm='%s' password='******' H(A1)='%s'\n",
              identity.toString().data(), user, realm, password, cred_digest.data()
         );

      assert(lineMgr.addCredentialForLine(identity, realm, user, cred_digest,
                                          HTTP_DIGEST_AUTHENTICATION));
   }

   SipUserAgent* pSipUserAgent =
      new SipUserAgent(port, port, PORT_NONE,
                       NULL,
                       NULL,
                       NULL,
                       NULL,
                       NULL,
                       NULL,
                       NULL,
                       NULL,
                       NULL,
                       NULL,
                       NULL,
                       &lineMgr);
   // Add the 'eventlist' extension, so dialogwatch can subscribe to
   // event lists.
   pSipUserAgent->allowExtension("eventlist");
   if (!pSipUserAgent->isOk())
   {
       fprintf(stderr, "Unable to bind to port %d\n", port);
       exit(1);
   }

   SipDialogMgr dialogManager;

   SipRefreshManager refreshMgr(*pSipUserAgent, dialogManager);
   refreshMgr.start();

   SipSubscribeClient sipSubscribeClient(*pSipUserAgent, dialogManager,
                                         refreshMgr);
   sipSubscribeClient.start();

   // Construct a name-addr from targetURI, in case it contains parameters.
   UtlString toUri;
   toUri = "<";
   toUri += targetURI;
   toUri += ">";
   UtlString earlyDialogHandle;

   fprintf(stderr,
           "resourceId '%s' fromString '%s' toUri '%s' event '%s' content-type '%s' port=%d expiration=%d\n",
           targetURI, fromString.data(), toUri.data(), eventType, contentType,
           port, expiration);

   UtlBoolean status =
      sipSubscribeClient.addSubscription(targetURI,
                                         eventType,
                                         contentType,
                                         fromString.data(),
                                         toUri.data(),
                                         NULL,
                                         expiration,
                                         (void *) NULL,
                                         subscriptionStateCallback,
                                         notifyEventCallback,
                                         earlyDialogHandle);

   if (!status)
   {
      fprintf(stderr, "Subscription attempt failed.\n");
      exit(1);
   }
   else
   {
      fprintf(stderr, "Subscription attempt succeeded.  Handle: '%s'\n",
              earlyDialogHandle.data());
   }

   while (1)
   {
      sleep(1000);
   }
}