001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/tags/2.1/src/org/deegree/portal/context/WMCMetadataSurrogate.java $
002 /*---------------- FILE HEADER ------------------------------------------
003
004 This file is part of deegree.
005 Copyright (C) 2001-2006 by:
006 Department of Geography, University of Bonn
007 http://www.giub.uni-bonn.de/deegree/
008 lat/lon GmbH
009 http://www.lat-lon.de
010
011 This library is free software; you can redistribute it and/or
012 modify it under the terms of the GNU Lesser General Public
013 License as published by the Free Software Foundation; either
014 version 2.1 of the License, or (at your option) any later version.
015
016 This library is distributed in the hope that it will be useful,
017 but WITHOUT ANY WARRANTY; without even the implied warranty of
018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019 Lesser General Public License for more details.
020
021 You should have received a copy of the GNU Lesser General Public
022 License along with this library; if not, write to the Free Software
023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024
025 Contact:
026
027 Andreas Poth
028 lat/lon GmbH
029 Aennchenstraße 19
030 53177 Bonn
031 Germany
032 E-Mail: poth@lat-lon.de
033
034 Prof. Dr. Klaus Greve
035 Department of Geography
036 University of Bonn
037 Meckenheimer Allee 166
038 53115 Bonn
039 Germany
040 E-Mail: greve@giub.uni-bonn.de
041
042 ---------------------------------------------------------------------------*/
043
044 package org.deegree.portal.context;
045
046 /**
047 * Helper class to collect metadata about a WMC. It substitutes some of the metadata available in a
048 * WMC and should be used for providing faster access to theses metadata.
049 *
050 * @author <a href="mailto:taddei@lat-lon.de">Ugo Taddei</a>
051 * @author last edited by: $Author: bezema $
052 *
053 * @version $Revision: 6259 $, $Date: 2007-03-20 10:15:15 +0100 (Di, 20 Mär 2007) $
054 */
055
056 public class WMCMetadataSurrogate {
057
058 private final String filename;
059
060 private final String author;
061
062 private final String title;
063
064 private final String description;
065
066 private final String[] keywords;
067
068 /**
069 * Creates a new <code>WMCMetadataSurrogate</code>.
070 *
071 * @param filename
072 * @param author
073 * @param title
074 * @param description
075 * @param keywords
076 */
077 public WMCMetadataSurrogate( String filename, String author, String title, String description,
078 String[] keywords ) {
079 this.filename = filename;
080 this.author = author;
081 this.title = title;
082 this.description = description;
083 this.keywords = keywords;
084 }
085
086 /**
087 * Creates a new <code>WMCMetadataSurrogate</code> using the filename and the
088 * <code>ViewContext</code> vc.
089 *
090 * @param filename
091 * @param vc
092 * the ViewContext used to initialize the title, the description and the keywords.
093 * Cannot be null.
094 * @return a new <code>WMCMetadataSurrogate</code>
095 */
096 public static final WMCMetadataSurrogate createFromWMC( String filename, ViewContext vc ) {
097 if ( vc == null ) {
098 throw new IllegalArgumentException( "ViewContext cannot be null." );
099 }
100
101 General g = vc.getGeneral();
102
103 return new WMCMetadataSurrogate( filename,
104 g.getContactInformation().getIndividualName()[0],
105 g.getTitle(), g.getAbstract(), g.getKeywords() );
106 }
107
108 /**
109 * @return description
110 */
111 public String getDescription() {
112 return description;
113 }
114
115 /**
116 * @return filename
117 */
118 public String getFilename() {
119 return filename;
120 }
121
122 /**
123 * @return keywords
124 */
125 public String[] getKeywords() {
126 return keywords;
127 }
128
129 /**
130 * @return title
131 */
132 public String getTitle() {
133 return title;
134 }
135
136 /**
137 * @return author
138 */
139 public String getAuthor() {
140 return author;
141 }
142
143 }
144
145 /***************************************************************************************************
146 * <code>
147 Changes to this class. What the people have been up to:
148
149 $Log$
150 Revision 1.2 2007/03/05 10:19:14 wanhoff
151 fixed Javadoc @return tags and footer
152
153 Revision 1.1 2007/02/02 09:53:46 poth
154 new function for iGeoPortal portlet edition added
155
156 Revision 1.1 2007/01/04 11:14:28 taddei
157 added this class to improve loading speed when creating list of shared contexts
158
159 </code>
160 **************************************************************************************************/