This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 0426da787dd852f113eb572f7a6480a223ceb198 Author: Andrea Cosentino <[email protected]> AuthorDate: Thu Apr 15 13:23:41 2021 +0200 CAMEL-16512 - Camel-Azure components: mark the clients as autowired - Storage-Blob --- .../component/azure/storage/blob/BlobComponent.java | 19 ------------------- .../azure/storage/blob/BlobConfiguration.java | 16 ++-------------- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobComponent.java b/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobComponent.java index 75e1e9d..6591f0a 100644 --- a/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobComponent.java +++ b/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobComponent.java @@ -72,10 +72,6 @@ public class BlobComponent extends DefaultComponent { final BlobEndpoint endpoint = new BlobEndpoint(uri, this, config); setProperties(endpoint, parameters); - if (config.isAutoDiscoverClient()) { - checkAndSetRegistryClient(config); - } - checkCredentials(config); validateConfigurations(config); @@ -106,21 +102,6 @@ public class BlobComponent extends DefaultComponent { } } - private void checkAndSetRegistryClient(final BlobConfiguration configuration) { - if (ObjectHelper.isEmpty(configuration.getServiceClient())) { - final Set<BlobServiceClient> clients = getCamelContext().getRegistry().findByType(BlobServiceClient.class); - if (clients.size() == 1) { - configuration.setServiceClient(clients.stream().findFirst().get()); - } else if (clients.size() > 1) { - LOG.info("More than one BlobServiceClient instance in the registry, make sure to have only one instance"); - } else { - LOG.info("No BlobServiceClient instance in the registry"); - } - } else { - LOG.info("BlobServiceClient instance is already set at endpoint level: skipping the check in the registry"); - } - } - private void validateConfigurations(final BlobConfiguration configuration) { if (configuration.getServiceClient() == null && configuration.getAccessKey() == null diff --git a/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobConfiguration.java b/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobConfiguration.java index b87e19a..75da69f 100644 --- a/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobConfiguration.java +++ b/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobConfiguration.java @@ -24,6 +24,7 @@ import com.azure.storage.blob.BlobServiceClient; import com.azure.storage.blob.models.BlockListType; import com.azure.storage.common.StorageSharedKeyCredential; import org.apache.camel.RuntimeCamelException; +import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriParams; import org.apache.camel.spi.UriPath; @@ -38,6 +39,7 @@ public class BlobConfiguration implements Cloneable { @UriParam private StorageSharedKeyCredential credentials; @UriParam + @Metadata(autowired = true) private BlobServiceClient serviceClient; @UriParam(label = "security", secret = true) private String accessKey; @@ -65,8 +67,6 @@ public class BlobConfiguration implements Cloneable { private Integer maxResultsPerPage; @UriParam(label = "common", defaultValue = "0") private int maxRetryRequests; - @UriParam(label = "common", defaultValue = "true") - private boolean autoDiscoverClient = true; @UriParam(defaultValue = "true") private boolean closeStreamAfterRead = true; @UriParam(label = "producer", defaultValue = "true") @@ -366,18 +366,6 @@ public class BlobConfiguration implements Cloneable { } /** - * Setting the autoDiscoverClient mechanism, if true, the component will look for a client instance in the registry - * automatically otherwise it will skip that checking. - */ - public boolean isAutoDiscoverClient() { - return autoDiscoverClient; - } - - public void setAutoDiscoverClient(boolean autoDiscoverClient) { - this.autoDiscoverClient = autoDiscoverClient; - } - - /** * Filters the results to return only blobs whose names match the specified regular expression. May be null to * return all if both prefix and regex are set, regex takes the priority and prefix is ignored. */
