|
1 | | -# API Connectors |
2 | | - |
3 | | -These are the currently-supported repositories from which the API will attempt |
4 | | -to pre-populate information it can glean given the project URL. Currently the |
5 | | -information obtained is somewhat sparse, as this is intended to provoke |
6 | | -discussion on what elements of metadata we should map to DOE CODE's schema. |
7 | | - |
8 | | -If any of these sources should have a "metadata.yml" file checked-in on the |
9 | | -master branch, project root level, the Connector will attempt to read from and |
10 | | -parse its information instead of calling various API methods to fill in the |
11 | | -metadata information. |
12 | | - |
13 | | -## GitHub |
14 | | - |
15 | | -Given the GitHub repository URL, the following information is obtained (provided |
16 | | -the project has such filled-in): |
17 | | -* Software Title ("Full Name") |
18 | | -* Acronym ("Name") |
19 | | -* Description |
20 | | -* Developers Listing ("Contributors") |
21 | | - * First/Last Name |
22 | | - * Email |
23 | | - * Affiliations ("Company") if provided |
24 | | - |
25 | | -## SourceForge |
26 | | - |
27 | | -From SourceForge's available API, the following is mapped: |
28 | | -* Software Title ("Name") |
29 | | -* Acronym ("Short Name") |
30 | | -* Description |
31 | | -* License (concatenating multiple SF licenses, if provided) |
32 | | -* Developers (first and last name) |
33 | | - |
34 | | -## BitBucket |
35 | | - |
36 | | -BitBucket API maps elements: |
37 | | -* Software Title ("Full Name") |
38 | | -* Acronym ("Name") |
39 | | -* Developers |
40 | | - * If a "team" is found, iterate through each team member; if a single user/ |
41 | | - Owner, take that as the sole developer |
42 | | - * First/Last Name |
43 | | - |
44 | | -# ConnectorFactory instantiation |
45 | | - |
46 | | -These connector instances should each implement the ConnectorInterface interface |
47 | | -in order to be added to a ConnectorFactory instantiation. The interface defines |
48 | | -only two methods: |
49 | | - |
50 | | -``` java |
51 | | - init() throws IOException |
52 | | -``` |
53 | | - |
54 | | - Initialize the Connector, if necessary, throwing IOException on errors |
55 | | - |
56 | | -``` java |
57 | | - read(String url) |
58 | | -``` |
59 | | - |
60 | | - Attempt to load Metadata information from the given URL, if recognized. If not, |
61 | | - or unable to do so, return null. |
62 | | - |
63 | | -In order to use the Factory, one should acquire an instance, and add each desired Connector to it: |
64 | | - |
65 | | -``` java |
66 | | - ConnectorFactory factory = ConnectorFactory.getInstance() |
67 | | - .add(new GitHub()) |
68 | | - .add(new SourceForge()) |
69 | | - .build(); |
70 | | -``` |
71 | | - |
72 | | -Simply call the `factory.read(String)` method to obtain any JSON metadata if possible. |
73 | | -Note this may return null if not recognized. |
| 1 | +# API Connectors |
| 2 | + |
| 3 | +These are the currently-supported repositories from which the API will attempt |
| 4 | +to pre-populate information it can glean given the project URL. Currently the |
| 5 | +information obtained is somewhat sparse, as this is intended to provoke |
| 6 | +discussion on what elements of metadata we should map to DOE CODE's schema. |
| 7 | + |
| 8 | +If any of these sources should have a "metadata.yml" file checked-in on the |
| 9 | +master branch, project root level, the Connector will attempt to read from and |
| 10 | +parse its information instead of calling various API methods to fill in the |
| 11 | +metadata information. |
| 12 | + |
| 13 | +## GitHub |
| 14 | + |
| 15 | +Given the GitHub Repository URL, the following information is obtained (provided |
| 16 | +the project has such filled-in): |
| 17 | +* Software Title ("Full Name") |
| 18 | +* Acronym ("Name") |
| 19 | +* Description |
| 20 | +* Developers Listing ("Contributors") |
| 21 | + * First/Last Name |
| 22 | + * Email |
| 23 | + * Affiliations ("Company") if provided |
| 24 | + |
| 25 | +## SourceForge |
| 26 | + |
| 27 | +From SourceForge's available API, the following is mapped: |
| 28 | +* Software Title ("Name") |
| 29 | +* Acronym ("Short Name") |
| 30 | +* Description |
| 31 | +* License (concatenating multiple SF licenses, if provided) |
| 32 | +* Developers (first and last name) |
| 33 | + |
| 34 | +## BitBucket |
| 35 | + |
| 36 | +BitBucket API maps elements: |
| 37 | +* Software Title ("Full Name") |
| 38 | +* Acronym ("Name") |
| 39 | +* Developers |
| 40 | + * If a "team" is found, iterate through each team member; if a single user/ |
| 41 | + Owner, take that as the sole developer |
| 42 | + * First/Last Name |
| 43 | + |
| 44 | +# ConnectorFactory instantiation |
| 45 | + |
| 46 | +These connector instances should each implement the ConnectorInterface interface |
| 47 | +in order to be added to a ConnectorFactory instantiation. The interface defines |
| 48 | +only two methods: |
| 49 | + |
| 50 | +``` java |
| 51 | + init() throws IOException |
| 52 | +``` |
| 53 | + |
| 54 | + Initialize the Connector, if necessary, throwing IOException on errors |
| 55 | + |
| 56 | +``` java |
| 57 | + read(String url) |
| 58 | +``` |
| 59 | + |
| 60 | + Attempt to load Metadata information from the given URL, if recognized. If not, |
| 61 | + or unable to do so, return null. |
| 62 | + |
| 63 | +In order to use the Factory, one should acquire an instance, and add each desired Connector to it: |
| 64 | + |
| 65 | +``` java |
| 66 | + ConnectorFactory factory = ConnectorFactory.getInstance() |
| 67 | + .add(new GitHub()) |
| 68 | + .add(new SourceForge()) |
| 69 | + .build(); |
| 70 | +``` |
| 71 | + |
| 72 | +Simply call the `factory.read(String)` method to obtain any JSON metadata if possible. |
| 73 | +Note this may return null if not recognized. |
0 commit comments