예제 #1
0
 /**
  * Answer the nodeId
  * 
  * @return string
  * @access public
  * @since 7/30/07
  * @static
  */
 public static function getCurrentNodeId()
 {
     if (!isset(self::$currentNodeId)) {
         $harmoni = Harmoni::instance();
         $harmoni->request->startNamespace(null);
         if (RequestContext::value("node")) {
             $nodeId = RequestContext::value("node");
         } else {
             if (RequestContext::value("site")) {
                 $slotManager = SlotManager::instance();
                 $slot = $slotManager->getSlotByShortname(RequestContext::value("site"));
                 if ($slot->siteExists()) {
                     $nodeId = $slot->getSiteId()->getIdString();
                 } else {
                     $harmoni->request->endNamespace();
                     throw new UnknownIdException("A Site has not been created for the slotname '" . $slot->getShortname() . "'.");
                 }
             }
         }
         if (!isset($nodeId) || !$nodeId) {
             $harmoni->request->endNamespace();
             throw new NullArgumentException('No site node specified.');
         }
         self::$currentNodeId = $nodeId;
         $harmoni->request->endNamespace();
     }
     return self::$currentNodeId;
 }