public static InterfaceImpl loadInterface(
      PageContext pc, Page page, PageSource ps, String callPath, boolean isRealPath)
      throws PageException {
    InterfaceImpl rtn = null;
    if (pc.getConfig().debug()) {
      DebugEntryTemplate debugEntry = pc.getDebugger().getEntry(pc, ps);
      pc.addPageSource(ps, true);

      int currTime = pc.getExecutionTime();
      long exeTime = 0;
      long time = System.nanoTime();
      try {
        debugEntry.updateFileLoadTime((int) (System.nanoTime() - time));
        exeTime = System.nanoTime();
        if (page == null) page = ps.loadPage(pc, false);
        rtn = initInterface(pc, page, callPath, isRealPath);
      } finally {
        int diff = ((int) (System.nanoTime() - exeTime) - (pc.getExecutionTime() - currTime));
        pc.setExecutionTime(pc.getExecutionTime() + (int) (System.nanoTime() - time));
        debugEntry.updateExeTime(diff);
        pc.removeLastPageSource(true);
      }
    }
    // no debug
    else {
      pc.addPageSource(ps, true);
      try {
        if (page == null) page = ps.loadPage(pc, false);
        rtn = initInterface(pc, page, callPath, isRealPath);
      } finally {
        pc.removeLastPageSource(true);
      }
    }
    return rtn;
  }
  public static Page loadPage(PageContext pc, PageSource ps, boolean forceReload)
      throws PageException {
    if (pc.getConfig().debug()) {
      DebugEntryTemplate debugEntry = pc.getDebugger().getEntry(pc, ps);
      pc.addPageSource(ps, true);

      int currTime = pc.getExecutionTime();
      long exeTime = 0;
      long time = System.currentTimeMillis();
      try {
        debugEntry.updateFileLoadTime((int) (System.currentTimeMillis() - time));
        exeTime = System.currentTimeMillis();
        return ps.loadPage(pc, forceReload);
      } finally {
        int diff =
            ((int) (System.currentTimeMillis() - exeTime) - (pc.getExecutionTime() - currTime));
        pc.setExecutionTime(pc.getExecutionTime() + (int) (System.currentTimeMillis() - time));
        debugEntry.updateExeTime(diff);
        pc.removeLastPageSource(true);
      }
    }
    // no debug
    pc.addPageSource(ps, true);
    try {
      return ps.loadPage(pc, forceReload);
    } finally {
      pc.removeLastPageSource(true);
    }
  }
  private static Object _search(
      PageContext pc,
      PageSource loadingLocation,
      String rawPath,
      Boolean searchLocal,
      Boolean searchRoot,
      boolean executeConstr,
      short returnType,
      boolean isExtendedComponent)
      throws PageException {
    PageSource currPS = pc.getCurrentPageSource();
    Page currP = currPS.loadPage(pc, false);

    // first try for the current dialect
    Object obj =
        _search(
            pc,
            loadingLocation,
            rawPath,
            searchLocal,
            searchRoot,
            executeConstr,
            returnType,
            currP,
            currPS.getDialect(),
            isExtendedComponent);
    // then we try the opposite dialect
    if (obj == null) {
      obj =
          _search(
              pc,
              loadingLocation,
              rawPath,
              searchLocal,
              searchRoot,
              executeConstr,
              returnType,
              currP,
              currPS.getDialect() == CFMLEngine.DIALECT_CFML
                  ? CFMLEngine.DIALECT_LUCEE
                  : CFMLEngine.DIALECT_CFML,
              isExtendedComponent);
    }

    if (obj == null)
      throw new ExpressionException(
          "invalid "
              + toStringType(returnType, currPS.getDialect())
              + " definition, can't find "
              + toStringType(returnType, currPS.getDialect())
              + " ["
              + rawPath
              + "]");
    return obj;
  }
 public static ComponentImpl loadComponent(
     PageContext pc,
     PageSource ps,
     String callPath,
     boolean isRealPath,
     boolean silent,
     boolean executeConstr)
     throws PageException {
   return _loadComponent(
       pc, toCIPage(ps.loadPage(pc, false), callPath), callPath, isRealPath, false, executeConstr);
 }