incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r560896 - in /incubator/nmaven/trunk: components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ components/dotnet-repository/src/main/java/org/apac...
Date Mon, 30 Jul 2007 09:09:41 GMT
Author: sisbell
Date: Mon Jul 30 02:09:36 2007
New Revision: 560896

URL: http://svn.apache.org/viewvc?view=rev&rev=560896
Log:
Added resolving for artifacts that have classifiers.

Modified:
    incubator/nmaven/trunk/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectFactory.java
    incubator/nmaven/trunk/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java
    incubator/nmaven/trunk/components/dotnet-repository/src/main/java/org/apache/maven/dotnet/repository/impl/RepositoryConverterImpl.java
    incubator/nmaven/trunk/components/dotnet-repository/src/test/java/org/apache/maven/dotnet/repository/impl/RepositoryConverterImplTest.java
    incubator/nmaven/trunk/misc/dotnet-repository-builder/pom-dotnet.xml

Modified: incubator/nmaven/trunk/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectFactory.java?view=diff&rev=560896&r1=560895&r2=560896
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectFactory.java
(original)
+++ incubator/nmaven/trunk/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectFactory.java
Mon Jul 30 02:09:36 2007
@@ -97,22 +97,23 @@
         return projectDependency;
     }
 
-    public static Dependency createDependencyFrom(ProjectDependency projectDependency)
+    public static Dependency createDependencyFrom( ProjectDependency projectDependency )
     {
         Dependency dependency = new Dependency();
-        dependency.setGroupId( projectDependency.getGroupId());
-        dependency.setArtifactId( projectDependency.getArtifactId());
-        dependency.setVersion( projectDependency.getVersion());
-        dependency.setType( projectDependency.getArtifactType());
-        dependency.setClassifier( projectDependency.getPublicKeyTokenId());
+        dependency.setGroupId( projectDependency.getGroupId() );
+        dependency.setArtifactId( projectDependency.getArtifactId() );
+        dependency.setVersion( projectDependency.getVersion() );
+        dependency.setType( projectDependency.getArtifactType() );
+        dependency.setClassifier( projectDependency.getPublicKeyTokenId() );
         return dependency;
     }
 
     public static Artifact createArtifactFrom( Project project, ArtifactFactory artifactFactory,
File localRepository )
     {
-        Artifact assembly = artifactFactory.createArtifact( project.getGroupId(), project.getArtifactId(),
-                                                            project.getVersion(), "compile",
-                                                            project.getArtifactType() );
+        Artifact assembly = artifactFactory.createArtifactWithClassifier( project.getGroupId(),
project.getArtifactId(),
+                                                                          project.getVersion(),
+                                                                          project.getArtifactType(),
+                                                                          project.getPublicKeyTokenId()
);
 
         File artifactFile = ( ( project.getArtifactType().startsWith( "gac" ) ) ) ? new File(
             "C:\\WINDOWS\\assembly\\" + project.getArtifactType() + "\\" + project.getArtifactId()
+ "\\" +
@@ -135,7 +136,7 @@
                                                                       projectDependency.getArtifactType(),
                                                                       projectDependency.getPublicKeyTokenId(),
scope,
                                                                       null );
-
+        //System.out.println("Scope = " + assembly.getScope() + ", Type = " + assembly.getType()
+ ", Classifier = " + assembly.getClassifier());
         File artifactFile = ( ( projectDependency.getArtifactType().startsWith( "gac" ) )
) ? new File(
             "C:\\WINDOWS\\assembly\\" + projectDependency.getArtifactType() + "\\" + projectDependency.getArtifactId()
+
                 "\\" + projectDependency.getVersion() + "__" + projectDependency.getPublicKeyTokenId()
+ "\\" +

Modified: incubator/nmaven/trunk/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java?view=diff&rev=560896&r1=560895&r2=560896
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java
(original)
+++ incubator/nmaven/trunk/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java
Mon Jul 30 02:09:36 2007
@@ -124,6 +124,12 @@
                 String artifactId = set.getBinding( ProjectUri.ARTIFACT_ID.getObjectBinding()
).getValue().toString();
                 String artifactType =
                     set.getBinding( ProjectUri.ARTIFACT_TYPE.getObjectBinding() ).getValue().toString();
+                String classifier = null;
+                if ( set.hasBinding( ProjectUri.CLASSIFIER.getObjectBinding() ) )
+                {
+                    classifier = set.getBinding( ProjectUri.CLASSIFIER.getObjectBinding()
).getValue().toString();
+                }
+
                 // Project project = getProjectFor( groupId, artifactId, version, artifactType,
null );
                 /*
                 for ( Iterator<Binding> i = set.iterator(); i.hasNext(); )
@@ -132,7 +138,7 @@
                     System.out.println( b.getName() + ":" + b.getValue() );
                 }
                */
-                projects.add( getProjectFor( groupId, artifactId, version, artifactType,
null ) );
+                projects.add( getProjectFor( groupId, artifactId, version, artifactType,
classifier ) );
             }
         }
         catch ( RepositoryException e )

Modified: incubator/nmaven/trunk/components/dotnet-repository/src/main/java/org/apache/maven/dotnet/repository/impl/RepositoryConverterImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-repository/src/main/java/org/apache/maven/dotnet/repository/impl/RepositoryConverterImpl.java?view=diff&rev=560896&r1=560895&r2=560896
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-repository/src/main/java/org/apache/maven/dotnet/repository/impl/RepositoryConverterImpl.java
(original)
+++ incubator/nmaven/trunk/components/dotnet-repository/src/main/java/org/apache/maven/dotnet/repository/impl/RepositoryConverterImpl.java
Mon Jul 30 02:09:36 2007
@@ -71,7 +71,7 @@
             if ( !project.getArtifactType().equals( "pom" ) )
             {
                 if ( artifact.getFile().exists() )
-                {
+                {  
                     FileUtils.copyFile( artifact.getFile(), new File( mavenRepository, layout.pathOf(
artifact ) ) );
                 }
                 else

Modified: incubator/nmaven/trunk/components/dotnet-repository/src/test/java/org/apache/maven/dotnet/repository/impl/RepositoryConverterImplTest.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/dotnet-repository/src/test/java/org/apache/maven/dotnet/repository/impl/RepositoryConverterImplTest.java?view=diff&rev=560896&r1=560895&r2=560896
==============================================================================
--- incubator/nmaven/trunk/components/dotnet-repository/src/test/java/org/apache/maven/dotnet/repository/impl/RepositoryConverterImplTest.java
(original)
+++ incubator/nmaven/trunk/components/dotnet-repository/src/test/java/org/apache/maven/dotnet/repository/impl/RepositoryConverterImplTest.java
Mon Jul 30 02:09:36 2007
@@ -8,12 +8,17 @@
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.openrdf.repository.Repository;
 import org.openrdf.repository.RepositoryException;
+import org.openrdf.repository.RepositoryConnection;
 import org.openrdf.repository.sail.SailRepository;
 import org.openrdf.sail.memory.MemoryStoreRDFSInferencer;
 import org.openrdf.sail.memory.MemoryStore;
+import org.openrdf.rio.RDFHandler;
+import org.openrdf.rio.RDFHandlerException;
+import org.openrdf.rio.rdfxml.RDFXMLWriter;
 
 import java.io.File;
 import java.io.IOException;
+import java.io.FileOutputStream;
 import java.util.ArrayList;
 
 
@@ -23,6 +28,8 @@
 
     private static File basedir = new File( System.getProperty( "basedir" ) );
 
+    private org.openrdf.repository.Repository rdfRepository;
+
     public void testConvert()
     {
         File testRepo = new File( System.getProperty( "basedir" ), "target/test-repo/repository"
);
@@ -36,6 +43,7 @@
         project.setArtifactId( "NMaven.Model.Pom" );
         project.setVersion( "1.0" );
         project.setArtifactType( "library" );
+        project.setPublicKeyTokenId( "abc" );
 
         ProjectDependency test2 = createProjectDependency( "NMaven", "NMaven.Test", "1.0"
);
         test2.setArtifactType( "library" );
@@ -62,9 +70,10 @@
         {
             fail( "Could not convert the repository: " + e.getMessage() );
         }
+        this.exportRepositoryToRdf( "testConvert-rdf.xml", testRepo, repository );
 
-        assertTrue( new File( testRepo, "/NMaven/Model/NMaven.Model.Pom/1.0/NMaven.Model.Pom-1.0.dll"
).exists() );
-        assertTrue( new File( testRepo, "/NMaven/Model/NMaven.Model.Pom/1.0/NMaven.Model.Pom-1.0.pom"
).exists() );
+        assertTrue( new File( testRepo, "/NMaven/Model/NMaven.Model.Pom/1.0/NMaven.Model.Pom-1.0-abc.dll"
).exists() );
+        assertTrue( new File( testRepo, "/NMaven/Model/NMaven.Model.Pom/1.0/NMaven.Model.Pom-1.0-abc.pom"
).exists() );
         assertTrue( new File( testRepo, "/NMaven/NMaven.Test/1.0/NMaven.Test-1.0.dll" ).exists()
);
         assertTrue( new File( testRepo, "/NMaven/NMaven.Test/1.0/NMaven.Test-1.0.pom" ).exists()
);
     }
@@ -103,5 +112,33 @@
         dao.setRdfRepository( rdfRepository );
         dao.openConnection();
         return dao;
+    }
+
+    private void exportRepositoryToRdf( String fileName, File localRepository, Repository
rdfRepository )
+    {
+        RDFHandler rdfxmlWriter;
+        try
+        {
+            File exportFile = new File( localRepository.getParentFile(), fileName );
+            rdfxmlWriter = new RDFXMLWriter( new FileOutputStream( exportFile ) );
+        }
+        catch ( IOException e )
+        {
+            return;
+        }
+
+        try
+        {
+            RepositoryConnection repositoryConnection = rdfRepository.getConnection();
+            repositoryConnection.export( rdfxmlWriter );
+        }
+        catch ( RepositoryException e )
+        {
+            e.printStackTrace();
+        }
+        catch ( RDFHandlerException e )
+        {
+            e.printStackTrace();
+        }
     }
 }

Modified: incubator/nmaven/trunk/misc/dotnet-repository-builder/pom-dotnet.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/misc/dotnet-repository-builder/pom-dotnet.xml?view=diff&rev=560896&r1=560895&r2=560896
==============================================================================
--- incubator/nmaven/trunk/misc/dotnet-repository-builder/pom-dotnet.xml (original)
+++ incubator/nmaven/trunk/misc/dotnet-repository-builder/pom-dotnet.xml Mon Jul 30 02:09:36
2007
@@ -31,6 +31,7 @@
       <artifactId>NMaven.Model.Pom</artifactId>
       <version>${pom.version}</version>
       <type>library</type>
+      <classifier>4b435f4d76e2f0e6</classifier>
     </dependency>
     <dependency>
       <groupId>NMaven.Model</groupId>
@@ -43,6 +44,7 @@
       <artifactId>NMaven.Plugin</artifactId>
       <version>${pom.version}</version>
       <type>library</type>
+      <classifier>4b435f4d76e2f0e6</classifier>
     </dependency>
     <dependency>
       <groupId>NMaven.Plugin</groupId>



Mime
View raw message