-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New interface & factory for AzureHTTPClient providers (#1700)
* New interface for AzureHTTPClient providers * Added license headers * Updated method spec definitions * Updated spec headers doc * Updated config property in readme file * Modified doc of method * Fixed checkstyle failures
- Loading branch information
1 parent
3cb57c2
commit 2a94cad
Showing
7 changed files
with
124 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...-azure/src/main/java/org/apache/samza/system/azureblob/AzureBlobClientBuilderFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.samza.system.azureblob; | ||
|
||
/** | ||
* Default implementation of {@link BlobClientBuilderFactory} that constructs a | ||
* new instance of {@link AzureBlobClientBuilder}. | ||
*/ | ||
public class AzureBlobClientBuilderFactory implements BlobClientBuilderFactory { | ||
@Override | ||
public BlobClientBuilder getBlobClientBuilder(String systemName, String azureUrlFormat, | ||
AzureBlobConfig azureBlobConfig) { | ||
return new AzureBlobClientBuilder(systemName, azureUrlFormat, azureBlobConfig); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
samza-azure/src/main/java/org/apache/samza/system/azureblob/BlobClientBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.samza.system.azureblob; | ||
|
||
import com.azure.storage.blob.BlobServiceAsyncClient; | ||
|
||
|
||
/** | ||
* Create a BlobServiceAsyncClient. Implementation controls construction of underlying client. | ||
* Customers implementing their own System Producer need to ensure thread safety of following impl for generation of client. | ||
* If org.apache.samza.system.azureblob.producer.AzureBlobSystemProducer is used, it by defaults allows only one thread to create the client. | ||
* Please ensure any client implementation of this interface to be thread safe as well. | ||
* AzureBlobSystemProducer also ensures to safely close the client on call of stop(). Please ensure to close clients if using this interface | ||
* to create your own client. | ||
*/ | ||
public interface BlobClientBuilder { | ||
/** | ||
* Create a client for uploading to Azure Blob Storage | ||
* @return New instance of {@link BlobServiceAsyncClient} | ||
*/ | ||
BlobServiceAsyncClient getBlobServiceAsyncClient(); | ||
} |
35 changes: 35 additions & 0 deletions
35
samza-azure/src/main/java/org/apache/samza/system/azureblob/BlobClientBuilderFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.samza.system.azureblob; | ||
|
||
/** | ||
* Constructs a new instance of type {@link BlobClientBuilder}. | ||
* Implementation controls construction of underlying instance. | ||
*/ | ||
public interface BlobClientBuilderFactory { | ||
/** | ||
* Create a new instance of {@link BlobClientBuilder} | ||
* @param systemName Name of the system for which the blob client builder is being created | ||
* @param azureUrlFormat The format of the Azure URL, which should conform to Azure's URL formatting requirements. | ||
* @param azureBlobConfig The configuration settings for Azure Blob, encapsulated in an {@link AzureBlobConfig} object. | ||
* This includes metadata details for Azure Blob configs. | ||
* @return New instance of {@link BlobClientBuilder} | ||
*/ | ||
BlobClientBuilder getBlobClientBuilder(String systemName, String azureUrlFormat, AzureBlobConfig azureBlobConfig); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters