Attaches a service for hosting
        :param http_service: A HTTPService instance
514983
def attach_http_service(cls, http_service: HTTPService):
        
        if cls._services['_http_service'] is None:
            cls._services['_http_service'] = http_service
            cls._set_bus(http_service)
        else:
            warnings.warn('HTTP service is already attached')
117901
public Object addingService(ServiceReference reference)
    {
        HttpService httpService = (HttpService) context.getService(reference);

        String alias = this.getAlias();
        String name = this.getProperty(RESOURCE_NAME);
        if (name == null)
            name = alias;
        try {
            httpService.registerResources(alias, name, httpContext);
        } catch (NamespaceException e) {
            e.printStackTrace();
        }

        return httpService;
    }
572894
public Object addingService(ServiceReference reference)
    {
        HttpService httpService = (HttpService) context.getService(reference);

        this.properties = this.updateDictionaryConfig(this.properties, true);
        try {
            String alias = this.getAlias();
            String servicePid = this.properties.get(BundleConstants.SERVICE_PID);
            if (servlet == null)
            {
                servlet = this.makeServlet(alias, this.properties);
                if (servlet instanceof WebappServlet)
                    ((WebappServlet) servlet).init(context, servicePid, this.properties);
            }
            else
                if (servlet instanceof WebappServlet)
                    ((WebappServlet) servlet).setProperties(properties);
            if (servicePid != null)   // Listen for configuration changes
                serviceRegistration = context.registerService(ManagedService.class.getName(), new HttpConfigurator(context, servicePid), this.properties);

            httpService.registerServlet(alias, servlet, this.properties, httpContext);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return httpService;
    }
805371
def add_mrp_service(self, info, address):
        """"""
        if self.protocol and self.protocol != PROTOCOL_MRP:
            return

        name = info.properties[b'Name'].decode('utf-8')
        self._handle_service(address, name, conf.MrpService(info.port))
582088
def register_service(self, service):
        
        if service not in self.services:
            self.services.append(service)
751047
def put_http_connection(self, host, is_secure, conn):
        
        with self.mutex:
            key = (host, is_secure)
            if key not in self.host_to_pool:
                self.host_to_pool[key] = HostConnectionPool()
            self.host_to_pool[key].put(conn)
131589
def create(self, **kwargs):
        
        self.service.create(**kwargs)

        predix.config.set_env_value(self.use_class, 'url',
                self.service.settings.data['url'])
        predix.config.set_env_value(self.use_class, 'access_key_id',
                self.service.settings.data['access_key_id'])
        predix.config.set_env_value(self.use_class, 'bucket_name',
                self.service.settings.data['bucket_name'])
        predix.config.set_env_value(self.use_class, 'host',
                self.service.settings.data['host'])
        predix.config.set_env_value(self.use_class, 'secret_access_key',
                self.service.settings.data['secret_access_key'])
1371180
def attach_tcp_service(cls, tcp_service: TCPService):
        
        if cls._tcp_service is None:
            cls._tcp_service = tcp_service
            cls._set_bus(tcp_service)
        else:
            warnings.warn('TCP service is already attached')
1297731
def register_service(self, name: str, service: Any):
        
        if not isinstance(service, type):
            if hasattr(service, '__class__'):
                _ensure_service_name(service.__class__, name)
            self.services[name] = service
            return

        if self._services_initialized:
            from warnings import warn
            warn('Services have already been initialized. Please register '
                 f'{name} sooner.')
            return

        self._services_registry[_ensure_service_name(service, name)] = service
403618
def attach_tcp_service(cls, tcp_service: TCPService):
        
        if cls._services['_tcp_service'] is None:
            cls._services['_tcp_service'] = tcp_service
            cls._set_bus(tcp_service)
        else:
            warnings.warn('TCP service is already attached')
134427
def serve_buffer(data: bytes,
                 offered_filename: str = None,
                 content_type: str = None,
                 as_attachment: bool = True,
                 as_inline: bool = False) -> HttpResponse:
    
    response = HttpResponse(data)
    add_http_headers_for_attachment(response,
                                    offered_filename=offered_filename,
                                    content_type=content_type,
                                    as_attachment=as_attachment,
                                    as_inline=as_inline,
                                    content_length=len(data))
    return response
1033583
def add_service(self, service_name):
        
        if service_name not in self.manifest['services']:
            self.manifest['services'].append(service_name)
184886
def attach_to_instance(self, instance, mountpoint):
        
        instance_id = _resolve_id(instance)
        try:
            resp = self._nova_volumes.create_server_volume(instance_id,
                    self.id, mountpoint)
        except Exception as e:
            raise exc.VolumeAttachmentFailed("%s" % e)
1365112
def _attach(cls, iface_id, vm_id):
        
        oper = cls.call('hosting.vm.iface_attach', vm_id, iface_id)
        return oper
423613
def add_service_port(service, port):
    '''
    
    '''
    if service not in get_services(permanent=True):
        raise CommandExecutionError('The service does not exist.')

    cmd = '--permanent --service={0} --add-port={1}'.format(service, port)
    return __firewall_cmd(cmd)
1079051
def add_service(self, service):
        
        if (self.service is None):
            self.service = service
        elif (isinstance(self.service, dict)):
            self.service = [self.service, service]
        else:
            self.service.append(service)
1145636
def register_service(cls, service):
        
        logger.debug('Registering service {0}'.format(service.name))
        return local_store.instance.register(service)