@Override public IDeviceStreamData addDeviceStreamData(UUID streamId, IDeviceStreamDataCreateRequest request) throws SiteWhereException { throw new SiteWhereException("Not implemented."); }
@Override public ISearchResults<IDeviceStreamData> listDeviceStreamDataForAssignment(UUID streamId, IDateRangeSearchCriteria criteria) throws SiteWhereException { throw new SiteWhereException("Not implemented."); }
@Override public List<IGrantedAuthority> addGrantedAuthorities(String username, List<String> authorities) throws SiteWhereException { throw new SiteWhereException("Not implemented."); }
@Override public ISearchResults<IDeviceStreamData> listDeviceStreamDataForAssignment(UUID streamId, IDateRangeSearchCriteria criteria) throws SiteWhereException { throw new SiteWhereException("Not implemented."); }
@Override public ISearchResults<IDeviceCommandResponse> listDeviceCommandInvocationResponses(UUID invocationId) throws SiteWhereException { throw new SiteWhereException("Not implemented."); }
@Override public List<IGrantedAuthority> removeGrantedAuthorities(String username, List<String> authorities) throws SiteWhereException { throw new SiteWhereException("Not implemented."); }
@Override public ISearchResults<IDeviceStreamData> listDeviceStreamDataForAssignment(UUID streamId, IDateRangeSearchCriteria criteria) throws SiteWhereException { throw new SiteWhereException("Not implemented."); }
@Override public File getTenantTemplatesRoot() throws SiteWhereException { File templates = new File(TEMPLATES_ROOT); if (!templates.exists()) { throw new SiteWhereException("Tenant templates folder not found in Docker image."); } return templates; }
@Override public void initialize(ILifecycleProgressMonitor monitor) throws SiteWhereException { if (getRemoteUri() == null) { throw new SiteWhereException("Remote URI must be configured."); } if (getQueueName() == null) { throw new SiteWhereException("Queue name must be configured."); } }
@Override public void onMeasurement(IDeviceEventContext context, IDeviceMeasurement mx) throws SiteWhereException { SolrInputDocument document = SiteWhereSolrFactory.createDocumentFromMeasurement(mx); try { queue.put(document); } catch (InterruptedException e) { throw new SiteWhereException("Interrupted during indexing.", e); } }
@Override public void start(ILifecycleProgressMonitor monitor) throws SiteWhereException { super.start(monitor); Map<String, ICommandDestination<?, ?>> destinations = getCommandDestinationsManager().getCommandDestinations(); if (destinations.size() != 1) { throw new SiteWhereException( "Expected exactly one destination for command routing but found " + destinations.size() + "."); } Iterator<ICommandDestination<?, ?>> it = destinations.values().iterator(); this.destinations = Collections.singletonList(it.next()); }
@Override public void start(ILifecycleProgressMonitor monitor) throws SiteWhereException { super.start(monitor); if (getScriptPath() == null) { throw new SiteWhereException("Script path not configured for Groovy filter."); } }
public void stop() throws SiteWhereException { try { getConsumer().close(); getSession().close(); getConnection().close(); } catch (Exception e) { throw new SiteWhereException("Error shutting down ActiveMQ consumer.", e); } }
@Override public void start(ILifecycleProgressMonitor monitor) throws SiteWhereException { if (getClient() == null) { throw new SiteWhereException("No InfluxDB client configured."); } getClient().start(monitor); }
@Override public ActiveSpan createTracerSpan(String name) throws SiteWhereException { ILifecycleProgressContext current = getContextStack().peek(); if (current != null) { return getMicroservice().getTracer().buildSpan(name).startActive(); } throw new SiteWhereException("Unable to create span. No context found."); }
@Override public void unscheduleJob(IScheduledJob job) throws SiteWhereException { try { getScheduler().unscheduleJob(new TriggerKey(job.getToken())); } catch (SchedulerException e) { throw new SiteWhereException("Unable to unschedule job.", e); } }
@Override public void initialize(IAssetManagement assetManagement) throws SiteWhereException { Binding binding = new Binding(); binding.setVariable("logger", LOGGER); binding.setVariable("assetBuilder", new AssetManagementRequestBuilder(assetManagement)); try { getGroovyConfiguration().run(getScriptPath(), binding); } catch (SiteWhereException e) { throw new SiteWhereException("Unable to run asset model initializer.", e); } }
@Override public void start(ILifecycleProgressMonitor monitor) throws SiteWhereException { try { groovyScriptEngine = new GroovyScriptEngine( new URL[] { getScriptSynchronizer().getFileSystemRoot().toURI().toURL() }); groovyScriptEngine.getConfig().setVerbose(isVerbose()); groovyScriptEngine.getConfig().setDebug(isDebug()); } catch (MalformedURLException e) { throw new SiteWhereException("Unable to create Groovy script engine.", e); } }
@Override public void initialize(ILifecycleProgressMonitor monitor) throws SiteWhereException { try { this.jwtInterceptor = new JwtServerInterceptor(getMicroservice(), getServiceImplementation().getClass()); this.tracingInterceptor = new ServerTracingInterceptor(getMicroservice().getTracer()); this.server = buildServer(); getLogger().debug("Initialized GRPC server on port " + port + "."); } catch (Throwable e) { throw new SiteWhereException("Unable to initialize GRPC server.", e); } }
@Override public void deliverSystemCommand(IDeviceNestingContext nested, IDeviceAssignment assignment, byte[] encoded, MqttParameters params) throws SiteWhereException { try { getLogger().info("About to publish system message to topic: " + params.getSystemTopic()); connection.publish(params.getSystemTopic(), encoded, QoS.AT_LEAST_ONCE, false); getLogger().info("Command published."); } catch (Exception e) { throw new SiteWhereException("Unable to publish command to MQTT topic.", e); } } }