inject resources
332278
@PostConstruct
	public void configure() {
		if (identityProvider.isUnsatisfied()) {
			setIdentityProvider(new EJBContextIdentityProvider(context));
		} else {
			setIdentityProvider(identityProvider.get());
		}
	}
209094
function inject (taskKey) {
    var taskName = task[taskKey]

    var num = parseFloat(taskName)

    if (!isNaN(num)) {
      funcs[taskName] = function () { return num }
    }
  }
25534
@Override
    public ResourceReferenceFactory<Object> registerResourceInjectionPoint(final InjectionPoint injectionPoint) {
        return new ResourceReferenceFactory<Object>() {
            @Override
            public ResourceReference<Object> createResource() {
                return new SimpleResourceReference<Object>(resolveResource(injectionPoint));
            }
        };
    }
597804
function addResources (statebox, options) {
  options.messages.info('Adding resources...')
  const stateResources = options.pluginComponents.stateResources
  if (!_.isObject(stateResources)) {
    return
  }

  const resourceClasses = {}
  for (const [name, resource] of Object.entries(stateResources)) {
    options.messages.detail(`Adding ${name}`)
    resourceClasses[name] = resource.componentModule
  } // for ...

  statebox.createModuleResources(resourceClasses)

  statebox.registerResourceResolver('function', functionResolver)
}
330236
private void initializeInjector(final Injector runtimeInjector) throws InjectionException {

    copyEventHandler(runtimeInjector, RuntimeParameters.ResourceStatusHandler.class);
    copyEventHandler(runtimeInjector, RuntimeParameters.NodeDescriptorHandler.class);
    copyEventHandler(runtimeInjector, RuntimeParameters.ResourceAllocationHandler.class);
    copyEventHandler(runtimeInjector, RuntimeParameters.RuntimeStatusHandler.class);

    try {
      runtimeInjector.bindVolatileInstance(HttpServer.class, this.originalInjector.getInstance(HttpServer.class));
      LOG.log(Level.INFO, "Binding http server for the runtime implementation");
    } catch (final InjectionException e) {
      LOG.log(Level.INFO, "Http Server is not configured for the runtime", e);
    }
  }
180522
function injectScript() {

    // Creating script element
    var script = document.createElement('script'),
        body = document.getElementsByTagName('body')[0];

    script.src = chrome.extension.getURL('build/artoo.chrome.js');
    script.type = 'text/javascript';
    script.id = 'artoo_injected_script';
    script.setAttribute('chrome', 'true');

    // Appending to body
    body.appendChild(script);
  }
1162202
function loadResources() {
        var resources = {};
        var resourcesDir = path.join(this.injector.rootDir, this.injector.servicesDir + '/resources');


        if (!fs.existsSync(resourcesDir)) {
            return resources;
        }

        var me = this;
        var resourceNames = fs.readdirSync(resourcesDir);

        _.each(resourceNames, function (resourceName) {
            if (resourceName.substring(resourceName.length - 3) !== '.js') {  // only dirs, not js files
                resources[resourceName] = me.injector.loadModule(utils.getCamelCase(resourceName + '.resource'));
            }
        });

        return resources;
    }
21024
def inject(self, contents=None, **kwargs):
        
        if contents and not isinstance(contents, dict):
            raise WrongContentError(self, contents, "contents should be a dict")
        self._stable = False
        if not contents:
            contents = {}
        if kwargs:
            contents.update(kwargs)
        self.content_data.update(contents)
        return self
565667
function injectParams(pattern, params) {
    params = params || {};

    var splatIndex = 0;

    return pattern.replace(paramInjectMatcher, function (match, paramName) {
      paramName = paramName || 'splat';

      // If param is optional don't check for existence
      if (paramName.slice(-1) === '?') {
        paramName = paramName.slice(0, -1);

        if (params[paramName] == null) return '';
      } else {
        invariant(params[paramName] != null, 'Missing "%s" parameter for path "%s"', paramName, pattern);
      }

      var segment;
      if (paramName === 'splat' && Array.isArray(params[paramName])) {
        segment = params[paramName][splatIndex++];

        invariant(segment != null, 'Missing splat # %s for path "%s"', splatIndex, pattern);
      } else {
        segment = params[paramName];
      }

      return segment;
    }).replace(paramInjectTrailingSlashMatcher, '/');
  }
126783
function addResourceRoute(routePath, controllerName) {
		resourceRouting.forEach(function(route) {
			var actionPath = route.path.replace(':controller', controllerName);
			route.verbs.forEach(function (verb) {
				addSingleRoute(verb, actionPath, controllerName, route.target.action);
			});
		});
	}
858762
static WebServiceRef createWebServiceRefFromResource(Resource resource, Class<?> typeClass, String jndiName) throws InjectionException {
        // notice we send in 'Service.class' for the 'value' attribute, this is
        // because only service type injections are possible with the @Resource
        // annotation, so we'll use the default value for the 'value' attribute.
        return new WebServiceRefSimulator(resource.mappedName(), jndiName, typeClass, Service.class, null, "");
    }
560211
private void addInjectionTarget(Injectable resource, Map<String, Map<String, String>> injectionMap) {
        List<InjectionTarget> injectionTargets = resource.getInjectionTargets();
        if (injectionTargets != null && injectionTargets.size() > 0) {
            String jndiName = resource.getName();
            for (InjectionTarget injectionTarget: injectionTargets) {
                String clazz = injectionTarget.getTargetClass();
                Map<String, String> injections = injectionMap.get(clazz);
                if (injections == null) {
                    injections = new HashMap<String, String>();
                    injectionMap.put(clazz, injections);
                }
                injections.put(injectionTarget.getTargetName(), jndiName);
            }
        }
    }
426184
protected function insertOtherResource()
    {
        $items = $this->package->getNonStorageServices();
        $imported = false;

        foreach ($items as $service => $resources) {
            foreach ($resources as $resourceName => $details) {
                try {
                    $api = $service . '/' . $resourceName;
                    switch ($api) {
                        case 'system/app':
                        case 'system/role':
                        case 'system/service':
                        case 'system/event_script':
                        case 'system/user':
                            // Skip; already imported at this point.
                            break;
                        case $service . '/_table':
                            $imported = $this->insertDbTableResources($service);
                            break;
                        case $service . '/_proc':
                        case $service . '/_func':
                            // Not supported at this time.
                            $this->log('warning', 'Skipping resource ' . $resourceName . '. Not supported.');
                            break;
                        default:
                            $imported = $this->insertGenericResources($service, $resourceName);
                            break;
                    }
                } catch (UnauthorizedException $e) {
                    $this->log(
                        'error',
                        'Failed to insert resources for ' . $service . '/' . $resourceName . '. ' . $e->getMessage()
                    );
                }
            }
        }

        return $imported;
    }
382827
function inject() {
        if (!WIN || !needsInject) { return }
        needsInject = false;
        var style = Object.keys(byName)
          .map(function (k) { return byName[k]; })
          .concat(remainder).join('\n');
        /* istanbul ignore next */
        if (cssTextProp) { cssTextProp.cssText = style; }
        else { styleNode.innerHTML = style; }
      }
433465
public static void injectResources(Props props) {
    // Add mapred, yarn and hdfs site configs (in addition to core-site, which
    // is automatically added) as default resources before we add the injected
    // configuration. This will cause the injected properties to override the
    // default site properties (instead of vice-versa). This is safe to do,
    // even when these site files don't exist for your Hadoop installation.
    if (props.getBoolean("azkaban.inject.hadoop-site.configs", true)) {
      Configuration.addDefaultResource("mapred-default.xml");
      Configuration.addDefaultResource("mapred-site.xml");
      Configuration.addDefaultResource("yarn-default.xml");
      Configuration.addDefaultResource("yarn-site.xml");
      Configuration.addDefaultResource("hdfs-default.xml");
      Configuration.addDefaultResource("hdfs-site.xml");
    }
    Configuration.addDefaultResource(INJECT_FILE);
  }
1293497
function injectJs(jsList, content) {
        var script = jsList.reduce(function (prev, now) {
            var uri = now.uri;
            return [prev, '<script type="text/javascript" src="', uri, '"></script>\r\n'].join('');
        }, '');
        if (content.indexOf(settings.scriptTag) !== -1) {
            content = content.replace(settings.scriptTag, script);
        }
        else {
            content = content.replace(/<\/head>/, script + '\n$&');
        }
        return content;
    }
1041039
function createInjector(options) {

  options = options || {};

  var configModule = {
    'config': ['value', options]
  };

  var modules = [ configModule, CoreModule ].concat(options.modules || []);

  return bootstrap(modules);
}