Project

General

Profile

1
/**
2
 Copyright 2006 OCLC, Online Computer Library Center
3
 Licensed under the Apache License, Version 2.0 (the "License");
4
 you may not use this file except in compliance with the License.
5
 You may obtain a copy of the License at
6

    
7
 http://www.apache.org/licenses/LICENSE-2.0
8

    
9
 Unless required by applicable law or agreed to in writing, software
10
 distributed under the License is distributed on an "AS IS" BASIS,
11
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
 See the License for the specific language governing permissions and
13
 limitations under the License.
14
 */
15

    
16
package edu.ucsb.nceas.metacat.oaipmh.harvester;
17

    
18
import java.io.IOException;
19
import javax.xml.parsers.ParserConfigurationException;
20
import javax.xml.transform.TransformerException;
21
import org.xml.sax.SAXException;
22

    
23

    
24
/**
25
 * This class represents an ListMetadataFormats response on either the server or
26
 * on the client
27
 * 
28
 * @author Jeffrey A. Young, OCLC Online Computer Library Center
29
 */
30
public class ListMetadataFormats extends HarvesterVerb {
31

    
32
  /**
33
   * Mock object constructor (for unit testing purposes)
34
   */
35
  public ListMetadataFormats() {
36
    super();
37
  }
38

    
39

    
40
  /**
41
   * Client-side ListMetadataFormats verb constructor
42
   * 
43
   * @param baseURL
44
   *          the baseURL of the server to be queried
45
   * @exception MalformedURLException
46
   *              the baseURL is bad
47
   * @exception SAXException
48
   *              the xml response is bad
49
   * @exception IOException
50
   *              an I/O error occurred
51
   */
52
  public ListMetadataFormats(String baseURL) throws IOException,
53
      ParserConfigurationException, SAXException, TransformerException {
54
    this(baseURL, null);
55
  }
56

    
57

    
58
  /**
59
   * Client-side ListMetadataFormats verb constructor (identifier version)
60
   * 
61
   * @param baseURL
62
   * @param identifier
63
   * @throws IOException
64
   * @throws ParserConfigurationException
65
   * @throws SAXException
66
   * @throws TransformerException
67
   */
68
  public ListMetadataFormats(String baseURL, String identifier)
69
      throws IOException, ParserConfigurationException, SAXException,
70
      TransformerException {
71
    super(getRequestURL(baseURL, identifier));
72
  }
73

    
74

    
75
  /**
76
   * Construct the query portion of the http request
77
   * 
78
   * @return a String containing the query portion of the http request
79
   */
80
  private static String getRequestURL(String baseURL, String identifier) {
81
    StringBuffer requestURL = new StringBuffer(baseURL);
82
    requestURL.append("?verb=ListMetadataFormats");
83
    if (identifier != null)
84
      requestURL.append("&identifier=").append(identifier);
85
    return requestURL.toString();
86
  }
87
}
(5-5/8)