incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r559413 - in /incubator/nmaven/branches/SI_GAC: ./ components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ components/dotnet-dao/project/src/ma...
Date Wed, 25 Jul 2007 12:06:17 GMT
Author: sisbell
Date: Wed Jul 25 05:06:16 2007
New Revision: 559413

URL: http://svn.apache.org/viewvc?view=rev&rev=559413
Log:
Optimized artifact resolving.

Modified:
    incubator/nmaven/branches/SI_GAC/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java
    incubator/nmaven/branches/SI_GAC/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/AssemblyResolverImpl.java
    incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectDao.java
    incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java
    incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/test/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImplTest.java
    incubator/nmaven/branches/SI_GAC/components/dotnet-jetty/src/main/java/org/apache/maven/dotnet/jetty/JettyStarter.java
    incubator/nmaven/branches/SI_GAC/plugins/maven-embedder-plugin/src/main/java/org/apache/maven/dotnet/plugin/embedder/EmbedderStarterMojo.java
    incubator/nmaven/branches/SI_GAC/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/FileInstallerMojo.java
    incubator/nmaven/branches/SI_GAC/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java
    incubator/nmaven/branches/SI_GAC/plugins/maven-resolver-plugin/src/main/java/org/apache/maven/dotnet/plugin/resolver/NetDependencyResolverMojo.java
    incubator/nmaven/branches/SI_GAC/plugins/maven-vsinstaller-plugin/src/main/java/org/apache/maven/dotnet/plugin/vsinstaller/VsInstallerMojo.java
    incubator/nmaven/branches/SI_GAC/plugins/maven-vsinstaller-plugin/src/main/resources/template/NMaven.VisualStudio.AddIn
    incubator/nmaven/branches/SI_GAC/pom.xml

Modified: incubator/nmaven/branches/SI_GAC/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java?view=diff&rev=559413&r1=559412&r2=559413
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java (original)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java Wed Jul 25 05:06:16 2007
@@ -305,7 +305,6 @@
                 ( ( artifact.getFile() != null ) ? artifact.getFile().getAbsolutePath() : "" ), e );
         }
 
-        ProjectDao dao = (ProjectDao) daoRegistry.find( "dao:project" );
         MavenXpp3Reader reader = new MavenXpp3Reader();
         Model model;
         try
@@ -320,7 +319,10 @@
         {
             throw new ArtifactInstallationException( "NMAVEN-002-013: Unable to read pom file" );
         }
-
+        //TODO: Add this back in: since this is already done in the resolve phase, don't redo it for perf reasons.
+        /*
+        ProjectDao dao = (ProjectDao) daoRegistry.find( "dao:project" );
+        dao.openConnection();
         try
         {
             dao.storeModelAndResolveDependencies( model, pomFile.getParentFile(), null,
@@ -330,6 +332,11 @@
         {
             throw new ArtifactInstallationException( e.getMessage() );
         }
+        finally
+        {
+            dao.closeConnection();
+        }
+        */
     }
 
     /**

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=559413&r1=559412&r2=559413
==============================================================================
--- 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 Wed Jul 25 05:06:16 2007
@@ -158,8 +158,7 @@
     {
         //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() );
@@ -202,6 +201,9 @@
                                                                                                           dependencies ) ) );
                 pd.addAll( subtractProjectDependencies( dependencies, projectDependencies ) );
         */
+        ProjectDao dao = (ProjectDao) daoRegistry.find( "dao:project" );
+        dao.init( artifactFactory, wagonManager );
+        dao.openConnection();
 
         Set<Artifact> artifactDependencies = new HashSet<Artifact>();
         try
@@ -212,6 +214,10 @@
         catch ( java.io.IOException e )
         {
             e.printStackTrace();
+        }
+        finally
+        {
+            dao.closeConnection();
         }
 
         //Resolve content

Modified: 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=diff&rev=559413&r1=559412&r2=559413
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectDao.java (original)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectDao.java Wed Jul 25 05:06:16 2007
@@ -43,4 +43,8 @@
 
     void init( ArtifactFactory artifactFactory, WagonManager wagonManager );
 
+    boolean openConnection();
+
+    boolean closeConnection(); 
+
 }

Modified: 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=diff&rev=559413&r1=559412&r2=559413
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java (original)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java Wed Jul 25 05:06:16 2007
@@ -46,6 +46,8 @@
 import java.io.FileReader;
 import java.net.URISyntaxException;
 
+import info.aduna.iteration.Iterations;
+
 public final class ProjectDaoImpl
     implements ProjectDao
 {
@@ -69,27 +71,76 @@
 
     private int storeCounter = 0;
 
+    private RepositoryConnection repositoryConnection;
+
+    private String dependencyQuery;
+
+    private String projectQuery;
+
     public void init( ArtifactFactory artifactFactory, WagonManager wagonManager )
     {
         this.artifactFactory = artifactFactory;
         this.wagonManager = wagonManager;
+
+        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 );
+
+        dependencyQuery = "SELECT * FROM " + this.constructQueryFragmentFor( "{x}", projectUris );
+
+        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 );
+
+        projectQuery = "SELECT * FROM " + this.constructQueryFragmentFor( "{x}", projectUris );
     }
 
-    public Project getProjectFor( String groupId, String artifactId, String version, String artifactType,
-                                  String publicKeyTokenId )
-        throws IOException
+    public boolean openConnection()
     {
-        long startTime = System.currentTimeMillis();
-
-        RepositoryConnection repositoryConnection;
         try
         {
             repositoryConnection = rdfRepository.getConnection();
+            repositoryConnection.setAutoCommit( false );
         }
         catch ( RepositoryException e )
         {
-            throw new IOException( e.getMessage() );
+            return false;
         }
+        return true;
+    }
+
+    public boolean closeConnection()
+    {
+        if ( repositoryConnection != null )
+        {
+            try
+            {
+                repositoryConnection.close();
+            }
+            catch ( RepositoryException e )
+            {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public Project getProjectFor( String groupId, String artifactId, String version, String artifactType,
+                                  String publicKeyTokenId )
+        throws IOException
+    {
+        long startTime = System.currentTimeMillis();
+
         ValueFactory valueFactory = rdfRepository.getValueFactory();
 
         Project project = new ProjectDependency();
@@ -99,30 +150,17 @@
         project.setArtifactType( artifactType );
         project.setPublicKeyTokenId( publicKeyTokenId );
 
+        TupleQueryResult result = null;
+
         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 tupleQuery = repositoryConnection.prepareTupleQuery( QueryLanguage.SERQL, projectQuery );
             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 ) );
-            //long startQueryTime = System.currentTimeMillis();
-            TupleQueryResult result = tupleQuery.evaluate();
-            //logger.info( "Get Project Query: Time = " + ( System.currentTimeMillis() - startQueryTime ) );
+            result = tupleQuery.evaluate();
+
             if ( !result.hasNext() )
             {
                 if ( artifactType != null && artifactType.startsWith( "gac" ) )
@@ -146,12 +184,13 @@
             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" ) )
                 {
@@ -196,17 +235,21 @@
         }
         finally
         {
-            try
-            {
-                repositoryConnection.close();
-            }
-            catch ( RepositoryException e )
+            if ( result != null )
             {
-                e.printStackTrace();
+                try
+                {
+                    result.close();
+                }
+                catch ( QueryEvaluationException e )
+                {
+
+                }
             }
         }
+
         //TODO: If has parent, then need to modify dependencies, etc of returned project
-        logger.info( "ProjectDao.GetProjectFor - Artifact Id = " + project.getArtifactId() + ", Time = " +
+        logger.finest( "ProjectDao.GetProjectFor - Artifact Id = " + project.getArtifactId() + ", Time = " +
             ( System.currentTimeMillis() - startTime ) + ",  Count = " + getProjectForCounter++ );
         return project;
     }
@@ -262,156 +305,158 @@
         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() ) );
+            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() ) );
-                }
+            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 );
+            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, null, artifactRepositories ) );
-                }
+            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, null, artifactRepositories ) );
+            }
 
-                for ( ProjectDependency projectDependency : project.getProjectDependencies() )
+            for ( ProjectDependency projectDependency : project.getProjectDependencies() )
+            {
+                logger.finest( "Project Dependency: Artifact ID = " + projectDependency.getArtifactId() +
+                    ", Group ID = " + projectDependency.getGroupId() + ", Version = " + projectDependency.getVersion() +
+                    ", Artifact Type = " + projectDependency.getArtifactType() );
+                if ( !projectDependency.isResolved() )
                 {
-                    System.out.println( "Project Dependency: Artifact ID = " + projectDependency.getArtifactId() +
-                        ", Group ID = " + projectDependency.getGroupId() + ", Version = " +
-                        projectDependency.getVersion() + ", Artifact Type = " + projectDependency.getArtifactType() );
-                    if ( !projectDependency.isResolved() )
+                    if ( projectDependency.getArtifactType().startsWith( "gac" ) )
                     {
-                        if ( projectDependency.getArtifactType().startsWith( "gac" ) )
-                        {
-                            projectDependency.setResolved( true );
-                            artifactDependencies.add(
-                                ProjectFactory.createArtifactFrom( projectDependency, artifactFactory ) );
-                        }
-                        else
+                        projectDependency.setResolved( true );
+                        artifactDependencies.add(
+                            ProjectFactory.createArtifactFrom( projectDependency, artifactFactory ) );
+                    }
+                    else
+                    {
+                        try
                         {
-                            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 );
-                                    artifactDependencies.addAll( this.storeProjectAndResolveDependencies(
-                                        projectDependency, null, artifactRepositories ) );
-                                }
-                            }
-                            catch ( IOException e )
+                            Project dep = this.getProjectFor( projectDependency.getGroupId(),
+                                                              projectDependency.getArtifactId(),
+                                                              projectDependency.getVersion(),
+                                                              projectDependency.getArtifactType(),
+                                                              projectDependency.getPublicKeyTokenId() );
+                            if ( dep.isResolved() )
                             {
-                                //e.printStackTrace();
-                                //safe to ignore: dependency not found
+                                projectDependency = (ProjectDependency) dep;
+                                Artifact assembly =
+                                    ProjectFactory.createArtifactFrom( projectDependency, artifactFactory );
+                                artifactDependencies.add( assembly );
+
+                                //repositoryConnection.commit();
+                                artifactDependencies.addAll( this.storeProjectAndResolveDependencies( projectDependency,
+                                                                                                      null,
+                                                                                                      artifactRepositories ) );
                             }
                         }
+                        catch ( IOException e )
+                        {
+                            //e.printStackTrace();
+                            //safe to ignore: dependency not found
+                        }
                     }
+                }
 
-                    if ( !projectDependency.isResolved() )
-                    {
+                if ( !projectDependency.isResolved() )
+                {
 
-                        Artifact assembly = ProjectFactory.createArtifactFrom( projectDependency, artifactFactory );
-                        Artifact pomArtifact = artifactFactory.createProjectArtifact( projectDependency.getGroupId(),
-                                                                                      projectDependency.getArtifactId(),
-                                                                                      projectDependency.getVersion() );
+                    Artifact assembly = ProjectFactory.createArtifactFrom( projectDependency, artifactFactory );
+                    Artifact pomArtifact = artifactFactory.createProjectArtifact( projectDependency.getGroupId(),
+                                                                                  projectDependency.getArtifactId(),
+                                                                                  projectDependency.getVersion() );
 
-                        pomArtifact.setFile( File.createTempFile( "pomFile", "pom.xml" ) );
+                    pomArtifact.setFile( File.createTempFile( "pomFile", "pom.xml" ) );
 
-                        try
-                        {
-                            logger.info( "NMAVEN-000-000: Retrieving artifact: Artifact ID  = " +
-                                projectDependency.getArtifactId() );
-                            wagonManager.getArtifact( pomArtifact, artifactRepositories );
-                            wagonManager.getArtifact( assembly, artifactRepositories );
-                        }
-                        catch ( TransferFailedException e )
-                        {
-                            throw new IOException(
-                                "NMAVEN-000-000: Problem in resolving artifact: Assembly Artifact Id = " +
-                                    assembly.getArtifactId() + ", Message = " + e.getMessage() );
-                        }
-                        catch ( ResourceDoesNotExistException e )
-                        {
-                            throw new IOException(
-                                "NMAVEN-000-000: Problem in resolving artifact: Assembly Artifact Id = " +
-                                    assembly.getArtifactId() + ", Message = " + e.getMessage() );
-                        }
+                    try
+                    {
+                        logger.info( "NMAVEN-000-000: Retrieving artifact: Artifact ID  = " +
+                            projectDependency.getArtifactId() );
+                        wagonManager.getArtifact( pomArtifact, artifactRepositories );
+                        wagonManager.getArtifact( assembly, artifactRepositories );
+                    }
+                    catch ( TransferFailedException e )
+                    {
+                        throw new IOException(
+                            "NMAVEN-000-000: Problem in resolving artifact: Assembly Artifact Id = " +
+                                assembly.getArtifactId() + ", Message = " + e.getMessage() );
+                    }
+                    catch ( ResourceDoesNotExistException e )
+                    {
+                        throw new IOException(
+                            "NMAVEN-000-000: Problem in resolving artifact: Assembly Artifact Id = " +
+                                assembly.getArtifactId() + ", Message = " + e.getMessage() );
+                    }
 
-                        File pomArtifactFile = pomArtifact.getFile();
-                        FileReader fileReader = new FileReader( pomArtifactFile );
+                    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() );
+                    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();
-            }
+                    }
+                    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();
         }
         catch ( OpenRDFException e )
         {
+            if ( repositoryConnection != null )
+            {
+                try
+                {
+                    repositoryConnection.rollback();
+                }
+                catch ( RepositoryException e1 )
+                {
+
+                }
+            }
             throw new IOException( "NMAVEN-000-000: Could not open RDF Repository: Message =" + e.getMessage() );
         }
 
@@ -421,7 +466,7 @@
             artifactDependencies.addAll( storeProjectAndResolveDependencies(
                 ProjectFactory.createProjectFrom( model, null ), localRepository, artifactRepositories ) );
         }
-        logger.info( "ProjectDao.storeProjectAndResolveDependencies - Artifact Id = " + project.getArtifactId() +
+        logger.finest( "ProjectDao.storeProjectAndResolveDependencies - Artifact Id = " + project.getArtifactId() +
             ", Time = " + ( System.currentTimeMillis() - startTime ) + ", Count = " + storeCounter++ );
         return artifactDependencies;
     }
@@ -468,8 +513,7 @@
                                     ArtifactFactory artifactFactory )
     {
         this.init( dataStoreObject, id, className );
-        this.wagonManager = wagonManager;
-        this.artifactFactory = artifactFactory;
+        init(artifactFactory, wagonManager);
     }
 
 
@@ -510,41 +554,37 @@
                                            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 );
-
         Set<ProjectDependency> projectDependencies = new HashSet<ProjectDependency>();
-        TupleQuery tq = repositoryConnection.prepareTupleQuery( QueryLanguage.SERQL, query );
+        TupleQuery tq = repositoryConnection.prepareTupleQuery( QueryLanguage.SERQL, dependencyQuery );
         tq.setBinding( "x", dependencyUri );
-        //long startQueryTime = System.currentTimeMillis();
+
         TupleQueryResult dependencyResult = tq.evaluate();
-        //logger.info( "Query Dependencies: Time = " + ( System.currentTimeMillis() - startQueryTime ) );
-        while ( dependencyResult.hasNext() )
+        try
         {
-            ProjectDependency projectDependency = new ProjectDependency();
-            BindingSet bs = dependencyResult.next();
-            projectDependency.setGroupId(
-                bs.getBinding( ProjectUri.GROUP_ID.getObjectBinding() ).getValue().toString() );
-            projectDependency.setArtifactId(
-                bs.getBinding( ProjectUri.ARTIFACT_ID.getObjectBinding() ).getValue().toString() );
-            projectDependency.setVersion(
-                bs.getBinding( ProjectUri.VERSION.getObjectBinding() ).getValue().toString() );
-
-            projectDependencies.add( projectDependency );
-            if ( bs.hasBinding( ProjectUri.DEPENDENCY.getObjectBinding() ) )
+            while ( dependencyResult.hasNext() )
             {
-                addDependenciesToProject( projectDependency, repositoryConnection,
-                                          bs.getValue( ProjectUri.DEPENDENCY.getObjectBinding() ) );
+                ProjectDependency projectDependency = new ProjectDependency();
+                BindingSet bs = dependencyResult.next();
+                projectDependency.setGroupId(
+                    bs.getBinding( ProjectUri.GROUP_ID.getObjectBinding() ).getValue().toString() );
+                projectDependency.setArtifactId(
+                    bs.getBinding( ProjectUri.ARTIFACT_ID.getObjectBinding() ).getValue().toString() );
+                projectDependency.setVersion(
+                    bs.getBinding( ProjectUri.VERSION.getObjectBinding() ).getValue().toString() );
+
+                projectDependencies.add( projectDependency );
+                if ( bs.hasBinding( ProjectUri.DEPENDENCY.getObjectBinding() ) )
+                {
+                    addDependenciesToProject( projectDependency, repositoryConnection,
+                                              bs.getValue( ProjectUri.DEPENDENCY.getObjectBinding() ) );
+                }
             }
+            project.setProjectDependencies( projectDependencies );
+        }
+        finally
+        {
+            dependencyResult.close();
         }
-        project.setProjectDependencies( projectDependencies );
     }
 
     private String constructQueryFragmentFor( String subject, List<ProjectUri> projectUris )

Modified: 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=diff&rev=559413&r1=559412&r2=559413
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/test/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImplTest.java (original)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-dao/project/src/test/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImplTest.java Wed Jul 25 05:06:16 2007
@@ -78,6 +78,7 @@
                     hasRequirement( ProjectUri.FRAMEWORK_VERSION.getPredicate(), "2.0", requirements ) );
         assertTrue( "Could not find vendor requirement",
                     hasRequirement( ProjectUri.VENDOR.getPredicate(), "MICROSOFT", requirements ) );
+        dao.closeConnection();
     }
 
     private boolean hasRequirement( String uri, String value, Set<Requirement> requirements )
@@ -153,6 +154,7 @@
         assertTrue( "Could not find required dependency. Found Dependency: GroupId = " +
             projectDependency.getGroupId() + ", Artifact Id = " + projectDependency.getArtifactId(),
                     this.hasDependency( "NMaven", "NMaven.Test4", "1.0.0", projectDependencies ) );
+        dao.closeConnection();
     }
 
     public void testStoreTransitiveDependency()
@@ -198,6 +200,7 @@
         assertTrue( "Could not find required dependency. Found Dependency: GroupId = " +
             projectDependency.getGroupId() + ", Artifact Id = " + projectDependency.getArtifactId(),
                     this.hasDependency( "NMaven", "NMaven.Test3", "1.0.0", projectDependencies ) );
+        dao.closeConnection();
     }
 
     public void testSingleStore()
@@ -235,6 +238,7 @@
         assertEquals( "Versions do not match", project.getVersion(), proj.getVersion() );
 
         assertEquals( "Found dependency when there should be none", 0, artifacts.size() );
+        dao.closeConnection();
     }
 
     public void testSingleStore_WithIncorrectVersion()
@@ -248,6 +252,7 @@
         try
         {
             dao.storeProjectAndResolveDependencies( project, null, new ArrayList<ArtifactRepository>() );
+
         }
         catch ( java.io.IOException e )
         {
@@ -264,6 +269,7 @@
             return;
 
         }
+        dao.closeConnection();
         fail( "Found project when none should exist." );
     }
 /*
@@ -369,10 +375,11 @@
         {
             return null;
         }
-        ProjectDaoImpl dao = new ProjectDaoImpl();
+        ProjectDaoImpl dao = new ProjectDaoImpl();        
         WagonManagerTestStub stub = new WagonManagerTestStub();
         stub.setBaseDir( basedir );
         dao.initForUnitTest( rdfRepository, "", "", stub, new ArtifactFactoryTestStub() );
+        dao.openConnection();
         return dao;
     }
 }

Modified: incubator/nmaven/branches/SI_GAC/components/dotnet-jetty/src/main/java/org/apache/maven/dotnet/jetty/JettyStarter.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/components/dotnet-jetty/src/main/java/org/apache/maven/dotnet/jetty/JettyStarter.java?view=diff&rev=559413&r1=559412&r2=559413
==============================================================================
--- incubator/nmaven/branches/SI_GAC/components/dotnet-jetty/src/main/java/org/apache/maven/dotnet/jetty/JettyStarter.java (original)
+++ incubator/nmaven/branches/SI_GAC/components/dotnet-jetty/src/main/java/org/apache/maven/dotnet/jetty/JettyStarter.java Wed Jul 25 05:06:16 2007
@@ -20,7 +20,7 @@
     {
         try
         {
-            logger.addHandler( new FileHandler(System.getProperty( "user.home" ) + "\\.m2\\jetty-log.xml" ) );
+            logger.addHandler( new FileHandler(System.getProperty( "user.home" ) + "\\.m2\\embedder-logs\\jetty-log.xml" ) );
         }
         catch ( IOException e )
         {

Modified: incubator/nmaven/branches/SI_GAC/plugins/maven-embedder-plugin/src/main/java/org/apache/maven/dotnet/plugin/embedder/EmbedderStarterMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/plugins/maven-embedder-plugin/src/main/java/org/apache/maven/dotnet/plugin/embedder/EmbedderStarterMojo.java?view=diff&rev=559413&r1=559412&r2=559413
==============================================================================
--- incubator/nmaven/branches/SI_GAC/plugins/maven-embedder-plugin/src/main/java/org/apache/maven/dotnet/plugin/embedder/EmbedderStarterMojo.java (original)
+++ incubator/nmaven/branches/SI_GAC/plugins/maven-embedder-plugin/src/main/java/org/apache/maven/dotnet/plugin/embedder/EmbedderStarterMojo.java Wed Jul 25 05:06:16 2007
@@ -132,7 +132,7 @@
         try
         {
             logger.addHandler(
-                new FileHandler( System.getProperty( "user.home" ) + "\\.m2\\nmaven-embedder-log.xml" ) );
+                new FileHandler( System.getProperty( "user.home" ) + "\\.m2\\embedder-logs\\nmaven-embedder-log.xml" ) );
         }
         catch ( IOException e )
         {
@@ -178,7 +178,7 @@
 
         Set<Artifact> artifactDependencies = new HashSet<Artifact>();
         Artifact artifact = artifactFactory.createDependencyArtifact( "org.mortbay.jetty", "jetty-embedded",
-                                                                      VersionRange.createFromVersion( "6.1.3" ), "jar",
+                                                                      VersionRange.createFromVersion( "6.1.5" ), "jar",
                                                                       null, "runtime", null );
         logger.info( "NMAVEN-000-000: Dependency: Type  = " + artifact.getType() + ", Artifact ID = " +
             artifact.getArtifactId() );

Modified: incubator/nmaven/branches/SI_GAC/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/FileInstallerMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/FileInstallerMojo.java?view=diff&rev=559413&r1=559412&r2=559413
==============================================================================
--- incubator/nmaven/branches/SI_GAC/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/FileInstallerMojo.java (original)
+++ incubator/nmaven/branches/SI_GAC/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/FileInstallerMojo.java Wed Jul 25 05:06:16 2007
@@ -121,6 +121,7 @@
     {
         ProjectDao dao = (ProjectDao) daoRegistry.find( "dao:project" );
         dao.init( artifactFactory, wagonManager );
+        dao.openConnection();
 
         artifactContext.init( project, project.getRemoteArtifactRepositories(), localRepository );
         if ( pomFile != null && !pomFile.exists() )

Modified: incubator/nmaven/branches/SI_GAC/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java?view=diff&rev=559413&r1=559412&r2=559413
==============================================================================
--- incubator/nmaven/branches/SI_GAC/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java (original)
+++ incubator/nmaven/branches/SI_GAC/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java Wed Jul 25 05:06:16 2007
@@ -139,6 +139,7 @@
 
         ProjectDao dao = (ProjectDao) daoRegistry.find( "dao:project" );
         dao.init( artifactFactory, wagonManager );
+        dao.openConnection();
 
         artifactContext.init( project, project.getRemoteArtifactRepositories(), localRepository );
         if ( project.getPackaging().equals( "pom" ) )

Modified: incubator/nmaven/branches/SI_GAC/plugins/maven-resolver-plugin/src/main/java/org/apache/maven/dotnet/plugin/resolver/NetDependencyResolverMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/plugins/maven-resolver-plugin/src/main/java/org/apache/maven/dotnet/plugin/resolver/NetDependencyResolverMojo.java?view=diff&rev=559413&r1=559412&r2=559413
==============================================================================
--- incubator/nmaven/branches/SI_GAC/plugins/maven-resolver-plugin/src/main/java/org/apache/maven/dotnet/plugin/resolver/NetDependencyResolverMojo.java (original)
+++ incubator/nmaven/branches/SI_GAC/plugins/maven-resolver-plugin/src/main/java/org/apache/maven/dotnet/plugin/resolver/NetDependencyResolverMojo.java Wed Jul 25 05:06:16 2007
@@ -31,6 +31,8 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.util.List;
 import java.util.ArrayList;
 
@@ -42,6 +44,7 @@
 import org.apache.maven.dotnet.executable.NetExecutable;
 import org.apache.maven.dotnet.executable.ExecutionException;
 import org.apache.maven.dotnet.PlatformUnsupportedException;
+import org.codehaus.plexus.util.FileUtils;
 
 /**
  * @author Shane Isbell
@@ -163,22 +166,54 @@
         }
 
         artifactContext.init( project, project.getRemoteArtifactRepositories(), new File( localRepository ) );
-        try
-        {
-            artifactContext.getArtifactInstaller().resolveAndInstallNetDependenciesForProfile( profile,
-                                                                                               dependencies );
-        }
-        catch ( ArtifactResolutionException e )
-        {
-            throw new MojoExecutionException( "NMAVEN-1600-003: Unable to resolve assemblies", e );
-        }
-        catch ( ArtifactNotFoundException e )
-        {
-            throw new MojoExecutionException( "NMAVEN-1600-003: Unable to resolve assemblies", e );
-        }
-        catch ( ArtifactInstallationException e )
+        if ( !new File( localRepository, "nmaven.artifacts.resolved" ).exists() ) //performance optimization
         {
-            throw new MojoExecutionException( "NMAVEN-1600-003: Unable to resolve assemblies", e );
+            try
+            {
+                artifactContext.getArtifactInstaller().resolveAndInstallNetDependenciesForProfile( profile,
+                                                                                                   dependencies );
+            }
+            catch ( ArtifactResolutionException e )
+            {
+                throw new MojoExecutionException( "NMAVEN-1600-003: Unable to resolve assemblies", e );
+            }
+            catch ( ArtifactNotFoundException e )
+            {
+                throw new MojoExecutionException( "NMAVEN-1600-003: Unable to resolve assemblies", e );
+            }
+            catch ( ArtifactInstallationException e )
+            {
+                throw new MojoExecutionException( "NMAVEN-1600-003: Unable to resolve assemblies", e );
+            }
+
+            new File( localRepository, "nmaven.artifacts.resolved" ).mkdir();
+            /*
+            FileOutputStream fos = null;
+            try
+            {
+                new File( localRepository, "nmaven.artifacts.resolved" ).mkdir();
+                //fos = new FileOutputStream( new File( localRepository, "nmaven.artifacts.resolved" ) );
+                //fos.write( 0 );
+            }
+            catch ( IOException e )
+            {
+
+            }
+            finally
+            {
+                if ( fos != null )
+                {
+                    try
+                    {
+                        fos.close();
+                    }
+                    catch ( IOException e )
+                    {
+
+                    }
+                }
+            }
+            */
         }
 
         //Do GAC Install, if needed

Modified: incubator/nmaven/branches/SI_GAC/plugins/maven-vsinstaller-plugin/src/main/java/org/apache/maven/dotnet/plugin/vsinstaller/VsInstallerMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/plugins/maven-vsinstaller-plugin/src/main/java/org/apache/maven/dotnet/plugin/vsinstaller/VsInstallerMojo.java?view=diff&rev=559413&r1=559412&r2=559413
==============================================================================
--- incubator/nmaven/branches/SI_GAC/plugins/maven-vsinstaller-plugin/src/main/java/org/apache/maven/dotnet/plugin/vsinstaller/VsInstallerMojo.java (original)
+++ incubator/nmaven/branches/SI_GAC/plugins/maven-vsinstaller-plugin/src/main/java/org/apache/maven/dotnet/plugin/vsinstaller/VsInstallerMojo.java Wed Jul 25 05:06:16 2007
@@ -191,8 +191,9 @@
                 outputFile.getParentFile().mkdir();
             }
             writer = new OutputStreamWriter( new FileOutputStream( outputFile ), "Unicode" );
+            String pab = new File(localRepository).getParent() + "\\pab";
             writer.write(
-                addin.replaceAll( "\\$\\{localRepository\\}", localRepository.replaceAll( "\\\\", "\\\\\\\\" ) ) );
+                addin.replaceAll( "\\$\\{localRepository\\}", pab.replaceAll( "\\\\", "\\\\\\\\" ) ) );
 
         }
         catch ( IOException e )

Modified: incubator/nmaven/branches/SI_GAC/plugins/maven-vsinstaller-plugin/src/main/resources/template/NMaven.VisualStudio.AddIn
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/plugins/maven-vsinstaller-plugin/src/main/resources/template/NMaven.VisualStudio.AddIn?view=diff&rev=559413&r1=559412&r2=559413
==============================================================================
--- incubator/nmaven/branches/SI_GAC/plugins/maven-vsinstaller-plugin/src/main/resources/template/NMaven.VisualStudio.AddIn (original)
+++ incubator/nmaven/branches/SI_GAC/plugins/maven-vsinstaller-plugin/src/main/resources/template/NMaven.VisualStudio.AddIn Wed Jul 25 05:06:16 2007
@@ -5,7 +5,7 @@
     <Version>8.0</Version>
   </HostApplication>
   <Addin>
-    <Assembly>${localRepository}\NMaven\VisualStudio\NMaven.VisualStudio.Addin\0.14\NMaven.VisualStudio.Addin.dll</Assembly>
+    <Assembly>${localRepository}\gac_msil\NMaven.VisualStudio.Addin\0.14__NMaven.VisualStudio\NMaven.VisualStudio.Addin.dll</Assembly>
     <FullClassName>NMaven.VisualStudio.Addin.Connect</FullClassName>
     <FriendlyName>NMaven.VisualStudio.Addin</FriendlyName>
     <Description>NMaven provides Maven 2.x plugins to support building of .NET applications</Description>

Modified: incubator/nmaven/branches/SI_GAC/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_GAC/pom.xml?view=diff&rev=559413&r1=559412&r2=559413
==============================================================================
--- incubator/nmaven/branches/SI_GAC/pom.xml (original)
+++ incubator/nmaven/branches/SI_GAC/pom.xml Wed Jul 25 05:06:16 2007
@@ -226,7 +226,7 @@
   </dependencies>
   <properties>
     <mavenVersion>2.1-SNAPSHOT</mavenVersion>
-    <jettyVersion>6.1.3</jettyVersion>
+    <jettyVersion>6.1.5</jettyVersion>
     <xfireVersion>1.2.5</xfireVersion>
   </properties>
   <dependencyManagement>



Mime
View raw message