001 //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/ogcwebservices/csw/discovery/SearchStatus.java $ 002 /*---------------------------------------------------------------------------- 003 This file is part of deegree, http://deegree.org/ 004 Copyright (C) 2001-2009 by: 005 Department of Geography, University of Bonn 006 and 007 lat/lon GmbH 008 009 This library is free software; you can redistribute it and/or modify it under 010 the terms of the GNU Lesser General Public License as published by the Free 011 Software Foundation; either version 2.1 of the License, or (at your option) 012 any later version. 013 This library is distributed in the hope that it will be useful, but WITHOUT 014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 015 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 016 details. 017 You should have received a copy of the GNU Lesser General Public License 018 along with this library; if not, write to the Free Software Foundation, Inc., 019 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 020 021 Contact information: 022 023 lat/lon GmbH 024 Aennchenstr. 19, 53177 Bonn 025 Germany 026 http://lat-lon.de/ 027 028 Department of Geography, University of Bonn 029 Prof. Dr. Klaus Greve 030 Postfach 1147, 53001 Bonn 031 Germany 032 http://www.geographie.uni-bonn.de/deegree/ 033 034 e-mail: info@deegree.org 035 ----------------------------------------------------------------------------*/ 036 package org.deegree.ogcwebservices.csw.discovery; 037 038 import java.util.Date; 039 040 import org.deegree.framework.util.TimeTools; 041 042 /** 043 * Class representation of a <csw:SearchStatus>-element. 044 * 045 * @author <a href="mailto:poth@lat-lon.de">Andreas Poth </a> 046 * @author <a href="mailto:tfr@users.sourceforge.net">Torsten Friebe </a> 047 * @author <a href="mailto:tfr@users.sourceforge.net">Markus Schneider </a> 048 * 049 * @author last edited by: $Author: mschneider $ 050 * 051 * @version 2.0, $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $ 052 */ 053 public class SearchStatus { 054 055 private static final String[] STATES = { "complete", "subset", "interim", "processing", "none" }; 056 057 private String status; 058 059 private Date timestamp; 060 061 /** 062 * 063 * 064 */ 065 private SearchStatus() { 066 this.timestamp = new Date( System.currentTimeMillis() ); 067 } 068 069 /** 070 * 071 * @param status 072 */ 073 SearchStatus( String status ) { 074 this(); 075 for ( int i = 0; i < STATES.length; i++ ) { 076 String aState = STATES[i]; 077 if ( aState.equalsIgnoreCase( status ) ) { 078 this.status = status; 079 } 080 } 081 } 082 083 /** 084 * 085 * @param status 086 * @param timestamp 087 */ 088 SearchStatus( String status, Date timestamp ) { 089 this( status ); 090 this.timestamp = timestamp; 091 } 092 093 /** 094 * Create a new instance from status-String and timestamp-String. 095 * 096 * TODO: parse timestampString 097 * 098 * @param status 099 * @param timestampString 100 */ 101 SearchStatus( String status, String timestampString ) { 102 this( status ); 103 this.timestamp = TimeTools.createCalendar( timestampString ).getTime(); 104 } 105 106 /** 107 * possible values are: 108 * <ul> 109 * <li>complete: The request was successfully completed and valid results are available or have 110 * been returned. 111 * <li>subset: The request was successfully completed and partial valid results are available 112 * or have been returned. In this case subsequest queries with new start positions may be used 113 * to see more results. 114 * <li>interim: The request was successfully completed and partial results are available or 115 * have been returned but the results may not be valid. For example, an intermediate server in a 116 * distributed search may have failed cause the partial, invalid result set to be generated. 117 * <li>processing: The request is still processing. When completed, the response will be sent 118 * to the specified response handler. 119 * <li>none: No records found. 120 * </ul> 121 * 122 * @return request processing status 123 */ 124 public String getStatus() { 125 return this.status; 126 } 127 128 /** 129 * @return datestamp of processing 130 */ 131 public Date getTimestamp() { 132 return this.timestamp; 133 } 134 135 }