int i = 0;
    public static void main(String[] args) throws ServiceException {        Zimbra.toolSetup("DEBUG");        Provisioning prov = Provisioning.getInstance();        if (args.length < 3) {        	usage(null);        }                TestTask task = TestTask.valueOf(args[0]);                String host = args[1];        String queueName = args[2];        String query = null;        if (task == TestTask.search) {        	if (args.length < 4) {        		usage("no query specified");        	}        	query = args[3];        }                QueueAction action = null;        String queueIds = null;        if (task == TestTask.action) {        	if (args.length < 5) {        		usage("not enough arguments for action");        	}        	action = QueueAction.valueOf(args[3]);        	if (action == null) {        		usage("invalid action " + args[3]);        	}        	queueIds = args[4];        }                Server server = prov.getServerByName(host);        RemoteMailQueue queue = new RemoteMailQueue(server, queueName, task == TestTask.scan);        queue.waitForScan(0);        if (task == TestTask.search) {            SearchResult sr = queue.search(query, 0, 30);                        for (QueueAttr attr : sr.sitems.keySet()) {                List<SummaryItem> slist = sr.sitems.get(attr);                System.out.println("qs attr=" + attr);                Collections.sort(slist);                for (SummaryItem sitem : slist) {                    System.out.println("   " + sitem.term() + "=" + sitem.count());                }            }            //public List<Map<QueueAttr, String>> qitems = new LinkedList<Map<QueueAttr, String>>();                        for (Map<QueueAttr,String> qitem : sr.qitems) {                System.out.println("qi");                 for (QueueAttr attr : qitem.keySet()) {                    System.out.println("   " + attr + "=" + qitem.get(attr));                }            }        }                if (task == TestTask.action) {        	queue.action(server, action, queueIds.split(","));        }    }