Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DARIAH-DE OAI-PMH Services
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DARIAH-DE
DARIAH-DE OAI-PMH Services
Commits
6cf7a5c8
Commit
6cf7a5c8
authored
8 years ago
by
mbrodhu
Browse files
Options
Downloads
Plain Diff
changes
parents
d2ca9566
aa437ff5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java
+212
-202
212 additions, 202 deletions
...re/src/main/java/info/textgrid/middleware/OAIPMHImpl.java
with
212 additions
and
202 deletions
oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java
+
212
−
202
View file @
6cf7a5c8
...
@@ -41,7 +41,8 @@ import org.apache.commons.logging.LogFactory;
...
@@ -41,7 +41,8 @@ import org.apache.commons.logging.LogFactory;
public
class
OAIPMHImpl
implements
OAIPMHProducer
{
public
class
OAIPMHImpl
implements
OAIPMHProducer
{
private
ErrorHandler
error
=
new
ErrorHandler
();
private
ErrorHandler
error
=
new
ErrorHandler
();
private
org
.
apache
.
commons
.
logging
.
Log
log
=
LogFactory
.
getLog
(
OAIPMHImpl
.
class
);
private
org
.
apache
.
commons
.
logging
.
Log
log
=
LogFactory
.
getLog
(
OAIPMHImpl
.
class
);
private
OAI_ESClient
oaiEsClient
;
private
OAI_ESClient
oaiEsClient
;
private
RepIdentification
rep
;
private
RepIdentification
rep
;
private
RecordListDeliverer
recordList
;
private
RecordListDeliverer
recordList
;
...
@@ -49,8 +50,8 @@ public class OAIPMHImpl implements OAIPMHProducer {
...
@@ -49,8 +50,8 @@ public class OAIPMHImpl implements OAIPMHProducer {
private
MetadataFormatListDeliverer
metadataFormatList
;
private
MetadataFormatListDeliverer
metadataFormatList
;
private
SetDeliverer
setList
;
private
SetDeliverer
setList
;
private
IdentifierListDeliverer
identifierList
;
private
IdentifierListDeliverer
identifierList
;
public
boolean
textgrid
;
public
boolean
textgrid
;
public
boolean
dariah
;
public
boolean
dariah
;
ListIdentifiersType
lit
=
new
ListIdentifiersType
();
ListIdentifiersType
lit
=
new
ListIdentifiersType
();
...
@@ -86,15 +87,11 @@ public class OAIPMHImpl implements OAIPMHProducer {
...
@@ -86,15 +87,11 @@ public class OAIPMHImpl implements OAIPMHProducer {
@QueryParam
(
"until"
)
@DefaultValue
(
""
)
String
until
,
@QueryParam
(
"until"
)
@DefaultValue
(
""
)
String
until
,
@QueryParam
(
"resumptionToken"
)
@DefaultValue
(
""
)
String
resumptionToken
)
{
@QueryParam
(
"resumptionToken"
)
@DefaultValue
(
""
)
String
resumptionToken
)
{
ObjectFactory
obf
=
new
ObjectFactory
();
ObjectFactory
obf
=
new
ObjectFactory
();
OAIPMHType
response
=
new
OAIPMHType
();
OAIPMHType
response
=
new
OAIPMHType
();
JAXBElement
<
OAIPMHType
>
oaipmhRoot
=
obf
.
createOAIPMH
(
response
);
JAXBElement
<
OAIPMHType
>
oaipmhRoot
=
obf
.
createOAIPMH
(
response
);
VerbType
verbParam
=
setVerb
(
verb
);
VerbType
verbParam
=
setVerb
(
verb
);
RequestType
request
=
new
RequestType
();
RequestType
request
=
new
RequestType
();
/*----Setting the responseDate of today-----*/
/*----Setting the responseDate of today-----*/
try
{
try
{
...
@@ -117,7 +114,8 @@ public class OAIPMHImpl implements OAIPMHProducer {
...
@@ -117,7 +114,8 @@ public class OAIPMHImpl implements OAIPMHProducer {
setMetadataPrefixRequestValue
(
metadataPrefix
,
request
);
setMetadataPrefixRequestValue
(
metadataPrefix
,
request
);
setResumptionTokenRequestValue
(
resumptionToken
,
request
);
setResumptionTokenRequestValue
(
resumptionToken
,
request
);
setSetRequestValue
(
set
,
request
);
setSetRequestValue
(
set
,
request
);
setVerbRequestValue
(
verb
,
verbParam
,
request
);
request
.
setVerb
(
verbParam
);
if
(
textgrid
==
true
)
{
if
(
textgrid
==
true
)
{
request
.
setValue
(
TGConstants
.
TG_REP_BASEURL
);
request
.
setValue
(
TGConstants
.
TG_REP_BASEURL
);
...
@@ -126,8 +124,6 @@ public class OAIPMHImpl implements OAIPMHProducer {
...
@@ -126,8 +124,6 @@ public class OAIPMHImpl implements OAIPMHProducer {
request
.
setValue
(
DARIAHConstants
.
DARIAH_REP_BASEURL
);
request
.
setValue
(
DARIAHConstants
.
DARIAH_REP_BASEURL
);
}
}
if
(
verbParam
!=
null
)
{
if
(
verbParam
!=
null
)
{
if
(
verbParam
.
value
().
equals
(
"Identify"
))
{
if
(
verbParam
.
value
().
equals
(
"Identify"
))
{
oaipmhRoot
=
identifyRequest
(
obf
,
response
,
request
);
oaipmhRoot
=
identifyRequest
(
obf
,
response
,
request
);
...
@@ -149,9 +145,8 @@ public class OAIPMHImpl implements OAIPMHProducer {
...
@@ -149,9 +145,8 @@ public class OAIPMHImpl implements OAIPMHProducer {
oaipmhRoot
=
listRecordsRequest
(
obf
,
response
,
request
);
oaipmhRoot
=
listRecordsRequest
(
obf
,
response
,
request
);
}
}
}
else
{
}
else
{
response
.
getError
().
add
(
error
.
setError
(
"VerbError"
));
response
.
getError
().
add
(
error
.
setError
(
"VerbError"
));
}
}
response
.
setRequest
(
request
);
response
.
setRequest
(
request
);
...
@@ -176,12 +171,17 @@ public class OAIPMHImpl implements OAIPMHProducer {
...
@@ -176,12 +171,17 @@ public class OAIPMHImpl implements OAIPMHProducer {
if
(
rep
.
requestChecker
(
request
))
{
if
(
rep
.
requestChecker
(
request
))
{
tgRepIdentificationRequest
.
setBaseURL
(
rep
.
getBaseUrl
());
tgRepIdentificationRequest
.
setBaseURL
(
rep
.
getBaseUrl
());
tgRepIdentificationRequest
.
setDeletedRecord
(
rep
.
getDeletedRecordStatus
());
tgRepIdentificationRequest
.
setDeletedRecord
(
rep
tgRepIdentificationRequest
.
setEarliestDatestamp
(
rep
.
getEarliestDatestamp
());
.
getDeletedRecordStatus
());
tgRepIdentificationRequest
.
setEarliestDatestamp
(
rep
.
getEarliestDatestamp
());
tgRepIdentificationRequest
.
setGranularity
(
rep
.
getGranularity
());
tgRepIdentificationRequest
.
setGranularity
(
rep
.
getGranularity
());
tgRepIdentificationRequest
.
setRepositoryName
(
rep
.
getRepositoryName
());
tgRepIdentificationRequest
.
setRepositoryName
(
rep
tgRepIdentificationRequest
.
setProtocolVersion
(
rep
.
getProtocolVersion
());
.
getRepositoryName
());
tgRepIdentificationRequest
.
getAdminEmail
().
add
(
rep
.
getAdminMaiAddresss
());
tgRepIdentificationRequest
.
setProtocolVersion
(
rep
.
getProtocolVersion
());
tgRepIdentificationRequest
.
getAdminEmail
().
add
(
rep
.
getAdminMaiAddresss
());
oai
.
setIdentify
(
tgRepIdentificationRequest
);
oai
.
setIdentify
(
tgRepIdentificationRequest
);
}
else
{
}
else
{
...
@@ -224,13 +224,16 @@ public class OAIPMHImpl implements OAIPMHProducer {
...
@@ -224,13 +224,16 @@ public class OAIPMHImpl implements OAIPMHProducer {
// TGConstants.TGFields);
// TGConstants.TGFields);
JAXBElement
<
OAIPMHType
>
oaipmhRoot
=
obf
.
createOAIPMH
(
oai
);
JAXBElement
<
OAIPMHType
>
oaipmhRoot
=
obf
.
createOAIPMH
(
oai
);
if
(
request
.
getMetadataPrefix
()
!=
null
&&
!
request
.
getMetadataPrefix
().
equals
(
"oai_dc"
))
{
if
(
request
.
getMetadataPrefix
()
!=
null
error
.
setError
(
TGConstants
.
OAI_METADATA_FORMAT_ERROR
).
setValue
(
&&
!
request
.
getMetadataPrefix
().
equals
(
"oai_dc"
))
{
error
.
setError
(
TGConstants
.
OAI_METADATA_FORMAT_ERROR
)
.
setValue
(
"The value of the metadataPrefix: "
"The value of the metadataPrefix: "
+
request
.
getMetadataPrefix
()
+
request
.
getMetadataPrefix
()
+
" is not supported by the item identified by the value of: "
+
" is not supported by the item identified by the value of: "
+
request
.
getIdentifier
());
+
request
.
getIdentifier
());
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_METADATA_FORMAT_ERROR
));
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_METADATA_FORMAT_ERROR
));
}
}
else
if
(
recDeliv
.
requestChecker
(
request
))
{
else
if
(
recDeliv
.
requestChecker
(
request
))
{
...
@@ -248,7 +251,8 @@ public class OAIPMHImpl implements OAIPMHProducer {
...
@@ -248,7 +251,8 @@ public class OAIPMHImpl implements OAIPMHProducer {
"The value of the identifier: "
"The value of the identifier: "
+
request
.
getIdentifier
()
+
request
.
getIdentifier
()
+
" is unknown or illegal in this repository"
);
+
" is unknown or illegal in this repository"
);
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_NO_RECORD_MATCH
));
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_NO_RECORD_MATCH
));
}
}
}
else
{
}
else
{
...
@@ -292,105 +296,117 @@ public class OAIPMHImpl implements OAIPMHProducer {
...
@@ -292,105 +296,117 @@ public class OAIPMHImpl implements OAIPMHProducer {
List
<
String
>
errorValues
=
new
ArrayList
<
String
>();
List
<
String
>
errorValues
=
new
ArrayList
<
String
>();
JAXBElement
<
OAIPMHType
>
oaipmhRoot
=
obf
.
createOAIPMH
(
oai
);
JAXBElement
<
OAIPMHType
>
oaipmhRoot
=
obf
.
createOAIPMH
(
oai
);
//if (identifierList.requestChecker(request)) {
// if (identifierList.requestChecker(request)) {
if
(
request
.
getResumptionToken
()
!=
null
&&
request
.
getMetadataPrefix
()
!=
null
){
errorValues
.
add
(
"MetadataPrefix"
);
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
).
setValue
(
"The request includes illegal arguments or missing requiered arguments:"
+
errorValues
);
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
));
}
else
if
(
request
.
getResumptionToken
()
!=
null
&&
request
.
getSet
()
!=
null
){
errorValues
.
add
(
"Set"
);
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
).
setValue
(
"The request includes illegal arguments or missing requiered arguments:"
+
errorValues
);
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
));
}
else
if
(
request
.
getResumptionToken
()
==
null
&&
request
.
getMetadataPrefix
()
==
null
){
errorValues
.
add
(
"MetadataPrefix"
);
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
).
setValue
(
"The request includes illegal arguments or missing requiered arguments:"
+
errorValues
);
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
));
}
else
if
(
request
.
getMetadataPrefix
()
!=
null
&&
!
request
.
getMetadataPrefix
().
equals
(
TGConstants
.
METADATA_DC_PREFIX
)){
error
.
setError
(
TGConstants
.
OAI_METADATA_FORMAT_ERROR
).
setValue
(
"The value of the metadataPrefix: "
+
request
.
getMetadataPrefix
()
+
" is not supported by the item identified by the value of: "
+
request
.
getIdentifier
());
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_METADATA_FORMAT_ERROR
));
}
else
{
System
.
out
.
println
(
"bla1000"
);
if
(
request
.
getResumptionToken
()
!=
null
&&
RecordListDeliverer
.
cursorCollector
.
containsKey
(
request
.
getResumptionToken
())){
error
.
setError
(
TGConstants
.
OAI_BAD_RESUMPTION_TOKEN
).
setValue
(
"The value of the resumptionToken argument is invalid or expired"
);
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_BAD_RESUMPTION_TOKEN
));
}
else
{
lit
=
identifierList
.
processIdentifierList
(
request
.
getFrom
(),
request
.
getUntil
(),
request
.
getSet
(),
request
.
getResumptionToken
());
if
(
lit
!=
null
)
{
System
.
out
.
println
(
"bla2000"
);
oai
.
setListIdentifiers
(
lit
);
}
else
{
error
.
setError
(
TGConstants
.
OAI_NO_RECORD_MATCH
).
setValue
(
"The combination of the values "
+
request
.
getFrom
()
+
" and "
+
request
.
getUntil
()
+
" results in an empty list"
);
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_NO_RECORD_MATCH
));
}
}
}
//}
/*if(request.getResumptionToken() != null && (request.getSet() != null || request.getMetadataPrefix() != null)){
error.setError(TGConstants.OAI_BAD_ARGUMENT).setValue(
"The request includes illegal arguments or missing requiered arguments:" + errorValues);
oai.getError().add(error.setError(TGConstants.OAI_BAD_ARGUMENT));
}
else {
if (request.getMetadataPrefix() != null && !request.getMetadataPrefix().equals(TGConstants.METADATA_DC_PREFIX )) {
try {
error.setError(TGConstants.OAI_METADATA_FORMAT_ERROR).setValue("The value of the metadataPrefix: "
+ request.getMetadataPrefix()
+ " is not supported by the item identified by the value of: "
+ request.getIdentifier());
oai.getError().add(error.setError(TGConstants.OAI_METADATA_FORMAT_ERROR));
} catch (Exception e) {
if
(
request
.
getResumptionToken
()
!=
null
// TODO Auto-generated catch block
&&
request
.
getMetadataPrefix
()
!=
null
)
{
log.debug(e);
errorValues
.
add
(
"MetadataPrefix"
);
}
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
).
setValue
(
"The request includes illegal arguments or missing requiered arguments:"
+
errorValues
);
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
));
}
else
if
(
request
.
getResumptionToken
()
!=
null
&&
request
.
getSet
()
!=
null
)
{
errorValues
.
add
(
"Set"
);
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
).
setValue
(
"The request includes illegal arguments or missing requiered arguments:"
+
errorValues
);
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
));
}
else
if
(
request
.
getResumptionToken
()
==
null
&&
request
.
getMetadataPrefix
()
==
null
)
{
errorValues
.
add
(
"MetadataPrefix"
);
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
).
setValue
(
"The request includes illegal arguments or missing requiered arguments:"
+
errorValues
);
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
));
}
else
if
(
request
.
getMetadataPrefix
()
!=
null
&&
!
request
.
getMetadataPrefix
().
equals
(
TGConstants
.
METADATA_DC_PREFIX
))
{
error
.
setError
(
TGConstants
.
OAI_METADATA_FORMAT_ERROR
)
.
setValue
(
"The value of the metadataPrefix: "
+
request
.
getMetadataPrefix
()
+
" is not supported by the item identified by the value of: "
+
request
.
getIdentifier
());
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_METADATA_FORMAT_ERROR
));
}
else
{
System
.
out
.
println
(
"bla1000"
);
if
(
request
.
getResumptionToken
()
!=
null
&&
RecordListDeliverer
.
cursorCollector
.
containsKey
(
request
.
getResumptionToken
()))
{
error
.
setError
(
TGConstants
.
OAI_BAD_RESUMPTION_TOKEN
)
.
setValue
(
"The value of the resumptionToken argument is invalid or expired"
);
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_BAD_RESUMPTION_TOKEN
));
}
else
{
}
else
{
try {
lit
=
identifierList
.
processIdentifierList
(
request
.
getFrom
(),
lit = identifierList.processIdentifierList(request.getFrom(), request.getUntil(), request.getSet(), request.getResumptionToken());
request
.
getUntil
(),
request
.
getSet
(),
if (lit != null) {
request
.
getResumptionToken
());
oai.setListIdentifiers(lit);
if
(
lit
!=
null
)
{
} else {
System
.
out
.
println
(
"bla2000"
);
error.setError(TGConstants.OAI_NO_RECORD_MATCH).setValue("The combination of the values "
oai
.
setListIdentifiers
(
lit
);
+ request.getFrom() + " and "
}
else
{
+ request.getUntil()
error
.
setError
(
TGConstants
.
OAI_NO_RECORD_MATCH
).
setValue
(
+ " results in an empty list");
"The combination of the values "
oai.getError().add(error.setError(TGConstants.OAI_NO_RECORD_MATCH));
+
request
.
getFrom
()
+
" and "
}
+
request
.
getUntil
()
+
" results in an empty list"
);
} catch (Exception e) {
oai
.
getError
().
add
(
// TODO Auto-generated catch block
error
.
setError
(
TGConstants
.
OAI_NO_RECORD_MATCH
));
log.debug(e);
}
}
}
}
}
}
} else {
if (request.getIdentifier() != null) {
errorValues.add("identifier");
}
if (request.getMetadataPrefix() == null) {
errorValues.add("metadataPrefix");
}
error.setError(TGConstants.OAI_BAD_ARGUMENT).setValue(
"The request includes illegal arguments "
+ "or missing requiered arguments: " + errorValues);
oai.getError().add(error.setError(TGConstants.OAI_BAD_ARGUMENT));
}*/
// }
/*
* if(request.getResumptionToken() != null && (request.getSet() != null
* || request.getMetadataPrefix() != null)){
* error.setError(TGConstants.OAI_BAD_ARGUMENT).setValue(
* "The request includes illegal arguments or missing requiered arguments:"
* + errorValues);
* oai.getError().add(error.setError(TGConstants.OAI_BAD_ARGUMENT)); }
* else {
*
*
* if (request.getMetadataPrefix() != null &&
* !request.getMetadataPrefix().equals(TGConstants.METADATA_DC_PREFIX ))
* { try {
* error.setError(TGConstants.OAI_METADATA_FORMAT_ERROR).setValue
* ("The value of the metadataPrefix: " + request.getMetadataPrefix() +
* " is not supported by the item identified by the value of: " +
* request.getIdentifier());
* oai.getError().add(error.setError(TGConstants
* .OAI_METADATA_FORMAT_ERROR));
*
* } catch (Exception e) { // TODO Auto-generated catch block
* log.debug(e); } } else { try { lit =
* identifierList.processIdentifierList(request.getFrom(),
* request.getUntil(), request.getSet(), request.getResumptionToken());
* if (lit != null) { oai.setListIdentifiers(lit); } else {
* error.setError(TGConstants.OAI_NO_RECORD_MATCH).setValue(
* "The combination of the values " + request.getFrom() + " and " +
* request.getUntil() + " results in an empty list");
* oai.getError().add(error.setError(TGConstants.OAI_NO_RECORD_MATCH));
* }
*
* } catch (Exception e) { // TODO Auto-generated catch block
* log.debug(e); } }
*
* }
*
* } else { if (request.getIdentifier() != null) {
* errorValues.add("identifier"); } if (request.getMetadataPrefix() ==
* null) { errorValues.add("metadataPrefix"); }
* error.setError(TGConstants.OAI_BAD_ARGUMENT).setValue(
* "The request includes illegal arguments " +
* "or missing requiered arguments: " + errorValues);
* oai.getError().add(error.setError(TGConstants.OAI_BAD_ARGUMENT));
*
* }
*/
return
oaipmhRoot
;
return
oaipmhRoot
;
}
}
...
@@ -444,7 +460,8 @@ public class OAIPMHImpl implements OAIPMHProducer {
...
@@ -444,7 +460,8 @@ public class OAIPMHImpl implements OAIPMHProducer {
"The value of the identifier: "
"The value of the identifier: "
+
request
.
getIdentifier
()
+
request
.
getIdentifier
()
+
" is unknown or illegal in this repository"
);
+
" is unknown or illegal in this repository"
);
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_NO_RECORD_MATCH
));
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_NO_RECORD_MATCH
));
}
}
}
else
{
}
else
{
if
(
request
.
getFrom
()
!=
null
)
{
if
(
request
.
getFrom
()
!=
null
)
{
...
@@ -475,83 +492,89 @@ public class OAIPMHImpl implements OAIPMHProducer {
...
@@ -475,83 +492,89 @@ public class OAIPMHImpl implements OAIPMHProducer {
public
JAXBElement
<
OAIPMHType
>
listRecordsRequest
(
ObjectFactory
obf
,
public
JAXBElement
<
OAIPMHType
>
listRecordsRequest
(
ObjectFactory
obf
,
OAIPMHType
oai
,
RequestType
request
)
{
OAIPMHType
oai
,
RequestType
request
)
{
//System.out.println("blablablabla");
//
System.out.println("blablablabla");
List
<
String
>
errorValues
=
new
ArrayList
<
String
>();
List
<
String
>
errorValues
=
new
ArrayList
<
String
>();
ListRecordsType
listRecords
=
new
ListRecordsType
();
ListRecordsType
listRecords
=
new
ListRecordsType
();
//RecordListDeliverer recordList = new RecordListDeliverer(oaiEsClient,// TGConstants.TGFields);
// RecordListDeliverer recordList = new
// RecordListDeliverer(oaiEsClient,// TGConstants.TGFields);
JAXBElement
<
OAIPMHType
>
oaipmhRoot
=
obf
.
createOAIPMH
(
oai
);
JAXBElement
<
OAIPMHType
>
oaipmhRoot
=
obf
.
createOAIPMH
(
oai
);
if
(
request
.
getResumptionToken
()
!=
null
&&
request
.
getMetadataPrefix
()
!=
null
){
if
(
request
.
getResumptionToken
()
!=
null
&&
request
.
getMetadataPrefix
()
!=
null
)
{
errorValues
.
add
(
"MetadataPrefix"
);
errorValues
.
add
(
"MetadataPrefix"
);
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
).
setValue
(
"The request includes illegal arguments or missing requiered arguments:"
+
errorValues
);
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
).
setValue
(
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
));
"The request includes illegal arguments or missing requiered arguments:"
}
else
if
(
request
.
getResumptionToken
()
!=
null
&&
request
.
getSet
()
!=
null
){
+
errorValues
);
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
));
}
else
if
(
request
.
getResumptionToken
()
!=
null
&&
request
.
getSet
()
!=
null
)
{
errorValues
.
add
(
"Set"
);
errorValues
.
add
(
"Set"
);
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
).
setValue
(
"The request includes illegal arguments or missing requiered arguments:"
+
errorValues
);
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
).
setValue
(
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
));
"The request includes illegal arguments or missing requiered arguments:"
}
+
errorValues
);
else
if
(
request
.
getResumptionToken
()
==
null
&&
request
.
getMetadataPrefix
()
==
null
){
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
));
}
else
if
(
request
.
getResumptionToken
()
==
null
&&
request
.
getMetadataPrefix
()
==
null
)
{
errorValues
.
add
(
"MetadataPrefix"
);
errorValues
.
add
(
"MetadataPrefix"
);
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
).
setValue
(
"The request includes illegal arguments or missing requiered arguments:"
+
errorValues
);
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
).
setValue
(
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
));
"The request includes illegal arguments or missing requiered arguments:"
}
else
if
(
request
.
getMetadataPrefix
()
!=
null
&&
!
request
.
getMetadataPrefix
().
equals
(
TGConstants
.
METADATA_DC_PREFIX
)){
+
errorValues
);
error
.
setError
(
TGConstants
.
OAI_METADATA_FORMAT_ERROR
).
setValue
(
"The value of the metadataPrefix: "
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_BAD_ARGUMENT
));
+
request
.
getMetadataPrefix
()
}
else
if
(
request
.
getMetadataPrefix
()
!=
null
+
" is not supported by the item identified by the value of: "
&&
!
request
.
getMetadataPrefix
().
equals
(
+
request
.
getIdentifier
());
TGConstants
.
METADATA_DC_PREFIX
))
{
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_METADATA_FORMAT_ERROR
));
error
.
setError
(
TGConstants
.
OAI_METADATA_FORMAT_ERROR
)
}
.
setValue
(
else
{
"The value of the metadataPrefix: "
listRecords
=
recordList
.
getRecords
(
request
.
getFrom
(),
request
.
getUntil
(),
request
.
getSet
(),
request
.
getResumptionToken
());
+
request
.
getMetadataPrefix
()
if
(
listRecords
!=
null
)
{
+
" is not supported by the item identified by the value of: "
+
request
.
getIdentifier
());
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_METADATA_FORMAT_ERROR
));
}
else
{
listRecords
=
recordList
.
getRecords
(
request
.
getFrom
(),
request
.
getUntil
(),
request
.
getSet
(),
request
.
getResumptionToken
());
if
(
listRecords
!=
null
)
{
oai
.
setListRecords
(
listRecords
);
oai
.
setListRecords
(
listRecords
);
}
else
{
}
else
{
error
.
setError
(
TGConstants
.
OAI_NO_RECORD_MATCH
).
setValue
(
"The combination of the values "
error
.
setError
(
TGConstants
.
OAI_NO_RECORD_MATCH
).
setValue
(
+
request
.
getFrom
()
+
" and "
"The combination of the values "
+
request
.
getFrom
()
+
request
.
getUntil
()
+
" and "
+
request
.
getUntil
()
+
" results in an empty list"
);
+
" results in an empty list"
);
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_NO_RECORD_MATCH
));
oai
.
getError
().
add
(
error
.
setError
(
TGConstants
.
OAI_NO_RECORD_MATCH
));
}
}
}
}
/*
/*if (recordList.requestChecker(request)) {
* if (recordList.requestChecker(request)) {
*
if (!request.getMetadataPrefix().equals(TGConstants.METADATA_DC_PREFIX)) {
* if
error.setError(TGConstants.OAI_METADATA_FORMAT_ERROR).setValue(
* (!request.getMetadataPrefix().equals(TGConstants.METADATA_DC_PREFIX))
"The value of the metadataPrefix: "
* { error.setError(TGConstants.OAI_METADATA_FORMAT_ERROR).setValue(
+ request.getMetadataPrefix()
* "The value of the metadataPrefix: " + request.getMetadataPrefix() +
+ " is not supported by the item identified by the value of: "
* " is not supported by the item identified by the value of: " +
+ request.getIdentifier());
* request.getIdentifier());
oai.getError().add(error.setError(TGConstants.OAI_METADATA_FORMAT_ERROR));
* oai.getError().add(error.setError(TGConstants
} else {
* .OAI_METADATA_FORMAT_ERROR)); } else {
//System.out.println("SET FROM REQUEST: " + request.getSet());
* //System.out.println("SET FROM REQUEST: " + request.getSet());
listRecords = recordList.getRecords(request.getFrom(), request.getUntil(), request.getSet(), request.getResumptionToken());
* listRecords = recordList.getRecords(request.getFrom(),
if (recordList.isFoundItems()) {
* request.getUntil(), request.getSet(), request.getResumptionToken());
// if(listRecords!=null){
* if (recordList.isFoundItems()) { // if(listRecords!=null){
oai.setListRecords(listRecords);
* oai.setListRecords(listRecords); } else {
} else {
* error.setError(TGConstants.OAI_NO_RECORD_MATCH).setValue(
error.setError(TGConstants.OAI_NO_RECORD_MATCH).setValue(
* "The combination of the values " + request.getFrom() + " and " +
"The combination of the values "
* request.getUntil() + " results in an empty list");
+ request.getFrom() + " and "
* oai.getError().add(error.setError(TGConstants.OAI_NO_RECORD_MATCH));
+ request.getUntil()
* } } } else { if (request.getIdentifier() != null) {
+ " results in an empty list");
* errorValues.add("identifier"); } if (request.getMetadataPrefix() ==
oai.getError().add(error.setError(TGConstants.OAI_NO_RECORD_MATCH));
* null) { errorValues.add("metadataPrefix"); }
}
* error.setError(TGConstants.OAI_BAD_ARGUMENT).setValue(
}
* "The request includes illegal " +
} else {
* "arguments or is missing required arguments: " + errorValues);
if (request.getIdentifier() != null) {
* oai.getError().add(error.setError(TGConstants.OAI_BAD_ARGUMENT)); }
errorValues.add("identifier");
*/
}
if (request.getMetadataPrefix() == null) {
errorValues.add("metadataPrefix");
}
error.setError(TGConstants.OAI_BAD_ARGUMENT).setValue(
"The request includes illegal "
+ "arguments or is missing required arguments: "
+ errorValues);
oai.getError().add(error.setError(TGConstants.OAI_BAD_ARGUMENT));
}*/
return
oaipmhRoot
;
return
oaipmhRoot
;
}
}
...
@@ -567,9 +590,12 @@ public class OAIPMHImpl implements OAIPMHProducer {
...
@@ -567,9 +590,12 @@ public class OAIPMHImpl implements OAIPMHProducer {
public
VerbType
setVerb
(
String
verb
)
{
public
VerbType
setVerb
(
String
verb
)
{
VerbType
verbParam
=
null
;
VerbType
verbParam
=
null
;
if
(
verb
==
null
||
verb
.
equals
(
"Identify"
))
{
if
(
verb
==
null
)
{
verb
=
"Identify"
;
}
if
(
verb
!=
null
&&
verb
.
equals
(
"Identify"
))
{
verbParam
=
VerbType
.
IDENTIFY
;
verbParam
=
VerbType
.
IDENTIFY
;
return
verbParam
;
}
else
if
(
verb
!=
null
&&
verb
.
equals
(
"ListMetadataFormats"
))
{
}
else
if
(
verb
!=
null
&&
verb
.
equals
(
"ListMetadataFormats"
))
{
verbParam
=
VerbType
.
LIST_METADATA_FORMATS
;
verbParam
=
VerbType
.
LIST_METADATA_FORMATS
;
}
else
if
(
verb
!=
null
&&
verb
.
equals
(
"ListSets"
))
{
}
else
if
(
verb
!=
null
&&
verb
.
equals
(
"ListSets"
))
{
...
@@ -671,22 +697,6 @@ public class OAIPMHImpl implements OAIPMHProducer {
...
@@ -671,22 +697,6 @@ public class OAIPMHImpl implements OAIPMHProducer {
}
}
}
}
/**
* Setting the from value for the request
*
* @param verb
* : String value from REST request
* @param verbParam
* : OAIPMH verb type
*/
public
void
setVerbRequestValue
(
String
verb
,
VerbType
verbParam
,
RequestType
request
)
{
if
(!
verb
.
isEmpty
())
{
request
.
setVerb
(
verbParam
);
}
}
public
RequestType
setRequestType
(
String
verb
)
{
public
RequestType
setRequestType
(
String
verb
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment