You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2007/07/06 18:35:16 UTC
svn commit: r553946 [9/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/maven...
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/PathUtils.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/PathUtils.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/PathUtils.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/PathUtils.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+/*
+ * PathUtils.java
+ *
+ * Created on 7 mai 2007, 21:54
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.codehaus.mojo.archetypeng;
+
+import org.codehaus.plexus.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author rafale
+ */
+public class PathUtils
+{
+ public static String getDirectory ( String file, int level )
+ {
+ String[] fileAsArray = StringUtils.split ( file, "/" );
+ List directoryAsArray = new ArrayList ();
+
+ for ( int i = 0; ( i < level ) && ( i < ( fileAsArray.length - 1 ) ); i++ )
+ {
+ directoryAsArray.add ( fileAsArray[i] );
+ }
+
+ return
+ StringUtils.join (
+ directoryAsArray.toArray ( new String[directoryAsArray.size ()] ),
+ "/"
+ );
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/PathUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/PathUtils.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/PomManager.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/PomManager.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/PomManager.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/PomManager.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,66 @@
+/*
+ * 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;
+
+import org.apache.maven.model.Model;
+
+import org.codehaus.mojo.archetypeng.exception.InvalidPackaging;
+
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import org.dom4j.DocumentException;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+public interface PomManager
+{
+ String ROLE = PomManager.class.getName ();
+
+ /**
+ */
+ void addModule ( File basedirPom, String artifactId )
+ throws FileNotFoundException,
+ IOException,
+ XmlPullParserException,
+ DocumentException,
+ InvalidPackaging;
+
+ /**
+ */
+ void addParent ( File pom, File basedirPom )
+ throws FileNotFoundException, IOException, XmlPullParserException;
+
+ /**
+ */
+ void mergePoms ( File pom, File temporaryPom )
+ throws FileNotFoundException, IOException, XmlPullParserException;
+
+ /**
+ */
+ Model readPom ( File pomFile )
+ throws FileNotFoundException, IOException, XmlPullParserException;
+
+ /**
+ */
+ void writePom ( Model model, File pomFile )
+ throws IOException;
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/PomManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/PomManager.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeGenerationConfigurationFailure.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeGenerationConfigurationFailure.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeGenerationConfigurationFailure.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeGenerationConfigurationFailure.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.exception;
+
+public class ArchetypeGenerationConfigurationFailure
+extends Exception
+{
+ public ArchetypeGenerationConfigurationFailure ( )
+ { }
+
+ public ArchetypeGenerationConfigurationFailure ( String msg )
+ {
+ super ( msg );
+ }
+
+ public ArchetypeGenerationConfigurationFailure ( Throwable cause )
+ {
+ super ( cause );
+ }
+
+ public ArchetypeGenerationConfigurationFailure ( String msg, Throwable cause )
+ {
+ super ( msg, cause );
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeGenerationConfigurationFailure.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeGenerationConfigurationFailure.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeGenerationFailure.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeGenerationFailure.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeGenerationFailure.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeGenerationFailure.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.exception;
+
+public class ArchetypeGenerationFailure
+extends Exception
+{
+ public ArchetypeGenerationFailure ( )
+ { }
+
+ public ArchetypeGenerationFailure ( String msg )
+ {
+ super ( msg );
+ }
+
+ public ArchetypeGenerationFailure ( Throwable cause )
+ {
+ super ( cause );
+ }
+
+ public ArchetypeGenerationFailure ( String msg, Throwable cause )
+ {
+ super ( msg, cause );
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeGenerationFailure.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeGenerationFailure.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeNotConfigured.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeNotConfigured.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeNotConfigured.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeNotConfigured.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.exception;
+
+public class ArchetypeNotConfigured
+extends Exception
+{
+ public ArchetypeNotConfigured ( )
+ { }
+
+ public ArchetypeNotConfigured ( String msg )
+ {
+ super ( msg );
+ }
+
+ public ArchetypeNotConfigured ( Throwable cause )
+ {
+ super ( cause );
+ }
+
+ public ArchetypeNotConfigured ( String msg, Throwable cause )
+ {
+ super ( msg, cause );
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeNotConfigured.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeNotConfigured.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeNotDefined.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeNotDefined.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeNotDefined.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeNotDefined.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.exception;
+
+public class ArchetypeNotDefined
+extends Exception
+{
+ public ArchetypeNotDefined ( )
+ { }
+
+ public ArchetypeNotDefined ( String msg )
+ {
+ super ( msg );
+ }
+
+ public ArchetypeNotDefined ( Throwable cause )
+ {
+ super ( cause );
+ }
+
+ public ArchetypeNotDefined ( String msg, Throwable cause )
+ {
+ super ( msg, cause );
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeNotDefined.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeNotDefined.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeSelectionFailure.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeSelectionFailure.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeSelectionFailure.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeSelectionFailure.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.exception;
+
+public class ArchetypeSelectionFailure
+extends Exception
+{
+ public ArchetypeSelectionFailure ( )
+ { }
+
+ public ArchetypeSelectionFailure ( String msg )
+ {
+ super ( msg );
+ }
+
+ public ArchetypeSelectionFailure ( Throwable cause )
+ {
+ super ( cause );
+ }
+
+ public ArchetypeSelectionFailure ( String msg, Throwable cause )
+ {
+ super ( msg, cause );
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeSelectionFailure.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ArchetypeSelectionFailure.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/InvalidPackaging.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/InvalidPackaging.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/InvalidPackaging.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/InvalidPackaging.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.exception;
+
+public class InvalidPackaging
+extends Exception
+{
+ public InvalidPackaging ( )
+ { }
+
+ public InvalidPackaging ( String msg )
+ {
+ super ( msg );
+ }
+
+ public InvalidPackaging ( Throwable cause )
+ {
+ super ( cause );
+ }
+
+ public InvalidPackaging ( String msg, Throwable cause )
+ {
+ super ( msg, cause );
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/InvalidPackaging.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/InvalidPackaging.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/OutputFileExists.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/OutputFileExists.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/OutputFileExists.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/OutputFileExists.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.exception;
+
+public class OutputFileExists
+extends Exception
+{
+ public OutputFileExists ( )
+ { }
+
+ public OutputFileExists ( String msg )
+ {
+ super ( msg );
+ }
+
+ public OutputFileExists ( Throwable cause )
+ {
+ super ( cause );
+ }
+
+ public OutputFileExists ( String msg, Throwable cause )
+ {
+ super ( msg, cause );
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/OutputFileExists.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/OutputFileExists.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/PomFileExists.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/PomFileExists.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/PomFileExists.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/PomFileExists.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.exception;
+
+public class PomFileExists
+extends Exception
+{
+ public PomFileExists ( )
+ { }
+
+ public PomFileExists ( String msg )
+ {
+ super ( msg );
+ }
+
+ public PomFileExists ( Throwable cause )
+ {
+ super ( cause );
+ }
+
+ public PomFileExists ( String msg, Throwable cause )
+ {
+ super ( msg, cause );
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/PomFileExists.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/PomFileExists.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ProjectDirectoryExists.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ProjectDirectoryExists.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ProjectDirectoryExists.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ProjectDirectoryExists.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.exception;
+
+public class ProjectDirectoryExists
+extends Exception
+{
+ public ProjectDirectoryExists ( )
+ { }
+
+ public ProjectDirectoryExists ( String msg )
+ {
+ super ( msg );
+ }
+
+ public ProjectDirectoryExists ( Throwable cause )
+ {
+ super ( cause );
+ }
+
+ public ProjectDirectoryExists ( String msg, Throwable cause )
+ {
+ super ( msg, cause );
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ProjectDirectoryExists.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/ProjectDirectoryExists.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/TemplateCreationException.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/TemplateCreationException.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/TemplateCreationException.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/TemplateCreationException.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.exception;
+
+public class TemplateCreationException
+extends Exception
+{
+ public TemplateCreationException ( )
+ { }
+
+ public TemplateCreationException ( String msg )
+ {
+ super ( msg );
+ }
+
+ public TemplateCreationException ( Throwable cause )
+ {
+ super ( cause );
+ }
+
+ public TemplateCreationException ( String msg, Throwable cause )
+ {
+ super ( msg, cause );
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/TemplateCreationException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/TemplateCreationException.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/UnknownArchetype.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/UnknownArchetype.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/UnknownArchetype.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/UnknownArchetype.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.exception;
+
+public class UnknownArchetype
+extends Exception
+{
+ public UnknownArchetype ( )
+ { }
+
+ public UnknownArchetype ( String msg )
+ {
+ super ( msg );
+ }
+
+ public UnknownArchetype ( Throwable cause )
+ {
+ super ( cause );
+ }
+
+ public UnknownArchetype ( String msg, Throwable cause )
+ {
+ super ( msg, cause );
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/UnknownArchetype.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/UnknownArchetype.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/UnknownGroup.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/UnknownGroup.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/UnknownGroup.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/UnknownGroup.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.exception;
+
+public class UnknownGroup
+extends Exception
+{
+ public UnknownGroup ( )
+ { }
+
+ public UnknownGroup ( String msg )
+ {
+ super ( msg );
+ }
+
+ public UnknownGroup ( Throwable cause )
+ {
+ super ( cause );
+ }
+
+ public UnknownGroup ( String msg, Throwable cause )
+ {
+ super ( msg, cause );
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/UnknownGroup.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/java/org/codehaus/mojo/archetypeng/exception/UnknownGroup.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/mdo/archetype-common.mdo
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/mdo/archetype-common.mdo?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/mdo/archetype-common.mdo (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-common/src/main/mdo/archetype-common.mdo Fri Jul 6 09:34:35 2007
@@ -0,0 +1,480 @@
+<?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.
+-->
+<model>
+ <id>archetype-common</id>
+ <name>ArchetypeCommon</name>
+
+ <defaults>
+ <default>
+ <key>package</key>
+ <value>org.codehaus.mojo.archetypeng</value>
+ </default>
+ </defaults>
+
+ <classes>
+
+ <class rootElement="true">
+ <name>Archetype</name>
+ <fields>
+ <field>
+ <name>GroupId</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>ArtifactId</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Version</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Name</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Prefix</name>
+ <type>String</type>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <code><![CDATA[
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+
+ if ( !( o instanceof Archetype ) )
+ {
+ return false;
+ }
+
+ Archetype a = (Archetype) o;
+
+ if ( !a.getArtifactId().equals( getArtifactId() ) )
+ {
+ return false;
+ }
+ else if ( !a.getGroupId().equals( getGroupId() ) )
+ {
+ return false;
+ }
+ /*
+ else if ( !a.getPrefix().equals( getPrefix() ) )
+ {
+ return false;
+ }
+ else if ( !a.getName().equals( getName() ) )
+ {
+ return false;
+ }*/
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result = 17;
+ result = 37 * result + getArtifactId().hashCode();
+ result = 37 * result + getGroupId().hashCode();
+ return result;
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class>
+
+ <class>
+ <name>ArchetypeDefinition</name>
+ <fields>
+ <field>
+ <name>GroupId</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>ArtifactId</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Version</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Name</name>
+ <type>String</type>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <code><![CDATA[
+ public void reset ()
+ {
+ setGroupId ( null );
+ setArtifactId ( null );
+ setVersion ( null );
+ }
+
+ public java.util.Properties toProperties ()
+ {
+ java.util.Properties properties = new java.util.Properties ();
+ properties.setProperty (
+ Constants.ARCHETYPE_GROUP_ID,
+ (org.codehaus.plexus.util.StringUtils.isNotEmpty( getGroupId () ) ? getGroupId () : "" )
+ );
+ properties.setProperty (
+ Constants.ARCHETYPE_ARTIFACT_ID,
+ (org.codehaus.plexus.util.StringUtils.isNotEmpty( getArtifactId () ) ? getArtifactId () : "" )
+ );
+ properties.setProperty (
+ Constants.ARCHETYPE_VERSION,
+ (org.codehaus.plexus.util.StringUtils.isNotEmpty( getVersion () ) ? getVersion () : "" )
+ );
+ return properties;
+ }
+
+ public boolean isArtifactDefined ()
+ {
+ return org.codehaus.plexus.util.StringUtils.isNotEmpty( getArtifactId () );
+ }
+
+ public boolean isDefined ()
+ {
+ return isPartiallyDefined () && isVersionDefined ();
+ }
+
+ public boolean isGroupDefined ()
+ {
+ return org.codehaus.plexus.util.StringUtils.isNotEmpty( getGroupId () );
+ }
+
+ public boolean isPartiallyDefined ()
+ {
+ return isGroupDefined () && isArtifactDefined ();
+ }
+
+ public boolean isVersionDefined ()
+ {
+ return org.codehaus.plexus.util.StringUtils.isNotEmpty( getVersion () );
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class>
+
+ <class>
+ <name>ArchetypeConfiguration</name>
+ <fields>
+ <field>
+ <name>GroupId</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>ArtifactId</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Version</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Name</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>RequiredProperties</name>
+ <association>
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <code><![CDATA[
+ public void reset ()
+ {
+ properties.clear ();
+ }
+
+ private java.util.Properties properties = new java.util.Properties ();
+
+ public void setProperty ( String requiredProperty, String propertyValue )
+ {
+ properties.setProperty ( requiredProperty, propertyValue );
+ }
+
+ public String getProperty (String property)
+ {
+ return properties.getProperty ( property, null );
+ }
+
+ public java.util.Properties getProperties ()
+ {
+ return properties;
+ }
+
+ public java.util.Properties toProperties ()
+ {
+ java.util.Properties result = new java.util.Properties ();
+ result.putAll ( properties );
+ result.setProperty (
+ Constants.ARCHETYPE_GROUP_ID,
+ (org.codehaus.plexus.util.StringUtils.isNotEmpty( getGroupId () ) ? getGroupId () : "" )
+ );
+ result.setProperty (
+ Constants.ARCHETYPE_ARTIFACT_ID,
+ (org.codehaus.plexus.util.StringUtils.isNotEmpty( getArtifactId () ) ? getArtifactId () : "" )
+ );
+ result.setProperty (
+ Constants.ARCHETYPE_VERSION,
+ (org.codehaus.plexus.util.StringUtils.isNotEmpty( getVersion () ) ? getVersion () : "" )
+ );
+ return result;
+ }
+
+ public boolean isConfigured ()
+ {
+ boolean configured = true;
+
+ java.util.Iterator requiredProperties = getRequiredProperties().iterator();
+ while ( configured && requiredProperties.hasNext () )
+ {
+ String requiredProperty = (String) requiredProperties.next ();
+
+ configured = configured &&
+ org.codehaus.plexus.util.StringUtils.isNotEmpty(
+ properties.getProperty ( requiredProperty )
+ );
+ }
+
+ return configured;
+ }
+
+ public boolean isConfigured ( String requiredProperties )
+ {
+ return org.codehaus.plexus.util.StringUtils.isNotEmpty (
+ properties.getProperty ( requiredProperties )
+ );
+ }
+
+ private java.util.Properties defaultProperties = new java.util.Properties ();
+
+ public void setDefaultProperty ( String requiredProperty, String propertyValue )
+ {
+ defaultProperties.setProperty ( requiredProperty, propertyValue );
+ }
+
+ public String getDefaultValue (String requiredProperty)
+ {
+ return defaultProperties.getProperty ( requiredProperty, null );
+ }
+
+ public java.util.Properties getDefaultValues ()
+ {
+ return defaultProperties;
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class>
+<!--
+ <class>
+ <name>Template</name>
+ <fields>
+ <field>
+ <name>Directory</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>InnerPath</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Language</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Main</name>
+ <type>boolean</type>
+ </field>
+ <field>
+ <name>Pom</name>
+ <type>boolean</type>
+ </field>
+ <field>
+ <name>Resource</name>
+ <type>boolean</type>
+ </field>
+ <field>
+ <name>SiteResource</name>
+ <type>boolean</type>
+ </field>
+ <field>
+ <name>Source</name>
+ <type>boolean</type>
+ </field>
+ <field>
+ <name>TemplateName</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>TemplatePath</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Test</name>
+ <type>boolean</type>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <code><![CDATA[
+ public Template ( String relativePath )
+ throws org.codehaus.mojo.archetypeng.exception.TemplateCreationException
+ {
+ if ( relativePath.equals ( Constants.ARCHETYPE_POM ) )
+ {
+ setTemplatePath ( relativePath );
+ setPom ( true );
+ }
+ else
+ {
+ setTemplatePath ( relativePath );
+
+ String srcLevel =
+ org.codehaus.plexus.util.StringUtils.prechomp (
+ relativePath,
+ Constants.SRC + "/"
+ );
+
+ String firstLevel =
+ org.codehaus.plexus.util.StringUtils.getPrechomp (
+ srcLevel,
+ "/"
+ ).replace (
+ "/",
+ ""
+ );
+ String afterFirstLevel = org.codehaus.plexus.util.StringUtils.prechomp (
+ srcLevel,
+ "/"
+ );
+ String secondLevel =
+ org.codehaus.plexus.util.StringUtils.getPrechomp (
+ afterFirstLevel,
+ "/"
+ ).replace (
+ "/",
+ ""
+ );
+ String aftersecondLevel = org.codehaus.plexus.util.StringUtils.prechomp (
+ afterFirstLevel,
+ "/"
+ );
+ String afterLevel;
+
+ if ( Constants.MAIN.equals ( firstLevel ) )
+ {
+ setMain ( true );
+ }
+ else if ( Constants.TEST.equals ( firstLevel ) )
+ {
+ setTest ( true );
+ }
+ else if ( Constants.SITE.equals ( firstLevel ) )
+ {
+ setSiteResource ( true );
+ }
+ else
+ {
+ throw new org.codehaus.mojo.archetypeng.exception.TemplateCreationException (
+ "Unknown directory " + firstLevel
+ );
+ }
+
+ if ( isMain () || isTest () )
+ {
+ if ( Constants.LANGUAGES.contains ( secondLevel ) )
+ {
+ setSource ( true );
+ setLanguage ( secondLevel );
+ }
+ else
+ {
+ setResource ( true );
+ setDirectory ( secondLevel );
+ }
+ afterLevel = aftersecondLevel;
+ }
+ else
+ { // isSiteResource
+ afterLevel = afterFirstLevel;
+ }
+
+ if ( org.codehaus.plexus.util.StringUtils.countMatches ( afterLevel, "/" ) > 0 )
+ {
+ setInnerPath (
+ org.codehaus.plexus.util.StringUtils.chomp ( afterLevel, "/" )
+ );
+ setTemplateName (
+ org.codehaus.plexus.util.StringUtils.getChomp (
+ afterLevel,
+ "/"
+ ).replace (
+ "/",
+ ""
+ )
+ );
+ }
+ else
+ {
+ setInnerPath ( "" );
+ setTemplateName ( afterLevel );
+ }
+ } // end if
+ }
+
+ public String toString ()
+ {
+ return
+ ( isPom ()
+ ? "POM"
+ : ( isMain ()
+ ? ( "MAIN"
+ + ( isSource () ? ( "-SOURCE(" + getLanguage () + ")" )
+ : ( "-RESOURCE(" + getDirectory () + ")" ) )
+ + ( "".equals ( getInnerPath () ) ? "" : ( "-" + getInnerPath () ) )
+ + "-" + getTemplateName () )
+ : ( isTest ()
+ ? ( "TEST"
+ + ( isSource () ? ( "-SOURCE(" + getLanguage () + ")" )
+ : ( "-RESOURCE(" + getDirectory () + ")" ) )
+ + ( "".equals ( getInnerPath () ) ? "" : ( "-" + getInnerPath () ) )
+ + "-" + getTemplateName () )
+ : ( "SITE"
+ + ( "".equals ( getInnerPath () ) ? "" : ( "-" + getInnerPath () ) )
+ + "-" + getTemplateName () ) ) ) );
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class>
+-->
+ </classes>
+</model>
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/pom.xml?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/pom.xml (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/pom.xml Fri Jul 6 09:34:35 2007
@@ -0,0 +1,78 @@
+<?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-creator</artifactId>
+
+ <name>Maven ArchetypeNG Creator</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.mojo.archetypeng</groupId>
+ <artifactId>maven-archetypeng-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-plugin-testing-harness</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-interactivity-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.mojo.archetypeng</groupId>
+ <artifactId>maven-archetypeng-archetype-descriptor</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</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>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreationConfigurator.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreationConfigurator.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreationConfigurator.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreationConfigurator.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.creator;
+
+import java.util.List;
+import org.apache.maven.project.MavenProject;
+
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotConfigured;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotDefined;
+import org.codehaus.mojo.archetypeng.exception.TemplateCreationException;
+
+import org.codehaus.plexus.components.interactivity.PrompterException;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import java.util.Properties;
+
+public interface ArchetypeCreationConfigurator
+{
+ String ROLE = ArchetypeCreationConfigurator.class.getName ();
+
+ void configureArchetypeCreation (
+ MavenProject project,
+ Boolean interactiveMode,
+ Properties commandLineProperties,
+ File propertyFile,
+ List languages
+ )
+ throws FileNotFoundException,
+ IOException,
+ ArchetypeNotDefined,
+ ArchetypeNotConfigured,
+ PrompterException,
+ TemplateCreationException;
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreationConfigurator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreationConfigurator.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreationQueryer.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreationQueryer.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreationQueryer.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreationQueryer.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,84 @@
+/*
+ * 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.creator;
+
+import org.codehaus.mojo.archetypeng.ArchetypeConfiguration;
+
+import org.codehaus.plexus.components.interactivity.PrompterException;
+
+public interface ArchetypeCreationQueryer
+{
+ String ROLE = ArchetypeCreationQueryer.class.getName ();
+
+ /**
+ */
+ String getArchetypeArtifactId ( String defaultValue )
+ throws PrompterException;
+
+ /**
+ */
+ String getArchetypeGroupId ( String defaultValue )
+ throws PrompterException;
+
+ /**
+ */
+ String getArchetypeVersion ( String defaultValue )
+ throws PrompterException;
+
+ /**
+ */
+ String getArtifactId ( String defaultValue )
+ throws PrompterException;
+
+ /**
+ */
+ boolean askAddAnotherProperty ()
+ throws PrompterException;
+
+ /**
+ */
+ String askNewPropertyKey ()
+ throws PrompterException;
+
+ /**
+ */
+ String askReplacementValue ( String propertyKey, String defaultValue )
+ throws PrompterException;
+
+ /**
+ */
+ boolean confirmConfiguration ( ArchetypeConfiguration archetypeConfiguration )
+ throws PrompterException;
+
+ /**
+ */
+ String getGroupId ( String defaultValue )
+ throws PrompterException;
+
+ /**
+ */
+ String getPackage ( String defaultValue )
+ throws PrompterException;
+
+ /**
+ */
+ String getVersion ( String defaultValue )
+ throws PrompterException;
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreationQueryer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreationQueryer.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreator.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreator.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreator.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreator.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,45 @@
+/*
+ * 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.creator;
+
+import org.apache.maven.project.MavenProject;
+
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotConfigured;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotDefined;
+import org.codehaus.mojo.archetypeng.exception.TemplateCreationException;
+
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+public interface ArchetypeCreator
+{
+ String ROLE = ArchetypeCreator.class.getName ();
+
+ void createArchetype ( MavenProject project, File propertyFile, List languages, List filtereds,
+ String defaultEncoding )
+ throws IOException,
+ ArchetypeNotDefined,
+ ArchetypeNotConfigured,
+ TemplateCreationException,
+ XmlPullParserException;
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/ArchetypeCreator.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/DefaultArchetypeCreationConfigurator.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/DefaultArchetypeCreationConfigurator.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/DefaultArchetypeCreationConfigurator.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/DefaultArchetypeCreationConfigurator.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,372 @@
+/*
+ * 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.creator;
+
+import org.apache.maven.project.MavenProject;
+
+import org.codehaus.mojo.archetypeng.ArchetypeConfiguration;
+import org.codehaus.mojo.archetypeng.ArchetypeDefinition;
+import org.codehaus.mojo.archetypeng.ArchetypeFactory;
+import org.codehaus.mojo.archetypeng.ArchetypeFilesResolver;
+import org.codehaus.mojo.archetypeng.ArchetypePropertiesManager;
+import org.codehaus.mojo.archetypeng.Constants;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotConfigured;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotDefined;
+import org.codehaus.mojo.archetypeng.exception.TemplateCreationException;
+
+import org.codehaus.plexus.components.interactivity.PrompterException;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.StringUtils;
+
+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 DefaultArchetypeCreationConfigurator
+extends AbstractLogEnabled
+implements ArchetypeCreationConfigurator
+{
+ /**
+ * @plexus.requirement
+ */
+ private ArchetypeCreationQueryer archetypeCreationQueryer;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArchetypeFactory archetypeFactory;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArchetypeFilesResolver archetypeFilesResolver;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArchetypePropertiesManager archetypePropertiesManager;
+
+ public void configureArchetypeCreation (
+ MavenProject project,
+ Boolean interactiveMode,
+ Properties commandLineProperties,
+ File propertyFile,
+ List languages
+ )
+ throws FileNotFoundException,
+ IOException,
+ ArchetypeNotDefined,
+ ArchetypeNotConfigured,
+ PrompterException,
+ TemplateCreationException
+ {
+ Properties properties =
+ initialiseArchetypeProperties ( commandLineProperties, propertyFile );
+
+ ArchetypeDefinition archetypeDefinition =
+ archetypeFactory.createArchetypeDefinition ( properties );
+
+ if ( !archetypeDefinition.isDefined () )
+ {
+ archetypeDefinition = defineDefaultArchetype ( project, properties );
+ }
+
+ ArchetypeConfiguration archetypeConfiguration =
+ archetypeFactory.createArchetypeConfiguration (
+ project,
+ archetypeDefinition,
+ properties
+ );
+
+ String resolvedPackage =
+ archetypeFilesResolver.resolvePackage ( project.getBasedir (), languages );
+
+ if ( !archetypeConfiguration.isConfigured () )
+ {
+ archetypeConfiguration =
+ defineDefaultConfiguration (
+ project,
+ archetypeDefinition,
+ resolvedPackage,
+ properties
+ );
+ }
+
+ if ( interactiveMode.booleanValue () )
+ {
+ getLogger ().debug ( "Entering interactive mode" );
+
+ boolean confirmed = false;
+ while ( !confirmed )
+ {
+ if ( !archetypeDefinition.isDefined () )
+ {
+ getLogger ().debug ( "Archetype is not defined" );
+ if ( !archetypeDefinition.isGroupDefined () )
+ {
+ getLogger ().debug ( "Asking for archetype's groupId" );
+ archetypeDefinition.setGroupId (
+ archetypeCreationQueryer.getArchetypeGroupId ( project.getGroupId () )
+ );
+ }
+ if ( !archetypeDefinition.isArtifactDefined () )
+ {
+ getLogger ().debug ( "Asking for archetype's artifactId" );
+ archetypeDefinition.setArtifactId (
+ archetypeCreationQueryer.getArchetypeArtifactId (
+ project.getArtifactId () + Constants.ARCHETYPE_SUFFIX
+ )
+ );
+ }
+ if ( !archetypeDefinition.isVersionDefined () )
+ {
+ getLogger ().debug ( "Asking for archetype's version" );
+ archetypeDefinition.setVersion (
+ archetypeCreationQueryer.getArchetypeVersion ( project.getVersion () )
+ );
+ }
+
+ archetypeFactory.updateArchetypeConfiguration (
+ archetypeConfiguration,
+ archetypeDefinition
+ );
+ }
+
+ if ( !archetypeConfiguration.isConfigured () )
+ {
+ getLogger ().debug ( "Archetype is not configured" );
+ if ( !archetypeConfiguration.isConfigured ( Constants.GROUP_ID ) )
+ {
+ getLogger ().debug ( "Asking for project's groupId" );
+ archetypeConfiguration.setProperty (
+ Constants.GROUP_ID,
+ archetypeCreationQueryer.getGroupId (
+ archetypeConfiguration.getDefaultValue ( Constants.GROUP_ID )
+ )
+ );
+ }
+ if ( !archetypeConfiguration.isConfigured ( Constants.ARTIFACT_ID ) )
+ {
+ getLogger ().debug ( "Asking for project's artifactId" );
+ archetypeConfiguration.setProperty (
+ Constants.ARTIFACT_ID,
+ archetypeCreationQueryer.getArtifactId (
+ archetypeConfiguration.getDefaultValue ( Constants.ARTIFACT_ID )
+ )
+ );
+ }
+ if ( !archetypeConfiguration.isConfigured ( Constants.VERSION ) )
+ {
+ getLogger ().debug ( "Asking for project's version" );
+ archetypeConfiguration.setProperty (
+ Constants.VERSION,
+ archetypeCreationQueryer.getVersion (
+ archetypeConfiguration.getDefaultValue ( Constants.VERSION )
+ )
+ );
+ }
+ if ( !archetypeConfiguration.isConfigured ( Constants.PACKAGE ) )
+ {
+ getLogger ().debug ( "Asking for project's package" );
+ archetypeConfiguration.setProperty (
+ Constants.PACKAGE,
+ archetypeCreationQueryer.getPackage (
+ StringUtils.isEmpty ( resolvedPackage )
+ ? archetypeConfiguration.getDefaultValue ( Constants.PACKAGE )
+ : resolvedPackage
+ )
+ );
+ }
+ } // end if
+
+ boolean stopAddingProperties = false;
+ while ( !stopAddingProperties )
+ {
+ getLogger ().debug ( "Asking for another required property" );
+ stopAddingProperties = !archetypeCreationQueryer.askAddAnotherProperty ();
+
+ if ( !stopAddingProperties )
+ {
+ getLogger ().debug ( "Asking for required property key" );
+
+ String propertyKey = archetypeCreationQueryer.askNewPropertyKey ();
+ getLogger ().debug ( "Asking for required property value" );
+
+ String replacementValue =
+ archetypeCreationQueryer.askReplacementValue (
+ propertyKey,
+ archetypeConfiguration.getDefaultValue ( propertyKey )
+ );
+ archetypeConfiguration.setDefaultProperty ( propertyKey, replacementValue );
+ archetypeConfiguration.setProperty ( propertyKey, replacementValue );
+ }
+ }
+
+ getLogger ().debug ( "Asking for configuration confirmation" );
+ if ( archetypeCreationQueryer.confirmConfiguration ( archetypeConfiguration ) )
+ {
+ confirmed = true;
+ }
+ else
+ {
+ getLogger ().debug ( "Reseting archetype's definition and configuration" );
+ archetypeConfiguration.reset ();
+ archetypeDefinition.reset ();
+ }
+ } // end while
+ }
+ else
+ {
+ getLogger ().debug ( "Entering batch mode" );
+ if ( !archetypeDefinition.isDefined () )
+ {
+ throw new ArchetypeNotDefined ( "The archetype is not defined" );
+ }
+ else if ( !archetypeConfiguration.isConfigured () )
+ {
+ throw new ArchetypeNotConfigured ( "The archetype is not configured" );
+ }
+ } // end if
+
+ archetypePropertiesManager.writeProperties (
+ archetypeConfiguration.toProperties (),
+ propertyFile
+ );
+ }
+
+ private ArchetypeDefinition defineDefaultArchetype (
+ MavenProject project,
+ Properties properties
+ )
+ {
+ if ( StringUtils.isEmpty ( properties.getProperty ( Constants.ARCHETYPE_GROUP_ID ) ) )
+ {
+ getLogger ().info ( "Setting default archetype's groupId: " + project.getGroupId () );
+ properties.setProperty ( Constants.ARCHETYPE_GROUP_ID, project.getGroupId () );
+ }
+ if ( StringUtils.isEmpty ( properties.getProperty ( Constants.ARCHETYPE_ARTIFACT_ID ) ) )
+ {
+ getLogger ().info (
+ "Setting default archetype's artifactId: " + project.getArtifactId ()
+ );
+ properties.setProperty (
+ Constants.ARCHETYPE_ARTIFACT_ID,
+ project.getArtifactId () + "-archetype"
+ );
+ }
+ if ( StringUtils.isEmpty ( properties.getProperty ( Constants.ARCHETYPE_VERSION ) ) )
+ {
+ getLogger ().info ( "Setting default archetype's version: " + project.getVersion () );
+ properties.setProperty ( Constants.ARCHETYPE_VERSION, project.getVersion () );
+ }
+
+ return archetypeFactory.createArchetypeDefinition ( properties );
+ }
+
+ private ArchetypeConfiguration defineDefaultConfiguration (
+ MavenProject project,
+ ArchetypeDefinition archetypeDefinition,
+ String resolvedPackage,
+ Properties properties
+ )
+ {
+ if ( StringUtils.isEmpty ( properties.getProperty ( Constants.GROUP_ID ) ) )
+ {
+ getLogger ().info ( "Setting default groupId: " + project.getGroupId () );
+ properties.setProperty ( Constants.GROUP_ID, project.getGroupId () );
+ }
+
+ if ( StringUtils.isEmpty ( properties.getProperty ( Constants.ARTIFACT_ID ) ) )
+ {
+ getLogger ().info ( "Setting default artifactId: " + project.getArtifactId () );
+ properties.setProperty ( Constants.ARTIFACT_ID, project.getArtifactId () );
+ }
+
+ if ( StringUtils.isEmpty ( properties.getProperty ( Constants.VERSION ) ) )
+ {
+ getLogger ().info ( "Setting default version: " + project.getVersion () );
+ properties.setProperty ( Constants.VERSION, project.getVersion () );
+ }
+
+ if ( StringUtils.isEmpty (
+ properties.getProperty (
+ Constants.PACKAGE,
+ properties.getProperty ( Constants.PACKAGE_NAME )
+ )
+ )
+ )
+ {
+ if ( StringUtils.isEmpty ( resolvedPackage ) )
+ {
+ resolvedPackage = project.getGroupId ();
+ }
+ getLogger ().info ( "Setting default package: " + resolvedPackage );
+ properties.setProperty ( Constants.PACKAGE_NAME, resolvedPackage );
+ properties.setProperty ( Constants.PACKAGE, resolvedPackage );
+ }
+
+ return
+ archetypeFactory.createArchetypeConfiguration (
+ project,
+ archetypeDefinition,
+ properties
+ );
+ }
+
+ private Properties initialiseArchetypeProperties (
+ Properties commandLineProperties,
+ File propertyFile
+ )
+ throws IOException
+ {
+ Properties properties = new Properties ();
+
+ try
+ {
+ archetypePropertiesManager.readProperties ( properties, propertyFile );
+ }
+ catch ( FileNotFoundException ex )
+ {
+ getLogger ().debug ( "archetype.properties does not exist" );
+ }
+
+ 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-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/DefaultArchetypeCreationConfigurator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-creator/src/main/java/org/codehaus/mojo/archetypeng/creator/DefaultArchetypeCreationConfigurator.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"