class SmsResourceProvider {

    protected ServiceConfig parentSubConfigFor(Context context, ServiceConfigManager scm)
            throws SMSException, SSOException, NotFoundException {

        Map<String, String> uriTemplateVariables = context.asContext(UriRouterContext.class).getUriTemplateVariables();

        ServiceConfig config;
        if (type == SchemaType.GLOBAL) {
            config = scm.getGlobalConfig(hasInstanceName ? uriTemplateVariables.get("name") : null);
        } else {
            config = scm.getOrganizationConfig(realmFor(context), null);
            if (!SmsRequestHandler.USE_PARENT_PATH.equals(schema.getResourceName()) && !config.exists()) {
                throw new NotFoundException("Parent service does not exist.");
            }
        }

        for (int i = 0; i < subSchemaPath.size() - 1; i++) {
            ServiceSchema schema = subSchemaPath.get(i);
            String subConfigName = schema.getResourceName();

            boolean configNeedsToExist = true;
            if (subConfigName == null || SmsRequestHandler.USE_PARENT_PATH.equals(subConfigName)) {
                subConfigName = schema.getName();
                configNeedsToExist = false;
            }

            if (uriPath.contains("{" + subConfigName + "}")) {
                subConfigName = uriTemplateVariables.get(subConfigName);
                configNeedsToExist = true;
            }

            config = config.getSubConfig(subConfigName);

            if (configNeedsToExist && !config.exists()) {
                throw new NotFoundException("Parent subconfig of type " + subConfigName + " does not exist.");
            }
        }
        return config;
    }

      SmsResourceProvider(ServiceSchema schema, SchemaType type, List<ServiceSchema> subSchemaPath, String uriPath,
            boolean serviceHasInstanceName, SmsJsonConverter converter, Debug debug,
            AMResourceBundleCache resourceBundleCache, Locale defaultLocale);

}