Commit 7dc64e0d authored by Erik Leckner's avatar Erik Leckner
Browse files

file-azure

parent 99d5d82b
......@@ -81,6 +81,13 @@
<artifactId>azure-active-directory-spring-boot-starter</artifactId>
<version>2.1.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>25.1-jre</version>
</dependency>
<!--
Override the spring-boot version of these dependencies to the ones
required by the azure-core library. This needs to be done for each
......@@ -115,6 +122,12 @@
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-compat-qual</artifactId>
<version>2.5.5</version>
<scope>compile</scope>
</dependency>
</dependencies>
<repositories>
<repository>
......
......@@ -16,14 +16,11 @@
package org.opengroup.osdu.file.provider.azure.common.base;
import com.google.common.annotations.GwtCompatible;
import com.google.common.base.Strings;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
@GwtCompatible
public final class Preconditions {
private Preconditions() {
}
......
......@@ -24,7 +24,7 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
//import org.springframework.data.annotation.Id;
//@Document(collection = "file-locations")
@Data
......
......@@ -17,8 +17,10 @@
package org.opengroup.osdu.file.provider.azure.repository;
import java.util.Date;
import java.util.Optional;
import org.opengroup.osdu.azure.CosmosStore;
import org.opengroup.osdu.core.common.model.http.AppException;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.file.provider.azure.model.entity.FileLocationEntity;
......@@ -46,27 +48,27 @@ public class FileLocationEntityRepository {
@Nullable
FileLocationEntity findByFileID(String fileID) {
FileLocationEntity entity = null;
//entity = new FileLocationEntity(fileID, fileID, "GCS", "https://blob/container/filepath", new Date(), "me");
return entity;
if (fileID == null) {
throw new IllegalArgumentException("The given fileID is null");
}
Optional<FileLocationEntity> fileLocationEntity = cosmosStore.findItem(headers.getPartitionId(),cosmosDBName,fileLocationContainer,fileID,fileID,FileLocationEntity.class);
if (!fileLocationEntity.isPresent())
return null;
return fileLocationEntity.get();
}
public FileLocationEntity save(FileLocationEntity entity) {
if (entity == null) {
throw new IllegalArgumentException("The given file location entity is null");
}
entity.setId(entity.getFileID());
System.out.println("Saving " + entity);
cosmosStore.upsertItem(headers.getPartitionId(), cosmosDBName, fileLocationContainer, entity);
/*
Optional<FileLocationEntity> FileLocationEntity = db.findById(entity.getId());
if (FileLocationEntity.isPresent())
throw new AppException(400, "Bad Request", "File location exists");
db.save(entity);
*/
return entity;
}
Page<FileLocationEntity> findFileList(@Param("time_from") Date from, @Param("time_to") Date to,
@Param("user_id") String userID, Pageable pageable) {
return null;
throw new UnsupportedOperationException("findFileList not supported");
}
}
......@@ -44,7 +44,6 @@ public class AzureBlobSasTokenServiceImpl {
.credential(defaultCredential)
.buildClient();
BlobContainerClient blobContainerClient = new BlobContainerClientBuilder()
.credential(defaultCredential)
.endpoint(containerUrl)
......
......@@ -19,31 +19,41 @@ azure.cosmosdb.uri=${cosmosdb_account}
azure.cosmosdb.key=${cosmosdb_key}
azure.cosmosdb.database=${cosmosdb_database}
# Azure KeyVault configuration
azure.keyvault.url=${keyvault_url}
# Azure Blob Storage configuration
file.location.containerName=odes-os-file-temp
file.location.userId=common-user
# Azure Application Insights configuration
azure.application-insights.instrumentation-key=${appinsights_key}
tenantInfo.container.name=TenantInfo
# Application name
# # Spring Application name
spring.application.name=file-azure
# Log configuration
LOG_PREFIX=file
logging.level.org.springframework.web=DEBUG
# Server configuration
server.servlet.contextPath=/api/file/v2/
server.port=8080
logging.level.org.springframework.web=DEBUG
# Java configuration
JAVA_HEAP_OPTS=-Xms4096M -Xmx4096M
JAVA_GC_OPTS=-XX:+UseG1GC -XX:+UseStringDeduplication -XX:InitiatingHeapOccupancyPercent=45
# Azure CosmosDB container configuration
filelocation.container.name=FileLocationEntity
server.port=8080
osdu.entitlements.url=https://ado-test-fqo-fqosn0o4-au-entitlements.azurewebsites.net/api/entitlements/v1
osdu.entitlements.app-key=00df85f1b08563059ea1f3fa080dd9001403
# Azure OSDU Entitlements configuration
osdu.entitlements.url=${osdu_entitlements_url}
osdu.entitlements.app-key=${osdu_entitlements_app_key}
RECORDS_ROOT_URL=https://ado-test-fqo-fqosn0o4-au-storage.azurewebsites.net/api/storage/v2
# Azure OSDU Storage configuration
RECORDS_ROOT_URL=${osdu_storage_url}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment