geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r369099 [5/5] - in /geronimo/trunk: assemblies/j2ee-installer/ assemblies/j2ee-installer/src/izpack/ assemblies/j2ee-installer/src/var/config/ modules/installer-processing/ modules/installer-processing/src/ modules/installer-processing/src/...
Date Sat, 14 Jan 2006 21:31:23 GMT
Added: geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/ValidatePackSelectionsAutomationHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/ValidatePackSelectionsAutomationHelper.java?rev=369099&view=auto
==============================================================================
--- geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/ValidatePackSelectionsAutomationHelper.java
(added)
+++ geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/ValidatePackSelectionsAutomationHelper.java
Sat Jan 14 13:31:11 2006
@@ -0,0 +1,168 @@
+/*
+ * modified for Geronimo....  Based on....
+ * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
+ * 
+ * http://www.izforge.com/izpack/
+ * http://developer.berlios.de/projects/izpack/
+ * 
+ * Copyright 2003 Jonathan Halliday
+ * Copyright 2002 Elmar Grom
+ * 
+ * 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.
+ */
+
+package com.izforge.izpack.panels;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Vector;
+
+import net.n3.nanoxml.XMLElement;
+
+import com.izforge.izpack.Pack;
+import com.izforge.izpack.installer.AutomatedInstallData;
+import com.izforge.izpack.installer.PanelAutomation;
+import com.izforge.izpack.util.Debug;
+
+/**
+ * Functions to support automated usage of the UserInputPanel
+ * 
+ * @author Jonathan Halliday
+ * @author Elmar Grom
+ */
+public class ValidatePackSelectionsAutomationHelper implements PanelAutomation
+{
+
+    // ------------------------------------------------------
+    // automatic script section keys
+    // ------------------------------------------------------
+    private static final String AUTO_KEY_USER_INPUT = "userInput";
+    private static final String AUTO_ATTR_PANEL_NAME ="panelName";
+
+    private static final String AUTO_KEY_ENTRY = "entry";
+
+    // ------------------------------------------------------
+    // automatic script keys attributes
+    // ------------------------------------------------------
+    private static final String AUTO_ATTRIBUTE_KEY = "key";
+
+    private static final String AUTO_ATTRIBUTE_VALUE = "value";
+
+    // ------------------------------------------------------
+    // String-String key-value pairs
+    // ------------------------------------------------------
+    private Map entries;
+
+    private String panelName = null;
+
+    public ValidatePackSelectionsAutomationHelper()
+    {
+        this.entries = null;
+    }
+
+    /**
+     * 
+     * @param entries String-String key-value pairs representing the state of the Panel
+     */
+    public ValidatePackSelectionsAutomationHelper(Map entries, String panelName )
+    {
+        this.panelName = panelName;
+        this.entries = entries;
+    }
+
+    /**
+     * Serialize state to XML and insert under panelRoot.
+     * 
+     * @param idata The installation data.
+     * @param panelRoot The XML root element of the panels blackbox tree.
+     */
+    public void makeXMLData(AutomatedInstallData idata, XMLElement panelRoot )
+    {
+        XMLElement userInput;
+        XMLElement dataElement;
+
+        // ----------------------------------------------------
+        // add the item that combines all entries
+        // ----------------------------------------------------
+        userInput = new XMLElement(AUTO_KEY_USER_INPUT);
+        userInput.setAttribute( AUTO_ATTR_PANEL_NAME, panelName );
+        // ###ead - bug.  Multiple entries into panel result in
+        //                multiple XML panel entries.
+        Vector panels = panelRoot.getChildrenNamed(AUTO_KEY_USER_INPUT);
+        for( int i = 0; i < panels.size(); ++i ) {
+           panelRoot.removeChild( (XMLElement)panels.elementAt(i) );
+        }
+        panelRoot.addChild(userInput);
+
+        // ----------------------------------------------------
+        // add all entries
+        // ----------------------------------------------------
+        Iterator keys = entries.keySet().iterator();
+        while (keys.hasNext())
+        {
+            String key = (String) keys.next();
+            String value = (String) entries.get(key);
+
+            dataElement = new XMLElement(AUTO_KEY_ENTRY);
+            dataElement.setAttribute(AUTO_ATTRIBUTE_KEY, key);
+            dataElement.setAttribute(AUTO_ATTRIBUTE_VALUE, value);
+
+            userInput.addChild(dataElement);
+        }
+    }
+
+    /**
+     * Deserialize state from panelRoot and set idata variables accordingly.
+     * 
+     * @param idata The installation data.
+     * @param panelRoot The XML root element of the panels blackbox tree.
+     */
+    public void runAutomated(AutomatedInstallData idata, XMLElement panelRoot)
+    {
+        XMLElement userInput;
+        XMLElement dataElement;
+        String variable;
+        String value;
+
+        // ----------------------------------------------------
+        // get the section containing the user entries
+        // ----------------------------------------------------
+        userInput = panelRoot.getFirstChildNamed(AUTO_KEY_USER_INPUT);
+
+        if (userInput == null) { return; }
+        String panelName = userInput.getAttribute( AUTO_ATTR_PANEL_NAME );
+        if( panelName == null ) {
+           System.out.println("Auto-installation will fail. Panel name not set in xml" );
+        }
+
+        Vector userEntries = userInput.getChildrenNamed(AUTO_KEY_ENTRY);
+
+        if (userEntries == null) { return; }
+
+        // ----------------------------------------------------
+        // retieve each entry and substitute the associated
+        // variable
+        // ----------------------------------------------------
+        for (int i = 0; i < userEntries.size(); i++)
+        {
+            dataElement = (XMLElement) userEntries.elementAt(i);
+            variable = dataElement.getAttribute(AUTO_ATTRIBUTE_KEY);
+            value = dataElement.getAttribute(AUTO_ATTRIBUTE_VALUE);
+
+            Debug.trace("ValidatePackSelections: setting variable " + variable + " to " +
value);
+            idata.setVariable(variable, value);
+        }
+        GeronimoConfigProcessor gcp = new GeronimoConfigProcessor();
+        gcp.processAutomatedInput( idata, panelName );
+    }
+}

Added: geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/Validator.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/Validator.java?rev=369099&view=auto
==============================================================================
--- geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/Validator.java
(added)
+++ geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/Validator.java
Sat Jan 14 13:31:11 2006
@@ -0,0 +1,46 @@
+/*
+ * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
+ * 
+ * http://www.izforge.com/izpack/
+ * http://developer.berlios.de/projects/izpack/
+ * 
+ * Copyright 2002 Elmar Grom
+ * 
+ * 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.
+ */
+
+package com.izforge.izpack.panels;
+
+/*---------------------------------------------------------------------------*/
+/**
+ * Interface for classes that provide rule validation services.
+ * 
+ * @version 0.0.1 / 10/26/02
+ * @author Elmar Grom
+ */
+/*---------------------------------------------------------------------------*/
+public interface Validator
+{
+
+    /*--------------------------------------------------------------------------*/
+    /**
+     * Validates the contend of an input field.
+     * 
+     * @param client the client object using the services of this validator.
+     * 
+     * @return <code>true</code> if the validation passes, otherwise <code>false</code>.
+     */
+    /*--------------------------------------------------------------------------*/
+    public boolean validate(ProcessingClient client);
+}
+/*---------------------------------------------------------------------------*/

Modified: geronimo/trunk/plugins/geronimo-assembly-plugin/plugin.jelly
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/geronimo-assembly-plugin/plugin.jelly?rev=369099&r1=369098&r2=369099&view=diff
==============================================================================
--- geronimo/trunk/plugins/geronimo-assembly-plugin/plugin.jelly (original)
+++ geronimo/trunk/plugins/geronimo-assembly-plugin/plugin.jelly Sat Jan 14 13:31:11 2006
@@ -227,7 +227,56 @@
         <attainGoal name="assemble:assemble-lib"/>
         <attainGoal name="assemble:assemble-unpack"/>
         <attainGoal name="assemble:assemble-configurations-to-repo"/>
+        <attainGoal name="assemble:assemble-installer-helpers"/>
         <attainGoal name="assemble:assemble-schemas"/>
+    </goal>
+    <goal name="assemble:assemble-installer-helpers">
+        <ant:copy todir="${geronimo.assembly.dest}/var/temp" >
+           <ant:fileset file="${maven.repo.local}/geronimo/plugins/geronimo-assembly-plugin*.jar"/>
+        </ant:copy>
+        <ant:copy todir="${geronimo.assembly.dest}/var/temp" >
+           <ant:fileset file="${maven.repo.local}/geronimo/jars/geronimo-installer-processing-${pom.currentVersion}.jar"/>
+        </ant:copy>
+        <j:set var="configStoreDir" value="${geronimo.assembly.dest}/config-store"/>
+        <!--        <ant:delete dir="${configStoreDir}"/>-->
+        <ant:mkdir dir="${configStoreDir}"/>
+        <ant:mkdir dir="${geronimo.assembly.dest}/var/config"/>
+        <j:file name="${geronimo.assembly.dest}/var/config/configure.xml" append="false"
outputMode="xml" escapeText="false" trim="false">
+           &lt;!-- used only for install. This file may be removed. --&gt;
+           &lt;configurations&gt;
+        </j:file>
+        <j:set var="DS" value="$" />
+        <j:set var="LB" value="{" />
+        <j:set var="RB" value="}" />
+        <j:forEach var="artifact" items="${pom.artifacts}">
+            <j:set var="dependency" value="${artifact.dependency}"/>
+            <j:if test="${dependency.type == 'car'}">
+                <j:file name="${geronimo.assembly.dest}/var/config/configure.xml" append="true"
outputMode="xml" omitXmlDeclaration="true" escapeText="false" trim="false">           

+                    &lt;configuration&gt;
+                </j:file> 
+                <j:if test="${dependency.getProperty('geronimo.assemble') == 'install'}">
+                    <j:set var="PACK" value="${dependency.getProperty('geronimo.pack')}"/>
+                    <j:file name="${geronimo.assembly.dest}/var/config/configure.xml"
append="true" outputMode="xml" omitXmlDeclaration="true" escapeText="false" trim="false">
           
+                      &lt;artifact&gt;${dependency.getGroupId()}/${dependency.getArtifactId()}/${dependency.getVersion()}/${dependency.getType()}
&lt;/artifact&gt;
+                      &lt;selected&gt;${DS}${LB}${PACK}${RB}&lt;/selected&gt;
+                    </j:file>
+                </j:if>
+
+                <!-- handle executable configs -->
+                <j:if test="${dependency.getProperty('geronimo.assemble.executable') !=
null}">
+                    <j:set var="exe" value="${dependency.getProperty('geronimo.assemble.executable')}"/>
+                    <j:file name="${geronimo.assembly.dest}/var/config/configure.xml"
append="true" outputMode="xml" omitXmlDeclaration="true" escapeText="false" trim="false">
           
+                      &lt;executable&gt;${exe}&lt;/executable&gt;
+                    </j:file>
+                </j:if>
+                <j:file name="${geronimo.assembly.dest}/var/config/configure.xml" append="true"
outputMode="xml" omitXmlDeclaration="true" escapeText="false" trim="false">
+                    &lt;/configuration&gt;
+                </j:file> 
+            </j:if>
+        </j:forEach>
+        <j:file name="${geronimo.assembly.dest}/var/config/configure.xml" append="true"
outputMode="xml" escapeText="false" trim="false" omitXmlDeclaration="true">
+           &lt;/configurations&gt;
+        </j:file>
     </goal>
 
     <goal name="assemble:jar-assembly" prereqs="assemble:assemble">

Modified: geronimo/trunk/plugins/geronimo-izpack-plugin/plugin.jelly
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/geronimo-izpack-plugin/plugin.jelly?rev=369099&r1=369098&r2=369099&view=diff
==============================================================================
--- geronimo/trunk/plugins/geronimo-izpack-plugin/plugin.jelly (original)
+++ geronimo/trunk/plugins/geronimo-izpack-plugin/plugin.jelly Sat Jan 14 13:31:11 2006
@@ -61,14 +61,15 @@
                 <ant:include name="STATUS"/>
             </ant:fileset>
         </ant:copy>
-
+        <!-- this dir is needed after install -->
+        <ant:mkdir dir="${geronimo.assembly.dest}/var/temp"/>
     </goal>
 
 
     <goal name="izpack:izpack-installer-build" prereqs="izpack:izpack-prepare" >
         <echo>IZPack installer build is running.</echo>
         <echo>IZPack Version is ${izpack_version}</echo>
-        <ant:java jar="${maven.repo.local}/izpack/jars/standalone-compiler-${izpack_version}.jar"
+        <ant:java jar="${maven.repo.local}/geronimo/jars/standalone-compiler-custom-${izpack_version}.jar"
               fork="true" >
            <arg value="${geronimo.assembly.dest}/geronimo-izpack.xml" />
            <arg value="-o" />

Modified: geronimo/trunk/plugins/geronimo-izpack-plugin/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/geronimo-izpack-plugin/project.xml?rev=369099&r1=369098&r2=369099&view=diff
==============================================================================
--- geronimo/trunk/plugins/geronimo-izpack-plugin/project.xml (original)
+++ geronimo/trunk/plugins/geronimo-izpack-plugin/project.xml Sat Jan 14 13:31:11 2006
@@ -37,8 +37,8 @@
             <version>1.1-SNAPSHOT</version>
         </dependency>
         <dependency>
-            <groupId>izpack</groupId>
-            <artifactId>standalone-compiler</artifactId>
+            <groupId>geronimo</groupId>
+            <artifactId>standalone-compiler-custom</artifactId>
             <version>3.8.0</version>
         </dependency>
     </dependencies>



Mime
View raw message