private StateMap getState(final String componentId, final Scope scope) {
    try {
      final StateManager manager = stateManagerProvider.getStateManager(componentId);
      if (manager == null) {
        throw new ResourceNotFoundException(
            String.format("State for the specified component %s could not be found.", componentId));
      }

      return manager.getState(scope);
    } catch (final IOException ioe) {
      throw new IllegalStateException(
          String.format(
              "Unable to get the state for the specified component %s: %s", componentId, ioe),
          ioe);
    }
  }
  private void clearState(final String componentId) {
    try {
      final StateManager manager = stateManagerProvider.getStateManager(componentId);
      if (manager == null) {
        throw new ResourceNotFoundException(
            String.format("State for the specified component %s could not be found.", componentId));
      }

      // clear both state's at the same time
      manager.clear(Scope.CLUSTER);
      manager.clear(Scope.LOCAL);
    } catch (final IOException ioe) {
      throw new IllegalStateException(
          String.format(
              "Unable to clear the state for the specified component %s: %s", componentId, ioe),
          ioe);
    }
  }