Lookup a parcel by name
  @param resource_root: The root Resource object.
  @param product: Parcel product name
  @param version: Parcel version
  @param cluster_name: Cluster name
  @return: An ApiService object
192843
def get_parcel(resource_root, product, version, cluster_name="default"):
  
  return _get_parcel(resource_root, PARCEL_PATH % (cluster_name, product, version))
1142247
@Override
    protected URL findResource(String name) {
        URL result = null;
        // Only check the parent bundle loader if the request is outside of "" or "/"
        if (!!!"".equals(name) && !!!"/".equals(name)) {
            // First try the bundleLoader
            result = bundleLoader.getResource(name);
        }
        // This doesn't have access to ALL split packages (it just gets one) so it's augmented with a resource provider  
        return result == null ? resourceProviders.findResource(name) : result;
    }
1083950
def get_service(self, name):
    
    return services.get_service(self._get_resource_root(), name, self.name)
219447
def version(*names, **kwargs):
    '''
    
    '''
    ret = {}
    versions_as_list = \
        salt.utils.data.is_true(kwargs.pop('versions_as_list', False))
    pkg_glob = False
    if names:
        pkgs = __salt__['pkg.list_pkgs'](versions_as_list=True, **kwargs)
        for name in names:
            if '*' in name:
                pkg_glob = True
                for match in fnmatch.filter(pkgs, name):
                    ret[match] = pkgs.get(match, [])
            else:
                ret[name] = pkgs.get(name, [])
    if not versions_as_list:
        __salt__['pkg_resource.stringify'](ret)
    # Return a string if no globbing is used, and there is one item in the
    # return dict
    if len(ret) == 1 and not pkg_glob:
        try:
            return next(six.itervalues(ret))
        except StopIteration:
            return ''
    return ret
1157332
private MavenProjectModel getMavenProject(MavenProjectService mavenProjectService, String groupId, String artifactId, String version)
    {
        Iterable<MavenProjectModel> possibleProjects = mavenProjectService.findByGroupArtifactVersion(groupId, artifactId, version);
        MavenProjectModel project = null;
        for (MavenProjectModel possibleProject : possibleProjects)
        {
            if (possibleProject.getRootFileModel() != null)
            {
                return possibleProject;
            }
            else if (project == null)
            {
                project = possibleProject;
            }
        }
        return project;
    }
707219
@Override
  protected GroupShardsIterator shards(ClusterState clusterState, TermsByQueryRequest request, String[] concreteIndices) {
    Map<String, Set<String>> routingMap = indexNameExpressionResolver.resolveSearchRouting(clusterState, request.routing(), request.indices());
    return clusterService.operationRouting().searchShards(clusterState, concreteIndices, routingMap, request.preference());
  }
1113894
public Version version(String versionName, boolean pool) throws VersionException, RepositoryException
   {
      JCRName jcrVersionName = locationFactory.parseJCRName(versionName);
      VersionImpl version =
         (VersionImpl)dataManager.getItem(nodeData(), new QPathEntry(jcrVersionName.getInternalName(), 1), pool,
            ItemType.NODE, false);
      if (version == null)
      {
         throw new VersionException("There are no version with name '" + versionName + "' in the version history "
            + getPath());
      }

      return version;
   }
750326
def get_version(root):
    
    version_json = os.path.join(root, 'version.json')
    if os.path.exists(version_json):
        with open(version_json, 'r') as version_json_file:
            return json.load(version_json_file)
    return None
932080
public void createProductDelivery(final String productLogicalName, final Delivery delivery, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {      
    	final Client client = getClient(user, password);
        final WebResource resource = client.resource(serverURL).path(RequestUtils.getProductDelivery(productLogicalName));
        final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, delivery);

        client.destroy();
        if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){
            final String message = "Failed to create a delivery";
            if(LOG.isErrorEnabled()) {
                LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
            }
            throw new GrapesCommunicationException(message, response.getStatus());
        }
    }
14911
def map_version(self, requirement, local_version):
        
        if isinstance(self._versions_map, dict):
            version = self._versions_map.get(requirement, {}).get(
                local_version, local_version)
        else:
            version = self._versions_map(requirement, local_version)
        return version
244961
public PromotionEvaluationReport getModulePromotionReport(final String name, final String version) throws GrapesCommunicationException {
        return getModulePromotionReportRaw(name, version, false, PromotionEvaluationReport.class);
    }
333104
def apiv1_root_view():
    
    docs_url = current_app.config.get('DOCS_URL',
                                      'http://' + request.host + '/docs')
    message = "Welcome to the voeventdb REST API, " \
              "interface version '{}'.".format(
        apiv1.name)
    api_details = {
        'message': message,
        'api_version': apiv1.name,
        'git_sha': package_version_dict['full-revisionid'][:8],
        'version_tag': package_version_dict['version'],
        'endpoints': [str(r) for r in get_apiv1_rules()],
        'docs_url': docs_url
    }

    if 'text/html' in request.headers.get("Accept", ""):
        return render_template('landing.html',
                               **api_details
                               )
    else:
        return jsonify(api_details)
205265
def _get_store_by_name(self, name):
        """"""
        for cls in self.storage_type_map.values():
            cluster_files = glob.glob(
                '%s/%s.%s' % (self.storage_path, name, cls.file_ending))
            if cluster_files:
                try:
                    return cls(self.storage_path)
                except:
                    continue
        raise ClusterNotFound("No cluster %s was found" % name)
985498
def register_mappings(self, alias, package_name):
        
        # For backwards compatibility, we also allow for ES2 mappings to be
        # placed at the root level of the specified package path, and not in
        # the `<package-path>/v2` directory.
        if ES_VERSION[0] == 2:
            try:
                resource_listdir(package_name, 'v2')
                package_name += '.v2'
            except (OSError, IOError) as ex:
                if getattr(ex, 'errno', 0) != errno.ENOENT:
                    raise
                warnings.warn(
                    "Having mappings in a path which doesn't specify the "
                    "Elasticsearch version is deprecated. Please move your "
                    "mappings to a subfolder named according to the "
                    "Elasticsearch version which your mappings are intended "
                    "for. (e.g. '{}/v2/{}')".format(
                        package_name, alias),
                    PendingDeprecationWarning)
        else:
            package_name = '{}.v{}'.format(package_name, ES_VERSION[0])

        def _walk_dir(aliases, *parts):
            root_name = build_index_name(self.app, *parts)
            resource_name = os.path.join(*parts)

            if root_name not in aliases:
                self.number_of_indexes += 1

            data = aliases.get(root_name, {})

            for filename in resource_listdir(package_name, resource_name):
                index_name = build_index_name(
                    self.app,
                    *(parts + (filename, ))
                )
                file_path = os.path.join(resource_name, filename)

                if resource_isdir(package_name, file_path):
                    _walk_dir(data, *(parts + (filename, )))
                    continue

                ext = os.path.splitext(filename)[1]
                if ext not in {'.json', }:
                    continue

                assert index_name not in data, 'Duplicate index'
                data[index_name] = self.mappings[index_name] = \
                    resource_filename(
                        package_name, os.path.join(resource_name, filename))
                self.number_of_indexes += 1

            aliases[root_name] = data

        # Start the recursion here:
        _walk_dir(self.aliases, alias)
1278332
def get_role(self, name):
    
    return roles.get_role(self._get_resource_root(), self.name, name,
        self._get_cluster_name())
364600
public static Specification<JpaDistributionSet> likeNameAndVersion(final String name, final String version) {
        return (targetRoot, query, cb) -> cb.and(
                cb.like(cb.lower(targetRoot.<String> get(JpaDistributionSet_.name)), name.toLowerCase()),
                cb.like(cb.lower(targetRoot.<String> get(JpaDistributionSet_.version)), version.toLowerCase()));
    }
416819
@Override
	public void index(String oid) throws IndexerException {
		try {
			DigitalObject object = storage.getObject(oid);
			// Some workflow actions create payloads, so we can't iterate
			// directly against the object.
			String[] oldManifest = {};
			oldManifest = object.getPayloadIdList().toArray(oldManifest);
			for (String payloadId : oldManifest) {
				Payload payload = object.getPayload(payloadId);
				if (!payload.getLabel().matches("version_tfpackage_.*")) {
					index(object, payload);
				}
			}
		} catch (StorageException ex) {
			throw new IndexerException(ex);
		}
	}