Skip to content

Commit 29a8c04

Browse files
authored
Allow directory client to be build only with some clients. e,g, reader
1 parent 3d8336a commit 29a8c04

12 files changed

+236
-297
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.aserto</groupId>
88
<artifactId>aserto-java</artifactId>
9-
<version>0.20.11</version>
9+
<version>0.21.00</version>
1010

1111
<name>${project.groupId}:${project.artifactId}</name>
1212
<description>Java SDK to interact with aserto services</description>

src/main/java/com/aserto/directory/v3/DirectoryClient.java

Lines changed: 144 additions & 38 deletions
Large diffs are not rendered by default.

src/main/java/com/aserto/directory/v3/DirectoryClientBuilder.java

Lines changed: 0 additions & 146 deletions
This file was deleted.

src/main/java/com/aserto/directory/v3/DirectoryClientExporter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
import java.util.Iterator;
88

99
public interface DirectoryClientExporter {
10-
Iterator<ExportResponse> exportData(Option options);
11-
Iterator<ExportResponse> exportData(Option options, Timestamp startFrom);
10+
Iterator<ExportResponse> exportData(Option options) throws UninitilizedClientException;
11+
Iterator<ExportResponse> exportData(Option options, Timestamp startFrom) throws UninitilizedClientException;
1212
}

src/main/java/com/aserto/directory/v3/DirectoryClientImporter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
import java.util.stream.Stream;
55

66
public interface DirectoryClientImporter {
7-
void importData(Stream<ImportElement> importStream) throws InterruptedException;
7+
void importData(Stream<ImportElement> importStream) throws InterruptedException, UninitilizedClientException;
88
}

src/main/java/com/aserto/directory/v3/DirectoryClientModel.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import com.aserto.directory.model.v3.GetManifestResponse;
55

66
public interface DirectoryClientModel {
7-
GetManifestResponse getManifest();
8-
void setManifest(String manifest) throws InterruptedException;
9-
DeleteManifestResponse deleteManifest();
7+
GetManifestResponse getManifest() throws UninitilizedClientException;
8+
void setManifest(String manifest) throws InterruptedException, UninitilizedClientException;
9+
DeleteManifestResponse deleteManifest() throws UninitilizedClientException;
1010
}

src/main/java/com/aserto/directory/v3/DirectoryClientReader.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@
66
import java.util.List;
77

88
public interface DirectoryClientReader {
9-
GetObjectResponse getObject(String type, String id);
10-
GetObjectResponse getObject(String type, String id, boolean withRelations);
11-
GetObjectsResponse getObjects(String type);
12-
GetObjectsResponse getObjects(String type, int pageSize, String pageToken);
13-
GetObjectManyResponse getObjectManyRequest(List<ObjectIdentifier> objectIdentifiers);
9+
GetObjectResponse getObject(String type, String id) throws UninitilizedClientException;
10+
GetObjectResponse getObject(String type, String id, boolean withRelations) throws UninitilizedClientException;
11+
GetObjectsResponse getObjects(String type) throws UninitilizedClientException;
12+
GetObjectsResponse getObjects(String type, int pageSize, String pageToken) throws UninitilizedClientException;
13+
GetObjectManyResponse getObjectManyRequest(List<ObjectIdentifier> objectIdentifiers) throws UninitilizedClientException;
1414
GetRelationResponse getRelation(String objectType, String objectId, String relationName,
15-
String subjectType, String subjectId);
15+
String subjectType, String subjectId) throws UninitilizedClientException;
1616
GetRelationResponse getRelation(String objectType, String objectId, String relationName, String subjectType,
17-
String subjectId, String subjectRelation);
17+
String subjectId, String subjectRelation) throws UninitilizedClientException;
1818
GetRelationResponse getRelation(String objectType, String objectId, String relationName, String subjectType,
19-
String subjectId, String subjectRelation, boolean withObjects);
20-
GetRelationsResponse getRelations(GetRelationsRequest relationsRequest);
19+
String subjectId, String subjectRelation, boolean withObjects) throws UninitilizedClientException;
20+
GetRelationsResponse getRelations(GetRelationsRequest relationsRequest) throws UninitilizedClientException;
2121

2222
CheckPermissionResponse checkPermission(String objectType, String objectId, String subjectType,
23-
String subjectId, String permissionName);
23+
String subjectId, String permissionName) throws UninitilizedClientException;
2424
CheckPermissionResponse checkPermission(String objectType, String objectId,
25-
String subjectType, String subjectId, String permissionName, boolean trace);
26-
CheckRelationResponse checkRelation(String objectType, String objectId, String relationName, String subjectType, String subjectId);
25+
String subjectType, String subjectId, String permissionName, boolean trace) throws UninitilizedClientException;
26+
CheckRelationResponse checkRelation(String objectType, String objectId, String relationName, String subjectType, String subjectId) throws UninitilizedClientException;
2727
CheckRelationResponse checkRelation(String objectType, String objectId, String relationName,
28-
String subjectType, String subjectId, boolean trace);
29-
CheckResponse check(String objectType, String objectId, String relationName, String subjectType, String subjectId);
28+
String subjectType, String subjectId, boolean trace) throws UninitilizedClientException;
29+
CheckResponse check(String objectType, String objectId, String relationName, String subjectType, String subjectId) throws UninitilizedClientException;
3030
CheckResponse check(String objectType, String objectId, String relationName,
31-
String subjectType, String subjectId, boolean trace);
31+
String subjectType, String subjectId, boolean trace) throws UninitilizedClientException;
3232
GetGraphResponse getGraph(GetGraphRequest getGraphRequest);
3333
}

src/main/java/com/aserto/directory/v3/DirectoryClientWriter.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
import com.google.protobuf.Struct;
88

99
public interface DirectoryClientWriter {
10-
public SetObjectResponse setObject(String type, String id);
11-
public SetObjectResponse setObject(String type, String id, String displayName, Struct properties, String hash);
12-
public DeleteObjectResponse deleteObject(String type, String id);
13-
public DeleteObjectResponse deleteObject(String type, String id, boolean withRelations);
10+
public SetObjectResponse setObject(String type, String id) throws UninitilizedClientException;
11+
public SetObjectResponse setObject(String type, String id, String displayName, Struct properties, String hash) throws UninitilizedClientException;
12+
public DeleteObjectResponse deleteObject(String type, String id) throws UninitilizedClientException;
13+
public DeleteObjectResponse deleteObject(String type, String id, boolean withRelations) throws UninitilizedClientException;
1414
public SetRelationResponse setRelation(String objectType, String objectId, String relationName,
15-
String subjectType, String subjectId);
15+
String subjectType, String subjectId) throws UninitilizedClientException;
1616
public SetRelationResponse setRelation(String objectType, String objectId, String relationName,
17-
String subjectType, String subjectId, String subjectRelation);
17+
String subjectType, String subjectId, String subjectRelation) throws UninitilizedClientException;
1818
public SetRelationResponse setRelation(String objectType, String objectId, String relationName,
19-
String subjectType, String subjectId, String subjectRelation, String hash);
19+
String subjectType, String subjectId, String subjectRelation, String hash) throws UninitilizedClientException;
2020
public DeleteRelationResponse deleteRelation(String objectType, String objectId, String relationName,
21-
String subjectType, String subjectId);
21+
String subjectType, String subjectId) throws UninitilizedClientException;
2222
public DeleteRelationResponse deleteRelation(String objectType, String objectId, String relationName,
23-
String subjectType, String subjectId, String subjectRelation);
23+
String subjectType, String subjectId, String subjectRelation) throws UninitilizedClientException;
2424
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.aserto.directory.v3;
2+
3+
public class UninitilizedClientException extends Exception {
4+
public UninitilizedClientException(String message) {
5+
super(message);
6+
}
7+
}

src/test/java/DirectoryClientBuilderTest.java

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)