class ModelBean {

    @GET
    @Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
            "application/x-protostuff", "text/html"})
    @Path("/list")
    @GZIP
    @Interceptors(ResponseInterceptor.class)
    public ModelList listModelNames(@QueryParam("modelTableName") String modelTableName) {
        
        if (modelTableName == null) {
            modelTableName = defaultModelTableName;
        }
        
        ModelList response = new ModelList(jqueryUri, dataTablesUri, modelTableName);
        
        // Find out who/what called this method
        Principal p = ctx.getCallerPrincipal();
        String user = p.getName();
        Set<Authorizations> cbAuths = new HashSet<>();
        if (p instanceof DatawavePrincipal) {
            DatawavePrincipal cp = (DatawavePrincipal) p;
            user = cp.getShortName();
            for (Collection<String> auths : cp.getAuthorizations()) {
                cbAuths.add(new Authorizations(auths.toArray(new String[auths.size()])));
            }
        }
        log.trace(user + " has authorizations " + cbAuths);
        
        Connector connector = null;
        HashSet<String> modelNames = new HashSet<>();
        try {
            Map<String,String> trackingMap = connectionFactory.getTrackingMap(Thread.currentThread().getStackTrace());
            connector = connectionFactory.getConnection(AccumuloConnectionFactory.Priority.LOW, trackingMap);
            try (Scanner scanner = ScannerHelper.createScanner(connector, this.checkModelTableName(modelTableName), cbAuths)) {
                for (Entry<Key,Value> entry : scanner) {
                    String colf = entry.getKey().getColumnFamily().toString();
                    if (!RESERVED_COLF_VALUES.contains(colf) && !modelNames.contains(colf)) {
                        String[] parts = colf.split(ModelKeyParser.NULL_BYTE);
                        if (parts.length == 1)
                            modelNames.add(colf);
                        else if (parts.length == 2)
                            modelNames.add(parts[0]);
                    }
                }
            }
            
        } catch (Exception e) {
            QueryException qe = new QueryException(DatawaveErrorCode.MODEL_NAME_LIST_ERROR, e);
            log.error(qe);
            response.addException(qe.getBottomQueryException());
            throw new DatawaveWebApplicationException(qe, response);
        } finally {
            if (null != connector) {
                try {
                    connectionFactory.returnConnection(connector);
                } catch (Exception e) {
                    log.error("Error returning connection to factory", e);
                }
            }
        }
        response.setNames(modelNames);
        return response;
    }

}