Example #1
0
  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;
  }
Example #2
0
  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);
    }
  }
Example #3
0
  private static ComponentImpl _loadComponent(
      PageContext pc,
      CIPage page,
      String callPath,
      boolean isRealPath,
      boolean isExtendedComponent,
      boolean executeConstr)
      throws PageException {
    ComponentImpl rtn = null;
    if (pc.getConfig().debug()) {
      DebugEntryTemplate debugEntry = pc.getDebugger().getEntry(pc, page.getPageSource());
      pc.addPageSource(page.getPageSource(), true);

      int currTime = pc.getExecutionTime();
      long exeTime = 0;
      long time = System.nanoTime();
      try {
        debugEntry.updateFileLoadTime((int) (System.nanoTime() - time));
        exeTime = System.nanoTime();
        rtn = initComponent(pc, page, callPath, isRealPath, isExtendedComponent, executeConstr);

      } finally {
        if (rtn != null) rtn.setLoaded(true);
        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(page.getPageSource(), true);
      try {
        rtn = initComponent(pc, page, callPath, isRealPath, isExtendedComponent, executeConstr);
      } finally {
        if (rtn != null) rtn.setLoaded(true);
        pc.removeLastPageSource(true);
      }
    }

    return rtn;
  }