You are viewing a plain text version of this content. The canonical link for it is here.
Posted to nmaven-commits@incubator.apache.org by si...@apache.org on 2007/07/12 19:08:06 UTC

svn commit: r555722 [2/4] - in /incubator/nmaven/branches/SI_GAC: ./ archetypes/ archetypes/maven-archetype-dotnet-simple/ archetypes/maven-archetype-netexecutable/ assemblies/ assemblies/NMaven.Artifact/ assemblies/NMaven.Artifact/src/main/csharp/NMav...

Modified: incubator/nmaven/branches/SI_GAC/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java?view=diff&rev=555722&r1=555721&r2=555722
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java (original)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java Thu Jul 12 12:07:57 2007
@@ -19,34 +19,27 @@
 package org.apache.maven.dotnet.artifact.impl;
 
 import org.apache.maven.dotnet.artifact.AssemblyResolver;
-import org.apache.maven.dotnet.artifact.AssemblyRepositoryLayout;
+import org.apache.maven.dotnet.dao.ProjectDao;
+import org.apache.maven.dotnet.dao.impl.ProjectFactory;
+import org.apache.maven.dotnet.repository.Project;
+import org.apache.maven.dotnet.repository.ProjectDependency;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
-import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolver;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
-import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
-import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.model.Dependency;
 
 import org.codehaus.plexus.logging.LogEnabled;
 import org.codehaus.plexus.logging.Logger;
-import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.CollectionUtils;
 
 import java.util.Set;
 import java.util.HashSet;
 import java.util.List;
-import java.util.ArrayList;
-
-import java.io.File;
-import java.io.IOException;
 
 /**
  * Provides a way to resolve transitive assemblies that do not have versions within their file name.
@@ -57,17 +50,6 @@
     implements AssemblyResolver, LogEnabled
 {
     /**
-     * An artifact resolver component for locating artifacts and pulling them into the local repo if they do not
-     * already exist.
-     */
-    private ArtifactResolver resolver;
-
-    /**
-     * Metadata component used by the <code>ArtifactResolver</code>.
-     */
-    private ArtifactMetadataSource metadata;
-
-    /**
      * The artifact factory component, which is used for creating artifacts.
      */
     private ArtifactFactory artifactFactory;
@@ -82,6 +64,10 @@
      */
     private Logger logger;
 
+    private org.apache.maven.dotnet.registry.DataAccessObjectRegistry daoRegistry;
+
+    private org.apache.maven.artifact.manager.WagonManager wagonManager;
+
     /**
      * Constructor. This method is intended to by invoked by the plexus-container, not by the application developer.
      */
@@ -97,116 +83,149 @@
         this.logger = logger;
     }
 
-    /**
-     * @see AssemblyResolver#resolveTransitivelyFor
-     */
-    public void resolveTransitivelyFor( MavenProject project, Artifact sourceArtifact, List<Dependency> dependencies,
-                                        List<ArtifactRepository> remoteArtifactRepositories,
-                                        ArtifactRepository localArtifactRepository,
-                                        boolean addResolvedDependenciesToProject )
-        throws ArtifactResolutionException, ArtifactNotFoundException
+    private Set<ProjectDependency> subtractProjectDependencies( List<Dependency> b, Set<ProjectDependency> a )
     {
-        List<ArtifactRepository> releaseRepositories = new ArrayList<ArtifactRepository>();
-        List<ArtifactRepository> snapshotRepositories = new ArrayList<ArtifactRepository>();
-        for ( ArtifactRepository artifactRepository : remoteArtifactRepositories )
+        Set<Dependency> d = new HashSet<Dependency>( b );
+
+        for ( Dependency dependency : b )
         {
-            if ( artifactRepository.getSnapshots().isEnabled() )
+            if ( containsDependency( a, dependency ) )
             {
-                snapshotRepositories.add( artifactRepository );
+                d.remove( dependency );
             }
-            if ( artifactRepository.getReleases().isEnabled() )
+        }
+        Set<ProjectDependency> projectDependencies = new HashSet<ProjectDependency>();
+        for ( Dependency dependency : d )
+        {
+            ProjectDependency projectDependency = new ProjectDependency();
+            projectDependency.setGroupId( dependency.getGroupId() );
+            projectDependency.setArtifactId( dependency.getArtifactId() );
+            projectDependency.setVersion( dependency.getVersion() );
+            projectDependencies.add( projectDependency );
+        }
+        return projectDependencies;
+    }
+
+    private Set<ProjectDependency> substractDependencies( Set<ProjectDependency> a, List<Dependency> b )
+    {
+        Set<ProjectDependency> pd = new HashSet<ProjectDependency>( a );
+        for ( ProjectDependency projectDependency : a )
+        {
+            if ( containsProjectDependency( b, projectDependency ) )
             {
-                releaseRepositories.add( artifactRepository );
+                pd.remove( projectDependency );
             }
         }
+        return pd;
+    }
 
-        Set<Artifact> artifactDependencies = new HashSet<Artifact>();
-        Set<Artifact> snapshotArtifactDependencies = new HashSet<Artifact>();
-        Set<Artifact> gacDependencies = new HashSet<Artifact>();
-
-        ArtifactFilter gacFilter = new GacFilter();
+    private boolean containsProjectDependency( List<Dependency> dependencies, ProjectDependency projectDependency )
+    {
         for ( Dependency dependency : dependencies )
         {
-            String scope = ( dependency.getScope() == null ) ? Artifact.SCOPE_COMPILE : dependency.getScope();
-            Artifact artifact = artifactFactory.createDependencyArtifact( dependency.getGroupId(),
-                                                                          dependency.getArtifactId(),
-                                                                          VersionRange.createFromVersion(
-                                                                              dependency.getVersion() ),
-                                                                          dependency.getType(),
-                                                                          dependency.getClassifier(), scope, null );
-            if ( artifact.getType().startsWith( "gac" ) )
-            {
-                logger.debug(
-                    "NMAVEN-000-000: GAC Dependency = " + artifact.getType() + ", ID = " + artifact.getArtifactId() );
-                gacDependencies.add( artifact );
-            }
-            else if ( artifact.isSnapshot() )
-            {
-                logger.debug( "NMAVEN-000-000: Snapshot Dependency: Type  = " + artifact.getType() +
-                    ", Artifact ID = " + artifact.getArtifactId() );
-                snapshotArtifactDependencies.add( artifact );
-            }
-            else
+            if ( isEqual( projectDependency, dependency ) )
             {
-                logger.debug( "NMAVEN-000-000: Dependency: Type  = " + artifact.getType() + ", Artifact ID = " +
-                    artifact.getArtifactId() );
-                artifactDependencies.add( artifact );
+                return true;
             }
         }
-        //Releases
-        ArtifactResolutionResult result = resolver.resolveTransitively( artifactDependencies, sourceArtifact,
-                                                                        localArtifactRepository, releaseRepositories,
-                                                                        metadata, gacFilter );
-        Set<Artifact> resolvedReleaseDependencies = result.getArtifacts();
-
-        //Snapshots
-        ArtifactRepository artifactRepository = new DefaultArtifactRepository( "local", "file://" +
-            localArtifactRepository.getBasedir(), new DefaultRepositoryLayout() );
-
-        ArtifactResolutionResult snapshotResult = resolver.resolveTransitively( snapshotArtifactDependencies,
-                                                                                sourceArtifact, artifactRepository,
-                                                                                snapshotRepositories, metadata,
-                                                                                gacFilter );
-        Set<Artifact> resolvedSnapshotDependencies = snapshotResult.getArtifacts();
-        AssemblyRepositoryLayout layout = new AssemblyRepositoryLayout();
-        for ( Artifact artifact : resolvedSnapshotDependencies )
+        return false;
+    }
+
+    private boolean containsDependency( Set<ProjectDependency> projectDependencies, Dependency dependency )
+    {
+        for ( ProjectDependency projectDependency : projectDependencies )
         {
-            File originalFileWithVersion = artifact.getFile();
-            if ( artifact.isSnapshot() )
+            if ( isEqual( projectDependency, dependency ) )
             {
-                artifact.setVersion( artifact.getBaseVersion() );
+                return true;
             }
-            File targetFileWithoutVersion =
-                new File( localArtifactRepository.getBasedir() + "/" + layout.pathOf( artifact ) );
-            if ( originalFileWithVersion.lastModified() > targetFileWithoutVersion.lastModified() )
-            {
-                logger.debug( "Original = " + originalFileWithVersion.getAbsolutePath() + ", Target = " +
-                    targetFileWithoutVersion.getAbsolutePath() );
+        }
+        return false;
+    }
+
+    private boolean isEqual( ProjectDependency projectDependency, Dependency dependency )
+    {
+        return ( projectDependency.getArtifactId().equals( dependency.getArtifactId() ) &&
+            projectDependency.getGroupId().equals( dependency.getGroupId() ) &&
+            projectDependency.getVersion().equals( dependency.getVersion() ) );
+    }
+
+    /**
+     * @see AssemblyResolver#resolveTransitivelyFor
+     */
+    public void resolveTransitivelyFor( MavenProject mavenProject, Artifact sourceArtifact,
+                                        List<Dependency> dependencies,
+                                        List<ArtifactRepository> remoteArtifactRepositories,
+                                        ArtifactRepository localArtifactRepository,
+                                        boolean addResolvedDependenciesToProject )
+        throws ArtifactResolutionException, ArtifactNotFoundException
+    {
+        //Check that the list of dependencies matches the first level RDF Repo
+        //If not, resolve missing dependencies and add to repo or delete additional dependencies from repo
+        ProjectDao dao = (ProjectDao) daoRegistry.find( "dao:project" );
+        dao.init( artifactFactory, wagonManager );
+
+        Project project = new Project();
+        project.setGroupId( mavenProject.getGroupId() );
+        project.setArtifactId( mavenProject.getArtifactId() );
+        project.setVersion( mavenProject.getVersion() );
+        project.setArtifactType( mavenProject.getArtifact().getType() );
+
+        project.setPublicKeyTokenId( mavenProject.getArtifact().getClassifier() );
+
+        for ( Dependency dependency : dependencies )
+        {
+            ProjectDependency projectDependency = new ProjectDependency();
+            projectDependency.setGroupId( dependency.getGroupId() );
+            projectDependency.setArtifactId( dependency.getArtifactId() );
+            projectDependency.setVersion( dependency.getVersion() );
+            projectDependency.setPublicKeyTokenId( dependency.getClassifier() );
+            projectDependency.setArtifactType( dependency.getType() );
+            project.addProjectDependency( projectDependency );
+        }
+
+        /*
                 try
                 {
-                    FileUtils.copyFile( originalFileWithVersion, targetFileWithoutVersion );
+                    project = dao.getProjectFor( mavenProject );
                 }
-                catch ( IOException e )
+                catch ( java.io.IOException e )
                 {
                     e.printStackTrace();
                 }
-            }
-            if ( originalFileWithVersion.length() != 0 && targetFileWithoutVersion.length() == 0 )
-            {
-                throw new ArtifactResolutionException( "NMAVEN-000-000: Artifact is corrupted:", artifact );
-            }
+        */
 
-            if ( targetFileWithoutVersion.exists() )
-            {
-                artifact.setFile( targetFileWithoutVersion.getAbsoluteFile() );
-            }
+        //Set<ProjectDependency> projectDependencies = project.getProjectDependencies();
+
+        /*
+                Set<ProjectDependency> pd = new HashSet<ProjectDependency>( CollectionUtils.subtract( projectDependencies,
+                                                                                                      substractDependencies(
+                                                                                                          projectDependencies,
+                                                                                                          dependencies ) ) );
+                pd.addAll( subtractProjectDependencies( dependencies, projectDependencies ) );
+        */
+
+        Set<Artifact> artifactDependencies = new HashSet<Artifact>();
+        try
+        {
+            artifactDependencies = dao.storeProjectAndResolveDependencies( project, remoteArtifactRepositories );
+        }
+        catch ( java.io.IOException e )
+        {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
         }
+
+        //Resolve content
+
+        //Resolve and store pom
+
+        //Add rdf info to mavenProject
+        System.out.println( "Dependencies = " + artifactDependencies.size() );
         if ( addResolvedDependenciesToProject )
         {
-            resolvedReleaseDependencies.addAll( gacDependencies );
-            resolvedReleaseDependencies.addAll( resolvedSnapshotDependencies );
-            project.setDependencyArtifacts( resolvedReleaseDependencies );
+            mavenProject.setDependencyArtifacts( artifactDependencies );
         }
+
     }
 
     private static class GacFilter

Modified: incubator/nmaven/branches/SI_GAC/components/dotnet-artifact/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/components/dotnet-artifact/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=555722&r1=555721&r2=555722
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-artifact/src/main/resources/META-INF/plexus/components.xml (original)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-artifact/src/main/resources/META-INF/plexus/components.xml Thu Jul 12 12:07:57 2007
@@ -99,11 +99,17 @@
       </configuration>
     </component>
     <component>
+      <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
+      <role-hint>dummy</role-hint>
+      <implementation>org.apache.maven.dotnet.artifact.DummyResolver</implementation>
+    </component>
+    <component>
       <role>org.apache.maven.dotnet.artifact.ArtifactContext</role>
       <implementation>org.apache.maven.dotnet.artifact.impl.ArtifactContextImpl</implementation>
       <requirements>
         <requirement>
           <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
+          <role-hint>dummy</role-hint>
         </requirement>
         <requirement>
           <role>org.apache.maven.artifact.metadata.ArtifactMetadataSource</role>
@@ -142,6 +148,7 @@
         </requirement>
         <requirement>
           <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
+          <role-hint>dummy</role-hint>
         </requirement>
         <requirement>
           <role>org.apache.maven.artifact.metadata.ArtifactMetadataSource</role>
@@ -152,6 +159,9 @@
         <requirement>
           <role>org.apache.maven.dotnet.registry.RepositoryRegistry</role>
         </requirement>
+        <requirement>
+          <role>org.apache.maven.dotnet.registry.DataAccessObjectRegistry</role>
+        </requirement>        
       </requirements>
     </component>
     <component>
@@ -164,18 +174,30 @@
       <implementation>org.apache.maven.dotnet.artifact.impl.AssemblyResolverImpl</implementation>
       <requirements>
         <requirement>
-          <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
+          <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
         </requirement>
         <requirement>
-          <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
+          <role>org.apache.maven.artifact.repository.ArtifactRepositoryFactory</role>
         </requirement>
         <requirement>
-          <role>org.apache.maven.artifact.metadata.ArtifactMetadataSource</role>
+          <role>org.apache.maven.dotnet.registry.DataAccessObjectRegistry</role>
         </requirement>
         <requirement>
-          <role>org.apache.maven.artifact.repository.ArtifactRepositoryFactory</role>
+          <role>org.apache.maven.artifact.manager.WagonManager</role>
         </requirement>
       </requirements>
     </component>
+    <component>
+      <role>org.apache.maven.dotnet.dao.ProjectDao</role>
+      <implementation>org.apache.maven.dotnet.dao.impl.ProjectDaoImpl</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.artifact.manager.WagonManager</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
+        </requirement>
+      </requirements>
+    </component>    
   </components>
 </component-set>

Modified: incubator/nmaven/branches/SI_GAC/components/dotnet-assembler/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/components/dotnet-assembler/pom.xml?view=diff&rev=555722&r1=555721&r2=555722
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-assembler/pom.xml (original)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-assembler/pom.xml Thu Jul 12 12:07:57 2007
@@ -20,7 +20,7 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <parent>
     <groupId>org.apache.maven.dotnet</groupId>
-    <version>0.14-SNAPSHOT</version>
+    <version>0.14</version>
     <artifactId>dotnet-components</artifactId>
   </parent>
   <modelVersion>4.0.0</modelVersion>

Modified: incubator/nmaven/branches/SI_GAC/components/dotnet-core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/components/dotnet-core/pom.xml?view=diff&rev=555722&r1=555721&r2=555722
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-core/pom.xml (original)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-core/pom.xml Thu Jul 12 12:07:57 2007
@@ -20,7 +20,7 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <parent>
     <groupId>org.apache.maven.dotnet</groupId>
-    <version>0.14-SNAPSHOT</version>
+    <version>0.14</version>
     <artifactId>dotnet-components</artifactId>
   </parent>
   <modelVersion>4.0.0</modelVersion>

Modified: incubator/nmaven/branches/SI_GAC/components/dotnet-core/src/main/resources/META-INF/nmaven/registry-config.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/components/dotnet-core/src/main/resources/META-INF/nmaven/registry-config.xml?view=diff&rev=555722&r1=555721&r2=555722
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-core/src/main/resources/META-INF/nmaven/registry-config.xml (original)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-core/src/main/resources/META-INF/nmaven/registry-config.xml Thu Jul 12 12:07:57 2007
@@ -40,7 +40,16 @@
       <repository-config>/META-INF/nmaven/net-dependencies.xml</repository-config>
       <init-param>
         <param-name>nmaven.version</param-name>
-        <param-value>0.14-SNAPSHOT</param-value>
+        <param-value>0.14</param-value>
+      </init-param>
+    </repository>
+    <repository>
+      <repository-name>connections</repository-name>
+      <repository-class>org.apache.maven.dotnet.registry.ConnectionsRepository</repository-class>
+      <repository-config>/META-INF/nmaven/jpox.properties</repository-config>
+      <init-param>
+        <param-name>dao:project</param-name>
+        <param-value>org.apache.maven.dotnet.dao.impl.ProjectDaoImpl</param-value>
       </init-param>
     </repository>
     <repository>

Added: incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/pom.xml?view=auto&rev=555722
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/pom.xml (added)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/pom.xml Thu Jul 12 12:07:57 2007
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?><!--
+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.
+-->
+<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.dotnet</groupId>
+    <version>0.14</version>
+    <artifactId>dotnet-components</artifactId>
+    <relativePath>..\..\pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.dotnet</groupId>
+  <artifactId>dotnet-dao-project</artifactId>
+  <name>dotnet-dao-project</name>
+  <description>
+  </description>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.dotnet</groupId>
+      <artifactId>dotnet-jdo</artifactId>
+      <version>0.14</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.dotnet</groupId>
+      <artifactId>dotnet-registry</artifactId>
+      <version>0.14</version>
+    </dependency>
+    <dependency>
+      <groupId>org.openrdf</groupId>
+      <artifactId>openrdf-model</artifactId>
+      <version>2.0-beta4</version>
+    </dependency>
+    <dependency>
+      <groupId>org.openrdf</groupId>
+      <artifactId>openrdf-repository-api</artifactId>
+      <version>2.0-beta4</version>
+    </dependency>
+    <dependency>
+      <groupId>org.openrdf</groupId>
+      <artifactId>openrdf-sail-nativerdf</artifactId>
+      <version>2.0-beta4</version>
+    </dependency>
+    <dependency>
+      <groupId>org.openrdf</groupId>
+      <artifactId>openrdf-queryparser-sparql</artifactId>
+      <version>2.0-beta4</version>
+    </dependency>
+    <dependency>
+      <groupId>info.aduna</groupId>
+      <artifactId>aduna-iteration</artifactId>
+      <version>1.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-jdk14</artifactId>
+      <version>1.3.0</version>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file

Propchange: incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectDao.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectDao.java?view=auto&rev=555722
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectDao.java (added)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectDao.java Thu Jul 12 12:07:57 2007
@@ -0,0 +1,42 @@
+package org.apache.maven.dotnet.dao;
+
+import org.apache.maven.dotnet.repository.Project;
+import org.apache.maven.dotnet.registry.DataAccessObject;
+
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.manager.WagonManager;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.model.Model;
+
+import java.util.Set;
+import java.util.List;
+import java.io.IOException;
+import java.io.File;
+
+public interface ProjectDao
+    extends DataAccessObject
+{
+    /**
+     * Role used to register component implementations with the container.
+     */
+    String ROLE = ProjectDao.class.getName();
+
+    Project getProjectFor( String groupId, String artifactId, String version, String artifactType,
+                           String publicKeyTokenId )
+        throws IOException;
+
+    Project getProjectFor( MavenProject mavenProject )
+        throws IOException;
+
+    Set<Artifact> storeProjectAndResolveDependencies( Project project, List<ArtifactRepository> artifactRepositories )
+        throws IOException;
+
+    Set<Artifact> storeModelAndResolveDependencies( Model model, File pomFileDirectory,
+                                                    List<ArtifactRepository> artifactRepositories )
+        throws IOException;
+
+    void init( ArtifactFactory artifactFactory, WagonManager wagonManager );
+
+}

Propchange: incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectDao.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectUri.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectUri.java?view=auto&rev=555722
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectUri.java (added)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectUri.java Thu Jul 12 12:07:57 2007
@@ -0,0 +1,59 @@
+package org.apache.maven.dotnet.dao;
+
+public enum ProjectUri
+{
+    GROUP_ID( "http://maven.apache.org/artifact/groupId", "groupId", false ),
+
+    ARTIFACT_ID( "http://maven.apache.org/artifact/artifactId", "artifactId", false ),
+
+    VERSION( "http://maven.apache.org/artifact/version", "versionValue", false ),
+
+    ARTIFACT_TYPE( "http://maven.apache.org/artifact/artifactType", "artifactType", false ),
+
+    CLASSIFIER( "http://maven.apache.org/artifact/classifier", "classifier", true ),
+
+    IS_RESOLVED( "http://maven.apache.org/artifact/dependency/isResolved", "isResolved", false ),
+
+    ARTIFACT( "http://maven.apache.org/Artifact", "artifact", false ),
+
+    DEPENDENCY( "http://maven.apache.org/artifact/dependency", "dependency", true ),
+
+    PARENT( "http://maven.apache.org/artifact/parent", "parent", true ),    
+
+    VENDOR( "http://maven.apache.org/artifact/requirement/vendor", "vendor", false ),
+
+    FRAMEWORK_VERSION( "http://maven.apache.org/artifact/requirement/frameworkVersion", "frameworkVersion", false );
+
+    private String uri;
+
+    private String bindingName;
+
+    private boolean isOptional;
+
+    ProjectUri( String uri, String bindingName, boolean isOptional )
+    {
+        this.uri = uri;
+        this.bindingName = bindingName;
+        this.isOptional = isOptional;
+    }
+
+    public String getPredicate()
+    {
+        return uri;
+    }
+
+    public String getObjectBinding()
+    {
+        return bindingName;
+    }
+
+    public boolean isOptional()
+    {
+        return isOptional;
+    }
+
+    public void setOptional( boolean isOptional )
+    {
+        this.isOptional = isOptional;
+    }
+}

Propchange: incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectUri.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java?view=auto&rev=555722
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java (added)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java Thu Jul 12 12:07:57 2007
@@ -0,0 +1,573 @@
+package org.apache.maven.dotnet.dao.impl;
+
+import org.apache.maven.dotnet.dao.ProjectDao;
+import org.apache.maven.dotnet.dao.ProjectUri;
+import org.apache.maven.dotnet.repository.Project;
+import org.apache.maven.dotnet.repository.ProjectDependency;
+import org.apache.maven.dotnet.repository.Requirement;
+import org.apache.maven.dotnet.registry.RepositoryRegistry;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.manager.WagonManager;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.wagon.TransferFailedException;
+import org.apache.maven.wagon.ResourceDoesNotExistException;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.model.Model;
+
+import org.openrdf.model.ValueFactory;
+import org.openrdf.model.URI;
+import org.openrdf.model.Value;
+import org.openrdf.model.BNode;
+import org.openrdf.model.vocabulary.RDF;
+
+import org.openrdf.repository.RepositoryConnection;
+import org.openrdf.repository.RepositoryException;
+import org.openrdf.OpenRDFException;
+import org.openrdf.query.QueryLanguage;
+import org.openrdf.query.QueryEvaluationException;
+import org.openrdf.query.MalformedQueryException;
+import org.openrdf.query.TupleQuery;
+import org.openrdf.query.TupleQueryResult;
+import org.openrdf.query.BindingSet;
+import org.openrdf.query.Binding;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+
+import java.util.logging.Logger;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+import java.io.File;
+import java.io.IOException;
+import java.io.FileReader;
+import java.net.URISyntaxException;
+
+public final class ProjectDaoImpl
+    implements ProjectDao
+{
+
+    private String className;
+
+    private String id;
+
+    private static Logger logger = Logger.getAnonymousLogger();
+
+    private org.openrdf.repository.Repository rdfRepository;
+
+    private org.apache.maven.artifact.manager.WagonManager wagonManager;
+
+    /**
+     * The artifact factory component, which is used for creating artifacts.
+     */
+    private org.apache.maven.artifact.factory.ArtifactFactory artifactFactory;
+
+    public void init( ArtifactFactory artifactFactory, WagonManager wagonManager )
+    {
+        this.artifactFactory = artifactFactory;
+        this.wagonManager = wagonManager;
+    }
+
+    public Project getProjectFor( String groupId, String artifactId, String version, String artifactType,
+                                  String publicKeyTokenId )
+        throws IOException
+    {
+        RepositoryConnection repositoryConnection;
+        try
+        {
+            repositoryConnection = rdfRepository.getConnection();
+        }
+        catch ( RepositoryException e )
+        {
+            throw new IOException( e.getMessage() );
+        }
+        ValueFactory valueFactory = rdfRepository.getValueFactory();
+
+        Project project = new ProjectDependency();
+        project.setArtifactId( artifactId );
+        project.setGroupId( groupId );
+        project.setVersion( version );
+        project.setArtifactType( artifactType );
+        project.setPublicKeyTokenId( publicKeyTokenId );
+
+        try
+        {
+            List<ProjectUri> projectUris = new ArrayList<ProjectUri>();
+            projectUris.add( ProjectUri.GROUP_ID );
+            projectUris.add( ProjectUri.ARTIFACT_ID );
+            projectUris.add( ProjectUri.VERSION );
+            projectUris.add( ProjectUri.ARTIFACT_TYPE );
+            projectUris.add( ProjectUri.IS_RESOLVED );
+            projectUris.add( ProjectUri.DEPENDENCY );
+            projectUris.add( ProjectUri.CLASSIFIER );
+            projectUris.add( ProjectUri.PARENT );
+
+            String query = "SELECT * FROM " + this.constructQueryFragmentFor( "{x}", projectUris );
+            System.out.println( query );
+            //  "SELECT * FROM {x} <http://maven.apache.org/artifact/groupId> {groupIdValue}; <http://maven.apache.org/artifact/artifactId> {artifactIdValue}; <http://maven.apache.org/artifact/version> {versionValue}; [<http://maven.apache.org/artifact/dependency> {dependency}]";
+            TupleQuery tupleQuery = repositoryConnection.prepareTupleQuery( QueryLanguage.SERQL, query );
+
+            tupleQuery.setBinding( ProjectUri.GROUP_ID.getObjectBinding(), valueFactory.createLiteral( groupId ) );
+            tupleQuery.setBinding( ProjectUri.ARTIFACT_ID.getObjectBinding(),
+                                   valueFactory.createLiteral( artifactId ) );
+            tupleQuery.setBinding( ProjectUri.VERSION.getObjectBinding(), valueFactory.createLiteral( version ) );
+
+            TupleQueryResult result = tupleQuery.evaluate();
+            if ( !result.hasNext() )
+            {
+                if ( artifactType != null && artifactType.startsWith( "gac" ) )
+                {
+                    Artifact artifact =
+                        ProjectFactory.createArtifactFrom( (ProjectDependency) project, artifactFactory );
+                    if ( !artifact.getFile().exists() )
+                    {
+                        throw new IOException( "Could not find GAC assembly: Group ID = " + groupId +
+                            ", Artifact ID = " + artifactId + ", Version = " + version + ", Artifact Type = " +
+                            artifactType + ", File Path = " + artifact.getFile().getAbsolutePath() );
+                    }
+                    project.setResolved( true );
+                    return project;
+                }
+
+                throw new IOException( "NMAVEN-000-000: Could not find the project: Group ID = " + groupId +
+                    ", Artifact ID = " + artifactId + ", Version = " + version + ", Artifact Type = " + artifactType );
+            }
+
+            while ( result.hasNext() )
+            {
+                BindingSet set = result.next();
+                for ( Iterator<Binding> i = set.iterator(); i.hasNext(); )
+                {
+                    Binding b = i.next();
+                    System.out.println( b.getName() + ":" + b.getValue() );
+                }
+
+                if ( set.getBinding( ProjectUri.IS_RESOLVED.getObjectBinding() ).getValue().toString().equalsIgnoreCase(
+                    "true" ) )
+                {
+                    project.setResolved( true );
+                }
+
+                project.setArtifactType(
+                    set.getBinding( ProjectUri.ARTIFACT_TYPE.getObjectBinding() ).getValue().toString() );
+
+                if ( set.hasBinding( ProjectUri.PARENT.getObjectBinding() ) )
+                {
+                    String pid = set.getBinding( ProjectUri.PARENT.getObjectBinding() ).getValue().toString();
+                    String[] tokens = pid.split( "[:]" );
+                    Project parentProject = getProjectFor( tokens[0], tokens[1], tokens[2], null, null );
+                    project.setParentProject( parentProject );
+                }
+
+                if ( set.hasBinding( ProjectUri.DEPENDENCY.getObjectBinding() ) )
+                {
+                    Binding binding = set.getBinding( ProjectUri.DEPENDENCY.getObjectBinding() );
+                    addDependenciesToProject( project, repositoryConnection, binding.getValue() );
+                }
+
+                if ( set.hasBinding( ProjectUri.CLASSIFIER.getObjectBinding() ) )
+                {
+                    Binding binding = set.getBinding( ProjectUri.CLASSIFIER.getObjectBinding() );
+                    addClassifiersToProject( project, repositoryConnection, binding.getValue() );
+                }
+            }
+            /*
+            String query = "CONSTRUCT * FROM {x} p {y} ";
+            GraphQueryResult graphResult = repositoryConnection.prepareGraphQuery( QueryLanguage.SERQL, query ).evaluate();
+            Map<String, String> map = graphResult.getNamespaces();
+            System.out.println( map );
+            while ( graphResult.hasNext() )
+            {
+                Statement st = graphResult.next();
+
+                System.out.println(
+                    "RESULT = " + st.getSubject() + " : " + st.getPredicate() + " : " + st.getObject() );
+            }
+            */
+
+        }
+        catch ( QueryEvaluationException e )
+        {
+            e.printStackTrace();
+        }
+        catch ( RepositoryException e )
+        {
+            e.printStackTrace();
+        }
+        catch ( MalformedQueryException e )
+        {
+            e.printStackTrace();
+        }
+        finally
+        {
+            try
+            {
+                repositoryConnection.close();
+            }
+            catch ( RepositoryException e )
+            {
+                e.printStackTrace();
+            }
+        }
+
+        return project;
+    }
+
+    public Project getProjectFor( MavenProject mavenProject )
+        throws IOException
+    {
+        return getProjectFor( mavenProject.getGroupId(), mavenProject.getArtifactId(), mavenProject.getVersion(),
+                              mavenProject.getArtifact().getType(), mavenProject.getArtifact().getClassifier() );
+    }
+
+    public Set<Artifact> storeProjectAndResolveDependencies( Project project,
+                                                             List<ArtifactRepository> artifactRepositories )
+        throws IOException, IllegalArgumentException
+    {
+        if ( project == null )
+        {
+            throw new IllegalArgumentException( "NMAVEN-000-000: Project is null" );
+        }
+
+        if ( project.getGroupId() == null || project.getArtifactId() == null || project.getVersion() == null )
+        {
+            throw new IllegalArgumentException( "NMAVEN-000-000: Project value is null: Group Id =" +
+                project.getGroupId() + ", Artifact Id = " + project.getArtifactId() + ", Version = " +
+                project.getVersion() );
+        }
+
+        Set<Artifact> artifactDependencies = new HashSet<Artifact>();
+
+        ValueFactory valueFactory = rdfRepository.getValueFactory();
+        URI id =
+            valueFactory.createURI( project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion() );
+        //BNode id = valueFactory.createBNode();
+        URI groupId = valueFactory.createURI( ProjectUri.GROUP_ID.getPredicate() );
+        URI artifactId = valueFactory.createURI( ProjectUri.ARTIFACT_ID.getPredicate() );
+        URI version = valueFactory.createURI( ProjectUri.VERSION.getPredicate() );
+        URI artifactType = valueFactory.createURI( ProjectUri.ARTIFACT_TYPE.getPredicate() );
+        URI classifier = valueFactory.createURI( ProjectUri.CLASSIFIER.getPredicate() );
+        URI isResolved = valueFactory.createURI( ProjectUri.IS_RESOLVED.getPredicate() );
+
+        URI artifact = valueFactory.createURI( ProjectUri.ARTIFACT.getPredicate() );
+        URI dependency = valueFactory.createURI( ProjectUri.DEPENDENCY.getPredicate() );
+        URI parent = valueFactory.createURI( ProjectUri.PARENT.getPredicate() );
+
+        Set<Model> modelDependencies = new HashSet<Model>();
+        try
+        {
+            RepositoryConnection repositoryConnection = rdfRepository.getConnection();
+
+            try
+            {
+                repositoryConnection.add( id, RDF.TYPE, artifact );
+                repositoryConnection.add( id, groupId, valueFactory.createLiteral( project.getGroupId() ) );
+                repositoryConnection.add( id, artifactId, valueFactory.createLiteral( project.getArtifactId() ) );
+                repositoryConnection.add( id, version, valueFactory.createLiteral( project.getVersion() ) );
+                repositoryConnection.add( id, artifactType, valueFactory.createLiteral( project.getArtifactType() ) );
+
+                BNode classifierNode = valueFactory.createBNode();
+                for ( Requirement requirement : project.getRequirements() )
+                {
+                    System.out.println( "Add requirement: " + requirement.getUri() );
+                    URI uri = valueFactory.createURI( requirement.getUri().toString() );
+                    repositoryConnection.add( classifierNode, uri,
+                                              valueFactory.createLiteral( requirement.getValue() ) );
+                }
+
+                repositoryConnection.add( id, classifier, classifierNode );
+
+                if ( project.getParentProject() != null )
+                {
+                    Project parentProject = project.getParentProject();
+                    URI pid = valueFactory.createURI( parentProject.getGroupId() + ":" + parentProject.getArtifactId() +
+                        ":" + parentProject.getVersion() );
+                    repositoryConnection.add( id, parent, pid );
+                    artifactDependencies.addAll(
+                        storeProjectAndResolveDependencies( parentProject, artifactRepositories ) );
+                }
+
+                for ( ProjectDependency projectDependency : project.getProjectDependencies() )
+                {
+                    System.out.println( "Project Dependency: Artifact ID = " + projectDependency.getArtifactId() +
+                        ", Group ID = " + projectDependency.getGroupId() + ", Version = " +
+                        projectDependency.getVersion() + ", Artifact Type = " + projectDependency.getArtifactType() );
+                    if ( !projectDependency.isResolved() )
+                    {
+                        try
+                        {
+                            Project dep = this.getProjectFor( projectDependency.getGroupId(),
+                                                              projectDependency.getArtifactId(),
+                                                              projectDependency.getVersion(),
+                                                              projectDependency.getArtifactType(),
+                                                              projectDependency.getPublicKeyTokenId() );
+                            if ( dep.isResolved() )
+                            {
+                                projectDependency = (ProjectDependency) dep;
+                                Artifact assembly =
+                                    ProjectFactory.createArtifactFrom( projectDependency, artifactFactory );
+                                artifactDependencies.add( assembly );
+                            }
+                        }
+                        catch ( IOException e )
+                        {
+                            e.printStackTrace();
+                            //safe to ignore: dependency not found
+                        }
+                    }
+
+                    if ( !projectDependency.isResolved() )
+                    {
+
+                        Artifact assembly = ProjectFactory.createArtifactFrom( projectDependency, artifactFactory );
+                        Artifact pomArtifact = artifactFactory.createProjectArtifact( projectDependency.getGroupId(),
+                                                                                      projectDependency.getArtifactId(),
+                                                                                      projectDependency.getVersion() );
+
+                        pomArtifact.setFile( File.createTempFile( "pomFile", "pom.xml" ) );
+
+                        try
+                        {
+                            wagonManager.getArtifact( pomArtifact, artifactRepositories );
+                            wagonManager.getArtifact( assembly, artifactRepositories );
+                        }
+                        catch ( TransferFailedException e )
+                        {
+                            throw new IOException(
+                                "NMAVEN-000-000: Problem in resolving artifact: Message = " + e.getMessage() );
+                        }
+                        catch ( ResourceDoesNotExistException e )
+                        {
+                            throw new IOException(
+                                "NMAVEN-000-000: Problem in resolving artifact: Message = " + e.getMessage() );
+                        }
+
+                        File pomArtifactFile = pomArtifact.getFile();
+                        FileReader fileReader = new FileReader( pomArtifactFile );
+
+                        MavenXpp3Reader reader = new MavenXpp3Reader();
+                        Model model;
+                        try
+                        {
+                            model = reader.read( fileReader );
+                        }
+                        catch ( XmlPullParserException e )
+                        {
+                            throw new IOException(
+                                "NMAVEN-000-000: Unable to read model: Message = " + e.getMessage() );
+
+                        }
+                        if ( !( model.getGroupId().equals( projectDependency.getGroupId() ) &&
+                            model.getArtifactId().equals( projectDependency.getArtifactId() ) &&
+                            model.getVersion().equals( projectDependency.getVersion() ) ) )
+                        {
+                            throw new IOException( "Model parameters do not match project dependencies parameters" );
+                        }
+                        modelDependencies.add( model );
+                        artifactDependencies.add( assembly );
+                    }//end if dependency not resolved
+                    //       BNode did = valueFactory.createBNode();
+                    URI did = valueFactory.createURI( projectDependency.getGroupId() + ":" +
+                        projectDependency.getArtifactId() + ":" + projectDependency.getVersion() );
+                    repositoryConnection.add( did, RDF.TYPE, artifact );
+                    repositoryConnection.add( did, groupId,
+                                              valueFactory.createLiteral( projectDependency.getGroupId() ) );
+                    repositoryConnection.add( did, artifactId,
+                                              valueFactory.createLiteral( projectDependency.getArtifactId() ) );
+                    repositoryConnection.add( did, version,
+                                              valueFactory.createLiteral( projectDependency.getVersion() ) );
+                    repositoryConnection.add( did, artifactType,
+                                              valueFactory.createLiteral( projectDependency.getArtifactType() ) );
+                    repositoryConnection.add( id, dependency, did );
+
+                }//end for
+                repositoryConnection.add( id, isResolved, valueFactory.createLiteral( true ) );
+                repositoryConnection.commit();
+            }
+            finally
+            {
+                repositoryConnection.close();
+            }
+        }
+        catch ( OpenRDFException e )
+        {
+            throw new IOException( "NMAVEN-000-000: Could not open RDF Repository: Message =" + e.getMessage() );
+        }
+
+        for ( Model model : modelDependencies )
+        {
+            System.out.println( "Storing dependency: Artifact Id = " + model.getArtifactId() );
+            artifactDependencies.addAll( storeProjectAndResolveDependencies(
+                ProjectFactory.createProjectFrom( model, null ), artifactRepositories ) );
+        }
+
+        return artifactDependencies;
+    }
+
+    public Set<Artifact> storeModelAndResolveDependencies( Model model, File pomFileDirectory,
+                                                           List<ArtifactRepository> artifactRepositories )
+        throws IOException
+    {
+        return storeProjectAndResolveDependencies( ProjectFactory.createProjectFrom( model, pomFileDirectory ),
+                                                   artifactRepositories );
+    }
+
+    public String getClassName()
+    {
+        return className;
+    }
+
+    public String getID()
+    {
+        return id;
+    }
+
+    public void init( Object dataStoreObject, String id, String className )
+        throws IllegalArgumentException
+    {
+        if ( dataStoreObject == null || !( dataStoreObject instanceof org.openrdf.repository.Repository ) )
+        {
+            throw new IllegalArgumentException(
+                "NMAVEN: Must initialize with an instance of org.openrdf.repository.Repository" );
+        }
+
+        this.id = id;
+        this.className = className;
+        this.rdfRepository = (org.openrdf.repository.Repository) dataStoreObject;
+    }
+
+    public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry )
+    {
+
+    }
+
+    protected void initForUnitTest( Object dataStoreObject, String id, String className, WagonManager wagonManager,
+                                    ArtifactFactory artifactFactory )
+    {
+        this.init( dataStoreObject, id, className );
+        this.wagonManager = wagonManager;
+        this.artifactFactory = artifactFactory;
+    }
+
+
+    private void addClassifiersToProject( Project project, RepositoryConnection repositoryConnection,
+                                          Value classifierUri )
+        throws RepositoryException, MalformedQueryException, QueryEvaluationException
+    {
+        String query = "SELECT * FROM {x} p {y}";
+        System.out.println( query );
+        TupleQuery tq = repositoryConnection.prepareTupleQuery( QueryLanguage.SERQL, query );
+        tq.setBinding( "x", classifierUri );
+        TupleQueryResult result = tq.evaluate();
+        while ( result.hasNext() )
+        {
+            BindingSet set = result.next();
+            for ( Iterator<Binding> i = set.iterator(); i.hasNext(); )
+            {
+                Binding binding = i.next();
+                System.out.println( "-" + binding.getName() + ":" + binding.getValue() );
+                if ( binding.getValue().toString().startsWith( "http://maven.apache.org/artifact/requirement" ) )
+                {
+                    try
+                    {
+                        project.addRequirement( Requirement.Factory.createDefaultRequirement(
+                            new java.net.URI( binding.getValue().toString() ), set.getValue( "y" ).toString() ) );
+                    }
+                    catch ( URISyntaxException e )
+                    {
+                        e.printStackTrace();
+                    }
+                }
+            }
+        }
+    }
+
+    private void addDependenciesToProject( Project project, RepositoryConnection repositoryConnection,
+                                           Value dependencyUri )
+        throws RepositoryException, MalformedQueryException, QueryEvaluationException
+    {
+        List<ProjectUri> projectUris = new ArrayList<ProjectUri>();
+        projectUris.add( ProjectUri.GROUP_ID );
+        projectUris.add( ProjectUri.ARTIFACT_ID );
+        projectUris.add( ProjectUri.VERSION );
+        projectUris.add( ProjectUri.ARTIFACT_TYPE );
+        projectUris.add( ProjectUri.IS_RESOLVED );
+        projectUris.add( ProjectUri.DEPENDENCY );
+
+        String query = "SELECT * FROM " + this.constructQueryFragmentFor( "{x}", projectUris );
+        System.out.println( query );
+
+        Set<ProjectDependency> projectDependencies = new HashSet<ProjectDependency>();
+        //  String dependencyQuery =
+        //      "SELECT DISTINCT * FROM {x} <http://maven.apache.org/artifact/groupId> {groupIdValue}; <http://maven.apache.org/artifact/artifactId> {artifactIdValue}; <http://maven.apache.org/artifact/version> {versionValue}";
+        TupleQuery tq = repositoryConnection.prepareTupleQuery( QueryLanguage.SERQL, query );
+        tq.setBinding( "x", dependencyUri );
+        TupleQueryResult dependencyResult = tq.evaluate();
+        while ( dependencyResult.hasNext() )
+        {
+            ProjectDependency projectDependency = new ProjectDependency();
+            BindingSet bs = dependencyResult.next();
+            projectDependency.setGroupId( bs.getBinding( ProjectUri.GROUP_ID.getObjectBinding() ).toString() );
+            projectDependency.setArtifactId( bs.getBinding( ProjectUri.ARTIFACT_ID.getObjectBinding() ).toString() );
+            projectDependency.setVersion( bs.getBinding( ProjectUri.VERSION.getObjectBinding() ).toString() );
+
+            projectDependencies.add( projectDependency );
+            if ( bs.hasBinding( ProjectUri.DEPENDENCY.getObjectBinding() ) )
+            {
+                addDependenciesToProject( projectDependency, repositoryConnection,
+                                          bs.getValue( ProjectUri.DEPENDENCY.getObjectBinding() ) );
+            }
+        }
+        project.setProjectDependencies( projectDependencies );
+    }
+
+    private String constructQueryFragmentFor( String subject, List<ProjectUri> projectUris )
+    {
+        // ProjectUri nonOptionalUri = this.getNonOptionalUriFrom( projectUris );
+        //   projectUris.remove( nonOptionalUri );
+
+        StringBuffer buffer = new StringBuffer();
+        buffer.append( subject );
+        for ( Iterator<ProjectUri> i = projectUris.iterator(); i.hasNext(); )
+        {
+            ProjectUri projectUri = i.next();
+            buffer.append( " " );
+            if ( projectUri.isOptional() )
+            {
+                buffer.append( "[" );
+            }
+            buffer.append( "<" ).append( projectUri.getPredicate() ).append( "> {" ).append(
+                projectUri.getObjectBinding() ).append( "}" );
+            if ( projectUri.isOptional() )
+            {
+                buffer.append( "]" );
+            }
+            if ( i.hasNext() )
+            {
+                buffer.append( ";" );
+            }
+        }
+        return buffer.toString();
+    }
+
+    private ProjectUri getNonOptionalUriFrom( List<ProjectUri> projectUris )
+    {
+        for ( ProjectUri projectUri : projectUris )
+        {
+            if ( !projectUri.isOptional() )
+            {
+                return projectUri;
+            }
+        }
+        return null;
+    }
+
+
+    private void mergeProjects( Project parent, Project child )
+    {
+
+    }
+}

Propchange: incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectFactory.java?view=auto&rev=555722
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectFactory.java (added)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectFactory.java Thu Jul 12 12:07:57 2007
@@ -0,0 +1,98 @@
+package org.apache.maven.dotnet.dao.impl;
+
+import org.apache.maven.dotnet.repository.Project;
+import org.apache.maven.dotnet.repository.ProjectDependency;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Parent;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.util.List;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.File;
+
+public class ProjectFactory
+{
+    public static Project createProjectFrom( Model model, File pomFileDirectory )
+        throws IOException
+    {
+        Project project = new Project();
+        project.setGroupId( model.getGroupId() );
+        project.setArtifactId( model.getArtifactId() );
+        project.setVersion( model.getVersion() );
+        project.setArtifactType( model.getPackaging() );
+        Parent parent = model.getParent();
+        if ( parent != null && pomFileDirectory != null)
+        {
+            String parentPomName = FileUtils.filename( parent.getRelativePath() );
+            File parentPomFile = new File( pomFileDirectory, parentPomName );
+            FileReader fileReader = new FileReader( parentPomFile );
+
+            MavenXpp3Reader reader = new MavenXpp3Reader();
+            Model parentModel;
+            try
+            {
+                parentModel = reader.read( fileReader );
+            }
+            catch ( XmlPullParserException e )
+            {
+                throw new IOException( "NMAVEN-000-000: Unable to read model: Message = " + e.getMessage() );
+
+            }
+            System.out.println("Pom File: " + pomFileDirectory.getAbsolutePath());
+            System.out.println("Parent: " + parentPomFile.getParentFile().getAbsolutePath());
+            Project parentProject = createProjectFrom( parentModel, parentPomFile.getParentFile() );
+            project.setParentProject( parentProject );
+        }
+
+        //TODO: publickey/classifier
+        List<Dependency> sourceArtifactDependencies = model.getDependencies();
+        for ( Dependency dependency : sourceArtifactDependencies )
+        {
+            project.addProjectDependency( createProjectDependencyFrom( dependency ) );
+        }
+        return project;
+    }
+
+    public static ProjectDependency createProjectDependencyFrom( Dependency dependency )
+    {
+        ProjectDependency projectDependency = new ProjectDependency();
+        projectDependency.setGroupId( dependency.getGroupId() );
+        projectDependency.setArtifactId( dependency.getArtifactId() );
+        projectDependency.setVersion( dependency.getVersion() );
+        projectDependency.setPublicKeyTokenId( dependency.getClassifier() );
+        projectDependency.setArtifactType( dependency.getType() );
+        return projectDependency;
+    }
+
+    public static Artifact createArtifactFrom( ProjectDependency projectDependency, ArtifactFactory artifactFactory )
+    {
+        String scope = ( projectDependency.getScope() == null ) ? Artifact.SCOPE_COMPILE : projectDependency.getScope();
+        Artifact assembly = artifactFactory.createDependencyArtifact( projectDependency.getGroupId(),
+                                                                      projectDependency.getArtifactId(),
+                                                                      VersionRange.createFromVersion(
+                                                                          projectDependency.getVersion() ),
+                                                                      projectDependency.getArtifactType(),
+                                                                      projectDependency.getPublicKeyTokenId(), scope,
+                                                                      null );
+
+        File artifactFile = ( ( projectDependency.getArtifactType().startsWith( "gac") ) ) ? new File(
+            "C:\\WINDOWS\\assembly\\gac_msil\\", projectDependency.getArtifactId() + "\\" +
+            projectDependency.getVersion() + "__" + projectDependency.getPublicKeyTokenId() + "\\" +
+            projectDependency.getArtifactId() + ".dll" ) : new File( System.getProperty( "user.home" ),
+                                                                     "\\.m2\\uac\\gac_msil\\" +
+                                                                         projectDependency.getArtifactId() + "\\" +
+                                                                         projectDependency.getVersion() + "__" +
+                                                                         projectDependency.getGroupId() + "\\" +
+                                                                         projectDependency.getArtifactId() + ".dll" );
+
+        assembly.setFile( artifactFile );
+        return assembly;
+    }
+}

Propchange: incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/resources/META-INF/plexus/components.xml?view=auto&rev=555722
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/resources/META-INF/plexus/components.xml (added)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/resources/META-INF/plexus/components.xml Thu Jul 12 12:07:57 2007
@@ -0,0 +1,16 @@
+<component-set>
+  <components>
+    <component>
+      <role>org.apache.maven.dotnet.dao.ProjectDao</role>
+      <implementation>org.apache.maven.dotnet.dao.impl.ProjectDaoImpl</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.artifact.manager.WagonManager</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
+        </requirement>
+      </requirements>
+    </component>
+  </components>
+</component-set>

Propchange: incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/test/java/org/apache/maven/dotnet/dao/impl/ArtifactFactoryTestStub.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/test/java/org/apache/maven/dotnet/dao/impl/ArtifactFactoryTestStub.java?view=auto&rev=555722
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/test/java/org/apache/maven/dotnet/dao/impl/ArtifactFactoryTestStub.java (added)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/test/java/org/apache/maven/dotnet/dao/impl/ArtifactFactoryTestStub.java Thu Jul 12 12:07:57 2007
@@ -0,0 +1,135 @@
+package org.apache.maven.dotnet.dao.impl;
+
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+import org.apache.maven.artifact.versioning.VersionRange;
+
+public class ArtifactFactoryTestStub
+    implements ArtifactFactory
+{
+
+    public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type )
+    {
+        return createArtifact( groupId, artifactId, version, scope, type, null, null );
+    }
+
+    public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type,
+                                                  String classifier )
+    {
+        return createArtifact( groupId, artifactId, version, null, type, classifier, null );
+    }
+
+    public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
+                                              String classifier, String scope )
+    {
+        return createArtifact( groupId, artifactId, versionRange, type, classifier, null, null );
+    }
+
+    public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
+                                              String classifier, String scope, boolean optional )
+    {
+        return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, null, optional );
+    }
+
+    public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
+                                              String classifier, String scope, String inheritedScope )
+    {
+        return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope );
+    }
+
+    public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
+                                              String classifier, String scope, String inheritedScope, boolean optional )
+    {
+        return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope, optional );
+    }
+
+    public Artifact createBuildArtifact( String groupId, String artifactId, String version, String packaging )
+    {
+        return createArtifact( groupId, artifactId, version, null, packaging, null, null );
+    }
+
+    public Artifact createProjectArtifact( String groupId, String artifactId, String version )
+    {
+        return createProjectArtifact( groupId, artifactId, version, null );
+    }
+
+    public Artifact createParentArtifact( String groupId, String artifactId, String version )
+    {
+        return createProjectArtifact( groupId, artifactId, version );
+    }
+
+    public Artifact createPluginArtifact( String groupId, String artifactId, VersionRange versionRange )
+    {
+        return createArtifact( groupId, artifactId, versionRange, "maven-plugin", null, Artifact.SCOPE_RUNTIME, null );
+    }
+
+    public Artifact createProjectArtifact( String groupId, String artifactId, String version, String scope )
+    {
+        return createArtifact( groupId, artifactId, version, scope, "pom" );
+    }
+
+    public Artifact createExtensionArtifact( String groupId, String artifactId, VersionRange versionRange )
+    {
+        return createArtifact( groupId, artifactId, versionRange, "jar", null, Artifact.SCOPE_RUNTIME, null );
+    }
+
+    private Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type,
+                                     String classifier, String inheritedScope )
+    {
+        VersionRange versionRange = null;
+        if ( version != null )
+        {
+            versionRange = VersionRange.createFromVersion( version );
+        }
+        return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope );
+    }
+
+    private Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
+                                     String classifier, String scope, String inheritedScope )
+    {
+        return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope, false );
+    }
+
+    private Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
+                                     String classifier, String scope, String inheritedScope, boolean optional )
+    {
+        // TODO: can refactor - inherited scope calculation belongs in the collector, use scope handler
+
+        String desiredScope = Artifact.SCOPE_RUNTIME;
+        if ( inheritedScope == null )
+        {
+            desiredScope = scope;
+        }
+        else if ( Artifact.SCOPE_TEST.equals( scope ) || Artifact.SCOPE_PROVIDED.equals( scope ) )
+        {
+            return null;
+        }
+        else if ( Artifact.SCOPE_COMPILE.equals( scope ) && Artifact.SCOPE_COMPILE.equals( inheritedScope ) )
+        {
+            // added to retain compile scope. Remove if you want compile inherited as runtime
+            desiredScope = Artifact.SCOPE_COMPILE;
+        }
+
+        if ( Artifact.SCOPE_TEST.equals( inheritedScope ) )
+        {
+            desiredScope = Artifact.SCOPE_TEST;
+        }
+
+        if ( Artifact.SCOPE_PROVIDED.equals( inheritedScope ) )
+        {
+            desiredScope = Artifact.SCOPE_PROVIDED;
+        }
+
+        if ( Artifact.SCOPE_SYSTEM.equals( scope ) )
+        {
+            // system scopes come through unchanged...
+            desiredScope = Artifact.SCOPE_SYSTEM;
+        }
+
+        return new DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type, classifier,
+                                    new DefaultArtifactHandler(type), optional );
+    }
+}

Propchange: incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/test/java/org/apache/maven/dotnet/dao/impl/ArtifactFactoryTestStub.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/test/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImplTest.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/test/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImplTest.java?view=auto&rev=555722
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/test/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImplTest.java (added)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/test/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImplTest.java Thu Jul 12 12:07:57 2007
@@ -0,0 +1,270 @@
+package org.apache.maven.dotnet.dao.impl;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.ArrayList;
+import java.net.URI;
+
+import org.openrdf.repository.sail.SailRepository;
+import org.openrdf.repository.RepositoryException;
+import org.openrdf.sail.memory.MemoryStore;
+import org.openrdf.sail.memory.MemoryStoreRDFSInferencer;
+import org.apache.maven.dotnet.repository.Project;
+import org.apache.maven.dotnet.repository.ProjectDependency;
+import org.apache.maven.dotnet.repository.Requirement;
+import org.apache.maven.dotnet.dao.ProjectDao;
+import org.apache.maven.dotnet.dao.ProjectUri;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.Artifact;
+
+public class ProjectDaoImplTest
+    extends TestCase
+{
+
+    private static File basedir = new File( System.getProperty( "basedir" ) );
+
+    public void testStore_WithRequirements()
+    {
+        ProjectDao dao = this.createProjectDao();
+
+        Project project = new Project();
+        project.setGroupId( "NMaven.Model" );
+        project.setArtifactId( "NMaven.Model.Pom" );
+        project.setVersion( "0.14.0.0" );
+        Set<Requirement> requirements = new HashSet<Requirement>();
+        try
+        {
+            requirements.add( Requirement.Factory.createDefaultRequirement( new URI( ProjectUri.VENDOR.getPredicate() ),
+                                                                            "MICROSOFT" ) );
+            requirements.add( Requirement.Factory.createDefaultRequirement(
+                new URI( ProjectUri.FRAMEWORK_VERSION.getPredicate() ), "2.0" ) );
+        }
+        catch ( Exception e )
+        {
+            e.printStackTrace();
+        }
+        project.setRequirements( requirements );
+
+        Set<Artifact> artifacts = null;
+        try
+        {
+            artifacts = dao.storeProjectAndResolveDependencies( project, new ArrayList<ArtifactRepository>() );
+        }
+        catch ( java.io.IOException e )
+        {
+            e.printStackTrace();
+            fail( "Could not store the project: " + e.getMessage() );
+        }
+
+        Project proj = null;
+        try
+        {
+            proj = dao.getProjectFor( "NMaven.Model", "NMaven.Model.Pom", "0.14.0.0", null, null );
+        }
+        catch ( java.io.IOException e )
+        {
+            e.printStackTrace();
+            fail( "Could not query the project: " + e.getMessage() );
+        }
+
+        requirements = proj.getRequirements();
+
+        assertEquals( "Incorrect number of requirements.", 2, requirements.size() );
+        assertTrue( "Could not find framework requirement",
+                    hasRequirement( ProjectUri.FRAMEWORK_VERSION.getPredicate(), "2.0", requirements ) );
+        assertTrue( "Could not find vendor requirement",
+                    hasRequirement( ProjectUri.VENDOR.getPredicate(), "MICROSOFT", requirements ) );
+    }
+
+    private boolean hasRequirement( String uri, String value, Set<Requirement> requirements )
+    {
+        for ( Requirement requirement : requirements )
+        {
+            if ( uri.equals( requirement.getUri().toString() ) && value.equals( requirement.getValue() ) )
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public void testSingleStore()
+    {
+        ProjectDao dao = this.createProjectDao();
+
+        Project project = new Project();
+        project.setGroupId( "NMaven.Model" );
+        project.setArtifactId( "NMaven.Model.Pom" );
+        project.setVersion( "0.14.0.0" );
+        Set<Artifact> artifacts = null;
+        try
+        {
+            artifacts = dao.storeProjectAndResolveDependencies( project, new ArrayList<ArtifactRepository>() );
+        }
+        catch ( java.io.IOException e )
+        {
+            e.printStackTrace();
+            fail( "Could not store the project: " + e.getMessage() );
+        }
+
+        Project proj = null;
+        try
+        {
+            proj = dao.getProjectFor( "NMaven.Model", "NMaven.Model.Pom", "0.14.0.0", null, null );
+        }
+        catch ( java.io.IOException e )
+        {
+            e.printStackTrace();
+            fail( "Could not query the project: " + e.getMessage() );
+        }
+
+        assertEquals( "Group IDs do not match", project.getGroupId(), proj.getGroupId() );
+        assertEquals( "Artifact IDs do not match", project.getArtifactId(), proj.getArtifactId() );
+        assertEquals( "Versions do not match", project.getVersion(), proj.getVersion() );
+
+        assertEquals( "Found dependency when there should be none", 0, artifacts.size() );
+    }
+
+    public void testSingleStore_WithIncorrectVersion()
+    {
+        ProjectDao dao = this.createProjectDao();
+
+        Project project = new Project();
+        project.setGroupId( "NMaven.Model" );
+        project.setArtifactId( "NMaven.Model.Pom" );
+        project.setVersion( "0.14.0.0" );
+        try
+        {
+            dao.storeProjectAndResolveDependencies( project, new ArrayList<ArtifactRepository>() );
+        }
+        catch ( java.io.IOException e )
+        {
+            e.printStackTrace();
+            fail( e.getMessage() );
+        }
+
+        try
+        {
+            Project proj = dao.getProjectFor( "NMaven.Model", "NMaven.Model.Pom", "0.15.0.0", null, null );
+        }
+        catch ( java.io.IOException e )
+        {
+            return;
+
+        }
+        fail( "Found project when none should exist." );
+    }
+/*
+    public void testAAA()
+    {
+
+        ProjectDao dao = this.createProjectDao();
+        Project project = new Project();
+        project.setArtifactId( "NMaven.Model.Pom" );
+        project.setGroupId( "NMaven.Model" );
+        project.setVersion( "0.14.0.0" );
+
+        Set<ProjectDependency> projectDependencies = new HashSet<ProjectDependency>();
+        projectDependencies.add( this.createProjectDependency( "NMaven", "NMaven.Test", "1.0.0" ) );
+        ProjectDependency pj2 = this.createProjectDependency( "NMaven", "NMaven.Test2", "1.0.0" );
+        pj2.addProjectDependency( this.createProjectDependency( "NMaven", "NMaven.Test3", "1.0.0" ) );
+        projectDependencies.add( pj2 );
+        project.setProjectDependencies( projectDependencies );
+
+        Set<Project> projects = new HashSet<Project>();
+        projects.add( project );
+
+        try
+        {
+            dao.storeProjectsAndResolveDependencies( projects, new ArrayList<ArtifactRepository>() );
+        }
+        catch ( java.io.IOException e )
+        {
+            e.printStackTrace();
+            fail( e.getMessage() );
+        }
+    }
+/*
+    public void testStore()
+    {
+        long start = System.currentTimeMillis();
+        File dataDir = new File( "c:\\tmp\\myRepository\\" );
+        org.openrdf.repository.Repository rdfRepository = new SailRepository( new MemoryStore( dataDir ) );
+        try
+        {
+            rdfRepository.initialize();
+        }
+        catch ( RepositoryException e )
+        {
+            e.printStackTrace();
+        }
+        System.out.println( "Time = " + ( System.currentTimeMillis() - start ) );
+        ProjectDaoImpl dao = new ProjectDaoImpl();
+        dao.init( rdfRepository, "", "" );
+
+        Project project = new Project();
+        project.setArtifactId( "NMaven.Model.Pom" );
+        project.setGroupId( "NMaven.Model" );
+        project.setVersion( "0.14.0.0" );
+
+        Set<ProjectDependency> projectDependencies = new HashSet<ProjectDependency>();
+        projectDependencies.add( this.createProjectDependency( "NMaven", "NMaven.Test", "1.0.0" ) );
+        ProjectDependency pj = this.createProjectDependency( "NMaven", "NMaven.Test2", "1.0.0" );
+        pj.addProjectDependency( this.createProjectDependency( "NMaven", "NMaven.Test3", "1.0.0" ));
+        projectDependencies.add( pj);
+        project.setProjectDependencies( projectDependencies );
+
+        Set<Project> projects = new HashSet<Project>();
+        projects.add( project );
+
+        dao.storeProjectsAndResolveDependencies( projects, new ArrayList<ArtifactRepository>() );
+
+        Project queriedProject = dao.getProjectFor( "", "", "" );
+        // queriedProject.setProjectDependencies( projectDependencies );
+
+        System.out.println( "Artifact ID = " + project.getArtifactId() );
+        for ( ProjectDependency projectDependency : project.getProjectDependencies() )
+        {
+            System.out.println( "PJ-1 = " + projectDependency.getArtifactId() );
+            for ( ProjectDependency dep : projectDependency.getProjectDependencies() )
+            {
+                System.out.println( "PJ-2 = " + dep.getArtifactId() );
+            }
+        }
+
+    }
+*/
+
+    private ProjectDependency createProjectDependency( String groupId, String artifactId, String version )
+    {
+        ProjectDependency projectDependency = new ProjectDependency();
+        projectDependency.setGroupId( groupId );
+        projectDependency.setArtifactId( artifactId );
+        projectDependency.setVersion( version );
+        return projectDependency;
+    }
+
+    private ProjectDao createProjectDao()
+    {
+        File dataDir = new File( basedir, ( "/target/rdf-repos/rdf-repo-" + System.currentTimeMillis() ) );
+        org.openrdf.repository.Repository rdfRepository =
+            new SailRepository( new MemoryStoreRDFSInferencer( new MemoryStore( dataDir ) ) );
+           // new SailRepository( new MemoryStoreRDFSInferencer( new MemoryStore( dataDir ) ) );
+        try
+        {
+            rdfRepository.initialize();
+        }
+        catch ( RepositoryException e )
+        {
+            return null;
+        }
+        ProjectDaoImpl dao = new ProjectDaoImpl();
+        WagonManagerTestStub stub = new WagonManagerTestStub();
+        stub.setBaseDir( basedir );
+        dao.initForUnitTest( rdfRepository, "", "", stub, new ArtifactFactoryTestStub() );
+        return dao;
+    }
+}

Propchange: incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/test/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native