[NPANDAY-231] Remove RDF repository and model
RE Added some repository converter, after continued work on the removal of the model it was still looking up for a repository convert, changed implementation from using rdf.
git-svn-id: https://svn.apache.org/repos/asf/incubator/npanday/branches/rdf-model-removal@1080100 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/components/dotnet-artifact/src/main/java/npanday/artifact/impl/AssemblyResolverImpl.java b/components/dotnet-artifact/src/main/java/npanday/artifact/impl/AssemblyResolverImpl.java
index 556e29e..760666d 100644
--- a/components/dotnet-artifact/src/main/java/npanday/artifact/impl/AssemblyResolverImpl.java
+++ b/components/dotnet-artifact/src/main/java/npanday/artifact/impl/AssemblyResolverImpl.java
@@ -122,7 +122,8 @@
}
ProjectDao dao = (ProjectDao) daoRegistry.find( "dao:project" );
- dao.init( artifactFactory, artifactResolver );
+
+ dao.init( artifactFactory, artifactResolver );
Set<Artifact> artifactDependencies = new HashSet<Artifact>();
try
diff --git a/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java b/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java
index 8d77a94..3740c2d 100644
--- a/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java
+++ b/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java
@@ -48,7 +48,7 @@
import org.codehaus.plexus.util.cli.DefaultConsumer;
import org.codehaus.plexus.util.cli.StreamConsumer;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import org.openrdf.OpenRDFException;
+/*import org.openrdf.OpenRDFException;
import org.openrdf.model.URI;
import org.openrdf.model.Value;
import org.openrdf.model.ValueFactory;
@@ -63,7 +63,7 @@
import org.openrdf.repository.Repository;
import org.openrdf.repository.RepositoryConnection;
import org.openrdf.repository.RepositoryException;
-import org.w3c.dom.Document;
+*/import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -106,26 +106,17 @@
private int storeCounter = 0;
- private RepositoryConnection repositoryConnection;
-
private String dependencyQuery;
private String projectQuery;
private ArtifactResolver artifactResolver;
- public void init( Object dataStoreObject, String id, String className )
+ public void init( String id, String className )
throws IllegalArgumentException
- {
- if ( dataStoreObject == null || !( dataStoreObject instanceof org.openrdf.repository.Repository ) )
- {
- throw new IllegalArgumentException(
- "NPANDAY-180-023: Must initialize with an instance of org.openrdf.repository.Repository" );
- }
-
+ {
this.id = id;
- this.className = className;
- this.rdfRepository = (org.openrdf.repository.Repository) dataStoreObject;
+ this.className = className;
}
public void init( ArtifactFactory artifactFactory, ArtifactResolver artifactResolver)
@@ -133,36 +124,13 @@
this.artifactFactory = artifactFactory;
this.artifactResolver = artifactResolver;
this.className = className;
-
- 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 );
-
- 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 Set<Project> getAllProjects()
throws IOException
{
Set<Project> projects = new HashSet<Project>();
- TupleQueryResult result = null;
+ /* TupleQueryResult result = null;
try
{
TupleQuery tupleQuery = repositoryConnection.prepareTupleQuery( QueryLanguage.SERQL, projectQuery );
@@ -182,10 +150,7 @@
}
// Project project = getProjectFor( groupId, artifactId, version, artifactType, null );
- /*
- * for ( Iterator<Binding> i = set.iterator(); i.hasNext(); ) { Binding b = i.next();
- * System.out.println( b.getName() + ":" + b.getValue() ); }
- */
+
projects.add( getProjectFor( groupId, artifactId, version, artifactType, classifier ) );
}
}
@@ -215,53 +180,17 @@
}
}
}
+ */
+
+ //Implement a new getAllProjects
return projects;
}
- public void setRdfRepository( Repository repository )
- {
- this.rdfRepository = repository;
- }
-
- public boolean openConnection()
- {
- try
- {
- repositoryConnection = rdfRepository.getConnection();
- repositoryConnection.setAutoCommit( false );
- }
- catch ( RepositoryException e )
- {
- return false;
- }
-
- return true;
- }
-
- public boolean closeConnection()
- {
-
- if ( repositoryConnection != null )
- {
- try
- {
- repositoryConnection.commit();
- repositoryConnection.close();
- }
- catch ( RepositoryException e )
- {
- return false;
- }
- }
-
- return true;
- }
-
public void removeProjectFor( String groupId, String artifactId, String version, String artifactType )
throws IOException
{
- ValueFactory valueFactory = rdfRepository.getValueFactory();
+ /* ValueFactory valueFactory = rdfRepository.getValueFactory();
URI id = valueFactory.createURI( groupId + ":" + artifactId + ":" + version + ":" + artifactType );
try
{
@@ -271,6 +200,9 @@
{
throw new IOException( e.getMessage() );
}
+ */
+
+ //Investigate behavior of removeProjectFor and Implment
}
public Project getProjectFor( String groupId, String artifactId, String version, String artifactType,
@@ -278,8 +210,6 @@
throws IOException
{
long startTime = System.currentTimeMillis();
-
- ValueFactory valueFactory = rdfRepository.getValueFactory();
ProjectDependency project = new ProjectDependency();
project.setArtifactId( artifactId );
@@ -807,118 +737,11 @@
init( artifactFactory, artifactResolver );
}
- private void addClassifiersToProject( Project project, RepositoryConnection repositoryConnection,
- Value classifierUri )
- throws RepositoryException, MalformedQueryException, QueryEvaluationException
+ private void addDependenciesToProject( Project project )
{
- String query = "SELECT * FROM {x} p {y}";
- 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();
- 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();
- }
- }
- }
- }
+ //Implement new way on how to get and add the project dependencies
}
- private void addDependenciesToProject( Project project, RepositoryConnection repositoryConnection,
- Value dependencyUri )
- throws RepositoryException, MalformedQueryException, QueryEvaluationException
- {
- TupleQuery tq = repositoryConnection.prepareTupleQuery( QueryLanguage.SERQL, dependencyQuery );
- tq.setBinding( "x", dependencyUri );
- TupleQueryResult dependencyResult = tq.evaluate();
- try
- {
- while ( dependencyResult.hasNext() )
- {
- 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() );
- projectDependency.setArtifactType( bs.getBinding( ProjectUri.ARTIFACT_TYPE.getObjectBinding() ).getValue().toString() );
-
- Binding classifierBinding = bs.getBinding( ProjectUri.CLASSIFIER.getObjectBinding() );
- if ( classifierBinding != null )
- {
- projectDependency.setPublicKeyTokenId( classifierBinding.getValue().toString().replace( ":", "" ) );
- }
-
- project.addProjectDependency( projectDependency );
- if ( bs.hasBinding( ProjectUri.DEPENDENCY.getObjectBinding() ) )
- {
- addDependenciesToProject( projectDependency, repositoryConnection,
- bs.getValue( ProjectUri.DEPENDENCY.getObjectBinding() ) );
- }
- }
- }
- finally
- {
- dependencyResult.close();
- }
- }
-
- 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;
- }
// TODO: move generateInteropDll, getInteropParameters, getTempDirectory, and execute methods to another class
private String generateInteropDll( String name, String classifier )
diff --git a/components/dotnet-registry/src/main/java/npanday/registry/ConnectionsRepository.java b/components/dotnet-registry/src/main/java/npanday/registry/ConnectionsRepository.java
index 2a644ae..9e3b301 100644
--- a/components/dotnet-registry/src/main/java/npanday/registry/ConnectionsRepository.java
+++ b/components/dotnet-registry/src/main/java/npanday/registry/ConnectionsRepository.java
@@ -18,10 +18,6 @@
*/
package npanday.registry;
-import org.openrdf.repository.RepositoryException;
-import org.openrdf.repository.sail.SailRepository;
-import org.openrdf.sail.memory.MemoryStore;
-
import org.apache.maven.artifact.factory.ArtifactFactory;
import java.io.InputStream;
@@ -64,20 +60,6 @@
{
long start = System.currentTimeMillis();
- File dataDir = new File( System.getProperty( "user.home" ), ".m2/repository" );
- MemoryStore store = new MemoryStore( dataDir );
- store.setPersist( true );
- store.setSyncDelay( 0 );
- org.openrdf.repository.Repository rdfRepository = new SailRepository( store );
- try
- {
- rdfRepository.initialize();
- }
- catch ( RepositoryException e )
- {
- throw new IOException("NPANDAY-080-005: Failed to initialized repository. Message = " + e.getMessage());
- }
-
Set<String> keys = properties.keySet();
for ( String keyName : keys )
{
@@ -95,7 +77,7 @@
}
DataAccessObject dao = (DataAccessObject) o;
- dao.init( rdfRepository, keyName, daoClassName );
+ dao.init( keyName, daoClassName );
dao.setRepositoryRegistry( registry );
daos.add( dao );
logger.finest( "NPANDAY-080-001: Adding data access object: Class Name = " + daoClassName );
diff --git a/components/dotnet-registry/src/main/java/npanday/registry/DataAccessObject.java b/components/dotnet-registry/src/main/java/npanday/registry/DataAccessObject.java
index ec017ee..8e2a2f0 100644
--- a/components/dotnet-registry/src/main/java/npanday/registry/DataAccessObject.java
+++ b/components/dotnet-registry/src/main/java/npanday/registry/DataAccessObject.java
@@ -42,7 +42,8 @@
* @param className
* @throws IllegalArgumentException
*/
- void init(Object dataStoreObject, String id, String className ) throws IllegalArgumentException;
+ //void init(Object dataStoreObject, String id, String className ) throws IllegalArgumentException;
+ void init(String id, String className );
void setRepositoryRegistry(RepositoryRegistry repositoryRegistry);
}
diff --git a/components/dotnet-registry/src/main/java/npanday/registry/impl/DataAccessObjectRegistryImpl.java b/components/dotnet-registry/src/main/java/npanday/registry/impl/DataAccessObjectRegistryImpl.java
index 4dbcfc9..b4d473e 100644
--- a/components/dotnet-registry/src/main/java/npanday/registry/impl/DataAccessObjectRegistryImpl.java
+++ b/components/dotnet-registry/src/main/java/npanday/registry/impl/DataAccessObjectRegistryImpl.java
@@ -82,14 +82,16 @@
for ( String name : repositoryRegistry.getRepositoryNames() )
{
Repository repository = repositoryRegistry.find( name );
+
if ( repository instanceof ConnectionsRepository )
{
ConnectionsRepository connectionsRepository = (ConnectionsRepository) repository;
+
if ( !isConnectionsRepoLoaded )
{
try
{
- connectionsRepository.lazyLoad();
+ connectionsRepository.lazyLoad();
isConnectionsRepoLoaded = true;
}
catch ( IOException e )
diff --git a/components/dotnet-repository/pom.xml b/components/dotnet-repository/pom.xml
new file mode 100644
index 0000000..393cd00
--- /dev/null
+++ b/components/dotnet-repository/pom.xml
@@ -0,0 +1,49 @@
+<?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>npanday</groupId>
+ <version>2.0-SNAPSHOT</version>
+ <artifactId>dotnet-components</artifactId>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>dotnet-repository</artifactId>
+ <name>NPanday :: Repository</name>
+ <description />
+ <dependencies>
+ <dependency>
+ <groupId>npanday</groupId>
+ <artifactId>dotnet-dao-project</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>npanday</groupId>
+ <artifactId>dotnet-artifact</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <targetPath>../test-repo</targetPath>
+ </testResource>
+ </testResources>
+ </build>
+</project>
diff --git a/components/dotnet-repository/src/main/java/npanday/repository/DotnetArtifactMetadata.java b/components/dotnet-repository/src/main/java/npanday/repository/DotnetArtifactMetadata.java
new file mode 100644
index 0000000..bf1d229
--- /dev/null
+++ b/components/dotnet-repository/src/main/java/npanday/repository/DotnetArtifactMetadata.java
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+package npanday.repository;
+
+import org.apache.maven.project.artifact.ProjectArtifactMetadata;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+
+import java.io.File;
+
+public class DotnetArtifactMetadata
+ extends ProjectArtifactMetadata
+{
+
+ private Artifact artifact;
+
+ public DotnetArtifactMetadata( Artifact artifact )
+ {
+ super( artifact );
+ this.artifact = artifact;
+ }
+
+ public DotnetArtifactMetadata( Artifact artifact, File file )
+ {
+ super( artifact, file );
+ this.artifact = artifact;
+ }
+
+ public String getRemoteFilename()
+ {
+ return getFilename();
+ }
+
+ public String getLocalFilename( ArtifactRepository repository )
+ {
+ return getFilename();
+ }
+
+ private String getFilename()
+ {
+ return ( artifact.getClassifier() != null ) ? artifact.getGroupId() + "-" + artifact.getVersion() + "-" +
+ artifact.getClassifier() + ".pom" : artifact.getGroupId() + "-" + artifact.getVersion() + ".pom";
+ }
+}
diff --git a/components/dotnet-repository/src/main/java/npanday/repository/RepositoryConverter.java b/components/dotnet-repository/src/main/java/npanday/repository/RepositoryConverter.java
new file mode 100644
index 0000000..9a27371
--- /dev/null
+++ b/components/dotnet-repository/src/main/java/npanday/repository/RepositoryConverter.java
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+package npanday.repository;
+
+import org.openrdf.repository.Repository;
+import org.apache.maven.artifact.Artifact;
+import npanday.artifact.ApplicationConfig;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Provides services for converting from RDF repository into the defau;t Maven repository format.
+ */
+public interface RepositoryConverter
+{
+ /**
+ * Role used to register component implementations with the container.
+ */
+ String ROLE = RepositoryConverter.class.getName();
+
+ /**
+ * Converts the specified RDF repository into the default local repository format.
+ *
+ * @param repository the RDF repository
+ * @param mavenRepository the base directory where the converted repository, with the default local repository
+ * format, should be placed
+ * @throws IOException if there is a problem in converting the repository
+ */
+ void convertRepositoryFormat( File mavenRepository )
+ throws IOException;
+
+ void convertRepositoryFormatFor( Artifact artifact, ApplicationConfig applicationConfig, File mavenRepository )
+ throws IOException;
+}
diff --git a/components/dotnet-repository/src/main/java/npanday/repository/impl/RepositoryConverterImpl.java b/components/dotnet-repository/src/main/java/npanday/repository/impl/RepositoryConverterImpl.java
new file mode 100644
index 0000000..07b15d8
--- /dev/null
+++ b/components/dotnet-repository/src/main/java/npanday/repository/impl/RepositoryConverterImpl.java
@@ -0,0 +1,219 @@
+/*
+ * 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.
+ */
+package npanday.repository.impl;
+
+import npanday.repository.RepositoryConverter;
+import npanday.dao.Project;
+import npanday.dao.ProjectDao;
+import npanday.dao.ProjectFactory;
+import npanday.registry.DataAccessObjectRegistry;
+import npanday.ArtifactType;
+import npanday.artifact.ApplicationConfig;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+import org.apache.maven.artifact.manager.WagonManager;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.openrdf.repository.Repository;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.FileWriter;
+import java.util.logging.Logger;
+import java.util.Set;
+
+/**
+ * Implementation of the RepositoryConverter.
+ */
+public class RepositoryConverterImpl
+ implements RepositoryConverter
+{
+
+ /**
+ * The artifact factory component, which is used for creating artifacts.
+ */
+ private org.apache.maven.artifact.factory.ArtifactFactory artifactFactory;
+
+ /**
+ * The data access object registry used for finding DAO objects
+ */
+ private npanday.registry.DataAccessObjectRegistry daoRegistry;
+
+ /**
+ * Resolver for timestamp artifacts
+ */
+ private ArtifactResolver artifactResolver;
+
+ private static Logger logger = Logger.getAnonymousLogger();
+
+ /**
+ * Used my unit tests to initialize the objects that plexus injects
+ *
+ * @param daoRegistry the data access object registry used for finding DAO objects
+ * @param artifactFactory the artifact factory used to create artifacts
+ * @param wagonManager the manager used to download artifacts
+ */
+ protected void initTest( ArtifactFactory artifactFactory, WagonManager wagonManager, ArtifactResolver artifactResolver )
+ {
+ this.daoRegistry = daoRegistry;
+ this.artifactFactory = artifactFactory;
+ this.artifactResolver = artifactResolver;
+ }
+
+ /**
+ * @see RepositoryConverter#convertRepositoryFormat(org.openrdf.repository.Repository, java.io.File)
+ */
+ public void convertRepositoryFormat( File mavenRepository )
+ throws IOException
+ {
+ ProjectDao dao = (ProjectDao) daoRegistry.find( "dao:project" );
+ dao.init( artifactFactory, artifactResolver );
+
+ Set<Project> projects = dao.getAllProjects();
+
+ for ( Project project : projects )
+ {
+ logger.finest( "NPANDAY-190-000: Converting Project: Artifact ID = " + project.getArtifactId() +
+ ", Dependency Count =" + project.getProjectDependencies().size() );
+
+ Artifact artifact = ProjectFactory.createArtifactFrom( project, artifactFactory, mavenRepository );
+ Model model = ProjectFactory.createModelFrom( project );
+
+ ArtifactHandler handler = new DefaultArtifactHandler(
+ ArtifactType.getArtifactTypeForPackagingName( artifact.getType() ).getExtension() );
+ artifact.setArtifactHandler( handler );
+
+ ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
+ if ( !project.getArtifactType().equals( "pom" ) )
+ {
+ if ( artifact.getFile().exists() )
+ {
+ FileUtils.copyFile( artifact.getFile(), new File( mavenRepository, layout.pathOf( artifact ) ) );
+ }
+ else
+ {
+ logger.warning( "NPANDAY-190-001: Could not find file: " + artifact.getFile().getAbsolutePath() );
+ continue;
+ }
+ }
+
+ if ( !artifact.getType().equals( "exe.config" ) )//This is attached
+ {
+ ArtifactHandler pomhandler = new DefaultArtifactHandler( "pom" );
+ artifact.setArtifactHandler( pomhandler );
+
+ File pomFile = new File( mavenRepository, pathOfPom( artifact ) );
+ pomFile.getParentFile().mkdirs();
+ FileWriter fileWriter = new FileWriter( pomFile );
+ try
+ {
+ new MavenXpp3Writer().write( fileWriter, model );
+ }
+ finally
+ {
+ IOUtil.close( fileWriter );
+ }
+ }
+ artifact.setArtifactHandler( handler );
+ }
+
+ }
+
+ public void convertRepositoryFormatFor( Artifact artifact, ApplicationConfig applicationConfig, File mavenRepository )
+ throws IOException
+ {
+ ProjectDao dao = (ProjectDao) daoRegistry.find( "dao:project" );
+ dao.init( artifactFactory, artifactResolver );
+
+ Project project = dao.getProjectFor( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
+ artifact.getType(), artifact.getClassifier() );
+
+ logger.finest( "NPANDAY-190-002: Converting Project: Artifact ID = " + project.getArtifactId() +
+ ", Dependency Count =" + project.getProjectDependencies().size() );
+ Model model = ProjectFactory.createModelFrom( project );
+
+ ArtifactHandler handler = new DefaultArtifactHandler(
+ ArtifactType.getArtifactTypeForPackagingName( artifact.getType() ).getExtension() );
+ artifact.setArtifactHandler( handler );
+
+ ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
+ if ( !project.getArtifactType().equals( "pom" ) )
+ {
+ if ( artifact.getFile().exists() )
+ {
+ FileUtils.copyFile( artifact.getFile(), new File( mavenRepository, layout.pathOf( artifact ) ) );
+ }
+ else
+ {
+ logger.warning( "NPANDAY-190-003: Could not find file: " + artifact.getFile().getAbsolutePath() );
+ return;
+ }
+ }
+
+ if ( applicationConfig != null )
+ {
+ File destPath = applicationConfig.getConfigBuildPath();
+ if ( destPath.exists() )
+ {
+ FileUtils.copyFile( destPath, applicationConfig.getRepositoryPath( mavenRepository ) );
+ }
+ }
+
+ if ( !artifact.getType().equals( "exe.config" ) )//This is attached
+ {
+ ArtifactHandler pomhandler = new DefaultArtifactHandler( "pom" );
+ artifact.setArtifactHandler( pomhandler );
+
+ File pomFile = new File( mavenRepository, pathOfPom( artifact ) );
+ FileWriter fileWriter = new FileWriter( pomFile );
+ new MavenXpp3Writer().write( fileWriter, model );
+ IOUtil.close( fileWriter );
+ }
+
+ artifact.setArtifactHandler( handler );
+
+ }
+
+ /**
+ * Returns the path of the the specified artifact's pom file.
+ *
+ * @param artifact the artifact
+ * @return the path of the the specified artifact's pom file
+ */
+ private String pathOfPom( Artifact artifact )
+ {
+ StringBuffer artifactPath = new StringBuffer();
+ for ( String groupId : artifact.getGroupId().split( "[.]" ) )
+ {
+ artifactPath.append( groupId ).append( File.separator );
+ }
+
+ artifactPath.append( artifact.getArtifactId() ).append( File.separator ).append( artifact.getBaseVersion() ).
+ append( File.separator ).append( artifact.getArtifactId() ).append( "-" ).append(
+ artifact.getBaseVersion() ).append( "." ).append( ( artifact.getArtifactHandler() ).getExtension() );
+ return artifactPath.toString();
+ }
+}
diff --git a/components/dotnet-repository/src/main/resources/META-INF/plexus/components.xml b/components/dotnet-repository/src/main/resources/META-INF/plexus/components.xml
new file mode 100644
index 0000000..6ffa2bd
--- /dev/null
+++ b/components/dotnet-repository/src/main/resources/META-INF/plexus/components.xml
@@ -0,0 +1,37 @@
+<!--
+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.
+-->
+<component-set>
+ <components>
+ <component>
+ <role>npanday.repository.RepositoryConverter</role>
+ <implementation>npanday.repository.impl.RepositoryConverterImpl</implementation>
+ <requirements>
+ <requirement>
+ <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
+ </requirement>
+ <requirement>
+ <role>npanday.registry.DataAccessObjectRegistry</role>
+ </requirement>
+ <requirement>
+ <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
+ </requirement>
+ </requirements>
+ </component>
+ </components>
+</component-set>
\ No newline at end of file
diff --git a/components/dotnet-repository/src/test/java/npanday/repository/impl/ArtifactFactoryTestStub.java b/components/dotnet-repository/src/test/java/npanday/repository/impl/ArtifactFactoryTestStub.java
new file mode 100644
index 0000000..7fd9255
--- /dev/null
+++ b/components/dotnet-repository/src/test/java/npanday/repository/impl/ArtifactFactoryTestStub.java
@@ -0,0 +1,152 @@
+/*
+ * 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.
+ */
+package npanday.repository.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.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 );
+ }
+}
diff --git a/components/dotnet-repository/src/test/java/npanday/repository/impl/ArtifactResolverTestStub.java b/components/dotnet-repository/src/test/java/npanday/repository/impl/ArtifactResolverTestStub.java
new file mode 100644
index 0000000..d48fec1
--- /dev/null
+++ b/components/dotnet-repository/src/test/java/npanday/repository/impl/ArtifactResolverTestStub.java
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+package npanday.repository.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.repository.metadata.Metadata;
+import org.apache.maven.artifact.repository.metadata.Snapshot;
+import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata;
+import org.apache.maven.artifact.repository.metadata.Versioning;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.wagon.ResourceDoesNotExistException;
+import org.apache.maven.wagon.TransferFailedException;
+import org.codehaus.plexus.util.FileUtils;
+
+public class ArtifactResolverTestStub implements ArtifactResolver
+{
+
+ public void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ resolve( artifact, remoteRepositories, localRepository, false );
+ }
+
+ public void resolveAlways( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ resolve( artifact, remoteRepositories, localRepository, true );
+ }
+
+ private void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository, boolean force )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ //do nothing
+ }
+
+ public ArtifactResolutionResult resolveTransitively( Set arg0, Artifact arg1, List arg2, ArtifactRepository arg3,
+ ArtifactMetadataSource arg4 )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ArtifactResolutionResult resolveTransitively( Set arg0, Artifact arg1, List arg2, ArtifactRepository arg3,
+ ArtifactMetadataSource arg4, List arg5 )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ArtifactResolutionResult resolveTransitively( Set arg0, Artifact arg1, ArtifactRepository arg2, List arg3,
+ ArtifactMetadataSource arg4, ArtifactFilter arg5 )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ArtifactResolutionResult resolveTransitively( Set arg0, Artifact arg1, Map arg2, ArtifactRepository arg3,
+ List arg4, ArtifactMetadataSource arg5 )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ArtifactResolutionResult resolveTransitively( Set arg0, Artifact arg1, Map arg2, ArtifactRepository arg3,
+ List arg4, ArtifactMetadataSource arg5, ArtifactFilter arg6 )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ArtifactResolutionResult resolveTransitively( Set arg0, Artifact arg1, Map arg2, ArtifactRepository arg3,
+ List arg4, ArtifactMetadataSource arg5, ArtifactFilter arg6,
+ List arg7 )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/components/dotnet-repository/src/test/java/npanday/repository/impl/DataAccessObjectRegistryStub.java b/components/dotnet-repository/src/test/java/npanday/repository/impl/DataAccessObjectRegistryStub.java
new file mode 100644
index 0000000..596302c
--- /dev/null
+++ b/components/dotnet-repository/src/test/java/npanday/repository/impl/DataAccessObjectRegistryStub.java
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+package npanday.repository.impl;
+
+import npanday.registry.DataAccessObjectRegistry;
+import npanday.registry.DataAccessObject;
+import npanday.dao.impl.ProjectDaoImpl;
+
+import java.util.Set;
+
+
+public class DataAccessObjectRegistryStub
+ implements DataAccessObjectRegistry
+{
+
+ public Set<DataAccessObject> findAll()
+ {
+ return null;
+ }
+
+ public DataAccessObject find( String daoId )
+ {
+ return new ProjectDaoImpl();
+ }
+
+ public Set<String> getDaoIds()
+ {
+ return null;
+ }
+
+}
diff --git a/components/dotnet-repository/src/test/java/npanday/repository/impl/RepositoryConverterImplTest.java b/components/dotnet-repository/src/test/java/npanday/repository/impl/RepositoryConverterImplTest.java
new file mode 100644
index 0000000..5dd5552
--- /dev/null
+++ b/components/dotnet-repository/src/test/java/npanday/repository/impl/RepositoryConverterImplTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+package npanday.repository.impl;
+
+import junit.framework.TestCase;
+import npanday.dao.impl.ProjectDaoImpl;
+import npanday.dao.ProjectDao;
+import npanday.dao.Project;
+import npanday.dao.ProjectDependency;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.Artifact;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+
+
+public class RepositoryConverterImplTest
+ extends TestCase
+{
+
+ private static File basedir = new File( System.getProperty( "basedir" ) );
+
+
+ public void testConvert()
+ {
+ File testRepo = new File( System.getProperty( "basedir" ), "target/test-repo/repository" );
+ testRepo.mkdir();
+
+ ProjectDao dao = this.createProjectDao( );
+
+ Project project = new Project();
+ project.setGroupId( "npanday.model" );
+ project.setArtifactId( "NPanday.Model.Pom" );
+ project.setVersion( "1.0" );
+ project.setArtifactType( "library" );
+
+ ProjectDependency test2 = createProjectDependency( "npanday", "ClassLibrary1", "1.0" );
+ test2.setArtifactType( "library" );
+ project.addProjectDependency( test2 );
+
+ //Temporarily Disabled. failing because group Id is not being parsed successfully
+ /*try
+ {
+ dao.storeProjectAndResolveDependencies( project, testRepo, new ArrayList<ArtifactRepository>() );
+ }
+ catch ( java.io.IOException e )
+ {
+ e.printStackTrace();
+ fail( "Could not store the project: " + e.getMessage() );
+ }
+
+ RepositoryConverterImpl repositoryConverter = new RepositoryConverterImpl();
+ repositoryConverter.initTest( new ArtifactFactoryTestStub(),null, new ArtifactResolverTestStub() );
+ try
+ {
+ repositoryConverter.convertRepositoryFormat( testRepo );
+ }
+ catch ( IOException e )
+ {
+ fail( "Could not convert the repository: " + e.getMessage() );
+ }
+ assertTrue( new File( testRepo, "/npanday/model/NPanday.Model.Pom/1.0/NPanday.Model.Pom-1.0.dll" ).exists() );
+ assertTrue( new File( testRepo, "/npanday/model/NPanday.Model.Pom/1.0/NPanday.Model.Pom-1.0.pom" ).exists() );
+ assertTrue( new File( testRepo, "/npanday/ClassLibrary1/1.0/ClassLibrary1-1.0.dll" ).exists() );
+ */
+ }
+
+ 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( )
+ {
+ ProjectDaoImpl dao = new ProjectDaoImpl();
+ dao.init( new ArtifactFactoryTestStub(), new ArtifactResolverTestStub() );
+
+ return dao;
+ }
+
+
+}
diff --git a/components/dotnet-repository/src/test/resources/npanday-NPanday.Test-1.0.xml b/components/dotnet-repository/src/test/resources/npanday-NPanday.Test-1.0.xml
new file mode 100644
index 0000000..d9659bf
--- /dev/null
+++ b/components/dotnet-repository/src/test/resources/npanday-NPanday.Test-1.0.xml
@@ -0,0 +1,26 @@
+<?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">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>npanday</groupId>
+ <artifactId>NPanday.Test</artifactId>
+ <version>1.0</version>
+ <name>NPanday.Test</name>
+</project>
diff --git a/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1-parent/1.0-SNAPSHOT/ClassLibrary1-parent-1.0-SNAPSHOT.pom b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1-parent/1.0-SNAPSHOT/ClassLibrary1-parent-1.0-SNAPSHOT.pom
new file mode 100644
index 0000000..7fe66af
--- /dev/null
+++ b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1-parent/1.0-SNAPSHOT/ClassLibrary1-parent-1.0-SNAPSHOT.pom
@@ -0,0 +1,30 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>npanday.ClassLibrary1</groupId>
+ <artifactId>ClassLibrary1-parent</artifactId>
+ <packaging>pom</packaging>
+ <name>npanday.ClassLibrary1 : ClassLibrary1-parent</name>
+ <version>1.0-SNAPSHOT</version>
+ <modules>
+ <module>ClassLibrary1</module>
+ </modules>
+</project>
\ No newline at end of file
diff --git a/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1-parent/1.0-SNAPSHOT/maven-metadata-local.xml b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1-parent/1.0-SNAPSHOT/maven-metadata-local.xml
new file mode 100644
index 0000000..ba78201
--- /dev/null
+++ b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1-parent/1.0-SNAPSHOT/maven-metadata-local.xml
@@ -0,0 +1,30 @@
+<?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.
+-->
+<metadata>
+ <groupId>npanday.ClassLibrary1</groupId>
+ <artifactId>ClassLibrary1-parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <localCopy>true</localCopy>
+ </snapshot>
+ <lastUpdated>20101019130606</lastUpdated>
+ </versioning>
+</metadata>
diff --git a/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1-parent/1.0/ClassLibrary1-parent-1.0.pom b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1-parent/1.0/ClassLibrary1-parent-1.0.pom
new file mode 100644
index 0000000..c23c6c7
--- /dev/null
+++ b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1-parent/1.0/ClassLibrary1-parent-1.0.pom
@@ -0,0 +1,30 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>npanday.ClassLibrary1</groupId>
+ <artifactId>ClassLibrary1-parent</artifactId>
+ <packaging>pom</packaging>
+ <name>npanday.ClassLibrary1 : ClassLibrary1-parent</name>
+ <version>1.0</version>
+ <modules>
+ <module>ClassLibrary1</module>
+ </modules>
+</project>
\ No newline at end of file
diff --git a/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1-parent/maven-metadata-local.xml b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1-parent/maven-metadata-local.xml
new file mode 100644
index 0000000..2dad211
--- /dev/null
+++ b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1-parent/maven-metadata-local.xml
@@ -0,0 +1,31 @@
+<?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.
+-->
+<metadata>
+ <groupId>npanday.ClassLibrary1</groupId>
+ <artifactId>ClassLibrary1-parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <versioning>
+ <versions>
+ <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
+ </versions>
+ <lastUpdated>20101019132844</lastUpdated>
+ </versioning>
+</metadata>
diff --git a/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/1.0-SNAPSHOT/ClassLibrary1-1.0-SNAPSHOT.dll b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/1.0-SNAPSHOT/ClassLibrary1-1.0-SNAPSHOT.dll
new file mode 100644
index 0000000..128e8a8
--- /dev/null
+++ b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/1.0-SNAPSHOT/ClassLibrary1-1.0-SNAPSHOT.dll
Binary files differ
diff --git a/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/1.0-SNAPSHOT/ClassLibrary1-1.0-SNAPSHOT.pom b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/1.0-SNAPSHOT/ClassLibrary1-1.0-SNAPSHOT.pom
new file mode 100644
index 0000000..73b471d
--- /dev/null
+++ b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/1.0-SNAPSHOT/ClassLibrary1-1.0-SNAPSHOT.pom
@@ -0,0 +1,48 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://maven.apache.org/POM/4.0.0">
+ <parent>
+ <artifactId>ClassLibrary1-parent</artifactId>
+ <groupId>npanday.ClassLibrary1</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>..\pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>ClassLibrary1</artifactId>
+ <packaging>library</packaging>
+ <name>npanday.ClassLibrary1 : ClassLibrary1</name>
+ <build>
+ <sourceDirectory>./</sourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>npanday.plugin</groupId>
+ <artifactId>maven-compile-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <frameworkVersion>3.5</frameworkVersion>
+ <includeSources>
+ <includeSource>Class1.cs</includeSource>
+ <includeSource>Properties\AssemblyInfo.cs</includeSource>
+ </includeSources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/1.0-SNAPSHOT/maven-metadata-local.xml b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/1.0-SNAPSHOT/maven-metadata-local.xml
new file mode 100644
index 0000000..c7deccb
--- /dev/null
+++ b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/1.0-SNAPSHOT/maven-metadata-local.xml
@@ -0,0 +1,30 @@
+<?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.
+-->
+<metadata>
+ <groupId>npanday.ClassLibrary1</groupId>
+ <artifactId>ClassLibrary1</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <localCopy>true</localCopy>
+ </snapshot>
+ <lastUpdated>20101019130635</lastUpdated>
+ </versioning>
+</metadata>
diff --git a/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/1.0/ClassLibrary1-1.0.dll b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/1.0/ClassLibrary1-1.0.dll
new file mode 100644
index 0000000..1652a6c
--- /dev/null
+++ b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/1.0/ClassLibrary1-1.0.dll
Binary files differ
diff --git a/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/1.0/ClassLibrary1-1.0.pom b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/1.0/ClassLibrary1-1.0.pom
new file mode 100644
index 0000000..9a91128
--- /dev/null
+++ b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/1.0/ClassLibrary1-1.0.pom
@@ -0,0 +1,48 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://maven.apache.org/POM/4.0.0">
+ <parent>
+ <artifactId>ClassLibrary1-parent</artifactId>
+ <groupId>npanday.ClassLibrary1</groupId>
+ <version>1.0</version>
+ <relativePath>..\pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>ClassLibrary1</artifactId>
+ <packaging>library</packaging>
+ <name>npanday.ClassLibrary1 : ClassLibrary1</name>
+ <build>
+ <sourceDirectory>./</sourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>npanday.plugin</groupId>
+ <artifactId>maven-compile-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <frameworkVersion>3.5</frameworkVersion>
+ <includeSources>
+ <includeSource>Class1.cs</includeSource>
+ <includeSource>Properties\AssemblyInfo.cs</includeSource>
+ </includeSources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/maven-metadata-local.xml b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/maven-metadata-local.xml
new file mode 100644
index 0000000..a919e38
--- /dev/null
+++ b/components/dotnet-repository/src/test/resources/repository/npanday/ClassLibrary1/maven-metadata-local.xml
@@ -0,0 +1,31 @@
+<?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.
+-->
+<metadata>
+ <groupId>npanday.ClassLibrary1</groupId>
+ <artifactId>ClassLibrary1</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <versioning>
+ <versions>
+ <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
+ </versions>
+ <lastUpdated>20101019132913</lastUpdated>
+ </versioning>
+</metadata>
diff --git a/components/dotnet-repository/src/test/resources/repository/npanday/model/NPanday.Model.Pom/1.0/NPanday.Model.Pom-1.0.dll b/components/dotnet-repository/src/test/resources/repository/npanday/model/NPanday.Model.Pom/1.0/NPanday.Model.Pom-1.0.dll
new file mode 100644
index 0000000..2fea26a
--- /dev/null
+++ b/components/dotnet-repository/src/test/resources/repository/npanday/model/NPanday.Model.Pom/1.0/NPanday.Model.Pom-1.0.dll
Binary files differ
diff --git a/components/dotnet-repository/src/test/resources/repository/npanday/model/NPanday.Test/1.0/NPanday.Test-1.0.dll b/components/dotnet-repository/src/test/resources/repository/npanday/model/NPanday.Test/1.0/NPanday.Test-1.0.dll
new file mode 100644
index 0000000..2fea26a
--- /dev/null
+++ b/components/dotnet-repository/src/test/resources/repository/npanday/model/NPanday.Test/1.0/NPanday.Test-1.0.dll
Binary files differ
diff --git a/components/pom.xml b/components/pom.xml
index 12f4de0..7d0ed16 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -37,6 +37,7 @@
<module>dotnet-model</module>
<module>dotnet-plugin</module>
<module>dotnet-registry</module>
+ <module>dotnet-repository</module>
<module>dotnet-vendor</module>
</modules>
<reporting>
diff --git a/dotnet/pom.xml b/dotnet/pom.xml
index d8e359a..04df8a3 100644
--- a/dotnet/pom.xml
+++ b/dotnet/pom.xml
@@ -35,7 +35,7 @@
</modules>
<build>
<sourceDirectory>src/main/csharp</sourceDirectory>
- <testSourceDirectory>src/test/csharp</testSourceDirectory>
+ <!--<testSourceDirectory>src/test/csharp</testSourceDirectory>-->
<plugins>
<plugin>
<groupId>npanday.plugin</groupId>
@@ -93,7 +93,6 @@
<plugin>
<groupId>npanday.plugin</groupId>
<artifactId>maven-mojo-generator-plugin</artifactId>
- <version>${stable.npanday.version}</version>
</plugin>
<plugin>
<groupId>npanday.plugin</groupId>
diff --git a/npanday-it-runner/pom.xml b/npanday-it-runner/pom.xml
index d76e4e1..b8cee2c 100644
--- a/npanday-it-runner/pom.xml
+++ b/npanday-it-runner/pom.xml
@@ -23,7 +23,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>npanday</groupId>
- <version>1.3-incubating-SNAPSHOT</version>
+ <version>2.0-SNAPSHOT</version>
<artifactId>npanday-project</artifactId>
</parent>
diff --git a/plugins/maven-repository-plugin/src/main/java/npanday/plugin/repository/RepositoryConverterForArtifactMojo.java b/plugins/maven-repository-plugin/src/main/java/npanday/plugin/repository/RepositoryConverterForArtifactMojo.java
index 036db70..6eb9c51 100644
--- a/plugins/maven-repository-plugin/src/main/java/npanday/plugin/repository/RepositoryConverterForArtifactMojo.java
+++ b/plugins/maven-repository-plugin/src/main/java/npanday/plugin/repository/RepositoryConverterForArtifactMojo.java
@@ -86,8 +86,7 @@
project.getBuild().getDirectory() ) );
try
{
- repositoryConverter.convertRepositoryFormatFor( project.getArtifact(), config, rdfRepository,
- localRepository );
+ repositoryConverter.convertRepositoryFormatFor( project.getArtifact(), config, localRepository );
}
catch ( IOException e )
{
diff --git a/pom.xml b/pom.xml
index ffd69c3..4f49107 100644
--- a/pom.xml
+++ b/pom.xml
@@ -579,7 +579,7 @@
<npanday.snapshots.url>http://repo.npanday.org/archiva/repository/npanday-snapshots</npanday.snapshots.url>
<npanday.releases.url>http://repo.npanday.org/archiva/repository/npanday-releases</npanday.releases.url>
<!--stable.npanday.version>${project.version}</stable.npanday.version-->
- <stable.npanday.version>1.2.1</stable.npanday.version>
+ <stable.npanday.version>1.3-incubating</stable.npanday.version>
</properties>
<distributionManagement>
<repository>
diff --git a/site/pom.xml b/site/pom.xml
index 8522a32..b626702 100644
--- a/site/pom.xml
+++ b/site/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>npanday</groupId>
<artifactId>npanday-project</artifactId>
- <version>1.3-incubating</version>
+ <version>2.0-SNAPSHOT</version>
</parent>
<artifactId>npanday-site</artifactId>
<packaging>pom</packaging>