JCRMIPermissionpublic class JCRMIPermission extends Object This class represents JCRMI permission. |
Fields Summary |
---|
private String | hashModifierHash modifier value. | private String[] | classesThe list of class names. | private int[] | methodsThe list of method identifiers. |
Constructors Summary |
---|
public JCRMIPermission(String hashModifier, Vector classList, Vector methodList)Constructor.
this.hashModifier = hashModifier;
classes = new String[classList.size()];
classList.copyInto(classes);
if (! methodList.isEmpty()) {
methods = new int[methodList.size()];
for (int i = 0; i < methodList.size(); i++) {
if (methodList.elementAt(i) instanceof String) {
methods[i] = getMethodId(hashModifier,
(String) methodList.elementAt(i));
} else {
methods[i] =
Utils.getInt((byte[])methodList.elementAt(i), 0);
}
}
}
|
Methods Summary |
---|
public boolean | checkAccess(java.lang.String className, java.lang.String method)Verify if this permission allows to invoke this method.
boolean found = false;
for (int i = 0; i < classes.length; i++) {
if (classes[i].equals(className)) {
found = true;
break;
}
}
if (! found) {
return false;
}
if (methods == null) {
return true;
}
int id = getMethodId(hashModifier, method);
for (int i = 0; i < methods.length; i++) {
if (id == methods[i])
return true;
}
return false;
| private static int | getMethodId(java.lang.String hashModifier, java.lang.String method)Calculates method ID for given hash modifier and method name.
if (hashModifier != null) {
method = hashModifier + method;
}
byte data[] = Utils.stringToBytes(method);
data = AccessControlManager.getHash(data, 0, data.length);
return Utils.getInt(data, 0);
|
|