Register as a service to be consumed by the <zosLogging> config service.

@param bundleContext
@return
500254
public synchronized MessageRouterConfigListenerImpl register(BundleContext bundleContext) {
        if (serviceRegistration != null) {
            return this; // Already registered.
        }

        Dictionary<String, Object> props = new Hashtable<String, Object>(1);
        props.put(Constants.SERVICE_VENDOR, "IBM");

        // register the ManagedService that will handle the config
        serviceRegistration = bundleContext.registerService(MessageRouterConfigListener.class, this, props);
        return this;
    }
44029
protected RegisteredService getRegisteredServiceForConsent(final RequestContext requestContext, final Service service) {
        val serviceToUse = this.authenticationRequestServiceSelectionStrategies.resolveService(service);
        val registeredService = this.servicesManager.findServiceBy(serviceToUse);
        RegisteredServiceAccessStrategyUtils.ensureServiceAccessIsAllowed(service, registeredService);
        return registeredService;
    }
786980
protected void activate(ComponentContext context) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
            Tr.event(this, tc, "activate", context);
        configAdminRef.activate(context);
        variableRegistryRef.activate(context);
        metaTypeServiceRef.activate(context);
        wsConfigurationHelperRef.activate(context);
        bundleContext = priv.getBundleContext(context);

    }
347496
@Override
    protected ServiceRegistration<D> addService(S service, ServiceProperties props) {
        D decorator = createDecorator(service, props);
        if (decorator == null) {
            return null;
        }
        Dictionary<String, ?> decoratorServiceProps = decoratorServiceProps(props);
        getLogger().info("Registering decorator service {} with properties {}", decoratorType.getSimpleName(), decoratorServiceProps);
        return getBundleContext().registerService(decoratorType, decorator, decoratorServiceProps);
    }
93085
public void registerDeferredService(BundleContext bundleContext, Class<?> providedService, Dictionary dict) {
        Object obj = serviceReg.get();
        if (obj instanceof ServiceRegistration<?>) {
            // already registered - nothing to do here
            return;
        }
        if (obj instanceof CountDownLatch) {
            // another thread is in the process of (de)registering - wait for it to finish
            try {
                ((CountDownLatch) obj).await();

                if (serviceReg.get() instanceof ServiceRegistration<?>) {
                    // Another thread has successfully registered to return out (so we don't go
                    // into recursive loop).
                    return;
                }
            } catch (InterruptedException swallowed) {
                if (tc.isDebugEnabled()) {
                    Tr.debug(tc, "Count down interrrupted", swallowed);
                }
            }
        } else {
            // This is probably the first thread to register.
            // Claim the right to register by setting a latch for other threads to wait on.
            CountDownLatch latch = new CountDownLatch(1);
            if (serviceReg.compareAndSet(null, latch)) {
                // This thread won the right to register the service
                try {
                    serviceReg.set(bundleContext.registerService(providedService.getName(), this, dict));
                    // successfully registered - nothing more to do
                    return;
                } finally {
                    // if the serviceReg was not updated for any reason, we need to set it back to null
                    serviceReg.compareAndSet(latch, null);
                    // in any case we need to allow any blocked threads to proceed
                    latch.countDown();
                }
            }
        }
        // If we get to here we have not successfully registered 
        // nor seen another thread successfully register, so just recurse.
        registerDeferredService(bundleContext, providedService, dict);
    }
1280830
private ServiceRegistration registerCrud(BundleContext context, JcrCrudService crud) {
        Dictionary prop = jcromConfiguration.toDictionary();
        prop.put(Crud.ENTITY_CLASS_PROPERTY, crud.getEntityClass());
        prop.put(Crud.ENTITY_CLASSNAME_PROPERTY, crud.getEntityClass().getName());
        ServiceRegistration serviceRegistration = context.registerService(new String[]{Crud.class.getName(), JcrCrud.class.getName()}, crud, prop);
        return serviceRegistration;
    }
107479
private void createManagedServiceFactory(BundleContext context) {
		// sanity check
		if (managedServiceFactoryReg != null) {
			managedServiceFactoryReg.unregister();
			managedServiceFactoryReg = null;
		}
		final Dictionary<String, String> props = new Hashtable<>();
		props.put(Constants.SERVICE_PID, HttpContextProcessing.PID);
		httpContextProcessing = new HttpContextProcessing(bundleContext, serverController);
		managedServiceFactoryReg = context.registerService(ManagedServiceFactory.class, httpContextProcessing, props);
	}
174044
public void register(Bundler bundler) {
    if (bundler == null) throw new NullPointerException("Cannot register null bundler.");

    if (runner.state == BundleServiceRunner.State.SAVING) {
      throw new IllegalStateException("Cannot register during onSave");
    }

    if (bundlers.add(bundler)) bundler.onEnterScope(scope);
    String mortarBundleKey = bundler.getMortarBundleKey();
    if (mortarBundleKey == null || mortarBundleKey.trim().equals("")) {
      throw new IllegalArgumentException(format("%s has null or empty bundle key", bundler));
    }

    switch (runner.state) {
      case IDLE:
        toBeLoaded.add(bundler);
        runner.servicesToBeLoaded.add(this);
        runner.finishLoading();
        break;
      case LOADING:
        if (!toBeLoaded.contains(bundler)) {
          toBeLoaded.add(bundler);
          runner.servicesToBeLoaded.add(this);
        }
        break;

      default:
        throw new AssertionError("Unexpected state " + runner.state);
    }
  }
534168
public static Bundle installBundle(BundleContext context, Resource bundle, boolean checkExistence) throws IOException, BundleException {
	if (checkExistence) {
	    BundleFile bf = new BundleFile(bundle);
	    if (!bf.isBundle()) throw new BundleException(bundle + " is not a valid bundle!");

	    Bundle existing = loadBundleFromLocal(context, bf.getSymbolicName(), bf.getVersion(), false, null);
	    if (existing != null) return existing;
	}

	return _loadBundle(context, bundle.getAbsolutePath(), bundle.getInputStream(), true);
    }
379225
@Activate
    public void startUp(BundleContext bundleContext) {
        extendedBundleContext = new ExtendedBundle.ExtendedBundleContext(bundleContext);
        bundleContext.addBundleListener(this);
    }
183312
def _register_bundle_factories(self, bundle):
        # type: (Bundle) -> None
        
        # Load the bundle factories
        factories = _load_bundle_factories(bundle)

        for context, factory_class in factories:
            try:
                # Register each found factory
                self._register_factory(context.name, factory_class, False)
            except ValueError as ex:
                # Already known factory
                _logger.error(
                    "Cannot register factory '%s' of bundle %d (%s): %s",
                    context.name,
                    bundle.get_bundle_id(),
                    bundle.get_symbolic_name(),
                    ex,
                )
                _logger.error(
                    "class: %s -- module: %s",
                    factory_class,
                    factory_class.__module__,
                )
            else:
                # Instantiate components
                for name, properties in context.get_instances().items():
                    self.instantiate(context.name, name, properties)
1187254
private void trackServlets(final BundleContext bundleContext) {
		final ServiceTracker<Servlet, ServletWebElement> servletTracker = ServletTracker
				.createTracker(extenderContext, bundleContext);

		servletTracker.open();
		trackers.add(0, servletTracker);

		final ServiceTracker<ServletMapping, ServletMappingWebElement> servletMappingTracker = ServletMappingTracker
				.createTracker(extenderContext, bundleContext);

		servletMappingTracker.open();
		trackers.add(0, servletMappingTracker);
	}
90810
public static RegisteredService getRegisteredService(final RequestContext context) {
        return context != null ? (RegisteredService) context.getFlowScope().get(PARAMETER_REGISTERED_SERVICE) : null;
    }
872658
@SuppressWarnings("rawtypes")
    protected <S> ServiceRegistration registerService(Class<S> clazz, S service,
            Map<String, ?> props) {
        if (service instanceof IBundleAwareService) {
            ((IBundleAwareService) service).setBundle(bundle);
        }

        Dictionary<String, Object> _p = new Hashtable<String, Object>();
        if (props != null) {
            for (Entry<String, ?> entry : props.entrySet()) {
                _p.put(entry.getKey(), entry.getValue());
            }
        }
        ServiceRegistration sr = bundleContext.registerService(clazz, service, _p);
        registeredServices.add(sr);
        return sr;
    }
979480
protected void registerPauseableComponentController(BundleContext systemContext) {
        PauseableComponentControllerImpl pauseableComponentController = new PauseableComponentControllerImpl(systemContext);
        if (pauseableComponentController != null) {
            Hashtable<String, String> svcProps = new Hashtable<String, String>();
            systemContext.registerService(PauseableComponentController.class.getName(), pauseableComponentController, svcProps);
        }
    }
1045269
@Override
	public IServiceRegistration registerService(String clazz, Object service,
			Dictionary<String, String> properties) {
		final String sourceMethod = "registerService"; //$NON-NLS-1$
		boolean isTraceLogging = log.isLoggable(Level.FINER);
		if (isTraceLogging) {
			log.entering(PlatformServicesImpl.class.getName(), sourceMethod, new Object[]{clazz, service, properties});
		}
		ServiceRegistrationOSGi serviceRegistrationOSGi = null;
		ServiceRegistration<?> serviceRegistration = null;
		BundleContext bundleContext = Activator.getBundleContext();
		if (bundleContext != null) {
			serviceRegistration = bundleContext.registerService(clazz, service,
					properties);
			serviceRegistrationOSGi = new ServiceRegistrationOSGi(serviceRegistration);
		}
		if (isTraceLogging) {
			log.exiting(PlatformServicesImpl.class.getName(), sourceMethod, serviceRegistrationOSGi);
		}
		return serviceRegistrationOSGi;
	}
468738
public static BundleContext getBundleContextByBundleId(long bundleId) {
        Bundle bundle = bundleContext.getBundle(bundleId);
        if (bundle != null) {
            return bundle.getBundleContext();
        } else {
            return null;
        }
    }