class ResourceTypesResource extends RealmAwareResource {

    @Override
    public Promise<ResourceResponse, ResourceException> readInstance(Context context, String resourceId,
            ReadRequest request) {

        String principalName = "unknown";
        try {
            Subject theSubject = getSubject(context);
            principalName = PrincipalRestUtils.getPrincipalNameFromSubject(theSubject);
            final String realm = getRealm(context);

            ResourceType resourceType = resourceTypeService.getResourceType(theSubject, realm, resourceId);
            if (resourceType == null) {
                throw new EntitlementException(NO_SUCH_RESOURCE_TYPE, resourceId, realm);
            }
            JsonResourceType wrapper = new JsonResourceType(resourceType);

            final ResourceResponse resource = newResourceResponse(resourceId,
                    String.valueOf(currentTimeMillis()),
                    JsonValue.json(wrapper.toJsonValue()));
            return newResultPromise(resource);

        } catch (EntitlementException ee) {
            if (logger.errorEnabled()) {
                logger.error("ResourceTypesResource :: READ by "
                        + principalName
                        + ": Could not jsonify class associated with defined Type: " + resourceId, ee);
            }
            return exceptionMappingHandler.handleError(context, request, ee).asPromise();
        }
    }

    @Inject public  ResourceTypesResource(
            @Named("frRest") Debug logger,
            ExceptionMappingHandler<EntitlementException, ResourceException> exceptionMappingHandler,
            ResourceTypeService resourceTypeService);

}