Ejemplo n.º 1
0
 public String getVersion(Class<?> api) {
   log.trace("getVersion for {}", api);
   Package pkg = api.getPackage();
   log.trace("    -> {}/{}", pkg.getImplementationVersion(), pkg.getSpecificationVersion());
   String version = pkg.getSpecificationVersion();
   if (version == null) version = pkg.getImplementationVersion();
   if (version == null) {
     try {
       version = readVersionFromManifest(api);
     } catch (IOException e) {
       log.error("Could not extract version for " + api, e);
       return null;
     }
   }
   return version;
 }
Ejemplo n.º 2
0
 /**
  * Check whether a given application version is compatible with the version of JHotDraw currently
  * loaded in the Java VM. A version number is available if there is a corresponding version entry
  * in the JHotDraw jar file for the framework package.
  */
 public static boolean isCompatibleVersion(String compareVersionString) {
   //		Package pack = VersionManagement.class.getPackage();
   Package pack = packages[4];
   if (compareVersionString == null) {
     return pack.getSpecificationVersion() == null;
   } else {
     return pack.isCompatibleWith(compareVersionString);
   }
 }
Ejemplo n.º 3
0
  public static String getPackageVersion(final Package lookupPackage) {
    if (lookupPackage == null) {
      return null;
    }

    String specVersion = lookupPackage.getSpecificationVersion();
    if (specVersion != null) {
      return specVersion;
    } else {
      // search in parent package
      String normalizedPackageName = normalizePackageName(lookupPackage.getName());
      String nextPackageName = getNextPackage(normalizedPackageName);
      return getPackageVersion(Package.getPackage(nextPackageName));
    }
  }
Ejemplo n.º 4
0
 /**
  * Return the version of the main package of the framework. A version number is available if there
  * is a corresponding version entry in the JHotDraw jar file for the framework package.
  */
 public static String getJHotDrawVersion() {
   // look for the framework main package
   Package pack = packages[4];
   return pack.getSpecificationVersion();
 }