From baf575860ec06ee06187cb13cad7459240db5ad0 Mon Sep 17 00:00:00 2001 From: vcolin7 Date: Tue, 17 Dec 2024 15:41:31 -0600 Subject: [PATCH 1/2] Removed most mentions of Azure from Client Core. --- sdk/clientcore/core/README.md | 68 +++++++++---------- sdk/clientcore/core/pom.xml | 2 +- .../implementation/BodyPublisherUtils.java | 4 +- .../core/http/models/ProxyOptions.java | 14 ++-- .../ReflectionSerializable.java | 3 - .../core/implementation/ReflectionUtils.java | 26 +++---- .../http/rest/RangeReplaceSubstitution.java | 2 +- .../serializer/HttpResponseDecodeData.java | 2 +- .../implementation/util/DefaultLogger.java | 3 +- .../core/implementation/util/UriBuilder.java | 3 - .../implementation/StringBuilderWriter.java | 4 +- .../core/sym/CharsToNameCanonicalizer.java | 5 +- .../jackson/core/util/BufferRecyclers.java | 2 +- .../core/serialization/json/package-info.java | 24 +++---- .../io/clientcore/core/util/ClientLogger.java | 4 +- .../core/util/SharedExecutorService.java | 4 +- .../core/util/binarydata/BinaryData.java | 27 ++------ .../util/configuration/Configuration.java | 6 +- .../configuration/ConfigurationBuilder.java | 28 ++++---- .../ConfigurationPropertyBuilder.java | 4 +- .../AnnotationJavadocCodesnippets.java | 10 +-- .../models/BinaryDataJavaDocCodeSnippet.java | 24 ++----- .../codesnippets/ReadingJsonExamples.java | 4 +- .../codesnippets/WritingJsonExamples.java | 8 +-- .../util/ConfigurationJavaDocCodeSnippet.java | 42 ++++++------ .../clientcore/core/http/RestProxyTests.java | 10 +-- .../http/rest/RestProxyImplTests.java | 2 +- .../rest/SwaggerInterfaceParserTests.java | 6 +- .../HttpResponseBodyDecoderTests.java | 4 +- .../core/shared/HttpClientTests.java | 28 ++++---- 30 files changed, 164 insertions(+), 209 deletions(-) diff --git a/sdk/clientcore/core/README.md b/sdk/clientcore/core/README.md index 225c649ff3831..fdcffe3279b99 100644 --- a/sdk/clientcore/core/README.md +++ b/sdk/clientcore/core/README.md @@ -1,13 +1,12 @@ # Core shared library for Java -[![Build Documentation](https://img.shields.io/badge/documentation-published-blue.svg)](https://azure.github.io/azure-sdk-for-java) + -Core provides shared primitives, abstractions, and helpers for modern Java Core SDK client libraries. -These libraries follow -the [SDK Design Guidelines for Java](https://azure.github.io/azure-sdk/java_introduction.html) -and can be easily identified by package names starting with `io.clientcore` and module names starting with `clientcore`, -e.g. `io.clientcore.core` would be found within the `/sdk/clientcore/core` directory. A more complete -list of client libraries using Core can be found [here](https://azure.github.io/azure-sdk/releases/latest/#java-packages). +Core provides shared primitives, abstractions, and helpers for modern SDK client libraries. These libraries + +can be easily identified by package names starting with `io.clientcore` and module names starting with `clientcore`, +e.g. `io.clientcore.core` would be found within the `/sdk/clientcore/core` directory. + Core allows client libraries to expose common functionality consistently, so that once you learn how to use these APIs in one client library, you will know how to use them in other client libraries. @@ -16,8 +15,7 @@ APIs in one client library, you will know how to use them in other client librar ### Prerequisites -- A [Java Development Kit (JDK)][jdk_link], version 8 or later. - - Here are details about [Java 8 client compatibility with Azure Certificate Authority](https://learn.microsoft.com/azure/security/fundamentals/azure-ca-details?tabs=root-and-subordinate-cas-list#client-compatibility-for-public-pkis). +- A Java Development Kit (JDK), version 8 or later. ### Include the package @@ -203,19 +201,19 @@ yourself. The following table lists the HTTP timeout, the corresponding `HttpCli set it, environment variable to control the default value, the default value if the environment value isn't set, and a brief description of what the timeout effects. -| HTTP Timeout | `HttpClientOptions` Method | Environment Variable | Default Value | Description | -|------------------|--------------------------------|--------------------------------|---------------|-------------------------------------------------------------------------------------------------------------------| -| Connect Timeout | `setConnectTimeout(Duration)` | AZURE_REQUEST_CONNECT_TIMEOUT | 10 seconds | The amount of time for a connection to be established before timing out. | -| Write Timeout | `setWriteTimeout(Duration)` | AZURE_REQUEST_WRITE_TIMEOUT | 60 seconds | The amount of time between each request data write to the network before timing out. | -| Response Timeout | `setResponseTimeout(Duration)` | AZURE_REQUEST_RESPONSE_TIMEOUT | 60 seconds | The amount of time between finishing sending the request to receiving the first response bytes before timing out. | -| Read Timeout | `setReadTimeout(Duration)` | AZURE_REQUEST_READ_TIMEOUT | 60 seconds | The amount of time between each response data read from the network before timing out. | +| HTTP Timeout | `HttpClientOptions` Method | Environment Variable | Default Value | Description | +|------------------|--------------------------------|--------------------------|---------------|-------------------------------------------------------------------------------------------------------------------| +| Connect Timeout | `setConnectTimeout(Duration)` | REQUEST_CONNECT_TIMEOUT | 10 seconds | The amount of time for a connection to be established before timing out. | +| Write Timeout | `setWriteTimeout(Duration)` | REQUEST_WRITE_TIMEOUT | 60 seconds | The amount of time between each request data write to the network before timing out. | +| Response Timeout | `setResponseTimeout(Duration)` | REQUEST_RESPONSE_TIMEOUT | 60 seconds | The amount of time between finishing sending the request to receiving the first response bytes before timing out. | +| Read Timeout | `setReadTimeout(Duration)` | REQUEST_READ_TIMEOUT | 60 seconds | The amount of time between each response data read from the network before timing out. | Since these timeouts are closest to the network, if they trigger they will be propagated back through the `HttpPipeline` and generally should be retried by the `RetryPolicy`. #### HttpPipeline Timeouts -HttpPipeline timeouts are the next level of timeout handling the Azure SDKs provide. These timeouts are configured using +HttpPipeline timeouts are the next level of timeout handling Client Core provides. These timeouts are configured using an `HttpPipelinePolicy` and configuring a timeout using either `Mono.timeout` for asynchronous requests or an `ExecutorService` with a timed `get(long, TimeUnit)` for synchronous requests. @@ -226,17 +224,16 @@ retrying the request will need to be handled by application logic. #### Service Client Timeouts -Service client timeouts are the highest level of timeout handling the Azure SDKs provide. These timeouts are configured +Service client timeouts are the highest level of timeout handling the Client Core provides. These timeouts are configured by passing `Duration timeout` into synchronous service methods that support timeouts or by using `Mono.timeout` or `Flux.timeout` on asynchronous service methods. -Since these timeouts are on the API call itself they cannot be captured by any retry mechanisms within the Azure SDKs +Since these timeouts are on the API call itself they cannot be captured by any retry mechanisms within the Client Core and must be handled by application logic. -## Next steps + ## Troubleshooting @@ -246,24 +243,25 @@ or checkout [StackOverflow for Azure Java SDK](https://stackoverflow.com/questio ### Enabling Logging -Azure SDKs for Java provide a consistent logging story to help aid in troubleshooting application errors and expedite +Client Core provides a consistent logging story to help aid in troubleshooting application errors and expedite their resolution. The logs produced will capture the flow of an application before reaching the terminal state to help -locate the root issue. View the [logging][logging] documentation for guidance about enabling logging. +locate the root issue. + #### HTTP Request and Response Logging HTTP request and response logging can be enabled by setting `HttpLogDetailLevel` in the `HttpLogOptions` used to create -an HTTP-based service client or by setting the environment variable or system property `AZURE_HTTP_LOG_DETAIL_LEVEL`. -The following table displays the valid options for `AZURE_HTTP_LOG_DETAIL_LEVEL` and the `HttpLogDetailLevel` it +an HTTP-based service client or by setting the environment variable or system property `HTTP_LOG_DETAIL_LEVEL`. +The following table displays the valid options for `HTTP_LOG_DETAIL_LEVEL` and the `HttpLogDetailLevel` it correlates to (valid options are case-insensitive): -| `AZURE_HTTP_LOG_DETAIL_LEVEL` value | `HttpLogDetailLevel` enum | -|-------------------------------------|---------------------------------------| -| `basic` | `HttpLogDetailLevel.BASIC` | -| `headers` | `HttpLogDetailLevel.HEADERS` | -| `body` | `HttpLogDetailLevel.BODY` | -| `body_and_headers` | `HttpLogDetailLevel.BODY_AND_HEADERS` | -| `bodyandheaders` | `HttpLogDetailLevel.BODY_AND_HEADERS` | +| `HTTP_LOG_DETAIL_LEVEL` value | `HttpLogDetailLevel` enum | +|-------------------------------|---------------------------------------| +| `basic` | `HttpLogDetailLevel.BASIC` | +| `headers` | `HttpLogDetailLevel.HEADERS` | +| `body` | `HttpLogDetailLevel.BODY` | +| `body_and_headers` | `HttpLogDetailLevel.BODY_AND_HEADERS` | +| `bodyandheaders` | `HttpLogDetailLevel.BODY_AND_HEADERS` | All other values, or unsupported values, result in `HttpLogDetailLevel.NONE`, or disabled HTTP request and response logging. Logging [must be enabled](#enabling-logging) to log HTTP requests and responses. Logging of HTTP headers @@ -291,8 +289,8 @@ the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/C -[logging]: https://learn.microsoft.com/azure/developer/java/sdk/logging-overview + -[jdk_link]: https://docs.microsoft.com/java/azure/jdk/?view=azure-java-stable + -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fcore%2Fgeneric-core%2FREADME.png) + diff --git a/sdk/clientcore/core/pom.xml b/sdk/clientcore/core/pom.xml index 9c43e77f25dda..8a09ee9449942 100644 --- a/sdk/clientcore/core/pom.xml +++ b/sdk/clientcore/core/pom.xml @@ -17,7 +17,7 @@ jar 1.0.0-beta.1 - Java Core Library for building client libraries for accessing web services. + Core Library for building Java client libraries for accessing web services. This library contains core types for building Java client libraries for accessing web services. https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/http/client/implementation/BodyPublisherUtils.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/http/client/implementation/BodyPublisherUtils.java index 8f54037f86a2d..794b38073b12b 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/http/client/implementation/BodyPublisherUtils.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/http/client/implementation/BodyPublisherUtils.java @@ -32,9 +32,9 @@ private BodyPublisherUtils() { */ public static HttpRequest.BodyPublisher toBodyPublisher(io.clientcore.core.http.models.HttpRequest request, Duration writeTimeout) { - // TODO (alzimmer): azure-core was using Flux.timeout to handle write timeouts. The logic will need to be - // re-implemented to handle write timeouts in a similar manner. + // TODO (alzimmer): Handle write timeouts. BinaryData body = request.getBody(); + if (body == null) { return noBody(); } diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/http/models/ProxyOptions.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/http/models/ProxyOptions.java index 026b299529901..8c676bfb72237 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/http/models/ProxyOptions.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/http/models/ProxyOptions.java @@ -205,8 +205,8 @@ public String getNonProxyHosts() { *
  • Java HTTP
  • * * - * Azure proxy configurations will be preferred over Java proxy configurations as they are more closely scoped to - * the purpose of the SDK. Additionally, more secure protocols, HTTPS vs HTTP, will be preferred. + * Client Core proxy configurations will be preferred over Java proxy configurations as they are more closely scoped + * to the purpose of the SDK. Additionally, more secure protocols, HTTPS vs HTTP, will be preferred. * *

    * {@code null} will be returned if no proxy was found in the environment. @@ -229,14 +229,14 @@ public static ProxyOptions fromConfiguration(Configuration configuration) { *

    * Environment configurations are loaded in this order: *

      - *
    1. Azure HTTPS
    2. - *
    3. Azure HTTP
    4. + *
    5. Client Core HTTPS
    6. + *
    7. Client Core HTTP
    8. *
    9. Java HTTPS
    10. *
    11. Java HTTP
    12. *
    * - * Azure proxy configurations will be preferred over Java proxy configurations as they are more closely scoped to - * the purpose of the SDK. Additionally, more secure protocols, HTTPS vs HTTP, will be preferred. + * Client Core proxy configurations will be preferred over Java proxy configurations as they are more closely scoped + * to the purpose of the SDK. Additionally, more secure protocols, HTTPS vs HTTP, will be preferred. *

    * {@code null} will be returned if no proxy was found in the environment. * @@ -491,7 +491,7 @@ private static String sanitizeNonProxyHosts(String[] nonProxyHosts) { /* * Replace the non-proxy host with the sanitized value. * - * The body of the non-proxy host is quoted to handle scenarios such a '127.0.0.1' or '*.azure.com' + * The body of the non-proxy host is quoted to handle scenarios such a '127.0.0.1' or '*.somecloud.com' * where without quoting the '.' in the string would be treated as the match any character instead of * the literal '.' character. */ diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/ReflectionSerializable.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/ReflectionSerializable.java index 1a95c9c04ddeb..f4479e52df753 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/ReflectionSerializable.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/ReflectionSerializable.java @@ -20,9 +20,6 @@ /** * Utility class that handles creating and using {@code JsonSerializable} and {@code XmlSerializable} reflectively while * they are in beta. - *

    - * Once {@code azure-json} and {@code azure-xml} GA this can be replaced with direct usage of the types. This is - * separated out from what uses it to keep those code paths clean. */ public final class ReflectionSerializable { private static final ClientLogger LOGGER = new ClientLogger(ReflectionSerializable.class); diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/ReflectionUtils.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/ReflectionUtils.java index de28460f3887c..ed24898b9269f 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/ReflectionUtils.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/ReflectionUtils.java @@ -38,36 +38,36 @@ public static ReflectiveInvoker getMethodInvoker(Class targetClass, Method me * to alleviate this issue, if {@code targetClass} is null {@link Method#getDeclaringClass()} will be used to infer * the class. *

    - * {@code scopeToAzure} is only when used when MethodHandles are being used and Java 9+ modules are being used. This - * will determine whether to use a MethodHandles.Lookup scoped to {@code core} or to use a public + * {@code scopeToClientCore} is only when used when MethodHandles are being used and Java 9+ modules are being used. + * This will determine whether to use a MethodHandles.Lookup scoped to {@code core} or to use a public * MethodHandles.Lookup. Scoping a MethodHandles.Lookup to {@code core} requires to module containing the - * class to open or export to {@code core} which generally only holds true for other Azure SDKs, for example + * class to open or export to {@code core} which generally only holds true for other SDKs, for example * there are cases where a reflective invocation is needed to Jackson which won't open or export to * {@code core} and the only APIs invoked reflectively are public APIs so the public MethodHandles.Lookup will * be used. * * @param targetClass The class that contains the method. * @param method The method to invoke. - * @param scopeToGenericCore If Java 9+ modules is being used this will scope MethodHandle-based reflection to using + * @param scopeToClientCore If Java 9+ modules is being used this will scope MethodHandle-based reflection to using * {@code core} as the scoped module, otherwise this is ignored. * @return An {@link ReflectiveInvoker} instance that will invoke the method. * @throws NullPointerException If {@code method} is null. * @throws Exception If the {@link ReflectiveInvoker} cannot be created. */ - public static ReflectiveInvoker getMethodInvoker(Class targetClass, Method method, boolean scopeToGenericCore) + public static ReflectiveInvoker getMethodInvoker(Class targetClass, Method method, boolean scopeToClientCore) throws Exception { if (method == null) { throw LOGGER.logThrowableAsError(new NullPointerException("'method' cannot be null.")); } targetClass = (targetClass == null) ? method.getDeclaringClass() : targetClass; - return INSTANCE.getMethodInvoker(targetClass, method, scopeToGenericCore); + return INSTANCE.getMethodInvoker(targetClass, method, scopeToClientCore); } /** * Creates an {@link ReflectiveInvoker} instance that will invoke a {@link Constructor}. *

    - * Calls {@link #getConstructorInvoker(Class, Constructor, boolean)} with {@code scopeToAzureCore} set to true. + * Calls {@link #getConstructorInvoker(Class, Constructor, boolean)} with {@code scopeToClientCore} set to true. * * @param targetClass The class that contains the constructor. * @param constructor The constructor to invoke. @@ -88,30 +88,30 @@ public static ReflectiveInvoker getConstructorInvoker(Class targetClass, Cons * to alleviate this issue, if {@code targetClass} is null {@link Constructor#getDeclaringClass()} will be used to * infer the class. *

    - * {@code scopeToAzure} is only when used when MethodHandles are being used and Java 9+ modules are being used. This - * will determine whether to use a MethodHandles.Lookup scoped to {@code core} or to use a public + * {@code scopeToClientCore} is only when used when MethodHandles are being used and Java 9+ modules are being used. + * This will determine whether to use a MethodHandles.Lookup scoped to {@code core} or to use a public * MethodHandles.Lookup. Scoping a MethodHandles.Lookup to {@code core} requires to module containing the - * class to open or export to {@code core} which generally only holds true for other Azure SDKs, for example + * class to open or export to {@code core} which generally only holds true for other SDKs, for example * there are cases where a reflective invocation is needed to Jackson which won't open or export to * {@code core} and the only APIs invoked reflectively are public APIs so the public MethodHandles.Lookup will * be used. * * @param targetClass The class that contains the constructor. * @param constructor The constructor to invoke. - * @param scopeToAzureCore If Java 9+ modules is being used this will scope MethodHandle-based reflection to using + * @param scopeToClientCore If Java 9+ modules is being used this will scope MethodHandle-based reflection to using * {@code core} as the scoped module, otherwise this is ignored. * @return An {@link ReflectiveInvoker} instance that will invoke the constructor. * @throws NullPointerException If {@code constructor} is null. * @throws Exception If the {@link ReflectiveInvoker} cannot be created. */ public static ReflectiveInvoker getConstructorInvoker(Class targetClass, Constructor constructor, - boolean scopeToAzureCore) throws Exception { + boolean scopeToClientCore) throws Exception { if (constructor == null) { throw LOGGER.logThrowableAsError(new NullPointerException("'constructor' cannot be null.")); } targetClass = (targetClass == null) ? constructor.getDeclaringClass() : targetClass; - return INSTANCE.getConstructorInvoker(targetClass, constructor, scopeToAzureCore); + return INSTANCE.getConstructorInvoker(targetClass, constructor, scopeToClientCore); } /** diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/http/rest/RangeReplaceSubstitution.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/http/rest/RangeReplaceSubstitution.java index bf9ce39cbc1a9..9fb1e15fe6924 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/http/rest/RangeReplaceSubstitution.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/http/rest/RangeReplaceSubstitution.java @@ -11,7 +11,7 @@ * A range replace substitution is a substitution that replaces a range of characters in a String with the supplied * value. This type of substitution is commonly used for host and path replacements where the Swagger interface will * have a definition such as {@code @Host("{uri}")} which will be replaced with a value such as - * {@code https://myhost.com}. + * {@code https://somecloud.com}. *

    * Before the introduction of this replacement {@link String#replace(CharSequence, CharSequence)} was used which would * generate a {@code Pattern} to perform replacing. diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/http/serializer/HttpResponseDecodeData.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/http/serializer/HttpResponseDecodeData.java index f95c65c5eade4..26c5cc5db92a2 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/http/serializer/HttpResponseDecodeData.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/http/serializer/HttpResponseDecodeData.java @@ -97,7 +97,7 @@ default boolean isReturnTypeDecodable() { * Whether the return type contains strongly-typed headers. *

    * If the response contains strongly-typed headers this is an indication to the HttpClient that the headers should - * be eagerly converted from the header format used by the HttpClient implementation to Azure Core HttpHeaders. + * be eagerly converted from the header format used by the HttpClient implementation to Client Core HttpHeaders. * * @return Whether the return type contains strongly-typed headers. */ diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/util/DefaultLogger.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/util/DefaultLogger.java index e2a5fd400b5ef..18c3e58042d49 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/util/DefaultLogger.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/util/DefaultLogger.java @@ -19,10 +19,9 @@ * This class is an internal implementation of slf4j logger. */ public final class DefaultLogger { - // The template for the log message: // YYYY-MM-DD HH:MM:ss.SSS [thread] [level] classpath - message - // E.g: 2020-01-09 12:35:14.232 [main] [WARN] com.azure.core.DefaultLogger - This is my log message. + // E.g: 2020-01-09 12:35:14.232 [main] [WARN] io.clientcore.core.DefaultLogger - This is my log message. private static final String WHITESPACE = " "; private static final String HYPHEN = " - "; private static final String OPEN_BRACKET = " ["; diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/util/UriBuilder.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/util/UriBuilder.java index 77868512b8cc3..96f08637f66d2 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/util/UriBuilder.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/implementation/util/UriBuilder.java @@ -220,9 +220,6 @@ public UriBuilder clearQuery() { public Map getQuery() { initializeQuery(); - // This contains a map of key=value query parameters, replacing - // multiple values for a single key with a list of values under the same name, - // joined together with a comma. As discussed in https://github.com/Azure/azure-sdk-for-java/pull/21203. return query.entrySet() .stream() // get all parameters joined by a comma. diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/serialization/json/implementation/StringBuilderWriter.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/serialization/json/implementation/StringBuilderWriter.java index 93b61b80cf532..29ef9e9e84c3f 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/serialization/json/implementation/StringBuilderWriter.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/serialization/json/implementation/StringBuilderWriter.java @@ -8,9 +8,7 @@ import java.util.Objects; /** - * Implementation of {@link Writer} that write content to a {@link StringBuilder}. This is copied directly from - * sdk/core/azure-core/src/main/java/com/azure/core/implementation/StringBuilderWriter.java in order to avoid a - * dependency on azure-core. + * Implementation of {@link Writer} that write content to a {@link StringBuilder}. *

    * Given the backing store of this {@link Writer} is a {@link StringBuilder} this is not thread-safe. */ diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/serialization/json/implementation/jackson/core/sym/CharsToNameCanonicalizer.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/serialization/json/implementation/jackson/core/sym/CharsToNameCanonicalizer.java index a5864d690ddbe..4db3ccd56059e 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/serialization/json/implementation/jackson/core/sym/CharsToNameCanonicalizer.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/serialization/json/implementation/jackson/core/sym/CharsToNameCanonicalizer.java @@ -82,10 +82,9 @@ public final class CharsToNameCanonicalizer { * collision chains. * Started with static value of 100 entries for the longest legal chain, * but increased in Jackson 2.13 to 150 to work around specific test case. - *

    + *

    * Note: longest chain we have been able to produce without malicious - * intent has been 38 (with "com.azure.json.implementation.jackson.core.main.TestWithTonsaSymbols"); - * our setting should be reasonable here. + * intent has been 38, so our setting should be reasonable here. * * @since 2.1 (changed in 2.13) */ diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/serialization/json/implementation/jackson/core/util/BufferRecyclers.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/serialization/json/implementation/jackson/core/util/BufferRecyclers.java index a2a0781f18938..b27de97aac696 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/serialization/json/implementation/jackson/core/util/BufferRecyclers.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/serialization/json/implementation/jackson/core/util/BufferRecyclers.java @@ -20,7 +20,7 @@ public class BufferRecyclers { * @since 2.9.6 */ public final static String SYSTEM_PROPERTY_TRACK_REUSABLE_BUFFERS - = "com.azure.json.implementation.jackson.core.util.BufferRecyclers.trackReusableBuffers"; + = "io.clientcore.core.serialization.json.implementation.jackson.core.util.BufferRecyclers.trackReusableBuffers"; /* * /********************************************************** diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/serialization/json/package-info.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/serialization/json/package-info.java index 5424eb7582ce8..5d4598413f6e9 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/serialization/json/package-info.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/serialization/json/package-info.java @@ -2,16 +2,16 @@ // Licensed under the MIT License. /** - *

    The Azure JSON library provides interfaces for stream-style JSON reading and writing. Stream-style reading and - * writing has the type itself define how to read JSON to create an instance of itself and how it writes out to JSON. - * Azure JSON also allows for external implementations for JSON reading and writing by offering a + *

    The Client Core JSON library provides interfaces for stream-style JSON reading and writing. Stream-style reading + * and writing has the type itself define how to read JSON to create an instance of itself and how it writes out to + * JSON. Client Core JSON also allows for external implementations for JSON reading and writing by offering a * service provider interface to load - * implementations from the classpath. However, if one is not found, the Azure JSON library provides a default + * implementations from the classpath. However, if one is not found, the Client Core JSON library provides a default * implementation.

    * *

    Getting Started

    * - *

    {@link io.clientcore.core.serialization.json.JsonSerializable} is the base of Azure JSON: it's the interface that types implement to + *

    {@link io.clientcore.core.serialization.json.JsonSerializable} is the base of Client Core JSON: it's the interface that types implement to * provide stream-style JSON reading and writing functionality. The interface has a single implementable method * {@link io.clientcore.core.serialization.json.JsonSerializable#toJson(io.clientcore.core.serialization.json.JsonWriter) toJson(JsonWriter)} that defines how the * object is written as JSON, to the {@link io.clientcore.core.serialization.json.JsonWriter}, and a static method @@ -394,7 +394,7 @@ * *

    {@link io.clientcore.core.serialization.json.JsonProviders} is a utility class that handles finding {@link io.clientcore.core.serialization.json.JsonProvider} * implementations on the classpath and should be the default way to create instances of - * {@link io.clientcore.core.serialization.json.JsonReader} and {@link io.clientcore.core.serialization.json.JsonWriter}. As mentioned earlier, the Azure JSON + * {@link io.clientcore.core.serialization.json.JsonReader} and {@link io.clientcore.core.serialization.json.JsonWriter}. As mentioned earlier, the Client Core JSON * package provides a default implementation allowing for the library to be used stand-alone. * {@link io.clientcore.core.serialization.json.JsonReader} can be created from {@code byte[]}, {@link java.lang.String}, * {@link java.io.InputStream}, and {@link java.io.Reader} sources, {@link io.clientcore.core.serialization.json.JsonWriter} can be created @@ -437,7 +437,7 @@ * + "\"threads\"16\",\"manufacturer\":\"Processor Corp\",\"clockSpeedInHertz\":4000000000," * + "\"releaseDate\":\"2023-01-01\"},\"Memory\":{\"memoryInBytes\":10000000000," * + "\"clockSpeedInHertz\":4800000000,\"manufacturer\":\"Memory Corp\",\"errorCorrecting\":true}," - * + "\"AcceleratedNetwork\":true,\"CloudProvider\":\"Azure\",\"Available\":true}") + * + "\"AcceleratedNetwork\":true,\"CloudProvider\":\"SomeCloud\",\"Available\":true}") * .getBytes(StandardCharsets.UTF_8)); * * try (JsonReader jsonReader = JsonProviders.createReader(json)) { @@ -454,7 +454,7 @@ * + "\"manufacturer\":\"Processor Corp\",\"clockSpeedInHertz\":4000000000,\"releaseDate\":\"2023-01-01\"}," * + "\"Memory\":{\"memoryInBytes\":10000000000,\"clockSpeedInHertz\":4800000000," * + "\"manufacturer\":\"Memory Corp\",\"errorCorrecting\":true},\"AcceleratedNetwork\":true," - * + "\"CloudProvider\":\"Azure\",\"Available\":true}"); + * + "\"CloudProvider\":\"SomeCloud\",\"Available\":true}"); * * try (JsonReader jsonReader = JsonProviders.createReader(json)) { * return VmStatistics.fromJson(jsonReader); @@ -467,7 +467,7 @@ * *

      * Map<String, Object> additionalVmProperties = new LinkedHashMap<>();
    - * additionalVmProperties.put("CloudProvider", "Azure");
    + * additionalVmProperties.put("CloudProvider", "SomeCloud");
      * additionalVmProperties.put("Available", true);
      *
      * VmStatistics vmStatistics = new VmStatistics("large",
    @@ -489,7 +489,7 @@
      * // {"VMSize":"large","Processor":{"cores":8,"threads":16,"manufacturer":"Processor Corp",
      * //   "clockSpeedInHertz":4000000000.0,"releaseDate":"2023-01-01"},"Memory":{"memoryInBytes":10000000000,
      * //   "clockSpeedInHertz":4800000000.0,"manufacturer":"Memory Corp","errorCorrecting":true},
    - * //   "AcceleratedNetwork":true,"CloudProvider":"Azure","Available":true}
    + * //   "AcceleratedNetwork":true,"CloudProvider":"SomeCloud","Available":true}
      * System.out.println(json);
      * 
    * @@ -499,7 +499,7 @@ * *
      * Map<String, Object> additionalVmProperties = new LinkedHashMap<>();
    - * additionalVmProperties.put("CloudProvider", "Azure");
    + * additionalVmProperties.put("CloudProvider", "SomeCloud");
      * additionalVmProperties.put("Available", true);
      *
      * VmStatistics vmStatistics = new VmStatistics("large",
    @@ -521,7 +521,7 @@
      * // {"VMSize":"large","Processor":{"cores":8,"threads":16,"manufacturer":"Processor Corp",
      * //   "clockSpeedInHertz":4000000000.0,"releaseDate":"2023-01-01"},"Memory":{"memoryInBytes":10000000000,
      * //   "clockSpeedInHertz":4800000000.0,"manufacturer":"Memory Corp","errorCorrecting":true},
    - * //   "AcceleratedNetwork":true,"CloudProvider":"Azure","Available":true}
    + * //   "AcceleratedNetwork":true,"CloudProvider":"SomeCloud","Available":true}
      * System.out.println(json);
      * 
    * diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/util/ClientLogger.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/util/ClientLogger.java index 21743e6fe6b93..32d45120433b5 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/util/ClientLogger.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/util/ClientLogger.java @@ -33,7 +33,7 @@ * logged.

    * *

    A minimum logging level threshold is determined by the - * {@link Configuration#PROPERTY_LOG_LEVEL AZURE_LOG_LEVEL} environment configuration. By default logging is + * {@link Configuration#PROPERTY_LOG_LEVEL LOG_LEVEL} environment configuration. By default logging is * disabled.

    * *

    The logger is capable of producing json-formatted messages enriched with key value pairs. @@ -498,7 +498,7 @@ private void addKeyValueInternal(String key, Object value) { } /** - * Enum which represent logging levels used in Azure SDKs. + * Enum which represent logging levels used. */ public enum LogLevel { /** diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/util/SharedExecutorService.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/util/SharedExecutorService.java index 9562066a27817..bffb558bc42b0 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/util/SharedExecutorService.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/util/SharedExecutorService.java @@ -192,11 +192,11 @@ public ScheduledExecutorService getExecutorService() { */ public void setExecutorService(ScheduledExecutorService executorService) { // We allow for the global executor service to be set from an external source to allow for consumers of the SDK - // to use their own thread management to run Azure SDK tasks. This allows for the SDKs to perform deeper + // to use their own thread management to run Client Core tasks. This allows for the SDKs to perform deeper // integration into an environment, such as the consumer environment knowing details about capacity, allowing // the custom executor service to better manage resources than our more general 10x the number of processors. // Another scenario could be an executor service that creates threads with specific permissions, such as - // allowing Azure Core or Jackson to perform deep reflection on classes that are not normally allowed. + // allowing Client Core or Jackson to perform deep reflection on classes that are not normally allowed. Objects.requireNonNull(executorService, "'executorService' cannot be null."); if (executorService.isShutdown() || executorService.isTerminated()) { throw LOGGER.logThrowableAsError( diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/util/binarydata/BinaryData.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/util/binarydata/BinaryData.java index b6942ab67cc05..f0b6b624366d2 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/util/binarydata/BinaryData.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/util/binarydata/BinaryData.java @@ -94,9 +94,7 @@ *

      * final Person data = new Person().setName("John");
      *
    - * // Provide your custom serializer or use Azure provided serializers.
    - * // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-jackson or
    - * // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-gson
    + * // Provide your custom serializer or use the provided serializers.
      * BinaryData binaryData = BinaryData.fromObject(data);
      *
      * System.out.println(binaryData);
    @@ -301,9 +299,7 @@ public static BinaryData fromListByteBuffer(List data) {
          * 
          * final Person data = new Person().setName("John");
          *
    -     * // Provide your custom serializer or use Azure provided serializers.
    -     * // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-jackson or
    -     * // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-gson
    +     * // Provide your custom serializer or use the provided serializers.
          * BinaryData binaryData = BinaryData.fromObject(data);
          *
          * System.out.println(binaryData);
    @@ -332,9 +328,7 @@ public static BinaryData fromObject(Object data) {
          * 
          * final Person data = new Person().setName("John");
          *
    -     * // Provide your custom serializer or use Azure provided serializers.
    -     * // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-jackson or
    -     * // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-gson
    +     * // Provide your custom serializer or use the provided serializers.
          * final ObjectSerializer serializer = new MyJsonSerializer(); // Replace this with your Serializer
          * BinaryData binaryData = BinaryData.fromObject(data, serializer);
          *
    @@ -515,10 +509,6 @@ public static BinaryData fromFile(Path file, Long position, Long length, int chu
          *
          * // Ensure your classpath have the Serializer to serialize the object which implement implement
          * // io.clientcore.core.serializer.util.JsonSerializer interface.
    -     * // Or use Azure provided libraries for this.
    -     * // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-jackson or
    -     * // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-gson
    -     *
          * BinaryData binaryData = BinaryData.fromObject(data);
          *
          * Person person = binaryData.toObject(Person.class);
    @@ -539,11 +529,7 @@ public static BinaryData fromFile(Path file, Long position, Long length, int chu
          *
          * // Ensure your classpath have the Serializer to serialize the object which implement implement
          * // io.clientcore.core.serializer.util.JsonSerializer interface.
    -     * // Or use Azure provided libraries for this.
    -     * // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-jackson or
    -     * // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-gson
    -     *
    -     *
    +     * // Or use the  provided libraries for this.
          * BinaryData binaryData = BinaryData.fromObject(personList);
          *
          * // Creation of the ParameterizedType could be replaced with a utility method that returns a Type based on the
    @@ -597,10 +583,7 @@ public  T toObject(Type type) throws IOException {
          * 
          * final Person data = new Person().setName("John");
          *
    -     * // Provide your custom serializer or use Azure provided serializers.
    -     * // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-jackson or
    -     * // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-gson
    -     *
    +     * // Provide your custom serializer or use the provided serializers.
          * final ObjectSerializer serializer = new MyJsonSerializer(); // Replace this with your Serializer
          * BinaryData binaryData = BinaryData.fromObject(data, serializer);
          *
    diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/util/configuration/Configuration.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/util/configuration/Configuration.java
    index c6ab0ab8fdb5c..8b2878c73e94b 100644
    --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/util/configuration/Configuration.java
    +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/util/configuration/Configuration.java
    @@ -23,7 +23,7 @@
      * 
      * 
      * Configuration configuration = new ConfigurationBuilder(new SampleSource(properties))
    - *     .root("azure.sdk")
    + *     .root("my.sdk")
      *     .buildSection("client-name");
      *
      * ConfigurationProperty<String> proxyHostnameProperty = ConfigurationPropertyBuilder.ofString("http.proxy.hostname")
    @@ -287,8 +287,8 @@ public boolean contains(ConfigurationProperty property) {
          *     .systemPropertyName("http.proxyHost")
          *     .build();
          *
    -     * // attempts to get local `azure.sdk.<client-name>.http.proxy.host` property and falls back to
    -     * // shared azure.sdk.http.proxy.port
    +     * // attempts to get local `my.sdk.<client-name>.http.proxy.host` property and falls back to
    +     * // shared my.sdk.http.proxy.port
          * System.out.println(configuration.get(property));
          * 
    * diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/util/configuration/ConfigurationBuilder.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/util/configuration/ConfigurationBuilder.java index 5fa84a651e91d..03e34eba45aea 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/util/configuration/ConfigurationBuilder.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/util/configuration/ConfigurationBuilder.java @@ -32,8 +32,8 @@ public final class ConfigurationBuilder { * *
          * configuration = new ConfigurationBuilder()
    -     *     .putProperty("azure.sdk.client-name.connection-string", "...")
    -     *     .root("azure.sdk")
    +     *     .putProperty("my.sdk.client-name.connection-string", "...")
    +     *     .root("my.sdk")
          *     .buildSection("client-name");
          *
          * ConfigurationProperty<String> connectionStringProperty = ConfigurationPropertyBuilder.ofString("connection-string")
    @@ -54,7 +54,7 @@ public ConfigurationBuilder() {
          * 
          * 
          * Configuration configuration = new ConfigurationBuilder(new SampleSource(properties))
    -     *     .root("azure.sdk")
    +     *     .root("my.sdk")
          *     .buildSection("client-name");
          *
          * ConfigurationProperty<String> proxyHostnameProperty = ConfigurationPropertyBuilder.ofString("http.proxy.hostname")
    @@ -73,14 +73,12 @@ public ConfigurationBuilder(ConfigurationSource source) {
     
         /**
          * Creates {@code ConfigurationBuilder} with configuration sources for explicit configuration, system properties and
    -     * environment configuration sources. Use this constructor to customize known SDK system properties and
    -     * environment variables retrieval.
    +     * environment configuration sources. Use this constructor to customize known system properties and environment
    +     * variables retrieval.
          *
    -     * @param source Custom {@link ConfigurationSource} containing known SDK configuration properties
    -     * @param systemPropertiesConfigurationSource {@link ConfigurationSource} containing known Azure SDK system
    -     * properties.
    -     * @param environmentConfigurationSource {@link ConfigurationSource} containing known Azure SDK environment
    -     * variables.
    +     * @param source Custom {@link ConfigurationSource} containing known configuration properties
    +     * @param systemPropertiesConfigurationSource {@link ConfigurationSource} containing known system properties.
    +     * @param environmentConfigurationSource {@link ConfigurationSource} containing known environment variables.
          */
         public ConfigurationBuilder(ConfigurationSource source, ConfigurationSource systemPropertiesConfigurationSource,
             ConfigurationSource environmentConfigurationSource) {
    @@ -100,8 +98,8 @@ public ConfigurationBuilder(ConfigurationSource source, ConfigurationSource syst
          * 
          * 
          * configuration = new ConfigurationBuilder()
    -     *     .putProperty("azure.sdk.client-name.connection-string", "...")
    -     *     .root("azure.sdk")
    +     *     .putProperty("my.sdk.client-name.connection-string", "...")
    +     *     .root("my.sdk")
          *     .buildSection("client-name");
          *
          * ConfigurationProperty<String> connectionStringProperty = ConfigurationPropertyBuilder.ofString("connection-string")
    @@ -131,7 +129,7 @@ public ConfigurationBuilder putProperty(String name, String value) {
          * 
          * 
          * Configuration configuration = new ConfigurationBuilder(new SampleSource(properties))
    -     *     .root("azure.sdk")
    +     *     .root("my.sdk")
          *     .buildSection("client-name");
          *
          * ConfigurationProperty<String> proxyHostnameProperty = ConfigurationPropertyBuilder.ofString("http.proxy.hostname")
    @@ -159,7 +157,7 @@ public ConfigurationBuilder root(String rootPath) {
          * 
          * // Builds shared Configuration only.
          * Configuration sharedConfiguration = new ConfigurationBuilder(new SampleSource(properties))
    -     *     .root("azure.sdk")
    +     *     .root("my.sdk")
          *     .build();
          * 
    * @@ -183,7 +181,7 @@ public Configuration build() { *
          * // Builds Configuration for <client-name> with fallback to shared properties.
          * configuration = new ConfigurationBuilder(new SampleSource(properties))
    -     *     .root("azure.sdk")
    +     *     .root("my.sdk")
          *     .buildSection("client-name");
          * 
    * diff --git a/sdk/clientcore/core/src/main/java/io/clientcore/core/util/configuration/ConfigurationPropertyBuilder.java b/sdk/clientcore/core/src/main/java/io/clientcore/core/util/configuration/ConfigurationPropertyBuilder.java index 876f3394b723e..0de4e5913dbde 100644 --- a/sdk/clientcore/core/src/main/java/io/clientcore/core/util/configuration/ConfigurationPropertyBuilder.java +++ b/sdk/clientcore/core/src/main/java/io/clientcore/core/util/configuration/ConfigurationPropertyBuilder.java @@ -53,8 +53,8 @@ public final class ConfigurationPropertyBuilder { * .systemPropertyName("http.proxyHost") * .build(); * - * // attempts to get local `azure.sdk.<client-name>.http.proxy.host` property and falls back to - * // shared azure.sdk.http.proxy.port + * // attempts to get local `my.sdk.<client-name>.http.proxy.host` property and falls back to + * // shared my.sdk.http.proxy.port * System.out.println(configuration.get(property)); *
    * diff --git a/sdk/clientcore/core/src/samples/java/io/clientcore/core/http/annotation/AnnotationJavadocCodesnippets.java b/sdk/clientcore/core/src/samples/java/io/clientcore/core/http/annotation/AnnotationJavadocCodesnippets.java index 6f02738276300..f20cb7ad747f2 100644 --- a/sdk/clientcore/core/src/samples/java/io/clientcore/core/http/annotation/AnnotationJavadocCodesnippets.java +++ b/sdk/clientcore/core/src/samples/java/io/clientcore/core/http/annotation/AnnotationJavadocCodesnippets.java @@ -12,7 +12,7 @@ import java.util.Map; /** - * Javadoc codesnippets for {@link com.azure.core.annotation} classes. + * Javadoc codesnippets for {@link io.clientcore.core.annotation} classes. */ @SuppressWarnings("ALL") public interface AnnotationJavadocCodesnippets { @@ -191,7 +191,7 @@ void getUploadUriForEntityType(@PathParam("resourceGroupName") String resourceGr */ interface HostExamples { // BEGIN: io.clientcore.core.http.annotation.Host.class1 - @ServiceInterface(name = "VirtualMachinesService", host = "https://management.azure.com") + @ServiceInterface(name = "VirtualMachinesService", host = "https://management.somecloud.com") interface VirtualMachinesService { @HttpRequestInformation(method = HttpMethod.GET, path = "/subscriptions/{subscriptionId}/resourceGroups/" + "{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", @@ -202,8 +202,8 @@ VirtualMachine getByResourceGroup(@PathParam("resourceGroupName") String rgName, // END: io.clientcore.core.http.annotation.Host.class1 // BEGIN: io.clientcore.core.http.annotation.Host.class2 - @ServiceInterface(name = "KeyVaultService", host = "https://{vaultName}.vault.azure.net:443") - interface KeyVaultService { + @ServiceInterface(name = "SecretsService", host = "https://{instance}.somecloud.com:443") + interface SecretsService { @HttpRequestInformation(method = HttpMethod.GET, path = "secrets/{secretName}", returnValueWireType = Secret.class) Secret get(@HostParam("vaultName") String vaultName, @PathParam("secretName") String secretName); @@ -336,7 +336,7 @@ void restart(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") // END: io.clientcore.core.http.annotation.Post.class1 // BEGIN: io.clientcore.core.http.annotation.Post.class2 - @HttpRequestInformation(method = HttpMethod.POST, path = "https://{functionApp}.azurewebsites.net/admin/" + @HttpRequestInformation(method = HttpMethod.POST, path = "https://{functionApp}.somecloud.com/admin/" + "functions/{name}/keys/{keyName}", returnValueWireType = KeyValuePair.class) KeyValuePair generateFunctionKey(@PathParam("functionApp") String functionApp, @PathParam("name") String name, @PathParam("keyName") String keyName); diff --git a/sdk/clientcore/core/src/samples/java/io/clientcore/core/models/BinaryDataJavaDocCodeSnippet.java b/sdk/clientcore/core/src/samples/java/io/clientcore/core/models/BinaryDataJavaDocCodeSnippet.java index fbd100fd86e69..07c0103648377 100644 --- a/sdk/clientcore/core/src/samples/java/io/clientcore/core/models/BinaryDataJavaDocCodeSnippet.java +++ b/sdk/clientcore/core/src/samples/java/io/clientcore/core/models/BinaryDataJavaDocCodeSnippet.java @@ -152,9 +152,7 @@ public void fromObjectDefaultJsonSerializers() { // BEGIN: io.clientcore.core.util.BinaryData.fromObject#Object final Person data = new Person().setName("John"); - // Provide your custom serializer or use Azure provided serializers. - // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-jackson or - // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-gson + // Provide your custom serializer or use the provided serializers. BinaryData binaryData = BinaryData.fromObject(data); System.out.println(binaryData); @@ -172,9 +170,7 @@ public void fromObjectObjectSerializer() { // BEGIN: io.clientcore.core.util.BinaryData.fromObject#Object-ObjectSerializer final Person data = new Person().setName("John"); - // Provide your custom serializer or use Azure provided serializers. - // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-jackson or - // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-gson + // Provide your custom serializer or use the provided serializers. final ObjectSerializer serializer = new MyJsonSerializer(); // Replace this with your Serializer BinaryData binaryData = BinaryData.fromObject(data, serializer); @@ -191,10 +187,7 @@ public void toObjectTypeDefaultJsonSerializer() throws IOException { // Ensure your classpath have the Serializer to serialize the object which implement implement // io.clientcore.core.serializer.util.JsonSerializer interface. - // Or use Azure provided libraries for this. - // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-jackson or - // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-gson - + // Or use the provided libraries for this. BinaryData binaryData = BinaryData.fromObject(data); Person person = binaryData.toObject(Person.class); @@ -216,11 +209,7 @@ public void toObjectTypeDefaultJsonSerializerWithGenerics() throws IOException { // Ensure your classpath have the Serializer to serialize the object which implement implement // io.clientcore.core.serializer.util.JsonSerializer interface. - // Or use Azure provided libraries for this. - // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-jackson or - // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-gson - - + // Or use the provided libraries for this. BinaryData binaryData = BinaryData.fromObject(personList); // Creation of the ParameterizedType could be replaced with a utility method that returns a Type based on the @@ -252,10 +241,7 @@ public void toObjectTypeObjectSerializer() throws IOException { // BEGIN: io.clientcore.core.util.BinaryData.toObject#Type-ObjectSerializer final Person data = new Person().setName("John"); - // Provide your custom serializer or use Azure provided serializers. - // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-jackson or - // https://central.sonatype.com/artifact/io.clientcore/azure-core-serializer-json-gson - + // Provide your custom serializer or use the provided serializers. final ObjectSerializer serializer = new MyJsonSerializer(); // Replace this with your Serializer BinaryData binaryData = BinaryData.fromObject(data, serializer); diff --git a/sdk/clientcore/core/src/samples/java/io/clientcore/core/serialization/json/codesnippets/ReadingJsonExamples.java b/sdk/clientcore/core/src/samples/java/io/clientcore/core/serialization/json/codesnippets/ReadingJsonExamples.java index c7466f53b39f7..58e9139a67dcb 100644 --- a/sdk/clientcore/core/src/samples/java/io/clientcore/core/serialization/json/codesnippets/ReadingJsonExamples.java +++ b/sdk/clientcore/core/src/samples/java/io/clientcore/core/serialization/json/codesnippets/ReadingJsonExamples.java @@ -44,7 +44,7 @@ public VmStatistics readJsonInputStream() throws IOException { + "\"threads\"16\",\"manufacturer\":\"Processor Corp\",\"clockSpeedInHertz\":4000000000," + "\"releaseDate\":\"2023-01-01\"},\"Memory\":{\"memoryInBytes\":10000000000," + "\"clockSpeedInHertz\":4800000000,\"manufacturer\":\"Memory Corp\",\"errorCorrecting\":true}," - + "\"AcceleratedNetwork\":true,\"CloudProvider\":\"Azure\",\"Available\":true}") + + "\"AcceleratedNetwork\":true,\"CloudProvider\":\"SomeCloud\",\"Available\":true}") .getBytes(StandardCharsets.UTF_8)); try (JsonReader jsonReader = JsonProviders.createReader(json)) { @@ -59,7 +59,7 @@ public VmStatistics readJsonReader() throws IOException { + "\"manufacturer\":\"Processor Corp\",\"clockSpeedInHertz\":4000000000,\"releaseDate\":\"2023-01-01\"}," + "\"Memory\":{\"memoryInBytes\":10000000000,\"clockSpeedInHertz\":4800000000," + "\"manufacturer\":\"Memory Corp\",\"errorCorrecting\":true},\"AcceleratedNetwork\":true," - + "\"CloudProvider\":\"Azure\",\"Available\":true}"); + + "\"CloudProvider\":\"SomeCloud\",\"Available\":true}"); try (JsonReader jsonReader = JsonProviders.createReader(json)) { return VmStatistics.fromJson(jsonReader); diff --git a/sdk/clientcore/core/src/samples/java/io/clientcore/core/serialization/json/codesnippets/WritingJsonExamples.java b/sdk/clientcore/core/src/samples/java/io/clientcore/core/serialization/json/codesnippets/WritingJsonExamples.java index 6365941ec26cb..57b449cd9e046 100644 --- a/sdk/clientcore/core/src/samples/java/io/clientcore/core/serialization/json/codesnippets/WritingJsonExamples.java +++ b/sdk/clientcore/core/src/samples/java/io/clientcore/core/serialization/json/codesnippets/WritingJsonExamples.java @@ -18,7 +18,7 @@ public class WritingJsonExamples { public void writeJsonOutputStream() throws IOException { // BEGIN: io.clientcore.core.serialization.json.JsonWriter.writeJsonOutputStream Map additionalVmProperties = new LinkedHashMap<>(); - additionalVmProperties.put("CloudProvider", "Azure"); + additionalVmProperties.put("CloudProvider", "SomeCloud"); additionalVmProperties.put("Available", true); VmStatistics vmStatistics = new VmStatistics("large", @@ -40,7 +40,7 @@ public void writeJsonOutputStream() throws IOException { // {"VMSize":"large","Processor":{"cores":8,"threads":16,"manufacturer":"Processor Corp", // "clockSpeedInHertz":4000000000.0,"releaseDate":"2023-01-01"},"Memory":{"memoryInBytes":10000000000, // "clockSpeedInHertz":4800000000.0,"manufacturer":"Memory Corp","errorCorrecting":true}, - // "AcceleratedNetwork":true,"CloudProvider":"Azure","Available":true} + // "AcceleratedNetwork":true,"CloudProvider":"SomeCloud","Available":true} System.out.println(json); // END: io.clientcore.core.serialization.json.JsonWriter.writeJsonOutputStream } @@ -48,7 +48,7 @@ public void writeJsonOutputStream() throws IOException { public void writeJsonWriter() throws IOException { // BEGIN: io.clientcore.core.serialization.json.JsonWriter.writeJsonWriter Map additionalVmProperties = new LinkedHashMap<>(); - additionalVmProperties.put("CloudProvider", "Azure"); + additionalVmProperties.put("CloudProvider", "SomeCloud"); additionalVmProperties.put("Available", true); VmStatistics vmStatistics = new VmStatistics("large", @@ -70,7 +70,7 @@ public void writeJsonWriter() throws IOException { // {"VMSize":"large","Processor":{"cores":8,"threads":16,"manufacturer":"Processor Corp", // "clockSpeedInHertz":4000000000.0,"releaseDate":"2023-01-01"},"Memory":{"memoryInBytes":10000000000, // "clockSpeedInHertz":4800000000.0,"manufacturer":"Memory Corp","errorCorrecting":true}, - // "AcceleratedNetwork":true,"CloudProvider":"Azure","Available":true} + // "AcceleratedNetwork":true,"CloudProvider":"SomeCloud","Available":true} System.out.println(json); // END: io.clientcore.core.serialization.json.JsonWriter.writeJsonWriter } diff --git a/sdk/clientcore/core/src/samples/java/io/clientcore/core/util/ConfigurationJavaDocCodeSnippet.java b/sdk/clientcore/core/src/samples/java/io/clientcore/core/util/ConfigurationJavaDocCodeSnippet.java index 137fe3aad271d..839b3e61f1a56 100644 --- a/sdk/clientcore/core/src/samples/java/io/clientcore/core/util/ConfigurationJavaDocCodeSnippet.java +++ b/sdk/clientcore/core/src/samples/java/io/clientcore/core/util/ConfigurationJavaDocCodeSnippet.java @@ -45,14 +45,14 @@ public Map getProperties(String path) { */ public void configurationBuilderUsage() { Map properties = new HashMap<>(); - properties.put("azure.sdk.client-name.http.proxy.port", "8080"); - properties.put("azure.sdk.http.proxy.hostname", " proxyHostnameProperty = ConfigurationPropertyBuilder.ofString("http.proxy.hostname") @@ -63,8 +63,8 @@ public void configurationBuilderUsage() { // BEGIN: io.clientcore.core.util.ConfigurationBuilder#putProperty configuration = new ConfigurationBuilder() - .putProperty("azure.sdk.client-name.connection-string", "...") - .root("azure.sdk") + .putProperty("my.sdk.client-name.connection-string", "...") + .root("my.sdk") .buildSection("client-name"); ConfigurationProperty connectionStringProperty = ConfigurationPropertyBuilder.ofString("connection-string") @@ -76,14 +76,14 @@ public void configurationBuilderUsage() { // BEGIN: io.clientcore.core.util.ConfigurationBuilder#buildSection // Builds Configuration for with fallback to shared properties. configuration = new ConfigurationBuilder(new SampleSource(properties)) - .root("azure.sdk") + .root("my.sdk") .buildSection("client-name"); // END: io.clientcore.core.util.ConfigurationBuilder#buildSection // BEGIN: io.clientcore.core.util.ConfigurationBuilder#build // Builds shared Configuration only. Configuration sharedConfiguration = new ConfigurationBuilder(new SampleSource(properties)) - .root("azure.sdk") + .root("my.sdk") .build(); // END: io.clientcore.core.util.ConfigurationBuilder#build } @@ -93,13 +93,13 @@ public void configurationBuilderUsage() { */ public void configurationUsage() { Map properties = new HashMap<>(); - properties.put("azure.sdk..http.proxy.port", "8080"); - properties.put("azure.sdk.http.proxy.hostname", ".http.proxy.port", "8080"); + properties.put("my.sdk.http.proxy.hostname", ""); // BEGIN: io.clientcore.core.util.Configuration.get#ConfigurationProperty @@ -109,8 +109,8 @@ public void configurationUsage() { .systemPropertyName("http.proxyHost") .build(); - // attempts to get local `azure.sdk..http.proxy.host` property and falls back to - // shared azure.sdk.http.proxy.port + // attempts to get local `my.sdk..http.proxy.host` property and falls back to + // shared my.sdk.http.proxy.port System.out.println(configuration.get(property)); // END: io.clientcore.core.util.Configuration.get#ConfigurationProperty } @@ -120,13 +120,13 @@ public void configurationUsage() { */ public void configurationPropertyUsage() { Map properties = new HashMap<>(); - properties.put("azure.sdk.sample.timeout", "1000"); - properties.put("azure.sdk.sample.retry-count", "3"); - properties.put("azure.sdk.sample.is-enabled", "true"); - properties.put("azure.sdk.sample.mode", "mode1"); + properties.put("my.sdk.sample.timeout", "1000"); + properties.put("my.sdk.sample.retry-count", "3"); + properties.put("my.sdk.sample.is-enabled", "true"); + properties.put("my.sdk.sample.mode", "mode1"); Configuration configuration = new ConfigurationBuilder(new SampleSource(properties)) - .root("azure.sdk") + .root("my.sdk") .buildSection("sample"); // BEGIN: io.clientcore.core.util.ConfigurationPropertyBuilder.ofDuration diff --git a/sdk/clientcore/core/src/test/java/io/clientcore/core/http/RestProxyTests.java b/sdk/clientcore/core/src/test/java/io/clientcore/core/http/RestProxyTests.java index 14c2cc82aae63..b9f7a30b37d96 100644 --- a/sdk/clientcore/core/src/test/java/io/clientcore/core/http/RestProxyTests.java +++ b/sdk/clientcore/core/src/test/java/io/clientcore/core/http/RestProxyTests.java @@ -40,7 +40,7 @@ * Tests {@link RestProxy}. */ public class RestProxyTests { - @ServiceInterface(name = "myService", host = "https://azure.com") + @ServiceInterface(name = "myService", host = "https://somecloud.com") interface TestInterface { @HttpRequestInformation(method = HttpMethod.POST, path = "my/uri/path", expectedStatusCodes = { 200 }) Response testMethod(@BodyParam("application/octet-stream") ByteBuffer request, @@ -86,12 +86,12 @@ public void streamResponseShouldHaveHttpResponseReference() { HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(client) .build(); - + TestInterface testInterface = RestProxy.create(TestInterface.class, pipeline, new DefaultJsonSerializer()); StreamResponse streamResponse = testInterface.testDownload(); - + streamResponse.close(); - + // This indirectly tests that StreamResponse has HttpResponse reference. assertTrue(client.closeCalledOnResponse); }*/ @@ -205,7 +205,7 @@ public HttpRequest getLastHttpRequest() { @Test public void doesNotChangeEncodedPath() throws IOException { String nextLinkUri - = "https://management.azure.com:443/subscriptions/000/resourceGroups/rg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines?api-version=2021-11-01&$skiptoken=Mzk4YzFjMzMtM2IwMC00OWViLWI2NGYtNjg4ZTRmZGQ1Nzc2IS9TdWJzY3JpcHRpb25zL2VjMGFhNWY3LTllNzgtNDBjOS04NWNkLTUzNWM2MzA1YjM4MC9SZXNvdXJjZUdyb3Vwcy9SRy1XRUlEWFUtVk1TUy9WTVNjYWxlU2V0cy9WTVNTMS9WTXMvNzc="; + = "https://management.somecloud.com:443/subscriptions/000/resourceGroups/rg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1/virtualMachines?api-version=2021-11-01&$skiptoken=Mzk4YzFjMzMtM2IwMC00OWViLWI2NGYtNjg4ZTRmZGQ1Nzc2IS9TdWJzY3JpcHRpb25zL2VjMGFhNWY3LTllNzgtNDBjOS04NWNkLTUzNWM2MzA1YjM4MC9SZXNvdXJjZUdyb3Vwcy9SRy1XRUlEWFUtVk1TUy9WTVNjYWxlU2V0cy9WTVNTMS9WTXMvNzc="; HttpPipeline pipeline = new HttpPipelineBuilder().httpClient((request) -> { assertEquals(nextLinkUri, request.getUri().toString()); diff --git a/sdk/clientcore/core/src/test/java/io/clientcore/core/implementation/http/rest/RestProxyImplTests.java b/sdk/clientcore/core/src/test/java/io/clientcore/core/implementation/http/rest/RestProxyImplTests.java index 698d882ba319f..9a0ab21df5fe5 100644 --- a/sdk/clientcore/core/src/test/java/io/clientcore/core/implementation/http/rest/RestProxyImplTests.java +++ b/sdk/clientcore/core/src/test/java/io/clientcore/core/implementation/http/rest/RestProxyImplTests.java @@ -31,7 +31,7 @@ * Tests {@link RestProxy}. */ public class RestProxyImplTests { - @ServiceInterface(name = "myService", host = "https://azure.com") + @ServiceInterface(name = "myService", host = "https://somecloud.com") interface TestInterface { @HttpRequestInformation(method = HttpMethod.POST, path = "my/uri/path", expectedStatusCodes = { 200 }) Response testMethod(@BodyParam("application/octet-stream") BinaryData data, diff --git a/sdk/clientcore/core/src/test/java/io/clientcore/core/implementation/http/rest/SwaggerInterfaceParserTests.java b/sdk/clientcore/core/src/test/java/io/clientcore/core/implementation/http/rest/SwaggerInterfaceParserTests.java index 5227674d814d4..b5247bb8e9c45 100644 --- a/sdk/clientcore/core/src/test/java/io/clientcore/core/implementation/http/rest/SwaggerInterfaceParserTests.java +++ b/sdk/clientcore/core/src/test/java/io/clientcore/core/implementation/http/rest/SwaggerInterfaceParserTests.java @@ -23,7 +23,7 @@ interface TestInterface1 { interface TestInterface2 { } - @ServiceInterface(name = "myService", host = "https://management.azure.com") + @ServiceInterface(name = "myService", host = "https://management.somecloud.com") interface TestInterface3 { } @@ -43,11 +43,11 @@ public void serviceWithNoHostInServiceInterfaceAnnotation() { @Test public void serviceWithServiceInterfaceAnnotation() { final SwaggerInterfaceParser interfaceParser = SwaggerInterfaceParser.getInstance(TestInterface3.class); - assertEquals("https://management.azure.com", interfaceParser.getHost()); + assertEquals("https://management.somecloud.com", interfaceParser.getHost()); assertEquals("myService", interfaceParser.getServiceName()); } - @ServiceInterface(name = "myService", host = "https://azure.com") + @ServiceInterface(name = "myService", host = "https://somecloud.com") interface TestInterface4 { @HttpRequestInformation(method = HttpMethod.GET, path = "my/uri/path", expectedStatusCodes = { 200 }) void testMethod4(); diff --git a/sdk/clientcore/core/src/test/java/io/clientcore/core/implementation/serializer/HttpResponseBodyDecoderTests.java b/sdk/clientcore/core/src/test/java/io/clientcore/core/implementation/serializer/HttpResponseBodyDecoderTests.java index 612b8b1360755..5bcc84e1c65b6 100644 --- a/sdk/clientcore/core/src/test/java/io/clientcore/core/implementation/serializer/HttpResponseBodyDecoderTests.java +++ b/sdk/clientcore/core/src/test/java/io/clientcore/core/implementation/serializer/HttpResponseBodyDecoderTests.java @@ -186,13 +186,13 @@ private static Stream decodableResponseSupplier() { ParameterizedType stringList = mockParameterizedType(List.class, String.class); HttpResponseDecodeData stringListDecodeData = new MockHttpResponseDecodeData(200, stringList, String.class, true); - List list = Arrays.asList("hello", "azure"); + List list = Arrays.asList("hello", "world"); Response stringListResponse = new MockHttpResponse(GET_REQUEST, 200, list); ParameterizedType mapStringString = mockParameterizedType(Map.class, String.class, String.class); HttpResponseDecodeData mapStringStringDecodeData = new MockHttpResponseDecodeData(200, mapStringString, String.class, true); - Map map = Collections.singletonMap("hello", "azure"); + Map map = Collections.singletonMap("hello", "world"); Response mapStringStringResponse = new MockHttpResponse(GET_REQUEST, 200, map); return Stream.of(Arguments.of(stringResponse, stringDecodeData, "hello"), diff --git a/sdk/clientcore/core/src/test/java/io/clientcore/core/shared/HttpClientTests.java b/sdk/clientcore/core/src/test/java/io/clientcore/core/shared/HttpClientTests.java index 41074f6774686..eca72b030ea48 100644 --- a/sdk/clientcore/core/src/test/java/io/clientcore/core/shared/HttpClientTests.java +++ b/sdk/clientcore/core/src/test/java/io/clientcore/core/shared/HttpClientTests.java @@ -324,20 +324,20 @@ public void canSendBinaryDataWithProgressReporting(BinaryData requestBody, byte[ getProtocol(ECHO_RESPONSE), new Headers(), requestBody); - + AtomicLong progress = new AtomicLong(); Context context = Contexts.empty() .setHttpRequestProgressReporter( ProgressReporter.withProgressListener(progress::set)) .getContext(); - + Response response = createHttpClient() .send(request); - + byte[] responseBytes = response .getBodyAsByteArray() .block(); - + assertArrayEquals(expectedResponseBody, responseBytes); assertEquals(expectedResponseBody.length, progress.intValue()); }*/ @@ -1356,20 +1356,20 @@ public void service20PutBodyAndHeaders() { .putBodyAndHeaders(getRequestUri(), "body string"); assertNotNull(response); assertEquals(200, response.getStatusCode()); - + assertEquals(Headers.class, response.getHeaders().getClass()); - + final HttpBinJSON body = response.getValue(); assertNotNull(body); assertMatchWithHttpOrHttps("localhost/put", body.uri()); assertEquals("body string", body.data()); - + final HttpBinHeaders headers = response.getDeserializedHeaders(); assertNotNull(headers); assertTrue(headers.accessControlAllowCredentials()); assertNotNull(headers.date()); assertNotEquals(0, (Object) headers.xProcessedTime()); - + */ } @@ -1554,13 +1554,13 @@ interface Service26 { HttpBinFormDataJSON postForm(@HostParam("uri") String uri, @FormParam("custname") String name, @FormParam("custtel") String telephone, @FormParam("custemail") String email, @FormParam("size") HttpBinFormDataJSON.PizzaSize size, @FormParam("toppings") List toppings); - + @Post("post") HttpBinFormDataJSON postEncodedForm(@HostParam("uri") String uri, @FormParam("custname") String name, @FormParam("custtel") String telephone, @FormParam(value = "custemail", encoded = true) String email, @FormParam("size") HttpBinFormDataJSON.PizzaSize size, @FormParam("toppings") List toppings); } - + @Test public void postUriForm() { Service26 service = createService(Service26.class); @@ -1572,12 +1572,12 @@ public void postUriForm() { assertEquals("123", response.form().customerTelephone()); assertEquals("foo%40bar.com", response.form().customerEmail()); assertEquals(HttpBinFormDataJSON.PizzaSize.LARGE, response.form().pizzaSize()); - + assertEquals(2, response.form().toppings().size()); assertEquals("Bacon", response.form().toppings().get(0)); assertEquals("Onion", response.form().toppings().get(1)); } - + @Test public void postUriFormEncoded() { Service26 service = createService(Service26.class); @@ -1589,7 +1589,7 @@ public void postUriFormEncoded() { assertEquals("123", response.form().customerTelephone()); assertEquals("foo@bar.com", response.form().customerEmail()); assertEquals(HttpBinFormDataJSON.PizzaSize.LARGE, response.form().pizzaSize()); - + assertEquals(2, response.form().toppings().size()); assertEquals("Bacon", response.form().toppings().get(0)); assertEquals("Onion", response.form().toppings().get(1)); @@ -1737,7 +1737,7 @@ public void canReceiveServerSentEvents() throws IOException { } /** - * Tests that eagerly converting implementation HTTP headers to azure-core Headers is done. + * Tests that eagerly converting implementation HTTP headers to Client Core Headers is done. */ @Test public void canRecognizeServerSentEvent() throws IOException { From 53337d9fc64f9c57600828f3a609725774d46b79 Mon Sep 17 00:00:00 2001 From: vcolin7 Date: Tue, 17 Dec 2024 15:59:40 -0600 Subject: [PATCH 2/2] Removed most mentions of Azure from the OKHttp library. --- sdk/clientcore/README.md | 36 +++++------ sdk/clientcore/core/README.md | 6 +- sdk/clientcore/http-okhttp3/README.md | 62 +++++-------------- .../clientcore/http/okhttp3/package-info.java | 2 +- ...pHttpClientBuilderJavaDocCodeSnippets.java | 2 +- 5 files changed, 39 insertions(+), 69 deletions(-) diff --git a/sdk/clientcore/README.md b/sdk/clientcore/README.md index 11033fe8ffd8e..8d33ae3f5b9f1 100644 --- a/sdk/clientcore/README.md +++ b/sdk/clientcore/README.md @@ -1,32 +1,32 @@ -# Azure Core shared library for Java +# Client Core shared library for Java -[![Build Documentation](https://img.shields.io/badge/documentation-published-blue.svg)](https://azure.github.io/azure-sdk-for-java) + -Azure Core provides shared primitives, abstractions, and helpers for modern Java Azure SDK client libraries. These libraries follow the [Azure SDK Design Guidelines for Java](https://azure.github.io/azure-sdk/java_introduction.html) and can be easily identified by package names starting with `io.clientcore` and module names starting with `azure-`, e.g. `io.clientcore.storage.blobs` would be found within the `/sdk/storage/azure-storage-blob` directory. A more complete list of client libraries using Azure Core can be found [here](https://azure.github.io/azure-sdk/releases/latest/#java-packages). +Client Core provides shared primitives, abstractions, and helpers for modern SDK client libraries. These libraries + +can be easily identified by package names starting with `io.clientcore` and module names starting with `core`, +e.g. `io.clientcore.core` would be found within the `/sdk/clientcore/core` directory. + -Azure Core allows client libraries to expose common functionality in a consistent fashion, so that once you learn how to use these APIs in one client library, you will know how to use them in other client libraries. +Client Core allows client libraries to expose common functionality in a consistent fashion, so that once you learn how +to use these APIs in one client library, you will know how to use them in other client libraries. -The main shared concepts of Azure Core (and therefore all Azure client libraries using Azure Core) include: +The main shared concepts of Client Core include: - Configuring service clients, e.g. configuring retries, logging, etc. - Accessing HTTP response details (`Response`). -- Calling long running operations (`Poller`). -- Paging and asynchronous streams (`PagedFlux`). + + - Exceptions for reporting errors from service requests in a consistent fashion. -- Abstractions for representing Azure SDK credentials. +- Abstractions for representing credentials. ## Sub-projects -Azure Core is split into a number of sub-components: +Client Core is split into a number of sub-components: -- [https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core) is the primary library, used by all client libraries to offer the functionality outlined above. -- [https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-amqp](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-amqp) provides functionality related to AMQP (Advanced Message Queuing Protocol). -- [https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty) provides a Netty derived HTTP client. -- [https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-okhttp](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-okhttp) provides an OkHttp derived HTTP client. -- [https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-management](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-management) provides APIs used by the Azure management libraries, but which are redundant to client libraries. -- [https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-test](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-test) provides utilities and API to make writing tests for Azure Core simpler and consistent. -- [https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-tracing-opentelemetry](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-tracing-opentelemetry) provides an OpenTelemetry based tracing library. +- [https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/clientcore/core](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/clientcore/core) is the primary library, used by all client libraries to offer the functionality outlined above. +- [https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/clientcore/http-okhttp3](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/clientore/http-okhttp3) provides an OkHttp derived HTTP client. -For documentation on using Azure Core, refer to the [https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core readme](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core). +For documentation on using Client Core, refer to the [https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/clientcore/core readme](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/clientcore/core). -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fcore%2FREADME.png) +~~~~ diff --git a/sdk/clientcore/core/README.md b/sdk/clientcore/core/README.md index fdcffe3279b99..991d1f934bb54 100644 --- a/sdk/clientcore/core/README.md +++ b/sdk/clientcore/core/README.md @@ -2,13 +2,13 @@ -Core provides shared primitives, abstractions, and helpers for modern SDK client libraries. These libraries +Client Core provides shared primitives, abstractions, and helpers for modern SDK client libraries. These libraries -can be easily identified by package names starting with `io.clientcore` and module names starting with `clientcore`, +can be easily identified by package names starting with `io.clientcore` and module names starting with `core`, e.g. `io.clientcore.core` would be found within the `/sdk/clientcore/core` directory. -Core allows client libraries to expose common functionality consistently, so that once you learn how to use these +Client Core allows client libraries to expose common functionality consistently, so that once you learn how to use these APIs in one client library, you will know how to use them in other client libraries. ## Getting started diff --git a/sdk/clientcore/http-okhttp3/README.md b/sdk/clientcore/http-okhttp3/README.md index b5c96e3d6898f..8cc1f3c0220b9 100644 --- a/sdk/clientcore/http-okhttp3/README.md +++ b/sdk/clientcore/http-okhttp3/README.md @@ -1,54 +1,21 @@ -# Azure Core OkHttp HTTP plugin library for Java +# Client Core OkHttp HTTP plugin library for Java -Azure Core OkHttp HTTP client is a plugin for the `azure-core` HTTP client API. +Client Core OkHttp HTTP client is a plugin for the `azure-core` HTTP client API. ## Getting started ### Prerequisites -- A [Java Development Kit (JDK)][jdk_link], version 8 or later. - - Here are details about [Java 8 client compatibility with Azure Certificate Authority](https://learn.microsoft.com/azure/security/fundamentals/azure-ca-details?tabs=root-and-subordinate-cas-list#client-compatibility-for-public-pkis). +- A Java Development Kit (JDK), version 8 or later. ### Include the package -#### Include the BOM file -Please include the azure-sdk-bom to your project to take dependency on the General Availability (GA) version of the library. In the following snippet, replace the {bom_version_to_target} placeholder with the version number. -To learn more about the BOM, see the [AZURE SDK BOM README](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/boms/azure-sdk-bom/README.md). - -```xml - - - - com.azure - azure-sdk-bom - {bom_version_to_target} - pom - import - - - -``` -and then include the direct dependency in the dependencies section without the version tag. - -```xml - - - com.azure - azure-core-http-okhttp - - -``` - -#### Include direct dependency -If you want to take dependency on a particular version of the library that is not present in the BOM, -add the direct dependency to your project as follows. - -[//]: # ({x-version-update-start;com.azure:azure-core-http-okhttp;current}) +[//]: # ({x-version-update-start;io.clientcore:http-okhttp3;current}) ```xml - com.azure - azure-core-http-okhttp - 1.11.14 + io.clientcore + http-okhttp3 + 1.0.0-beta.1 ``` [//]: # ({x-version-update-end}) @@ -101,9 +68,9 @@ HttpClient client = new OkHttpHttpClientBuilder( .build(); ``` -## Next steps + ## Troubleshooting @@ -114,7 +81,8 @@ or checkout [StackOverflow for Azure Java SDK](https://stackoverflow.com/questio Azure SDKs for Java provide a consistent logging story to help aid in troubleshooting application errors and expedite their resolution. The logs produced will capture the flow of an application before reaching the terminal state to help -locate the root issue. View the [logging][logging] wiki for guidance about enabling logging. +locate the root issue. + ## Contributing @@ -127,7 +95,9 @@ For details on contributing to this repository, see the [contributing guide](htt 1. Create new Pull Request -[logging]: https://github.com/Azure/azure-sdk-for-java/wiki/Logging-in-Azure-SDK -[jdk_link]: https://docs.microsoft.com/java/azure/jdk/?view=azure-java-stable -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fcore%2Fazure-core-http-okhttp%2FREADME.png) + + + + + diff --git a/sdk/clientcore/http-okhttp3/src/main/java/io/clientcore/http/okhttp3/package-info.java b/sdk/clientcore/http-okhttp3/src/main/java/io/clientcore/http/okhttp3/package-info.java index 1e0cf00e1cb4a..72e2676f3a232 100644 --- a/sdk/clientcore/http-okhttp3/src/main/java/io/clientcore/http/okhttp3/package-info.java +++ b/sdk/clientcore/http-okhttp3/src/main/java/io/clientcore/http/okhttp3/package-info.java @@ -2,6 +2,6 @@ // Licensed under the MIT License. /** - * Package containing OkHttp HTTP client plugin for azure-core. + * Package containing OkHttp HTTP client plugin for Client Core. */ package io.clientcore.http.okhttp3; diff --git a/sdk/clientcore/http-okhttp3/src/samples/java/io/clientcore/http/okhttp3/OkHttpHttpClientBuilderJavaDocCodeSnippets.java b/sdk/clientcore/http-okhttp3/src/samples/java/io/clientcore/http/okhttp3/OkHttpHttpClientBuilderJavaDocCodeSnippets.java index e20cb79678c3a..4a6ed3dac050e 100644 --- a/sdk/clientcore/http-okhttp3/src/samples/java/io/clientcore/http/okhttp3/OkHttpHttpClientBuilderJavaDocCodeSnippets.java +++ b/sdk/clientcore/http-okhttp3/src/samples/java/io/clientcore/http/okhttp3/OkHttpHttpClientBuilderJavaDocCodeSnippets.java @@ -74,7 +74,7 @@ public void usingExistingHttpClientSample() { // BEGIN: io.clientcore.http.okhttp3.using-existing-okhttp // Create an OkHttpClient with connection timeout of 250 seconds. OkHttpClient okHttpClient = new OkHttpClient().newBuilder().connectTimeout(Duration.ofSeconds(250)).build(); - // Use "okHttpClient" instance to create an azure-core HttpClient "client". + // Use "okHttpClient" instance to create a Client Core HttpClient "client". // Both "okHttpClient" and "client" share same underlying resources such as // connection pool, thread pool. // "client" inherits connection timeout settings and add proxy.