001 /*---------------------------------------------------------------------------- 002 This file is part of deegree, http://deegree.org/ 003 Copyright (C) 2001-2009 by: 004 Department of Geography, University of Bonn 005 and 006 lat/lon GmbH 007 008 This library is free software; you can redistribute it and/or modify it under 009 the terms of the GNU Lesser General Public License as published by the Free 010 Software Foundation; either version 2.1 of the License, or (at your option) 011 any later version. 012 This library is distributed in the hope that it will be useful, but WITHOUT 013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 014 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 015 details. 016 You should have received a copy of the GNU Lesser General Public License 017 along with this library; if not, write to the Free Software Foundation, Inc., 018 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 019 020 Contact information: 021 022 lat/lon GmbH 023 Aennchenstr. 19, 53177 Bonn 024 Germany 025 http://lat-lon.de/ 026 027 Department of Geography, University of Bonn 028 Prof. Dr. Klaus Greve 029 Postfach 1147, 53001 Bonn 030 Germany 031 http://www.geographie.uni-bonn.de/deegree/ 032 033 e-mail: info@deegree.org 034 ----------------------------------------------------------------------------*/ 035 036 package org.deegree.ogcwebservices.wcts.configuration; 037 038 import java.util.Timer; 039 import java.util.TimerTask; 040 041 import org.deegree.framework.log.ILogger; 042 import org.deegree.framework.log.LoggerFactory; 043 import org.deegree.ogcwebservices.wcts.capabilities.Content; 044 import org.deegree.ogcwebservices.wcts.capabilities.WCTSCapabilities; 045 import org.deegree.owscommon_1_1_0.OperationsMetadata; 046 import org.deegree.owscommon_1_1_0.ServiceIdentification; 047 import org.deegree.owscommon_1_1_0.ServiceProvider; 048 049 /** 050 * <code>WCTSConfiguration</code> holds some configuration options as well as a timer to rebuild the contents of the 051 * capabilities. 052 * 053 * @author <a href="mailto:bezema@lat-lon.de">Rutger Bezema</a> 054 * 055 * @author last edited by: $Author:$ 056 * 057 * @version $Revision:$, $Date:$ 058 * 059 */ 060 public class WCTSConfiguration extends WCTSCapabilities { 061 062 final static ILogger LOG = LoggerFactory.getLogger( WCTSConfiguration.class ); 063 064 /** 065 * 066 */ 067 private static final long serialVersionUID = 3906808063695620386L; 068 069 private final WCTSDeegreeParams deegreeParams; 070 071 /** 072 * @param version 073 * @param updateSequence 074 * @param serviceIdentification 075 * @param serviceProvider 076 * @param operationsMetadata 077 * @param contents 078 * @param deegreeParams 079 * which will hold this service specific parameters. 080 */ 081 public WCTSConfiguration( String version, String updateSequence, ServiceIdentification serviceIdentification, 082 ServiceProvider serviceProvider, OperationsMetadata operationsMetadata, Content contents, 083 final WCTSDeegreeParams deegreeParams ) { 084 super( version, updateSequence, serviceIdentification, serviceProvider, operationsMetadata, contents ); 085 this.deegreeParams = deegreeParams; 086 } 087 088 /** 089 * @param capabilities 090 * @param deegreeParams 091 */ 092 public WCTSConfiguration( WCTSCapabilities capabilities, final WCTSDeegreeParams deegreeParams ) { 093 super( capabilities ); 094 this.deegreeParams = deegreeParams; 095 if ( deegreeParams.getUpdateSequence() > -1 ) { 096 // set to one minute if smaller 097 Timer t = new Timer(); 098 t.scheduleAtFixedRate( new TimerTask() { 099 100 @Override 101 public void run() { 102 LOG.logInfo( "Refreshing contents from cache (as set in the wcts updateSequence configuration document)." ); 103 Content c = getContents(); 104 c.updateFromProvider( deegreeParams.getConfiguredCRSProvider() ); 105 } 106 }, 0, deegreeParams.getUpdateSequence() ); 107 } 108 109 } 110 111 /** 112 * @return the deegreeParams. 113 */ 114 public final WCTSDeegreeParams getDeegreeParams() { 115 return deegreeParams; 116 } 117 118 }