001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.geronimo.kernel.repository;
018
019 import java.io.File;
020 import java.io.IOException;
021 import java.io.InputStream;
022
023 /**
024 * A repository that accepts new entries.
025 *
026 * @version $Rev: 476457 $ $Date: 2006-11-18 01:49:20 -0500 (Sat, 18 Nov 2006) $
027 */
028 public interface WriteableRepository extends Repository {
029 /**
030 * Copies a file from the server's filesystem into the repository.
031 * Obviously to use this remotely, you must have some other way
032 * to upload the file to the server's filesystem, even if the
033 * the server is just going to turn around and upload it to some
034 * other remote location.
035 *
036 * @param source A file representing the data for the new repository
037 * entry
038 * @param destination A fully-resolved artifact that tells the repository
039 * where it should save the data to
040 * @param monitor Tracks the progress of the installation
041 */
042 public void copyToRepository(File source, Artifact destination, FileWriteMonitor monitor) throws IOException;
043
044 /**
045 * Copies the contents of an arbitrary stream into the repository.
046 * Obviously to use this remotely, you must have some other way
047 * to upload the content to the server's JVM, even if the the server
048 * is just going to turn around and upload it to some other remote
049 * location. The source will be closed when the write completes.
050 *
051 * @param source A stream representing the data for the new
052 * repository entry
053 * @param destination A fully-resolved artifact that tells the repository
054 * where it should save the data to
055 * @param monitor Tracks the progress of the installation
056 */
057 public void copyToRepository(InputStream source, int size, Artifact destination, FileWriteMonitor monitor) throws IOException;
058 }