}
/* Utility operations */
protected Set<SystemPackage> createSystemPackages() {
final JavaPackageScanner packageScanner = javaPackageScanner.getObject();
final boolean validCache = packageScanner.isCacheValid(configuration.getSystemPackageCache());
Set<SystemPackage> packages;
if (validCache) {
packages = getCachedPackages();
} else {
packages = Collections.emptySet();
}
final boolean cacheDoesNotExist = CollectionUtils.isEmpty(packages);
final PackageCacheMode packageCacheMode = configuration.getSystemPackageCacheMode();
if (packageCacheMode.isReadFromCache() == false || cacheDoesNotExist || !validCache) {
packages = packageScanner.scanWebApplicationPackages();
}
if (packageCacheMode.isForceWriteToCache() || (cacheDoesNotExist && packageCacheMode.isWriteToCache())) {
writeCachedPackages(packages);
}