Author: carlos
Date: Thu Jun 21 11:27:33 2007
New Revision: 549579
URL: http://svn.apache.org/viewvc?view=rev&rev=549579
Log:
Add some code for a possible implementation for syncing
repositories using only one file with the data
Added:
maven/archiva/trunk/maven-meeper/src/main/
maven/archiva/trunk/maven-meeper/src/main/java/
maven/archiva/trunk/maven-meeper/src/main/java/org/
maven/archiva/trunk/maven-meeper/src/main/java/org/apache/
maven/archiva/trunk/maven-meeper/src/main/java/org/apache/maven/
maven/archiva/trunk/maven-meeper/src/main/java/org/apache/maven/
archiva/
maven/archiva/trunk/maven-meeper/src/main/java/org/apache/maven/
archiva/meeper/
maven/archiva/trunk/maven-meeper/src/main/java/org/apache/maven/
archiva/meeper/Reader.java (with props)
maven/archiva/trunk/maven-meeper/src/main/java/org/apache/maven/
archiva/meeper/SyncedRepository.java (with props)
maven/archiva/trunk/maven-meeper/src/main/resources/
maven/archiva/trunk/maven-meeper/src/test/
maven/archiva/trunk/maven-meeper/src/test/java/
maven/archiva/trunk/maven-meeper/src/test/java/org/
maven/archiva/trunk/maven-meeper/src/test/java/org/apache/
maven/archiva/trunk/maven-meeper/src/test/java/org/apache/maven/
maven/archiva/trunk/maven-meeper/src/test/java/org/apache/maven/
archiva/
maven/archiva/trunk/maven-meeper/src/test/java/org/apache/maven/
archiva/meeper/
maven/archiva/trunk/maven-meeper/src/test/java/org/apache/maven/
archiva/meeper/ReaderTest.java (with props)
maven/archiva/trunk/maven-meeper/src/test/resources/
maven/archiva/trunk/maven-meeper/src/test/resources/org/
maven/archiva/trunk/maven-meeper/src/test/resources/org/apache/
maven/archiva/trunk/maven-meeper/src/test/resources/org/apache/
maven/
maven/archiva/trunk/maven-meeper/src/test/resources/org/apache/
maven/archiva/
maven/archiva/trunk/maven-meeper/src/test/resources/org/apache/
maven/archiva/meeper/
maven/archiva/trunk/maven-meeper/src/test/resources/org/apache/
maven/archiva/meeper/sync.csv (with props)
Modified:
maven/archiva/trunk/maven-meeper/ (props changed)
maven/archiva/trunk/maven-meeper/pom.xml
Propchange: maven/archiva/trunk/maven-meeper/
----------------------------------------------------------------------
--------
--- svn:ignore (original)
+++ svn:ignore Thu Jun 21 11:27:33 2007
@@ -1,8 +1,9 @@
-target
-*~
-*.log
-.classpath
-.project
-*.ipr
-*.iws
-*.iml
+target
+*~
+*.log
+.classpath
+.project
+*.ipr
+*.iws
+*.iml
+.settings
Modified: maven/archiva/trunk/maven-meeper/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/maven-meeper/
pom.xml?view=diff&rev=549579&r1=549578&r2=549579
======================================================================
========
--- maven/archiva/trunk/maven-meeper/pom.xml (original)
+++ maven/archiva/trunk/maven-meeper/pom.xml Thu Jun 21 11:27:33 2007
@@ -15,7 +15,8 @@
~ limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://
maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-parent</artifactId>
@@ -23,6 +24,19 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>maven-meeper</artifactId>
- <packaging>pom</packaging>
<name>Maven Meeper</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-csv</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.2</version>
+ </dependency>
+ </dependencies>
+
</project>
Added: maven/archiva/trunk/maven-meeper/src/main/java/org/apache/
maven/archiva/meeper/Reader.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/maven-meeper/
src/main/java/org/apache/maven/archiva/meeper/Reader.java?
view=auto&rev=549579
======================================================================
========
--- maven/archiva/trunk/maven-meeper/src/main/java/org/apache/maven/
archiva/meeper/Reader.java (added)
+++ maven/archiva/trunk/maven-meeper/src/main/java/org/apache/maven/
archiva/meeper/Reader.java Thu Jun 21 11:27:33 2007
@@ -0,0 +1,62 @@
+package org.apache.maven.archiva.meeper;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or
more contributor license
+ * agreements. See the NOTICE file distributed with this work for
additional information regarding
+ * copyright ownership. The ASF licenses this file to you under
the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with
the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
permissions and limitations under
+ * the License.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.csv.CSVParser;
+
+/**
+ * Read a csv file with the synced repositories information
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Carlos Sanchez</a>
+ * @version $Id$
+ */
+public class Reader
+{
+ private CSVParser parser;
+
+ public Reader( InputStream stream )
+ {
+ parser = new CSVParser( new InputStreamReader( stream ) );
+ }
+
+ public List parse()
+ throws IOException
+ {
+ String[][] data = parser.getAllValues();
+ List repos = new ArrayList( data.length - 1 );
+
+ /* ignore headers line */
+ for ( int i = 1; i < data.length; i++ )
+ {
+ int j = 0;
+ SyncedRepository repo = new SyncedRepository();
+ repo.setGroupId( data[i][j++] );
+ repo.setLocation( data[i][j++] );
+ repo.setProtocol( data[i][j++] );
+ repo.setContactName( data[i][j++] );
+ repo.setContactMail( data[i][j++] );
+ repos.add( repo );
+ }
+
+ return repos;
+ }
+}
Propchange: maven/archiva/trunk/maven-meeper/src/main/java/org/
apache/maven/archiva/meeper/Reader.java
----------------------------------------------------------------------
--------
svn:eol-style = native
Propchange: maven/archiva/trunk/maven-meeper/src/main/java/org/
apache/maven/archiva/meeper/Reader.java
----------------------------------------------------------------------
--------
svn:keywords = "Author Date Id Revision"
Added: maven/archiva/trunk/maven-meeper/src/main/java/org/apache/
maven/archiva/meeper/SyncedRepository.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/maven-meeper/
src/main/java/org/apache/maven/archiva/meeper/SyncedRepository.java?
view=auto&rev=549579
======================================================================
========
--- maven/archiva/trunk/maven-meeper/src/main/java/org/apache/maven/
archiva/meeper/SyncedRepository.java (added)
+++ maven/archiva/trunk/maven-meeper/src/main/java/org/apache/maven/
archiva/meeper/SyncedRepository.java Thu Jun 21 11:27:33 2007
@@ -0,0 +1,92 @@
+package org.apache.maven.archiva.meeper;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or
more contributor license
+ * agreements. See the NOTICE file distributed with this work for
additional information regarding
+ * copyright ownership. The ASF licenses this file to you under
the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with
the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
permissions and limitations under
+ * the License.
+ */
+
+import org.apache.commons.lang.builder.ReflectionToStringBuilder;
+
+/**
+ * Stores a synced repository data.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Carlos Sanchez</a>
+ * @version $Id$
+ */
+public class SyncedRepository
+{
+ private String groupId;
+
+ private String location;
+
+ private String protocol;
+
+ private String contactName;
+
+ private String contactMail;
+
+ public void setGroupId( String groupId )
+ {
+ this.groupId = groupId;
+ }
+
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ public void setContactName( String contactName )
+ {
+ this.contactName = contactName;
+ }
+
+ public String getContactName()
+ {
+ return contactName;
+ }
+
+ public void setContactMail( String contactMail )
+ {
+ this.contactMail = contactMail;
+ }
+
+ public String getContactMail()
+ {
+ return contactMail;
+ }
+
+ public void setLocation( String location )
+ {
+ this.location = location;
+ }
+
+ public String getLocation()
+ {
+ return location;
+ }
+
+ public void setProtocol( String protocol )
+ {
+ this.protocol = protocol;
+ }
+
+ public String getProtocol()
+ {
+ return protocol;
+ }
+
+ public String toString()
+ {
+ return ReflectionToStringBuilder.toString( this );
+ }
+}
Propchange: maven/archiva/trunk/maven-meeper/src/main/java/org/
apache/maven/archiva/meeper/SyncedRepository.java
----------------------------------------------------------------------
--------
svn:eol-style = native
Propchange: maven/archiva/trunk/maven-meeper/src/main/java/org/
apache/maven/archiva/meeper/SyncedRepository.java
----------------------------------------------------------------------
--------
svn:keywords = "Author Date Id Revision"
Added: maven/archiva/trunk/maven-meeper/src/test/java/org/apache/
maven/archiva/meeper/ReaderTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/maven-meeper/
src/test/java/org/apache/maven/archiva/meeper/ReaderTest.java?
view=auto&rev=549579
======================================================================
========
--- maven/archiva/trunk/maven-meeper/src/test/java/org/apache/maven/
archiva/meeper/ReaderTest.java (added)
+++ maven/archiva/trunk/maven-meeper/src/test/java/org/apache/maven/
archiva/meeper/ReaderTest.java Thu Jun 21 11:27:33 2007
@@ -0,0 +1,50 @@
+package org.apache.maven.archiva.meeper;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or
more contributor license
+ * agreements. See the NOTICE file distributed with this work for
additional information regarding
+ * copyright ownership. The ASF licenses this file to you under
the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with
the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
permissions and limitations under
+ * the License.
+ */
+
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+public class ReaderTest
+ extends TestCase
+{
+
+ private Reader reader;
+
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ reader = new Reader( this.getClass().getClassLoader()
+ .getResourceAsStream( "org/apache/maven/archiva/meeper/
sync.csv" ) );
+ }
+
+ public void testParse()
+ throws Exception
+ {
+ List repos = reader.parse();
+ assertEquals( 2, repos.size() );
+ for ( Iterator it = repos.iterator(); it.hasNext(); )
+ {
+ SyncedRepository repo = (SyncedRepository) it.next();
+ System.out.println( repo );
+ }
+ }
+
+}
Propchange: maven/archiva/trunk/maven-meeper/src/test/java/org/
apache/maven/archiva/meeper/ReaderTest.java
----------------------------------------------------------------------
--------
svn:eol-style = native
Propchange: maven/archiva/trunk/maven-meeper/src/test/java/org/
apache/maven/archiva/meeper/ReaderTest.java
----------------------------------------------------------------------
--------
svn:keywords = "Author Date Id Revision"
Added: maven/archiva/trunk/maven-meeper/src/test/resources/org/
apache/maven/archiva/meeper/sync.csv
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/maven-meeper/
src/test/resources/org/apache/maven/archiva/meeper/sync.csv?
view=auto&rev=549579
======================================================================
========
--- maven/archiva/trunk/maven-meeper/src/test/resources/org/apache/
maven/archiva/meeper/sync.csv (added)
+++ maven/archiva/trunk/maven-meeper/src/test/resources/org/apache/
maven/archiva/meeper/sync.csv Thu Jun 21 11:27:33 2007
@@ -0,0 +1,3 @@
+"groupId","location","protocol","contactName","contactMail"
+"asm","[EMAIL PROTECTED]:../../groups/maven/htdocs/
maven2","rsync_ssh","EugeneKuleshov","[EMAIL PROTECTED]"
+"ch.qos.logback","rsync://pixie.qos.ch/mvnrepo","rsync","Ceki
Gulcu","[EMAIL PROTECTED]"
Propchange: maven/archiva/trunk/maven-meeper/src/test/resources/org/
apache/maven/archiva/meeper/sync.csv
----------------------------------------------------------------------
--------
svn:eol-style = native
Propchange: maven/archiva/trunk/maven-meeper/src/test/resources/org/
apache/maven/archiva/meeper/sync.csv
----------------------------------------------------------------------
--------
svn:keywords = "Author Date Id Revision"