private void bindSingletons() { bind(Configuration.class).toInstance(configuration); bind(BaseConfiguration.class).toInstance(configuration); ServerStatus serverStatus = new ServerStatus(configuration); serverStatus.addCapability(ServerStatus.Capability.RADIO); bind(ServerStatus.class).toInstance(serverStatus); bind(InputRegistry.class).toProvider(RadioInputRegistryProvider.class); }
protected void restrictToMaster() { if (!serverStatus.hasCapability(ServerStatus.Capability.MASTER)) { LOG.warn("Rejected request that is only allowed against master nodes. Returning HTTP 403."); throw new WebApplicationException(403); } }