An abstract method that Executes the command
if (!validateOptions())
throw new CommandValidationException("Validation failed");
String objectName = getObjectName();
Object[] params = getParamsInfo();
String operationName = getOperationName();
String[] types = getTypesInfo();
String[] map = null;
String[] principals = null;
String[] usergroups = null;
AttributeList list = null;
list =(AttributeList) params[0];
if(list != null){
int s = list.size();
int i = 0 ;
for(i=0;i<s;i++)
{
Attribute attribute =(Attribute)list.get(i);
if(attribute.getName().equalsIgnoreCase("principal"))
{
String principal = (String)attribute.getValue();
principals =((String[]) getListOfValues(principal));
list.set(i,new Attribute("principal",principals));
}
if ((attribute.getName().equalsIgnoreCase("user_group")))
{
String usergroup = (String)attribute.getValue();
usergroups = ((String[])getListOfValues(usergroup));
list.set(i,new Attribute("user_group",usergroups));
}
}
}
MBeanServerConnection mbsc = getMBeanServerConnection(getHost(), getPort(),
getUser(), getPassword());
try
{
ObjectName object =(ObjectName)mbsc.invoke(new ObjectName(objectName),
operationName, params, types);
CLILogger.getInstance().printDetailMessage(getLocalizedString(
"CommandSuccessful",
new Object[] {name}));
}
catch(Exception e)
{
if (e.getLocalizedMessage() != null)
CLILogger.getInstance().printDetailMessage(e.getLocalizedMessage());
throw new CommandException(getLocalizedString("CommandUnSuccessful",
new Object[] {name} ), e);
}