001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2005-2006, GeoTools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016: package org.geotools.data.coverage.grid;
017:
018: import java.io.IOException;
019: import java.util.logging.Level;
020: import java.util.logging.Logger;
021:
022: import javax.imageio.stream.ImageOutputStream;
023:
024: import org.geotools.factory.Hints;
025: import org.geotools.util.logging.Logging;
026: import org.opengis.coverage.MetadataNameNotFoundException;
027: import org.opengis.coverage.grid.GridCoverageWriter;
028:
029: /**
030: * An {@link AbstractGridCoverageWriter} is the base class for all
031: * {@link GridCoverageWriter} implementations in GeoTools toolkit.
032: *
033: *
034: * <p>
035: * We expect it to become the place where to move functionalities common to all
036: * {@link GridCoverageWriter}.
037: *
038: * @author Simone Giannecchini
039: * @since 2.3.x
040: * @deprecated use {@link org.geotools.coverage.grid.io.AbstractGridCoverageWriter} instead.
041: */
042: public abstract class AbstractGridCoverageWriter implements
043: GridCoverageWriter {
044:
045: /** The {@link Logger} for this {@link AbstractGridCoverageWriter}. */
046: private final static Logger LOGGER = Logging
047: .getLogger("org.geotools.data.coverage.grid");
048:
049: /** the destination object where we will do the writing */
050: protected Object destination;
051:
052: /** Hints to be used for the writing process. */
053: protected Hints hints = new Hints(null);
054:
055: /** The destination {@link ImageOutputStream}. */
056: protected ImageOutputStream outStream = null;
057:
058: /**
059: * Default constructor for an {@link AbstractGridCoverageWriter}.
060: */
061:
062: public AbstractGridCoverageWriter() {
063:
064: }
065:
066: /**
067: * Releases resources held by this {@link AbstractGridCoverageWriter}.
068: */
069: public void dispose() {
070: if (outStream != null) {
071: try {
072: outStream.flush();
073: outStream.close();
074:
075: } catch (IOException e) {
076: if (LOGGER.isLoggable(Level.WARNING))
077: LOGGER.log(Level.WARNING, e.getLocalizedMessage(),
078: e);
079:
080: }
081: }
082:
083: }
084:
085: /**
086: * (non-Javadoc)
087: *
088: * @see org.opengis.coverage.grid.GridCoverageWriter#getDestination()
089: */
090: public final Object getDestination() {
091: return destination;
092: }
093:
094: /**
095: * Implementation of getMetadataNames. Currently unimplemented because it
096: * has not been specified where to retrieve the metadata
097: *
098: * @return null
099: *
100: * @see org.opengis.coverage.grid.GridCoverageWriter#getMetadataNames()
101: */
102: public String[] getMetadataNames() {
103: throw new UnsupportedOperationException("Unsupported method");
104: }
105:
106: /**
107: * @see org.opengis.coverage.grid.GridCoverageWriter#setCurrentSubname(java.lang.String)
108: */
109: public void setCurrentSubname(String name) throws IOException {
110: throw new UnsupportedOperationException("Unsupported method");
111: }
112:
113: /**
114: * @see org.opengis.coverage.grid.GridCoverageWriter#setMetadataValue(java.lang.String,
115: * java.lang.String)
116: */
117: public void setMetadataValue(String name, String value)
118: throws IOException, MetadataNameNotFoundException {
119: throw new UnsupportedOperationException("Unsupported method");
120: }
121:
122: }
|