Search in sources :

Example 1 with ConsoleResourceImpl

use of org.openremote.manager.asset.console.ConsoleResourceImpl in project openremote by openremote.

the class AssetStorageService method init.

@Override
public void init(Container container) throws Exception {
    timerService = container.getService(TimerService.class);
    persistenceService = container.getService(PersistenceService.class);
    identityService = container.getService(ManagerIdentityService.class);
    clientEventService = container.getService(ClientEventService.class);
    gatewayService = container.getService(GatewayService.class);
    EventSubscriptionAuthorizer assetEventAuthorizer = AssetStorageService.assetInfoAuthorizer(identityService, this);
    clientEventService.addSubscriptionAuthorizer((realm, auth, subscription) -> {
        if (!subscription.isEventType(AssetEvent.class)) {
            return false;
        }
        return assetEventAuthorizer.authorise(realm, auth, subscription);
    });
    container.getService(ManagerWebService.class).addApiSingleton(new AssetResourceImpl(container.getService(TimerService.class), identityService, this, container.getService(MessageBrokerService.class)));
    container.getService(ManagerWebService.class).addApiSingleton(new ConsoleResourceImpl(container.getService(TimerService.class), identityService, this, clientEventService));
    container.getService(MessageBrokerService.class).getContext().addRoutes(this);
}
Also used : PersistenceService(org.openremote.container.persistence.PersistenceService) ManagerIdentityService(org.openremote.manager.security.ManagerIdentityService) EventSubscriptionAuthorizer(org.openremote.manager.event.EventSubscriptionAuthorizer) ManagerWebService(org.openremote.manager.web.ManagerWebService) ConsoleResourceImpl(org.openremote.manager.asset.console.ConsoleResourceImpl) ClientEventService(org.openremote.manager.event.ClientEventService) TimerService(org.openremote.container.timer.TimerService) GatewayService(org.openremote.manager.gateway.GatewayService)

Aggregations

PersistenceService (org.openremote.container.persistence.PersistenceService)1 TimerService (org.openremote.container.timer.TimerService)1 ConsoleResourceImpl (org.openremote.manager.asset.console.ConsoleResourceImpl)1 ClientEventService (org.openremote.manager.event.ClientEventService)1 EventSubscriptionAuthorizer (org.openremote.manager.event.EventSubscriptionAuthorizer)1 GatewayService (org.openremote.manager.gateway.GatewayService)1 ManagerIdentityService (org.openremote.manager.security.ManagerIdentityService)1 ManagerWebService (org.openremote.manager.web.ManagerWebService)1