Check if service is registered.
189269
public function has($name): bool
    {
        try {
            $this->container->get($name);

            return true;
        } catch (\Exception $e) {
            return false;
        }
    }
162351
def get_service(self, service_type=None):
        """"""
        for service in self._services:
            if service.type == service_type and service_type:
                return service
        return None
575275
def get_current_service_state(self, service_id: str):
        """"""
        state = self._get_service_state(service_id)
        return state.current_state
407407
def is_registered_app(self, app):
        ''''''
        if app is None:
            return False
        if isinstance(app, AppConfig):
            app = app.name
        return app in self.registered_apps
346799
public static boolean isServiceExported(Configuration configuration, int port, String serviceName) {
        if (serviceName == null)
            return false;
        try {
            final Registry registry = RegistryFinder.getInstance().getRegistry(configuration, port);
            String[] list = registry.list();

            if (list != null) {
                for (int i = 0; i < list.length; i++) {
                    if (serviceName.equals(list[i]))
                        return true;
                }
            }
        } catch (RemoteException ex) {
            return false;
        } catch (Exception e) {
            return false;
        }
        return false;
    }
1170254
def service_action(self, service, action):
        ""
        try:
            service = api.get_cluster(self.cluster).get_service(service)
        except ApiException:
            print("Service not found")
            return None

        if action == "start":
            service.start()
        if action == "restart":
            service.restart()
        if action == "stop":
            service.stop()

        return True
864404
public void registerService(Object service)
    {
    	this.setService(service);
    	String serviceClass = getInterfaceClassName(); 

    	if (service != null)
    		serviceRegistration = context.registerService(serviceClass, this.service, properties);
    }
498174
@Override
    public void registerService(ServiceInstance<T> service) throws Exception
    {
        Entry<T> newEntry = new Entry<T>(service);
        Entry<T> oldEntry = services.putIfAbsent(service.getId(), newEntry);
        Entry<T> useEntry = (oldEntry != null) ? oldEntry : newEntry;
        synchronized(useEntry)
        {
            if ( useEntry == newEntry ) // i.e. is new
            {
                useEntry.cache = makeNodeCache(service);
            }
            internalRegisterService(service);
        }
    }
155449
private ServiceReference checkService(ServiceReference serviceReference, String interfaceClassName)
    {
        if (serviceReference != null)
        {
            Object service = bundleContext.getService(serviceReference);
            if (service != null)
            {
                try {
                    if (interfaceClassName != null)
                        if (!service.getClass().isAssignableFrom(Class.forName(interfaceClassName)))
                            serviceReference = null;
                } catch (ClassNotFoundException e) {
                    // Ignore this error
                }
            }
        }
        return serviceReference;
    }
560509
function checkServices(servicesJson) {
	//console.log(util.inspect(servicesJson))
	for (serviceId in servicesJson) {
		service=servicesJson[serviceId]
		if (service.uuid === blueRadiosService) {
			console.log('BlueRadios service UUID found!')
			//check for characteristics?
			return true;
		}
	}
}
1042753
def _register_service_type(cls, subclass):
        """"""
        if hasattr(subclass, '__service_type__'):
            cls._service_type_mapping[subclass.__service_type__] = subclass
            if subclass.__service_type__:
                setattr(subclass,
                        subclass.__service_type__,
                        property(lambda x: x))
        return subclass
957192
def is_ready(self, service_name):
        
        service = self.get_service(service_name)
        reqs = service.get('required_data', [])
        return all(bool(req) for req in reqs)
49943
public static boolean isServiceRunning(Class<? extends Service> service) {
        ActivityManager manager = (ActivityManager) QuickUtils.getContext().getSystemService(Context.ACTIVITY_SERVICE);
        for (ActivityManager.RunningServiceInfo runningServiceInfo : manager.getRunningServices(Integer.MAX_VALUE)) {
            if (service.getName().equals(runningServiceInfo.service.getClassName())) {
                return true;
            }
        }
        return false;
    }
908089
def has_reg?(name, params = {})
      params = {
        test_for_true_false: true
      }.update(params)
      if params.key?(:enabled_features) || params.key?(:enabled_feature)
        return !!get_registers(params).include?(name)
      else
        params[:enabled_features] = :default
        return !!get_registers(params).include?(name)
      end
    end
812950
protected void verifyRegisteredService(final RequestContext requestContext, final RegisteredService registeredService) {
        if (registeredService == null || !registeredService.getAccessStrategy().isServiceAccessAllowed()) {
            LOGGER.debug("Service [{}] is not recognized/allowed by the CAS service registry", registeredService);
            if (registeredService != null) {
                WebUtils.putUnauthorizedRedirectUrlIntoFlowScope(requestContext, registeredService.getAccessStrategy().getUnauthorizedRedirectUrl());
            }
            throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY);
        }
    }
585984
public static void ensureServiceAccessIsAllowed(final String service, final RegisteredService registeredService) {
        if (registeredService == null) {
            val msg = String.format("Unauthorized Service Access. Service [%s] is not found in service registry.", service);
            LOGGER.warn(msg);
            throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
        }
        if (!registeredService.getAccessStrategy().isServiceAccessAllowed()) {
            val msg = String.format("Unauthorized Service Access. Service [%s] is not enabled in service registry.", service);
            LOGGER.warn(msg);
            throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
        }
        if (!ensureServiceIsNotExpired(registeredService)) {
            val msg = String.format("Expired Service Access. Service [%s] has been expired", service);
            LOGGER.warn(msg);
            throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_EXPIRED_SERVICE, msg);
        }
    }
839671
def is_disabled(self, name):
        
        if self.services and name in self.services:
            return self.services[name]['config'] == 'disabled'
        return False