Commit d73422afc05d8c3e37bbe197a195bbf7769d1e9f

Authored by Paulo Graça
1 parent bcd468f51a

Support ORCID v2.0 and change logging framework to logback

.gitignore
... ... @@ -4,3 +4,4 @@
4 4 .classpath
5 5 .project
6 6 .settings/
  7 +/target/
... ...
pom.xml
... ... @@ -4,17 +4,16 @@
4 4  
5 5 <groupId>org.um.dsi.gavea</groupId>
6 6 <artifactId>degois-orcid-client</artifactId>
7   - <version>2.0-rc2</version>
  7 + <version>2.0</version>
8 8  
9 9 <name>Orcid Client</name>
10 10  
11 11 <properties>
12 12 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13 13 <java.version>1.8</java.version>
14   -
15 14 <jersey.version>2.22.1</jersey.version>
16 15 <jaxb2-basics.version>0.9.5</jaxb2-basics.version>
17   - <log4j.version>2.4</log4j.version>
  16 + <logback-version>1.1.7</logback-version>
18 17 <junit.version>4.12</junit.version>
19 18 </properties>
20 19  
... ... @@ -46,11 +45,18 @@
46 45 <artifactId>jaxb2-basics-runtime</artifactId>
47 46 <version>${jaxb2-basics.version}</version>
48 47 </dependency>
49   - <!-- Log4J -->
  48 + <!-- Logging -->
  49 + <dependency>
  50 + <groupId>ch.qos.logback</groupId>
  51 + <artifactId>logback-classic</artifactId>
  52 + <version>${logback-version}</version>
  53 + <scope>compile</scope>
  54 + </dependency>
50 55 <dependency>
51   - <groupId>org.apache.logging.log4j</groupId>
52   - <artifactId>log4j-core</artifactId>
53   - <version>${log4j.version}</version>
  56 + <groupId>ch.qos.logback</groupId>
  57 + <artifactId>logback-core</artifactId>
  58 + <version>${logback-version}</version>
  59 + <scope>compile</scope>
54 60 </dependency>
55 61 <!-- JUnit -->
56 62 <dependency>
... ... @@ -80,8 +86,8 @@
80 86 <bindingDirectory>${basedir}/src/main/resources/binding</bindingDirectory>
81 87 <schemaDirectory>${basedir}/src/main/resources/xsd</schemaDirectory>
82 88 <schemaIncludes>
83   - <include>common_2.0_rc2/*.xsd</include>
84   - <include>record_2.0_rc2/*.xsd</include>
  89 + <include>common_2.0/*.xsd</include>
  90 + <include>record_2.0/*.xsd</include>
85 91 </schemaIncludes>
86 92 <episode>false</episode>
87 93 <args>
... ...
src/main/java/org/um/dsi/gavea/orcid/client/constants/OrcidConstants.java
... ... @@ -4,7 +4,7 @@ import javax.ws.rs.core.MediaType;
4 4  
5 5 public final class OrcidConstants {
6 6  
7   - public final static String API_VERSION = "v2.0_rc2";
  7 + public final static String API_VERSION = "v2.0";
8 8  
9 9 public final static String ENDPOINT_OAUTH_AUTHORIZE = "/oauth/authorize";
10 10 public final static String ENDPOINT_OAUTH_TOKEN = "/oauth/token";
... ...
src/main/resources/binding/orcid-2.0.xjb
... ... @@ -0,0 +1,184 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
  3 + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
  4 + xmlns:namespace="http://jaxb2-commons.dev.java.net/namespace-prefix"
  5 + jaxb:version="2.1">
  6 +
  7 + <jaxb:bindings schemaLocation="../xsd/record_2.0/activities-2.0.xsd" node="/xs:schema">
  8 + <jaxb:globalBindings>
  9 + <jaxb:serializable uid="1" />
  10 + </jaxb:globalBindings>
  11 +
  12 + <jaxb:schemaBindings>
  13 + <jaxb:package name="org.um.dsi.gavea.orcid.model.activities" />
  14 + </jaxb:schemaBindings>
  15 + <jaxb:bindings node="//xs:complexType[@name='educations']">
  16 + <jaxb:property name="educations-ctype" />
  17 + <jaxb:class name="EducationsCtype" />
  18 + </jaxb:bindings>
  19 + <jaxb:bindings node="//xs:complexType[@name='employments']">
  20 + <jaxb:property name="employments-ctype" />
  21 + <jaxb:class name="EmploymentsCtype" />
  22 + </jaxb:bindings>
  23 + <jaxb:bindings node="//xs:complexType[@name='works']">
  24 + <jaxb:property name="works-ctype" />
  25 + <jaxb:class name="WorksCtype" />
  26 + </jaxb:bindings>
  27 + <jaxb:bindings node="//xs:complexType[@name='peer-reviews']">
  28 + <jaxb:property name="peer-reviews-ctype" />
  29 + <jaxb:class name="PeerReviewsCtype" />
  30 + </jaxb:bindings>
  31 + <jaxb:bindings node="//xs:complexType[@name='fundings']">
  32 + <jaxb:property name="fundings-ctype" />
  33 + <jaxb:class name="FundingsCtype" />
  34 + </jaxb:bindings>
  35 + </jaxb:bindings>
  36 +
  37 + <jaxb:bindings schemaLocation="../xsd/common_2.0/common-2.0.xsd" node="/xs:schema">
  38 + <jaxb:schemaBindings>
  39 + <jaxb:package name="org.um.dsi.gavea.orcid.model.common" />
  40 + </jaxb:schemaBindings>
  41 +
  42 + <jaxb:bindings node="//xs:complexType[@name='client-id']/xs:sequence/xs:choice/xs:sequence/xs:element[@name='path']">
  43 + <jaxb:property name="uri-path" />
  44 + </jaxb:bindings>
  45 +
  46 + <jaxb:bindings node="//xs:complexType[@name='orcid-id']/xs:sequence/xs:choice/xs:sequence/xs:element[@name='path']">
  47 + <jaxb:property name="uri-path" />
  48 + </jaxb:bindings>
  49 + </jaxb:bindings>
  50 +
  51 + <jaxb:bindings schemaLocation="../xsd/record_2.0/address-2.0.xsd" node="/xs:schema">
  52 + <jaxb:schemaBindings>
  53 + <jaxb:package name="org.um.dsi.gavea.orcid.model.address" />
  54 + </jaxb:schemaBindings>
  55 +
  56 + <jaxb:bindings node="//xs:complexType[@name='address']">
  57 + <jaxb:property name="address-ctype" />
  58 + <jaxb:class name="AddressCtype" />
  59 + </jaxb:bindings>
  60 + </jaxb:bindings>
  61 +
  62 + <jaxb:bindings schemaLocation="../xsd/record_2.0/education-2.0.xsd" node="/xs:schema">
  63 + <jaxb:schemaBindings>
  64 + <jaxb:package name="org.um.dsi.gavea.orcid.model.education" />
  65 + </jaxb:schemaBindings>
  66 + </jaxb:bindings>
  67 +
  68 + <jaxb:bindings schemaLocation="../xsd/record_2.0/email-2.0.xsd" node="/xs:schema">
  69 + <jaxb:schemaBindings>
  70 + <jaxb:package name="org.um.dsi.gavea.orcid.model.email" />
  71 + </jaxb:schemaBindings>
  72 +
  73 + <jaxb:bindings node="//xs:complexType[@name='email']">
  74 + <jaxb:property name="email-ctype" />
  75 + <jaxb:class name="EmailCtype" />
  76 + </jaxb:bindings>
  77 + </jaxb:bindings>
  78 +
  79 + <jaxb:bindings schemaLocation="../xsd/record_2.0/employment-2.0.xsd" node="/xs:schema">
  80 + <jaxb:schemaBindings>
  81 + <jaxb:package name="org.um.dsi.gavea.orcid.model.employment" />
  82 + </jaxb:schemaBindings>
  83 + </jaxb:bindings>
  84 +
  85 + <jaxb:bindings schemaLocation="../xsd/record_2.0/error-2.0.xsd" node="/xs:schema">
  86 + <jaxb:schemaBindings>
  87 + <jaxb:package name="org.um.dsi.gavea.orcid.model.error" />
  88 + </jaxb:schemaBindings>
  89 + </jaxb:bindings>
  90 +
  91 + <jaxb:bindings schemaLocation="../xsd/record_2.0/funding-2.0.xsd" node="/xs:schema">
  92 + <jaxb:schemaBindings>
  93 + <jaxb:package name="org.um.dsi.gavea.orcid.model.funding" />
  94 + </jaxb:schemaBindings>
  95 +
  96 + <jaxb:bindings node="//xs:element[@name='summary']">
  97 + <jaxb:property name="funding-summary" />
  98 + <jaxb:class name="FundingSummary" />
  99 + </jaxb:bindings>
  100 + </jaxb:bindings>
  101 +
  102 + <jaxb:bindings schemaLocation="../xsd/record_2.0/keyword-2.0.xsd" node="/xs:schema">
  103 + <jaxb:schemaBindings>
  104 + <jaxb:package name="org.um.dsi.gavea.orcid.model.keyword" />
  105 + </jaxb:schemaBindings>
  106 +
  107 + <jaxb:bindings node="//xs:complexType[@name='keyword']">
  108 + <jaxb:property name="keyword-ctype" />
  109 + <jaxb:class name="KeywordCtype" />
  110 + </jaxb:bindings>
  111 + </jaxb:bindings>
  112 +
  113 + <jaxb:bindings schemaLocation="../xsd/record_2.0/other-name-2.0.xsd" node="/xs:schema">
  114 + <jaxb:schemaBindings>
  115 + <jaxb:package name="org.um.dsi.gavea.orcid.model.othername" />
  116 + </jaxb:schemaBindings>
  117 +
  118 + <jaxb:bindings node="//xs:complexType[@name='other-name']">
  119 + <jaxb:property name="other-name-ctype" />
  120 + <jaxb:class name="OtherNameCtype" />
  121 + </jaxb:bindings>
  122 + </jaxb:bindings>
  123 +
  124 + <jaxb:bindings schemaLocation="../xsd/record_2.0/peer-review-2.0.xsd" node="/xs:schema">
  125 + <jaxb:schemaBindings>
  126 + <jaxb:package name="org.um.dsi.gavea.orcid.model.peerreview" />
  127 + </jaxb:schemaBindings>
  128 +
  129 + <jaxb:bindings node="//xs:element[@name='summary']">
  130 + <jaxb:property name="peer-review-summary" />
  131 + <jaxb:class name="PeerReviewSummary" />
  132 + </jaxb:bindings>
  133 + </jaxb:bindings>
  134 +
  135 + <jaxb:bindings schemaLocation="../xsd/record_2.0/person-2.0.xsd" node="/xs:schema">
  136 + <jaxb:schemaBindings>
  137 + <jaxb:package name="org.um.dsi.gavea.orcid.model.person" />
  138 + </jaxb:schemaBindings>
  139 + </jaxb:bindings>
  140 +
  141 + <jaxb:bindings schemaLocation="../xsd/record_2.0/person-external-identifier-2.0.xsd" node="/xs:schema">
  142 + <jaxb:schemaBindings>
  143 + <jaxb:package name="org.um.dsi.gavea.orcid.model.person.externalidentifier" />
  144 + </jaxb:schemaBindings>
  145 + </jaxb:bindings>
  146 +
  147 + <jaxb:bindings schemaLocation="../xsd/record_2.0/personal-details-2.0.xsd" node="/xs:schema">
  148 + <jaxb:schemaBindings>
  149 + <jaxb:package name="org.um.dsi.gavea.orcid.model.personaldetails" />
  150 + </jaxb:schemaBindings>
  151 +
  152 + <jaxb:bindings node="//xs:complexType[@name='name']">
  153 + <jaxb:property name="name-ctype" />
  154 + <jaxb:class name="NameCtype" />
  155 + </jaxb:bindings>
  156 +
  157 + <jaxb:bindings node="//xs:complexType[@name='biography']">
  158 + <jaxb:property name="biography-ctype" />
  159 + <jaxb:class name="BiographyCtype" />
  160 + </jaxb:bindings>
  161 +
  162 + <jaxb:bindings node="//xs:complexType[@name='credit-name']">
  163 + <jaxb:property name="credit-name-ctype" />
  164 + <jaxb:class name="CreditNameCtype" />
  165 + </jaxb:bindings>
  166 + </jaxb:bindings>
  167 +
  168 + <jaxb:bindings schemaLocation="../xsd/record_2.0/researcher-url-2.0.xsd" node="/xs:schema">
  169 + <jaxb:schemaBindings>
  170 + <jaxb:package name="org.um.dsi.gavea.orcid.model.researcherurl" />
  171 + </jaxb:schemaBindings>
  172 +
  173 + <jaxb:bindings node="//xs:complexType[@name='researcher-url']">
  174 + <jaxb:property name="researcher-url-ctype" />
  175 + <jaxb:class name="ResearcherUrlCtype" />
  176 + </jaxb:bindings>
  177 + </jaxb:bindings>
  178 +
  179 + <jaxb:bindings schemaLocation="../xsd/record_2.0/work-2.0.xsd" node="/xs:schema">
  180 + <jaxb:schemaBindings>
  181 + <jaxb:package name="org.um.dsi.gavea.orcid.model.work" />
  182 + </jaxb:schemaBindings>
  183 + </jaxb:bindings>
  184 +</jaxb:bindings>
0 185 \ No newline at end of file
... ...
src/main/resources/binding/orcid-2.0_rc2.xjb
... ... @@ -1,164 +0,0 @@
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
3   - xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
4   - xmlns:namespace="http://jaxb2-commons.dev.java.net/namespace-prefix"
5   - jaxb:version="2.1">
6   -
7   - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/activities-2.0_rc2.xsd" node="/xs:schema">
8   - <jaxb:globalBindings>
9   - <jaxb:serializable uid="1" />
10   - </jaxb:globalBindings>
11   -
12   - <jaxb:schemaBindings>
13   - <jaxb:package name="org.um.dsi.gavea.orcid.model.activities" />
14   - </jaxb:schemaBindings>
15   - </jaxb:bindings>
16   -
17   - <jaxb:bindings schemaLocation="../xsd/common_2.0_rc2/common-2.0_rc2.xsd" node="/xs:schema">
18   - <jaxb:schemaBindings>
19   - <jaxb:package name="org.um.dsi.gavea.orcid.model.common" />
20   - </jaxb:schemaBindings>
21   -
22   - <jaxb:bindings node="//xs:complexType[@name='client-id']/xs:sequence/xs:choice/xs:sequence/xs:element[@name='path']">
23   - <jaxb:property name="uri-path" />
24   - </jaxb:bindings>
25   -
26   - <jaxb:bindings node="//xs:complexType[@name='orcid-id']/xs:sequence/xs:choice/xs:sequence/xs:element[@name='path']">
27   - <jaxb:property name="uri-path" />
28   - </jaxb:bindings>
29   - </jaxb:bindings>
30   -
31   - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/address-2.0_rc2.xsd" node="/xs:schema">
32   - <jaxb:schemaBindings>
33   - <jaxb:package name="org.um.dsi.gavea.orcid.model.address" />
34   - </jaxb:schemaBindings>
35   -
36   - <jaxb:bindings node="//xs:complexType[@name='address']">
37   - <jaxb:property name="address-ctype" />
38   - <jaxb:class name="AddressCtype" />
39   - </jaxb:bindings>
40   - </jaxb:bindings>
41   -
42   - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/education-2.0_rc2.xsd" node="/xs:schema">
43   - <jaxb:schemaBindings>
44   - <jaxb:package name="org.um.dsi.gavea.orcid.model.education" />
45   - </jaxb:schemaBindings>
46   - </jaxb:bindings>
47   -
48   - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/email-2.0_rc2.xsd" node="/xs:schema">
49   - <jaxb:schemaBindings>
50   - <jaxb:package name="org.um.dsi.gavea.orcid.model.email" />
51   - </jaxb:schemaBindings>
52   -
53   - <jaxb:bindings node="//xs:complexType[@name='email']">
54   - <jaxb:property name="email-ctype" />
55   - <jaxb:class name="EmailCtype" />
56   - </jaxb:bindings>
57   - </jaxb:bindings>
58   -
59   - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/employment-2.0_rc2.xsd" node="/xs:schema">
60   - <jaxb:schemaBindings>
61   - <jaxb:package name="org.um.dsi.gavea.orcid.model.employment" />
62   - </jaxb:schemaBindings>
63   - </jaxb:bindings>
64   -
65   - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/error-2.0_rc2.xsd" node="/xs:schema">
66   - <jaxb:schemaBindings>
67   - <jaxb:package name="org.um.dsi.gavea.orcid.model.error" />
68   - </jaxb:schemaBindings>
69   - </jaxb:bindings>
70   -
71   - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/funding-2.0_rc2.xsd" node="/xs:schema">
72   - <jaxb:schemaBindings>
73   - <jaxb:package name="org.um.dsi.gavea.orcid.model.funding" />
74   - </jaxb:schemaBindings>
75   -
76   - <jaxb:bindings node="//xs:element[@name='summary']">
77   - <jaxb:property name="funding-summary" />
78   - <jaxb:class name="FundingSummary" />
79   - </jaxb:bindings>
80   - </jaxb:bindings>
81   -
82   - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/keyword-2.0_rc2.xsd" node="/xs:schema">
83   - <jaxb:schemaBindings>
84   - <jaxb:package name="org.um.dsi.gavea.orcid.model.keyword" />
85   - </jaxb:schemaBindings>
86   -
87   - <jaxb:bindings node="//xs:complexType[@name='keyword']">
88   - <jaxb:property name="keyword-ctype" />
89   - <jaxb:class name="KeywordCtype" />
90   - </jaxb:bindings>
91   - </jaxb:bindings>
92   -
93   - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/other-name-2.0_rc2.xsd" node="/xs:schema">
94   - <jaxb:schemaBindings>
95   - <jaxb:package name="org.um.dsi.gavea.orcid.model.othername" />
96   - </jaxb:schemaBindings>
97   -
98   - <jaxb:bindings node="//xs:complexType[@name='other-name']">
99   - <jaxb:property name="other-name-ctype" />
100   - <jaxb:class name="OtherNameCtype" />
101   - </jaxb:bindings>
102   - </jaxb:bindings>
103   -
104   - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/peer-review-2.0_rc2.xsd" node="/xs:schema">
105   - <jaxb:schemaBindings>
106   - <jaxb:package name="org.um.dsi.gavea.orcid.model.peerreview" />
107   - </jaxb:schemaBindings>
108   -
109   - <jaxb:bindings node="//xs:element[@name='summary']">
110   - <jaxb:property name="peer-review-summary" />
111   - <jaxb:class name="PeerReviewSummary" />
112   - </jaxb:bindings>
113   - </jaxb:bindings>
114   -
115   - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/person-2.0_rc2.xsd" node="/xs:schema">
116   - <jaxb:schemaBindings>
117   - <jaxb:package name="org.um.dsi.gavea.orcid.model.person" />
118   - </jaxb:schemaBindings>
119   - </jaxb:bindings>
120   -
121   - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/person-external-identifier-2.0_rc2.xsd" node="/xs:schema">
122   - <jaxb:schemaBindings>
123   - <jaxb:package name="org.um.dsi.gavea.orcid.model.person.externalidentifier" />
124   - </jaxb:schemaBindings>
125   - </jaxb:bindings>
126   -
127   - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/personal-details-2.0_rc2.xsd" node="/xs:schema">
128   - <jaxb:schemaBindings>
129   - <jaxb:package name="org.um.dsi.gavea.orcid.model.personaldetails" />
130   - </jaxb:schemaBindings>
131   -
132   - <jaxb:bindings node="//xs:complexType[@name='name']">
133   - <jaxb:property name="name-ctype" />
134   - <jaxb:class name="NameCtype" />
135   - </jaxb:bindings>
136   -
137   - <jaxb:bindings node="//xs:complexType[@name='biography']">
138   - <jaxb:property name="biography-ctype" />
139   - <jaxb:class name="BiographyCtype" />
140   - </jaxb:bindings>
141   -
142   - <jaxb:bindings node="//xs:complexType[@name='credit-name']">
143   - <jaxb:property name="credit-name-ctype" />
144   - <jaxb:class name="CreditNameCtype" />
145   - </jaxb:bindings>
146   - </jaxb:bindings>
147   -
148   - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/researcher-url-2.0_rc2.xsd" node="/xs:schema">
149   - <jaxb:schemaBindings>
150   - <jaxb:package name="org.um.dsi.gavea.orcid.model.researcherurl" />
151   - </jaxb:schemaBindings>
152   -
153   - <jaxb:bindings node="//xs:complexType[@name='researcher-url']">
154   - <jaxb:property name="researcher-url-ctype" />
155   - <jaxb:class name="ResearcherUrlCtype" />
156   - </jaxb:bindings>
157   - </jaxb:bindings>
158   -
159   - <jaxb:bindings schemaLocation="../xsd/record_2.0_rc2/work-2.0_rc2.xsd" node="/xs:schema">
160   - <jaxb:schemaBindings>
161   - <jaxb:package name="org.um.dsi.gavea.orcid.model.work" />
162   - </jaxb:schemaBindings>
163   - </jaxb:bindings>
164   -</jaxb:bindings>
165 0 \ No newline at end of file
src/test/java/org/um/dsi/gavea/orcid/client/test/OrcidTest.java
... ... @@ -49,10 +49,10 @@ public class OrcidTest {
49 49 @Test
50 50 public void testGetAuthorizeUri() {
51 51 try {
52   - System.out.println(orcidOAuthClient.getAuthorizeUriLogin(defaultScopes, null, null));
53   - System.out.println(orcidOAuthClient.getAuthorizeUriLogin(defaultScopes, null, "0000-0001-8317-2905"));
54   - System.out.println(orcidOAuthClient.getAuthorizeUriLogin(defaultScopes, null, "ajg@gavea.dsi.uminho.pt"));
55   - System.out.println(orcidOAuthClient.getAuthorizeUriRegistration(defaultScopes, null, "Gonçalves", "André"));
  52 + System.out.println(orcidOAuthClient.getAuthorizeUri(defaultScopes, null, null));
  53 + System.out.println(orcidOAuthClient.getAuthorizeUri(defaultScopes, null, "0000-0001-8317-2905"));
  54 + System.out.println(orcidOAuthClient.getAuthorizeUri(defaultScopes, null, "ajg@gavea.dsi.uminho.pt"));
  55 + System.out.println(orcidOAuthClient.getAuthorizeUri(defaultScopes, null, "Gonçalves", "André"));
56 56 } catch (Exception e) {
57 57 e.printStackTrace();
58 58 }
... ...