KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dspace > content > packager > PackageDisseminator


1 /*
2  * PackageDisseminator.java
3  *
4  * Version: $Revision: 1.1 $
5  *
6  * Date: $Date: 2006/03/17 00:04:38 $
7  *
8  * Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
9  * Institute of Technology. All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are
13  * met:
14  *
15  * - Redistributions of source code must retain the above copyright
16  * notice, this list of conditions and the following disclaimer.
17  *
18  * - Redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution.
21  *
22  * - Neither the name of the Hewlett-Packard Company nor the name of the
23  * Massachusetts Institute of Technology nor the names of their
24  * contributors may be used to endorse or promote products derived from
25  * this software without specific prior written permission.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
34  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
36  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
37  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
38  * DAMAGE.
39  */

40
41 package org.dspace.content.packager;
42
43 import java.io.IOException JavaDoc;
44 import java.io.OutputStream JavaDoc;
45 import java.sql.SQLException JavaDoc;
46
47 import org.dspace.authorize.AuthorizeException;
48 import org.dspace.content.DSpaceObject;
49 import org.dspace.content.crosswalk.CrosswalkException;
50 import org.dspace.core.Context;
51
52 /**
53  * Plugin Interface to produce Dissemination Information Package (DIP)
54  * of a DSpace object.
55  * <p>
56  * An implementation translates DSpace objects to some external
57  * "package" format. A package is a single data stream (or file)
58  * containing enough information to reconstruct the object. It can be
59  * anything from an archive like a Zip file with a manifest and metadata,
60  * to a simple manifest containing external references to the content,
61  * to a self-contained file such as a PDF.
62  * <p>
63  * A DIP implementation has two methods: <code>disseminate</code>
64  * to produce the package itself, and <code>getMIMEType</code> to
65  * identify its Internet format type (needed when transmitting the package
66  * over HTTP).
67  * <p>
68  * Both of these methods are given an attribute-values
69  * list of "parameters", which may modify their actions. Since the
70  * format output by <code>disseminate</code> may be affected by
71  * parameters, it is given to the <code>getMIMEType</code> method as well.
72  * The parameters list is a generalized mechanism to pass parameters
73  * from the package requestor to the packager, since different packagers will
74  * understand different sets of parameters.
75  *
76  * @author Larry Stone
77  * @version $Revision: 1.1 $
78  * @see PackageParameters
79  */

80 public interface PackageDisseminator
81 {
82     /**
83      * Export the object (Item, Collection, or Community) as a
84      * "package" on the indicated OutputStream. Package is any serialized
85      * representation of the item, at the discretion of the implementing
86      * class. It does not have to include content bitstreams.
87      * <br>
88      * Use the <code>params</code> parameter list to adjust the way the
89      * package is made, e.g. including a "<code>metadataOnly</code>"
90      * parameter might make the package a bare manifest in XML
91      * instead of a Zip file including manifest and contents.
92      * <br>
93      * Throws an exception of the chosen object is not acceptable or there is
94      * a failure creating the package.
95      *
96      * @param context DSpace context.
97      * @param object DSpace object (item, collection, etc)
98      * @param params Properties-style list of options specific to this packager
99      * @param out output stream on which to write package
100      * @throws PackageValidationException if package cannot be created or there is
101      * a fatal error in creating it.
102      */

103     void disseminate(Context context, DSpaceObject object,
104                      PackageParameters params, OutputStream JavaDoc out)
105         throws PackageException, CrosswalkException,
106                AuthorizeException, SQLException JavaDoc, IOException JavaDoc;
107
108     /**
109      * Identifies the MIME-type of this package, e.g. <code>"application/zip"</code>.
110      * Required when sending the package via HTTP, to
111      * provide the Content-Type header.
112      *
113      * @return the MIME type (content-type header) of the package to be returned
114      */

115     String JavaDoc getMIMEType(PackageParameters params);
116 }
117
Popular Tags