KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployapi > config > ConfigBeanArchive


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.deployapi.config;
25
26 import java.io.*;
27 import java.util.Enumeration JavaDoc;
28 import java.util.jar.Manifest JavaDoc;
29 import javax.enterprise.deploy.model.DeployableObject JavaDoc;
30
31 import com.sun.enterprise.deployment.deploy.shared.AbstractArchive;
32 import com.sun.enterprise.util.LocalStringManagerImpl;
33
34 /**
35  * This class act as an AbstractArchive implementation, delegating all possible
36  * APIs to the JSR88 DeployObject object.
37  *
38  * @author Jerome Dochez
39  */

40 public class ConfigBeanArchive extends AbstractArchive {
41     
42     private DeployableObject JavaDoc deployObject;
43     
44     private static LocalStringManagerImpl localStrings =
45       new LocalStringManagerImpl(ConfigBeanArchive.class);
46     
47     /** Creates a new instance of ConfigBeanArchive */
48     public ConfigBeanArchive(DeployableObject JavaDoc deployObject) {
49         this.deployObject = deployObject;
50     }
51     
52     /**
53      * @returns an @see java.io.OutputStream for a new entry in this
54      * current abstract archive.
55      * @param the entry name
56      */

57     public OutputStream addEntry(String JavaDoc name) throws IOException {
58         throw new IOException(localStrings.getLocalString(
59                     "enterprise.deployapi.config.configbeanarchive.notimplemented",
60                     "Operation not implemented"));
61     }
62     
63     /**
64      * close the abstract archive
65      */

66     public void close() throws IOException {
67         // nothing to do here
68
}
69     
70     /**
71      * close a previously returned @see java.io.OutputStream returned
72      * by an addEntry call
73      *
74      * @param the output stream to close
75      */

76     public void closeEntry(AbstractArchive os) throws IOException {
77         throw new IOException(localStrings.getLocalString(
78                     "enterprise.deployapi.config.configbeanarchive.notimplemented",
79                     "Operation not implemented"));
80         
81     }
82     
83     /**
84      * close a previously returned @see java.io.OutputStream returned
85      * by an addEntry call
86      * @param the output stream to close
87      */

88     public void closeEntry(OutputStream os) throws IOException {
89         throw new IOException(localStrings.getLocalString(
90                     "enterprise.deployapi.config.configbeanarchive.notimplemented",
91                     "Operation not implemented"));
92     }
93     
94     /**
95      * delete the archive
96      */

97     public boolean delete() {
98         return false;
99     }
100     
101     /**
102      * @return an @see java.util.Enumeration of entries in this abstract
103      * archive
104      */

105     public Enumeration JavaDoc entries() {
106         return deployObject.entries();
107     }
108     
109     /**
110      * @return an @see java.util.Enumeration of entries in this abstract
111      * archive, providing the list of embedded archive to not count their
112      * entries as part of this archive
113      */

114      public Enumeration JavaDoc entries(Enumeration JavaDoc embeddedArchives) {
115     // jar file are not recursive
116
return entries();
117      }
118     
119     /**
120      * @return true if this archive exists
121      */

122     public boolean exists() {
123         return false;
124     }
125     
126     /**
127      * @return the archive uri
128      */

129     public String JavaDoc getArchiveUri() {
130         return null;
131     }
132     
133     /**
134      * @return the archive size
135      */

136     public long getArchiveSize() throws NullPointerException JavaDoc, SecurityException JavaDoc {
137         return -1;
138     }
139
140     /**
141      * create or obtain an embedded archive within this abstraction.
142      *
143      * @param the name of the embedded archive.
144      */

145     public AbstractArchive getEmbeddedArchive(String JavaDoc name) throws IOException {
146         throw new IOException(localStrings.getLocalString(
147                     "enterprise.deployapi.config.configbeanarchive.notimplemented",
148                     "Operation not implemented"));
149         
150     }
151     
152     /**
153      * @return a @see java.io.InputStream for an existing entry in
154      * the current abstract archive
155      * @param the entry name
156      */

157     public InputStream getEntry(String JavaDoc name) throws IOException {
158         return deployObject.getEntry(name);
159     }
160     
161     /**
162      * @return the manifest information for this abstract archive
163      */

164     public Manifest JavaDoc getManifest() throws IOException {
165         return null;
166     }
167     
168     /**
169      * rename the archive
170      *
171      * @param name the archive name
172      */

173     public boolean renameTo(String JavaDoc name) {
174         return false;
175     }
176     
177     /** @return true if this archive abstraction supports overwriting of elements
178      *
179      */

180     public boolean supportsElementsOverwriting() {
181         return false;
182     }
183     
184     public void closeEntry() throws IOException {
185         throw new IOException(localStrings.getLocalString(
186                     "enterprise.deployapi.config.configbeanarchive.notimplemented",
187                     "Operation not implemented"));
188     }
189     
190     public java.net.URI JavaDoc getURI() {
191         return null;
192     }
193     
194     public OutputStream putNextEntry(String JavaDoc name) throws IOException {
195         throw new IOException(localStrings.getLocalString(
196                     "enterprise.deployapi.config.configbeanarchive.notimplemented",
197                     "Operation not implemented"));
198     }
199     
200 }
201
Popular Tags