@Override public void start() { Dictionary<String, Object> props = null; if (m_trackedResource != null) { props = new Hashtable<>(); props.put(ResourceHandler.URL, m_trackedResource); } else { if (m_resourceFilter != null) { props = new Hashtable<>(); props.put(ResourceHandler.FILTER, m_resourceFilter); } } m_registration = m_component.getBundleContext().registerService(ResourceHandler.class.getName(), this, props); super.start(); }
@Override public void start() { BundleContext context = m_component.getBundleContext(); if (context != null) { // If null, we are in a test environment Properties props = new Properties(); props.put(Constants.SERVICE_PID, m_pid); ManagedService ms = this; if (m_metaType != null) { ms = m_metaType; props.put(MetaTypeProvider.METATYPE_PID, m_pid); String[] ifaces = new String[] { ManagedService.class.getName(), MetaTypeProvider.class.getName() }; m_registration = context.registerService(ifaces, ms, toR6Dictionary(props)); } else { m_registration = context.registerService(ManagedService.class.getName(), ms, toR6Dictionary(props)); } } super.start(); }
@Override public void start() { m_tracker = new BundleTracker(m_component.getBundleContext(), m_stateMask, this); m_tracker.open(); super.start(); }
@Override public void start() { if (m_trackedServiceName != null) { BundleContext ctx = m_component.getBundleContext(); if (m_trackedServiceFilter != null) { try { m_tracker = new ServiceTracker(ctx, ctx.createFilter(m_trackedServiceFilter), this); } catch (InvalidSyntaxException e) { throw new IllegalStateException("Invalid filter definition for dependency: " + m_trackedServiceFilter); } } else if (m_trackedServiceReference != null) { m_tracker = new ServiceTracker(ctx, m_trackedServiceReference, this); } else { m_tracker = new ServiceTracker(ctx, m_trackedServiceName.getName(), this); } } else { throw new IllegalStateException("Could not create tracker for dependency, no service name specified."); } if (m_debug) { m_tracker.setDebug(m_debugKey); } m_tracker.open(); super.start(); }
@Override public void start() { try { if (m_async) { if (m_exec != null) { m_future.whenCompleteAsync((result, error) -> completed(result, error), m_exec); } else { m_future.whenCompleteAsync((result, error) -> completed(result, error)); } } else { m_future.whenComplete((result, error) -> completed(result, error)); } } catch (Throwable error) { super.getComponentContext().getLogger().log(LogService.LOG_ERROR, "completable future failed", error); } super.start(); }