lib/factories/service.factory.js
function getAdapter(serviceInfo, resource, moduleStack) {
        var adapterName = serviceInfo.adapterName;

        // if adapter name is 'service' and there is a default, switch to the default
        if (adapterName === 'service' && resource.adapters[this.injector.container]) {
            adapterName = serviceInfo.adapterName = resource.adapters[this.injector.container];
            serviceInfo.adapterImpl = this.injector.adapterMap[adapterName];
            serviceInfo.serviceName = utils.getCamelCase(serviceInfo.resourceName + '.' +
                serviceInfo.adapterName + '.service');
        }

        // if that doesn't work, we will assume the adapter is in the current codebase, so go get it
        var overridePath = '/resources/' + serviceInfo.resourceName + '/' + serviceInfo.resourceName + '.' +
            (adapterName === 'service' ? adapterName : adapterName + '.service');
        var adapterPath = '/adapters/' + adapterName + '/' +
            serviceInfo.adapterImpl + '.' + adapterName + '.adapter';

        // if override exists, use that one, else use the lower level adapter
        var Adapter =
            this.loadIfExists(overridePath, moduleStack, null) ||
            this.injector.adapters[serviceInfo.adapterImpl] ||
            this.loadIfExists(adapterPath, moduleStack, null);

        // if still no adapter found, then there is an issue
        if (!Adapter) {
            throw new Error('ServiceFactory could not find adapter ' + adapterName +
            ' paths ' + overridePath + ' and ' + adapterPath);
        }

        return new Adapter(resource);
    }
function getAdapter(serviceInfo, resource, moduleStack) {
        var adapterName = serviceInfo.adapterName;

        // if adapter name is 'service' and there is a default, switch to the default
        if (adapterName === 'service' && resource.adapters[this.injector.container]) {
            adapterName = serviceInfo.adapterName = resource.adapters[this.injector.container];
            serviceInfo.adapterImpl = this.injector.adapterMap[adapterName];
            serviceInfo.serviceName = utils.getCamelCase(serviceInfo.resourceName + '.' +
                serviceInfo.adapterName + '.service');
        }

        // if that doesn't work, we will assume the adapter is in the current codebase, so go get it
        var overridePath = '/resources/' + serviceInfo.resourceName + '/' + serviceInfo.resourceName + '.' +
            (adapterName === 'service' ? adapterName : adapterName + '.service');
        var adapterPath = '/adapters/' + adapterName + '/' +
            serviceInfo.adapterImpl + '.' + adapterName + '.adapter';

        // if override exists, use that one, else use the lower level adapter
        var Adapter =
            this.loadIfExists(overridePath, moduleStack, null) ||
            this.injector.adapters[serviceInfo.adapterImpl] ||
            this.loadIfExists(adapterPath, moduleStack, null);

        // if still no adapter found, then there is an issue
        if (!Adapter) {
            throw new Error('ServiceFactory could not find adapter ' + adapterName +
            ' paths ' + overridePath + ' and ' + adapterPath);
        }

        return new Adapter(resource);
    }
function getAdapter ( serviceInfo , resource , moduleStack ) { var adapterName = serviceInfo . adapterName ; // if adapter name is 'service' and there is a default, switch to the default if ( adapterName === 'service' && resource . adapters [ this . injector . container ] ) { adapterName = serviceInfo . adapterName = resource . adapters [ this . injector . container ] ; serviceInfo . adapterImpl = this . injector . adapterMap [ adapterName ] ; serviceInfo . serviceName = utils . getCamelCase ( serviceInfo . resourceName + '.' + serviceInfo . adapterName + '.service' ) ; } // if that doesn't work, we will assume the adapter is in the current codebase, so go get it var overridePath = '/resources/' + serviceInfo . resourceName + '/' + serviceInfo . resourceName + '.' + ( adapterName === 'service' ? adapterName : adapterName + '.service' ) ; var adapterPath = '/adapters/' + adapterName + '/' + serviceInfo . adapterImpl + '.' + adapterName + '.adapter' ; // if override exists, use that one, else use the lower level adapter var Adapter = this . loadIfExists ( overridePath , moduleStack , null ) || this . injector . adapters [ serviceInfo . adapterImpl ] || this . loadIfExists ( adapterPath , moduleStack , null ) ; // if still no adapter found, then there is an issue if ( ! Adapter ) { throw new Error ( 'ServiceFactory could not find adapter ' + adapterName + ' paths ' + overridePath + ' and ' + adapterPath ) ; } return new Adapter ( resource ) ; }
Get a adapter based on the service info and what exists on the file system

@param serviceInfo
@param resource
@param moduleStack
Get a adapter based on the service info and what exists on the file system