Re: svn commit: r726880 - in /maven/mercury/trunk: mercury-ant/mercury-ant-tasks/ mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/ mercury-ant/mercury-ant-tasks/src/main

2008-12-16 Thread Benjamin Bentmann

Hi Oleg,


Author: ogusakov
Date: Mon Dec 15 16:04:14 2008
New Revision: 726880

URL: http://svn.apache.org/viewvc?rev=726880view=rev
Log:
[MERCURY-56] verification configuration for mercury ant tasks done, PGP unit 
test works on osx. Need test keyrings for other platforms.

[...]

@@ -30,7 +40,7 @@
 public class Config
 extends AbstractDataType
 {
-  private static final Language LANG = new DefaultLanguage( Config.class );
+  private static final Language _lang = new DefaultLanguage( Config.class );
   
   CollectionRepo _repos;
   
@@ -178,6 +123,22 @@

 String _authid;
 String _proxyauthid;
 
+boolean _readable = true;

+boolean _writeable = false;
+
+ListVerify _writeVerifiers;

+ListVerify _readVerifiers;
+
+public void setReadable( boolean readable )
+{
+  this._readable = readable;
+}
+
+
@@ -207,6 +168,135 @@

 {
   return _dir != null;
 }
+
+public Verify createVerifywrite()

+{
+  if( _writeVerifiers == null )
+_writeVerifiers = new ArrayListVerify(2);


Please adopt our community conventions for Java code style [0, 1] which 
is usually as easy as importing the provided formatter configs into the IDE.


A consistent formatting eases reading/reviewing the code and more 
importantly simplifies contributing/patching.


Thanks


Benjamin


[0] 
http://maven.apache.org/developers/committer-environment.html#Maven_Code_Style

[1] http://maven.apache.org/developers/conventions/code.html

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



Re: svn commit: r726880 - in /maven/mercury/trunk: mercury-ant/mercury-ant-tasks/ mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/ mercury-ant/mercury-ant-tasks/src/main

2008-12-16 Thread Oleg Gusakov

Hey Ben,

Benjamin Bentmann wrote:

Hi Oleg,


Author: ogusakov
Date: Mon Dec 15 16:04:14 2008
New Revision: 726880

URL: http://svn.apache.org/viewvc?rev=726880view=rev
Log:
[MERCURY-56] verification configuration for mercury ant tasks done, 
PGP unit test works on osx. Need test keyrings for other platforms.



Modified: 
maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/FileUtil.java 

URL: 
http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/FileUtil.java?rev=726880r1=726879r2=726880view=diff 

== 

--- 
maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/FileUtil.java 
(original)
+++ 
maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/FileUtil.java 
Mon Dec 15 16:04:14 2008

@@ -593,35 +595,35 @@
   public static void main( String[] args )
   throws IOException, StreamObserverException
   {


It looks odd for a utility class to have main() method. If it serves a 
production purpose, wouldn't it be better to move the main() out into 
a dedicated class, say in the default package with a descriptive name 
for easy invocation from CLI? If it's only for testing, src/main/java 
is definitively the wrong place.



Maybe ...
Likewise, RepositoryUpdateIntervalPolicy from the mercury-repo-api 
contains a main() method which pretty much looks like test code that 
should be deleted/moved out.

This one - agree, I missed it when cleaning


   
//--- 


+  public static InputStream toStream( String resource )
+  throws MalformedURLException, IOException
+  {
+if( Util.isEmpty( resource ) )
+  return null;
++if( resource.startsWith( file:// )
+|| resource.startsWith( http://; )
+)
+  return new URL(resource).openStream();
+
+return new FileInputStream( new File(resource) );
+  }


RFC 2396 [0], section 3.1, Scheme Component suggests to
treat upper case letters as equivalent to lower case in scheme names 
(e.g., allow HTTP as well as http)


Also, can you elaborate what motivates the selection of only file:// 
and http://; as protocols? For instance, whereever HTTP is used the 
option of HTTPS isn't that far. FTP?


Would it maybe better match your intention to just always call 
URL.openStream() and fallback to the FileInputStream in the case the 
former method threw an exception (unknown protocol)?


I will sure enhance it in the future, for now I only needed a specific 
protocol and ability to blend files and URLs. I don't want to enlarge 
the footprint, so ftp is not gonna make it :)


Thanks,
Oleg


Benjamin



[0] http://www.faqs.org/rfcs/rfc2396.html

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org




-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



Re: svn commit: r726880 - in /maven/mercury/trunk: mercury-ant/mercury-ant-tasks/ mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/ mercury-ant/mercury-ant-tasks/src/main

2008-12-16 Thread Oleg Gusakov

Ben,

Benjamin Bentmann wrote:

Hi Oleg,


Author: ogusakov
Date: Mon Dec 15 16:04:14 2008
New Revision: 726880

URL: http://svn.apache.org/viewvc?rev=726880view=rev
Log:
[MERCURY-56] verification configuration for mercury ant tasks done, 
PGP unit test works on osx. Need test keyrings for other platforms.


[...]

@@ -30,7 +40,7 @@
 public class Config
 extends AbstractDataType
 {
-  private static final Language LANG = new DefaultLanguage( 
Config.class );
+  private static final Language _lang = new DefaultLanguage( 
Config.class );

  CollectionRepo _repos;
   @@ -178,6 +123,22 @@
 String _authid;
 String _proxyauthid;
 +boolean _readable = true;
+boolean _writeable = false;
++ListVerify _writeVerifiers;
+ListVerify _readVerifiers;
+
+public void setReadable( boolean readable )
+{
+  this._readable = readable;
+}
+
+@@ -207,6 +168,135 @@
 {
   return _dir != null;
 }
++public Verify createVerifywrite()
+{
+  if( _writeVerifiers == null )
+_writeVerifiers = new ArrayListVerify(2);


Please adopt our community conventions for Java code style [0, 1] 
which is usually as easy as importing the provided formatter configs 
into the IDE.


A consistent formatting eases reading/reviewing the code and more 
importantly simplifies contributing/patching.
Please don't make mass changes without talking. I am still doing a lot 
of modifications and having inconsistent code base - a lot of svn 
conflicts - impedes the process.


Record them as a jira for now.

Thanks,
Oleg


Thanks


Benjamin


[0] 
http://maven.apache.org/developers/committer-environment.html#Maven_Code_Style 


[1] http://maven.apache.org/developers/conventions/code.html

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org




-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



Re: svn commit: r726880 - in /maven/mercury/trunk: mercury-ant/mercury-ant-tasks/ mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/ mercury-ant/mercury-ant-tasks/src/main

2008-12-16 Thread Benjamin Bentmann

Hi Oleg,


Author: ogusakov
Date: Mon Dec 15 16:04:14 2008
New Revision: 726880

URL: http://svn.apache.org/viewvc?rev=726880view=rev
Log:
[MERCURY-56] verification configuration for mercury ant tasks done, PGP unit 
test works on osx. Need test keyrings for other platforms.


Modified: 
maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/FileUtil.java
URL: 
http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/FileUtil.java?rev=726880r1=726879r2=726880view=diff
==
--- 
maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/FileUtil.java
 (original)
+++ 
maven/mercury/trunk/mercury-util/src/main/java/org/apache/maven/mercury/util/FileUtil.java
 Mon Dec 15 16:04:14 2008
@@ -593,35 +595,35 @@
   public static void main( String[] args )
   throws IOException, StreamObserverException
   {


It looks odd for a utility class to have main() method. If it serves a 
production purpose, wouldn't it be better to move the main() out into a 
dedicated class, say in the default package with a descriptive name for 
easy invocation from CLI? If it's only for testing, src/main/java is 
definitively the wrong place.


Likewise, RepositoryUpdateIntervalPolicy from the mercury-repo-api 
contains a main() method which pretty much looks like test code that 
should be deleted/moved out.



   
//---
+  public static InputStream toStream( String resource )
+  throws MalformedURLException, IOException
+  {
+if( Util.isEmpty( resource ) )
+  return null;
+
+if( resource.startsWith( file:// )

+|| resource.startsWith( http://; )
+)
+  return new URL(resource).openStream();
+
+return new FileInputStream( new File(resource) );
+  }


RFC 2396 [0], section 3.1, Scheme Component suggests to

treat upper case letters as equivalent to lower case in scheme names (e.g., allow HTTP 
as well as http)


Also, can you elaborate what motivates the selection of only file:// 
and http://; as protocols? For instance, whereever HTTP is used the 
option of HTTPS isn't that far. FTP?


Would it maybe better match your intention to just always call 
URL.openStream() and fallback to the FileInputStream in the case the 
former method threw an exception (unknown protocol)?



Benjamin



[0] http://www.faqs.org/rfcs/rfc2396.html

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



Re: svn commit: r726880 - in /maven/mercury/trunk: mercury-ant/mercury-ant-tasks/ mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/ mercury-ant/mercury-ant-tasks/src/main

2008-12-16 Thread Oleg Gusakov

Recorded in http://jira.codehaus.org/browse/MERCURY-59, will comply asahp

Benjamin Bentmann wrote:

Hi Oleg,


Author: ogusakov
Date: Mon Dec 15 16:04:14 2008
New Revision: 726880

URL: http://svn.apache.org/viewvc?rev=726880view=rev
Log:
[MERCURY-56] verification configuration for mercury ant tasks done, 
PGP unit test works on osx. Need test keyrings for other platforms.


[...]

@@ -30,7 +40,7 @@
 public class Config
 extends AbstractDataType
 {
-  private static final Language LANG = new DefaultLanguage( 
Config.class );
+  private static final Language _lang = new DefaultLanguage( 
Config.class );

  CollectionRepo _repos;
   @@ -178,6 +123,22 @@
 String _authid;
 String _proxyauthid;
 +boolean _readable = true;
+boolean _writeable = false;
++ListVerify _writeVerifiers;
+ListVerify _readVerifiers;
+
+public void setReadable( boolean readable )
+{
+  this._readable = readable;
+}
+
+@@ -207,6 +168,135 @@
 {
   return _dir != null;
 }
++public Verify createVerifywrite()
+{
+  if( _writeVerifiers == null )
+_writeVerifiers = new ArrayListVerify(2);


Please adopt our community conventions for Java code style [0, 1] 
which is usually as easy as importing the provided formatter configs 
into the IDE.


A consistent formatting eases reading/reviewing the code and more 
importantly simplifies contributing/patching.


Thanks


Benjamin


[0] 
http://maven.apache.org/developers/committer-environment.html#Maven_Code_Style 


[1] http://maven.apache.org/developers/conventions/code.html

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org




-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



Re: svn commit: r726880 - in /maven/mercury/trunk: mercury-ant/mercury-ant-tasks/ mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/ mercury-ant/mercury-ant-tasks/src/main

2008-12-15 Thread Brett Porter


On 16/12/2008, at 11:04 AM, ogusa...@apache.org wrote:


Author: ogusakov
Date: Mon Dec 15 16:04:14 2008
New Revision: 726880

URL: http://svn.apache.org/viewvc?rev=726880view=rev
Log:
[MERCURY-56] verification configuration for mercury ant tasks done,  
PGP unit test works on osx. Need test keyrings for other platforms.


The test keyrings should be portable?

- Brett

--
Brett Porter
br...@apache.org
http://blogs.exist.com/bporter/


-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org