View Javadoc

1   /**
2    *
3    * Copyright 2003-2004 The Apache Software Foundation
4    *
5    *  Licensed under the Apache License, Version 2.0 (the "License");
6    *  you may not use this file except in compliance with the License.
7    *  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   *  Unless required by applicable law or agreed to in writing, software
12   *  distributed under the License is distributed on an "AS IS" BASIS,
13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   *  See the License for the specific language governing permissions and
15   *  limitations under the License.
16   */
17  package org.apache.geronimo.kernel.repository;
18  
19  import java.net.URI;
20  import java.io.File;
21  import java.io.IOException;
22  import java.io.InputStream;
23  
24  /**
25   * A repository that accepts new entries.
26   *
27   * @version $Rev: 396287 $ $Date: 2006-04-23 08:45:52 -0700 (Sun, 23 Apr 2006) $
28   */
29  public interface WriteableRepository extends Repository {
30      /**
31       * Copies a file from the server's filesystem into the repository.
32       * Obviously to use this remotely, you must have some other way
33       * to upload the file to the server's filesystem, even if the
34       * the server is just going to turn around and upload it to some
35       * other remote location.
36       *
37       * @param source       A file representing the data for the new repository
38       *                     entry
39       * @param destination  A fully-resolved artifact that tells the repository
40       *                     where it should save the data to
41       * @param monitor      Tracks the progress of the installation
42       */
43      public void copyToRepository(File source, Artifact destination, FileWriteMonitor monitor) throws IOException;
44  
45      /**
46       * Copies the contents of an arbitrary stream into the repository.
47       * Obviously to use this remotely, you must have some other way
48       * to upload the content to the server's JVM, even if the the server
49       * is just going to turn around and upload it to some other remote
50       * location.  The source will be closed when the write completes.
51       *
52       * @param source       A stream representing the data for the new
53       *                     repository entry
54       * @param destination  A fully-resolved artifact that tells the repository
55       *                     where it should save the data to
56       * @param monitor      Tracks the progress of the installation
57       */
58      public void copyToRepository(InputStream source, int size, Artifact destination, FileWriteMonitor monitor) throws IOException;
59  }