Return-Path: Delivered-To: apmail-archiva-dev-archive@www.apache.org Received: (qmail 95267 invoked from network); 24 Mar 2009 00:53:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Mar 2009 00:53:19 -0000 Received: (qmail 73638 invoked by uid 500); 24 Mar 2009 00:53:19 -0000 Delivered-To: apmail-archiva-dev-archive@archiva.apache.org Received: (qmail 73589 invoked by uid 500); 24 Mar 2009 00:53:19 -0000 Mailing-List: contact dev-help@archiva.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@archiva.apache.org Delivered-To: mailing list dev@archiva.apache.org Received: (qmail 73579 invoked by uid 99); 24 Mar 2009 00:53:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Mar 2009 00:53:19 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [194.36.240.4] (HELO extmx02.mail.eu.nomura.com) (194.36.240.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Mar 2009 00:53:09 +0000 Received: from mailrouter2.uk.nomura.com (mailrouter2.mail.eu.nomura.com [147.201.184.83]) by extmx02.mail.eu.nomura.com (8.13.8/8.13.8) with ESMTP id n2O0qlKr009232 for ; Tue, 24 Mar 2009 00:52:47 GMT Received: from lonex3005.EUROPE.NOM (viphost4 [147.201.64.204]) by mailrouter2.uk.nomura.com (8.13.6/8.12.10) with ESMTP id n2O0qlcA001671 for ; Tue, 24 Mar 2009 00:52:47 GMT Received: from LONEV3102.EUROPE.NOM ([147.201.211.14]) by lonex3005.EUROPE.NOM with Microsoft SMTPSVC(6.0.3790.1830); Tue, 24 Mar 2009 00:52:47 +0000 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: RE: archiva source code Date: Tue, 24 Mar 2009 00:52:46 -0000 Message-ID: <34E8025924BF7D44A7DE4654C76EA21702856F45@LONEV3102.EUROPE.NOM> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: archiva source code Thread-Index: AcmsE32mVCaaQMQ5TsCUGKG3RbcUCgABqF3g References: <34E8025924BF7D44A7DE4654C76EA21702856F1B@LONEV3102.EUROPE.NOM> <9D01E300-C6B3-401C-BDEF-699BB4CB2D7A@apache.org> <34E8025924BF7D44A7DE4654C76EA21702856F1F@LONEV3102.EUROPE.NOM> <1C3D3F01-19CD-4E0D-87BC-43F3C9CC4851@apache.org> <34E8025924BF7D44A7DE4654C76EA21702856F43@LONEV3102.EUROPE.NOM> <34E8025924BF7D44A7DE4654C76EA21702856F44@LONEV3102.EUROPE.NOM> From: To: X-OriginalArrivalTime: 24 Mar 2009 00:52:47.0215 (UTC) FILETIME=[D95567F0:01C9AC1A] X-ngb-disclaimer: Tue Mar 24 00:52:47 GMT 2009 Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org Ok, I didn't notice that there was already an exists=3DlocalFile.exists().....so there was no need to create a new file object. The code below looks like something that I can expand on. One more question, What exactly do you mean by a configuration check? Cheers again -----Original Message----- From: Brett Porter [mailto:brett@apache.org]=20 Sent: 23 March 2009 23:59 To: dev@archiva.apache.org Subject: Re: archiva source code I don't see anything here that attempts to block, and not sure why you=20= =20 are creating a new file object. I was thinking of something along the lines of: if ( isCollection() && inputContext.hasStream() ) // New File { if ( exists ) { throw new DavException( HttpServletResponse.SC_FORBIDDEN, "You=20=20 can't overwrite resources already in the repository" ); } ... With a more descriptive error message and a configuration check. Cheers, Brett On 24/03/2009, at 10:39 AM, wrote: > Here is a simple modification I have made to block duplicate > deployments. Any idea what I could be missing because it is not=20=20 > working > properly. This is in the addMember method. > > > if ( isCollection() && inputContext.hasStream() ) // New File > {=09 > File file =3D null; > FileOutputStream stream =3D > null; > try > {=09 > file =3D new > File(localFile.toString()); > if (!file.exists()){ > System.out.println(" > does not EXIST..." +localFile.toString()); >=20=09=09=09=09=20=20=20=20=20=20=20=20=20=20=20=20=09 > stream =3D new > FileOutputStream( localFile ); > IOUtils.copy( > inputContext.getInputStream(), stream ); //takes in one file & then > sends it. send another one after this=09=09=09 > } >=20=09=09=09=09=20=20=20=20=20=20=20=20=20=20=20=20=09 > } > // catch ( IOException e ) > catch ( Exception e ) > { > throw new DavException( > HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e ); > } > > > > -----Original Message----- > From: Brett Porter [mailto:brett@apache.org] > Sent: 23 March 2009 23:34 > To: dev@archiva.apache.org > Subject: Re: archiva source code > > Not quite sure what you are referring to... addMember takes an > inputContext with a stream - the servlet container and jackrabbit > handle taking this directly from the client and passing in a stream > that is written to the localFile. > > What you want to do is, based on the value of exists and the new > configuration option, fail. > > Cheers, > Brett > > On 24/03/2009, at 10:29 AM, wrote: > >> Hi again, >> I have just started having a go at fixing the issue below. Before >> archiva starts copying artifacts to the version directory, 1.e., 4.1, >> 9.0, 1.2.3 and so on...., it creates it somewhere first. Does anyone >> have an idea where? I have commented out the 'addMember' method in >> the >> 'ArchivaDavResource' class and this confirms that the version >> directory >> is not created there. Does anyone know where it is created? If I can >> find the answer to this, then the rest should be trivial. >> Thanks. >> >> -----Original Message----- >> From: Brett Porter [mailto:brett@porterclan.net] On Behalf Of Brett >> Porter >> Sent: 17 March 2009 10:07 >> To: dev@archiva.apache.org >> Subject: Re: archiva source code >> >> >> On 17/03/2009, at 8:57 PM, >> >> wrote: >> >>> The problem is that Archiva accepts deployments of artifacts that >>> already exist in the repository. I have already modified the code in >>> the >>> UploadAction class to block off any duplicates via the upload >>> section on >>> the Archiva UI and now I am trying to do the same for Webdav. I am >>> open >>> for suggestions if anyone has some, because it seems like doing the >>> same >>> for deployments via Webdav is going to be a tough hack. >> >> ArchivaDavResource has an addMember resource that takes care of this, >> so you can make the modification there. >> >> If you are able to also add some configuration on the managed >> repository as to whether it should allow this or not, this would be a >> great change to contribute back. Will you be able to submit a patch >> for your changes? >> >> Cheers, >> Brett >> >> -- >> Brett Porter >> brett@apache.org >> http://blogs.exist.com/bporter/ >> >> >> >> >> This e-mail (including any attachments) is confidential, may contain >> proprietary or privileged information and is intended for the named >> recipient(s) only. Unintended recipients are prohibited from taking >> action >> on the basis of information in this e-mail and must delete all=20=20 >> copies. >> Nomura will not accept responsibility or liability for the accuracy=20= =20 >> or >> completeness of, or the presence of any virus or disabling code in, >> this >> e-mail. If verification is sought please request a hard copy. Any >> reference >> to the terms of executed transactions should be treated as >> preliminary only >> and subject to formal written confirmation by Nomura. Nomura >> reserves the >> right to monitor e-mail communications through its networks (in >> accordance >> with applicable laws). No confidentiality or privilege is waived or >> lost by >> Nomura by any mistransmission of this e-mail. Any reference to >> "Nomura" is >> a reference to any entity in the Nomura Holdings, Inc. group. Please >> read >> our Electronic Communications Legal Notice which forms part of this >> e-mail: >> http://www.Nomura.com/email_disclaimer.htm >> > > -- > Brett Porter > brett@apache.org > http://blogs.exist.com/bporter/ > > > > > This e-mail (including any attachments) is confidential, may contain > proprietary or privileged information and is intended for the named > recipient(s) only. Unintended recipients are prohibited from taking=20=20 > action > on the basis of information in this e-mail and must delete all copies. > Nomura will not accept responsibility or liability for the accuracy or > completeness of, or the presence of any virus or disabling code in,=20=20 > this > e-mail. If verification is sought please request a hard copy. Any=20=20 > reference > to the terms of executed transactions should be treated as=20=20 > preliminary only > and subject to formal written confirmation by Nomura. Nomura=20=20 > reserves the > right to monitor e-mail communications through its networks (in=20=20 > accordance > with applicable laws). No confidentiality or privilege is waived or=20=20 > lost by > Nomura by any mistransmission of this e-mail. Any reference to=20=20 > "Nomura" is > a reference to any entity in the Nomura Holdings, Inc. group. Please=20= =20 > read > our Electronic Communications Legal Notice which forms part of this=20=20 > e-mail: > http://www.Nomura.com/email_disclaimer.htm > -- Brett Porter brett@apache.org http://blogs.exist.com/bporter/ This e-mail (including any attachments) is confidential, may contain proprietary or privileged information and is intended for the named recipient(s) only. Unintended recipients are prohibited from taking action on the basis of information in this e-mail and must delete all copies. Nomura will not accept responsibility or liability for the accuracy or completeness of, or the presence of any virus or disabling code in, this e-mail. If verification is sought please request a hard copy. Any reference to the terms of executed transactions should be treated as preliminary only and subject to formal written confirmation by Nomura. Nomura reserves the right to monitor e-mail communications through its networks (in accordance with applicable laws). No confidentiality or privilege is waived or lost by Nomura by any mistransmission of this e-mail. Any reference to "Nomura" is a reference to any entity in the Nomura Holdings, Inc. group. Please read our Electronic Communications Legal Notice which forms part of this e-mail: http://www.Nomura.com/email_disclaimer.htm