Fetches a resource from a plugin jar with the given pluginName
Returns 404 if the resource cannot be found
553796
@RequestMapping(value = "/api/resource/{pluginName}/**", method = RequestMethod.GET)
    public
    @ResponseBody
    byte[] getResourceFile(Model model, @PathVariable String pluginName, HttpServletRequest request) throws Exception {
        try {
            String url = (String) request.getAttribute(
                    HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
            String fileName = url.replaceFirst("/api/resource/" + pluginName + "/", "");

            return PluginManager.getInstance().getResource(pluginName, fileName);
        } catch (Exception e) {
            throw new ResourceNotFoundException();
        }
    }
1339823
function possiblyFetch(id, plugins_dir, options) {
    var parsedSpec = pluginSpec.parse(id);
    //Check if a mapping exists for the plugin id
    //if it does, convert id to new name id
    var newId = parsedSpec.scope ? null : pluginMapper.oldToNew[parsedSpec.id];
    if(newId) {
        if(parsedSpec.version) {
            id = newId + '@' + parsedSpec.version;
        } else {
            id = newId;
        }
    }

    // if plugin is a relative path, check if it already exists
    var plugin_src_dir = isAbsolutePath(id) ? id : path.join(plugins_dir, parsedSpec.id);

    // Check that the plugin has already been fetched.
    if (fs.existsSync(plugin_src_dir)) {
        return Q(plugin_src_dir);
    }

    var alias =  parsedSpec.scope ? null : pluginMapper.newToOld[parsedSpec.id] || newId;
    // if the plugin alias has already been fetched, use it.
    if (alias && fs.existsSync(path.join(plugins_dir, alias))) {
        events.emit('warn', 'Plugin with alternate id ' + alias + ' is already fetched, so installing it instead of ' + parsedSpec.id);
        return Q(path.join(plugins_dir, alias));
    }

    // if plugin doesnt exist, use fetch to get it.
    if (newId) {
        events.emit('warn', 'Notice: ' + parsedSpec.id + ' has been automatically converted to ' + newId + ' and fetched from npm. This is due to our old plugins registry shutting down.');
    }
    var opts = underscore.extend({}, options, {
        client: 'plugman'
    });

    return plugman.raw.fetch(id, plugins_dir, opts);
}
713113
@Override
	public Reader getResource(String resourceName) throws ResourceNotFoundException {

		return getResource(null, resourceName, false);
	}
1140754
def get_resource(url, headers):
    
    headers["Accept"] = "application/json"
    response = Catalyst_DAO().getURL(url, headers)

    if response.status != 200:
        raise DataFailureException(url, response.status, response.data)

    try:
        return json.loads(response.data)
    except ValueError as ex:
        raise DataFailureException(url, response.status, response.data)
590991
@Nullable
  public URL getResource (final String name)
  {
    URL ret = null;

    if (m_aBestCandidate != null)
    {
      ret = m_aBestCandidate.getResource (name);
      if (ret != null)
        return ret;
      m_aBestCandidate = null;
    }

    IClassLoadHelper aLoadHelper = null;

    final Iterator <IClassLoadHelper> iter = m_aLoadHelpers.iterator ();
    while (iter.hasNext ())
    {
      aLoadHelper = iter.next ();
      ret = aLoadHelper.getResource (name);
      if (ret != null)
        break;
    }

    m_aBestCandidate = aLoadHelper;
    return ret;
  }
964016
def retrieve_resource(collection, key):
    
    session = _get_session()
    cls = endpoint_class(collection)
    resource = session.query(cls).get(key)
    if resource is None:
        raise InvalidAPIUsage(404)
    return resource
873610
@Override
    public final <RS> Maybe<Response<RS>> get(String resource, Class<RS> clazz)
            throws RestEndpointIOException {
        HttpGet get = new HttpGet(spliceUrl(resource));
        return executeInternal(get, new ClassConverterCallback<RS>(serializers, clazz));
    }
1106299
def get(cls, name, definition, output_dir):
        
        if 'url' in definition:
            return URLResource(name, definition, output_dir)
        elif 'pypi' in definition:
            return PyPIResource(name, definition, output_dir)
        else:
            return Resource(name, definition, output_dir)
723597
def get_plugin(cls, name: str) -> Type[ConnectionPlugin]:
        
        if name not in cls.available:
            raise ConnectionPluginNotRegistered(
                f"Connection {name!r} is not registered"
            )
        return cls.available[name]
529076
def inspect_plugin(self, name):
        
        url = self._url('/plugins/{0}/json', name)
        return self._result(self._get(url), True)
771219
@Override
    @FFDCIgnore(MalformedURLException.class)
    public URL getResource() {
        String useRelPath = getRelativePath();

        if ( (zipEntryData == null) || zipEntryData.isDirectory() ) {
            useRelPath += "/";
        }

        URI entryUri = rootContainer.createEntryUri(useRelPath);
        if ( entryUri == null ) {
            return null;
        }

        try {
            return entryUri.toURL(); // throws MalformedURLException
        } catch ( MalformedURLException e ) {
            // In some cases an attempt is made to get a resource using the wsjar protocol
            // after the protocol has been deregistered.  It would be too much of a behavior change
            // to properly enforce the dependency on the wsjar protocol for all components.
            // Instead, only log a debug statement if a MalformedURLException is caught during
            // shutdown.
            if ( FrameworkState.isStopping() ) {
                if ( TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
                    Tr.debug(tc, "MalformedURLException during OSGi framework stop.", e.getMessage());
                } else {
                    FFDCFilter.processException(e, getClass().getName(), "269");
                }
            }
            return null;
        }
    }
811897
def _get(self, plugin_name):
        

        for p in self._plugins:
            if p.name == plugin_name:
                return p

        return None
1359196
public @CheckForNull Plugin getPlugin() {
        PluginInstanceStore pis = Jenkins.lookup(PluginInstanceStore.class);
        return pis != null ? pis.store.get(this) : null;
    }
34855
def onRefreshPluginData(self, plugin_name, data):
        
        logger.info(u"onRefreshPluginData: {}".format(plugin_name))
        if not plugin_name:
            logger.error("Missing plugin name")
            return
        reactor.callFromThread(self._sendJSON, {
            'msg': "plugin_data_get",
            'plugin_name': plugin_name
        })
1198692
function getPluginName(plugin) {
	if (isPluginFunction(plugin)) return null;

	return _.isString(plugin) ? plugin : _.head(plugin);
}
1248619
private ScriptPluginProvider getPlugin(
            final PluginMeta pluginMeta,
            final File file,
            final ProviderDef pluginDef,
            final ProviderIdent ident
    ) throws
            ProviderLoaderException, PluginException
    {
        if (null == fileExpandedDir) {
            final File dir;
            try {
                dir = expandScriptPlugin(file);
            } catch (IOException e) {
                throw new ProviderLoaderException(e, ident.getService(), ident.getProviderName());
            }
            fileExpandedDir = dir;
            if (pluginDef.getPluginType().equals("script")) {

                final File script = new File(fileExpandedDir, pluginDef.getScriptFile());
                //set executable bit for script-file of the provider
                try {
                    ScriptfileUtils.setExecutePermissions(script);
                } catch (IOException e) {
                    log.warn("Unable to set executable bit for script file: " + script + ": " + e.getMessage());
                }
            }
            debug("expanded plugin dir! " + fileExpandedDir);
        } else {
            debug("expanded plugin dir: " + fileExpandedDir);
        }
        if (pluginDef.getPluginType().equals("script")) {
            final File script = new File(fileExpandedDir, pluginDef.getScriptFile());
            if (!script.exists() || !script.isFile()) {
                throw new PluginException("Script file was not found: " + script.getAbsolutePath());
            }
        }
        return new ScriptPluginProviderImpl(pluginMeta, pluginDef, file, fileExpandedDir);
    }
68229
@Override
    protected URL findResource(String name) {
        try {
            return Whitebox.invokeMethod(deferTo, "findResource", name);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }