class ApplicationsResource extends RealmAwareResource {

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

        final Subject subject = getContextSubject(context);
        if (subject == null) {
            debug.error("ApplicationsResource :: READ : Unknown Subject");
            return new BadRequestException().asPromise();
        }

        final String realm = getRealm(context);
        try {
            final Application application = appService(subject, realm).getApplication(resourceId);
            if (application == null) {
                throw new EntitlementException(EntitlementException.APP_RETRIEVAL_ERROR, realm);
            }
            ApplicationWrapper applicationWrapper = createApplicationWrapper(application, appTypeManagerWrapper);
            return newResultPromise(newResourceResponse(resourceId,
                    Long.toString(application.getLastModifiedDate()), applicationWrapper.toJsonValue()));
        } catch (EntitlementException e) {
            debug.error("ApplicationsResource :: READ by {}: Application failed to retrieve the resource specified.",
                    getPrincipalNameFromSubject(subject), e);
            return exceptionMappingHandler.handleError(context, request, e).asPromise();
        }
    }

    @Inject public  ApplicationsResource(@Named("frRest") Debug debug, ApplicationServiceFactory applicationServiceFactory,
            ApplicationTypeManagerWrapper appTypeManagerWrapper,
            ExceptionMappingHandler<EntitlementException, ResourceException> exceptionMappingHandler);

}