当前位置: 首页>>代码示例>>PHP>>正文


PHP Service::setHostName方法代码示例

本文整理汇总了PHP中Service::setHostName方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::setHostName方法的具体用法?PHP Service::setHostName怎么用?PHP Service::setHostName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Service的用法示例。


在下文中一共展示了Service::setHostName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createSampleService

 public static function createSampleService($label)
 {
     $se = new Service();
     $se->setHostName('' . $label);
     $se->setBeta(false);
     $se->setProduction(true);
     $se->setMonitored(true);
     return $se;
 }
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:9,代码来源:TestUtil.php

示例2: addService

 /**
  * Array
  * (
  *     [Service_Type] => 21
  *     [EndpointURL] => Testing://host.com
  *     [Scope] => 2
  *     [Hosting_Site] => 377
  *     [SE] => Array
  *     (
  *         [ENDPOINT] => my.new.host.com21
  *         [HOSTNAME] => my.new.host.com
  *         [HOST_IP] => 10.0.0.1
  *         [HOST_DN] => /cn=JCasson
  *         [HOST_IP_V6] => 0000:0000:0000:0000:0000:0000:0000:0000[/int]
  *         [DESCRIPTION] => hithere
  *         [HOST_OS] =>
  *         [HOST_ARCH] =>
  *         [BETA] => Y
  *         [PRODUCTION_LEVEL] => Y
  *         [IS_MONITORED] => Y
  *         [EMAIL] =>
  *     )
  * )
  * @param Array $values Balues for the new SE (defined above)
  * @param org\gocdb\services\User $user The user adding the SE
  */
 public function addService($values, \User $user = null)
 {
     $this->em->getConnection()->beginTransaction();
     // get the parent site
     $dql = "SELECT s from Site s WHERE s.id = :id";
     $site = $this->em->createQuery($dql)->setParameter('id', $values['hostingSite'])->getSingleResult();
     // get the service type
     $st = $this->getServiceType($values['serviceType']);
     $siteService = new \org\gocdb\services\Site();
     $siteService->setEntityManager($this->em);
     if (count($siteService->authorizeAction(\Action::SITE_ADD_SERVICE, $site, $user)) == 0) {
         throw new \Exception("You don't hold a role over {$site}.");
     }
     $this->validate($values['SE'], 'service');
     $this->validateEndpointUrl($values['endpointUrl']);
     $this->uniqueCheck($values['SE']['HOSTNAME'], $st, $site);
     //check there are the required number of scopes specified
     $this->checkNumberOfScopes($values['Scope_ids']);
     // validate production/monitored combination
     if ($st != 'VOMS' && $st != 'emi.ARGUS') {
         if ($values['PRODUCTION_LEVEL'] == "Y" && $values['IS_MONITORED'] != "Y") {
             throw new \Exception("If Production flat is set to True, Monitored flag must also be True (except for VOMS and emi.ARGUS)");
         }
     }
     $se = new \Service();
     try {
         $se->setParentSiteDoJoin($site);
         $se->setServiceType($st);
         // Set production
         if ($values['PRODUCTION_LEVEL'] == "Y") {
             $se->setProduction(true);
         } else {
             $se->setProduction(false);
         }
         // Set Beta
         if ($values['BETA'] == "Y") {
             $se->setBeta(true);
         } else {
             $se->setBeta(false);
         }
         // Set monitored
         if ($values['IS_MONITORED'] == "Y") {
             $se->setMonitored(true);
         } else {
             $se->setMonitored(false);
         }
         // Set the scopes
         foreach ($values['Scope_ids'] as $scopeId) {
             $dql = "SELECT s FROM Scope s WHERE s.id = :id";
             $scope = $this->em->createQuery($dql)->setParameter('id', $scopeId)->getSingleResult();
             $se->addScope($scope);
         }
         $se->setDn($values['SE']['HOST_DN']);
         $se->setIpAddress($values['SE']['HOST_IP']);
         $se->setOperatingSystem($values['SE']['HOST_OS']);
         $se->setArchitecture($values['SE']['HOST_ARCH']);
         $se->setHostName($values['SE']['HOSTNAME']);
         $se->setDescription($values['SE']['DESCRIPTION']);
         $se->setEmail($values['SE']['EMAIL']);
         $se->setUrl($values['endpointUrl']);
         /* With version 5.3 a service does not have to have an endpoint. 
            $el = new \EndpointLocation();
            $el->setUrl($values['endpointUrl']);
            $se->addEndpointLocationDoJoin($el);
            $this->em->persist($el);
            */
         $this->em->persist($se);
         $this->em->flush();
         $this->em->getConnection()->commit();
     } catch (\Exception $e) {
         $this->em->getConnection()->rollback();
         $this->em->close();
         throw $e;
     }
//.........这里部分代码省略.........
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:101,代码来源:ServiceService.php

示例3: Exception

        $doctrineSe->setMonitored(false);
    }
    // Set the scope
    if ((string) $xmlSe->SCOPE == "EGI") {
        $doctrineSe->addScope($egiScope);
    } else {
        if ((string) $xmlSe->SCOPE == 'Local') {
            $doctrineSe->addScope($localScope);
        } else {
            throw new Exception("Unknown scope " . $xmlSe->SCOPE . " for SE " . $xmlSe->HOSTNAME);
        }
    }
    //set creation date
    $creationDate = new \DateTime("now", new DateTimeZone('UTC'));
    $doctrineSe->setCreationDate($creationDate);
    $doctrineSe->setDn((string) $xmlSe->HOSTDN);
    $doctrineSe->setIpAddress((string) $xmlSe->HOST_IP);
    $doctrineSe->setOperatingSystem((string) $xmlSe->HOST_OS);
    $doctrineSe->setArchitecture((string) $xmlSe->HOST_ARCH);
    $doctrineSe->setHostName((string) $xmlSe->HOSTNAME);
    $doctrineSe->setDescription((string) $xmlSe->DESCRIPTION);
    // A service has ELs
    $doctrineEndpointLocation = new EndpointLocation();
    $doctrineEndpointLocation->setUrl((string) $xmlSe->URL);
    $doctrineEndpointLocation->setName('sampleEndpoint');
    $doctrineEndpointLocation->setInterfaceName((string) $doctrineSe->getServiceType()->getName());
    $doctrineSe->addEndpointLocationDoJoin($doctrineEndpointLocation);
    $entityManager->persist($doctrineSe);
    $entityManager->persist($doctrineEndpointLocation);
}
$entityManager->flush();
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:31,代码来源:AddServiceEndpoints.php


注:本文中的Service::setHostName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。