ServiceReference sref = registration.getReference(); String parserFactoryClassName = (String) sref.getProperty(FACTORYNAMEKEY);
= bundleContext.getService(serviceRegistration.getReference());
= bundleContext.getService(serviceRegistration.getReference());
ServiceReference sref = registration.getReference(); String parserFactoryClassName = (String) sref .getProperty(FACTORYNAMEKEY);
public ServiceReference getServiceReference() { if (scp.serviceComponent.provides != null) { ServiceRegistration reg = scp.registration; if (reg != null) { return reg.getReference(); } } return null; }
@Override public ServiceReference<S> getServiceReference() { return m_serviceRegistration == null? null: m_serviceRegistration.getReference(); }
@Override public ServiceReference<S> getServiceReference() { return m_serviceRegistration == null? null: m_serviceRegistration.getReference(); }
/** * {@inheritDoc} * * <p>Overridden in order to get hold of our service reference.</p> */ public Object getService(Bundle bundle, ServiceRegistration registration) { m_serviceRef = registration.getReference(); return this; }
@Override public void stop(final BundleContext context) throws Exception { context.ungetService(metricRegistry.getReference()); context.ungetService(healthRegistry.getReference()); }
@Override public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException { ServiceRegistration reg = bundle.osgi.services.get(clazz); return reg != null ? new ServiceReference[] { reg.getReference() } : null; }
/** * The Name of the registered {@link CoreContainer} * @return */ public String getServerName(){ Object value = serverRegistration.getReference().getProperty(PROPERTY_SERVER_NAME); return value == null ? null : value.toString(); } /**
@Deactivate protected void deactivate(ComponentContext ctxt) { ctxt.getBundleContext().ungetService(serviceRegistration.getReference()); if (log.isDebugEnabled()) { log.info("Identity LDAP directory mgt bundle is deactivated"); } } }
private void deregisterInstance(HazelcastOSGiInstance hazelcastOSGiInstance) { instanceMap.remove(hazelcastOSGiInstance.getName()); ServiceRegistration serviceRegistration = instanceServiceRegistrationMap.remove(hazelcastOSGiInstance); if (serviceRegistration != null) { ownerBundleContext.ungetService(serviceRegistration.getReference()); serviceRegistration.unregister(); } }
@Override public void stop(BundleContext context) throws Exception { for (ServiceRegistration serviceRegistration : serviceFactoryRegistrationList) { ServiceReference serviceReference = serviceRegistration.getReference(); SpringContextServiceFactory serviceFactory = (SpringContextServiceFactory)context.getService(serviceReference); serviceRegistration.unregister(); serviceFactory.destroyFactory(); } } }
final ServiceReference<S> getServiceReference() { ServiceRegistration<S> reg = getServiceRegistration(); if (reg != null) { return reg.getReference(); } return null; }
long registerService() { final Bundle bundle = this.cache.getBundle(); final Dictionary<String, Object> props = new Hashtable<>(); props.put(Constants.SERVICE_DESCRIPTION, "Provider of bundle based resources from bundle " + String.valueOf(bundle.getBundleId())); props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation"); props.put(ResourceProvider.PROPERTY_ROOT, this.root.getResourceRoot()); props.put(PROP_BUNDLE,bundle.getBundleId()); serviceRegistration = bundle.getBundleContext().registerService(ResourceProvider.class, this, props); return (Long) serviceRegistration.getReference().getProperty(Constants.SERVICE_ID); }
@Override public void run(final ProxyManager pm) throws Exception { String[] objectClassProperty = (String[]) originalRef.getProperty(Constants.OBJECTCLASS); ServiceFactory<Object> sf = new ProxyServiceFactory(pm, originalRef); registrationHolder.registration = originalRef.getBundle().getBundleContext().registerService( objectClassProperty, sf, proxyPropertiesRoles()); Dictionary<String, Object> actualProxyProps = copyProperties(registrationHolder.registration.getReference()); LOG.debug("Created proxy of service {} under {} with properties {}", orgServiceID, actualProxyProps.get(Constants.OBJECTCLASS), actualProxyProps); }
void servicePropertiesModified(ServiceRegistration reg, Dictionary oldProps) { updateHook(reg.getReference()); if (m_callbacks != null) { m_callbacks.serviceChanged( new ServiceEvent(ServiceEvent.MODIFIED, reg.getReference()), oldProps); } }
@Override public void execute(String id) { AutomaticPackageReplicatorJob job = (AutomaticPackageReplicatorJob) getBundleContext() .getService(super.getRegisteredServices().get(id).getReference()); job.run(); }
@SuppressWarnings( "unchecked" ) @Override public T getService(Bundle bundle, ServiceRegistration<T> registration) { String[] mimetype = (String[])registration.getReference().getProperty("mimetype"); if (isYaml(mimetype)) return (T)new YamlWriterFactory(); else return (T)new JsonWriterFactory(); }