001 //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/portal/context/WMCMetadataSurrogate.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 037 package org.deegree.portal.context; 038 039 /** 040 * Helper class to collect metadata about a WMC. It substitutes some of the metadata available in a 041 * WMC and should be used for providing faster access to theses metadata. 042 * 043 * @author <a href="mailto:taddei@lat-lon.de">Ugo Taddei</a> 044 * @author last edited by: $Author: mschneider $ 045 * 046 * @version $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $ 047 */ 048 049 public class WMCMetadataSurrogate { 050 051 private final String filename; 052 053 private final String author; 054 055 private final String title; 056 057 private final String description; 058 059 private final String[] keywords; 060 061 /** 062 * Creates a new <code>WMCMetadataSurrogate</code>. 063 * 064 * @param filename 065 * @param author 066 * @param title 067 * @param description 068 * @param keywords 069 */ 070 public WMCMetadataSurrogate( String filename, String author, String title, String description, String[] keywords ) { 071 this.filename = filename; 072 this.author = author; 073 this.title = title; 074 this.description = description; 075 this.keywords = keywords; 076 } 077 078 /** 079 * Creates a new <code>WMCMetadataSurrogate</code> using the filename and the 080 * <code>ViewContext</code> vc. 081 * 082 * @param filename 083 * @param vc 084 * the ViewContext used to initialize the title, the description and the keywords. 085 * Cannot be null. 086 * @return a new <code>WMCMetadataSurrogate</code> 087 */ 088 public static final WMCMetadataSurrogate createFromWMC( String filename, ViewContext vc ) { 089 if ( vc == null ) { 090 throw new IllegalArgumentException( "ViewContext cannot be null." ); 091 } 092 093 General g = vc.getGeneral(); 094 095 return new WMCMetadataSurrogate( filename, g.getContactInformation().getIndividualName()[0], g.getTitle(), 096 g.getAbstract(), g.getKeywords() ); 097 } 098 099 /** 100 * @return description 101 */ 102 public String getDescription() { 103 return description; 104 } 105 106 /** 107 * @return filename 108 */ 109 public String getFilename() { 110 return filename; 111 } 112 113 /** 114 * @return keywords 115 */ 116 public String[] getKeywords() { 117 return keywords; 118 } 119 120 /** 121 * @return title 122 */ 123 public String getTitle() { 124 return title; 125 } 126 127 /** 128 * @return author 129 */ 130 public String getAuthor() { 131 return author; 132 } 133 134 }