Index the specified Collection copying all references to Certificates
and CRLs.
428004
private void buildIndex(Collection<?> coll) {
        certSubjects = new HashMap<X500Principal, Object>();
        crlIssuers = new HashMap<X500Principal, Object>();
        otherCertificates = null;
        otherCRLs = null;
        for (Object obj : coll) {
            if (obj instanceof X509Certificate) {
                indexCertificate((X509Certificate)obj);
            } else if (obj instanceof X509CRL) {
                indexCRL((X509CRL)obj);
            } else if (obj instanceof Certificate) {
                if (otherCertificates == null) {
                    otherCertificates = new HashSet<Certificate>();
                }
                otherCertificates.add((Certificate)obj);
            } else if (obj instanceof CRL) {
                if (otherCRLs == null) {
                    otherCRLs = new HashSet<CRL>();
                }
                otherCRLs.add((CRL)obj);
            } else {
                // ignore
            }
        }
        if (otherCertificates == null) {
            otherCertificates = Collections.<Certificate>emptySet();
        }
        if (otherCRLs == null) {
            otherCRLs = Collections.<CRL>emptySet();
        }
    }
572178
private static Collection<X509CRL> getMatchingCRLs
        (X509CRL crl, CRLSelector selector) {
        if (selector == null || (crl != null && selector.match(crl))) {
            return Collections.singletonList(crl);
        } else {
            return Collections.emptyList();
        }
    }
1194402
public ManageableCollection createCollectionProxy(PBKey brokerKey, Query query, Class collectionClass)
    {
        Object args[] = {brokerKey, collectionClass, query};

        try
        {
            return (ManageableCollection) getCollectionProxyConstructor(collectionClass).newInstance(args);
        }
        catch(InstantiationException ex)
        {
            throw new PersistenceBrokerException("Exception while creating a new collection proxy instance", ex);
        }
        catch(InvocationTargetException ex)
        {
            throw new PersistenceBrokerException("Exception while creating a new collection proxy instance", ex);
        }
        catch(IllegalAccessException ex)
        {
            throw new PersistenceBrokerException("Exception while creating a new collection proxy instance", ex);
        }
    }
551173
def setIndexes(self, indexes):
        
        self.__indexes = {}
        for name, index in indexes.items():
            self.__indexes[name] = index
            index.setSchema(self)
1362533
def create_indexes(cls, target=None, recreate=False):
		
		
		# TODO: Nested indexes.
		
		results = []
		collection = cls.get_collection(target)
		
		if recreate:
			collection.drop_indexes()
		
		for index in cls.__indexes__.values():
			results.append(index.create(collection))
		
		return results
1196019
public synchronized void refreshIndexes() {
		/*
		 * cache index by Bin name
		 */
		if (this.indexCache == null)
			this.indexCache = new TreeMap<String, Index>();

		Node[] nodes = client.getNodes();
		for (Node node : nodes) {
			if (node.isActive()) {
				try {
					String indexString = Info.request(getInfoPolicy(), node, "sindex");
					if (!indexString.isEmpty()) {
						String[] indexList = indexString.split(";");
						for (String oneIndexString : indexList) {
							Index index = new Index(oneIndexString);
							this.indexCache.put(index.toKeyString(), index);
						}
					}
					break;
				} catch (AerospikeException e) {
					log.error("Error geting Index informaton", e);
				}
			}
		}
	}
962985
public void createIndex(DBObject keys, DBObject options) throws MongoException {
        dbCollection.createIndex(keys, options);
    }
516792
def index_objects(self, objects, index="default"):
        """"""
        if not objects:
            return

        index_name = index
        index = self.app_state.indexes[index_name]
        indexed = set()

        with index.writer() as writer:
            for obj in objects:
                document = self.get_document(obj)
                if document is None:
                    continue

                object_key = document["object_key"]
                if object_key in indexed:
                    continue

                writer.delete_by_term("object_key", object_key)
                try:
                    writer.add_document(**document)
                except ValueError:
                    # logger is here to give us more infos in order to catch a weird bug
                    # that happens regularly on CI but is not reliably
                    # reproductible.
                    logger.error("writer.add_document(%r)", document, exc_info=True)
                    raise
                indexed.add(object_key)
616866
private Collection<X509Certificate> getMatchingEECerts
        (ReverseState currentState, List<CertStore> certStores)
        throws CertStoreException, CertificateException, IOException {

        /*
         * Compose a CertSelector to filter out
         * certs which do not satisfy requirements.
         *
         * First, retrieve clone of current target cert constraints, and
         * then add more selection criteria based on current validation state.
         */
        X509CertSelector sel = (X509CertSelector) targetCertConstraints.clone();

        /*
         * Match on issuer (subject of previous cert)
         */
        sel.setIssuer(currentState.subjectDN);

        /*
         * Match on certificate validity date.
         */
        sel.setCertificateValid(buildParams.date());

        /*
         * Policy processing optimizations
         */
        if (currentState.explicitPolicy == 0)
            sel.setPolicy(getMatchingPolicies());

        /*
         * If previous cert has a subject key identifier extension,
         * use it to match on authority key identifier extension.
         */
        /*if (currentState.subjKeyId != null) {
          AuthorityKeyIdentifierExtension authKeyId = new AuthorityKeyIdentifierExtension(
                (KeyIdentifier) currentState.subjKeyId.get(SubjectKeyIdentifierExtension.KEY_ID),
                null, null);
        sel.setAuthorityKeyIdentifier(authKeyId.getExtensionValue());
        }*/

        /*
         * Require EE certs
         */
        sel.setBasicConstraints(-2);

        /* Retrieve matching certs from CertStores */
        HashSet<X509Certificate> eeCerts = new HashSet<>();
        addMatchingCerts(sel, certStores, eeCerts, true);

        if (debug != null) {
            debug.println("ReverseBuilder.getMatchingEECerts got "
                          + eeCerts.size() + " certs.");
        }
        return eeCerts;
    }
869059
function createIndexes() {
            // create listed indexes if they don't already exist.
            return Promise.all(Object.keys(CRUD.EntityManager.entities).map(function(entityName) {
                var entity = CRUD.EntityManager.entities[entityName];
                if (('indexes' in entity)) {
                    return Promise.all(entity.indexes.map(function(index) {
                        var indexName = index.replace(/\W/g, '') + '_idx';
                        if (!(entity.table in indexes) || indexes[entity.table].indexOf(indexName) == -1) {
                            return db.execute("create index if not exists " + indexName + " on " + entity.table + " (" + index + ")").then(function(result) {
                                CRUD.log("index created: ", entity.table, index, indexName);
                                if (!(entity.table in indexes)) {
                                    indexes[entity.table] = [];
                                }
                                indexes[entity.table].push(indexName);
                                return;
                            });
                        }
                        return;
                    }));
                }
            }));
        }
868645
private Iterable<String> getAllIncluding(String index, Iterable<String> keys, IterableChain<String> result) {
        result.addAll(keys);
        for (String key : keys) {
            Iterable<String> values = get(index, key);
            if (values.iterator().hasNext()) {
                getAllIncluding(index, values, result);
            }
        }
        return result;
    }
784047
function getIndexes(done, results) {
  var client = results.client;
  var ns = mongodbNS(results.namespace);
  client
    .db(ns.database)
    .collection(ns.collection)
    .indexes(function(err, indexes) {
      if (err) {
        done(err);
      }
      // add ns field to each index
      _.each(indexes, function(idx) {
        idx.ns = ns.ns;
      });
      done(null, indexes);
    });
}
1354269
private Collection<? extends String> recursiveCollect(String refId,
      Map<String, SortedSet<String>> relationKeyMap, int maxRecursion) {
    Set<String> list = new HashSet<>();
    if (maxRecursion > 0 && relationKeyMap.containsKey(refId)) {
      SortedSet<String> subList = relationKeyMap.get(refId);
      for (String subRefId : subList) {
        list.add(subRefId);
        list.addAll(
            recursiveCollect(subRefId, relationKeyMap, maxRecursion - 1));
      }
    }
    return list;
  }
1280768
private void indexResourcesAndClassInfo() {
        // Add backrefs from Info objects back to this ScanResult
        final Collection<ClassInfo> allClassInfo = classNameToClassInfo.values();
        for (final ClassInfo classInfo : allClassInfo) {
            classInfo.setScanResult(this);
        }

        // If inter-class dependencies are enabled, create placeholder ClassInfo objects for any referenced
        // classes that were not scanned
        if (scanSpec.enableInterClassDependencies) {
            for (final ClassInfo ci : new ArrayList<>(classNameToClassInfo.values())) {
                final Set<ClassInfo> refdClasses = new HashSet<>();
                for (final String refdClassName : ci.findReferencedClassNames()) {
                    // Don't add circular dependencies
                    if (!ci.getName().equals(refdClassName)) {
                        // Get ClassInfo object for the named class, or create one if it doesn't exist
                        final ClassInfo refdClassInfo = ClassInfo.getOrCreateClassInfo(refdClassName,
                                /* classModifiers are unknown */ 0, classNameToClassInfo);
                        refdClassInfo.setScanResult(this);
                        if (!refdClassInfo.isExternalClass() || scanSpec.enableExternalClasses) {
                            // Only add class to result if it is whitelisted, or external classes are enabled
                            refdClasses.add(refdClassInfo);
                        }
                    }
                }
                ci.setReferencedClasses(new ClassInfoList(refdClasses, /* sortByName = */ true));
            }
        }
    }
353355
public void ensureIndex(final DBObject keys, final DBObject optionsIN) throws MongoException {
        dbCollection.ensureIndex(keys, optionsIN);
    }
632049
def copy(self, contents=True):
        ''''''
        cp = connection(collection=self._db_coll, baseiri=self._baseiri)
        if contents: cp.add_many(self._relationships)
        return cp
273548
private function writeIndexes()
    {
        //Begin database batch
        $this->beginBatch();

        //Index all node entities
        foreach ($this->nodeEntities as $entity)
        {
            $this->index($entity);
        }

        //Index all relation entities
        foreach ($this->relationEntities as $entity)
        {
            $this->index($entity);
        }

        //Write all repository indexes
        foreach ($this->repositories as $repository)
        {
            $repository->writeIndex();
        }

        //Commit batch to the database
        $this->commitBatch();
    }