use of org.openmuc.framework.parser.spi.ParserService in project OpenMUC by isc-konstanz.
the class AmqpDriver method getNewParserImplementationFromServiceRegistry.
private void getNewParserImplementationFromServiceRegistry(ServiceEvent event) {
ServiceReference<?> serviceReference = event.getServiceReference();
ParserService parser = (ParserService) context.getService(serviceReference);
String parserId = (String) serviceReference.getProperty("parserID");
if (event.getType() == ServiceEvent.UNREGISTERING) {
logger.info("{} unregistering, removing Parser from AmqpDriver", parser.getClass().getName());
connection.setParser(parserId, null);
} else {
logger.info("{} changed, updating Parser in AmqpDriver", parser.getClass().getName());
connection.setParser(parserId, parser);
}
}
use of org.openmuc.framework.parser.spi.ParserService in project OpenMUC by isc-konstanz.
the class AmqpDriver method checkForExistingParserService.
private void checkForExistingParserService() {
List<ServiceReference<?>> serviceReferences = getServiceReferences();
for (ServiceReference<?> serviceReference : serviceReferences) {
String parserIdInit = (String) serviceReference.getProperty("parserID");
ParserService parserInit = (ParserService) context.getService(serviceReference);
if (parserInit != null) {
logger.info("{} registered, updating Parser in AmqpDriver", parserInit.getClass().getName());
connection.setParser(parserIdInit, parserInit);
}
}
}
use of org.openmuc.framework.parser.spi.ParserService in project OpenMUC by isc-konstanz.
the class AmqpComponent method handleServiceRegistrationEvent.
private void handleServiceRegistrationEvent(Object event, BundleContext context) {
ServiceReference<?> serviceReference = ((ServiceEvent) event).getServiceReference();
String parserId = (String) serviceReference.getProperty("parserID");
ParserService parserService = (ParserService) context.getService(serviceReference);
String parserServiceName = parserService.getClass().getName();
if (((ServiceEvent) event).getType() == ServiceEvent.UNREGISTERING) {
logger.info("{} unregistering, removing Parser", parserServiceName);
amqpLogger.removeParser(parserId);
} else {
logger.info("{} changed, updating Parser", parserServiceName);
amqpLogger.addParser(parserId, parserService);
}
}
use of org.openmuc.framework.parser.spi.ParserService in project OpenMUC by isc-konstanz.
the class MqttLoggerComponent method handleServiceRegistrationEvent.
private void handleServiceRegistrationEvent(Object event, BundleContext context) {
ServiceReference<?> serviceReference = ((ServiceEvent) event).getServiceReference();
String parserId = (String) serviceReference.getProperty("parserID");
ParserService parserService = (ParserService) context.getService(serviceReference);
String parserServiceName = parserService.getClass().getName();
if (((ServiceEvent) event).getType() == ServiceEvent.UNREGISTERING) {
logger.info("{} unregistering, removing Parser", parserServiceName);
mqttLogger.removeParser(parserId);
} else {
logger.info("{} changed, updating Parser", parserServiceName);
mqttLogger.addParser(parserId, parserService);
}
}
use of org.openmuc.framework.parser.spi.ParserService in project OpenMUC by isc-konstanz.
the class MqttDriver method checkForExistingParserService.
private void checkForExistingParserService() {
List<ServiceReference<?>> serviceReferences = getServiceReferences();
for (ServiceReference<?> serviceReference : serviceReferences) {
String parserIdInit = (String) serviceReference.getProperty("parserID");
ParserService parserInit = (ParserService) context.getService(serviceReference);
if (parserInit != null) {
logger.info("{} registered, updating Parser in MqttDriver", parserInit.getClass().getName());
connection.setParser(parserIdInit, parserInit);
}
}
}
Aggregations