code: public static Link parse(String origin, String link, boolean allowModuleName) {
          String originMod = origin;
          int index = link.indexOf('#');
          if (index == -1) {
              if (allowModuleName) {
                  index = link.lastIndexOf('/');
                  if (index == -1) {
                      return new Link(null, null, link);
                  }
  
                  return new Link(null, link.substring(0, index), link.substring(index + 1));
              }
  
              return new Link(null, null, link);
          }
  
          String name = link.substring(index + 1);
          String uri = link.substring(0, index);
          if (originMod == null) {
              originMod = "";
          } else {
              index = originMod.lastIndexOf('/');
              originMod = index == -1 ? "" : originMod.substring(0, index);
          }
  
          if (uri.startsWith("../")) {
              uri = uri.substring(3);
          }
  
          while (uri.startsWith("../")) {
              index = originMod.lastIndexOf('/');
              if (index == -1) {
                  originMod = "";
              } else {
                  originMod = originMod.substring(0, index);
              }
              uri = uri.substring(3);
          }
  
          return new Link(originMod.isEmpty() ? uri : originMod + '/' + uri, null, name);
      }
docs: Parse a link from an ejb-link or a message-destination-link
  
  @param origin original module name.
  @param link link provided on the link element
  @param allowModuleName boolean if a module name is allowed on the link
  @return