    public Object ac_rep_ls_$_0_99(final Args args) throws Exception
    {
        if (args.argc() > 0) {
            StringBuilder sb   = new StringBuilder();
            for (int i = 0; i < args.argc(); i++) {
                PnfsId pnfsid = new PnfsId(args.argv(i));
                sb.append(_repository.getEntry(pnfsid));
                sb.append("\n");
            }
            return sb.toString();
        }
        final DelayedReply reply = new DelayedReply();
        Thread task = new Thread() {
                void reply(Object o)
                    throws InterruptedException
                {
                    try {
                        reply.send(o);
                    } catch (NoRouteToCellException e) {
                        _log.error("Failed to send reply for 'rep ls': " + e);
                    }
                }
                public void run()
                {
                    try {
                        try {
                            reply(list());
                        } catch (CacheException e) {
                            reply(e);
                        } catch (RuntimeException e) {
                            reply(e);
                        }
                    } catch (InterruptedException e) {
                        _log.warn("Interrupted while listing: " + e);
                    }
                }
                private Object list()
                    throws CacheException, InterruptedException
                {
                    StringBuilder sb = new StringBuilder();
                    String stat = args.getOpt("s");
                    if (stat != null) {
                        long dev = 1;
                        dev = (stat.indexOf("k") > -1) ||
                            (stat.indexOf("K") > -1) ? 1024L : dev;
                        dev = (stat.indexOf("m") > -1) ||
                            (stat.indexOf("M") > -1) ? (1024L*1024L) : dev;
                        dev = (stat.indexOf("g") > -1) ||
                            (stat.indexOf("G") > -1) ? (1024L*1024L*1024L) : dev;
                        dev = (stat.indexOf("t") > -1) ||
                            (stat.indexOf("T") > -1) ? (1024L*1024L*1024L*1024L) : dev;
                        Map<String,long[]> map = new HashMap<String,long[]>();
                        long removable = 0L;
                        for (PnfsId id: _repository) {
                            try {
                                CacheEntry entry = _repository.getEntry(id);
                                StorageInfo info = entry.getStorageInfo();
                                if (info == null) continue;
                                String sc = info.getStorageClass()
                                    + "@" + info.getHsm();
                                long[] counter = map.get(sc);
                                if (counter == null)
                                    map.put(sc, counter = new long[8]);
                                boolean sticky = entry.isSticky();
                                boolean precious =
                                    (entry.getState() == EntryState.PRECIOUS);
                                long entrySize = entry.getReplicaSize();
                                counter[0] += entrySize;
                                counter[1]++;
                                if (precious) {
                                    counter[2] += entrySize;
                                    counter[3]++;
                                }
                                if (sticky) {
                                    counter[4] += entrySize;
                                    counter[5]++;
                                }
                                if (!precious && !sticky) {
                                    counter[6] += entrySize;
                                    removable  += entrySize;
                                    counter[7]++;
                                }
                            } catch (FileNotInCacheException e) {
                            }
                        }
                        if (args.getOpt("sum") != null) {
                            long[] counter = new long[10];
                            map.put("total", counter);
                            SpaceRecord record = _repository.getSpaceRecord();
                            counter[0] = record.getTotalSpace();
                            counter[1] = record.getFreeSpace();
                            counter[2] = removable;
                        }
                        Iterator<String> e2 = map.keySet().iterator();
                        if (args.getOpt("binary") != null) {
                            Object [] result = new Object[map.size()];
                            for (int i = 0; e2.hasNext(); i++) {
                                Object[] ex =  new Object[2];
                                ex[0]  = e2.next();
                                ex[1]  = map.get(ex[0]);
                                result[i] = ex;
                            }
                            return result;
                        }
                        while (e2.hasNext()) {
                            String sc = e2.next();
                            long[] counter = map.get(sc);
                            sb.append(Formats.field(sc,24,Formats.LEFT)).
                                append("  ").
                                append(Formats.field(""+counter[0]/dev,10,Formats.RIGHT)).
                                append("  ").
                                append(Formats.field(""+counter[1],8,Formats.RIGHT)).
                                append("  ").
                                append(Formats.field(""+counter[2]/dev,10,Formats.RIGHT)).
                                append("  ").
                                append(Formats.field(""+counter[3],8,Formats.RIGHT)).
                                append("  ").
                                append(Formats.field(""+counter[4]/dev,10,Formats.RIGHT)).
                                append("  ").
                                append(Formats.field(""+counter[5],8,Formats.RIGHT)).
                                append("  ").
                                append(Formats.field(""+counter[6]/dev,10,Formats.RIGHT)).
                                append("  ").
                                append(Formats.field(""+counter[7],8,Formats.RIGHT)).
                                append("\n");
                        }
                    } else  {
                        String format = args.getOpt("l");
                        format = format == null ? "" : format;
                        boolean notcached = format.indexOf("nc") > -1;
                        boolean precious  = format.indexOf('p')  > -1;
                        boolean locked    = format.indexOf('l')  > -1;
                        boolean sticky    = format.indexOf('s')  > -1;
                        boolean used      = format.indexOf('u')  > -1;
                        boolean broken    = format.indexOf('e')  > -1;
                        for (PnfsId id: _repository) {
                            try {
                                CacheEntry entry = _repository.getEntry(id);
                                EntryState state = entry.getState();
                                if (format.length() == 0 ||
                                    (notcached && state != EntryState.CACHED) ||
                                    (precious && state == EntryState.PRECIOUS) ||
                                    (sticky && entry.isSticky()) ||
                                    (broken && state == EntryState.BROKEN) ||
                                    (used && entry.getLinkCount() > 0)) {
                                    sb.append(entry).append('\n');
                                }
                            } catch (FileNotInCacheException e) {
                            }
                        }
                    }
                    return sb.toString();
                }
            };
        task.start();
        return reply;
    }

    public Object ac_rep_ls_$_0_99(final Args args) throws Exception
    {
        if (args.argc() > 0) {
            StringBuilder sb   = new StringBuilder();
            for (int i = 0; i < args.argc(); i++) {
                PnfsId pnfsid = new PnfsId(args.argv(i));
                sb.append(_repository.getEntry(pnfsid));
                sb.append("\n");
            }
            return sb.toString();
        }
        final DelayedReply reply = new DelayedReply();
        Thread task = new Thread() {
                void reply(Object o)
                    throws InterruptedException
                {
                    try {
                        reply.send(o);
                    } catch (NoRouteToCellException e) {
                        _log.error("Failed to send reply for 'rep ls': " + e);
                    }
                }
                public void run()
                {
                    try {
                        try {
                            reply(list());
                        } catch (CacheException e) {
                            reply(e);
                        } catch (RuntimeException e) {
                            reply(e);
                        }
                    } catch (InterruptedException e) {
                        _log.warn("Interrupted while listing: " + e);
                    }
                }
                private Object list()
                    throws CacheException, InterruptedException
                {
                    StringBuilder sb = new StringBuilder();
                    String stat = args.getOpt("s");
                    if (stat != null) {
                        long dev = 1;
                        dev = (stat.indexOf("k") > -1) ||
                            (stat.indexOf("K") > -1) ? 1024L : dev;
                        dev = (stat.indexOf("m") > -1) ||
                            (stat.indexOf("M") > -1) ? (1024L*1024L) : dev;
                        dev = (stat.indexOf("g") > -1) ||
                            (stat.indexOf("G") > -1) ? (1024L*1024L*1024L) : dev;
                        dev = (stat.indexOf("t") > -1) ||
                            (stat.indexOf("T") > -1) ? (1024L*1024L*1024L*1024L) : dev;
                        Map<String,long[]> map = new HashMap<String,long[]>();
                        long removable = 0L;
                        for (PnfsId id: _repository) {
                            try {
                                CacheEntry entry = _repository.getEntry(id);
                                StorageInfo info = entry.getStorageInfo();
                                if (info == null) continue;
                                String sc = info.getStorageClass()
                                    + "@" + info.getHsm();
                                long[] counter = map.get(sc);
                                if (counter == null)
                                    map.put(sc, counter = new long[8]);
                                boolean sticky = entry.isSticky();
                                boolean precious =
                                    (entry.getState() == EntryState.PRECIOUS);
                                long entrySize = entry.getReplicaSize();
                                counter[0] += entrySize;
                                counter[1]++;
                                if (precious) {
                                    counter[2] += entrySize;
                                    counter[3]++;
                                }
                                if (sticky) {
                                    counter[4] += entrySize;
                                    counter[5]++;
                                }
                                if (!precious && !sticky) {
                                    counter[6] += entrySize;
                                    removable  += entrySize;
                                    counter[7]++;
                                }
                            } catch (FileNotInCacheException e) {
                            }
                        }
                        if (args.getOpt("sum") != null) {
                            long[] counter = new long[10];
                            map.put("total", counter);
                            SpaceRecord record = _repository.getSpaceRecord();
                            counter[0] = record.getTotalSpace();
                            counter[1] = record.getFreeSpace();
                            counter[2] = removable;
                        }
                        Iterator<String> e2 = map.keySet().iterator();
                        if (args.getOpt("binary") != null) {
                            Object [] result = new Object[map.size()];
                            for (int i = 0; e2.hasNext(); i++) {
                                Object[] ex =  new Object[2];
                                ex[0]  = e2.next();
                                ex[1]  = map.get(ex[0]);
                                result[i] = ex;
                            }
                            return result;
                        }
                        while (e2.hasNext()) {
                            String sc = e2.next();
                            long[] counter = map.get(sc);
                            sb.append(Formats.field(sc,24,Formats.LEFT)).
                                append("  ").
                                append(Formats.field(""+counter[0]/dev,10,Formats.RIGHT)).
                                append("  ").
                                append(Formats.field(""+counter[1],8,Formats.RIGHT)).
                                append("  ").
                                append(Formats.field(""+counter[2]/dev,10,Formats.RIGHT)).
                                append("  ").
                                append(Formats.field(""+counter[3],8,Formats.RIGHT)).
                                append("  ").
                                append(Formats.field(""+counter[4]/dev,10,Formats.RIGHT)).
                                append("  ").
                                append(Formats.field(""+counter[5],8,Formats.RIGHT)).
                                append("  ").
                                append(Formats.field(""+counter[6]/dev,10,Formats.RIGHT)).
                                append("  ").
                                append(Formats.field(""+counter[7],8,Formats.RIGHT)).
                                append("\n");
                        }
                    } else  {
                        String format = args.getOpt("l");
                        format = format == null ? "" : format;
                        boolean notcached = format.indexOf("nc") > -1;
                        boolean precious  = format.indexOf('p')  > -1;
                        boolean locked    = format.indexOf('l')  > -1;
                        boolean sticky    = format.indexOf('s')  > -1;
                        boolean used      = format.indexOf('u')  > -1;
                        boolean broken    = format.indexOf('e')  > -1;
                        boolean cached    = format.indexOf('c')  > -1;
                        for (PnfsId id: _repository) {
                            try {
                                CacheEntry entry = _repository.getEntry(id);
                                EntryState state = entry.getState();
                                if (format.length() == 0 ||
                                    (notcached && state != EntryState.CACHED) ||
                                    (precious && state == EntryState.PRECIOUS) ||
                                    (sticky && entry.isSticky()) ||
                                    (broken && state == EntryState.BROKEN) ||
                                    (cached && state == EntryState.CACHED) ||
                                    (used && entry.getLinkCount() > 0)) {
                                    sb.append(entry).append('\n');
                                }
                            } catch (FileNotInCacheException e) {
                            }
                        }
                    }
                    return sb.toString();
                }
            };
        task.start();
        return reply;
    }
