use of java.security.Permissions in project Payara by payara.
the class PermsHolder method getPermissions.
public PermissionCollection getPermissions(CodeSource codesource, PermissionCollection parentPC) {
String codeUrl = codesource.getLocation().toString();
PermissionCollection cachedPermissons = loaderPC.get(codeUrl);
if (cachedPermissons != null)
return cachedPermissons;
else
cachedPermissons = new Permissions();
PermissionCollection pc = parentPC;
if (pc != null) {
Enumeration<Permission> perms = pc.elements();
while (perms.hasMoreElements()) {
Permission p = perms.nextElement();
cachedPermissons.add(p);
}
}
if (declaredPermissionCollection != null) {
Enumeration<Permission> dperms = this.declaredPermissionCollection.elements();
while (dperms.hasMoreElements()) {
Permission p = dperms.nextElement();
cachedPermissons.add(p);
}
}
if (eePermissionCollection != null) {
Enumeration<Permission> eeperms = eePermissionCollection.elements();
while (eeperms.hasMoreElements()) {
Permission p = eeperms.nextElement();
cachedPermissons.add(p);
}
}
PermissionCollection tmpPc = loaderPC.putIfAbsent(codeUrl, cachedPermissons);
if (tmpPc != null) {
cachedPermissons = tmpPc;
}
return cachedPermissons;
}
Aggregations