Refine search
@Override @SuppressWarnings("unchecked") public void start(BundleContext context) throws Exception { osgiServiceUtil = new OsgiServiceUtil( context ); // Build a JtaPlatform specific for this OSGi context final OsgiJtaPlatform osgiJtaPlatform = new OsgiJtaPlatform( osgiServiceUtil ); final Dictionary properties = new Hashtable(); // In order to support existing persistence.xml files, register using the legacy provider name. properties.put( "javax.persistence.provider", HibernatePersistenceProvider.class.getName() ); persistenceProviderService = context.registerService( PersistenceProvider.class.getName(), new OsgiPersistenceProviderService( osgiJtaPlatform, osgiServiceUtil ), properties ); sessionFactoryService = context.registerService( SessionFactory.class.getName(), new OsgiSessionFactoryService( osgiJtaPlatform, osgiServiceUtil ), new Hashtable() ); }
public void start(BundleContext context) throws Exception { Dictionary<String, Object> properties = new Hashtable<String, Object>(); properties.put(DataSourceFactory.OSGI_JDBC_DRIVER_CLASS, Driver.class.getName()); properties.put(DataSourceFactory.OSGI_JDBC_DRIVER_NAME, org.postgresql.util.DriverInfo.DRIVER_NAME); properties.put(DataSourceFactory.OSGI_JDBC_DRIVER_VERSION, org.postgresql.util.DriverInfo.DRIVER_VERSION); try { _registration = context.registerService(DataSourceFactory.class.getName(), new PGDataSourceFactory(), properties); } catch (NoClassDefFoundError e) { String msg = e.getMessage(); if (msg != null && msg.contains("org/osgi/service/jdbc/DataSourceFactory")) { if (!Boolean.getBoolean("pgjdbc.osgi.debug")) { return; } new IllegalArgumentException("Unable to load DataSourceFactory. " + "Will ignore DataSourceFactory registration. If you need one, " + "ensure org.osgi.enterprise is on the classpath", e).printStackTrace(); // just ignore. Assume OSGi-enterprise is not loaded return; } throw e; } }
/** * Exports the Ignite instance onto the OSGi Service Registry. * * @param ignite Ignite. */ private void exportOsgiService(Ignite ignite) { Dictionary<String, String> dict = new Hashtable<>(); // Only add the service property if the Ignite instance name != null. if (ignite.name() != null) dict.put(OSGI_SERVICE_PROP_IGNITE_NAME, ignite.name()); bundleCtx.registerService(Ignite.class, ignite, dict); if (log.isInfoEnabled()) log.info("Exported OSGi service for Ignite with properties: " + dict); } }
public void start(BundleContext context) throws Exception { bundleContext = context; Dictionary<String, Object> props = new Hashtable<String, Object>(); props.put("osgi.command.function", new String[] {"deploy", "install", "uninstall", "start", "stop", "list",}); props.put("osgi.command.scope", "subsystem"); context.registerService(getClass().getName(), this, props); }
public void start(BundleContext context) throws Exception { bundleContext = context; Dictionary<String, Object> props = new Hashtable<String, Object>(); props.put("osgi.command.function", new String[] {"start"}); props.put("osgi.command.scope", "obr"); context.registerService(getClass().getName(), this, props); }
@SuppressWarnings("unchecked") public void init() { Dictionary properties = new Properties(); properties.put( Constants.SERVICE_PID, "camelinaction.fileinventoryroutefactory"); registration = bundleContext.registerService(ManagedServiceFactory.class.getName(), this, properties); LOG.info("FileInventoryRouteCamelServiceFactory ready to accept " + "new config with PID=camelinaction.fileinventoryroutefactory-xxx"); }
void register(final BundleContext btx) { logger.debug("Registering health check mbean {} with name {}", mbean, objectName); final Dictionary<String, String> mbeanProps = new Hashtable<String, String>(); mbeanProps.put("jmx.objectname", objectName); this.registration = btx.registerService(DynamicMBean.class.getName(), this.mbean, mbeanProps); }
/** * Starts this CommandProvider. * * Registers this object as a CommandProvider with the highest ranking possible. * Adds this object as a SynchronousBundleListener. */ void start() { Dictionary<String, Object> props = new Hashtable<String, Object>(); props.put(Constants.SERVICE_RANKING, new Integer(Integer.MAX_VALUE)); providerReg = context.registerService(CommandProvider.class.getName(), this, props); context.addBundleListener(this); }
public synchronized void register(BundleContext context) throws IllegalStateException { if (registration != null) { throw new IllegalStateException(getClass().getSimpleName() + " already registered"); } Dictionary<String, Object> svcProps = new Hashtable<>(); svcProps.put(SVC_PROP_NAME, serviceName); this.registration = context.registerService(RequestLog.class, this, svcProps); }
public void start() throws Exception { Dictionary<String, Object> props = new Hashtable<String, Object>(); props.put(Constants.SERVICE_PID, PID); this.configServiceReg = this.context.registerService(ManagedService.class.getName(), this, props); this.httpServiceTracker = new ServiceTracker(this.context, HttpService.class.getName(), this); this.httpServiceTracker.open(); }
public void register() { final Dictionary<String, Object> props = new Hashtable<>(); props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation"); props.put(Constants.SERVICE_DESCRIPTION, "HTTP Service Web Console Plugin"); props.put("felix.webconsole.label", "httpservice"); props.put("felix.webconsole.title", "HTTP Service"); props.put("felix.webconsole.configprinter.modes", "always"); this.serviceReg = context.registerService(Servlet.class, this, props); }
private void register(BundleContext context, String serviceClass, Object service, boolean setRanking, Dictionary<String, Object> properties) { if (properties == null) properties = new Hashtable<>(7); Dictionary<String, String> headers = context.getBundle().getHeaders(); properties.put(Constants.SERVICE_VENDOR, headers.get(Constants.BUNDLE_VENDOR)); if (setRanking) { properties.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); } properties.put(Constants.SERVICE_PID, context.getBundle().getBundleId() + "." + service.getClass().getName()); //$NON-NLS-1$ registrations.add(context.registerService(serviceClass, service, properties)); } }
private void register(BundleContext context, String serviceClass, Object service, boolean setRanking, Dictionary<String, Object> properties) { if (properties == null) properties = new Hashtable<String, Object>(7); Dictionary<String, String> headers = context.getBundle().getHeaders(); properties.put(Constants.SERVICE_VENDOR, headers.get(Constants.BUNDLE_VENDOR)); if (setRanking) { properties.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); } properties.put(Constants.SERVICE_PID, context.getBundle().getBundleId() + "." + service.getClass().getName()); //$NON-NLS-1$ registrations.add(context.registerService(serviceClass, service, properties)); } }
@Override public void start(final BundleContext bundleContext) { Dictionary<String, String> properties = new Hashtable<>(); properties.put(Constants.SERVICE_PID, CONFIG_PID); bundleContext.registerService(ManagedService.class.getName(), new ConfigUpdater(bundleContext), properties); }
@Override public void start(BundleContext context) throws Exception { EventCollector collector = new EventCollector(); Dictionary<String, String> props = new Hashtable<>(); props.put("event.topics", "*"); String[] ifAr = new String[]{EventHandler.class.getName(), EventCollector.class.getName()}; context.registerService(ifAr, collector, props); }
@SuppressWarnings("squid:S1149") protected final void registerAsSlingFilter(ComponentContext ctx, int ranking, String pattern) { Dictionary<String, String> filterProps = new Hashtable<String, String>(); filterProps.put("service.ranking", String.valueOf(ranking)); filterProps.put("sling.filter.scope", "REQUEST"); filterProps.put("sling.filter.pattern", StringUtils.defaultIfEmpty(pattern, ".*")); filterRegistration = ctx.getBundleContext().registerService(Filter.class.getName(), this, filterProps); }
@SuppressWarnings("squid:S1149") protected final void registerAsFilter(ComponentContext ctx, int ranking, String pattern) { Dictionary<String, String> filterProps = new Hashtable<String, String>(); filterProps.put("service.ranking", String.valueOf(ranking)); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_REGEX, StringUtils.defaultIfEmpty(pattern, ".*")); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=*)"); filterRegistration = ctx.getBundleContext().registerService(Filter.class.getName(), this, filterProps); }
private ServiceRegistration<?> registerPerformanceLog(BundleContext context) { Object service = createPerformanceLog(context.getBundle()); String serviceName = FrameworkLog.class.getName(); Dictionary<String, Object> serviceProperties = new Hashtable<String, Object>(7); Dictionary<String, String> headers = context.getBundle().getHeaders(); serviceProperties.put(Constants.SERVICE_VENDOR, headers.get(Constants.BUNDLE_VENDOR)); serviceProperties.put(Constants.SERVICE_RANKING, new Integer(Integer.MIN_VALUE)); serviceProperties.put(Constants.SERVICE_PID, context.getBundle().getBundleId() + '.' + service.getClass().getName()); serviceProperties.put(FrameworkLog.SERVICE_PERFORMANCE, Boolean.TRUE.toString()); return context.registerService(serviceName, service, serviceProperties); }
private ServiceRegistration<?> registerPerformanceLog(BundleContext context) { Object service = createPerformanceLog(context.getBundle()); String serviceName = FrameworkLog.class.getName(); Dictionary<String, Object> serviceProperties = new Hashtable<>(7); Dictionary<String, String> headers = context.getBundle().getHeaders(); serviceProperties.put(Constants.SERVICE_VENDOR, headers.get(Constants.BUNDLE_VENDOR)); serviceProperties.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MIN_VALUE)); serviceProperties.put(Constants.SERVICE_PID, context.getBundle().getBundleId() + '.' + service.getClass().getName()); serviceProperties.put(FrameworkLog.SERVICE_PERFORMANCE, Boolean.TRUE.toString()); return context.registerService(serviceName, service, serviceProperties); }
private void registerNamespaceHandler(final BundleContext context) { Dictionary<String, Object> props = new Hashtable<>(); props.put("osgi.service.blueprint.namespace", OpendaylightNamespaceHandler.NAMESPACE_1_0_0); namespaceReg = context.registerService(NamespaceHandler.class.getName(), new OpendaylightNamespaceHandler(), props); }