plugin: Remove memory mapping of apiname and class name in StaticRoleBasedAPIAccessChecker

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
Rohit Yadav 2013-01-02 18:21:54 -08:00
parent 65e4f00a10
commit c5b51b7c39

View File

@ -58,7 +58,6 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIA
private static List<String> s_adminCommands = null; private static List<String> s_adminCommands = null;
private static List<String> s_resourceDomainAdminCommands = null; private static List<String> s_resourceDomainAdminCommands = null;
private static List<String> s_allCommands = null; private static List<String> s_allCommands = null;
private Properties _apiCommands = null;
protected @Inject AccountManager _accountMgr; protected @Inject AccountManager _accountMgr;
@ -87,11 +86,6 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIA
return commandExists; return commandExists;
} }
@Override
public Properties getApiCommands() {
return _apiCommands;
}
private static boolean isCommandAvailableForAccount(short accountType, String commandName) { private static boolean isCommandAvailableForAccount(short accountType, String commandName) {
boolean isCommandAvailable = false; boolean isCommandAvailable = false;
switch (accountType) { switch (accountType) {
@ -130,9 +124,6 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIA
} }
private void processConfigFiles(List<String> configFiles) { private void processConfigFiles(List<String> configFiles) {
if (_apiCommands == null)
_apiCommands = new Properties();
Properties preProcessedCommands = new Properties(); Properties preProcessedCommands = new Properties();
for (String configFile : configFiles) { for (String configFile : configFiles) {
@ -160,12 +151,12 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIA
for (Object key : preProcessedCommands.keySet()) { for (Object key : preProcessedCommands.keySet()) {
String preProcessedCommand = preProcessedCommands.getProperty((String) key); String preProcessedCommand = preProcessedCommands.getProperty((String) key);
String[] commandParts = preProcessedCommand.split(";"); int splitIndex = preProcessedCommand.lastIndexOf(";");
_apiCommands.setProperty(key.toString(), commandParts[0]); // Backward compatible to old style, apiname=pkg;mask
String mask = preProcessedCommand.substring(splitIndex+1);
if (commandParts.length > 1) {
try { try {
short cmdPermissions = Short.parseShort(commandParts[1]); short cmdPermissions = Short.parseShort(mask);
if ((cmdPermissions & ADMIN_COMMAND) != 0) { if ((cmdPermissions & ADMIN_COMMAND) != 0) {
s_adminCommands.add((String) key); s_adminCommands.add((String) key);
} }
@ -187,6 +178,5 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIA
} }
} }
} }
}
} }