/** * Returns the properties (name, version, dependencies, etc.) for the provided VLT package file * * @throws IOException if it can't read the file * @see #packageProperties(File) */ public static PackageId packageId(File packageFile) throws IOException { return packageProperties(packageFile).getId(); }
@Override public void beforeExtract(final PackageId packageId, final Session inspectSession, final PackageProperties packageProperties, final MetaInf metaInf, final List<PackageId> subpackages) throws RepositoryException { if (this.levelSet == null) { return; } AccessControlHandling packageMode = ofNullable(packageProperties.getACHandling()).orElse(IGNORE); if (this.levelSet == ACHandlingLevelSet.EXPLICIT) { if (!allowedModes.contains(packageMode)) { reportViolation(Violation.Severity.MAJOR, String.format("acHandling mode %s is forbidden. acHandling values in allowedModes are %s", packageMode, allowedModes), packageId); } } else { if (!this.levelSet.getAllowedModes().contains(packageMode)) { reportViolation(Violation.Severity.MAJOR, String.format("acHandling mode %s is forbidden. allowed acHandling values in levelSet:%s are %s", packageMode, this.levelSet.name().toLowerCase(), this.levelSet.getAllowedModes()), packageId); } } } }