se.kb.oai.pmh
Class QueryBuilder

java.lang.Object
  extended by se.kb.oai.pmh.QueryBuilder

public class QueryBuilder
extends Object

Helper class that builds the URL:s that corresponds to the different requests to the OAI-PMH server.

Author:
Oskar Grenholm, National Library of Sweden

Constructor Summary
QueryBuilder(String baseurl)
          Creates a QueryBuilder for a specific OAI-PMH server.
 
Method Summary
 String buildGetRecordQuery(String identifier, String metadataPrefix)
          Build the query for a GetRecord request.
 String buildIdentifyQuery()
          Build the query for a Identify request.
 String buildListIdentifiersQuery(ResumptionToken token)
          Build the query for an additional ListIdentifiers request with a ResumptionToken.
 String buildListIdentifiersQuery(String metadataPrefix, String from, String until, String set)
          Build the query for a ListIdentifiers request.
 String buildListMetadataFormatsQuery(String identifier)
          Build the query for a ListMetadtaFormats request.
 String buildListRecordsQuery(ResumptionToken token)
          Build the query for an additional ListRecords request with a ResumptionToken.
 String buildListRecordsQuery(String metadataPrefix, String from, String until, String set)
          Build the query for a ListRecords request.
 String buildListSetsQuery()
          Build the query for a ListSets request.
 String buildListSetsQuery(ResumptionToken token)
          Build the query for an additional ListSets request with a ResumptionToken.
 String getBaseUrl()
          Get the base URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryBuilder

public QueryBuilder(String baseurl)
Creates a QueryBuilder for a specific OAI-PMH server.

Parameters:
baseurl - the base URL to the OAI-PMH server
Method Detail

getBaseUrl

public String getBaseUrl()
Get the base URL.

Returns:
the base URL

buildGetRecordQuery

public String buildGetRecordQuery(String identifier,
                                  String metadataPrefix)
Build the query for a GetRecord request.

Parameters:
identifier - the identifier
metadataPrefix - the metadata prefix
Returns:
the full query URL as a String

buildIdentifyQuery

public String buildIdentifyQuery()
Build the query for a Identify request.

Returns:
the full query URL as a String

buildListIdentifiersQuery

public String buildListIdentifiersQuery(String metadataPrefix,
                                        String from,
                                        String until,
                                        String set)
Build the query for a ListIdentifiers request.

Parameters:
metadataPrefix - which metadata format
from - a start date, optional (may be null)
until - a stop date, optional (may be null)
set - a specific set, optional (may be null)
Returns:
the full query URL as a String

buildListIdentifiersQuery

public String buildListIdentifiersQuery(ResumptionToken token)
Build the query for an additional ListIdentifiers request with a ResumptionToken.

Parameters:
token - a resumption token returned from a previous request
Returns:
the full query URL as a String

buildListMetadataFormatsQuery

public String buildListMetadataFormatsQuery(String identifier)
Build the query for a ListMetadtaFormats request.

Parameters:
identifier - the id, optional (may be null)
Returns:
the full query URL as a String

buildListRecordsQuery

public String buildListRecordsQuery(String metadataPrefix,
                                    String from,
                                    String until,
                                    String set)
Build the query for a ListRecords request.

Parameters:
metadataPrefix - which metadata format
from - a start date, optional (may be null)
until - a stop date, optional (may be null)
set - a specific set, optional (may be null)
Returns:
the full query URL as a String

buildListRecordsQuery

public String buildListRecordsQuery(ResumptionToken token)
Build the query for an additional ListRecords request with a ResumptionToken.

Parameters:
token - a resumption token returned from a previous request
Returns:
the full query URL as a String

buildListSetsQuery

public String buildListSetsQuery()
Build the query for a ListSets request.

Returns:
the full query URL as a String

buildListSetsQuery

public String buildListSetsQuery(ResumptionToken token)
Build the query for an additional ListSets request with a ResumptionToken.

Parameters:
token - a resumption token returned from a previous request
Returns:
the full query URL as a String


Copyright © 2008. All Rights Reserved.