Changeset 7226


Ignore:
Timestamp:
Nov 15, 2016, 1:35:33 PM (7 years ago)
Author:
Nicklas Nordborg
Message:

References #2041: Support for extension points within extensions

Adding more debug logging to see what it going on when scanning for updated extensions.

If using the ExtensionsFile.wasModified() method instead of the ExtensionsFile.checkModified() method (which has already been called in the ExtensionsControl.scanForChanges() method) changes in one extension will automatically be detected in other extensions depending on the same JAR file (this was implemented in [7192] and [7196]).

However it only works once. If the server admin simply closes the extension installation wizard and then open it again, only the JAR file that was actually changed will be detected and not those that depend on it.

I'll need to set up a better test case. One idea is to add an example extension point to the "Example code package" (http://baseplugins.thep.lu.se/wiki/net.sf.basedb.examplecode) that we can use for testing purposes from other extensions.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/util/JarClassLoader.java

    r7196 r7226  
    497497  public boolean hasChanged(boolean checkSecondary)
    498498  {
     499    if (log.isDebugEnabled())
     500    {
     501      log.debug("Checking if JAR has changed: " + mainJarFile);
     502    }
    499503    boolean isSame = mainJarFile.exists() &&
    500504      mainJarFile.lastModified() == jarTimeStamp && mainJarFile.length() == jarSize;
    501     if (!isSame) return true;
     505    if (!isSame)
     506    {
     507      log.debug("Main JAR file has changed: " + mainJarFile);
     508      return true;
     509    }
    502510    if (checkSecondary)
    503511    {
     
    505513      {
    506514        File jarFile = info.jarFile;
     515        if (jarFile.equals(mainJarFile)) continue; // We have already checked this one
     516       
     517        if (log.isDebugEnabled())
     518        {
     519          log.debug("Checking if secondary JAR has changed: " + jarFile);
     520        }
    507521        if (jarFile.exists())
    508522        {
     
    515529          isSame = !info.existed;
    516530        }
    517         if (!isSame) return true;
     531        if (!isSame)
     532        {
     533          log.debug("Secondary JAR file has changed: " + jarFile);
     534          return true;
     535        }
    518536      }
    519537      for (JarClassLoaderProxy proxy : proxyLoaders)
    520538      {
    521         if (proxy.hasChanged()) return true;
    522       }
    523     }
     539        if (log.isDebugEnabled())
     540        {
     541          log.debug("Checking if proxy JAR has changed: " + proxy.jarPath);
     542        }
     543        isSame = !proxy.hasChanged();
     544        if (!isSame)
     545        {
     546          log.debug("Proxy JAR has changed: " + proxy.jarPath);
     547          return true;
     548        }
     549      }
     550    }
     551   
     552    if (log.isDebugEnabled()) log.debug("JAR has not changed: " + mainJarFile);
    524553    return false;
    525554  }
  • trunk/src/core/net/sf/basedb/util/extensions/manager/ExtensionsFile.java

    r6898 r7226  
    269269  public boolean checkModified()
    270270  {
     271    log.debug("Checking if file is modified: " + uri);
    271272    wasModified = false; // Assume not modified as a starting point
    272273    if (isNew)
    273274    {
    274275      // New files are always modified
     276      log.debug("File was new: " + uri);
    275277      wasModified = true;
    276278    }
     
    278280    {
    279281      // The XML or JAR file has changed
     282      log.debug("File has been modified: " + uri);
    280283      wasModified = true;
    281284    }
     
    283286    {
    284287      // JAR files have changed if the class loader detect changes
     288      log.debug("Class path has been modified: " + uri);
    285289      wasModified = true;
     290    }
     291    else
     292    {
     293      log.debug("File has not been modified: " + uri);
    286294    }
    287295    return wasModified;
  • trunk/www/admin/extensions/wizard.jsp

    r6986 r7226  
    118118          checkInstall = true;
    119119        }
    120         else if (xtFile.checkModified())
     120        else if (xtFile.wasModified())
    121121        {
    122122          status = "Modified";
Note: See TracChangeset for help on using the changeset viewer.