Add a new service.
437151
async def _on_service_added(self, update):
        """"""

        info = update['payload']
        name = info['short_name']

        if name in self.services:
            return

        with self._state_lock:
            new_id = len(self.services)
            serv = states.ServiceState(name, info['long_name'],
                                       info['preregistered'], new_id)
            self.services[name] = serv
            self._name_map[new_id] = name

        # Notify about this new service if anyone is listening
        if self._on_change_callback:
            self._on_change_callback(name, new_id, serv.state, True, False)
561582
def put(self, service, path, body, **kwargs):
        
        return self.make_request(Methods.POST, service, path, body=body,
                                 **kwargs)
740975
@Override
    public void add(final S service)
    {
        if(service == null)
        {
            throw new NullPointerException("Service must not be null");
        }
        
        final K key = this.getKey(service);
        
        if(key == null)
        {
            throw new NullPointerException("Key for service must not be null");
        }
        
        Collection<S> set = this.services.get(key);
        
        set.add(service);
        
        if(set.size() != 1)
        {
            this.log.error("Failing due to a duplicate service with key: {} for class {}", key, service);
            throw new ServiceConfigurationError("Found a duplicate service with key: " + key + " for class: " + service);
        }
        
        if(this.log.isDebugEnabled())
        {
            this.log.debug("Added service with key: {}", key);
        }
    }
274046
public function addService($service)
    {
        if (in_array($service, $this->allServices)) {
            $this->services[] = $service;
        }

        return $this;
    }
1251961
def service(container, name=None):
    
    def register(service):
        container.add_service(service, name)
        return service

    return register
259027
@Override
    protected L addService(L service, ServiceProperties props) {
        L decorated = decorator.apply(service, props);
        if (decorated != null) {
            listenerSupport.addListener(decorated);
        }
        return decorated;
    }
1033583
def add_service(self, service_name):
        
        if service_name not in self.manifest['services']:
            self.manifest['services'].append(service_name)
670555
def add_service(key, *args)

      raise ArgumentError.new(
        '#add_service: at least two arguments please'
      ) if args.empty?

      key = key.to_s
      path, klass, opts = args

      key = "s_#{key}" unless SERVICE_PREFIX.match(key)

      aa = [ self, opts ].compact

      service = if klass

        require(path)

        @services[key] = Ruote.constantize(klass).new(*aa)

      elsif path.is_a?(Class)

        @services[key] = path.new(*aa)

      else

        @services[key] = path
      end

      (class << self; self; end).class_eval(
        %{ def #{key[2..-1]}; @services['#{key}']; end })
          #
          # This 'two-liner' will add an instance method to Context for this
          # service.
          #
          # If the service key is 's_dishwasher', then the service will be
          # available via Context#dishwasher.
          #
          # I.e. dishwasher = engine.context.dishwasher

      service
    end
910143
def add_hs_service(self, info, address):
        """"""
        if self.protocol and self.protocol != PROTOCOL_DMAP:
            return

        name = info.properties[b'Name'].decode('utf-8')
        hsgid = info.properties[b'hG'].decode('utf-8')
        self._handle_service(
            address, name, conf.DmapService(hsgid, port=info.port))
865481
def new(self, sources):
        """"""
        self._response['shouldEndSession'] = True
        self._response['action']['audio']['interface'] = 'new'
        self._response['action']['audio']['sources'] = sources
        return self
41322
public function add()
	{
		// Get the alias we're setting
		$name = $this->arguments->getOpt(3);
		$path = $this->arguments->getOpt(4);

		// Delete the primary args so they aren't added as top level config values
		$this->arguments->deleteOpt(3);
		$this->arguments->deleteOpt(4);

		// Set the new aliases argument
		$this->arguments->setOpt('aliases', array($name => $path));

		// Redirect back to the basic configuration set method
		App::get('client')->call('configuration', 'set', $this->arguments, $this->output);
	}
392759
def startService(self):
        
        Service.startService(self)
        self._thread = threading.Thread(target=self._writer)
        self._thread.start()
        addDestination(self)
150483
def add_endpoint(self, ep):
        """"""
        assert ep.name not in self.endpoints, ep
        self.endpoints[ep.name] = ep
106228
def add_non_hs_service(self, info, address):
        """"""
        if self.protocol and self.protocol != PROTOCOL_DMAP:
            return

        name = info.properties[b'CtlN'].decode('utf-8')
        self._handle_service(
            address, name, conf.DmapService(None, port=info.port))
1043607
public function addService(Service $service) {
    if (!in_array($service, $this->services, TRUE)) {
      $this->services[] = $service;
      
      if ($service instanceof \Psc\System\LoggerObject && $service->getLogger() instanceof \Psc\System\DispatchingLogger) {
        $this->getLogger()->listenTo($service->getLogger());
      }
    }
    return $this;
  }
852624
public function addService($service)
    {
        $this->strategies[] = $service;
        $this->strategies = array_unique($this->strategies);
    }
750081
def new(*args, &block)
      enclosing_resource ? service.build(*args, &block) : service.new(*args, &block)
    end