001 /**
002 * ===========================================================
003 * LibRepository : a free Java content repository access layer
004 * ===========================================================
005 *
006 * Project Info: http://jfreereport.pentaho.org/librepository/
007 *
008 * (C) Copyright 2006, by Pentaho Corporation and Contributors.
009 *
010 * This library is free software; you can redistribute it and/or modify it under the terms
011 * of the GNU Lesser General Public License as published by the Free Software Foundation;
012 * either version 2.1 of the License, or (at your option) any later version.
013 *
014 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
015 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016 * See the GNU Lesser General Public License for more details.
017 *
018 * You should have received a copy of the GNU Lesser General Public License along with this
019 * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
020 * Boston, MA 02111-1307, USA.
021 *
022 * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
023 * in the United States and other countries.]
024 *
025 * ------------
026 * StreamRepository.java
027 * ------------
028 * (C) Copyright 2006, by Pentaho Corporation.
029 */
030
031 package org.jfree.repository.stream;
032
033 import java.io.InputStream;
034 import java.io.OutputStream;
035
036 import org.jfree.repository.ContentLocation;
037 import org.jfree.repository.DefaultMimeRegistry;
038 import org.jfree.repository.MimeRegistry;
039 import org.jfree.repository.Repository;
040
041 /**
042 * A repository that feeds a single source.
043 *
044 * @author Thomas Morgner
045 */
046 public class StreamRepository implements Repository
047 {
048 private MimeRegistry mimeRegistry;
049 private WrappedOutputStream outputStream;
050 private WrappedInputStream inputStream;
051 private StreamContentLocation rootLocation;
052
053 public StreamRepository(final InputStream inputStream, final OutputStream outputStream)
054 {
055 this.inputStream = new WrappedInputStream(inputStream);
056 this.outputStream = new WrappedOutputStream(outputStream);
057 this.mimeRegistry = new DefaultMimeRegistry();
058
059 this.rootLocation = new StreamContentLocation(this);
060 }
061
062 public WrappedOutputStream getOutputStream()
063 {
064 return outputStream;
065 }
066
067 public WrappedInputStream getInputStream()
068 {
069 return inputStream;
070 }
071
072 public ContentLocation getRoot()
073 {
074 return rootLocation;
075 }
076
077 public MimeRegistry getMimeRegistry()
078 {
079 return mimeRegistry;
080 }
081 }