Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 16209 invoked from network); 3 Dec 2005 00:02:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Dec 2005 00:02:07 -0000 Received: (qmail 19882 invoked by uid 500); 3 Dec 2005 00:01:34 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 19815 invoked by uid 500); 3 Dec 2005 00:01:33 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 19701 invoked by uid 99); 3 Dec 2005 00:01:33 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Dec 2005 16:01:33 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of davanum@gmail.com designates 66.249.82.202 as permitted sender) Received: from [66.249.82.202] (HELO xproxy.gmail.com) (66.249.82.202) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Dec 2005 12:57:07 -0800 Received: by xproxy.gmail.com with SMTP id t16so570127wxc for ; Fri, 02 Dec 2005 12:55:17 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Rw/LexyWrB+xaekrAAn2BaJxPK3dI/YdNT08QCzKNoJI7qP8n/LppX64RMyGqzE3RgCMcpCxclhgmJykLYI5r2S6yUhVIJzO7Y8SJXVYCuaYLx7sW9Fzd8PLebmu0JvU4JOBmSNy4ot9cddy3hKIHHBiW0XZg3jLDj1wbjF7j1Q= Received: by 10.11.98.49 with SMTP id v49mr76910cwb; Fri, 02 Dec 2005 12:55:16 -0800 (PST) Received: by 10.11.122.64 with HTTP; Fri, 2 Dec 2005 12:55:16 -0800 (PST) Message-ID: <19e0530f0512021255x69eb481cgfb6a105fd9a7c8b@mail.gmail.com> Date: Fri, 2 Dec 2005 15:55:16 -0500 From: Davanum Srinivas Reply-To: dims@apache.org To: axis-dev@ws.apache.org Subject: Re: [Axis2] Deployment packaging In-Reply-To: <200512021457.32122.aartigues@picturemarketing.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200512021457.32122.aartigues@picturemarketing.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Next time yes...this time. Already checked in :) thanks, dims On 12/2/05, Alex Artigues wrote: > [Sorry for repost, first time had attachment and we weren't sure if it go= t > through. We have included it inline here.] > > > A patch would be awesome!! we could possibly help with perf testing as > > well if we see the patch. > > And here it is! > > This patch does not include any attempts at optimization. It addresses t= he > following issues: > > 1) Resources cannot be loaded from jars inside of the service .aar > getResourceAsStream() has been overridden to allow this. > > 2) ZipInputStreams were left open by getBytes() if the target was not fou= nd. > An additional try/catch block has been added after the search loop to mak= e > sure this happens. > > 3) Minor change in findLibJars() to normalize the path for startsWith() a= nd > endsWith() checks. > > > What's missing from this patch is optimization code to address the extend= ed > loading times of the DeploymentClassLoader. We still don't know how to b= est > deal with this. > > We forgot to extend a big "Thank You" to everyone out there working on th= is > project in the last post. Thanks! > > --Alex & Ralf > aartigues@picturemarketing.com > rsantiago@picturemarketing.com > > Sidenote: Should we post this to JIRA also? > > > > Patch: > ################################################ > --- /home/alex/archive/axis2src/modules/core/src/org/apache/axis2/deploym= ent/DeploymentClassLoader.java > 2005-09-25 20:11:58.000000000 -0400 > +++ modules/core/src/org/apache/axis2/deployment/DeploymentClassLoader.ja= va > 2005-12-02 12:43:01.000000000 -0500 > @@ -18,6 +18,7 @@ > > import org.apache.axis2.i18n.Messages; > > +import java.io.ByteArrayInputStream; > import java.io.ByteArrayOutputStream; > import java.io.File; > import java.io.FileInputStream; > @@ -79,9 +80,10 @@ > * id the entry name start with /lib and end with .jar > * then those entry name will be added to the arraylist > */ > - if (entryName !=3D null && (entryName.startsWith("lib/")= || > - entryName.startsWith("Lib/")) && > - entryName.endsWith(".jar")) { > + if ( entryName !=3D null && > + entryName.toLowerCase().startsWith("lib/") && > + entryName.toLowerCase().endsWith(".jar") ) > + { > lib_jars_list.add(entryName); > } > } > @@ -183,6 +185,10 @@ > return raw; > } > } > + try { > + zin.close(); > + } catch (IOException ioe) {//already closed > + } > } catch (IOException e) { > throw e; > } > @@ -190,5 +196,57 @@ > } > throw new > ClassNotFoundException(Messages.getMessage(DeploymentErrorMsgs.CLASS_NOT_= FOUND, > filename)); > } > -} > - > + > + > + public InputStream getResourceAsStream(String name) > + { > + /* > + * This override locates resources similar to the way that getBy= tes() > locates classes. > + * We do not store the bytes from resources in memory, as > + * the size of resources is generally unpredictable > + */ > + if (name=3D=3Dnull) > + return null; > + > + InputStream is =3D super.getResourceAsStream(name); > + if (is =3D=3D null) > + { > + for (int i =3D 0; i < lib_jars_list.size(); i++) > + { > + String libjar_name =3D (String) lib_jars_list.get(i); > + try > + { > + InputStream in =3D super.getResourceAsStream(libjar_= name); > + ZipInputStream zin =3D new ZipInputStream(in); > + ZipEntry entry; > + String entryName =3D ""; > + while ((entry =3D zin.getNextEntry()) !=3D null) > + { > + entryName =3D entry.getName(); > + if (entryName !=3D null && entryName.equals(name= )) > + { > + byte data[] =3D new byte[2048]; > + ByteArrayOutputStream out =3D new > ByteArrayOutputStream(); > + int count; > + while ((count =3D zin.read(data, 0, 2048)) != =3D -1) > + { > + out.write(data, 0, count); > + } > + byte raw[] =3D out.toByteArray(); > + out.close(); > + zin.close(); > + return new ByteArrayInputStream(raw); > + } > + } > + try { > + zin.close(); > + } catch (IOException ioe) {//already closed > + } > + } catch (IOException e) { > + } > + } > + } > + > + return is; > + } > +} > \ No newline at end of file > > -- Davanum Srinivas : http://wso2.com/blogs/