/**
   * {@inheritDoc}
   *
   * @see
   *     org.xwiki.contrib.mail.IMailComponent#getStoreManager(org.xwiki.contrib.mail.internal.source.StoreSource)
   */
  @Override
  public IStoreManager getStoreManager(StoreSource source) throws ComponentLookupException {
    IStoreManager store = null;

    // Component hint is the format supported by provider of this store
    store = this.componentManager.getInstance(IStoreManager.class, source.getFormat());
    store.setMailSource(source);

    return store;
  }
  /**
   * {@inheritDoc}
   *
   * @throws ComponentLookupException
   * @see org.xwiki.contrib.mail.IMailComponent#getStoreManager(java.lang.String, java.lang.String)
   */
  @Override
  public IStoreManager getStoreManager(final String format, final String location)
      throws ComponentLookupException {
    IStoreManager store = null;

    final String storeLocation = location.replaceAll("\\\\", "/");
    File storeRoot = new File(storeLocation);
    if (!storeRoot.exists()) {
      storeRoot.mkdirs();
    }
    // Component hint is the format supported by provider of this store
    store = this.componentManager.getInstance(IStoreManager.class, format);
    StoreSource source = new StoreSource(format, location);
    store.setMailSource(source);

    return store;
  }