maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r553946 [13/19] - in /maven/archetype/branches/maven-archetypeng: ./ maven-archetypeng-bundles/ maven-archetypeng-bundles/maven-archetypeng-archetype/ maven-archetypeng-bundles/maven-archetypeng-archetype/src/ maven-archetypeng-bundles/mave...
Date Fri, 06 Jul 2007 16:35:16 GMT
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/pom.xml?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/pom.xml (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/pom.xml Fri Jul  6 09:34:35 2007
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2006 The Apache Software Foundation.
+  ~
+  ~ Licensed 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>
+
+    <parent>
+        <groupId>org.codehaus.mojo.archetypeng</groupId>
+        <artifactId>maven-archetypeng-core</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>maven-archetypeng-generator</artifactId>
+
+    <name>Maven ArchetypeNG Generator</name>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.codehaus.mojo.archetypeng</groupId>
+            <artifactId>maven-archetypeng-common</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-velocity</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven.shared</groupId>
+            <artifactId>maven-plugin-testing-harness</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven.archetype</groupId>
+            <artifactId>maven-archetype-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-interactivity-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>velocity</groupId>
+            <artifactId>velocity</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-utils</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-artifact</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-artifact-manager</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-model</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.mojo.archetypeng</groupId>
+            <artifactId>maven-archetypeng-archetype-descriptor</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-container-default</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <dependencies>
+                    <dependency>
+                        <groupId>ant</groupId>
+                        <artifactId>ant-antlr</artifactId>
+                        <version>1.6.5</version>
+                    </dependency>
+                </dependencies>
+
+                <executions>
+                    <execution>
+                        <id>archetype-test</id>
+                        <phase>process-test-resources</phase>
+                        <configuration>
+                            <tasks>
+                                <property name="test.projects.name" value="maven-archetype-test"></property>
+                                <property name="test.projects.version" value="1.0"></property>
+                                <property name="test.projects.archetype" value="${test.projects.name}-${test.projects.version}"></property>
+                                <property name="test.projects.source.directory" value="${test.projects.archetype}"></property>
+                                <property name="test.projects.target.directory" value="org/codehaus/mojo/archetypes/${test.projects.name}/${test.projects.version}"></property>
+                                <property name="test.projects.repository" value="repositories/central"></property>
+
+                                <mkdir dir="${basedir}/target/test-classes/${test.projects.repository}/${test.projects.target.directory}/"></mkdir>
+
+                                <jar destfile="${basedir}/target/test-classes/${test.projects.repository}/${test.projects.target.directory}/${test.projects.archetype}.jar" basedir="${basedir}/src/test/archetypes/${test.projects.source.directory}/"></jar>
+                            </tasks>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+
+                    <execution>
+                        <id>archetype-test-partial</id>
+                        <phase>process-test-resources</phase>
+                        <configuration>
+                            <tasks>
+                                <property name="test.projects.name" value="maven-archetype-test-partial"></property>
+                                <property name="test.projects.version" value="1.0"></property>
+                                <property name="test.projects.archetype" value="${test.projects.name}-${test.projects.version}"></property>
+                                <property name="test.projects.source.directory" value="${test.projects.archetype}"></property>
+                                <property name="test.projects.target.directory" value="org/codehaus/mojo/archetypes/${test.projects.name}/${test.projects.version}"></property>
+                                <property name="test.projects.repository" value="repositories/central"></property>
+                                <mkdir dir="${basedir}/target/test-classes/${test.projects.repository}/${test.projects.target.directory}/"></mkdir>
+
+                                <jar destfile="${basedir}/target/test-classes/${test.projects.repository}/${test.projects.target.directory}/${test.projects.archetype}.jar" basedir="${basedir}/src/test/archetypes/${test.projects.source.directory}/"></jar>
+                            </tasks>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+
+                    <execution>
+                        <id>archetype-test-site</id>
+                        <phase>process-test-resources</phase>
+                        <configuration>
+                            <tasks>
+                                <property name="test.projects.name" value="maven-archetype-test-site"></property>
+                                <property name="test.projects.version" value="1.0"></property>
+                                <property name="test.projects.archetype" value="${test.projects.name}-${test.projects.version}"></property>
+                                <property name="test.projects.source.directory" value="${test.projects.archetype}"></property>
+                                <property name="test.projects.target.directory" value="org/codehaus/mojo/archetypes/${test.projects.name}/${test.projects.version}"></property>
+                                <property name="test.projects.repository" value="repositories/central"></property>
+
+                                <mkdir dir="${basedir}/target/test-classes/${test.projects.repository}/${test.projects.target.directory}/"></mkdir>
+
+                                <jar destfile="${basedir}/target/test-classes/${test.projects.repository}/${test.projects.target.directory}/${test.projects.archetype}.jar" basedir="${basedir}/src/test/archetypes/${test.projects.source.directory}/"></jar>
+                            </tasks>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+
+                    <execution>
+                        <id>archetype-test-old</id>
+                        <phase>process-test-resources</phase>
+                        <configuration>
+                            <tasks>
+                                <property name="test.projects.name" value="maven-archetype-test-old"></property>
+                                <property name="test.projects.version" value="1.0"></property>
+                                <property name="test.projects.archetype" value="${test.projects.name}-${test.projects.version}"></property>
+                                <property name="test.projects.source.directory" value="${test.projects.archetype}"></property>
+                                <property name="test.projects.target.directory" value="org/codehaus/mojo/archetypes/${test.projects.name}/${test.projects.version}"></property>
+                                <property name="test.projects.repository" value="repositories/central"></property>
+
+                                <mkdir dir="${basedir}/target/test-classes/${test.projects.repository}/${test.projects.target.directory}/"></mkdir>
+
+                                <jar destfile="${basedir}/target/test-classes/${test.projects.repository}/${test.projects.target.directory}/${test.projects.archetype}.jar" basedir="${basedir}/src/test/archetypes/${test.projects.source.directory}/"></jar>
+                            </tasks>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+
+                    <execution>
+                        <id>archetype-test-fileset</id>
+                        <phase>process-test-resources</phase>
+                        <configuration>
+                            <tasks>
+                                <property name="test.projects.name" value="maven-archetype-test-fileset"></property>
+                                <property name="test.projects.version" value="1.0"></property>
+                                <property name="test.projects.archetype" value="${test.projects.name}-${test.projects.version}"></property>
+                                <property name="test.projects.source.directory" value="${test.projects.archetype}"></property>
+                                <property name="test.projects.target.directory" value="org/codehaus/mojo/archetypes/${test.projects.name}/${test.projects.version}"></property>
+                                <property name="test.projects.repository" value="repositories/central"></property>
+
+                                <mkdir dir="${basedir}/target/test-classes/${test.projects.repository}/${test.projects.target.directory}/"></mkdir>
+
+                                <jar destfile="${basedir}/target/test-classes/${test.projects.repository}/${test.projects.target.directory}/${test.projects.archetype}.jar" basedir="${basedir}/src/test/archetypes/${test.projects.source.directory}/"></jar>
+                            </tasks>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+
+                    <execution>
+                        <id>repository-metadata</id>
+                        <phase>process-test-resources</phase>
+                        <configuration>
+                            <tasks>
+                                <property name="test.projects.source.directory" value="${test.projects.archetype}"></property>
+                                <property name="test.projects.target.directory" value="org/codehaus/mojo/archetypes"></property>
+                                <property name="test.projects.repository" value="repositories/central"></property>
+
+                                <mkdir dir="${basedir}/target/test-classes/${test.projects.repository}/${test.projects.target.directory}"></mkdir>
+
+                                <copy todir="${basedir}/target/test-classes/${test.projects.repository}/${test.projects.target.directory}">
+                                    <fileset dir="${basedir}/src/test/central-repository"></fileset>
+                                </copy>
+                            </tasks>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerationConfigurator.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerationConfigurator.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerationConfigurator.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerationConfigurator.java Fri Jul  6 09:34:35 2007
@@ -0,0 +1,54 @@
+/*
+ * 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 org.codehaus.mojo.archetypeng.generator;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+
+import org.codehaus.mojo.archetypeng.exception.ArchetypeGenerationConfigurationFailure;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotConfigured;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotDefined;
+import org.codehaus.mojo.archetypeng.exception.UnknownArchetype;
+
+import org.codehaus.plexus.components.interactivity.PrompterException;
+
+import java.io.File;
+import java.io.IOException;
+
+import java.util.List;
+import java.util.Properties;
+
+public interface ArchetypeGenerationConfigurator
+{
+    String ROLE = ArchetypeGenerationConfigurator.class.getName ();
+
+    void configureArchetype (
+        Boolean interactiveMode,
+        File propertyFile,
+        Properties commandLineProperties,
+        ArtifactRepository localRepository,
+        List repositories
+    )
+    throws ArchetypeNotDefined,
+        UnknownArchetype,
+        ArchetypeNotConfigured,
+        IOException,
+        PrompterException,
+        ArchetypeGenerationConfigurationFailure;
+}

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerationConfigurator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerationConfigurator.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerationQueryer.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerationQueryer.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerationQueryer.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerationQueryer.java Fri Jul  6 09:34:35 2007
@@ -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.
+ */
+
+package org.codehaus.mojo.archetypeng.generator;
+
+import org.codehaus.mojo.archetypeng.ArchetypeConfiguration;
+
+import org.codehaus.plexus.components.interactivity.PrompterException;
+
+public interface ArchetypeGenerationQueryer
+{
+    /**
+     */
+    boolean confirmConfiguration ( ArchetypeConfiguration archetypeConfiguration )
+    throws PrompterException;
+
+    /**
+     */
+    String getPropertyValue ( String requiredProperty, String defaultValue )
+    throws PrompterException;
+}

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerationQueryer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerationQueryer.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerator.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerator.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerator.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerator.java Fri Jul  6 09:34:35 2007
@@ -0,0 +1,65 @@
+/*
+ * 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 org.codehaus.mojo.archetypeng.generator;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+
+import org.codehaus.mojo.archetypeng.exception.ArchetypeGenerationFailure;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotConfigured;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotDefined;
+import org.codehaus.mojo.archetypeng.exception.InvalidPackaging;
+import org.codehaus.mojo.archetypeng.exception.OutputFileExists;
+import org.codehaus.mojo.archetypeng.exception.PomFileExists;
+import org.codehaus.mojo.archetypeng.exception.ProjectDirectoryExists;
+import org.codehaus.mojo.archetypeng.exception.UnknownArchetype;
+
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import org.dom4j.DocumentException;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import java.util.List;
+
+public interface ArchetypeGenerator
+{
+    String ROLE = ArchetypeGenerator.class.getName ();
+
+    void generateArchetype (
+        File propertyFile,
+        ArtifactRepository localRepository,
+        List repositories,
+        String basedir
+    )
+    throws IOException,
+        ArchetypeNotDefined,
+        UnknownArchetype,
+        ArchetypeNotConfigured,
+        ProjectDirectoryExists,
+        PomFileExists,
+        OutputFileExists,
+        FileNotFoundException,
+        XmlPullParserException,
+        DocumentException,
+        InvalidPackaging,
+        ArchetypeGenerationFailure;
+}

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeGenerator.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeSelectionQueryer.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeSelectionQueryer.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeSelectionQueryer.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeSelectionQueryer.java Fri Jul  6 09:34:35 2007
@@ -0,0 +1,52 @@
+/*
+ * 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 org.codehaus.mojo.archetypeng.generator;
+
+import org.codehaus.mojo.archetypeng.Archetype;
+import org.codehaus.mojo.archetypeng.ArchetypeDefinition;
+
+import org.codehaus.plexus.components.interactivity.PrompterException;
+
+import java.util.List;
+
+public interface ArchetypeSelectionQueryer
+{
+    String ROLE = ArchetypeSelectionQueryer.class.getName ();
+
+    /**
+     */
+    boolean confirmSelection ( ArchetypeDefinition archetypeDefinition )
+    throws PrompterException;
+
+    /**
+     */
+    Archetype selectArtifact ( List list )
+    throws PrompterException;
+
+    /**
+     */
+    String selectGroup ( List list )
+    throws PrompterException;
+
+    /**
+     */
+    String selectVersion ( List list )
+    throws PrompterException;
+}

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeSelectionQueryer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeSelectionQueryer.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeSelector.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeSelector.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeSelector.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeSelector.java Fri Jul  6 09:34:35 2007
@@ -0,0 +1,56 @@
+/*
+ * 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 org.codehaus.mojo.archetypeng.generator;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotDefined;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeSelectionFailure;
+import org.codehaus.mojo.archetypeng.exception.UnknownArchetype;
+
+import org.codehaus.plexus.components.interactivity.PrompterException;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import java.util.List;
+
+public interface ArchetypeSelector
+{
+    String ROLE = ArchetypeSelector.class.getName ();
+
+    void selectArchetype (
+        String archetypeGroupId,
+        String archetypeArtifactId,
+        String archetypeVersion,
+        Boolean interactiveMode,
+        File propertyFile,
+        File archetypeRegistryFile,
+        ArtifactRepository localRepository,
+        List repositories
+    )
+    throws ArchetypeNotDefined,
+        UnknownArchetype,
+        IOException,
+        FileNotFoundException,
+        PrompterException,
+        ArchetypeSelectionFailure;
+}

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeSelector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/ArchetypeSelector.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerationConfigurator.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerationConfigurator.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerationConfigurator.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerationConfigurator.java Fri Jul  6 09:34:35 2007
@@ -0,0 +1,250 @@
+/*
+ * 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 org.codehaus.mojo.archetypeng.generator;
+
+import org.apache.maven.archetype.Archetype;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+
+import org.codehaus.mojo.archetypeng.ArchetypeArtifactManager;
+import org.codehaus.mojo.archetypeng.ArchetypeConfiguration;
+import org.codehaus.mojo.archetypeng.ArchetypeDefinition;
+import org.codehaus.mojo.archetypeng.ArchetypeFactory;
+import org.codehaus.mojo.archetypeng.ArchetypePropertiesManager;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeGenerationConfigurationFailure;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotConfigured;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotDefined;
+import org.codehaus.mojo.archetypeng.exception.UnknownArchetype;
+
+import org.codehaus.plexus.components.interactivity.PrompterException;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * @plexus.component
+ */
+public class DefaultArchetypeGenerationConfigurator
+extends AbstractLogEnabled
+implements ArchetypeGenerationConfigurator
+{
+    /**
+     * @plexus.requirement
+     */
+    Archetype oldArchetype;
+    /**
+     * @plexus.requirement
+     */
+    private ArchetypeArtifactManager archetypeArtifactManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private ArchetypeFactory archetypeFactory;
+
+    /**
+     * @plexus.requirement
+     */
+    private ArchetypeGenerationQueryer archetypeGenerationQueryer;
+
+    /**
+     * @plexus.requirement
+     */
+    private ArchetypePropertiesManager archetypePropertiesManager;
+
+    public void configureArchetype (
+        Boolean interactiveMode,
+        File propertyFile,
+        Properties commandLineProperties,
+        ArtifactRepository localRepository,
+        List repositories
+    )
+    throws ArchetypeNotDefined,
+        UnknownArchetype,
+        ArchetypeNotConfigured,
+        IOException,
+        PrompterException,
+        ArchetypeGenerationConfigurationFailure
+    {
+        Properties properties =
+            initialiseArchetypeProperties ( commandLineProperties, propertyFile );
+
+        ArchetypeDefinition archetypeDefinition =
+            archetypeFactory.createArchetypeDefinition ( properties );
+
+        if ( !archetypeDefinition.isDefined () )
+        {
+            throw new ArchetypeNotDefined ( "The archetype is not defined" );
+        }
+
+        if ( !archetypeArtifactManager.exists (
+                archetypeDefinition.getGroupId (),
+                archetypeDefinition.getArtifactId (),
+                archetypeDefinition.getVersion (),
+                localRepository,
+                repositories
+            )
+        )
+        {
+            throw new UnknownArchetype (
+                "The desired archetype does not exist (" + archetypeDefinition.getGroupId () + ":"
+                + archetypeDefinition.getArtifactId () + ":" + archetypeDefinition.getVersion ()
+                + ")"
+            );
+        }
+
+        ArchetypeConfiguration archetypeConfiguration;
+
+        if ( archetypeArtifactManager.isOldArchetype (
+                archetypeDefinition.getGroupId (),
+                archetypeDefinition.getArtifactId (),
+                archetypeDefinition.getVersion (),
+                localRepository,
+                repositories
+            )
+        )
+        {
+            org.apache.maven.archetype.descriptor.ArchetypeDescriptor archetypeDescriptor =
+                archetypeArtifactManager.getOldArchetypeDescriptor (
+                    archetypeDefinition.getGroupId (),
+                    archetypeDefinition.getArtifactId (),
+                    archetypeDefinition.getVersion (),
+                    localRepository,
+                    repositories
+                );
+            archetypeConfiguration =
+                archetypeFactory.createArchetypeConfiguration ( archetypeDescriptor, properties );
+        }
+        else if (
+            archetypeArtifactManager.isFileSetArchetype (
+                archetypeDefinition.getGroupId (),
+                archetypeDefinition.getArtifactId (),
+                archetypeDefinition.getVersion (),
+                localRepository,
+                repositories
+            )
+        )
+        {
+            org.codehaus.mojo.archetypeng.archetype.filesets.ArchetypeDescriptor archetypeDescriptor =
+                archetypeArtifactManager.getFileSetArchetypeDescriptor (
+                    archetypeDefinition.getGroupId (),
+                    archetypeDefinition.getArtifactId (),
+                    archetypeDefinition.getVersion (),
+                    localRepository,
+                    repositories
+                );
+            archetypeConfiguration =
+                archetypeFactory.createArchetypeConfiguration ( archetypeDescriptor, properties );
+        }
+        else
+        {
+            throw new ArchetypeGenerationConfigurationFailure (
+                "The defined artifact is not an archetype"
+            );
+        }
+
+        if ( interactiveMode.booleanValue () )
+        {
+            boolean confirmed = false;
+            while ( !confirmed )
+            {
+                if ( !archetypeConfiguration.isConfigured () )
+                {
+                    Iterator requiredProperties =
+                        archetypeConfiguration.getRequiredProperties ().iterator ();
+
+                    while ( requiredProperties.hasNext () )
+                    {
+                        String requiredProperty = (String) requiredProperties.next ();
+
+                        if ( !archetypeConfiguration.isConfigured ( requiredProperty ) )
+                        {
+                            archetypeConfiguration.setProperty (
+                                requiredProperty,
+                                archetypeGenerationQueryer.getPropertyValue (
+                                    requiredProperty,
+                                    archetypeConfiguration.getDefaultValue ( requiredProperty )
+                                )
+                            );
+                        }
+                    }
+                }
+                if ( !archetypeConfiguration.isConfigured () )
+                {
+                    throw new ArchetypeGenerationConfigurationFailure (
+                        "The archetype generation must be configured here"
+                    );
+                }
+                else if (
+                    !archetypeGenerationQueryer.confirmConfiguration ( archetypeConfiguration )
+                )
+                {
+                    getLogger ().debug ( "Archetype generation configuration not confirmed" );
+                    archetypeConfiguration.reset ();
+                }
+                else
+                {
+                    getLogger ().debug ( "Archetype generation configuration confirmed" );
+                    confirmed = true;
+                }
+            } // end while
+        }
+        else
+        {
+            if ( !archetypeConfiguration.isConfigured () )
+            {
+                throw new ArchetypeNotConfigured ( "The archetype is not configurated" );
+            }
+        }
+
+        archetypePropertiesManager.writeProperties (
+            archetypeConfiguration.toProperties (),
+            propertyFile
+        );
+    }
+
+    private Properties initialiseArchetypeProperties (
+        Properties commandLineProperties,
+        File propertyFile
+    )
+    throws FileNotFoundException, IOException
+    {
+        Properties properties = new Properties ();
+        archetypePropertiesManager.readProperties ( properties, propertyFile );
+
+        Iterator commandLinePropertiesIterator =
+            new ArrayList ( commandLineProperties.keySet () ).iterator ();
+        while ( commandLinePropertiesIterator.hasNext () )
+        {
+            String propertyKey = (String) commandLinePropertiesIterator.next ();
+            properties.setProperty (
+                propertyKey,
+                commandLineProperties.getProperty ( propertyKey )
+            );
+        }
+        return properties;
+    }
+}

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerationConfigurator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerationConfigurator.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerationQueryer.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerationQueryer.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerationQueryer.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerationQueryer.java Fri Jul  6 09:34:35 2007
@@ -0,0 +1,77 @@
+/*
+ * 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 org.codehaus.mojo.archetypeng.generator;
+
+import org.codehaus.mojo.archetypeng.ArchetypeConfiguration;
+
+import org.codehaus.plexus.components.interactivity.Prompter;
+import org.codehaus.plexus.components.interactivity.PrompterException;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+import java.util.Iterator;
+
+/**
+ * @plexus.component
+ */
+public class DefaultArchetypeGenerationQueryer
+extends AbstractLogEnabled
+implements ArchetypeGenerationQueryer
+{
+    /**
+     * @plexus.requirement
+     */
+    private Prompter prompter;
+
+    public boolean confirmConfiguration ( ArchetypeConfiguration archetypeConfiguration )
+    throws PrompterException
+    {
+        String query = "Confirm properties configuration:\n";
+
+        Iterator requiredPropertiesIter =
+            archetypeConfiguration.getRequiredProperties ().iterator ();
+
+        while ( requiredPropertiesIter.hasNext () )
+        {
+            String property = (String) requiredPropertiesIter.next ();
+            query += property + ": " + archetypeConfiguration.getProperty ( property ) + "\n";
+        }
+
+        String answer = prompter.prompt ( query, "Y" );
+
+        return "Y".equalsIgnoreCase ( answer );
+    }
+
+    public String getPropertyValue ( String requiredProperty, String defaultValue )
+    throws PrompterException
+    {
+        String query = "Define value for " + requiredProperty + ": ";
+        String answer;
+
+        if ( ( defaultValue != null ) && !defaultValue.equals ( "null" ) )
+        {
+            answer = prompter.prompt ( query, defaultValue );
+        }
+        else
+        {
+            answer = prompter.prompt ( query );
+        }
+        return answer;
+    }
+}

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerationQueryer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerationQueryer.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerator.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerator.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerator.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerator.java Fri Jul  6 09:34:35 2007
@@ -0,0 +1,298 @@
+/*
+ * 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 org.codehaus.mojo.archetypeng.generator;
+
+import org.apache.maven.archetype.Archetype;
+import org.apache.maven.archetype.ArchetypeDescriptorException;
+import org.apache.maven.archetype.ArchetypeNotFoundException;
+import org.apache.maven.archetype.ArchetypeTemplateProcessingException;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+
+import org.codehaus.mojo.archetypeng.ArchetypeArtifactManager;
+import org.codehaus.mojo.archetypeng.ArchetypeConfiguration;
+import org.codehaus.mojo.archetypeng.ArchetypeDefinition;
+import org.codehaus.mojo.archetypeng.ArchetypeFactory;
+import org.codehaus.mojo.archetypeng.ArchetypePropertiesManager;
+import org.codehaus.mojo.archetypeng.Constants;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeGenerationFailure;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotConfigured;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotDefined;
+import org.codehaus.mojo.archetypeng.exception.InvalidPackaging;
+import org.codehaus.mojo.archetypeng.exception.OutputFileExists;
+import org.codehaus.mojo.archetypeng.exception.PomFileExists;
+import org.codehaus.mojo.archetypeng.exception.ProjectDirectoryExists;
+import org.codehaus.mojo.archetypeng.exception.UnknownArchetype;
+
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import org.dom4j.DocumentException;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * @plexus.component
+ */
+public class DefaultArchetypeGenerator
+extends AbstractLogEnabled
+implements ArchetypeGenerator
+{
+    /**
+     * @plexus.requirement
+     */
+    private ArchetypeArtifactManager archetypeArtifactManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private ArchetypeFactory archetypeFactory;
+
+    /**
+     * @plexus.requirement
+     */
+    private ArchetypePropertiesManager archetypePropertiesManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private FilesetArchetypeGenerator filesetGenerator;
+    /**
+     * @plexus.requirement
+     */
+    private Archetype oldArchetype;
+
+    public void generateArchetype (
+        File propertyFile,
+        ArtifactRepository localRepository,
+        List repositories,
+        String basedir
+    )
+    throws IOException,
+        ArchetypeNotDefined,
+        UnknownArchetype,
+        ArchetypeNotConfigured,
+        ProjectDirectoryExists,
+        PomFileExists,
+        OutputFileExists,
+        FileNotFoundException,
+        XmlPullParserException,
+        DocumentException,
+        InvalidPackaging,
+        ArchetypeGenerationFailure
+    {
+        Properties properties = initialiseArchetypeProperties ( propertyFile );
+
+        ArchetypeDefinition archetypeDefinition =
+            archetypeFactory.createArchetypeDefinition ( properties );
+
+        if ( !archetypeDefinition.isDefined () )
+        {
+            throw new ArchetypeNotDefined ( "The archetype is not defined" );
+        }
+
+        if ( !archetypeArtifactManager.exists (
+                archetypeDefinition.getGroupId (),
+                archetypeDefinition.getArtifactId (),
+                archetypeDefinition.getVersion (),
+                localRepository,
+                repositories
+            )
+        )
+        {
+            throw new UnknownArchetype (
+                "The desired archetype does not exist (" + archetypeDefinition.getGroupId () + ":"
+                + archetypeDefinition.getArtifactId () + ":" + archetypeDefinition.getVersion ()
+                + ")"
+            );
+        }
+
+        if ( archetypeArtifactManager.isFileSetArchetype (
+                archetypeDefinition.getGroupId (),
+                archetypeDefinition.getArtifactId (),
+                archetypeDefinition.getVersion (),
+                localRepository,
+                repositories
+            )
+        )
+        {
+            processFileSetArchetype (
+                properties,
+                localRepository,
+                basedir,
+                repositories,
+                archetypeDefinition
+            );
+        }
+        else if (
+            archetypeArtifactManager.isOldArchetype (
+                archetypeDefinition.getGroupId (),
+                archetypeDefinition.getArtifactId (),
+                archetypeDefinition.getVersion (),
+                localRepository,
+                repositories
+            )
+        )
+        {
+            processOldArchetype (
+                localRepository,
+                properties,
+                basedir,
+                archetypeDefinition,
+                repositories
+            );
+        }
+        else
+        {
+            throw new ArchetypeGenerationFailure ( "The defined artifact is not an archetype" );
+        }
+    }
+
+    /**Common*/
+    public String getPackageAsDirectory ( String packageName )
+    {
+        return StringUtils.replace ( packageName, ".", "/" );
+    }
+
+    /**Common*/
+    private Properties initialiseArchetypeProperties ( File propertyFile )
+    throws IOException
+    {
+        Properties properties = new Properties ();
+        archetypePropertiesManager.readProperties ( properties, propertyFile );
+        return properties;
+    }
+
+    /**FileSetArchetype*/
+    private void processFileSetArchetype (
+        final Properties properties,
+        final ArtifactRepository localRepository,
+        final String basedir,
+        final List repositories,
+        final ArchetypeDefinition archetypeDefinition
+    )
+    throws UnknownArchetype,
+        ArchetypeNotConfigured,
+        ProjectDirectoryExists,
+        PomFileExists,
+        OutputFileExists,
+        ArchetypeGenerationFailure
+    {
+        File archetypeFile =
+            archetypeArtifactManager.getArchetypeFile (
+                archetypeDefinition.getGroupId (),
+                archetypeDefinition.getArtifactId (),
+                archetypeDefinition.getVersion (),
+                localRepository,
+                repositories
+            );
+
+        filesetGenerator.generateArchetype ( properties, archetypeFile, basedir );
+    }
+
+    /**OldArchetype*/
+    private void processOldArchetype (
+        final ArtifactRepository localRepository,
+        final Properties properties,
+        final String basedir,
+        final ArchetypeDefinition archetypeDefinition,
+        final List repositories
+    )
+    throws UnknownArchetype, ArchetypeGenerationFailure
+    {
+        ArchetypeConfiguration archetypeConfiguration;
+
+        org.apache.maven.archetype.descriptor.ArchetypeDescriptor archetypeDescriptor =
+            archetypeArtifactManager.getOldArchetypeDescriptor (
+                archetypeDefinition.getGroupId (),
+                archetypeDefinition.getArtifactId (),
+                archetypeDefinition.getVersion (),
+                localRepository,
+                repositories
+            );
+        archetypeConfiguration =
+            archetypeFactory.createArchetypeConfiguration ( archetypeDescriptor, properties );
+
+        Map map = new HashMap ();
+
+        map.put ( "basedir", basedir );
+
+        map.put (
+            "package",
+            archetypeConfiguration.getProperties ().getProperty ( Constants.PACKAGE )
+        );
+
+        map.put (
+            "packageName",
+            archetypeConfiguration.getProperties ().getProperty ( Constants.PACKAGE )
+        );
+
+        map.put (
+            "groupId",
+            archetypeConfiguration.getProperties ().getProperty ( Constants.GROUP_ID )
+        );
+
+        map.put (
+            "artifactId",
+            archetypeConfiguration.getProperties ().getProperty ( Constants.ARTIFACT_ID )
+        );
+
+        map.put (
+            "version",
+            archetypeConfiguration.getProperties ().getProperty ( Constants.VERSION )
+        );
+        try
+        {
+            oldArchetype.createArchetype (
+                archetypeDefinition.getGroupId (),
+                archetypeDefinition.getArtifactId (),
+                archetypeDefinition.getVersion (),
+                localRepository,
+                repositories,
+                map
+            );
+        }
+        catch ( ArchetypeDescriptorException ex )
+        {
+            throw new ArchetypeGenerationFailure (
+                "Failed to generate project from the old archetype"
+            );
+        }
+        catch ( ArchetypeTemplateProcessingException ex )
+        {
+            throw new ArchetypeGenerationFailure (
+                "Failed to generate project from the old archetype"
+            );
+        }
+        catch ( ArchetypeNotFoundException ex )
+        {
+            throw new ArchetypeGenerationFailure (
+                "Failed to generate project from the old archetype"
+            );
+        }
+    }
+}

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeGenerator.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeSelectionQueryer.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeSelectionQueryer.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeSelectionQueryer.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeSelectionQueryer.java Fri Jul  6 09:34:35 2007
@@ -0,0 +1,137 @@
+/*
+ * 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 org.codehaus.mojo.archetypeng.generator;
+
+import org.codehaus.mojo.archetypeng.Archetype;
+import org.codehaus.mojo.archetypeng.ArchetypeDefinition;
+
+import org.codehaus.plexus.components.interactivity.Prompter;
+import org.codehaus.plexus.components.interactivity.PrompterException;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @plexus.component
+ */
+public class DefaultArchetypeSelectionQueryer
+extends AbstractLogEnabled
+implements ArchetypeSelectionQueryer
+{
+    /**
+     * @plexus.requirement
+     */
+    private Prompter prompter;
+
+    public boolean confirmSelection ( ArchetypeDefinition archetypeDefinition )
+    throws PrompterException
+    {
+        String query =
+            "Confirm archetype selection: \n" + archetypeDefinition.getGroupId () + "/"
+            + archetypeDefinition.getName () + "\n";
+
+        String answer = prompter.prompt ( query, Arrays.asList ( new String[] { "Y", "N" } ), "Y" );
+
+        return "Y".equalsIgnoreCase ( answer );
+    }
+
+    public Archetype selectArtifact ( List archetypes )
+    throws PrompterException
+    {
+        String query = "Choose archetype:\n";
+        Map answerMap = new HashMap ();
+        List answers = new ArrayList ();
+        Iterator archetypeIterator = archetypes.iterator ();
+        int counter = 1;
+        while ( archetypeIterator.hasNext () )
+        {
+            Archetype archetype = (Archetype) archetypeIterator.next ();
+
+            answerMap.put ( "" + counter, archetype );
+            query +=
+                "" + counter + ": " + archetype.getName () + " (" + archetype.getGroupId () + ":"
+                + archetype.getArtifactId () + ")\n";
+            answers.add ( "" + counter );
+
+            counter++;
+        }
+        query += "Choose a number: ";
+
+        String answer = prompter.prompt ( query, answers );
+
+        return (Archetype) answerMap.get ( answer );
+    }
+
+    public String selectGroup ( List groups )
+    throws PrompterException
+    {
+        String query = "Choose group:\n";
+        Map answerMap = new HashMap ();
+        List answers = new ArrayList ();
+        Iterator groupIterator = groups.iterator ();
+        int counter = 1;
+        while ( groupIterator.hasNext () )
+        {
+            String group = (String) groupIterator.next ();
+
+            answerMap.put ( "" + counter, group );
+            query += "" + counter + ": " + group + "\n";
+            answers.add ( "" + counter );
+
+            counter++;
+        }
+        query += "Choose a number: ";
+
+        String answer = prompter.prompt ( query, answers );
+
+        return (String) answerMap.get ( answer );
+    }
+
+    public String selectVersion ( List archetypeVersions )
+    throws PrompterException
+    {
+        String query = "Choose version: \n";
+        Map answerMap = new HashMap ();
+        List answers = new ArrayList ();
+
+        Iterator archetypeVersionsKeys = archetypeVersions.iterator ();
+        int counter = 1;
+        while ( archetypeVersionsKeys.hasNext () )
+        {
+            String archetypeVersion = (String) archetypeVersionsKeys.next ();
+
+            answerMap.put ( "" + counter, archetypeVersion );
+            query += "" + counter + ": " + archetypeVersion + "\n";
+            answers.add ( "" + counter );
+
+            counter++;
+        }
+        query += "Choose a number: ";
+
+        String answer = prompter.prompt ( query, answers );
+
+        return (String) answerMap.get ( answer );
+    }
+}

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeSelectionQueryer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeSelectionQueryer.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeSelector.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeSelector.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeSelector.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeSelector.java Fri Jul  6 09:34:35 2007
@@ -0,0 +1,322 @@
+/*
+ * 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 org.codehaus.mojo.archetypeng.generator;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+
+import org.codehaus.mojo.archetypeng.Archetype;
+import org.codehaus.mojo.archetypeng.ArchetypeArtifactManager;
+import org.codehaus.mojo.archetypeng.ArchetypeDefinition;
+import org.codehaus.mojo.archetypeng.ArchetypeFactory;
+import org.codehaus.mojo.archetypeng.ArchetypePropertiesManager;
+import org.codehaus.mojo.archetypeng.ArchetypeRegistryManager;
+import org.codehaus.mojo.archetypeng.Constants;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotDefined;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeSelectionFailure;
+import org.codehaus.mojo.archetypeng.exception.UnknownArchetype;
+import org.codehaus.mojo.archetypeng.exception.UnknownGroup;
+
+import org.codehaus.plexus.components.interactivity.PrompterException;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * @plexus.component
+ */
+public class DefaultArchetypeSelector
+extends AbstractLogEnabled
+implements ArchetypeSelector
+{
+    /**
+     * @plexus.requirement
+     */
+    private ArchetypeArtifactManager archetypeArtifactManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private ArchetypeFactory archetypeFactory;
+
+    /**
+     * @plexus.requirement
+     */
+    private ArchetypePropertiesManager archetypePropertiesManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private ArchetypeRegistryManager archetypeRegistryManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private ArchetypeSelectionQueryer archetypeSelectionQueryer;
+
+    public void selectArchetype (
+        String archetypeGroupId,
+        String archetypeArtifactId,
+        String archetypeVersion,
+        Boolean interactiveMode,
+        File propertyFile,
+        File archetypeRegistryFile,
+        ArtifactRepository localRepository,
+        List repositories
+    )
+    throws ArchetypeNotDefined,
+        UnknownArchetype,
+        IOException,
+        FileNotFoundException,
+        PrompterException,
+        ArchetypeSelectionFailure
+    {
+        Properties properties =
+            initialiseArchetypeId (
+                archetypeGroupId,
+                archetypeArtifactId,
+                archetypeVersion,
+                propertyFile
+            );
+
+        ArchetypeDefinition archetypeDefinition =
+            archetypeFactory.createArchetypeDefinition ( properties );
+
+        if ( interactiveMode.booleanValue () )
+        {
+            if ( archetypeDefinition.isPartiallyDefined () )
+            {
+                getLogger ().debug ( "Archetype is partially defined" );
+                archetypeDefinition.setVersion (
+                    archetypeArtifactManager.getReleaseVersion (
+                        archetypeDefinition.getGroupId (),
+                        archetypeDefinition.getArtifactId (),
+                        localRepository,
+                        repositories
+                    )
+                );
+            }
+            else
+            {
+                getLogger ().debug ( "Archetype is not defined" );
+            }
+
+            while ( !archetypeDefinition.isDefined () )
+            {
+                try
+                {
+                    if ( !archetypeDefinition.isGroupDefined () )
+                    {
+                        getLogger ().debug ( "Archetype group not defined" );
+
+                        List groups =
+                            archetypeRegistryManager.getArchetypeGroups ( archetypeRegistryFile );
+                        getLogger ().debug ( "Groups=" + groups );
+
+                        archetypeDefinition.setGroupId (
+                            archetypeSelectionQueryer.selectGroup ( groups )
+                        );
+                    }
+                    else
+                    {
+                        getLogger ().debug (
+                            "Archetype group: " + archetypeDefinition.getGroupId ()
+                        );
+                    }
+
+                    if ( !archetypeDefinition.isArtifactDefined () )
+                    {
+                        getLogger ().debug ( "Archetype artifact not defined" );
+
+                        List archetypes =
+                            archetypeArtifactManager.getArchetypes (
+                                archetypeDefinition.getGroupId (),
+                                localRepository,
+                                repositories
+                            );
+                        getLogger ().debug ( "Archetypes=" + archetypes );
+
+                        Archetype archetype =
+                            archetypeSelectionQueryer.selectArtifact ( archetypes );
+
+                        archetypeDefinition.setArtifactId ( archetype.getArtifactId () );
+                        archetypeDefinition.setName ( archetype.getName () );
+                    }
+                    else
+                    {
+                        getLogger ().debug (
+                            "Archetype artifact: " + archetypeDefinition.getArtifactId ()
+                        );
+                    }
+
+                    if ( archetypeDefinition.isPartiallyDefined () )
+                    {
+                        getLogger ().debug ( "Archetype version not defined" );
+
+                        List versions =
+                            archetypeArtifactManager.getVersions (
+                                archetypeDefinition.getGroupId (),
+                                archetypeDefinition.getArtifactId (),
+                                localRepository,
+                                repositories
+                            );
+                        getLogger ().debug ( "Versions=" + versions );
+
+                        archetypeDefinition.setVersion (
+                            archetypeSelectionQueryer.selectVersion ( versions )
+                        );
+                    }
+                    else
+                    {
+                        getLogger ().debug (
+                            "Archetype version: " + archetypeDefinition.getVersion ()
+                        );
+                    }
+
+                    if ( !archetypeDefinition.isDefined () )
+                    {
+                        throw new ArchetypeSelectionFailure (
+                            "The archetype must be selected here"
+                        );
+                    }
+                    else if ( !archetypeSelectionQueryer.confirmSelection ( archetypeDefinition ) )
+                    {
+                        getLogger ().debug ( "Archetype selection not confirmed" );
+                        archetypeDefinition.reset ();
+                    }
+                    else
+                    {
+                        getLogger ().debug ( "Archetype selection confirmed" );
+                    }
+                }
+                catch ( UnknownGroup e )
+                {
+                    getLogger ().warn ( "Unknown group" );
+                    archetypeDefinition.reset ();
+                }
+                catch ( UnknownArchetype e )
+                {
+                    getLogger ().warn ( "Unknown archetype" );
+                    archetypeDefinition.reset ();
+                }
+            } // end while
+        }
+        else
+        {
+            if ( !archetypeDefinition.isDefined () )
+            {
+                if ( !archetypeDefinition.isPartiallyDefined () )
+                {
+                    throw new ArchetypeNotDefined ( "The archetype is not defined" );
+                }
+                else
+                {
+                    getLogger ().debug ( "Archetype is partially defined" );
+                    archetypeDefinition.setVersion (
+                        archetypeArtifactManager.getReleaseVersion (
+                            archetypeDefinition.getGroupId (),
+                            archetypeDefinition.getArtifactId (),
+                            localRepository,
+                            repositories
+                        )
+                    );
+                    getLogger ().info (
+                        "Using default version " + archetypeDefinition.getVersion ()
+                    );
+                }
+            }
+            if ( !archetypeDefinition.isDefined () )
+            {
+                throw new ArchetypeSelectionFailure ( "The archetype must be selected here" );
+            }
+            else
+            {
+                getLogger ().info (
+                    "Archetype selected (" + archetypeDefinition.getGroupId () + ":"
+                    + archetypeDefinition.getArtifactId () + ":" + archetypeDefinition
+                    .getVersion () + ")"
+                );
+            }
+        } // end if
+
+        if ( !archetypeArtifactManager.exists (
+                archetypeDefinition.getGroupId (),
+                archetypeDefinition.getArtifactId (),
+                archetypeDefinition.getVersion (),
+                localRepository,
+                repositories
+            )
+        )
+        {
+            throw new UnknownArchetype (
+                "The desired archetype does not exist (" + archetypeDefinition.getGroupId () + ":"
+                + archetypeDefinition.getArtifactId () + ":" + archetypeDefinition.getVersion ()
+                + ")"
+            );
+        }
+        else
+        {
+            archetypePropertiesManager.writeProperties (
+                archetypeDefinition.toProperties (),
+                propertyFile
+            );
+        }
+    }
+
+    private Properties initialiseArchetypeId (
+        String archetypeGroupId,
+        String archetypeArtifactId,
+        String archetypeVersion,
+        File propertyFile
+    )
+    throws IOException
+    {
+        Properties properties = new Properties ();
+        try
+        {
+            archetypePropertiesManager.readProperties ( properties, propertyFile );
+        }
+        catch ( FileNotFoundException e )
+        {
+            getLogger ().debug ( "archetype.properties does not exist" );
+        }
+
+        if ( archetypeGroupId != null )
+        {
+            properties.setProperty ( Constants.ARCHETYPE_GROUP_ID, archetypeGroupId );
+        }
+
+        if ( archetypeArtifactId != null )
+        {
+            properties.setProperty ( Constants.ARCHETYPE_ARTIFACT_ID, archetypeArtifactId );
+        }
+
+        if ( archetypeVersion != null )
+        {
+            properties.setProperty ( Constants.ARCHETYPE_VERSION, archetypeVersion );
+        }
+
+        return properties;
+    }
+}

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeSelector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/main/java/org/codehaus/mojo/archetypeng/generator/DefaultArchetypeSelector.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message