KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > deploy > shared > Archive


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.deployment.deploy.shared;
25
26 import java.util.Enumeration JavaDoc;
27 import java.io.InputStream JavaDoc;
28 import java.io.OutputStream JavaDoc;
29 import java.io.IOException JavaDoc;
30 import java.net.URI JavaDoc;
31 import java.util.jar.Manifest JavaDoc;
32
33
34 /**
35  * This interface is an abstraction for accessing a module archive.
36  *
37  * @author Jerome Dochez
38  */

39 public interface Archive {
40     
41     /**
42      * closes this archive and releases all resources
43      */

44     public void close() throws IOException JavaDoc;
45     
46     /**
47      * Returns an enumeration of the module file entries. All elements
48      * in the enumeration are of type String. Each String represents a
49      * file name relative to the root of the module.
50      *
51      * @return an enumeration of the archive file entries.
52      */

53     public Enumeration JavaDoc entries();
54
55     /**
56      * Returns an enumeration of the module file entries with the
57      * specified prefix. All elements in the enumeration are of
58      * type String. Each String represents a file name relative
59      * to the root of the module.
60      *
61      * @param prefix the prefix of entries to be included
62      * @return an enumeration of the archive file entries.
63      */

64     public Enumeration JavaDoc entries(String JavaDoc prefix);
65
66     /**
67      * Returns the InputStream for the given entry name
68      * The file name must be relative to the root of the module.
69      *
70      * @param name the file name relative to the root of the module.
71      *
72      * @return the InputStream for the given entry name or null if not found.
73      */

74     public InputStream JavaDoc getEntry(String JavaDoc name) throws IOException JavaDoc;
75     
76     /**
77      * Returns an instance of this archive abstraction for an embedded
78      * archive within this archive.
79      *
80      * @param name is the entry name relative to the root for the archive
81      *
82      * @return the Archive instance for this abstraction
83      */

84     public Archive getSubArchive(String JavaDoc name) throws IOException JavaDoc;
85     
86     /**
87      * Returns the manifest information for this archive
88      * @return the manifest info
89      */

90     public Manifest JavaDoc getManifest() throws IOException JavaDoc;
91     
92     /**
93      * (Optional)
94      * Returns the path for this archive. If the archive is implemented
95      * as a jar file for instance, it will return the full path to the
96      * jar file as jar url like
97      * jar://foo/bar/archive.jar
98      * <p>
99      * If the archive is implemented as a directory structure
100      * with each entry a separate file, it will return the root directory
101      * as a file url like
102      * file://foo/bar/archive
103      * <p>
104      * Some implementation of the archive which are not based on the file
105      * system will not be able to return a value.
106      *
107      * @return the url path for this archive.
108      */

109     public URI JavaDoc getURI();
110     
111     /**
112      * Returns the size of the archive.
113      * @return long indicating the size of the archive
114      */

115     public long getArchiveSize() throws NullPointerException JavaDoc, SecurityException JavaDoc;
116 }
117
Popular Tags