Get a license by name

@param license license name
@return License
@throws java.lang.IllegalStateException when unknown license is requested
548676
public static License read(final String license) {
        final String trimmedLicense = license.trim();
        if (sLicenses.containsKey(trimmedLicense)) {
            return sLicenses.get(trimmedLicense);
        } else {
            throw new IllegalStateException(String.format("no such license available: %s, did you forget to register it?", trimmedLicense));
        }
    }
393430
public void approveLicense(final String name, final Boolean approved) {
        final DbLicense license = getLicense(name);
        repoHandler.approveLicense(license, approved);
    }
501656
def license(self, value=None):
        
        if not (value is None):
            if (self.metadatatype == "native"):
                self.metadata['license'] = value
            else:
                self._license = value
        if (self.metadatatype == "native"):
            if 'license' in self.metadata:
                return self.metadata['license']
            else:
                return None
        else:
            return self._license
1208860
public LicenseTemplate getSingleLicenseTemplate(String key) throws GitLabApiException {
        Response response = get(Response.Status.OK, null, "licenses", key);
        return (response.readEntity(LicenseTemplate.class));
    }
202521
public License<Connector<T>> getOrCreateLicense()
   {
      Node node = childNode.getOrCreate("license");
      License<Connector<T>> license = new LicenseImpl<Connector<T>>(this, "license", childNode, node);
      return license;
   }
926211
public Object service(String name) {
        Object service = this.services.get(name);
        if (service == null) {
            throw new IllegalArgumentException("Service '" + name + "' not found");
        }
        return service; 
    }
1313346
public static Class<?> getClass(String name) throws CertificateException {
        OIDInfo info = nameMap.get(name);
        return (info == null) ? null : info.getClazz();
    }
1242821
public static LicenseApi licenseApiFactory()
    {
        String licensePath = System.getProperty("user.dir") + "/" + licenseFileName;
        LicenseApi licenseApi = MiscUtils.licenseApiFactory(licensePath);
        if (licenseApi == null) {
            try {
                // Get location of jar file
                String jarLoc = VoltDB.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();
                // Strip of file name
                int lastSlashOff = jarLoc.lastIndexOf("/");
                if (lastSlashOff == -1) {
                    // Jar is at root directory
                    licensePath = "/" + licenseFileName;
                }
                else {
                    licensePath = jarLoc.substring(0, lastSlashOff+1) + licenseFileName;
                }
                licenseApi = MiscUtils.licenseApiFactory(licensePath);
            }
            catch (URISyntaxException e) {
            }
        }
        if (licenseApi == null) {
            licensePath = System.getProperty("user.home") + "/" + licenseFileName;
            licenseApi = MiscUtils.licenseApiFactory(licensePath);
        }
        if (licenseApi != null) {
            hostLog.info("Searching for license file located " + licensePath);
        }
        return licenseApi;
    }
515503
public LicenseType<ConnectorType<T>> getOrCreateLicense()
   {
      Node node = childNode.getOrCreate("license");
      LicenseType<ConnectorType<T>> license = new LicenseTypeImpl<ConnectorType<T>>(this, "license", childNode, node);
      return license;
   }
146513
public void addLicense(final String gavc, final String licenseId) {
        final DbArtifact dbArtifact = getArtifact(gavc);

        // Try to find an existing license that match the new one
        final LicenseHandler licenseHandler = new LicenseHandler(repositoryHandler);
        final DbLicense license = licenseHandler.resolve(licenseId);

        // If there is no existing license that match this one let's use the provided value but
        // only if the artifact has no license  yet. Otherwise it could mean that users has already
        // identify the license manually.
        if(license == null){
            if(dbArtifact.getLicenses().isEmpty()){
                LOG.warn("Add reference to a non existing license called " + licenseId + " in  artifact " + dbArtifact.getGavc());
                repositoryHandler.addLicenseToArtifact(dbArtifact, licenseId);
            }
        }
        // Add only if the license is not already referenced
        else if(!dbArtifact.getLicenses().contains(license.getName())){
            repositoryHandler.addLicenseToArtifact(dbArtifact, license.getName());
        }
    }
1131672
public static jazz_license get(nitro_service client) throws Exception
	{
		jazz_license resource = new jazz_license();
		resource.validate("get");
		return ((jazz_license[]) resource.get_resources(client))[0];
	}
742977
def get_license(name):
    '''
    
    '''

    filenames = os.listdir(cwd + licenses_loc)
    licenses = dict(zip(filenames, [-1] * len(filenames)))

    for l in licenses:
        licenses[l] = compute_distance(name, l)

    return min(licenses, key=(lambda k: licenses[k]))
526510
public static sdx_license[] get_filtered(nitro_service service, String filter) throws Exception
	{
		sdx_license obj = new sdx_license();
		options option = new options();
		option.set_filter(filter);
		sdx_license[] response = (sdx_license[]) obj.getfiltered(service, option);
		return response;
	}
747598
public List<LicenseTemplate> getAllLicenseTemplates() throws GitLabApiException {
        Response response = get(Response.Status.OK, null, "licenses");
        return (response.readEntity(new GenericType<List<LicenseTemplate>>() {}));
    }
1343340
public static String driversLicense() {
        StringBuffer dl = new StringBuffer(JDefaultAddress.stateAbbr());
        dl.append("-");
        dl.append(JDefaultNumber.randomNumberString(8));

        return dl.toString();
    }
1335950
def get_license(id):
    
    response = utils.checked_api_call(
        pnc_api.licenses, 'get_specific', id= id)
    if response:
        return utils.format_json(response.content)
691256
@GET
    @Produces({MediaType.APPLICATION_JSON})
    @Path("/{gavc}" + ServerAPI.GET_LICENSES)
    public Response getLicenses(@PathParam("gavc") final String gavc, @Context final UriInfo uriInfo){

        if(LOG.isInfoEnabled()) {
            LOG.info(String.format("Got a get artifact licenses request [%s]", gavc));
        }
        final LicenseListView view = new LicenseListView("Licenses of " + gavc);

        final FiltersHolder filters = new FiltersHolder();
        filters.init(uriInfo.getQueryParameters());

        final List<DbLicense> dbLicenses = getArtifactHandler().getArtifactLicenses(gavc,filters);
        for(final DbLicense license: dbLicenses){
            view.add(getModelMapper().getLicense(license));
        }

        return Response.ok(view).build();
    }