Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed deprecations #1892

Merged
merged 17 commits into from
May 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -776,11 +776,6 @@
<artifactId>helidon-integrations-cdi-jpa</artifactId>
<version>${helidon.version}</version>
</dependency>
<dependency>
<groupId>io.helidon.integrations.cdi</groupId>
<artifactId>helidon-integrations-cdi-jpa-weld</artifactId>
<version>${helidon.version}</version>
</dependency>
<dependency>
<groupId>io.helidon.integrations.cdi</groupId>
<artifactId>helidon-integrations-cdi-jta</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static Resource create(Config resourceConfig) {
* @param config configuration
* @param prefix prefix of the resource
* @return resource if configured
* @deprecated use {@link #create(io.helidon.config.Config)} instead (and change the configuration to use
* @deprecated since 2.0.0 use {@link #create(io.helidon.config.Config)} instead (and change the configuration to use
* {@code .resource.type} instead of prefixes
*/
@Deprecated
Expand Down
10 changes: 5 additions & 5 deletions common/http/src/main/java/io/helidon/common/http/Content.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2020 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -41,7 +41,7 @@
* It is possible to register function to convert publisher to {@link io.helidon.common.reactive.Single} of a single entity using
* {@link #registerReader(Class, Reader)} or {@link #registerReader(Predicate, Reader)} methods. It
* is then possible to use {@link #as(Class)} method to obtain such entity.
* @deprecated use {@code io.helidon.media.common.MessageBodyReadableContent} instead
* @deprecated since 2.0.0, use {@code io.helidon.media.common.MessageBodyReadableContent} instead
*/
@Deprecated
public interface Content extends Flow.Publisher<DataChunk> {
Expand Down Expand Up @@ -73,7 +73,7 @@ public interface Content extends Flow.Publisher<DataChunk> {
*
* @param function a function that transforms a given publisher (that is either the original
* publisher or the publisher transformed by the last previously registered filter).
* @deprecated use {@code io.helidon.media.common.MessageBodyReaderContext.registerFilter}
* @deprecated since 2.0.0, use {@code io.helidon.media.common.MessageBodyReaderContext.registerFilter}
*/
@Deprecated
void registerFilter(Function<Flow.Publisher<DataChunk>, Flow.Publisher<DataChunk>> function);
Expand All @@ -93,7 +93,7 @@ public interface Content extends Flow.Publisher<DataChunk> {
* If an exception is thrown, the resulting completion stage of
* {@link #as(Class)} method call ends exceptionally.
* @param <T> the requested type
* @deprecated use {@code io.helidon.media.common.MessageBodyReaderContext.registerReader}
* @deprecated since 2.0.0, use {@code io.helidon.media.common.MessageBodyReaderContext.registerReader}
*/
@Deprecated
<T> void registerReader(Class<T> type, Reader<T> reader);
Expand All @@ -116,7 +116,7 @@ public interface Content extends Flow.Publisher<DataChunk> {
* If an exception is thrown, the resulting completion stage of
* {@link #as(Class)} method call ends exceptionally.
* @param <T> the requested type
* @deprecated use {@code io.helidon.media.common.MessageBodyReaderContext.registerReader}
* @deprecated since 2.0.0, use {@code io.helidon.media.common.MessageBodyReaderContext.registerReader}
*/
@Deprecated
<T> void registerReader(Predicate<Class<?>> predicate, Reader<T> reader);
Expand Down
4 changes: 2 additions & 2 deletions common/http/src/main/java/io/helidon/common/http/Reader.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2020 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,7 @@
* The Reader transforms a {@link DataChunk} publisher into a completion stage of the associated type.
*
* @param <R> the requested type
* @deprecated use {@code io.helidon.media.common.MessageBodyReader} instead
* @deprecated since 2.0.0, use {@code io.helidon.media.common.MessageBodyReader} instead
*/
@FunctionalInterface
@Deprecated
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -78,28 +78,6 @@ PreparedStatement build(Connection conn, DbClientServiceContext dbContext) {
}
}

/**
* Switch to {@link #build(java.sql.Connection, io.helidon.dbclient.DbClientServiceContext)} and use services.
*
* @param connection connection to use
* @return prepared statement
*/
@Deprecated
protected PreparedStatement build(Connection connection) {
LOGGER.fine(() -> String.format("Building SQL statement: %s", statement()));
switch (paramType()) {
// Statement may not contain any parameters, no conversion is needed.
case UNKNOWN:
return prepareStatement(connection, statementName(), statement());
case INDEXED:
return prepareIndexedStatement(connection, statementName(), statement(), indexedParams());
case NAMED:
return prepareNamedStatement(connection, statementName(), statement(), namedParams());
default:
throw new IllegalStateException("Unknown SQL statement type");
}
}

@Override
protected String dbType() {
return dbType;
Expand Down
7 changes: 3 additions & 4 deletions examples/dbclient/jdbc/src/main/resources/logging.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2019, 2020 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,15 +18,14 @@
# For more information see $JAVA_HOME/jre/lib/logging.properties

# Send messages to the console
handlers=java.util.logging.ConsoleHandler
handlers=io.helidon.common.HelidonConsoleHandler

# Global default logging level. Can be overriden by specific handlers and loggers
.level=INFO

# Helidon Web Server has a custom log formatter that extends SimpleFormatter.
# It replaces "!thread!" with the current thread name
java.util.logging.ConsoleHandler.level=INFO
java.util.logging.ConsoleHandler.formatter=io.helidon.webserver.WebServerLogFormatter
io.helidon.common.HelidonConsoleHandler.level=ALL
java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n

#Component specific log levels
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2019, 2020 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,15 +18,14 @@
# For more information see $JAVA_HOME/jre/lib/logging.properties

# Send messages to the console
handlers=java.util.logging.ConsoleHandler
handlers=io.helidon.common.HelidonConsoleHandler

# Global default logging level. Can be overriden by specific handlers and loggers
.level=INFO

# Helidon Web Server has a custom log formatter that extends SimpleFormatter.
# It replaces "!thread!" with the current thread name
java.util.logging.ConsoleHandler.level=INFO
java.util.logging.ConsoleHandler.formatter=io.helidon.webserver.WebServerLogFormatter
io.helidon.common.HelidonConsoleHandler.level=ALL
java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n

#Component specific log levels
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2019, 2020 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,15 +18,14 @@
# For more information see $JAVA_HOME/jre/lib/logging.properties

# Send messages to the console
handlers=java.util.logging.ConsoleHandler
handlers=io.helidon.common.HelidonConsoleHandler

# Global default logging level. Can be overriden by specific handlers and loggers
.level=INFO

# Helidon Web Server has a custom log formatter that extends SimpleFormatter.
# It replaces "!thread!" with the current thread name
java.util.logging.ConsoleHandler.level=INFO
java.util.logging.ConsoleHandler.formatter=io.helidon.webserver.WebServerLogFormatter
io.helidon.common.HelidonConsoleHandler.level=ALL
java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n

#Component specific log levels
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -99,12 +99,13 @@ private List<Auth> fromConfig(List<Config> configList) {
}

private List<Auth> fromAnnotations(EndpointConfig endpointConfig) {
return endpointConfig.combineAnnotations(Authentications.class, EndpointConfig.AnnotationScope.METHOD)
.stream()
.map(Authentications::value)
.flatMap(Arrays::stream)
.map(Auth::new)
.collect(Collectors.toList());
return endpointConfig.securityLevels()
.stream()
.flatMap(level -> level.combineAnnotations(Authentications.class, EndpointConfig.AnnotationScope.METHOD).stream())
.map(Authentications::value)
.flatMap(Arrays::stream)
.map(Auth::new)
.collect(Collectors.toList());
}

private Subject buildSubject(Auth authentication) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2020 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,6 +30,7 @@
import io.helidon.security.Security;
import io.helidon.security.SecurityContext;
import io.helidon.security.SecurityEnvironment;
import io.helidon.security.SecurityLevel;
import io.helidon.security.SecurityResponse;
import io.helidon.security.Subject;

Expand Down Expand Up @@ -93,9 +94,13 @@ public Class<? extends Annotation> annotationType() {
when(context.service()).thenReturn(Optional.empty());

SecurityEnvironment se = SecurityEnvironment.create();

SecurityLevel level = SecurityLevel.create("mock")
.withClassAnnotations(Map.of(AtnProviderSync.AtnAnnot.class, List.of(annot)))
.build();

EndpointConfig ep = EndpointConfig.builder()
.annotations(EndpointConfig.AnnotationScope.CLASS,
Map.of(AtnProviderSync.AtnAnnot.class, List.of(annot)))
.securityLevels(List.of(level))
.build();

ProviderRequest request = mock(ProviderRequest.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -89,7 +89,6 @@ public BackendServiceClient(final Client restClient, final Config config) {
* @return future with all records
*/
public CompletionStage<JsonArray> getAll(final SpanContext spanContext) {

Span span = tracer.buildSpan("todos.get-all")
.asChildOf(spanContext)
.start();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2020 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@
package io.helidon.demo.todos.frontend;

import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;

import javax.json.JsonObject;
Expand All @@ -30,6 +31,8 @@
import io.helidon.webserver.ServerResponse;
import io.helidon.webserver.Service;

import io.opentracing.Span;
import io.opentracing.SpanContext;
import org.eclipse.microprofile.metrics.Counter;
import org.eclipse.microprofile.metrics.Metadata;
import org.eclipse.microprofile.metrics.MetricRegistry;
Expand Down Expand Up @@ -135,10 +138,23 @@ private void create(final ServerRequest req, final ServerResponse res) {
* @param res the server response
*/
private void getAll(final ServerRequest req, final ServerResponse res) {
AtomicReference<Span> createdSpan = new AtomicReference<>();

SpanContext spanContext = req.spanContext().orElseGet(() -> {
Span mySpan = req.tracer().buildSpan("getAll").start();
createdSpan.set(mySpan);
return mySpan.context();
});
secure(req, res, sc -> {
bsc.getAll(req.spanContext())
bsc.getAll(spanContext)
.thenAccept(res::send)
.exceptionally(t -> sendError(t, res));
.exceptionally(t -> sendError(t, res))
.whenComplete((noting, throwable) -> {
Span mySpan = createdSpan.get();
if (null != mySpan) {
mySpan.finish();
}
});
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -57,10 +57,11 @@ private void getText(ServerRequest request, ServerResponse response) {

Response backendResponse = backendTarget
.property(ClientTracingFilter.TRACER_PROPERTY_NAME, request.tracer())
.property(ClientTracingFilter.CURRENT_SPAN_CONTEXT_PROPERTY_NAME, request.spanContext())
.property(ClientTracingFilter.CURRENT_SPAN_CONTEXT_PROPERTY_NAME, request.spanContext().orElse(null))
.queryParam("q", query)
.queryParam("lang", language)
.request().get();
.request()
.get();

final String result;
if (backendResponse.getStatusInfo().getFamily() == Response.Status.Family.SUCCESSFUL) {
Expand Down
Loading