public void initMessages() {
    if (this.repositoryMessagesLocations != null) {
      // Register the messages found in the repository
      for (RepositoryLocation repositoryLocation : this.repositoryMessagesLocations) {
        StoreRef storeRef = repositoryLocation.getStoreRef();

        if (!nodeService.exists(storeRef)) {
          logger.info("StoreRef '" + storeRef + "' does not exist");
          continue; // skip this location
        }

        if (repositoryLocation.getQueryLanguage().equals(RepositoryLocation.LANGUAGE_PATH)) {
          List<NodeRef> nodeRefs =
              getNodes(storeRef, repositoryLocation, ContentModel.TYPE_CONTENT);

          if (nodeRefs.size() > 0) {
            List<String> resourceBundleBaseNames = new ArrayList<String>();

            for (NodeRef messageResource : nodeRefs) {
              String resourceName =
                  (String) nodeService.getProperty(messageResource, ContentModel.PROP_NAME);

              String bundleBaseName = messageService.getBaseBundleName(resourceName);

              if (!resourceBundleBaseNames.contains(bundleBaseName)) {
                resourceBundleBaseNames.add(bundleBaseName);
              }
            }
          }
        } else {
          logger.error(
              "Unsupported query language for messages location: "
                  + repositoryLocation.getQueryLanguage());
        }
      }
    }
  }