View Javadoc

1   /**
2    *
3    * Copyright 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.deployment.util;
18  
19  import java.io.IOException;
20  import java.security.cert.Certificate;
21  import java.util.jar.Attributes;
22  import java.util.jar.JarEntry;
23  import java.util.jar.Manifest;
24  
25  /**
26   * @version $Rev: 355877 $ $Date: 2005-12-10 18:48:27 -0800 (Sat, 10 Dec 2005) $
27   */
28  public class NestedJarEntry extends JarEntry {
29      private final JarEntry baseEntry;
30      private final Manifest manifest;
31  
32      public NestedJarEntry(String name, JarEntry baseEntry, Manifest manifest) {
33          super(name);
34          this.baseEntry = baseEntry;
35          this.manifest = manifest;
36      }
37  
38      public JarEntry getBaseEntry() {
39          return baseEntry;
40      }
41  
42      public Attributes getAttributes() throws IOException {
43          if (manifest == null) {
44              return null;
45          }
46          return manifest.getAttributes(getName());
47      }
48  
49      /**
50       * Always return null.  This could be implementd by verifing the signatures
51       * in the manifest file against the actual file, but we don't need this for
52       * Geronimo.
53       * @return null
54       */
55      public Certificate[] getCertificates() {
56          return null;
57      }
58  
59      public long getTime() {
60          return baseEntry.getTime();
61      }
62  
63      public void setTime(long time) {
64          baseEntry.setTime(time);
65      }
66  
67      public long getSize() {
68          return baseEntry.getSize();
69      }
70  
71      public void setSize(long size) {
72          baseEntry.setSize(size);
73      }
74  
75      public long getCompressedSize() {
76          return baseEntry.getCompressedSize();
77      }
78  
79      public void setCompressedSize(long csize) {
80          baseEntry.setCompressedSize(csize);
81      }
82  
83      public long getCrc() {
84          return baseEntry.getCrc();
85      }
86  
87      public void setCrc(long crc) {
88          baseEntry.setCrc(crc);
89      }
90  
91      public int getMethod() {
92          return baseEntry.getMethod();
93      }
94  
95      public void setMethod(int method) {
96          baseEntry.setMethod(method);
97      }
98  
99      public byte[] getExtra() {
100         return baseEntry.getExtra();
101     }
102 
103     public void setExtra(byte[] extra) {
104         baseEntry.setExtra(extra);
105     }
106 
107     public String getComment() {
108         return baseEntry.getComment();
109     }
110 
111     public void setComment(String comment) {
112         baseEntry.setComment(comment);
113     }
114 
115     public boolean isDirectory() {
116         return baseEntry.isDirectory();
117     }
118 
119     public String toString() {
120         return baseEntry.toString();
121     }
122 
123     public int hashCode() {
124         return baseEntry.hashCode();
125     }
126 
127     public Object clone() {
128         return new NestedJarEntry(getName(), baseEntry, manifest);
129     }
130 }