private void runDiscoveryForThingType(Console console, ThingTypeUID thingTypeUID) { discoveryServiceRegistry.startScan(thingTypeUID, null); }
@POST @Path("/bindings/{bindingId}/scan") @Produces(MediaType.TEXT_PLAIN) @ApiOperation(value = "Starts asynchronous discovery process for a binding and returns the timeout in seconds of the discovery operation.", response = Integer.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = Integer.class) }) public Response scan(@PathParam("bindingId") @ApiParam(value = "bindingId") final String bindingId) { discoveryServiceRegistry.startScan(bindingId, new ScanListener() { @Override public void onErrorOccurred(Exception exception) { logger.error("Error occurred while scanning for binding '{}': {}", bindingId, exception.getMessage(), exception); } @Override public void onFinished() { logger.debug("Scan for binding '{}' successfully finished.", bindingId); } }); return Response.ok(discoveryServiceRegistry.getMaxScanTimeout(bindingId)).build(); }
protected void activate(ComponentContext componentContext) { this.timeToLiveChecker = ThreadPoolManager.getScheduledPool("discovery") .scheduleWithFixedDelay(new TimeToLiveCheckingThread(this), 0, 30, TimeUnit.SECONDS); this.discoveryServiceRegistry.addDiscoveryListener(this); }
protected void deactivate(ComponentContext componentContext) { this.discoveryServiceRegistry.removeDiscoveryListener(this); this.listeners.clear(); this.timeToLiveChecker.cancel(true); }
@GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Gets all bindings that support discovery.", response = String.class, responseContainer = "Set") @ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = String.class, responseContainer = "Set") }) public Response getDiscoveryServices() { Collection<String> supportedBindings = discoveryServiceRegistry.getSupportedBindings(); return Response.ok(new LinkedHashSet<>(supportedBindings)).build(); }
protected void activate(ComponentContext componentContext) { this.timeToLiveChecker = ThreadPoolManager.getScheduledPool("discovery") .scheduleWithFixedDelay(new TimeToLiveCheckingThread(this), 0, 30, TimeUnit.SECONDS); this.discoveryServiceRegistry.addDiscoveryListener(this); }
protected void deactivate(ComponentContext componentContext) { this.discoveryServiceRegistry.removeDiscoveryListener(this); this.listeners.clear(); this.timeToLiveChecker.cancel(true); }
private void runDiscoveryForBinding(Console console, String bindingId) { discoveryServiceRegistry.startScan(bindingId, null); }
private void runDiscoveryForThingType(Console console, ThingTypeUID thingTypeUID) { discoveryServiceRegistry.startScan(thingTypeUID, null); }
private void runDiscoveryForBinding(Console console, String bindingId) { discoveryServiceRegistry.startScan(bindingId, null); }