Esempio n. 1
0
  public void setLastModified(String location, long lastModified) {
    Swc swc = (Swc) swcLRUCache.get(location);

    if (swc != null) {
      swc.setLastModified(lastModified);
    }
  }
Esempio n. 2
0
  // changed from private to protected to support Flash Authoring - jkamerer 2007.07.30
  protected Swc getSwc(File file) {
    Swc swc;
    try {
      String location = FileUtils.canonicalPath(file);
      swc = (Swc) swcLRUCache.get(location);

      long fileLastModified = file.lastModified();

      if (swc == null || (fileLastModified != swc.getLastModified())) {
        if (Trace.swc) {
          if (swc != null) {
            Trace.trace(
                "Reloading: location = "
                    + location
                    + ", fileLastModified = "
                    + fileLastModified
                    + ", swc.getLastModified() = "
                    + swc.getLastModified()
                    + ", swc = "
                    + swc.hashCode());
          } else {
            Trace.trace("Loading " + location);
          }
        }

        SwcArchive archive =
            file.isDirectory()
                ? (SwcArchive) new SwcDirectoryArchive(location)
                : lazyRead ? new SwcLazyReadArchive(location) : new SwcDynamicArchive(location);

        swc = new Swc(archive, true);
        swc.setLastModified(fileLastModified);

        if (ThreadLocalToolkit.errorCount() > 0) {
          swc = null;
        } else if (useCache) {
          swcLRUCache.put(location, swc);
        }
      } else if (Trace.swc) {
        Trace.trace("Using cached version of " + location);
      }
    } catch (Exception e) {
      if (Trace.error) {
        e.printStackTrace();
      }
      SwcException.SwcNotLoaded ex = new SwcException.SwcNotLoaded(file.getName(), e);
      ThreadLocalToolkit.log(ex);
      throw ex;
    }
    return swc;
  }