Skip to content

Commit 4420f90

Browse files
committed
javadoc changes
1 parent b11f7f1 commit 4420f90

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+198
-372
lines changed

api/build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ java {
2020
withSourcesJar()
2121
}
2222

23+
javadoc {
24+
options.overview = "src/main/java/org/fairdatapipeline/overview.html"
25+
}
26+
27+
2328
dependencies {
2429
implementation project(':dataregistry')
2530
annotationProcessor 'org.immutables:value:2.8.8'
@@ -130,9 +135,6 @@ publishing {
130135

131136
signing {
132137
if (project.hasProperty('signing.keyId') && project.hasProperty('signing.secretKeyRingFile')) {
133-
if(!project.hasProperty('signing.password')){
134-
throw(new GradleException('Please give signing.password in gradle command line:\n\ngradle <task> -Psigning.password=<secret>\n'))
135-
}
136138
sign publishing.publications.mavenJava
137139
}
138140
}

api/src/main/java/org/fairdatapipeline/api/Author.java

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,14 @@
66
import org.fairdatapipeline.dataregistry.content.RegistryUsers;
77
import org.fairdatapipeline.dataregistry.restclient.APIURL;
88
import org.fairdatapipeline.dataregistry.restclient.RestClient;
9-
import org.slf4j.Logger;
10-
import org.slf4j.LoggerFactory;
119

1210
/** Retrieve the Author from the local registry. */
13-
public class Author {
14-
private static final Logger logger = LoggerFactory.getLogger(Author.class);
11+
class Author {
1512
RegistryAuthor registryAuthor;
1613

1714
/**
18-
* This implementation just retrieves the first Author it finds in the Registry.
19-
*
20-
* @param restClient link to the restClient to use.
21-
*/
22-
void DummyAuthor(RestClient restClient) {
23-
this.registryAuthor =
24-
(RegistryAuthor) restClient.getFirst(RegistryAuthor.class, Collections.emptyMap());
25-
if (this.registryAuthor == null) {
26-
String msg = "Couldn't find an author in the local registry!";
27-
logger.error(msg);
28-
throw (new RegistryObjectNotfoundException(msg));
29-
}
30-
}
31-
32-
/**
33-
* Not used. Sonia's version of the Author-retrieval code which finds the admin user, and then
34-
* retrieves the Author it links to via the User_author table. (not using this as my user_author
35-
* table is empty)
15+
* Current implementation to find the author - find the admin user, then find the linked author
16+
* via the User_author table.
3617
*
3718
* @param restClient link to the restClient to use.
3819
*/
@@ -41,18 +22,15 @@ void DummyAuthor(RestClient restClient) {
4122
(RegistryUsers)
4223
restClient.getFirst(RegistryUsers.class, Collections.singletonMap("username", "admin"));
4324
if (u == null) {
44-
String msg = "Couldn't find a User in the local registry!";
45-
logger.error(msg);
46-
throw (new RegistryObjectNotfoundException(msg));
25+
throw (new RegistryObjectNotfoundException("Couldn't find a User in the local registry!"));
4726
}
4827
RegistryUser_author ua =
4928
(RegistryUser_author)
5029
restClient.getFirst(
5130
RegistryUser_author.class, Collections.singletonMap("user", u.get_id().toString()));
5231
if (ua == null) {
53-
String msg = "Couldn't find a User_author in the local registry!";
54-
logger.error(msg);
55-
throw (new RegistryObjectNotfoundException(msg));
32+
throw (new RegistryObjectNotfoundException(
33+
"Couldn't find a User_author in the local registry!"));
5634
}
5735
this.registryAuthor = (RegistryAuthor) restClient.get(RegistryAuthor.class, ua.getAuthor());
5836
}

api/src/main/java/org/fairdatapipeline/api/CodeRepo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* exist yet). Also create a CodeRepo registryObject storing the storage_location, authors, and
1010
* description. (if an object pointing to the Storage_location does not exists yet)
1111
*/
12-
public class CodeRepo {
12+
class CodeRepo {
1313
Storage_location storage_location;
1414
FileObject fileObject;
1515

api/src/main/java/org/fairdatapipeline/api/Coderun.java

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,12 @@ public Coderun(Path configFilePath, @Nullable Path scriptPath) {
136136
public Coderun(Path configFilePath, @Nullable Path scriptPath, @Nullable String registryToken) {
137137
YamlReader yamlReader = new YamlFactory().yamlReader();
138138
if (!new File(configFilePath.toString()).isFile()) {
139-
String msg = "Coderun -- configFilePath argument must be a Path to a config file.";
140-
logger.error(msg);
141-
throw (new IllegalArgumentException(msg));
139+
throw (new IllegalArgumentException(
140+
"Coderun -- configFilePath argument must be a Path to a config file."));
142141
}
143142
if (scriptPath != null && !new File(scriptPath.toString()).isFile()) {
144-
String msg = "Coderun -- scriptPath argument must be a Path to a script file.";
145-
logger.error(msg);
146-
throw (new IllegalArgumentException(msg));
143+
throw (new IllegalArgumentException(
144+
"Coderun -- scriptPath argument must be a Path to a script file."));
147145
}
148146

149147
this.coderuns_txt = configFilePath.getParent().resolve("coderuns.txt");
@@ -160,9 +158,8 @@ public Coderun(Path configFilePath, @Nullable Path scriptPath, @Nullable String
160158
if (Files.isReadable(Path.of(filename))) {
161159
registryToken = new FileReader().read(filename);
162160
} else {
163-
String msg = "No registry token given. Giving up.";
164-
logger.error(msg);
165-
throw (new IllegalActionException(msg));
161+
throw (new IllegalActionException(
162+
"No registry token given. Giving up. (Token can be given in the config or in the Coderun constructor)"));
166163
}
167164
}
168165
}
@@ -200,10 +197,8 @@ public Coderun(Path configFilePath, @Nullable Path scriptPath, @Nullable String
200197
if (config.run_metadata().script_path().isPresent()) {
201198
scriptPath = Path.of(config.run_metadata().script_path().get());
202199
} else {
203-
String msg =
204-
"Coderun() -- Script path must be given either in constructor args or in config.";
205-
logger.error(msg);
206-
throw (new ConfigException(msg));
200+
throw (new ConfigException(
201+
"Coderun() -- Script path must be given either in constructor args or in config."));
207202
}
208203
}
209204
this.config_storage_location =
@@ -246,9 +241,8 @@ private void prepare_code_run() {
246241
try {
247242
remote_repo_url = new URL(remote_repo);
248243
} catch (MalformedURLException e) {
249-
String msg = "Remote repo must be a valid URL; (" + remote_repo + " isn't)";
250-
logger.error(msg);
251-
throw (new ConfigException(msg, e));
244+
throw (new ConfigException(
245+
"Remote repo must be a valid URL; (" + remote_repo + " isn't)", e));
252246
}
253247

254248
this.codeRepo =
@@ -330,10 +324,8 @@ public Data_product_read get_dp_for_read(String dataProduct_name) {
330324
if (dp_info_map.containsKey(dataProduct_name)) {
331325
// I could of course refuse to serve up the same DP twice, but let's be friendly.
332326
if (dp_info_map.get(dataProduct_name).getClass() != Data_product_read.class) {
333-
String msg =
334-
"You are trying to open the same data product twice in the same coderun, first for write and then for read. Please don't.";
335-
logger.error(msg);
336-
throw (new IllegalActionException(msg));
327+
throw (new IllegalActionException(
328+
"You are trying to open the same data product twice in the same coderun, first for write and then for read. Please don't."));
337329
}
338330
return (Data_product_read) dp_info_map.get(dataProduct_name);
339331
}
@@ -353,16 +345,12 @@ public Data_product_write get_dp_for_write(String dataProduct_name, String exten
353345
if (dp_info_map.containsKey(dataProduct_name)) {
354346
// I could of course refuse to serve up the same DP twice, but let's be friendly.
355347
if (dp_info_map.get(dataProduct_name).getClass() != Data_product_write.class) {
356-
String msg =
357-
"You are trying to open the same data product twice in the same coderun, first for read and then for write. Please don't.";
358-
logger.error(msg);
359-
throw (new IllegalActionException(msg));
348+
throw (new IllegalActionException(
349+
"You are trying to open the same data product twice in the same coderun, first for read and then for write. Please don't."));
360350
}
361351
if (!dp_info_map.get(dataProduct_name).extension.equals(extension)) {
362-
String msg =
363-
"You are trying to open the same data product using two different file types. Please don't.";
364-
logger.error(msg);
365-
throw (new IllegalActionException(msg));
352+
throw (new IllegalActionException(
353+
"You are trying to open the same data product using two different file types. Please don't."));
366354
}
367355
return (Data_product_write) dp_info_map.get(dataProduct_name);
368356
}
@@ -381,10 +369,8 @@ public Data_product_write get_dp_for_write(String dataProduct_name) {
381369
if (dp_info_map.containsKey(dataProduct_name)) {
382370
// I could of course refuse to serve up the same DP twice, but let's be friendly.
383371
if (dp_info_map.get(dataProduct_name).getClass() != Data_product_write.class) {
384-
String msg =
385-
"You are trying to open the same data product twice in the same coderun, first for read and then for write. Please don't.";
386-
logger.error(msg);
387-
throw (new IllegalActionException(msg));
372+
throw (new IllegalActionException(
373+
"You are trying to open the same data product twice in the same coderun, first for read and then for write. Please don't."));
388374
}
389375
return (Data_product_write) dp_info_map.get(dataProduct_name);
390376
}
@@ -445,9 +431,8 @@ public void close() {
445431
dp_info_map.forEach((key, value) -> value.close());
446432
RegistryCode_run coderun = (RegistryCode_run) restClient.post(this.registryCode_run);
447433
if (coderun == null) {
448-
String msg = "Failed to create Code_run in registry: " + this.registryCode_run;
449-
logger.error(msg);
450-
throw (new RegistryException(msg));
434+
throw (new RegistryException(
435+
"Failed to create Code_run in registry: " + this.registryCode_run));
451436
}
452437
this.register_issues();
453438
this.append_code_run_uuid(coderun.getUuid());

api/src/main/java/org/fairdatapipeline/api/FileObject.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
import org.slf4j.Logger;
77
import org.slf4j.LoggerFactory;
88

9-
/** create a new registryObject with given storage_location, description, authors, file_type. */
9+
/**
10+
* A new registryObject with given storage_location, description, authors, file_type. Used for
11+
* Submission Script, Code Repo, Config File, which can have issues raised on.
12+
*/
1013
public class FileObject {
1114
private static final Logger logger = LoggerFactory.getLogger(FileObject.class);
1215
Coderun coderun;

api/src/main/java/org/fairdatapipeline/api/IllegalActionException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.fairdatapipeline.api;
22

3-
/** the consumer is probably trying to do something they aren't supposed to be doing. */
3+
/** The consumer is probably trying to do something they aren't supposed to be doing. */
44
public class IllegalActionException extends RuntimeException {
55
/**
66
* Constructor

api/src/main/java/org/fairdatapipeline/api/RegistryException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.fairdatapipeline.api;
22

3-
/** Failure to create an Object in the registry */
3+
/** Failure to create an Object in the registry. */
44
public class RegistryException extends RuntimeException {
55
/**
66
* Constructor

api/src/main/java/org/fairdatapipeline/api/RegistryObjectNotfoundException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.fairdatapipeline.api;
22

3-
/** Failure to retrieve an expected object from the registry */
3+
/** Failure to retrieve an expected object from the registry. */
44
public class RegistryObjectNotfoundException extends RuntimeException {
55
/**
66
* Constructor

api/src/main/java/org/fairdatapipeline/api/Storage_location.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import org.slf4j.LoggerFactory;
1414

1515
/** This is used to store a file or a remote repo to the registry as a RegistryStorage_location. */
16-
public class Storage_location {
16+
class Storage_location {
1717
private static final Logger logger = LoggerFactory.getLogger(Storage_location.class);
1818
RegistryStorage_location registryStorage_location;
1919

api/src/main/java/org/fairdatapipeline/api/Storage_root.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import org.slf4j.Logger;
1111
import org.slf4j.LoggerFactory;
1212

13-
/** retrieve or create the RegistryStorage_root with a given 'root'. */
14-
public class Storage_root {
13+
/** Retrieve or create the RegistryStorage_root with a given 'root'. */
14+
class Storage_root {
1515
private static final Logger logger = LoggerFactory.getLogger(Storage_root.class);
1616
RegistryStorage_root registryStorage_root;
1717

0 commit comments

Comments
 (0)