use of org.openremote.container.timer.TimerService in project openremote by openremote.
the class MqttBrokerService method init.
@Override
public void init(Container container) throws Exception {
host = getString(container.getConfig(), MQTT_SERVER_LISTEN_HOST, BrokerConstants.HOST);
port = getInteger(container.getConfig(), MQTT_SERVER_LISTEN_PORT, BrokerConstants.PORT);
clientEventService = container.getService(ClientEventService.class);
ManagerIdentityService identityService = container.getService(ManagerIdentityService.class);
messageBrokerService = container.getService(MessageBrokerService.class);
executorService = container.getExecutorService();
timerService = container.getService(TimerService.class);
if (!identityService.isKeycloakEnabled()) {
LOG.warning("MQTT connections are not supported when not using Keycloak identity provider");
active = false;
} else {
active = true;
identityProvider = (ManagerKeycloakIdentityProvider) identityService.getIdentityProvider();
container.getService(MessageBrokerService.class).getContext().addRoutes(this);
}
}
use of org.openremote.container.timer.TimerService in project openremote by openremote.
the class ProvisioningService method init.
@Override
public void init(Container container) throws Exception {
persistenceService = container.getService(PersistenceService.class);
identityService = container.getService(ManagerIdentityService.class);
TimerService timerService = container.getService(TimerService.class);
container.getService(ManagerWebService.class).addApiSingleton(new ProvisioningResourceImpl(this, timerService, identityService));
}
use of org.openremote.container.timer.TimerService in project openremote by openremote.
the class UserAssetProvisioningMQTTHandler method start.
@Override
public void start(Container container) throws Exception {
super.start(container);
provisioningService = container.getService(ProvisioningService.class);
timerService = container.getService(TimerService.class);
brokerService = container.getService(MqttBrokerService.class);
assetStorageService = container.getService(AssetStorageService.class);
ManagerIdentityService identityService = container.getService(ManagerIdentityService.class);
if (!identityService.isKeycloakEnabled()) {
LOG.warning("MQTT connections are not supported when not using Keycloak identity provider");
isKeycloak = false;
} else {
isKeycloak = true;
identityProvider = (ManagerKeycloakIdentityProvider) identityService.getIdentityProvider();
container.getService(MessageBrokerService.class).getContext().addRoutes(new ProvisioningPersistenceRouteBuilder(this));
}
}
use of org.openremote.container.timer.TimerService in project openremote by openremote.
the class RulesService method init.
@Override
public void init(Container container) throws Exception {
executorService = container.getExecutorService();
timerService = container.getService(TimerService.class);
persistenceService = container.getService(PersistenceService.class);
rulesetStorageService = container.getService(RulesetStorageService.class);
identityService = container.getService(ManagerIdentityService.class);
notificationService = container.getService(NotificationService.class);
assetStorageService = container.getService(AssetStorageService.class);
assetProcessingService = container.getService(AssetProcessingService.class);
assetDatapointService = container.getService(AssetDatapointService.class);
assetPredictedDatapointService = container.getService(AssetPredictedDatapointService.class);
clientEventService = container.getService(ClientEventService.class);
gatewayService = container.getService(GatewayService.class);
if (initDone) {
return;
}
clientEventService.addSubscriptionAuthorizer((realm, auth, subscription) -> {
if (subscription.isEventType(RulesEngineStatusEvent.class) || subscription.isEventType(RulesetChangedEvent.class)) {
if (auth == null) {
return false;
}
if (auth.isSuperUser()) {
return true;
}
// Regular user must have role
if (!auth.hasResourceRole(ClientRole.READ_ASSETS.getValue(), auth.getClientId())) {
return false;
}
boolean isRestrictedUser = identityService.getIdentityProvider().isRestrictedUser(auth);
return !isRestrictedUser;
}
return false;
});
ServiceLoader.load(GeofenceAssetAdapter.class).forEach(geofenceAssetAdapter -> {
LOG.fine("Adding GeofenceAssetAdapter: " + geofenceAssetAdapter.getClass().getName());
geofenceAssetAdapters.add(geofenceAssetAdapter);
});
geofenceAssetAdapters.addAll(container.getServices(GeofenceAssetAdapter.class));
geofenceAssetAdapters.sort(Comparator.comparingInt(GeofenceAssetAdapter::getPriority));
container.getService(MessageBrokerService.class).getContext().addRoutes(this);
configEventExpires = getString(container.getConfig(), RULE_EVENT_EXPIRES, RULE_EVENT_EXPIRES_DEFAULT);
container.getService(ManagerWebService.class).addApiSingleton(new FlowResourceImpl(container.getService(TimerService.class), container.getService(ManagerIdentityService.class)));
initDone = true;
}
Aggregations