class ServiceHost implements ServiceRequestSender {

    public void queryServiceUris(String servicePath, Operation get) {
        // TODO Use Radix trees for efficient prefix searches. This is not
        // urgent since we consider queries directly on the host instead of the
        // document index, to be rare

        ServiceDocumentQueryResult r = new ServiceDocumentQueryResult();

        boolean doPrefixMatch = servicePath.endsWith(UriUtils.URI_WILDCARD_CHAR);
        servicePath = servicePath.replace(UriUtils.URI_WILDCARD_CHAR, "");

        for (AttachedServiceInfo serviceInfo : this.attachedServices.values()) {
            Service s = serviceInfo.service;
            if (s.getProcessingStage() != ProcessingStage.AVAILABLE) {
                continue;
            }
            if (s.hasOption(ServiceOption.UTILITY)) {
                continue;
            }
            String path = s.getSelfLink();
            if (doPrefixMatch) {
                if (!path.startsWith(servicePath)) {
                    continue;
                }
            } else {
                if (!path.equals(servicePath)) {
                    continue;
                }
            }

            // For wildcard search on index-service(e.g.: "/core/document-index?documentSelfLink=/core/examples/*"),
            // when there is no matching in data store, it also searches available services on the host.
            // Since document-index is already searched, only non-persisted stateful or stateless services are the
            // target to check the authorization.
            if (isAuthorizationEnabled()) {
                // For non-persisted service, state is kept in resource-tracker cache.
                // For stateless service, resource-tracker returns null.
                // When null is passed to "isAuthorized()" method, it creates an empty ServiceDocument with self link
                // from passed service; so that, it can check auth against selflink for stateless services.
                // This is same behavior in "StatelessService#authorizeRequest()"
                ServiceDocument state = this.serviceResourceTracker.getCachedServiceState(s, get);
                if (!isAuthorized(s, state, get)) {
                    continue;
                }
            }

            r.documentLinks.add(path);
        }
        r.documentOwner = getId();
        r.documentCount = (long) r.documentLinks.size();
        get.setBodyNoCloning(r).complete();
    }

    protected  ServiceHost();

}