code: public static Repository repositoryFromUrl(String url) throws MalformedURLException {
          URL parsedUrl = new URL(url);
  
          StringBuffer id = new StringBuffer(parsedUrl.getHost());
          String path = parsedUrl.getPath();
          if (path.length() > 0) {
              path = path.replaceFirst("/", "").replaceAll("/", "-").replaceAll(":", "-");
              id.append("-");
              id.append(path);
          }
  
          if (parsedUrl.getPort() > -1) {
              id.append("-");
              id.append(parsedUrl.getPort());
          }
  
          Repository repo = new Repository();
          repo.setId( id.toString() );
          repo.setName( parsedUrl.getHost() );
          repo.setUrl( url );
          
          return repo;
      }
docs: Create a {@link Repository} from a String url
  
  @param url String
  @return {@link Repository}
  @throws MalformedURLException exception