01: /*
02: * (C) Copyright Simulacra Media Ltd, 2004. All rights reserved.
03: *
04: * The program is provided "AS IS" without any warranty express or
05: * implied, including the warranty of non-infringement and the implied
06: * warranties of merchantibility and fitness for a particular purpose.
07: * Simulacra Media Ltd will not be liable for any damages suffered by you as a result
08: * of using the Program. In no event will Simulacra Media Ltd be liable for any
09: * special, indirect or consequential damages or lost profits even if
10: * Simulacra Media Ltd has been advised of the possibility of their occurrence.
11: * Simulacra Media Ltd will not be liable for any third party claims against you.
12: *
13: */
14:
15: package com.ibm.webdav;
16:
17: import java.util.logging.*;
18:
19: import org.w3c.dom.Element;
20:
21: import com.ibm.webdav.basicsearch.BasicSearchRequest;
22:
23: /**
24: * @author Michael Bell
25: * @version 1.0
26: */
27: public class SearchRequestFactory {
28:
29: /**
30: * Logger for this class
31: */
32: private static final Logger m_logger = Logger
33: .getLogger(SearchRequestFactory.class.getName());
34:
35: public SearchRequestFactory() {
36: }
37:
38: public static SearchRequest getSearchRequest(Element xmlElement)
39: throws WebDAVException {
40: SearchRequest request = null;
41:
42: try {
43: if (xmlElement.getNamespaceURI().equals("DAV:")
44: && xmlElement.getLocalName().equals(
45: BasicSearchRequest.TAG_BASICSEARCH)) {
46: request = new BasicSearchRequest();
47:
48: request.instantiateFromXML(xmlElement);
49: }
50: } catch (WebDAVException e) {
51: throw e;
52: } catch (Exception e) {
53: m_logger.log(Level.WARNING, e.getLocalizedMessage(), e);
54: throw new WebDAVException(
55: WebDAVStatus.SC_INTERNAL_SERVER_ERROR, e
56: .getMessage());
57: }
58:
59: return request;
60: }
61: }
|