class MachineTokenRegistry {

  public String getOrCreateToken(String userId, String workspaceId) throws MachineTokenException {
    lock.writeLock().lock();
    try {
      final Map<String, String> wsRow = tokens.row(workspaceId);
      String token = wsRow.get(userId);
      if (token == null) {
        token = createToken(userId, workspaceId);
      }
      return token;
    } finally {
      lock.writeLock().unlock();
    }
  }

  @Inject public  MachineTokenRegistry(SignatureKeyManager signatureKeyManager, UserManager userManager);

}