001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.geronimo.deployment.util; 018 019 import java.io.IOException; 020 import java.security.cert.Certificate; 021 import java.util.jar.Attributes; 022 import java.util.jar.JarEntry; 023 import java.util.jar.Manifest; 024 025 /** 026 * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $ 027 */ 028 public class NestedJarEntry extends JarEntry { 029 private final JarEntry baseEntry; 030 private final Manifest manifest; 031 032 public NestedJarEntry(String name, JarEntry baseEntry, Manifest manifest) { 033 super(name); 034 this.baseEntry = baseEntry; 035 this.manifest = manifest; 036 } 037 038 public JarEntry getBaseEntry() { 039 return baseEntry; 040 } 041 042 public Attributes getAttributes() throws IOException { 043 if (manifest == null) { 044 return null; 045 } 046 return manifest.getAttributes(getName()); 047 } 048 049 /** 050 * Always return null. This could be implementd by verifing the signatures 051 * in the manifest file against the actual file, but we don't need this for 052 * Geronimo. 053 * @return null 054 */ 055 public Certificate[] getCertificates() { 056 return null; 057 } 058 059 public long getTime() { 060 return baseEntry.getTime(); 061 } 062 063 public void setTime(long time) { 064 baseEntry.setTime(time); 065 } 066 067 public long getSize() { 068 return baseEntry.getSize(); 069 } 070 071 public void setSize(long size) { 072 baseEntry.setSize(size); 073 } 074 075 public long getCompressedSize() { 076 return baseEntry.getCompressedSize(); 077 } 078 079 public void setCompressedSize(long csize) { 080 baseEntry.setCompressedSize(csize); 081 } 082 083 public long getCrc() { 084 return baseEntry.getCrc(); 085 } 086 087 public void setCrc(long crc) { 088 baseEntry.setCrc(crc); 089 } 090 091 public int getMethod() { 092 return baseEntry.getMethod(); 093 } 094 095 public void setMethod(int method) { 096 baseEntry.setMethod(method); 097 } 098 099 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 }