scala.collection.Map Java Examples
The following examples show how to use
scala.collection.Map.
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: KafkaHubServiceImpl.java From kafka-eagle with Apache License 2.0 | 6 votes |
private File createKafkaTempJson(Map<TopicPartition, Seq<Object>> tuple) throws IOException { JSONObject object = new JSONObject(); object.put("version", 1); JSONArray array = new JSONArray(); for (Entry<TopicPartition, Seq<Object>> entry : JavaConversions.mapAsJavaMap(tuple).entrySet()) { List<Object> replicas = JavaConversions.seqAsJavaList(entry.getValue()); JSONObject tpObject = new JSONObject(); tpObject.put("topic", entry.getKey().topic()); tpObject.put("partition", entry.getKey().partition()); tpObject.put("replicas", replicas); array.add(tpObject); } object.put("partitions", array); File f = File.createTempFile("ke_reassignment_", ".json"); FileWriter out = new FileWriter(f); out.write(object.toJSONString()); out.close(); f.deleteOnExit(); return f; }
Example #2
Source File: SingerStatus.java From singer with Apache License 2.0 | 5 votes |
private Double getGaugeValue(Map<String, Object> gauges, String gaugeName) { Double result = 0.0; if (gauges.contains(gaugeName)) { @SuppressWarnings("rawtypes") Option option = gauges.get(gaugeName); result = option.isDefined() ? (Double) option.get() : 0.0; } return result; }
Example #3
Source File: SingerStatus.java From singer with Apache License 2.0 | 5 votes |
private Long getCounterValue(Map<String, Object> counters, String counterName) { Long result = 0L; if (counters.contains(counterName)) { @SuppressWarnings("rawtypes") Option option = counters.get(counterName); result = option.isDefined() ? (Long) option.get() : 0L; } return result; }
Example #4
Source File: JavaToScalaConverter.java From fasten with Apache License 2.0 | 5 votes |
/** * Imitates a scala function2 in case of java method to be passed to scala. * @param javaFunction A java function in order to do things on scala. * @return Execution of java function as scala function2. */ public static AbstractFunction2<Method, Map<Object, Iterable<Method>>, Object> asScalaFunction2( final ScalaFunction2 javaFunction) { return new AbstractFunction2<>() { @Override public Object apply(Method v1, Map<Object, Iterable<Method>> v2) { return javaFunction.execute(v1, v2); } }; }
Example #5
Source File: KafkaTopicService.java From Decision with Apache License 2.0 | 5 votes |
@Override public void createOrUpdateTopic(String topic, int replicationFactor, int partitions) { logger.debug("Creating topic {} with replication {} and {} partitions", topic, replicationFactor, partitions); Topic.validate(topic); Seq<Object> brokerList = ZkUtils.getSortedBrokerList(zkClient); Map<Object, Seq<Object>> partitionReplicaAssignment = AdminUtils.assignReplicasToBrokers(brokerList, partitions, replicationFactor, AdminUtils.assignReplicasToBrokers$default$4(), AdminUtils.assignReplicasToBrokers$default$5()); AdminUtils.createOrUpdateTopicPartitionAssignmentPathInZK(zkClient, topic, partitionReplicaAssignment, AdminUtils.createOrUpdateTopicPartitionAssignmentPathInZK$default$4(), AdminUtils.createOrUpdateTopicPartitionAssignmentPathInZK$default$5()); logger.debug("Topic {} created", topic); }
Example #6
Source File: BeansInitializer.java From gsn with GNU General Public License v3.0 | 4 votes |
public static VSensorConfig vsensor(VsConf vs){ VSensorConfig v=new VSensorConfig(); v.setMainClass(vs.processing().className()); v.setDescription(vs.description()); v.setName(vs.name()); v.setIsTimeStampUnique(vs.processing().uniqueTimestamp()); if (vs.poolSize().isDefined()) v.setLifeCyclePoolSize(((Integer)vs.poolSize().get())); if (vs.processing().rate().isDefined()) v.setOutputStreamRate(((Integer)vs.processing().rate().get())); v.setPriority(vs.priority()); KeyValueImp [] addr=new KeyValueImp[vs.address().size()]; Iterable<String> keys=JavaConversions.asJavaIterable(vs.address().keys()); int i=0; for (String k:keys){ addr[i]=new KeyValueImp(k,vs.address().apply(k)); i++; } v.setAddressing(addr); InputStream[] is=new InputStream[vs.streams().size()]; for (int j=0;j<is.length;j++){ is[j]=stream(vs.streams().apply(j)); } v.setInputStreams(is); if (vs.processing().webInput().isDefined()){ WebInputConf wic=vs.processing().webInput().get(); v.setWebParameterPassword(wic.password()); WebInput[] wi=new WebInput[wic.commands().size()]; for (int j=0;j<wi.length;j++){ wi[j]=webInput(wic.commands().apply(j)); } v.setWebInput(wi); } DataField [] out=new DataField[(vs.processing().output().size())]; for (int j=0;j<out.length;j++){ out[j]=dataField(vs.processing().output().apply(j)); } v.setOutputStructure(out); Map<String,String> init=vs.processing().initParams(); ArrayList<KeyValue> ini=new ArrayList<KeyValue>(); Iterable<String> initkeys=JavaConversions.asJavaIterable(init.keys()); for (String ik:initkeys){ logger.trace("keys:"+ik); ini.add(new KeyValueImp(ik.toLowerCase(),init.apply(ik))); } v.setMainClassInitialParams(ini); StorageConfig st=new StorageConfig(); if (vs.storageSize().isDefined()) st.setStorageSize(vs.storageSize().get()); if (vs.storage().isDefined()){ StorageConf sc=vs.storage().get(); if (sc.identifier().isDefined()) st.setIdentifier(sc.identifier().get()); st.setJdbcDriver(sc.driver()); st.setJdbcURL(sc.url()); st.setJdbcUsername(sc.user()); st.setJdbcPassword(sc.pass()); } if (st.getStorageSize()!=null || st.getJdbcURL()!=null) v.setStorage(st); return v; }
Example #7
Source File: IndexValueRow.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
@Override public <K, V> Map<K, V> getMap(int i) { return valueRow.getMap(i); }
Example #8
Source File: IndexValueRow.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
@Override public <K, V> java.util.Map<K, V> getJavaMap(int i) { return valueRow.getJavaMap(i); }
Example #9
Source File: IndexValueRow.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
@Override public <T> scala.collection.immutable.Map<String, T> getValuesMap(Seq<String> seq) { return valueRow.getValuesMap(seq); }
Example #10
Source File: ValueRow.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
@Override public <K, V> Map<K, V> getMap(int i) { throw new UnsupportedOperationException(); }
Example #11
Source File: ValueRow.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
@Override public <K, V> java.util.Map<K, V> getJavaMap(int i) { throw new UnsupportedOperationException(); }
Example #12
Source File: ValueRow.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
@Override public <T> scala.collection.immutable.Map<String, T> getValuesMap(Seq<String> seq) { throw new UnsupportedOperationException(); }
Example #13
Source File: ScalaFunction2.java From fasten with Apache License 2.0 | votes |
Boolean execute(final Method callee, final Map<Object, Iterable<Method>> caller);