java.util.Map.Entry Java Examples
The following examples show how to use
java.util.Map.Entry.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AccessSignInterceptor.java From jeewx-boot with Apache License 2.0 | 6 votes |
private String getRedirectUrl(String requestPath, Map<String, String> paramMap) { Set<Entry<String, String>> es = paramMap.entrySet(); Iterator<Entry<String, String>> it = es.iterator(); StringBuffer sb = new StringBuffer(); sb.append(requestPath + "?"); while (it.hasNext()) { @SuppressWarnings("rawtypes") Map.Entry entry = (Map.Entry) it.next(); String k = (String) entry.getKey(); String v = (String) entry.getValue(); if (null != v && !"".equals(v) && !"null".equals(v) && !"sign".equals(k) && !"nickname".equals(k) && !"key".equals(k)) { sb.append(k + "=" + v + "&"); } } String redirectUrl = sb.toString(); redirectUrl = redirectUrl.substring(0, redirectUrl.length() - 1); logger.info("---------------redirectUrl--------------" + redirectUrl); return redirectUrl; }
Example #2
Source File: ExportParametersTest.java From TranskribusCore with GNU General Public License v3.0 | 6 votes |
@Test public void testDetermineFormat() throws JAXBException { ExportParameters params = createTestParams(); String paramsStr = JaxbUtils.marshalToJsonString(params, false); String jsonParsStr = createLegacyJsonString(params); Map<String, Object> mapOfPars = GsonUtil.toMap2(jsonParsStr); Map<String, Object> mapOfPars2 = GsonUtil.toMap2(paramsStr); for(Entry<String, Object> e : mapOfPars2.entrySet()) { logger.info(e.getKey() + " -> " + e.getValue()); } logger.debug("Legacy map class (should be String) = " + mapOfPars.get(CommonExportPars.PARAMETER_KEY).getClass()); logger.debug("When reading the ExportParameters class (is a Gson object) = " + mapOfPars2.get(CommonExportPars.PARAMETER_KEY).getClass()); Assert.assertFalse("Validation method erroneously accepted legacy object!", isExportParameterObject(jsonParsStr)); Assert.assertTrue("Validation method erroneously rejected parameter object!", isExportParameterObject(paramsStr)); }
Example #3
Source File: ApiJsonResult.java From wpcleaner with Apache License 2.0 | 6 votes |
/** * Manage query-continue in request. * * @param root Root of the JSON tree. * @param queryContinue XPath query to the query-continue node. * @param properties Properties defining request. * @return True if request should be continued. */ protected boolean shouldContinue( JsonNode root, String queryContinue, Map<String, String> properties) { if ((root == null) || (queryContinue == null)) { return false; } boolean result = false; JsonNode continueNode = root.path("continue"); if ((continueNode != null) && !continueNode.isMissingNode()) { Iterator<Entry<String, JsonNode>> continueIterator = continueNode.fields(); while (continueIterator.hasNext()) { Entry<String, JsonNode> continueElement = continueIterator.next(); String name = continueElement.getKey(); String value = continueElement.getValue().asText(); if ((name != null) && (value != null)) { properties.put(name, value); if (!"".equals(value)) { result = true; } } } } return result; }
Example #4
Source File: Main.java From DKO with GNU Lesser General Public License v2.1 | 6 votes |
private static void printHelp() { System.err.println("ERROR: Unrecognized command."); System.err.println("Syntax: java -jar lib/dko.jar <command> [command_option...]"); System.err.println(""); System.err.println("Where <command> is one of the following:"); for (Entry<String, Class<?>> e : commands.entrySet()) { System.err.print(" "); System.err.print(e.getKey()); System.err.print(":\t"); try { Method help = e.getValue().getDeclaredMethod("getDescription"); System.err.println(help.invoke(null)); } catch (Exception e1) { System.err.println("(no description available)"); } } System.err.println(""); System.err.println("For help on an individual command, run the command with '--help'."); System.err.println(""); }
Example #5
Source File: HttpClientUtils.java From ueboot with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * 向指定URL发送GET方法的请求 * * @param url 发送请求的URL * @param map 请求Map参数,请求参数应该是 {"name1":"value1","name2":"value2"}的形式。 * @param charset 发送和接收的格式 * @return URL 所代表远程资源的响应结果 */ public static String sendGet(String url, Map<String, Object> map, String charset) { StringBuffer sb = new StringBuffer(); //构建请求参数 if (map != null && map.size() > 0) { Iterator it = map.entrySet().iterator(); //定义迭代器 while (it.hasNext()) { Entry er = (Entry) it.next(); sb.append(er.getKey()); sb.append("="); sb.append(er.getValue()); sb.append("&"); } } return sendGet(url, sb.toString(), charset); }
Example #6
Source File: ConsumerOffsetManager.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
/** * 扫描数据被删除了的topic,offset记录也对应删除 */ public void scanUnsubscribedTopic() { Iterator<Entry<String, ConcurrentMap<Integer, Long>>> it = this.offsetTable.entrySet().iterator(); while (it.hasNext()) { Entry<String, ConcurrentMap<Integer, Long>> next = it.next(); String topicAtGroup = next.getKey(); String[] arrays = topicAtGroup.split(TOPIC_GROUP_SEPARATOR); if (arrays.length == 2) { //还是以前写法好 if (arrays != null && arrays.length == 2) String topic = arrays[0]; String group = arrays[1]; // 当前订阅关系里面没有group-topic订阅关系(消费端当前是停机的状态)并且offset落后很多,则删除消费进度 if (null == brokerController.getConsumerManager().findSubscriptionData(group, topic) && this.offsetBehindMuchThanData(topic, next.getValue())) { it.remove(); log.warn("remove topic offset, {}", topicAtGroup); } } } }
Example #7
Source File: AbstractGesture.java From gef with Eclipse Public License 2.0 | 6 votes |
/** * This method is called when the attached {@link IDomain} is reset to * <code>null</code> so that you can unregister previously registered event * listeners. */ protected void doDeactivate() { // remove scene change listeners for (Entry<ObservableValue<Scene>, ChangeListener<? super Scene>> entry : sceneChangeListeners .entrySet()) { ObservableValue<Scene> sceneProperty = entry.getKey(); sceneProperty.removeListener(entry.getValue()); } sceneChangeListeners.clear(); // remove viewer focus change listeners for (final IViewer viewer : new ArrayList<>( viewerFocusChangeListeners.keySet())) { viewer.viewerFocusedProperty() .removeListener(viewerFocusChangeListeners.remove(viewer)); } viewerFocusChangeListeners.clear(); // unhook scenes for (Scene scene : hookedScenes) { unhookScene(scene); } }
Example #8
Source File: HttpAdapterList.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Creates a PortAddressResolver that maps portname to its address * * @param endpointImpl application endpoint Class that eventually serves the request. */ public PortAddressResolver createPortAddressResolver(final String baseAddress, final Class<?> endpointImpl) { return new PortAddressResolver() { @Override public String getAddressFor(@NotNull QName serviceName, @NotNull String portName) { String urlPattern = addressMap.get(new PortInfo(serviceName,portName, endpointImpl)); if (urlPattern == null) { //if a WSDL defines more ports, urlpattern is null (portName does not match endpointImpl) //so fallback to the default behaviour where only serviceName/portName is checked for (Entry<PortInfo, String> e : addressMap.entrySet()) { if (serviceName.equals(e.getKey().serviceName) && portName.equals(e.getKey().portName)) { urlPattern = e.getValue(); break; } } } return (urlPattern == null) ? null : baseAddress+urlPattern; } }; }
Example #9
Source File: HttpManagementConstantHeadersTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
private static ModelNode createConstantHeadersOperation(final Map<String, List<Map<String, String>>> constantHeadersValues) { ModelNode writeAttribute = new ModelNode(); writeAttribute.get("address").set(INTERFACE_ADDRESS.toModelNode()); writeAttribute.get("operation").set("write-attribute"); writeAttribute.get("name").set("constant-headers"); ModelNode constantHeaders = new ModelNode(); for (Entry<String, List<Map<String, String>>> entry : constantHeadersValues.entrySet()) { for (Map<String, String> header: entry.getValue()) { constantHeaders.add(createHeaderMapping(entry.getKey(), header)); } } writeAttribute.get("value").set(constantHeaders); return writeAttribute; }
Example #10
Source File: BaseHibernateDao.java From framework with Apache License 2.0 | 6 votes |
/** * Description: <br> * * @author yang.zhipeng <br> * @taskId <br> * @param paramMap <br> * @param query <br> * @throws DaoException <br> */ private void setParamMap(final Map<String, Object> paramMap, final Query query) throws DaoException { if (MapUtils.isNotEmpty(paramMap)) { for (Entry<String, Object> entry : paramMap.entrySet()) { Object obj = entry.getValue(); // 这里考虑传入的参数是什么类型,不同类型使用的方法不同 if (obj instanceof Collection<?>) { query.setParameterList(entry.getKey(), (Collection<?>) obj); } else if (obj != null && obj.getClass().isArray() && obj instanceof Object[]) { query.setParameterList(entry.getKey(), (Object[]) obj); } else { query.setParameter(entry.getKey(), obj); } } } }
Example #11
Source File: QueryMacroFunction.java From datawave with Apache License 2.0 | 6 votes |
@Override public String apply(String query) { for (String key : queryMacros.keySet()) { if (query.contains(key)) { // blah blah FOO:selector blah blah ".*("+key+":([\\S]+)).*" String patternOne = ".*(" + key + ":([\\S]+)).*"; // blah blah FOO(selector1,selector2,...) blah blah ".*("+key+"\\(([\\S]+\\))).*" String patternTwo = ".*(" + key + "\\(([\\S]+)\\)).*"; Pattern pattern = Pattern.compile(patternTwo); Matcher matcher = pattern.matcher(query); while (matcher.find()) { String replacementPart = queryMacros.get(key); Map<String,String> selectorMap = getSelectorMap(matcher.group(2)); // replace the placeholders with the selectors for (Entry<String,String> entry : selectorMap.entrySet()) { replacementPart = replacementPart.replaceAll(entry.getKey(), entry.getValue()); } // then replace the macro with the replacement part query = query.replace(matcher.group(1), replacementPart); matcher = pattern.matcher(query); } } } return query; }
Example #12
Source File: Transformer.java From Diorite with MIT License | 6 votes |
private void addGlobalInjectInvokes() { MethodNode codeBefore = new MethodNode(); MethodNode codeAfter = new MethodNode(); this.fillMethodInvokes(codeBefore, codeAfter, this.classData); for (Entry<MethodNode, TransformerInitMethodData> initEntry : this.inits.entrySet()) { MethodNode init = initEntry.getKey(); TransformerInitMethodData initPair = initEntry.getValue(); MethodInsnNode superInvoke = initPair.superInvoke; if (codeAfter.instructions.size() > 0) { for (InsnNode node : initPair.returns) { init.instructions.insertBefore(node, codeAfter.instructions); } } if (codeBefore.instructions.size() > 0) { init.instructions.insert(superInvoke, codeBefore.instructions); } } }
Example #13
Source File: JavaTypeTokenizer.java From codemining-core with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * @param tokens * @param cu * @return */ private List<FullToken> getTypedTokens( final SortedMap<Integer, FullToken> tokens, final ASTNode cu) { final JavaApproximateTypeInferencer tInf = new JavaApproximateTypeInferencer( cu); tInf.infer(); final Map<Integer, String> types = tInf.getVariableTypesAtPosition(); final List<FullToken> typeTokenList = Lists.newArrayList(); for (final Entry<Integer, FullToken> token : tokens.entrySet()) { final String type = types.get(token.getKey()); if (type != null) { typeTokenList.add(new FullToken("var%" + type + "%", token .getValue().tokenType)); } else { typeTokenList.add(new FullToken(token.getValue().token, token .getValue().tokenType)); } } return typeTokenList; }
Example #14
Source File: MorphlineHandlerImpl.java From mt-flume with Apache License 2.0 | 6 votes |
@Override public void process(Event event) { Record record = new Record(); for (Entry<String, String> entry : event.getHeaders().entrySet()) { record.put(entry.getKey(), entry.getValue()); } byte[] bytes = event.getBody(); if (bytes != null && bytes.length > 0) { record.put(Fields.ATTACHMENT_BODY, bytes); } try { Notifications.notifyStartSession(morphline); if (!morphline.process(record)) { LOG.warn("Morphline {} failed to process record: {}", morphlineFileAndId, record); } } catch (RuntimeException t) { morphlineContext.getExceptionHandler().handleException(t, record); } }
Example #15
Source File: FixDataDictionaryProvider.java From sailfish-core with Apache License 2.0 | 6 votes |
private DataDictionary getDictionary() { DataDictionary localDataDictionary = dataDictionary; if (localDataDictionary == null) { synchronized(configureLock) { localDataDictionary = dataDictionary; if (localDataDictionary == null) { this.dataDictionary = localDataDictionary = new QFJDictionaryAdapter(dictionaryStructure); if(settingMap != null) { for(Entry<DataDictionarySetting, Boolean> entry : settingMap.entrySet()) { DataDictionarySetting setting = entry.getKey(); boolean flag = entry.getValue(); setting.set(localDataDictionary, flag); } } else { logger.warn("Data dictionary provider is not yet configured"); } } } } return localDataDictionary; }
Example #16
Source File: OperatorDiscoverer.java From attic-apex-core with Apache License 2.0 | 6 votes |
private void addTagsToProperties(MethodInfo mi, JSONObject propJ) throws JSONException { //create description object. description tag enables the visual tools to display description of keys/values //of a map property, items of a list, properties within a complex type. JSONObject descriptionObj = new JSONObject(); if (mi.comment != null) { descriptionObj.put("$", mi.comment); } for (Map.Entry<String, String> descEntry : mi.descriptions.entrySet()) { descriptionObj.put(descEntry.getKey(), descEntry.getValue()); } if (descriptionObj.length() > 0) { propJ.put("descriptions", descriptionObj); } //create useSchema object. useSchema tag is added to enable visual tools to be able to render a text field //as a dropdown with choices populated from the schema attached to the port. JSONObject useSchemaObj = new JSONObject(); for (Map.Entry<String, String> useSchemaEntry : mi.useSchemas.entrySet()) { useSchemaObj.put(useSchemaEntry.getKey(), useSchemaEntry.getValue()); } if (useSchemaObj.length() > 0) { propJ.put("useSchema", useSchemaObj); } }
Example #17
Source File: ClientMessageHandlerTube.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
boolean callHandlersOnRequest(MessageUpdatableContext context, boolean isOneWay) { boolean handlerResult; //Lets copy all the MessageContext.OUTBOUND_ATTACHMENT_PROPERTY to the message Map<String, DataHandler> atts = (Map<String, DataHandler>) context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS); AttachmentSet attSet = context.packet.getMessage().getAttachments(); for (Entry<String, DataHandler> entry : atts.entrySet()) { String cid = entry.getKey(); if (attSet.get(cid) == null) { // Otherwise we would be adding attachments twice Attachment att = new DataHandlerAttachment(cid, atts.get(cid)); attSet.add(att); } } try { //CLIENT-SIDE handlerResult = processor.callHandlersRequest(HandlerProcessor.Direction.OUTBOUND, context, !isOneWay); } catch (WebServiceException wse) { remedyActionTaken = true; //no rewrapping throw wse; } catch (RuntimeException re) { remedyActionTaken = true; throw new WebServiceException(re); } if (!handlerResult) { remedyActionTaken = true; } return handlerResult; }
Example #18
Source File: TransientProducerRepository.java From shardingsphere-elasticjob-cloud with Apache License 2.0 | 5 votes |
synchronized void remove(final String jobName) { for (Entry<JobKey, List<String>> each : cronTasks.entrySet()) { JobKey jobKey = each.getKey(); List<String> jobNames = each.getValue(); jobNames.remove(jobName); if (jobNames.isEmpty()) { cronTasks.remove(jobKey); } } }
Example #19
Source File: DefaultMQAdminExtImpl.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 votes |
public boolean consumed(final MessageExt msg, final String group) throws RemotingException, MQClientException, InterruptedException, MQBrokerException { ConsumeStats cstats = this.examineConsumeStats(group); ClusterInfo ci = this.examineBrokerClusterInfo(); Iterator<Entry<MessageQueue, OffsetWrapper>> it = cstats.getOffsetTable().entrySet().iterator(); while (it.hasNext()) { Entry<MessageQueue, OffsetWrapper> next = it.next(); MessageQueue mq = next.getKey(); if (mq.getTopic().equals(msg.getTopic()) && mq.getQueueId() == msg.getQueueId()) { BrokerData brokerData = ci.getBrokerAddrTable().get(mq.getBrokerName()); if (brokerData != null) { String addr = brokerData.getBrokerAddrs().get(MixAll.MASTER_ID); if (addr.equals(RemotingUtil.socketAddress2String(msg.getStoreHost()))) { /* 检查msg是否已经被消费,根据offset进行比较 */ if (next.getValue().getConsumerOffset() > msg.getQueueOffset()) { return true; } } } } } /* 还没有被消费 */ return false; }
Example #20
Source File: DefaultHeaders.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
protected void addImpl(Headers<? extends K, ? extends V, ?> headers) { if (headers instanceof DefaultHeaders) { @SuppressWarnings("unchecked") final DefaultHeaders<? extends K, ? extends V, T> defaultHeaders = (DefaultHeaders<? extends K, ? extends V, T>) headers; HeaderEntry<? extends K, ? extends V> e = defaultHeaders.head.after; if (defaultHeaders.hashingStrategy == hashingStrategy && defaultHeaders.nameValidator == nameValidator) { // Fastest copy while (e != defaultHeaders.head) { add0(e.hash, index(e.hash), e.key, e.value); e = e.after; } } else { // Fast copy while (e != defaultHeaders.head) { add(e.key, e.value); e = e.after; } } } else { // Slow copy for (Entry<? extends K, ? extends V> header : headers) { add(header.getKey(), header.getValue()); } } }
Example #21
Source File: Map.java From oopsla15-artifact with Eclipse Public License 1.0 | 5 votes |
@Override public IMap compose(IMap other) { Map that = (Map) other; IMapWriter writer; if (this.getType().hasFieldNames() && that.getType().hasFieldNames()) { /* * special treatment necessary if type contains labels */ Type newMapType = TypeFactory.getInstance().mapType( this.getType().getKeyType(), this.getType().getKeyLabel(), that.getType().getValueType(), that.getType().getValueLabel()); writer = ValueFactory.getInstance().mapWriter(newMapType); } else { writer = ValueFactory.getInstance().mapWriter(this.getType().getKeyType(), that.getType().getValueType()); } for (Iterator<Entry<IValue, IValue>> iterator = this.entryIterator(); iterator.hasNext();) { Entry<IValue, IValue> pair = iterator.next(); if (that.containsKey(pair.getValue())) writer.put(pair.getKey(), that.get(pair.getValue())); } return writer.done(); }
Example #22
Source File: CityGMLImportManager.java From importer-exporter with Apache License 2.0 | 5 votes |
protected void delegateToADEImporter(AbstractGML object, long objectId, AbstractObjectType<?> objectType) throws CityGMLImportException, SQLException { // delegate import of ADE object to an ADE importer if (object instanceof ADEModelObject) { ADEModelObject adeObject = (ADEModelObject)object; ForeignKeys foreignKeys = (ForeignKeys)object.getLocalProperty(CoreConstants.FOREIGN_KEYS_SET); if (foreignKeys == null) foreignKeys = ForeignKeys.EMPTY_SET; getADEImportManager(adeObject).importObject(adeObject, objectId, objectType, foreignKeys); } // if the object is a CityGML feature or an ADE feature derived from a CityGML feature // then check for generic ADE properties and delegate their import to an ADE importer if (object instanceof AbstractFeature && object instanceof CityGMLModuleComponent) { AbstractFeature feature = (AbstractFeature)object; List<ADEModelObject> properties = propertyCollector.getADEProperties(feature); if (properties != null && !properties.isEmpty()) { IdentityHashMap<ADEImportManager, ADEPropertyCollection> groupedBy = new IdentityHashMap<>(); for (ADEModelObject property : properties) { ADEImportManager adeImporter = getADEImportManager(property); ADEPropertyCollection collection = groupedBy.get(adeImporter); if (collection == null) { collection = new ADEPropertyCollection(); groupedBy.put(adeImporter, collection); } collection.register(property); } for (Entry<ADEImportManager, ADEPropertyCollection> entry : groupedBy.entrySet()) entry.getKey().importGenericApplicationProperties(entry.getValue(), feature, objectId, (FeatureType)objectType); } } }
Example #23
Source File: PartyChartDataManagerImpl.java From cia with Apache License 2.0 | 5 votes |
/** * Gets the max size view riksdagen vote data ballot party summary daily. * * @return the max size view riksdagen vote data ballot party summary daily */ private List<ViewRiksdagenVoteDataBallotPartySummaryDaily> getMaxSizeViewRiksdagenVoteDataBallotPartySummaryDaily() { initPartyMap(); final Optional<Entry<String, List<ViewRiksdagenVoteDataBallotPartySummaryDaily>>> first = partyMap.entrySet() .stream().sorted((e1, e2) -> Integer.compare(e2.getValue().size(), e1.getValue().size()) ).findFirst(); if (first.isPresent()) { return first.get().getValue(); } else { return new ArrayList<>(); } }
Example #24
Source File: SimpleSectionAdapter.java From adapter-kit with Apache License 2.0 | 5 votes |
/** * Returns the actual index of the object in the data source linked to the this list item. * * @param position List item position in the {@link ListView}. * @return Index of the item in the wrapped list adapter's data source. */ public int getIndexForPosition(int position) { int nSections = 0; Set<Entry<String, Integer>> entrySet = mSections.entrySet(); for(Entry<String, Integer> entry : entrySet) { if(entry.getValue() < position) { nSections++; } } return position - nSections; }
Example #25
Source File: StatsItemSet.java From DDMQ with Apache License 2.0 | 5 votes |
private void printAtDay() { Iterator<Entry<String, StatsItem>> it = this.statsItemTable.entrySet().iterator(); while (it.hasNext()) { Entry<String, StatsItem> next = it.next(); next.getValue().printAtDay(); } }
Example #26
Source File: DotAttributeBuilder.java From depgraph-maven-plugin with Apache License 2.0 | 5 votes |
@Override public String toString() { if (this.attributes.isEmpty()) { return ""; } StringBuilder sb = new StringBuilder("["); for (Entry<String, String> attribute : this.attributes.entrySet()) { sb.append(attribute.getKey()).append("=").append(attribute.getValue()).append(","); } return sb.delete(sb.length() - 1, sb.length()) .append("]") .toString(); }
Example #27
Source File: KinesisConsumer.java From attic-apex-malhar with Apache License 2.0 | 5 votes |
public static Map<String, String> getShardStatsForPartitions(List<KinesisShardStats> kinesisshardStats) { Map<String, String> result = Maps.newHashMap(); for (KinesisShardStats kms : kinesisshardStats) { for (Entry<String, String> item : kms.partitionStats.entrySet()) { result.put(item.getKey(), item.getValue()); } } return result; }
Example #28
Source File: PhoenixMetaDataCoprocessorHost.java From phoenix with Apache License 2.0 | 5 votes |
PhoenixMetaDataCoprocessorHost(RegionCoprocessorEnvironment env) throws IOException { super(null); this.env = env; this.conf = new Configuration(); for (Entry<String, String> entry : env.getConfiguration()) { conf.set(entry.getKey(), entry.getValue()); } boolean accessCheckEnabled = this.conf.getBoolean(QueryServices.PHOENIX_ACLS_ENABLED, QueryServicesOptions.DEFAULT_PHOENIX_ACLS_ENABLED); if (this.conf.get(PHOENIX_META_DATA_COPROCESSOR_CONF_KEY) == null && accessCheckEnabled) { this.conf.set(PHOENIX_META_DATA_COPROCESSOR_CONF_KEY, DEFAULT_PHOENIX_META_DATA_COPROCESSOR_CONF_KEY); } loadSystemCoprocessors(conf, PHOENIX_META_DATA_COPROCESSOR_CONF_KEY); }
Example #29
Source File: CryptoModule.java From seed with Mozilla Public License 2.0 | 5 votes |
@Override protected void configure() { // Truststore OptionalBinder.newOptionalBinder(binder(), Key.get(KeyStore.class, Names.named(TRUSTSTORE))); if (trustStore != null) { bind(KeyStore.class).annotatedWith(Names.named(TRUSTSTORE)).toInstance(trustStore); } // Keystore(s) for (Entry<String, KeyStore> keyStoreEntry : this.keyStores.entrySet()) { bind(Key.get(KeyStore.class, Names.named(keyStoreEntry.getKey()))).toInstance(keyStoreEntry.getValue()); } // Encryption service(s) for (Entry<Key<EncryptionService>, EncryptionService> entry : this.encryptionServices.entrySet()) { bind(entry.getKey()).toInstance(entry.getValue()); } // Hashing service bind(HashingService.class).to(PBKDF2HashingService.class); // SSL context OptionalBinder.newOptionalBinder(binder(), SSLContext.class); if (sslContext != null) { bind(SSLContext.class).toInstance(sslContext); } // Bind custom X509KeyManager if any if (keyManagerClass != null) { bind(X509KeyManager.class).to(keyManagerClass); } else { bind(X509KeyManager.class).toProvider(Providers.of(null)); } // KeyManager adapters should be injectable keyManagerAdapters.forEach(this::requestInjection); }
Example #30
Source File: VertexImpl.java From tez with Apache License 2.0 | 5 votes |
void mergeFrom(TaskStatistics taskStats) { if (taskStats == null) { return; } for (Map.Entry<String, org.apache.tez.runtime.api.impl.IOStatistics> entry : taskStats .getIOStatistics().entrySet()) { String ioName = entry.getKey(); IOStatisticsImpl myIOStat = ioStats.get(ioName); Preconditions.checkState(myIOStat != null, "Unexpected IO name: " + ioName + " for vertex:" + getLogIdentifier()); myIOStat.mergeFrom(entry.getValue()); } }