class SourceService implements ISourceService {

   @Override
   public Source createSource(String url, String username, String password, Integer maxDownloads)
   {
      IllegalArgumentException exception = new IllegalArgumentException("Invalid URL");
      if (url == null || url.isEmpty())
      {
         throw exception;
      }

      try
      {
         URL checkUrl = new URL(url);
         if (!checkUrl.getProtocol().startsWith("http"))
         {
            throw exception;
         }
      }
      catch (MalformedURLException e)
      {
         throw new IllegalArgumentException("Invalid URL");
      }

      return getSourceManager().create(url, username, password, maxDownloads);
   }

}