First addition of visual web sources release60_vw_after_trunk_fix
authormzlamal@netbeans.org
Sun, 28 Jan 2007 18:54:08 +0000
changeset 18804d7579499091
parent 1879 295b4fa95b8d
child 1881 b3553b72e0ea
First addition of visual web sources
visualweb/project/jsfportlet/build.xml
visualweb/project/jsfportlet/manifest.mf
visualweb/project/jsfportlet/nbproject/build-impl.xml
visualweb/project/jsfportlet/nbproject/genfiles.properties
visualweb/project/jsfportlet/nbproject/project.properties
visualweb/project/jsfportlet/nbproject/project.xml
visualweb/project/jsfportlet/nbproject/suite.properties
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/Bundle.properties
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/JsfPortletProjectTemplate.java
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/JsfPortletProjectTemplateJakarta.xml
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/libraries/Bundle.properties
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/libraries/jsf-portlet-runtime.xml
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/libraries/portlet-runtime.xml
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/Bundle.properties
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/layer.xml
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPage.java.template
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPage.jsp.template
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPageFragment.java.template
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPageFragment.jspf.template
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/PortletJavaPageTemplateHelp.html
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/PortletPageFragmentTemplateHelp.html
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/PortletPageTemplateHelp.html
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/facesConfigTemplateHelp.html
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/portletTLDTemplateHelp.html
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/portletTemplateHelp.html
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/portletWebTemplateHelp.html
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/faces-config.xml.template
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/portlet-web.xml.template
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/portlet.tld.template
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/portlet.xml.template
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/resources/Bundle.properties
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/FileChooser.java
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/FoldersListSettings.java
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PanelConfigureProject.java
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PanelConfigureProjectVisual.form
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PanelConfigureProjectVisual.java
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PanelProjectLocationVisual.form
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PanelProjectLocationVisual.java
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PortletProjectDeployDescriptorVisual.form
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PortletProjectDeployDescriptorVisual.java
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PortletProjectDeploymentDescriptor.java
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PortletProjectWizardIterator.java
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PortletWizardProperties.java
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/SettingsPanel.java
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Utils.java
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/WizardProperties.java
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/resources/Bundle.properties
visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/resources/PortletProject.html
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/CheckLicense.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/CvsFileSet.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/ForEach.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/ForEachXsl.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/GetLocalizableFiles.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/JHIndexer.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/L10nTask.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/LocJHIndexer.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/LocMakeNBM.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/LocalizedJar.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/MakeLNBM.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/MakeLayer.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/MakeListOfNBM.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/ModuleTracking.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/RaveLocalizedJar.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/Repeat.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/UpdateTracking.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/XMLUtil.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/utils/cvsutils/CvsEntries.java
visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/utils/cvsutils/Entry.java
visualweb/ravebuild/build.properties
visualweb/ravebuild/build.xml
visualweb/ravebuild/build_env/.pswd
visualweb/ravebuild/build_env/README
visualweb/ravebuild/build_env/converter.sh
visualweb/ravebuild/build_env/make_statefile.sh
visualweb/ravebuild/default-rave-properties.xml
visualweb/ravebuild/merge-forked-modules.xml
visualweb/ravebuild/nbproject/project.xml
visualweb/ravebuild/visualweb-nbm-license.txt
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/visualweb/project/jsfportlet/build.xml	Sun Jan 28 18:54:08 2007 +0000
     1.3 @@ -0,0 +1,27 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<!--
     1.6 +The contents of this file are subject to the terms of the Common Development
     1.7 +and Distribution License (the License). You may not use this file except in
     1.8 +compliance with the License.
     1.9 +
    1.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
    1.11 +or http://www.netbeans.org/cddl.txt.
    1.12 +
    1.13 +When distributing Covered Code, include this CDDL Header Notice in each file
    1.14 +and include the License file at http://www.netbeans.org/cddl.txt.
    1.15 +If applicable, add the following below the CDDL Header, with the fields
    1.16 +enclosed by brackets [] replaced by your own identifying information:
    1.17 +"Portions Copyrighted [year] [name of copyright owner]"
    1.18 +
    1.19 +The Original Software is NetBeans. The Initial Developer of the Original
    1.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
    1.21 +Microsystems, Inc. All Rights Reserved.
    1.22 +-->
    1.23 +
    1.24 +<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
    1.25 +<!-- for some information on what you could do (e.g. targets to override). -->
    1.26 +<!-- If you delete this file and reopen the project it will be recreated. -->
    1.27 +<project name="org.netbeans.modules.visualweb.project.jsfportlet" default="netbeans" basedir=".">
    1.28 +    <description>Builds, tests, and runs the project org.netbeans.modules.visualweb.project.jsfportlet.</description>
    1.29 +    <import file="nbproject/build-impl.xml"/>
    1.30 +</project>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/visualweb/project/jsfportlet/manifest.mf	Sun Jan 28 18:54:08 2007 +0000
     2.3 @@ -0,0 +1,8 @@
     2.4 +Manifest-Version: 1.0
     2.5 +OpenIDE-Module: org.netbeans.modules.visualweb.project.jsfportlet/1
     2.6 +OpenIDE-Module-Specification-Version: 2.0
     2.7 +X-Comment: Portlet Project Support.
     2.8 +OpenIDE-Module-Implementation-Version: 1
     2.9 +OpenIDE-Module-Layer: org/netbeans/modules/visualweb/project/jsfportlet/resources/layer.xml
    2.10 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/visualweb/project/jsfportlet/resources/Bundle.properties
    2.11 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/visualweb/project/jsfportlet/nbproject/build-impl.xml	Sun Jan 28 18:54:08 2007 +0000
     3.3 @@ -0,0 +1,30 @@
     3.4 +<?xml version="1.0" encoding="UTF-8"?>
     3.5 +<!--
     3.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
     3.7 +***         EDIT ../build.xml INSTEAD         ***
     3.8 +-->
     3.9 +<project name="org.netbeans.modules.visualweb.project.jsfportlet-impl" basedir=".." xmlns:nbmproject="http://www.netbeans.org/ns/nb-module-project/2">
    3.10 +    <property file="nbproject/private/suite-private.properties"/>
    3.11 +    <property file="nbproject/suite.properties"/>
    3.12 +    <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
    3.13 +    <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
    3.14 +    <property file="${suite.dir}/nbproject/platform.properties"/>
    3.15 +    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
    3.16 +        <attribute name="name"/>
    3.17 +        <attribute name="value"/>
    3.18 +        <sequential>
    3.19 +            <property name="@{name}" value="${@{value}}"/>
    3.20 +        </sequential>
    3.21 +    </macrodef>
    3.22 +    <property file="${user.properties.file}"/>
    3.23 +    <nbmproject:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir"/>
    3.24 +    <nbmproject:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir"/>
    3.25 +    <fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'">
    3.26 +        <condition>
    3.27 +            <not>
    3.28 +                <available file="${harness.dir}" type="dir"/>
    3.29 +            </not>
    3.30 +        </condition>
    3.31 +    </fail>
    3.32 +    <import file="${harness.dir}/build.xml"/>
    3.33 +</project>
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/visualweb/project/jsfportlet/nbproject/genfiles.properties	Sun Jan 28 18:54:08 2007 +0000
     4.3 @@ -0,0 +1,8 @@
     4.4 +build.xml.data.CRC32=54fe5d68
     4.5 +build.xml.script.CRC32=029f884c
     4.6 +build.xml.stylesheet.CRC32=1101b4cf
     4.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
     4.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
     4.9 +nbproject/build-impl.xml.data.CRC32=54fe5d68
    4.10 +nbproject/build-impl.xml.script.CRC32=8edb7f10
    4.11 +nbproject/build-impl.xml.stylesheet.CRC32=d126b16b
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/visualweb/project/jsfportlet/nbproject/project.properties	Sun Jan 28 18:54:08 2007 +0000
     5.3 @@ -0,0 +1,10 @@
     5.4 +#                 Sun Public License Notice
     5.5 +# 
     5.6 +# The contents of this file are subject to the Sun Public License
     5.7 +# Version 1.0 (the "License"). You may not use this file except in
     5.8 +# compliance with the License. A copy of the License is available at
     5.9 +# http://www.sun.com/
    5.10 +# 
    5.11 +# The Original Code is NetBeans. The Initial Developer of the Original
    5.12 +# Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
    5.13 +# Microsystems, Inc. All Rights Reserved.
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/visualweb/project/jsfportlet/nbproject/project.xml	Sun Jan 28 18:54:08 2007 +0000
     6.3 @@ -0,0 +1,132 @@
     6.4 +<?xml version="1.0" encoding="UTF-8"?>
     6.5 +<!--
     6.6 +The contents of this file are subject to the terms of the Common Development
     6.7 +and Distribution License (the License). You may not use this file except in
     6.8 +compliance with the License.
     6.9 +
    6.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
    6.11 +or http://www.netbeans.org/cddl.txt.
    6.12 +
    6.13 +When distributing Covered Code, include this CDDL Header Notice in each file
    6.14 +and include the License file at http://www.netbeans.org/cddl.txt.
    6.15 +If applicable, add the following below the CDDL Header, with the fields
    6.16 +enclosed by brackets [] replaced by your own identifying information:
    6.17 +"Portions Copyrighted [year] [name of copyright owner]"
    6.18 +
    6.19 +The Original Software is NetBeans. The Initial Developer of the Original
    6.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
    6.21 +Microsystems, Inc. All Rights Reserved.
    6.22 +-->
    6.23 +
    6.24 +<project xmlns="http://www.netbeans.org/ns/project/1">
    6.25 +    <type>org.netbeans.modules.apisupport.project</type>
    6.26 +    <configuration>
    6.27 +        <data xmlns="http://www.netbeans.org/ns/nb-module-project/2">
    6.28 +            <code-name-base>org.netbeans.modules.visualweb.project.jsfportlet</code-name-base>
    6.29 +            <suite-component/>
    6.30 +            <module-dependencies>
    6.31 +                <dependency>
    6.32 +                    <code-name-base>org.netbeans.modules.visualweb.project.jsf</code-name-base>
    6.33 +                    <build-prerequisite/>
    6.34 +                    <compile-dependency/>
    6.35 +                    <run-dependency>
    6.36 +                        <release-version>1</release-version>
    6.37 +                        <specification-version>1.0</specification-version>
    6.38 +                    </run-dependency>
    6.39 +                </dependency>
    6.40 +                <dependency>
    6.41 +                    <code-name-base>org.netbeans.modules.visualweb.api.portlet.dd</code-name-base>
    6.42 +                    <build-prerequisite/>
    6.43 +                    <compile-dependency/>
    6.44 +                    <run-dependency>
    6.45 +                        <release-version>1</release-version>
    6.46 +                        <specification-version>1.0</specification-version>
    6.47 +                    </run-dependency>
    6.48 +                </dependency>
    6.49 +                <dependency>
    6.50 +                    <code-name-base>org.netbeans.modules.j2eeserver</code-name-base>
    6.51 +                    <build-prerequisite/>
    6.52 +                    <compile-dependency/>
    6.53 +                    <run-dependency>
    6.54 +                        <release-version>4</release-version>
    6.55 +                        <specification-version>1.13</specification-version>
    6.56 +                    </run-dependency>
    6.57 +                </dependency>
    6.58 +                <dependency>
    6.59 +                    <code-name-base>org.netbeans.modules.project.ant</code-name-base>
    6.60 +                    <build-prerequisite/>
    6.61 +                    <compile-dependency/>
    6.62 +                    <run-dependency>
    6.63 +                        <release-version>1</release-version>
    6.64 +                        <specification-version>1.12</specification-version>
    6.65 +                    </run-dependency>
    6.66 +                </dependency>
    6.67 +                <dependency>
    6.68 +                    <code-name-base>org.netbeans.modules.project.libraries</code-name-base>
    6.69 +                    <build-prerequisite/>
    6.70 +                    <compile-dependency/>
    6.71 +                    <run-dependency>
    6.72 +                        <release-version>1</release-version>
    6.73 +                        <specification-version>1.13</specification-version>
    6.74 +                    </run-dependency>
    6.75 +                </dependency>
    6.76 +                <dependency>
    6.77 +                    <code-name-base>org.netbeans.modules.projectapi</code-name-base>
    6.78 +                    <build-prerequisite/>
    6.79 +                    <compile-dependency/>
    6.80 +                    <run-dependency>
    6.81 +                        <release-version>1</release-version>
    6.82 +                        <specification-version>1.9</specification-version>
    6.83 +                    </run-dependency>
    6.84 +                </dependency>
    6.85 +                <dependency>
    6.86 +                    <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
    6.87 +                    <build-prerequisite/>
    6.88 +                    <compile-dependency/>
    6.89 +                    <run-dependency>
    6.90 +                        <release-version>1</release-version>
    6.91 +                        <specification-version>1.13.0.5</specification-version>
    6.92 +                    </run-dependency>
    6.93 +                </dependency>
    6.94 +                <dependency>
    6.95 +                    <code-name-base>org.openide.dialogs</code-name-base>
    6.96 +                    <build-prerequisite/>
    6.97 +                    <compile-dependency/>
    6.98 +                    <run-dependency>
    6.99 +                        <specification-version>6.4</specification-version>
   6.100 +                    </run-dependency>
   6.101 +                </dependency>
   6.102 +                <dependency>
   6.103 +                    <code-name-base>org.openide.filesystems</code-name-base>
   6.104 +                    <build-prerequisite/>
   6.105 +                    <compile-dependency/>
   6.106 +                    <run-dependency>
   6.107 +                        <specification-version>6.4</specification-version>
   6.108 +                    </run-dependency>
   6.109 +                </dependency>
   6.110 +                <dependency>
   6.111 +                    <code-name-base>org.openide.options</code-name-base>
   6.112 +                    <build-prerequisite/>
   6.113 +                    <compile-dependency/>
   6.114 +                    <run-dependency>
   6.115 +                        <specification-version>6.4</specification-version>
   6.116 +                    </run-dependency>
   6.117 +                </dependency>
   6.118 +                <dependency>
   6.119 +                    <code-name-base>org.openide.util</code-name-base>
   6.120 +                    <build-prerequisite/>
   6.121 +                    <compile-dependency/>
   6.122 +                    <run-dependency>
   6.123 +                        <specification-version>6.8</specification-version>
   6.124 +                    </run-dependency>
   6.125 +                </dependency>
   6.126 +            </module-dependencies>
   6.127 +            <public-packages/>
   6.128 +            <!-- 
   6.129 +            <friend-packages>
   6.130 +                <package>org.netbeans.modules.visualweb.project.jsfportlet</package>
   6.131 +            </friend-packages>
   6.132 +            -->
   6.133 +        </data>
   6.134 +    </configuration>
   6.135 +</project>
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/visualweb/project/jsfportlet/nbproject/suite.properties	Sun Jan 28 18:54:08 2007 +0000
     7.3 @@ -0,0 +1,1 @@
     7.4 +suite.dir=${basedir}/../../idesuite
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/Bundle.properties	Sun Jan 28 18:54:08 2007 +0000
     8.3 @@ -0,0 +1,21 @@
     8.4 +#                 Sun Public License Notice
     8.5 +# 
     8.6 +# The contents of this file are subject to the Sun Public License
     8.7 +# Version 1.0 (the "License"). You may not use this file except in
     8.8 +# compliance with the License. A copy of the License is available at
     8.9 +# http://www.sun.com/
    8.10 +# 
    8.11 +# The Original Code is NetBeans. The Initial Developer of the Original
    8.12 +# Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
    8.13 +# Microsystems, Inc. All Rights Reserved.
    8.14 +
    8.15 +
    8.16 +# manifest.mf
    8.17 +OpenIDE-Module-Name=JSF Portlet
    8.18 +OpenIDE-Module-Display-Category=Visual Web
    8.19 +OpenIDE-Module-Short-Description=TODO.
    8.20 +OpenIDE-Module-Long-Description=TODO.
    8.21 +
    8.22 +
    8.23 +MSG_JsfPortletSupportImpl_DATAOBJECT_NULL=The DataObject of the Initial Page is Null!
    8.24 +MSG_JsfPortletSupportImpl_PORTLETDDNOTFOUND=The porlet.xml File could not be found for project\: {0}!
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/JsfPortletProjectTemplate.java	Sun Jan 28 18:54:08 2007 +0000
     9.3 @@ -0,0 +1,139 @@
     9.4 +/*
     9.5 + * {START_JAVA_COPYRIGHT_NOTICE
     9.6 + * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
     9.7 + * Use is subject to license terms.
     9.8 + * END_COPYRIGHT_NOTICE}
     9.9 + */
    9.10 +
    9.11 +package org.netbeans.modules.visualweb.project.jsfportlet;
    9.12 +
    9.13 +import org.netbeans.modules.visualweb.project.jsf.api.JsfProjectConstants;
    9.14 +import org.netbeans.modules.visualweb.project.jsf.api.ProjectTemplate;
    9.15 +import org.netbeans.modules.visualweb.project.jsf.api.JsfProjectClassPathExtender;
    9.16 +import org.netbeans.modules.visualweb.project.jsf.api.JsfProjectUtils;
    9.17 +
    9.18 +import java.io.IOException;
    9.19 +import java.io.InputStream;
    9.20 +import javax.xml.parsers.DocumentBuilder;
    9.21 +import javax.xml.parsers.DocumentBuilderFactory;
    9.22 +import org.netbeans.api.project.Project;
    9.23 +import org.netbeans.api.project.libraries.Library;
    9.24 +import org.netbeans.api.project.libraries.LibraryManager;
    9.25 +import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
    9.26 +import org.openide.ErrorManager;
    9.27 +import org.openide.filesystems.FileObject;
    9.28 +import org.openide.filesystems.FileUtil;
    9.29 +import org.w3c.dom.Document;
    9.30 +import org.w3c.dom.Node;
    9.31 +import org.w3c.dom.NodeList;
    9.32 +
    9.33 +
    9.34 +/**
    9.35 + *
    9.36 + * @author David Botterill
    9.37 + */
    9.38 +public class JsfPortletProjectTemplate extends ProjectTemplate {
    9.39 +    private static final String DEFAULT_THEME = "theme-default";
    9.40 +
    9.41 +    /** Creates a new instance of JsfProjectTemplate */
    9.42 +    public JsfPortletProjectTemplate() {
    9.43 +    }
    9.44 +    
    9.45 +    public void addLibrary(Project project) throws IOException {
    9.46 +        // Add the Creator libraries to the project
    9.47 +        LibraryManager libMgr = LibraryManager.getDefault();
    9.48 +        Library[] designLibs = {
    9.49 +            libMgr.getLibrary("jsfsupport-designtime"),
    9.50 +            libMgr.getLibrary("webui-designtime"),
    9.51 +            libMgr.getLibrary("jdbcsupport-designtime"),
    9.52 +            libMgr.getLibrary(DEFAULT_THEME),
    9.53 +        };
    9.54 +        
    9.55 +        Library[] runLibs = {
    9.56 +            libMgr.getLibrary("jsfsupport-runtime"),
    9.57 +            libMgr.getLibrary("portlet-runtime"),
    9.58 +            libMgr.getLibrary("jsf-portlet-runtime"),
    9.59 +            libMgr.getLibrary("jdbcsupport-runtime"),
    9.60 +            libMgr.getLibrary("exceptionhandler-runtime"),
    9.61 +            libMgr.getLibrary(DEFAULT_THEME),
    9.62 +        };
    9.63 +
    9.64 +        if (JsfProjectUtils.isJsfProject(project)) { // XXX Thresher project
    9.65 +            JsfProjectUtils.addLibraryReferences(project, designLibs, JsfProjectClassPathExtender.LIBRARY_ROLE_DESIGN);
    9.66 +            JsfProjectUtils.addLibraryReferences(project, runLibs, JsfProjectClassPathExtender.LIBRARY_ROLE_DEPLOY);
    9.67 +            JsfProjectUtils.addLocalizedThemeArchive(project, DEFAULT_THEME);
    9.68 +	} else {
    9.69 +            JsfProjectUtils.addLibraryReferences(project, designLibs, JsfProjectClassPathExtender.LIBRARY_ROLE_DESIGN);
    9.70 +            JsfProjectUtils.addLibraryReferences(project, runLibs, JsfProjectClassPathExtender.LIBRARY_ROLE_DEPLOY);
    9.71 +            JsfProjectUtils.addLocalizedThemeArchive(project, DEFAULT_THEME);
    9.72 +        }
    9.73 +        JsfProjectUtils.putProjectProperty(project, JsfProjectConstants.PROP_CURRENT_THEME, DEFAULT_THEME); // NOI18N
    9.74 +    }
    9.75 +
    9.76 +    public void create(Project project, String j2eeLevel) throws IOException {
    9.77 +        // Extract the project template file for this project type
    9.78 +        // TODO: support BluePrints source structure as well...
    9.79 +        InputStream is = JsfPortletProjectTemplate.class.getResourceAsStream("/org/netbeans/modules/visualweb/project/jsfportlet/JsfPortletProjectTemplateJakarta.xml"); // NOI18N
    9.80 +        Document document = null;
    9.81 +        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    9.82 +        Node node;
    9.83 +        
    9.84 +        try {
    9.85 +            DocumentBuilder builder = factory.newDocumentBuilder();
    9.86 +            document = builder.parse(is);
    9.87 +            FileObject projDir = project.getProjectDirectory();
    9.88 +            instantiateFile(project, document.getDocumentElement(), project.getProjectDirectory(), j2eeLevel);
    9.89 +        } catch (IOException e) {
    9.90 +            throw e;
    9.91 +        } catch (Exception e) {
    9.92 +            ErrorManager.getDefault().notify(e);
    9.93 +        }
    9.94 +    }
    9.95 +
    9.96 +    public void instantiateFile(Project project, Node node, FileObject folder, String j2eeLevel) throws IOException {
    9.97 +        if (folder.equals(project.getProjectDirectory())) {
    9.98 +            JsfProjectUtils.putProjectProperty(project, JsfProjectConstants.PROP_JSF_PROJECT_LIBRARIES_DIR, JsfProjectConstants.PATH_LIBRARIES);
    9.99 +        }
   9.100 +        
   9.101 +        if (j2eeLevel == null) {
   9.102 +            j2eeLevel = J2eeModule.JAVA_EE_5;
   9.103 +        }
   9.104 +                
   9.105 +        String nodeName = node.getNodeName();
   9.106 +        String fileName = getAttr(node, "name"); // NOI18N
   9.107 +        String templateJ2eeLevel = getAttr(node, "j2eeLevel"); // NOI18N
   9.108 +        
   9.109 +        if (templateJ2eeLevel.length() != 0 && !j2eeLevel.equals(templateJ2eeLevel)) {
   9.110 +                                    // Wrong Java EE level
   9.111 +            return;
   9.112 +        }
   9.113 +        
   9.114 +        if (nodeName.equals("file") && folder.getFileObject(fileName) == null) {
   9.115 +            instantiateFileTemplate(folder, fileName, getAttr(node, "template"));  // NOI18N
   9.116 +        } else {
   9.117 +            FileObject newFolder = null;
   9.118 +            if (nodeName.equals("folder")) {  // NOI18N
   9.119 +                if (fileName.equals("${" + JsfProjectConstants.PROP_JSF_PAGEBEAN_PACKAGE + "}")) {
   9.120 +                    fileName = getBeanPackage();
   9.121 +                    if (fileName == null) {
   9.122 +                        fileName = deriveSafeName(project.getProjectDirectory().getName());
   9.123 +                    }
   9.124 +                    JsfProjectUtils.putProjectProperty(project, JsfProjectConstants.PROP_JSF_PAGEBEAN_PACKAGE, fileName);
   9.125 +                }
   9.126 +                fileName = fileName.replace('.',  '/');
   9.127 +                if ((newFolder = folder.getFileObject(fileName)) == null) {
   9.128 +                    // <RAVE> folder.createFolder does NOT deal with nested folders being created
   9.129 +                    newFolder = FileUtil.createFolder(folder, fileName);
   9.130 +//                    newFolder = folder.createFolder(fileName);  // NOI18N
   9.131 +                    // </RAVE>
   9.132 +                }
   9.133 +            } else {
   9.134 +                newFolder = folder;
   9.135 +            }
   9.136 +            NodeList nodes = node.getChildNodes();
   9.137 +            for (int i = 0; i < nodes.getLength(); i++) {
   9.138 +                instantiateFile(project, nodes.item(i), newFolder, j2eeLevel);
   9.139 +            }
   9.140 +        }
   9.141 +    }
   9.142 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/JsfPortletProjectTemplateJakarta.xml	Sun Jan 28 18:54:08 2007 +0000
    10.3 @@ -0,0 +1,54 @@
    10.4 +<?xml version="1.0" encoding="UTF-8"?>
    10.5 +<!--
    10.6 +The contents of this file are subject to the terms of the Common Development
    10.7 +and Distribution License (the License). You may not use this file except in
    10.8 +compliance with the License.
    10.9 +
   10.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   10.11 +or http://www.netbeans.org/cddl.txt.
   10.12 +
   10.13 +When distributing Covered Code, include this CDDL Header Notice in each file
   10.14 +and include the License file at http://www.netbeans.org/cddl.txt.
   10.15 +If applicable, add the following below the CDDL Header, with the fields
   10.16 +enclosed by brackets [] replaced by your own identifying information:
   10.17 +"Portions Copyrighted [year] [name of copyright owner]"
   10.18 +
   10.19 +The Original Software is NetBeans. The Initial Developer of the Original
   10.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   10.21 +Microsystems, Inc. All Rights Reserved.
   10.22 +-->
   10.23 +
   10.24 +<project>
   10.25 +    <folder name="nbproject">
   10.26 +        <file name="j2ee13-web-xml.xsl" template="Templates/JsfApps/j2ee13-web-xml.xsl"/>
   10.27 +        <file name="export-web-xml.xsl" template="Templates/JsfApps/export-web-xml.xsl"/>
   10.28 +    </folder>    
   10.29 +    <folder name="src">
   10.30 +        <folder name="${jsf.pagebean.package}">
   10.31 +            <file name="ApplicationBean1.java" template="Templates/JsfBeans/ApplicationBean.java"/>
   10.32 +            <file name="SessionBean1.java" template="Templates/JsfBeans/SessionBean.java"/>
   10.33 +            <file name="RequestBean1.java" template="Templates/JsfBeans/RequestBean.java"/>
   10.34 +            <file name="Bundle.properties" template="Templates/Classes/properties.properties"/>
   10.35 +        </folder>
   10.36 +    </folder>
   10.37 +    <folder name="web">
   10.38 +        <file name="PortletPage1.jsp" template="Templates/JsfPortlet/PortletPage.jsp"/>
   10.39 +<!-- I'm guessing portlets shouldn't have their own stylesheets.... correct?
   10.40 +        <folder name="resources">
   10.41 +            <file name="stylesheet.css" template="Templates/JsfOther/stylesheet.css"/>
   10.42 +        </folder>
   10.43 +-->
   10.44 +        <folder name="WEB-INF">
   10.45 +            <file name="web.xml" template="Templates/JsfAdvanced/web.xml"/>
   10.46 +            <file name="portlet.xml" template="Templates/JsfPortlet/portlet.xml"/>
   10.47 +            <file name="navigation.xml" template="Templates/JsfAdvanced/navigation.xml"/>
   10.48 +            <file name="managed-beans.xml" template="Templates/JsfAdvanced/managed-beans.xml"/>
   10.49 +            <file name="faces-config.xml" template="Templates/JsfAdvanced/faces-config.xml"/>
   10.50 +            <folder name="classes"/>
   10.51 +            <folder name="lib"/>
   10.52 +            <folder name="tld">
   10.53 +                <file name="portlet.tld" template="Templates/JsfPortlet/portlet.tld"/>
   10.54 +            </folder>
   10.55 +        </folder>
   10.56 +    </folder>
   10.57 +</project>
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/libraries/Bundle.properties	Sun Jan 28 18:54:08 2007 +0000
    11.3 @@ -0,0 +1,2 @@
    11.4 +jsf-portlet-runtime=JSR-168 Portlet to JSF Bridge Support
    11.5 +portlet-runtime=Sun Web Portlet 
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/libraries/jsf-portlet-runtime.xml	Sun Jan 28 18:54:08 2007 +0000
    12.3 @@ -0,0 +1,30 @@
    12.4 +<?xml version="1.0" encoding="UTF-8"?>
    12.5 +<!--
    12.6 +The contents of this file are subject to the terms of the Common Development
    12.7 +and Distribution License (the License). You may not use this file except in
    12.8 +compliance with the License.
    12.9 +
   12.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   12.11 +or http://www.netbeans.org/cddl.txt.
   12.12 +
   12.13 +When distributing Covered Code, include this CDDL Header Notice in each file
   12.14 +and include the License file at http://www.netbeans.org/cddl.txt.
   12.15 +If applicable, add the following below the CDDL Header, with the fields
   12.16 +enclosed by brackets [] replaced by your own identifying information:
   12.17 +"Portions Copyrighted [year] [name of copyright owner]"
   12.18 +
   12.19 +The Original Software is NetBeans. The Initial Developer of the Original
   12.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   12.21 +Microsystems, Inc. All Rights Reserved.
   12.22 +-->
   12.23 +
   12.24 +<!DOCTYPE library PUBLIC "-//NetBeans//DTD Library Declaration 1.0//EN" "http://www.netbeans.org/dtds/library-declaration-1_0.dtd">
   12.25 +<library version="1.0">
   12.26 +    <name>jsf-portlet-runtime</name>
   12.27 +    <type>j2se</type>
   12.28 +    <localizing-bundle>org.netbeans.modules.visualweb.project.jsfportlet.libraries.Bundle</localizing-bundle>
   12.29 +    <volume>
   12.30 +        <type>classpath</type>
   12.31 +        <resource>jar:nbinst:///modules/ext/jsf-portlet.jar!/</resource>
   12.32 +    </volume>
   12.33 +</library>
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/libraries/portlet-runtime.xml	Sun Jan 28 18:54:08 2007 +0000
    13.3 @@ -0,0 +1,33 @@
    13.4 +<?xml version="1.0" encoding="UTF-8"?>
    13.5 +<!--
    13.6 +The contents of this file are subject to the terms of the Common Development
    13.7 +and Distribution License (the License). You may not use this file except in
    13.8 +compliance with the License.
    13.9 +
   13.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   13.11 +or http://www.netbeans.org/cddl.txt.
   13.12 +
   13.13 +When distributing Covered Code, include this CDDL Header Notice in each file
   13.14 +and include the License file at http://www.netbeans.org/cddl.txt.
   13.15 +If applicable, add the following below the CDDL Header, with the fields
   13.16 +enclosed by brackets [] replaced by your own identifying information:
   13.17 +"Portions Copyrighted [year] [name of copyright owner]"
   13.18 +
   13.19 +The Original Software is NetBeans. The Initial Developer of the Original
   13.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   13.21 +Microsystems, Inc. All Rights Reserved.
   13.22 +-->
   13.23 +
   13.24 +<!DOCTYPE library PUBLIC "-//NetBeans//DTD Library Declaration 1.0//EN" "http://www.netbeans.org/dtds/library-declaration-1_0.dtd">
   13.25 +<library version="1.0">
   13.26 +    <name>portlet-runtime</name>
   13.27 +    <type>j2se</type>
   13.28 +    <localizing-bundle>org.netbeans.modules.visualweb.project.jsfportlet.libraries.Bundle</localizing-bundle>
   13.29 +    <volume>
   13.30 +        <type>classpath</type>
   13.31 +        <resource>jar:nbinst:///modules/ext/webui.jar!/</resource>
   13.32 +        <resource>jar:nbinst:///modules/ext/jstl.jar!/</resource>
   13.33 +        <resource>jar:nbinst:///modules/ext/commons-fileupload-1.0.jar!/</resource>        
   13.34 +        <resource>jar:nbinst:///modules/ext/standard.jar!/</resource>        
   13.35 +    </volume>
   13.36 +</library>
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/Bundle.properties	Sun Jan 28 18:54:08 2007 +0000
    14.3 @@ -0,0 +1,15 @@
    14.4 +#                 Sun Public License Notice
    14.5 +# 
    14.6 +# The contents of this file are subject to the Sun Public License
    14.7 +# Version 1.0 (the "License"). You may not use this file except in
    14.8 +# compliance with the License. A copy of the License is available at
    14.9 +# http://www.sun.com/
   14.10 +# 
   14.11 +# The Original Code is NetBeans. The Initial Developer of the Original
   14.12 +# Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
   14.13 +# Microsystems, Inc. All Rights Reserved.
   14.14 +OpenIDE-Module-Name=Portlet Project Support
   14.15 +OpenIDE-Module-Display-Category=Visual Web
   14.16 +OpenIDE-Module-Short-Description=Supports creating Portlet Web Projects
   14.17 +OpenIDE-Module-Long-Description=Supports creating Portlet Web Projects
   14.18 +Templates/JsfPortlet=Portlet Pages
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/layer.xml	Sun Jan 28 18:54:08 2007 +0000
    15.3 @@ -0,0 +1,108 @@
    15.4 +<?xml version="1.0" encoding="UTF-8"?>
    15.5 +<!--
    15.6 +The contents of this file are subject to the terms of the Common Development
    15.7 +and Distribution License (the License). You may not use this file except in
    15.8 +compliance with the License.
    15.9 +
   15.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   15.11 +or http://www.netbeans.org/cddl.txt.
   15.12 +
   15.13 +When distributing Covered Code, include this CDDL Header Notice in each file
   15.14 +and include the License file at http://www.netbeans.org/cddl.txt.
   15.15 +If applicable, add the following below the CDDL Header, with the fields
   15.16 +enclosed by brackets [] replaced by your own identifying information:
   15.17 +"Portions Copyrighted [year] [name of copyright owner]"
   15.18 +
   15.19 +The Original Software is NetBeans. The Initial Developer of the Original
   15.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   15.21 +Microsystems, Inc. All Rights Reserved.
   15.22 +-->
   15.23 +
   15.24 +<?xml-stylesheet type="text/xml" href="http://openide.netbeans.org/fs/filesystem.xsl"?>
   15.25 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
   15.26 +<filesystem>
   15.27 +    <folder name="Templates">
   15.28 +        <!-- XXX Portlet is not available for ShortFin
   15.29 +        <folder name="Project">
   15.30 +            <attr name="Web" boolvalue="true"/>
   15.31 +            
   15.32 +            <folder name="Web">
   15.33 +                <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsf/ui/resources/web.html"/>                
   15.34 +                <attr name="emptyWeb.xml/portletProject.xml" boolvalue="true"/>
   15.35 +                <file name="portletProject.xml">
   15.36 +                   <attr name="template" boolvalue="true"/>
   15.37 +                   <attr name="templateWizardIterator" newvalue="org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard.PortletProjectWizardIterator"/>
   15.38 +                   <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard.resources.Bundle"/>
   15.39 +                   <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/resources/PortletProjectIcon.gif"/>
   15.40 +                   <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/resources/PortletProject.html"/>
   15.41 +                    <attr name="templateCategory" stringvalue="rave-portlet"/>
   15.42 +                </file>
   15.43 +            </folder>
   15.44 +        </folder>
   15.45 +        -->
   15.46 +        <attr name="JsfAdvanced/JsfPortlet" boolvalue="true"/>
   15.47 +        <folder name="JsfPortlet">
   15.48 +            <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsfportlet.resources.Bundle"/>        
   15.49 +            <file name="portletWeb.xml" url="/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/portlet-web.xml.template">
   15.50 +                <attr name="template" boolvalue="true" />
   15.51 +                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsfportlet.resources.templates.resources.Bundle"/>
   15.52 +                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/portletWebTemplateHelp.html" />
   15.53 +                <attr name="templateCategory" stringvalue="rave-portlet"/>
   15.54 +            </file>    
   15.55 +             <file name="portlet.xml" url="/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/portlet.xml.template">
   15.56 +                <attr name="template" boolvalue="true" />
   15.57 +                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsfportlet.resources.templates.resources.Bundle"/>
   15.58 +                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/portletTemplateHelp.html" />
   15.59 +                <attr name="templateCategory" stringvalue="rave-portlet"/>
   15.60 +            </file>    
   15.61 +            <file name="portlet.tld" url="/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/portlet.tld.template">
   15.62 +                <attr name="template" boolvalue="true" />
   15.63 +                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsfportlet.resources.templates.resources.Bundle"/>
   15.64 +                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/portletTLDTemplateHelp.html" />
   15.65 +                <attr name="templateCategory" stringvalue="rave-portlet"/>
   15.66 +            </file>    
   15.67 +
   15.68 +            <file name="PortletPage.jsp" url="/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPage.jsp.template">
   15.69 +                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsfportlet.resources.templates.resources.Bundle"/>
   15.70 +                <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org.netbeans.modules.html.htmlObject.gif"/>
   15.71 +                <attr name="template" boolvalue="true" />
   15.72 +                <attr name="templateWizardIterator" newvalue="org.netbeans.modules.visualweb.project.jsf.ui.WebFormIterator"/>
   15.73 +                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/PortletPageTemplateHelp.html" />
   15.74 +                <attr name="templateCategory" stringvalue="rave-portlet"/>
   15.75 +            </file>
   15.76 +            <attr name="PortletPage.jsp/PortletPage.java" boolvalue="true"/>
   15.77 +            <file name="PortletPage.java"  url="/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPage.java.template">
   15.78 +                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsfportlet.resources.templates.resources.Bundle"/>
   15.79 +                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/PortletJavaPageTemplateHelp.html" />
   15.80 +                <attr name="templateCategory" stringvalue="rave-portlet"/>
   15.81 +            </file>
   15.82 +        <file name="PortletPageFragment.jspf" url="/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPageFragment.jspf.template">
   15.83 +                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsfportlet.resources.templates.resources.Bundle"/>
   15.84 +                <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org.netbeans.modules.html.htmlObject.gif"/>
   15.85 +                <attr name="template" boolvalue="true" />
   15.86 +                <attr name="templateWizardIterator" newvalue="org.netbeans.modules.visualweb.project.jsf.ui.WebFormIterator"/>
   15.87 +                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/PortletPageFragmentTemplateHelp.html" />
   15.88 +                <attr name="templateCategory" stringvalue="rave-portlet"/>
   15.89 +            </file>
   15.90 +            <attr name="PortletPageFragment.jspf/PortletPageFragment.java" boolvalue="true"/>
   15.91 +            <file name="PortletPageFragment.java" url="/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPageFragment.java.template">
   15.92 +                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsf.resources.Bundle"/>
   15.93 +                <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsf/resources/templates/descriptions/pageJavaTemplateHelp.html" />
   15.94 +            </file>
   15.95 +            <attr name="PageFragment.java/html.html" boolvalue="true"/>
   15.96 +            
   15.97 +
   15.98 +
   15.99 +        </folder> <!--JsfPortlet-->
  15.100 +
  15.101 +    </folder> <!-- Templates-->
  15.102 +    <folder name="org-netbeans-api-project-libraries">
  15.103 +        <folder name="Libraries">
  15.104 +            <file name="portlet-runtime.xml" url="/org/netbeans/modules/visualweb/project/jsfportlet/libraries/portlet-runtime.xml"/>
  15.105 +            <file name="jsf-portlet-runtime.xml" url="/org/netbeans/modules/visualweb/project/jsfportlet/libraries/jsf-portlet-runtime.xml"/>
  15.106 +        </folder>
  15.107 +    </folder>
  15.108 +    
  15.109 +    
  15.110 +    
  15.111 +</filesystem>
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPage.java.template	Sun Jan 28 18:54:08 2007 +0000
    16.3 @@ -0,0 +1,51 @@
    16.4 +/*
    16.5 + * __NAME__.java
    16.6 + *
    16.7 + * Created on __DATE__, __TIME__
    16.8 + * Copyright __USER__
    16.9 + */
   16.10 +package untitled;
   16.11 +
   16.12 +import com.sun.rave.web.ui.appbase.AbstractPageBean;
   16.13 +import javax.faces.FacesException;
   16.14 +import com.sun.rave.web.ui.component.Form;
   16.15 +import com.sun.rave.web.ui.component.ThemeLinks;
   16.16 +
   16.17 +
   16.18 +public class __NAME__ extends AbstractPageBean {
   16.19 +    // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
   16.20 +
   16.21 +    private int __placeholder;
   16.22 +
   16.23 +    private ThemeLinks themeLinks1 = new ThemeLinks();
   16.24 +
   16.25 +    public ThemeLinks getThemeLinks1() {
   16.26 +        return themeLinks1;
   16.27 +    }
   16.28 +
   16.29 +    public void setThemeLinks1(ThemeLinks t) {
   16.30 +        this.themeLinks1 = t;
   16.31 +    }
   16.32 +
   16.33 +    private Form form1 = new Form();
   16.34 +
   16.35 +    public Form getForm1() {
   16.36 +        return form1;
   16.37 +    }
   16.38 +
   16.39 +    public void setForm1(Form f) {
   16.40 +        this.form1 = f;
   16.41 +    }
   16.42 +
   16.43 +    // </editor-fold>
   16.44 +    public __NAME__() {
   16.45 +        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
   16.46 +        try {
   16.47 +        } catch (Exception e) {
   16.48 +            log("Page1 Initialization Failure", e);
   16.49 +            throw e instanceof javax.faces.FacesException ? (FacesException) e: new FacesException(e);
   16.50 +        }
   16.51 +        // </editor-fold>
   16.52 +        // TODO: Add your own initialization code here (optional)
   16.53 +    }
   16.54 +}
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPage.jsp.template	Sun Jan 28 18:54:08 2007 +0000
    17.3 @@ -0,0 +1,11 @@
    17.4 +<?xml version="1.0" encoding="UTF-8"?>
    17.5 +<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">
    17.6 +    <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
    17.7 +    <f:view>
    17.8 +        <div style="-rave-layout: grid; position: relative; left: 0px; top: 0px; width: 400px; height: 400px">
    17.9 +            <ui:themeLinks binding="#{__NAME__.themeLinks1}" id="themeLinks1" />
   17.10 +            <ui:form binding="#{__NAME__.form1}" id="form1"/>
   17.11 +        </div>
   17.12 +    </f:view>
   17.13 +</jsp:root>
   17.14 +
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPageFragment.java.template	Sun Jan 28 18:54:08 2007 +0000
    18.3 @@ -0,0 +1,14 @@
    18.4 +/*
    18.5 + * __NAME__.java
    18.6 + *
    18.7 + * Created on __DATE__, __TIME__
    18.8 + * Copyright __USER__
    18.9 + */
   18.10 +package untitled;
   18.11 +
   18.12 +import com.sun.rave.web.ui.appbase.AbstractPageBean;
   18.13 +
   18.14 +public class __NAME__ extends AbstractPageBean {
   18.15 +    public __NAME__() {
   18.16 +    }
   18.17 +}
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPageFragment.jspf.template	Sun Jan 28 18:54:08 2007 +0000
    19.3 @@ -0,0 +1,5 @@
    19.4 +<?xml version="1.0"?>
    19.5 +<div style="-rave-layout: grid; width: 400px; height: 200px" xmlns:f="http://java.sun.com/jsf/core" >
    19.6 +  <f:subview id="__NAME__">
    19.7 +  </f:subview>
    19.8 +</div>
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/PortletJavaPageTemplateHelp.html	Sun Jan 28 18:54:08 2007 +0000
    20.3 @@ -0,0 +1,26 @@
    20.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    20.5 +<!--
    20.6 +The contents of this file are subject to the terms of the Common Development
    20.7 +and Distribution License (the License). You may not use this file except in
    20.8 +compliance with the License.
    20.9 +
   20.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   20.11 +or http://www.netbeans.org/cddl.txt.
   20.12 +
   20.13 +When distributing Covered Code, include this CDDL Header Notice in each file
   20.14 +and include the License file at http://www.netbeans.org/cddl.txt.
   20.15 +If applicable, add the following below the CDDL Header, with the fields
   20.16 +enclosed by brackets [] replaced by your own identifying information:
   20.17 +"Portions Copyrighted [year] [name of copyright owner]"
   20.18 +
   20.19 +The Original Software is NetBeans. The Initial Developer of the Original
   20.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   20.21 +Microsystems, Inc. All Rights Reserved.
   20.22 +-->
   20.23 +
   20.24 +
   20.25 +<HTML>
   20.26 +<BODY>
   20.27 +        This template creates a a portlet page bean for a portlet page.
   20.28 +</BODY>
   20.29 +</HTML>
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/PortletPageFragmentTemplateHelp.html	Sun Jan 28 18:54:08 2007 +0000
    21.3 @@ -0,0 +1,26 @@
    21.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    21.5 +<!--
    21.6 +The contents of this file are subject to the terms of the Common Development
    21.7 +and Distribution License (the License). You may not use this file except in
    21.8 +compliance with the License.
    21.9 +
   21.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   21.11 +or http://www.netbeans.org/cddl.txt.
   21.12 +
   21.13 +When distributing Covered Code, include this CDDL Header Notice in each file
   21.14 +and include the License file at http://www.netbeans.org/cddl.txt.
   21.15 +If applicable, add the following below the CDDL Header, with the fields
   21.16 +enclosed by brackets [] replaced by your own identifying information:
   21.17 +"Portions Copyrighted [year] [name of copyright owner]"
   21.18 +
   21.19 +The Original Software is NetBeans. The Initial Developer of the Original
   21.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   21.21 +Microsystems, Inc. All Rights Reserved.
   21.22 +-->
   21.23 +
   21.24 +
   21.25 +<HTML>
   21.26 +<BODY>
   21.27 +        This template will create a new blank portlet page fragment. Design the portlet page fragment by dragging components from the Palette.  Add the portlet page fragment to portlet pages by adding a page fragment box from the component palette.
   21.28 +</BODY>
   21.29 +</HTML>
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/PortletPageTemplateHelp.html	Sun Jan 28 18:54:08 2007 +0000
    22.3 @@ -0,0 +1,26 @@
    22.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    22.5 +<!--
    22.6 +The contents of this file are subject to the terms of the Common Development
    22.7 +and Distribution License (the License). You may not use this file except in
    22.8 +compliance with the License.
    22.9 +
   22.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   22.11 +or http://www.netbeans.org/cddl.txt.
   22.12 +
   22.13 +When distributing Covered Code, include this CDDL Header Notice in each file
   22.14 +and include the License file at http://www.netbeans.org/cddl.txt.
   22.15 +If applicable, add the following below the CDDL Header, with the fields
   22.16 +enclosed by brackets [] replaced by your own identifying information:
   22.17 +"Portions Copyrighted [year] [name of copyright owner]"
   22.18 +
   22.19 +The Original Software is NetBeans. The Initial Developer of the Original
   22.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   22.21 +Microsystems, Inc. All Rights Reserved.
   22.22 +-->
   22.23 +
   22.24 +
   22.25 +<HTML>
   22.26 +<BODY>
   22.27 +        This template will create a new blank portlet page. Design the portlet page by dragging components from the Palette.
   22.28 +</BODY>
   22.29 +</HTML>
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/facesConfigTemplateHelp.html	Sun Jan 28 18:54:08 2007 +0000
    23.3 @@ -0,0 +1,28 @@
    23.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    23.5 +<!--
    23.6 +The contents of this file are subject to the terms of the Common Development
    23.7 +and Distribution License (the License). You may not use this file except in
    23.8 +compliance with the License.
    23.9 +
   23.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   23.11 +or http://www.netbeans.org/cddl.txt.
   23.12 +
   23.13 +When distributing Covered Code, include this CDDL Header Notice in each file
   23.14 +and include the License file at http://www.netbeans.org/cddl.txt.
   23.15 +If applicable, add the following below the CDDL Header, with the fields
   23.16 +enclosed by brackets [] replaced by your own identifying information:
   23.17 +"Portions Copyrighted [year] [name of copyright owner]"
   23.18 +
   23.19 +The Original Software is NetBeans. The Initial Developer of the Original
   23.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   23.21 +Microsystems, Inc. All Rights Reserved.
   23.22 +-->
   23.23 +
   23.24 +
   23.25 +<HTML>
   23.26 +<BODY>
   23.27 +        This template creates a new Faces Configuration XML file that is used
   23.28 +        by a Java Studio Creator project.
   23.29 +        It is also known as faces-config.xml.
   23.30 +</BODY>
   23.31 +</HTML>
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/portletTLDTemplateHelp.html	Sun Jan 28 18:54:08 2007 +0000
    24.3 @@ -0,0 +1,28 @@
    24.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    24.5 +<!--
    24.6 +The contents of this file are subject to the terms of the Common Development
    24.7 +and Distribution License (the License). You may not use this file except in
    24.8 +compliance with the License.
    24.9 +
   24.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   24.11 +or http://www.netbeans.org/cddl.txt.
   24.12 +
   24.13 +When distributing Covered Code, include this CDDL Header Notice in each file
   24.14 +and include the License file at http://www.netbeans.org/cddl.txt.
   24.15 +If applicable, add the following below the CDDL Header, with the fields
   24.16 +enclosed by brackets [] replaced by your own identifying information:
   24.17 +"Portions Copyrighted [year] [name of copyright owner]"
   24.18 +
   24.19 +The Original Software is NetBeans. The Initial Developer of the Original
   24.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   24.21 +Microsystems, Inc. All Rights Reserved.
   24.22 +-->
   24.23 +
   24.24 +
   24.25 +<HTML>
   24.26 +<BODY>
   24.27 +        This template creates a new Portlet TLD file that is used
   24.28 +        by a Java Studio Creator project.
   24.29 +        It is also known as portlet.tld.
   24.30 +</BODY>
   24.31 +</HTML>
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/portletTemplateHelp.html	Sun Jan 28 18:54:08 2007 +0000
    25.3 @@ -0,0 +1,28 @@
    25.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    25.5 +<!--
    25.6 +The contents of this file are subject to the terms of the Common Development
    25.7 +and Distribution License (the License). You may not use this file except in
    25.8 +compliance with the License.
    25.9 +
   25.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   25.11 +or http://www.netbeans.org/cddl.txt.
   25.12 +
   25.13 +When distributing Covered Code, include this CDDL Header Notice in each file
   25.14 +and include the License file at http://www.netbeans.org/cddl.txt.
   25.15 +If applicable, add the following below the CDDL Header, with the fields
   25.16 +enclosed by brackets [] replaced by your own identifying information:
   25.17 +"Portions Copyrighted [year] [name of copyright owner]"
   25.18 +
   25.19 +The Original Software is NetBeans. The Initial Developer of the Original
   25.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   25.21 +Microsystems, Inc. All Rights Reserved.
   25.22 +-->
   25.23 +
   25.24 +
   25.25 +<HTML>
   25.26 +<BODY>
   25.27 +        This template creates a new Portlet deployment descriptor XML file that is used
   25.28 +        by a Java Studio Creator project.
   25.29 +        It is also known as portlet.xml.
   25.30 +</BODY>
   25.31 +</HTML>
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/portletWebTemplateHelp.html	Sun Jan 28 18:54:08 2007 +0000
    26.3 @@ -0,0 +1,27 @@
    26.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    26.5 +<!--
    26.6 +The contents of this file are subject to the terms of the Common Development
    26.7 +and Distribution License (the License). You may not use this file except in
    26.8 +compliance with the License.
    26.9 +
   26.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   26.11 +or http://www.netbeans.org/cddl.txt.
   26.12 +
   26.13 +When distributing Covered Code, include this CDDL Header Notice in each file
   26.14 +and include the License file at http://www.netbeans.org/cddl.txt.
   26.15 +If applicable, add the following below the CDDL Header, with the fields
   26.16 +enclosed by brackets [] replaced by your own identifying information:
   26.17 +"Portions Copyrighted [year] [name of copyright owner]"
   26.18 +
   26.19 +The Original Software is NetBeans. The Initial Developer of the Original
   26.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   26.21 +Microsystems, Inc. All Rights Reserved.
   26.22 +-->
   26.23 +
   26.24 +
   26.25 +<HTML>
   26.26 +<BODY>
   26.27 +        This template creates a new Portlet Web Application Configuration XML file that
   26.28 +        is used by a Java Studio Creator project. Also known as web.xml.
   26.29 +</BODY>
   26.30 +</HTML>
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/faces-config.xml.template	Sun Jan 28 18:54:08 2007 +0000
    27.3 @@ -0,0 +1,33 @@
    27.4 +<?xml version='1.0' encoding='UTF-8'?>
    27.5 +
    27.6 +<!--
    27.7 + Copyright 2005 Sun Microsystems, Inc. All rights reserved.
    27.8 + SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
    27.9 +-->
   27.10 +
   27.11 +<!DOCTYPE faces-config PUBLIC
   27.12 +  "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
   27.13 +  "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
   27.14 +
   27.15 +
   27.16 +<faces-config>
   27.17 +
   27.18 +
   27.19 +  <!-- Install Replacement Factory Objects -->
   27.20 +  <factory>
   27.21 +    <faces-context-factory>
   27.22 +      com.sun.faces.portlet.FacesContextFactoryImpl
   27.23 +    </faces-context-factory>
   27.24 +    <lifecycle-factory>
   27.25 +      com.sun.faces.portlet.LifecycleFactoryImpl
   27.26 +    </lifecycle-factory>
   27.27 +  </factory>
   27.28 +  
   27.29 +  <!-- Install Replacement Application Objects -->  
   27.30 +  <application>
   27.31 +    <view-handler>
   27.32 +        com.sun.faces.portlet.ViewHandlerImpl
   27.33 +    </view-handler>
   27.34 +  </application>   
   27.35 +
   27.36 +</faces-config>
   27.37 \ No newline at end of file
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/portlet-web.xml.template	Sun Jan 28 18:54:08 2007 +0000
    28.3 @@ -0,0 +1,114 @@
    28.4 +<?xml version="1.0" encoding="UTF-8"?>
    28.5 +<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    28.6 +                         "http://java.sun.com/dtd/web-app_2_3.dtd">
    28.7 +<web-app>
    28.8 +    <context-param>
    28.9 +        <param-name>com.sun.faces.portlet.INIT_VIEW</param-name>
   28.10 +        <param-value>/Page1.jsp</param-value>
   28.11 +    </context-param>
   28.12 +    <context-param>
   28.13 +        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
   28.14 +        <param-value>client</param-value>
   28.15 +    </context-param>
   28.16 +    <context-param>
   28.17 +        <param-name>javax.faces.CONFIG_FILES</param-name>
   28.18 +        <param-value>/WEB-INF/navigation.xml,/WEB-INF/managed-beans.xml,/WEB-INF/faces-config.xml</param-value>
   28.19 +    </context-param>
   28.20 +    <context-param>
   28.21 +      <param-name>com.sun.faces.verifyObjects</param-name>
   28.22 +      <!-- TODO   Turn on again once webui doesn't have abstract objects in their config -->
   28.23 +      <param-value>false</param-value>
   28.24 +    </context-param>
   28.25 +    <context-param>
   28.26 +        <param-name>com.sun.faces.validateXml</param-name>
   28.27 +        <param-value>true</param-value>
   28.28 +    </context-param>
   28.29 +    <servlet>
   28.30 +        <servlet-name>Faces Servlet</servlet-name>
   28.31 +        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
   28.32 +        <load-on-startup> 1 </load-on-startup>
   28.33 +    </servlet>
   28.34 +    <!-- Portlet servlet declaration -->
   28.35 +    <servlet>
   28.36 +        <servlet-name>CreatorPortlet</servlet-name>
   28.37 +        <display-name>CreatorPortlet Wrapper</display-name>
   28.38 +        <description>Automated generated Portlet Wrapper</description>
   28.39 +        <servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
   28.40 +        <init-param>
   28.41 +            <param-name>portlet-class</param-name>
   28.42 +            <param-value>com.sun.faces.portlet.FacesPortlet</param-value>
   28.43 +        </init-param>
   28.44 +        <init-param>
   28.45 +            <param-name>portlet-guid</param-name>
   28.46 +            <param-value>CreatorPortlet.CreatorPortlet</param-value>
   28.47 +        </init-param>
   28.48 +    </servlet>
   28.49 +
   28.50 +    <!-- Error Handler Servlet -->
   28.51 +    <servlet>
   28.52 +	<servlet-name>ExceptionHandlerServlet</servlet-name>
   28.53 +	<servlet-class>com.sun.errorhandler.ExceptionHandler</servlet-class>
   28.54 +        <init-param>
   28.55 +	   <param-name>errorHost</param-name>
   28.56 +           <param-value>localhost</param-value>
   28.57 +        </init-param>
   28.58 +        <init-param>
   28.59 +           <param-name>errorPort</param-name>
   28.60 +           <param-value>4444</param-value>
   28.61 +        </init-param>
   28.62 +    </servlet>
   28.63 +
   28.64 +    <!-- Sun Web UI Components Themes -->
   28.65 +    <servlet>
   28.66 +        <servlet-name>ThemeServlet</servlet-name>
   28.67 +        <servlet-class>com.sun.rave.web.ui.theme.ThemeServlet</servlet-class>
   28.68 +    </servlet>
   28.69 +
   28.70 +    <servlet-mapping>
   28.71 +        <servlet-name>CreatorPortlet</servlet-name>
   28.72 +        <url-pattern>/CreatorPortlet/*</url-pattern>
   28.73 +    </servlet-mapping>
   28.74 +    <!-- Error Handler Servlet Mapping -->
   28.75 +    <servlet-mapping>
   28.76 +        <servlet-name>ExceptionHandlerServlet</servlet-name>
   28.77 +        <url-pattern>/error/ExceptionHandler</url-pattern>
   28.78 +    </servlet-mapping>
   28.79 +
   28.80 +    <!-- Sun Web UI Components Servlet Mapping -->
   28.81 +    <servlet-mapping>
   28.82 +        <servlet-name>ThemeServlet</servlet-name>
   28.83 +        <url-pattern>/suntheme/*</url-pattern>
   28.84 +    </servlet-mapping>
   28.85 +
   28.86 +    <!-- Welcome File List -->
   28.87 +    <welcome-file-list>
   28.88 +        <welcome-file>faces/Page1.jsp</welcome-file>
   28.89 +    </welcome-file-list>
   28.90 +
   28.91 +    <!-- Catch  ServletException -->
   28.92 +    <error-page>
   28.93 +        <exception-type>javax.servlet.ServletException</exception-type>
   28.94 +        <location>/error/ExceptionHandler</location>
   28.95 +    </error-page>
   28.96 +
   28.97 +    <!-- Catch  IOException -->
   28.98 +    <!-- //TODO This breaks Pluto
   28.99 +    <error-page>
  28.100 +        <exception-type>java.io.IOException</exception-type>
  28.101 +        <location>/error/ExceptionHandler</location>
  28.102 +    </error-page>
  28.103 +    -->
  28.104 +
  28.105 +    <!-- Catch  FacesException -->
  28.106 +    <!-- //TODO This breaks Pluto
  28.107 +    <error-page>
  28.108 +        <exception-type>javax.faces.FacesException</exception-type>
  28.109 +        <location>/error/ExceptionHandler</location>
  28.110 +    </error-page>
  28.111 +    -->
  28.112 +
  28.113 +    <taglib>
  28.114 +        <taglib-uri>http://java.sun.com/portlet</taglib-uri>
  28.115 +        <taglib-location>/WEB-INF/tld/portlet.tld</taglib-location>
  28.116 +    </taglib>
  28.117 +</web-app>
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/portlet.tld.template	Sun Jan 28 18:54:08 2007 +0000
    29.3 @@ -0,0 +1,104 @@
    29.4 +<?xml version="1.0" encoding="ISO-8859-1" ?>
    29.5 +<!DOCTYPE taglib PUBLIC
    29.6 +  "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
    29.7 +  "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
    29.8 +<!-- 
    29.9 +Copyright 2004 The Apache Software Foundation
   29.10 +Licensed  under the  Apache License,  Version 2.0  (the "License");
   29.11 +you may not use  this file  except in  compliance with the License.
   29.12 +You may obtain a copy of the License at 
   29.13 +
   29.14 +http://www.apache.org/licenses/LICENSE-2.0
   29.15 +
   29.16 +Unless required by applicable law or agreed to in writing, software
   29.17 +distributed  under the  License is distributed on an "AS IS" BASIS,
   29.18 +WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
   29.19 +implied.
   29.20 +
   29.21 +See the License for the specific language governing permissions and
   29.22 +limitations under the License.
   29.23 +-->
   29.24 +<taglib>
   29.25 +    <tlibversion>1.0</tlibversion>
   29.26 +    <jspversion>1.1</jspversion>
   29.27 +    <shortname>portlet</shortname>
   29.28 +    <uri>http://java.sun.com/portlet</uri>
   29.29 +    <tag>
   29.30 +        <name>defineObjects</name>
   29.31 +        <tagclass>org.apache.pluto.tags.DefineObjectsTag</tagclass>
   29.32 +        <teiclass>org.apache.pluto.tags.DefineObjectsTag$TEI</teiclass>
   29.33 +        <bodycontent>empty</bodycontent>
   29.34 +    </tag>
   29.35 +    <tag>
   29.36 +        <name>param</name>
   29.37 +        <tagclass>org.apache.pluto.tags.ParamTag</tagclass>
   29.38 +        <bodycontent>empty</bodycontent>
   29.39 +        <attribute>
   29.40 +            <name>name</name>
   29.41 +            <required>true</required>
   29.42 +            <rtexprvalue>true</rtexprvalue>
   29.43 +        </attribute>
   29.44 +        <attribute>
   29.45 +            <name>value</name>
   29.46 +            <required>true</required>
   29.47 +            <rtexprvalue>true</rtexprvalue>
   29.48 +        </attribute>
   29.49 +    </tag>
   29.50 +    <tag>
   29.51 +        <name>actionURL</name>
   29.52 +        <tagclass>org.apache.pluto.tags.ActionURLTag</tagclass>
   29.53 +        <teiclass>org.apache.pluto.tags.BasicURLTag$TEI</teiclass>
   29.54 +        <bodycontent>JSP</bodycontent>
   29.55 +        <attribute>
   29.56 +            <name>windowState</name>
   29.57 +            <required>false</required>
   29.58 +            <rtexprvalue>true</rtexprvalue>
   29.59 +        </attribute>
   29.60 +        <attribute>
   29.61 +            <name>portletMode</name>
   29.62 +            <required>false</required>
   29.63 +            <rtexprvalue>true</rtexprvalue>
   29.64 +        </attribute>
   29.65 +        <attribute>
   29.66 +            <name>secure</name>
   29.67 +            <required>false</required>
   29.68 +            <rtexprvalue>true</rtexprvalue>
   29.69 +        </attribute>
   29.70 +        <attribute>
   29.71 +            <name>var</name>
   29.72 +            <required>false</required>
   29.73 +            <rtexprvalue>true</rtexprvalue>
   29.74 +        </attribute>
   29.75 +    </tag>
   29.76 +    <tag>
   29.77 +        <name>renderURL</name>
   29.78 +        <tagclass>org.apache.pluto.tags.RenderURLTag</tagclass>
   29.79 +        <teiclass>org.apache.pluto.tags.BasicURLTag$TEI</teiclass>
   29.80 +        <bodycontent>JSP</bodycontent>
   29.81 +        <attribute>
   29.82 +            <name>windowState</name>
   29.83 +            <required>false</required>
   29.84 +            <rtexprvalue>true</rtexprvalue>
   29.85 +        </attribute>
   29.86 +        <attribute>
   29.87 +            <name>portletMode</name>
   29.88 +            <required>false</required>
   29.89 +            <rtexprvalue>true</rtexprvalue>
   29.90 +        </attribute>
   29.91 +        <attribute>
   29.92 +            <name>secure</name>
   29.93 +            <required>false</required>
   29.94 +            <rtexprvalue>true</rtexprvalue>
   29.95 +        </attribute>
   29.96 +        <attribute>
   29.97 +            <name>var</name>
   29.98 +            <required>false</required>
   29.99 +            <rtexprvalue>true</rtexprvalue>
  29.100 +        </attribute>
  29.101 +    </tag>
  29.102 +    <tag>
  29.103 +        <name>namespace</name>
  29.104 +        <tagclass>org.apache.pluto.tags.NamespaceTag</tagclass>
  29.105 +        <bodycontent>empty</bodycontent>
  29.106 +    </tag>
  29.107 +</taglib>
  29.108 \ No newline at end of file
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/portlet.xml.template	Sun Jan 28 18:54:08 2007 +0000
    30.3 @@ -0,0 +1,28 @@
    30.4 +<?xml version="1.0" encoding="UTF-8"?>
    30.5 +<!--The portlet-app element is the root of the deployment descriptor
    30.6 +for a portlet application. -->
    30.7 +<portlet-app
    30.8 +    xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
    30.9 +    version="1.0"
   30.10 +    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   30.11 +    xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
   30.12 +                        http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
   30.13 +
   30.14 +        <portlet>
   30.15 +            <description>Creator Portlet</description>
   30.16 +            <portlet-name>CreatorPortlet</portlet-name>
   30.17 +            <display-name>Creator Portlet</display-name>	
   30.18 +            <portlet-class>com.sun.faces.portlet.FacesPortlet</portlet-class>
   30.19 +            <supports>
   30.20 +		<mime-type>text/html</mime-type>
   30.21 +		<portlet-mode>VIEW</portlet-mode>
   30.22 +            </supports>
   30.23 +            <supported-locale>en</supported-locale>
   30.24 +
   30.25 +            <portlet-info>
   30.26 +		<title>Creator Portlet</title>
   30.27 +		<short-title>Creator Portlet</short-title>
   30.28 +		<keywords>Creator</keywords>
   30.29 +            </portlet-info>
   30.30 +        </portlet>
   30.31 + </portlet-app>
   30.32 \ No newline at end of file
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/resources/Bundle.properties	Sun Jan 28 18:54:08 2007 +0000
    31.3 @@ -0,0 +1,18 @@
    31.4 +#
    31.5 +#                 Sun Public License Notice
    31.6 +# 
    31.7 +# The contents of this file are subject to the Sun Public License
    31.8 +# Version 1.0 (the "License"). You may not use this file except in
    31.9 +# compliance with the License. A copy of the License is available at
   31.10 +# http://www.sun.com/
   31.11 +# 
   31.12 +# The Original Code is NetBeans. The Initial Developer of the Original
   31.13 +# Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
   31.14 +# Microsystems, Inc. All Rights Reserved.
   31.15 +#
   31.16 +Templates/JsfPortlet/portletWeb.xml=Portlet Web Application Configuration
   31.17 +Templates/JsfPortlet/portlet.xml=Portlet Deployment Descriptor
   31.18 +Templates/JsfPortlet/faces.config.xml=Java Server Faces Configuration for JSF-Portlet Bridge
   31.19 +Templates/JsfPortlet/portlet.tld=JSR-168 Portlet Tag Library
   31.20 +Templates/JsfPortlet/PortletPage.jsp=Portlet Page 
   31.21 +Templates/JsfPortlet/PortletPageFragment.jspf=Portlet Page Fragment
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties	Sun Jan 28 18:54:08 2007 +0000
    32.3 @@ -0,0 +1,91 @@
    32.4 +#
    32.5 +#                 Sun Public License Notice
    32.6 +# 
    32.7 +# The contents of this file are subject to the Sun Public License
    32.8 +# Version 1.0 (the "License"). You may not use this file except in
    32.9 +# compliance with the License. A copy of the License is available at
   32.10 +# http://www.sun.com/
   32.11 +# 
   32.12 +# The Original Code is NetBeans. The Initial Developer of the Original
   32.13 +# Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
   32.14 +# Microsystems, Inc. All Rights Reserved.
   32.15 +#
   32.16 +
   32.17 +#PanelProjectLocationVisual
   32.18 +TXT_NewWebApp=Portlet
   32.19 +LBL_NWP1_ProjectTitleName=Name and Location
   32.20 +LBL_NWP1_ProjectName_Label=Project Name
   32.21 +LBL_NPW1_DefaultProjectName=Portlet{0}
   32.22 +LBL_NWP1_ProjectLocation_Label=Project Location
   32.23 +LBL_NWP1_BrowseLocation_Button=Browse...
   32.24 +LBL_NWP1_CreatedProjectFolder_Lablel=Project Folder
   32.25 +
   32.26 +LBL_NWP1_ProjectName_LabelMnemonic=N
   32.27 +LBL_NWP1_ProjectLocation_LabelMnemonic=L
   32.28 +LBL_NWP1_CreatedProjectFolder_LablelMnemonic=D
   32.29 +LBL_NWP1_BrowseLocation_ButtonMnemonic=s
   32.30 +
   32.31 +# A11Y Panels
   32.32 +ACS_NWP1_NamePanel_A11YDesc=Project Name and Location Panel
   32.33 +ACS_IW_SourcesPanel_A11YDesc=Add Existing Sources Panel
   32.34 +
   32.35 +ACS_LBL_NWP1_ProjectName_A11YDesc=Project Name
   32.36 +ACS_LBL_NPW1_ProjectLocation_A11YDesc=Project Location
   32.37 +ACS_LBL_NWP1_BrowseLocation_A11YDesc=Browse Project Location
   32.38 +ACS_LBL_NWP1_CreatedProjectFolder_A11YDesc=Project Folder
   32.39 +
   32.40 +LBL_NWP1_SelectProjectLocation=Select Project Location
   32.41 +MSG_IllegalProjectName=Project Name is not a valid folder name.
   32.42 +MSG_InvalidProjectName=Project Name can only contain characters in [a-zA-Z_0-9.-].
   32.43 +MSG_ProjectFolderExists=Project Folder already exists and is not empty.
   32.44 +MSG_ProjectLocationRO=Project Location is read only.
   32.45 +MSG_IllegalProjectLocation=Project Location is not valid path.
   32.46 +MSG_IllegalDisk=At least disk roots must be mounted!
   32.47 +MSG_CreateDir=Directory does not exist. Do you want to create it?
   32.48 +MSG_FileNotFound=The web application's deployment descriptor (WEB-INF/web.xml) does not exist. You must create it, otherwise you cannot run the web application.
   32.49 +MSG_ProjectFolderReadOnly=Project Folder is read-only.
   32.50 +
   32.51 +#Portlet wizard
   32.52 +LBL_Portlet_Step1=Project Name and Location
   32.53 +LBL_Portlet_Step2=Portlet Deployment Descriptor
   32.54 +LBL_WizardStepsCount={0} of {1}
   32.55 +LAB_ConfigureSourceRoots=Existing Sources and Libraries
   32.56 +
   32.57 +#PortletProjectDeployDescriptorVisual
   32.58 +ACS_LBL_PPOV_PORTLETNAME_A11YDesc=Portlet Name
   32.59 +ACS_LBL_PPOV_PORTLETNAME_A11YName=Portlet Name
   32.60 +LBL_PPOV_PORTLETNAME=Portlet Name\:
   32.61 +LBL_PPOV_PORTLETDESC=Portlet Description\:
   32.62 +ACS_LBL_PPOV_PORTLETDESC_A11YName=
   32.63 +ACS_LBL_PPOV_PORTLETDESC_A11YDesc=Portlet Description
   32.64 +ACS_TXT_PPOV_PORTLETNAME_A11YName=Portlet Name
   32.65 +ACS_TXT_PPOV_PORTLETNAME_A11YDesc=Portlet Name Textfield
   32.66 +LBL_PPOV_PORTLETDISPLAYNAME=Portlet Display Name\:
   32.67 +ACS_TXT_PPOV_PORTLETDISPLAYNAME_A11YName=Portlet Display Name
   32.68 +ACS_TXT_PPOV_PORTLETDISPLAYNAME_A11YDesc=Portlet Display Name Textfield
   32.69 +LBL_PPOV_PORTLETTITLE=Portlet Title\:
   32.70 +ACS_TXT_PPOV_PORTLETTITLE_A11YName=Portlet Title
   32.71 +ACS_TXT_PPOV_PORTLETTITLE_A11YDesc=Portlet Title Textfield
   32.72 +ACS_LBL_PPOV_PORTLETTITLE_A11YName=Portlet Title
   32.73 +ACS_LBL_PPOV_PORTLETTITLE_A11YDesc=Portlet Title Label
   32.74 +LBL_PPOV_PORTLETSHORTTITLE=Portlet Short Title\:
   32.75 +ACS_LBL_PPOV_PORTLETSHORTTITLE_A11YName=Portlet Short Title
   32.76 +ACS_LBL_PPOV_PORTLETSHORTTITLE_A11YDesc=Portlet Short Title Label
   32.77 +ACS_TXT_PPOV_PORTLETSHORTTITLE_A11YName=Portlet Short Title
   32.78 +ACS_TXT_PPOV_PORTLETSHORTTITLE_A11YDesc=Portlet Short Title Textfield
   32.79 +TXT_PORTLET_DIPSLAYNAME_SUFFIX_DEFAULT=Portlet
   32.80 +TXT_PORTLET_DESC_DEFAULT=Created By Visual Web Pack
   32.81 +
   32.82 +ACS_TXT_PPOV_PORTLETDESC_A11YDesc=Portlet Description Textfield
   32.83 +
   32.84 +ACS_TXT_PPOV_PORTLETDESC_A11YName=Portlet Description
   32.85 +
   32.86 +LBL_PPOV_PORTLETNAMEMnemonic=N
   32.87 +
   32.88 +LBL_PPOV_PORTLETDISPLAYNAMEMnemonic=D
   32.89 +
   32.90 +LBL_PPOV_PORTLETDESCMnemonic=c
   32.91 +
   32.92 +LBL_PPOV_PORTLETTITLEMnemonic=i
   32.93 +
   32.94 +LBL_PPOV_PORTLETSHORTTITLEMnemonic=S
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/FileChooser.java	Sun Jan 28 18:54:08 2007 +0000
    33.3 @@ -0,0 +1,151 @@
    33.4 +/*
    33.5 + * {START_JAVA_COPYRIGHT_NOTICE
    33.6 + * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
    33.7 + * Use is subject to license terms.
    33.8 + * END_COPYRIGHT_NOTICE}
    33.9 + */
   33.10 +
   33.11 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
   33.12 +
   33.13 +import org.openide.filesystems.FileUtil;
   33.14 +
   33.15 +import javax.swing.*;
   33.16 +import javax.swing.filechooser.FileSystemView;
   33.17 +import javax.swing.filechooser.FileFilter;
   33.18 +import java.io.File;
   33.19 +import java.io.IOException;
   33.20 +import java.awt.*;
   33.21 +import java.util.Map;
   33.22 +import java.util.HashMap;
   33.23 +
   33.24 +public class FileChooser extends JFileChooser {
   33.25 +
   33.26 +    private String key;
   33.27 +    protected String initialPath;
   33.28 +
   33.29 +    public FileChooser(String key, String currentDirectoryPath) {
   33.30 +        super(getInitialDirectory(key, currentDirectoryPath));
   33.31 +        this.key = key;
   33.32 +    }
   33.33 +
   33.34 +    public FileChooser(String key) {
   33.35 +        this(key, null);
   33.36 +        this.key = key;
   33.37 +    }
   33.38 +
   33.39 +    private static File getInitialDirectory(String key, String currentDirectoryPath) {
   33.40 +        return getInitialDirectory(key, currentDirectoryPath == null ? null : new File(currentDirectoryPath));
   33.41 +    }
   33.42 +
   33.43 +    private static File getInitialDirectory(String key, File f) {
   33.44 +        while (f != null) {
   33.45 +            if (f.exists() && f.isDirectory()) {
   33.46 +                return f;
   33.47 +            }
   33.48 +            f = f.getParentFile();
   33.49 +        }
   33.50 +        File lastChooserLocation = getLastChooserLocation(key);
   33.51 +        if (lastChooserLocation != null && lastChooserLocation.exists()) {
   33.52 +            return lastChooserLocation;
   33.53 +        } else {
   33.54 +            String pathname = System.getProperty("user.home"); //NOI18N
   33.55 +            if(pathname != null) {
   33.56 +                File file = new File(pathname).getAbsoluteFile();
   33.57 +                if(file.exists()) {
   33.58 +                    return file;
   33.59 +                }
   33.60 +            }
   33.61 +            File file = new File("").getAbsoluteFile(); //NOI18N
   33.62 +            assert file.exists() : "Default directory '" + file.getAbsolutePath() + "' does not exist"; //NOI18N
   33.63 +            return f;
   33.64 +        }
   33.65 +    }
   33.66 +
   33.67 +    public int showDialog(Component parent, String approveButtonText) throws HeadlessException {
   33.68 +        FileUtil.preventFileChooserSymlinkTraversal(this, getInitialDirectory(key, getCurrentDirectory()));
   33.69 +        return super.showDialog(parent, approveButtonText);
   33.70 +    }
   33.71 +
   33.72 +    protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
   33.73 +        if (SELECTED_FILE_CHANGED_PROPERTY.equals(propertyName)) {
   33.74 +            newValue = correctFile((File) newValue);
   33.75 +        }
   33.76 +        super.firePropertyChange(propertyName, oldValue, newValue);
   33.77 +    }
   33.78 +
   33.79 +    public void approveSelection() {
   33.80 +        saveCurrentLocation();
   33.81 +        super.approveSelection();
   33.82 +    }
   33.83 +
   33.84 +    public void cancelSelection() {
   33.85 +        super.cancelSelection();
   33.86 +    }
   33.87 +
   33.88 +    private static File correctFile(File f) {
   33.89 +        while(f != null && ".".equals(f.getName())) { //NOI18N
   33.90 +            f = f.getParentFile();
   33.91 +        }
   33.92 +        return f;
   33.93 +    }
   33.94 +
   33.95 +    private void saveCurrentLocation() {
   33.96 +        if (!isMultiSelectionEnabled() && isDirectorySelectionEnabled()) {
   33.97 +            // Try to save selected file (if it is an existing single directory
   33.98 +            if (saveLocation(getSelectedFile())) {
   33.99 +                return;
  33.100 +            }
  33.101 +        }
  33.102 +        saveLocation(getCurrentDirectory());
  33.103 +    }
  33.104 +
  33.105 +    private boolean saveLocation(File f) {
  33.106 +        if (f != null && f.isDirectory()) {
  33.107 +            setLastChooserLocation(key, f);
  33.108 +            return true;
  33.109 +        } else {
  33.110 +            return false;
  33.111 +        }
  33.112 +    }
  33.113 +
  33.114 +    public static File getLastChooserLocation(String key) {
  33.115 +        Map map = FoldersListSettings.getDefault().getLastUsedChooserLocations();
  33.116 +        if (map != null) {
  33.117 +            return (File) map.get(key);
  33.118 +        } else {
  33.119 +            return null;
  33.120 +        }
  33.121 +    }
  33.122 +
  33.123 +    public static void setLastChooserLocation(String key, File folder) {
  33.124 +        FoldersListSettings foldersListSettings = FoldersListSettings.getDefault();
  33.125 +        Map map = foldersListSettings.getLastUsedChooserLocations();
  33.126 +        // we should get a different instance of the map to be sure
  33.127 +        // that modification of settings will be detected
  33.128 +        map = map == null ? new HashMap() : new HashMap(map);
  33.129 +        map.put(key, folder);
  33.130 +        foldersListSettings.setLastUsedChooserLocations(map);
  33.131 +    }
  33.132 +
  33.133 +    public static FileChooser createDirectoryChooser(String key) {
  33.134 +        return createDirectoryChooser(key, null);
  33.135 +    }
  33.136 +
  33.137 +    public static FileChooser createDirectoryChooser(String key, String initialPath) {
  33.138 +        FileChooser chooser = new FileChooser(key, initialPath);
  33.139 +        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
  33.140 +        chooser.setMultiSelectionEnabled(false);
  33.141 +        chooser.setAcceptAllFileFilterUsed(false);
  33.142 +        return chooser;
  33.143 +    }
  33.144 +
  33.145 +    public static FileChooser createFileChooser(String key, String dialogTitle, FileFilter fileFilter) {
  33.146 +        FileChooser chooser = new FileChooser(key);
  33.147 +        chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
  33.148 +        chooser.setMultiSelectionEnabled(true);
  33.149 +        chooser.setDialogTitle(dialogTitle);
  33.150 +        chooser.setFileFilter(fileFilter);
  33.151 +        chooser.setAcceptAllFileFilterUsed(false);
  33.152 +        return chooser;
  33.153 +    }
  33.154 +}
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/FoldersListSettings.java	Sun Jan 28 18:54:08 2007 +0000
    34.3 @@ -0,0 +1,143 @@
    34.4 +/*
    34.5 + * {START_JAVA_COPYRIGHT_NOTICE
    34.6 + * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
    34.7 + * Use is subject to license terms.
    34.8 + * END_COPYRIGHT_NOTICE}
    34.9 + */
   34.10 +
   34.11 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
   34.12 +
   34.13 +import java.io.File;
   34.14 +import java.util.Map;
   34.15 +import javax.swing.SwingUtilities;
   34.16 +import org.openide.ErrorManager;
   34.17 +
   34.18 +import org.openide.options.SystemOption;
   34.19 +import org.openide.util.NbBundle;
   34.20 +
   34.21 +/**
   34.22 + * Misnamed storage of information application to the new webproject wizard.
   34.23 + */
   34.24 +public class FoldersListSettings extends SystemOption {
   34.25 +
   34.26 +    static final long serialVersionUID = -4905094097265543014L;
   34.27 +    
   34.28 +    private static final String NEW_PROJECT_COUNT = "newProjectCount"; //NOI18N
   34.29 +    
   34.30 +    private static final String NEW_APP_COUNT = "newApplicationCount";  //NOI18N
   34.31 +    
   34.32 +    private static final String LAST_USED_CP_FOLDER = "lastUsedClassPathFolder";    //NOI18N
   34.33 +
   34.34 +    private static final String LAST_USED_ARTIFACT_FOLDER = "lastUsedArtifactFolder"; //NOI18N
   34.35 +
   34.36 +    private static final String SHOW_AGAIN_BROKEN_REF_ALERT = "showAgainBrokenRefAlert"; //NOI18N
   34.37 +    
   34.38 +    private static final String SHOW_AGAIN_BROKEN_SERVER_ALERT = "showAgainBrokenServerAlert"; //NOI18N
   34.39 +    
   34.40 +    private static final String LAST_USED_CHOOSER_LOCATIONS = "lastUsedChooserLocations"; //NOI18N
   34.41 +    
   34.42 +    private static final String AGREED_SET_JDK_14 = "agreeSetJdk14"; // NOI18N
   34.43 +    
   34.44 +    private static final String AGREED_SET_SOURCE_LEVEL_14 = "agreeSetSourceLevel14"; // NOI18N
   34.45 +    
   34.46 +    public static String defaultProjectDir = null;
   34.47 + 
   34.48 +
   34.49 +    public static FoldersListSettings getDefault () {
   34.50 +        return (FoldersListSettings) SystemOption.findObject (FoldersListSettings.class, true);
   34.51 +    }
   34.52 +    
   34.53 +    public String displayName() {
   34.54 +        return NbBundle.getMessage(FoldersListSettings.class, "TXT_WebProjectFolderList");
   34.55 +    }
   34.56 +    
   34.57 +    public int getNewProjectCount () {
   34.58 +        Integer value = (Integer) getProperty (NEW_PROJECT_COUNT);
   34.59 +        return value == null ? 0 : value.intValue();
   34.60 +    }
   34.61 +
   34.62 +    public void setNewProjectCount (int count) {
   34.63 +        this.putProperty(NEW_PROJECT_COUNT, new Integer(count),true);
   34.64 +    }
   34.65 +    
   34.66 +    public int getNewApplicationCount () {
   34.67 +        Integer value = (Integer) getProperty (NEW_APP_COUNT);
   34.68 +        return value == null ? 0 : value.intValue();
   34.69 +    }
   34.70 +    
   34.71 +    public void setNewApplicationCount (int count) {
   34.72 +        this.putProperty(NEW_APP_COUNT, new Integer(count),true);
   34.73 +    }
   34.74 +    
   34.75 +    public File getLastUsedClassPathFolder () {
   34.76 +        String lucpr = (String) this.getProperty (LAST_USED_CP_FOLDER);
   34.77 +        if (lucpr == null) {
   34.78 +            lucpr = System.getProperty("user.home");    //NOI18N
   34.79 +        }
   34.80 +        return new File (lucpr);
   34.81 +    }
   34.82 +
   34.83 +    public void setLastUsedClassPathFolder (File folder) {
   34.84 +        assert folder != null : "ClassPath root can not be null";
   34.85 +        String path = folder.getAbsolutePath();
   34.86 +        this.putProperty(LAST_USED_CP_FOLDER, path, true);
   34.87 +    }
   34.88 +
   34.89 +    public File getLastUsedArtifactFolder () {
   34.90 +        String folder = (String) this.getProperty (LAST_USED_ARTIFACT_FOLDER);
   34.91 +        if (folder == null) {
   34.92 +            folder = System.getProperty("user.home");    //NOI18N
   34.93 +        }
   34.94 +        return new File (folder);
   34.95 +    }
   34.96 +
   34.97 +    public void setLastUsedArtifactFolder (File folder) {
   34.98 +        assert folder != null : "Folder can not be null";
   34.99 +        String path = folder.getAbsolutePath();
  34.100 +        this.putProperty (LAST_USED_ARTIFACT_FOLDER, path, true);
  34.101 +    }
  34.102 +
  34.103 +    public boolean isShowAgainBrokenRefAlert() {
  34.104 +        Boolean b = (Boolean)getProperty(SHOW_AGAIN_BROKEN_REF_ALERT);
  34.105 +        return b == null ? true : b.booleanValue();
  34.106 +    }
  34.107 +    
  34.108 +    public void setShowAgainBrokenRefAlert(boolean again) {
  34.109 +        this.putProperty(SHOW_AGAIN_BROKEN_REF_ALERT, Boolean.valueOf(again), true);
  34.110 +    }
  34.111 +    
  34.112 +    public boolean isShowAgainBrokenServerAlert() {
  34.113 +        Boolean b = (Boolean)getProperty(SHOW_AGAIN_BROKEN_SERVER_ALERT);
  34.114 +        return b == null ? true : b.booleanValue();
  34.115 +    }
  34.116 +    
  34.117 +    public void setShowAgainBrokenServerAlert(boolean again) {
  34.118 +        this.putProperty(SHOW_AGAIN_BROKEN_SERVER_ALERT, Boolean.valueOf(again), true);
  34.119 +    }
  34.120 +    
  34.121 +    public Map getLastUsedChooserLocations() {
  34.122 +        return (Map) this.getProperty(LAST_USED_CHOOSER_LOCATIONS);
  34.123 +    }
  34.124 +
  34.125 +    public void setLastUsedChooserLocations(Map map) {
  34.126 +        this.putProperty(LAST_USED_CHOOSER_LOCATIONS, map, true);
  34.127 +    }
  34.128 +    
  34.129 +    public boolean isAgreedSetJdk14() {
  34.130 +        Boolean b = (Boolean)getProperty(AGREED_SET_JDK_14);
  34.131 +        return b == null ? true : b.booleanValue();
  34.132 +    }
  34.133 +    
  34.134 +    public void setAgreedSetJdk14(boolean agreed) {
  34.135 +        this.putProperty(AGREED_SET_JDK_14, Boolean.valueOf(agreed), true);
  34.136 +    }
  34.137 +    
  34.138 +    public boolean isAgreedSetSourceLevel14() {
  34.139 +        Boolean b = (Boolean)getProperty(AGREED_SET_SOURCE_LEVEL_14);
  34.140 +        return b == null ? true : b.booleanValue();
  34.141 +    }
  34.142 +    
  34.143 +    public void setAgreedSetSourceLevel14(boolean agreed) {
  34.144 +        this.putProperty(AGREED_SET_SOURCE_LEVEL_14, Boolean.valueOf(agreed), true);
  34.145 +    }
  34.146 +}
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PanelConfigureProject.java	Sun Jan 28 18:54:08 2007 +0000
    35.3 @@ -0,0 +1,102 @@
    35.4 +/*
    35.5 + * {START_JAVA_COPYRIGHT_NOTICE
    35.6 + * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
    35.7 + * Use is subject to license terms.
    35.8 + * END_COPYRIGHT_NOTICE}
    35.9 + */
   35.10 +
   35.11 +
   35.12 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
   35.13 +
   35.14 +import java.awt.Component;
   35.15 +import java.util.HashSet;
   35.16 +import java.util.Iterator;
   35.17 +import java.util.Set;
   35.18 +
   35.19 +import javax.swing.JComponent;
   35.20 +import javax.swing.event.ChangeEvent;
   35.21 +import javax.swing.event.ChangeListener;
   35.22 +
   35.23 +import org.openide.WizardDescriptor;
   35.24 +import org.openide.WizardValidationException;
   35.25 +import org.openide.util.HelpCtx;
   35.26 +
   35.27 +/**
   35.28 + * Panel just asking for basic info.
   35.29 + * @author Jesse Glick
   35.30 + */
   35.31 +final class PanelConfigureProject implements WizardDescriptor.Panel, WizardDescriptor.FinishablePanel, 
   35.32 +        WizardDescriptor.ValidatingPanel {
   35.33 +    
   35.34 +    protected WizardDescriptor wizardDescriptor;
   35.35 +    private PanelConfigureProjectVisual component;
   35.36 +    
   35.37 +    /** Create the wizard panel descriptor. */
   35.38 +    public PanelConfigureProject(WizardDescriptor inWizardDescriptor) {
   35.39 +        wizardDescriptor = inWizardDescriptor;
   35.40 +    }
   35.41 +    
   35.42 +    public boolean isFinishPanel() {
   35.43 +        return false;
   35.44 +    }
   35.45 +
   35.46 +    public Component getComponent() {
   35.47 +        if (component == null) {
   35.48 +            component = new PanelConfigureProjectVisual(this);
   35.49 +        }
   35.50 +        return component;
   35.51 +    }
   35.52 +    
   35.53 +    public HelpCtx getHelp() {
   35.54 +        return new HelpCtx(PanelConfigureProject.class);
   35.55 +    }
   35.56 +    
   35.57 +    public boolean isValid() {
   35.58 +        getComponent();
   35.59 +        return component.valid(wizardDescriptor);
   35.60 +    }
   35.61 +    
   35.62 +    private final Set/*<ChangeListener>*/ listeners = new HashSet(1);
   35.63 +    public final void addChangeListener(ChangeListener l) {
   35.64 +        synchronized (listeners) {
   35.65 +            listeners.add(l);
   35.66 +        }
   35.67 +    }
   35.68 +    public final void removeChangeListener(ChangeListener l) {
   35.69 +        synchronized (listeners) {
   35.70 +            listeners.remove(l);
   35.71 +        }
   35.72 +    }
   35.73 +    protected final void fireChangeEvent() {
   35.74 +        Iterator it;
   35.75 +        synchronized (listeners) {
   35.76 +            it = new HashSet(listeners).iterator();
   35.77 +        }
   35.78 +        ChangeEvent ev = new ChangeEvent(this);
   35.79 +        while (it.hasNext()) {
   35.80 +            ((ChangeListener)it.next()).stateChanged(ev);
   35.81 +        }
   35.82 +    }
   35.83 +    
   35.84 +    public void readSettings(Object settings) {
   35.85 +        wizardDescriptor = (WizardDescriptor) settings;
   35.86 +        component.read (wizardDescriptor);
   35.87 +        
   35.88 +        // XXX hack, TemplateWizard in final setTemplateImpl() forces new wizard's title
   35.89 +        // this name is used in NewProjectWizard to modify the title
   35.90 +        Object substitute = ((JComponent) component).getClientProperty("NewProjectWizard_Title"); // NOI18N
   35.91 +        if (substitute != null)
   35.92 +            wizardDescriptor.putProperty("NewProjectWizard_Title", substitute); // NOI18N
   35.93 +    }
   35.94 +    
   35.95 +    public void storeSettings(Object settings) {
   35.96 +        WizardDescriptor d = (WizardDescriptor) settings;
   35.97 +        component.store(d);
   35.98 +        ((WizardDescriptor) d).putProperty("NewProjectWizard_Title", null); // NOI18N
   35.99 +    }
  35.100 +
  35.101 +    public void validate() throws WizardValidationException {
  35.102 +        getComponent();
  35.103 +        component.valid(wizardDescriptor);
  35.104 +    }
  35.105 +}
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PanelConfigureProjectVisual.form	Sun Jan 28 18:54:08 2007 +0000
    36.3 @@ -0,0 +1,45 @@
    36.4 +<?xml version="1.0" encoding="UTF-8" ?>
    36.5 +
    36.6 +<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    36.7 +  <Properties>
    36.8 +    <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
    36.9 +      <Dimension value="[500, 340]"/>
   36.10 +    </Property>
   36.11 +    <Property name="requestFocusEnabled" type="boolean" value="false"/>
   36.12 +  </Properties>
   36.13 +  <AuxValues>
   36.14 +    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
   36.15 +    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   36.16 +    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   36.17 +    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   36.18 +  </AuxValues>
   36.19 +
   36.20 +  <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
   36.21 +  <SubComponents>
   36.22 +    <Container class="javax.swing.JPanel" name="locationContainer">
   36.23 +      <Constraints>
   36.24 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
   36.25 +          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="0" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
   36.26 +        </Constraint>
   36.27 +      </Constraints>
   36.28 +
   36.29 +      <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
   36.30 +    </Container>
   36.31 +    <Component class="javax.swing.JSeparator" name="jSeparator1">
   36.32 +      <Constraints>
   36.33 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
   36.34 +          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="12" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
   36.35 +        </Constraint>
   36.36 +      </Constraints>
   36.37 +    </Component>
   36.38 +    <Container class="javax.swing.JPanel" name="optionsContainer">
   36.39 +      <Constraints>
   36.40 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
   36.41 +          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="0" gridHeight="0" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
   36.42 +        </Constraint>
   36.43 +      </Constraints>
   36.44 +
   36.45 +      <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
   36.46 +    </Container>
   36.47 +  </SubComponents>
   36.48 +</Form>
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PanelConfigureProjectVisual.java	Sun Jan 28 18:54:08 2007 +0000
    37.3 @@ -0,0 +1,130 @@
    37.4 +/*
    37.5 + *                 Sun Public License Notice
    37.6 + *
    37.7 + * The contents of this file are subject to the Sun Public License
    37.8 + * Version 1.0 (the "License"). You may not use this file except in
    37.9 + * compliance with the License. A copy of the License is available at
   37.10 + * http://www.sun.com/
   37.11 + *
   37.12 + * The Original Code is NetBeans. The Initial Developer of the Original
   37.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
   37.14 + * Microsystems, Inc. All Rights Reserved.
   37.15 + */
   37.16 +
   37.17 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
   37.18 +
   37.19 +import org.netbeans.modules.visualweb.project.jsf.api.JsfProjectConstants;
   37.20 +
   37.21 +import javax.swing.JPanel;
   37.22 +
   37.23 +import org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment;
   37.24 +import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
   37.25 +
   37.26 +import org.openide.WizardDescriptor;
   37.27 +import org.openide.WizardValidationException;
   37.28 +import org.openide.util.HelpCtx;
   37.29 +import org.openide.util.NbBundle;
   37.30 +
   37.31 +public class PanelConfigureProjectVisual extends JPanel implements HelpCtx.Provider {
   37.32 +    
   37.33 +    private PanelConfigureProject panel;
   37.34 +    
   37.35 +    private PanelProjectLocationVisual projectLocationPanel;
   37.36 +    
   37.37 +    /** Creates new form PanelInitProject */
   37.38 +    public PanelConfigureProjectVisual(PanelConfigureProject panel) {
   37.39 +        this.panel = panel;
   37.40 +        initComponents();
   37.41 +        this.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PanelConfigureProjectVisual.class, "ACS_NWP1_NamePanel_A11YDesc"));  // NOI18N
   37.42 +        
   37.43 +        projectLocationPanel = new PanelProjectLocationVisual(panel);
   37.44 +        locationContainer.add(projectLocationPanel, java.awt.BorderLayout.NORTH);
   37.45 +        
   37.46 +        // Provide a name in the title bar.
   37.47 +        setName(NbBundle.getMessage(PanelConfigureProjectVisual.class, "LBL_NWP1_ProjectTitleName")); //NOI18N
   37.48 +        putClientProperty("NewProjectWizard_Title", NbBundle.getMessage(PanelConfigureProjectVisual.class, "TXT_NewWebApp")); //NOI18N
   37.49 +    }
   37.50 +    
   37.51 +    boolean valid(WizardDescriptor wizardDescriptor) {
   37.52 +        return projectLocationPanel.valid(wizardDescriptor);
   37.53 +    }
   37.54 +    
   37.55 +    void read(WizardDescriptor d) {
   37.56 +        projectLocationPanel.read(d);
   37.57 +    }
   37.58 +    
   37.59 +    void store(WizardDescriptor d) {
   37.60 +        projectLocationPanel.store(d);
   37.61 +
   37.62 +                                // Mostly hard coded for now!
   37.63 +        d.putProperty(WizardProperties.SET_AS_MAIN, Boolean.TRUE);
   37.64 +        d.putProperty(WizardProperties.SERVER_INSTANCE_ID,
   37.65 +                      Deployment.getDefault().getDefaultServerInstanceID());
   37.66 +        d.putProperty(WizardProperties.SOURCE_STRUCTURE,
   37.67 +                      JsfProjectConstants.SRC_STRUCT_JAKARTA);
   37.68 +        d.putProperty(WizardProperties.J2EE_LEVEL,
   37.69 +                      J2eeModule.J2EE_14);
   37.70 +        d.putProperty(WizardProperties.CONTEXT_PATH,
   37.71 +                      "/" + projectLocationPanel.projectNameTextField. // NOI18N
   37.72 +                      getText().trim().replace(' ', '_')); // NOI18N
   37.73 +        d.putProperty(WizardProperties.EAR_APPLICATION, null);
   37.74 +        d.putProperty(WizardProperties.SOURCE_LEVEL, "1.4"); // NOI18N
   37.75 +
   37.76 +    }
   37.77 +    
   37.78 +    /** This method is called from within the constructor to
   37.79 +     * initialize the form.
   37.80 +     * WARNING: Do NOT modify this code. The content of this method is
   37.81 +     * always regenerated by the Form Editor.
   37.82 +     */
   37.83 +    private void initComponents() {//GEN-BEGIN:initComponents
   37.84 +        java.awt.GridBagConstraints gridBagConstraints;
   37.85 +
   37.86 +        locationContainer = new javax.swing.JPanel();
   37.87 +        jSeparator1 = new javax.swing.JSeparator();
   37.88 +        optionsContainer = new javax.swing.JPanel();
   37.89 +
   37.90 +        setLayout(new java.awt.GridBagLayout());
   37.91 +
   37.92 +        setPreferredSize(new java.awt.Dimension(500, 340));
   37.93 +        setRequestFocusEnabled(false);
   37.94 +        locationContainer.setLayout(new java.awt.BorderLayout());
   37.95 +
   37.96 +        gridBagConstraints = new java.awt.GridBagConstraints();
   37.97 +        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
   37.98 +        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
   37.99 +        gridBagConstraints.weightx = 1.0;
  37.100 +        add(locationContainer, gridBagConstraints);
  37.101 +
  37.102 +        gridBagConstraints = new java.awt.GridBagConstraints();
  37.103 +        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
  37.104 +        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  37.105 +        gridBagConstraints.weightx = 1.0;
  37.106 +        gridBagConstraints.insets = new java.awt.Insets(12, 0, 12, 0);
  37.107 +        add(jSeparator1, gridBagConstraints);
  37.108 +
  37.109 +        optionsContainer.setLayout(new java.awt.BorderLayout());
  37.110 +
  37.111 +        gridBagConstraints = new java.awt.GridBagConstraints();
  37.112 +        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
  37.113 +        gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
  37.114 +        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
  37.115 +        gridBagConstraints.weightx = 1.0;
  37.116 +        gridBagConstraints.weighty = 1.0;
  37.117 +        add(optionsContainer, gridBagConstraints);
  37.118 +
  37.119 +    }//GEN-END:initComponents
  37.120 +    
  37.121 +    // Variables declaration - do not modify//GEN-BEGIN:variables
  37.122 +    private javax.swing.JSeparator jSeparator1;
  37.123 +    private javax.swing.JPanel locationContainer;
  37.124 +    private javax.swing.JPanel optionsContainer;
  37.125 +    // End of variables declaration//GEN-END:variables
  37.126 +    
  37.127 +    /** Help context where to find more about the paste type action.
  37.128 +     * @return the help context for this action
  37.129 +     */
  37.130 +    public HelpCtx getHelpCtx() {
  37.131 +        return new HelpCtx(PanelConfigureProjectVisual.class);
  37.132 +    }
  37.133 +}
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PanelProjectLocationVisual.form	Sun Jan 28 18:54:08 2007 +0000
    38.3 @@ -0,0 +1,161 @@
    38.4 +<?xml version="1.0" encoding="UTF-8" ?>
    38.5 +
    38.6 +<Form version="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    38.7 +  <AuxValues>
    38.8 +    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
    38.9 +    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   38.10 +    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   38.11 +    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   38.12 +  </AuxValues>
   38.13 +
   38.14 +  <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
   38.15 +  <SubComponents>
   38.16 +    <Component class="javax.swing.JLabel" name="projectNameLabel">
   38.17 +      <Properties>
   38.18 +        <Property name="displayedMnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
   38.19 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_ProjectName_LabelMnemonic" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
   38.20 +        </Property>
   38.21 +        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
   38.22 +          <ComponentRef name="projectNameTextField"/>
   38.23 +        </Property>
   38.24 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   38.25 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_ProjectName_Label" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   38.26 +        </Property>
   38.27 +      </Properties>
   38.28 +      <AccessibilityProperties>
   38.29 +        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   38.30 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_ProjectName_Label" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
   38.31 +        </Property>
   38.32 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   38.33 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_LBL_NWP1_ProjectName_A11YDesc" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
   38.34 +        </Property>
   38.35 +      </AccessibilityProperties>
   38.36 +      <Constraints>
   38.37 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
   38.38 +          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="12" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
   38.39 +        </Constraint>
   38.40 +      </Constraints>
   38.41 +    </Component>
   38.42 +    <Component class="javax.swing.JTextField" name="projectNameTextField">
   38.43 +      <AccessibilityProperties>
   38.44 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   38.45 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_LBL_NWP1_ProjectName_A11YDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   38.46 +        </Property>
   38.47 +      </AccessibilityProperties>
   38.48 +      <AuxValues>
   38.49 +        <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="4"/>
   38.50 +      </AuxValues>
   38.51 +      <Constraints>
   38.52 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
   38.53 +          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="12" insetsBottom="12" insetsRight="0" anchor="17" weightX="1.0" weightY="0.0"/>
   38.54 +        </Constraint>
   38.55 +      </Constraints>
   38.56 +    </Component>
   38.57 +    <Component class="javax.swing.JLabel" name="projectLocationLabel">
   38.58 +      <Properties>
   38.59 +        <Property name="displayedMnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
   38.60 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_ProjectLocation_LabelMnemonic" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
   38.61 +        </Property>
   38.62 +        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
   38.63 +          <ComponentRef name="projectLocationTextField"/>
   38.64 +        </Property>
   38.65 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   38.66 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_ProjectLocation_Label" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   38.67 +        </Property>
   38.68 +      </Properties>
   38.69 +      <AccessibilityProperties>
   38.70 +        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   38.71 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_ProjectLocation_Label" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
   38.72 +        </Property>
   38.73 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   38.74 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_LBL_NPW1_ProjectLocation_A11YDesc" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
   38.75 +        </Property>
   38.76 +      </AccessibilityProperties>
   38.77 +      <Constraints>
   38.78 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
   38.79 +          <GridBagConstraints gridX="-1" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="5" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
   38.80 +        </Constraint>
   38.81 +      </Constraints>
   38.82 +    </Component>
   38.83 +    <Component class="javax.swing.JTextField" name="projectLocationTextField">
   38.84 +      <AccessibilityProperties>
   38.85 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   38.86 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_LBL_NPW1_ProjectLocation_A11YDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   38.87 +        </Property>
   38.88 +      </AccessibilityProperties>
   38.89 +      <Constraints>
   38.90 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
   38.91 +          <GridBagConstraints gridX="-1" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="12" insetsBottom="5" insetsRight="0" anchor="17" weightX="1.0" weightY="0.0"/>
   38.92 +        </Constraint>
   38.93 +      </Constraints>
   38.94 +    </Component>
   38.95 +    <Component class="javax.swing.JButton" name="Button">
   38.96 +      <Properties>
   38.97 +        <Property name="mnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
   38.98 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_BrowseLocation_ButtonMnemonic" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
   38.99 +        </Property>
  38.100 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  38.101 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_BrowseLocation_Button" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  38.102 +        </Property>
  38.103 +        <Property name="actionCommand" type="java.lang.String" value="BROWSE"/>
  38.104 +      </Properties>
  38.105 +      <AccessibilityProperties>
  38.106 +        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  38.107 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_BrowseLocation_Button" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
  38.108 +        </Property>
  38.109 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  38.110 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_LBL_NWP1_BrowseLocation_A11YDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  38.111 +        </Property>
  38.112 +      </AccessibilityProperties>
  38.113 +      <Events>
  38.114 +        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseLocationAction"/>
  38.115 +      </Events>
  38.116 +      <Constraints>
  38.117 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
  38.118 +          <GridBagConstraints gridX="-1" gridY="1" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="5" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
  38.119 +        </Constraint>
  38.120 +      </Constraints>
  38.121 +    </Component>
  38.122 +    <Component class="javax.swing.JLabel" name="createdFolderLabel">
  38.123 +      <Properties>
  38.124 +        <Property name="displayedMnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
  38.125 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_CreatedProjectFolder_LablelMnemonic" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
  38.126 +        </Property>
  38.127 +        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
  38.128 +          <ComponentRef name="createdFolderTextField"/>
  38.129 +        </Property>
  38.130 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  38.131 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_CreatedProjectFolder_Lablel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  38.132 +        </Property>
  38.133 +      </Properties>
  38.134 +      <AccessibilityProperties>
  38.135 +        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  38.136 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_CreatedProjectFolder_Lablel" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
  38.137 +        </Property>
  38.138 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  38.139 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_LBL_NWP1_CreatedProjectFolder_A11YDesc" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
  38.140 +        </Property>
  38.141 +      </AccessibilityProperties>
  38.142 +      <Constraints>
  38.143 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
  38.144 +          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="0" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
  38.145 +        </Constraint>
  38.146 +      </Constraints>
  38.147 +    </Component>
  38.148 +    <Component class="javax.swing.JTextField" name="createdFolderTextField">
  38.149 +      <Properties>
  38.150 +        <Property name="editable" type="boolean" value="false"/>
  38.151 +      </Properties>
  38.152 +      <AccessibilityProperties>
  38.153 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  38.154 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_LBL_NWP1_CreatedProjectFolder_A11YDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  38.155 +        </Property>
  38.156 +      </AccessibilityProperties>
  38.157 +      <Constraints>
  38.158 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
  38.159 +          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="0" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="12" insetsBottom="0" insetsRight="0" anchor="18" weightX="1.0" weightY="1.0"/>
  38.160 +        </Constraint>
  38.161 +      </Constraints>
  38.162 +    </Component>
  38.163 +  </SubComponents>
  38.164 +</Form>
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PanelProjectLocationVisual.java	Sun Jan 28 18:54:08 2007 +0000
    39.3 @@ -0,0 +1,334 @@
    39.4 +/*
    39.5 + *                 Sun Public License Notice
    39.6 + *
    39.7 + * The contents of this file are subject to the Sun Public License
    39.8 + * Version 1.0 (the "License"). You may not use this file except in
    39.9 + * compliance with the License. A copy of the License is available at
   39.10 + * http://www.sun.com/
   39.11 + *
   39.12 + * The Original Code is NetBeans. The Initial Developer of the Original
   39.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
   39.14 + * Microsystems, Inc. All Rights Reserved.
   39.15 + */
   39.16 +
   39.17 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
   39.18 +
   39.19 +
   39.20 +import java.io.File;
   39.21 +import java.io.IOException;
   39.22 +import java.text.MessageFormat;
   39.23 +
   39.24 +import javax.swing.JFileChooser;
   39.25 +import javax.swing.event.DocumentEvent;
   39.26 +import javax.swing.event.DocumentListener;
   39.27 +import javax.swing.text.Document;
   39.28 +
   39.29 +import org.netbeans.spi.project.ui.support.ProjectChooser;
   39.30 +
   39.31 +import org.openide.WizardDescriptor;
   39.32 +import org.openide.filesystems.FileUtil;
   39.33 +import org.openide.util.NbBundle;
   39.34 +
   39.35 +
   39.36 +public class PanelProjectLocationVisual extends SettingsPanel implements DocumentListener {
   39.37 +    public static final String PROP_PROJECT_NAME = "projectName"; //NOI18N
   39.38 +    private static final String PROJECT_NAME_FORMATER = getBundleResource("LBL_NPW1_DefaultProjectName"); //NOI18N
   39.39 +    
   39.40 +    private String generatedProjectName = "";
   39.41 +    private int generatedProjectNameIndex = 0;
   39.42 +    
   39.43 +    private PanelConfigureProject panel;
   39.44 +    
   39.45 +    /** Creates new form PanelProjectLocationVisual */
   39.46 +    public PanelProjectLocationVisual(PanelConfigureProject panel) {
   39.47 +        initComponents();
   39.48 +        this.panel = panel;
   39.49 +        
   39.50 +        
   39.51 +        // Register listener on the textFields to make the automatic updates
   39.52 +        projectNameTextField.getDocument().addDocumentListener(this);
   39.53 +        projectLocationTextField.getDocument().addDocumentListener(this);
   39.54 +    }
   39.55 +    
   39.56 +    /** This method is called from within the constructor to
   39.57 +     * initialize the form.
   39.58 +     * WARNING: Do NOT modify this code. The content of this method is
   39.59 +     * always regenerated by the Form Editor.
   39.60 +     */
   39.61 +    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
   39.62 +    private void initComponents() {
   39.63 +        java.awt.GridBagConstraints gridBagConstraints;
   39.64 +
   39.65 +        projectNameLabel = new javax.swing.JLabel();
   39.66 +        projectNameTextField = new javax.swing.JTextField();
   39.67 +        projectLocationLabel = new javax.swing.JLabel();
   39.68 +        projectLocationTextField = new javax.swing.JTextField();
   39.69 +        Button = new javax.swing.JButton();
   39.70 +        createdFolderLabel = new javax.swing.JLabel();
   39.71 +        createdFolderTextField = new javax.swing.JTextField();
   39.72 +
   39.73 +        setLayout(new java.awt.GridBagLayout());
   39.74 +
   39.75 +        projectNameLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_NWP1_ProjectName_LabelMnemonic").charAt(0));
   39.76 +        projectNameLabel.setLabelFor(projectNameTextField);
   39.77 +        projectNameLabel.setText(org.openide.util.NbBundle.getMessage(PanelProjectLocationVisual.class, "LBL_NWP1_ProjectName_Label"));
   39.78 +        gridBagConstraints = new java.awt.GridBagConstraints();
   39.79 +        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
   39.80 +        gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0);
   39.81 +        add(projectNameLabel, gridBagConstraints);
   39.82 +        projectNameLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_NWP1_ProjectName_Label"));
   39.83 +        projectNameLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("ACS_LBL_NWP1_ProjectName_A11YDesc"));
   39.84 +
   39.85 +        gridBagConstraints = new java.awt.GridBagConstraints();
   39.86 +        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
   39.87 +        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
   39.88 +        gridBagConstraints.weightx = 1.0;
   39.89 +        gridBagConstraints.insets = new java.awt.Insets(0, 12, 12, 0);
   39.90 +        add(projectNameTextField, gridBagConstraints);
   39.91 +        projectNameTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PanelProjectLocationVisual.class, "ACS_LBL_NWP1_ProjectName_A11YDesc"));
   39.92 +
   39.93 +        projectLocationLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_NWP1_ProjectLocation_LabelMnemonic").charAt(0));
   39.94 +        projectLocationLabel.setLabelFor(projectLocationTextField);
   39.95 +        projectLocationLabel.setText(org.openide.util.NbBundle.getMessage(PanelProjectLocationVisual.class, "LBL_NWP1_ProjectLocation_Label"));
   39.96 +        gridBagConstraints = new java.awt.GridBagConstraints();
   39.97 +        gridBagConstraints.gridy = 1;
   39.98 +        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
   39.99 +        gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
  39.100 +        add(projectLocationLabel, gridBagConstraints);
  39.101 +        projectLocationLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_NWP1_ProjectLocation_Label"));
  39.102 +        projectLocationLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("ACS_LBL_NPW1_ProjectLocation_A11YDesc"));
  39.103 +
  39.104 +        gridBagConstraints = new java.awt.GridBagConstraints();
  39.105 +        gridBagConstraints.gridy = 1;
  39.106 +        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  39.107 +        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  39.108 +        gridBagConstraints.weightx = 1.0;
  39.109 +        gridBagConstraints.insets = new java.awt.Insets(0, 12, 5, 0);
  39.110 +        add(projectLocationTextField, gridBagConstraints);
  39.111 +        projectLocationTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PanelProjectLocationVisual.class, "ACS_LBL_NPW1_ProjectLocation_A11YDesc"));
  39.112 +
  39.113 +        Button.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_NWP1_BrowseLocation_ButtonMnemonic").charAt(0));
  39.114 +        Button.setText(org.openide.util.NbBundle.getMessage(PanelProjectLocationVisual.class, "LBL_NWP1_BrowseLocation_Button"));
  39.115 +        Button.setActionCommand("BROWSE");
  39.116 +        Button.addActionListener(new java.awt.event.ActionListener() {
  39.117 +            public void actionPerformed(java.awt.event.ActionEvent evt) {
  39.118 +                browseLocationAction(evt);
  39.119 +            }
  39.120 +        });
  39.121 +
  39.122 +        gridBagConstraints = new java.awt.GridBagConstraints();
  39.123 +        gridBagConstraints.gridy = 1;
  39.124 +        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
  39.125 +        gridBagConstraints.insets = new java.awt.Insets(0, 6, 5, 0);
  39.126 +        add(Button, gridBagConstraints);
  39.127 +        Button.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_NWP1_BrowseLocation_Button"));
  39.128 +        Button.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PanelProjectLocationVisual.class, "ACS_LBL_NWP1_BrowseLocation_A11YDesc"));
  39.129 +
  39.130 +        createdFolderLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_NWP1_CreatedProjectFolder_LablelMnemonic").charAt(0));
  39.131 +        createdFolderLabel.setLabelFor(createdFolderTextField);
  39.132 +        createdFolderLabel.setText(org.openide.util.NbBundle.getMessage(PanelProjectLocationVisual.class, "LBL_NWP1_CreatedProjectFolder_Lablel"));
  39.133 +        gridBagConstraints = new java.awt.GridBagConstraints();
  39.134 +        gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
  39.135 +        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  39.136 +        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
  39.137 +        add(createdFolderLabel, gridBagConstraints);
  39.138 +        createdFolderLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_NWP1_CreatedProjectFolder_Lablel"));
  39.139 +        createdFolderLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("ACS_LBL_NWP1_CreatedProjectFolder_A11YDesc"));
  39.140 +
  39.141 +        createdFolderTextField.setEditable(false);
  39.142 +        gridBagConstraints = new java.awt.GridBagConstraints();
  39.143 +        gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
  39.144 +        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  39.145 +        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
  39.146 +        gridBagConstraints.weightx = 1.0;
  39.147 +        gridBagConstraints.weighty = 1.0;
  39.148 +        gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
  39.149 +        add(createdFolderTextField, gridBagConstraints);
  39.150 +        createdFolderTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PanelProjectLocationVisual.class, "ACS_LBL_NWP1_CreatedProjectFolder_A11YDesc"));
  39.151 +
  39.152 +    }
  39.153 +    // </editor-fold>//GEN-END:initComponents
  39.154 +    
  39.155 +    private static String getBundleResource(final String resourceName) {
  39.156 +        return NbBundle.getMessage(PanelProjectLocationVisual.class, resourceName);
  39.157 +    }
  39.158 +    
  39.159 +    private void browseLocationAction(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseLocationAction
  39.160 +        String command = evt.getActionCommand();
  39.161 +        
  39.162 +        if ("BROWSE".equals(command)) { //NOI18N
  39.163 +            JFileChooser chooser = FileChooser.createDirectoryChooser(
  39.164 +                    "PanelProjectLocationVisual.browseLocationAction", projectLocationTextField.getText()); //NOI18N
  39.165 +            chooser.setDialogTitle(getBundleResource("LBL_NWP1_SelectProjectLocation")); //NOI18N
  39.166 +            if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
  39.167 +                File projectDir = chooser.getSelectedFile();
  39.168 +                projectLocationTextField.setText(projectDir.getAbsolutePath());
  39.169 +            }
  39.170 +            panel.fireChangeEvent();
  39.171 +        }
  39.172 +    }//GEN-LAST:event_browseLocationAction
  39.173 +    
  39.174 +    public void addNotify() {
  39.175 +        super.addNotify();
  39.176 +        //same problem as in 31086, initial focus on Cancel button
  39.177 +        projectNameTextField.requestFocus();
  39.178 +    }
  39.179 +    
  39.180 +    boolean valid(WizardDescriptor wizardDescriptor) {
  39.181 +        String projectName = projectNameTextField.getText();
  39.182 +        if ( projectName.length() == 0 ) {
  39.183 +            wizardDescriptor.putProperty( "WizardPanel_errorMessage", // NOI18N
  39.184 +                    NbBundle.getMessage(PanelProjectLocationVisual.class,"MSG_IllegalProjectName"));
  39.185 +            return false; // Display name not specified
  39.186 +        }
  39.187 +        if ( !projectName.matches("[\\w.-]+") ) {
  39.188 +            String message = NbBundle.getMessage(PanelProjectLocationVisual.class,"MSG_InvalidProjectName");
  39.189 +            wizardDescriptor.putProperty("WizardPanel_errorMessage", message);
  39.190 +            return false;
  39.191 +        }
  39.192 +        File f = new File(projectLocationTextField.getText()).getAbsoluteFile();
  39.193 +        if (getCanonicalFile(f)==null) {
  39.194 +            String message = NbBundle.getMessage(PanelProjectLocationVisual.class,"MSG_IllegalProjectLocation");
  39.195 +            wizardDescriptor.putProperty("WizardPanel_errorMessage", message);
  39.196 +            return false;
  39.197 +        }
  39.198 +        final File destFolder = getCanonicalFile(new File( createdFolderTextField.getText() ).getAbsoluteFile());
  39.199 +        if (destFolder == null) {
  39.200 +            String message = NbBundle.getMessage(PanelProjectLocationVisual.class,"MSG_IllegalProjectName");
  39.201 +            wizardDescriptor.putProperty("WizardPanel_errorMessage", message);
  39.202 +            return false;
  39.203 +        }
  39.204 +        
  39.205 +        // Do not allow a project name that degenerates to a reference to the parent folder
  39.206 +        if (destFolder.equals(f)) {
  39.207 +            String message = NbBundle.getMessage(PanelProjectLocationVisual.class,"MSG_IllegalProjectName");
  39.208 +            wizardDescriptor.putProperty("WizardPanel_errorMessage", message);
  39.209 +            return false;
  39.210 +        }
  39.211 +        
  39.212 +        File projLoc = destFolder;
  39.213 +        while (projLoc != null && !projLoc.exists()) {
  39.214 +            projLoc = projLoc.getParentFile();
  39.215 +        }
  39.216 +        if (projLoc == null || !projLoc.canWrite()) {
  39.217 +            wizardDescriptor.putProperty( "WizardPanel_errorMessage", // NOI18N
  39.218 +                    NbBundle.getMessage(PanelProjectLocationVisual.class,"MSG_ProjectFolderReadOnly"));
  39.219 +            return false;
  39.220 +        }
  39.221 +        
  39.222 +        if (FileUtil.toFileObject(projLoc) == null) {
  39.223 +            String message = NbBundle.getMessage(PanelProjectLocationVisual.class,"MSG_IllegalProjectLocation");
  39.224 +            wizardDescriptor.putProperty("WizardPanel_errorMessage", message);
  39.225 +            return false;
  39.226 +        }
  39.227 +        
  39.228 +        File[] kids = destFolder.listFiles();
  39.229 +        if ( destFolder.exists() && kids != null && kids.length > 0) {
  39.230 +            // Folder exists and is not empty
  39.231 +            wizardDescriptor.putProperty( "WizardPanel_errorMessage", // NOI18N
  39.232 +                    NbBundle.getMessage(PanelProjectLocationVisual.class,"MSG_ProjectFolderExists"));
  39.233 +            return false;
  39.234 +        }
  39.235 +        
  39.236 +        wizardDescriptor.putProperty( "WizardPanel_errorMessage", "");
  39.237 +        return true;
  39.238 +    }
  39.239 +    
  39.240 +    public static File getCanonicalFile(File f) {
  39.241 +        File f1;
  39.242 +        try {
  39.243 +            f1 = f.getCanonicalFile();
  39.244 +        } catch (IOException e) {
  39.245 +            f1 = null;
  39.246 +        }
  39.247 +        return f1;
  39.248 +    }
  39.249 +    
  39.250 +    void store(WizardDescriptor d) {
  39.251 +        d.putProperty(WizardProperties.PROJECT_DIR, new File(createdFolderTextField.getText().trim()));
  39.252 +        d.putProperty(WizardProperties.NAME, projectNameTextField.getText().trim());
  39.253 +        final Integer nameIndex = projectNameTextField.getText().equals(generatedProjectName) ?
  39.254 +            new Integer(generatedProjectNameIndex) : null;
  39.255 +        d.putProperty(PortletProjectWizardIterator.PROP_NAME_INDEX, nameIndex);
  39.256 +    }
  39.257 +    
  39.258 +    void read(WizardDescriptor settings) {
  39.259 +        if (projectLocationTextField.getText().trim().length() == 0) {
  39.260 +            projectLocationTextField.setText(ProjectChooser.getProjectsFolder().getAbsolutePath());
  39.261 +        }
  39.262 +    }
  39.263 +    
  39.264 +    // Variables declaration - do not modify//GEN-BEGIN:variables
  39.265 +    private javax.swing.JButton Button;
  39.266 +    private javax.swing.JLabel createdFolderLabel;
  39.267 +    private javax.swing.JTextField createdFolderTextField;
  39.268 +    private javax.swing.JLabel projectLocationLabel;
  39.269 +    private javax.swing.JTextField projectLocationTextField;
  39.270 +    private javax.swing.JLabel projectNameLabel;
  39.271 +    protected javax.swing.JTextField projectNameTextField;
  39.272 +    // End of variables declaration//GEN-END:variables
  39.273 +    
  39.274 +    public static String getProjectName(int index) {
  39.275 +        return MessageFormat.format(PROJECT_NAME_FORMATER, new Object[]{String.valueOf(index)});
  39.276 +    }
  39.277 +    
  39.278 +    private static int getValidProjectNameIndex(int currentIndex, File projectLocation) {
  39.279 +        int index = currentIndex > 0 ? currentIndex : FoldersListSettings.getDefault().getNewProjectCount() + 1;
  39.280 +        if(projectLocation != null) {
  39.281 +            while (new File(projectLocation, getProjectName(index)).exists()) {
  39.282 +                index++;
  39.283 +            }
  39.284 +        }
  39.285 +        return index;
  39.286 +    }
  39.287 +    // Implementation of DocumentListener --------------------------------------
  39.288 +    
  39.289 +    public void changedUpdate( DocumentEvent e ) {
  39.290 +        updateTexts( e );
  39.291 +        if (this.projectNameTextField.getDocument() == e.getDocument()) {
  39.292 +            firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
  39.293 +        }
  39.294 +    }
  39.295 +    
  39.296 +    public void insertUpdate( DocumentEvent e ) {
  39.297 +        updateTexts( e );
  39.298 +        if (this.projectNameTextField.getDocument() == e.getDocument()) {
  39.299 +            firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
  39.300 +        }
  39.301 +    }
  39.302 +    
  39.303 +    public void removeUpdate( DocumentEvent e ) {
  39.304 +        updateTexts( e );
  39.305 +        if (this.projectNameTextField.getDocument() == e.getDocument()) {
  39.306 +            firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
  39.307 +        }
  39.308 +    }
  39.309 +    
  39.310 +    /** Handles changes in the Project name and project directory
  39.311 +     */
  39.312 +    private void updateTexts( DocumentEvent e ) {
  39.313 +        Document doc = e.getDocument();
  39.314 +        if (doc == projectNameTextField.getDocument() || doc == projectLocationTextField.getDocument()) {
  39.315 +            String projectName = projectNameTextField.getText();
  39.316 +            
  39.317 +            if (doc == projectLocationTextField.getDocument()) {
  39.318 +                if (projectName.equals(generatedProjectName)) {
  39.319 +                    File f = new File(projectLocationTextField.getText().trim());
  39.320 +                    generatedProjectNameIndex = getValidProjectNameIndex(generatedProjectNameIndex, f);
  39.321 +                } else {
  39.322 +                    generatedProjectNameIndex = 0;
  39.323 +                }
  39.324 +                generatedProjectName = generatedProjectNameIndex > 0 ? getProjectName(generatedProjectNameIndex) : null;
  39.325 +                if(generatedProjectNameIndex > 0) {
  39.326 +                    projectName = generatedProjectName;
  39.327 +                    projectNameTextField.setText(generatedProjectName);
  39.328 +                    projectNameTextField.selectAll();
  39.329 +                }
  39.330 +            }
  39.331 +            
  39.332 +            String projectFolder = projectLocationTextField.getText();
  39.333 +            createdFolderTextField.setText(projectFolder + File.separatorChar + projectName);
  39.334 +        }
  39.335 +        panel.fireChangeEvent(); // Notify that the panel changed
  39.336 +    }
  39.337 +}
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PortletProjectDeployDescriptorVisual.form	Sun Jan 28 18:54:08 2007 +0000
    40.3 @@ -0,0 +1,222 @@
    40.4 +<?xml version="1.0" encoding="UTF-8" ?>
    40.5 +
    40.6 +<Form version="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    40.7 +  <AuxValues>
    40.8 +    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
    40.9 +    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   40.10 +    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   40.11 +    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   40.12 +  </AuxValues>
   40.13 +
   40.14 +  <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
   40.15 +  <SubComponents>
   40.16 +    <Component class="javax.swing.JLabel" name="lblPortletName">
   40.17 +      <Properties>
   40.18 +        <Property name="displayedMnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
   40.19 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_PPOV_PORTLETNAMEMnemonic" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
   40.20 +        </Property>
   40.21 +        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
   40.22 +          <ComponentRef name="txtPortletName"/>
   40.23 +        </Property>
   40.24 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   40.25 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_PPOV_PORTLETNAME" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   40.26 +        </Property>
   40.27 +      </Properties>
   40.28 +      <AccessibilityProperties>
   40.29 +        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   40.30 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_LBL_PPOV_PORTLETNAME_A11YName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   40.31 +        </Property>
   40.32 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   40.33 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_LBL_PPOV_PORTLETNAME_A11YDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   40.34 +        </Property>
   40.35 +      </AccessibilityProperties>
   40.36 +      <Constraints>
   40.37 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
   40.38 +          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="12" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
   40.39 +        </Constraint>
   40.40 +      </Constraints>
   40.41 +    </Component>
   40.42 +    <Component class="javax.swing.JTextField" name="txtPortletName">
   40.43 +      <Properties>
   40.44 +        <Property name="editable" type="boolean" value="false"/>
   40.45 +      </Properties>
   40.46 +      <AccessibilityProperties>
   40.47 +        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   40.48 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_TXT_PPOV_PORTLETNAME_A11YName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   40.49 +        </Property>
   40.50 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   40.51 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_TXT_PPOV_PORTLETNAME_A11YDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   40.52 +        </Property>
   40.53 +      </AccessibilityProperties>
   40.54 +      <Constraints>
   40.55 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
   40.56 +          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="5" insetsBottom="0" insetsRight="12" anchor="17" weightX="1.0" weightY="0.0"/>
   40.57 +        </Constraint>
   40.58 +      </Constraints>
   40.59 +    </Component>
   40.60 +    <Component class="javax.swing.JLabel" name="lblPortletDescription">
   40.61 +      <Properties>
   40.62 +        <Property name="displayedMnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
   40.63 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_PPOV_PORTLETDESCMnemonic" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
   40.64 +        </Property>
   40.65 +        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
   40.66 +          <ComponentRef name="txtPortletDescription"/>
   40.67 +        </Property>
   40.68 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   40.69 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_PPOV_PORTLETDESC" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   40.70 +        </Property>
   40.71 +      </Properties>
   40.72 +      <AccessibilityProperties>
   40.73 +        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   40.74 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_LBL_PPOV_PORTLETDESC_A11YName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   40.75 +        </Property>
   40.76 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   40.77 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_LBL_PPOV_PORTLETDESC_A11YDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   40.78 +        </Property>
   40.79 +      </AccessibilityProperties>
   40.80 +      <Constraints>
   40.81 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
   40.82 +          <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="12" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
   40.83 +        </Constraint>
   40.84 +      </Constraints>
   40.85 +    </Component>
   40.86 +    <Component class="javax.swing.JTextField" name="txtPortletDescription">
   40.87 +      <AccessibilityProperties>
   40.88 +        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   40.89 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_TXT_PPOV_PORTLETDESC_A11YName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   40.90 +        </Property>
   40.91 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   40.92 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_TXT_PPOV_PORTLETDESC_A11YDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   40.93 +        </Property>
   40.94 +      </AccessibilityProperties>
   40.95 +      <Constraints>
   40.96 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
   40.97 +          <GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="5" insetsBottom="0" insetsRight="12" anchor="17" weightX="1.0" weightY="0.0"/>
   40.98 +        </Constraint>
   40.99 +      </Constraints>
  40.100 +    </Component>
  40.101 +    <Component class="javax.swing.JLabel" name="lblPortletDisplayName">
  40.102 +      <Properties>
  40.103 +        <Property name="displayedMnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
  40.104 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_PPOV_PORTLETDISPLAYNAMEMnemonic" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
  40.105 +        </Property>
  40.106 +        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
  40.107 +          <ComponentRef name="txtPortletDisplayName"/>
  40.108 +        </Property>
  40.109 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  40.110 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_PPOV_PORTLETDISPLAYNAME" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  40.111 +        </Property>
  40.112 +      </Properties>
  40.113 +      <AccessibilityProperties>
  40.114 +        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  40.115 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_TXT_PPOV_PORTLETDISPLAYNAME_A11YName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  40.116 +        </Property>
  40.117 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  40.118 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_TXT_PPOV_PORTLETDISPLAYNAME_A11YDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  40.119 +        </Property>
  40.120 +      </AccessibilityProperties>
  40.121 +      <Constraints>
  40.122 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
  40.123 +          <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="12" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
  40.124 +        </Constraint>
  40.125 +      </Constraints>
  40.126 +    </Component>
  40.127 +    <Component class="javax.swing.JTextField" name="txtPortletDisplayName">
  40.128 +      <AccessibilityProperties>
  40.129 +        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  40.130 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_TXT_PPOV_PORTLETDISPLAYNAME_A11YName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  40.131 +        </Property>
  40.132 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  40.133 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_TXT_PPOV_PORTLETDISPLAYNAME_A11YDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  40.134 +        </Property>
  40.135 +      </AccessibilityProperties>
  40.136 +      <Constraints>
  40.137 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
  40.138 +          <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="5" insetsBottom="0" insetsRight="12" anchor="17" weightX="1.0" weightY="0.0"/>
  40.139 +        </Constraint>
  40.140 +      </Constraints>
  40.141 +    </Component>
  40.142 +    <Component class="javax.swing.JLabel" name="lblPortletDescription1">
  40.143 +      <Properties>
  40.144 +        <Property name="displayedMnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
  40.145 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_PPOV_PORTLETTITLEMnemonic" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
  40.146 +        </Property>
  40.147 +        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
  40.148 +          <ComponentRef name="txtPortletTitle"/>
  40.149 +        </Property>
  40.150 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  40.151 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_PPOV_PORTLETTITLE" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  40.152 +        </Property>
  40.153 +      </Properties>
  40.154 +      <AccessibilityProperties>
  40.155 +        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  40.156 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_LBL_PPOV_PORTLETTITLE_A11YName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  40.157 +        </Property>
  40.158 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  40.159 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_LBL_PPOV_PORTLETTITLE_A11YDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  40.160 +        </Property>
  40.161 +      </AccessibilityProperties>
  40.162 +      <Constraints>
  40.163 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
  40.164 +          <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="12" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
  40.165 +        </Constraint>
  40.166 +      </Constraints>
  40.167 +    </Component>
  40.168 +    <Component class="javax.swing.JTextField" name="txtPortletTitle">
  40.169 +      <AccessibilityProperties>
  40.170 +        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  40.171 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_TXT_PPOV_PORTLETTITLE_A11YName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  40.172 +        </Property>
  40.173 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  40.174 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_TXT_PPOV_PORTLETTITLE_A11YDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  40.175 +        </Property>
  40.176 +      </AccessibilityProperties>
  40.177 +      <Constraints>
  40.178 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
  40.179 +          <GridBagConstraints gridX="1" gridY="3" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="5" insetsBottom="0" insetsRight="12" anchor="10" weightX="1.0" weightY="0.0"/>
  40.180 +        </Constraint>
  40.181 +      </Constraints>
  40.182 +    </Component>
  40.183 +    <Component class="javax.swing.JLabel" name="lblPortletDescription2">
  40.184 +      <Properties>
  40.185 +        <Property name="displayedMnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
  40.186 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_PPOV_PORTLETSHORTTITLEMnemonic" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
  40.187 +        </Property>
  40.188 +        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
  40.189 +          <ComponentRef name="txtPortletShortTitle"/>
  40.190 +        </Property>
  40.191 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  40.192 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_PPOV_PORTLETSHORTTITLE" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  40.193 +        </Property>
  40.194 +      </Properties>
  40.195 +      <AccessibilityProperties>
  40.196 +        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  40.197 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_LBL_PPOV_PORTLETSHORTTITLE_A11YName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  40.198 +        </Property>
  40.199 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  40.200 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_LBL_PPOV_PORTLETSHORTTITLE_A11YDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  40.201 +        </Property>
  40.202 +      </AccessibilityProperties>
  40.203 +      <Constraints>
  40.204 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
  40.205 +          <GridBagConstraints gridX="0" gridY="4" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="12" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
  40.206 +        </Constraint>
  40.207 +      </Constraints>
  40.208 +    </Component>
  40.209 +    <Component class="javax.swing.JTextField" name="txtPortletShortTitle">
  40.210 +      <AccessibilityProperties>
  40.211 +        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  40.212 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_TXT_PPOV_PORTLETSHORTTITLE_A11YName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  40.213 +        </Property>
  40.214 +        <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  40.215 +          <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_TXT_PPOV_PORTLETSHORTTITLE_A11YDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  40.216 +        </Property>
  40.217 +      </AccessibilityProperties>
  40.218 +      <Constraints>
  40.219 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
  40.220 +          <GridBagConstraints gridX="1" gridY="4" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="5" insetsBottom="0" insetsRight="12" anchor="10" weightX="1.0" weightY="0.0"/>
  40.221 +        </Constraint>
  40.222 +      </Constraints>
  40.223 +    </Component>
  40.224 +  </SubComponents>
  40.225 +</Form>
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PortletProjectDeployDescriptorVisual.java	Sun Jan 28 18:54:08 2007 +0000
    41.3 @@ -0,0 +1,217 @@
    41.4 +/*
    41.5 + * PortletProjectDeployDescriptorVisual.java
    41.6 + *
    41.7 + * Created on April 27, 2005, 11:51 PM
    41.8 + *
    41.9 + * To change this template, choose Tools | Options and locate the template under
   41.10 + * the Source Creation and Management node. Right-click the template and choose
   41.11 + * Open. You can then make changes to the template in the Source Editor.
   41.12 + */
   41.13 +
   41.14 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
   41.15 +import org.openide.WizardDescriptor;
   41.16 +import org.openide.util.NbBundle;
   41.17 +
   41.18 +
   41.19 +/**
   41.20 + * This class acts as one of the panels shown in the WizardIterator to create
   41.21 + * a portlet project.  This panel represents the portlet specific options that a
   41.22 + * user can specify.
   41.23 + *
   41.24 + * @author  David Botterill
   41.25 + */
   41.26 +public class PortletProjectDeployDescriptorVisual extends javax.swing.JPanel {
   41.27 +    
   41.28 +    private WizardDescriptor wizardDescriptor;
   41.29 +    
   41.30 +    /**
   41.31 +     * Creates new form PortletProjectOptionsVisual
   41.32 +     */
   41.33 +    public PortletProjectDeployDescriptorVisual(WizardDescriptor inWizardDescriptor) {
   41.34 +        wizardDescriptor = inWizardDescriptor;
   41.35 +        initComponents();
   41.36 +        /**
   41.37 +         * Set the inital portlet name based on the project name.
   41.38 +         */
   41.39 +        Object projectName = wizardDescriptor.getProperty(WizardProperties.NAME);
   41.40 +        if(null != projectName && projectName instanceof String) {
   41.41 +            this.txtPortletName.setText((String)projectName);
   41.42 +        }
   41.43 +        
   41.44 +
   41.45 +    }
   41.46 +    
   41.47 +    /** This method is called from within the constructor to
   41.48 +     * initialize the form.
   41.49 +     * WARNING: Do NOT modify this code. The content of this method is
   41.50 +     * always regenerated by the Form Editor.
   41.51 +     */
   41.52 +    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
   41.53 +    private void initComponents() {
   41.54 +        java.awt.GridBagConstraints gridBagConstraints;
   41.55 +
   41.56 +        lblPortletName = new javax.swing.JLabel();
   41.57 +        txtPortletName = new javax.swing.JTextField();
   41.58 +        lblPortletDescription = new javax.swing.JLabel();
   41.59 +        txtPortletDescription = new javax.swing.JTextField();
   41.60 +        lblPortletDisplayName = new javax.swing.JLabel();
   41.61 +        txtPortletDisplayName = new javax.swing.JTextField();
   41.62 +        lblPortletDescription1 = new javax.swing.JLabel();
   41.63 +        txtPortletTitle = new javax.swing.JTextField();
   41.64 +        lblPortletDescription2 = new javax.swing.JLabel();
   41.65 +        txtPortletShortTitle = new javax.swing.JTextField();
   41.66 +
   41.67 +        setLayout(new java.awt.GridBagLayout());
   41.68 +
   41.69 +        lblPortletName.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_PPOV_PORTLETNAMEMnemonic").charAt(0));
   41.70 +        lblPortletName.setLabelFor(txtPortletName);
   41.71 +        lblPortletName.setText(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "LBL_PPOV_PORTLETNAME"));
   41.72 +        gridBagConstraints = new java.awt.GridBagConstraints();
   41.73 +        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
   41.74 +        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
   41.75 +        add(lblPortletName, gridBagConstraints);
   41.76 +        lblPortletName.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_LBL_PPOV_PORTLETNAME_A11YName"));
   41.77 +        lblPortletName.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_LBL_PPOV_PORTLETNAME_A11YDesc"));
   41.78 +
   41.79 +        txtPortletName.setEditable(false);
   41.80 +        gridBagConstraints = new java.awt.GridBagConstraints();
   41.81 +        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
   41.82 +        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
   41.83 +        gridBagConstraints.weightx = 1.0;
   41.84 +        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 12);
   41.85 +        add(txtPortletName, gridBagConstraints);
   41.86 +        txtPortletName.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETNAME_A11YName"));
   41.87 +        txtPortletName.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETNAME_A11YDesc"));
   41.88 +
   41.89 +        lblPortletDescription.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_PPOV_PORTLETDESCMnemonic").charAt(0));
   41.90 +        lblPortletDescription.setLabelFor(txtPortletDescription);
   41.91 +        lblPortletDescription.setText(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "LBL_PPOV_PORTLETDESC"));
   41.92 +        gridBagConstraints = new java.awt.GridBagConstraints();
   41.93 +        gridBagConstraints.gridx = 0;
   41.94 +        gridBagConstraints.gridy = 2;
   41.95 +        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
   41.96 +        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
   41.97 +        add(lblPortletDescription, gridBagConstraints);
   41.98 +        lblPortletDescription.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_LBL_PPOV_PORTLETDESC_A11YName"));
   41.99 +        lblPortletDescription.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_LBL_PPOV_PORTLETDESC_A11YDesc"));
  41.100 +
  41.101 +        gridBagConstraints = new java.awt.GridBagConstraints();
  41.102 +        gridBagConstraints.gridx = 1;
  41.103 +        gridBagConstraints.gridy = 2;
  41.104 +        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  41.105 +        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  41.106 +        gridBagConstraints.weightx = 1.0;
  41.107 +        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 12);
  41.108 +        add(txtPortletDescription, gridBagConstraints);
  41.109 +        txtPortletDescription.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETDESC_A11YName"));
  41.110 +        txtPortletDescription.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETDESC_A11YDesc"));
  41.111 +
  41.112 +        lblPortletDisplayName.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_PPOV_PORTLETDISPLAYNAMEMnemonic").charAt(0));
  41.113 +        lblPortletDisplayName.setLabelFor(txtPortletDisplayName);
  41.114 +        lblPortletDisplayName.setText(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "LBL_PPOV_PORTLETDISPLAYNAME"));
  41.115 +        gridBagConstraints = new java.awt.GridBagConstraints();
  41.116 +        gridBagConstraints.gridx = 0;
  41.117 +        gridBagConstraints.gridy = 1;
  41.118 +        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  41.119 +        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
  41.120 +        add(lblPortletDisplayName, gridBagConstraints);
  41.121 +        lblPortletDisplayName.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETDISPLAYNAME_A11YName"));
  41.122 +        lblPortletDisplayName.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETDISPLAYNAME_A11YDesc"));
  41.123 +
  41.124 +        gridBagConstraints = new java.awt.GridBagConstraints();
  41.125 +        gridBagConstraints.gridx = 1;
  41.126 +        gridBagConstraints.gridy = 1;
  41.127 +        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  41.128 +        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  41.129 +        gridBagConstraints.weightx = 1.0;
  41.130 +        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 12);
  41.131 +        add(txtPortletDisplayName, gridBagConstraints);
  41.132 +        txtPortletDisplayName.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETDISPLAYNAME_A11YName"));
  41.133 +        txtPortletDisplayName.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETDISPLAYNAME_A11YDesc"));
  41.134 +
  41.135 +        lblPortletDescription1.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_PPOV_PORTLETTITLEMnemonic").charAt(0));
  41.136 +        lblPortletDescription1.setLabelFor(txtPortletTitle);
  41.137 +        lblPortletDescription1.setText(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "LBL_PPOV_PORTLETTITLE"));
  41.138 +        gridBagConstraints = new java.awt.GridBagConstraints();
  41.139 +        gridBagConstraints.gridx = 0;
  41.140 +        gridBagConstraints.gridy = 3;
  41.141 +        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  41.142 +        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
  41.143 +        add(lblPortletDescription1, gridBagConstraints);
  41.144 +        lblPortletDescription1.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_LBL_PPOV_PORTLETTITLE_A11YName"));
  41.145 +        lblPortletDescription1.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_LBL_PPOV_PORTLETTITLE_A11YDesc"));
  41.146 +
  41.147 +        gridBagConstraints = new java.awt.GridBagConstraints();
  41.148 +        gridBagConstraints.gridx = 1;
  41.149 +        gridBagConstraints.gridy = 3;
  41.150 +        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  41.151 +        gridBagConstraints.weightx = 1.0;
  41.152 +        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 12);
  41.153 +        add(txtPortletTitle, gridBagConstraints);
  41.154 +        txtPortletTitle.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETTITLE_A11YName"));
  41.155 +        txtPortletTitle.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETTITLE_A11YDesc"));
  41.156 +
  41.157 +        lblPortletDescription2.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_PPOV_PORTLETSHORTTITLEMnemonic").charAt(0));
  41.158 +        lblPortletDescription2.setLabelFor(txtPortletShortTitle);
  41.159 +        lblPortletDescription2.setText(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "LBL_PPOV_PORTLETSHORTTITLE"));
  41.160 +        gridBagConstraints = new java.awt.GridBagConstraints();
  41.161 +        gridBagConstraints.gridx = 0;
  41.162 +        gridBagConstraints.gridy = 4;
  41.163 +        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  41.164 +        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
  41.165 +        add(lblPortletDescription2, gridBagConstraints);
  41.166 +        lblPortletDescription2.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_LBL_PPOV_PORTLETSHORTTITLE_A11YName"));
  41.167 +        lblPortletDescription2.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_LBL_PPOV_PORTLETSHORTTITLE_A11YDesc"));
  41.168 +
  41.169 +        gridBagConstraints = new java.awt.GridBagConstraints();
  41.170 +        gridBagConstraints.gridx = 1;
  41.171 +        gridBagConstraints.gridy = 4;
  41.172 +        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  41.173 +        gridBagConstraints.weightx = 1.0;
  41.174 +        gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 12);
  41.175 +        add(txtPortletShortTitle, gridBagConstraints);
  41.176 +        txtPortletShortTitle.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETSHORTTITLE_A11YName"));
  41.177 +        txtPortletShortTitle.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETSHORTTITLE_A11YDesc"));
  41.178 +
  41.179 +    }
  41.180 +    // </editor-fold>//GEN-END:initComponents
  41.181 +        
  41.182 +    
  41.183 +    // Variables declaration - do not modify//GEN-BEGIN:variables
  41.184 +    private javax.swing.JLabel lblPortletDescription;
  41.185 +    private javax.swing.JLabel lblPortletDescription1;
  41.186 +    private javax.swing.JLabel lblPortletDescription2;
  41.187 +    private javax.swing.JLabel lblPortletDisplayName;
  41.188 +    private javax.swing.JLabel lblPortletName;
  41.189 +    private javax.swing.JTextField txtPortletDescription;
  41.190 +    private javax.swing.JTextField txtPortletDisplayName;
  41.191 +    private javax.swing.JTextField txtPortletName;
  41.192 +    private javax.swing.JTextField txtPortletShortTitle;
  41.193 +    private javax.swing.JTextField txtPortletTitle;
  41.194 +    // End of variables declaration//GEN-END:variables
  41.195 +    
  41.196 +    boolean valid(WizardDescriptor wizardDescriptor) {
  41.197 +        return true;
  41.198 +    }
  41.199 +    
  41.200 +    void store(WizardDescriptor inDescriptor) {
  41.201 +        inDescriptor.putProperty(PortletWizardProperties.PORTLET_NAME,this.txtPortletName.getText());
  41.202 +        inDescriptor.putProperty(PortletWizardProperties.PORTLET_DISPLAYNAME,this.txtPortletDisplayName.getText());
  41.203 +        inDescriptor.putProperty(PortletWizardProperties.PORTLET_DESC,this.txtPortletDescription.getText());
  41.204 +        inDescriptor.putProperty(PortletWizardProperties.PORTLET_TITLE,this.txtPortletTitle.getText());
  41.205 +        inDescriptor.putProperty(PortletWizardProperties.PORTLET_SHORTTITLE,this.txtPortletShortTitle.getText());
  41.206 +    }
  41.207 +    
  41.208 +    void read(WizardDescriptor inDescriptor) {
  41.209 +        this.txtPortletName.setText((String)inDescriptor.getProperty(WizardProperties.NAME));
  41.210 +        this.txtPortletDisplayName.setText((String)inDescriptor.getProperty(WizardProperties.NAME) + " " + 
  41.211 +                NbBundle.getMessage(PortletProjectWizardIterator.class, "TXT_PORTLET_DIPSLAYNAME_SUFFIX_DEFAULT"));
  41.212 +        this.txtPortletDescription.setText(NbBundle.getMessage(PortletProjectWizardIterator.class, "TXT_PORTLET_DESC_DEFAULT"));
  41.213 +        this.txtPortletTitle.setText((String)inDescriptor.getProperty(WizardProperties.NAME));
  41.214 +        this.txtPortletShortTitle.setText((String)inDescriptor.getProperty(WizardProperties.NAME));
  41.215 +       
  41.216 +        
  41.217 +    }
  41.218 +    
  41.219 +    
  41.220 +}
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PortletProjectDeploymentDescriptor.java	Sun Jan 28 18:54:08 2007 +0000
    42.3 @@ -0,0 +1,99 @@
    42.4 +/*
    42.5 + * PortletProjectDeploymentDescriptor.java
    42.6 + *
    42.7 + * Created on April 27, 2005, 11:49 PM
    42.8 + *
    42.9 + * To change this template, choose Tools | Options and locate the template under
   42.10 + * the Source Creation and Management node. Right-click the template and choose
   42.11 + * Open. You can then make changes to the template in the Source Editor.
   42.12 + */
   42.13 +
   42.14 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
   42.15 +
   42.16 +import java.awt.Component;
   42.17 +import java.util.HashSet;
   42.18 +import java.util.Iterator;
   42.19 +import java.util.Set;
   42.20 +import javax.swing.event.ChangeEvent;
   42.21 +import javax.swing.event.ChangeListener;
   42.22 +import org.openide.WizardDescriptor;
   42.23 +import org.openide.WizardValidationException;
   42.24 +import org.openide.util.HelpCtx;
   42.25 +
   42.26 +
   42.27 +
   42.28 +/**
   42.29 + * This class acts as the WizardDescriptor.Panel wrapper for PortletProjectOptionsVisual
   42.30 + * @author David Botterill
   42.31 + * @see PortletProjectOptionsVisual
   42.32 + */
   42.33 +public class PortletProjectDeploymentDescriptor implements  WizardDescriptor.Panel, WizardDescriptor.FinishablePanel,
   42.34 +        WizardDescriptor.ValidatingPanel{
   42.35 +    
   42.36 +    private WizardDescriptor wizardDescriptor;
   42.37 +    private PortletProjectDeployDescriptorVisual component;
   42.38 +    
   42.39 +    
   42.40 +    /** Creates a new instance of PortletProjectOptions */
   42.41 +    public PortletProjectDeploymentDescriptor(WizardDescriptor inWizardDescriptor) {
   42.42 +        wizardDescriptor = inWizardDescriptor;
   42.43 +    }
   42.44 +    
   42.45 +    public boolean isFinishPanel() {
   42.46 +        return true;
   42.47 +    }
   42.48 +    
   42.49 +    public Component getComponent() {
   42.50 +        if (component == null) {
   42.51 +            component = new PortletProjectDeployDescriptorVisual(wizardDescriptor);
   42.52 +        }
   42.53 +        return component;
   42.54 +    }
   42.55 +    
   42.56 +    public HelpCtx getHelp() {
   42.57 +        return new HelpCtx(PortletProjectDeploymentDescriptor.class);
   42.58 +    }
   42.59 +    
   42.60 +    public boolean isValid() {
   42.61 +        getComponent();
   42.62 +        return component.valid(wizardDescriptor);
   42.63 +    }
   42.64 +    
   42.65 +    private final Set/*<ChangeListener>*/ listeners = new HashSet(1);
   42.66 +    public final void addChangeListener(ChangeListener l) {
   42.67 +        synchronized (listeners) {
   42.68 +            listeners.add(l);
   42.69 +        }
   42.70 +    }
   42.71 +    public final void removeChangeListener(ChangeListener l) {
   42.72 +        synchronized (listeners) {
   42.73 +            listeners.remove(l);
   42.74 +        }
   42.75 +    }
   42.76 +    protected final void fireChangeEvent() {
   42.77 +        Iterator it;
   42.78 +        synchronized (listeners) {
   42.79 +            it = new HashSet(listeners).iterator();
   42.80 +        }
   42.81 +        ChangeEvent ev = new ChangeEvent(this);
   42.82 +        while (it.hasNext()) {
   42.83 +            ((ChangeListener)it.next()).stateChanged(ev);
   42.84 +        }
   42.85 +    }
   42.86 +    
   42.87 +    public void readSettings(Object settings) {
   42.88 +        wizardDescriptor = (WizardDescriptor) settings;
   42.89 +        component.read(wizardDescriptor);
   42.90 +        
   42.91 +    }
   42.92 +    
   42.93 +    public void storeSettings(Object settings) {
   42.94 +        WizardDescriptor d = (WizardDescriptor) settings;
   42.95 +        component.store(d);
   42.96 +    }
   42.97 +    
   42.98 +    public void validate() throws WizardValidationException {
   42.99 +        
  42.100 +    }
  42.101 +    
  42.102 +}
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PortletProjectWizardIterator.java	Sun Jan 28 18:54:08 2007 +0000
    43.3 @@ -0,0 +1,374 @@
    43.4 +/*
    43.5 + * {START_JAVA_COPYRIGHT_NOTICE
    43.6 + * Copyright 2002-2005 Sun Microsystems, Inc. All rights reserved.
    43.7 + * SUN PROPRIETARY/CONFIDENTIAL.
    43.8 + * Use is subject to license terms.
    43.9 + * END_COPYRIGHT_NOTICE}
   43.10 + */
   43.11 +
   43.12 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
   43.13 +
   43.14 +import org.netbeans.modules.visualweb.project.jsf.api.JsfProjectConstants;
   43.15 +import org.netbeans.modules.visualweb.project.jsf.api.ProjectTemplate;
   43.16 +import org.netbeans.modules.visualweb.project.jsf.api.JsfProjectUtils;
   43.17 +import com.sun.rave.api.portlet.dd.InitParamType;
   43.18 +import com.sun.rave.api.portlet.dd.JsfPortletDDProperties;
   43.19 +import com.sun.rave.api.portlet.dd.PortletApp;
   43.20 +import com.sun.rave.api.portlet.dd.PortletInfoType;
   43.21 +import com.sun.rave.api.portlet.dd.PortletType;
   43.22 +import org.netbeans.modules.visualweb.project.jsfportlet.JsfPortletProjectTemplate;
   43.23 +import java.awt.Component;
   43.24 +import java.io.File;
   43.25 +import java.io.IOException;
   43.26 +import java.text.MessageFormat;
   43.27 +import java.util.HashSet;
   43.28 +import java.util.NoSuchElementException;
   43.29 +import java.util.Set;
   43.30 +import javax.swing.JComponent;
   43.31 +import javax.swing.event.ChangeListener;
   43.32 +import javax.xml.parsers.ParserConfigurationException;
   43.33 +import org.netbeans.api.project.Project;
   43.34 +import org.netbeans.api.project.ProjectManager;
   43.35 +import org.netbeans.spi.project.support.ant.AntProjectHelper;
   43.36 +import org.netbeans.spi.project.ui.support.ProjectChooser;
   43.37 +import org.openide.ErrorManager;
   43.38 +import org.openide.WizardDescriptor;
   43.39 +import org.openide.filesystems.FileObject;
   43.40 +import org.openide.filesystems.FileUtil;
   43.41 +import org.openide.util.NbBundle;
   43.42 +import org.xml.sax.SAXException;
   43.43 +
   43.44 +/**
   43.45 + * This class is a modification of com.sun.rave.project.jsf.ui.wizards.NewJsfProjectWizardIterator.
   43.46 + * The "initiate" method should be almost IDENTICAL to NewJsfProjectWizardIterator's.
   43.47 + * @author David Botterill
   43.48 + */
   43.49 +//TODO refactor NewJsfProjectWizardIterator so it can be extended
   43.50 +public class PortletProjectWizardIterator implements WizardDescriptor.InstantiatingIterator {
   43.51 +    
   43.52 +    static final String PROP_NAME_INDEX = "nameIndex"; //NOI18N
   43.53 +    static File defaultProjectFolder = null;
   43.54 +    private transient int index;
   43.55 +    private transient WizardDescriptor.Panel[] panels;
   43.56 +    private transient WizardDescriptor wiz;
   43.57 +    PanelConfigureProject panelConfigureProject;
   43.58 +    PortletProjectDeploymentDescriptor portletProjectDeploymentDescriptor;
   43.59 +    
   43.60 +    
   43.61 +    /** Creates a new instance of PortletProjectWizardIterator */
   43.62 +    public PortletProjectWizardIterator() {
   43.63 +    }
   43.64 +    
   43.65 +    protected WizardDescriptor.Panel[] createPanels(WizardDescriptor inWiz) {
   43.66 +        panelConfigureProject = new PanelConfigureProject(inWiz);
   43.67 +        portletProjectDeploymentDescriptor = new PortletProjectDeploymentDescriptor(inWiz);
   43.68 +        
   43.69 +        return new WizardDescriptor.Panel [] {panelConfigureProject,portletProjectDeploymentDescriptor};
   43.70 +    }
   43.71 +    
   43.72 +    protected String[] createSteps() {
   43.73 +        return new String[] {
   43.74 +            NbBundle.getMessage(PortletProjectWizardIterator.class, "LBL_Portlet_Step1"), //NOI18N
   43.75 +                    NbBundle.getMessage(PortletProjectWizardIterator.class, "LBL_Portlet_Step2")
   43.76 +                    
   43.77 +        };
   43.78 +    }
   43.79 +    
   43.80 +    public Set instantiate() throws IOException {
   43.81 +        Set resultSet = new HashSet();
   43.82 +        File dirF = (File) wiz.getProperty(WizardProperties.PROJECT_DIR);
   43.83 +        String name = (String) wiz.getProperty(WizardProperties.NAME);
   43.84 +        String servInstID = (String) wiz.getProperty(WizardProperties.SERVER_INSTANCE_ID);
   43.85 +        String sourceStructure = (String)wiz.getProperty(WizardProperties.SOURCE_STRUCTURE);
   43.86 +        String j2eeLevel = (String) wiz.getProperty(WizardProperties.J2EE_LEVEL);
   43.87 +        String contextPath = (String) wiz.getProperty(WizardProperties.CONTEXT_PATH);
   43.88 +        String platformName = (String)wiz.getProperty(WizardProperties.JAVA_PLATFORM);
   43.89 +        String sourceLevel = (String) wiz.getProperty(WizardProperties.SOURCE_LEVEL);
   43.90 +        
   43.91 +        // AntProjectHelper h = WebProjectGenerator.createProject(dirF, name, servInstID, sourceStructure, j2eeLevel, contextPath);
   43.92 +        // XXX Should move this to project/jsfproject
   43.93 +        // AntProjectHelper h = JsfProjectUtils.createWebProject(dirF, name, servInstID, sourceStructure, j2eeLevel, contextPath, platformName, sourceLevel, getTemplate());
   43.94 +        AntProjectHelper h = null;
   43.95 +        FileObject dir = FileUtil.toFileObject(dirF);
   43.96 +        Project project = ProjectManager.getDefault().findProject(dir);
   43.97 +        try {
   43.98 +            FileObject webRoot = project.getProjectDirectory().getFileObject("web");//NOI18N
   43.99 +            // <RAVE> substitute index.jsp with PortletPage1.jsp
  43.100 +            // FileObject indexJSPFo = getIndexJSPFFO(webRoot, "index"); //NOI18N
  43.101 +            // assert indexJSPFo != null : "webRoot: " + webRoot + ", defaultJSP: index";//NOI18N
  43.102 +            FileObject indexJSPFo = getIndexJSPFFO(webRoot, "PortletPage1"); //NOI18N
  43.103 +            JsfProjectUtils.putProjectProperty(project,
  43.104 +                    JsfProjectConstants.PROJECT_SUPPORTS_PORTLETS, "true"); // NOI18N
  43.105 +            Object wizardPortletNameObj = wiz.getProperty(PortletWizardProperties.PORTLET_NAME);
  43.106 +            /**
  43.107 +             * Add name and context path to the project properties.
  43.108 +             */
  43.109 +            if(null != wizardPortletNameObj && wizardPortletNameObj instanceof String) {
  43.110 +                JsfProjectUtils.putProjectProperty(project,
  43.111 +                        JsfProjectConstants.PORTLET_NAME,(String)wizardPortletNameObj); // NOI18N
  43.112 +            }
  43.113 +
  43.114 +            if(null != contextPath) {
  43.115 +                JsfProjectUtils.putProjectProperty(project,
  43.116 +                        JsfProjectConstants.PORTLET_CONTEXTPATH,contextPath); // NOI18N
  43.117 +            }
  43.118 +           
  43.119 +            assert indexJSPFo != null : "webRoot: " + webRoot + ", defaultJSP: PortletPage1";//NOI18N
  43.120 +            // </RAVE>
  43.121 +            // Returning FileObject of main class, will be called its preferred action
  43.122 +            resultSet.add(indexJSPFo);
  43.123 +        } catch (Exception e) {
  43.124 +            ErrorManager.getDefault().notify(e);
  43.125 +        }
  43.126 +        
  43.127 +        Integer index = (Integer) wiz.getProperty(PROP_NAME_INDEX);
  43.128 +        if(index != null) {
  43.129 +            FoldersListSettings.getDefault().setNewProjectCount(index.intValue());
  43.130 +        }
  43.131 +        
  43.132 +        setPortletDDValues(project,wiz);
  43.133 +        
  43.134 +        
  43.135 +        wiz.putProperty(WizardProperties.NAME, null); // reset project name
  43.136 +        
  43.137 +//        Project earProject = (Project) wiz.getProperty(WizardProperties.EAR_APPLICATION);
  43.138 +//        WebProject createdWebProject = (WebProject) ProjectManager.getDefault().findProject(dir);
  43.139 +//        if (earProject != null && createdWebProject != null) {
  43.140 +//            Ear ear = Ear.getEar(earProject.getProjectDirectory());
  43.141 +//            if (ear != null) {
  43.142 +//                ear.addWebModule(createdWebProject.getAPIWebModule());
  43.143 +//            }
  43.144 +//        }
  43.145 +        
  43.146 +        // save last project location
  43.147 +        dirF = (dirF != null) ? dirF.getParentFile() : null;
  43.148 +        if (dirF != null && dirF.exists()) {
  43.149 +            ProjectChooser.setProjectsFolder(dirF);
  43.150 +        }
  43.151 +        
  43.152 +        resultSet.add(dir);
  43.153 +        
  43.154 +        // Returning set of FileObject of project diretory.
  43.155 +        // Project will be open and set as main
  43.156 +        return resultSet;
  43.157 +    }
  43.158 +    
  43.159 +    private void setPortletDDValues(Project inProject,WizardDescriptor inWiz) {
  43.160 +        PortletApp portletApp = null;
  43.161 +        
  43.162 +        /**
  43.163 +         * First get the portlet.xml file from the project directory
  43.164 +         */
  43.165 +        FileObject webRootFO = inProject.getProjectDirectory().getFileObject("web/WEB-INF");//NOI18N
  43.166 +        if(null == webRootFO) {
  43.167 +            // TODO write some log message
  43.168 +            return;
  43.169 +        }
  43.170 +        FileObject portletXMLFO = webRootFO.getFileObject("portlet.xml"); //NOI18N
  43.171 +        File portletXMLFile = FileUtil.toFile(portletXMLFO);
  43.172 +        
  43.173 +        try {
  43.174 +            /**
  43.175 +             * Create the portlet application
  43.176 +             */
  43.177 +            portletApp = PortletApp.read(portletXMLFile);
  43.178 +            
  43.179 +            if(null!=portletApp) {
  43.180 +                /**
  43.181 +                 * Now get the Portlets in the portlet application.
  43.182 +                 * NOTE- we only expect there to be one portlet per project so
  43.183 +                 * we will only deal with the first portlet.
  43.184 +                 */
  43.185 +                PortletType [] portletType = portletApp.getPortlet();
  43.186 +                if(null != portletType) {
  43.187 +                    /**
  43.188 +                     * NAME
  43.189 +                     *
  43.190 +                     * Set the portlet Name
  43.191 +                     */
  43.192 +                    
  43.193 +                    Object wizardPortletNameObj = inWiz.getProperty(PortletWizardProperties.PORTLET_NAME);
  43.194 +                    if(null != wizardPortletNameObj && wizardPortletNameObj instanceof String) {
  43.195 +                        portletType[0].setPortletName((String)wizardPortletNameObj);
  43.196 +                    }
  43.197 +                  
  43.198 +                    /**
  43.199 +                     * DISPLAYNAME
  43.200 +                     *
  43.201 +                     * Set the portlet display name. This is two parts. The DD
  43.202 +                     * can have multiple locale specific display names each with a
  43.203 +                     * display name and a locale.
  43.204 +                     *
  43.205 +                     * Note-IF and WHEN we support multiple locales to be input in Creator,
  43.206 +                     * we'll need to change this code to handle all the locales.
  43.207 +                     *
  43.208 +                     * First we remove all the display names then add our own.
  43.209 +                     */
  43.210 +                    //TODO support multiple locales
  43.211 +                    
  43.212 +                    String [] displayNames = portletType[0].getDisplayName();
  43.213 +                    for(int ii=0; null != displayNames && ii < displayNames.length;ii++) {
  43.214 +                        portletType[0].removeDisplayName(displayNames[ii]);
  43.215 +                    }
  43.216 +                    
  43.217 +                    Object wizardPortletDisplayNameObj = inWiz.getProperty(PortletWizardProperties.PORTLET_DISPLAYNAME);
  43.218 +                    if(null != wizardPortletDisplayNameObj && wizardPortletDisplayNameObj instanceof String) {
  43.219 +                        portletType[0].addDisplayName((String)wizardPortletDisplayNameObj);
  43.220 +                    }
  43.221 +                    
  43.222 +                    /**
  43.223 +                     * DESCRIPTION
  43.224 +                     *
  43.225 +                     * We need to do the same with descriptions as with the display name.
  43.226 +                     */
  43.227 +                    //TODO support multiple locales
  43.228 +                    String [] descriptions = portletType[0].getDescription();
  43.229 +                    for(int ii=0; null != descriptions && ii < descriptions.length;ii++) {
  43.230 +                        portletType[0].removeDescription(descriptions[ii]);
  43.231 +                    }
  43.232 +                    
  43.233 +                    Object wizardPortletDescObj = inWiz.getProperty(PortletWizardProperties.PORTLET_DESC);
  43.234 +                    if(null != wizardPortletDescObj && wizardPortletDescObj instanceof String) {
  43.235 +                        portletType[0].addDescription((String)wizardPortletDescObj);
  43.236 +                    }
  43.237 +                    
  43.238 +                    /**
  43.239 +                     * TITLE
  43.240 +                     * SHORTTITLE
  43.241 +                     *
  43.242 +                     * remove the PortletInfo and add a new one.
  43.243 +                     *
  43.244 +                     */
  43.245 +                    
  43.246 +                    PortletInfoType portletInfoType = portletType[0].getPortletInfo();
  43.247 +                    if(null != portletInfoType) {
  43.248 +                        Object wizardPortletTitleObj = inWiz.getProperty(PortletWizardProperties.PORTLET_TITLE);
  43.249 +                        if(null != wizardPortletTitleObj && wizardPortletTitleObj instanceof String) {
  43.250 +                            portletInfoType.setTitle((String)wizardPortletTitleObj);
  43.251 +                        }
  43.252 +                        Object wizardPortletShortTitleObj = inWiz.getProperty(PortletWizardProperties.PORTLET_SHORTTITLE);
  43.253 +                        if(null != wizardPortletShortTitleObj && wizardPortletShortTitleObj instanceof String) {
  43.254 +                            portletInfoType.setShortTitle((String)wizardPortletShortTitleObj);
  43.255 +                        }
  43.256 +                        
  43.257 +                    }
  43.258 +                    
  43.259 +                    
  43.260 +                    /**
  43.261 +                     * INITIAL_VIEW
  43.262 +                     *
  43.263 +                     * Set the initial view page for the JSF-Portlet bridge.  We can have
  43.264 +                     * multiple "init_param"s so remove all of them and then add ours.
  43.265 +                     *
  43.266 +                     */
  43.267 +                    //TODO handle user init_params
  43.268 +                    InitParamType [] initParams = portletType[0].getInitParam();
  43.269 +                    for(int ii=0; null != initParams && ii < initParams.length;ii++) {
  43.270 +                        portletType[0].removeInitParam(initParams[ii]);
  43.271 +                    }
  43.272 +                    
  43.273 +                    InitParamType initialViewInitParam = new InitParamType(JsfPortletDDProperties.INIT_VIEW,"/PortletPage1.jsp"); //NOI18N
  43.274 +                    //TODO There should be a better way to get the name of the default first page, "PortletPage1.jsp".
  43.275 +                    portletType[0].addInitParam(initialViewInitParam);
  43.276 +                    
  43.277 +                    
  43.278 +                    
  43.279 +                    
  43.280 +                }
  43.281 +                
  43.282 +                portletApp.write(portletXMLFile);
  43.283 +                
  43.284 +                
  43.285 +            }
  43.286 +            
  43.287 +        } catch(IOException ioe) {
  43.288 +            ErrorManager.getDefault().notify(ioe);
  43.289 +        } catch(ParserConfigurationException pce) {
  43.290 +            ErrorManager.getDefault().notify(pce);
  43.291 +        } catch(SAXException se) {
  43.292 +            ErrorManager.getDefault().notify(se);
  43.293 +        }
  43.294 +    }
  43.295 +    
  43.296 +    
  43.297 +    public void initialize(WizardDescriptor wiz) {
  43.298 +        this.wiz = wiz;
  43.299 +        index = 0;
  43.300 +        panels = createPanels(wiz);
  43.301 +        // Make sure list of steps is accurate.
  43.302 +        String[] steps = createSteps();
  43.303 +        wiz.putProperty("WizardPanel_contentData", steps); // NOI18N
  43.304 +        
  43.305 +        for (int i = 0; i < panels.length; i++) {
  43.306 +            Component c = panels[i].getComponent();
  43.307 +            if (steps[i] == null) {
  43.308 +                // Default step name to component name of panel.
  43.309 +                // Mainly useful for getting the name of the target
  43.310 +                // chooser to appear in the list of steps.
  43.311 +                steps[i] = c.getName();
  43.312 +            }
  43.313 +            if (c instanceof JComponent) { // assume Swing components
  43.314 +                JComponent jc = (JComponent)c;
  43.315 +                // Step #.
  43.316 +                jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i)); // NOI18N
  43.317 +                // Step name (actually the whole list for reference).
  43.318 +                jc.putClientProperty("WizardPanel_contentData", steps); // NOI18N
  43.319 +            }
  43.320 +        }
  43.321 +    }
  43.322 +    public void uninitialize(WizardDescriptor wiz) {
  43.323 +        this.wiz.putProperty(WizardProperties.PROJECT_DIR,null);
  43.324 +        this.wiz.putProperty(WizardProperties.NAME,null);
  43.325 +        this.wiz = null;
  43.326 +        panels = null;
  43.327 +    }
  43.328 +    
  43.329 +    public String name() {
  43.330 +        return MessageFormat.format(NbBundle.getMessage(PortletProjectWizardIterator.class, "LBL_WizardStepsCount"), new String[] {(new Integer(index + 1)).toString(), (new Integer(panels.length)).toString()}); //NOI18N
  43.331 +    }
  43.332 +    
  43.333 +    public boolean hasNext() {
  43.334 +        return index < panels.length - 1;
  43.335 +    }
  43.336 +    public boolean hasPrevious() {
  43.337 +        return index > 0;
  43.338 +    }
  43.339 +    public void nextPanel() {
  43.340 +        if (!hasNext()) throw new NoSuchElementException();
  43.341 +        index++;
  43.342 +        panelConfigureProject.readSettings(wiz);
  43.343 +        portletProjectDeploymentDescriptor.readSettings(wiz);
  43.344 +        
  43.345 +    }
  43.346 +    public void previousPanel() {
  43.347 +        if (!hasPrevious()) throw new NoSuchElementException();
  43.348 +        index--;
  43.349 +    }
  43.350 +    public WizardDescriptor.Panel current() {
  43.351 +        return panels[index];
  43.352 +    }
  43.353 +    
  43.354 +    // If nothing unusual changes in the middle of the wizard, simply:
  43.355 +    public final void addChangeListener(ChangeListener l) {}
  43.356 +    public final void removeChangeListener(ChangeListener l) {}
  43.357 +    
  43.358 +    // helper methods, finds indexJSPF's FileObject
  43.359 +    private FileObject getIndexJSPFFO(FileObject webRoot, String indexJSP) {
  43.360 +        // replace '.' with '/'
  43.361 +        indexJSP = indexJSP.replace('.', '/'); // NOI18N
  43.362 +        
  43.363 +        // ignore unvalid mainClass ???
  43.364 +        
  43.365 +        return webRoot.getFileObject(indexJSP, "jsp"); // NOI18N
  43.366 +    }
  43.367 +    
  43.368 +    /**
  43.369 +     * Provides the project template to be used to instantiate the project contents
  43.370 +     * May be overridden by subclasses to produce project variants
  43.371 +     * @return The project template class that will perform the instantiation of project contents
  43.372 +     */
  43.373 +    protected ProjectTemplate getTemplate() {
  43.374 +        return new JsfPortletProjectTemplate();
  43.375 +    }
  43.376 +    
  43.377 +}
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PortletWizardProperties.java	Sun Jan 28 18:54:08 2007 +0000
    44.3 @@ -0,0 +1,24 @@
    44.4 +/*
    44.5 + * {START_JAVA_COPYRIGHT_NOTICE
    44.6 + * Copyright 2002-2005 Sun Microsystems, Inc. All rights reserved.
    44.7 + * SUN PROPRIETARY/CONFIDENTIAL.
    44.8 + * Use is subject to license terms.
    44.9 + * END_COPYRIGHT_NOTICE}
   44.10 + */
   44.11 +
   44.12 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
   44.13 +
   44.14 +/**
   44.15 + * This class encapsulates the properties appropriate for the Portlet project wizard.
   44.16 + * @author David Botterill
   44.17 + */
   44.18 +public class PortletWizardProperties {
   44.19 +    
   44.20 +    public static String PORTLET_NAME="portlet.name";
   44.21 +    public static String PORTLET_DISPLAYNAME="portlet.displayname";
   44.22 +    public static String PORTLET_DESC="portlet.description";
   44.23 +    public static String PORTLET_TITLE="portlet.title";
   44.24 +    public static String PORTLET_SHORTTITLE="portlet.shorttitle";
   44.25 +    
   44.26 +    
   44.27 +}
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/SettingsPanel.java	Sun Jan 28 18:54:08 2007 +0000
    45.3 @@ -0,0 +1,22 @@
    45.4 +/*
    45.5 + * {START_JAVA_COPYRIGHT_NOTICE
    45.6 + * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
    45.7 + * Use is subject to license terms.
    45.8 + * END_COPYRIGHT_NOTICE}
    45.9 + */
   45.10 +
   45.11 +
   45.12 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
   45.13 +
   45.14 +import javax.swing.JPanel;
   45.15 +import org.openide.WizardDescriptor;
   45.16 +
   45.17 +
   45.18 +abstract class SettingsPanel extends JPanel {
   45.19 +
   45.20 +    abstract void store (WizardDescriptor settings);
   45.21 +
   45.22 +    abstract void read (WizardDescriptor settings);
   45.23 +
   45.24 +    abstract boolean valid (WizardDescriptor settings);
   45.25 +}
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Utils.java	Sun Jan 28 18:54:08 2007 +0000
    46.3 @@ -0,0 +1,265 @@
    46.4 +/*
    46.5 + * {START_JAVA_COPYRIGHT_NOTICE
    46.6 + * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
    46.7 + * Use is subject to license terms.
    46.8 + * END_COPYRIGHT_NOTICE}
    46.9 + */
   46.10 +
   46.11 +
   46.12 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
   46.13 +
   46.14 +import java.util.Vector;
   46.15 +import org.openide.filesystems.FileObject;
   46.16 +import org.openide.filesystems.FileUtil;
   46.17 +import org.netbeans.spi.project.support.ant.AntProjectHelper;
   46.18 +import org.netbeans.spi.project.support.ant.EditableProperties;
   46.19 +
   46.20 +import javax.swing.*;
   46.21 +import java.awt.*;
   46.22 +import java.beans.PropertyChangeEvent;
   46.23 +import java.beans.PropertyChangeListener;
   46.24 +import java.io.File;
   46.25 +import java.io.IOException;
   46.26 +import org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment;
   46.27 +
   46.28 +import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
   46.29 +import org.openide.DialogDescriptor;
   46.30 +import org.openide.DialogDisplayer;
   46.31 +import org.openide.util.NbBundle;
   46.32 +
   46.33 +
   46.34 +public class Utils {
   46.35 +
   46.36 +    // COPIED FROM TOMCAT
   46.37 +    private static final String javaKeywords[] = {
   46.38 +        "abstract", "assert", "boolean", "break", "byte", "case",
   46.39 +        "catch", "char", "class", "const", "continue",
   46.40 +        "default", "do", "double", "else", "enum", "extends",
   46.41 +        "final", "finally", "float", "for", "goto",
   46.42 +        "if", "implements", "import", "instanceof", "int",
   46.43 +        "interface", "long", "native", "new", "package",
   46.44 +        "private", "protected", "public", "return", "short",
   46.45 +        "static", "strictfp", "super", "switch", "synchronized",
   46.46 +        "this", "throws", "transient", "try", "void",
   46.47 +        "volatile", "while" };
   46.48 +
   46.49 +    private static final String JSP_PACKAGE_NAME = "org.apache.jsp";
   46.50 +    
   46.51 +    private static final String PLATFORM_ANT_NAME = "platform.ant.name"; //NOI18N
   46.52 +    public static final String SPECIFICATION_J2SE = "j2se";              //NOI18N
   46.53 +
   46.54 +    public static File getRoot(File f) {
   46.55 +        File rootF = f;
   46.56 +        while (rootF.getParentFile() != null) {
   46.57 +            rootF = rootF.getParentFile();
   46.58 +        }
   46.59 +        return rootF;
   46.60 +    }
   46.61 +
   46.62 +    public static FileObject getValidDir(File dir) throws IOException {
   46.63 +        final File f = dir.getCanonicalFile();
   46.64 +        f.mkdirs();
   46.65 +        if (!f.exists()) {
   46.66 +            throw new IOException("No such dir on disk: " + f);
   46.67 +        }
   46.68 +        if (!f.isDirectory()) {
   46.69 +            throw new IOException("Not really a dir" + ": " + f);
   46.70 +        }
   46.71 +        return FileUtil.toFileObject(f);
   46.72 +    }
   46.73 +
   46.74 +    public static FileObject getValidEmptyDir(File dir) throws IOException {
   46.75 +        final FileObject fo = getValidDir(dir);
   46.76 +        if (fo.getChildren().length != 0) {
   46.77 +            throw new IOException("Dir has to be empty: " + dir);
   46.78 +        }
   46.79 +        return fo;
   46.80 +    }
   46.81 +
   46.82 +    /**
   46.83 +     * Updates property file at given location of ant based project
   46.84 +     * @param h helper of the project
   46.85 +     * @param path a relative URI in the project directory
   46.86 +     * @param ep new or updated properties
   46.87 +     */
   46.88 +    public static void updateProperties(AntProjectHelper h, String path, EditableProperties ep) {
   46.89 +        EditableProperties properties = h.getProperties(path);
   46.90 +        properties.putAll(ep);
   46.91 +        h.putProperties(path, properties);
   46.92 +    }
   46.93 +
   46.94 +    /**
   46.95 +     * Recursively checks whether the file lies underneath or equals the folder
   46.96 +     * @param folder the root of folders hierarchy to search in 
   46.97 +     * @param file the file to search for
   46.98 +     * @return <code>true</code>, if <code>file</code> lies somewhere underneath or equals the <code>folder</code>,
   46.99 +     * <code>false</code> otherwise
  46.100 +     */
  46.101 +    public static boolean isParentOrEqual(File folder, File file) {
  46.102 +        if(folder != null || file != null) {
  46.103 +            folder = FileUtil.normalizeFile(folder);
  46.104 +            file = FileUtil.normalizeFile(file);
  46.105 +            while(file != null) {
  46.106 +                if(file.equals(folder)) {
  46.107 +                    return true;
  46.108 +                }
  46.109 +                file = file.getParentFile();
  46.110 +            }
  46.111 +        }
  46.112 +        return false;
  46.113 +    }
  46.114 +
  46.115 +
  46.116 +    // COPIED FROM TOMCAT
  46.117 +    /** Returns a slash-delimited resource path for the servlet generated from 
  46.118 +     * JSP, given a resource path of the original JSP. Uses code copied from Tomcat.
  46.119 +     * Note: does not handle tag files yet, only JSP files.
  46.120 +     */
  46.121 +    static String getGeneratedJavaResource(String jspUri) {
  46.122 +        int iSep = jspUri.lastIndexOf('/');
  46.123 +        String packageName = (iSep > 0) ? makeJavaPackage(jspUri.substring(0,iSep)) : ""; // NOI18N
  46.124 +        if (packageName.length() == 0) {
  46.125 +            packageName = JSP_PACKAGE_NAME;
  46.126 +        }
  46.127 +        else {
  46.128 +            packageName = JSP_PACKAGE_NAME + "." + packageName; // NOI18N
  46.129 +        }
  46.130 +        String className = makeJavaIdentifier(jspUri.substring(iSep + 1));
  46.131 +        return packageName.replace('.', '/') + "/" + className + ".java"; // NOI18N
  46.132 +    }
  46.133 +    
  46.134 +    // COPIED FROM TOMCAT
  46.135 +    /**
  46.136 +     * Converts the given path to a Java package or fully-qualified class name
  46.137 +     *
  46.138 +     * @param path Path to convert
  46.139 +     *
  46.140 +     * @return Java package corresponding to the given path
  46.141 +     */
  46.142 +    private static final String makeJavaPackage(String path) {
  46.143 +        String classNameComponents[] = split(path,"/");
  46.144 +        StringBuffer legalClassNames = new StringBuffer();
  46.145 +        for (int i = 0; i < classNameComponents.length; i++) {
  46.146 +            legalClassNames.append(makeJavaIdentifier(classNameComponents[i]));
  46.147 +            if (i < classNameComponents.length - 1) {
  46.148 +                legalClassNames.append('.');
  46.149 +            }
  46.150 +        }
  46.151 +        return legalClassNames.toString();
  46.152 +    }
  46.153 +    
  46.154 +    // COPIED FROM TOMCAT
  46.155 +    /**
  46.156 +     * Splits a string into it's components.
  46.157 +     * @param path String to split
  46.158 +     * @param pat Pattern to split at
  46.159 +     * @return the components of the path
  46.160 +     */
  46.161 +    private static final String [] split(String path, String pat) {
  46.162 +        Vector comps = new Vector();
  46.163 +        int pos = path.indexOf(pat);
  46.164 +        int start = 0;
  46.165 +        while( pos >= 0 ) {
  46.166 +            if(pos > start ) {
  46.167 +                String comp = path.substring(start,pos);
  46.168 +                comps.add(comp);
  46.169 +            }
  46.170 +            start = pos + pat.length();
  46.171 +            pos = path.indexOf(pat,start);
  46.172 +        }
  46.173 +        if( start < path.length()) {
  46.174 +            comps.add(path.substring(start));
  46.175 +        }
  46.176 +        String [] result = new String[comps.size()];
  46.177 +        for(int i=0; i < comps.size(); i++) {
  46.178 +            result[i] = (String)comps.elementAt(i);
  46.179 +        }
  46.180 +        return result;
  46.181 +    }
  46.182 +            
  46.183 +    // COPIED FROM TOMCAT
  46.184 +    /**
  46.185 +     * Converts the given identifier to a legal Java identifier
  46.186 +     *
  46.187 +     * @param identifier Identifier to convert
  46.188 +     *
  46.189 +     * @return Legal Java identifier corresponding to the given identifier
  46.190 +     */
  46.191 +    private static final String makeJavaIdentifier(String identifier) {
  46.192 +        StringBuffer modifiedIdentifier = 
  46.193 +            new StringBuffer(identifier.length());
  46.194 +        if (!Character.isJavaIdentifierStart(identifier.charAt(0))) {
  46.195 +            modifiedIdentifier.append('_');
  46.196 +        }
  46.197 +        for (int i = 0; i < identifier.length(); i++) {
  46.198 +            char ch = identifier.charAt(i);
  46.199 +            if (Character.isJavaIdentifierPart(ch) && ch != '_') {
  46.200 +                modifiedIdentifier.append(ch);
  46.201 +            } else if (ch == '.') {
  46.202 +                modifiedIdentifier.append('_');
  46.203 +            } else {
  46.204 +                modifiedIdentifier.append(mangleChar(ch));
  46.205 +            }
  46.206 +        }
  46.207 +        if (isJavaKeyword(modifiedIdentifier.toString())) {
  46.208 +            modifiedIdentifier.append('_');
  46.209 +        }
  46.210 +        return modifiedIdentifier.toString();
  46.211 +    }
  46.212 +    
  46.213 +    // COPIED FROM TOMCAT
  46.214 +    /**
  46.215 +     * Mangle the specified character to create a legal Java class name.
  46.216 +     */
  46.217 +    private static final String mangleChar(char ch) {
  46.218 +        char[] result = new char[5];
  46.219 +        result[0] = '_';
  46.220 +        result[1] = Character.forDigit((ch >> 12) & 0xf, 16);
  46.221 +        result[2] = Character.forDigit((ch >> 8) & 0xf, 16);
  46.222 +        result[3] = Character.forDigit((ch >> 4) & 0xf, 16);
  46.223 +        result[4] = Character.forDigit(ch & 0xf, 16);
  46.224 +        return new String(result);
  46.225 +    }
  46.226 +
  46.227 +    // COPIED FROM TOMCAT
  46.228 +    /**
  46.229 +     * Test whether the argument is a Java keyword
  46.230 +     */
  46.231 +    private static boolean isJavaKeyword(String key) {
  46.232 +        int i = 0;
  46.233 +        int j = javaKeywords.length;
  46.234 +        while (i < j) {
  46.235 +            int k = (i+j)/2;
  46.236 +            int result = javaKeywords[k].compareTo(key);
  46.237 +            if (result == 0) {
  46.238 +                return true;
  46.239 +            }
  46.240 +            if (result < 0) {
  46.241 +                i = k+1;
  46.242 +            } else {
  46.243 +                j = k;
  46.244 +            }
  46.245 +        }
  46.246 +        return false;
  46.247 +    }
  46.248 +
  46.249 +    public static Color getErrorColor() {
  46.250 +        // inspired by org.openide.WizardDescriptor
  46.251 +        Color c = UIManager.getColor("nb.errorForeground"); //NOI18N
  46.252 +        return c == null ? new Color(89,79,191) : c;
  46.253 +    }
  46.254 +    
  46.255 +    public static String toClasspathString(File[] classpathEntries) {
  46.256 +        if (classpathEntries == null) {
  46.257 +            return "";
  46.258 +        }
  46.259 +        StringBuffer classpath = new StringBuffer();
  46.260 +        for (int i = 0; i < classpathEntries.length; i++) {
  46.261 +            classpath.append(classpathEntries[i].getAbsolutePath());
  46.262 +            if (i + 1 < classpathEntries.length) {
  46.263 +                classpath.append(":"); // NOI18N
  46.264 +            }
  46.265 +        }
  46.266 +        return classpath.toString();
  46.267 +    }
  46.268 +}
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/WizardProperties.java	Sun Jan 28 18:54:08 2007 +0000
    47.3 @@ -0,0 +1,38 @@
    47.4 +/*
    47.5 + *                 Sun Public License Notice
    47.6 + *
    47.7 + * The contents of this file are subject to the Sun Public License
    47.8 + * Version 1.0 (the "License"). You may not use this file except in
    47.9 + * compliance with the License. A copy of the License is available at
   47.10 + * http://www.sun.com/
   47.11 + *
   47.12 + * The Original Code is NetBeans. The Initial Developer of the Original
   47.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
   47.14 + * Microsystems, Inc. All Rights Reserved.
   47.15 + */
   47.16 +
   47.17 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
   47.18 +
   47.19 +public class WizardProperties {
   47.20 +    public static final String PROJECT_DIR = "projdir"; //NOI18N
   47.21 +    public static final String NAME = "name"; //NOI18N
   47.22 +    public static final String SOURCE_ROOT = "sourceRoot"; //NOI18N
   47.23 +    
   47.24 +    public static final String SET_AS_MAIN = "setAsMain"; //NOI18N
   47.25 +    public static final String SERVER_INSTANCE_ID = "serverInstanceID"; //NOI18N
   47.26 +    public static final String J2EE_LEVEL = "j2eeLevel"; //NOI18N
   47.27 +    public static final String SOURCE_STRUCTURE = "sourceStructure"; //NOI18N
   47.28 +    public static final String CONTEXT_PATH = "contextPath"; //NOI18N
   47.29 +    
   47.30 +    public static final String DOC_BASE = "docBase"; //NOI18N
   47.31 +    public static final String JAVA_ROOT = "javaRoot"; //NOI18N
   47.32 +    public static final String LIB_FOLDER = "libFolder"; //NOI18N
   47.33 +    public static final String TEST_ROOT = "testRoot"; //NOI18N
   47.34 +    
   47.35 +    public static final String EAR_APPLICATION = "earApplication"; //NOI18N
   47.36 +    
   47.37 +    public static final String JAVA_PLATFORM = "setJavaPlatform"; // NOI18N
   47.38 +    public static final String SOURCE_LEVEL = "setSourceLevel"; // NOI18N
   47.39 +    
   47.40 +    public static final String FRAMEWORKS = "frameworks"; // NOI18N
   47.41 +}
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/resources/Bundle.properties	Sun Jan 28 18:54:08 2007 +0000
    48.3 @@ -0,0 +1,16 @@
    48.4 +#
    48.5 +#                 Sun Public License Notice
    48.6 +# 
    48.7 +# The contents of this file are subject to the Sun Public License
    48.8 +# Version 1.0 (the "License"). You may not use this file except in
    48.9 +# compliance with the License. A copy of the License is available at
   48.10 +# http://www.sun.com/
   48.11 +# 
   48.12 +# The Original Code is NetBeans. The Initial Developer of the Original
   48.13 +# Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
   48.14 +# Microsystems, Inc. All Rights Reserved.
   48.15 +#
   48.16 +
   48.17 +#System file system
   48.18 +Templates/Project/Web/portletProject.xml=JSR-168 JSF Portlet Project
   48.19 +
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/visualweb/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/resources/PortletProject.html	Sun Jan 28 18:54:08 2007 +0000
    49.3 @@ -0,0 +1,26 @@
    49.4 +<!--
    49.5 +The contents of this file are subject to the terms of the Common Development
    49.6 +and Distribution License (the License). You may not use this file except in
    49.7 +compliance with the License.
    49.8 +
    49.9 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   49.10 +or http://www.netbeans.org/cddl.txt.
   49.11 +
   49.12 +When distributing Covered Code, include this CDDL Header Notice in each file
   49.13 +and include the License file at http://www.netbeans.org/cddl.txt.
   49.14 +If applicable, add the following below the CDDL Header, with the fields
   49.15 +enclosed by brackets [] replaced by your own identifying information:
   49.16 +"Portions Copyrighted [year] [name of copyright owner]"
   49.17 +
   49.18 +The Original Software is NetBeans. The Initial Developer of the Original
   49.19 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   49.20 +Microsystems, Inc. All Rights Reserved.
   49.21 +-->
   49.22 +
   49.23 +
   49.24 +
   49.25 +<HTML>
   49.26 +  <BODY>
   49.27 +    Select JSR-168 JSF Portlet Project to build a JSR-168 compliant portlet application containing one portlet.
   49.28 +  </BODY>
   49.29 +</HTML>
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/CheckLicense.java	Sun Jan 28 18:54:08 2007 +0000
    50.3 @@ -0,0 +1,492 @@
    50.4 +/*
    50.5 + * The contents of this file are subject to the terms of the Common Development
    50.6 + * and Distribution License (the License). You may not use this file except in
    50.7 + * compliance with the License.
    50.8 + *
    50.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   50.10 + * or http://www.netbeans.org/cddl.txt.
   50.11 +
   50.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   50.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   50.14 + * If applicable, add the following below the CDDL Header, with the fields
   50.15 + * enclosed by brackets [] replaced by your own identifying information:
   50.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   50.17 + *
   50.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   50.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   50.20 + * Microsystems, Inc. All Rights Reserved.
   50.21 + */
   50.22 +
   50.23 +package org.netbeans.modules.visualweb.ravebuild;
   50.24 +
   50.25 +
   50.26 +import java.io.BufferedReader;
   50.27 +import java.io.BufferedWriter;
   50.28 +import java.io.File;
   50.29 +import java.io.FileInputStream;
   50.30 +import java.io.FileOutputStream;
   50.31 +import java.io.FileReader;
   50.32 +import java.io.FileWriter;
   50.33 +import java.io.IOException;
   50.34 +import java.io.Reader;
   50.35 +import java.util.ArrayList;
   50.36 +import java.util.Iterator;
   50.37 +import java.util.List;
   50.38 +import java.util.Vector;
   50.39 +import java.util.regex.Matcher;
   50.40 +import java.util.regex.Pattern;
   50.41 +
   50.42 +import org.apache.tools.ant.BuildException;
   50.43 +import org.apache.tools.ant.FileScanner;
   50.44 +import org.apache.tools.ant.Project;
   50.45 +import org.apache.tools.ant.Task;
   50.46 +import org.apache.tools.ant.types.FileSet;
   50.47 +
   50.48 +/** Check source files for a license notice.
   50.49 + * @author Jesse Glick
   50.50 + */
   50.51 +public class CheckLicense extends Task {
   50.52 +
   50.53 +    private final List filesets = new ArrayList (1); // List<FileSet>
   50.54 +    private String fragment;
   50.55 +    private List fragments; // List<Fragment>
   50.56 +    private License license;
   50.57 +    private ArrayList delimiters;
   50.58 +    private boolean replaceonly = false;
   50.59 +
   50.60 +    /** Add a file set of source files to check.
   50.61 +     * @param fs set of files to check licenses of
   50.62 +     */
   50.63 +    public void addFileSet (FileSet fs) {
   50.64 +        filesets.add (fs);
   50.65 +    }
   50.66 +    
   50.67 +    /** Add a file set of CVS-controlled source files to check.
   50.68 +     * @param fs set of files to check licenses of
   50.69 +     */
   50.70 +    public void addCvsFileSet(CvsFileSet fs) {
   50.71 +        filesets.add(fs);
   50.72 +    }
   50.73 +
   50.74 +    /** Set the fragment of license notice which is expected
   50.75 +     * to be found in each source file.
   50.76 +     * @param f the fragment
   50.77 +     */
   50.78 +    public void setFragment (String f) {
   50.79 +        fragment = f;
   50.80 +    }
   50.81 +    
   50.82 +    public Convert createConvert() {
   50.83 +        Convert f = new Convert();
   50.84 +        if (fragments == null) {
   50.85 +            fragments = new ArrayList();
   50.86 +        }
   50.87 +        
   50.88 +        fragments.add(f);
   50.89 +        return f;
   50.90 +    }
   50.91 +    
   50.92 +    public void setReplaceonly(boolean b) {
   50.93 +        replaceonly = b;
   50.94 +    }
   50.95 +    
   50.96 +    public Delimiters createDelimiters() {
   50.97 +        Delimiters d = new Delimiters();
   50.98 +        if (delimiters == null) {
   50.99 +            delimiters = new ArrayList();
  50.100 +        }
  50.101 +        
  50.102 +        delimiters.add(d);
  50.103 +        return d;
  50.104 +    }
  50.105 +    
  50.106 +    public void addLicense(License license) {
  50.107 +        this.license = license;
  50.108 +    }
  50.109 +    
  50.110 +
  50.111 +    public void execute() throws BuildException {
  50.112 +        if (replaceonly == false) {
  50.113 +            if (fragment == null) {
  50.114 +                throw new BuildException("You must supply a fragment", getLocation());
  50.115 +            }
  50.116 +            
  50.117 +            if (filesets.isEmpty()) throw new BuildException("You must supply at least one fileset", getLocation());
  50.118 +            
  50.119 +            if (license == null) {
  50.120 +                throw new BuildException("The 'license' subelement must be defined",getLocation());
  50.121 +            }
  50.122 +            
  50.123 +            if (delimiters == null) {
  50.124 +                throw new BuildException("You must supply at least one delimiters element");
  50.125 +            }
  50.126 +        }
  50.127 +        Iterator it = filesets.iterator();
  50.128 +        String failMsg = null;
  50.129 +        try {
  50.130 +            while (it.hasNext()) {
  50.131 +                FileScanner scanner = ((FileSet) it.next()).getDirectoryScanner(getProject());
  50.132 +                File baseDir = scanner.getBasedir();
  50.133 +                String[] files = scanner.getIncludedFiles();
  50.134 +                log("Looking for " + fragment + " in " + files.length + " files in " + baseDir.getAbsolutePath());
  50.135 +                for (int i = 0; i < files.length; i++) {
  50.136 +                    File f = new File(baseDir, files[i]);
  50.137 +                    
  50.138 +                    if (replaceonly == false) {
  50.139 +                        //log("Scanning " + f, Project.MSG_VERBOSE);
  50.140 +                        BufferedReader br = new BufferedReader(new FileReader(f));
  50.141 +                        String line = null;
  50.142 +                        try {
  50.143 +                            while ((line = br.readLine()) != null) {
  50.144 +                                if (line.indexOf(fragment) != -1) {
  50.145 +                                    // Found it.
  50.146 +                                    break;
  50.147 +                                }
  50.148 +                            }
  50.149 +                        } finally {
  50.150 +                            br.close();
  50.151 +                        }
  50.152 +                        
  50.153 +                        if (line == null) {
  50.154 +                            removeOldLicense(f);
  50.155 +                            prependLicense(f);
  50.156 +                        }else {
  50.157 +                            updateLicense(f);
  50.158 +                        }
  50.159 +                    }else {
  50.160 +                        updateLicense(f);
  50.161 +                    }
  50.162 +                }
  50.163 +            }
  50.164 +            
  50.165 +            if (failMsg != null) {
  50.166 +                throw new BuildException(failMsg);
  50.167 +            }
  50.168 +            
  50.169 +        } catch (IOException ioe) {
  50.170 +            throw new BuildException("Could not open files to check licenses", ioe, getLocation());
  50.171 +        }
  50.172 +    }
  50.173 +    
  50.174 +    private void removeOldLicense(File f) throws BuildException {
  50.175 +        try {
  50.176 +            BufferedReader reader = new BufferedReader(new FileReader(f));
  50.177 +            Vector lines = new Vector();
  50.178 +            
  50.179 +            while (reader.ready()) {
  50.180 +                lines.add(reader.readLine());
  50.181 +            }
  50.182 +            reader.close();
  50.183 +            
  50.184 +            Pattern[] patterns = new Pattern[delimiters.size()];
  50.185 +            for (int i = 0; i < delimiters.size(); i++) {
  50.186 +                String middle = ((Delimiters)delimiters.get(i)).middle;
  50.187 +                patterns[i] = Pattern.compile("(\\s)*" + regex(middle) + ".*[Cc][Oo][Pp][Yy][Rr][Ii][Gg][Hh][Tt].*");
  50.188 +            }
  50.189 +            
  50.190 +            
  50.191 +            boolean changed = false;
  50.192 +            for (int i = 0; i < lines.size() && changed == false; i++) {
  50.193 +                String nextLine = (String)lines.get(i);
  50.194 +                
  50.195 +                // match a line that contains (start-string)...Copyright...
  50.196 +                for (int j = 0; j < patterns.length; j++) {
  50.197 +                    if (patterns[j].matcher(nextLine).matches()) {
  50.198 +                        log("Removing existing copyright from " + f.getAbsolutePath(), Project.MSG_INFO);
  50.199 +                        log("Matched line..." + nextLine);
  50.200 +                        deleteCopyright(lines, i, (Delimiters)delimiters.get(j));
  50.201 +                        changed = true;
  50.202 +                        break;                        
  50.203 +                    }
  50.204 +                    
  50.205 +                }
  50.206 +            }            
  50.207 +            if (changed) {
  50.208 +                BufferedWriter writer = new BufferedWriter(new FileWriter(f));
  50.209 +                
  50.210 +                for (int i = 0; i < lines.size(); i++) {
  50.211 +                    Object next = lines.get(i);
  50.212 +                    if (next != null) {
  50.213 +                        writer.write((String)next);
  50.214 +                        writer.newLine();
  50.215 +                    }
  50.216 +                }
  50.217 +                writer.close();
  50.218 +            }
  50.219 +            
  50.220 +        }catch (IOException ex) {
  50.221 +            throw new BuildException("Could not read/write files to delete old license", ex, getLocation());
  50.222 +        }
  50.223 +    }
  50.224 +    
  50.225 +    private String regex(String str) {
  50.226 +        StringBuffer buffer = new StringBuffer();
  50.227 +        for (int i = 0; i < str.length(); i++) {
  50.228 +            String hex = Integer.toHexString((int)str.charAt(i));
  50.229 +            buffer.append("\\x"+hex);
  50.230 +        }
  50.231 +        return buffer.toString();
  50.232 +    }
  50.233 +    
  50.234 +    private void deleteCopyright(Vector lines, int i, Delimiters delim) {
  50.235 +        String start = delim.start;
  50.236 +        String end = delim.end;
  50.237 +        
  50.238 +        // find the first line of the copyright comment block
  50.239 +        for (int j = i; j >= 0; j--) {
  50.240 +            String curLine = (String)lines.get(j);
  50.241 +            int index = (end == null) ? curLine.indexOf(start) : curLine.lastIndexOf(start);
  50.242 +            
  50.243 +            if (end == null) {
  50.244 +                if (index > 0) {
  50.245 +                    lines.set(j, curLine.substring(0,index));
  50.246 +                }else if (index == 0) {
  50.247 +                    lines.set(j, null);
  50.248 +                }else {
  50.249 +                    break;
  50.250 +                }
  50.251 +            }else {
  50.252 +                if (index > 0) {
  50.253 +                    lines.set(j, curLine.substring(0,index));
  50.254 +                    break;
  50.255 +                }else if (index == 0) {
  50.256 +                    lines.set(j,null);
  50.257 +                    break;
  50.258 +                }else {
  50.259 +                    lines.set(j,null);
  50.260 +                }
  50.261 +            }
  50.262 +        }
  50.263 +        
  50.264 +        
  50.265 +        // find the last line of the copyright comment block
  50.266 +        for (int j = i ; j < lines.size(); j++) {
  50.267 +            String curLine = (String)lines.get(j);
  50.268 +            
  50.269 +            if (curLine == null) {
  50.270 +                continue;
  50.271 +            }else if (end == null) {
  50.272 +                int index = curLine.indexOf(start);
  50.273 +                
  50.274 +                if (index > 0) {
  50.275 +                    lines.set(j, curLine.substring(0,index));
  50.276 +                }else if (index == 0) {
  50.277 +                    lines.set(j, null);
  50.278 +                }else {
  50.279 +                    break;
  50.280 +                }
  50.281 +            }else {
  50.282 +                int index = curLine.indexOf(end);
  50.283 +                int size = end.length();
  50.284 +                
  50.285 +                if (index == -1) {
  50.286 +                    lines.set(j, null);
  50.287 +                }else if (index == curLine.length() - size) {
  50.288 +                    lines.set(j, null);
  50.289 +                    break;
  50.290 +                }else {
  50.291 +                    lines.set(j, curLine.substring(index + size));
  50.292 +                    break;
  50.293 +                }
  50.294 +            }
  50.295 +        }  
  50.296 +    }
  50.297 +    
  50.298 +    private void prependLicense(File f) throws BuildException {
  50.299 +        try {
  50.300 +            log("Inserting license notice in " + f.getAbsolutePath(), Project.MSG_INFO);
  50.301 +            FileInputStream is = new FileInputStream(f);
  50.302 +            StringBuffer sb = new StringBuffer(1024);
  50.303 +            byte[] buffer = new byte[1024];
  50.304 +            int bufferLength;
  50.305 +        
  50.306 +            while ( (bufferLength = is.read(buffer)) != -1) {
  50.307 +                sb.append(new String(buffer, 0, bufferLength));
  50.308 +            }
  50.309 +            is.close();
  50.310 +            
  50.311 +            FileOutputStream os = new FileOutputStream(f);
  50.312 +            os.write(license.repl.getBytes());
  50.313 +            os.write(sb.toString().getBytes());
  50.314 +            os.close();
  50.315 +            
  50.316 +            
  50.317 +        }catch (IOException ex) {
  50.318 +            throw new BuildException("Could not read/write files to insert license", ex, getLocation());
  50.319 +        }
  50.320 +        
  50.321 +        
  50.322 +    }
  50.323 +    
  50.324 +    private void updateLicense(File file) throws BuildException {
  50.325 +        try {
  50.326 +            byte[] workingArray = new byte[4096];
  50.327 +            log("Processing " + file, Project.MSG_VERBOSE);
  50.328 +            
  50.329 +            FileInputStream is = new FileInputStream(file);
  50.330 +            int workingLength = is.read(workingArray);
  50.331 +            if (workingLength == -1) {
  50.332 +                log("Could not update license in " + file.getAbsoluteFile(), Project.MSG_WARN);
  50.333 +                return;
  50.334 +            }
  50.335 +            String workingString = new String(workingArray, 0, workingLength);
  50.336 +            boolean changed = false;
  50.337 +            String prefix = null;
  50.338 +            
  50.339 +            Iterator frags = fragments.iterator();
  50.340 +            while (frags.hasNext()) {
  50.341 +                Convert f = (Convert)frags.next();
  50.342 +                
  50.343 +                Matcher matcher = f.orig.matcher(workingString);
  50.344 +                
  50.345 +                while (matcher.find()) {
  50.346 +                    if (f.prefix) {
  50.347 +                        if (prefix != null) {
  50.348 +                            throw new BuildException("Only one convert element can be prefix!");
  50.349 +                        }
  50.350 +                        if (matcher.groupCount() != 1) {
  50.351 +                            throw new BuildException("There should be one group for the prefix element. Was: " + matcher.groupCount());
  50.352 +                        }
  50.353 +                        prefix = matcher.group(1);
  50.354 +                    }
  50.355 +                    
  50.356 +                    String before = workingString.substring(0, matcher.start());
  50.357 +                    String after = workingString.substring(matcher.end());
  50.358 +                    String middle = wrapWithPrefix(f.repl, prefix, before.length() == 0 || before.endsWith("\n"));
  50.359 +                    
  50.360 +                    if (!middle.equals(matcher.group(0))) {
  50.361 +                        workingString = before + middle + after;
  50.362 +                        log("Matched " + middle, Project.MSG_VERBOSE);
  50.363 +                        changed = true;
  50.364 +                    } else {
  50.365 +                        log("Matched, but no change: " + middle, Project.MSG_VERBOSE);
  50.366 +                    }
  50.367 +                    
  50.368 +                    if (!f.all) {
  50.369 +                        break;
  50.370 +                    } else {
  50.371 +                        matcher = f.orig.matcher(workingString);
  50.372 +                    }
  50.373 +                }
  50.374 +                
  50.375 +            }
  50.376 +            
  50.377 +            byte[] rest = null;
  50.378 +            if (is.available() > 0 && changed) {
  50.379 +                rest = new byte[is.available()];
  50.380 +                int read = is.read(rest);
  50.381 +                assert read == rest.length;
  50.382 +            }
  50.383 +            
  50.384 +            is.close();
  50.385 +            
  50.386 +            
  50.387 +            if (changed) {
  50.388 +                log("Rewriting " + file, Project.MSG_INFO);
  50.389 +                FileOutputStream os = new FileOutputStream(file);
  50.390 +                workingString = Pattern.compile(" +$", Pattern.MULTILINE).matcher(workingString+"X").replaceAll("");
  50.391 +                os.write(workingString.substring(0, workingString.length() - 1).getBytes());
  50.392 +                if (rest != null) {
  50.393 +                    os.write(rest);
  50.394 +                }
  50.395 +                os.close();
  50.396 +            }
  50.397 +        } catch (IOException ioe) {
  50.398 +            throw new BuildException("Could not open files to check license", ioe, getLocation());
  50.399 +        }
  50.400 +    }
  50.401 +
  50.402 +    private String wrapWithPrefix(String repl, String prefix, boolean startWithPrefix) {
  50.403 +        if (prefix == null) {
  50.404 +            return repl;
  50.405 +        }
  50.406 +        
  50.407 +        String[] all = repl.split("\n");
  50.408 +        StringBuffer sb = new StringBuffer();
  50.409 +        for (int i = 0; i < all.length; i++) {
  50.410 +            if (all[i].length() > 0) {
  50.411 +                if (startWithPrefix) {
  50.412 +                    sb.append(prefix);
  50.413 +                }
  50.414 +                sb.append(all[i]);
  50.415 +            }
  50.416 +            if (i < all.length - 1) {
  50.417 +                sb.append('\n');
  50.418 +            }
  50.419 +            startWithPrefix = true;
  50.420 +        }
  50.421 +        
  50.422 +        return sb.toString();
  50.423 +    }
  50.424 +
  50.425 +    
  50.426 +    public static final class Convert {
  50.427 +        Pattern orig;
  50.428 +        String repl;
  50.429 +        boolean prefix;
  50.430 +        boolean all;
  50.431 +        
  50.432 +        public void setToken(String orig) {
  50.433 +            this.orig = Pattern.compile(orig, Pattern.DOTALL | Pattern.MULTILINE);
  50.434 +        }
  50.435 +        public void setReplace(String repl) {
  50.436 +            this.repl = repl.replace("\\n", "\n").replace("\\t", "\t");
  50.437 +        }
  50.438 +        public void setPrefix(boolean b) {
  50.439 +            prefix = b;
  50.440 +        }
  50.441 +        public void setReplaceAll(boolean b) {
  50.442 +            all = b;
  50.443 +        }
  50.444 +        public Line createLine() {
  50.445 +            return new Line();
  50.446 +        }
  50.447 +                        
  50.448 +        public final class Line {
  50.449 +            public void setText(String t) {
  50.450 +                if (repl == null) {
  50.451 +                    repl = t;
  50.452 +                } else {
  50.453 +                    repl = repl + "\n" + t;
  50.454 +                }
  50.455 +            }
  50.456 +        }
  50.457 +    }
  50.458 +    
  50.459 +    public static final class Delimiters {
  50.460 +        String start;
  50.461 +        String middle;
  50.462 +        String end;
  50.463 +        
  50.464 +        public void setStart(String start) {
  50.465 +            this.start = start;
  50.466 +        }
  50.467 +        
  50.468 +        public void setMiddle(String middle) {
  50.469 +            this.middle = middle;
  50.470 +        }
  50.471 +        
  50.472 +        public void setEnd(String end) {
  50.473 +            this.end = end;
  50.474 +        }
  50.475 +    }
  50.476 +    
  50.477 +    public static final class License {
  50.478 +        String repl;
  50.479 +        
  50.480 +        public Line createLine() {
  50.481 +            return new Line();
  50.482 +        }
  50.483 +        
  50.484 +        public final class Line {
  50.485 +            public void setText(String t) {
  50.486 +                if (repl == null) {
  50.487 +                    repl = t;
  50.488 +                } else {
  50.489 +                    repl = repl + "\n" + t;
  50.490 +                }
  50.491 +            }
  50.492 +        }
  50.493 +        
  50.494 +    }
  50.495 +}
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/CvsFileSet.java	Sun Jan 28 18:54:08 2007 +0000
    51.3 @@ -0,0 +1,170 @@
    51.4 +/*
    51.5 + * The contents of this file are subject to the terms of the Common Development
    51.6 + * and Distribution License (the License). You may not use this file except in
    51.7 + * compliance with the License.
    51.8 + *
    51.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   51.10 + * or http://www.netbeans.org/cddl.txt.
   51.11 +
   51.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   51.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   51.14 + * If applicable, add the following below the CDDL Header, with the fields
   51.15 + * enclosed by brackets [] replaced by your own identifying information:
   51.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   51.17 + *
   51.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   51.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   51.20 + * Microsystems, Inc. All Rights Reserved.
   51.21 + */
   51.22 +
   51.23 +package org.netbeans.modules.visualweb.ravebuild;
   51.24 +
   51.25 +import java.io.BufferedReader;
   51.26 +import java.io.File;
   51.27 +import java.io.FileReader;
   51.28 +import java.io.IOException;
   51.29 +import java.io.Reader;
   51.30 +import java.util.Collections;
   51.31 +import java.util.HashMap;
   51.32 +import java.util.HashSet;
   51.33 +import java.util.Map;
   51.34 +import java.util.Set;
   51.35 +import org.apache.tools.ant.BuildException;
   51.36 +import org.apache.tools.ant.DirectoryScanner;
   51.37 +import org.apache.tools.ant.Project;
   51.38 +import org.apache.tools.ant.types.EnumeratedAttribute;
   51.39 +import org.apache.tools.ant.types.FileSet;
   51.40 +
   51.41 +/** A special fileset permitting exclusions based on CVS characteristics.
   51.42 + * @author Jesse Glick
   51.43 + */
   51.44 +public class CvsFileSet extends FileSet {
   51.45 +    
   51.46 +    /** Filtering mode for CVS filesets.
   51.47 +     */
   51.48 +    public static final class Mode extends EnumeratedAttribute {
   51.49 +        public String[] getValues() {
   51.50 +            return new String[] {
   51.51 +                "controlled",
   51.52 +                "uncontrolled",
   51.53 +                "text",
   51.54 +                "binary",
   51.55 +            };
   51.56 +        }
   51.57 +    }
   51.58 +    
   51.59 +    private String mode = "controlled";
   51.60 +    
   51.61 +    /** Set filtering mode.
   51.62 +     * @param m The mode to use:
   51.63 +     * <dl>
   51.64 +     * <dt><code>controlled</code> (default)
   51.65 +     * <dd>Only files under CVS control are matched.
   51.66 +     * <dt><code>uncontrolled</code>
   51.67 +     * <dd>Only files not under CVS control are matched.
   51.68 +     * <dt><code>text</code>
   51.69 +     * <dd>Only files under CVS control and marked as textual are matched.
   51.70 +     * <dt><code>binary</code>
   51.71 +     * <dd>Only files under CVS control and marked as binary are matched.
   51.72 +     * </dl>
   51.73 +     */
   51.74 +    public void setMode(Mode m) {
   51.75 +        mode = m.getValue();
   51.76 +    }
   51.77 +    
   51.78 +    public DirectoryScanner getDirectoryScanner(Project proj) throws BuildException {
   51.79 +        DirectoryScanner scan = new CvsDirectoryScanner();
   51.80 +        setupDirectoryScanner(scan, proj);
   51.81 +        scan.scan();
   51.82 +        return scan;
   51.83 +    }
   51.84 +    
   51.85 +    private static final Set[] NO_ENTRIES = new Set[] {Collections.EMPTY_SET, Collections.EMPTY_SET};
   51.86 +        
   51.87 +    private class CvsDirectoryScanner extends DirectoryScanner {
   51.88 +        
   51.89 +        // Map from dirs to parsed CVS/Entries, being set of text and binary filenames
   51.90 +        private final Map entries = new HashMap(100); // Map<File,Set<String>[2]>
   51.91 +        
   51.92 +        protected boolean isIncluded(String name) throws BuildException {
   51.93 +            if (! super.isIncluded(name)) return false;
   51.94 +            File f = new File(getBasedir(), name);
   51.95 +            if (! f.exists()) throw new IllegalStateException();
   51.96 +            if (! f.isFile()) return false;
   51.97 +            Set[] entries = loadEntries(f.getParentFile());
   51.98 +            Set text = entries[0];
   51.99 +            Set binary = entries[1];
  51.100 +            String bname = f.getName();
  51.101 +            if (mode.equals("controlled")) {
  51.102 +                return text.contains(bname) || binary.contains(bname);
  51.103 +            } else if (mode.equals("uncontrolled")) {
  51.104 +                return ! text.contains(bname) && ! binary.contains(bname);
  51.105 +            } else if (mode.equals("text")) {
  51.106 +                return text.contains(bname);
  51.107 +            } else if (mode.equals("binary")) {
  51.108 +                return binary.contains(bname);
  51.109 +            } else {
  51.110 +                throw new IllegalStateException(mode);
  51.111 +            }
  51.112 +        }
  51.113 +        
  51.114 +        private Set[] loadEntries(File dir) throws BuildException {
  51.115 +            Set[] tb = (Set[])entries.get(dir);
  51.116 +            if (tb == null) {
  51.117 +                File efile = new File(new File(dir, "CVS"), "Entries");
  51.118 +                if (efile.exists()) {
  51.119 +                    tb = new Set[] {new HashSet(10), new HashSet(10)};
  51.120 +                    try {
  51.121 +                        Reader r = new FileReader(efile);
  51.122 +                        try {
  51.123 +                            BufferedReader buf = new BufferedReader(r);
  51.124 +                            String line;
  51.125 +                            int lineNumber = 0;
  51.126 +                            while ((line = buf.readLine()) != null) {
  51.127 +                                lineNumber++;
  51.128 +                                if (line.startsWith("/")) {
  51.129 +                                    line = line.substring(1);
  51.130 +                                    int idx = line.indexOf('/');
  51.131 +                                    String name = line.substring(0, idx);
  51.132 +                                    idx = line.lastIndexOf('/');
  51.133 +                                    line = line.substring(0, idx);
  51.134 +                                    idx = line.lastIndexOf('/');
  51.135 +                                    String subst = line.substring(idx + 1);
  51.136 +                                    if (subst.equals("")) {
  51.137 +                                        tb[0].add(name);
  51.138 +                                    } else if (subst.equals("-kb")) {
  51.139 +                                        tb[1].add(name);
  51.140 +                                    } else {
  51.141 +                                        /* Don't know why, but getProject() stoped working, returns null :-(
  51.142 +                                        getProject().log(efile + ":" + lineNumber + ": warning: strange key subst mode: " + subst, Project.MSG_WARN);
  51.143 +                                        */
  51.144 +                                        if (subst.equals("-ko")) {
  51.145 +                                            // Treat it like -kkv.
  51.146 +                                            tb[0].add(name);
  51.147 +                                        }
  51.148 +                                    }
  51.149 +                                }
  51.150 +                            }
  51.151 +                        } finally {
  51.152 +                            r.close();
  51.153 +                        }
  51.154 +                    } catch (IOException ioe) {
  51.155 +                        throw new BuildException("While reading " + efile, ioe);
  51.156 +                    }
  51.157 +                } else {
  51.158 +                    tb = NO_ENTRIES;
  51.159 +                }
  51.160 +                entries.put(dir, tb);
  51.161 +            }
  51.162 +            return tb;
  51.163 +        }
  51.164 +        
  51.165 +        protected boolean couldHoldIncluded(String name) {
  51.166 +            if (! super.couldHoldIncluded(name)) return false;
  51.167 +            // Do not look into CVS meta directories.
  51.168 +            return ! name.endsWith(File.separatorChar + "CVS");
  51.169 +        }
  51.170 +        
  51.171 +    }
  51.172 +    
  51.173 +}
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/ForEach.java	Sun Jan 28 18:54:08 2007 +0000
    52.3 @@ -0,0 +1,203 @@
    52.4 +// This file was copied from daning.sfbay:/cvs/darkhorse/nbbuild/antsrc and modified
    52.5 +
    52.6 +/*
    52.7 + * The contents of this file are subject to the terms of the Common Development
    52.8 + * and Distribution License (the License). You may not use this file except in
    52.9 + * compliance with the License.
   52.10 + *
   52.11 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   52.12 + * or http://www.netbeans.org/cddl.txt.
   52.13 +
   52.14 + * When distributing Covered Code, include this CDDL Header Notice in each file
   52.15 + * and include the License file at http://www.netbeans.org/cddl.txt.
   52.16 + * If applicable, add the following below the CDDL Header, with the fields
   52.17 + * enclosed by brackets [] replaced by your own identifying information:
   52.18 + * "Portions Copyrighted [year] [name of copyright owner]"
   52.19 + *
   52.20 + * The Original Software is NetBeans. The Initial Developer of the Original
   52.21 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   52.22 + * Microsystems, Inc. All Rights Reserved.
   52.23 + */
   52.24 +package org.netbeans.modules.visualweb.ravebuild;
   52.25 +
   52.26 +import java.io.File;
   52.27 +import java.util.*;
   52.28 +
   52.29 +import org.apache.tools.ant.BuildException;
   52.30 +import org.apache.tools.ant.taskdefs.Ant;
   52.31 +import org.apache.tools.ant.taskdefs.Property;
   52.32 +
   52.33 +/**
   52.34 + * For each specified location call ant task with specified target name.
   52.35 + * If target name is not specified than name of current target is used.
   52.36 + *
   52.37 + * @author  Libor Kramolis
   52.38 + */
   52.39 +public class ForEach extends Ant {
   52.40 +    private static final boolean DEBUG = false;
   52.41 +    private static final boolean ECHO  = true;
   52.42 +    
   52.43 +    private List   locations; // List<String>
   52.44 +    private String startdir;
   52.45 +    private boolean skipNonExistentDir = false;
   52.46 +    private Vector properties = new Vector();
   52.47 +    private String suffix;
   52.48 +    
   52.49 +    //
   52.50 +    // init
   52.51 +    //
   52.52 +    
   52.53 +    public ForEach () {
   52.54 +        locations = new Vector();
   52.55 +    }
   52.56 +
   52.57 +    //
   52.58 +    // itself
   52.59 +    //
   52.60 +
   52.61 +    /** Comma separated list of locations. */
   52.62 +    public void setLocations (String s) {
   52.63 +        if ( DEBUG ) log ("SET locations = " + s);
   52.64 +
   52.65 +        StringTokenizer tok = new StringTokenizer (s, ",:");
   52.66 +        locations = new Vector ();
   52.67 +        while ( tok.hasMoreTokens() ) {
   52.68 +            locations.add (tok.nextToken().trim());
   52.69 +        }
   52.70 +    }
   52.71 +
   52.72 +    //override setDir() to noop
   52.73 +    public void setDir() {}
   52.74 +    
   52.75 +    private String target;
   52.76 +    public String getTarget() {
   52.77 +        return target;
   52.78 +    }
   52.79 +    public void setTarget(String v) {
   52.80 +        target = v;
   52.81 +    }
   52.82 +    
   52.83 +    private boolean inheritAll;
   52.84 +    public boolean getInheritAll() {
   52.85 +        return inheritAll;
   52.86 +    }
   52.87 +    public void setInheritAll(boolean v) {
   52.88 +        inheritAll = v;
   52.89 +    }
   52.90 +
   52.91 +   /**
   52.92 +    * Support nested property elements
   52.93 +    */
   52.94 +   public void addProperty (Property p) {
   52.95 +       properties.add(p);
   52.96 +   }
   52.97 +    
   52.98 +    /** Where cd first
   52.99 +     */
  52.100 +    public void setStartdir (String s) {
  52.101 +        if ( DEBUG ) log ("SET startdir = " + s);
  52.102 +
  52.103 +        startdir = s;
  52.104 +    }
  52.105 +    
  52.106 +    public void setSuffix(String s) {
  52.107 +        suffix = s;
  52.108 +    }
  52.109 +    
  52.110 +    public void setSkipNonExistentDir(boolean v) {
  52.111 +        skipNonExistentDir = v;
  52.112 +    }
  52.113 +    public boolean getSkipNonExistentDir() {
  52.114 +        return skipNonExistentDir;
  52.115 +    }
  52.116 +    
  52.117 +    /** Execute this task. */
  52.118 +    public void execute () throws BuildException {        
  52.119 +        if (locations.isEmpty()) {
  52.120 +            if (skipNonExistentDir) {
  52.121 +                if ( DEBUG ) {
  52.122 +                    log ("for-each: No locations no loops!");
  52.123 +		}
  52.124 +                return;
  52.125 +            } else {
  52.126 +                throw new BuildException("You must set at least one location!", getLocation());
  52.127 +            }
  52.128 +        }
  52.129 +
  52.130 +        if ( getTarget() == null ) {
  52.131 +            setTarget(this.getOwningTarget().getName());
  52.132 +
  52.133 +            if ( DEBUG ) log ("EXECUTE owningTarget = " + this.getOwningTarget());
  52.134 +        }
  52.135 +        File baseDir;
  52.136 +	if ( startdir == null ) {
  52.137 +            baseDir = getProject().getBaseDir();
  52.138 +        } else {
  52.139 +            baseDir = new File(getProject().getBaseDir(), startdir);
  52.140 +        }
  52.141 +
  52.142 +        Iterator it = locations.iterator();
  52.143 +        while ( it.hasNext() ) {
  52.144 +            String dirName = (String) it.next();
  52.145 +
  52.146 +            if ( ECHO ) log ("Process '" + dirName + "' location with '" + target + "' target ...");
  52.147 +            
  52.148 +            File dir = new File (baseDir, dirName);
  52.149 +            
  52.150 +            if (suffix != null) {
  52.151 +                dir = new File(dir, suffix);
  52.152 +            }
  52.153 +            
  52.154 +	    File buildXml = new File(dir, "build.xml");
  52.155 +            if (! buildXml.exists() && skipNonExistentDir) {
  52.156 +                if ( DEBUG ) log ("Skipped non-existent " + dir.getAbsolutePath());
  52.157 +                continue;
  52.158 +            }
  52.159 +
  52.160 +	    String location = (new File(dir, "build.xml")).getAbsolutePath();
  52.161 +            Ant ant = (Ant) getProject().createTask("ant");
  52.162 +            ant.init();
  52.163 +            ant.setLocation(getLocation());
  52.164 +	    ant.setAntfile(location);
  52.165 +            ant.setTarget (getTarget());
  52.166 +            ant.setInheritAll(getInheritAll());
  52.167 +	    if (getPropertyName() != null && getPropertyValue() != null) {
  52.168 +		org.apache.tools.ant.taskdefs.Property p = ant.createProperty();
  52.169 +		p.setName(getPropertyName());
  52.170 +		p.setValue(getPropertyValue());
  52.171 +	    }
  52.172 +
  52.173 +            for (int i = 0; i < properties.size(); i++) {
  52.174 +                Property p = (Property) properties.get(i);
  52.175 +                Property antProp = ant.createProperty();
  52.176 +                antProp.setName(p.getName());
  52.177 +                antProp.setValue(p.getValue());
  52.178 +            }
  52.179 +
  52.180 +            if ( DEBUG ) log ("--> next [ " + target + " ] " + dir.getAbsolutePath());
  52.181 +            
  52.182 +            ant.execute();
  52.183 +        }
  52.184 +        
  52.185 +    }
  52.186 +    public void handleErrorOutput(String output) {
  52.187 +	log(output);
  52.188 +    }
  52.189 +    
  52.190 +        private String propertyName;
  52.191 +        private String propertyValue;
  52.192 +        
  52.193 +        public String getPropertyName() {
  52.194 +            return propertyName;
  52.195 +        }
  52.196 +        public void setPropertyName(String name) {
  52.197 +            propertyName = name;
  52.198 +        }
  52.199 +        public String getPropertyValue() {
  52.200 +            return propertyValue;
  52.201 +        }
  52.202 +        public void setPropertyValue(String v) {
  52.203 +            propertyValue = v;
  52.204 +        }
  52.205 +    
  52.206 +}
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/ForEachXsl.java	Sun Jan 28 18:54:08 2007 +0000
    53.3 @@ -0,0 +1,147 @@
    53.4 +/*
    53.5 + * The contents of this file are subject to the terms of the Common Development
    53.6 + * and Distribution License (the License). You may not use this file except in
    53.7 + * compliance with the License.
    53.8 + *
    53.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   53.10 + * or http://www.netbeans.org/cddl.txt.
   53.11 +
   53.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   53.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   53.14 + * If applicable, add the following below the CDDL Header, with the fields
   53.15 + * enclosed by brackets [] replaced by your own identifying information:
   53.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   53.17 + *
   53.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   53.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   53.20 + * Microsystems, Inc. All Rights Reserved.
   53.21 + */
   53.22 +
   53.23 +/*
   53.24 + * ForEachXsl.java
   53.25 + *
   53.26 + * Created on November 14, 2006, 4:56 PM
   53.27 + *
   53.28 + * To change this template, choose Tools | Template Manager
   53.29 + * and open the template in the editor.
   53.30 + */
   53.31 +
   53.32 +package org.netbeans.modules.visualweb.ravebuild;
   53.33 +
   53.34 +import java.io.BufferedReader;
   53.35 +import java.io.BufferedWriter;
   53.36 +import java.io.File;
   53.37 +import java.io.FileReader;
   53.38 +import java.io.FileWriter;
   53.39 +import java.io.IOException;
   53.40 +import java.util.Iterator;
   53.41 +import java.util.StringTokenizer;
   53.42 +import java.util.Vector;
   53.43 +import org.apache.tools.ant.BuildException;
   53.44 +import org.apache.tools.ant.Project;
   53.45 +import org.apache.tools.ant.taskdefs.Ant;
   53.46 +
   53.47 +/**
   53.48 + *
   53.49 + * @author qn145415
   53.50 + */
   53.51 +public class ForEachXsl extends Ant {
   53.52 +    private Vector locations;
   53.53 +    private String startdir;
   53.54 +    private String suffix;
   53.55 +    
   53.56 +    /** Creates a new instance of ForEachXsl */
   53.57 +    public ForEachXsl() {
   53.58 +        locations = new Vector();
   53.59 +    }
   53.60 +    
   53.61 +    /** Comma separated list of locations. */
   53.62 +    public void setLocations (String s) {
   53.63 +        StringTokenizer tok = new StringTokenizer (s, ",:");
   53.64 +        locations = new Vector ();
   53.65 +        while ( tok.hasMoreTokens() ) {
   53.66 +            locations.add (tok.nextToken().trim());
   53.67 +        }
   53.68 +    }    
   53.69 +    
   53.70 +    public void setSuffix(String s) {
   53.71 +        suffix = s;
   53.72 +    }
   53.73 +    
   53.74 +    public void setStartdir (String s) {
   53.75 +        startdir = s;
   53.76 +    }
   53.77 +    
   53.78 +    /** Execute this task. */
   53.79 +    public void execute () throws BuildException {        
   53.80 +        if (locations.isEmpty()) {
   53.81 +            throw new BuildException("You must set at least one location!", getLocation());
   53.82 +        }
   53.83 +
   53.84 +        File baseDir;
   53.85 +	if ( startdir == null ) {
   53.86 +            baseDir = getProject().getBaseDir();
   53.87 +        } else {
   53.88 +            baseDir = new File(getProject().getBaseDir(), startdir);
   53.89 +        }
   53.90 +
   53.91 +        Iterator it = locations.iterator();
   53.92 +        String construct = "    <import file=\"${suite.dir}/templates/common.xml\"/>";
   53.93 +        while ( it.hasNext() ) {
   53.94 +            String dirName = (String) it.next();
   53.95 +            
   53.96 +            File dir = new File (baseDir, dirName);
   53.97 +            
   53.98 +            if (suffix != null) {
   53.99 +                dir = new File(dir, suffix);
  53.100 +            }
  53.101 +            
  53.102 +	    File buildXml = new File(dir, "build.xml");
  53.103 +            if (! buildXml.exists()) {
  53.104 +                log("Build file not found - " + buildXml.getAbsolutePath(), Project.MSG_ERR);
  53.105 +                continue;
  53.106 +            }
  53.107 +            
  53.108 +            try {
  53.109 +                BufferedReader br = new BufferedReader(new FileReader(buildXml));
  53.110 +                Vector lines = new Vector();
  53.111 +                boolean next = false;
  53.112 +                boolean found = false;
  53.113 +                boolean dirty = true;
  53.114 +                while (br.ready()) {
  53.115 +                    String nextline = br.readLine();
  53.116 +                    
  53.117 +                    if (next == true) {
  53.118 +                        next = false;
  53.119 +                        if (nextline.indexOf(construct.trim()) == -1) {
  53.120 +                            lines.add(construct);
  53.121 +                        }
  53.122 +                    }
  53.123 +                    
  53.124 +                    lines.add(nextline);
  53.125 +                    if (found == false && nextline.indexOf("<import file=\"nbproject/build-impl.xml\"/>") != -1) {
  53.126 +                        next = true;
  53.127 +                        found = true;
  53.128 +                    }else if (nextline.indexOf(construct.trim()) != -1) {
  53.129 +                        dirty = false;
  53.130 +                        break;
  53.131 +                    }
  53.132 +                }
  53.133 +                br.close();
  53.134 +                if (dirty) {
  53.135 +                    BufferedWriter writer = new BufferedWriter(new FileWriter(buildXml));
  53.136 +                    for (int i = 0; i < lines.size(); i++) {
  53.137 +                        writer.write((String)lines.get(i));
  53.138 +                        writer.newLine();
  53.139 +                    }
  53.140 +                    writer.close();
  53.141 +                }
  53.142 +            }catch (IOException ex) {
  53.143 +                throw new BuildException("Unable to modify build.xml files", ex);
  53.144 +            }
  53.145 +            
  53.146 +        }
  53.147 +        
  53.148 +    }
  53.149 +    
  53.150 +}
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/GetLocalizableFiles.java	Sun Jan 28 18:54:08 2007 +0000
    54.3 @@ -0,0 +1,232 @@
    54.4 +/*
    54.5 + * The contents of this file are subject to the terms of the Common Development
    54.6 + * and Distribution License (the License). You may not use this file except in
    54.7 + * compliance with the License.
    54.8 + *
    54.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   54.10 + * or http://www.netbeans.org/cddl.txt.
   54.11 +
   54.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   54.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   54.14 + * If applicable, add the following below the CDDL Header, with the fields
   54.15 + * enclosed by brackets [] replaced by your own identifying information:
   54.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   54.17 + *
   54.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   54.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   54.20 + * Microsystems, Inc. All Rights Reserved.
   54.21 + */
   54.22 +
   54.23 +package org.netbeans.modules.visualweb.ravebuild;
   54.24 +
   54.25 +import org.apache.tools.ant.*;
   54.26 +import org.apache.tools.ant.util.*;
   54.27 +import org.apache.tools.ant.taskdefs.*;
   54.28 +import org.apache.tools.ant.types.FileSet;
   54.29 +import java.io.*;
   54.30 +import java.util.*;
   54.31 +
   54.32 +/** This task copies the localizable files to a directory.
   54.33 + * This task uses the L10nTask's getLocalizableFiles() function
   54.34 + * to get the list of localizable files for each module.
   54.35 + */
   54.36 +public class GetLocalizableFiles extends Task {
   54.37 +
   54.38 +  /** The name of file that contains the localizable file
   54.39 +   * regular expressions.
   54.40 +   * <p>Default: <samp>l10n.list</samp>
   54.41 +   */
   54.42 +  protected String listFile = "l10n.list";
   54.43 +
   54.44 +  /** The grandparent directory of the l10n.list files.
   54.45 +   * <p>Default: <samp>..</samp>
   54.46 +   */
   54.47 +  protected String baseDir = "..";
   54.48 +  protected File grandParent = null ;
   54.49 +
   54.50 +  /** The target directory to copy all translatable files to.
   54.51 +   * <p>Default: <samp>src-todo</samp>
   54.52 +   */
   54.53 +  protected File targetDir = null ;
   54.54 +
   54.55 +  /** List of exclude patterns that override the listFiles.
   54.56 +   * <p>Default: Ja localized files
   54.57 +   */
   54.58 +  protected String excludes = "**/ja/,**/*_ja.*" ;
   54.59 +
   54.60 +  /** Used internally. */
   54.61 +  protected FileUtils fileUtils = null ;
   54.62 +
   54.63 +  protected boolean moduleList = true ;
   54.64 +  protected String localizable_modules = "";
   54.65 +
   54.66 +  public void setBaseDir(String s) {
   54.67 +    File f ;
   54.68 +
   54.69 +    baseDir = s;
   54.70 +    f = new File( antBaseDir() + baseDir) ;
   54.71 +    try {
   54.72 +      grandParent = new File( f.getCanonicalPath()) ;
   54.73 +    }
   54.74 +    catch( Exception e) {
   54.75 +      e.printStackTrace();
   54.76 +      throw new BuildException() ;
   54.77 +    }
   54.78 +  }
   54.79 +  public void setListFile( String s) {
   54.80 +    listFile = s ;
   54.81 +  }
   54.82 +  public void setTargetDir( File f) {
   54.83 +    targetDir = f ;
   54.84 +  }
   54.85 +  public void setExcludes( String s) {
   54.86 +    excludes = s ;
   54.87 +  }
   54.88 +  public void setModuleList( boolean doit) {
   54.89 +    moduleList = doit ;
   54.90 +  }
   54.91 +
   54.92 +  /** A file filter that accepts only directories
   54.93 +   */
   54.94 +  class DirectoryFilter implements FileFilter {
   54.95 +    public boolean accept(File f) {
   54.96 +      return( f.isDirectory()) ;
   54.97 +    }
   54.98 +  }
   54.99 +
  54.100 +  class TarFileFilter implements FileFilter {
  54.101 +    public boolean accept(File f) {
  54.102 +      return( f.getName().endsWith( ".tar")) ;
  54.103 +    }
  54.104 +  }
  54.105 +
  54.106 +  public void execute() throws BuildException {
  54.107 +    File module ;
  54.108 +    LinkedList modules ;
  54.109 +    ListIterator iter ;
  54.110 +
  54.111 +    if( targetDir == null) {
  54.112 +      targetDir = new File( antBaseDir() + "src-todo") ;
  54.113 +    }
  54.114 +
  54.115 +    // If needed, setup the grandParent variable. //
  54.116 +    if( grandParent == null) {
  54.117 +      setBaseDir( baseDir) ;
  54.118 +    }
  54.119 +
  54.120 +    // For each module with a list file. //
  54.121 +    modules = getModulesWithListFiles() ;
  54.122 +    iter = modules.listIterator() ;
  54.123 +    while( iter.hasNext()) {
  54.124 +      module = (File) iter.next() ;
  54.125 +
  54.126 +      // Copy the module's localizable files. //
  54.127 +      copyL9eFiles( module) ;
  54.128 +
  54.129 +      if (moduleList) {
  54.130 +        localizable_modules = module.getName() + "," + localizable_modules;
  54.131 +      }
  54.132 +    }
  54.133 +    getProject().setNewProperty("allmodules", localizable_modules);
  54.134 +  }
  54.135 +
  54.136 +  protected void copyL9eFiles( File module) {
  54.137 +    String[] l9eFiles, changedFiles ;
  54.138 +    int i ;
  54.139 +    File fromFile, toFile ;
  54.140 +    L10nTask l10nTask ;
  54.141 +
  54.142 +    // Setup the file utils. //
  54.143 +    if( fileUtils == null) {
  54.144 +      fileUtils = FileUtils.newFileUtils() ;
  54.145 +    }
  54.146 +
  54.147 +    // Use the l10n task to read the list file and get a list of the //
  54.148 +    // localizable files.					     //
  54.149 +    getProject().addTaskDefinition("l10nTask", L10nTask.class);
  54.150 +    l10nTask = (L10nTask) getProject().createTask("l10nTask");
  54.151 +    l10nTask.init() ;
  54.152 +    l10nTask.setLocalizableFile( listFile) ;
  54.153 +    l10nTask.setExcludePattern( excludes) ;
  54.154 +    l9eFiles = l10nTask.getLocalizableFiles( grandParent, module.getName()) ;
  54.155 +    if( l9eFiles != null) {
  54.156 +
  54.157 +      // Get a list of the files that have changed. //
  54.158 +      changedFiles = getChangedFiles( l9eFiles) ;
  54.159 +
  54.160 +      // Copy the localizable files that have changed. //
  54.161 +      if( changedFiles != null && changedFiles.length > 0) {
  54.162 +	log( "Copying " + changedFiles.length + " files to " + targetDir.getPath()) ;
  54.163 +	for( i = 0; i < changedFiles.length; i++) {
  54.164 +	  fromFile = new File( changedFiles[i]) ;
  54.165 +	  toFile = new File( mapL9eFile( changedFiles[i],
  54.166 +					 targetDir.getPath(),
  54.167 +					 grandParent.getPath())) ;
  54.168 +	  try {
  54.169 +	    //log("Copying " + fromFile.getPath() + " to " + toFile.getPath()) ;
  54.170 +	    fileUtils.copyFile( fromFile, toFile) ;
  54.171 +	  } catch (IOException ioe) {
  54.172 +	    String msg = "Failed to copy " + fromFile.getPath() + " to " +
  54.173 +	      toFile.getPath() + " due to " + ioe.getMessage();
  54.174 +	    throw new BuildException(msg, ioe, getLocation());
  54.175 +	  }
  54.176 +	}
  54.177 +      }
  54.178 +    }
  54.179 +  }
  54.180 +
  54.181 +  protected String[] getChangedFiles( String[] files) {
  54.182 +    L9eMapper mapper = new L9eMapper() ;
  54.183 +    mapper.setFrom( grandParent.getPath()) ;
  54.184 +    mapper.setTo( targetDir.getPath()) ;
  54.185 +
  54.186 +    SourceFileScanner ds = new SourceFileScanner( this);
  54.187 +    return( ds.restrict( files, null, null, mapper)) ;
  54.188 +  }
  54.189 +
  54.190 +  protected class L9eMapper implements FileNameMapper {
  54.191 +
  54.192 +    protected String m_grandParent ;
  54.193 +    protected String m_toDir ;
  54.194 +
  54.195 +    public void setFrom(String from) {
  54.196 +      m_grandParent = from ;
  54.197 +    }
  54.198 +
  54.199 +    public void setTo(String to) {
  54.200 +      m_toDir = to ;
  54.201 +    }
  54.202 +
  54.203 +    // Returns an one-element array containing the destination file //
  54.204 +    // name.							    //
  54.205 +    public String[] mapFileName(String file) {
  54.206 +      return new String[] { GetLocalizableFiles.mapL9eFile( file, m_toDir, m_grandParent) } ;
  54.207 +    }
  54.208 +  }
  54.209 +
  54.210 +  protected static String mapL9eFile( String file, String toDir, 
  54.211 +				      String grandParentName) {
  54.212 +    return toDir + file.substring( grandParentName.length()) ;
  54.213 +  }
  54.214 +
  54.215 +  protected LinkedList getModulesWithListFiles() {
  54.216 +    File module, list ;
  54.217 +    File[] parents ;
  54.218 +    LinkedList modules = new LinkedList() ;
  54.219 +    int i ;
  54.220 +
  54.221 +    parents = grandParent.listFiles( new DirectoryFilter()) ;
  54.222 +    for( i = 0; i < parents.length; i++) {
  54.223 +      module = parents[ i] ;
  54.224 +      list = new File( module.getPath() + File.separator + listFile) ;
  54.225 +      if( list.exists()) {
  54.226 +	modules.add( module) ;
  54.227 +      }
  54.228 +    }
  54.229 +    return( modules) ;
  54.230 +  }
  54.231 +
  54.232 +  protected String antBaseDir() {
  54.233 +    return( getProject().getBaseDir().getAbsolutePath() + File.separator) ;
  54.234 +  }
  54.235 +}
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/JHIndexer.java	Sun Jan 28 18:54:08 2007 +0000
    55.3 @@ -0,0 +1,386 @@
    55.4 +/*
    55.5 + * The contents of this file are subject to the terms of the Common Development
    55.6 + * and Distribution License (the License). You may not use this file except in
    55.7 + * compliance with the License.
    55.8 + *
    55.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   55.10 + * or http://www.netbeans.org/cddl.txt.
   55.11 +
   55.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   55.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   55.14 + * If applicable, add the following below the CDDL Header, with the fields
   55.15 + * enclosed by brackets [] replaced by your own identifying information:
   55.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   55.17 + *
   55.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   55.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   55.20 + * Microsystems, Inc. All Rights Reserved.
   55.21 + */
   55.22 +
   55.23 +package org.netbeans.modules.visualweb.ravebuild;
   55.24 +
   55.25 +import java.io.*;
   55.26 +import java.lang.reflect.*;
   55.27 +import java.util.*;
   55.28 +
   55.29 +import org.apache.tools.ant.AntClassLoader;
   55.30 +import org.apache.tools.ant.BuildException;
   55.31 +import org.apache.tools.ant.DirectoryScanner;
   55.32 +import org.apache.tools.ant.FileScanner;
   55.33 +import org.apache.tools.ant.Project;
   55.34 +import org.apache.tools.ant.taskdefs.Copy;
   55.35 +import org.apache.tools.ant.taskdefs.Delete;
   55.36 +import org.apache.tools.ant.taskdefs.Java;
   55.37 +import org.apache.tools.ant.taskdefs.MatchingTask;
   55.38 +import org.apache.tools.ant.taskdefs.Mkdir;
   55.39 +import org.apache.tools.ant.taskdefs.Move;
   55.40 +import org.apache.tools.ant.types.FileSet;
   55.41 +import org.apache.tools.ant.types.Mapper;
   55.42 +import org.apache.tools.ant.types.Path;
   55.43 +
   55.44 +// ToDo:
   55.45 +// stopwords configuration
   55.46 +// verbose mode
   55.47 +
   55.48 +/** Task to run JavaHelp search indexer.
   55.49 + * Creates the proper binary search database from source HTML.
   55.50 + * @author Jesse Glick
   55.51 + * @see <a href="http://java.sun.com/products/javahelp/">JavaHelp home page</a>
   55.52 + */
   55.53 +public class JHIndexer extends MatchingTask {
   55.54 +
   55.55 +    private Path classpath;
   55.56 +    private File db;
   55.57 +    private File basedir;
   55.58 +    private String locale;
   55.59 +    private List brandings = new LinkedList(); // List<BrandedFileSet>
   55.60 +
   55.61 +    /** Set the location of <samp>jhall.jar</samp> or <samp>jsearch.jar</samp> (JavaHelp tools library). */
   55.62 +    public Path createClasspath() {
   55.63 +        // JavaHelp release notes say jhtools.jar is enough, but class NoClassDefFoundError
   55.64 +        // on javax.help.search.IndexBuilder when I tried it...
   55.65 +        if (classpath == null) {
   55.66 +            classpath = new Path(getProject());
   55.67 +        }
   55.68 +        return classpath.createPath();
   55.69 +    }
   55.70 +
   55.71 +    /** Set the location of the output database.
   55.72 +     * E.g. <samp>JavaHelpSearch</samp>).
   55.73 +     * <strong>Warning:</strong> the directory will be deleted and recreated.
   55.74 +     */
   55.75 +    public void setDb (File db) {
   55.76 +        this.db = db;
   55.77 +    }
   55.78 +
   55.79 +    /** Set the base directory from which to scan files.
   55.80 +     * This should be the directory containing the helpset for the database to work correctly.
   55.81 +     */
   55.82 +    public void setBasedir (File basedir) {
   55.83 +        this.basedir = basedir;
   55.84 +    }
   55.85 +    public void setLocale (String locale) {
   55.86 +        this.locale = locale;
   55.87 +    }
   55.88 +    
   55.89 +    /**
   55.90 +     * A set of additional files forming a branding variant.
   55.91 +     * @see #addBrandedFileSet
   55.92 +     */
   55.93 +    public static final class BrandedFileSet extends FileSet {
   55.94 +        String branding;
   55.95 +        public void setBranding(String b) {
   55.96 +            this.branding = b;
   55.97 +        }
   55.98 +    }
   55.99 +    
  55.100 +    /**
  55.101 +     * Add a set of branded files to be indexed.
  55.102 +     * For example, you may have in <samp>/the/base/dir</samp>
  55.103 +     * <ul>
  55.104 +     * <li><samp>foo.html</samp>
  55.105 +     * <li><samp>bar.html</samp>
  55.106 +     * <li><samp>baz.html</samp>
  55.107 +     * </ul>
  55.108 +     * Now create a new directory <samp>/the/new/dir</samp>:
  55.109 +     * <ul>
  55.110 +     * <li><samp>foo_brand.html</samp>
  55.111 +     * <li><samp>baz_brand.html</samp>
  55.112 +     * </ul>
  55.113 +     * If you include this with:
  55.114 +     * <pre>
  55.115 +&lt;jhindexer basedir="/the/base/dir"&gt;
  55.116 +    &lt;include name="*&#42;/*.html"/&gt;
  55.117 +    &lt;brandedfileset dir="/the/new/dir" branding="brand"&gt;
  55.118 +        &lt;include name="*&#42;/*.html"/&gt;
  55.119 +    &lt;/brandedfileset&gt;
  55.120 +&lt;/jhindexer&gt;
  55.121 +     * </pre>
  55.122 +     * then the search database will contain entries:
  55.123 +     * <table border="1">
  55.124 +     * <tr><th>JH name</th><th>From file</th></tr>
  55.125 +     * <tr><td><samp>foo.html</samp></td><td><samp>/the/new/dir/foo_brand.html</samp></td></tr>
  55.126 +     * <tr><td><samp>bar.html</samp></td><td><samp>/the/base/dir/bar.html</samp></td></tr>
  55.127 +     * <tr><td><samp>baz.html</samp></td><td><samp>/the/new/dir/baz_brand.html</samp></td></tr>
  55.128 +     * </table>
  55.129 +     * and every file in the database (<samp>TMAP</samp> etc.)
  55.130 +     * will receive the special suffix <samp>_brand</samp>.
  55.131 +     * <p>You may give multiple branding filesets, so long as the branding
  55.132 +     * tokens supplied are nested: i.e. for every pair of tokens among the supplied
  55.133 +     * filesets, one is a prefix of the other (with <samp>_</samp> being the
  55.134 +     * separator between the prefix and suffix). The search database suffix is then
  55.135 +     * an underscore followed by the longest branding token.
  55.136 +     * <p>Such a database is suitable for branding NetBeans: consider a module
  55.137 +     * with documentation entries such as the following:
  55.138 +     * <ul>
  55.139 +     * <li><samp>modules/docs/foo.jar!/some/pkg/foo/foo.html</samp>
  55.140 +     * <li><samp>modules/docs/foo.jar!/some/pkg/foo/bar.html</samp>
  55.141 +     * <li><samp>modules/docs/foo.jar!/some/pkg/foo/baz.html</samp>
  55.142 +     * <li><samp>modules/docs/foo.jar!/some/pkg/foo/JavaHelpSearch/TMAP</samp> (etc.)
  55.143 +     * <li><samp>modules/docs/locale/foo_brand.jar!/some/pkg/foo/foo_brand.html</samp>
  55.144 +     * <li><samp>modules/docs/locale/foo_brand.jar!/some/pkg/foo/baz_brand.html</samp>
  55.145 +     * <li><samp>modules/docs/locale/foo_brand.jar!/some/pkg/foo/JavaHelpSearch/TMAP_brand</samp> (etc.)
  55.146 +     * </ul>
  55.147 +     * where the files in <samp>modules/docs/foo.jar!/some/pkg/foo/JavaHelpSearch/</samp>
  55.148 +     * were generated by a regular invocation of this task and the files in
  55.149 +     * <samp>modules/docs/locale/foo_brand.jar!/some/pkg/foo/JavaHelpSearch/</samp>
  55.150 +     * were generated by the variant above. Then a help set reference using a URL such as
  55.151 +     * <samp>nbdocs:/some/pkg/foo/helpset.xml</samp> will, when running with branding
  55.152 +     * <samp>brand</samp>, not only display the expected variants of <samp>foo.html</samp>
  55.153 +     * and <samp>baz.html</samp>, but be able to search for strings specifically in them
  55.154 +     * (including correct offsets).
  55.155 +     * @see <a href="http://www.netbeans.org/issues/show_bug.cgi?id=31044">Issue #31044</a>
  55.156 +     */
  55.157 +    public void addBrandedFileSet(BrandedFileSet s) {
  55.158 +        brandings.add(s);
  55.159 +    }
  55.160 +    
  55.161 +    /** @deprecated Use {@link #createClasspath} instead. */
  55.162 +    public void setJhall(File f) {
  55.163 +        log("The 'jhall' attribute to <jhindexer> is deprecated. Use a nested <classpath> instead.", Project.MSG_WARN);
  55.164 +        createClasspath().setLocation(f);
  55.165 +    }
  55.166 +
  55.167 +    /**  
  55.168 +     *
  55.169 +     */
  55.170 +    public void setClassPath(Path cp) {
  55.171 +        classpath = cp;
  55.172 +    }
  55.173 +    
  55.174 +    public void execute () throws BuildException {
  55.175 +        if (classpath == null) throw new BuildException ("Must specify the classpath attribute to find jhall.jar or jsearch.jar");
  55.176 +        if (db == null) throw new BuildException ("Must specify the db attribute");
  55.177 +        if (basedir == null) throw new BuildException ("Must specify the basedir attribute");
  55.178 +        FileScanner scanner = getDirectoryScanner (basedir);
  55.179 +        scanner.scan ();
  55.180 +        String[] files = scanner.getIncludedFiles ();
  55.181 +        // First, an up-to-date check. ;-)
  55.182 +        if (basedir.exists () && db.exists ()) {
  55.183 +            long lastModified = Long.MIN_VALUE;
  55.184 +            // First scan output dir for any files.
  55.185 +            FileScanner output = new DirectoryScanner ();
  55.186 +            output.setBasedir (db);
  55.187 +            output.scan ();
  55.188 +            String[] outfiles = output.getIncludedFiles ();
  55.189 +            if (outfiles.length > 0) {
  55.190 +                for (int i = 0; i < outfiles.length; i++) {
  55.191 +                    long mod = new File (db, outfiles[i]).lastModified ();
  55.192 +                    if (mod > lastModified) {
  55.193 +                        lastModified = mod;
  55.194 +                    }
  55.195 +                }
  55.196 +                // Now check to see if any source files are newer.
  55.197 +                boolean ok = true;
  55.198 +                for (int i = 0; i < files.length; i++) {
  55.199 +                    long mod = new File (basedir, files[i]).lastModified ();
  55.200 +                    if (mod > lastModified) {
  55.201 +                        ok = false;
  55.202 +                        break;
  55.203 +                    }
  55.204 +                }
  55.205 +                if (!brandings.isEmpty()) {
  55.206 +                    // Check these too!
  55.207 +                    Iterator it = brandings.iterator();
  55.208 +                    while (it.hasNext()) {
  55.209 +                        FileSet fs = (FileSet)it.next();
  55.210 +                        FileScanner scanner2 = fs.getDirectoryScanner(getProject());
  55.211 +                        String[] files2 = scanner2.getIncludedFiles();
  55.212 +                        for (int i = 0; i < files2.length; i++) {
  55.213 +                            long mod = new File (basedir, files2[i]).lastModified ();
  55.214 +                            if (mod > lastModified) {
  55.215 +                                ok = false;
  55.216 +                                break;
  55.217 +                            }
  55.218 +                        }
  55.219 +                    }
  55.220 +                }
  55.221 +                if (ok) {
  55.222 +                    // No need to rebuild.
  55.223 +                    return;
  55.224 +                }
  55.225 +            }
  55.226 +        }
  55.227 +        Delete delete = (Delete) getProject().createTask("delete");
  55.228 +        delete.setDir (db);
  55.229 +        delete.init ();
  55.230 +        delete.setLocation(getLocation());
  55.231 +        delete.execute ();
  55.232 +        Mkdir mkdir = (Mkdir) getProject().createTask("mkdir");
  55.233 +        mkdir.setDir (db);
  55.234 +        mkdir.init ();
  55.235 +        mkdir.setLocation(getLocation());
  55.236 +        mkdir.execute ();
  55.237 +        String maxbranding = null;
  55.238 +        if (!brandings.isEmpty()) {
  55.239 +            // Copy all files, overriding by branding, to a fresh dir somewhere.
  55.240 +            // Does not suffice to simply use IndexRemove to strip off the basedirs
  55.241 +            // of files in branded filesets, since their filenames will also include
  55.242 +            // the branding token, and this will mess up the search database: it needs
  55.243 +            // to store just the simple file name with no branding infix.
  55.244 +            File tmp = new File(System.getProperty("java.io.tmpdir"), "jhindexer-branding-merge");
  55.245 +            delete = (Delete) getProject().createTask("delete");
  55.246 +            delete.setDir(tmp);
  55.247 +            delete.init();
  55.248 +            delete.setLocation(getLocation());
  55.249 +            delete.execute();
  55.250 +            tmp.mkdir();
  55.251 +            // Start with the base files.
  55.252 +            Copy copy = (Copy) getProject().createTask("copy");
  55.253 +            copy.setTodir(tmp);
  55.254 +            copy.addFileset(fileset);
  55.255 +            copy.init();
  55.256 +            copy.setLocation(getLocation());
  55.257 +            copy.execute();
  55.258 +            // Now branded filesets. Must be done in order of branding, so that
  55.259 +            // more specific files override generic ones.
  55.260 +            class BrandingLengthComparator implements Comparator {
  55.261 +                public int compare(Object a, Object b) {
  55.262 +                    return ((BrandedFileSet)a).branding.length() - ((BrandedFileSet)b).branding.length();
  55.263 +                }
  55.264 +            }
  55.265 +            Collections.sort(brandings, new BrandingLengthComparator());
  55.266 +            Iterator it = brandings.iterator();
  55.267 +            while (it.hasNext()) {
  55.268 +                BrandedFileSet s = (BrandedFileSet)it.next();
  55.269 +                if (maxbranding != null && !s.branding.startsWith(maxbranding + "_")) {
  55.270 +                    throw new BuildException("Illegal branding: " + s.branding, getLocation());
  55.271 +                }
  55.272 +                maxbranding = s.branding; // only last one will be kept
  55.273 +                String[] suffixes = {
  55.274 +                    ".html",
  55.275 +                    ".htm",
  55.276 +                    ".xhtml",
  55.277 +                    // XXX any others? unpleasant to hardcode but this is easiest,
  55.278 +                    // since glob mappers do not permit *_x* -> ** syntax.
  55.279 +                };
  55.280 +                for (int i = 0; i < suffixes.length; i++) {
  55.281 +                    String suffix = suffixes[i];
  55.282 +                    copy = (Copy) getProject().createTask("copy");
  55.283 +                    copy.setTodir(tmp);
  55.284 +                    copy.setOverwrite(true);
  55.285 +                    copy.addFileset(s);
  55.286 +                    Mapper m = copy.createMapper();
  55.287 +                    Mapper.MapperType mt = new Mapper.MapperType();
  55.288 +                    mt.setValue("glob");
  55.289 +                    m.setType(mt);
  55.290 +                    m.setFrom("*_" + s.branding + suffix);
  55.291 +                    m.setTo("*" + suffix);
  55.292 +                    copy.init();
  55.293 +                    copy.setLocation(getLocation());
  55.294 +                    copy.execute();
  55.295 +                    if (locale != null) {
  55.296 +                        // Possibly have e.g. x_f4j_ja.html.
  55.297 +                        suffix = "_" + locale + suffix;
  55.298 +                        copy = (Copy) getProject().createTask("copy");
  55.299 +                        copy.setTodir(tmp);
  55.300 +                        copy.setOverwrite(true);
  55.301 +                        copy.addFileset(s);
  55.302 +                        m = copy.createMapper();
  55.303 +                        mt = new Mapper.MapperType();
  55.304 +                        mt.setValue("glob");
  55.305 +                        m.setType(mt);
  55.306 +                        m.setFrom("*_" + s.branding + suffix);
  55.307 +                        m.setTo("*" + suffix);
  55.308 +                        copy.init();
  55.309 +                        copy.setLocation(getLocation());
  55.310 +                        copy.execute();
  55.311 +                    }
  55.312 +                }
  55.313 +            }
  55.314 +            // Now replace basedir & files with this temp dir.
  55.315 +            basedir = tmp;
  55.316 +            FileSet tmpf = new FileSet();
  55.317 +            tmpf.setProject(getProject());
  55.318 +            tmpf.setDir(tmp);
  55.319 +            files = tmpf.getDirectoryScanner(getProject()).getIncludedFiles();
  55.320 +        }
  55.321 +        log ("Running JavaHelp search database indexer...");
  55.322 +        try {
  55.323 +            File config = File.createTempFile ("jhindexer-config", ".txt");
  55.324 +            try {
  55.325 +                OutputStream os = new FileOutputStream (config);
  55.326 +                try {
  55.327 +                    PrintWriter pw = new PrintWriter (os);
  55.328 +                    pw.println ("IndexRemove " + basedir + File.separator);
  55.329 +                    String message = "Files to be indexed:";
  55.330 +                    for (int i = 0; i < files.length; i++) {
  55.331 +                        // [PENDING] JavaHelp docs say to use / as file sep for File directives;
  55.332 +                        // so what should the complete path be? Someone should test this on Windoze...
  55.333 +                        String path = basedir + File.separator + files[i];
  55.334 +                        pw.println ("File " + path);
  55.335 +                        message += "\n\t" + path;
  55.336 +                    }
  55.337 +                    log (message, Project.MSG_VERBOSE);
  55.338 +                    pw.flush ();
  55.339 +                } finally {
  55.340 +                    os.close ();
  55.341 +                }
  55.342 +                AntClassLoader loader = new AntClassLoader(getProject(), classpath);
  55.343 +                try {
  55.344 +                    Class clazz = loader.loadClass ("com.sun.java.help.search.Indexer");
  55.345 +                    Method main = clazz.getMethod ("main", new Class[] { String[].class });
  55.346 +                    List args = Arrays.asList(new String[] {
  55.347 +                        "-c", config.getAbsolutePath(),
  55.348 +                        "-db", db.getAbsolutePath()
  55.349 +                    });
  55.350 +                    if (locale != null) {
  55.351 +                        args = new ArrayList(args); // #35244
  55.352 +                        args.add("-locale");
  55.353 +                        args.add(locale);
  55.354 +                    }
  55.355 +                    main.invoke(null, new Object[] {args.toArray(new String[args.size()])});
  55.356 +                } catch (InvocationTargetException ite) {
  55.357 +                    throw new BuildException("Could not run indexer", ite.getTargetException(), getLocation());
  55.358 +                } catch (Exception e) { // ClassNotFoundException, NoSuchMethodException, ...
  55.359 +                    throw new BuildException("Could not run indexer", e, getLocation());
  55.360 +                }
  55.361 +            } finally {
  55.362 +                config.delete ();
  55.363 +            }
  55.364 +        } catch (IOException ioe) {
  55.365 +            throw new BuildException("Could not make temporary config file", ioe, getLocation());
  55.366 +        }
  55.367 +        if (maxbranding != null) {
  55.368 +            // Now rename search DB files to include branding suffix.
  55.369 +            // Note that DOCS.TAB -> DOCS_brand.TAB to work with nbdocs: protocol.
  55.370 +            String[] dbfiles = db.list();
  55.371 +            for (int i = 0; i < dbfiles.length; i++) {
  55.372 +                String basename, ext;
  55.373 +                int idx = dbfiles[i].lastIndexOf('.');
  55.374 +                if (idx != -1) {
  55.375 +                    basename = dbfiles[i].substring(0, idx);
  55.376 +                    ext = dbfiles[i].substring(idx);
  55.377 +                } else {
  55.378 +                    basename = dbfiles[i];
  55.379 +                    ext = "";
  55.380 +                }
  55.381 +                File old = new File(db, dbfiles[i]);
  55.382 +                File nue = new File(db, basename + "_" + maxbranding + ext);
  55.383 +                log("Moving " + old + " to " + nue, Project.MSG_VERBOSE);
  55.384 +                old.renameTo(nue);
  55.385 +            }
  55.386 +        }
  55.387 +    }
  55.388 +
  55.389 +}
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/L10nTask.java	Sun Jan 28 18:54:08 2007 +0000
    56.3 @@ -0,0 +1,795 @@
    56.4 +/*
    56.5 + * The contents of this file are subject to the terms of the Common Development
    56.6 + * and Distribution License (the License). You may not use this file except in
    56.7 + * compliance with the License.
    56.8 + *
    56.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   56.10 + * or http://www.netbeans.org/cddl.txt.
   56.11 +
   56.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   56.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   56.14 + * If applicable, add the following below the CDDL Header, with the fields
   56.15 + * enclosed by brackets [] replaced by your own identifying information:
   56.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   56.17 + *
   56.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   56.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   56.20 + * Microsystems, Inc. All Rights Reserved.
   56.21 + */
   56.22 +
   56.23 +/************************************************************************
   56.24 +
   56.25 +        FILENAME: L10nTask.java
   56.26 +
   56.27 +        AUTHOR: Erica Grevemeyer      DATE: Jan  30 11:21:09 PST 2002
   56.28 +
   56.29 +************************************************************************/
   56.30 +package org.netbeans.modules.visualweb.ravebuild;
   56.31 +
   56.32 +import org.apache.tools.ant.*;
   56.33 +import org.apache.tools.ant.taskdefs.*;
   56.34 +import org.apache.tools.ant.types.FileSet;
   56.35 +import java.io.*;
   56.36 +import java.util.*;
   56.37 +import org.netbeans.modules.visualweb.ravebuild.utils.cvsutils.CvsEntries;
   56.38 +
   56.39 +/**
   56.40 + * This task was created to create L10N kits.
   56.41 + * The xml to call this task might look like:
   56.42 + * <l10nTask topdirs="${f4jroot} ${nbroot}"  modules="${all_modules}" localizableFile="${localizableF}" generatedFile="${genFile}" changedFile="${changedFile}" buildDir="${l10n-build}" distDir="${l10n-dist}" buildNumber="${buildnumber}"/>
   56.43 + *
   56.44 + *
   56.45 + * Each resulting kit will be a tar file containing one directory
   56.46 + *   for each repository examined.  
   56.47 + * Each repository_directory will contain one tar-file
   56.48 + *   for each module with changed localizable files.
   56.49 + * The structure of the tar file is as follows:
   56.50 + * repository_dir/
   56.51 + *                 module_tar/
   56.52 + *                            generatedFile
   56.53 + *                            contentFile
   56.54 + *                            localizableFile1.html
   56.55 + *                            localizableFile2.gif...
   56.56 + *
   56.57 + * 1.  All localizable files (as defined in "localizableFile")
   56.58 + *     "localizableFile" is a list of file patterns difining all localizable source files.
   56.59 + *     "localizableFile" itself is not included in the kit.
   56.60 + * 2.  A content file (as named in "contentFile")
   56.61 + *     This is a list of the names of all localizable files which need to be (re)localized.
   56.62 + * 3.  A generated file (as named in "generatedFile")
   56.63 + *     This is a list of the names of all localizable files with the most recent
   56.64 + *     CVS revision number. 
   56.65 + * 
   56.66 + * The generated file need not be committed to cvs until the files come back
   56.67 + * localized. (This is a change from the procedure followed in late 2001).
   56.68 + *
   56.69 + * As of version 1.1.2, converted Gzip methods to use ant 1.4.1, and added ability to 
   56.70 + * 1) embed exclude patterns in the l10n.list file 
   56.71 + *		(must use keyword "exclude " followed by the pattern.)
   56.72 + * 2) add ability to embed reading of additional files 
   56.73 + *		(must use the keyword "read " followed by the path to the file)
   56.74 + *		The special case "read global" will read the file set by the property globalFile
   56.75 + * 3) add the ability to embed properties in the patterns. i
   56.76 + *		The special case "l10n-module" property will be set from within L10nTask
   56.77 + *
   56.78 + * @author Erica Grevemeyer
   56.79 + * @version 1.1,	Feb  4 11:21:09 PST 2002
   56.80 + * @version 1.1.2	Aug 29 15:23:51 PDT 2002
   56.81 + */
   56.82 +public class L10nTask extends MatchingTask {
   56.83 +	private String[] modules;
   56.84 +	private String[] topdirs;
   56.85 +	private String localizableFile, generatedFile, changedFile,globalFile;
   56.86 +	private String allFile = "l10n.list.all";
   56.87 +	private String excludePattern = ""; 
   56.88 +	private String includePattern = ""; 
   56.89 +		// Sets the set of exclude patterns. 
   56.90 +		// Patterns may be separated by a comma or a space.
   56.91 +		// The first instance which necessitated this addition was 
   56.92 +		// "**/ja/**"
   56.93 +	private String buildDir;
   56.94 +	private String distDir;
   56.95 +	private Vector error = new Vector();
   56.96 +	private Hashtable cvsEntriesCache=new Hashtable();
   56.97 +	private Hashtable changed = new Hashtable();
   56.98 +	private Hashtable generatedFileHash = new Hashtable();
   56.99 +	private Hashtable fullPropHash = null ;
  56.100 +
  56.101 +	private Project p;
  56.102 +	private boolean readGlobalFile=false; //have we already read globalFile?
  56.103 +	private StringBuffer[] globalsbholder= new StringBuffer[2];
  56.104 +	static boolean DEBUG = false;
  56.105 +	boolean cont=false;
  56.106 +	private String buildNumber;
  56.107 +	String[] localizableFiles;
  56.108 +
  56.109 +	public void execute() throws BuildException {
  56.110 +		// 1. Check that settable variables have been set.
  56.111 +		// If they have not been, abandon ship!
  56.112 +
  56.113 +		if (modules == null ) {
  56.114 +			throw new BuildException("Required variable not set.  Set 'modules' in the calling .xml file");
  56.115 +		}
  56.116 +		if (topdirs == null ) {
  56.117 +			throw new BuildException("Required variable not set.  Set 'topdirs' in the calling .xml file");
  56.118 +		}
  56.119 +		if (distDir == null ) {
  56.120 +			throw new BuildException("Required variable not set.  Set 'distDir' in the calling .xml file");
  56.121 +		}
  56.122 +
  56.123 +		if (buildDir == null ) {
  56.124 +			throw new BuildException("Required variable not set.  Set 'buildDir' in the calling .xml file");
  56.125 +		}
  56.126 +		if (localizableFile == null ) {
  56.127 +			throw new BuildException("Required variable not set.  Set 'localizableFile' in the calling .xml file");
  56.128 +		}
  56.129 +		if (generatedFile == null ) {
  56.130 +			throw new BuildException("Required variable not set.  Set 'generatedFile' in the calling .xml file");
  56.131 +		}
  56.132 +		if (changedFile == null ) {
  56.133 +			throw new BuildException("Required variable not set.  Set 'changedFile' in the calling .xml file");
  56.134 +		}
  56.135 +		if (buildNumber == null ) {
  56.136 +			throw new BuildException("Required variable not set.  Set 'buildNumber' in the calling .xml file");
  56.137 +		}
  56.138 +
  56.139 +		//if the dir doesn't exist, make it.
  56.140 +		// if the dir still doesn't exist, fail.
  56.141 +		File dd = new File(distDir);
  56.142 +		if ( ! dd.exists()  ) {
  56.143 +			dd.mkdirs();
  56.144 +		}
  56.145 +
  56.146 +		System.out.print("topdirs:\t");
  56.147 +		for (int j=0; j<topdirs.length; j++) {
  56.148 +			System.out.print(topdirs[j]+"\t");
  56.149 +		}
  56.150 +
  56.151 +		System.out.print("\nmodules:\t");
  56.152 +		for (int i=0; i<modules.length; i++) {
  56.153 +			System.out.print(modules[i]+"\t");
  56.154 +		}
  56.155 +
  56.156 +		System.out.println("\ndistDir:\t"+distDir);
  56.157 +		System.out.println("buildDir:\t"+buildDir);
  56.158 +		System.out.println("localizableFile:\t"+localizableFile);
  56.159 +		System.out.println("generatedFile:\t"+generatedFile);
  56.160 +		System.out.println("changedFile:\t"+changedFile);
  56.161 +		System.out.println("globalFile:\t"+globalFile);
  56.162 +		System.out.println("buildNumber:\t"+buildNumber);
  56.163 +
  56.164 +
  56.165 +		CvsEntries ce;
  56.166 +
  56.167 +		p=this.getProject();
  56.168 +
  56.169 +		for (int i=0; i<topdirs.length; i++) {
  56.170 +			// if (DEBUG)  System.out.println("STARTING TOPDIR "+topdirs[i]); 
  56.171 +			for(int j=0; j<modules.length; j++) {
  56.172 +				if (modules[j] != null && ! modules[j].equals("")) {
  56.173 + 				fullPropHash = p.getProperties();
  56.174 +
  56.175 +                                // System.out.println("IN FOR MODULES "+modules[j]);
  56.176 +				// System.out.println("\tSTARTING MODULE "+modules[j]); 
  56.177 +
  56.178 +				File f = new File(topdirs[i]+File.separator+modules[j]+File.separator+localizableFile);
  56.179 +                                // System.out.println("Localizable file is: "+f.getAbsolutePath());
  56.180 +				
  56.181 +				if ( f.exists() ) {
  56.182 +					System.out.println("\t\tFILE exists"+topdirs[i]+File.separator+modules[j]+File.separator+localizableFile);
  56.183 +					File topDir = new File(topdirs[i]);
  56.184 +					File modDir = new File(topdirs[i]+File.separator+modules[j]);
  56.185 +
  56.186 +					// moved getGeneratedFiles from here to only getGeneratedFiles 
  56.187 +					// if there are localizableFiles.
  56.188 +
  56.189 +					localizableFiles = getLocalizableFiles(topDir, modules[j]);
  56.190 +					if (localizableFiles == null ) { 
  56.191 +						if (DEBUG) {
  56.192 +							System.out.println("\t\tNo Localizable Files for this module."+topDir+File.separator+modules[j]); 
  56.193 +						}
  56.194 +					} else {
  56.195 +
  56.196 +						//don't look for the generated Files if there are no localizableFiles
  56.197 +						generatedFileHash = getGeneratedFiles(topDir, modules[j]);
  56.198 +						//if ( generatedFileHash == null ) { System. out.println("\t\tGENFILEHASH is null"); }
  56.199 +					
  56.200 +					/* DO PRE PROCESSING
  56.201 +						int lastSlashIndex;
  56.202 +						String parentDirFullPath;
  56.203 +						String cacheDirFullPath;
  56.204 +					*/
  56.205 +
  56.206 +					for (int k=0; k<localizableFiles.length; k++) {
  56.207 +
  56.208 +					// DO SOME PRE-PROCESSING HERE. CACHE DIR REACTION (don't check for existance of same dir over & over again).  
  56.209 +					
  56.210 +
  56.211 +						int lastSlashIndex = localizableFiles[k].lastIndexOf(File.separator);
  56.212 +						String parentDirFullPath = localizableFiles[k].substring(0, lastSlashIndex);
  56.213 +						
  56.214 +						// Check that the CVS/ dir exists.  
  56.215 +						// If it does not, assume we are dealing with a generated dir 
  56.216 +						// which does not need to be examined by me.
  56.217 +						if ( ! new File(parentDirFullPath+"/CVS").exists() ) {
  56.218 +							//System.out.println("CVSDIR doesn't exist ["+parentDirFullPath+"/CVS ]");
  56.219 +							// skip to the end of this loop
  56.220 +							//HEY!  there must be a cleaner way!! 
  56.221 +							System.out.println("This dir is a generated dir with no CVS dir "+parentDirFullPath);
  56.222 +
  56.223 +						} else {
  56.224 +
  56.225 +							// PRINT TO "allfiles" list.
  56.226 +							boolean success = printToAllFile(topdirs[i], modules[j], localizableFiles);
  56.227 +							if (! success) { 
  56.228 +								System.out.println("ERROR: Print to All File in "+topdirs[i]+", "+modules[j]+"failed.");
  56.229 +
  56.230 +							}
  56.231 +
  56.232 +							ce = (CvsEntries)cvsEntriesCache.get(parentDirFullPath);
  56.233 +
  56.234 +							if ( ce == null ) {
  56.235 +								ce = new CvsEntries(parentDirFullPath);  //passing parentDirFullPath
  56.236 +								cvsEntriesCache.put(parentDirFullPath, ce);
  56.237 +							}
  56.238 +
  56.239 +							if ( generatedFileHash == null ) {
  56.240 +								generatedFileHash=new Hashtable();	
  56.241 +							}
  56.242 +
  56.243 +
  56.244 +							String localizableFileOnly = localizableFiles[k].substring(localizableFiles[k].lastIndexOf(File.separator)+1);
  56.245 +							if (localizableFileOnly == null) { System.out.println("NULL LOCALIZABLE FILE"); } 
  56.246 +						
  56.247 +							String ceRev = ce.getRevnoByFileName(localizableFileOnly);
  56.248 +
  56.249 +							if ( ceRev == null ) {
  56.250 +								// If this file is NOT in ce (doesn't exist in CVS/Entries)
  56.251 +								// there is something wrong with the build working directory.
  56.252 +								// We will collect these file names & report at the end.
  56.253 +							
  56.254 +								//Maybe we don't want to add them.  THe build generates lots of files which aren't in CVS.
  56.255 +								// error.add(localizableFiles[k]);
  56.256 +
  56.257 +							} else {
  56.258 +								// System.out.println("CEREV: "+ceRev);
  56.259 +								// compare revnos
  56.260 +
  56.261 +								String genRev = (String)generatedFileHash.get(localizableFiles[k]);
  56.262 +								// if (DEBUG) System.out.println("GENREV "+genRev + "\tFN: "+localizableFiles[k]);
  56.263 +
  56.264 +								if ( genRev == null || ! ceRev.equals(genRev)) {
  56.265 +									//Update changed fileHash
  56.266 +									changed.put(localizableFiles[k], ceRev);
  56.267 +
  56.268 +
  56.269 +									//Update generatedFileHash
  56.270 +									generatedFileHash.put(localizableFiles[k], ceRev);
  56.271 +								
  56.272 +
  56.273 +								//if (DEBUG) System.out.println("I got this far, but there was nothing CHANGED: "+localizableFiles[k]);
  56.274 +								}
  56.275 +							}
  56.276 +						}
  56.277 +							
  56.278 +					} //for localizable files
  56.279 +
  56.280 +					// IN HERE PRINT TO GENERATED FILE.
  56.281 +					boolean success = printToFile(topdirs[i], modules[j]);
  56.282 +
  56.283 +
  56.284 +					if (! success) { 
  56.285 +						System.out.println("ERROR: Print to File in "+topdirs[i]+", "+modules[j]+"failed.");
  56.286 +					}
  56.287 +
  56.288 +					// toDir should be build/topDir
  56.289 +					// baseDir should be fullpathtoTopDir
  56.290 +					// if (DEBUG) System.out.println("BUILDDIR "+buildDir);
  56.291 +					File tDir = new File(buildDir+File.separator+topdirs[i]);
  56.292 +					int lio = topdirs[i].lastIndexOf(File.separator);
  56.293 +					String shortTopdir = topdirs[i].substring(lio+1);
  56.294 +
  56.295 +
  56.296 +						// make a tar no matter what.  
  56.297 +						// At a minimum it will have
  56.298 +						// file module.l10n.list.all.
  56.299 +						// THEN delete files.
  56.300 +
  56.301 +						mkTars(topdirs[i]+File.separator, buildDir+File.separator+shortTopdir+File.separator+modules[j]+".tar", topdirs[i]+File.separator+modules[j]+File.separator+modules[j]+"."+changedFile, modules[j]); 
  56.302 +					// if (! changed.isEmpty() ) {
  56.303 +						Delete delete = (Delete)p.createTask("delete");
  56.304 +						delete.setDir(new File(topdirs[i]+File.separator+modules[j]));
  56.305 +						FileSet fs = new FileSet();
  56.306 +						fs.setDir(new File(topdirs[i]+File.separator+modules[j]));
  56.307 +						String includes = modules[j]+"."+generatedFile+","+ modules[j]+"."+changedFile+","+ modules[j]+"."+allFile;
  56.308 +						fs.setIncludes(includes);
  56.309 +						delete.addFileset(fs);
  56.310 +
  56.311 +						delete.setIncludes(includes);
  56.312 +						delete.setVerbose(true);
  56.313 +						delete.execute();
  56.314 +					//}
  56.315 +
  56.316 +
  56.317 +					// Clean up before moving on.
  56.318 +
  56.319 +					// if (DEBUG) System.out.println("CLEARING "+topdirs[i] + " " + modules[j]);
  56.320 +					generatedFileHash.clear();
  56.321 +					changed.clear();
  56.322 +					error.clear();
  56.323 +
  56.324 +				} // if File: topDirs[i]/modules[j]/localizableFile exists
  56.325 +				} // if localizableFiles is not null
  56.326 +			} // if module isn't null
  56.327 +			} //for module
  56.328 +		} //for topdirs
  56.329 +
  56.330 +		// Tar everything
  56.331 +		if (DEBUG) System.out.println("ABOUT TO MAKE THE BIG TAR: "+distDir+"/l10n-"+buildNumber+".tar.gz");
  56.332 +
  56.333 +		// Check to make sure that the build dir exists, 
  56.334 +		// & that there are little tars to tar... or we get a "basedir dne" 
  56.335 +		// exception.
  56.336 +		
  56.337 +		File bd = new File(buildDir);
  56.338 +		if (bd.exists()) {
  56.339 +			File tarFile = new File(buildDir+"/l10n-"+buildNumber+".tar");
  56.340 +
  56.341 +			Tar tar = (Tar)p.createTask("tar");
  56.342 +			tar.setBasedir(bd);
  56.343 +			tar.setTarfile(tarFile);
  56.344 +			tar.setLongfile("gnu");
  56.345 +			////// automatically includes all in the basedir
  56.346 +			tar.execute();
  56.347 +
  56.348 +			if ( tarFile.exists() ) {
  56.349 +				GZip gzip = (GZip)p.createTask("gzip");
  56.350 +				gzip.setSrc(new File(buildDir+"/l10n-"+buildNumber+".tar"));
  56.351 +				gzip.setZipfile(new File(distDir+"/l10n-"+buildNumber+".tar.gz"));
  56.352 +				gzip.execute();
  56.353 +			} else {
  56.354 +				System.out.println("NO tar file, can't gzip"+buildDir+"/l10n-"+buildNumber+".tar");
  56.355 +			}
  56.356 +		} else {
  56.357 +			System.out.println("No files in builddir.  No kit to build");
  56.358 +		}
  56.359 +
  56.360 +
  56.361 +		
  56.362 +
  56.363 +	} // execute()
  56.364 +
  56.365 +	public void mkTars(String srcDir, String fullTarfilePath, String fullIncludesFilePath, String module) {
  56.366 +		//String td = srcDir.substring(srcDir.lastIndexOf(File.separator)+1);
  56.367 +		if (DEBUG) {
  56.368 +			// System.out.println("SRCDIR = "+srcDir);
  56.369 +			//System.out.println("FULL TARFILE PATH = "+fullTarfilePath);
  56.370 +		}
  56.371 +
  56.372 +		File incBaseDir = new File(srcDir);
  56.373 +		Tar tar = (Tar)p.createTask("tar");
  56.374 +		tar.setBasedir(new File(srcDir)); 
  56.375 +		tar.setTarfile(new File(fullTarfilePath));
  56.376 +		
  56.377 +		File incFile = new File(fullIncludesFilePath); 
  56.378 +
  56.379 +		if (incFile.exists() ) { 
  56.380 +			tar.setIncludes(module+File.separator+module+"."+allFile);
  56.381 +			tar.setIncludes(module+File.separator+module+"."+generatedFile);
  56.382 +			tar.setIncludes(module+File.separator+module+"."+changedFile);
  56.383 +			tar.setIncludesfile(incFile);
  56.384 +			tar.setLongfile("gnu");
  56.385 +			tar.execute();
  56.386 +		}
  56.387 +
  56.388 +	}
  56.389 +
  56.390 +	public boolean printToAllFile(String fullTopDir, String module, String[] localizableFiles) {
  56.391 +		try {
  56.392 +			int lastSlashIndex = fullTopDir.lastIndexOf(File.separator);
  56.393 +			String topDir= fullTopDir.substring(lastSlashIndex+1);
  56.394 +
  56.395 +			File f = new File(buildDir+ File.separator +topDir );
  56.396 +			f.mkdirs();
  56.397 +
  56.398 +			FileWriter allWrite = new FileWriter(fullTopDir+File.separator+module+File.separator+module+"."+allFile);
  56.399 +
  56.400 +			if ( localizableFiles != null ) {
  56.401 +				for (int i=0; i<localizableFiles.length; i++) {
  56.402 +					int lio = localizableFiles[i].lastIndexOf(fullTopDir);
  56.403 +					if (lio >= 0) {
  56.404 +						String moduleFileName= localizableFiles[i].substring(lio+fullTopDir.length()+1);
  56.405 +						allWrite.write(moduleFileName+"\n");
  56.406 +					} else {
  56.407 +						System.out.println("Error: NO TOPDIR HERE: "+ localizableFiles[i]+ " FTD: "+fullTopDir+" LIO "+lio);
  56.408 +					}
  56.409 +
  56.410 +				}
  56.411 +			}
  56.412 +			allWrite.close();
  56.413 +		
  56.414 +		} catch (IOException ioe) {
  56.415 +			System.out.println("IOException"+ioe);
  56.416 +			return false;
  56.417 +		}
  56.418 +		return true;
  56.419 +
  56.420 +	}
  56.421 +	public boolean printToFile(String fullTopDir, String module) {
  56.422 +
  56.423 +		// if (DEBUG) System.out.println("IN printToFile FULLTOPDIR"+fullTopDir+ " MODULE" + module);
  56.424 +			
  56.425 +		try {
  56.426 +
  56.427 +			int lastSlashIndex = fullTopDir.lastIndexOf(File.separator);
  56.428 +			String topDir= fullTopDir.substring(lastSlashIndex+1);
  56.429 +
  56.430 +		/*  No need to mkdirs now - printToAllFile is making them.
  56.431 +			File f = new File(buildDir+ File.separator +topDir );
  56.432 +			f.mkdirs();
  56.433 +		*/
  56.434 +
  56.435 +			FileWriter genWrite = new FileWriter(fullTopDir+File.separator+module+File.separator+module+"."+generatedFile);
  56.436 +			FileWriter changedWrite = new FileWriter(fullTopDir+File.separator+module+File.separator+module+"."+changedFile);
  56.437 +
  56.438 +
  56.439 +			if ( generatedFileHash == null ) {
  56.440 +				generatedFileHash = new Hashtable();
  56.441 +			} else {
  56.442 +
  56.443 +				for (Enumeration g = generatedFileHash.keys() ; g.hasMoreElements() ;) {
  56.444 +					String genFileKey = (String)g.nextElement();
  56.445 +					int lioTopDir =  genFileKey.lastIndexOf(topDir);
  56.446 +					String moduleFileName = genFileKey.substring(lioTopDir+topDir.length()+1) ;
  56.447 +
  56.448 +					genWrite.write(moduleFileName+"\t"+(String)generatedFileHash.get(genFileKey)+"\n");
  56.449 +				}
  56.450 +
  56.451 +				// To make sure the changeFile & generatedFile appear in the tar,
  56.452 +				// make them the first lines in the file.
  56.453 +				for (Enumeration c = changed.keys() ; c.hasMoreElements() ;) {
  56.454 +					String changedFileKey = (String)c.nextElement();
  56.455 +
  56.456 +					int lio = changedFileKey.lastIndexOf(topDir+File.separator+module);
  56.457 +					String moduleFileName;
  56.458 +					if (lio >= 0) {
  56.459 +				
  56.460 +						moduleFileName=changedFileKey.substring(changedFileKey.lastIndexOf(topDir+File.separator+module)+topDir.length()+1);
  56.461 +						changedWrite.write(moduleFileName+"\n");
  56.462 +					} else {
  56.463 +						// If we get here, the cache is probobly not really being cleared.  
  56.464 +
  56.465 +						//The cache is not being cleared 
  56.466 +						// OR we have wild-card characters
  56.467 +						System.out.println("WARNING: L10n.list file error. Each item in your list should reference the current module.  If this is a global l10n file used over several modules use the property ${l10n-module} as a place-holder.  This error occurred in "+module+".");
  56.468 +						// Contact program administrator.\r\t"+ changedFileKey+ "\r\tTD "+topDir+File.separator+module +" LIO "+lio);	
  56.469 +					}
  56.470 +
  56.471 +					//changedWrite.write(changedFileKey+"\n");
  56.472 +					//Changed should have a list of fullpath in order to do copy
  56.473 +				}
  56.474 +			}
  56.475 +
  56.476 +			if (! error.isEmpty() ) {
  56.477 +				FileWriter errorWrite = new FileWriter(buildDir+File.separator+"l10n-errors.txt", true);
  56.478 +				for (Enumeration e = error.elements(); e.hasMoreElements();) {
  56.479 +					String ee = (String)e.nextElement();
  56.480 +					errorWrite.write(ee+"\n");
  56.481 +					System.out.println("Error: "+ee);
  56.482 +				}
  56.483 +				errorWrite.close();
  56.484 +			}
  56.485 +	
  56.486 +
  56.487 +			genWrite.close();
  56.488 +			changedWrite.close();
  56.489 +
  56.490 +
  56.491 +		} catch (IOException ioe) {
  56.492 +			System.out.println("IOException printToFile()"+ioe);
  56.493 +			return false;
  56.494 +		}
  56.495 +		return true;
  56.496 +	}
  56.497 +
  56.498 +        /** You can use this function independently of "execute()", but
  56.499 +         * you have to set these attributes: localizableFile,
  56.500 +         * globalFile (if "read global" is used in any l10n.list
  56.501 +         * files), excludePattern (if desired), includePattern (if
  56.502 +         * desired)
  56.503 +         */
  56.504 +	public String[] getLocalizableFiles(File topRoot, String module) {
  56.505 +		String[] lfs = null;
  56.506 +		StringBuffer[] sbholder=new StringBuffer[2];
  56.507 +		StringBuffer sbi= new StringBuffer();
  56.508 +		StringBuffer sbe = new StringBuffer();
  56.509 +		String includeS="";
  56.510 +		String excludeS="";
  56.511 +		// if (DEBUG) System.out.println("\t\tIN getLocalizableFiles(File "+topRoot.getName()+", " + module+")");
  56.512 +
  56.513 +		if( fullPropHash == null) {
  56.514 +		  p = getProject() ;
  56.515 +		  fullPropHash = p.getProperties();
  56.516 +		}
  56.517 +		fullPropHash.put("l10n-module", module);
  56.518 +
  56.519 +		try {
  56.520 +			File includes = new File(topRoot.getCanonicalPath() + File.separator + module + File.separator + localizableFile);
  56.521 +			if ( ! includes.exists() || includes.length() <= 0 ) {
  56.522 +				//if (DEBUG) System.out.println("FILE IS too short to mess with "+ module);
  56.523 +				return lfs;
  56.524 +			}
  56.525 +
  56.526 +			try {
  56.527 +				sbholder = processListFile(includes,module);
  56.528 +			} catch (java.io.IOException ioe) {
  56.529 +				System.out.println("Error processing file. "+ioe);
  56.530 +			}
  56.531 +
  56.532 +			if (sbholder != null) {
  56.533 +				sbi = sbholder[0];
  56.534 +				sbe = sbholder[1];
  56.535 +
  56.536 +				sbe.append(" "+excludePattern);
  56.537 +				sbi.append(" "+includePattern);
  56.538 +
  56.539 +				if (DEBUG) {
  56.540 +					System.out.println("INC "+sbi.toString());
  56.541 +					System.out.println("EXC "+sbe.toString());
  56.542 +				}
  56.543 +			}
  56.544 +
  56.545 +			this.fileset = new FileSet();
  56.546 +
  56.547 +			// this.setIncludesfile(includes);
  56.548 +			if ( sbi !=null) {
  56.549 +				this.setIncludes(sbi.toString()); 
  56.550 +					//changed to accomodate excludes in file
  56.551 +
  56.552 +				if ( sbi.toString().equals(" ") ) {
  56.553 +                                        this.setIncludes(module+"/src");
  56.554 +				}
  56.555 +			}
  56.556 +
  56.557 +			if (sbe != null ) {
  56.558 +				this.setExcludes(sbe.toString());
  56.559 +				// Sets the set of exclude patterns. 
  56.560 +				// Patterns may be separated by a comma or a space.
  56.561 +			}
  56.562 +
  56.563 +			DirectoryScanner ds = this.getDirectoryScanner(topRoot);
  56.564 +		
  56.565 +			ds.scan();
  56.566 +			lfs = ds.getIncludedFiles();
  56.567 +
  56.568 +			for (int k=0; k<lfs.length; k++) {
  56.569 +				// if (DEBUG) System.out.println("\t\t\tLFS "+lfs[k]);
  56.570 +				lfs[k] = topRoot+File.separator+lfs[k].trim();
  56.571 +				//lfs[k] = topRoot+File.separator+lfs[k];
  56.572 +			}
  56.573 +
  56.574 +			// if (DEBUG) System.out.println("THERE ARE "+lfs.length + " FILES in INCL FILES");
  56.575 +		} catch(java.io.IOException e) {
  56.576 +			System.out.println(e.getMessage());
  56.577 +		}
  56.578 +		return lfs;
  56.579 +	}
  56.580 +
  56.581 +	public Hashtable getGeneratedFiles(File topDir, String mod) {
  56.582 +		// NOTE: This method will return 'null' 100% of the time if there 
  56.583 +		// are no l10n.list.generated files.
  56.584 +		// At this writing, this functionality is not used.
  56.585 +		// EG 1/03
  56.586 +
  56.587 +		Hashtable h=new Hashtable();
  56.588 +		// Read generated File
  56.589 +		try {
  56.590 +
  56.591 +			String topDirFullPath = topDir.getCanonicalPath();
  56.592 +			// if (DEBUG) System.out.println("\t\ttopDirFullPath: "+topDirFullPath);
  56.593 +
  56.594 +			BufferedReader inBuff = new BufferedReader(new FileReader(new File(topDir+File.separator+mod,generatedFile)));
  56.595 +			boolean eof = false;
  56.596 +			while (! eof) {
  56.597 +                String line = inBuff.readLine();
  56.598 +                if (line==null) {
  56.599 +                    eof = true;
  56.600 +                } else {
  56.601 +					//System.out.println("LL "+ line);
  56.602 +
  56.603 +					int tabIndex = line.indexOf("\t");
  56.604 +					if (tabIndex > 0) {
  56.605 +						String filename = line.substring(0,tabIndex);
  56.606 +						String revision = line.substring(tabIndex+1);
  56.607 +						h.put(topDirFullPath+File.separator+filename, revision);
  56.608 +					} else {
  56.609 +						System.out.println("There's no tab in this line"+"["+line+"]");
  56.610 +					
  56.611 +					}
  56.612 +
  56.613 +                }
  56.614 +
  56.615 +            } //while
  56.616 +		} catch(java.io.FileNotFoundException e) {
  56.617 +			// Warning: Generated File: "+generatedFile+" in "+
  56.618 +			// topDir+File.separator+mod+" not found.  
  56.619 +			// Adding all files to changed list."
  56.620 +			return(null);
  56.621 +		} catch(java.io.IOException e) {
  56.622 +			System.out.println("IOException "+ e);
  56.623 +		}
  56.624 +
  56.625 +		return h;
  56.626 +	}
  56.627 +
  56.628 +	// Accessor Methods
  56.629 +
  56.630 +	public void setTopdirs(String s) {
  56.631 +		StringTokenizer st = new StringTokenizer(s);
  56.632 +		String[] tops = new String[st.countTokens()];
  56.633 +		int i=0;
  56.634 +		while (st.hasMoreTokens()) {
  56.635 +			tops[i++]=st.nextToken();
  56.636 +		}
  56.637 +
  56.638 +		if (false) {
  56.639 +			for (int j=0; j<tops.length; j++) {
  56.640 +				System.out.println("TOPS "+tops[j]);
  56.641 +			}
  56.642 +		}
  56.643 +
  56.644 +		this.topdirs = tops;
  56.645 +		
  56.646 +	}
  56.647 +	public void setModules(String s) {
  56.648 +		StringTokenizer st = new StringTokenizer(s,",");
  56.649 +		String[] mods = new String[st.countTokens()];
  56.650 +                HashSet modSet = new HashSet(); //This will guarantee that there will be no duplications
  56.651 +                String fullMod = null;
  56.652 +		
  56.653 +		while (st.hasMoreTokens()) {
  56.654 +			fullMod=st.nextToken().trim();;
  56.655 +
  56.656 +			// if (DEBUG) System.out.println("ITEM IN MODLIST: "+fullMod);
  56.657 +
  56.658 +			int index = fullMod.indexOf(File.separator);
  56.659 +			if (index >= 0) {
  56.660 +				//Check that the mod doesn't have a slash
  56.661 +				// (if it does, keep only what is to the left of the slash)
  56.662 +				fullMod=fullMod.substring(0,index);
  56.663 +
  56.664 +				// if (DEBUG) System.out.println("CHANGED FULLMOD & it's NOW "+fullMod);
  56.665 +			}
  56.666 +                        modSet.add( fullMod );
  56.667 +		}
  56.668 +                this.modules = new String[ modSet.size() ];
  56.669 +                Iterator it = modSet.iterator();
  56.670 +                
  56.671 +                int i=0;
  56.672 +                while( it.hasNext() )
  56.673 +                    this.modules[i++] = (String) it.next();
  56.674 +		
  56.675 +	}
  56.676 +
  56.677 +	public StringBuffer[] processListFile(File inc,String module) throws java.io.IOException {
  56.678 +		System.out.println("Reading list file: "+inc.toString());
  56.679 +		StringBuffer[] sbholder=new StringBuffer[2];
  56.680 +		StringBuffer sbi = new StringBuffer();
  56.681 +		StringBuffer sbe = new StringBuffer();
  56.682 +
  56.683 +		
  56.684 +		if(inc.exists() && inc.length() >0) {
  56.685 +			//Read Includes File.
  56.686 +			try {
  56.687 +				BufferedReader br = new BufferedReader(new FileReader(inc));
  56.688 +				String line;
  56.689 +				while((line=br.readLine()) != null && line.indexOf("#") <0) {
  56.690 +					boolean skipit=false;
  56.691 +					// For each line check if there are any properties which 
  56.692 +					// should be interpreted first.
  56.693 +					while (line.indexOf("${") >= 0 && skipit == false) {
  56.694 +						
  56.695 +						String propertyName;
  56.696 +						String value="";
  56.697 +						String res="";
  56.698 +						String pre="";
  56.699 +
  56.700 +						propertyName=line.substring(line.indexOf("${")+2,line.indexOf("}"));
  56.701 +
  56.702 +						if (fullPropHash.containsKey(propertyName)) {
  56.703 +							
  56.704 +							value=(String)fullPropHash.get(propertyName);
  56.705 +							res = line.substring(line.indexOf("}")+1);	
  56.706 +							pre= line.substring(0,line.indexOf("{")-1);
  56.707 +							line=pre+value+res;
  56.708 +							// System.out.println("LINE is now "+line);
  56.709 +						} else {
  56.710 +							System.out.println("Uninterpretable property in l10n file:"+inc.toString()+". "+propertyName+" Interpreting the entire line literally.");
  56.711 +							skipit=true;
  56.712 +						}
  56.713 +					}
  56.714 +
  56.715 +					if (line.indexOf("exclude") >= 0) {
  56.716 +						sbe.append(" "+line.substring("exclude".length()+1));
  56.717 +					} else if (line.indexOf("read global") >= 0) {
  56.718 +						
  56.719 +						if (globalFile != null && ! globalFile.equals("")) {
  56.720 +							if (readGlobalFile==true) {
  56.721 +								System.out.println("Already read it");
  56.722 +								//We did it once, don't do it again.
  56.723 +								// just copy in the values.
  56.724 +								sbi.append(" "+globalsbholder[0]);
  56.725 +								sbe.append(" "+globalsbholder[1]);
  56.726 +							} else {
  56.727 +							        globalsbholder[0]= new StringBuffer();
  56.728 +								globalsbholder[1]= new StringBuffer();
  56.729 +								StringBuffer[] globalarray = processListFile(new File(globalFile),module);
  56.730 +								if (globalarray[0] != null) {
  56.731 +									sbi.append(" "+globalarray[0]);
  56.732 +									globalsbholder[0].append(" "+globalarray[0]); 
  56.733 +									//put it where we can get it back.
  56.734 +								} 
  56.735 +								if (globalarray[1] != null) {
  56.736 +									sbe.append(" "+globalarray[1]);
  56.737 +									globalsbholder[1].append(" "+globalarray[1]); 
  56.738 +										//put it where we can get it back.
  56.739 +								}
  56.740 +							}
  56.741 +							readGlobalFile = true ;
  56.742 +						}
  56.743 +					} else if( line.trim().startsWith( "read")) {
  56.744 +					  String l = line.trim() ;
  56.745 +					  l = l.substring( 4) ;
  56.746 +					  l = l.trim() ;
  56.747 +					  StringBuffer[] sbarr = processListFile( new File( l), 
  56.748 +										  module) ;
  56.749 +					  sbi.append( " " + sbarr[ 0]) ;
  56.750 +					  sbe.append( " " + sbarr[ 1]) ;
  56.751 +					} else {
  56.752 +						sbi.append(" "+line);
  56.753 +					}
  56.754 +					// System.out.println("GLOBAL"+line.indexOf("read global")+" EXCLUDES "+line.indexOf("exclude")+ "FILE"+inc.toString());
  56.755 +				} //while
  56.756 +				br.close();
  56.757 +				} catch (java.io.IOException ioe) {
  56.758 +					throw new java.io.IOException(ioe.toString());	
  56.759 +				}
  56.760 +		}
  56.761 +		sbholder[0]=sbi;
  56.762 +		sbholder[1]=sbe;
  56.763 +		return sbholder;
  56.764 +	}
  56.765 +
  56.766 +	public void setDistDir(String s) {
  56.767 +		// if (DEBUG) System.out.println("DIST DIR SHOULD BE: "+s);
  56.768 +		this.distDir=s;
  56.769 +	}
  56.770 +	public void setBuildDir(String s) {
  56.771 +		this.buildDir=s;
  56.772 +	}
  56.773 +	public void setDebug(boolean s) {
  56.774 +		this.DEBUG=s;
  56.775 +	}
  56.776 +	public void setLocalizableFile(String s) {
  56.777 +		this.localizableFile=s;
  56.778 +	}
  56.779 +	public void setExcludePattern(String s) {
  56.780 +		this.excludePattern=s;
  56.781 +	}
  56.782 +	public void setIncludePattern(String s) {
  56.783 +		this.includePattern=s;
  56.784 +	}
  56.785 +	
  56.786 +	public void setBuildNumber(String s) {
  56.787 +		this.buildNumber=s;
  56.788 +	}
  56.789 +	public void setGeneratedFile(String s) {
  56.790 +		this.generatedFile=s;
  56.791 +	}
  56.792 +	public void setChangedFile(String s) {
  56.793 +		this.changedFile=s;
  56.794 +	}
  56.795 +	public void setGlobalFile(String s) {
  56.796 +		this.globalFile=s;
  56.797 +	}
  56.798 +}
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/LocJHIndexer.java	Sun Jan 28 18:54:08 2007 +0000
    57.3 @@ -0,0 +1,237 @@
    57.4 +/*
    57.5 + * The contents of this file are subject to the terms of the Common Development
    57.6 + * and Distribution License (the License). You may not use this file except in
    57.7 + * compliance with the License.
    57.8 + *
    57.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   57.10 + * or http://www.netbeans.org/cddl.txt.
   57.11 +
   57.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   57.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   57.14 + * If applicable, add the following below the CDDL Header, with the fields
   57.15 + * enclosed by brackets [] replaced by your own identifying information:
   57.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   57.17 + *
   57.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   57.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   57.20 + * Microsystems, Inc. All Rights Reserved.
   57.21 + */
   57.22 +
   57.23 +package org.netbeans.modules.visualweb.ravebuild;
   57.24 +
   57.25 +import java.io.*;
   57.26 +import java.util.*;
   57.27 +
   57.28 +import org.apache.tools.ant.* ;
   57.29 +import org.apache.tools.ant.taskdefs.* ;
   57.30 +import org.apache.tools.ant.types.FileSet;
   57.31 +import org.apache.tools.ant.types.Path;
   57.32 +
   57.33 +/** This task runs the JHIndexer task multiple times, once for each
   57.34 + * language, and automatically creates the appropriate regular
   57.35 + * expressions to choose the files for each language.  This task
   57.36 + * greatly reduces the amount of Ant code required to run JHIndexer
   57.37 + * especially when there are helpsets for multiple languages in the
   57.38 + * same directory tree.
   57.39 + *
   57.40 + * @author Jerry Huth (email: jerry@solidstep.com)
   57.41 + */
   57.42 +public class LocJHIndexer extends MatchingTask {
   57.43 +
   57.44 +  protected File basedir = null ;
   57.45 +  protected String dbdir = null ;
   57.46 +  protected String locales = null ;
   57.47 +  protected String jhall = null ;
   57.48 +
   57.49 +  /** Specify a regular expression to find <samp>jhall.jar</samp>
   57.50 +   * (JavaHelp tools library).
   57.51 +   */
   57.52 +  public void setJhall( String jhall) {
   57.53 +    this.jhall = jhall;
   57.54 +  }
   57.55 +
   57.56 +  /** Get the jhall jar file to use. */
   57.57 +  protected String getJhall() {
   57.58 +    String ret = null ;
   57.59 +    String prop = null ;
   57.60 +
   57.61 +    // Use the attribute if specified. //
   57.62 +    if( jhall != null) {
   57.63 +      ret = jhall ;
   57.64 +    }
   57.65 +    else {
   57.66 +
   57.67 +      // Else look for the global property. //
   57.68 +      prop = getProject().getProperty("locjhindexer.jhall");
   57.69 +      if( prop != null) {
   57.70 +	ret = prop ;
   57.71 +      }
   57.72 +    }
   57.73 +
   57.74 +    return( ret) ;
   57.75 +  }
   57.76 +
   57.77 +  /** Set the location of the docs helpsets' base dir. */
   57.78 +  public void setBasedir( File dir) {
   57.79 +    basedir = dir ;
   57.80 +  }
   57.81 +
   57.82 +  /** Set the name of the search database directory (which is under
   57.83 +   * <samp>basedir/&lt;locale></samp>)
   57.84 +   */
   57.85 +  public void setDbdir( String dir) {
   57.86 +    dbdir = dir ;
   57.87 +  }
   57.88 +
   57.89 +  /** Set a comma-separated list of locales which have helpsets. */
   57.90 +  public void setLocales( String s) {
   57.91 +    locales = s ;
   57.92 +  }
   57.93 +
   57.94 +  /** Get the locales for which we'll look for helpsets. */
   57.95 +  protected String getLocales() {
   57.96 +    if( locales != null) {
   57.97 +      return( locales) ;
   57.98 +    }
   57.99 +    return(getProject().getProperty("locjhindexer.locales"));
  57.100 +  }
  57.101 +
  57.102 +  public void execute() throws BuildException {
  57.103 +    String locs = getLocales() ;
  57.104 +    String helpset_locs = null ;
  57.105 +    StringTokenizer tokenizer = null ;
  57.106 +    String loc = null ;
  57.107 +
  57.108 +    if( getJhall() == null)
  57.109 +      throw new BuildException( "Must specify the jhall attribute") ;
  57.110 +    if( dbdir == null || dbdir.trim().equals( ""))
  57.111 +      throw new BuildException( "Must specify the dbdir attribute") ;
  57.112 +    if( basedir == null)
  57.113 +      throw new BuildException( "Must specify the basedir attribute") ;
  57.114 +    if( locs == null || locs.trim().equals( ""))
  57.115 +      throw new BuildException( "Must specify the locales attribute") ;
  57.116 +
  57.117 +    // I couldn't get it to work unless I explicitly added the task def here. //
  57.118 +    getProject().addTaskDefinition("jhindexer", JHIndexer.class);
  57.119 +
  57.120 +    // For each locale. //
  57.121 +    tokenizer = new StringTokenizer( locs, ", ") ;
  57.122 +    while( tokenizer.hasMoreTokens()) {
  57.123 +      loc = tokenizer.nextToken() ;
  57.124 +
  57.125 +      // If there's a helpset for this locale. //
  57.126 +      if( hasHelpset( loc)) {
  57.127 +
  57.128 +	// Add it to the list of locales that have helpsets. //
  57.129 +	if( helpset_locs == null) {
  57.130 +	  helpset_locs = new String( loc) ;
  57.131 +	}
  57.132 +	else {
  57.133 +	  helpset_locs += "," + loc ;
  57.134 +	}
  57.135 +      }
  57.136 +    }
  57.137 +
  57.138 +    // For each locale. //
  57.139 +    if( helpset_locs != null) {
  57.140 +      tokenizer = new StringTokenizer( helpset_locs, ", ") ;
  57.141 +      while( tokenizer.hasMoreTokens()) {
  57.142 +	loc = tokenizer.nextToken() ;
  57.143 +
  57.144 +	// Run the JHIndexer for this locale. //
  57.145 +	RunForLocale( loc) ;
  57.146 +      }
  57.147 +    }
  57.148 +  }
  57.149 +
  57.150 +  /** See if there's a helpset for this locale. */
  57.151 +  protected boolean hasHelpset( String loc) {
  57.152 +    boolean ret = false ;
  57.153 +    LocHelpsetFilter filter = new LocHelpsetFilter( loc) ;
  57.154 +    File files[] ;
  57.155 +
  57.156 +    files = basedir.listFiles( filter) ;
  57.157 +    if( files != null && files.length > 0) {
  57.158 +      ret = true ;
  57.159 +    }
  57.160 +
  57.161 +    return( ret) ;
  57.162 +  }
  57.163 +
  57.164 +  // Run JHIndexer for the given locale. //
  57.165 +  protected void RunForLocale( String locale) throws BuildException {
  57.166 +    JHIndexer jhindexer ;
  57.167 +
  57.168 +    jhindexer = (JHIndexer) getProject().createTask("jhindexer");
  57.169 +    jhindexer.init() ;
  57.170 +
  57.171 +    jhindexer.setIncludes( locale + "/**/*.htm*") ;
  57.172 +    jhindexer.setExcludes( locale + "/" + dbdir + "/" + "," +
  57.173 +			   locale + "/credits.htm*") ;
  57.174 +    jhindexer.setBasedir( new File( basedir + "/")) ;
  57.175 +    jhindexer.setDb( new File( basedir + "/" + locale + "/" + dbdir)) ;
  57.176 +    jhindexer.setLocale( locale) ;
  57.177 +    setJHLib( jhindexer) ;
  57.178 +
  57.179 +    jhindexer.execute() ;
  57.180 +  }
  57.181 +
  57.182 +  protected void setJHLib( JHIndexer jhindexer) {
  57.183 +    String jhlib, dir, regexp ;
  57.184 +    int idx, i ;
  57.185 +    FileSet fs ;
  57.186 +    File file ;
  57.187 +    LinkedList dirs, regexps ;
  57.188 +    StringTokenizer st ;
  57.189 +    Path path ;
  57.190 +
  57.191 +    // For each regular expression. //
  57.192 +    dirs = new LinkedList() ;
  57.193 +    regexps = new LinkedList() ;
  57.194 +    jhlib = getJhall() ;
  57.195 +    st = new StringTokenizer( jhlib, " 	\n,") ;
  57.196 +    while( st.hasMoreTokens()) {
  57.197 +      regexp = st.nextToken() ;
  57.198 +
  57.199 +      // Break the regular expression up into directory and file //
  57.200 +      // components.						 //
  57.201 +      idx = regexp.lastIndexOf( "/") ;
  57.202 +      dir = regexp.substring( 0, idx) ;
  57.203 +      file = new File( dir) ;
  57.204 +      if( file.exists()) {
  57.205 +	dirs.add( dir) ;
  57.206 +	regexps.add( regexp.substring( idx+1)) ;
  57.207 +      }
  57.208 +    }
  57.209 +
  57.210 +    if( dirs.size() > 0) {
  57.211 +      path = jhindexer.createClasspath() ;
  57.212 +      for( i = 0; i < dirs.size(); i++) {
  57.213 +	dir = (String) dirs.get( i) ;
  57.214 +	regexp = (String) regexps.get( i) ;
  57.215 +	fs = new FileSet() ;
  57.216 +	fs.setDir( new File( dir)) ;
  57.217 +	fs.setIncludes( regexp) ;
  57.218 +	path.addFileset( fs) ;
  57.219 +      }
  57.220 +    }
  57.221 +    else {
  57.222 +      throw new BuildException( "jhall not found.") ;
  57.223 +    }
  57.224 +  }
  57.225 +
  57.226 +  protected class LocHelpsetFilter implements FilenameFilter {
  57.227 +    protected String locale = null ;
  57.228 +
  57.229 +    public LocHelpsetFilter( String loc) {
  57.230 +      locale = loc ;
  57.231 +    }
  57.232 +
  57.233 +    public boolean accept(File dir,
  57.234 +			  String name) {
  57.235 +      return( name.endsWith( "_" + locale + ".hs")) ;
  57.236 +    }
  57.237 +  }
  57.238 +
  57.239 +}
  57.240 +
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/LocMakeNBM.java	Sun Jan 28 18:54:08 2007 +0000
    58.3 @@ -0,0 +1,603 @@
    58.4 +/*
    58.5 + * The contents of this file are subject to the terms of the Common Development
    58.6 + * and Distribution License (the License). You may not use this file except in
    58.7 + * compliance with the License.
    58.8 + *
    58.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   58.10 + * or http://www.netbeans.org/cddl.txt.
   58.11 +
   58.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   58.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   58.14 + * If applicable, add the following below the CDDL Header, with the fields
   58.15 + * enclosed by brackets [] replaced by your own identifying information:
   58.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   58.17 + *
   58.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   58.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   58.20 + * Microsystems, Inc. All Rights Reserved.
   58.21 + */
   58.22 +
   58.23 +package org.netbeans.modules.visualweb.ravebuild;
   58.24 +
   58.25 +import java.io.* ;
   58.26 +import java.net.MalformedURLException;
   58.27 +import java.util.* ;
   58.28 +
   58.29 +import org.apache.tools.ant.* ;
   58.30 +import org.apache.tools.ant.taskdefs.* ;
   58.31 +import org.apache.tools.ant.types.* ;
   58.32 +
   58.33 +/** Runs the makenbm task for each locale specified in the
   58.34 + * global property locmakenbm.locales.
   58.35 + * NOTE: Currently this runs makelnbm, since the new
   58.36 + * functionality in that hasn't been merged into makenbm
   58.37 + * yet.
   58.38 + *
   58.39 + * @author Jerry Huth (email: jerry@solidstep.com)
   58.40 + */
   58.41 +public class LocMakeNBM extends Task {
   58.42 +
   58.43 +  protected String locales = null ;
   58.44 +  protected String mainDir = null ;
   58.45 +  protected File topDir = null ;
   58.46 +  protected String fileName = null ;
   58.47 +  protected String moduleName = null ;
   58.48 +  protected String baseFileName = null ;
   58.49 +  protected boolean deleteInfo = false ;
   58.50 +  protected String nbmIncludes = null ;
   58.51 +  protected String modInfo = null ;
   58.52 +  protected String findLocBundle = "." ;  // relative to the directory 
   58.53 +				          // corresponding to the module's 
   58.54 +                                          // codename
   58.55 +  protected File locBundle = null ;  // path to localizing bundle - overrides 
   58.56 +                                     // findLocBundle
   58.57 +  protected String locIncludes = null ; // comma-separated list of 
   58.58 +                                        // "<locale>:<pattern>" elements
   58.59 +  private String global = null;
   58.60 +
   58.61 +  /** Install globally? */
   58.62 +  public void setGlobal (String isGlobal) {
   58.63 +    this.global = isGlobal;
   58.64 +  }
   58.65 +
   58.66 +  public void setLocales( String s) {
   58.67 +    locales = s ;
   58.68 +  }
   58.69 +  public void setMainDir( String s) {
   58.70 +    mainDir = s ;
   58.71 +  }
   58.72 +  public void setTopDir( File f) {
   58.73 +    topDir = f ;
   58.74 +  }
   58.75 +  public void setModule(String module) {
   58.76 +      this.moduleName = module;
   58.77 +      log("Setting moduleName = '"+moduleName+"'", Project.MSG_VERBOSE);
   58.78 +  }
   58.79 +  public void setFile( String s) {
   58.80 +    fileName = s ;
   58.81 +    log("Setting fileName = '"+fileName+"'", Project.MSG_VERBOSE);
   58.82 +    if( !fileName.substring( fileName.length() - 4).equals( ".nbm")) { //NOI18N
   58.83 +      throw new BuildException( "Incorrect NBM file name \""+ s+"\". NBM file name must end in '.nbm'") ;
   58.84 +    }
   58.85 +    baseFileName = fileName.substring( 0, fileName.length() - 4) ;
   58.86 +  }
   58.87 +  public void setDeleteInfo( boolean b) {
   58.88 +    deleteInfo = b ;
   58.89 +  }
   58.90 +  public void setNbmIncludes( String s) {
   58.91 +    nbmIncludes = s ;
   58.92 +  }
   58.93 +  public void setModInfo( String s) {
   58.94 +    modInfo = s ;
   58.95 +  }
   58.96 +  public void setLocBundle( File f) {
   58.97 +    locBundle = f ;
   58.98 +  }
   58.99 +  public void setFindLocBundle( String s) {
  58.100 +    findLocBundle = s ;
  58.101 +  }
  58.102 +  public void setLocIncludes( String s) {
  58.103 +    locIncludes = s ;
  58.104 +  }
  58.105 +
  58.106 +  public void execute() throws BuildException {
  58.107 +    try {
  58.108 +      really_execute() ;
  58.109 +
  58.110 +    } catch( BuildException be) {
  58.111 +      be.printStackTrace();
  58.112 +      throw be ;
  58.113 +    }
  58.114 +  }
  58.115 +
  58.116 +  public void really_execute() throws BuildException {
  58.117 +    String locs, loc ;
  58.118 +    StringTokenizer stok ;
  58.119 +    LinkedList build_locales = new LinkedList() ;
  58.120 +    ListIterator iterator ;
  58.121 +
  58.122 +    // Set default values. //
  58.123 +    if( mainDir == null) {
  58.124 +      mainDir = new String( "netbeans") ; //NOI18N
  58.125 +    }
  58.126 +    if( topDir == null) {
  58.127 +      topDir = getProject().getBaseDir() ;
  58.128 +    }
  58.129 +    
  58.130 +    if (( modInfo == null) && (moduleName != null)) {
  58.131 +        // load module info frommodule jarfile
  58.132 +        File f = new File (topDir,moduleName.replace('/', File.separatorChar));
  58.133 +        java.util.jar.JarFile jf;
  58.134 +        try {
  58.135 +            jf= new java.util.jar.JarFile(f);
  58.136 +        } catch (java.io.IOException ioe) {
  58.137 +            throw new BuildException("I/O error during opening module jarfile", ioe, this.getLocation());
  58.138 +        }
  58.139 +        java.util.jar.Manifest mani;
  58.140 +        try {
  58.141 +            mani = jf.getManifest();
  58.142 +        } catch (java.io.IOException ioe) {
  58.143 +            throw new BuildException("I/O error getting manifest from file '"+f.getAbsolutePath()+"'", ioe, this.getLocation());
  58.144 +        }
  58.145 +        if ( mani != null ) {
  58.146 +            java.util.jar.Attributes attr = mani.getMainAttributes();
  58.147 +            String cname = attr.getValue("OpenIDE-Module");
  58.148 +            String sver = attr.getValue("OpenIDE-Module-Specification-Version");
  58.149 +            if ((cname != null) && (!(cname.equals(""))) && (sver != null) && (!(sver.equals("")))) {
  58.150 +                modInfo = cname + '/' + sver;
  58.151 +                log("Gathered module information from module jarfile. Codename = '"+cname+"' and specification version = '"+sver+"'",Project.MSG_VERBOSE);
  58.152 +            } else {
  58.153 +                throw new BuildException("Module in file '"+f.getAbsolutePath()+"' does not have either OpenIDE-Module attribute or OpenIDE-Module-Specification-Version attributes or missing both.", this.getLocation());
  58.154 +            }
  58.155 +        }
  58.156 +    }
  58.157 +    
  58.158 +    // Print a warning and stop if the topDir doesn't exist. //
  58.159 +    if( printMissingDirWarning()) {
  58.160 +      return ;
  58.161 +    }
  58.162 +
  58.163 +    locs = getLocales() ;
  58.164 +    if( locs == null || locs.trim().equals( "")) { //NOI18N
  58.165 +      throw new BuildException( "Must specify 1 or more locales.") ;
  58.166 +    }
  58.167 +    if( fileName == null) {
  58.168 +      throw new BuildException( "Must specify the file attribute.") ;
  58.169 +    }
  58.170 +    
  58.171 +    // I couldn't get it to work unless I explicitly added the task def here. //
  58.172 +    getProject().addTaskDefinition("makelnbm", MakeLNBM.class); //NOI18N
  58.173 +
  58.174 +    // Get a list of the locales for which localized files exist. //
  58.175 +    stok = new StringTokenizer( locs, ",") ; //NOI18N
  58.176 +    while( stok.hasMoreTokens()) {
  58.177 +      loc = stok.nextToken() ;
  58.178 +      log("Checking if module has files in locale '"+loc+"'", Project.MSG_VERBOSE);
  58.179 +      if( hasFilesInLocale( loc)) {
  58.180 +	build_locales.add( loc) ;
  58.181 +        log("Module has files in locale '"+loc+"'", Project.MSG_VERBOSE);
  58.182 +      } else {
  58.183 +        log("Module has no files in locale '"+loc+"'", Project.MSG_VERBOSE);
  58.184 +      }
  58.185 +    }
  58.186 +
  58.187 +    // For each locale that we need to build an NBM for. //
  58.188 +    iterator = build_locales.listIterator() ;
  58.189 +    while( iterator.hasNext()) {
  58.190 +
  58.191 +      // Build the NBM for this locale. //
  58.192 +      buildNbm( (String) iterator.next()) ;
  58.193 +    }
  58.194 +  }
  58.195 +
  58.196 +  /** Build the NBM for this locale. */
  58.197 +  protected void buildNbm( String locale) throws BuildException {
  58.198 +    MakeLNBM makenbm ;
  58.199 +    LinkedList list = new LinkedList() ;
  58.200 +    ListIterator iterator ;
  58.201 +    String includes = new String() ;
  58.202 +    String s ;
  58.203 +    File licenseFile ;
  58.204 +    boolean first_time ;
  58.205 +    Delete del ;
  58.206 +
  58.207 +    // Delete the Info directory if desired. //
  58.208 +    if( deleteInfo) {
  58.209 +      del = (Delete) getProject().createTask("delete"); //NOI18N
  58.210 +      del.init() ;
  58.211 +      del.setDir( new File( topDir.getAbsolutePath() + File.separator + "Info")) ; //NOI18N
  58.212 +      del.execute() ;
  58.213 +      del.setDir( new File( topDir.getAbsolutePath() + File.separator + "Info_" +  //NOI18N
  58.214 +			    locale)) ;
  58.215 +      del.execute() ;
  58.216 +    }
  58.217 +    else {
  58.218 +
  58.219 +      // Move the Info_<locale> dir to Info. //
  58.220 +      switchInfo( true, locale) ;
  58.221 +    }
  58.222 +
  58.223 +    makenbm = (MakeLNBM) getProject().createTask("makelnbm"); //NOI18N
  58.224 +    makenbm.init() ;
  58.225 +
  58.226 +    makenbm.setModInfo( modInfo) ;
  58.227 +    makenbm.setLangCode( locale) ;
  58.228 +    if (this.global != null) {
  58.229 +        makenbm.setGlobal(this.global);
  58.230 +    }
  58.231 +
  58.232 +    String fname = getLocalizedFileName( locale);
  58.233 +    makenbm.setFile( new File( getProject().getBaseDir().getAbsolutePath() + 
  58.234 +			       File.separator + fname)) ;
  58.235 +    makenbm.setTopdir( topDir) ;
  58.236 +    makenbm.setIsStandardInclude( false) ;
  58.237 +    String distbase = getProject().getProperty("dist.base"); //NOI18N
  58.238 +    if (distbase != null) {
  58.239 +//        try {
  58.240 +            int idx = fname.lastIndexOf('/');
  58.241 +            makenbm.setDistribution(distbase + "/" + fname.substring(idx + 1)); //NOI18N
  58.242 +//        } catch (MalformedURLException e) {
  58.243 +//            throw new BuildException(e, getLocation());
  58.244 +//        }
  58.245 +    }
  58.246 +    licenseFile = getLicenseFile( locale) ;
  58.247 +    if( licenseFile != null) {
  58.248 +      MakeLNBM.Blurb blurb = makenbm.createLicense() ;
  58.249 +      blurb.setFile( licenseFile) ;
  58.250 +    }
  58.251 +
  58.252 +    // Set the localizing bundle specified, or look for it. //
  58.253 +    if( locBundle != null) {
  58.254 +      setLocBundle( makenbm, getSpecificLocBundleFile( locBundle, locale)) ;
  58.255 +    }
  58.256 +    else {
  58.257 +      setLocBundle( makenbm, findLocBundle( makenbm, locale)) ;
  58.258 +    }
  58.259 +
  58.260 +    // Set up the signing data if it's specified. //
  58.261 +    if( getKeystore() != null &&
  58.262 +	getStorepass() != null &&
  58.263 +	getAlias() != null) {
  58.264 +      MakeLNBM.Signature sign = makenbm.createSignature() ;
  58.265 +      sign.setKeystore( new File( getKeystore())) ;
  58.266 +      sign.setStorepass( getStorepass()) ;
  58.267 +      sign.setAlias( getAlias()) ;
  58.268 +    }
  58.269 +
  58.270 +    // Get the list of include patterns for this locale. //
  58.271 +    addLocalePatterns( list, locale) ;
  58.272 +
  58.273 +    // Create a comma-separated list of include patterns. //
  58.274 +    iterator = list.listIterator() ;
  58.275 +    first_time = true ;
  58.276 +    while( iterator.hasNext()) {
  58.277 +      s = (String) iterator.next() ;
  58.278 +      if( !first_time) {
  58.279 +	includes += "," ; //NOI18N
  58.280 +      }
  58.281 +      includes += s ;
  58.282 +      first_time = false ;
  58.283 +    }
  58.284 +    // Add any extra includes that were specified. //
  58.285 +    if( nbmIncludes != null && !nbmIncludes.trim().equals( "")) { //NOI18N
  58.286 +      if( !first_time) {
  58.287 +	includes += "," ; //NOI18N
  58.288 +      }
  58.289 +      includes += nbmIncludes ;
  58.290 +    }
  58.291 +    makenbm.setIncludes( includes) ;
  58.292 +
  58.293 +    makenbm.execute() ;
  58.294 +
  58.295 +    // Move the Info dir to Info_<locale>. //
  58.296 +    switchInfo( false, locale) ;
  58.297 +  }
  58.298 +
  58.299 +  /** Return the license file associated with this locale if there is
  58.300 +   * one.
  58.301 +   */
  58.302 +  protected File getLicenseFile( String locale) {
  58.303 +    String license_prop_name = locale + ".license.file" ; //NOI18N
  58.304 +    String license_prop = getProject().getProperty(license_prop_name);
  58.305 +    File license = null ;
  58.306 +    if( license_prop != null) {
  58.307 +      license = new File( license_prop ) ;
  58.308 +    }
  58.309 +    return( license) ;
  58.310 +  }
  58.311 +
  58.312 +  protected void switchInfo( boolean to_info,
  58.313 +			     String locale) {
  58.314 +    File dir ;
  58.315 +
  58.316 +    if( to_info) {
  58.317 +      dir = new File( topDir.getAbsolutePath() + File.separator + "Info_" + locale) ; //NOI18N
  58.318 +      dir.renameTo( new File( topDir.getAbsolutePath() + File.separator + "Info")) ; //NOI18N
  58.319 +    }
  58.320 +    else {
  58.321 +      dir = new File( topDir.getAbsolutePath() + File.separator + "Info") ; //NOI18N
  58.322 +      dir.renameTo( new File( topDir.getAbsolutePath() + File.separator + "Info_" +  //NOI18N
  58.323 +			      locale)) ;
  58.324 +    }
  58.325 +  }
  58.326 +
  58.327 +  /** Get the localized version of the NBM filename. */
  58.328 +  protected String getLocalizedFileName( String locale) {
  58.329 +    return( baseFileName + "_" + locale + ".nbm") ; //NOI18N
  58.330 +  }
  58.331 +
  58.332 +  protected String getLocales() {
  58.333 +    if( locales != null) {
  58.334 +      return( locales) ;
  58.335 +    }
  58.336 +    return( getGlobalProp( "locmakenbm.locales")) ; //NOI18N
  58.337 +  }
  58.338 +
  58.339 +  /** See if there are any files for the given locale. */
  58.340 +  protected boolean hasFilesInLocale( String loc) {
  58.341 +    FileSet fs ;
  58.342 +    boolean ret = true ;
  58.343 +
  58.344 +    // Setup a fileset to find files in this locale. //
  58.345 +    fs = new FileSet() ;
  58.346 +    fs.setDir( topDir) ;
  58.347 +    addLocalePatterns( fs, loc) ;
  58.348 +
  58.349 +    // See if there are any localized files for this locale. //
  58.350 +    String[] inc_files = fs.getDirectoryScanner(getProject()).getIncludedFiles();
  58.351 +    if( inc_files.length == 0) {
  58.352 +      ret = false ;
  58.353 +    }
  58.354 +
  58.355 +    return( ret) ;
  58.356 +  }
  58.357 +
  58.358 +  /** Add the patterns to include the localized files for the given locale. */
  58.359 +  protected void addLocalePatterns( FileSet fs,
  58.360 +				    String loc) {
  58.361 +    LinkedList list = new LinkedList() ;
  58.362 +    ListIterator iterator ;
  58.363 +
  58.364 +    // Get the list of patterns for this locale. //
  58.365 +    addLocalePatterns( list, loc) ;
  58.366 +
  58.367 +    // For each pattern for this locale. //
  58.368 +    iterator = list.listIterator( 0) ;
  58.369 +    while( iterator.hasNext()) {
  58.370 +
  58.371 +      // Add it to the includes list. //
  58.372 +      fs.createInclude().setName( (String) iterator.next()) ;
  58.373 +    }
  58.374 +
  58.375 +  }
  58.376 +
  58.377 +  protected void addLocalePatterns( LinkedList list,
  58.378 +				    String loc) {
  58.379 +    String dir = new String() ;
  58.380 +    String re = new String() ;
  58.381 +
  58.382 +
  58.383 +    dir = mainDir ;        // modified for clusterization
  58.384 +    re = dir + "/**/*_" + loc + ".*" ; // pattern is: ${dir}/**/*_${locale}.* //NOI18N
  58.385 +    list.add( new String( re)) ;
  58.386 +    re = dir + "/**/" + loc + "/" ;    // pattern is: ${dir}/${locale}/ //NOI18N
  58.387 +    list.add( new String( re)) ;
  58.388 +
  58.389 +//    re = "**/*_" + loc + ".*" ; // pattern is: ${dir}/**/*_${locale}.* //NOI18N
  58.390 +//    list.add( new String( re)) ;
  58.391 +//    re = "**/" + loc + "/" ;    // pattern is: ${dir}/${locale}/ //NOI18N
  58.392 +//    list.add( new String( re)) ;
  58.393 +
  58.394 +    addLocIncludes( list, loc) ;
  58.395 +
  58.396 +    // For ja locale, include these other variants. //
  58.397 +    if( loc.equals( "ja")) { //NOI18N
  58.398 +      addLocalePatterns( list, "ja_JP.PCK") ; //NOI18N
  58.399 +      addLocalePatterns( list, "ja_JP.eucJP") ; //NOI18N
  58.400 +      addLocalePatterns( list, "ja_JP.SJIS") ; //NOI18N
  58.401 +      addLocalePatterns( list, "ja_JP.UTF-8") ; //NOI18N
  58.402 +      addLocalePatterns( list, "ja_JP.UTF8") ; //NOI18N
  58.403 +    }
  58.404 +  }
  58.405 +
  58.406 +  protected void addLocIncludes( LinkedList list,
  58.407 +				 String loc) {
  58.408 +    StringTokenizer tkzr ;
  58.409 +    String locInc, incLocale, incPattern ;
  58.410 +    int idx ;
  58.411 +
  58.412 +    if( locIncludes == null) {
  58.413 +      return ;
  58.414 +    }
  58.415 +
  58.416 +    // For each locale-specific include. //
  58.417 +    tkzr = new StringTokenizer( locIncludes, ",\n\t ") ; //NOI18N
  58.418 +    while( tkzr.hasMoreTokens()) {
  58.419 +      locInc = tkzr.nextToken() ;
  58.420 +      idx = locInc.indexOf( ":") ; //NOI18N
  58.421 +      if( idx != -1) {
  58.422 +	incLocale = locInc.substring( 0, idx) ;
  58.423 +	incPattern = locInc.substring( idx+1) ;
  58.424 +	if( incLocale.equals( loc)) {
  58.425 +	  list.add( new String( incPattern)) ;
  58.426 +	}
  58.427 +      }
  58.428 +      else {
  58.429 +	list.add( new String( locInc)) ;
  58.430 +      }
  58.431 +    }
  58.432 +  }
  58.433 +
  58.434 +  protected String getGlobalProp( String name) {
  58.435 +    String ret ;
  58.436 +    ret = getProject().getProperty(name);
  58.437 +
  58.438 +    // Don't return empty strings or strings whose value contains a //
  58.439 +    // property that isn't set.					    //
  58.440 +    if( ret != null) {
  58.441 +      if( ret.trim().equals( "")) { //NOI18N
  58.442 +	ret = null ;
  58.443 +      }
  58.444 +      else if( ret.indexOf( "${") != -1) { //NOI18N
  58.445 +	ret = null ;
  58.446 +      }
  58.447 +    }
  58.448 +    return( ret) ;
  58.449 +  }
  58.450 +
  58.451 +  protected String getKeystore() {
  58.452 +    return( getGlobalProp( "locmakenbm.keystore")) ; //NOI18N
  58.453 +  }
  58.454 +
  58.455 +  protected String getStorepass() {
  58.456 +    return( getGlobalProp( "locmakenbm.storepass")) ; //NOI18N
  58.457 +  }
  58.458 +
  58.459 +  protected String getAlias() {
  58.460 +    return( getGlobalProp( "locmakenbm.alias")) ; //NOI18N
  58.461 +  }
  58.462 +
  58.463 +  /** If the topDir doesn't exist, warn the user and return true. */
  58.464 +  protected boolean printMissingDirWarning() {
  58.465 +    boolean ret = false ;
  58.466 +    if( !topDir.exists()) {
  58.467 +      log( "WARNING: Skipping this task: Directory " + topDir.getPath() + 
  58.468 +	   " doesn't exist.") ;
  58.469 +      ret = true ;
  58.470 +    }
  58.471 +    return( ret) ;
  58.472 +  }
  58.473 +
  58.474 +  /** If the localizing bundle is there, use it. */
  58.475 +  protected void setLocBundle( MakeLNBM makenbm,
  58.476 +			       File bundle) {
  58.477 +    if( bundle != null && bundle.exists()) {
  58.478 +      makenbm.setLocBundle( bundle) ;
  58.479 +    }
  58.480 +    else {
  58.481 +      log( "WARNING: Localizing bundle not found: " + 
  58.482 +          ((bundle==null)?(""):(bundle.getPath())) ) ; //NOI18N
  58.483 +    }
  58.484 +  }
  58.485 +
  58.486 +  protected String getSrcDir( File file) {
  58.487 +    InputStreamReader isr ;
  58.488 +    FileInputStream fis ;
  58.489 +    char[] buf = new char[ 200] ;
  58.490 +    String s = null ;
  58.491 +    int idx, len ;
  58.492 +
  58.493 +    try {
  58.494 +
  58.495 +      // Read the srcdir from the file that locjar wrote. //
  58.496 +      fis = new FileInputStream( file) ;
  58.497 +      isr = new InputStreamReader( fis) ;
  58.498 +      len = isr.read( buf) ;
  58.499 +      if( len != -1) {
  58.500 +	if( buf[ len-1] == '\n') { //NOI18N
  58.501 +	  len-- ;
  58.502 +	}
  58.503 +	s = new String( buf, 0, len) ;
  58.504 +	idx = s.indexOf( "=") ; //NOI18N
  58.505 +	if( idx != -1) {
  58.506 +	  s = s.substring( idx + 1) ;
  58.507 +	  s.trim() ;
  58.508 +	}
  58.509 +	else {
  58.510 +	  s = null ;
  58.511 +	}
  58.512 +      }
  58.513 +    }
  58.514 +    catch( Exception e) {
  58.515 +      System.out.println( "ERROR: " + e.getMessage()) ;
  58.516 +      e.printStackTrace() ;
  58.517 +      throw new BuildException() ;
  58.518 +    }
  58.519 +    return( s) ;
  58.520 +  }
  58.521 +
  58.522 +  protected File findLocBundle( MakeLNBM makenbm,
  58.523 +				String locale) {
  58.524 +    File srcdirfile, locdir ;
  58.525 +    int index ;
  58.526 +    String s, srcdir = null ;
  58.527 +
  58.528 +    // See if the file containing the srcdir is there. //
  58.529 +    srcdirfile = new File( topDir.getAbsolutePath() + File.separator + 
  58.530 +			   "srcdir.properties") ; //NOI18N
  58.531 +    if( srcdirfile.exists()) {
  58.532 +      srcdir = getSrcDir( srcdirfile) ;
  58.533 +    }
  58.534 +//    if( srcdir == null) {
  58.535 +//      throw new BuildException( "ERROR: Could not get source dir from: " + srcdirfile.getPath()) ;
  58.536 +//    }
  58.537 +
  58.538 +    // Get the codename of this module. //
  58.539 +    index = modInfo.indexOf( "/") ; //NOI18N
  58.540 +    if( index != -1) {
  58.541 +      s = modInfo.substring( 0, index) ;
  58.542 +    }
  58.543 +    else {
  58.544 +      s = new String( modInfo) ;
  58.545 +    }
  58.546 +
  58.547 +    // Convert to pathname and set the loc bundle. //
  58.548 +    s = s.replace( '.', '/') ; //NOI18N
  58.549 +    locdir = new File( getRelPath( srcdir + "/" + s, findLocBundle). //NOI18N
  58.550 +		       replace( '/', File.separatorChar)) ; //NOI18N
  58.551 +    return( getDefaultLocBundleFile( locdir, locale)) ;
  58.552 +  }
  58.553 +
  58.554 +  protected File getDefaultLocBundleFile( File dir,
  58.555 +					  String locale) {
  58.556 +    return( new File( dir.getPath() + File.separator + "Bundle_" + locale + ".properties")) ; //NOI18N
  58.557 +  }
  58.558 +
  58.559 +  protected File getSpecificLocBundleFile( File enBundle,
  58.560 +					   String locale) {
  58.561 +    String path = enBundle.getPath() ;
  58.562 +    int idx = path.lastIndexOf( '.') ; //NOI18N
  58.563 +    if( idx != -1) {
  58.564 +      return( new File( path.substring( 0, idx) + "_" + locale + path.substring( idx))) ; //NOI18N
  58.565 +    }
  58.566 +    else {
  58.567 +      return( new File( path + "_" + locale)) ; //NOI18N
  58.568 +    }
  58.569 +  }
  58.570 +
  58.571 +  /** This supports ".." path elements at the start of path2. */
  58.572 +  protected String getRelPath( String path1,
  58.573 +			       String path2) {
  58.574 +    int idx1, idx2 ;
  58.575 +
  58.576 +    if( path2.equals( ".")) { //NOI18N
  58.577 +      return( path1) ;
  58.578 +    }
  58.579 +
  58.580 +    // For each ".." element in path2. //
  58.581 +    while( true) {
  58.582 +      idx2 = path2.indexOf( "..") ; //NOI18N
  58.583 +      if( idx2 == -1) {
  58.584 +	break ;
  58.585 +      }
  58.586 +
  58.587 +      // Strip off the ".." //
  58.588 +      path2 = path2.substring( 2) ;
  58.589 +
  58.590 +      // Strip off the slash if it starts with slash. //
  58.591 +      idx2 = path2.indexOf( "/") ; //NOI18N
  58.592 +      if( idx2 == 0) {
  58.593 +	path2 = path2.substring( 1) ;
  58.594 +      }
  58.595 +
  58.596 +      // Strip off the last element of path1. //
  58.597 +      idx1 = path1.lastIndexOf( "/") ; //NOI18N
  58.598 +      if( idx1 != -1) {
  58.599 +	path1 = path1.substring( 0, idx1) ;
  58.600 +      }
  58.601 +    }
  58.602 +
  58.603 +    return( path1 + "/" + path2) ; //NOI18N
  58.604 +  }
  58.605 +
  58.606 +}
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/LocalizedJar.java	Sun Jan 28 18:54:08 2007 +0000
    59.3 @@ -0,0 +1,815 @@
    59.4 +/*
    59.5 + * The contents of this file are subject to the terms of the Common Development
    59.6 + * and Distribution License (the License). You may not use this file except in
    59.7 + * compliance with the License.
    59.8 + *
    59.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   59.10 + * or http://www.netbeans.org/cddl.txt.
   59.11 +
   59.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   59.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   59.14 + * If applicable, add the following below the CDDL Header, with the fields
   59.15 + * enclosed by brackets [] replaced by your own identifying information:
   59.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   59.17 + *
   59.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   59.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   59.20 + * Microsystems, Inc. All Rights Reserved.
   59.21 + */
   59.22 +
   59.23 +package org.netbeans.modules.visualweb.ravebuild;
   59.24 +
   59.25 +import java.io.*;
   59.26 +import java.util.*;
   59.27 +import java.util.Map; // override org.apache.tools.ant.Map
   59.28 +import java.util.zip.*;
   59.29 +import java.util.jar.*;
   59.30 +
   59.31 +import org.apache.tools.ant.*;
   59.32 +import org.apache.tools.ant.taskdefs.MatchingTask;
   59.33 +import org.apache.tools.ant.types.*;
   59.34 +
   59.35 +/** Create a JAR file with locale variants.
   59.36 + * Whenever files are found which should be localized, or are the result
   59.37 + * of localization, places them in separate JAR files named according to the locale,
   59.38 + * in a <samp>locale/</samp> subdirectory of the directory containing the master JAR.
   59.39 + * Each sub-JAR gets a manifest which just has some informational tags
   59.40 + * indicating its purpose (locale and branding):
   59.41 + * <code>X-Informational-Archive-Locale</code> and/or <code>X-Informational-Archive-Branding</code>.
   59.42 + * The values may be e.g. <code>ja</code> or <code>f4j_ce</code>; or <code>-</code>
   59.43 + * if there is no suffix for this JAR.
   59.44 + * You can control the available locales; brandings; and set of files which should
   59.45 + * always be considered part of the localizable base kit.
   59.46 + * You can use the "branding" and "locale" subelements to control the branded
   59.47 + * and localized .jar files that will be produced.  Also, you can set the global
   59.48 + * properties "locjar.brands" and "locjar.locales" to comma-separated
   59.49 + * lists of branding or locale identifiers so that NetBeans-based projects can
   59.50 + * brand or localize NetBeans without having to maintain modified versions of all
   59.51 + * the individual Ant scripts
   59.52 + * Originally this Ant task didn't recognize files below a directory with the
   59.53 + * same name as a locale as being localized.  Now it does so by default.
   59.54 + * <p>Based on <code>&lt;zip&gt;</code> and <code>&lt;jar&gt;</code> tasks in Ant,
   59.55 + * but not feasible to simply subclass or compose them.
   59.56 + * @see <a href="http://www.netbeans.org/devhome/docs/i18n/index.html">NetBeans I18N documentation</a>
   59.57 + * @author Jesse Glick
   59.58 + */
   59.59 +public class LocalizedJar extends MatchingTask {
   59.60 +
   59.61 +    private List localeKits = new LinkedList (); // List<FileSet>
   59.62 +    private List locales = new LinkedList (); // List<LocaleOrB>
   59.63 +    private List brandings = new LinkedList (); // List<LocaleOrB>
   59.64 +    private File jarFile;
   59.65 +    private File baseDir;
   59.66 +    private boolean doCompress = false;
   59.67 +    private static long emptyCrc = new CRC32 ().getValue ();
   59.68 +    private List filesets = new LinkedList (); // List<FileSet>
   59.69 +    private File manifest;
   59.70 +    private boolean checkPathLocale = true ;
   59.71 +    private boolean warnMissingDir = false ;
   59.72 +    private boolean warnMissingDirSet = false ;
   59.73 +    private boolean preserveModuleJar = true;
   59.74 +    private boolean alwaysIncludeManifest = false;
   59.75 +
   59.76 +    /** Locale or branding specifier.
   59.77 +     * Represents a complete locale or branding suffix,
   59.78 +     * e.g. <code>ja</code> or <code>ja_JP</code>
   59.79 +     * (but not simply <code>JP</code>).
   59.80 +     * For branding, e.g. <code>f4j</code> or <code>f4j_ce</code>.
   59.81 +     * You must include all relevant suffixes if you expect them to match
   59.82 +     * (but the task will handle a branding suffix combined with a locale
   59.83 +     * suffix, in that order).
   59.84 +     */
   59.85 +    public class LocaleOrB {
   59.86 +        String n;
   59.87 +        /** The suffix. */
   59.88 +        public void setName (String n) {
   59.89 +            this.n = n;
   59.90 +        }
   59.91 +    }
   59.92 +
   59.93 +    /** Distinguish particular files that will be considered localizable.
   59.94 +     * This nested <samp>&lt;localekit&gt;</samp> has the same syntax as a FileSet.
   59.95 +     * So typically you will build a JAR from a fileset containing all build
   59.96 +     * products within a given directory; the "locale kit" should be a fileset
   59.97 +     * matching all properties files, for example, and maybe icons which you would
   59.98 +     * expect someone to try to localize--in general, anything which will be referenced
   59.99 +     * in code using a localized lookup (<code>NbBundle</code>).
  59.100 +     * While files with recognized localized (or branded) suffixes automatically go into
  59.101 +     * marked JARs in the <samp>locale/</samp> subdirectory, files considered part of the
  59.102 +     * locale kit also always go into this subdirectory; if they have no suffix, they will
  59.103 +     * be placed in a suffixless locale JAR.
  59.104 +     * So localizers can simply look at this JAR file and brand/localize it as they see fit.
  59.105 +     */
  59.106 +    public void addLocalekit (FileSet fs) {
  59.107 +        localeKits.add (fs);
  59.108 +    }
  59.109 +
  59.110 +    /** Add a recognized locale suffix. */
  59.111 +    public LocaleOrB createLocale () {
  59.112 +        LocaleOrB l = new LocaleOrB ();
  59.113 +        locales.add (l);
  59.114 +        return l;
  59.115 +    }
  59.116 +
  59.117 +    /** Add a recognized branding suffix. */
  59.118 +    public LocaleOrB createBranding () {
  59.119 +        LocaleOrB l = new LocaleOrB ();
  59.120 +        brandings.add (l);
  59.121 +        return l;
  59.122 +    }
  59.123 +
  59.124 +    /** JAR file to create.
  59.125 +     * In fact this is the location of the "base" JAR;
  59.126 +     * locale-specific JARs may be created in the <samp>locale/</samp> subdirectory
  59.127 +     * of the directory containing this JAR, and will be named according to the name
  59.128 +     * of this JAR.
  59.129 +     * Compare Ant's <samp>&lt;jar&gt;</samp> task.
  59.130 +     */
  59.131 +    public void setJarfile (File jarFile) {
  59.132 +        if (! jarFile.getName ().endsWith (".jar")) {
  59.133 +            throw new BuildException ("jarfile attribute must be a file with *.jar extension");
  59.134 +        }
  59.135 +        if (jarFile.getParentFile () == null) {
  59.136 +            throw new BuildException ("jarfile attribute must have a containing directory");
  59.137 +        }
  59.138 +        this.jarFile = jarFile;
  59.139 +    }
  59.140 +
  59.141 +    /** Base directory to JAR.
  59.142 +     * Compare Ant's <samp>&lt;jar&gt;</samp> task.
  59.143 +     */
  59.144 +    public void setBasedir (File baseDir) {
  59.145 +        this.baseDir = baseDir;
  59.146 +    }
  59.147 +
  59.148 +    /** Turn on or off compression (default off).
  59.149 +     * Compare Ant's <samp>&lt;jar&gt;</samp> task.
  59.150 +     */
  59.151 +    public void setCompress(boolean compress) {
  59.152 +        doCompress = compress;
  59.153 +    }
  59.154 +
  59.155 +    /** Turn on/off preserving original module jars with 'code'
  59.156 +     *  Set it to 'true' to not allow overwriting of module jars
  59.157 +     *  with localization/branding stuff
  59.158 +     */
  59.159 +    public void setPreserveModuleJar(boolean pmj) {
  59.160 +        preserveModuleJar = pmj;
  59.161 +    }
  59.162 +
  59.163 +    /** Turn on/off inclusion of manifest even for localized and/or branded
  59.164 +     *  jars. Set it to true if you want to add special manifest tags
  59.165 +     *  to all produced jarfiles
  59.166 +     */
  59.167 +    public void setAlwaysIncludeManifest(boolean aim) {
  59.168 +        alwaysIncludeManifest = aim;
  59.169 +    }
  59.170 +
  59.171 +    /** A set of files to JAR up.
  59.172 +     * Compare Ant's <samp>&lt;jar&gt;</samp> task.
  59.173 +     */
  59.174 +    public void addFileset (FileSet set) {
  59.175 +        filesets.add (set);
  59.176 +    }
  59.177 +
  59.178 +    /** Manifest file for the JAR.
  59.179 +     * Compare Ant's <samp>&lt;jar&gt;</samp> task.
  59.180 +     */
  59.181 +    public void setManifest (File manifest) {
  59.182 +	this.manifest = manifest;
  59.183 +    }
  59.184 +
  59.185 +    /** By default this is true.  If set to false, then this task will
  59.186 +     * not recognize files below a directory with the same name as a
  59.187 +     * locale as being localized (unless the simple filename also
  59.188 +     * includes the locale).
  59.189 +     */
  59.190 +    public void setCheckPathLocale( boolean doit) {
  59.191 +      checkPathLocale = doit ;
  59.192 +    }
  59.193 +
  59.194 +    /** This is false by default, in which case missing dirs in the
  59.195 +     * filesets cause a BuildException to be thrown.  If true, then
  59.196 +     * a warning is printed but the build will continue.
  59.197 +     * This task will also look for a global property 
  59.198 +     * "locjar.warnMissingDir" if this attribute isn't set.
  59.199 +     */
  59.200 +    public void setWarnMissingDir( boolean b) {
  59.201 +      warnMissingDir = b ;
  59.202 +      warnMissingDirSet = true ;
  59.203 +    }
  59.204 +
  59.205 +    public void execute () throws BuildException {
  59.206 +
  59.207 +        // Sanity checks:
  59.208 +        if (baseDir == null && filesets.size () == 0) {
  59.209 +            throw new BuildException ("basedir attribute must be set, or at least one fileset must be given!");
  59.210 +        }
  59.211 +        if (jarFile == null) {
  59.212 +            throw new BuildException ("You must specify the JAR file to create!");
  59.213 +        }
  59.214 +        if (manifest != null && ! manifest.isFile ()) {
  59.215 +            throw new BuildException ("The specified manifest does not actually exist.");
  59.216 +        }
  59.217 +
  59.218 +	// If needed, warn that directories are missing. //
  59.219 +	if( shouldWarnMissingDir() && warnIfMissingDir()) {
  59.220 +
  59.221 +	  // Stop if dirs were missing. //
  59.222 +	  return ;
  59.223 +	}
  59.224 +
  59.225 +	// Look for global locales or brandings to use. //
  59.226 +	addGlobalLocaleAndBranding() ;
  59.227 +
  59.228 +        //System.err.println ("Stage #1");
  59.229 +        // First find out which files need to be archived.
  59.230 +        Map allFiles = new HashMap (); // all files to do something with; Map<String,File> from JAR path to actual file
  59.231 +        // Populate it.
  59.232 +        {
  59.233 +            List scanners = new ArrayList (filesets.size () + 1); // List<FileScanner>
  59.234 +            if (baseDir != null) {
  59.235 +                scanners.add (getDirectoryScanner (baseDir));
  59.236 +            }
  59.237 +            Iterator it = filesets.iterator ();
  59.238 +            while (it.hasNext ()) {
  59.239 +                scanners.add(((FileSet) it.next()).getDirectoryScanner(getProject()));
  59.240 +            }
  59.241 +            it = scanners.iterator ();
  59.242 +            while (it.hasNext ()) {
  59.243 +                FileScanner scanner = (FileScanner) it.next ();
  59.244 +                File thisBaseDir = scanner.getBasedir ();
  59.245 +                String[] files = scanner.getIncludedFiles ();
  59.246 +                for (int i = 0; i < files.length; i++) {
  59.247 +                    String name = files[i].replace (File.separatorChar, '/');
  59.248 +                    if (name.equalsIgnoreCase ("META-INF/MANIFEST.MF")) {
  59.249 +                        log ("Warning: ignoring META-INF/MANIFEST.MF found among scanned files", Project.MSG_WARN);
  59.250 +                        continue;
  59.251 +                    }
  59.252 +                    allFiles.put (name, new File (thisBaseDir, files[i]));
  59.253 +                }
  59.254 +            }
  59.255 +        }
  59.256 +
  59.257 +        //System.err.println ("Stage #2");
  59.258 +        // Now find all files which should always be put into a locale
  59.259 +        // kit (e.g. dir/locale/name.jar, no special locale or
  59.260 +        // branding, but distinguished as localizable/brandable).
  59.261 +        Set localeKitFiles = new HashSet (); // Set<File>; all locale-kit files
  59.262 +        // Populate this one.
  59.263 +        {
  59.264 +            Iterator it = localeKits.iterator ();
  59.265 +            while (it.hasNext ()) {
  59.266 +                FileScanner scanner = ((FileSet) it.next()).getDirectoryScanner(getProject());
  59.267 +                File thisBaseDir = scanner.getBasedir ();
  59.268 +                String[] files = scanner.getIncludedFiles ();
  59.269 +                for (int i = 0; i < files.length; i++) {
  59.270 +                    localeKitFiles.add (new File (thisBaseDir, files[i]));
  59.271 +                }
  59.272 +            }
  59.273 +        }
  59.274 +
  59.275 +        //System.err.println ("Stage #3");
  59.276 +        // Compute list of supported locales and brandings.
  59.277 +        List locales2 = new LinkedList (); // List<String>; all locales
  59.278 +        List brandings2 = new LinkedList (); // List<String>; all brandings
  59.279 +        // Initialize above two.
  59.280 +        {
  59.281 +            Iterator it = locales.iterator ();
  59.282 +            while (it.hasNext ()) {
  59.283 +                locales2.add (((LocaleOrB) it.next ()).n);
  59.284 +            }
  59.285 +            it = brandings.iterator ();
  59.286 +            while (it.hasNext ()) {
  59.287 +                brandings2.add (((LocaleOrB) it.next ()).n);
  59.288 +            }
  59.289 +            class InverseLengthComparator implements Comparator {
  59.290 +                public int compare (Object o1, Object o2) {
  59.291 +                    String s1 = (String) o1;
  59.292 +                    String s2 = (String) o2;
  59.293 +                    return s2.length () - s1.length ();
  59.294 +                }
  59.295 +            }
  59.296 +            Comparator c = new InverseLengthComparator ();
  59.297 +            Collections.sort (locales2, c);
  59.298 +            Collections.sort (brandings2, c);
  59.299 +        }
  59.300 +
  59.301 +        //System.err.println ("Stage #4");
  59.302 +        // Analyze where everything goes.
  59.303 +        Set jars = new HashSet (); // Set<File>; JAR files to build
  59.304 +        Map localeMarks = new HashMap (); // Map<File,String>; JAR files to locale (or null for basic JAR, "-" for blank)
  59.305 +        Map brandingMarks = new HashMap (); // Map<File,String>; JAR files to branding (or null for basic JAR, "-" for blank)
  59.306 +        Map router = new HashMap (); // Map<File,Map<String,File>>; JAR files to map of JAR path to actual file (file may be null for dirs)
  59.307 +        {
  59.308 +	    String localeDir ;
  59.309 +            Iterator it = allFiles.entrySet ().iterator ();
  59.310 +            while (it.hasNext ()) {
  59.311 +                Map.Entry entry = (Map.Entry) it.next ();
  59.312 +                String path = (String) entry.getKey ();
  59.313 +
  59.314 +log( "==> Examining file: " + path, Project.MSG_DEBUG) ;
  59.315 +
  59.316 +                File file = (File) entry.getValue ();
  59.317 +                // First see if it matches a known branding, locale, or pair of one of each.
  59.318 +                String testpath = path;
  59.319 +                int idx = testpath.lastIndexOf ('/');
  59.320 +                if (idx != -1) testpath = testpath.substring (idx + 1);
  59.321 +                idx = testpath.lastIndexOf ('.');
  59.322 +                if (idx != -1) testpath = testpath.substring (0, idx);
  59.323 +                String thisLocale = null;
  59.324 +                Iterator it2 = locales2.iterator ();
  59.325 +                while (it2.hasNext ()) {
  59.326 +                    String tryLocale = (String) it2.next ();
  59.327 +                    if (testpath.endsWith ("_" + tryLocale)) {
  59.328 +                        thisLocale = tryLocale;
  59.329 +                        testpath = testpath.substring (0, testpath.length () - 1 - tryLocale.length ());
  59.330 +                        break;
  59.331 +                    }
  59.332 +                }
  59.333 +                String thisBranding = null;
  59.334 +                it2 = brandings2.iterator ();
  59.335 +                while (it2.hasNext ()) {
  59.336 +                    String tryBranding = (String) it2.next ();
  59.337 +                    if (testpath.endsWith ("_" + tryBranding)) {
  59.338 +                        thisBranding = tryBranding;
  59.339 +                        break;
  59.340 +                    }
  59.341 +                }
  59.342 +                File thisjar = null; // JAR to send this file to
  59.343 +
  59.344 +		// Check if this file has a parent directory with the //
  59.345 +		// same name as one of the locales.		      //
  59.346 +		localeDir = checkInLocaleDir( file, locales2) ;
  59.347 +		if( localeDir != null) {
  59.348 +		  thisLocale = localeDir ;
  59.349 +		}
  59.350 +
  59.351 +
  59.352 +                if( thisLocale != null) {
  59.353 +                    log( "    Locale: " + thisLocale, Project.MSG_DEBUG) ;
  59.354 +                } else {
  59.355 +                    log( "    Locale not set", Project.MSG_DEBUG) ;
  59.356 +                }
  59.357 +                if( thisBranding != null) {
  59.358 +                    log( "    Branding: " + thisBranding, Project.MSG_DEBUG) ;
  59.359 +                } else {
  59.360 +                    log( "    Branding not set", Project.MSG_DEBUG) ;
  59.361 +                }
  59.362 +                if( localeKitFiles.contains( file)) {
  59.363 +                    log( "    Localizable file.", Project.MSG_DEBUG) ;
  59.364 +                } 
  59.365 +
  59.366 +
  59.367 +                if (thisLocale != null || thisBranding != null || localeKitFiles.contains (file)) {
  59.368 +                    String name = jarFile.getName ();
  59.369 +                    // We know jarFile is a *.jar so this is safe:
  59.370 +                    name = name.substring (0, name.length () - 4);
  59.371 +                    if (thisBranding != null) {
  59.372 +                        name += '_' + thisBranding;
  59.373 +                    }
  59.374 +                    if (thisLocale != null) {
  59.375 +                        name += '_' + thisLocale;
  59.376 +                    }
  59.377 +                    name += ".jar";
  59.378 +                    if ((preserveModuleJar) && (thisBranding == null) && (thisLocale == null)) {
  59.379 +                        thisjar = null;
  59.380 +                        log("    Preserving module file (1): " + jarFile.getName(), Project.MSG_DEBUG);
  59.381 +                    } else {
  59.382 +                        thisjar = new File (new File (jarFile.getParentFile (), "locale"), name);
  59.383 +                        localeMarks.put (thisjar, ((thisLocale != null) ? thisLocale : "-"));
  59.384 +                        brandingMarks.put (thisjar, ((thisBranding != null) ? thisBranding : "-"));
  59.385 +                    }
  59.386 +                } else {
  59.387 + 		    if (preserveModuleJar) {
  59.388 +                        thisjar = null;
  59.389 +                        log("    Preserving module file (2): " + jarFile.getName(), Project.MSG_DEBUG);
  59.390 +                    } else {
  59.391 +                        thisjar = jarFile;
  59.392 +                        localeMarks.put (thisjar, null);
  59.393 +                        brandingMarks.put (thisjar, null);
  59.394 +                    }
  59.395 +                }
  59.396 +                if (thisjar != null) {
  59.397 +  	            log("    Adding file " + thisjar.getName() + " to 'jars' HashSet", Project.MSG_DEBUG);
  59.398 +                    jars.add (thisjar);
  59.399 +                    Map files = (Map) router.get (thisjar);
  59.400 +                    if (files == null) {
  59.401 +                        files = new TreeMap ();
  59.402 +                        router.put (thisjar, files);
  59.403 +                    }
  59.404 +                    files.put (path, file);
  59.405 +                }
  59.406 +            }
  59.407 +        }
  59.408 +
  59.409 +        //System.err.println ("Stage #5");
  59.410 +        // Go through JARs one by one, and build them (if necessary).
  59.411 +        {
  59.412 +            List jars2 = new ArrayList (jars);
  59.413 +            class FileNameComparator implements Comparator {
  59.414 +                public int compare (Object o1, Object o2) {
  59.415 +                    File f1 = (File) o1;
  59.416 +                    File f2 = (File) o2;
  59.417 +                    return f1.toString ().compareTo (f2.toString ());
  59.418 +                }
  59.419 +            }
  59.420 +            Comparator c = new FileNameComparator ();
  59.421 +            Collections.sort (jars2, c);
  59.422 +            Iterator it = jars2.iterator ();
  59.423 +            while (it.hasNext ()) {
  59.424 +                File jar = (File) it.next ();
  59.425 +                Map files = (Map) router.get (jar); // Map<String,File>
  59.426 +                if (jar.exists ()) {
  59.427 +                    // Do an up-to-date check first.
  59.428 +                    long time = jar.lastModified ();
  59.429 +                    if (manifest == null || manifest.lastModified () <= time) {
  59.430 +                        boolean upToDate = true;
  59.431 +                        Iterator it2 = files.values ().iterator ();
  59.432 +                        while (it2.hasNext ()) {
  59.433 +                            File f = (File) it2.next ();
  59.434 +                            if (f.lastModified () > time) {
  59.435 +                                upToDate = false;
  59.436 +                                break;
  59.437 +                            }
  59.438 +                        }
  59.439 +                        if (upToDate) {
  59.440 +                            // Skip this JAR.
  59.441 +                            continue;
  59.442 +                        }
  59.443 +                    }
  59.444 +                }
  59.445 +                log ("Building localized/branded jar: " + jar);
  59.446 +                IOException closing = null;
  59.447 +                try {
  59.448 +                    jar.getParentFile ().mkdirs ();
  59.449 +                    ZipOutputStream out = new ZipOutputStream (new FileOutputStream (jar));
  59.450 +                    try {
  59.451 +                        out.setMethod (doCompress ? ZipOutputStream.DEFLATED : ZipOutputStream.STORED);
  59.452 +                        String localeMark = (String) localeMarks.get (jar);
  59.453 +                        String brandingMark = (String) brandingMarks.get (jar);
  59.454 +                        Set addedDirs = new HashSet (); // Set<String>
  59.455 +                        // Add the manifest.
  59.456 +                        InputStream is;
  59.457 +                        long time;
  59.458 +                        java.util.jar.Manifest mani;
  59.459 +                        if (manifest != null && localeMark == null && brandingMark == null) {
  59.460 +                            // Master JAR, and it has a manifest.
  59.461 +                            is = new FileInputStream (manifest);
  59.462 +                            time = manifest.lastModified ();
  59.463 +                            try {
  59.464 +                                mani = new java.util.jar.Manifest (is);
  59.465 +                            } finally {
  59.466 +                                is.close ();
  59.467 +                            }
  59.468 +                        } else if ((manifest != null) && (alwaysIncludeManifest)) {
  59.469 +                            // always include specified manifest in localized/branded jars
  59.470 +                            // such manifest must not contain attribute OpenIDE-Module
  59.471 +                            // check supplied manifest and if contains key OpenIDE-Module, issue warning
  59.472 +                            // and fallback to default Ant's manifest boilerplate (like no manifest was supplied)
  59.473 +                            is = new FileInputStream (manifest);
  59.474 +                            time = manifest.lastModified ();
  59.475 +                            try {
  59.476 +                                mani = new java.util.jar.Manifest (is);
  59.477 +                            } finally {
  59.478 +                                is.close ();
  59.479 +                            }
  59.480 +                            Attributes attr = mani.getMainAttributes ();
  59.481 +                            //check if it's not module manifest for jarfile with localized/branded resources
  59.482 +                            if ((attr.containsKey ("OpenIDE-Module")) && ((localeMark != null) || (brandingMark != null))){
  59.483 +                            	String lbmsg = "";
  59.484 +                            	if (localeMark != null) {
  59.485 +                            	    lbmsg = "locale: '"+localeMark+"' ";
  59.486 +                            	}
  59.487 +                            	if (brandingMark != null) {
  59.488 +                            	    lbmsg = "branding: '"+brandingMark+"' ";
  59.489 +                            	}
  59.490 +                                log("WARNING: Ignoring supplied NetBeans module manifest for "+lbmsg+"jarfile '"+jar+"'. Using default Ant manifest bolilerplate. "
  59.491 +                                   +"Use -verbose option to see more details.", Project.MSG_INFO);
  59.492 +                                log("WARNING(verbose): Supplied manifest file '"+manifest.getAbsolutePath()+"' contains "
  59.493 +                                   +"key OpenIDE-Module, which cannot be included in manifest of localized "
  59.494 +                                   +"and/or branded jar. Ignoring whole manifest for now. To fix this you have "
  59.495 +                                   +"to avoid using NetBeans module manifest file together with attribute "
  59.496 +                                   +"'allwaysincludemanifest' set to 'true' and non-empty properties 'locjar.locales' "
  59.497 +                                   +"and 'locjar.brands'. You can accomplish that by i.e. using Ant's <jar> task "
  59.498 +                                   +"for regular NetBeans module jarfile packaging and use NetBeans' Ant extension "
  59.499 +                                   +"task <"+this.getTaskName()+"> for localized and/or branded jars. Using default "
  59.500 +                                   +"Ant's manifest boilerplate instead.", Project.MSG_VERBOSE);
  59.501 +                                try {
  59.502 +                                    is.close();
  59.503 +                                } finally {
  59.504 +                                    is = MatchingTask.class.getResourceAsStream ("/org/apache/tools/ant/defaultManifest.mf");
  59.505 +                                    time = System.currentTimeMillis ();
  59.506 +                                    try {
  59.507 +                                        mani = new java.util.jar.Manifest (is);
  59.508 +                                    } finally {
  59.509 +                                       is.close ();
  59.510 +                                    }
  59.511 +                                }
  59.512 +                            }
  59.513 +                        } else {
  59.514 +                            // Some subsidiary JAR.
  59.515 +                            is = MatchingTask.class.getResourceAsStream ("/org/apache/tools/ant/defaultManifest.mf");
  59.516 +                            time = System.currentTimeMillis ();
  59.517 +                            try {
  59.518 +                                mani = new java.util.jar.Manifest (is);
  59.519 +                            } finally {
  59.520 +                                is.close ();
  59.521 +                            }
  59.522 +                        }
  59.523 +                        Attributes attr = mani.getMainAttributes ();
  59.524 +                        if (! attr.containsKey (Attributes.Name.MANIFEST_VERSION)) {
  59.525 +                            attr.put (Attributes.Name.MANIFEST_VERSION, "1.0");
  59.526 +                        }
  59.527 +                        if (localeMark != null) {
  59.528 +                            attr.putValue ("X-Informational-Archive-Locale", localeMark);
  59.529 +                        }
  59.530 +                        if (brandingMark != null) {
  59.531 +                            attr.putValue ("X-Informational-Archive-Branding", brandingMark);
  59.532 +                        }
  59.533 +                        ByteArrayOutputStream baos = new ByteArrayOutputStream ();
  59.534 +                        mani.write (baos);
  59.535 +                        byte[] bytes = baos.toByteArray ();
  59.536 +                        addToJar (new ByteArrayInputStream (bytes), new ByteArrayInputStream (bytes),
  59.537 +                                  out, "META-INF/MANIFEST.MF", time, addedDirs);
  59.538 +                        // Now regular files.
  59.539 +                        Iterator it2 = files.entrySet ().iterator ();
  59.540 +                        while (it2.hasNext ()) {
  59.541 +                            Map.Entry entry = (Map.Entry) it2.next ();
  59.542 +                            String path = (String) entry.getKey ();
  59.543 +                            File file = (File) entry.getValue ();
  59.544 +                            addToJar (new FileInputStream (file), new FileInputStream (file),
  59.545 +                                      out, path, file.lastModified (), addedDirs);
  59.546 +                        }
  59.547 +
  59.548 +			// If desired, write the root of the srcDir to a file. //
  59.549 +			writeSrcDir() ;
  59.550 +                    } finally {
  59.551 +                        try {
  59.552 +                            out.close ();
  59.553 +                        } catch (IOException ex) {
  59.554 +                            closing = ex;
  59.555 +                        }
  59.556 +                    }
  59.557 +
  59.558 +                    if (closing != null) {
  59.559 +                        // if there was a closing exception and no other one
  59.560 +                        throw closing;
  59.561 +                    }
  59.562 +                } catch (IOException ioe) {
  59.563 +                    String msg = "Problem creating JAR: " + ioe.getMessage ();
  59.564 +                    if (! jar.delete ()) {
  59.565 +                        msg += " (and the JAR is probably corrupt but I could not delete it)";
  59.566 +                    }
  59.567 +                    throw new BuildException(msg, ioe, getLocation());
  59.568 +                }
  59.569 +            }
  59.570 +        }
  59.571 +
  59.572 +    } // end execute()
  59.573 +
  59.574 +    private void addToJar (InputStream in1, InputStream in2, ZipOutputStream out,
  59.575 +                           String path, long lastModified, Set addedDirs) throws IOException {
  59.576 +        try {
  59.577 +            if (path.endsWith ("/")) {
  59.578 +                throw new IOException ("Bad path: " + path);
  59.579 +            }
  59.580 +            // Add parent dirs as needed:
  59.581 +            int pos = -1;
  59.582 +            while ((pos = path.indexOf ('/', pos + 1)) != -1) {
  59.583 +                String dir = path.substring (0, pos + 1);
  59.584 +                if (! addedDirs.contains (dir)) {
  59.585 +                    addedDirs.add (dir);
  59.586 +                    ZipEntry ze = new ZipEntry (dir);
  59.587 +                    ze.setSize (0);
  59.588 +                    ze.setMethod (ZipEntry.STORED);
  59.589 +                    ze.setCrc (emptyCrc);
  59.590 +                    ze.setTime (lastModified);
  59.591 +                    out.putNextEntry (ze);
  59.592 +                }
  59.593 +            }
  59.594 +            // Add the file itself:
  59.595 +            ZipEntry ze = new ZipEntry (path);
  59.596 +            ze.setMethod (doCompress ? ZipEntry.DEFLATED : ZipEntry.STORED);
  59.597 +            ze.setTime (lastModified);
  59.598 +            long size = 0;
  59.599 +            CRC32 crc = new CRC32 ();
  59.600 +            byte[] buf = new byte[4096];
  59.601 +            int read;
  59.602 +            while ((read = in1.read (buf)) != -1) {
  59.603 +                crc.update (buf, 0, read);
  59.604 +                size += read;
  59.605 +            }
  59.606 +            in1.close ();
  59.607 +            ze.setCrc (crc.getValue ());
  59.608 +            ze.setSize (size);
  59.609 +            out.putNextEntry (ze);
  59.610 +            while ((read = in2.read (buf)) != -1) {
  59.611 +                out.write (buf, 0, read);
  59.612 +            }
  59.613 +        } finally {
  59.614 +            in2.close ();
  59.615 +            in1.close ();
  59.616 +        }
  59.617 +    } // end addToJar()
  59.618 +
  59.619 +
  59.620 +  // If the name of any parent directory of this file is the same as //
  59.621 +  // one of the locales, return the locale.			     //
  59.622 +  protected String checkInLocaleDir( File file,
  59.623 +				     List locales) {
  59.624 +
  59.625 +    // See if this functionality is disabled. //
  59.626 +    if( !checkPathLocale) {
  59.627 +      return null ;
  59.628 +    }
  59.629 +
  59.630 +    int idx ;
  59.631 +    String loc, locale_dir, ret = null ;
  59.632 +    String path = file.getPath() ;
  59.633 +    Iterator iter = locales.iterator() ;
  59.634 +
  59.635 +    // For each locale. //
  59.636 +    while( iter.hasNext()) {
  59.637 +      loc = (String) iter.next() ;
  59.638 +
  59.639 +      // If the path contains a dir with the same name as the //
  59.640 +      // locale.					      //
  59.641 +      locale_dir = new String( file.separator) ;
  59.642 +      locale_dir += loc ;
  59.643 +      locale_dir += file.separator ;
  59.644 +      idx = path.indexOf( locale_dir) ;
  59.645 +      if( idx != -1) {
  59.646 +
  59.647 +	// Stop and return this locale. //
  59.648 +	ret = loc ;
  59.649 +	break ;
  59.650 +      }
  59.651 +    }
  59.652 +
  59.653 +    return( ret) ;
  59.654 +  }
  59.655 +
  59.656 +  ////////////////////////////////////////////////////////////////////
  59.657 +  // This section of code supports the feature that this class will //
  59.658 +  // look for global properties that specify locales and brandings  //
  59.659 +  // that should be used.					    //
  59.660 +  protected void addGlobalLocaleAndBranding() {
  59.661 +    addGlobals( getGlobalLocaleVarName(), locales) ;
  59.662 +    addGlobals( getOldGlobalLocaleVarName(), locales) ;
  59.663 +    addGlobals( getGlobalBrandingVarName(), brandings) ;
  59.664 +    addGlobals( getOldGlobalBrandingVarName(), brandings) ;
  59.665 +  }
  59.666 +
  59.667 +  protected String getGlobalLocaleVarName() {
  59.668 +    return( new String( "locjar.locales")) ;
  59.669 +  }
  59.670 +
  59.671 +  protected String getGlobalBrandingVarName() {
  59.672 +    return( new String( "locjar.brands")) ;
  59.673 +  }
  59.674 +
  59.675 +  // For backwards compatibility. //
  59.676 +  protected String getOldGlobalLocaleVarName() {
  59.677 +    return( new String( "locjar_global_locales")) ;
  59.678 +  }
  59.679 +
  59.680 +  // For backwards compatibility. //
  59.681 +  protected String getOldGlobalBrandingVarName() {
  59.682 +    return( new String( "locjar_global_brands")) ;
  59.683 +  }
  59.684 +
  59.685 +  protected void addGlobals( String var_name,
  59.686 +			     List list) {
  59.687 +    String prop = null ;
  59.688 +    StringTokenizer tokenizer = null ;
  59.689 +    String tok = null ;
  59.690 +    LocaleOrB lorb = null ;
  59.691 +
  59.692 +    // Foreach string in the global list. //
  59.693 +    prop = getProject().getProperty( var_name) ;
  59.694 +    if( prop != null && !prop.equals( "")) {
  59.695 +      tokenizer = new StringTokenizer( prop, ", ") ;
  59.696 +      while( tokenizer.hasMoreTokens()) {
  59.697 +	tok = tokenizer.nextToken() ;
  59.698 +
  59.699 +	// Add a new entry in the given list. //
  59.700 +	lorb = new LocaleOrB() ;
  59.701 +	lorb.setName( tok) ;
  59.702 +	list.add( lorb) ;
  59.703 +      }
  59.704 +    }
  59.705 +  }
  59.706 +  //////////////////////////////////////////////////////////////////////
  59.707 +
  59.708 +  protected boolean shouldWarnMissingDir() {
  59.709 +    String s ;
  59.710 +    boolean ret = false ;	// Default false. //
  59.711 +
  59.712 +    // If the attribute is set, use its value. //
  59.713 +    if( warnMissingDirSet) {
  59.714 +      ret = warnMissingDir ;
  59.715 +    }
  59.716 +
  59.717 +    // Otherwise use the global property value, if set. //
  59.718 +    else {
  59.719 +      s = getProject().getProperty("locjar.warnMissingDir");
  59.720 +      if( s != null && !s.trim().equals( "")) {
  59.721 +	ret = getProject().toBoolean(s);
  59.722 +      }
  59.723 +    }
  59.724 +
  59.725 +    return( ret) ;
  59.726 +  }
  59.727 +
  59.728 +  // If any dir's don't exist, warn the user and return true. //
  59.729 +  protected boolean warnIfMissingDir() {
  59.730 +    ListIterator iter ;
  59.731 +    FileSet fileset ;
  59.732 +    File dir ;
  59.733 +    boolean ret = false ;
  59.734 +
  59.735 +    // Print warning if the basedir doesn't exist. //
  59.736 +    if( baseDir != null && !baseDir.exists()) {
  59.737 +      ret = true ;
  59.738 +      printMissingDirWarning( baseDir) ;
  59.739 +    }
  59.740 +
  59.741 +    // For each fileset. //
  59.742 +    iter = filesets.listIterator() ;
  59.743 +    if( iter != null) {
  59.744 +      while( iter.hasNext()) {
  59.745 +
  59.746 +	// Print warning if the dir doesn't exist. //
  59.747 +	fileset = (FileSet) iter.next() ;
  59.748 +	dir = fileset.getDir(getProject());
  59.749 +	if( dir != null && !dir.exists()) {
  59.750 +	  ret = true ;
  59.751 +	  printMissingDirWarning( dir) ;
  59.752 +	}
  59.753 +      }
  59.754 +    }
  59.755 +    return( ret) ;
  59.756 +  }
  59.757 +
  59.758 +  // Warn the user that the given dir doesn't exist. //
  59.759 +  protected void printMissingDirWarning( File dir) {
  59.760 +    log( "WARNING: Skipping this task: Directory " + dir.getPath() + " doesn't exist.") ;
  59.761 +  }
  59.762 +
  59.763 +  protected boolean shouldWriteSrcDir() {
  59.764 +    boolean ret = false ;
  59.765 +    String s = getProject().getProperty("locjar.writeSrcDir");
  59.766 +    if( s != null && getProject().toBoolean(s)) {
  59.767 +      ret = true ;
  59.768 +    }
  59.769 +    return( ret) ;
  59.770 +  }
  59.771 +
  59.772 +  protected void writeSrcDir() {
  59.773 +    String name ;
  59.774 +    int idx, fromIdx ;
  59.775 +    OutputStreamWriter osw ;
  59.776 +    FileOutputStream fos ;
  59.777 +    File file ;
  59.778 +
  59.779 +    if( shouldWriteSrcDir() && jarFile != null && baseDir != null) {
  59.780 +      name = jarFile.getPath() ;
  59.781 +      fromIdx = getNetbeansStartIdx() ;
  59.782 +      idx = name.indexOf( File.separator+"netbeans"+File.separator, fromIdx) ;
  59.783 +      if( idx != -1) {
  59.784 +	try {
  59.785 +	  file = new File( name.substring( 0, idx) + File.separator + "srcdir.properties") ;
  59.786 +	  fos = new FileOutputStream( file) ;
  59.787 +	  osw = new OutputStreamWriter( fos) ;
  59.788 +	  osw.write( "srcdir=" + baseDir + "\n") ;
  59.789 +	  osw.close() ;
  59.790 +	  fos.close() ;
  59.791 +	}
  59.792 +	catch( Exception e) {
  59.793 +	  System.out.println( "ERROR: " + e.getMessage()) ;
  59.794 +	  e.printStackTrace() ;
  59.795 +	  throw new BuildException() ;
  59.796 +	}
  59.797 +      }
  59.798 +      else {
  59.799 +	throw new BuildException( "ERROR: Couldn't find netbeans dir to write srcdir.properties to.") ;
  59.800 +      }
  59.801 +    }
  59.802 +  }
  59.803 +
  59.804 +  // Return the index to start searching from to find the "netbeans"
  59.805 +  // directory into which the "srcdir.properties" file will be
  59.806 +  // written.
  59.807 +  protected int getNetbeansStartIdx() {
  59.808 +    int startIdx = 0 ;
  59.809 +    int idx ;
  59.810 +
  59.811 +    idx = baseDir.getPath().lastIndexOf( File.separator+
  59.812 +					 "netbeans"+File.separator) ;
  59.813 +    if( idx != -1) {
  59.814 +      startIdx = idx + 1 ;
  59.815 +    }
  59.816 +    return( startIdx) ;
  59.817 +  }
  59.818 +}
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/MakeLNBM.java	Sun Jan 28 18:54:08 2007 +0000
    60.3 @@ -0,0 +1,872 @@
    60.4 +/*
    60.5 + * The contents of this file are subject to the terms of the Common Development
    60.6 + * and Distribution License (the License). You may not use this file except in
    60.7 + * compliance with the License.
    60.8 + *
    60.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   60.10 + * or http://www.netbeans.org/cddl.txt.
   60.11 +
   60.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   60.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   60.14 + * If applicable, add the following below the CDDL Header, with the fields
   60.15 + * enclosed by brackets [] replaced by your own identifying information:
   60.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   60.17 + *
   60.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   60.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   60.20 + * Microsystems, Inc. All Rights Reserved.
   60.21 + */
   60.22 +
   60.23 +package org.netbeans.modules.visualweb.ravebuild;
   60.24 +
   60.25 +import java.io.*;
   60.26 +import java.util.*;
   60.27 +import java.util.jar.*;
   60.28 +import java.util.zip.*;
   60.29 +import java.net.*;
   60.30 +
   60.31 +import org.apache.tools.ant.BuildException;
   60.32 +import org.apache.tools.ant.Location;
   60.33 +import org.apache.tools.ant.Project;
   60.34 +import org.apache.tools.ant.taskdefs.MatchingTask;
   60.35 +import org.apache.tools.ant.taskdefs.Jar;
   60.36 +import org.apache.tools.ant.taskdefs.Zip;
   60.37 +import org.apache.tools.ant.taskdefs.SignJar;
   60.38 +import org.apache.tools.ant.types.FileSet;
   60.39 +
   60.40 +/** Makes a localized <code>.nbm</code> (<b>N</b>et<b>B</b>eans <b>M</b>odule) file.
   60.41 + * This version is temporary, intended to be used only until 
   60.42 + * the functionality added to this version since rev 1.29 
   60.43 + * of MakeNBM.java can be added into MakeNBM.java
   60.44 + * 
   60.45 + * @author Jerry Huth (email: jerry@solidstep.com)
   60.46 + */
   60.47 +public class MakeLNBM extends MatchingTask {
   60.48 +
   60.49 +    /** The same syntax may be used for either <samp>&lt;license&gt;</samp> or
   60.50 +     * <samp>&lt;description&gt;</samp> subelements.
   60.51 +     * <p>By setting the property <code>makenbm.nocdata</code> to <code>true</code>,
   60.52 +     * you can avoid using XML <code>CDATA</code> (for compatibility with older versions
   60.53 +     * of Auto Update which could not handle it).
   60.54 +     */
   60.55 +    public class Blurb {
   60.56 +        /** You may embed a <samp>&lt;file&gt;</samp> element inside the blurb.
   60.57 +         * If there is text on either side of it, that will be separated
   60.58 +         * with a line of dashes automatically.
   60.59 +         * But use nested <samp>&lt;text&gt;</samp> for this purpose.
   60.60 +         */
   60.61 +	public class FileInsert {
   60.62 +            /** File location. */
   60.63 +	    public void setLocation (File file) throws BuildException {
   60.64 +                log("Including contents of " + file, Project.MSG_VERBOSE);
   60.65 +		long lmod = file.lastModified ();
   60.66 +		if (lmod > mostRecentInput) mostRecentInput = lmod;
   60.67 +		addSeparator ();
   60.68 +		try {
   60.69 +		    InputStream is = new FileInputStream (file);
   60.70 +		    try {
   60.71 +			Reader r = new InputStreamReader (is, "UTF-8"); //NOI18N
   60.72 +			char[] buf = new char[4096];
   60.73 +			int len;
   60.74 +			while ((len = r.read (buf)) != -1)
   60.75 +			    text.append (buf, 0, len);
   60.76 +		    } finally {
   60.77 +			is.close ();
   60.78 +		    }
   60.79 +		} catch (IOException ioe) {
   60.80 +                    throw new BuildException ("Exception reading blurb from " + file, ioe, getLocation ());
   60.81 +		}
   60.82 +	    }
   60.83 +	}
   60.84 +	private StringBuffer text = new StringBuffer ();
   60.85 +	private String name = null;
   60.86 +        /** There may be freeform text inside the element. Prefer to use nested elements. */
   60.87 +	public void addText (String t) {
   60.88 +	    addSeparator ();
   60.89 +	    // Strips indentation. Needed because of common style:
   60.90 +	    // <description>
   60.91 +	    //   Some text here.
   60.92 +	    //   And another line.
   60.93 +	    // </description>
   60.94 +	    t = getProject().replaceProperties(t.trim());
   60.95 +	    int min = Integer.MAX_VALUE;
   60.96 +	    StringTokenizer tok = new StringTokenizer (t, "\n"); //NOI18N
   60.97 +	    boolean first = true;
   60.98 +	    while (tok.hasMoreTokens ()) {
   60.99 +		String line = tok.nextToken ();
  60.100 +		if (first) {
  60.101 +		    first = false;
  60.102 +		} else {
  60.103 +		    int i;
  60.104 +		    for (i = 0;
  60.105 +			 i < line.length () &&
  60.106 +			     Character.isWhitespace (line.charAt (i));
  60.107 +			 i++)
  60.108 +			;
  60.109 +		    if (i < min) min = i;
  60.110 +		}
  60.111 +	    }
  60.112 +	    if (min == 0) {
  60.113 +		text.append (t);
  60.114 +	    } else {
  60.115 +		tok = new StringTokenizer (t, "\n"); //NOI18N
  60.116 +		first = true;
  60.117 +		while (tok.hasMoreTokens ()) {
  60.118 +		    String line = tok.nextToken ();
  60.119 +		    if (first) {
  60.120 +			first = false;
  60.121 +		    } else {
  60.122 +			text.append ('\n'); //NOI18N
  60.123 +			line = line.substring (min);
  60.124 +		    }
  60.125 +		    text.append (line);
  60.126 +		}
  60.127 +	    }
  60.128 +	}
  60.129 +        /** Contents of a file to include. */
  60.130 +	public FileInsert createFile () {
  60.131 +	    return new FileInsert ();
  60.132 +	}
  60.133 +        /** Text to include literally. */
  60.134 +        public class Text {
  60.135 +            public void addText(String t) {
  60.136 +                Blurb.this.addText(t);
  60.137 +            }
  60.138 +        }
  60.139 +        // At least on Ant 1.3, mixed content does not work: all the text is added
  60.140 +        // first, then all the file inserts. Need to use subelements to be sure.
  60.141 +        /** Include nested literal text. */
  60.142 +        public Text createText() {
  60.143 +            return new Text();
  60.144 +        }
  60.145 +	private void addSeparator () {
  60.146 +	    if (text.length () > 0) {
  60.147 +		// some sort of separator
  60.148 +		if (text.charAt (text.length () - 1) != '\n') //NOI18N
  60.149 +		    text.append ('\n'); //NOI18N
  60.150 +		text.append ("-----------------------------------------------------\n"); //NOI18N
  60.151 +	    }
  60.152 +	}
  60.153 +	public String getText () {
  60.154 +            String nocdata = getProject().getProperty("makenbm.nocdata"); //NOI18N
  60.155 +            if (nocdata != null && Project.toBoolean(nocdata)) {
  60.156 +                return xmlEscape(text.toString());
  60.157 +            } else {
  60.158 +                return "<![CDATA[" + text.toString () + "]]>"; //NOI18N
  60.159 +            }
  60.160 +	}
  60.161 +        /** You can either set a name for the blurb, or using the <code>file</code> attribute does this.
  60.162 +         * The name is mandatory for licenses, as this identifies the license in
  60.163 +         * an update description.
  60.164 +         */
  60.165 +	public void setName (String name) {
  60.166 +	    this.name = name;
  60.167 +	}
  60.168 +	public String getName () {
  60.169 +	    return name;
  60.170 +	}
  60.171 +        /** Include a file (and set the license name according to its basename). */
  60.172 +	public void setFile (File file) {
  60.173 +	    // This actually adds the text and so on:
  60.174 +	    new FileInsert ().setLocation (file);
  60.175 +	    // Default for the name too, as a convenience.
  60.176 +	    if (name == null) name = file.getName ();
  60.177 +	}
  60.178 +    }
  60.179 +
  60.180 +    public class ExternalPackage {
  60.181 +	String name = null;
  60.182 +	String targetName = null;
  60.183 +	String startUrl = null;
  60.184 +	String description = null;
  60.185 +
  60.186 +	public void setName(String n) {
  60.187 +	    this.name = n;
  60.188 +	}
  60.189 +
  60.190 +	public void setTargetName(String t) {
  60.191 +	    this.targetName = t;
  60.192 +	}
  60.193 +
  60.194 +	public void setStartURL(String u) {
  60.195 +	    this.startUrl = u;
  60.196 +	}
  60.197 +	
  60.198 +	public void setDescription(String d) {
  60.199 +	    this.description = d;
  60.200 +	}
  60.201 +
  60.202 +    }
  60.203 +
  60.204 +    // Similar to org.openide.xml.XMLUtil methods.
  60.205 +    private static String xmlEscape(String s) {
  60.206 +        int max = s.length();
  60.207 +        StringBuffer s2 = new StringBuffer((int)(max * 1.1 + 1));
  60.208 +        for (int i = 0; i < max; i++) {
  60.209 +            char c = s.charAt(i);
  60.210 +            switch (c) {
  60.211 +                case '<': //NOI18N
  60.212 +                    s2.append("&lt;"); //NOI18N
  60.213 +                    break;
  60.214 +                case '>': //NOI18N
  60.215 +                    s2.append("&gt;"); //NOI18N
  60.216 +                    break;
  60.217 +                case '&': //NOI18N
  60.218 +                    s2.append("&amp;"); //NOI18N
  60.219 +                    break;
  60.220 +                case '"': //NOI18N
  60.221 +                    s2.append("&quot;"); //NOI18N
  60.222 +                    break;
  60.223 +                default:
  60.224 +                    s2.append(c);
  60.225 +                    break;
  60.226 +            }
  60.227 +        }
  60.228 +        return s2.toString();
  60.229 +    }
  60.230 +
  60.231 +    /** <samp>&lt;signature&gt;</samp> subelement for signing the NBM. */
  60.232 +    public /*static*/ class Signature {
  60.233 +	public File keystore;
  60.234 +	public String storepass, alias;
  60.235 +        /** Path to the keystore (private key). */
  60.236 +	public void setKeystore (File f) {
  60.237 +	    keystore = f;
  60.238 +	}
  60.239 +        /** Password for the keystore.
  60.240 +         * If a question mark (<samp>?</samp>), the NBM will not be signed
  60.241 +         * and a warning will be printed.
  60.242 +         */
  60.243 +	public void setStorepass (String s) {
  60.244 +	    storepass = s;
  60.245 +	}
  60.246 +        /** Alias for the private key. */
  60.247 +	public void setAlias (String s) {
  60.248 +	    alias = s;
  60.249 +	}
  60.250 +    }
  60.251 +
  60.252 +    private File file = null;
  60.253 +    private File topdir = null;
  60.254 +    private File manifest = null;
  60.255 +    /** see #13850 for explanation */
  60.256 +    private File module = null;
  60.257 +    private String homepage = null;
  60.258 +    private String distribution = null;
  60.259 +    private String needsrestart = null;
  60.260 +    private Blurb license = null;
  60.261 +    private Blurb description = null;
  60.262 +    private Blurb notification = null;    
  60.263 +    private Signature signature = null;
  60.264 +    private long mostRecentInput = 0L;
  60.265 +    private boolean isStandardInclude = true;
  60.266 +    private Vector externalPackages = null;
  60.267 +    private boolean manOrModReq = true ;
  60.268 +    private boolean manOrModReqSet = false ;
  60.269 +    private String langCode = null ;
  60.270 +    private String brandingCode = null ;
  60.271 +    private String modInfo = null ;
  60.272 +    private File locBundle = null ; // Localizing Bundle
  60.273 +    private String global = null;
  60.274 +
  60.275 +    /** Install globally? */
  60.276 +    public void setGlobal (String isGlobal) {
  60.277 +        this.global = isGlobal;
  60.278 +    }
  60.279 +
  60.280 +    /** Include netbeans directory - default is true */
  60.281 +    public void setIsStandardInclude(boolean isStandardInclude) {
  60.282 +	this.isStandardInclude = isStandardInclude;
  60.283 +    }
  60.284 +
  60.285 +    /** Name of resulting NBM file. */
  60.286 +    public void setFile (File file) {
  60.287 +	this.file = file;
  60.288 +    }
  60.289 +    /** Top directory.
  60.290 +     * Expected to contain a subdirectory <samp>netbeans/</samp> with the
  60.291 +     * desired contents of the NBM.
  60.292 +     * Will create <samp>Info/info.xml</samp> with metadata.
  60.293 +     */
  60.294 +    public void setTopdir (File topdir) {
  60.295 +	this.topdir = topdir;
  60.296 +    }
  60.297 +    /** Module manifest needed for versioning.
  60.298 +     * @deprecated Use {@link #setModule} instead.
  60.299 +     */
  60.300 +    public void setManifest (File manifest) {
  60.301 +	this.manifest = manifest;
  60.302 +	long lmod = manifest.lastModified ();
  60.303 +	if (lmod > mostRecentInput) mostRecentInput = lmod;
  60.304 +        log(getLocation() + "The 'manifest' attr on <makenbm> is deprecated, please use 'module' instead", Project.MSG_WARN);
  60.305 +    }
  60.306 +    /** Module JAR needed for generating the info file.
  60.307 +     * Information may be gotten either from its manifest,
  60.308 +     * or if it declares OpenIDE-Module-Localizing-Bundle in its
  60.309 +     * manifest, from that bundle.
  60.310 +     * The base locale variant, if any, is also checked if necessary
  60.311 +     * for the named bundle.
  60.312 +     * Currently no other locale variants of the module are examined;
  60.313 +     * the information is available but there is no published specification
  60.314 +     * of what the resulting variant NBMs (or variant information within
  60.315 +     * the NBM) should look like.
  60.316 +     */
  60.317 +    public void setModule(File module) {
  60.318 +        this.module = module;
  60.319 +        // mostRecentInput updated below...
  60.320 +    }
  60.321 +    /** URL to a home page describing the module. */
  60.322 +    public void setHomepage (String homepage) {
  60.323 +	this.homepage = homepage;
  60.324 +    }
  60.325 +    /** Does module need IDE restart to be installed? */
  60.326 +    public void setNeedsrestart (String needsrestart) {
  60.327 +        this.needsrestart = needsrestart;
  60.328 +    }
  60.329 +    /** URL where this NBM file is expected to be downloadable from. */
  60.330 +    public void setDistribution (String distribution) throws BuildException {
  60.331 +        if (distribution.startsWith("http://")) { //NOI18N
  60.332 +            this.distribution = distribution;
  60.333 +        } else  if (!(distribution.equals(""))) {
  60.334 +            // workaround for typical bug in build script
  60.335 +            this.distribution = "http://" + distribution; //NOI18N
  60.336 +        } else {
  60.337 +            throw new BuildException("Distribution URL is empty, check build.xml file", getLocation());
  60.338 +        }
  60.339 +        // check the URL
  60.340 +        try {
  60.341 +            URI uri = java.net.URI.create(this.distribution);
  60.342 +        } catch (IllegalArgumentException ile) {
  60.343 +            throw new BuildException("Distribution URL \"" + this.distribution + "\" is not a valid URI", ile, getLocation());
  60.344 +        }
  60.345 +    }
  60.346 +    public Blurb createLicense () {
  60.347 +	return (license = new Blurb ());
  60.348 +    }
  60.349 +    public Blurb createNotification () {
  60.350 +	return (notification = new Blurb ());
  60.351 +    }    
  60.352 +    public Blurb createDescription () {
  60.353 +        log(getLocation() + "The <description> subelement in <makenbm> is deprecated except for emergency patches, please ensure your module has an OpenIDE-Module-Long-Description instead", Project.MSG_WARN);
  60.354 +	return (description = new Blurb ());
  60.355 +    }
  60.356 +    public Signature createSignature () {
  60.357 +	return (signature = new Signature ());
  60.358 +    }
  60.359 +
  60.360 +    public ExternalPackage createExternalPackage(){
  60.361 +	ExternalPackage externalPackage = new ExternalPackage ();
  60.362 +	if (externalPackages == null)
  60.363 +	    externalPackages = new Vector();
  60.364 +	externalPackages.add( externalPackage );
  60.365 +	return externalPackage;
  60.366 +    }
  60.367 +
  60.368 +    public void execute () throws BuildException {
  60.369 +	if (file == null) {
  60.370 +	    throw new BuildException("must set file for makenbm", getLocation());
  60.371 +        }
  60.372 +        if (manifest == null && module == null && reqManOrMod()) {
  60.373 +            throw new BuildException("must set module for makenbm", getLocation());
  60.374 +        }
  60.375 +        if (manifest != null && module != null) {
  60.376 +            throw new BuildException("cannot set both manifest and module for makenbm", getLocation());
  60.377 +        }
  60.378 +	// Will create a file Info/info.xml to be stored alongside netbeans/ contents.
  60.379 +	File infodir = new File (topdir, "Info"); //NOI18N
  60.380 +	infodir.mkdirs ();
  60.381 +	File infofile = new File (infodir, "info.xml"); //NOI18N
  60.382 +	if (infofile.exists ()) {
  60.383 +            infofile.delete();
  60.384 +        }
  60.385 +        Attributes attr = null;
  60.386 +        if (module != null) {
  60.387 +            // The normal case; read attributes from its manifest and maybe bundle.
  60.388 +            long mMod = module.lastModified();
  60.389 +            if (mostRecentInput < mMod) mostRecentInput = mMod;
  60.390 +            try {
  60.391 +                JarFile modulejar = new JarFile(module);
  60.392 +                try {
  60.393 +                    attr = modulejar.getManifest().getMainAttributes();
  60.394 +                    String bundlename = attr.getValue("OpenIDE-Module-Localizing-Bundle"); //NOI18N
  60.395 +                    if (bundlename != null) {
  60.396 +                        Properties p = new Properties();
  60.397 +                        ZipEntry bundleentry = modulejar.getEntry(bundlename);
  60.398 +                        if (bundleentry != null) {
  60.399 +                            InputStream is = modulejar.getInputStream(bundleentry);
  60.400 +                            try {
  60.401 +                                p.load(is);
  60.402 +                            } finally {
  60.403 +                                is.close();
  60.404 +                            }
  60.405 +                        } else {
  60.406 +                            // Not found in main JAR, check locale variant JAR.
  60.407 +                            File variant = new File(new File(module.getParentFile(), "locale"), module.getName()); //NOI18N
  60.408 +                            if (!variant.isFile()) throw new BuildException(bundlename + " not found in " + module, getLocation());
  60.409 +                            long vmMod = variant.lastModified();
  60.410 +                            if (mostRecentInput < vmMod) mostRecentInput = vmMod;
  60.411 +                            ZipFile variantjar = new ZipFile(variant);
  60.412 +                            try {
  60.413 +                                bundleentry = variantjar.getEntry(bundlename);
  60.414 +                                if (bundleentry == null) throw new BuildException(bundlename + " not found in " + module + " nor in " + variant, getLocation());
  60.415 +                                InputStream is = variantjar.getInputStream(bundleentry);
  60.416 +                                try {
  60.417 +                                    p.load(is);
  60.418 +                                } finally {
  60.419 +                                    is.close();
  60.420 +                                }
  60.421 +                            } finally {
  60.422 +                                variantjar.close();
  60.423 +                            }
  60.424 +                        }
  60.425 +                        // Now pick up attributes from the bundle.
  60.426 +                        Iterator it = p.entrySet().iterator();
  60.427 +                        while (it.hasNext()) {
  60.428 +                            Map.Entry entry = (Map.Entry)it.next();
  60.429 +                            String name = (String)entry.getKey();
  60.430 +                            if (! name.startsWith("OpenIDE-Module-")) continue; //NOI18N
  60.431 +                            attr.putValue(name, (String)entry.getValue());
  60.432 +                        }
  60.433 +                    } // else all loc attrs in main manifest, OK
  60.434 +                } finally {
  60.435 +                    modulejar.close();
  60.436 +                }
  60.437 +            } catch (IOException ioe) {
  60.438 +                throw new BuildException("exception while reading " + module, ioe, getLocation());
  60.439 +            }
  60.440 +        } // else we will read attr later if info file is out of date
  60.441 +	boolean skipInfo = false;
  60.442 +	if (infofile.exists ()) {
  60.443 +	    // Check for up-to-date w.r.t. manifest and maybe license file.
  60.444 +	    long iMod = infofile.lastModified ();
  60.445 +	    if (mostRecentInput < iMod)
  60.446 +		skipInfo = true;
  60.447 +	}
  60.448 +	if (! skipInfo) {
  60.449 +	    log ("Creating NBM info file " + infofile);
  60.450 +            if (manifest != null) {
  60.451 +                // Read module manifest for main attributes.
  60.452 +                try {
  60.453 +                    InputStream manifestStream = new FileInputStream (manifest);
  60.454 +                    try {
  60.455 +                        attr = new Manifest (manifestStream).getMainAttributes ();
  60.456 +                    } finally {
  60.457 +                        manifestStream.close ();
  60.458 +                    }
  60.459 +                } catch (IOException e) {
  60.460 +                    throw new BuildException("exception when reading manifest " + manifest, e, getLocation());
  60.461 +                }
  60.462 +            } // else we read attr before
  60.463 +	    try {
  60.464 +		OutputStream infoStream = new FileOutputStream (infofile);
  60.465 +		try {
  60.466 +                    PrintWriter ps = new PrintWriter(new OutputStreamWriter(infoStream, "UTF-8"));
  60.467 +		    // Begin writing XML.
  60.468 +                    ps.println ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //NOI18N
  60.469 +                    ps.println("<!DOCTYPE module PUBLIC \"-//NetBeans//DTD Autoupdate Module Info 2.3//EN\" \"http://www.netbeans.org/dtds/autoupdate-info-2_3.dtd\">"); //NOI18N
  60.470 +		    if( attr != null) {
  60.471 +		      String codenamebase = attr.getValue ("OpenIDE-Module"); //NOI18N
  60.472 +		      if (codenamebase == null)
  60.473 +			throw new BuildException("invalid manifest, does not contain OpenIDE-Module", getLocation());
  60.474 +		      // Strip major release number if any.
  60.475 +		      codenamebase = getCodenameBase( codenamebase) ;
  60.476 +		      ps.println ("<module codenamebase=\"" + xmlEscape(codenamebase) + "\""); //NOI18N
  60.477 +		    }
  60.478 +		    else {
  60.479 +		      ps.print( "<module "); //NOI18N
  60.480 +		      if( modInfo != null && !modInfo.trim().equals( "")) {
  60.481 +			String codenamebase = getCodenameBase( modInfo) ;
  60.482 +			ps.println( "codenamebase=\"" + xmlEscape(codenamebase) + "\""); //NOI18N
  60.483 +		      }
  60.484 +		      else {
  60.485 +			ps.println( "") ; //NOI18N
  60.486 +		      }
  60.487 +		    }
  60.488 +		    if (homepage != null)
  60.489 +                        ps.println ("        homepage=\"" + xmlEscape(homepage) + "\""); //NOI18N
  60.490 +		    if (distribution != null) {
  60.491 +                        ps.println ("        distribution=\"" + xmlEscape(distribution) + "\""); //NOI18N
  60.492 +                    } else {
  60.493 +                        throw new BuildException("NBM distribution URL is not set", getLocation());
  60.494 +                    }
  60.495 +		    // Here we only write a name for the license.
  60.496 +		    if (license != null) {
  60.497 +			String name = license.getName ();
  60.498 +			if (name == null)
  60.499 +			    throw new BuildException("Every license must have a name or file attribute", getLocation());
  60.500 +                        ps.println ("        license=\"" + xmlEscape(name) + "\""); //NOI18N
  60.501 +		    }
  60.502 +		    ps.println ("        downloadsize=\"0\""); //NOI18N
  60.503 +                    if (needsrestart != null)
  60.504 +                        ps.println ("        needsrestart=\"" + xmlEscape(needsrestart) + "\""); //NOI18N
  60.505 +		    if ((global != null) && (!global.equals(""))) {  //NOI18N
  60.506 +                        ps.println ("        global=\"" + xmlEscape(global) + "\""); //NOI18N
  60.507 +                    }
  60.508 +		    ps.println (">"); //NOI18N
  60.509 +		    if (description != null) {
  60.510 +			ps.print ("  <description>"); //NOI18N
  60.511 +			ps.print (description.getText ());
  60.512 +			ps.println ("</description>"); //NOI18N
  60.513 +                    }
  60.514 +
  60.515 +		    // Write manifest attributes.
  60.516 +		    if( attr != null) {
  60.517 +		        ps.print ("  <manifest "); //NOI18N
  60.518 +			boolean firstline = true;
  60.519 +		        List attrNames = new ArrayList(attr.size()); // List<String>
  60.520 +			Iterator it = attr.keySet().iterator();
  60.521 +			while (it.hasNext()) {
  60.522 +			    attrNames.add(((Attributes.Name)it.next()).toString());
  60.523 +			}
  60.524 +			Collections.sort(attrNames);
  60.525 +			it = attrNames.iterator();
  60.526 +			while (it.hasNext()) {
  60.527 +			    String name = (String)it.next();
  60.528 +			    // Ignore irrelevant attributes (cf. www/www/dtds/autoupdate-catalog-2_0.dtd
  60.529 +			    //  and www/www/dtds/autoupdate-info-1_0.dtd):
  60.530 +			    if (! name.startsWith("OpenIDE-Module")) continue; //NOI18N
  60.531 +			    if (name.equals("OpenIDE-Module-Localizing-Bundle")) continue; //NOI18N
  60.532 +			    if (name.equals("OpenIDE-Module-Install")) continue; //NOI18N
  60.533 +			    if (name.equals("OpenIDE-Module-Layer")) continue; //NOI18N
  60.534 +			    if (name.equals("OpenIDE-Module-Description")) continue; //NOI18N
  60.535 +			    if (name.equals("OpenIDE-Module-Package-Dependency-Message")) continue; //NOI18N
  60.536 +			    if (name.equals("OpenIDE-Module-Public-Packages")) continue; //NOI18N
  60.537 +			    if (firstline)
  60.538 +			        firstline = false;
  60.539 +			    else
  60.540 +			      ps.print ("            "); //NOI18N
  60.541 +			    ps.println(name + "=\"" + xmlEscape(attr.getValue(name)) + "\""); //NOI18N
  60.542 +			}
  60.543 +			ps.println ("  />"); //NOI18N
  60.544 +		    }
  60.545 +		    else if( modInfo != null && !modInfo.trim().equals( "")) { //NOI18N
  60.546 +		      String specver, majorver ;
  60.547 +
  60.548 +		      // Write the l10n tag and lang/branding codes. //
  60.549 +		      ps.println("  <l10n "); //NOI18N
  60.550 +		      if( langCode != null && !langCode.trim().equals( "")) { //NOI18N
  60.551 +			ps.println( "        langcode=\"" + xmlEscape(langCode) + "\"") ; //NOI18N
  60.552 +		      }
  60.553 +		      if( brandingCode != null && !brandingCode.trim().equals( "")) { //NOI18N
  60.554 +			ps.println( "        brandingcode=\"" + xmlEscape(brandingCode) + "\"") ; //NOI18N
  60.555 +		      }
  60.556 +
  60.557 +		      // Write the major version if possible. //
  60.558 +		      majorver = getMajorVer( modInfo) ;
  60.559 +		      if( majorver != null && !majorver.trim().equals( "")) { //NOI18N
  60.560 +			ps.println( "        module_major_version=\"" + xmlEscape(majorver) + "\"") ; //NOI18N
  60.561 +		      }
  60.562 +
  60.563 +		      // Write the spec version if possible. //
  60.564 +		      specver = getSpecVer( modInfo) ;
  60.565 +		      if( specver != null && !specver.trim().equals( "")) { //NOI18N
  60.566 +			ps.println( "        module_spec_version=\"" + xmlEscape(specver) + "\"") ; //NOI18N
  60.567 +		      }
  60.568 +
  60.569 +		      // Read localizing bundle and write relevant attr's. //
  60.570 +		      if( locBundle != null) {
  60.571 +			writeLocBundleAttrs( ps) ;
  60.572 +		      }
  60.573 +
  60.574 +		      ps.println( "  />") ; //NOI18N
  60.575 +		    }
  60.576 +
  60.577 +		    // Maybe write out license text.
  60.578 +		    if (license != null) {
  60.579 +                        ps.print ("  <license name=\"" + xmlEscape(license.getName ()) + "\">"); //NOI18N
  60.580 +			ps.print (license.getText ());
  60.581 +			ps.println ("</license>"); //NOI18N
  60.582 +		    }
  60.583 +                    if (notification != null) {
  60.584 +                        ps.print("  <module_notification>"); //NOI18N
  60.585 +                        ps.print(notification.getText());
  60.586 +                        ps.println("</module_notification>"); //NOI18N
  60.587 +		    }
  60.588 +		    if (externalPackages != null) {
  60.589 +			Enumeration exp = externalPackages.elements();
  60.590 +			while (exp.hasMoreElements()) {
  60.591 +			    ExternalPackage externalPackage = (ExternalPackage) exp.nextElement();
  60.592 +			    if (externalPackage.name == null || 
  60.593 +				externalPackage.targetName == null ||
  60.594 +				externalPackage.startUrl == null)
  60.595 +				throw new BuildException("Must define name, targetname, starturl for external package");
  60.596 +			    ps.print("  <external_package "); //NOI18N
  60.597 +			    ps.print("name=\""+xmlEscape(externalPackage.name)+"\" "); //NOI18N
  60.598 +			    ps.print("target_name=\""+xmlEscape(externalPackage.targetName)+"\" "); //NOI18N
  60.599 +			    ps.print("start_url=\""+xmlEscape(externalPackage.startUrl)+"\""); //NOI18N
  60.600 +			    if (externalPackage.description != null)
  60.601 +				ps.print(" description=\""+xmlEscape(externalPackage.description)+"\""); //NOI18N
  60.602 +			    ps.println("/>"); //NOI18N
  60.603 +			}
  60.604 +		    }
  60.605 +		    ps.println ("</module>"); //NOI18N
  60.606 +                    ps.flush();
  60.607 +		} finally {
  60.608 +		    infoStream.close ();
  60.609 +		}
  60.610 +	    } catch (IOException e) {
  60.611 +		throw new BuildException("exception when creating Info/info.xml", e, getLocation());
  60.612 +	    }
  60.613 +	}
  60.614 +
  60.615 +	// JAR it all up together.
  60.616 +	long jarModified = file.lastModified (); // may be 0
  60.617 +	//log ("Ensuring existence of NBM file " + file);
  60.618 +	Jar jar = (Jar) getProject().createTask("jar"); //NOI18N
  60.619 +	jar.setJarfile (file);
  60.620 +	//jar.setBasedir (topdir.getAbsolutePath ());
  60.621 +        jar.setCompress(true);
  60.622 +	//jar.createInclude ().setName ("netbeans/"); //NOI18N
  60.623 +	//jar.createInclude ().setName ("Info/info.xml"); //NOI18N
  60.624 +        jar.addFileset (getFileSet());
  60.625 +	jar.setLocation(getLocation());
  60.626 +	jar.init ();
  60.627 +	jar.execute ();
  60.628 +	// Maybe sign it.
  60.629 +	if (signature != null && file.lastModified () != jarModified) {
  60.630 +	    if (signature.keystore == null)
  60.631 +		throw new BuildException ("must define keystore attribute on <signature/>");
  60.632 +	    if (signature.storepass == null)
  60.633 +		throw new BuildException ("must define storepass attribute on <signature/>");
  60.634 +	    if (signature.alias == null)
  60.635 +		throw new BuildException ("must define alias attribute on <signature/>");
  60.636 +            if (signature.storepass.equals ("?") || !signature.keystore.exists()) {
  60.637 +                log ("Not signing NBM file " + file + "; no stored-key password provided or keystore (" 
  60.638 +		     + signature.keystore.toString() + ") doesn't exist", Project.MSG_WARN);
  60.639 +            } else {
  60.640 +                log ("Signing NBM file " + file);
  60.641 +                SignJar signjar = (SignJar) getProject().createTask("signjar"); //NOI18N
  60.642 +                //I have to use Reflection API, because there was changed API in ANT1.5
  60.643 +                try {
  60.644 +                    try {
  60.645 +                        Class[] paramsT = {String.class};
  60.646 +                        Object[] paramsV1 = {signature.keystore.getAbsolutePath()};
  60.647 +                        Object[] paramsV2 = {file.getAbsolutePath()};
  60.648 +                        signjar.getClass().getDeclaredMethod( "setKeystore", paramsT ).invoke( signjar, paramsV1 ); //NOI18N
  60.649 +                        signjar.getClass().getDeclaredMethod( "setJar", paramsT ).invoke( signjar, paramsV2 ); //NOI18N
  60.650 +                    } catch (NoSuchMethodException ex1) {
  60.651 +                        //Probably ANT 1.5
  60.652 +                        try {
  60.653 +                            Class[] paramsT = {File.class};
  60.654 +                            Object[] paramsV1 = {signature.keystore};
  60.655 +                            Object[] paramsV2 = {file};
  60.656 +                            signjar.getClass().getDeclaredMethod( "setKeystore", paramsT ).invoke( signjar, paramsV1 ); //NOI18N
  60.657 +                            signjar.getClass().getDeclaredMethod( "setJar", paramsT ).invoke( signjar, paramsV2 ); //NOI18N
  60.658 +                        } catch (NoSuchMethodException ex2) {
  60.659 +			    //Probably ANT1.5.3
  60.660 +			    try {
  60.661 +				Class[] paramsT1 = {File.class};
  60.662 +				Class[] paramsT2 = {String.class};
  60.663 +				Object[] paramsV1 = {signature.keystore.getAbsolutePath()};
  60.664 +				Object[] paramsV2 = {file};
  60.665 +				signjar.getClass().getDeclaredMethod( "setKeystore", paramsT2 ).invoke( signjar, paramsV1 ); //NOI18N
  60.666 +				signjar.getClass().getDeclaredMethod( "setJar", paramsT1 ).invoke( signjar, paramsV2 ); //NOI18N
  60.667 +			    }   catch (NoSuchMethodException ex3) {
  60.668 +                                throw new BuildException("Unknown Ant version, only Ant 1.6.5 is currently supported.");
  60.669 +                            }
  60.670 +                        }
  60.671 +                    }
  60.672 +                } catch (IllegalAccessException ex4) {
  60.673 +                    throw new BuildException(ex4);
  60.674 +                } catch (java.lang.reflect.InvocationTargetException ex5) {
  60.675 +                    throw new BuildException(ex5);
  60.676 +                }
  60.677 +                signjar.setStorepass (signature.storepass);
  60.678 +                signjar.setAlias (signature.alias);
  60.679 +                signjar.setLocation(getLocation());
  60.680 +                signjar.init ();
  60.681 +                signjar.execute ();
  60.682 +            }
  60.683 +	}
  60.684 +    }
  60.685 +   
  60.686 +    // Reflection access from MakeListOfNBM:
  60.687 +    
  60.688 +    public FileSet getFileSet() {
  60.689 +        FileSet fs = fileset;		//makes in apperance to excludes and includes files defined in XML
  60.690 +        fs.setDir (topdir);
  60.691 +
  60.692 +	if (isStandardInclude) {
  60.693 +	  fs.createInclude ().setName ("netbeans/"); //NOI18N
  60.694 +	  fs.createExclude ().setName ("netbeans/update_tracking/*.xml"); //NOI18N
  60.695 +	}
  60.696 +
  60.697 +	fs.createInclude ().setName ("Info/info.xml"); //NOI18N
  60.698 +        return fs;
  60.699 +    }
  60.700 +
  60.701 +    public Attributes getAttributes() throws IOException {
  60.702 +        if (manifest != null) {
  60.703 +            InputStream is = new FileInputStream(manifest);
  60.704 +            try {
  60.705 +                return new Manifest(is).getMainAttributes();
  60.706 +            } finally {
  60.707 +                is.close();
  60.708 +            }
  60.709 +        } else if (module != null) {
  60.710 +            JarFile jar = new JarFile(module);
  60.711 +            try {
  60.712 +                return jar.getManifest().getMainAttributes();
  60.713 +            } finally {
  60.714 +                jar.close();
  60.715 +            }
  60.716 +        } else {
  60.717 +            throw new IOException(getLocation() + "must give either 'manifest' or 'module' on <makenbm>");
  60.718 +        }
  60.719 +    }
  60.720 +
  60.721 +  protected String getCodenameBase( String openide_module) {
  60.722 +    String ret = openide_module ;
  60.723 +    int idx = ret.indexOf ('/'); //NOI18N
  60.724 +    if (idx != -1) {
  60.725 +      ret = ret.substring (0, idx);
  60.726 +    }
  60.727 +    return( ret) ;
  60.728 +  }
  60.729 +
  60.730 +  protected String getSpecVer( String mod_info) {
  60.731 +    String ret = null ;
  60.732 +    int first_idx, second_idx ;
  60.733 +
  60.734 +    // If there are 2 slashes. //
  60.735 +    first_idx = mod_info.indexOf( '/') ; //NOI18N
  60.736 +    if( first_idx != -1) {
  60.737 +      second_idx = mod_info.indexOf( '/', first_idx+1) ; //NOI18N
  60.738 +      if( second_idx != -1) {
  60.739 +
  60.740 +	// Return the string after the second slash. //
  60.741 +	ret = mod_info.substring( second_idx+1, mod_info.length()) ;
  60.742 +      }
  60.743 +    }
  60.744 +
  60.745 +    // Return null rather than an empty string. //
  60.746 +    if( ret != null && ret.trim().equals( "")) { //NOI18N
  60.747 +      ret = null ;
  60.748 +    }
  60.749 +    return( ret) ;
  60.750 +  }
  60.751 +
  60.752 +  protected String getMajorVer( String mod_info) {
  60.753 +    String ret = null ;
  60.754 +    int first_idx, second_idx ;
  60.755 +
  60.756 +    // If there are 2 slashes. //
  60.757 +    first_idx = mod_info.indexOf( '/') ; //NOI18N
  60.758 +    if( first_idx != -1) {
  60.759 +      second_idx = mod_info.indexOf( '/', first_idx+1) ; //NOI18N
  60.760 +      if( second_idx != -1) {
  60.761 +
  60.762 +	// Return the string between the slashes. //
  60.763 +	ret = mod_info.substring( first_idx+1, second_idx) ;
  60.764 +      }
  60.765 +
  60.766 +      // Else return the string after the first slash. //
  60.767 +      else {
  60.768 +	ret = mod_info.substring( first_idx+1, mod_info.length()) ;
  60.769 +      }
  60.770 +    }
  60.771 +
  60.772 +    // Return null rather than an empty string. //
  60.773 +    if( ret != null && ret.trim().equals( "")) { //NOI18N
  60.774 +      ret = null ;
  60.775 +    }
  60.776 +    return( ret) ;
  60.777 +  }
  60.778 +
  60.779 +  /** For l10n NBM's, this is the localizing bundle file 
  60.780 +   * that we'll look in to get module name, description, etc.
  60.781 +   */
  60.782 +  public void setLocBundle( File f) {
  60.783 +    locBundle = f ;
  60.784 +  }
  60.785 +
  60.786 +  /** See reqManOrMod() */
  60.787 +  public void setManOrModReq( boolean b) {
  60.788 +    manOrModReq = b ;
  60.789 +    manOrModReqSet = true ;
  60.790 +  }
  60.791 +
  60.792 +  /** If the manifest and module aren't required, use this 
  60.793 +   * to set the module codename, major version and spec version.
  60.794 +   */
  60.795 +  public void setModInfo( String s) {
  60.796 +    modInfo = s ;
  60.797 +  }
  60.798 +
  60.799 +  /** Set the language code for localized NBM's. */
  60.800 +  public void setLangCode( String s) {
  60.801 +    langCode = s ;
  60.802 +  }
  60.803 +
  60.804 +  /** Set the branding code for branded NBM's. */
  60.805 +  public void setBrandingCode( String s) {
  60.806 +    brandingCode = s ;
  60.807 +  }
  60.808 +
  60.809 +  /** Returns true if either a manifest or a module must be specified.
  60.810 +   * This is true unless either the global property
  60.811 +   * makenbm.manOrModReq is false, or the manOrModReq attribute of
  60.812 +   * this task is false.  The attribute, if set, has priority over the
  60.813 +   * global property.
  60.814 +   */
  60.815 +  public boolean reqManOrMod() {
  60.816 +    String s = null ;
  60.817 +    boolean req = true ;
  60.818 +
  60.819 +    if( manOrModReqSet) {
  60.820 +      req = manOrModReq ;
  60.821 +    }
  60.822 +    else {
  60.823 +      s = getProject().getProperty("makenbm.manOrModReq"); //NOI18N
  60.824 +      if( s != null && !s.equals( "")) { //NOI18N
  60.825 +	req = getProject().toBoolean(s);
  60.826 +      }
  60.827 +    }
  60.828 +
  60.829 +    return( req) ;
  60.830 +  }
  60.831 +
  60.832 +  protected void writeLocBundleAttrs( PrintWriter ps) {
  60.833 +    FileInputStream fis ;
  60.834 +    Properties p = new Properties() ;
  60.835 +    String s ;
  60.836 +    boolean hadone = false ;
  60.837 +
  60.838 +    try {
  60.839 +      fis = new FileInputStream( locBundle) ;
  60.840 +      p.load( fis);
  60.841 +      fis.close();
  60.842 +    }
  60.843 +    catch( Exception e) {
  60.844 +      System.out.println( "ERROR: " + e.getMessage()) ;
  60.845 +      e.printStackTrace() ;
  60.846 +      throw new BuildException() ;
  60.847 +    }
  60.848 +
  60.849 +    s = p.getProperty( "OpenIDE-Module-Name") ; //NOI18N
  60.850 +    if( writeProp( "OpenIDE-Module-Name", s, ps)) { //NOI18N
  60.851 +      hadone = true ;
  60.852 +    }
  60.853 +
  60.854 +    s = p.getProperty( "OpenIDE-Module-Long-Description") ; //NOI18N
  60.855 +    if( writeProp( "OpenIDE-Module-Long-Description", s, ps)) { //NOI18N
  60.856 +      hadone = true ;
  60.857 +    }
  60.858 +
  60.859 +    if( !hadone) {
  60.860 +      log( "WARNING: Localizing bundle had neither property: " + locBundle) ;
  60.861 +    }
  60.862 +  }
  60.863 +
  60.864 +  protected boolean writeProp( String name,
  60.865 +			       String val,
  60.866 +			       PrintWriter ps) {
  60.867 +    boolean ret = false ;
  60.868 +    if( val != null) {
  60.869 +      ps.println( name + "=\"" + xmlEscape(val) +"\"") ; //NOI18N
  60.870 +      ret = true ;
  60.871 +    }
  60.872 +    return( ret) ;
  60.873 +  }
  60.874 +
  60.875 +}
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/MakeLayer.java	Sun Jan 28 18:54:08 2007 +0000
    61.3 @@ -0,0 +1,111 @@
    61.4 +/*
    61.5 + * The contents of this file are subject to the terms of the Common Development
    61.6 + * and Distribution License (the License). You may not use this file except in
    61.7 + * compliance with the License.
    61.8 + *
    61.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   61.10 + * or http://www.netbeans.org/cddl.txt.
   61.11 +
   61.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   61.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   61.14 + * If applicable, add the following below the CDDL Header, with the fields
   61.15 + * enclosed by brackets [] replaced by your own identifying information:
   61.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   61.17 + *
   61.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   61.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   61.20 + * Microsystems, Inc. All Rights Reserved.
   61.21 + */
   61.22 +
   61.23 +package org.netbeans.modules.visualweb.ravebuild;
   61.24 +
   61.25 +import java.io.File;
   61.26 +import java.io.FileWriter;
   61.27 +import java.io.IOException;
   61.28 +import java.util.*;
   61.29 +
   61.30 +import org.apache.tools.ant.FileScanner;
   61.31 +import org.apache.tools.ant.types.FileSet;
   61.32 +import org.apache.tools.ant.BuildException;
   61.33 +import org.apache.tools.ant.taskdefs.MatchingTask;
   61.34 +import org.apache.tools.ant.taskdefs.UpToDate;
   61.35 +
   61.36 +/** Create a fragment of a module's XML layer.
   61.37 + *
   61.38 + * @author  Michal Zlamal
   61.39 + */
   61.40 +public class MakeLayer extends MatchingTask {
   61.41 +
   61.42 +    private File dest = null;
   61.43 +    private File topdir = null;
   61.44 +    private boolean absolutePath = false;
   61.45 +
   61.46 +    /** Target file containing list of all classes. */
   61.47 +    public void setDestfile(File f) {
   61.48 +        dest = f;
   61.49 +    }
   61.50 +
   61.51 +    /** Set the top directory.
   61.52 +     * There should be subdirectories under this matching pacgages.
   61.53 +     */
   61.54 +    public void setTopdir (File t) {
   61.55 +        topdir = t;
   61.56 +    }
   61.57 +    
   61.58 +    /** Set whether there is absolute path in top dir or not
   61.59 +     * default value is false
   61.60 +     */
   61.61 +    public void setAbsolutePath( boolean absolutePath ) {
   61.62 +        this.absolutePath = absolutePath;
   61.63 +    }
   61.64 +
   61.65 +    
   61.66 +    public void execute()  throws BuildException {
   61.67 +        if (topdir == null) {
   61.68 +            throw new BuildException("You must set at topdir attribute", getLocation());
   61.69 +        }
   61.70 +        if (dest == null) {
   61.71 +            throw new BuildException("You must specify output file", getLocation());
   61.72 +        }
   61.73 +        UpToDate upToDate = (UpToDate) this.getProject().createTask( "uptodate" ); //NOI18N
   61.74 +        fileset.setDir( topdir );
   61.75 +        upToDate.addSrcfiles( fileset );
   61.76 +        upToDate.setTargetFile( dest );
   61.77 +        upToDate.setProperty(dest.getAbsolutePath() + ".property"); //NOI18N
   61.78 +        upToDate.execute();
   61.79 +        if (this.getProject().getProperty(dest.getAbsolutePath() + ".property") != null) //NOI18N
   61.80 +            return;
   61.81 +        
   61.82 +        int lengthAdjust = (absolutePath) ? 0 : 1;
   61.83 +        FileWriter layerFile;
   61.84 +        try {
   61.85 +            layerFile = new FileWriter(dest);
   61.86 +        }
   61.87 +        catch (IOException e) {
   61.88 +            throw new BuildException(e, getLocation());
   61.89 +        }
   61.90 +        
   61.91 +        FileScanner scanner = getDirectoryScanner (topdir);
   61.92 +        String[] files = scanner.getIncludedFiles ();
   61.93 +        for (int i=0; i <files.length; i++) {
   61.94 +            File aFileName = new File(topdir, files[i]);
   61.95 +            try {
   61.96 +                layerFile.write(("<file name=\""+aFileName.getName()+"\"\n").replace(File.separatorChar,'/')); //NOI18N
   61.97 +                layerFile.write(("  url=\""+aFileName.getAbsolutePath().substring(topdir.getAbsolutePath().length()+lengthAdjust)+"\"/>\n").replace(File.separatorChar,'/')); //NOI18N
   61.98 +            }
   61.99 +            catch(IOException ex) {
  61.100 +                throw new BuildException("I/O error while writing layer file "+dest.getAbsolutePath(), ex, getLocation());
  61.101 +            }
  61.102 +        }
  61.103 +        
  61.104 +        try {
  61.105 +            layerFile.close();
  61.106 +        }
  61.107 +        catch (IOException e) {
  61.108 +            throw new BuildException("I/O error when trying to close layer file "+dest.getAbsolutePath(), e, getLocation());
  61.109 +        }
  61.110 +    }
  61.111 +}
  61.112 +
  61.113 +
  61.114 +
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/MakeListOfNBM.java	Sun Jan 28 18:54:08 2007 +0000
    62.3 @@ -0,0 +1,245 @@
    62.4 +/*
    62.5 + * The contents of this file are subject to the terms of the Common Development
    62.6 + * and Distribution License (the License). You may not use this file except in
    62.7 + * compliance with the License.
    62.8 + *
    62.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   62.10 + * or http://www.netbeans.org/cddl.txt.
   62.11 +
   62.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   62.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   62.14 + * If applicable, add the following below the CDDL Header, with the fields
   62.15 + * enclosed by brackets [] replaced by your own identifying information:
   62.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   62.17 + *
   62.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   62.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   62.20 + * Microsystems, Inc. All Rights Reserved.
   62.21 + */
   62.22 +
   62.23 +package org.netbeans.modules.visualweb.ravebuild;
   62.24 +
   62.25 +import java.io.File;
   62.26 +import java.io.FileInputStream;
   62.27 +import java.io.IOException;
   62.28 +import java.util.StringTokenizer;
   62.29 +import java.util.jar.Attributes;
   62.30 +import java.util.jar.JarFile;
   62.31 +import java.util.zip.CRC32;
   62.32 +import org.apache.tools.ant.BuildException;
   62.33 +import org.apache.tools.ant.DirectoryScanner;
   62.34 +import org.apache.tools.ant.Project;
   62.35 +import org.apache.tools.ant.Task;
   62.36 +import org.apache.tools.ant.types.FileSet;
   62.37 +
   62.38 +/**
   62.39 + * Create an update tracking file automatically.
   62.40 + * Requires a build script target containing one (and only one)
   62.41 + * occurrence of the <code>&lt;makenbm&gt;</code> task.
   62.42 + * @author  Michal Zlamal
   62.43 + */
   62.44 +public class MakeListOfNBM extends Task {
   62.45 +    File outputFile = null;
   62.46 +    String moduleName = null;
   62.47 +    boolean pok = true;
   62.48 +    FileSet fs = null;
   62.49 +    
   62.50 +    /** Sets the directory used to create the NBM list file */
   62.51 +    public void setOutputfiledir(File s) {
   62.52 +        outputFile = s;
   62.53 +        log("Setting outputfile to " + s, Project.MSG_DEBUG);
   62.54 +    }
   62.55 +
   62.56 +    public FileSet createFileSet() {
   62.57 +        return (fs = new FileSet());
   62.58 +    }
   62.59 +    
   62.60 +    /** Sets the module file */
   62.61 +    public void setModule(String s) {
   62.62 +        moduleName = s;
   62.63 +        log("Setting moduleName to " + s, Project.MSG_DEBUG);
   62.64 +    }
   62.65 +
   62.66 +    public void setTargetName(String t) {
   62.67 +        pok = false;
   62.68 +        log("<"+this.getTaskName()+"> attribute targetname has been DEPRECATED");
   62.69 +    }
   62.70 +
   62.71 +    public void execute () throws BuildException {
   62.72 +        if (!pok) throw new BuildException("Use the fileset to specify the content of the NBM");
   62.73 +        if ( outputFile == null ) throw new BuildException( "You have to specify output directoty" );
   62.74 +        if ( moduleName == null ) throw new BuildException( "You have to specify the main module's file" );
   62.75 +        if ( fs == null ) throw new BuildException( "You have to specify the fileset of files included in this module" );
   62.76 +
   62.77 +        log ("Generating information for Auto Update...");
   62.78 +        
   62.79 +        UpdateTracking track = new UpdateTracking( outputFile.getAbsolutePath() );
   62.80 +        Attributes attr;
   62.81 +        JarFile jar = null;
   62.82 +        File module = new File( outputFile, moduleName );
   62.83 +        try {
   62.84 +            jar = new JarFile(module);
   62.85 +            attr = jar.getManifest().getMainAttributes();
   62.86 +        } catch (IOException ex) {
   62.87 +            throw new BuildException("Can't get manifest attributes for module jar file "+module.getAbsolutePath(), ex, getLocation());
   62.88 +        } finally {
   62.89 +            try {
   62.90 +                if (jar != null) jar.close();
   62.91 +            } catch( IOException ex1 ) {
   62.92 +                String exmsg = ex1.getMessage();
   62.93 +                if (exmsg == null) exmsg = "Unknown error";
   62.94 +                log("Caught I/O Exception (msg:\""+exmsg+"\") when trying to close jar file "+module.getAbsolutePath(),Project.MSG_WARN);
   62.95 +            }
   62.96 +        }
   62.97 +        
   62.98 +        String codename = attr.getValue("OpenIDE-Module"); //NOI18N
   62.99 +        if (codename == null) {
  62.100 +            throw new BuildException("Manifest in jar file "+module.getAbsolutePath()+" does not contain OpenIDE-Module", getLocation());
  62.101 +        }
  62.102 +        
  62.103 +        String versionSpecNum = attr.getValue("OpenIDE-Module-Specification-Version"); //NOI18N
  62.104 +        if (versionSpecNum == null) {
  62.105 +            log("Manifest in jar file "+module.getAbsolutePath()+" does not contain tag OpenIDE-Module-Specification-Version");
  62.106 +            return;
  62.107 +        }
  62.108 +        
  62.109 +        UpdateTracking.Version version = track.addNewModuleVersion( codename, versionSpecNum );
  62.110 +
  62.111 +        fs.createInclude().setName("config" + File.separator + "Modules" + File.separator + track.getTrackingFileName()); //NOI18N
  62.112 +        
  62.113 +        // get directory scanner for "default" files
  62.114 +        DirectoryScanner ds = fs.getDirectoryScanner( this.getProject() );
  62.115 +        ds.scan();
  62.116 +        
  62.117 +        // check if we need also localized and branded files
  62.118 +        String lmnl = this.getProject().getProperty("locmakenbm.locales"); // NOI18N
  62.119 +        String lmnb = this.getProject().getProperty("locmakenbm.brands"); // NOI18N
  62.120 +        
  62.121 +        if ((!(lmnl == null)) && (!(lmnl.trim().equals("")))) { // NOI18N
  62.122 +            // property locmakenbm.locales is set, let's update the included fileset for locales
  62.123 +            // defined in that property
  62.124 +
  62.125 +            java.util.StringTokenizer tokenizer = new StringTokenizer( lmnl, ", ") ; //NOI18N
  62.126 +            int cntTok = tokenizer.countTokens();
  62.127 +            String[] lmnLocales = new String[cntTok];
  62.128 +            for (int j=0; j < cntTok; j++) {
  62.129 +                String s = tokenizer.nextToken();
  62.130 +                lmnLocales[j] = s;
  62.131 +                log("  lmnLocales[j] == "+lmnLocales[j], Project.MSG_DEBUG); // NOI18N
  62.132 +            }
  62.133 +
  62.134 +            // handle brandings   
  62.135 +            String[] lmnBrands = null;
  62.136 +            if ((!(lmnb == null)) && (!(lmnb.trim().equals("")))) { // NOI18N
  62.137 +                tokenizer = new StringTokenizer( lmnb, ", ") ; //NOI18N
  62.138 +                cntTok = tokenizer.countTokens();
  62.139 +                lmnBrands = new String[cntTok];
  62.140 +                for (int j=0; j < cntTok; j++) {
  62.141 +                    String s = tokenizer.nextToken();
  62.142 +                    lmnBrands[j] = s;
  62.143 +                    log("  lmnBrands[j] == "+lmnBrands[j], Project.MSG_DEBUG); // NOI18N
  62.144 +                }
  62.145 +            }
  62.146 +
  62.147 +            // update fileset for localized/branded files
  62.148 +        
  62.149 +            String[] englishFiles = ds.getIncludedFiles();
  62.150 +            int sepPos, extPos;
  62.151 +            String dirName, fname, filename, fext, newinc, ei_codename;
  62.152 +            String moduleJar = null;
  62.153 +            boolean skipLocaleDir = false;
  62.154 +            for (int k=0; k < englishFiles.length; k++) {
  62.155 +                // skip records for already localized/branded files
  62.156 +                if ((englishFiles[k].lastIndexOf("/locale/") >= 0) || // NOI18N
  62.157 +                     (englishFiles[k].lastIndexOf(File.separator+"locale"+File.separator) >= 0)) {  // NOI18N
  62.158 +                    skipLocaleDir=true;
  62.159 +                } else {
  62.160 +                    skipLocaleDir=false;
  62.161 +                }
  62.162 +                log("Examining file " + englishFiles[k], Project.MSG_DEBUG);
  62.163 +                sepPos = englishFiles[k].lastIndexOf(File.separator);
  62.164 +                if (sepPos < 0) {
  62.165 +                    dirName = ""; //NOI18N
  62.166 +                    filename = englishFiles[k];
  62.167 +                } else {
  62.168 +                    dirName = englishFiles[k].substring(0,sepPos);
  62.169 +                    filename = englishFiles[k].substring(sepPos+File.separator.length());
  62.170 +                }
  62.171 +                extPos = filename.lastIndexOf('.'); //NOI18N
  62.172 +                if (extPos < 0) {
  62.173 +                    fname = filename;
  62.174 +                    fext = ""; //NOI18N
  62.175 +                } else {
  62.176 +                    fname = filename.substring(0, extPos);
  62.177 +                    fext = filename.substring(extPos);
  62.178 +                }
  62.179 +                for (int j=0; j < lmnLocales.length; j++) {
  62.180 +                    // localized files
  62.181 +                    if (skipLocaleDir) {
  62.182 +                    	newinc = dirName + File.separator + fname + "_"+lmnLocales[j]+"*" + fext; //NOI18N
  62.183 +                    } else {
  62.184 +                        newinc = dirName + File.separator + "locale" + File.separator + fname + "_"+lmnLocales[j]+"*" + fext; //NOI18N
  62.185 +                    }
  62.186 +                    log("  adding include mask \""+newinc+"\"", Project.MSG_DEBUG);
  62.187 +                    fs.setIncludes( newinc );
  62.188 +                    // localized & branded files
  62.189 +                    if (!(lmnBrands == null)) {
  62.190 +                    	for (int i=0; i < lmnBrands.length; i++) {
  62.191 +                    	    if (skipLocaleDir) {
  62.192 +                    	        newinc = dirName + File.separator + fname + "_"+lmnBrands[i]+"_"+lmnLocales[j]+"*" + fext; //NOI18N
  62.193 +                            } else {
  62.194 +                    	        newinc = dirName + File.separator + "locale" + File.separator + fname + "_"+lmnBrands[i]+"_"+lmnLocales[j]+"*" + fext; //NOI18N
  62.195 +                    	    }
  62.196 +                            log("  adding include mask \""+newinc+"\"", Project.MSG_DEBUG);
  62.197 +                            fs.setIncludes( newinc );
  62.198 +                    	}
  62.199 +                    }
  62.200 +                }
  62.201 +            }
  62.202 +            // update directory scanner
  62.203 +            ds = fs.getDirectoryScanner(this.getProject());
  62.204 +            ds.scan();
  62.205 +        }
  62.206 +        
  62.207 +        String include[] = ds.getIncludedFiles();
  62.208 +        for( int j=0; j < include.length; j++ ){
  62.209 +            try {
  62.210 +                File inFile = new File( ds.getBasedir(), include[j] );
  62.211 +                FileInputStream inFileStream = new FileInputStream( inFile );
  62.212 +                byte array[] = new byte[ (int) inFile.length() ];
  62.213 +                CRC32 crc = new CRC32();
  62.214 +                inFileStream.read( array );
  62.215 +                inFileStream.close();
  62.216 +                crc.update( array );
  62.217 +                String abs = inFile.getAbsolutePath();
  62.218 +                String prefix = ds.getBasedir().getAbsolutePath() + File.separatorChar;
  62.219 +                if (! abs.startsWith(prefix)) throw new IllegalStateException(abs);
  62.220 +                version.addFileWithCrc(abs.substring(prefix.length()).replace(File.separatorChar, '/'), Long.toString( crc.getValue() ) );
  62.221 +            } catch (IOException ex) {
  62.222 +                log( ex.toString() );
  62.223 +            }
  62.224 +        }
  62.225 +        track.write();
  62.226 +        String moduleName = this.getProject().getProperty("module.name"); //NOI18N
  62.227 +        if (moduleName == null) {
  62.228 +            // external module?
  62.229 +            return;
  62.230 +        }
  62.231 +        String[] inc = new String[include.length+2];
  62.232 +        for (int i=0; i < include.length; i++)
  62.233 +            inc[i] = include[i];
  62.234 +        inc[include.length] = "config" + File.separator + "Modules" + File.separator + track.getTrackingFileName(); // NOI18N
  62.235 +        inc[include.length+1] = UpdateTracking.TRACKING_DIRECTORY + File.separator + track.getTrackingFileName();
  62.236 +        // Hack. We assume outputFile is a direct subdir of the dest dir.
  62.237 +        ModuleTracking moduleTracking = new ModuleTracking(outputFile.getParentFile().getAbsolutePath());
  62.238 +        String nbmfilename = this.getProject().getProperty("nbm"); // NOI18N
  62.239 +        String nbmhomepage = this.getProject().getProperty("nbm.homepage"); // NOI18N
  62.240 +        String nbmneedsrestart = this.getProject().getProperty("nbm.needs.restart"); // NOI18N
  62.241 +        String nbmreleasedate = this.getProject().getProperty("nbm.release.date"); // NOI18N
  62.242 +	String nbmmoduleauthor = this.getProject().getProperty("nbm.module.author"); // NOI18N
  62.243 +	String nbmisglobal = this.getProject().getProperty("nbm.is.global"); // NOI18N
  62.244 +        // ...and again here.
  62.245 +        moduleTracking.putModule(moduleName, codename, outputFile.getName(), nbmfilename, nbmhomepage, nbmneedsrestart, nbmreleasedate, nbmmoduleauthor, nbmisglobal, inc);
  62.246 +        moduleTracking.write();
  62.247 +    }
  62.248 +}
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/ModuleTracking.java	Sun Jan 28 18:54:08 2007 +0000
    63.3 @@ -0,0 +1,530 @@
    63.4 +/*
    63.5 + * The contents of this file are subject to the terms of the Common Development
    63.6 + * and Distribution License (the License). You may not use this file except in
    63.7 + * compliance with the License.
    63.8 + *
    63.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   63.10 + * or http://www.netbeans.org/cddl.txt.
   63.11 +
   63.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   63.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   63.14 + * If applicable, add the following below the CDDL Header, with the fields
   63.15 + * enclosed by brackets [] replaced by your own identifying information:
   63.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   63.17 + *
   63.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   63.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   63.20 + * Microsystems, Inc. All Rights Reserved.
   63.21 + */
   63.22 +
   63.23 +package org.netbeans.modules.visualweb.ravebuild;
   63.24 +
   63.25 +import java.io.File;
   63.26 +import java.io.FileInputStream;
   63.27 +import java.io.FileOutputStream;
   63.28 +import java.io.InputStream;
   63.29 +import java.io.OutputStream;
   63.30 +import java.util.ArrayList;
   63.31 +import java.util.HashMap;
   63.32 +import java.util.Hashtable;
   63.33 +import java.util.Iterator;
   63.34 +import java.util.List;
   63.35 +import java.util.Map;
   63.36 +import org.apache.tools.ant.BuildException;
   63.37 +import org.w3c.dom.Document;
   63.38 +import org.w3c.dom.Element;
   63.39 +import org.xml.sax.InputSource;
   63.40 +
   63.41 +/** This class represents module updates tracking
   63.42 + *
   63.43 + * @author  akemr
   63.44 + */
   63.45 +class ModuleTracking {
   63.46 +    private static final String ELEMENT_MODULE_TRACKING = "tracking"; // NOI18N
   63.47 +    private static final String ELEMENT_MODULE = "module"; // NOI18N
   63.48 +    private static final String ATTR_MODULE_NAME = "name"; // NOI18N
   63.49 +    private static final String ELEMENT_FILE = "file"; // NOI18N
   63.50 +    private static final String ATTR_FILE_NAME = "name"; // NOI18N
   63.51 +    private static final String ATTR_CODE_NAME = "codename"; // NOI18N
   63.52 +    private static final String ATTR_MODULE_PATH = "path"; // NOI18N
   63.53 +    private static final String ATTR_NBM_HOME_PAGE = "nbmhomepage"; // NOI18N
   63.54 +    private static final String ATTR_NBM_FILE_NAME = "nbmfilename"; // NOI18N
   63.55 +    private static final String ATTR_NBM_NEEDS_RESTART = "nbmneedsrestart"; // NOI18N
   63.56 +    private static final String ATTR_NBM_IS_GLOBAL = "nbmisglobal"; // NOI18N
   63.57 +    private static final String ATTR_NBM_RELEASE_DATE = "nbmreleasedate"; // NOI18N
   63.58 +    private static final String ATTR_NBM_MODULE_AUTHOR = "nbmmoduleauthor"; // NOI18N
   63.59 +    
   63.60 +    /** Platform dependent file name separator */
   63.61 +    private static final String FILE_SEPARATOR = System.getProperty ("file.separator");   // NOI18N             
   63.62 +
   63.63 +    /** The name of the file */
   63.64 +    public static final String TRACKING_FILE = "module_tracking.xml"; // NOI18N
   63.65 +    
   63.66 +    private boolean pError = false;
   63.67 +    
   63.68 +    private File trackingFile = null;
   63.69 +    
   63.70 +    private String nbPath = null;
   63.71 +    private Tracking tracking = null;
   63.72 +   
   63.73 +    // for generating xml in build process
   63.74 +    public ModuleTracking(String nbPath) {
   63.75 +        this.nbPath = nbPath;
   63.76 +        File directory = new File( nbPath );
   63.77 +        if (!directory.exists()) {
   63.78 +            directory.mkdirs();
   63.79 +        }
   63.80 +        trackingFile = new File(directory, TRACKING_FILE);
   63.81 +        read();
   63.82 +    }
   63.83 +    
   63.84 +/*    public Module addNewModule( String name ) {
   63.85 +         = new Tracking();
   63.86 +        module.setName( name );
   63.87 +        return module;
   63.88 +    }*/
   63.89 +    
   63.90 +    public void putModule(String name, String codename, String path, String nbmfilename, String nbmhomepage, String nbmneedsrestart, String nbmreleasedate, String nbmmoduleauthor, String nbmisglobal, String[] files) {
   63.91 +        if (name == null) {
   63.92 +            // #59426: external module, skip.
   63.93 +            return;
   63.94 +        }
   63.95 +        Module modByName = tracking.getModule(name);
   63.96 +	Module modByCodeName = tracking.getModuleByCodeName(codename);
   63.97 +	Module module = null;
   63.98 +	if (modByName != null) {
   63.99 +	    module = modByName;
  63.100 +	} else if (modByCodeName != null) {
  63.101 +	    module = modByCodeName;
  63.102 +	}
  63.103 +        if (module == null) {
  63.104 +            module = new Module();
  63.105 +            module.setName(name);
  63.106 +	    module.setCodeName(codename);
  63.107 +            module.setPath(path);
  63.108 +            tracking.addModule(module);
  63.109 +        }
  63.110 +        if (module.getNbmFileName().equals("")) // NOI18N
  63.111 +            module.setNbmFileName(nbmfilename);
  63.112 +        if (module.getNbmHomePage().equals("")) // NOI18N
  63.113 +            module.setNbmHomePage(nbmhomepage);
  63.114 +        if (module.getNbmModuleAuthor().equals("")) // NOI18N
  63.115 +            module.setNbmModuleAuthor(nbmmoduleauthor);
  63.116 +        if (module.getNbmNeedsRestart().equals("")) // NOI18N
  63.117 +            module.setNbmNeedsRestart(nbmneedsrestart);
  63.118 +        if (module.getNbmReleaseDate().equals("")) // NOI18N
  63.119 +            module.setNbmReleaseDate(nbmreleasedate);
  63.120 +        if (module.getNbmIsGlobal().equals ("")) { // NOI18N
  63.121 +            module.setNbmIsGlobal(nbmisglobal);
  63.122 +        }
  63.123 +/*	    
  63.124 +	System.out.println("    module        == "+name);
  63.125 +	System.out.println("    path          == "+path);
  63.126 +	System.out.println("    codename      == "+ codename);
  63.127 +	System.out.println("    filename      == "+module.getNbmFileName());
  63.128 +	System.out.println("    homepage      == "+module.getNbmHomePage());
  63.129 +	System.out.println("    author        == "+module.getNbmModuleAuthor());
  63.130 +	System.out.println("    needsrestart  == "+module.getNbmNeedsRestart());
  63.131 +	System.out.println("    global        == "+module.getNbmIsGlobal ());
  63.132 +	System.out.println("    releasedate   == "+module.getNbmReleaseDate());
  63.133 +*/
  63.134 +        module.putFiles( files );
  63.135 +    }
  63.136 +    
  63.137 +    public Map/*<String,Module>*/ getModules() {
  63.138 +        return tracking.getModules();
  63.139 +    }
  63.140 +    
  63.141 +    public Hashtable getModulesByCodeName() {
  63.142 +            return tracking.getModulesByCodeName();
  63.143 +    }
  63.144 +
  63.145 +    public Iterator getFilesForModule(String name) {
  63.146 +        Module module = tracking.getModule(name);
  63.147 +        if (module == null) return null;
  63.148 +        String[] files = new String[module.getFiles().size()];
  63.149 +        return module.getFiles().iterator();
  63.150 +    }
  63.151 +    
  63.152 +    public String getModulePath(String name) {
  63.153 +        Module module = tracking.getModule(name);
  63.154 +        if (module == null) return null;
  63.155 +        return module.getPath();
  63.156 +    }
  63.157 +    
  63.158 +    void write( ) {
  63.159 +        Document document = XMLUtil.createDocument(ELEMENT_MODULE_TRACKING);
  63.160 +        Element e_module_tracking = document.getDocumentElement();
  63.161 +        Iterator it2 = tracking.getModules().values().iterator();
  63.162 +        while ( it2.hasNext() ) {
  63.163 +            Module mod = (Module)it2.next();
  63.164 +            Element e_module = document.createElement(ELEMENT_MODULE);
  63.165 +            assert mod.getName() != null : mod.getCodeName();
  63.166 +            e_module.setAttribute(ATTR_MODULE_NAME, mod.getName());
  63.167 +            e_module.setAttribute(ATTR_CODE_NAME, mod.getCodeName());
  63.168 +            e_module.setAttribute(ATTR_MODULE_PATH, mod.getPath());
  63.169 +            e_module.setAttribute(ATTR_NBM_FILE_NAME, mod.getNbmFileName());
  63.170 +            e_module.setAttribute(ATTR_NBM_HOME_PAGE, mod.getNbmHomePage());
  63.171 +            e_module.setAttribute(ATTR_NBM_MODULE_AUTHOR, mod.getNbmModuleAuthor());
  63.172 +            e_module.setAttribute(ATTR_NBM_NEEDS_RESTART, mod.getNbmNeedsRestart());
  63.173 +            e_module.setAttribute(ATTR_NBM_IS_GLOBAL, mod.getNbmIsGlobal ());
  63.174 +            e_module.setAttribute(ATTR_NBM_RELEASE_DATE, mod.getNbmReleaseDate());
  63.175 +            e_module_tracking.appendChild( e_module );
  63.176 +            Iterator it3 = mod.getFiles().iterator();
  63.177 +            while ( it3.hasNext() ) {
  63.178 +                String file = (String)it3.next();
  63.179 +                Element e_file = document.createElement(ELEMENT_FILE);
  63.180 +                e_file.setAttribute(ATTR_FILE_NAME, file.replace(File.separatorChar,'/'));
  63.181 +                e_module.appendChild( e_file );
  63.182 +            }
  63.183 +        }
  63.184 +        
  63.185 +        //document.getDocumentElement().normalize();
  63.186 +        try {
  63.187 +	    OutputStream os = new FileOutputStream(trackingFile);
  63.188 +            XMLUtil.write(document, os);
  63.189 +            os.close();
  63.190 +        } catch (Exception e) {
  63.191 +            e.printStackTrace();
  63.192 +            trackingFile.delete();
  63.193 +            throw new BuildException("Could not write update tracking file " + trackingFile.getAbsolutePath(), e);
  63.194 +        }        
  63.195 +    }
  63.196 +
  63.197 +    /** Scan through org.w3c.dom.Document document. */
  63.198 +    private void read() {
  63.199 +        /** org.w3c.dom.Document document */
  63.200 +        org.w3c.dom.Document document;
  63.201 +        if (trackingFile.exists()) {
  63.202 +            InputStream is;
  63.203 +            try {
  63.204 +                is = new FileInputStream( trackingFile );
  63.205 +                
  63.206 +            InputSource xmlInputSource = new InputSource( is );
  63.207 +            document = XMLUtil.parse( xmlInputSource, false, false, new ErrorCatcher(), null );
  63.208 +            if (is != null)
  63.209 +                is.close();
  63.210 +            }
  63.211 +            catch ( org.xml.sax.SAXException e ) {
  63.212 +                System.out.println("Module tracking file " + trackingFile.getAbsolutePath() + " is not well formatted XML document" ); 
  63.213 +                e.printStackTrace();
  63.214 +                return;
  63.215 +            }
  63.216 +            catch ( java.io.IOException e ) {
  63.217 +                System.out.println("I/O error when accessing module tracking file " + trackingFile.getAbsolutePath() ); 
  63.218 +                e.printStackTrace();
  63.219 +                return;
  63.220 +            }
  63.221 +            
  63.222 +            org.w3c.dom.Element element = document.getDocumentElement();
  63.223 +            if ((element != null) && element.getTagName().equals(ELEMENT_MODULE_TRACKING)) {
  63.224 +                scanElement_module_tracking(element);
  63.225 +            }
  63.226 +        }
  63.227 +        if (tracking == null)
  63.228 +            tracking = new Tracking();
  63.229 +    }
  63.230 +    
  63.231 +    /** Scan through org.w3c.dom.Element named module. */
  63.232 +    void scanElement_module_tracking(org.w3c.dom.Element element) { // <tracking>
  63.233 +        tracking = new Tracking();        
  63.234 +        org.w3c.dom.NodeList nodes = element.getChildNodes();
  63.235 +        for (int i = 0; i < nodes.getLength(); i++) {
  63.236 +            org.w3c.dom.Node node = nodes.item(i);
  63.237 +            if ( node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE ) {
  63.238 +                org.w3c.dom.Element nodeElement = (org.w3c.dom.Element)node;
  63.239 +                if (nodeElement.getTagName().equals(ELEMENT_MODULE)) {
  63.240 +                    scanElement_module(nodeElement, tracking);
  63.241 +                }
  63.242 +            }
  63.243 +        }
  63.244 +    }
  63.245 +    
  63.246 +    /** Scan through org.w3c.dom.Element named module. */
  63.247 +    void scanElement_module(org.w3c.dom.Element element, Tracking tracking) { // <module>
  63.248 +        Module module = new Module();        
  63.249 +        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
  63.250 +        for (int i = 0; i < attrs.getLength(); i++) {
  63.251 +            org.w3c.dom.Attr attr = (org.w3c.dom.Attr)attrs.item(i);
  63.252 +            if (attr.getName().equals(ATTR_MODULE_NAME)) { // <module name="???">
  63.253 +                module.setName( attr.getValue() );
  63.254 +            }
  63.255 +            if (attr.getName().equals(ATTR_CODE_NAME)) { // <module codename="???">
  63.256 +                module.setCodeName( attr.getValue() );
  63.257 +            }
  63.258 +            if (attr.getName().equals(ATTR_MODULE_PATH)) { // <module path="???">
  63.259 +                module.setPath( attr.getValue() );
  63.260 +            }
  63.261 +            if (attr.getName().equals(ATTR_NBM_HOME_PAGE)) { // <module nbmhomepage="???">
  63.262 +                module.setNbmHomePage( attr.getValue() );
  63.263 +            }
  63.264 +            if (attr.getName().equals(ATTR_NBM_FILE_NAME)) { // <module nbmfilename="???">
  63.265 +                module.setNbmFileName( attr.getValue() );
  63.266 +            }
  63.267 +            if (attr.getName().equals(ATTR_NBM_NEEDS_RESTART)) { // <module nbmneedsrestart="???">
  63.268 +                module.setNbmNeedsRestart( attr.getValue() );
  63.269 +            }
  63.270 +            if (attr.getName().equals(ATTR_NBM_IS_GLOBAL)) { // <module nbmisglobal="???">
  63.271 +                module.setNbmIsGlobal( attr.getValue() );
  63.272 +            }
  63.273 +            if (attr.getName().equals(ATTR_NBM_RELEASE_DATE)) { // <module nbmreleasedate="???">
  63.274 +                module.setNbmReleaseDate( attr.getValue() );
  63.275 +            }
  63.276 +            if (attr.getName().equals(ATTR_NBM_MODULE_AUTHOR)) { // <module nbmmoduleauthor="???">
  63.277 +                module.setNbmModuleAuthor( attr.getValue() );
  63.278 +            }
  63.279 +       }
  63.280 +        org.w3c.dom.NodeList nodes = element.getChildNodes();
  63.281 +        for (int i = 0; i < nodes.getLength(); i++) {
  63.282 +            org.w3c.dom.Node node = nodes.item(i);
  63.283 +            if ( node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE ) {
  63.284 +                org.w3c.dom.Element nodeElement = (org.w3c.dom.Element)node;
  63.285 +                if (nodeElement.getTagName().equals(ELEMENT_FILE)) {
  63.286 +                    scanElement_file(nodeElement, module);
  63.287 +                }
  63.288 +            }
  63.289 +        }
  63.290 +        tracking.addModule(module);
  63.291 +    }
  63.292 +    
  63.293 +    /** Scan through org.w3c.dom.Element named file. */
  63.294 +    void scanElement_file(org.w3c.dom.Element element, Module module) { // <file>
  63.295 +        String file = null;
  63.296 +        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
  63.297 +        for (int i = 0; i < attrs.getLength(); i++) {
  63.298 +            org.w3c.dom.Attr attr = (org.w3c.dom.Attr)attrs.item(i);
  63.299 +            if (attr.getName().equals(ATTR_FILE_NAME)) { // <file name="???">
  63.300 +                file = attr.getValue();
  63.301 +            }
  63.302 +        }
  63.303 +        module.addFile (file.replace(File.separatorChar,'/'));
  63.304 +    }
  63.305 +
  63.306 +    public class Tracking extends Object {        
  63.307 +        private Map/*<String,Module>*/ modules = new HashMap();
  63.308 +	private Hashtable modulesByCodeName = new Hashtable();
  63.309 +
  63.310 +        Map/*<String,Module>*/ getModules() {
  63.311 +            return modules;
  63.312 +        }
  63.313 +        
  63.314 +         /** Getter for property files.
  63.315 +         * @return Value of property files.
  63.316 +         */
  63.317 +        Hashtable getModulesByCodeName() {
  63.318 +            return modulesByCodeName;
  63.319 +        }
  63.320 +        
  63.321 +        /** Setter for property files.
  63.322 +         * @param files New value of property files.
  63.323 +         */
  63.324 +        void setModulesByCodeName(Hashtable modules) {
  63.325 +            this.modulesByCodeName = modules;
  63.326 +        }
  63.327 +        
  63.328 +        public void addModule( Module module ) {
  63.329 +            modules.put( module.getName(), module );
  63.330 +	    modulesByCodeName.put( module.getCodeName(), module );
  63.331 +        }
  63.332 +        
  63.333 +        public Module getModule( String name ) {
  63.334 +            return (Module) modules.get(name);
  63.335 +        }
  63.336 +        public Module getModuleByCodeName( String codename ) {
  63.337 +            return (Module) modulesByCodeName.get(codename);
  63.338 +        }
  63.339 +    }
  63.340 +
  63.341 +    public class Module extends Object {        
  63.342 +        /** Holds value of property name. */
  63.343 +        private String name;
  63.344 +        
  63.345 +        /** Holds value of property codename. */
  63.346 +        private String codename;
  63.347 +        
  63.348 +        /** Holds value of property path. */
  63.349 +        private String path;
  63.350 +        
  63.351 +        /** Holds value of property nbmhomepage. */
  63.352 +        private String nbmhomepage = ""; // NOI18N
  63.353 +        
  63.354 +        /** Holds value of property nbmfilename. */
  63.355 +        private String nbmfilename = ""; // NOI18N
  63.356 +        
  63.357 +        /** Holds value of property nbmneedsrestart. */
  63.358 +        private String nbmneedsrestart = ""; // NOI18N
  63.359 +        
  63.360 +        /** Holds value of property nbmisglobal. */
  63.361 +        private String nbmisglobal = ""; // NOI18N
  63.362 +        
  63.363 +        /** Holds value of property nbmreleasedate. */
  63.364 +        private String nbmreleasedate = ""; // NOI18N
  63.365 +        
  63.366 +        /** Holds value of property nbmmoduleauthor. */
  63.367 +        private String nbmmoduleauthor = ""; // NOI18N
  63.368 +
  63.369 +        /** Holds value of property files. */
  63.370 +        private List files = new ArrayList();
  63.371 +        
  63.372 +        /** Getter for property name */
  63.373 +        String getName() {
  63.374 +            return name;
  63.375 +        }
  63.376 +        
  63.377 +        /** Setter for property name */
  63.378 +        void setName(String name) {
  63.379 +            this.name = name;
  63.380 +        }
  63.381 +        
  63.382 +        /** Getter for property codename */
  63.383 +        String getCodeName() {
  63.384 +            return codename;
  63.385 +        }
  63.386 +        
  63.387 +        /** Setter for property codename */
  63.388 +        void setCodeName(String codename) {
  63.389 +            this.codename = codename;
  63.390 +        }
  63.391 +        
  63.392 +        /** Getter for property path */
  63.393 +        String getPath() {
  63.394 +            return path;
  63.395 +        }
  63.396 +        
  63.397 +        /** Setter for property path */
  63.398 +        void setPath(String path) {
  63.399 +            this.path = path;
  63.400 +        }
  63.401 +        
  63.402 +        /** Getter for property nbmhomepage */
  63.403 +        String getNbmHomePage () {
  63.404 +            if (this.nbmhomepage == null) {
  63.405 +                return ""; // NOI18N
  63.406 +            } else {
  63.407 +                return this.nbmhomepage;
  63.408 +            }
  63.409 +        }
  63.410 +        
  63.411 +        /** Setter for property nbmhomepage */
  63.412 +        void setNbmHomePage (String nbmh) {
  63.413 +            if (!(nbmh == null)) 
  63.414 +                this.nbmhomepage = nbmh;
  63.415 +        }
  63.416 +        
  63.417 +        /** Getter for property nbmfilename */
  63.418 +        String getNbmFileName () {
  63.419 +            if (this.nbmfilename == null) {
  63.420 +                return ""; // NOI18N
  63.421 +            } else {
  63.422 +                return this.nbmfilename;
  63.423 +            }
  63.424 +        }
  63.425 +        
  63.426 +        /** Setter for property nbmfilename */
  63.427 +        void setNbmFileName (String nbmfn) {
  63.428 +            if (!(nbmfn == null))
  63.429 +                this.nbmfilename = nbmfn;
  63.430 +        }
  63.431 +        
  63.432 +        /** Getter for property nbmneedsrestart */
  63.433 +        String getNbmNeedsRestart () {
  63.434 +            if (this.nbmneedsrestart == null) {
  63.435 +                return ""; // NOI18N
  63.436 +            } else {
  63.437 +                return this.nbmneedsrestart;
  63.438 +            }
  63.439 +        }
  63.440 +        
  63.441 +        /** Setter for property nbmneedsrestart */
  63.442 +        void setNbmNeedsRestart (String nbmnr) {
  63.443 +            if (!(nbmnr == null))
  63.444 +                this.nbmneedsrestart = nbmnr;
  63.445 +        }
  63.446 +        
  63.447 +        /** Setter for property nbmisglobal */
  63.448 +        void setNbmIsGlobal (String isGlobal) {
  63.449 +            if (!(isGlobal == null))
  63.450 +                this.nbmisglobal = isGlobal;
  63.451 +        }
  63.452 +        
  63.453 +        /** Getter for property nbmisglobal */
  63.454 +        String getNbmIsGlobal () {
  63.455 +            return this.nbmisglobal;
  63.456 +        }
  63.457 +        
  63.458 +        /** Getter for property nbmreleasedate */
  63.459 +        String getNbmReleaseDate () {
  63.460 +            if (this.nbmreleasedate == null) {
  63.461 +                return ""; // NOI18N
  63.462 +            } else {
  63.463 +                return this.nbmreleasedate;
  63.464 +            }
  63.465 +        }
  63.466 +        
  63.467 +        /** Setter for property nbmreleasedate */
  63.468 +        void setNbmReleaseDate (String nbmrd) {
  63.469 +            if (!(nbmrd == null ))
  63.470 +                this.nbmreleasedate = nbmrd;
  63.471 +        }
  63.472 +        
  63.473 +        /** Getter for property nbmmoduleauthor */
  63.474 +        String getNbmModuleAuthor () {
  63.475 +            if (this.nbmmoduleauthor == null) {
  63.476 +                return ""; // NOI18N
  63.477 +            } else {
  63.478 +                return this.nbmmoduleauthor;
  63.479 +            }
  63.480 +        }
  63.481 +        
  63.482 +        /** Setter for property nbmmoduleauthor */
  63.483 +        void setNbmModuleAuthor (String nbmma) {
  63.484 +            if (!(nbmma == null))
  63.485 +                this.nbmmoduleauthor = nbmma;
  63.486 +        }
  63.487 +         /** Getter for property files.
  63.488 +         * @return Value of property files.
  63.489 +         */
  63.490 +        List getFiles() {
  63.491 +            return files;
  63.492 +        }
  63.493 +        
  63.494 +        /** Setter for property files.
  63.495 +         * @param files New value of property files.
  63.496 +         */
  63.497 +        void setFiles(List files) {
  63.498 +            this.files = files;
  63.499 +        }
  63.500 +        
  63.501 +        public void addFile( String filename) {
  63.502 +            files.add( filename.replace(File.separatorChar, '/') );
  63.503 +        }
  63.504 +        
  63.505 +        public void putFiles( String[] list ) {
  63.506 +            for (int i=0; i < list.length; i++) {
  63.507 +                if (!files.contains(list[i].replace(File.separatorChar,'/'))) {
  63.508 +                    files.add(list[i].replace(File.separatorChar,'/'));
  63.509 +                }
  63.510 +            }
  63.511 +        }
  63.512 +    }
  63.513 +    
  63.514 +    class ErrorCatcher implements org.xml.sax.ErrorHandler {
  63.515 +        private void message (String level, org.xml.sax.SAXParseException e) {
  63.516 +            pError = true;
  63.517 +        }
  63.518 +
  63.519 +        public void error (org.xml.sax.SAXParseException e) {
  63.520 +            // normally a validity error
  63.521 +            pError = true;
  63.522 +        }
  63.523 +
  63.524 +        public void warning (org.xml.sax.SAXParseException e) {
  63.525 +            //parseFailed = true;
  63.526 +        }
  63.527 +
  63.528 +        public void fatalError (org.xml.sax.SAXParseException e) {
  63.529 +            pError = true;
  63.530 +        }
  63.531 +    }
  63.532 +    
  63.533 +}
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/RaveLocalizedJar.java	Sun Jan 28 18:54:08 2007 +0000
    64.3 @@ -0,0 +1,769 @@
    64.4 +/*
    64.5 + * The contents of this file are subject to the terms of the Common Development
    64.6 + * and Distribution License (the License). You may not use this file except in
    64.7 + * compliance with the License.
    64.8 + *
    64.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   64.10 + * or http://www.netbeans.org/cddl.txt.
   64.11 +
   64.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   64.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   64.14 + * If applicable, add the following below the CDDL Header, with the fields
   64.15 + * enclosed by brackets [] replaced by your own identifying information:
   64.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   64.17 + *
   64.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   64.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   64.20 + * Microsystems, Inc. All Rights Reserved.
   64.21 + *
   64.22 + *
   64.23 + * Cloned from nbbuild/antsrc/org/netbeans/nbbuild
   64.24 + * Modified to accept the 'overrideManifest' parameter
   64.25 + *
   64.26 + */
   64.27 +
   64.28 +package org.netbeans.modules.visualweb.ravebuild;
   64.29 +
   64.30 +import java.io.*;
   64.31 +import java.util.*;
   64.32 +import java.util.Map; // override org.apache.tools.ant.Map
   64.33 +import java.util.zip.*;
   64.34 +import java.util.jar.*;
   64.35 +
   64.36 +import org.apache.tools.ant.*;
   64.37 +import org.apache.tools.ant.taskdefs.MatchingTask;
   64.38 +import org.apache.tools.ant.types.*;
   64.39 +
   64.40 +/** Create a JAR file with locale variants.
   64.41 + * Whenever files are found which should be localized, or are the result
   64.42 + * of localization, places them in separate JAR files named according to the locale,
   64.43 + * in a <samp>locale/</samp> subdirectory of the directory containing the master JAR.
   64.44 + * Each sub-JAR gets a manifest which just has some informational tags
   64.45 + * indicating its purpose (locale and branding):
   64.46 + * <code>X-Informational-Archive-Locale</code> and/or <code>X-Informational-Archive-Branding</code>.
   64.47 + * The values may be e.g. <code>ja</code> or <code>f4j_ce</code>; or <code>-</code>
   64.48 + * if there is no suffix for this JAR.
   64.49 + * You can control the available locales; brandings; and set of files which should
   64.50 + * always be considered part of the localizable base kit.
   64.51 + * You can use the "branding" and "locale" subelements to control the branded
   64.52 + * and localized .jar files that will be produced.  Also, you can set the global
   64.53 + * properties "locjar.brands" and "locjar.locales" to comma-separated
   64.54 + * lists of branding or locale identifiers so that NetBeans-based projects can
   64.55 + * brand or localize NetBeans without having to maintain modified versions of all
   64.56 + * the individual Ant scripts
   64.57 + * Originally this Ant task didn't recognize files below a directory with the
   64.58 + * same name as a locale as being localized.  Now it does so by default.
   64.59 + * <p>Based on <code>&lt;zip&gt;</code> and <code>&lt;jar&gt;</code> tasks in Ant,
   64.60 + * but not feasible to simply subclass or compose them.
   64.61 + * @see <a href="http://www.netbeans.org/devhome/docs/i18n/index.html">NetBeans I18N documentation</a>
   64.62 + * @author Jesse Glick
   64.63 + */
   64.64 +public class RaveLocalizedJar extends MatchingTask {
   64.65 +
   64.66 +    private List localeKits = new LinkedList (); // List<FileSet>
   64.67 +    private List locales = new LinkedList (); // List<LocaleOrB>
   64.68 +    private List brandings = new LinkedList (); // List<LocaleOrB>
   64.69 +    private File jarFile;
   64.70 +    private File baseDir;
   64.71 +    private boolean doCompress = false;
   64.72 +    private static long emptyCrc = new CRC32 ().getValue ();
   64.73 +    private List filesets = new LinkedList (); // List<FileSet>
   64.74 +    private File manifest;
   64.75 +    private boolean checkPathLocale = true ;
   64.76 +    private boolean warnMissingDir = false ;
   64.77 +    private boolean warnMissingDirSet = false ;
   64.78 +    private boolean preserveModuleJar = true;
   64.79 +    private boolean overrideManifest = false;
   64.80 +
   64.81 +    /** Locale or branding specifier.
   64.82 +     * Represents a complete locale or branding suffix,
   64.83 +     * e.g. <code>ja</code> or <code>ja_JP</code>
   64.84 +     * (but not simply <code>JP</code>).
   64.85 +     * For branding, e.g. <code>f4j</code> or <code>f4j_ce</code>.
   64.86 +     * You must include all relevant suffixes if you expect them to match
   64.87 +     * (but the task will handle a branding suffix combined with a locale
   64.88 +     * suffix, in that order).
   64.89 +     */
   64.90 +    public class LocaleOrB {
   64.91 +        String n;
   64.92 +        /** The suffix. */
   64.93 +        public void setName (String n) {
   64.94 +            this.n = n;
   64.95 +        }
   64.96 +    }
   64.97 +
   64.98 +    /** Distinguish particular files that will be considered localizable.
   64.99 +     * This nested <samp>&lt;localekit&gt;</samp> has the same syntax as a FileSet.
  64.100 +     * So typically you will build a JAR from a fileset containing all build
  64.101 +     * products within a given directory; the "locale kit" should be a fileset
  64.102 +     * matching all properties files, for example, and maybe icons which you would
  64.103 +     * expect someone to try to localize--in general, anything which will be referenced
  64.104 +     * in code using a localized lookup (<code>NbBundle</code>).
  64.105 +     * While files with recognized localized (or branded) suffixes automatically go into
  64.106 +     * marked JARs in the <samp>locale/</samp> subdirectory, files considered part of the
  64.107 +     * locale kit also always go into this subdirectory; if they have no suffix, they will
  64.108 +     * be placed in a suffixless locale JAR.
  64.109 +     * So localizers can simply look at this JAR file and brand/localize it as they see fit.
  64.110 +     */
  64.111 +    public void addLocalekit (FileSet fs) {
  64.112 +        localeKits.add (fs);
  64.113 +    }
  64.114 +
  64.115 +    /** Add a recognized locale suffix. */
  64.116 +    public LocaleOrB createLocale () {
  64.117 +        LocaleOrB l = new LocaleOrB ();
  64.118 +        locales.add (l);
  64.119 +        return l;
  64.120 +    }
  64.121 +
  64.122 +    /** Add a recognized branding suffix. */
  64.123 +    public LocaleOrB createBranding () {
  64.124 +        LocaleOrB l = new LocaleOrB ();
  64.125 +        brandings.add (l);
  64.126 +        return l;
  64.127 +    }
  64.128 +
  64.129 +    /** JAR file to create.
  64.130 +     * In fact this is the location of the "base" JAR;
  64.131 +     * locale-specific JARs may be created in the <samp>locale/</samp> subdirectory
  64.132 +     * of the directory containing this JAR, and will be named according to the name
  64.133 +     * of this JAR.
  64.134 +     * Compare Ant's <samp>&lt;jar&gt;</samp> task.
  64.135 +     */
  64.136 +    public void setJarfile (File jarFile) {
  64.137 +        if (! jarFile.getName ().endsWith (".jar")) {
  64.138 +            throw new BuildException ("jarfile attribute must be a file with *.jar extension");
  64.139 +        }
  64.140 +        if (jarFile.getParentFile () == null) {
  64.141 +            throw new BuildException ("jarfile attribute must have a containing directory");
  64.142 +        }
  64.143 +        this.jarFile = jarFile;
  64.144 +    }
  64.145 +
  64.146 +    /** Base directory to JAR.
  64.147 +     * Compare Ant's <samp>&lt;jar&gt;</samp> task.
  64.148 +     */
  64.149 +    public void setBasedir (File baseDir) {
  64.150 +        this.baseDir = baseDir;
  64.151 +    }
  64.152 +
  64.153 +    /** Turn on or off compression (default off).
  64.154 +     * Compare Ant's <samp>&lt;jar&gt;</samp> task.
  64.155 +     */
  64.156 +    public void setCompress(boolean compress) {
  64.157 +        doCompress = compress;
  64.158 +    }
  64.159 +
  64.160 +    /** Turn on/off preserving original module jars with 'code'
  64.161 +     *  Set it to 'true' to not allow overwriting of module jars
  64.162 +     *  with localization/branding stuff
  64.163 +     */
  64.164 +    public void setPreserveModuleJar(boolean pmj) {
  64.165 +        preserveModuleJar = pmj;
  64.166 +    }
  64.167 +
  64.168 +    /** A set of files to JAR up.
  64.169 +     * Compare Ant's <samp>&lt;jar&gt;</samp> task.
  64.170 +     */
  64.171 +    public void addFileset (FileSet set) {
  64.172 +        filesets.add (set);
  64.173 +    }
  64.174 +
  64.175 +    /** Manifest file for the JAR.
  64.176 +     * Compare Ant's <samp>&lt;jar&gt;</samp> task.
  64.177 +     */
  64.178 +    public void setManifest (File manifest) {
  64.179 +	this.manifest = manifest;
  64.180 +    }
  64.181 +
  64.182 +    /** Override Manifest file for the JAR.
  64.183 +     * Default behavior is to ignore manifest argument if jar has locale or branding markings
  64.184 +     */
  64.185 +    public void setOverrideManifest (boolean overrideManifest) {
  64.186 +	this.overrideManifest = overrideManifest;
  64.187 +    }
  64.188 +
  64.189 +    /** By default this is true.  If set to false, then this task will
  64.190 +     * not recognize files below a directory with the same name as a
  64.191 +     * locale as being localized (unless the simple filename also
  64.192 +     * includes the locale).
  64.193 +     */
  64.194 +    public void setCheckPathLocale( boolean doit) {
  64.195 +      checkPathLocale = doit ;
  64.196 +    }
  64.197 +
  64.198 +    /** This is false by default, in which case missing dirs in the
  64.199 +     * filesets cause a BuildException to be thrown.  If true, then
  64.200 +     * a warning is printed but the build will continue.
  64.201 +     * This task will also look for a global property
  64.202 +     * "locjar.warnMissingDir" if this attribute isn't set.
  64.203 +     */
  64.204 +    public void setWarnMissingDir( boolean b) {
  64.205 +      warnMissingDir = b ;
  64.206 +      warnMissingDirSet = true ;
  64.207 +    }
  64.208 +
  64.209 +    public void execute () throws BuildException {
  64.210 +
  64.211 +        // Sanity checks:
  64.212 +        if (baseDir == null && filesets.size () == 0) {
  64.213 +            throw new BuildException ("basedir attribute must be set, or at least one fileset must be given!");
  64.214 +        }
  64.215 +        if (jarFile == null) {
  64.216 +            throw new BuildException ("You must specify the JAR file to create!");
  64.217 +        }
  64.218 +        if (manifest != null && ! manifest.isFile ()) {
  64.219 +            throw new BuildException ("The specified manifest does not actually exist.");
  64.220 +        }
  64.221 +
  64.222 +	// If needed, warn that directories are missing. //
  64.223 +	if( shouldWarnMissingDir() && warnIfMissingDir()) {
  64.224 +
  64.225 +	  // Stop if dirs were missing. //
  64.226 +	  return ;
  64.227 +	}
  64.228 +
  64.229 +	// Look for global locales or brandings to use. //
  64.230 +	addGlobalLocaleAndBranding() ;
  64.231 +
  64.232 +        //System.err.println ("Stage #1");
  64.233 +        // First find out which files need to be archived.
  64.234 +        Map allFiles = new HashMap (); // all files to do something with; Map<String,File> from JAR path to actual file
  64.235 +        // Populate it.
  64.236 +        {
  64.237 +            List scanners = new ArrayList (filesets.size () + 1); // List<FileScanner>
  64.238 +            if (baseDir != null) {
  64.239 +                scanners.add (getDirectoryScanner (baseDir));
  64.240 +            }
  64.241 +            Iterator it = filesets.iterator ();
  64.242 +            while (it.hasNext ()) {
  64.243 +                scanners.add(((FileSet) it.next()).getDirectoryScanner(getProject()));
  64.244 +            }
  64.245 +            it = scanners.iterator ();
  64.246 +            while (it.hasNext ()) {
  64.247 +                FileScanner scanner = (FileScanner) it.next ();
  64.248 +                File thisBaseDir = scanner.getBasedir ();
  64.249 +                String[] files = scanner.getIncludedFiles ();
  64.250 +                for (int i = 0; i < files.length; i++) {
  64.251 +                    String name = files[i].replace (File.separatorChar, '/');
  64.252 +                    if (name.equalsIgnoreCase ("META-INF/MANIFEST.MF")) {
  64.253 +                        log ("Warning: ignoring META-INF/MANIFEST.MF found among scanned files", Project.MSG_WARN);
  64.254 +                        continue;
  64.255 +                    }
  64.256 +                    allFiles.put (name, new File (thisBaseDir, files[i]));
  64.257 +                }
  64.258 +            }
  64.259 +        }
  64.260 +
  64.261 +        //System.err.println ("Stage #2");
  64.262 +        // Now find all files which should always be put into a locale
  64.263 +        // kit (e.g. dir/locale/name.jar, no special locale or
  64.264 +        // branding, but distinguished as localizable/brandable).
  64.265 +        Set localeKitFiles = new HashSet (); // Set<File>; all locale-kit files
  64.266 +        // Populate this one.
  64.267 +        {
  64.268 +            Iterator it = localeKits.iterator ();
  64.269 +            while (it.hasNext ()) {
  64.270 +                FileScanner scanner = ((FileSet) it.next()).getDirectoryScanner(getProject());
  64.271 +                File thisBaseDir = scanner.getBasedir ();
  64.272 +                String[] files = scanner.getIncludedFiles ();
  64.273 +                for (int i = 0; i < files.length; i++) {
  64.274 +                    localeKitFiles.add (new File (thisBaseDir, files[i]));
  64.275 +                }
  64.276 +            }
  64.277 +        }
  64.278 +
  64.279 +        //System.err.println ("Stage #3");
  64.280 +        // Compute list of supported locales and brandings.
  64.281 +        List locales2 = new LinkedList (); // List<String>; all locales
  64.282 +        List brandings2 = new LinkedList (); // List<String>; all brandings
  64.283 +        // Initialize above two.
  64.284 +        {
  64.285 +            Iterator it = locales.iterator ();
  64.286 +            while (it.hasNext ()) {
  64.287 +                locales2.add (((LocaleOrB) it.next ()).n);
  64.288 +            }
  64.289 +            it = brandings.iterator ();
  64.290 +            while (it.hasNext ()) {
  64.291 +                brandings2.add (((LocaleOrB) it.next ()).n);
  64.292 +            }
  64.293 +            class InverseLengthComparator implements Comparator {
  64.294 +                public int compare (Object o1, Object o2) {
  64.295 +                    String s1 = (String) o1;
  64.296 +                    String s2 = (String) o2;
  64.297 +                    return s2.length () - s1.length ();
  64.298 +                }
  64.299 +            }
  64.300 +            Comparator c = new InverseLengthComparator ();
  64.301 +            Collections.sort (locales2, c);
  64.302 +            Collections.sort (brandings2, c);
  64.303 +        }
  64.304 +
  64.305 +        //System.err.println ("Stage #4");
  64.306 +        // Analyze where everything goes.
  64.307 +        Set jars = new HashSet (); // Set<File>; JAR files to build
  64.308 +        Map localeMarks = new HashMap (); // Map<File,String>; JAR files to locale (or null for basic JAR, "-" for blank)
  64.309 +        Map brandingMarks = new HashMap (); // Map<File,String>; JAR files to branding (or null for basic JAR, "-" for blank)
  64.310 +        Map router = new HashMap (); // Map<File,Map<String,File>>; JAR files to map of JAR path to actual file (file may be null for dirs)
  64.311 +        {
  64.312 +	    String localeDir ;
  64.313 +            Iterator it = allFiles.entrySet ().iterator ();
  64.314 +            while (it.hasNext ()) {
  64.315 +                Map.Entry entry = (Map.Entry) it.next ();
  64.316 +                String path = (String) entry.getKey ();
  64.317 +
  64.318 +log( "==> Examining file: " + path, Project.MSG_DEBUG) ;
  64.319 +
  64.320 +                File file = (File) entry.getValue ();
  64.321 +                // First see if it matches a known branding, locale, or pair of one of each.
  64.322 +                String testpath = path;
  64.323 +                int idx = testpath.lastIndexOf ('/');
  64.324 +                if (idx != -1) testpath = testpath.substring (idx + 1);
  64.325 +                idx = testpath.lastIndexOf ('.');
  64.326 +                if (idx != -1) testpath = testpath.substring (0, idx);
  64.327 +                String thisLocale = null;
  64.328 +                Iterator it2 = locales2.iterator ();
  64.329 +                while (it2.hasNext ()) {
  64.330 +                    String tryLocale = (String) it2.next ();
  64.331 +                    if (testpath.endsWith ("_" + tryLocale)) {
  64.332 +                        thisLocale = tryLocale;
  64.333 +                        testpath = testpath.substring (0, testpath.length () - 1 - tryLocale.length ());
  64.334 +                        break;
  64.335 +                    }
  64.336 +                }
  64.337 +                String thisBranding = null;
  64.338 +                it2 = brandings2.iterator ();
  64.339 +                while (it2.hasNext ()) {
  64.340 +                    String tryBranding = (String) it2.next ();
  64.341 +                    if (testpath.endsWith ("_" + tryBranding)) {
  64.342 +                        thisBranding = tryBranding;
  64.343 +                        break;
  64.344 +                    }
  64.345 +                }
  64.346 +                File thisjar = null; // JAR to send this file to
  64.347 +
  64.348 +		// Check if this file has a parent directory with the //
  64.349 +		// same name as one of the locales.		      //
  64.350 +		localeDir = checkInLocaleDir( file, locales2) ;
  64.351 +		if( localeDir != null) {
  64.352 +		  thisLocale = localeDir ;
  64.353 +		}
  64.354 +
  64.355 +
  64.356 +                if( thisLocale != null) {
  64.357 +                    log( "    Locale: " + thisLocale, Project.MSG_DEBUG) ;
  64.358 +                } else {
  64.359 +                    log( "    Locale not set", Project.MSG_DEBUG) ;
  64.360 +                }
  64.361 +                if( thisBranding != null) {
  64.362 +                    log( "    Branding: " + thisBranding, Project.MSG_DEBUG) ;
  64.363 +                } else {
  64.364 +                    log( "    Branding not set", Project.MSG_DEBUG) ;
  64.365 +                }
  64.366 +                if( localeKitFiles.contains( file)) {
  64.367 +                    log( "    Localizable file.", Project.MSG_DEBUG) ;
  64.368 +                }
  64.369 +
  64.370 +
  64.371 +                if (thisLocale != null || thisBranding != null || localeKitFiles.contains (file)) {
  64.372 +                    String name = jarFile.getName ();
  64.373 +                    // We know jarFile is a *.jar so this is safe:
  64.374 +                    name = name.substring (0, name.length () - 4);
  64.375 +                    if (thisBranding != null) {
  64.376 +                        name += '_' + thisBranding;
  64.377 +                    }
  64.378 +                    if (thisLocale != null) {
  64.379 +                        name += '_' + thisLocale;
  64.380 +                    }
  64.381 +                    name += ".jar";
  64.382 +                    if ((preserveModuleJar) && (thisBranding == null) && (thisLocale == null)) {
  64.383 +                        thisjar = null;
  64.384 +                        log("    Preserving module file (1): " + jarFile.getName(), Project.MSG_DEBUG);
  64.385 +                    } else {
  64.386 +                        thisjar = new File (new File (jarFile.getParentFile (), "locale"), name);
  64.387 +                        localeMarks.put (thisjar, ((thisLocale != null) ? thisLocale : "-"));
  64.388 +                        brandingMarks.put (thisjar, ((thisBranding != null) ? thisBranding : "-"));
  64.389 +                    }
  64.390 +                } else {
  64.391 + 		    if (preserveModuleJar) {
  64.392 +                        thisjar = null;
  64.393 +                        log("    Preserving module file (2): " + jarFile.getName(), Project.MSG_DEBUG);
  64.394 +                    } else {
  64.395 +                        thisjar = jarFile;
  64.396 +                        localeMarks.put (thisjar, null);
  64.397 +                        brandingMarks.put (thisjar, null);
  64.398 +                    }
  64.399 +                }
  64.400 +                if (thisjar != null) {
  64.401 +  	            log("    Adding file " + thisjar.getName() + " to 'jars' HashSet", Project.MSG_DEBUG);
  64.402 +                    jars.add (thisjar);
  64.403 +                    Map files = (Map) router.get (thisjar);
  64.404 +                    if (files == null) {
  64.405 +                        files = new TreeMap ();
  64.406 +                        router.put (thisjar, files);
  64.407 +                    }
  64.408 +                    files.put (path, file);
  64.409 +                }
  64.410 +            }
  64.411 +        }
  64.412 +
  64.413 +        //System.err.println ("Stage #5");
  64.414 +        // Go through JARs one by one, and build them (if necessary).
  64.415 +        {
  64.416 +            List jars2 = new ArrayList (jars);
  64.417 +            class FileNameComparator implements Comparator {
  64.418 +                public int compare (Object o1, Object o2) {
  64.419 +                    File f1 = (File) o1;
  64.420 +                    File f2 = (File) o2;
  64.421 +                    return f1.toString ().compareTo (f2.toString ());
  64.422 +                }
  64.423 +            }
  64.424 +            Comparator c = new FileNameComparator ();
  64.425 +            Collections.sort (jars2, c);
  64.426 +            Iterator it = jars2.iterator ();
  64.427 +            while (it.hasNext ()) {
  64.428 +                File jar = (File) it.next ();
  64.429 +                Map files = (Map) router.get (jar); // Map<String,File>
  64.430 +                if (jar.exists ()) {
  64.431 +                    // Do an up-to-date check first.
  64.432 +                    long time = jar.lastModified ();
  64.433 +                    if (manifest == null || manifest.lastModified () <= time) {
  64.434 +                        boolean upToDate = true;
  64.435 +                        Iterator it2 = files.values ().iterator ();
  64.436 +                        while (it2.hasNext ()) {
  64.437 +                            File f = (File) it2.next ();
  64.438 +                            if (f.lastModified () > time) {
  64.439 +                                upToDate = false;
  64.440 +                                break;
  64.441 +                            }
  64.442 +                        }
  64.443 +                        if (upToDate) {
  64.444 +                            // Skip this JAR.
  64.445 +                            continue;
  64.446 +                        }
  64.447 +                    }
  64.448 +                }
  64.449 +                log ("Building localized jar: " + jar);
  64.450 +                IOException closing = null;
  64.451 +                try {
  64.452 +                    jar.getParentFile ().mkdirs ();
  64.453 +                    ZipOutputStream out = new ZipOutputStream (new FileOutputStream (jar));
  64.454 +                    try {
  64.455 +                        out.setMethod (doCompress ? ZipOutputStream.DEFLATED : ZipOutputStream.STORED);
  64.456 +                        String localeMark = (String) localeMarks.get (jar);
  64.457 +                        String brandingMark = (String) brandingMarks.get (jar);
  64.458 +                        Set addedDirs = new HashSet (); // Set<String>
  64.459 +                        // Add the manifest.
  64.460 +                        InputStream is;
  64.461 +                        long time;
  64.462 +                        if ((manifest != null && localeMark == null && brandingMark == null) || overrideManifest) {
  64.463 +                            // Master JAR, and it has a manifest.
  64.464 +                            is = new FileInputStream (manifest);
  64.465 +                            time = manifest.lastModified ();
  64.466 +                        } else {
  64.467 +                            // Some subsidiary JAR.
  64.468 +                            is = MatchingTask.class.getResourceAsStream ("/org/apache/tools/ant/defaultManifest.mf");
  64.469 +                            time = System.currentTimeMillis ();
  64.470 +                        }
  64.471 +                        java.util.jar.Manifest mani;
  64.472 +                        try {
  64.473 +                            mani = new java.util.jar.Manifest (is);
  64.474 +                        } finally {
  64.475 +                            is.close ();
  64.476 +                        }
  64.477 +                        Attributes attr = mani.getMainAttributes ();
  64.478 +                        if (! attr.containsKey (Attributes.Name.MANIFEST_VERSION)) {
  64.479 +                            attr.put (Attributes.Name.MANIFEST_VERSION, "1.0");
  64.480 +                        }
  64.481 +                        if (localeMark != null) {
  64.482 +                            attr.putValue ("X-Informational-Archive-Locale", localeMark);
  64.483 +                        }
  64.484 +                        if (brandingMark != null) {
  64.485 +                            attr.putValue ("X-Informational-Archive-Branding", brandingMark);
  64.486 +                        }
  64.487 +                        ByteArrayOutputStream baos = new ByteArrayOutputStream ();
  64.488 +                        mani.write (baos);
  64.489 +                        byte[] bytes = baos.toByteArray ();
  64.490 +                        addToJar (new ByteArrayInputStream (bytes), new ByteArrayInputStream (bytes),
  64.491 +                                  out, "META-INF/MANIFEST.MF", time, addedDirs);
  64.492 +                        // Now regular files.
  64.493 +                        Iterator it2 = files.entrySet ().iterator ();
  64.494 +                        while (it2.hasNext ()) {
  64.495 +                            Map.Entry entry = (Map.Entry) it2.next ();
  64.496 +                            String path = (String) entry.getKey ();
  64.497 +                            File file = (File) entry.getValue ();
  64.498 +                            addToJar (new FileInputStream (file), new FileInputStream (file),
  64.499 +                                      out, path, file.lastModified (), addedDirs);
  64.500 +                        }
  64.501 +
  64.502 +			// If desired, write the root of the srcDir to a file. //
  64.503 +			writeSrcDir() ;
  64.504 +                    } finally {
  64.505 +                        try {
  64.506 +                            out.close ();
  64.507 +                        } catch (IOException ex) {
  64.508 +                            closing = ex;
  64.509 +                        }
  64.510 +                    }
  64.511 +
  64.512 +                    if (closing != null) {
  64.513 +                        // if there was a closing exception and no other one
  64.514 +                        throw closing;
  64.515 +                    }
  64.516 +                } catch (IOException ioe) {
  64.517 +                    String msg = "Problem creating JAR: " + ioe.getMessage ();
  64.518 +                    if (! jar.delete ()) {
  64.519 +                        msg += " (and the JAR is probably corrupt but I could not delete it)";
  64.520 +                    }
  64.521 +                    throw new BuildException(msg, ioe, getLocation());
  64.522 +                }
  64.523 +            }
  64.524 +        }
  64.525 +
  64.526 +    } // end execute()
  64.527 +
  64.528 +    private void addToJar (InputStream in1, InputStream in2, ZipOutputStream out,
  64.529 +                           String path, long lastModified, Set addedDirs) throws IOException {
  64.530 +        try {
  64.531 +            if (path.endsWith ("/")) {
  64.532 +                throw new IOException ("Bad path: " + path);
  64.533 +            }
  64.534 +            // Add parent dirs as needed:
  64.535 +            int pos = -1;
  64.536 +            while ((pos = path.indexOf ('/', pos + 1)) != -1) {
  64.537 +                String dir = path.substring (0, pos + 1);
  64.538 +                if (! addedDirs.contains (dir)) {
  64.539 +                    addedDirs.add (dir);
  64.540 +                    ZipEntry ze = new ZipEntry (dir);
  64.541 +                    ze.setSize (0);
  64.542 +                    ze.setMethod (ZipEntry.STORED);
  64.543 +                    ze.setCrc (emptyCrc);
  64.544 +                    ze.setTime (lastModified);
  64.545 +                    out.putNextEntry (ze);
  64.546 +                }
  64.547 +            }
  64.548 +            // Add the file itself:
  64.549 +            ZipEntry ze = new ZipEntry (path);
  64.550 +            ze.setMethod (doCompress ? ZipEntry.DEFLATED : ZipEntry.STORED);
  64.551 +            ze.setTime (lastModified);
  64.552 +            long size = 0;
  64.553 +            CRC32 crc = new CRC32 ();
  64.554 +            byte[] buf = new byte[4096];
  64.555 +            int read;
  64.556 +            while ((read = in1.read (buf)) != -1) {
  64.557 +                crc.update (buf, 0, read);
  64.558 +                size += read;
  64.559 +            }
  64.560 +            in1.close ();
  64.561 +            ze.setCrc (crc.getValue ());
  64.562 +            ze.setSize (size);
  64.563 +            out.putNextEntry (ze);
  64.564 +            while ((read = in2.read (buf)) != -1) {
  64.565 +                out.write (buf, 0, read);
  64.566 +            }
  64.567 +        } finally {
  64.568 +            in2.close ();
  64.569 +            in1.close ();
  64.570 +        }
  64.571 +    } // end addToJar()
  64.572 +
  64.573 +
  64.574 +  // If the name of any parent directory of this file is the same as //
  64.575 +  // one of the locales, return the locale.			     //
  64.576 +  protected String checkInLocaleDir( File file,
  64.577 +				     List locales) {
  64.578 +
  64.579 +    // See if this functionality is disabled. //
  64.580 +    if( !checkPathLocale) {
  64.581 +      return null ;
  64.582 +    }
  64.583 +
  64.584 +    int idx ;
  64.585 +    String loc, locale_dir, ret = null ;
  64.586 +    String path = file.getPath() ;
  64.587 +    Iterator iter = locales.iterator() ;
  64.588 +
  64.589 +    // For each locale. //
  64.590 +    while( iter.hasNext()) {
  64.591 +      loc = (String) iter.next() ;
  64.592 +
  64.593 +      // If the path contains a dir with the same name as the //
  64.594 +      // locale.					      //
  64.595 +      locale_dir = new String( file.separator) ;
  64.596 +      locale_dir += loc ;
  64.597 +      locale_dir += file.separator ;
  64.598 +      idx = path.indexOf( locale_dir) ;
  64.599 +      if( idx != -1) {
  64.600 +
  64.601 +	// Stop and return this locale. //
  64.602 +	ret = loc ;
  64.603 +	break ;
  64.604 +      }
  64.605 +    }
  64.606 +
  64.607 +    return( ret) ;
  64.608 +  }
  64.609 +
  64.610 +  ////////////////////////////////////////////////////////////////////
  64.611 +  // This section of code supports the feature that this class will //
  64.612 +  // look for global properties that specify locales and brandings  //
  64.613 +  // that should be used.					    //
  64.614 +  protected void addGlobalLocaleAndBranding() {
  64.615 +    addGlobals( getGlobalLocaleVarName(), locales) ;
  64.616 +    addGlobals( getOldGlobalLocaleVarName(), locales) ;
  64.617 +    addGlobals( getGlobalBrandingVarName(), brandings) ;
  64.618 +    addGlobals( getOldGlobalBrandingVarName(), brandings) ;
  64.619 +  }
  64.620 +
  64.621 +  protected String getGlobalLocaleVarName() {
  64.622 +    return( new String( "locjar.locales")) ;
  64.623 +  }
  64.624 +
  64.625 +  protected String getGlobalBrandingVarName() {
  64.626 +    return( new String( "locjar.brands")) ;
  64.627 +  }
  64.628 +
  64.629 +  // For backwards compatibility. //
  64.630 +  protected String getOldGlobalLocaleVarName() {
  64.631 +    return( new String( "locjar_global_locales")) ;
  64.632 +  }
  64.633 +
  64.634 +  // For backwards compatibility. //
  64.635 +  protected String getOldGlobalBrandingVarName() {
  64.636 +    return( new String( "locjar_global_brands")) ;
  64.637 +  }
  64.638 +
  64.639 +  protected void addGlobals( String var_name,
  64.640 +			     List list) {
  64.641 +    String prop = null ;
  64.642 +    StringTokenizer tokenizer = null ;
  64.643 +    String tok = null ;
  64.644 +    LocaleOrB lorb = null ;
  64.645 +
  64.646 +    // Foreach string in the global list. //
  64.647 +    prop = getProject().getProperty( var_name) ;
  64.648 +    if( prop != null && !prop.equals( "")) {
  64.649 +      tokenizer = new StringTokenizer( prop, ", ") ;
  64.650 +      while( tokenizer.hasMoreTokens()) {
  64.651 +	tok = tokenizer.nextToken() ;
  64.652 +
  64.653 +	// Add a new entry in the given list. //
  64.654 +	lorb = new LocaleOrB() ;
  64.655 +	lorb.setName( tok) ;
  64.656 +	list.add( lorb) ;
  64.657 +      }
  64.658 +    }
  64.659 +  }
  64.660 +  //////////////////////////////////////////////////////////////////////
  64.661 +
  64.662 +  protected boolean shouldWarnMissingDir() {
  64.663 +    String s ;
  64.664 +    boolean ret = false ;	// Default false. //
  64.665 +
  64.666 +    // If the attribute is set, use its value. //
  64.667 +    if( warnMissingDirSet) {
  64.668 +      ret = warnMissingDir ;
  64.669 +    }
  64.670 +
  64.671 +    // Otherwise use the global property value, if set. //
  64.672 +    else {
  64.673 +      s = getProject().getProperty("locjar.warnMissingDir");
  64.674 +      if( s != null && !s.trim().equals( "")) {
  64.675 +	ret = getProject().toBoolean(s);
  64.676 +      }
  64.677 +    }
  64.678 +
  64.679 +    return( ret) ;
  64.680 +  }
  64.681 +
  64.682 +  // If any dir's don't exist, warn the user and return true. //
  64.683 +  protected boolean warnIfMissingDir() {
  64.684 +    ListIterator iter ;
  64.685 +    FileSet fileset ;
  64.686 +    File dir ;
  64.687 +    boolean ret = false ;
  64.688 +
  64.689 +    // Print warning if the basedir doesn't exist. //
  64.690 +    if( baseDir != null && !baseDir.exists()) {
  64.691 +      ret = true ;
  64.692 +      printMissingDirWarning( baseDir) ;
  64.693 +    }
  64.694 +
  64.695 +    // For each fileset. //
  64.696 +    iter = filesets.listIterator() ;
  64.697 +    if( iter != null) {
  64.698 +      while( iter.hasNext()) {
  64.699 +
  64.700 +	// Print warning if the dir doesn't exist. //
  64.701 +	fileset = (FileSet) iter.next() ;
  64.702 +	dir = fileset.getDir(getProject());
  64.703 +	if( dir != null && !dir.exists()) {
  64.704 +	  ret = true ;
  64.705 +	  printMissingDirWarning( dir) ;
  64.706 +	}
  64.707 +      }
  64.708 +    }
  64.709 +    return( ret) ;
  64.710 +  }
  64.711 +
  64.712 +  // Warn the user that the given dir doesn't exist. //
  64.713 +  protected void printMissingDirWarning( File dir) {
  64.714 +    log( "WARNING: Skipping this task: Directory " + dir.getPath() + " doesn't exist.") ;
  64.715 +  }
  64.716 +
  64.717 +  protected boolean shouldWriteSrcDir() {
  64.718 +    boolean ret = false ;
  64.719 +    String s = getProject().getProperty("locjar.writeSrcDir");
  64.720 +    if( s != null && getProject().toBoolean(s)) {
  64.721 +      ret = true ;
  64.722 +    }
  64.723 +    return( ret) ;
  64.724 +  }
  64.725 +
  64.726 +  protected void writeSrcDir() {
  64.727 +    String name ;
  64.728 +    int idx, fromIdx ;
  64.729 +    OutputStreamWriter osw ;
  64.730 +    FileOutputStream fos ;
  64.731 +    File file ;
  64.732 +
  64.733 +    if( shouldWriteSrcDir() && jarFile != null && baseDir != null) {
  64.734 +      name = jarFile.getPath() ;
  64.735 +      fromIdx = getNetbeansStartIdx() ;
  64.736 +      idx = name.indexOf( File.separator+"netbeans"+File.separator, fromIdx) ;
  64.737 +      if( idx != -1) {
  64.738 +	try {
  64.739 +	  file = new File( name.substring( 0, idx) + File.separator + "srcdir.properties") ;
  64.740 +	  fos = new FileOutputStream( file) ;
  64.741 +	  osw = new OutputStreamWriter( fos) ;
  64.742 +	  osw.write( "srcdir=" + baseDir + "\n") ;
  64.743 +	  osw.close() ;
  64.744 +	  fos.close() ;
  64.745 +	}
  64.746 +	catch( Exception e) {
  64.747 +	  System.out.println( "ERROR: " + e.getMessage()) ;
  64.748 +	  e.printStackTrace() ;
  64.749 +	  throw new BuildException() ;
  64.750 +	}
  64.751 +      }
  64.752 +      else {
  64.753 +	throw new BuildException( "ERROR: Couldn't find netbeans dir to write srcdir.properties to.") ;
  64.754 +      }
  64.755 +    }
  64.756 +  }
  64.757 +
  64.758 +  // Return the index to start searching from to find the "netbeans"
  64.759 +  // directory into which the "srcdir.properties" file will be
  64.760 +  // written.
  64.761 +  protected int getNetbeansStartIdx() {
  64.762 +    int startIdx = 0 ;
  64.763 +    int idx ;
  64.764 +
  64.765 +    idx = baseDir.getPath().lastIndexOf( File.separator+
  64.766 +					 "netbeans"+File.separator) ;
  64.767 +    if( idx != -1) {
  64.768 +      startIdx = idx + 1 ;
  64.769 +    }
  64.770 +    return( startIdx) ;
  64.771 +  }
  64.772 +}
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/Repeat.java	Sun Jan 28 18:54:08 2007 +0000
    65.3 @@ -0,0 +1,116 @@
    65.4 +/*
    65.5 + * The contents of this file are subject to the terms of the Common Development
    65.6 + * and Distribution License (the License). You may not use this file except in
    65.7 + * compliance with the License.
    65.8 + *
    65.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   65.10 + * or http://www.netbeans.org/cddl.txt.
   65.11 +
   65.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   65.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   65.14 + * If applicable, add the following below the CDDL Header, with the fields
   65.15 + * enclosed by brackets [] replaced by your own identifying information:
   65.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   65.17 + *
   65.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   65.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   65.20 + * Microsystems, Inc. All Rights Reserved.
   65.21 + */
   65.22 +package org.netbeans.modules.visualweb.ravebuild;
   65.23 +
   65.24 +import java.io.File;
   65.25 +import java.util.*;
   65.26 +
   65.27 +import org.apache.tools.ant.BuildException;
   65.28 +import org.apache.tools.ant.taskdefs.Ant;
   65.29 +
   65.30 +import org.apache.tools.ant.Project;
   65.31 +import org.apache.tools.ant.Target;
   65.32 +import org.apache.tools.ant.Task;
   65.33 +import org.apache.tools.ant.taskdefs.CallTarget;
   65.34 +import org.apache.tools.ant.taskdefs.Property;
   65.35 +
   65.36 +/**
   65.37 + * For each of specified property values calls target task of a specified name
   65.38 + * with property set to one of these values
   65.39 + *
   65.40 + * @author  Radim Kubacki
   65.41 + */
   65.42 +public class Repeat extends Task {
   65.43 +    
   65.44 +    private List   values; // List<String>
   65.45 +    private String target;
   65.46 +    private String startdir;
   65.47 +    private String name;
   65.48 +    
   65.49 +    //
   65.50 +    // init
   65.51 +    //
   65.52 +    
   65.53 +    public Repeat() {
   65.54 +        values = new Vector();
   65.55 +        target    = null;
   65.56 +    }
   65.57 +
   65.58 +    //
   65.59 +    // itself
   65.60 +    //
   65.61 +
   65.62 +    /** Name of property that will be set for each call. */
   65.63 +    public void setName (String s) {
   65.64 +        log ("SET name = " + s, Project.MSG_DEBUG);
   65.65 +
   65.66 +        name = s;
   65.67 +    }
   65.68 +    
   65.69 +    /** Comma separated list of values. */
   65.70 +    public void setValues (String s) {
   65.71 +        log ("SET values = " + s, Project.MSG_DEBUG);
   65.72 +
   65.73 +        StringTokenizer tok = new StringTokenizer (s, ", ");
   65.74 +        values = new Vector ();
   65.75 +        while ( tok.hasMoreTokens() ) {
   65.76 +            values.add (tok.nextToken().trim());
   65.77 +        }
   65.78 +    }
   65.79 +    
   65.80 +    /** Name of target which will be used with ant task. If not specified,
   65.81 +     * owning target name is used.
   65.82 +     */
   65.83 +    public void setTarget (String s) {
   65.84 +        log ("SET target = " + s, Project.MSG_DEBUG);
   65.85 +
   65.86 +        target = s;
   65.87 +    }
   65.88 +
   65.89 +    /** Execute this task. */
   65.90 +    public void execute () throws BuildException {        
   65.91 +        if ( values.isEmpty() ) {
   65.92 +            throw new BuildException("You must set at least one value!", getLocation());
   65.93 +        }
   65.94 +
   65.95 +        if ( target == null ) {
   65.96 +            throw new BuildException("Target must be set!", getLocation());
   65.97 +        }
   65.98 +
   65.99 +        Iterator it = values.iterator();
  65.100 +        while ( it.hasNext() ) {
  65.101 +            String val = (String) it.next();
  65.102 +
  65.103 +            log ("Process '" + val + "' location with '" + target + "' target ...", Project.MSG_VERBOSE);
  65.104 +            
  65.105 +            CallTarget antCall = (CallTarget) getProject().createTask("antcall");
  65.106 +            antCall.init();
  65.107 +            antCall.setLocation(getLocation());
  65.108 +            
  65.109 +            // ant.setDir (dir);
  65.110 +            antCall.setTarget (target);
  65.111 +            Property prop = antCall.createParam();
  65.112 +            prop.setName(name);
  65.113 +            prop.setValue(val);
  65.114 +            
  65.115 +            antCall.execute();
  65.116 +        }
  65.117 +    }
  65.118 +    
  65.119 +}
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/UpdateTracking.java	Sun Jan 28 18:54:08 2007 +0000
    66.3 @@ -0,0 +1,597 @@
    66.4 +/*
    66.5 + * The contents of this file are subject to the terms of the Common Development
    66.6 + * and Distribution License (the License). You may not use this file except in
    66.7 + * compliance with the License.
    66.8 + *
    66.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   66.10 + * or http://www.netbeans.org/cddl.txt.
   66.11 +
   66.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   66.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   66.14 + * If applicable, add the following below the CDDL Header, with the fields
   66.15 + * enclosed by brackets [] replaced by your own identifying information:
   66.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   66.17 + *
   66.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   66.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   66.20 + * Microsystems, Inc. All Rights Reserved.
   66.21 + */
   66.22 +
   66.23 +package org.netbeans.modules.visualweb.ravebuild;
   66.24 +
   66.25 +import java.io.*;
   66.26 +import java.util.*;
   66.27 +import java.io.FileOutputStream;
   66.28 +
   66.29 +import org.w3c.dom.*;
   66.30 +import org.xml.sax.InputSource;
   66.31 +
   66.32 +import org.apache.tools.ant.BuildException;
   66.33 +
   66.34 +/** This class represents module updates tracking
   66.35 + *
   66.36 + * @author  akemr
   66.37 + */
   66.38 +class UpdateTracking {
   66.39 +    private static final String ELEMENT_MODULE = "module"; // NOI18N
   66.40 +    private static final String ATTR_CODENAME = "codename"; // NOI18N
   66.41 +    private static final String ELEMENT_VERSION = "module_version"; // NOI18N
   66.42 +    private static final String ATTR_VERSION = "specification_version"; // NOI18N
   66.43 +    private static final String ATTR_ORIGIN = "origin"; // NOI18N
   66.44 +    private static final String ATTR_LAST = "last"; // NOI18N
   66.45 +    private static final String ATTR_INSTALL = "install_time"; // NOI18N
   66.46 +    private static final String ELEMENT_FILE = "file"; // NOI18N
   66.47 +    private static final String ATTR_FILE_NAME = "name"; // NOI18N
   66.48 +    private static final String ATTR_CRC = "crc"; // NOI18N
   66.49 +    
   66.50 +    private static final String NBM_ORIGIN = "nbm"; // NOI18N
   66.51 +    private static final String INST_ORIGIN = "installer"; // NOI18N
   66.52 +
   66.53 +    /** Platform dependent file name separator */
   66.54 +    private static final String FILE_SEPARATOR = System.getProperty ("file.separator");  // NOI18N           
   66.55 +
   66.56 +    /** The name of the install_later file */
   66.57 +    public static final String TRACKING_DIRECTORY = "update_tracking"; // NOI18N
   66.58 +    
   66.59 +    private boolean pError = false;
   66.60 +    
   66.61 +    private File trackingFile = null;
   66.62 +    
   66.63 +    private String origin = NBM_ORIGIN;
   66.64 +    private String nbPath = null;
   66.65 +    private Module module = null;
   66.66 +    protected InputStream is = null;
   66.67 +    protected OutputStream os = null;
   66.68 +   
   66.69 +    // for generating xml in build process
   66.70 +    public UpdateTracking( String nbPath ) {
   66.71 +        this.nbPath = nbPath;
   66.72 +        origin = INST_ORIGIN;
   66.73 +    }
   66.74 +    
   66.75 +    /**
   66.76 +     * Use this constructor, only when you want to use I/O Streams
   66.77 +     */
   66.78 +    public UpdateTracking () {
   66.79 +        this.nbPath = null;
   66.80 +        origin = INST_ORIGIN;
   66.81 +    }
   66.82 +    
   66.83 +    public Version addNewModuleVersion( String codename, String spec_version ) {
   66.84 +        module = new Module();
   66.85 +        module.setCodename( codename );
   66.86 +        Version version = new Version();        
   66.87 +        version.setVersion( spec_version );
   66.88 +        version.setOrigin( origin );
   66.89 +        version.setLast( true );
   66.90 +        version.setInstall_time( System.currentTimeMillis() );
   66.91 +        module.setVersion( version );
   66.92 +        return version;
   66.93 +    }
   66.94 +    
   66.95 +    public String getVersionFromFile (File utf) throws BuildException {
   66.96 +        this.setTrackingFile(utf.getParentFile(), utf.getName());
   66.97 +        read();
   66.98 +        if ( module.getVersions().size() != 1 ) 
   66.99 +            throw new BuildException ("Module described in update tracking file " + utf.getAbsolutePath() + " has got " + module.getVersions().size() + " specification versions. Correct number is 1.");
  66.100 +        return ((Version) module.getVersions().get(0)).getVersion();
  66.101 +    }
  66.102 +    
  66.103 +    public String getCodenameFromFile (File utf) throws BuildException {
  66.104 +        this.setTrackingFile(utf.getParentFile(), utf.getName());
  66.105 +        read();
  66.106 +        if ( module.getVersions().size() != 1 ) 
  66.107 +            throw new BuildException ("Module described in update tracking file " + utf.getAbsolutePath() + " has got " + module.getVersions().size() + " specification versions. Correct number is 1.");
  66.108 +        return module.getCodename();
  66.109 +    }
  66.110 +    
  66.111 +    public String getVersionForCodeName( String codeName ) throws BuildException {
  66.112 +        module = new Module();
  66.113 +        module.setCodename( codeName );
  66.114 +//        if (this.is == null) {
  66.115 +            File directory = new File( nbPath + FILE_SEPARATOR + TRACKING_DIRECTORY );
  66.116 +            setTrackingFile(directory, getTrackingFileName());
  66.117 +            if (!trackingFile.exists() || !trackingFile.isFile())
  66.118 +                throw new BuildException ("Tracking file " + trackingFile.getAbsolutePath() + " cannot be found for module codenamebase " + codeName );
  66.119 +//        }
  66.120 +        read();
  66.121 +        if ( module.getVersions().size() != 1 ) 
  66.122 +            throw new BuildException ("Module with codenamebase " + codeName + " has got " + module.getVersions().size() + " specification versions. Correct number is 1.");
  66.123 +        return ((Version) module.getVersions().get(0)).getVersion();
  66.124 +    }
  66.125 +    
  66.126 +    public String[] getListOfNBM( String codeName ) throws BuildException {
  66.127 +        module = new Module();
  66.128 +        module.setCodename( codeName );
  66.129 +        if (this.is == null) {
  66.130 +            File directory = new File( nbPath + FILE_SEPARATOR + TRACKING_DIRECTORY );
  66.131 +            setTrackingFile(directory, getTrackingFileName());
  66.132 +            if (!trackingFile.exists() || !trackingFile.isFile())
  66.133 +                throw new BuildException ("Tracking file " + trackingFile.getAbsolutePath() + " cannot be found for module codenamebase " + codeName );
  66.134 +        }
  66.135 +        
  66.136 +        read();
  66.137 +        
  66.138 +        if ( module.getVersions().size() != 1 ) 
  66.139 +            throw new BuildException ("Module with codenamebase " + codeName + " has got " + module.getVersions().size() + " specification versions. Correct number is 1.");
  66.140 +        
  66.141 +        List files = ((Version) module.getVersions().get(0)).getFiles();
  66.142 +        String [] listFiles = new String[ files.size() ];
  66.143 +        for (int i=0; i < files.size(); i++) {
  66.144 +            listFiles[i] = (((ModuleFile) files.get(i)).getName().replace(File.separatorChar,'/'));
  66.145 +        }
  66.146 +        
  66.147 +        return listFiles;
  66.148 +    }
  66.149 +
  66.150 +    public void removeLocalized( String locale ) {
  66.151 +        File updateDirectory = new File( nbPath, TRACKING_DIRECTORY );
  66.152 +        File[] trackingFiles = updateDirectory.listFiles( new FileFilter() { // Get only *.xml files
  66.153 +            public boolean accept( File file ) {
  66.154 +                return file.isFile() &&file.getName().endsWith(".xml"); //NOI18N
  66.155 +            }
  66.156 +        } );
  66.157 +        if (trackingFiles != null)
  66.158 +            for (int i = trackingFiles.length-1; i >= 0; i--) {
  66.159 +                trackingFile = trackingFiles[i];
  66.160 +                read();
  66.161 +                module.removeLocalized( locale );
  66.162 +                write();
  66.163 +            }
  66.164 +    }
  66.165 +    
  66.166 +    void write( ) throws BuildException{
  66.167 +        Document document = XMLUtil.createDocument(ELEMENT_MODULE);  
  66.168 +        Element e_module = document.getDocumentElement();
  66.169 +        e_module.setAttribute(ATTR_CODENAME, module.getCodename());
  66.170 +        Iterator it2 = module.getVersions().iterator();
  66.171 +        while ( it2.hasNext() ) {
  66.172 +            Version ver = (Version)it2.next();
  66.173 +            Element e_version = document.createElement(ELEMENT_VERSION);
  66.174 +            e_version.setAttribute(ATTR_VERSION, ver.getVersion());
  66.175 +            e_version.setAttribute(ATTR_ORIGIN, ver.getOrigin());
  66.176 +            e_version.setAttribute(ATTR_LAST, "true");                          //NOI18N
  66.177 +            e_version.setAttribute(ATTR_INSTALL, Long.toString(ver.getInstall_time()));
  66.178 +            e_module.appendChild( e_version );
  66.179 +            Iterator it3 = ver.getFiles().iterator();
  66.180 +            while ( it3.hasNext() ) {
  66.181 +                ModuleFile file = (ModuleFile)it3.next();
  66.182 +                Element e_file = document.createElement(ELEMENT_FILE);
  66.183 +                e_file.setAttribute(ATTR_FILE_NAME, file.getName().replace(File.separatorChar,'/'));
  66.184 +                e_file.setAttribute(ATTR_CRC, file.getCrc());
  66.185 +                e_version.appendChild( e_file );
  66.186 +            }
  66.187 +        }
  66.188 +        
  66.189 +        //document.getDocumentElement().normalize();
  66.190 +        if (this.os == null) {
  66.191 +            File directory = new File( nbPath + FILE_SEPARATOR + TRACKING_DIRECTORY );
  66.192 +            if (!directory.exists()) {
  66.193 +                directory.mkdirs();
  66.194 +            }
  66.195 +            setTrackingFile(directory, this.getTrackingFileName());
  66.196 +            FileOutputStream fos = null;
  66.197 +            try {
  66.198 +                fos = new FileOutputStream(new File(directory,this.getTrackingFileName()));
  66.199 +            } catch (Exception e) {
  66.200 +                throw new BuildException("Could not get outputstream to write update tracking", e);
  66.201 +            }
  66.202 +            this.setTrackingOutputStream(fos);
  66.203 +        }
  66.204 +        try {
  66.205 +            try {
  66.206 +                XMLUtil.write(document, this.os);
  66.207 +            } finally {
  66.208 +                this.os.close();
  66.209 +            }
  66.210 +        } catch (Exception e) {
  66.211 +            e.printStackTrace();
  66.212 +            if ((trackingFile != null) && (trackingFile.exists()))
  66.213 +                trackingFile.delete();
  66.214 +            throw new BuildException("Could not write update tracking", e);
  66.215 +        }        
  66.216 +    }
  66.217 +
  66.218 +    protected void setTrackingFile (File dir, String tFname) throws BuildException {
  66.219 +        this.trackingFile = new File(dir,tFname);
  66.220 +//        this.trackingFile.mkdirs();
  66.221 +        try {
  66.222 +            //setTrackingOutputStream(new FileOutputStream(this.trackingFile));
  66.223 +            if (this.trackingFile.exists())
  66.224 +                setTrackingInputStream(new FileInputStream(this.trackingFile));
  66.225 +        } catch (java.io.FileNotFoundException fnf) {
  66.226 +            throw new BuildException("Unable to find tracking file "+this.trackingFile.getAbsolutePath(), fnf);
  66.227 +        }
  66.228 +    }
  66.229 +    
  66.230 +    public void setTrackingOutputStream(OutputStream tos) {
  66.231 +        this.os = tos;
  66.232 +    }
  66.233 +    
  66.234 +    public OutputStream getTrackingOutputStream() {
  66.235 +        return this.os;
  66.236 +    }
  66.237 +    
  66.238 +    public void setTrackingInputStream(InputStream tis) {
  66.239 +        this.is = tis;
  66.240 +    }
  66.241 +    
  66.242 +    public String getTrackingFileName() throws BuildException {
  66.243 +        String trackingFileName = module.getCodenamebase();
  66.244 +        if ( ( trackingFileName == null ) || ( trackingFileName.length() == 0 ) )
  66.245 +            throw new BuildException ("Empty codenamebase, unable to locate tracking file");
  66.246 +        trackingFileName = trackingFileName.replace('.', '-') + ".xml"; //NOI18N
  66.247 +        return trackingFileName;
  66.248 +    }
  66.249 +
  66.250 +    /** Scan through org.w3c.dom.Document document. */
  66.251 +    private void read() throws BuildException {
  66.252 +        /** org.w3c.dom.Document document */
  66.253 +        org.w3c.dom.Document document;
  66.254 +        if (this.is == null) {
  66.255 +            File directory = new File( nbPath + FILE_SEPARATOR + TRACKING_DIRECTORY );
  66.256 +            if (!directory.exists()) {
  66.257 +                directory.mkdirs();
  66.258 +            }
  66.259 +            setTrackingFile(directory,getTrackingFileName());
  66.260 +        }
  66.261 +        try {
  66.262 +            InputSource xmlInputSource = new InputSource( this.is );
  66.263 +            document = XMLUtil.parse( xmlInputSource, false, false, new ErrorCatcher(), null );
  66.264 +            if (is != null)
  66.265 +                is.close();
  66.266 +        } catch ( org.xml.sax.SAXException e ) {
  66.267 +            e.printStackTrace();
  66.268 +            if (trackingFile == null) {
  66.269 +                throw new BuildException ("Update tracking data in external InputStream is not well formatted XML document.", e);
  66.270 +            } else {
  66.271 +                throw new BuildException ("Update tracking file " + trackingFile.getAbsolutePath() + " is not well formatted XML document.", e);
  66.272 +            }
  66.273 +        } catch ( java.io.IOException e ) {
  66.274 +            e.printStackTrace();
  66.275 +            if (trackingFile == null) {
  66.276 +                throw new BuildException ("I/O error while accessing tracking data in InputStream", e);
  66.277 +            } else {
  66.278 +                throw new BuildException ("I/O error while accessing tracking file " + trackingFile.getAbsolutePath(), e);
  66.279 +            }
  66.280 +        }
  66.281 +            
  66.282 +        org.w3c.dom.Element element = document.getDocumentElement();
  66.283 +        if ((element != null) && element.getTagName().equals(ELEMENT_MODULE)) {
  66.284 +            scanElement_module(element);
  66.285 +        }
  66.286 +    }    
  66.287 +    
  66.288 +    /** Scan through org.w3c.dom.Element named module. */
  66.289 +    void scanElement_module(org.w3c.dom.Element element) { // <module>
  66.290 +        module = new Module();        
  66.291 +        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
  66.292 +        for (int i = 0; i < attrs.getLength(); i++) {
  66.293 +            org.w3c.dom.Attr attr = (org.w3c.dom.Attr)attrs.item(i);
  66.294 +            if (attr.getName().equals(ATTR_CODENAME)) { // <module codename="???">
  66.295 +                module.setCodename( attr.getValue() );
  66.296 +            }
  66.297 +        }
  66.298 +        org.w3c.dom.NodeList nodes = element.getChildNodes();
  66.299 +        for (int i = 0; i < nodes.getLength(); i++) {
  66.300 +            org.w3c.dom.Node node = nodes.item(i);
  66.301 +            if ( node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE ) {
  66.302 +                org.w3c.dom.Element nodeElement = (org.w3c.dom.Element)node;
  66.303 +                if (nodeElement.getTagName().equals(ELEMENT_VERSION)) {
  66.304 +                    scanElement_module_version(nodeElement, module);
  66.305 +                }
  66.306 +            }
  66.307 +        }
  66.308 +    }
  66.309 +    
  66.310 +    /** Scan through org.w3c.dom.Element named module_version. */
  66.311 +    void scanElement_module_version(org.w3c.dom.Element element, Module module) { // <module_version>
  66.312 +        Version version = new Version();        
  66.313 +        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
  66.314 +        for (int i = 0; i < attrs.getLength(); i++) {
  66.315 +            org.w3c.dom.Attr attr = (org.w3c.dom.Attr)attrs.item(i);
  66.316 +            if (attr.getName().equals(ATTR_VERSION)) { // <module_version specification_version="???">
  66.317 +                version.setVersion( attr.getValue() );
  66.318 +            }
  66.319 +            if (attr.getName().equals(ATTR_ORIGIN)) { // <module_version origin="???">
  66.320 +                version.setOrigin( attr.getValue() );
  66.321 +            }
  66.322 +            if (attr.getName().equals(ATTR_LAST)) { // <module_version last="???">                
  66.323 +                version.setLast( Boolean.getBoolean(attr.getValue() ));
  66.324 +            }
  66.325 +            if (attr.getName().equals(ATTR_INSTALL)) { // <module_version install_time="???">
  66.326 +                long li = 0;
  66.327 +                try {
  66.328 +                    li = Long.parseLong( attr.getValue() );
  66.329 +                } catch ( NumberFormatException nfe ) {
  66.330 +                }
  66.331 +                version.setInstall_time( li );
  66.332 +            }
  66.333 +        }
  66.334 +        org.w3c.dom.NodeList nodes = element.getChildNodes();
  66.335 +        for (int i = 0; i < nodes.getLength(); i++) {
  66.336 +            org.w3c.dom.Node node = nodes.item(i);
  66.337 +            if ( node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE ) {
  66.338 +                org.w3c.dom.Element nodeElement = (org.w3c.dom.Element)node;
  66.339 +                if (nodeElement.getTagName().equals(ELEMENT_FILE)) {
  66.340 +                    scanElement_file(nodeElement, version);
  66.341 +                }
  66.342 +            }
  66.343 +        }
  66.344 +        module.addVersion( version );
  66.345 +    }
  66.346 +    
  66.347 +    /** Scan through org.w3c.dom.Element named file. */
  66.348 +    void scanElement_file(org.w3c.dom.Element element, Version version) { // <file>
  66.349 +        ModuleFile file = new ModuleFile();        
  66.350 +        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
  66.351 +        for (int i = 0; i < attrs.getLength(); i++) {
  66.352 +            org.w3c.dom.Attr attr = (org.w3c.dom.Attr)attrs.item(i);
  66.353 +            if (attr.getName().equals(ATTR_FILE_NAME)) { // <file name="???">
  66.354 +                file.setName( attr.getValue().replace(File.separatorChar,'/') );
  66.355 +            }
  66.356 +            if (attr.getName().equals(ATTR_CRC)) { // <file crc="???">
  66.357 +                file.setCrc( attr.getValue() );
  66.358 +            }
  66.359 +        }
  66.360 +        version.addFile (file );
  66.361 +    }
  66.362 +    
  66.363 +    class Module extends Object {        
  66.364 +        
  66.365 +        /** Holds value of property codename. */
  66.366 +        private String codename;
  66.367 +        
  66.368 +        /** Holds value of property versions. */
  66.369 +        private List versions = new ArrayList();
  66.370 +        
  66.371 +        /** Getter for property codenamebase.
  66.372 +         * @return Value of property codenamebase.
  66.373 +         */
  66.374 +        String getCodenamebase() {
  66.375 +	    String codenamebase = new String(codename);
  66.376 +            int idx = codenamebase.lastIndexOf ('/'); //NOI18N
  66.377 +            if (idx != -1) codenamebase = codenamebase.substring (0, idx);
  66.378 +
  66.379 +            return codenamebase;
  66.380 +        }
  66.381 +
  66.382 +         /** Getter for property codename.
  66.383 +         * @return Value of property codename.
  66.384 +         */
  66.385 +        String getCodename() {
  66.386 +            return codename;
  66.387 +        }
  66.388 +       
  66.389 +        /** Setter for property codename.
  66.390 +         * @param codename New value of property codename.
  66.391 +         */
  66.392 +        void setCodename(String codename) {
  66.393 +            this.codename = codename;
  66.394 +        }
  66.395 +        
  66.396 +        /** Getter for property versions.
  66.397 +         * @return Value of property versions.
  66.398 +         */
  66.399 +        List getVersions() {
  66.400 +            return versions;
  66.401 +        }
  66.402 +        
  66.403 +        /** Setter for property versions.
  66.404 +         * @param versions New value of property versions.
  66.405 +         */
  66.406 +        void setVersions(List versions) {
  66.407 +            this.versions = versions;
  66.408 +        }
  66.409 +        
  66.410 +        void addVersion( Version version ) {
  66.411 +            versions = new ArrayList();
  66.412 +            versions.add( version );
  66.413 +        }
  66.414 +
  66.415 +        void setVersion( Version version ) {
  66.416 +            versions = new ArrayList();
  66.417 +            versions.add( version );
  66.418 +        }
  66.419 +        
  66.420 +        void removeLocalized( String locale ) {
  66.421 +            Iterator it = versions.iterator();
  66.422 +            while (it.hasNext()) {
  66.423 +                Version ver = (Version) it.next();
  66.424 +                ver.removeLocalized( locale );
  66.425 +            }
  66.426 +        }
  66.427 +    }
  66.428 +    
  66.429 +    public class Version extends Object {        
  66.430 +        
  66.431 +        /** Holds value of property version. */
  66.432 +        private String version;
  66.433 +        
  66.434 +        /** Holds value of property origin. */
  66.435 +        private String origin;
  66.436 +        
  66.437 +        /** Holds value of property last. */
  66.438 +        private boolean last;
  66.439 +        
  66.440 +        /** Holds value of property install_time. */
  66.441 +        private long install_time = 0;
  66.442 +        
  66.443 +        /** Holds value of property files. */
  66.444 +        private List files = new ArrayList();
  66.445 +        
  66.446 +        /** Getter for property version.
  66.447 +         * @return Value of property version.
  66.448 +         */
  66.449 +        String getVersion() {
  66.450 +            return version;
  66.451 +        }
  66.452 +        
  66.453 +        /** Setter for property version.
  66.454 +         * @param version New value of property version.
  66.455 +         */
  66.456 +        void setVersion(String version) {
  66.457 +            this.version = version;
  66.458 +        }
  66.459 +        
  66.460 +        /** Getter for property origin.
  66.461 +         * @return Value of property origin.
  66.462 +         */
  66.463 +        String getOrigin() {
  66.464 +            return origin;
  66.465 +        }
  66.466 +        
  66.467 +        /** Setter for property origin.
  66.468 +         * @param origin New value of property origin.
  66.469 +         */
  66.470 +        void setOrigin(String origin) {
  66.471 +            this.origin = origin;
  66.472 +        }
  66.473 +        
  66.474 +        /** Getter for property last.
  66.475 +         * @return Value of property last.
  66.476 +         */
  66.477 +        boolean isLast() {
  66.478 +            return last;
  66.479 +        }
  66.480 +        
  66.481 +        /** Setter for property last.
  66.482 +         * @param last New value of property last.
  66.483 +         */
  66.484 +        void setLast(boolean last) {
  66.485 +            this.last = last;
  66.486 +        }
  66.487 +        
  66.488 +        /** Getter for property install_time.
  66.489 +         * @return Value of property install_time.
  66.490 +         */
  66.491 +        long getInstall_time() {
  66.492 +            return install_time;
  66.493 +        }
  66.494 +        
  66.495 +        /** Setter for property install_time.
  66.496 +         * @param install_time New value of property install_time.
  66.497 +         */
  66.498 +        void setInstall_time(long install_time) {
  66.499 +            this.install_time = install_time;
  66.500 +        }
  66.501 +        
  66.502 +        /** Getter for property files.
  66.503 +         * @return Value of property files.
  66.504 +         */
  66.505 +        List getFiles() {
  66.506 +            return files;
  66.507 +        }
  66.508 +        
  66.509 +        /** Setter for property files.
  66.510 +         * @param files New value of property files.
  66.511 +         */
  66.512 +        void setFiles(List files) {
  66.513 +            this.files = files;
  66.514 +        }
  66.515 +        
  66.516 +        void addFile( ModuleFile file ) {
  66.517 +            files.add( file );
  66.518 +        }
  66.519 +        
  66.520 +        public void addFileWithCrc( String filename, String crc ) {
  66.521 +            ModuleFile file = new ModuleFile();
  66.522 +            file.setName( filename );
  66.523 +            file.setCrc( crc);
  66.524 +            files.add( file );
  66.525 +        }
  66.526 +        
  66.527 +        public void removeLocalized( String locale ) {
  66.528 +            ArrayList newFiles = new ArrayList();
  66.529 +            Iterator it = files.iterator();
  66.530 +            while (it.hasNext()) {
  66.531 +                ModuleFile file = (ModuleFile) it.next();
  66.532 +                if (file.getName().indexOf("_" + locale + ".") == -1 // NOI18N
  66.533 +                    && file.getName().indexOf("_" + locale + "/") == -1 // NOI18N
  66.534 +                    && !file.getName().endsWith("_" + locale) ) // NOI18N
  66.535 +                    newFiles.add ( file );
  66.536 +            }
  66.537 +            files = newFiles;
  66.538 +            
  66.539 +        }
  66.540 +        
  66.541 +    }
  66.542 +    
  66.543 +    class ModuleFile extends Object {        
  66.544 +        
  66.545 +        /** Holds value of property name. */
  66.546 +        private String name;
  66.547 +        
  66.548 +        /** Holds value of property crc. */
  66.549 +        private String crc;
  66.550 +        
  66.551 +        /** Getter for property name.
  66.552 +         * @return Value of property name.
  66.553 +         */
  66.554 +        String getName() {
  66.555 +            return name;
  66.556 +        }
  66.557 +        
  66.558 +        /** Setter for property name.
  66.559 +         * @param name New value of property name.
  66.560 +         */
  66.561 +        void setName(String name) {
  66.562 +            this.name = name.replace(File.separatorChar,'/');
  66.563 +        }
  66.564 +        
  66.565 +        /** Getter for property crc.
  66.566 +         * @return Value of property crc.
  66.567 +         */
  66.568 +        String getCrc() {
  66.569 +            return crc;
  66.570 +        }
  66.571 +        
  66.572 +        /** Setter for property crc.
  66.573 +         * @param crc New value of property crc.
  66.574 +         */
  66.575 +        void setCrc(String crc) {
  66.576 +            this.crc = crc;
  66.577 +        }
  66.578 +        
  66.579 +    }
  66.580 +
  66.581 +    class ErrorCatcher implements org.xml.sax.ErrorHandler {
  66.582 +        private void message (String level, org.xml.sax.SAXParseException e) {
  66.583 +            pError = true;
  66.584 +        }
  66.585 +
  66.586 +        public void error (org.xml.sax.SAXParseException e) {
  66.587 +            // normally a validity error
  66.588 +            pError = true;
  66.589 +        }
  66.590 +
  66.591 +        public void warning (org.xml.sax.SAXParseException e) {
  66.592 +            //parseFailed = true;
  66.593 +        }
  66.594 +
  66.595 +        public void fatalError (org.xml.sax.SAXParseException e) {
  66.596 +            pError = true;
  66.597 +        }
  66.598 +    }
  66.599 +    
  66.600 +}
    67.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/XMLUtil.java	Sun Jan 28 18:54:08 2007 +0000
    67.3 @@ -0,0 +1,223 @@
    67.4 +/*
    67.5 + * The contents of this file are subject to the terms of the Common Development
    67.6 + * and Distribution License (the License). You may not use this file except in
    67.7 + * compliance with the License.
    67.8 + *
    67.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   67.10 + * or http://www.netbeans.org/cddl.txt.
   67.11 +
   67.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   67.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   67.14 + * If applicable, add the following below the CDDL Header, with the fields
   67.15 + * enclosed by brackets [] replaced by your own identifying information:
   67.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   67.17 + *
   67.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   67.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   67.20 + * Microsystems, Inc. All Rights Reserved.
   67.21 + */
   67.22 +
   67.23 +package org.netbeans.modules.visualweb.ravebuild;
   67.24 +
   67.25 +import java.io.IOException;
   67.26 +import java.io.OutputStream;
   67.27 +import java.util.ArrayList;
   67.28 +import java.util.Arrays;
   67.29 +import java.util.Collection;
   67.30 +import java.util.List;
   67.31 +import javax.xml.parsers.DocumentBuilder;
   67.32 +import javax.xml.parsers.DocumentBuilderFactory;
   67.33 +import javax.xml.parsers.ParserConfigurationException;
   67.34 +import javax.xml.transform.OutputKeys;
   67.35 +import javax.xml.transform.Result;
   67.36 +import javax.xml.transform.Source;
   67.37 +import javax.xml.transform.Transformer;
   67.38 +import javax.xml.transform.TransformerFactory;
   67.39 +import javax.xml.transform.TransformerFactoryConfigurationError;
   67.40 +import javax.xml.transform.dom.DOMSource;
   67.41 +import javax.xml.transform.stream.StreamResult;
   67.42 +import org.w3c.dom.DOMException;
   67.43 +import org.w3c.dom.DOMImplementation;
   67.44 +import org.w3c.dom.Document;
   67.45 +import org.w3c.dom.DocumentType;
   67.46 +import org.w3c.dom.Element;
   67.47 +import org.w3c.dom.Node;
   67.48 +import org.w3c.dom.NodeList;
   67.49 +import org.w3c.dom.Text;
   67.50 +import org.xml.sax.EntityResolver;
   67.51 +import org.xml.sax.ErrorHandler;
   67.52 +import org.xml.sax.InputSource;
   67.53 +import org.xml.sax.SAXException;
   67.54 +
   67.55 +/**
   67.56 + * Utility class collecting library methods related to XML processing.
   67.57 + * @author Petr Kuzel, Jesse Glick
   67.58 + */
   67.59 +final class XMLUtil extends Object {
   67.60 +
   67.61 +    private static final ThreadLocal/*<DocumentBuilder>*/[] builderTL = new ThreadLocal[4];
   67.62 +    static {
   67.63 +        for (int i = 0; i < 4; i++) {
   67.64 +            builderTL[i] = new ThreadLocal();
   67.65 +        }
   67.66 +    }
   67.67 +    public static Document parse (
   67.68 +            InputSource input, 
   67.69 +            boolean validate, 
   67.70 +            boolean namespaceAware,
   67.71 +            ErrorHandler errorHandler,             
   67.72 +            EntityResolver entityResolver
   67.73 +        ) throws IOException, SAXException {
   67.74 +        
   67.75 +        int index = (validate ? 0 : 1) + (namespaceAware ? 0 : 2);
   67.76 +        DocumentBuilder builder = (DocumentBuilder) builderTL[index].get();
   67.77 +        if (builder == null) {
   67.78 +            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
   67.79 +            factory.setValidating(validate);
   67.80 +            factory.setNamespaceAware(namespaceAware);
   67.81 +
   67.82 +            try {
   67.83 +                builder = factory.newDocumentBuilder();
   67.84 +            } catch (ParserConfigurationException ex) {
   67.85 +                throw new SAXException(ex);
   67.86 +            }
   67.87 +            builderTL[index].set(builder);
   67.88 +        }
   67.89 +        
   67.90 +        if (errorHandler != null) {
   67.91 +            builder.setErrorHandler(errorHandler);
   67.92 +        }
   67.93 +        
   67.94 +        if (entityResolver != null) {
   67.95 +            builder.setEntityResolver(entityResolver);
   67.96 +        }
   67.97 +        
   67.98 +        return builder.parse(input);
   67.99 +    }
  67.100 +    
  67.101 +    public static Document createDocument(String rootQName) throws DOMException {
  67.102 +        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  67.103 +        try {
  67.104 +            return factory.newDocumentBuilder().getDOMImplementation().createDocument(null, rootQName, null);
  67.105 +        } catch (ParserConfigurationException ex) {
  67.106 +            throw (DOMException)new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot create parser").initCause(ex); // NOI18N
  67.107 +        }
  67.108 +    }
  67.109 +    
  67.110 +    private static DOMImplementation getDOMImplementation() throws DOMException { //can be made public
  67.111 +        
  67.112 +        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  67.113 +    
  67.114 +        try {
  67.115 +            return factory.newDocumentBuilder().getDOMImplementation();
  67.116 +        } catch (ParserConfigurationException ex) {
  67.117 +            throw (DOMException)new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot create parser").initCause(ex); // NOI18N
  67.118 +        }        
  67.119 +    }
  67.120 +    
  67.121 +    public static void write(Document doc, OutputStream out) throws IOException {
  67.122 +        // XXX note that this may fail to write out namespaces correctly if the document
  67.123 +        // is created with namespaces and no explicit prefixes; however no code in
  67.124 +        // this package is likely to be doing so
  67.125 +        try {
  67.126 +            Transformer t = TransformerFactory.newInstance().newTransformer();
  67.127 +            DocumentType dt = doc.getDoctype();
  67.128 +            if (dt != null) {
  67.129 +                String pub = dt.getPublicId();
  67.130 +                if (pub != null) {
  67.131 +                    t.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, pub);
  67.132 +                }
  67.133 +                t.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, dt.getSystemId());
  67.134 +            }
  67.135 +            t.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); // NOI18N
  67.136 +            t.setOutputProperty(OutputKeys.INDENT, "yes"); // NOI18N
  67.137 +            t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); // NOI18N
  67.138 +            Source source = new DOMSource(doc);
  67.139 +            Result result = new StreamResult(out);
  67.140 +            t.transform(source, result);
  67.141 +        } catch (Exception e) {
  67.142 +            throw (IOException)new IOException(e.toString()).initCause(e);
  67.143 +        } catch (TransformerFactoryConfigurationError e) {
  67.144 +            throw (IOException)new IOException(e.toString()).initCause(e);
  67.145 +        }
  67.146 +    }
  67.147 +
  67.148 +    /**
  67.149 +     * Search for an XML element in the direct children of a parent.
  67.150 +     * DOM provides a similar method but it does a recursive search
  67.151 +     * which we do not want. It also gives a node list and we want
  67.152 +     * only one result.
  67.153 +     * @param parent a parent element
  67.154 +     * @param name the intended local name
  67.155 +     * @param namespace the intended namespace (or null)
  67.156 +     * @return the one child element with that name, or null if none or more than one
  67.157 +     */
  67.158 +    public static Element findElement(Element parent, String name, String namespace) {
  67.159 +        Element result = null;
  67.160 +        NodeList l = parent.getChildNodes();
  67.161 +        for (int i = 0; i < l.getLength(); i++) {
  67.162 +            if (l.item(i).getNodeType() == Node.ELEMENT_NODE) {
  67.163 +                Element el = (Element)l.item(i);
  67.164 +                if ((namespace == null && name.equals(el.getTagName())) ||
  67.165 +                    (namespace != null && name.equals(el.getLocalName()) &&
  67.166 +                                          namespace.equals(el.getNamespaceURI()))) {
  67.167 +                    if (result == null) {
  67.168 +                        result = el;
  67.169 +                    } else {
  67.170 +                        return null;
  67.171 +                    }
  67.172 +                }
  67.173 +            }
  67.174 +        }
  67.175 +        return result;
  67.176 +    }
  67.177 +    
  67.178 +    /**
  67.179 +     * Extract nested text from an element.
  67.180 +     * Currently does not handle coalescing text nodes, CDATA sections, etc.
  67.181 +     * @param parent a parent element
  67.182 +     * @return the nested text, or null if none was found
  67.183 +     */
  67.184 +    static String findText(Element parent) {
  67.185 +        NodeList l = parent.getChildNodes();
  67.186 +        for (int i = 0; i < l.getLength(); i++) {
  67.187 +            if (l.item(i).getNodeType() == Node.TEXT_NODE) {
  67.188 +                Text text = (Text)l.item(i);
  67.189 +                return text.getNodeValue();
  67.190 +            }
  67.191 +        }
  67.192 +        return null;
  67.193 +    }
  67.194 +    
  67.195 +    /**
  67.196 +     * Find all direct child elements of an element.
  67.197 +     * More useful than {@link Element#getElementsByTagNameNS} because it does
  67.198 +     * not recurse into recursive child elements.
  67.199 +     * Children which are all-whitespace text nodes or comments are ignored; others cause
  67.200 +     * an exception to be thrown.
  67.201 +     * @param parent a parent element in a DOM tree
  67.202 +     * @return a list of direct child elements (may be empty)
  67.203 +     * @throws IllegalArgumentException if there are non-element children besides whitespace
  67.204 +     */
  67.205 +    static List/*<Element>*/ findSubElements(Element parent) throws IllegalArgumentException {
  67.206 +        NodeList l = parent.getChildNodes();
  67.207 +        List/*<Element>*/ elements = new ArrayList(l.getLength());
  67.208 +        for (int i = 0; i < l.getLength(); i++) {
  67.209 +            Node n = l.item(i);
  67.210 +            if (n.getNodeType() == Node.ELEMENT_NODE) {
  67.211 +                elements.add((Element)n);
  67.212 +            } else if (n.getNodeType() == Node.TEXT_NODE) {
  67.213 +                String text = ((Text)n).getNodeValue();
  67.214 +                if (text.trim().length() > 0) {
  67.215 +                    throw new IllegalArgumentException("non-ws text encountered in " + parent + ": " + text); // NOI18N
  67.216 +                }
  67.217 +            } else if (n.getNodeType() == Node.COMMENT_NODE) {
  67.218 +                // OK, ignore
  67.219 +            } else {
  67.220 +                throw new IllegalArgumentException("unexpected non-element child of " + parent + ": " + n); // NOI18N
  67.221 +            }
  67.222 +        }
  67.223 +        return elements;
  67.224 +    }
  67.225 +    
  67.226 +}
    68.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/utils/cvsutils/CvsEntries.java	Sun Jan 28 18:54:08 2007 +0000
    68.3 @@ -0,0 +1,86 @@
    68.4 +/**
    68.5 + *
    68.6 + *  CLASS COPIED FROM NETBEANS
    68.7 + *
    68.8 + */
    68.9 +
   68.10 +/*
   68.11 + * The contents of this file are subject to the terms of the Common Development
   68.12 + * and Distribution License (the License). You may not use this file except in
   68.13 + * compliance with the License.
   68.14 + *
   68.15 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   68.16 + * or http://www.netbeans.org/cddl.txt.
   68.17 +
   68.18 + * When distributing Covered Code, include this CDDL Header Notice in each file
   68.19 + * and include the License file at http://www.netbeans.org/cddl.txt.
   68.20 + * If applicable, add the following below the CDDL Header, with the fields
   68.21 + * enclosed by brackets [] replaced by your own identifying information:
   68.22 + * "Portions Copyrighted [year] [name of copyright owner]"
   68.23 + *
   68.24 + * The Original Software is NetBeans. The Initial Developer of the Original
   68.25 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   68.26 + * Microsystems, Inc. All Rights Reserved.
   68.27 + */
   68.28 +
   68.29 +/************************************************************************
   68.30 +
   68.31 +        FILENAME: CvsEntries.java
   68.32 +
   68.33 +        AUTHOR: Erica Grevemeyer      DATE: Jan  7 11:21:09 PST 2002
   68.34 +
   68.35 +************************************************************************/
   68.36 +package org.netbeans.modules.visualweb.ravebuild.utils.cvsutils;
   68.37 +
   68.38 +import java.io.*;
   68.39 +import java.util.*;
   68.40 +
   68.41 +/** Read a specified CVS/Entries style file, 
   68.42 + * as Entries & store the collection of Entries
   68.43 + * in the passed-in Hashtable.  If no 'separator' string
   68.44 + * is passed then a 'blankspace' separator is assumed.
   68.45 + * 
   68.46 + * @author Erica Grevemeyer
   68.47 + * @version  1.1	Jan  7 11:21:09 PST 200
   68.48 + */
   68.49 +
   68.50 +public class CvsEntries {
   68.51 +
   68.52 +	private java.util.HashMap hash = new java.util.HashMap();
   68.53 +	private static final String DEFAULT_CVS_ENTRIES_FILENAME = "CVS/Entries";
   68.54 +
   68.55 +	// Constructors 
   68.56 +	public CvsEntries(String directoryPath) {
   68.57 +            this(directoryPath, DEFAULT_CVS_ENTRIES_FILENAME);
   68.58 +	}
   68.59 +	
   68.60 +
   68.61 +	public CvsEntries(String directoryPath, String fileName) {
   68.62 +		try {
   68.63 +			String entriesFile = directoryPath + "/" + fileName;
   68.64 +			BufferedReader inBuff = new BufferedReader(new FileReader(new File(entriesFile)));
   68.65 +			Entry e;
   68.66 +			
   68.67 +			String line;
   68.68 +
   68.69 +			while ((line = inBuff.readLine()) != null) {
   68.70 +				e = new Entry(line);
   68.71 +				if ( ! e.getFiletype().equals("D") ) {
   68.72 +					hash.put(e.getFilename(), e);
   68.73 +				}
   68.74 +			}
   68.75 +		
   68.76 +		} catch(IOException e) {
   68.77 +			System.out.println("Error: " + e.toString());	
   68.78 +		}
   68.79 +	}
   68.80 +        
   68.81 +	public String getRevnoByFileName(String fileName) {
   68.82 +		Entry e = (Entry)hash.get(fileName);
   68.83 +		if (e == null ) {
   68.84 +			return null;
   68.85 +		} else {
   68.86 +			return e.getRevno();
   68.87 +			}
   68.88 +	}
   68.89 +}
    69.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.2 +++ b/visualweb/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/utils/cvsutils/Entry.java	Sun Jan 28 18:54:08 2007 +0000
    69.3 @@ -0,0 +1,166 @@
    69.4 +/**
    69.5 + *
    69.6 + *  CLASS COPIED FROM NETBEANS
    69.7 + *
    69.8 + */
    69.9 +
   69.10 +/*
   69.11 + * The contents of this file are subject to the terms of the Common Development
   69.12 + * and Distribution License (the License). You may not use this file except in
   69.13 + * compliance with the License.
   69.14 + *
   69.15 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   69.16 + * or http://www.netbeans.org/cddl.txt.
   69.17 +
   69.18 + * When distributing Covered Code, include this CDDL Header Notice in each file
   69.19 + * and include the License file at http://www.netbeans.org/cddl.txt.
   69.20 + * If applicable, add the following below the CDDL Header, with the fields
   69.21 + * enclosed by brackets [] replaced by your own identifying information:
   69.22 + * "Portions Copyrighted [year] [name of copyright owner]"
   69.23 + *
   69.24 + * The Original Software is NetBeans. The Initial Developer of the Original
   69.25 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   69.26 + * Microsystems, Inc. All Rights Reserved.
   69.27 + */
   69.28 +
   69.29 +/************************************************************************
   69.30 +
   69.31 +        FILENAME: Entry.java
   69.32 +
   69.33 +        AUTHOR: Erica Grevemeyer      DATE: Jan  7 11:21:09 PST 2002
   69.34 +
   69.35 +************************************************************************/
   69.36 +package org.netbeans.modules.visualweb.ravebuild.utils.cvsutils;
   69.37 +
   69.38 +import java.util.*;
   69.39 +
   69.40 +/**
   69.41 + *	This CVS utility class will parse a single line in a 
   69.42 + *	CVS/Entries file.
   69.43 + *
   69.44 + *   @author Erica Grevemeyer
   69.45 + *   @version  1.1 Jan  7 11:21:09 PST 2002
   69.46 + */
   69.47 +
   69.48 +public class Entry {
   69.49 +	private static final String DEFAULT_SEPARATOR = "/";
   69.50 +	private String filename, filetype, revno, timestamp;
   69.51 +
   69.52 +	// Constructor Methods
   69.53 +	/** Create an Entry instance when all information is already available.
   69.54 +	* @param ft - File type. (Value will be either "F" or "D" indicating file or directory).
   69.55 +	* @param fn - filename listed in the entry
   69.56 +	* @param revno - latest revision number listedx.
   69.57 +	* @param ts - the time stamp string. (ex. Sat Dec 22 00:31:24 2001)
   69.58 +    * This may have additional information if the file is not up to date.
   69.59 +	*/
   69.60 +	public Entry(String ft, String fn, String revno, String ts) {
   69.61 +		setFiletype(ft);
   69.62 +		setFilename(fn);
   69.63 +		setRevno(revno);
   69.64 +		setTimestamp(ts);
   69.65 +	}
   69.66 +
   69.67 +	/**
   69.68 +	* @param line - line from the read in file. 
   69.69 +	* @param separator - separator used in this file.  CVS generated files will use &quot;/&quot; 
   69.70 +	*/
   69.71 +	public Entry(String line, String separator) {
   69.72 +	/*
   69.73 +		We use the separator here instead of always 
   69.74 +		defaulting to CVS's "/" so that we can use 
   69.75 +		this class to parse files which are 
   69.76 +		organized the same way, but don't use the '/'.
   69.77 +
   69.78 +	*/ 
   69.79 +		StringTokenizer st = new StringTokenizer(line, separator);
   69.80 +
   69.81 +		int index = 0;
   69.82 +		String[] item=new String[6];
   69.83 +
   69.84 +		while (st.hasMoreTokens()) {
   69.85 +			String ftstr = ""; 
   69.86 +			String tok = st.nextToken();
   69.87 +			
   69.88 +			//  Typical CVS/Entries file lines:
   69.89 +			//   D/dirname////
   69.90 +			//  /filename/1.3/Sat Dec 22 00:31:24 2001//
   69.91 +
   69.92 +			if (index == 0 ) {
   69.93 +				if ( ! tok.equals("D") ) {
   69.94 +					item[index++]="F";
   69.95 +				}
   69.96 +			}
   69.97 +			item[index++]=tok;
   69.98 +			//item[0] = filetype
   69.99 +			//item[1] = filename
  69.100 +			//item[2] = revno
  69.101 +			//item[3] = timestamp
  69.102 +			//item[4] = other
  69.103 +			//item[5] = other1
  69.104 +
  69.105 +		} //while more tokens
  69.106 +		this.setFiletype(item[0]);
  69.107 +		this.setFilename(item[1]);
  69.108 +		this.setRevno(item[2]);
  69.109 +		this.setTimestamp(item[3]);
  69.110 +		
  69.111 +	}
  69.112 +        
  69.113 +	public Entry(String line) {
  69.114 +		this(line, DEFAULT_SEPARATOR);
  69.115 +	}
  69.116 +	
  69.117 +	public boolean hasName(String queryFilename) {	
  69.118 +		return this.getFilename().trim().equals(queryFilename.trim());
  69.119 +	}	
  69.120 +
  69.121 +	//Display Methods
  69.122 +	public String toString() {
  69.123 +		String fn, ft, revno, ts;
  69.124 +
  69.125 +		fn=this.getFilename();
  69.126 +		ft=this.getFiletype();
  69.127 +		revno=this.getRevno();
  69.128 +		ts=this.getTimestamp();
  69.129 +
  69.130 +		String fullEntry="FileName:\t"
  69.131 +			+fn+"\nFileType:\t"+ft +"\nRevno:\t"+revno
  69.132 +			+"\nTimeStamp:\t" +ts+"\n";
  69.133 +		return fullEntry;	
  69.134 +	}
  69.135 +
  69.136 +	// Accessor Methods
  69.137 +	public void setFilename(String str) {
  69.138 +		this.filename=str;
  69.139 +	}	
  69.140 +
  69.141 +	public String getFilename() {
  69.142 +		return filename;
  69.143 +	}	
  69.144 +
  69.145 +	public void setFiletype(String str) {
  69.146 +		this.filetype=str;
  69.147 +	}	
  69.148 +
  69.149 +	public String getFiletype() {
  69.150 +		return filetype;
  69.151 +	}	
  69.152 +
  69.153 +	public void setRevno(String str) {
  69.154 +		this.revno=str;
  69.155 +	}	
  69.156 +
  69.157 +	public String getRevno() {
  69.158 +		return revno;
  69.159 +	}	
  69.160 +
  69.161 +	public void setTimestamp(String str) {
  69.162 +		this.timestamp=str;
  69.163 +	}	
  69.164 +
  69.165 +	public String getTimestamp() {
  69.166 +		return timestamp;
  69.167 +	}	
  69.168 +	
  69.169 +}
    70.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.2 +++ b/visualweb/ravebuild/build.properties	Sun Jan 28 18:54:08 2007 +0000
    70.3 @@ -0,0 +1,23 @@
    70.4 +# The contents of this file are subject to the terms of the Common Development
    70.5 +# and Distribution License (the License). You may not use this file except in
    70.6 +# compliance with the License.
    70.7 +#
    70.8 +# You can obtain a copy of the License at http://www.netbeans.org/cddl.html
    70.9 +# or http://www.netbeans.org/cddl.txt.
   70.10 +
   70.11 +# When distributing Covered Code, include this CDDL Header Notice in each file
   70.12 +# and include the License file at http://www.netbeans.org/cddl.txt.
   70.13 +# If applicable, add the following below the CDDL Header, with the fields
   70.14 +# enclosed by brackets [] replaced by your own identifying information:
   70.15 +# "Portions Copyrighted [year] [name of copyright owner]"
   70.16 +#
   70.17 +# The Original Software is NetBeans. The Initial Developer of the Original
   70.18 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   70.19 +# Microsystems, Inc. All Rights Reserved.
   70.20 +
   70.21 +# This property is used when merging the forked module sources to the netbeans 
   70.22 +# source directory. The list should contain the names of sparse cvs modules.
   70.23 +# Only changed files should be contained in our sparse modules! If a file has size == 0,
   70.24 +# the corresponding file will be removed from the original NB source!!
   70.25 +# Look at the j2ee or j2eeserver modules as examples.
   70.26 +#netbeans.forked.modules=libs,xml
    71.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.2 +++ b/visualweb/ravebuild/build.xml	Sun Jan 28 18:54:08 2007 +0000
    71.3 @@ -0,0 +1,1196 @@
    71.4 +<?xml version='1.0' encoding='ISO-8859-1' ?>
    71.5 +<!--
    71.6 +The contents of this file are subject to the terms of the Common Development
    71.7 +and Distribution License (the License). You may not use this file except in
    71.8 +compliance with the License.
    71.9 +
   71.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   71.11 +or http://www.netbeans.org/cddl.txt.
   71.12 +
   71.13 +When distributing Covered Code, include this CDDL Header Notice in each file
   71.14 +and include the License file at http://www.netbeans.org/cddl.txt.
   71.15 +If applicable, add the following below the CDDL Header, with the fields
   71.16 +enclosed by brackets [] replaced by your own identifying information:
   71.17 +"Portions Copyrighted [year] [name of copyright owner]"
   71.18 +
   71.19 +The Original Software is NetBeans. The Initial Developer of the Original
   71.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   71.21 +Microsystems, Inc. All Rights Reserved.
   71.22 +=======
   71.23 +Visual Web top level build script.
   71.24 +-->
   71.25 +<project name="ravebuild" default="build" basedir=".">
   71.26 +
   71.27 +    <!-- XXX Also like in nbbuild, allow to specify user properties in ravebuild-->
   71.28 +    <!-- First things first: read the user's and/or -->
   71.29 +    <!-- the site's build properties files.         -->
   71.30 +    <property file="${basedir}/user.build.properties"/>
   71.31 +    <property file="${basedir}/build.properties"/>
   71.32 +    <import file="${basedir}/default-rave-properties.xml"/>    
   71.33 +
   71.34 +    <property name="build.compiler.debug" value="true"/>
   71.35 +    <property name="build.compiler.deprecation" value="true"/>
   71.36 +    <!-- Jar options -->
   71.37 +    <property name="build.package.compress" value="false"/>
   71.38 +    <property name="build.package.index" value="true"/>
   71.39 +
   71.40 +    <!-- Overriding test.user.dir -->
   71.41 +    <property name="test.user.dir" location="${basedir}/testuserdir"/>
   71.42 +    
   71.43 +    <!-- Used for NBM builds -->
   71.44 +    <property name="dist.base" value="www.sun.com/download/nbms"/>
   71.45 +    <property name="homepage.base" value="sun.com"/>
   71.46 +    <property name="nbm_alias" value="creator_ide"/>
   71.47 +    <property name="makenbm.override.url" value="http://www.sun.com/software/products/jscreator"/>
   71.48 +    <property name="nbm.is.global" value="true"/>
   71.49 +    
   71.50 +    <!-- Needed to be set this way, otherwise they are not initialized when init is running,
   71.51 +    which caused sanity-start to fail on unix, investigate -->
   71.52 +    <property name="sanitystart.args.additional" value=""/>
   71.53 +    <property name="sanitystart.args" value="-J-Dnetbeans.close=true ${sanitystart.args.additional}"/>
   71.54 +    
   71.55 +    <target name="bootstrap">
   71.56 +        <mkdir dir="${basedir}/build/antclasses"/>
   71.57 +        <javac srcdir="${basedir}/antsrc" destdir="${basedir}/build/antclasses" deprecation="true" debug="${build.compiler.debug}" source="1.4">
   71.58 +            <classpath path="${ant.home}/lib/ant.jar"/>
   71.59 +        </javac>
   71.60 +        <jar jarfile="${basedir}/raveantext.jar" basedir="${basedir}/build/antclasses">
   71.61 +            <exclude name="**/*.java"/>
   71.62 +            <exclude name="package-list"/>
   71.63 +        </jar>
   71.64 +         
   71.65 +        <taskdef name="for-each" 
   71.66 +         classname="org.netbeans.modules.visualweb.ravebuild.ForEach" 
   71.67 +         classpath="${rave_all}/ravebuild/raveantext.jar"/>
   71.68 +        <taskdef name="for-each-xsl"
   71.69 +        classname="org.netbeans.modules.visualweb.ravebuild.ForEachXsl"
   71.70 +        classpath="${rave_all}/ravebuild/raveantext.jar"/>
   71.71 +    </target>
   71.72 +    
   71.73 +    <target name="-check-netbeans-build" depends="merge-forked-modules">
   71.74 +      <condition property="skip.netbeans.build" value="true">
   71.75 +        <and>
   71.76 +          <or>
   71.77 +            <isset property="no.forked.modules"/>
   71.78 +            <isset property="no.new.merge"/>
   71.79 +          </or>
   71.80 +          <available file="${nb.src.dir}/merge_timestamps/build.ts"/>
   71.81 +          <available file="${nb.src.dir}/nbbuild/netbeans/platform6/lib/boot.jar"/>
   71.82 +        </and>
   71.83 +      </condition>
   71.84 +      <echo message="skip.netbeans.build= ${skip.netbeans.build}"/>
   71.85 +
   71.86 +      <property name="netbeans.location" location="${nb.src.dir}/nbbuild/netbeans"/>
   71.87 +    </target>
   71.88 +
   71.89 +    <target name="-check-netbeans-copy" depends="-check-netbeans-build">
   71.90 +      <condition property="skip.netbeans.copy" value="true">
   71.91 +        <and>
   71.92 +            <available file="${netbeans.dest.dir}/bin/netbeans"/>
   71.93 +        </and>
   71.94 +      </condition>
   71.95 +      <echo message="skip.netbeans.copy= ${skip.netbeans.copy}"/>
   71.96 +    </target>
   71.97 +
   71.98 +    <target name="prepare-netbeans-dest-dir" depends="-check-netbeans-copy, init"
   71.99 +        unless="skip.netbeans.copy">
  71.100 +        <mkdir dir="${netbeans.dest.dir}"/>
  71.101 +        <copy overwrite="true" todir="${netbeans.dest.dir}">
  71.102 +            <fileset dir="${netbeans.location}" includes="**"/>
  71.103 +        </copy>
  71.104 +        <chmod perm="755" file="${netbeans.dest.dir}/bin/netbeans"/>
  71.105 +        <property name="cluster.location" location="${netbeans.dest.dir}/visualweb1"/>
  71.106 +        <echo append="true" file="${netbeans.dest.dir}/etc/netbeans.clusters">visualweb1${line.separator}</echo>
  71.107 +    </target>
  71.108 +    
  71.109 +    <target name="build-netbeans" depends="-check-netbeans-build,init"
  71.110 +        unless="skip.netbeans.build">
  71.111 +      <delete file="${nb.src.dir}/merge_timestamps/build.ts" failonerror="false"/>
  71.112 +      <ant antfile="${nb.src.dir}/nbbuild/build.xml" target="build-nozip" inheritall="false"/>
  71.113 +      <touch file="${nb.src.dir}/merge_timestamps/build.ts"/>
  71.114 +    </target>
  71.115 +    
  71.116 +    <target name="build-nbm-pack" depends="init,setup-nbm-signing,load-nbm-password" description="Builds all creator modules into nbms">
  71.117 +        <delete dir="nbms"/>
  71.118 +        <mkdir dir="nbms" />
  71.119 +        <loadproperties srcFile="../visualwebsuite/nbproject/project.properties">
  71.120 +           <filterchain>
  71.121 +                 <tokenfilter>
  71.122 +                   <!--deletecharacters chars=".."/-->
  71.123 +                   <replacestring from=".." to=""/>
  71.124 +                 </tokenfilter>
  71.125 +             </filterchain>      
  71.126 +        </loadproperties>
  71.127 +       <!-- <echo message="Modules = ${modules}"/>-->
  71.128 +       <for-each startdir=".." target="nbm" locations="${modules}">
  71.129 +            <property name="nbm.target.dir" value="${basedir}/nbms"/>
  71.130 +            <property name="license.file" location="${rave_all}/ravebuild/visualweb-nbm-license.txt"/>
  71.131 +            <property name="nbm.is.global" value="true"/>
  71.132 +            <property name="homepage.base" value="sun.com"/>
  71.133 +            <property name="makenbm.override.url" value="http://www.netbeans.org/products/visualweb/index.html"/> 
  71.134 +            <property name="keystore" value="${keystore}"/>
  71.135 +            <property name="storepass" value="${storepass}"/>
  71.136 +            <property name="nbm_alias" value="visualweb_ide"/>
  71.137 +       </for-each>
  71.138 +    </target>
  71.139 +    <target name="nbm"/><!-- dummy target -->
  71.140 +    
  71.141 +    <target name="fix-all-licenses" depends="init">
  71.142 +        <loadproperties srcFile="../visualwebsuite/nbproject/project.properties">
  71.143 +           <filterchain>
  71.144 +                 <tokenfilter>
  71.145 +                   <!--deletecharacters chars=".."/-->
  71.146 +                   <replacestring from=".." to=""/>
  71.147 +                 </tokenfilter>
  71.148 +             </filterchain>      
  71.149 +        </loadproperties>
  71.150 +        <for-each-xsl startdir=".." locations="${modules}"/>
  71.151 +        <for-each startdir=".." target="fix-license" locations="${modules}" inheritall="false"/>
  71.152 +        <!--
  71.153 +        <for-each-xsl startdir=".." locations="xhtml"/>
  71.154 +        <for-each startdir=".." target="fix-license" locations="xhtml" inheritall="false"/>
  71.155 +        -->
  71.156 +    </target>
  71.157 +    
  71.158 +    <target name="fix-all-library-licenses" depends="init">
  71.159 +         <loadproperties srcFile="../visualwebsuite/nbproject/project.properties">
  71.160 +           <filterchain>
  71.161 +                 <tokenfilter>
  71.162 +                   <!--deletecharacters chars=".."/-->
  71.163 +                   <replacestring from=".." to=""/>
  71.164 +                 </tokenfilter>
  71.165 +             </filterchain>      
  71.166 +        </loadproperties>
  71.167 +        <for-each-xsl startdir=".." locations="${modules}" suffix="library"/>
  71.168 +        <for-each startdir=".." target="fix-license" locations="${modules}" suffix="library" inheritall="false" skipnonexistentdir="true">
  71.169 +            <property name="suite.dir" location="${basedir}/../visualwebsuite"/>
  71.170 +        </for-each>
  71.171 +    </target>
  71.172 +    
  71.173 +    <target name="-check-forked-modules">
  71.174 +        <condition property="no.forked.modules">
  71.175 +            <equals trim="true" arg1="${netbeans.forked.modules}" arg2=""/>
  71.176 +        </condition>
  71.177 +    </target>
  71.178 +    
  71.179 +    <target name="merge-forked-modules" depends="-check-forked-modules,init"
  71.180 +        unless="no.forked.modules">
  71.181 +      <mkdir dir="${nb.src.dir}/merge_timestamps"/>
  71.182 +      <subant target="merge" genericantfile="${basedir}/merge-forked-modules.xml">
  71.183 +        <property name="rave_all" value="${rave_all}"/>
  71.184 +        <property name="nb.src.dir" value="${nb.src.dir}"/>
  71.185 +        <dirset dir="${rave_all}" includes="${netbeans.forked.modules}"/>
  71.186 +      </subant>
  71.187 +      <uptodate property="no.new.merge">
  71.188 +        <srcfiles dir="${nb.src.dir}/merge_timestamps" includes="module.*.ts"/>
  71.189 +        <mapper type="merge" to="${nb.src.dir}/nbbuild/netbeans/moduleCluster.properties"/>
  71.190 +      </uptodate>
  71.191 +    </target>
  71.192 +
  71.193 +    <target name="unzip-netbeans-bin" depends="init" unless="netbeans.bin.unzipped">
  71.194 +        <mkdir dir="${basedir}/build"/>
  71.195 +        <unzip overwrite="true" src="${cache.dir}/${nb.bin.zip}" dest="${basedir}"/>
  71.196 +        <property name="netbeans.location" location="${basedir}/netbeans"/>
  71.197 +        <property name="netbeans.bin.unzipped" value="true"/>
  71.198 +    </target>
  71.199 +    
  71.200 +    <!-- Overriding all target.
  71.201 +    Reason: removing commit-validation, adding sanity-start -->
  71.202 +    <!-- Removed sanity-start for now to avoid all the ide exceptions in the visualweb module -->
  71.203 +    <target name="all" depends="build-zip" description="Build the IDE, run basic validation tests, start the IDE, and create the zip"/>
  71.204 +    
  71.205 +    <!-- All target without zipping the IDE -->
  71.206 +    <!-- Removed sanity-start for now to avoid all the ide exceptions in the visualweb module -->
  71.207 +    <target name="all-nozip" depends="build" description="Build the IDE, run basic validation tests, and start the IDE"/>
  71.208 +    
  71.209 +    <target name="build" depends="prepare-netbeans-dest-dir, copy-jdk" description="Build the IDE, run basic validation tests, and start the IDE">
  71.210 +        <ant antfile="../visualwebsuite/build.xml" target="build" inheritall="false"/>
  71.211 +        <echo file="${basedir}/rave/visualweb1/build-number">${buildnumber}</echo>
  71.212 +        <!-- ant antfile="../idesuite/build.xml" target="build" inheritall="false"/ -->
  71.213 +        <!-- echo file="${basedir}/rave/raveide2.0/build-number">${buildnumber}</echo -->
  71.214 +    </target>
  71.215 +
  71.216 +    <!--
  71.217 +    <target name="rebuild-netbeans" description="(Re)builds Netbeans from the source distribution">
  71.218 +        <antcall target="prepare-netbeans-dest-dir" inheritall="true">
  71.219 +            <param name="force.netbeans.rebuild" value="true"/>
  71.220 +        </antcall>
  71.221 +    </target>
  71.222 +    -->
  71.223 +    
  71.224 +    <target name="-suite-clean">
  71.225 +        <available file="${basedir}/rave/harness/suite.xml" property="harness.available"/>
  71.226 +    </target>
  71.227 +    
  71.228 +    <target name="suite-clean" depends="init, -suite-clean" description="Cleans the module suite only" if="harness.available">
  71.229 +        <!-- ant antfile="../idesuite/build.xml" target="clean" inheritall="false"/ -->
  71.230 +        <ant antfile="../visualwebsuite/build.xml" target="clean" inheritall="false"/>
  71.231 +    </target>
  71.232 +    
  71.233 +    <target name="ravebuild-clean">
  71.234 +        <delete dir="build"/>
  71.235 +        <delete file="raveantext.jar" failonerror="false" deleteonexit="true"/>
  71.236 +    </target>
  71.237 +    
  71.238 +    <target name="nb-platform-clean">
  71.239 +        <ant antfile="netbeans-src/nbbuild/build.xml" target="clean" inheritall="false"/>
  71.240 +      <delete file="${nb.src.dir}/merge_timestamps/build.ts"/>
  71.241 +    </target>
  71.242 +    
  71.243 +    <target name="test-clean">
  71.244 +    <!-- XXX Fix this later
  71.245 +        <ant antfile="../test/build.xml" target="clean" inheritall="false"/>
  71.246 +    -->
  71.247 +    </target>
  71.248 +
  71.249 +    <target name="clean" depends="init, suite-clean, ravebuild-clean, test-clean" description="Cleans build products">
  71.250 +        <delete dir="rave" deleteonexit="true"/>
  71.251 +    </target>
  71.252 +    
  71.253 +    <!-- Overriding set-buildnumber target.
  71.254 +    Reason: Different format (property would be better) -->
  71.255 +    <target name="set-buildnumber" unless="buildnumber">
  71.256 +        <tstamp>
  71.257 +            <format property="buildnumber" pattern="yyMMdd-HHmm"/>
  71.258 +        </tstamp> 
  71.259 +    </target>
  71.260 +
  71.261 +    <target name="-validate-cache">
  71.262 +        <condition property="netbeans.bin.available">
  71.263 +            <or>
  71.264 +                <available file="${netbeans.location}/bin/netbeans"/>
  71.265 +                <isset property="bypass.cache.validation"/>
  71.266 +            </or>
  71.267 +        </condition>
  71.268 +        
  71.269 +        <fail unless="netbeans.bin.available">
  71.270 +            Netbeans binary under ${netbeans.location} could not be found.  A cache update may be needed.
  71.271 +        </fail>
  71.272 +
  71.273 +        <condition property="jdk.available">
  71.274 +            <or>
  71.275 +                <available file="${basedir}/ship-java/COPYRIGHT"/>
  71.276 +                <os family="mac"/>
  71.277 +                <isset property="bypass.cache.validation"/>
  71.278 +            </or>
  71.279 +        </condition>
  71.280 +        
  71.281 +        <fail unless="jdk.available">
  71.282 +            The bundled version of the JVM under ${basedir}/ship-java could not be found.  A cache update may be needed.
  71.283 +        </fail>
  71.284 +    </target>
  71.285 +    
  71.286 +    <!-- Overriding init target.
  71.287 +    Reason: Adding setup-nbm-signing targets
  71.288 +    and setup of buildnum and nbm.target.dir properties -->
  71.289 +    <target name="init" depends="-validate-cache, set-buildnumber, bootstrap">
  71.290 +        <property name="buildnum" value="ide-${buildnumber}"/>
  71.291 +        <property name="sanitystart.args" value="-J-Dnetbeans.close=true ${sanitystart.args.additional}"/>
  71.292 +        <!-- Adding new value -->
  71.293 +        <property name="nbm.target.dir" location="nbms" />
  71.294 +        <condition property="isMacOSX">
  71.295 +            <os family="mac"/>
  71.296 +        </condition>
  71.297 +    </target>
  71.298 +
  71.299 +    <!-- Overriging sanity-start target.
  71.300 +    Reason: To match the ravebuild/rave dir (not able to parametrize) -->
  71.301 +    <target name="sanity-start" depends="init,maybe-build-nozip">
  71.302 +        <mkdir dir="${test.user.dir}"/>
  71.303 +        <echo>Starting the IDE as a sanity check...</echo>
  71.304 +        <!-- XXX better would be to scan start log for stacktraces and just show those; -->
  71.305 +        <!-- possibly after filtering for duplicates or something like this. -->
  71.306 +        <!-- Timeout is ten minutes; should be enough for valid start, while preventing -->
  71.307 +        <!-- a deadlock from hanging an automated build: -->
  71.308 +        <exec os="Windows NT Windows 95 Windows 98 Windows 2000 Windows XP" executable="${netbeans.dest.dir}/bin/netbeans.exe" failonerror="yes" timeout="600000">
  71.309 +            <arg value="-jdkhome"/>
  71.310 +            <arg file="${jdkhome}"/>
  71.311 +            <arg value="-userdir"/>
  71.312 +            <arg file="${test.user.dir}"/>
  71.313 +            <arg line="${sanitystart.args}"/>
  71.314 +        </exec>
  71.315 +        <exec os="Linux SunOS Solaris" dir="." executable="sh" failonerror="yes" timeout="600000">
  71.316 +            <arg value="${netbeans.dest.dir}/bin/netbeans"/>
  71.317 +            <arg value="-jdkhome"/>
  71.318 +            <arg file="${jdkhome}"/>
  71.319 +            <arg value="-userdir"/>
  71.320 +            <arg file="${test.user.dir}"/>
  71.321 +            <arg line="${sanitystart.args}"/>
  71.322 +        </exec>
  71.323 +	<exec os="Mac OS X" dir="." executable="sh" failonerror="yes" timeout="600000">
  71.324 +            <arg value="${netbeans.dest.dir}/bin/netbeans"/>
  71.325 +            <arg value="-userdir"/>
  71.326 +            <arg file="${test.user.dir}"/>
  71.327 +            <arg line="${sanitystart.args}"/>
  71.328 +        </exec>
  71.329 +        <echo>Finished starting the IDE, pay attention to any reported errors.</echo>
  71.330 +    </target>
  71.331 +    
  71.332 +    <!-- Overriding build target.
  71.333 +    Reason: to be able customize the destination and prefix (not able now). -->
  71.334 +    <target name="build-zip" depends="build-nozip,copy-jdk"
  71.335 +            description="Create a complete build including a ZIP distribution (but do not try it).">
  71.336 +        <!-- zip task not well suited to making final build, as it does not set +x bits -->
  71.337 +        <!-- so on Unix try to use native ZIP first -->
  71.338 +        <delete file="${rave.zip.dest}/RAVE-${buildnum}.zip"/>
  71.339 +
  71.340 +        <!-- package the zip file -->
  71.341 +        <zip destfile="${rave.zip.dest}/RAVE-${buildnum}.zip" update="true" duplicate="preserve">
  71.342 +            <zipfileset file="${netbeans.dest.dir}/bin/creator" filemode="755" prefix="${rave.zip.prefix}/bin"/>
  71.343 +            <zipfileset file="${netbeans.dest.dir}/platform6/lib/nbexec" filemode="755" prefix="${rave.zip.prefix}/platform6/lib"/>
  71.344 +            <zipfileset file="${netbeans.dest.dir}" filemode="755" prefix="${rave.zip.prefix}">
  71.345 +                <include name="*.sh"/>
  71.346 +            </zipfileset>
  71.347 +            <zipfileset dir="${netbeans.dest.dir}" prefix="${rave.zip.prefix}">
  71.348 +                <exclude name="*.built" />
  71.349 +            </zipfileset>
  71.350 +        </zip>
  71.351 +        <echo>Build created; see RAVE-${buildnum}.zip (in ravebuild/).
  71.352 +If you like, you may run the IDE straight from
  71.353 +the ${netbeans.dest.dir}/bin/ directory.
  71.354 +(For example, type: ant tryme)
  71.355 +        </echo>
  71.356 +    </target>
  71.357 +    
  71.358 +    
  71.359 +    <!-- Overriding build-nbms target.
  71.360 +    Reason: adding deletion of nbms dir -->
  71.361 +    <target name="build-nbms" depends="init">
  71.362 +        <delete dir="nbms"/>
  71.363 +<!--        <ant antfile="${nb.src.dir}/nbbuild/build.xml" target="build-nbms" inheritall="false"/> -->
  71.364 +        <!-- Does not work <antcall target="nbbuild.build-nbms"/> -->
  71.365 +    </target>
  71.366 +
  71.367 +    <!-- Overriding l10n-kit target.
  71.368 +    Reason: Using diff module list. -->
  71.369 +   
  71.370 +    <delete dir="l10n-tmp"/>
  71.371 +    <target name="grab" depends="init"
  71.372 +            description="Grabs localizable files into l10n-tmp">
  71.373 +	<taskdef name="grabLocalizableFiles" classname="com.sun.rave.ravebuild.GetLocalizableFiles" classpath="${basedir}/raveantext.jar"/>
  71.374 +	<grabLocalizableFiles listfile="l10n.list" basedir=".." targetdir="l10n-tmp" modulelist="true"/>
  71.375 +  </target>
  71.376 +
  71.377 +    <target name="l10n-kit" depends="init,grab">
  71.378 +        <taskdef name="l10n" classname="com.sun.rave.ravebuild.L10nTask"
  71.379 +                classpath="${basedir}/raveantext.jar"/>
  71.380 +        <delete dir="${l10n.dist.dir}"/>
  71.381 +        <mkdir dir="${l10n.dist.dir}"/>
  71.382 +        <delete dir="tmp"/>
  71.383 +        <mkdir dir="tmp"/>
  71.384 +        <property name="nbroot" location=".."/>
  71.385 +        <!-- Make sure you call with the right configuration here to get modules populated correctly -->
  71.386 +        <property name="l10n-modules" value="installer,${allmodules}"/> 
  71.387 +        <l10n topdirs="${nbroot}" modules="${l10n-modules}"
  71.388 +            localizablefile="l10n.list" generatedfile="l10n.list.translated"
  71.389 +            distdir="${l10n.dist.dir}" changedfile="l10n.list.changed"
  71.390 +            builddir="tmp" buildnumber="${buildnumber}"
  71.391 +            excludepattern="**/ja/,**/*_ja.*"/>
  71.392 +        <delete dir="tmp"/>
  71.393 +    </target>
  71.394 +
  71.395 +    <!-- FIXME Overriding check-for-build target.
  71.396 +    Reason: To reflect changed target location. -->    
  71.397 +    <target name="check-for-build">
  71.398 +        <available property="have-build" file="${netbeans.dest.dir}/bin/netbeans"/>
  71.399 +    </target>
  71.400 +    <!-- Overriding maybe-build-nozip target.
  71.401 +    Reason: To launch with correct basedir and target context. -->
  71.402 +    <target name="maybe-build-nozip" depends="check-for-build" unless="have-build">
  71.403 +        <ant dir="${basedir}" target="build-nozip"/>
  71.404 +    </target>
  71.405 +        
  71.406 +
  71.407 +    <!-- Overriding build-nozip target.
  71.408 +    Reason: Overriding cluster.properties file, removing netbeans.conf, using creator.conf
  71.409 +    and adding creator launchers -->
  71.410 +    <target name="build-nozip" depends="build">
  71.411 +    </target>
  71.412 +
  71.413 +    <!-- target used by Rave build -->
  71.414 +    <!-- Zip up the NBMs for release -->
  71.415 +    <target name="zip-nbms" depends="init">
  71.416 +        <!-- Zip up all the other nbms and store in dist.dir -->
  71.417 +
  71.418 +	<!-- This is the old way to creating NBM zip. -->
  71.419 +	<!-- But this does not create NBM zip on Windows -->
  71.420 +        <!-- <exec os="Solaris SunOS Linux Mac OS X" executable="zip" dir="${nbm.target.dir}" failonerror="false">
  71.421 +            <arg line="-9"/>
  71.422 +            <arg line="-r"/>
  71.423 +            <arg line="RAVE-${buildnum}-nbms.zip"/>
  71.424 +            <arg line="."/>
  71.425 +            <arg line="-i"/>
  71.426 +            <arg line="*"/>
  71.427 +        </exec>
  71.428 +        <move file="${nbm.target.dir}/RAVE-${buildnum}-nbms.zip"
  71.429 +        tofile="${basedir}/RAVE-${buildnum}-nbms-test.zip"/> -->
  71.430 +
  71.431 +	<!-- Using ANT zip to create NBM zips on all platforms -->
  71.432 +	<zip destfile="${basedir}/RAVE-${buildnum}-nbms.zip">
  71.433 +    	    <zipfileset dir="${nbm.target.dir}" includes="*.nbm"/>
  71.434 +  	</zip>	
  71.435 +        <!-- Cleanup the temporary directory. -->
  71.436 +    </target>
  71.437 +
  71.438 +    <!-- This will read the NBM signing values from the cache if possible. -->
  71.439 +    <target name="setup-nbm-signing"
  71.440 +            depends="start-setup-nbm-signing,load-nbm-password,dont-sign-nbms"/>
  71.441 +
  71.442 +    <!-- Set properties for the NBM signing cache, and see if it's there. -->
  71.443 +    <target name="start-setup-nbm-signing">
  71.444 +        <property name="re-nbm-key-cache" location="${basedir}/build_env"/>
  71.445 +        <property name="keystore" location="${re-nbm-key-cache}/ide.ks"/>
  71.446 +        <property name="re-nbm-passfile" location="${re-nbm-key-cache}/.pswd"/>
  71.447 +        <available file="${keystore}" property="re-nbm-keystore-available"/>
  71.448 +    </target>
  71.449 +
  71.450 +    <!-- Read the file that will set re-nbm-storepass to the password. -->
  71.451 +    <target name="load-nbm-password" if="re-nbm-keystore-available">
  71.452 +        <property file="${re-nbm-passfile}"/>
  71.453 +        <property name="storepass" value="${re-nbm-storepass}"/>
  71.454 +    </target>
  71.455 +
  71.456 +    <!-- If we can't sign the NBM's, set alternate property values. -->
  71.457 +    <target name="dont-sign-nbms" unless="re-nbm-keystore-available">
  71.458 +        <property name="keystore" value="junk"/>
  71.459 +        <property name="storepass" value="?"/>
  71.460 +    </target>
  71.461 +  
  71.462 +    <target name="copy-env1" depends="init">
  71.463 +        <available property="env-copied" file="${jdkhome}/COPYRIGHT"/>
  71.464 +        <condition property="noJdkCopy">
  71.465 +            <or>
  71.466 +                <isset property="isMacOSX"/>
  71.467 +                <isset property="env-copied"/>
  71.468 +            </or>
  71.469 +        </condition>
  71.470 +	<available property="shipJdkHome" 
  71.471 +		   value="${basedir}/ship-java"
  71.472 +		   file="${basedir}/ship-java/COPYRIGHT"/>
  71.473 +	<condition property="shipJdkHome" value="${jdkhome}">
  71.474 +	    <not>
  71.475 +       		<isset property="shipJdkHome"/>
  71.476 +	    </not>
  71.477 +	</condition>
  71.478 +    </target>
  71.479 +
  71.480 +    <target name="copy-jdk" depends="copy-env1" unless="noJdkCopy">
  71.481 +        <copy toDir="${jdkhome}">
  71.482 +            <fileset dir="${shipJdkHome}">
  71.483 +                <include name="COPYRIGHT"/>
  71.484 +                <include name="LICENSE"/>
  71.485 +                <include name="README"/>
  71.486 +                <include name="src.zip"/>
  71.487 +                <include name="README.html"/>
  71.488 +                <include name="bin/**"/>
  71.489 +                <include name="include/**"/>
  71.490 +                <include name="jre/**"/>
  71.491 +                <include name="lib/**"/>
  71.492 +                <include name="man/**"/>
  71.493 +            </fileset>
  71.494 +        </copy>
  71.495 +        <chmod perm="ugo+x">
  71.496 +            <fileset dir="${jdkhome}">
  71.497 +                <include name="**/bin/*"/>
  71.498 +            </fileset>
  71.499 +        </chmod>
  71.500 +    </target>
  71.501 +
  71.502 +    <!-- Helper targets for building individual modules, this replaces the individual scripts -->
  71.503 +    <!-- Add individual wrapper targets you need -->
  71.504 +    <property name="target" value="netbeans"/>
  71.505 +
  71.506 +    <!-- Rave modules -->
  71.507 +    <target name="appbase">
  71.508 +        <ant dir="../appbase" target="${target}"/>
  71.509 +    </target>
  71.510 +    <target name="audit">
  71.511 +        <ant dir="../audit" target="${target}"/>
  71.512 +    </target>
  71.513 +    <target name="branding/autoupdate">
  71.514 +        <ant dir="../branding/autoupdate" target="${target}"/>
  71.515 +    </target>
  71.516 +    <target name="branding/beans">
  71.517 +        <ant dir="../branding/beans" target="${target}"/>
  71.518 +    </target>
  71.519 +    <target name="branding/core">
  71.520 +        <ant dir="../branding/core" target="${target}"/>
  71.521 +    </target>
  71.522 +    <target name="branding/core/windows">
  71.523 +        <ant dir="../branding/core/windows" target="${target}"/>
  71.524 +    </target>
  71.525 +    <target name="branding/editor">
  71.526 +        <ant dir="../branding/editor" target="${target}"/>
  71.527 +    </target>
  71.528 +    <target name="branding/extbrowser">
  71.529 +        <ant dir="../branding/extbrowser" target="${target}"/>
  71.530 +    </target>
  71.531 +    <target name="branding/java">
  71.532 +        <ant dir="../branding/java" target="${target}"/>
  71.533 +    </target>
  71.534 +    <target name="branding/image">
  71.535 +        <ant dir="../branding/image" target="${target}"/>
  71.536 +    </target>
  71.537 +    <target name="branding/html">
  71.538 +        <ant dir="../branding/html" target="${target}"/>
  71.539 +    </target>
  71.540 +    <target name="branding/objectbrowser/navigator">
  71.541 +        <ant dir="../branding/objectbrowser/navigator" target="${target}"/>
  71.542 +    </target>
  71.543 +    <target name="branding/openide">
  71.544 +        <ant dir="../branding/openide" target="${target}"/>
  71.545 +    </target>
  71.546 +    <target name="branding/openidex">
  71.547 +        <ant dir="../branding/openidex" target="${target}"/>
  71.548 +    </target>
  71.549 +    <target name="branding/openide/loaders">
  71.550 +        <ant dir="../branding/openide/loaders" target="${target}"/>
  71.551 +    </target>
  71.552 +    <target name="branding/projects/projectui">
  71.553 +        <ant dir="../branding/projects/projectui" target="${target}"/>
  71.554 +    </target>
  71.555 +    <target name="branding/refactoring">
  71.556 +        <ant dir="../branding/refactoring" target="${target}"/>
  71.557 +    </target>
  71.558 +    <target name="branding/tasklist/docscan">
  71.559 +        <ant dir="../branding/tasklist/docscan" target="${target}"/>
  71.560 +    </target>
  71.561 +    <target name="branding/utilities">
  71.562 +        <ant dir="../branding/utilities" target="${target}"/>
  71.563 +    </target>
  71.564 +    <target name="branding/vcscore">
  71.565 +        <ant dir="../branding/vcscore" target="${target}"/>
  71.566 +    </target>
  71.567 +    <target name="branding/web/jspsyntax">
  71.568 +        <ant dir="../branding/web/jspsyntax" target="${target}"/>
  71.569 +    </target>
  71.570 +    <target name="branding/web/project">
  71.571 +        <ant dir="../branding/web/project" target="${target}"/>
  71.572 +    </target>
  71.573 +    <target name="branding/xml/catalog">
  71.574 +        <ant dir="../branding/xml/catalog" target="${target}"/>
  71.575 +    </target>
  71.576 +    <target name="branding/xml/core">
  71.577 +        <ant dir="../branding/xml/core" target="${target}"/>
  71.578 +    </target>
  71.579 +    <target name="branding/xml/css">
  71.580 +        <ant dir="../branding/xml/css" target="${target}"/>
  71.581 +    </target>
  71.582 +    <target name="branding/xml/text-edit">
  71.583 +        <ant dir="../branding/xml/text-edit" target="${target}"/>
  71.584 +    </target>
  71.585 +    <target name="css">
  71.586 +        <ant dir="../css" target="${target}"/>
  71.587 +    </target>
  71.588 +    <target name="dataconnectivity">
  71.589 +        <ant dir="../dataconnectivity" target="${target}"/>
  71.590 +    </target>
  71.591 +    <target name="designer">
  71.592 +        <ant dir="../designer" target="${target}"/>
  71.593 +    </target>
  71.594 +    <target name="designer/api">
  71.595 +        <ant dir="../designer/api" target="${target}"/>
  71.596 +    </target>
  71.597 +    <target name="designer/markup">
  71.598 +        <ant dir="../designer/markup" target="${target}"/>
  71.599 +    </target>
  71.600 +    <target name="designtime">
  71.601 +        <ant dir="../designtime" target="${target}"/>
  71.602 +    </target>
  71.603 +    <target name="ejb">
  71.604 +        <ant dir="../ejb" target="${target}"/>
  71.605 +    </target>
  71.606 +    <target name="ejb/support">
  71.607 +        <ant dir="../ejb/support" target="${target}"/>
  71.608 +    </target>
  71.609 +    <target name="errorhandler/client">
  71.610 +        <ant dir="../errorhandler/client" target="${target}"/>
  71.611 +    </target>
  71.612 +    <target name="errorhandler/server">
  71.613 +        <ant dir="../errorhandler/server" target="${target}"/>
  71.614 +    </target>
  71.615 +    <target name="extension/apisupport/ant">
  71.616 +        <ant dir="../extension/apisupport/ant" target="${target}"/>
  71.617 +    </target>
  71.618 +    <target name="extension/autoupdate">
  71.619 +        <ant dir="../extension/autoupdate" target="${target}"/>
  71.620 +    </target>
  71.621 +    <target name="extension/beans">
  71.622 +        <ant dir="../extension/beans" target="${target}"/>
  71.623 +    </target>
  71.624 +    <target name="extension/core">
  71.625 +        <ant dir="../extension/core" target="${target}"/>
  71.626 +    </target>
  71.627 +    <target name="extension/core/execution">
  71.628 +        <ant dir="../extension/core/execution" target="${target}"/>
  71.629 +    </target>
  71.630 +    <target name="extension/core/ide">
  71.631 +        <ant dir="../extension/core/ide" target="${target}"/>
  71.632 +    </target>
  71.633 +    <target name="extension/core/javahelp">
  71.634 +        <ant dir="../extension/core/javahelp" target="${target}"/>
  71.635 +    </target>
  71.636 +    <target name="extension/core/multiview">
  71.637 +        <ant dir="../extension/core/multiview" target="${target}"/>
  71.638 +    </target>
  71.639 +    <target name="extension/core/output2">
  71.640 +        <ant dir="../extension/core/output2" target="${target}"/>
  71.641 +    </target>
  71.642 +    <target name="extension/core/ui">
  71.643 +        <ant dir="../extension/core/ui" target="${target}"/>
  71.644 +    </target>
  71.645 +    <target name="extension/core/windows">
  71.646 +        <ant dir="../extension/core/windows" target="${target}"/>
  71.647 +    </target>
  71.648 +    <target name="extension/debuggercore">
  71.649 +        <ant dir="../extension/debuggercore" target="${target}"/>
  71.650 +    </target>
  71.651 +    <target name="extension/debuggerjpda/ui">
  71.652 +        <ant dir="../extension/debuggerjpda/ui" target="${target}"/>
  71.653 +    </target>
  71.654 +    <target name="extension/editor">
  71.655 +        <ant dir="../extension/editor" target="${target}"/>
  71.656 +    </target>
  71.657 +    <target name="extension/html">
  71.658 +        <ant dir="../extension/html" target="${target}"/>
  71.659 +    </target>
  71.660 +    <target name="extension/ide/launcher/upgrade">
  71.661 +        <ant dir="../extension/ide/launcher/upgrade" target="${target}"/>
  71.662 +    </target>
  71.663 +    <target name="extension/java">
  71.664 +        <ant dir="../extension/java" target="${target}"/>
  71.665 +    </target>
  71.666 +    <target name="extension/java/editor">
  71.667 +        <ant dir="../extension/java/editor" target="${target}"/>
  71.668 +    </target>
  71.669 +    <target name="extension/java/freeform">
  71.670 +        <ant dir="../extension/java/freeform" target="${target}"/>
  71.671 +    </target>
  71.672 +    <target name="extension/java/j2seproject">
  71.673 +        <ant dir="../extension/java/j2seproject" target="${target}"/>
  71.674 +    </target>
  71.675 +    <target name="extension/java/platform">
  71.676 +        <ant dir="../extension/java/platform" target="${target}"/>
  71.677 +    </target>
  71.678 +    <target name="extension/javadoc">
  71.679 +        <ant dir="../extension/javadoc" target="${target}"/>
  71.680 +    </target>
  71.681 +    <target name="extension/monitor">
  71.682 +        <ant dir="../extension/monitor" target="${target}"/>
  71.683 +    </target>
  71.684 +    <target name="extension/objectbrowser/navigator">
  71.685 +        <ant dir="../extension/objectbrowser/navigator" target="${target}"/>
  71.686 +    </target>
  71.687 +    <target name="extension/openide">
  71.688 +        <ant dir="../extension/openide" target="${target}"/>
  71.689 +    </target>
  71.690 +    <target name="extension/projects/projectui">
  71.691 +        <ant dir="../extension/projects/projectui" target="${target}"/>
  71.692 +    </target>
  71.693 +    <target name="extension/properties">
  71.694 +        <ant dir="../extension/properties" target="${target}"/>
  71.695 +    </target>
  71.696 +    <target name="extension/refactoring">
  71.697 +        <ant dir="../extension/refactoring" target="${target}"/>
  71.698 +    </target>
  71.699 +    <target name="extension/tasklist/docscan">
  71.700 +        <ant dir="../extension/tasklist/docscan" target="${target}"/>
  71.701 +    </target>
  71.702 +    <target name="extension/utilities">
  71.703 +        <ant dir="../extension/utilities" target="${target}"/>
  71.704 +    </target>
  71.705 +    <target name="extension/utilities/project">
  71.706 +        <ant dir="../extension/utilities/project" target="${target}"/>
  71.707 +    </target>
  71.708 +    <target name="extension/vcscore">
  71.709 +        <ant dir="../extension/vcscore" target="${target}"/>
  71.710 +    </target>
  71.711 +    <target name="extension/vcsgeneric">
  71.712 +        <ant dir="../extension/vcsgeneric" target="${target}"/>
  71.713 +    </target>
  71.714 +    <target name="extension/web/core">
  71.715 +        <ant dir="../extension/web/core" target="${target}"/>
  71.716 +    </target>
  71.717 +    <target name="extension/web/project">
  71.718 +        <ant dir="../extension/web/project" target="${target}"/>
  71.719 +    </target>
  71.720 +    <target name="extension/xml/api">
  71.721 +        <ant dir="../extension/xml/api" target="${target}"/>
  71.722 +    </target>
  71.723 +    <target name="extension/xml/catalog">
  71.724 +        <ant dir="../extension/xml/catalog" target="${target}"/>
  71.725 +    </target>
  71.726 +    <target name="extension/xml/core">
  71.727 +        <ant dir="../extension/xml/core" target="${target}"/>
  71.728 +    </target>
  71.729 +    <target name="extension/xml/css">
  71.730 +        <ant dir="../extension/xml/css" target="${target}"/>
  71.731 +    </target>
  71.732 +    <target name="extension/xml/text-edit">
  71.733 +        <ant dir="../extension/xml/text-edit" target="${target}"/>
  71.734 +    </target>
  71.735 +    <target name="insync">
  71.736 +        <ant dir="../insync" target="${target}"/>
  71.737 +    </target>
  71.738 +    <target name="insync/api">
  71.739 +        <ant dir="../insync/api" target="${target}"/>
  71.740 +    </target>
  71.741 +    <target name="jsfcl">
  71.742 +        <ant dir="../jsfcl" target="${target}"/>
  71.743 +    </target>
  71.744 +    <target name="jsfloader">
  71.745 +        <ant dir="../project/jsfloader" target="${target}"/>
  71.746 +    </target>
  71.747 +    <target name="jsfmetadata">
  71.748 +        <ant dir="../jsfmetadata" target="${target}"/>
  71.749 +    </target>
  71.750 +    <target name="jsfsupport">
  71.751 +        <ant dir="../jsfsupport" target="${target}"/>
  71.752 +    </target>
  71.753 +    <target name="jspsyntaxint">
  71.754 +        <ant dir="../jspsyntaxint" target="${target}"/>
  71.755 +    </target>
  71.756 +    <target name="jwsdpsupport">
  71.757 +        <ant dir="../jwsdpsupport" target="${target}"/>
  71.758 +    </target>
  71.759 +    <!-- XXX Change to ravelibs/ soon -->
  71.760 +    <target name="ravelibs/jsf">
  71.761 +        <ant dir="../ravelibs/jsf" target="${target}"/>
  71.762 +    </target>
  71.763 +    <target name="ravelibs/rowset">
  71.764 +        <ant dir="../ravelibs/rowset" target="${target}"/>
  71.765 +    </target>
  71.766 +    <target name="licensing">
  71.767 +        <ant dir="../licensing" target="${target}"/>
  71.768 +    </target>
  71.769 +    <target name="navigation">
  71.770 +        <ant dir="../navigation" target="${target}"/>
  71.771 +    </target>
  71.772 +    <target name="opensrc">
  71.773 +        <ant dir="../opensrc" target="${target}"/>
  71.774 +    </target>
  71.775 +    <target name="opensrc/batik">
  71.776 +        <ant dir="../opensrc/batik" target="${target}"/>
  71.777 +    </target>
  71.778 +    <target name="opensrc/batik/script">
  71.779 +        <ant dir="../opensrc/batik/script" target="${target}"/>
  71.780 +    </target>
  71.781 +    <target name="preview/support">
  71.782 +        <ant dir="../preview/support" target="${target}"/>
  71.783 +    </target>
  71.784 +    <target name="project">
  71.785 +        <ant dir="../project" target="${target}"/>
  71.786 +    </target>
  71.787 +    <target name="project/jsfloader">
  71.788 +        <ant dir="../project/jsfloader" target="${target}"/>
  71.789 +    </target>
  71.790 +    <target name="project/jsf">
  71.791 +        <ant dir="../project/jsf" target="${target}"/>
  71.792 +    </target>
  71.793 +    <target name="project/jsfproject">
  71.794 +        <ant dir="../project/jsfproject" target="${target}"/>
  71.795 +    </target>
  71.796 +    <target name="project/jsfprojectapi">
  71.797 +        <ant dir="../project/jsfprojectapi" target="${target}"/>
  71.798 +    </target>
  71.799 +    <target name="project/jsfportlet">
  71.800 +        <ant dir="../project/jsfportlet" target="${target}"/>
  71.801 +    </target>
  71.802 +    <target name="project/navigationloader">
  71.803 +        <ant dir="../project/navigationloader" target="${target}"/>
  71.804 +    </target>
  71.805 +    <target name="clean-project/jsfportlet">
  71.806 +        <ant dir="../project/jsfportlet" target="clean"/>
  71.807 +    </target>
  71.808 +    <target name="portletcontainer">
  71.809 +        <ant dir="../portletcontainer" target="${target}"/>
  71.810 +    </target>
  71.811 +    <target name="clean-portletcontainer">
  71.812 +        <ant dir="../portletcontainer" target="${target}"/>
  71.813 +    </target>
  71.814 +    <target name="project/migration">
  71.815 +        <ant dir="../project/migration" target="${target}"/>
  71.816 +    </target>
  71.817 +    <target name="clean-project/migration">
  71.818 +        <ant dir="../project/migration" target="clean"/>
  71.819 +    </target>
  71.820 +    <target name="propertyeditors">
  71.821 +        <ant dir="../propertyeditors" target="${target}"/>
  71.822 +    </target>
  71.823 +    <target name="ravehelp">
  71.824 +        <ant dir="../ravehelp" target="${target}"/>
  71.825 +    </target>
  71.826 +    <target name="ravelibs/jsf-portlet">
  71.827 +        <ant dir="../ravelibs/jsf-portlet" target="${target}"/>
  71.828 +    </target>
  71.829 +    <target name="ravelibs/portlet-api">
  71.830 +        <ant dir="../ravelibs/portlet-api" target="${target}"/>
  71.831 +    </target>
  71.832 +    <target name="registration">
  71.833 +        <ant dir="../registration" target="${target}"/>
  71.834 +    </target>
  71.835 +    <target name="servernav">
  71.836 +        <ant dir="../servernav" target="${target}"/>
  71.837 +    </target>
  71.838 +    <target name="sql">
  71.839 +        <ant dir="../sql" target="${target}"/>
  71.840 +    </target>
  71.841 +    <target name="sqleditor">
  71.842 +        <ant dir="../dataconnectivity/sqleditor" target="${target}"/>
  71.843 +    </target>
  71.844 +    <target name="sunddapi">
  71.845 +        <ant dir="../sunddapi" target="${target}"/>
  71.846 +    </target>
  71.847 +    <target name="studio-plugin">
  71.848 +        <ant dir="../studio-plugin" target="${target}"/>
  71.849 +    </target>
  71.850 +    <target name="sunappsrvint">
  71.851 +        <ant dir="../sunappsrvint" target="${target}"/>
  71.852 +    </target>
  71.853 +    <target name="toolbox">
  71.854 +        <ant dir="../toolbox" target="${target}"/>
  71.855 +    </target>
  71.856 +    <target name="userdoc">
  71.857 +        <ant dir="../userdoc" target="${target}"/>
  71.858 +    </target>
  71.859 +    <target name="visual">
  71.860 +        <ant dir="../visual" target="${target}"/>
  71.861 +    </target>
  71.862 +    <target name="ravewebsvc">
  71.863 +        <ant dir="../ravewebsvc" target="${target}"/>
  71.864 +    </target>
  71.865 +    <target name="dataprovider/designtime">
  71.866 +        <ant dir="../dataprovider/designtime" target="${target}"/>
  71.867 +    </target>
  71.868 +    <target name="dataprovider/runtime">
  71.869 +        <ant dir="../dataprovider/runtime" target="${target}"/>
  71.870 +    </target>
  71.871 +    <target name="xhtml">
  71.872 +        <ant dir="../xhtml" target="${target}"/>
  71.873 +    </target>
  71.874 +    <target name="webui/designtime">
  71.875 +        <ant dir="../webui/designtime" target="${target}"/>
  71.876 +    </target>
  71.877 +    <target name="webui/runtime">
  71.878 +        <ant dir="../webui/runtime" target="${target}"/>
  71.879 +    </target>
  71.880 +    <target name="webui/themes">
  71.881 +        <ant dir="../webui/themes" target="${target}"/>
  71.882 +    </target>
  71.883 +    <target name="welcome">
  71.884 +        <ant dir="../welcome" target="${target}"/>
  71.885 +    </target>
  71.886 +    <target name="woodstock">
  71.887 +        <ant dir="../woodstock" target="${target}"/>
  71.888 +    </target>
  71.889 +    <target name="ws61-plugin">
  71.890 +        <ant dir="../ws61-plugin" target="${target}"/>
  71.891 +    </target>
  71.892 +    <target name="sampleapps/bundled">
  71.893 +        <ant dir="../sampleapps/bundled" target="${target}"/>
  71.894 +    </target>
  71.895 +    
  71.896 +    
  71.897 +    <!-- These targets duplicate the functionality of the RE tools -->
  71.898 +    <target name="download-jdk" description="Manually downloads the JDK TAR into this directory">
  71.899 +        <antcall target="-download-jdk" inheritall="false">
  71.900 +            <param name="bypass.cache.validation" value="true"/>
  71.901 +        </antcall>
  71.902 +    </target>
  71.903 +
  71.904 +    <target name="download-jdk-all" description="Downloads All platform specific JDK ZIPS">
  71.905 +        <antcall target="-download-jdk-all" inheritall="false">
  71.906 +            <param name="bypass.cache.validation" value="true"/>
  71.907 +        </antcall>
  71.908 +    </target>
  71.909 +
  71.910 +    <target name="download-netbeans-src" description="Downloads the Netbeans sources into this directory">
  71.911 +        <antcall target="-get-netbeans-src" inheritall="false">
  71.912 +            <param name="bypass.cache.validation" value="true"/>
  71.913 +        </antcall>
  71.914 +    </target>
  71.915 +    
  71.916 +    <target name="download-netbeans-binary" description="Downloads the Netbeans IDE binary into this directory">
  71.917 +        <antcall target="-get-netbeans-bin" inheritall="false">
  71.918 +            <param name="bypass.cache.validation" value="true"/>
  71.919 +        </antcall>
  71.920 +    </target>    
  71.921 +
  71.922 +    <target name="download-netbeans-platform-binary" description="Downloads Netbeans IDE platform specific ML binaries">
  71.923 +	<antcall target="-get-netbeans-platform" inheritall="false">
  71.924 +		<param name="bypass.cache.validation" value="true"/>
  71.925 +	</antcall>
  71.926 +    </target>   
  71.927 +
  71.928 +    <target name="download-netbeans-platform-binary-ml" description="Downloads Netbeans IDE platform specific ML binaries">
  71.929 +        <antcall target="-get-netbeans-platform-ml" inheritall="false">
  71.930 +                <param name="bypass.cache.validation" value="true"/>
  71.931 +        </antcall>
  71.932 +    </target>
  71.933 +
  71.934 +    <target name="download-ismp" description="Downloads ISMP">
  71.935 +	<antcall target="-get-ismp" inheritall="false">
  71.936 +	</antcall>
  71.937 +    </target> 
  71.938 +
  71.939 +    <target name="download-as-binary" description="Downloads App Server">
  71.940 +	<antcall target="-get-as-binary" inheritall="false">
  71.941 +	</antcall>
  71.942 +    </target> 
  71.943 +
  71.944 +   <target name="download-as-binary-platform" description="Downloads Platform Specific App Server">
  71.945 +        <condition property="as.platform" value="${as.win}">
  71.946 +            <os family="windows"/>
  71.947 +        </condition>
  71.948 +
  71.949 +        <condition property="as.platform" value="${as.linux}">
  71.950 +            <os name="Linux"/>
  71.951 +        </condition>
  71.952 +
  71.953 +        <condition property="as.platform" value="${as.solsparc}">
  71.954 +            <os name="SunOS" arch="sparc"/>
  71.955 +        </condition>
  71.956 +
  71.957 +        <condition property="as.platform" value="${as.solx86}">
  71.958 +            <os name="SunOS" arch="x86"/>
  71.959 +        </condition>
  71.960 +
  71.961 +	<condition property="as.platform" value="${as.mac}">
  71.962 +            <os family="mac"/>
  71.963 +        </condition>
  71.964 +
  71.965 +	<mkdir dir="${as.cache.dir}"/>
  71.966 +        <get src="${as.cache.server.url}/${as.platform}"
  71.967 +             dest="${as.cache.dir}/${as.platform}" usetimestamp="true" ignoreerrors="true"/>
  71.968 +    </target>
  71.969 + 
  71.970 +    <target name="unzip-jdk" description="Downloads and unzips the shipping JDK">
  71.971 +        <antcall target="-unzip-jdk" inheritall="false">
  71.972 +            <param name="bypass.cache.validation" value="true"/>
  71.973 +        </antcall>
  71.974 +    </target>
  71.975 +    
  71.976 +    <target name="unzip-netbeans-src"  description="Downloads and unzips the Netbeans sources">
  71.977 +        <antcall target="-unzip-netbeans-src" inheritall="false">
  71.978 +            <param name="bypass.cache.validation" value="true"/>
  71.979 +        </antcall>
  71.980 +    </target>
  71.981 +
  71.982 +    <target name="unzip-netbeans-binary"  description="Downloads and unzips the Netbeans IDE binary">
  71.983 +        <antcall target="-unzip-netbeans-bin" inheritall="false">
  71.984 +            <param name="bypass.cache.validation" value="true"/>
  71.985 +        </antcall>
  71.986 +    </target>
  71.987 + 
  71.988 +    <target name="-download-jdk" depends="init">
  71.989 +        <condition property="jdk.name" value="${jdk.win}.tar">
  71.990 +            <os family="windows"/>
  71.991 +        </condition>
  71.992 +        
  71.993 +        <condition property="jdk.name" value="${jdk.linux}.tar">
  71.994 +            <os name="Linux"/>
  71.995 +        </condition>
  71.996 +        
  71.997 +        <condition property="jdk.name" value="${jdk.solsparc}.tar">
  71.998 +            <os name="SunOS" arch="sparc"/>
  71.999 +        </condition>
 71.1000 +        
 71.1001 +        <condition property="jdk.name" value="${jdk.solx86}.tar">
 71.1002 +            <os name="SunOS" arch="x86"/>
 71.1003 +        </condition>
 71.1004 +        
 71.1005 +        <get src="${jdk.cache.server.url}/tars/${jdk.name}"
 71.1006 +             dest="${cache.dir}/jdk-zip.tar" usetimestamp="true" ignoreerrors="true"/>
 71.1007 +    </target>
 71.1008 +
 71.1009 +    <target name="-download-jdk-all" depends="-check-jdk-online, init">
 71.1010 +        <mkdir dir="${jdk.cache.dir}"/>
 71.1011 +        <get src="${jdk.cache.server.url}/zips/${jdk.linux}.zip"
 71.1012 +             dest="${jdk.cache.dir}/${jdk.linux}.zip" usetimestamp="true" ignoreerrors="true"/>
 71.1013 +
 71.1014 +        <get src="${jdk.cache.server.url}/zips/${jdk.solsparc}.zip"
 71.1015 +             dest="${jdk.cache.dir}/${jdk.solsparc}.zip" usetimestamp="true" ignoreerrors="true"/>
 71.1016 +
 71.1017 +        <get src="${jdk.cache.server.url}/zips/${jdk.solx86}.zip"
 71.1018 +             dest="${jdk.cache.dir}/${jdk.solx86}.zip" usetimestamp="true" ignoreerrors="true"/>
 71.1019 +
 71.1020 +        <get src="${jdk.cache.server.url}/zips/${jdk.win}.zip"
 71.1021 +             dest="${jdk.cache.dir}/${jdk.win}.zip" usetimestamp="true" ignoreerrors="true"/>
 71.1022 +    </target>
 71.1023 +    
 71.1024 +    <target name="-unzip-jdk" depends="-download-jdk, init">
 71.1025 +        <!-- use exec instead of the untar task, since the task does not preserve file permissions -->
 71.1026 +        <mkdir dir="${basedir}/ship-java"/>
 71.1027 +        <!-- <exec dir="${basedir}/ship-java" executable="tar" failonerror="true">
 71.1028 +            <arg line="xvf ${cache.dir}/jdk-zip.tar"/>
 71.1029 +        </exec> -->
 71.1030 +		<untar src="${cache.dir}/jdk-zip.tar" dest="${basedir}/ship-java"/>
 71.1031 +    </target>
 71.1032 +    
 71.1033 +    <target name="-unzip-netbeans-src" depends="-get-netbeans-src, init">
 71.1034 +        <!-- use exec to avoid the file permission preservation issue in ant -->
 71.1035 +        <exec dir="${basedir}" executable="unzip" failonerror="true">
 71.1036 +            <arg line="${cache.dir}/${nb.src.zip} -d ${nb.src.base}"/>
 71.1037 +        </exec>
 71.1038 +    </target>
 71.1039 +
 71.1040 +    <target name="-unzip-netbeans-bin" depends="-get-netbeans-bin, init">
 71.1041 +        <!-- use exec to avoid the file permission preservation issue in ant -->
 71.1042 +        <exec dir="${basedir}" executable="unzip" failonerror="true">
 71.1043 +            <arg line="${cache.dir}/${nb.bin.zip} -d ${nb.bin.base}"/>
 71.1044 +        </exec>
 71.1045 +    </target>    
 71.1046 +    
 71.1047 +    <target name="-check-ravebuild-online" depends="init">
 71.1048 +        <condition property="is.ravebuild.online">
 71.1049 +            <http url="${ravebuild.cache.server.url}"/>
 71.1050 +        </condition>
 71.1051 +        <echo>Online check: ${is.ravebuild.online}</echo>
 71.1052 +    </target>
 71.1053 +
 71.1054 +    <target name="-check-ismp-online" depends="init">
 71.1055 +	<condition property="is.ismp.online">
 71.1056 +            <http url="${ismp.cache.server.url}"/>
 71.1057 +	</condition>
 71.1058 +	<echo>Online check: ${is.ismp.online}</echo>
 71.1059 +    </target>
 71.1060 +
 71.1061 +    <target name="-check-as-online" depends="init">
 71.1062 +	<condition property="is.as.online">
 71.1063 +	    <http url="${as.cache.server.url}"/>
 71.1064 +	</condition>
 71.1065 +	<echo>Online check: ${is.as.online}</echo>
 71.1066 +    </target>
 71.1067 +
 71.1068 +    <target name="-check-jdk-online" depends="init">
 71.1069 +        <condition property="is.jdk.online">
 71.1070 +            <http url="${jdk.cache.server.url}"/>
 71.1071 +        </condition>
 71.1072 +        <echo>Online check: ${is.jdk.online}</echo>
 71.1073 +    </target>
 71.1074 +
 71.1075 +    <target name="-check-netbeans-src" depends="init">
 71.1076 +        <available file="${cache.dir}/${nb.src.zip}" property="netbeans.src.zip.available"/>
 71.1077 +    </target>
 71.1078 +
 71.1079 +    <target name="-check-netbeans-bin" depends="init">
 71.1080 +        <available file="${cache.dir}/${nb.bin.zip}" property="netbeans.bin.zip.available"/>
 71.1081 +    </target>
 71.1082 +
 71.1083 +    <target name="-get-netbeans-src" depends="-check-ravebuild-online, -check-netbeans-src, init" unless="netbeans.src.zip.available">
 71.1084 +	<mkdir dir="${nb.cache.dir}"/>
 71.1085 +        <get src="${ravebuild.cache.server.url}/${nb.src.zip}" 
 71.1086 +             dest="${nb.cache.dir}/${nb.src.zip}" usetimestamp="true" ignoreerrors="true"/>
 71.1087 +    </target>
 71.1088 +
 71.1089 +    <target name="-get-netbeans-bin" depends="-check-ravebuild-online, -check-netbeans-bin, init" unless="netbeans.bin.zip.available">
 71.1090 +	<mkdir dir="${nb.cache.dir}"/>
 71.1091 +        <get src="${ravebuild.cache.server.url}/${nb.bin.zip}" 
 71.1092 +             dest="${nb.cache.dir}/${nb.bin.zip}" usetimestamp="true" ignoreerrors="true"/>
 71.1093 +    </target>
 71.1094 +  
 71.1095 +    <target name="-get-netbeans-platform" depends="-check-ravebuild-online, init">
 71.1096 +	<mkdir dir="${nb.cache.dir}"/>
 71.1097 +        <get src="${ravebuild.cache.server.url}/${nb.linux}"
 71.1098 +             dest="${nb.cache.dir}/${nb.linux}" usetimestamp="true" ignoreerrors="true"/>
 71.1099 +	<get src="${ravebuild.cache.server.url}/${nb.mac}"
 71.1100 +             dest="${nb.cache.dir}/${nb.mac}" usetimestamp="true" ignoreerrors="true"/>
 71.1101 +	<get src="${ravebuild.cache.server.url}/${nb.solsparc}"
 71.1102 +             dest="${nb.cache.dir}/${nb.solsparc}" usetimestamp="true" ignoreerrors="true"/>
 71.1103 +	<get src="${ravebuild.cache.server.url}/${nb.solx86}"
 71.1104 +             dest="${nb.cache.dir}/${nb.solx86}" usetimestamp="true" ignoreerrors="true"/>
 71.1105 +	<get src="${ravebuild.cache.server.url}/${nb.win}"
 71.1106 +             dest="${nb.cache.dir}/${nb.win}" usetimestamp="true" ignoreerrors="true"/>
 71.1107 +    </target>
 71.1108 +
 71.1109 +    <target name="-get-netbeans-platform-ml" depends="-check-ravebuild-online, init">
 71.1110 +        <mkdir dir="${nb.cache.dir}"/>
 71.1111 +        <get src="${ravebuild.cache.server.url}/${nb.linux.ml}"
 71.1112 +             dest="${nb.cache.dir}/${nb.linux.ml}" usetimestamp="true" ignoreerrors="true"/>
 71.1113 +        <get src="${ravebuild.cache.server.url}/${nb.mac.ml}"
 71.1114 +             dest="${nb.cache.dir}/${nb.mac.ml}" usetimestamp="true" ignoreerrors="true"/>
 71.1115 +        <get src="${ravebuild.cache.server.url}/${nb.solsparc.ml}"
 71.1116 +             dest="${nb.cache.dir}/${nb.solsparc.ml}" usetimestamp="true" ignoreerrors="true"/>
 71.1117 +        <get src="${ravebuild.cache.server.url}/${nb.solx86.ml}"
 71.1118 +             dest="${nb.cache.dir}/${nb.solx86.ml}" usetimestamp="true" ignoreerrors="true"/>
 71.1119 +        <get src="${ravebuild.cache.server.url}/${nb.win.ml}"
 71.1120 +             dest="${nb.cache.dir}/${nb.win.ml}" usetimestamp="true" ignoreerrors="true"/>
 71.1121 +    </target>
 71.1122 +
 71.1123 +    <target name="-get-ismp" depends="-check-ismp-online, init">
 71.1124 +	<mkdir dir="${ismp.cache.dir}"/>
 71.1125 +	<get src="${ismp.cache.server.url}/${ismp.name}"
 71.1126 +             dest="${ismp.cache.dir}/${ismp.name}" usetimestamp="true" ignoreerrors="true"/>
 71.1127 +    </target>
 71.1128 +
 71.1129 +    <target name="-get-as-binary" depends="-check-as-online, init">
 71.1130 +	<mkdir dir="${as.cache.dir}"/>
 71.1131 +	<get src="${as.cache.server.url}/${as.linux}"
 71.1132 +             dest="${as.cache.dir}/${as.linux}" usetimestamp="true" ignoreerrors="true"/>
 71.1133 +	<get src="${as.cache.server.url}/${as.mac}"
 71.1134 +             dest="${as.cache.dir}/${as.mac}" usetimestamp="true" ignoreerrors="true"/>
 71.1135 +	<get src="${as.cache.server.url}/${as.solsparc}"
 71.1136 +             dest="${as.cache.dir}/${as.solsparc}" usetimestamp="true" ignoreerrors="true"/>
 71.1137 +	<get src="${as.cache.server.url}/${as.solx86}"
 71.1138 +             dest="${as.cache.dir}/${as.solx86}" usetimestamp="true" ignoreerrors="true"/>
 71.1139 +	<get src="${as.cache.server.url}/${as.win}"
 71.1140 +             dest="${as.cache.dir}/${as.win}" usetimestamp="true" ignoreerrors="true"/>
 71.1141 +    </target>
 71.1142 + 
 71.1143 +    <target name="en-pack-installers">
 71.1144 +
 71.1145 +        <!-- Clean up some sample complib modules before building installers -->
 71.1146 +	<ant dir="../sampleapps/complibs/ajax" target="clean"/>
 71.1147 +
 71.1148 +        <property environment="myenv"/>
 71.1149 +        <echo> Installer installation dir is: ${myenv.ISMP}</echo>
 71.1150 +        <!-- ant dir="${nb_all.dir}/installer/profiler" target="build" -->
 71.1151 +        <ant dir="../installer/nb_installer/creator" target="build">
 71.1152 +            <property name="cluster.dir" location="rave/visualweb1"/>
 71.1153 +            <property name="ismp.home" location="${myenv.ISMP}"/>
 71.1154 +            <property name="installer.basename" value="${installer.basename}"/>
 71.1155 +	    <property name="installer.suffix" value="${installer.suffix}"/>
 71.1156 +        </ant>
 71.1157 +    </target>
 71.1158 +   
 71.1159 +    <target name="ml-pack-installers">
 71.1160 +        <property environment="myenv"/>
 71.1161 +        <echo> Installer installation dir is: ${myenv.ISMP}</echo>
 71.1162 +        <!-- ant dir="${nb_all.dir}/installer/profiler" target="build-ml" -->
 71.1163 +        <ant dir="../installer/nb_installer/creator" target="build-ml">
 71.1164 +            <property name="cluster.dir" location="rave/visualweb1"/>
 71.1165 +            <property name="ismp.home" location="${myenv.ISMP}"/>
 71.1166 +            <property name="installer.basename" value="${installer.basename}"/>
 71.1167 +            <property name="installer.suffix" value="${installer.suffix}"/>
 71.1168 +        </ant>
 71.1169 +    </target>
 71.1170 + 
 71.1171 +    <target name="en-pack-installers-cn">
 71.1172 +
 71.1173 +        <!-- Clean up some sample complib modules before building installers -->
 71.1174 +	<ant dir="../sampleapps/complibs/ajax" target="clean"/>
 71.1175 +
 71.1176 +        <property environment="myenv"/>
 71.1177 +        <echo> Installer installation dir is: ${myenv.ISMP}</echo>
 71.1178 +        <!-- ant dir="${nb_all.dir}/installer/profiler" target="build" -->
 71.1179 +        <ant dir="../installer/nb_installer/creator" target="build-cn">
 71.1180 +            <property name="cluster.dir" location="rave/visualweb1"/>
 71.1181 +            <property name="ismp.home" location="${myenv.ISMP}"/>
 71.1182 +            <property name="installer.basename" value="${installer.basename}"/>
 71.1183 +	    <property name="installer.suffix" value="${installer.suffix}"/>
 71.1184 +        </ant>
 71.1185 +    </target>
 71.1186 +   
 71.1187 +    <target name="ml-pack-installers-cn">
 71.1188 +        <property environment="myenv"/>
 71.1189 +        <echo> Installer installation dir is: ${myenv.ISMP}</echo>
 71.1190 +        <!-- ant dir="${nb_all.dir}/installer/profiler" target="build-ml" -->
 71.1191 +        <ant dir="../installer/nb_installer/creator" target="build-ml-cn">
 71.1192 +            <property name="cluster.dir" location="rave/visualweb1"/>
 71.1193 +            <property name="ismp.home" location="${myenv.ISMP}"/>
 71.1194 +            <property name="installer.basename" value="${installer.basename}"/>
 71.1195 +            <property name="installer.suffix" value="${installer.suffix}"/>
 71.1196 +        </ant>
 71.1197 +    </target>
 71.1198 +</project>
 71.1199 +
    72.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.2 +++ b/visualweb/ravebuild/build_env/.pswd	Sun Jan 28 18:54:08 2007 +0000
    72.3 @@ -0,0 +1,4 @@
    72.4 +
    72.5 +# This is the storepass property to be used when signing the NBM files #
    72.6 +
    72.7 +re-nbm-storepass=G0!R4v3
    73.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.2 +++ b/visualweb/ravebuild/build_env/README	Sun Jan 28 18:54:08 2007 +0000
    73.3 @@ -0,0 +1,26 @@
    73.4 +
    73.5 +HOW TO INSTALL CREATOR PACK - updated 05/09/06
    73.6 +
    73.7 +0. Make sure that you have jdk 1.5_06 preinstalled on your system.
    73.8 +
    73.9 +1. Download and unzip NB by extracting the contents of 
   73.10 +   netbeans-5.5-daily-bin-2006...-ide-...zip;
   73.11 +
   73.12 +   Manually modify $installdir/etc/netbeans.conf for the following:
   73.13 +
   73.14 +   Replace the line "#jdkhome=..." with
   73.15 +   jdkhome=<path to jdk 1.5_06>
   73.16 +
   73.17 +2. Download and install the latest CreatorPack-... installer. Give NB install 
   73.18 +   location when being asked. Make sure that the build is after this INF:
   73.19 +   http://inf.central/inf/integrationReport.jsp?id=92439
   73.20 +   for example, /net/clue.sfbay/kits/rave/main/Build060424_7/pack_installers
   73.21 +
   73.22 +3. Download and install glassfish and add this server to Netbeans:
   73.23 +   - Run the installer: java -Xmx256m -jar glassfish-installer-9.0-*.jar
   73.24 +   - cd glassfish; ant -f setup.xml
   73.25 +   - Configure netbeans: select Tools>Server Manager(Or from runtime tab, right 
   73.26 +     click at Server and select Add server). Click Add Server button. Follow 
   73.27 +     the wizard and specify the Platform Location to glassfish directory which 
   73.28 +     you just installed. 
   73.29 +
    74.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.2 +++ b/visualweb/ravebuild/build_env/converter.sh	Sun Jan 28 18:54:08 2007 +0000
    74.3 @@ -0,0 +1,63 @@
    74.4 +#!/bin/sh
    74.5 +
    74.6 +if [ "$#" -lt 4 ]; then
    74.7 +        echo "\nUsage";
    74.8 +	echo "-s : source dir including file name to pick up the windows PE installer"
    74.9 +        echo "-d : destination dir to put the converted windows PE installer"
   74.10 +	echo "\n"
   74.11 +        exit 0;
   74.12 +fi
   74.13 +
   74.14 +for i in $* ; do
   74.15 +  case $i in
   74.16 +    -s)
   74.17 +        ORIGINAL_DISTRIBUTION=$2
   74.18 +        shift 2
   74.19 +        ;;
   74.20 +    -d)
   74.21 +    	NEW_DISTRIBUTION_DIR=$2
   74.22 +    	shift 2
   74.23 +    	;;
   74.24 +    esac
   74.25 +done
   74.26 +
   74.27 +if [ ! -f ${ORIGINAL_DISTRIBUTION} ]  ; then
   74.28 +	echo "\nSource File ${ORIGINAL_DISTRIBUTION} does not exists\n"
   74.29 +        exit 9
   74.30 +fi
   74.31 +
   74.32 +if [ ! -d ${NEW_DISTRIBUTION_DIR} ]; then
   74.33 +	echo "\nDestination Dir ${NEW_DISTRIBUTION_DIR} does not exists\n"
   74.34 +        exit 9
   74.35 +fi
   74.36 +
   74.37 +FILE_NAME=`basename ${ORIGINAL_DISTRIBUTION}`
   74.38 +NEW_DISTRIBUTION=${NEW_DISTRIBUTION_DIR}/${FILE_NAME}
   74.39 +
   74.40 +mkdir tmp
   74.41 +cd tmp
   74.42 +
   74.43 +#unzip the original distribution file, disregard warning 
   74.44 +
   74.45 +/usr/bin/unzip $ORIGINAL_DISTRIBUTION
   74.46 +
   74.47 +#create a new zip
   74.48 +
   74.49 +/usr/bin/zip -r newzip.zip  appserv.class setup.exe setup.dos.exe 3RD-PARTY-LICENSE.txt LICENSE.txt package
   74.50 +
   74.51 +#append new zip to setup.dos.exe
   74.52 +
   74.53 +cat newzip.zip >> setup.dos.exe
   74.54 +
   74.55 +#rename setup.dos.exe into new distribution file
   74.56 +
   74.57 +mv setup.dos.exe $NEW_DISTRIBUTION
   74.58 +chmod 755 $NEW_DISTRIBUTION
   74.59 +
   74.60 +#cleanup of intermediate files
   74.61 +
   74.62 +rm -rf newzip.zip package appserv.class setup.exe 3RD-PARTY-LICENSE.txt LICENSE.txt
   74.63 +
   74.64 +cd ../
   74.65 +rm -rf tmp
   74.66 +
    75.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.2 +++ b/visualweb/ravebuild/build_env/make_statefile.sh	Sun Jan 28 18:54:08 2007 +0000
    75.3 @@ -0,0 +1,210 @@
    75.4 +#!/bin/sh
    75.5 +#
    75.6 +# This script generates a statefile for the Sun App Server (personal edition)
    75.7 +# based on existing standards.  Fucntionality has now been added to extract
    75.8 +# the wizard IDs from the installers themselves
    75.9 +
   75.10 +ErrorExit()
   75.11 +{
   75.12 +	echo ""
   75.13 +	echo ${p}: ERROR: $*
   75.14 +	Usage
   75.15 +	exit 1
   75.16 +}
   75.17 +
   75.18 +GetOptions()
   75.19 +{
   75.20 +	# Set defaults
   75.21 +
   75.22 +	#JAVA_HOME is expected to be set in environment
   75.23 +
   75.24 +	PLATFORM="$FORTE_PORT"
   75.25 +	if [ "${PLATFORM}" = "cygwin" ]; then
   75.26 +	    	PLATFORM="nt"
   75.27 +	fi
   75.28 +	INSTALL_DIR="$SRCROOT/SUNWappserver"
   75.29 +	STATEFILE="sunappserver_statefile"
   75.30 +	STOREAUTH="FALSE"
   75.31 +	ENCRYPT="TRUE"
   75.32 +	PASSWORD="npoacvubuubealduopqzvanqzva"
   75.33 +	macarg=""
   75.34 +
   75.35 +	# Parse arguments
   75.36 +
   75.37 +	while [ $# -gt 0 -a "$1" != "" ]
   75.38 +	do
   75.39 +		arg=$1; shift
   75.40 +
   75.41 +		case $arg in
   75.42 +		-platform)
   75.43 +			if [ $# -eq 0 ]; then
   75.44 +			ErrorExit "-platform requires an argument (solsparc, nt, linux)"
   75.45 +			fi
   75.46 +			PLATFORM="$1"
   75.47 +			shift
   75.48 +			;;
   75.49 +		-wizard_id)
   75.50 +			if [ $# -eq 0 ]; then
   75.51 +			ErrorExit "-wizard_id requires an argument"
   75.52 +			fi
   75.53 +			WIZARD_ID="$1"
   75.54 +			shift
   75.55 +			;;
   75.56 +		-java_home)
   75.57 +			if [ $# -eq 0 ]; then
   75.58 +			ErrorExit "-java_home requires an argument"
   75.59 +			fi
   75.60 +			JDK_LOC="$1"
   75.61 +			shift
   75.62 +			;;
   75.63 +		-install_dir)
   75.64 +			if [ $# -eq 0 ]; then
   75.65 +			ErrorExit "-install_dir requires an argument"
   75.66 +			fi
   75.67 +			INSTALL_DIR="$1"
   75.68 +			shift
   75.69 +			;;
   75.70 +		-password)
   75.71 +			if [ $# -eq 0 ]; then
   75.72 +			ErrorExit "-password requires an argument"
   75.73 +			fi
   75.74 +			PASSWORD="$1"
   75.75 +			shift
   75.76 +			;;
   75.77 +		-statefile)
   75.78 +			if [ $# -eq 0 ]; then
   75.79 +			ErrorExit "-statefile requires an argument"
   75.80 +			fi
   75.81 +			STATEFILE="$1"
   75.82 +			shift
   75.83 +			;;
   75.84 +		-storeauth)
   75.85 +			STOREAUTH=TRUE
   75.86 +			;;
   75.87 +		-no_encrypt)
   75.88 +			ENCRYPT=FALSE
   75.89 +			;;
   75.90 +		*)
   75.91 +			ErrorExit "Unknown option: $arg"
   75.92 +			;;
   75.93 +		esac
   75.94 +	done
   75.95 +
   75.96 +}
   75.97 +
   75.98 +GetWizardID()
   75.99 +{
  75.100 +	# This function extracts the WizardID from the installer
  75.101 +	# If CACHEROOT is set it will use that location, but if not
  75.102 +    # it will use the APP_SERVER_LOCATION from create_installers
  75.103 +
  75.104 +	if [ "${CACHEROOT}x" != "x" ]; then
  75.105 +		if [ "${LOCALE_EXT}" = "ml" ]; then	
  75.106 +			APP_SERVER_LOCATION=$CACHEROOT/SunAppServerML
  75.107 +		else
  75.108 +			APP_SERVER_LOCATION=$CACHEROOT/SunAppServer
  75.109 +		fi
  75.110 +
  75.111 +		APP_SERVER_SPARC_NAME=`cd $APP_SERVER_LOCATION; echo *solaris-sparc*`
  75.112 +		APP_SERVER_X86_NAME=`cd $APP_SERVER_LOCATION; echo *solaris-i586*`
  75.113 +		APP_SERVER_WINDOWS_NAME=`cd $APP_SERVER_LOCATION; echo *windows*`
  75.114 +		APP_SERVER_LINUX_NAME=`cd $APP_SERVER_LOCATION; echo *linux*`
  75.115 +		APP_SERVER_MAC_NAME=`cd $APP_SERVER_LOCATION; echo *mac*`
  75.116 +	fi
  75.117 +
  75.118 +	case $PLATFORM in 
  75.119 +		solsparc)
  75.120 +			ASINSTALLER=`echo $APP_SERVER_LOCATION/$APP_SERVER_SPARC_NAME`
  75.121 +			;;
  75.122 +		solx86)
  75.123 +			ASINSTALLER=`echo $APP_SERVER_LOCATION/$APP_SERVER_X86_NAME`
  75.124 +			;;
  75.125 +		nt)
  75.126 +			ASINSTALLER=`echo $APP_SERVER_LOCATION/$APP_SERVER_WINDOWS_NAME`
  75.127 +			;;
  75.128 +		linux)
  75.129 +			ASINSTALLER=`echo $APP_SERVER_LOCATION/$APP_SERVER_LINUX_NAME`
  75.130 +			;;
  75.131 +		macosx)
  75.132 +			macarg="-Dwizard.NoNativeAbort=true"
  75.133 +			ASINSTALLER=`echo $APP_SERVER_LOCATION/$APP_SERVER_MAC_NAME`
  75.134 +			;;
  75.135 +	esac
  75.136 +
  75.137 +	if [ "${ASINSTALLER}x" = "x" ]; then
  75.138 +		ErrorExit "Unable to find PE installer from $APP_SERVER_LOCATION"
  75.139 +	fi
  75.140 +
  75.141 +	CURRDIR=`pwd`
  75.142 +	TMPDIR=/tmp/$USER/${p}.$$
  75.143 +	mkdir -p $TMPDIR
  75.144 +	cd $TMPDIR
  75.145 +	unzip -q $ASINSTALLER appserv.class > /dev/null 2>&1
  75.146 +	# unzip -q $ASINSTALLER appserv.class
  75.147 +	
  75.148 +	WIZARD_ID=`$JAVA_HOME/bin/java $macarg -cp . appserv -id`
  75.149 +	cd $CURRDIR
  75.150 +	rm -rf $TMPDIR
  75.151 +}
  75.152 +
  75.153 +Usage()
  75.154 +{
  75.155 +
  75.156 +  cat <<EOF
  75.157 +
  75.158 +Usage: sh $p
  75.159 +
  75.160 +Options:  -wizard_id <wizard_id> - Sets the Wizard ID to the specified value
  75.161 +          -platform <platform>   - Sets the desired platform statefile (solsparc, nt, linux)
  75.162 +          -java_home <java_home> - Sets the JDK_LOCATION to the specified location
  75.163 +          -install_dir <dir>     - Sets the location to install the server
  75.164 +          -statefile <file>      - Sets the filename to use for the statefile
  75.165 +          -password <pass>       - Sets the encrypted ASADMIN password
  75.166 +          -storeauth             - Sets STORE_AUTH_ADMIN to true (defaults to FALSE)
  75.167 +          -no_encrypt            - Sets ADMIN_PASSWORD_ENCRYPTED to false (defaults to TRUE)
  75.168 +
  75.169 +Description:
  75.170 +
  75.171 +This script will generate a statefile for use with automated
  75.172 +installations of the Sun application server.  The hard-coded
  75.173 +default values are expected to change relatively frequently
  75.174 +as the version of the app server changes.
  75.175 +
  75.176 +If using the default values, this script assumes that SRCROOT
  75.177 +is set.  If you override with the -install_dir argument,
  75.178 +you do not need to set SRCROOT.
  75.179 +
  75.180 +EOF
  75.181 +}
  75.182 +
  75.183 +
  75.184 +p=`basename $0`
  75.185 +
  75.186 +GetOptions "$@"
  75.187 +
  75.188 +# If the wizard_id isn't passed on the ocmmand line, go figure it out
  75.189 +if [ "${WIZARD_ID}x" = "x" ]; then
  75.190 +	GetWizardID 
  75.191 +fi
  75.192 +
  75.193 +cat << EOF > $STATEFILE
  75.194 +#
  75.195 +# Wizard Statefile generatd by ${p}
  75.196 +#              
  75.197 +# Wizard Statefile section for Sun Java System Application Server 
  75.198 +#
  75.199 +[STATE_BEGIN Sun Java System Application Server ${WIZARD_ID}]
  75.200 +defaultInstallDirectory = $INSTALL_DIR
  75.201 +currentInstallDirectory = $INSTALL_DIR
  75.202 +JDK_LOCATION = ${JDK_LOC}
  75.203 +INST_ASADMIN_USERNAME = admin
  75.204 +INST_ASADMIN_PASSWORD = ${PASSWORD}
  75.205 +INST_ASADMIN_PORT = 14848
  75.206 +INST_ASWEB_PORT = 18080
  75.207 +INST_HTTPS_PORT = 11043
  75.208 +STORE_ADMIN_AUTH = ${STOREAUTH}
  75.209 +ADMIN_PASSWORD_ENCRYPTED = ${ENCRYPT}
  75.210 +CREATE_SAMPLES_DOMAIN = FALSE
  75.211 +CREATE_DESKTOP_SHORTCUT = FALSE
  75.212 +[STATE_DONE Sun Java System Application Server ${WIZARD_ID}]
  75.213 +EOF
    76.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.2 +++ b/visualweb/ravebuild/default-rave-properties.xml	Sun Jan 28 18:54:08 2007 +0000
    76.3 @@ -0,0 +1,88 @@
    76.4 +<?xml version="1.0" encoding="UTF-8"?> 
    76.5 +<!--
    76.6 +The contents of this file are subject to the terms of the Common Development
    76.7 +and Distribution License (the License). You may not use this file except in
    76.8 +compliance with the License.
    76.9 +
   76.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   76.11 +or http://www.netbeans.org/cddl.txt.
   76.12 +
   76.13 +When distributing Covered Code, include this CDDL Header Notice in each file
   76.14 +and include the License file at http://www.netbeans.org/cddl.txt.
   76.15 +If applicable, add the following below the CDDL Header, with the fields
   76.16 +enclosed by brackets [] replaced by your own identifying information:
   76.17 +"Portions Copyrighted [year] [name of copyright owner]"
   76.18 +
   76.19 +The Original Software is NetBeans. The Initial Developer of the Original
   76.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   76.21 +Microsystems, Inc. All Rights Reserved.
   76.22 +-->
   76.23 +
   76.24 +<project name="default-rave-properties" default="none" basedir=".">
   76.25 +
   76.26 +  <dirname property="rave_all" file="${ant.file.default-rave-properties}/.."/>
   76.27 +  
   76.28 +  <property name="netbeans.dest.dir" location="${rave_all}/ravebuild/rave"/>
   76.29 +  <property name="netbeans.location" location="${rave_all}/ravebuild/netbeans"/>
   76.30 +  
   76.31 +  <!-- setting dest and prefix for zip file -->
   76.32 +  <property name="rave.zip.dest" location="${rave_all}/ravebuild"/>
   76.33 +  <property name="rave.zip.prefix" value="creator"/>
   76.34 +  <property name="cache.dir" location="${rave_all}/ravebuild"/>
   76.35 + 
   76.36 +  <property name="jdkhome" value="${netbeans.dest.dir}/java"/>
   76.37 +  
   76.38 +  <!-- properties related to netbeans -->
   76.39 +  <property name="nb.cache.dir" location="${cache.dir}"/>
   76.40 +  <property name="en.nb.name.part1" value="netbeans-5_5-special"/>
   76.41 +  <property name="en.nb.name.part2" value="200701190000"/>
   76.42 +  <property name="en.nb.name.part3" value="19_Jan_2007_0000"/>
   76.43 +  <property name="ml.nb.name.part1" value="netbeans-5_5-daily"/>
   76.44 +  <property name="ml.nb.name.part2" value="200611140100"/>
   76.45 +  <property name="ml.nb.name.part3" value="14_Nov_2006_0100"/> 
   76.46 +  <property name="ml.nb.name.suffix" value="ml_ja_zh_CN_pt_BR"/>
   76.47 +
   76.48 +  <property name="nb.src.zip" value="${en.nb.name.part1}-src-${en.nb.name.part2}-ide_sources-${en.nb.name.part3}.zip"/>
   76.49 +  <property name="nb.bin.zip" value="${en.nb.name.part1}-bin-${en.nb.name.part2}-ide-${en.nb.name.part3}.zip"/>
   76.50 +
   76.51 +  <property name="nb.linux" value="${en.nb.name.part1}-bin-${en.nb.name.part2}-linux-${en.nb.name.part3}.bin"/>
   76.52 +  <property name="nb.mac" value="${en.nb.name.part1}-bin-${en.nb.name.part2}-macosx-${en.nb.name.part3}.tar.gz"/>
   76.53 +  <property name="nb.solsparc" value="${en.nb.name.part1}-bin-${en.nb.name.part2}-solaris-sparc-${en.nb.name.part3}.bin"/>
   76.54 +  <property name="nb.solx86" value="${en.nb.name.part1}-bin-${en.nb.name.part2}-solaris-x86-${en.nb.name.part3}.bin"/>
   76.55 +  <property name="nb.win" value="${en.nb.name.part1}-bin-${en.nb.name.part2}-windows-${en.nb.name.part3}.exe"/>
   76.56 +
   76.57 +  <property name="nb.linux.ml" value="${ml.nb.name.part1}-bin-${ml.nb.name.part2}-linux-${ml.nb.name.suffix}-${ml.nb.name.part3}.bin"/>
   76.58 +  <property name="nb.mac.ml" value="${ml.nb.name.part1}-bin-${ml.nb.name.part2}-macosx-${ml.nb.name.suffix}-${ml.nb.name.part3}.tar.gz"/>
   76.59 +  <property name="nb.solsparc.ml" value="${ml.nb.name.part1}-bin-${ml.nb.name.part2}-solaris-sparc-${ml.nb.name.suffix}-${ml.nb.name.part3}.bin"/>
   76.60 +  <property name="nb.solx86.ml" value="${ml.nb.name.part1}-bin-${ml.nb.name.part2}-solaris-x86-${ml.nb.name.suffix}-${ml.nb.name.part3}.bin"/>
   76.61 +  <property name="nb.win.ml" value="${ml.nb.name.part1}-bin-${ml.nb.name.part2}-windows-${ml.nb.name.suffix}-${ml.nb.name.part3}.exe"/>
   76.62 +
   76.63 +  <property name="nb.bin.base" location="${rave_all}/ravebuild"/>
   76.64 +  <property name="nb.src.base" location="${rave_all}/ravebuild"/>
   76.65 +  <property name="nb.src.dir" location="${nb.src.base}/netbeans-src"/>
   76.66 +  <property name="nb.forked.modules.dir" location="${rave_all}"/>
   76.67 +  <property name="l10n.dist.dir" location="${rave_all}/ravebuild/l10ndist"/>  
   76.68 +  <property name="ravebuild.cache.server.url" value="http://balui.sfbay.sun.com/cache/CCRproto/netbeans"/>
   76.69 +
   76.70 +  <!-- properties related to ismp -->
   76.71 +  <property name="ismp.cache.dir" location="${cache.dir}/ISMP"/>
   76.72 +  <property name="ismp.name" value="is11sab.zip"/>
   76.73 +  <property name="ismp.cache.server.url" value="http://clue.sfbay.sun.com/kits2/installs/ismp/XI"/>
   76.74 +
   76.75 +  <!-- properties related to glassfish -->
   76.76 +  <property name="as.cache.dir" location="${cache.dir}/SunAppServer"/>
   76.77 +  <property name="as.linux" value="glassfish-installer-linux-v1_ur1-b14.jar"/>
   76.78 +  <property name="as.mac" value="glassfish-installer-mac-v1_ur1-b14.jar"/>
   76.79 +  <property name="as.solsparc" value="glassfish-installer-sol-sparc-v1_ur1-b14.jar"/>
   76.80 +  <property name="as.solx86" value="glassfish-installer-sol-x86-v1_ur1-b14.jar"/>
   76.81 +  <property name="as.win" value="glassfish-installer-windows-v1_ur1-b14.jar"/>
   76.82 +  <property name="as.cache.server.url" value="http://balui.sfbay.sun.com/cache/SunAppServer/v1ur1/PE/b14"/>
   76.83 +
   76.84 +  <property name="jdk.cache.dir" location="${cache.dir}/JDKzip"/>
   76.85 +  <property name="jdk.linux" value="j2sdk-1.5.0_06-linux"/>
   76.86 +  <property name="jdk.solsparc" value="j2sdk-1.5.0_06-solsparc"/>
   76.87 +  <property name="jdk.solx86" value="j2sdk-1.5.0_06-solx86"/>
   76.88 +  <property name="jdk.win" value="j2sdk-1.5.0_06-nt"/>
   76.89 +  <property name="jdk.cache.server.url" value="http://balui.sfbay.sun.com/cache/j2se/1.5.0_06"/>
   76.90 +
   76.91 +</project>
    77.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.2 +++ b/visualweb/ravebuild/merge-forked-modules.xml	Sun Jan 28 18:54:08 2007 +0000
    77.3 @@ -0,0 +1,154 @@
    77.4 +<?xml version='1.0' encoding='UTF-8' ?>
    77.5 +<!--
    77.6 +The contents of this file are subject to the terms of the Common Development
    77.7 +and Distribution License (the License). You may not use this file except in
    77.8 +compliance with the License.
    77.9 +
   77.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   77.11 +or http://www.netbeans.org/cddl.txt.
   77.12 +
   77.13 +When distributing Covered Code, include this CDDL Header Notice in each file
   77.14 +and include the License file at http://www.netbeans.org/cddl.txt.
   77.15 +If applicable, add the following below the CDDL Header, with the fields
   77.16 +enclosed by brackets [] replaced by your own identifying information:
   77.17 +"Portions Copyrighted [year] [name of copyright owner]"
   77.18 +
   77.19 +The Original Software is NetBeans. The Initial Developer of the Original
   77.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   77.21 +Microsystems, Inc. All Rights Reserved.
   77.22 +-->
   77.23 +
   77.24 +
   77.25 +<project name="merge-forked-modules" default="merge" basedir=".">
   77.26 +<!-- Should be set -->
   77.27 +  <property name="rave_all" value="${basedir}/.."/>
   77.28 +  <property name="nb.src.dir" value="${rave_all}/ravebuild/netbeans-src"/>
   77.29 +
   77.30 +  <basename property="modulename" file="${basedir}"/>
   77.31 +  <property name="timestamp-dir" value="${nb.src.dir}/merge_timestamps"/>
   77.32 +  <property name="originals-dir" value="${rave_all}/ravebuild/merge_originals/${modulename}"/>
   77.33 +  <property name="timestamp-file" value="module.${modulename}.ts"/>
   77.34 +  <property name="touchstamp-file" value="module.${modulename}.touch"/>
   77.35 +
   77.36 +  <target name="init">
   77.37 +    <echo message="Start merge of ${modulename}"/>
   77.38 +
   77.39 +    <mkdir dir="${timestamp-dir}"/>
   77.40 +    <mkdir dir="${originals-dir}"/>
   77.41 +
   77.42 +    <available property="touchfile.exists" file="${timestamp-dir}/${touchstamp-file}"/>
   77.43 +  </target>
   77.44 +
   77.45 +  <target name="touch-files" depends="init" unless="touchfile.exists">
   77.46 +    <!-- The touch is needed to keep the no.restore checks working  -->
   77.47 +    <touch>
   77.48 +      <fileset dir="${basedir}" includes="**/*" defaultexcludes="yes"/>
   77.49 +    </touch>
   77.50 +    <touch file="${timestamp-dir}/${touchstamp-file}"/>
   77.51 +  </target>
   77.52 +
   77.53 +  <target name="check-timestamps" depends="touch-files">
   77.54 +    <uptodate property="merge.uptodate" targetfile="${timestamp-dir}/${timestamp-file}">
   77.55 +      <srcfiles dir="." includes="**/*" defaultexcludes="yes"/>
   77.56 +    </uptodate>
   77.57 +    <condition property="no.restore.one">
   77.58 +      <uptodate> 
   77.59 +        <srcfiles dir="${originals-dir}" includes="**/*"
   77.60 +          excludes="_nbproject/**/*" defaultexcludes="yes"/>
   77.61 +        <mapper type="glob" from="*" to="${basedir}/*"/>
   77.62 +      </uptodate>
   77.63 +    </condition>
   77.64 +    <condition property="no.restore.two">
   77.65 +      <uptodate>
   77.66 +        <srcfiles dir="${originals-dir}" includes="_nbproject/**/*"
   77.67 +          defaultexcludes="yes"/>
   77.68 +        <mapper type="glob" from="_nbproject/*" to="${basedir}/nbproject/*"/>
   77.69 +      </uptodate>
   77.70 +    </condition>
   77.71 +    <condition property="no.restore">
   77.72 +      <and>
   77.73 +        <isset property="no.restore.one"/>
   77.74 +        <isset property="no.restore.two"/>
   77.75 +      </and>
   77.76 +    </condition>
   77.77 +<!--
   77.78 +    <echo message="mw merge.uptodate= ${merge.uptodate}"/>
   77.79 +    <echo message="mw no.restore.one= ${no.restore.one}"/>
   77.80 +    <echo message="mw no.restore.two= ${no.restore.two}"/>
   77.81 +    <echo message="mw no.restore= ${no.restore}"/>
   77.82 +-->
   77.83 +  </target>
   77.84 +
   77.85 +  <target name="restore-files" depends="check-timestamps" unless="no.restore">
   77.86 +    <move todir="${nb.src.dir}/${modulename}" overwrite="true">
   77.87 +      <fileset dir="${originals-dir}" includes="**/*"
   77.88 +          excludes="_nbproject/**/*" defaultexcludes="yes">
   77.89 +        <not>
   77.90 +          <present targetdir="${basedir}"/>
   77.91 +        </not>
   77.92 +      </fileset>
   77.93 +    </move>
   77.94 +    <move todir="${nb.src.dir}/${modulename}" overwrite="true">
   77.95 +      <fileset dir="${originals-dir}" includes="_nbproject/**/*"
   77.96 +          defaultexcludes="yes">
   77.97 +        <not>
   77.98 +          <present targetdir="${basedir}">
   77.99 +            <mapper type="glob" from="_nbproject/*" to="nbproject/*"/>
  77.100 +          </present>
  77.101 +        </not>
  77.102 +      </fileset>
  77.103 +      <mapper type="glob" from="_nbproject/*" to="nbproject/*"/>
  77.104 +    </move>
  77.105 +    <touch file="${timestamp-dir}/${timestamp-file}"/>
  77.106 +  </target>
  77.107 +
  77.108 +  <target name="remove-files" depends="check-timestamps,restore-files"
  77.109 +      unless="merge.uptodate">
  77.110 +    <move todir="${originals-dir}" overwrite="false">
  77.111 +      <fileset dir="${nb.src.dir}/${modulename}" includes="**/*"
  77.112 +          excludes="nbproject/**/*" defaultexcludes="yes">
  77.113 +        <and>
  77.114 +          <present targetdir="${basedir}"/>
  77.115 +          <different targetdir="${basedir}"/>
  77.116 +          <not>
  77.117 +            <present targetdir="${originals-dir}"/>
  77.118 +          </not>
  77.119 +        </and>
  77.120 +      </fileset>
  77.121 +    </move>
  77.122 +    <move todir="${originals-dir}" overwrite="false">
  77.123 +      <fileset dir="${nb.src.dir}/${modulename}" includes="nbproject/**/*"
  77.124 +          defaultexcludes="yes">
  77.125 +        <and>
  77.126 +          <present targetdir="${basedir}"/>
  77.127 +          <different targetdir="${basedir}"/>
  77.128 +          <not>
  77.129 +            <present targetdir="${originals-dir}">
  77.130 +              <mapper type="glob" from="nbproject/*" to="_nbproject/*"/>
  77.131 +            </present>
  77.132 +          </not>
  77.133 +        </and>
  77.134 +      </fileset>
  77.135 +      <mapper type="glob" from="nbproject/*" to="_nbproject/*"/>
  77.136 +    </move>
  77.137 +    <delete includeEmptyDirs="yes">
  77.138 +      <fileset dir="${nb.src.dir}/${modulename}" includes="**/*" defaultexcludes="yes">
  77.139 +        <and>
  77.140 +          <present targetdir="${basedir}"/>
  77.141 +          <different targetdir="${basedir}"/>
  77.142 +        </and>
  77.143 +      </fileset>
  77.144 +    </delete>
  77.145 +  </target>
  77.146 +
  77.147 +  <target name="merge" depends="check-timestamps,remove-files" unless="merge.uptodate">
  77.148 +    <copy todir="${nb.src.dir}/${modulename}">
  77.149 +      <fileset dir="${basedir}" includes="**/*" defaultexcludes="yes">
  77.150 +        <size value="0" when="more"/>
  77.151 +      </fileset>
  77.152 +    </copy>
  77.153 +    <touch file="${timestamp-dir}/${timestamp-file}"/>
  77.154 +
  77.155 +    <echo message="Finished merge of ${modulename}"/>
  77.156 +  </target>
  77.157 +</project>
    78.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.2 +++ b/visualweb/ravebuild/nbproject/project.xml	Sun Jan 28 18:54:08 2007 +0000
    78.3 @@ -0,0 +1,97 @@
    78.4 +<?xml version="1.0" encoding="UTF-8"?>
    78.5 +<!--
    78.6 +The contents of this file are subject to the terms of the Common Development
    78.7 +and Distribution License (the License). You may not use this file except in
    78.8 +compliance with the License.
    78.9 +
   78.10 +You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   78.11 +or http://www.netbeans.org/cddl.txt.
   78.12 +
   78.13 +When distributing Covered Code, include this CDDL Header Notice in each file
   78.14 +and include the License file at http://www.netbeans.org/cddl.txt.
   78.15 +If applicable, add the following below the CDDL Header, with the fields
   78.16 +enclosed by brackets [] replaced by your own identifying information:
   78.17 +"Portions Copyrighted [year] [name of copyright owner]"
   78.18 +
   78.19 +The Original Software is NetBeans. The Initial Developer of the Original
   78.20 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   78.21 +Microsystems, Inc. All Rights Reserved.
   78.22 +-->
   78.23 +
   78.24 +<project xmlns="http://www.netbeans.org/ns/project/1">
   78.25 +    <type>org.netbeans.modules.ant.freeform</type>
   78.26 +    <configuration>
   78.27 +        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
   78.28 +            <!-- Do not use Project Properties customizer when editing this file manually. -->
   78.29 +            <name>Rave Build System</name>
   78.30 +            <properties/>
   78.31 +            <folders>
   78.32 +                <source-folder>
   78.33 +                    <label>antsrc</label>
   78.34 +                    <type>java</type>
   78.35 +                    <location>antsrc</location>
   78.36 +                </source-folder>
   78.37 +            </folders>
   78.38 +            <ide-actions>
   78.39 +                <action name="build">
   78.40 +                    <target>build</target>
   78.41 +                </action>
   78.42 +                <action name="clean">
   78.43 +                    <target>clean-portletcontainer</target>
   78.44 +                </action>
   78.45 +                <action name="javadoc">
   78.46 +                    <target>all-extension/javadoc</target>
   78.47 +                </action>
   78.48 +                <action name="run">
   78.49 +                    <target>all-dataprovider/runtime</target>
   78.50 +                </action>
   78.51 +                <action name="test">
   78.52 +                    <target>clean-test</target>
   78.53 +                </action>
   78.54 +                <action name="rebuild">
   78.55 +                    <target>clean-portletcontainer</target>
   78.56 +                    <target>build</target>
   78.57 +                </action>
   78.58 +            </ide-actions>
   78.59 +            <export>
   78.60 +                <type>folder</type>
   78.61 +                <location>build/antclasses</location>
   78.62 +                <build-target>all-nozip</build-target>
   78.63 +            </export>
   78.64 +            <export>
   78.65 +                <type>jar</type>
   78.66 +                <location>raveantext.jar</location>
   78.67 +                <build-target>all-nozip</build-target>
   78.68 +            </export>
   78.69 +            <view>
   78.70 +                <items>
   78.71 +                    <source-folder style="packages">
   78.72 +                        <label>antsrc</label>
   78.73 +                        <location>antsrc</location>
   78.74 +                    </source-folder>
   78.75 +                    <source-file>
   78.76 +                        <location>build.xml</location>
   78.77 +                    </source-file>
   78.78 +                </items>
   78.79 +                <context-menu>
   78.80 +                    <ide-action name="build"/>
   78.81 +                    <ide-action name="clean"/>
   78.82 +                    <ide-action name="javadoc"/>
   78.83 +                    <ide-action name="run"/>
   78.84 +                    <ide-action name="test"/>
   78.85 +                    <ide-action name="rebuild"/>
   78.86 +                </context-menu>
   78.87 +            </view>
   78.88 +            <subprojects/>
   78.89 +        </general-data>
   78.90 +        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
   78.91 +            <compilation-unit>
   78.92 +                <package-root>antsrc</package-root>
   78.93 +                <classpath mode="compile">${ant.home}/lib/ant.jar</classpath>
   78.94 +                <built-to>build/antclasses</built-to>
   78.95 +                <built-to>raveantext.jar</built-to>
   78.96 +                <source-level>1.4</source-level>
   78.97 +            </compilation-unit>
   78.98 +        </java-data>
   78.99 +    </configuration>
  78.100 +</project>
    79.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.2 +++ b/visualweb/ravebuild/visualweb-nbm-license.txt	Sun Jan 28 18:54:08 2007 +0000
    79.3 @@ -0,0 +1,118 @@
    79.4 +Sun Microsystems, Inc. ("Sun")
    79.5 +SOFTWARE LICENSE AGREEMENT and ENTITLEMENT for SOFTWARE 
    79.6 +
    79.7 +ENTITLEMENT for SOFTWARE 
    79.8 +
    79.9 +Licensee/Company: Entity receiving Software.
   79.10 +
   79.11 +Effective Date:  Date Sun delivers the Software to You.
   79.12 +
   79.13 +Software: The Add-On Module delivered to You.
   79.14 +
   79.15 +Host Software: The software product(s) described in the Software's documentation for which the Software is intended to be used with.
   79.16 +
   79.17 +Permitted Use:  The Permitted Use shall be the same as the Permitted Use in Your Host Software's Software License Agreement.  Software may only be used in conjunction with the Host Software.  Use of the Software on a stand-alone basis is not permitted under this license.  If You do not have a valid license to use the Host Software, You have no license to use the Software for any purpose.
   79.18 +
   79.19 +License Term:  The License Term shall be the same as the License Term set forth in your Host Software's license agreement.  
   79.20 +
   79.21 +Licensed Unit: The Licensed Unit shall be the same as the Licensed Unit set forth in your Host Software's Software License Agreement.
   79.22 +
   79.23 +Licensed Unit Count: The License Unit Count  shall be the same as the Licensed Unit Count set forth in your Host Software's Software License Agreement.
   79.24 +
   79.25 + 
   79.26 +Sun Microsystems, Inc. ("Sun")
   79.27 +SOFTWARE LICENSE AGREEMENT
   79.28 +
   79.29 +READ THE TERMS OF THIS AGREEMENT ("AGREEMENT") CAREFULLY BEFORE OPENING SOFTWARE MEDIA PACKAGE. BY OPENING SOFTWARE MEDIA PACKAGE, YOU AGREE TO THE TERMS OF THIS AGREEMENT. IF YOU ARE ACCESSING SOFTWARE ELECTRONICALLY, INDICATE YOUR ACCEPTANCE OF THESE TERMS BY SELECTING THE "ACCEPT" BUTTON AT THE END OF THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL OF THE TERMS, PROMPTLY RETURN THE UNUSED SOFTWARE TO YOUR PLACE OF PURCHASE FOR A REFUND OR, IF SOFTWARE IS ACCESSED ELECTRONICALLY, SELECT THE "DECLINE" (OR "EXIT") BUTTON AT THE END OF THIS AGREEMENT. IF YOU HAVE SEPARATELY AGREED TO LICENSE TERMS ("MASTER TERMS") FOR YOUR LICENSE TO THIS SOFTWARE, THEN SECTIONS 1-5 OF THIS AGREEMENT ("SUPPLEMENTAL LICENSE TERMS") SHALL SUPPLEMENT AND SUPERSEDE THE MASTER TERMS IN RELATION TO THIS SOFTWARE.
   79.30 +
   79.31 +1.	Definitions.
   79.32 +
   79.33 +(a) 	"Entitlement" means the collective set of applicable documents authorized by Sun evidencing your obligation to pay associated fees (if any) for the license, associated Services, and the authorized scope of use of Software under this Agreement.
   79.34 +
   79.35 +(b) 	"Licensed Unit" means the unit of measure by which your use of Software and/or Service is licensed, as described in your Entitlement.
   79.36 +
   79.37 +(c)	"Permitted Use" means the licensed Software use(s) authorized in this Agreement as specified in your Entitlement. The Permitted Use for any bundled Sun software not specified in your Entitlement will be evaluation use as provided in Section 3.
   79.38 +
   79.39 +(d) 	"Service" means the service(s) that Sun or its delegate will provide, if any, as selected in your Entitlement and as further described in the applicable service listings at www.sun.com/service/servicelist.
   79.40 +
   79.41 +(e) 	"Software" means the Sun software described in your Entitlement. Also, certain software may be included for evaluation use under Section 3. 
   79.42 +
   79.43 +(f)	"You" and "Your" means the individual or legal entity specified in the Entitlement, or for evaluation purposes, the entity performing the evaluation.
   79.44 +
   79.45 +2.	License Grant and Entitlement.
   79.46 +
   79.47 +Subject to the terms of your Entitlement, Sun grants you a nonexclusive, nontransferable limited license to use Software for its Permitted Use for the license term. Your Entitlement will specify (a) Software licensed, (b) the Permitted Use, (c) the license term, and (d) the Licensed Units. 
   79.48 +
   79.49 +Additionally, if your Entitlement includes Services, then it will also specify the (e) Service and (f) service term. 
   79.50 +
   79.51 +If your rights to Software or Services are limited in duration and the date such rights begin is other than the purchase date, your Entitlement will provide that beginning date(s).
   79.52 +
   79.53 +The Entitlement may be delivered to you in various ways depending on the manner in which you obtain Software and Services, for example, the Entitlement may be provided in your receipt, invoice or your contract with Sun or authorized Sun reseller. It may also be in electronic format if you download Software.
   79.54 +
   79.55 +3.	Permitted Use.
   79.56 +
   79.57 +As selected in your Entitlement, one or more of the following Permitted Uses will apply to your use of Software. Unless you have an Entitlement that expressly permits it, you may not use Software for any of the other Permitted Uses. If you don't have an Entitlement, or if your Entitlement doesn't cover additional software delivered to you, then such software is for your Evaluation Use.
   79.58 +
   79.59 +(a) Evaluation Use. You may evaluate Software internally for a period of 90 days from your first use. 
   79.60 +
   79.61 +(b) Research and Instructional Use. You may use Software internally to design, develop and test, and also to provide instruction on such uses.
   79.62 +
   79.63 +(c) Individual Use. You may use Software internally for personal, individual use.
   79.64 +
   79.65 +(d) Commercial Use. You may use Software internally for your own commercial purposes. 
   79.66 +
   79.67 +(e) Service Provider Use. You may make Software functionality accessible (but not by providing Software itself or through outsourcing services) to your end users in an extranet deployment, but not to your affiliated companies or to government agencies.
   79.68 +
   79.69 +4.	Licensed Units.
   79.70 +
   79.71 +Your Permitted Use is limited to the number of Licensed Units stated in your Entitlement. If you require additional Licensed Units, you will need additional Entitlement(s).
   79.72 +
   79.73 +5.	Restrictions.
   79.74 +
   79.75 +(a) The copies of Software provided to you under this Agreement is licensed, not sold, to you by Sun. Sun reserves all rights not expressly granted. (b) You may make a single archival copy of Software, but otherwise may not copy, modify, or distribute Software. However if the Sun documentation accompanying Software lists specific portions of Software, such as header files, class libraries, reference source code, and/or redistributable files, that may be handled differently, you may do so only as provided in the Sun documentation. (c) You may not rent, lease, lend or encumber Software. (d) Unless enforcement is prohibited by applicable law, you may not decompile, or reverse engineer Software. (e) The terms and conditions of this Agreement will apply to any Software updates, provided to you at Sun's discretion, that replace and/or supplement the original Software, unless such update contains a separate license. (f) You may not publish or provide the results of any benchmark or comparison tests run on Software to any third party without the prior written consent of Sun. (g) Software is confidential and copyrighted. (h) Unless otherwise specified, if Software is delivered with embedded or bundled software that enables functionality of Software, you may not use such software on a stand-alone basis or use any portion of such software to interoperate with any program(s) other than Software. (i) Software may contain programs that perform automated collection of system data and/or automated software updating services. System data collected through such programs may be used by Sun, its subcontractors, and its service delivery partners for the purpose of providing you with remote system services and/or improving Sun's software and systems. (j) Software is not designed, licensed or intended for use in the design, construction, operation or maintenance of any nuclear facility and Sun and its licensors disclaim any express or implied warranty of fitness for such uses. (k) No right, title or interest in or to any trademark, service mark, logo or trade name of Sun or its licensors is granted under this Agreement.
   79.76 +
   79.77 +6.	Term and Termination. 
   79.78 +
   79.79 +The license and service term are set forth in your Entitlement(s). Your rights under this Agreement will terminate immediately without notice from Sun if you materially breach it or take any action in derogation of Sun's and/or its licensors' rights to Software. Sun may terminate this Agreement should any Software become, or in Sun's reasonable opinion likely to become, the subject of a claim of intellectual property infringement or trade secret misappropriation. Upon termination, you will cease use of, and destroy, Software and confirm compliance in writing to Sun. Sections 1, 5, 6, 7, and 9-15 will survive termination of the Agreement.
   79.80 +
   79.81 +7.	Java Compatibility and Open Source.
   79.82 +
   79.83 +Software may contain Java technology. You may not create additional classes to, or modifications of, the Java technology, except under compatibility requirements available under a separate agreement available at www.java.net.
   79.84 +
   79.85 +Sun supports and benefits from the global community of open source developers, and thanks the community for its important contributions and open standards-based technology, which Sun has adopted into many of its products.
   79.86 +
   79.87 +Please note that portions of Software may be provided with notices and open source licenses from such communities and third parties that govern the use of those portions, and any licenses granted hereunder do not alter any rights and obligations you may have under such open source licenses, however, the disclaimer of warranty and limitation of liability provisions in this Agreement will apply to all Software in this distribution.
   79.88 +
   79.89 +8. 	Limited Warranty. 
   79.90 +
   79.91 +Sun warrants to you that for a period of 90 days from the date of purchase, as evidenced by a copy of the receipt, the media on which Software is furnished (if any) will be free of defects in materials and workmanship under normal use. Except for the foregoing, Software is provided "AS IS". Your exclusive remedy and Sun's entire liability under this limited warranty will be at Sun's option to replace Software media or refund the fee paid for Software. Some states do not allow limitations on certain implied warranties, so the above may not apply to you. This limited warranty gives you specific legal rights. You may have others, which vary from state to state.
   79.92 +
   79.93 +9.	Disclaimer of Warranty. 
   79.94 +
   79.95 +UNLESS SPECIFIED IN THIS AGREEMENT, ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. 
   79.96 +
   79.97 +10. 	Limitation of Liability. 
   79.98 +
   79.99 +TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event will Sun's liability to you, whether in contract, tort (including negligence), or otherwise, exceed the amount paid by you for Software under this Agreement. The foregoing limitations will apply even if the above stated warranty fails of its essential purpose. Some states do not allow the exclusion of incidental or consequential damages, so some of the terms above may not be applicable to you. 
  79.100 +
  79.101 +11. 	Export Regulations. 
  79.102 +
  79.103 +All Software, documents, technical data, and any other materials delivered under this Agreement are subject to U.S. export control laws and may be subject to export or import regulations in other countries. You agree to comply strictly with these laws and regulations and acknowledge that you have the responsibility to obtain any licenses to export, re-export, or import as may be required after delivery to you. 
  79.104 +
  79.105 +12. 	U.S. Government Restricted Rights. 
  79.106 +
  79.107 +If Software is being acquired by or on behalf of the U.S. Government or by a U.S. Government prime contractor or subcontractor (at any tier), then the Government's rights in Software and accompanying documentation will be only as set forth in this Agreement; this is in accordance with 48 CFR 227.7201 through 227.7202-4 (for Department of Defense (DOD) acquisitions) and with 48 CFR 2.101 and 12.212 (for non-DOD acquisitions). 
  79.108 +
  79.109 +13. 	Governing Law. 
  79.110 +
  79.111 +Any action related to this Agreement will be governed by California law and controlling U.S. federal law. No choice of law rules of any jurisdiction will apply. 
  79.112 +
  79.113 +14. 	Severability. 
  79.114 +
  79.115 +If any provision of this Agreement is held to be unenforceable, this Agreement will remain in effect with the provision omitted, unless omission would frustrate the intent of the parties, in which case this Agreement will immediately terminate.
  79.116 +
  79.117 +15. 	Integration. 
  79.118 +
  79.119 +This Agreement, including any terms contained in your Entitlement, is the entire agreement between you and Sun relating to its subject matter. It supersedes all prior or contemporaneous oral or written communications, proposals, representations and warranties and prevails over any conflicting or additional terms of any quote, order, acknowledgment, or other communication between the parties relating to its subject matter during the term of this Agreement. No modification of this Agreement will be binding, unless in writing and signed by an authorized representative of each party.
  79.120 +
  79.121 +Please contact Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, California 95054 if you have questions.