Skip to content

Commit

Permalink
Switch back to resource based metadata retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
machristie authored and DImuthuUpe committed Feb 18, 2021
1 parent 3d96e11 commit 13ff874
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,18 @@ public interface MetadataCollector {
*/
public FileResourceMetadata getFileResourceMetadata(String resourceId, String credentialToken) throws Exception;

/**
* Fetches a metadata of given File Resource
/*
* Fetches a metadata of given File Resource inside a registered directory resource. Target file might be living in
* multiple level below the parent directory
*
* @param storageId id of the storage resource
* @param resourcePath resource path
* @param parentResourceId parent directory resource id
* @param resourcePath path of the target resource. This should be a child path of the parent resource
* @param credentialToken credential token for the resource
* @return an object of {@link FileResourceMetadata}
* @throws Exception if the resource id is not a File Resource type or the resource can't be fetched from the resource service
* @throws Exception if the parent resource is not a Directory resource or the target resource is not a File Resource type
* or the resource can't be fetched from the resource service
*/
public FileResourceMetadata getFileResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception;
public FileResourceMetadata getFileResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception;

/**
* Fetches a metadata of given Directory Resource
Expand All @@ -64,14 +66,17 @@ public interface MetadataCollector {
public DirectoryResourceMetadata getDirectoryResourceMetadata(String resourceId, String credentialToken) throws Exception;

/**
* Fetches a metadata of given Directory Resource
* Fetches a metadata of given Directory Resource inside a registered directory resource. Target directory might be living in
* multiple level below the parent directory
*
* @param storageId id of the storage resource
* @param resourcePath resource path
* @param parentResourceId parent directory resource id
* @param resourcePath path of the target resource. This should be a child path of the parent resource
* @param credentialToken credential token for the resource
* @return an object of {@link DirectoryResourceMetadata}
* @throws Exception if the resource id is not a Directory Resource type or the resource can't be fetched from the resource service
* @throws Exception if the parent resource is not a Directory resource or the target resource is not a Directory Resource type
* or the resource can't be fetched from the resource service
*/
public DirectoryResourceMetadata getDirectoryResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception;
public DirectoryResourceMetadata getDirectoryResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception;

/**
* Check whether the resource is available in the actual storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public FileResourceMetadata getFileResourceMetadata(String resourceId, String cr
}

@Override
public FileResourceMetadata getFileResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception {
public FileResourceMetadata getFileResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception {
throw new UnsupportedOperationException("Method not implemented");
}

Expand All @@ -107,7 +107,7 @@ public DirectoryResourceMetadata getDirectoryResourceMetadata(String resourceId,
throw new UnsupportedOperationException("Method not implemented"); }

@Override
public DirectoryResourceMetadata getDirectoryResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception {
public DirectoryResourceMetadata getDirectoryResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception {
throw new UnsupportedOperationException("Method not implemented");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public FileResourceMetadata getFileResourceMetadata(String resourceId, String cr
}

@Override
public FileResourceMetadata getFileResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception {
public FileResourceMetadata getFileResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception {
throw new UnsupportedOperationException("Method not implemented");
}

Expand All @@ -96,7 +96,7 @@ public DirectoryResourceMetadata getDirectoryResourceMetadata(String resourceId,
throw new UnsupportedOperationException("Method not implemented"); }

@Override
public DirectoryResourceMetadata getDirectoryResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception {
public DirectoryResourceMetadata getDirectoryResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception {
throw new UnsupportedOperationException("Method not implemented");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public FileResourceMetadata getFileResourceMetadata(String resourceId, String cr
}

@Override
public FileResourceMetadata getFileResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception {
public FileResourceMetadata getFileResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception {
throw new UnsupportedOperationException("Method not implemented");
}

Expand All @@ -90,7 +90,7 @@ public DirectoryResourceMetadata getDirectoryResourceMetadata(String resourceId,
throw new UnsupportedOperationException("Method not implemented"); }

@Override
public DirectoryResourceMetadata getDirectoryResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception {
public DirectoryResourceMetadata getDirectoryResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception {
throw new UnsupportedOperationException("Method not implemented");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public FileResourceMetadata getFileResourceMetadata(String resourceId, String cr
}

@Override
public FileResourceMetadata getFileResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception {
public FileResourceMetadata getFileResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception {
throw new UnsupportedOperationException("Method not implemented");
}

Expand All @@ -111,7 +111,7 @@ public DirectoryResourceMetadata getDirectoryResourceMetadata(String resourceId,
throw new UnsupportedOperationException("Method not implemented"); }

@Override
public DirectoryResourceMetadata getDirectoryResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception {
public DirectoryResourceMetadata getDirectoryResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception {
throw new UnsupportedOperationException("Method not implemented");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public FileResourceMetadata getFileResourceMetadata(String resourceId, String cr
}

@Override
public FileResourceMetadata getFileResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception {
public FileResourceMetadata getFileResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception {
throw new UnsupportedOperationException("Method not implemented");
}

Expand All @@ -111,7 +111,7 @@ public DirectoryResourceMetadata getDirectoryResourceMetadata(String resourceId,
throw new UnsupportedOperationException("Method not implemented"); }

@Override
public DirectoryResourceMetadata getDirectoryResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception {
public DirectoryResourceMetadata getDirectoryResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception {
throw new UnsupportedOperationException("Method not implemented");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public FileResourceMetadata getFileResourceMetadata(String resourceId, String cr
}

@Override
public FileResourceMetadata getFileResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception {
public FileResourceMetadata getFileResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception {
throw new UnsupportedOperationException("Method not implemented");
}

Expand All @@ -104,7 +104,7 @@ public DirectoryResourceMetadata getDirectoryResourceMetadata(String resourceId,
throw new UnsupportedOperationException("Method not implemented"); }

@Override
public DirectoryResourceMetadata getDirectoryResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception {
public DirectoryResourceMetadata getDirectoryResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception {
throw new UnsupportedOperationException("Method not implemented");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public FileResourceMetadata getFileResourceMetadata(String resourceId, String cr
}

@Override
public FileResourceMetadata getFileResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception {
public FileResourceMetadata getFileResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception {
throw new UnsupportedOperationException("Method not implemented");
}

Expand All @@ -97,7 +97,7 @@ public DirectoryResourceMetadata getDirectoryResourceMetadata(String resourceId,
throw new UnsupportedOperationException("Method not implemented"); }

@Override
public DirectoryResourceMetadata getDirectoryResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception {
public DirectoryResourceMetadata getDirectoryResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception {
throw new UnsupportedOperationException("Method not implemented");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ public FileResourceMetadata getFileResourceMetadata(String resourceId, String cr
}

@Override
public FileResourceMetadata getFileResourceMetadata(String storageId, String resourcePath, String credentialToken) throws Exception {
public FileResourceMetadata getFileResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception {
ResourceServiceClient resourceClient = ResourceServiceClientBuilder.buildClient(resourceServiceHost, resourceServicePort);
SCPResource scpResource = resourceClient.scp().getSCPResource(SCPResourceGetRequest.newBuilder().setResourceId(storageId).build());
SCPResource scpResource = resourceClient.scp().getSCPResource(SCPResourceGetRequest.newBuilder().setResourceId(parentResourceId).build());

SecretServiceClient secretClient = SecretServiceClientBuilder.buildClient(secretServiceHost, secretServicePort);
SCPSecret scpSecret = secretClient.scp().getSCPSecret(SCPSecretGetRequest.newBuilder().setSecretId(credentialToken).build());
Expand Down Expand Up @@ -204,9 +204,9 @@ public DirectoryResourceMetadata getDirectoryResourceMetadata(String resourceId,
}

@Override
public DirectoryResourceMetadata getDirectoryResourceMetadata(String resourceId, String resourcePath, String credentialToken) throws Exception {
public DirectoryResourceMetadata getDirectoryResourceMetadata(String parentResourceId, String resourcePath, String credentialToken) throws Exception {
ResourceServiceClient resourceClient = ResourceServiceClientBuilder.buildClient(resourceServiceHost, resourceServicePort);
SCPResource scpPResource = resourceClient.scp().getSCPResource(SCPResourceGetRequest.newBuilder().setResourceId(resourceId).build());
SCPResource scpPResource = resourceClient.scp().getSCPResource(SCPResourceGetRequest.newBuilder().setResourceId(parentResourceId).build());

SecretServiceClient secretClient = SecretServiceClientBuilder.buildClient(secretServiceHost, secretServicePort);
SCPSecret scpSecret = secretClient.scp().getSCPSecret(SCPSecretGetRequest.newBuilder().setSecretId(credentialToken).build());
Expand Down

0 comments on commit 13ff874

Please sign in to comment.