geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r369099 [2/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-processing/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/installer-processing/project.xml?rev=369099&view=auto
==============================================================================
--- geronimo/trunk/modules/installer-processing/project.xml (added)
+++ geronimo/trunk/modules/installer-processing/project.xml Sat Jan 14 13:31:11 2006
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright 2004 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.
+-->
+
+<!-- $Rev: 330381 $ $Date: 2005-11-02 18:02:55 -0500 (Wed, 02 Nov 2005) $ -->
+<project>
+    <pomVersion>3</pomVersion>
+    <extend>../../etc/project.xml</extend>
+
+    <!-- ===================== -->
+    <!-- Module Identification -->
+    <!-- ===================== -->
+    <name>Geronimo :: Installer Processing</name>
+    <id>geronimo-installer-processing</id>
+    <shortDescription>Geronimo Installer Processing</shortDescription>
+    <description>Geronimo Installer Processing</description>
+    <url>http://geronimo.apache.org/modules/installer-processing/</url>
+    <siteDirectory>/www/geronimo.apache.org/modules/installer-processing</siteDirectory>
+    <distributionDirectory>/www/incubator.apache.org/projects/geronimo/builds/installer-processing</distributionDirectory>
+    <package>org.apache.geronimo.installer</package>
+
+    <!-- ============ -->
+    <!-- Dependencies -->
+    <!-- ============ -->
+    <dependencies>
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-dependency-plugin</artifactId>
+            <version>${geronimo_dependency_plugin_version}</version>
+            <type>plugin</type>
+        </dependency>
+
+        <dependency>
+            <groupId>xerces</groupId>
+            <artifactId>xerces</artifactId>
+            <version>2.4.0</version>
+        </dependency>
+
+     </dependencies>
+
+
+    <!-- =================== -->
+    <!-- Build Specification -->
+    <!-- =================== -->
+    <build>
+        <unitTest>
+            <includes>
+	        <include>**/**Test.java</include>
+            </includes>
+            <resources>
+                <resource>
+                    <directory>${basedir}/src/test-resources</directory>
+                </resource>
+            </resources>
+        </unitTest>
+    </build>
+</project>

Added: geronimo/trunk/modules/installer-processing/src/java/org/apache/geronimo/installer/processing/ConfigInstaller.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/installer-processing/src/java/org/apache/geronimo/installer/processing/ConfigInstaller.java?rev=369099&view=auto
==============================================================================
--- geronimo/trunk/modules/installer-processing/src/java/org/apache/geronimo/installer/processing/ConfigInstaller.java (added)
+++ geronimo/trunk/modules/installer-processing/src/java/org/apache/geronimo/installer/processing/ConfigInstaller.java Sat Jan 14 13:31:11 2006
@@ -0,0 +1,352 @@
+/*
+ * Apache 2.0 license
+ *
+*/
+package org.apache.geronimo.installer.processing;
+import org.apache.xerces.dom.TextImpl;
+import org.apache.xerces.parsers.DOMParser;
+import org.w3c.dom.Document;
+import org.w3c.dom.Text;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+import java.lang.reflect.Method;
+import java.util.Vector;
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+public class ConfigInstaller  {
+   // read the configure.xml
+   // punch it into LocalConfigInstaller along with moving any 
+   //    exes necessary (do proper chmods)
+   protected static String installRoot = null;
+   protected static String xmlName = null; // offset from installRoot
+   protected static boolean fTrace = false;
+   protected static URLClassLoader cl = null;
+
+   protected static void initClassLoader() {
+      Vector vjars = new Vector();
+      try {
+         getJars( new File(installRoot), vjars );
+      } catch( Exception e ) {
+         throw new RuntimeException( "unable to build list of jars for classloader" );
+      }
+      Object ojars[] = vjars.toArray();
+      URL jars[] = new URL[ ojars.length ];
+      System.arraycopy( ojars, 0, jars, 0, ojars.length );
+      //for( int i = 0; i < jars.length; ++i ) {
+      //   System.out.println( "jar: " + jars[i].toString() );
+      //}
+      cl = new URLClassLoader( jars, Thread.currentThread().getContextClassLoader() );
+      //System.out.println( "CL: " + cl );
+   }
+
+   protected static void getJars( File baseDir, Vector jars ) throws Exception {
+      File files[] = baseDir.listFiles(); 
+      for( int i = 0; i < files.length; ++i ) {
+         if( files[ i ].isDirectory() ) {
+            getJars( files[ i ], jars );
+         } else {
+            String name = files[ i ].getCanonicalPath();
+            String nameUp = name.toUpperCase();
+            if( nameUp.endsWith( ".JAR" )) {
+                jars.add( files[ i ].toURL() );
+                //System.out.println( "getJars: added " + files[ i ].toURL() );
+            }
+         }
+      }
+   }
+
+   // args:
+   //    installRoot
+   //    configuration xml (var/config/configure.xml)
+
+   public static void main( String args[] ) {
+      if( args.length >= 1 ) 
+         installRoot = args[0];
+      if( args.length >= 2 )
+         xmlName = args[1];
+      if( args.length >=3 ) {
+         String parts[] = args[2].split("=");
+         String varName = parts[0];
+         String value = parts[1];
+         System.out.println( "Found var: " + varName + " value = " + value );
+         if( varName.equalsIgnoreCase( "trace" )) {
+            fTrace = false;
+            if( value.equalsIgnoreCase( "true" ))
+               fTrace = true;
+         }
+      }
+      if( installRoot == null || xmlName == null ) {
+         throw new RuntimeException( "ConfigInstaller: installRoot and xmlname required" );
+      }
+      initClassLoader();
+      ConfigThread ct = new ConfigThread();
+      ct.setContextClassLoader( cl );
+      ct.start();
+      trace( "Joining ConfigThread..." );
+      try { ct.join(); } catch( Exception e ) { };
+      trace( "ConfigThread done." );
+      System.out.println( "Configuration complete." );
+   }
+   protected static void trace( String output ) {
+      if( fTrace ) {
+         System.out.println( output );
+      }
+   }
+
+}
+class ConfigWorker {
+   protected Class installerCls = null;
+   protected Object installerObj = null;
+   protected Method execute = null;
+   protected Method setTargetRoot = null;
+   protected Method setTargetConfigStore = null; //"config-store"
+   protected Method setTargetRepository = null; //"repository"
+   protected Method setSourceRepository = null; //"${maven.repo.local}"
+   protected Method setArtifact = null;
+   protected DOMParser parser = null;
+   protected boolean fTrace = false;
+
+   protected void trace( String output ) {
+      if( fTrace ) {
+         System.out.println( output );
+      }
+   }
+
+   protected void doit( ClassLoader cl, Boolean fTrace ) {
+      //ConfigWorker cw = new ConfigWorker();
+      this.fTrace = fTrace.booleanValue();
+      trace( ">ConfigWorker.doit()" );
+      if( init( cl ) && parse() ) {
+         processXML();
+      }
+      trace( "<ConfigWorker.doit()" );
+   }
+   protected ConfigWorker() {
+   }
+
+   protected void initLocalConfigInstaller( ClassLoader cl ) {
+      trace( ">ConfigWorker.initLocalConfigInstaller()" );
+      try {
+         installerCls = cl.loadClass( "org.apache.geronimo.plugin.assembly.LocalConfigInstaller" );
+      } catch( Exception e ) {
+         
+         throw new RuntimeException( "Unable to load LocalConfigInstaller class" );
+      }
+      try {
+         execute = installerCls.getDeclaredMethod( "execute", null );
+      } catch( Exception e ) {
+         throw new RuntimeException( "Unable to get method object \"execute\" from LocalConfigInstaller class" );
+      }
+      try {
+         setTargetRoot = installerCls.getSuperclass().getDeclaredMethod( "setTargetRoot", new Class[] { File.class } );
+      } catch( Exception e ) {
+         throw new RuntimeException( "Unable to get method object \"setTargetRoot\" from LocalConfigInstaller class" );
+      }
+      try {
+         setTargetConfigStore = installerCls.getSuperclass().getDeclaredMethod( "setTargetConfigStore", new Class[] { String.class } );
+      } catch( Exception e ) {
+         throw new RuntimeException( "Unable to get method object \"setTargetConfigStore\" from LocalConfigInstaller class" );
+      }
+      try {
+         setTargetRepository = installerCls.getSuperclass().getDeclaredMethod( "setTargetRepository", new Class[] { String.class } );
+      } catch( Exception e ) {
+         throw new RuntimeException( "Unable to get method object \"setTargetRepository\" from LocalConfigInstaller class" );
+      }
+      try {
+         setSourceRepository = installerCls.getSuperclass().getDeclaredMethod( "setSourceRepository", new Class[] { File.class } );
+      } catch( Exception e ) {
+         throw new RuntimeException( "Unable to get method object \"setSourceRepository\" from LocalConfigInstaller class" );
+      }
+      try {
+         setArtifact = installerCls.getSuperclass().getDeclaredMethod( "setArtifact", new Class[] { String.class } );
+      } catch( Exception e ) {
+         throw new RuntimeException( "Unable to get method object \"setArtifact\" from LocalConfigInstaller class" );
+      }
+      try {
+         installerObj = installerCls.newInstance();
+      } catch( Exception e ) {
+         throw new RuntimeException( "Unable to create instanceof LocalConfigInstaller" );
+      }
+      trace( "<ConfigWorker.initLocalConfigInstaller()" );
+   }
+   
+   protected boolean init(ClassLoader cl) {
+      boolean fRet = true;
+      trace( ">ConfigWorker.init()" );
+      initLocalConfigInstaller(cl);
+      try {
+         parser = new DOMParser();
+      } catch (Exception e) {
+         System.err.println("error: Unable to instantiate XML parser");
+         fRet = false;
+      }
+      
+      trace( "<ConfigWorker.init()" );
+      return fRet;
+   }
+
+
+   protected boolean parse() {
+      boolean fRet = true;
+      trace( ">ConfigWorker.parse()" );
+      try {
+      parser.parse( ConfigInstaller.installRoot + '/' + ConfigInstaller.xmlName );
+      } catch( Exception e ) {
+         System.err.println( "Exception while parsing: " + ConfigInstaller.installRoot + "/" + ConfigInstaller.xmlName );
+         fRet = false;
+      }
+      trace( "<ConfigWorker.parse()" );
+      return fRet;
+   }
+   protected void processXML() { 
+      trace( ">ConfigWorker.processXML()" );
+      Document doc = parser.getDocument();
+      Node node = doc.getDocumentElement();
+      processConfigurations(node);
+      trace( "<ConfigWorker.processXML()" );
+   }
+   protected int numElements = 0;
+   protected boolean fSelected = false;
+   protected String artifact = null;
+   protected String executable = null;
+
+   public void processConfigurations(Node node) {
+      trace( ">ConfigWorker.processConfigurations()" );
+
+        // is there anything to do?
+        if (node == null) {
+            return;
+        }
+        String nodeName = node.getNodeName();
+        //System.out.println( "nodeName: " + nodeName );
+        if( nodeName.equalsIgnoreCase("configurations") == false ) {
+           throw new RuntimeException("ConfigInstaller: Malformed XML.  \"configurations\" element expected.");
+        }
+        Node child = node.getFirstChild();
+        while (child != null) {
+           int nodeType = child.getNodeType();
+           if( nodeType == Node.ENTITY_REFERENCE_NODE
+               || nodeType == Node.ENTITY_NODE
+               || nodeType == Node.ELEMENT_NODE )
+              processConfiguration(child);
+           child = child.getNextSibling();
+        }
+      trace( "<ConfigWorker.processConfigurations()" );
+  }
+
+  public void processConfiguration( Node node ) {
+      trace( ">ConfigWorker.processConfiguration()" );
+        // is there anything to do?
+        if (node == null) {
+            return;
+        }
+        artifact = null;
+        executable = null;
+        fSelected = false;
+
+        String nodeName = node.getNodeName();
+        //System.out.println( "nodeName: " + nodeName );        
+        if( nodeName.equalsIgnoreCase("configuration") == false ) {
+           throw new RuntimeException("ConfigInstaller: Malformed XML.  \"configuration\" element expected. (" + nodeName + ")" );
+        }
+        Node child = node.getFirstChild();
+        while (child != null) {
+           int nodeType = child.getNodeType();
+           if( nodeType != Node.ENTITY_REFERENCE_NODE 
+               && nodeType != Node.ENTITY_NODE 
+               && nodeType != Node.ELEMENT_NODE ) {
+              child = child.getNextSibling();
+              continue;
+           }
+           nodeName = child.getNodeName();
+           if( nodeName.equalsIgnoreCase( "selected" )) {
+              Text text = (Text)child.getFirstChild();
+              fSelected = false;
+              if( text.getNodeValue().trim().equalsIgnoreCase( "true" )) {
+                 fSelected = true;
+              }
+           }
+           else if( nodeName.equalsIgnoreCase( "executable" )) {
+              Text text = (Text)child.getFirstChild();
+              executable = text.getNodeValue();
+              executable = executable.trim();
+           }
+           else if( nodeName.equalsIgnoreCase( "artifact" )) {
+              Text text = (Text)child.getFirstChild();
+              artifact = text.getNodeValue();
+              artifact = artifact.trim();
+           }
+           else {
+              throw new RuntimeException( "ConfigInstaller: Malformed XML. Element of type \"selected\" or \"executable\" or \"artifact\" expected. (" + nodeName + ")" );
+           }
+           child = child.getNextSibling();
+        }
+        if( fSelected ) {
+           //System.out.println( "Install config.  A: " + artifact + " E: " + executable );
+           doInstall();
+           
+        } else {
+           //System.out.println( "NO Install config.  A: " + artifact + " E: " + executable );
+        }
+      trace( "<ConfigWorker.processConfiguration()" );
+  }
+  protected void doInstall() {
+     trace( ">ConfigWorker.doInstall()" );
+     //System.out.println( "doInstall()" );
+     doMethod( setTargetConfigStore, new Object[] { "config-store" } );
+     doMethod( setTargetRepository, new Object[]  { "repository" } );
+     doMethod( setArtifact, new Object[] { artifact } );
+     doMethod( setTargetRoot, new Object[] { new File( ConfigInstaller.installRoot ) } );
+     doMethod( setSourceRepository, new Object[] { new File( ConfigInstaller.installRoot + "/repository" ) } );
+     doMethod( execute, new Object[] { } );
+     trace( "<ConfigWorker.doInstall()" );
+  }
+  protected void doMethod( Method m, Object[] parms ) {
+     trace( ">ConfigWorker.doMethod()" );
+     try {
+        m.invoke( installerObj, parms );
+     } catch( Exception e ) {
+        System.err.println( e.getMessage() );
+        e.printStackTrace();
+        throw new RuntimeException( "Exception while executing: LocalConfigInstaller." + m.getName() );
+     }
+      trace( "<ConfigWorker.doMethod()" );
+  }
+}
+
+class ConfigThread extends Thread {
+   public void run() {
+      //ConfigWorker.doit(); <-- this would be nice, but...
+      // using reflection is required to get the classloader override to work
+      Class cwc = null;
+      Object cw = null;
+      ClassLoader cl = Thread.currentThread().getContextClassLoader();
+      //System.out.println( "CL: " + cl.toString() );
+      Boolean fTrace = new Boolean( ConfigInstaller.fTrace );
+      try {
+         cwc = cl.loadClass( "org.apache.geronimo.installer.processing.ConfigWorker" );
+         cw = cwc.newInstance();
+      } catch( Exception e ) {
+         e.printStackTrace();
+         throw new RuntimeException( "Unable to load ConfigWorker class" );
+      }
+      Method doit = null;
+      try {
+         doit = cwc.getDeclaredMethod( "doit", new Class[] { ClassLoader.class, Boolean.class } );
+      } catch( Exception e ) {
+         e.printStackTrace();
+         throw new RuntimeException( "Unable to load ConfigWorker doit method" );
+      }
+      try {
+        doit.invoke( cw, new Object[] { cl, fTrace }  );
+     } catch( Exception e ) {
+        e.printStackTrace();
+        throw new RuntimeException( "Exception while executing: ConfigWorker.doit()"  );
+     }
+
+  }
+}

Added: geronimo/trunk/modules/installer-support/LICENSE.txt
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/installer-support/LICENSE.txt?rev=369099&view=auto
==============================================================================
--- geronimo/trunk/modules/installer-support/LICENSE.txt (added)
+++ geronimo/trunk/modules/installer-support/LICENSE.txt Sat Jan 14 13:31:11 2006
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
+

Added: geronimo/trunk/modules/installer-support/NOTICE.txt
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/installer-support/NOTICE.txt?rev=369099&view=auto
==============================================================================
--- geronimo/trunk/modules/installer-support/NOTICE.txt (added)
+++ geronimo/trunk/modules/installer-support/NOTICE.txt Sat Jan 14 13:31:11 2006
@@ -0,0 +1,3 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+

Added: geronimo/trunk/modules/installer-support/maven.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/installer-support/maven.xml?rev=369099&view=auto
==============================================================================
--- geronimo/trunk/modules/installer-support/maven.xml (added)
+++ geronimo/trunk/modules/installer-support/maven.xml Sat Jan 14 13:31:11 2006
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 2004 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 default="default"
+    xmlns:j="jelly:core"
+    xmlns:maven="jelly:maven"
+    xmlns:deploy="deploy"
+    xmlns:ant="jelly:ant">
+    
+    <!-- Construct dependency lists for inclusion in generated jar. -->
+    <postGoal name="java:compile">
+        <attainGoal name="geronimo:dependency"/>
+       <echo>Maven local repo is: ${maven.repo.local}</echo>
+       <echo>Maven build dir is: ${maven.build.dir}</echo>
+
+       <!-- we build the extension to a std geronimo jar name,
+            but it must be inserted into the compiler jar with
+            the panel name as ref'd in geronimo-izpack.xml
+            "ValidatePackSelections.jar"
+       -->
+       <ant:mkdir dir="${maven.build.dir}/tmp/bin/panels" />
+       <ant:jar destfile="${maven.build.dir}/tmp/bin/panels/ValidatePackSelections.jar"
+          basedir="${maven.build.dir}/classes"
+       />
+       <!-- copy the standalone-compiler-IZPACKVER to a new name
+            so it will be ready to receive the ValidatePackSelections.jar
+       -->
+       <ant:copy file="${maven.repo.local}/izpack/jars/standalone-compiler-${izpack_version}.jar" tofile="${maven.build.dir}/standalone-compiler-custom-${izpack_version}.jar" />
+       <!-- slip the bin/panels/ValidatePackSelections.jar into
+              the standalone-compiler jar
+              don't forget "update" or it's screwed
+       -->
+       <ant:jar destfile="${maven.build.dir}/standalone-compiler-custom-${izpack_version}.jar"
+                basedir="${maven.build.dir}/tmp"
+                includes="**/ValidatePackSelections.jar"
+                update="true" >
+       </ant:jar>
+       <!--
+         Ok, we've got a new izpack compiler jar.  Copy it to 
+         the local repository as a geronimo artifact.
+       -->
+      <echo>Built Geronimo custom IzPack installer jar</echo>
+      <echo>Copying standalone-compiler-custom-${izpack_version} to local repo</echo>
+      <ant:copy file="${maven.build.dir}/standalone-compiler-custom-${izpack_version}.jar"
+                tofile="${maven.repo.local}/geronimo/jars/standalone-compiler-custom-${izpack_version}.jar"
+     /> 
+    </postGoal>
+</project>

Added: geronimo/trunk/modules/installer-support/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/installer-support/project.properties?rev=369099&view=auto
==============================================================================
--- geronimo/trunk/modules/installer-support/project.properties (added)
+++ geronimo/trunk/modules/installer-support/project.properties Sat Jan 14 13:31:11 2006
@@ -0,0 +1,11 @@
+##
+## $Rev: 179736 $ $Date: 2005-06-03 03:20:04 -0400 (Fri, 03 Jun 2005) $
+##
+
+# the directory containing the geronimo website in CVS
+
+#maven.junit.jvmargs=-Djava.security.auth.login.config=src/test-resources/data/login.config -ea
+#maven.junit.fork=true
+#maven.compile.optimize=false
+#maven.compile.fork=true
+izpack_version=3.8.0

Added: geronimo/trunk/modules/installer-support/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/installer-support/project.xml?rev=369099&view=auto
==============================================================================
--- geronimo/trunk/modules/installer-support/project.xml (added)
+++ geronimo/trunk/modules/installer-support/project.xml Sat Jan 14 13:31:11 2006
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright 2004 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.
+-->
+
+<!-- $Rev: 330381 $ $Date: 2005-11-02 18:02:55 -0500 (Wed, 02 Nov 2005) $ -->
+<project>
+    <pomVersion>3</pomVersion>
+    <extend>../../etc/project.xml</extend>
+
+    <!-- ===================== -->
+    <!-- Module Identification -->
+    <!-- ===================== -->
+    <name>Geronimo :: Installer Support</name>
+    <id>geronimo-installer-support</id>
+    <shortDescription>Geronimo Installer Support</shortDescription>
+    <description>Geronimo Installer Support</description>
+    <url>http://geronimo.apache.org/modules/installer/</url>
+    <siteDirectory>/www/geronimo.apache.org/modules/installer</siteDirectory>
+    <distributionDirectory>/www/incubator.apache.org/projects/geronimo/builds/installer</distributionDirectory>
+    <package>com.izforge.izpack.panels</package>
+
+    <!-- ============ -->
+    <!-- Dependencies -->
+    <!-- ============ -->
+    <dependencies>
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-dependency-plugin</artifactId>
+            <version>${geronimo_dependency_plugin_version}</version>
+            <type>plugin</type>
+        </dependency>
+
+	<dependency>
+            <groupId>izpack</groupId>
+            <artifactId>installer</artifactId>
+            <version>${izpack_version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>izpack</groupId>
+            <artifactId>standalone-compiler</artifactId>
+            <version>${izpack_version}</version>
+        </dependency>
+
+     </dependencies>
+
+
+    <!-- =================== -->
+    <!-- Build Specification -->
+    <!-- =================== -->
+    <build>
+        <unitTest>
+            <includes>
+	        <include>**/**Test.java</include>
+            </includes>
+            <resources>
+                <resource>
+                    <directory>${basedir}/src/test-resources</directory>
+                </resource>
+            </resources>
+        </unitTest>
+    </build>
+</project>

Added: geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/GeronimoConfigProcessor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/GeronimoConfigProcessor.java?rev=369099&view=auto
==============================================================================
--- geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/GeronimoConfigProcessor.java (added)
+++ geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/GeronimoConfigProcessor.java Sat Jan 14 13:31:11 2006
@@ -0,0 +1,501 @@
+/*
+ * Apache 2.0 license
+ *
+*/
+package com.izforge.izpack.panels;
+import com.izforge.izpack.installer.AutomatedInstallData;
+import com.izforge.izpack.util.Debug;
+import com.izforge.izpack.Pack;
+import java.util.Vector;
+public class GeronimoConfigProcessor {
+
+   static int BASE_CONFIG = 0;
+   static int JETTY_CONFIG = 1;
+   static int TOMCAT_CONFIG = 2;
+   static int EJB_CONFIG = 3;
+   static int CORBA_CONFIG = 4;
+   static int DERBY_CONFIG = 5;
+   static int ACTIVEMQ_CONFIG = 6;
+   static int LDAP_CONFIG = 7;
+   static int SMTP_CONFIG = 8;
+   static int CONFIG_CKPT = 9;
+
+   static String panelNames[] = {
+      // keep in sync with izpack-user-input.xml
+      // until there's a better way
+      "Base Configuration",
+      "Jetty Web Configuration",
+      "Tomcat Web Configuration",
+      "EJB Configuration",
+      "CORBA Configuration",
+      "Derby Configuration",
+      "ActiveMQ Configuration",
+      "Directory (LDAP) Configuration",
+      "SMTP Transport Configuration",
+      "Configuration Checkpoint"
+   };
+
+   static int SERVER_PACK = 0;
+   static int J2EE_PACK = 1;
+   static int CORBA_PACK = 2;
+   static int JMS_PACK = 3;
+   static int JETTY_PACK = 4;
+   static int JETTY_WELCOME_PACK = 5;
+   static int JETTY_MGT_PACK = 6;
+   static int JETTY_UDDI_PACK = 7;
+   static int JETTY_SAMPLE_PACK = 8;
+   static int JETTY_DAYTRADER = 9;
+   static int TOMCAT_PACK = 10;
+   static int TOMCAT_WELCOME_PACK = 11;
+   static int TOMCAT_MGT_PACK = 12;
+   static int TOMCAT_UDDI_PACK = 13;
+   static int TOMCAT_SAMPLE_PACK = 14;
+   static int TOMCAT_DAYTRADER = 15;
+   static int LDAP_PACK = 16;
+   static int SMTP_PACK = 17;
+   static int SAMPLE_DB_POOL_PACK = 18;
+   static int JMX_WEB_DEBUG_PACK = 19;
+
+   static String packNames[] = {
+      "Server",
+      "J2EE Features",
+      "CORBA Features",
+      "JMS Features",
+      "Jetty Web Container",
+      "Jetty Welcome Application",
+      "Jetty Web Management Console",
+      "Jetty UDDI Server",
+      "Jetty Sample Applications",
+      "Daytrader for Jetty",
+      "Tomcat Web Container",
+      "Tomcat Welcome Application",
+      "Tomcat Web Management Console",
+      "Tomcat UDDI Server",
+      "Tomcat Sample Applications",
+      "Daytrader for Tomcat",
+      "LDAP Server",
+      "SMTP Transport",
+      "Sample Database Pool",
+      "JMX Debug Web Application"
+   };
+
+   protected String getPanelName( int panelId ) {
+      return panelNames[ panelId ];
+   }
+
+   protected String getPackName( int packId ) {
+      return packNames[ packId ];
+   }
+   
+   protected void debug( String debugString ) {
+      Debug.trace( debugString );
+   }
+   protected static VarInfo vars[] = {
+
+        new VarInfo( "SecurityDefaultUser",'s',BASE_CONFIG,SERVER_PACK,"" ),
+        new VarInfo( "SecurityDefaultPassword",'s',BASE_CONFIG, SERVER_PACK,"" ),
+        new VarInfo( "PlanRemoteLoginPort",'p',BASE_CONFIG,J2EE_PACK,"Remote Login Port" ),
+        new VarInfo( "PlanServerHostName",'h',JETTY_CONFIG,JETTY_PACK,"" ),
+        new VarInfo( "PlanHTTPPort",'p',JETTY_CONFIG,JETTY_PACK,"Jetty HTTP Port" ),
+        new VarInfo( "PlanHTTPSPort",'p',JETTY_CONFIG, JETTY_PACK,"Jetty HTTPS Port"),
+        new VarInfo( "PlanAJPPort",'p',JETTY_CONFIG,JETTY_PACK,"Jetty AJP Port" ),
+        new VarInfo( "PlanServerHostName",'h',TOMCAT_CONFIG,TOMCAT_PACK,"" ),
+        new VarInfo( "PlanHTTPPort2",'p',TOMCAT_CONFIG,TOMCAT_PACK,"Tomcat HTTP Port" ),
+        new VarInfo( "PlanHTTPSPort2",'p',TOMCAT_CONFIG,TOMCAT_PACK,"Tomcat HTTPS Port" ),
+        new VarInfo( "PlanAJPPort2",'p',TOMCAT_CONFIG,TOMCAT_PACK,"Tomcat AJP Port" ),
+        new VarInfo( "PlanNamingPort",'p',EJB_CONFIG,SERVER_PACK,"Naming Port" ),
+        new VarInfo( "PlanOpenEJBPort",'p',EJB_CONFIG, J2EE_PACK,"EJB Port" ),
+        new VarInfo( "PlanClientAddresses",'s',EJB_CONFIG,SERVER_PACK,"" ),
+        new VarInfo( "PlanIIOPPort",'p',CORBA_CONFIG,CORBA_PACK,"IIOP Port" ),
+        new VarInfo( "PlanORBSSLHost",'h',CORBA_CONFIG,CORBA_PACK,"" ),
+        new VarInfo( "PlanORBSSLPort",'p',CORBA_CONFIG,CORBA_PACK,"ORB SSL Port" ),
+        new VarInfo( "PlanCOSNamingHost",'h',CORBA_CONFIG,CORBA_PACK,"" ),
+        new VarInfo( "PlanCOSNamingPort",'p',CORBA_CONFIG,CORBA_PACK,"CosNaming Port" ),
+        new VarInfo( "PlanDerbyPort",'p',DERBY_CONFIG,SAMPLE_DB_POOL_PACK,"Derby Port" ),
+        new VarInfo( "PlanActiveMQPort",'p',ACTIVEMQ_CONFIG,JMS_PACK,"JMS Port" ),
+        new VarInfo( "PlanLdapPort",'p',LDAP_CONFIG,LDAP_PACK,"LDAP Port" ),
+        new VarInfo( "PlanSMTPHost",'h',SMTP_CONFIG,SMTP_PACK,"SMTP Host" ),
+        new VarInfo( "PlanSMTPPort",'p',SMTP_CONFIG,SMTP_PACK,"SMTP Port" )
+    };
+
+
+    
+    protected boolean isTomcatSelected( AutomatedInstallData idata ) {
+       return isPackSelected( idata, packNames[ TOMCAT_PACK ]);
+    }
+    protected boolean isPackSelected( AutomatedInstallData idata, String packName ) {
+       boolean fRet = false;
+       int iSize = idata.selectedPacks.size();
+       if( iSize > 0 ) {
+          for( int i = 0; i < iSize; ++i ) {
+             Pack p = (Pack)idata.selectedPacks.get( i );
+             if( p.name.equals( packName )) {
+                fRet = true;
+             }
+          }
+       }
+       return fRet;
+    }
+
+    protected boolean isJettySelected( AutomatedInstallData idata ) {
+       return isPackSelected( idata, packNames[ JETTY_PACK ]);
+    }
+
+
+    protected void panelNavDebug( AutomatedInstallData idata ) {
+       debug( "--> num panels: " + idata.panels.size() + "  cur panel: " + idata.curPanelNumber );
+    }
+
+    protected boolean shouldSkipPanel( AutomatedInstallData idata, String panelName ) {
+      boolean fRet = false;
+      debug( "shouldSkipPanel( " + panelName + " ) is: " + fRet );
+      return fRet;
+    }
+    protected static boolean fInitialConfigDone = false;
+    protected void setInitialConfig( AutomatedInstallData idata ) {
+         if( fInitialConfigDone ) return;
+         fInitialConfigDone = true;
+         debug( ">setInitialConfig()  ");
+         //System.out.println( "CPES = " + cpes );
+         for( int i = 0; i < idata.allPacks.size(); ++i ) {
+                Pack pack = (Pack)idata.allPacks.get( i );
+                boolean fSel = false;
+                if( isPackSelected( idata, pack.name )) {
+                   fSel = true;
+                }
+                setEnableVar( idata, pack.name, fSel );
+         }
+         // fixup for jetty not selected to install
+         if( isJettySelected( idata ) == false && 
+                isTomcatSelected( idata ) == true ) {
+                int packs[] = {
+                   TOMCAT_PACK, 
+                   TOMCAT_WELCOME_PACK,
+                   TOMCAT_MGT_PACK,
+                   TOMCAT_UDDI_PACK,
+                   TOMCAT_SAMPLE_PACK,
+                   TOMCAT_DAYTRADER };
+                boolean fSel = false;
+                String packName = null;
+                for( int i = 0; i < packs.length; ++i ) {
+                   packName = getPackName( packs[ i ] );
+                   fSel = isPackSelected( idata, packName );
+                   setEnableVar( idata, packName, fSel );
+                }
+         }
+
+         // end fixup
+         debug( "<setInitialConfig()  ");
+    }
+
+    protected void setEnableVar( AutomatedInstallData idata, String packName, boolean fSetting ) {
+       debug( ">setEnableVar()");
+       String varName = new String(packName);
+       varName = varName.replace( ' ','.' );
+       varName += ".enable";
+       String sel = "false";
+       if( fSetting ) {
+          sel = "true";
+       }
+       Debug.trace( varName + " is " + sel );
+       idata.setVariable( varName, sel );
+       debug( "<setEnableVar()");
+    }
+
+    protected void resetConfigNonSelected( AutomatedInstallData idata ) {
+         debug( ">resetConfigNonSelected()  ");
+         String packName = null;
+         for( int i = 0; i < idata.allPacks.size(); ++i ) {
+                Pack pack = (Pack)idata.allPacks.get( i );
+                packName = pack.name;
+                if( isPackSelected( idata, packName ) == false ) {
+                   String sel = "false";
+                   String varName = new String(packName);
+                   varName = varName.replace( ' ','.' );
+                   varName += ".enable";
+                   Debug.trace( varName + " is " + sel );
+                   idata.setVariable( varName, sel );
+                }
+         }
+         debug( "<resetConfigNonSelected()  ");
+    }
+    protected boolean panelEntryTasks( AutomatedInstallData idata, String panelName ) {
+       boolean fRet = true;
+       if( panelName.equals( getPanelName( BASE_CONFIG ))) {
+          setInitialConfig( idata ); // from selected packs
+          resetConfigNonSelected( idata );
+       }
+       return fRet;
+    }
+    protected boolean checkInput( String panelName, AutomatedInstallData idata ) {
+      boolean fRet = true; // default to true in case a panel is added and
+                           // we forget to update this method ;)
+      if( panelName.equals( getPanelName( BASE_CONFIG ))) {
+          fRet = true;
+       }
+       else if( panelName.equals( getPanelName( JETTY_CONFIG ))) {
+          fRet = true;
+       }
+       else if( panelName.equals( getPanelName( TOMCAT_CONFIG ))) {
+          fRet = true;
+       }
+       else if( panelName.equals( getPanelName( EJB_CONFIG ))) {
+          fRet = true;
+       }
+       else if( panelName.equals( getPanelName( CORBA_CONFIG ))) {
+          fRet = true;
+       }
+       else if( panelName.equals( getPanelName( DERBY_CONFIG ))) {
+          fRet = true;
+       }
+       else if( panelName.equals( getPanelName( ACTIVEMQ_CONFIG ))) {
+          fRet = true;
+       }
+       else if( panelName.equals( getPanelName( LDAP_CONFIG ))) {
+          fRet = true;
+       }
+       else if( panelName.equals( getPanelName( SMTP_CONFIG ))) {
+          fRet = true;
+       }
+       else if( panelName.equals( getPanelName( CONFIG_CKPT ))) {
+          fRet = true;
+          setAutoInstallConfig( idata );
+          processConfig( idata );
+       }
+       return fRet;
+    }
+
+    protected boolean processConfig( AutomatedInstallData idata ) {
+
+       boolean fRet = true;
+
+       /* kind of a hack to work around the fact that 
+          if any web container is installed, then all the samples
+          both for jetty and tomcat are desired.  
+          !!!! Left this code in, but it's not currently set up to really work.
+       */
+       String samples = "false";
+       String varName = "Geronimo.Sample.Applications";
+       if( isPackSelected( idata, packNames[ JETTY_SAMPLE_PACK ] )) {
+          samples = "true";
+       }
+       if( isPackSelected( idata, packNames[ TOMCAT_SAMPLE_PACK ] )) {
+          samples = "true";
+       }
+       idata.setVariable( varName, samples ); 
+
+       String serverName = null;
+       String webBuilderNamespace = null;
+       varName = null;
+       if( isTomcatSelected( idata ) ) {
+          serverName = idata.getVariable( "TOMCAT_WEB_SERVER_NAME" );
+          varName = "PlanWebServerName";
+          idata.setVariable( varName, serverName );
+          webBuilderNamespace = idata.getVariable( "TOMCAT_WEBBUILDER_NAMESPACE" );
+          varName = "PlanWebBuilderDefaultNamespace";
+          idata.setVariable( varName, webBuilderNamespace );
+       } else if( isJettySelected( idata ) ) {
+          serverName = idata.getVariable( "JETTY_WEB_SERVER_NAME" );
+          varName = "PlanWebServerName";
+          idata.setVariable( varName, serverName );
+          webBuilderNamespace = idata.getVariable( "JETTY_WEBBUILDER_NAMESPACE" );
+          varName = "PlanWebBuilderDefaultNamespace";
+          idata.setVariable( varName, webBuilderNamespace );
+       } else {
+          // no web container was selected.  Set some reasonable default so
+          // the user can at least figure out how to modify the value
+          serverName = idata.getVariable( "NO_WEB_SERVER_NAME" );
+          varName = "PlanWebServerName";
+          idata.setVariable( varName, serverName );
+          webBuilderNamespace = idata.getVariable( "NO_WEBBUILDER_NAMESPACE" );
+          varName = "PlanWebBuilderDefaultNamespace";
+          idata.setVariable( varName, webBuilderNamespace );
+       }
+       return fRet;
+    }
+
+    protected void setAutoInstallConfig( AutomatedInstallData idata ) {
+         debug( ">setAutoInstallConfig()  ");
+
+         // variables used in processing (izpack-process.xml)
+         String cpes = System.getProperty( "path.separator" );
+         idata.setVariable( "CPES", cpes );
+         String trace = System.getProperty( "TRACE" );
+         if( trace == null ) {
+            trace = "false";
+         }
+         idata.setVariable( "TRACE", trace );
+
+         // the server pack is always selected and its 
+         // enable variable MUST be true.  This is the default
+         // for the interactive install, but we must fix it up
+         // for the automated install. Most of the ".enable" 
+         // variables are defined as checkbox variables
+         // in associated panels.  The server pack does
+         // not have one of these, but there is a config.xml
+         // dependency on this enable variable.
+         String serverPack = getPackName( SERVER_PACK );
+         serverPack = serverPack.replace( ' ', '.' );
+         String serverEnableVar = serverPack + ".enable";
+         idata.setVariable( serverEnableVar, "true" );
+
+         // setup variables for each pack and set each according
+         // to whether the pack is selected or not.
+         // e.g. pack="J2EE Features", var="J2EE.Features"
+         //                     var is true if J2EE Features pack
+         //                     will be installed and false otherwise.
+         //    For interactive installs, these variables already exist.
+         // Additionally, define a variable packname.enable for
+         //    each pack which denotes whether it's enabled at runtime
+         //    in config.xml.
+         //    At this point in the proceedure, some of these may already
+         //    be defined.  So, we only create the ones for non-selected
+         //    packs which may not have had panels displayed. In any case,
+         //    if the pack is not selected for install, the related
+         //    PackName.enable variable should be false.
+         String packName = null;
+         for( int i = 0; i < idata.allPacks.size(); ++i ) {
+                Pack pack = (Pack)idata.allPacks.get( i );
+                String sel = "false";
+                packName = pack.name;
+                String packVar = new String(packName);
+                packVar = packVar.replace( ' ','.' );
+                sel = idata.getVariable( packVar );
+                if( sel == null ) {
+                   sel = "false";
+                   idata.setVariable( packVar, sel );
+                }
+                if( isPackSelected( idata, packName )) {
+                   sel = "true";
+                   idata.setVariable( packVar, sel );
+                }
+                String packEnable = packVar + ".enable";
+                String eSel = idata.getVariable( packEnable );
+                // only set undefined enable variables
+                if( eSel == null ) {
+                   eSel = "false";
+                   idata.setVariable( packEnable, eSel );
+                }
+                debug( "-- " + packVar + " is: " + sel + "   " + packEnable + " is: " + eSel );
+         }
+
+         debug( "<setAutoInstallConfig()  ");
+    }
+
+    protected void processAutomatedInput( 
+                 AutomatedInstallData idata, String panelName ) {
+ 
+         if( isCheckpointPanel( panelName )) {
+            setAutoInstallConfig( idata );
+            processConfig( idata );
+         }
+    }
+    protected boolean isCheckpointPanel( String panelName ) {
+       boolean fRet = panelName.equals( getPanelName( CONFIG_CKPT ));
+       debug( "isCheckpointPanel( " + panelName + " ) is: " + fRet );
+       return fRet;
+    }
+    protected boolean haveConfigErrors(
+           AutomatedInstallData idata, String msgs[] ) {
+       int numVars2Ck = 0;
+       for( int i = 0; i < vars.length; ++i ) {
+          if( vars[i].verTyp == 'p' && isPackSelected( idata, packNames[ vars[i].packId] ))
+             ++numVars2Ck;
+       }
+       int vars2Ck[] = new int[ numVars2Ck ];
+       int idx = 0;
+       for( int i = 0; i < vars.length; ++i ) {
+          if( vars[i].verTyp == 'p' && isPackSelected( idata, packNames[ vars[i].packId] )) {
+             vars2Ck[idx] = i;
+             ++idx;
+          }
+       }
+       Vector conflicts = new Vector();
+       int vars2Ck2[] = new int[ numVars2Ck ];
+       System.arraycopy( vars2Ck, 0, vars2Ck2, 0, numVars2Ck );
+       for( int i = 0; i < vars2Ck.length; ++i ) {
+          for( int j = 0; j < vars2Ck2.length; ++j ) {
+            int p1Idx = vars2Ck[i];
+            int p2Idx = vars2Ck2[j];            
+            if( p1Idx == p2Idx ) continue; // filter out same
+            String p1 = idata.getVariable( vars[p1Idx].varName );
+            String p2 = idata.getVariable( vars[p2Idx].varName );
+            if( p1 != null && p2 != null && p1.equals(p2) ) {
+               conflicts.add( new Object[] { new Integer(p1Idx), new Integer(p2Idx) });
+            }
+          }
+       }
+       boolean fRet = false;
+       int numConflicts = conflicts.size();
+       Object conflictDups[] = new Object[numConflicts];
+       if( numConflicts > 0 ) {
+          fRet = true;
+          int msgIdx = 0;
+          msgs[msgIdx] = "Warning. Geronimo configuration problems.";
+          msgs[++msgIdx] = "       The list of port conflicts below should be resolved before continuing the installation.";
+          msgs[++msgIdx] = "__________________________________";
+          int dupsIdx = 0;
+          boolean fDup = false;
+          for( int i = 0; i < numConflicts && i < 7; ++i ) {
+              Object[] ports = (Object[])conflicts.elementAt(i);
+              int p1Idx = ((Integer)ports[0]).intValue();
+              int p2Idx = ((Integer)ports[1]).intValue();
+              fDup = false;
+              for( int dupCk = 0; dupCk < conflictDups.length; ++dupCk ) {
+                 Object[] ports2 = (Object[])conflictDups[dupCk];
+                 if( ports2 != null ) {
+                    int v1 = ((Integer)ports2[0]).intValue();
+                    int v2 = ((Integer)ports2[1]).intValue();
+                    if(( v1 == p1Idx && v2 == p2Idx ) || ( v1 == p2Idx && v2 == p1Idx ))
+                       fDup = true;
+                 }
+              }
+              conflictDups[dupsIdx] = ports;
+              ++dupsIdx;
+              if( fDup == false ) {
+                 msgs[++msgIdx] = "    The \"" + vars[p1Idx].varDesc + "\" conflicts with the \"" + vars[p2Idx].varDesc + "\"";
+              }
+          }
+          ++msgIdx;
+          for( int i = msgIdx; i < 10; ++i ) {
+             msgs[i] = " ";
+          }
+       }
+       return fRet;
+    }
+    protected void panelDebug( AutomatedInstallData idata, String panelName ) {
+      Debug.trace( "------ Begin panel entry debug info for: " + panelName + "-----" );
+      if( panelName.equals( getPanelName( BASE_CONFIG ))) {
+         for( int i = 0; i < idata.selectedPacks.size(); ++i ) {
+            Pack pack = (Pack)idata.selectedPacks.get( i );
+            Debug.trace( pack.name + " is selected." );
+         }
+         Debug.trace( "-----------" );
+         String packName = null;
+         for( int i = 0; i < idata.allPacks.size(); ++i ) {
+                Pack pack = (Pack)idata.allPacks.get( i );
+                String sel = "not selected";
+                packName = pack.name;
+                if( isPackSelected( idata, packName )) {
+                   sel = "selected";
+                }
+                Debug.trace( packName + " is " + sel );
+         }
+      }
+      Debug.trace( "------ End panel entry debug info for: " + panelName + "-----" );
+    }
+}
+class VarInfo {
+   public VarInfo( String varName, char verTyp, int panelId, int packId, String varDesc ) {
+      this.varName = varName;
+      this.panelId = panelId;
+      this.packId = packId;
+      this.verTyp = verTyp;
+      this.varDesc = varDesc;
+   }
+   String varName;
+   int panelId;
+   int packId;
+   char verTyp;
+   String varDesc;
+}

Added: geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/PasswordGroup.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/PasswordGroup.java?rev=369099&view=auto
==============================================================================
--- geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/PasswordGroup.java (added)
+++ geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/PasswordGroup.java Sat Jan 14 13:31:11 2006
@@ -0,0 +1,187 @@
+/*
+ * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
+ * 
+ * http://www.izforge.com/izpack/
+ * http://developer.berlios.de/projects/izpack/
+ * 
+ * Copyright 2003 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.Vector;
+
+import javax.swing.JPasswordField;
+
+/*---------------------------------------------------------------------------*/
+/**
+ * This class can be used to manage multiple related password fields. This is used in the
+ * <code>UserInputPanel</code> to manage communication with the validator and processor for
+ * password fields.
+ * 
+ * @see com.izforge.izpack.panels.UserInputPanel
+ * 
+ * @version 0.0.1 / 2/22/03
+ * @author Elmar Grom
+ */
+/*---------------------------------------------------------------------------*/
+public class PasswordGroup implements ProcessingClient
+{
+
+    // ------------------------------------------------------------------------
+    // Variable Declarations
+    // ------------------------------------------------------------------------
+    private Vector fields = new Vector();
+
+    private Validator validator = null;
+
+    private Processor processor = null;
+
+    /*--------------------------------------------------------------------------*/
+    /**
+     * Creates a passowrd group to manage one or more password fields.
+     * 
+     * @param validator A string that specifies a class that provides a password validation service.
+     * The class must implement the <code>Validator</code> interface. If an attempt to instantiate
+     * this class fails, no validation will be performed.
+     * @param processor A string that specifies a class that provides a password processing service,
+     * such as password encryption. The class must implement the <code>Processor</code> interface.
+     * If an attempt to instantiate this class fails, no processing will be performed. Insted the
+     * contents of the first field will be returned.
+     */
+    /*--------------------------------------------------------------------------*/
+    public PasswordGroup(String validator, String processor)
+    {
+        // ----------------------------------------------------
+        // attempt to create an instance of the Validator
+        // ----------------------------------------------------
+        try
+        {
+            this.validator = (Validator) Class.forName(validator).newInstance();
+        }
+        catch (Throwable exception)
+        {
+            this.validator = null;
+        }
+
+        // ----------------------------------------------------
+        // attempt to create an instance of the Processor
+        // ----------------------------------------------------
+        try
+        {
+            this.processor = (Processor) Class.forName(processor).newInstance();
+        }
+        catch (Throwable exception)
+        {
+            this.processor = null;
+        }
+    }
+
+    /*--------------------------------------------------------------------------*/
+    /**
+     * Returns the number of sub-fields.
+     * 
+     * @return the number of sub-fields
+     */
+    /*--------------------------------------------------------------------------*/
+    public int getNumFields()
+    {
+        return (fields.size());
+    }
+
+    /*--------------------------------------------------------------------------*/
+    /**
+     * Returns the contents of the field indicated by <code>index</code>.
+     * 
+     * @param index the index of the sub-field from which the contents is requested.
+     * 
+     * @return the contents of the indicated sub-field.
+     * 
+     * @exception IndexOutOfBoundsException if the index is out of bounds.
+     */
+    /*--------------------------------------------------------------------------*/
+    public String getFieldContents(int index) throws IndexOutOfBoundsException
+    {
+        if ((index < 0) || (index >= fields.size())) { throw (new IndexOutOfBoundsException()); }
+
+        String contents = new String(((JPasswordField) fields.elementAt(index)).getPassword());
+        return (contents);
+    }
+
+    /*--------------------------------------------------------------------------*/
+    /**
+     * Adds a <code>JPasswordField</code> to the group of fields being managed by this object.
+     * 
+     * @param field <code>JPasswordField</code> to add
+     */
+    /*--------------------------------------------------------------------------*/
+    public void addField(JPasswordField field)
+    {
+        if (field != null)
+        {
+            fields.add(field);
+        }
+    }
+
+    /*--------------------------------------------------------------------------*/
+    /**
+     * This method validates the group content. Validating is performed through a user supplied
+     * service class that provides the validation rules.
+     * 
+     * @return <code>true</code> if the validation passes or no implementation of a validation
+     * rule exists. Otherwise <code>false</code> is returned.
+     */
+    /*--------------------------------------------------------------------------*/
+    public boolean validateContents()
+    {
+        if (validator != null)
+        {
+            return (validator.validate(this));
+        }
+        else
+        {
+            return (true);
+        }
+    }
+
+    /*--------------------------------------------------------------------------*/
+    /**
+     * Returns the password. If a processing service class was supplied it will be used to process
+     * the password before it is returned, otherwise the content of the first field will be
+     * returned.
+     * 
+     * @return the password
+     */
+    /*--------------------------------------------------------------------------*/
+    public String getPassword()
+    {
+        if (processor != null)
+        {
+            return (processor.process(this));
+        }
+        else
+        {
+            String contents = "";
+
+            if (fields.size() > 0)
+            {
+                contents = new String(((JPasswordField) fields.elementAt(0)).getPassword());
+            }
+
+            return (contents);
+        }
+    }
+}
+/*---------------------------------------------------------------------------*/

Added: geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/ProcessPanelAutomationHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/ProcessPanelAutomationHelper.java?rev=369099&view=auto
==============================================================================
--- geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/ProcessPanelAutomationHelper.java (added)
+++ geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/ProcessPanelAutomationHelper.java Sat Jan 14 13:31:11 2006
@@ -0,0 +1,127 @@
+/*
+ * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
+ * 
+ * http://www.izforge.com/izpack/
+ * http://developer.berlios.de/projects/izpack/
+ * 
+ * Copyright 2003 Jonathan Halliday
+ * 
+ * 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.io.IOException;
+
+import net.n3.nanoxml.XMLElement;
+
+import com.izforge.izpack.installer.AutomatedInstallData;
+import com.izforge.izpack.installer.PanelAutomation;
+import com.izforge.izpack.installer.PanelAutomationHelper;
+import com.izforge.izpack.installer.ProcessPanelWorker;
+import com.izforge.izpack.util.AbstractUIProcessHandler;
+
+/**
+ * Functions to support automated usage of the CompilePanel
+ * 
+ * @author Jonathan Halliday
+ * @author Tino Schwarze
+ */
+public class ProcessPanelAutomationHelper extends PanelAutomationHelper implements PanelAutomation,
+        AbstractUIProcessHandler
+{
+
+    private ProcessPanelWorker worker = null;
+
+    private int noOfJobs = 0;
+
+    private int currentJob = 0;
+
+    /**
+     * Save data for running automated.
+     * 
+     * @param installData installation parameters
+     * @param panelRoot unused.
+     */
+    public void makeXMLData(AutomatedInstallData installData, XMLElement panelRoot)
+    {
+        // not used here - during automatic installation, no automatic
+        // installation information is generated
+    }
+
+    /**
+     * Perform the installation actions.
+     * 
+     * @param panelRoot The panel XML tree root.
+     */
+    public void runAutomated(AutomatedInstallData idata, XMLElement panelRoot)
+    {
+        try
+        {
+            this.worker = new ProcessPanelWorker(idata, this);
+
+            this.worker.run();
+        }
+        catch (IOException e)
+        {
+            e.printStackTrace();
+        }
+
+    }
+
+    public void logOutput(String message, boolean stderr)
+    {
+        if (stderr)
+        {
+            System.err.println(message);
+        }
+        else
+        {
+            System.out.println(message);
+        }
+    }
+
+    /**
+     * Reports progress on System.out
+     * 
+     * @see com.izforge.izpack.util.AbstractUIProcessHandler#startProcessing(int)
+     */
+    public void startProcessing(int noOfJobs)
+    {
+        System.out.println("[ Starting processing ]");
+        this.noOfJobs = noOfJobs;
+    }
+
+    /**
+     * 
+     * @see com.izforge.izpack.util.AbstractUIProcessHandler#finishProcessing()
+     */
+    public void finishProcessing()
+    {
+        System.out.println("[ Processing finished ]");
+    }
+
+    /**
+     * 
+     */
+    public void startProcess(String name)
+    {
+        this.currentJob++;
+        System.out.println("Starting process " + name + " (" + Integer.toString(this.currentJob)
+                + "/" + Integer.toString(this.noOfJobs) + ")");
+    }
+
+    public void finishProcess()
+    {
+    }
+}

Added: geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/ProcessingClient.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/ProcessingClient.java?rev=369099&view=auto
==============================================================================
--- geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/ProcessingClient.java (added)
+++ geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/ProcessingClient.java Sat Jan 14 13:31:11 2006
@@ -0,0 +1,60 @@
+/*
+ * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
+ * 
+ * http://www.izforge.com/izpack/
+ * http://developer.berlios.de/projects/izpack/
+ * 
+ * Copyright 2003 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;
+
+/*---------------------------------------------------------------------------*/
+/**
+ * Implement this interface in any class that wants to use processing or validation services.
+ * 
+ * @see com.izforge.izpack.panels.Processor
+ * @see com.izforge.izpack.panels.Validator
+ * 
+ * @version 0.0.1 / 2/22/03
+ * @author Elmar Grom
+ */
+/*---------------------------------------------------------------------------*/
+public interface ProcessingClient
+{
+
+    /*--------------------------------------------------------------------------*/
+    /**
+     * Returns the number of sub-fields.
+     * 
+     * @return the number of sub-fields
+     */
+    /*--------------------------------------------------------------------------*/
+    public int getNumFields();
+
+    /*--------------------------------------------------------------------------*/
+    /**
+     * Returns the contents of the field indicated by <code>index</code>.
+     * 
+     * @param index the index of the sub-field from which the contents is requested.
+     * 
+     * @return the contents of the indicated sub-field.
+     * 
+     * @exception IndexOutOfBoundsException if the index is out of bounds.
+     */
+    /*--------------------------------------------------------------------------*/
+    public String getFieldContents(int index);
+}
+/*---------------------------------------------------------------------------*/

Added: geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/Processor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/Processor.java?rev=369099&view=auto
==============================================================================
--- geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/Processor.java (added)
+++ geronimo/trunk/modules/installer-support/src/java/com/izforge/izpack/panels/Processor.java Sat Jan 14 13:31:11 2006
@@ -0,0 +1,48 @@
+/*
+ * 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 input field processing services.
+ * 
+ * @see com.izforge.izpack.panels.ProcessingClient
+ * 
+ * @version 0.0.1 / 10/26/02
+ * @author Elmar Grom
+ */
+/*---------------------------------------------------------------------------*/
+public interface Processor
+{
+
+    /*--------------------------------------------------------------------------*/
+    /**
+     * Processes the contend of an input field.
+     * 
+     * @param client the client object using the services of this processor.
+     * 
+     * @return The result of the encryption.
+     */
+    /*--------------------------------------------------------------------------*/
+    public String process(ProcessingClient client);
+}
+/*---------------------------------------------------------------------------*/



Mime
View raw message