Repository: maven-archetype Updated Branches: refs/heads/master b48013975 -> 933180233
Remove DataSink, it's never used Project: http://git-wip-us.apache.org/repos/asf/maven-archetype/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-archetype/commit/1263477e Tree: http://git-wip-us.apache.org/repos/asf/maven-archetype/tree/1263477e Diff: http://git-wip-us.apache.org/repos/asf/maven-archetype/diff/1263477e Branch: refs/heads/master Commit: 1263477e2b3a59ca31f5913fa969c882fb8a5801 Parents: b480139 Author: rfscholte <[email protected]> Authored: Fri Jan 27 15:37:47 2017 +0100 Committer: rfscholte <[email protected]> Committed: Fri Jan 27 15:37:47 2017 +0100 ---------------------------------------------------------------------- .../archetype/source/ArchetypeDataSink.java | 36 --------- .../source/ArchetypeDataSinkException.java | 40 ---------- .../source/CatalogArchetypeDataSink.java | 71 ----------------- .../source/CatalogArchetypeDataSinkTest.java | 80 -------------------- 4 files changed, 227 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/1263477e/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSink.java ---------------------------------------------------------------------- diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSink.java b/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSink.java deleted file mode 100644 index ce3e331..0000000 --- a/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSink.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.apache.maven.archetype.source; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.Writer; -import java.util.List; -import java.util.Properties; - -import org.apache.maven.archetype.catalog.Archetype; - -/** @author Jason van Zyl */ -public interface ArchetypeDataSink -{ - void putArchetypes( List<Archetype> archetypes, Writer writer ) - throws ArchetypeDataSinkException; - - void putArchetypes( ArchetypeDataSource source, Properties properties, Writer writer ) - throws ArchetypeDataSourceException, ArchetypeDataSinkException; -} http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/1263477e/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSinkException.java ---------------------------------------------------------------------- diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSinkException.java b/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSinkException.java deleted file mode 100644 index 2de90d0..0000000 --- a/archetype-common/src/main/java/org/apache/maven/archetype/source/ArchetypeDataSinkException.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.apache.maven.archetype.source; - -/* - * 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. - */ - -/** @author Jason van Zyl */ -public class ArchetypeDataSinkException - extends Exception -{ - public ArchetypeDataSinkException( String message ) - { - super( message ); - } - - public ArchetypeDataSinkException( String message, Throwable throwable ) - { - super( message, throwable ); - } - - public ArchetypeDataSinkException( Throwable throwable ) - { - super( throwable ); - } -} http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/1263477e/archetype-common/src/main/java/org/apache/maven/archetype/source/CatalogArchetypeDataSink.java ---------------------------------------------------------------------- diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/source/CatalogArchetypeDataSink.java b/archetype-common/src/main/java/org/apache/maven/archetype/source/CatalogArchetypeDataSink.java deleted file mode 100644 index 9abbc74..0000000 --- a/archetype-common/src/main/java/org/apache/maven/archetype/source/CatalogArchetypeDataSink.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.apache.maven.archetype.source; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.maven.archetype.catalog.Archetype; -import org.apache.maven.archetype.catalog.ArchetypeCatalog; -import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Writer; -import org.codehaus.plexus.logging.AbstractLogEnabled; -import org.codehaus.plexus.util.IOUtil; - -import java.io.IOException; -import java.io.Writer; -import java.util.List; -import java.util.Properties; - -/** @author Jason van Zyl */ -public class CatalogArchetypeDataSink - extends AbstractLogEnabled - implements ArchetypeDataSink -{ - private ArchetypeCatalogXpp3Writer catalogWriter = new ArchetypeCatalogXpp3Writer(); - - public void putArchetypes( List<Archetype> archetypes, Writer writer ) - throws ArchetypeDataSinkException - { - ArchetypeCatalog catalog = new ArchetypeCatalog(); - - for ( Archetype archetype : archetypes ) - { - catalog.addArchetype( archetype ); - } - - try - { - catalogWriter.write( writer, catalog ); - } - catch ( IOException e ) - { - throw new ArchetypeDataSinkException( "Error writing archetype catalog.", e ); - } - finally - { - IOUtil.close( writer ); - } - } - - public void putArchetypes( ArchetypeDataSource source, Properties properties, Writer writer ) - throws ArchetypeDataSourceException, ArchetypeDataSinkException - { - List<Archetype> archetypes = source.getArchetypeCatalog( properties ).getArchetypes(); - - putArchetypes( archetypes, writer ); - } -} http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/1263477e/archetype-common/src/test/java/org/apache/maven/archetype/source/CatalogArchetypeDataSinkTest.java ---------------------------------------------------------------------- diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/source/CatalogArchetypeDataSinkTest.java b/archetype-common/src/test/java/org/apache/maven/archetype/source/CatalogArchetypeDataSinkTest.java deleted file mode 100644 index f0fdd0b..0000000 --- a/archetype-common/src/test/java/org/apache/maven/archetype/source/CatalogArchetypeDataSinkTest.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.apache.maven.archetype.source; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.maven.archetype.catalog.Archetype; -import org.apache.maven.archetype.catalog.ArchetypeCatalog; -import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Reader; -import org.codehaus.plexus.PlexusTestCase; - -import java.io.StringReader; -import java.io.StringWriter; -import java.io.Writer; -import java.util.ArrayList; -import java.util.List; - -/** @author Jason van Zyl */ -public class CatalogArchetypeDataSinkTest - extends PlexusTestCase -{ - public void testCatalogArchetypeDataSink() - throws Exception - { - Archetype a0 = new Archetype(); - - a0.setGroupId( "groupId" ); - - a0.setArtifactId( "artifactId" ); - - a0.setVersion( "1.0" ); - - a0.setDescription( "description" ); - - a0.setRepository( "http://magicbunny.com/maven2" ); - - List<Archetype> archetypes = new ArrayList<Archetype>(); - - archetypes.add( a0 ); - - ArchetypeDataSink sink = new CatalogArchetypeDataSink(); - - Writer writer = new StringWriter(); - - sink.putArchetypes( archetypes, writer ); - - StringReader reader = new StringReader( writer.toString() ); - - ArchetypeCatalogXpp3Reader catalogReader = new ArchetypeCatalogXpp3Reader(); - - ArchetypeCatalog catalog = catalogReader.read( reader ); - - Archetype a1 = (Archetype) catalog.getArchetypes().get( 0 ); - - assertEquals( "groupId", a1.getGroupId() ); - - assertEquals( "artifactId", a1.getArtifactId() ); - - assertEquals( "1.0", a1.getVersion() ); - - assertEquals( "description", a1.getDescription() ); - - assertEquals( "http://magicbunny.com/maven2", a1.getRepository() ); - } -}
