bug 8373: Added new API listEventTypes

This commit is contained in:
kishan 2011-06-13 19:11:12 +05:30
parent 197dc6cf6e
commit 5a6664ab12
3 changed files with 23 additions and 0 deletions

View File

@ -497,5 +497,7 @@ public interface ManagementService {
* @return Pair<List<? extends Host>, List<Long>> List of all Hosts in VM's cluster and list of HostIds with enough capacity
*/
Pair<List<? extends Host>, List<Long>> listHostsForMigrationOfVM(UserVm vm, Long startIndex, Long pageSize);
String[] listEventTypes();
}

View File

@ -163,6 +163,7 @@ listZones=com.cloud.api.commands.ListZonesByCmd;15
#### events commands
listEvents=com.cloud.api.commands.ListEventsCmd;15
listEventTypes=com.cloud.api.commands.ListEventTypesCmd;15
#### alerts commands
listAlerts=com.cloud.api.commands.ListAlertsCmd;3

View File

@ -17,6 +17,7 @@
*/
package com.cloud.server;
import java.lang.reflect.Field;
import java.math.BigInteger;
import java.net.Inet6Address;
import java.net.InetAddress;
@ -4761,4 +4762,23 @@ public class ManagementServerImpl implements ManagementServer {
return true;
}
@Override
public String[] listEventTypes(){
Object eventObj = new EventTypes();
Class<EventTypes> c = EventTypes.class;
Field[] fields = c.getDeclaredFields();
String[] eventTypes = new String[fields.length];
try {
int i = 0;
for(Field field : fields){
eventTypes[i++] = field.get(eventObj).toString();
}
return eventTypes;
} catch (IllegalArgumentException e) {
s_logger.error("Error while listing Event Types", e);
} catch (IllegalAccessException e) {
s_logger.error("Error while listing Event Types", e);
}
return null;
}
}