/**
  * Get the service like IDataServiceMetadataProvider, IDataServiceQueryProvider,
  * IDataServiceStreamProvider
  * 
  * @param String $serviceType Type of service IDataServiceMetadataProvider, 
  *                            IDataServiceQueryProvider,
  *                            IDataServiceStreamProvider
  * 
  * @see library/ODataProducer/ODataProducer.IServiceProvider::getService()
  * @return object
  */
 public function getService($serviceType)
 {
     if ($serviceType === 'IDataServiceMetadataProvider' || $serviceType === 'IDataServiceQueryProvider2' || $serviceType === 'IDataServiceStreamProvider') {
         if (is_null($this->_NorthWindExpressionProvider)) {
             $this->_NorthWindExpressionProvider = new NorthWindDSExpressionProvider();
         }
     }
     if ($serviceType === 'IDataServiceMetadataProvider') {
         if (is_null($this->_NorthWindMetadata)) {
             $this->_NorthWindMetadata = CreateNorthWindMetadata::create();
         }
         return $this->_NorthWindMetadata;
     } else {
         if ($serviceType === 'IDataServiceQueryProvider') {
             if (is_null($this->_NorthWindQueryProvider)) {
                 $this->_NorthWindQueryProvider = new NorthWindQueryProvider();
             }
             return $this->_NorthWindQueryProvider;
         } else {
             if ($serviceType === 'IDataServiceStreamProvider') {
                 return new NorthWindStreamProvider();
             }
         }
     }
     return null;
 }
Exemplo n.º 2
0
 /**
  * Get the service like IMetadataProvider, IDataServiceQueryProvider,
  * IStreamProvider
  * 
  * @param String $serviceType Type of service IMetadataProvider,
  *                            IDataServiceQueryProvider,
  *                            IQueryProvider,
  *                            IStreamProvider
  * 
  * @see library/POData.IServiceProvider::getService()
  * @return object
  */
 public function getService($serviceType)
 {
     if ($serviceType === 'IMetadataProvider') {
         if (is_null($this->_northWindMetadata)) {
             $this->_northWindMetadata = CreateNorthWindMetadata::create();
         }
         return $this->_northWindMetadata;
     } else {
         if ($serviceType === 'IQueryProvider') {
             if (is_null($this->_northWindQueryProvider)) {
                 $this->_northWindQueryProvider = new NorthWindQueryProvider();
             }
             return $this->_northWindQueryProvider;
         } else {
             if ($serviceType === 'IStreamProvider') {
                 return new NorthWindStreamProvider();
             }
         }
     }
     return null;
 }