@Override public TopicMetadataResponse send(TopicMetadataRequest request) { java.util.List<String> topics = request.topics(); TopicMetadata[] topicMetadataArray = new TopicMetadata[topics.size()]; for (int i = 0; i < topicMetadataArray.length; i++) { String topic = topics.get(i); if (!topic.equals(topicName)) { topicMetadataArray[i] = new TopicMetadata(topic, null, Errors.UNKNOWN_TOPIC_OR_PARTITION.code()); } else { PartitionMetadata[] partitionMetadataArray = new PartitionMetadata[partitionCount]; for (int j = 0; j < partitionCount; j++) { java.util.List<BrokerEndPoint> emptyJavaList = Collections.emptyList(); List<BrokerEndPoint> emptyScalaList = JavaConversions.asScalaBuffer(emptyJavaList).toList(); partitionMetadataArray[j] = new PartitionMetadata(j, Some.apply(brokerArray[partitionLeaderIndices[j]]), emptyScalaList, emptyScalaList, Errors.NONE.code()); } Seq<PartitionMetadata> partitionsMetadata = List.fromArray(partitionMetadataArray); topicMetadataArray[i] = new TopicMetadata(topic, partitionsMetadata, Errors.NONE.code()); } } Seq<BrokerEndPoint> brokers = List.fromArray(brokerArray); Seq<TopicMetadata> topicsMetadata = List.fromArray(topicMetadataArray); return new TopicMetadataResponse(new kafka.api.TopicMetadataResponse(brokers, topicsMetadata, -1)); } }
/** * Invoked when a handler or resource is not found. * <p> * If the environment's mode is production, then returns Results.notFound (404) with the included template from `views.html.defaultpages.notFound` as the content. * <p> * Otherwise, Results.notFound (404) is rendered with {@code views.html.defaultpages.devNotFound} template. * * @param request The request that no handler was found to handle. * @param message A message, which is not used by the default implementation. * @return a CompletionStage containing the Result. */ protected CompletionStage<Result> onNotFound(RequestHeader request, String message) { if (environment.isProd()) { return CompletableFuture.completedFuture(Results.notFound(views.html.defaultpages.notFound.render( request.method(), request.uri(), request.asScala()))); } else { return CompletableFuture.completedFuture(Results.notFound(views.html.defaultpages.devNotFound.render( request.method(), request.uri(), Some.apply(routes.get()), request.asScala() ))); } }
/** * Invoked when a handler or resource is not found. * <p> * If the environment's mode is production, then returns Results.notFound (404) with the included template from `views.html.defaultpages.notFound` as the content. * <p> * Otherwise, Results.notFound (404) is rendered with {@code views.html.defaultpages.devNotFound} template. * * @param request The request that no handler was found to handle. * @param message A message, which is not used by the default implementation. * @return a CompletionStage containing the Result. */ protected CompletionStage<Result> onNotFound(RequestHeader request, String message) { if (environment.isProd()) { return CompletableFuture.completedFuture(Results.notFound(views.html.defaultpages.notFound.render( request.method(), request.uri(), request.asScala()))); } else { return CompletableFuture.completedFuture(Results.notFound(views.html.defaultpages.devNotFound.render( request.method(), request.uri(), Some.apply(routes.get()), request.asScala() ))); } }
/** * Invoked when a handler or resource is not found. * <p> * If the environment's mode is production, then returns Results.notFound (404) with the included template from `views.html.defaultpages.notFound` as the content. * <p> * Otherwise, Results.notFound (404) is rendered with {@code views.html.defaultpages.devNotFound} template. * * @param request The request that no handler was found to handle. * @param message A message, which is not used by the default implementation. * @return a CompletionStage containing the Result. */ protected CompletionStage<Result> onNotFound(RequestHeader request, String message) { if (environment.isProd()) { return CompletableFuture.completedFuture(Results.notFound(views.html.defaultpages.notFound.render( request.method(), request.uri(), request.asScala()))); } else { return CompletableFuture.completedFuture(Results.notFound(views.html.defaultpages.devNotFound.render( request.method(), request.uri(), Some.apply(routes.get()), request.asScala() ))); } }
/** * Invoked when a handler or resource is not found. * * @param request The request that no handler was found to handle. * @param message A message. */ protected F.Promise<Result> onNotFound(RequestHeader request, String message){ if (environment.isProd()) { return F.Promise.<Result>pure(Results.notFound(views.html.defaultpages.notFound.render( request.method(), request.uri()))); } else { return F.Promise.<Result>pure(Results.notFound(views.html.defaultpages.devNotFound.render( request.method(), request.uri(), Some.apply(routes.get()) ))); } }
@Override public Option<Partitioner> partitioner() { // setting the partitioner helps to "keep" the same partitioner in the following // mapWithState read for Read.Unbounded, preventing a post-mapWithState shuffle. return scala.Some.apply(partitioner); }
@Override public Option<Object> sampleTrace(TraceId traceId) { return Some.apply(true); }
@Override public Option<Object> sampleTrace(TraceId traceId) { return Some.apply(true); }
@Override public Option<Object> sampleTrace(TraceId traceId) { return Some.apply(true); }
@Override public Context doAttach(Context toAttach) { Context current = current(); storage.set(Some.apply(toAttach)); return current; } }
/** the {@link OdinDocument} that represents the jCas */ public OdinDocument create() { OdinDocument document = new OdinDocument(sentenceFactory.create()); document.text_$eq(Some.apply(jCas.getDocumentText())); int chainId = 0; List<CorefMention> mentions = new ArrayList<>(); for (Entry<ReferenceTarget, Collection<Entity>> coref : referentMap.asMap().entrySet()) { for (Entity entity : coref.getValue()) { Collection<Sentence> collection = entityIndex.get(entity); if (!collection.isEmpty()) { OdinSentence sentence = document.findSentence(collection.iterator().next()); mentions.add(sentence.corefMention(entity, chainId)); } } chainId++; } CorefChains chains = CorefChains.apply(JavaConversions.iterableAsScalaIterable(mentions)); document.coreferenceChains_$eq(Option.apply(chains)); return document; } }
/** the {@link OdinDocument} that represents the jCas */ public OdinDocument create() { OdinDocument document = new OdinDocument(sentenceFactory.create()); document.text_$eq(Some.apply(jCas.getDocumentText())); int chainId = 0; List<CorefMention> mentions = new ArrayList<>(); for (Entry<ReferenceTarget, Collection<Entity>> coref : referentMap.asMap().entrySet()) { for (Entity entity : coref.getValue()) { Collection<Sentence> collection = entityIndex.get(entity); if (!collection.isEmpty()) { OdinSentence sentence = document.findSentence(collection.iterator().next()); mentions.add(sentence.corefMention(entity, chainId)); } } chainId++; } CorefChains chains = CorefChains.apply(JavaConversions.iterableAsScalaIterable(mentions)); document.coreferenceChains_$eq(Option.apply(chains)); return document; } }
@Override public void start(Configuration conf) { if (conf.getBoolean(STATS_EXPORT, false)) { statsExporter = new com.twitter.ostrich.admin.AdminServiceFactory( conf.getInt(STATS_HTTP_PORT, 9002), 20, OstrichProvider.<StatsFactory>emptyList(), Some.apply(""), OstrichProvider.<Regex>emptyList(), OstrichProvider.<String, CustomHttpHandler>emptyMap(), list(Duration.apply(1, TimeUnit.MINUTES)) ).apply(RuntimeEnvironment.apply(this, new String[0])); this.shutdownServiceTracker = conf.getBoolean(SHOULD_SHUTDOWN_SERVICE_TRACKER, false); } }
public F.Promise<Result> onHandlerNotFound(Http.RequestHeader request) { ErrorResponse er = apply(NOT_FOUND, "URI not found", apply$default$3(), Some.apply(request.path())); return F.Promise.pure(notFound(toJson(er))); }
public Future<play.api.mvc.Result> onHandlerNotFound(play.api.mvc.RequestHeader request) { ErrorResponse er = apply(NOT_FOUND, "URI not found", apply$default$3(), Some.apply(request.path())); return Futures.successful(notFound(toJson(er)).toScala()); }
/** * Extend the MQTT connection settings by adding an SSL socket factory. * * @param s the MQTT connection settings. * @param sf the SSL socket factory. * @return a copy of {@code s} with {@code sf}. */ static MqttConnectionSettings withSocketFactory(final MqttConnectionSettings s, final SSLSocketFactory sf) { return s.copy(s.broker(), s.clientId(), s.persistence(), s.auth(), Some.apply(sf), s.cleanSession(), s.will(), s.automaticReconnect(), s.keepAliveInterval(), s.connectionTimeout(), s.disconnectQuiesceTimeout(), s.disconnectTimeout(), s.maxInFlight(), s.mqttVersion(), s.serverUris(), s.sslHostnameVerifier(), s.sslProperties()); }
/** * Extend the MQTT connection settings by adding an SSL socket factory. * * @param s the MQTT connection settings. * @param sf the SSL socket factory. * @return a copy of {@code s} with {@code sf}. */ static MqttConnectionSettings withSocketFactory(final MqttConnectionSettings s, final SSLSocketFactory sf) { return s.copy(s.broker(), s.clientId(), s.persistence(), s.auth(), Some.apply(sf), s.cleanSession(), s.will(), s.automaticReconnect(), s.keepAliveInterval(), s.connectionTimeout(), s.disconnectQuiesceTimeout(), s.disconnectTimeout(), s.maxInFlight(), s.mqttVersion(), s.serverUris(), s.sslHostnameVerifier(), s.sslProperties()); }