Merged in files from main/misc.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/misc/build.xml Wed Feb 23 20:12:58 2011 -0500
1.3 @@ -0,0 +1,64 @@
1.4 +<?xml version="1.0" encoding="UTF-8"?>
1.5 +<!--
1.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
1.7 +
1.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
1.9 +
1.10 +
1.11 +The contents of this file are subject to the terms of either the GNU
1.12 +General Public License Version 2 only ("GPL") or the Common
1.13 +Development and Distribution License("CDDL") (collectively, the
1.14 +"License"). You may not use this file except in compliance with the
1.15 +License. You can obtain a copy of the License at
1.16 +http://www.netbeans.org/cddl-gplv2.html
1.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
1.18 +specific language governing permissions and limitations under the
1.19 +License. When distributing the software, include this License Header
1.20 +Notice in each file and include the License file at
1.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
1.22 +particular file as subject to the "Classpath" exception as provided
1.23 +by Sun in the GPL Version 2 section of the License file that
1.24 +accompanied this code. If applicable, add the following below the
1.25 +License Header, with the fields enclosed by brackets [] replaced by
1.26 +your own identifying information:
1.27 +"Portions Copyrighted [year] [name of copyright owner]"
1.28 +
1.29 +Contributor(s):
1.30 +
1.31 +The Original Software is NetBeans. The Initial Developer of the Original
1.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
1.33 +Microsystems, Inc. All Rights Reserved.
1.34 +
1.35 +If you wish your version of this file to be governed by only the CDDL
1.36 +or only the GPL Version 2, indicate your decision by adding
1.37 +"[Contributor] elects to include this software in this distribution
1.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
1.39 +single choice of license, a recipient has the option to distribute
1.40 +your version of this file under either the CDDL, the GPL Version 2 or
1.41 +to extend the choice of license to its licensees as provided above.
1.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
1.43 +Version 2 license, then the option applies only if the new code is
1.44 +made subject to such option by the copyright holder.
1.45 +-->
1.46 +<project name="Visual Web Build" default="build" basedir=".">
1.47 + <property name="build.sysclasspath" value="ignore"/>
1.48 +
1.49 + <target name="build">
1.50 + <subant target="build" inheritAll="false" buildpath="visualwebsuite">
1.51 + <property name="scan.binaries" value="true"/>
1.52 + </subant>
1.53 + </target>
1.54 +
1.55 + <target name="build-zip" depends="build">
1.56 + <mkdir dir="dist"/>
1.57 + <zip destfile="dist/visualweb1.zip">
1.58 + <zipfileset dir="${nb_all}/nbbuild/netbeans/visualweb1" prefix="visualweb1"/>
1.59 + </zip>
1.60 + </target>
1.61 +
1.62 + <target name="clean">
1.63 + <subant target="clean" inheritAll="false" buildpath="visualwebsuite">
1.64 + <property name="scan.binaries" value="true"/>
1.65 + </subant>
1.66 + </target>
1.67 +</project>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/misc/nbproject/project.xml Wed Feb 23 20:12:58 2011 -0500
2.3 @@ -0,0 +1,77 @@
2.4 +<?xml version="1.0" encoding="UTF-8"?>
2.5 +<!--
2.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2.7 +
2.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
2.9 +
2.10 +
2.11 +The contents of this file are subject to the terms of either the GNU
2.12 +General Public License Version 2 only ("GPL") or the Common
2.13 +Development and Distribution License("CDDL") (collectively, the
2.14 +"License"). You may not use this file except in compliance with the
2.15 +License. You can obtain a copy of the License at
2.16 +http://www.netbeans.org/cddl-gplv2.html
2.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
2.18 +specific language governing permissions and limitations under the
2.19 +License. When distributing the software, include this License Header
2.20 +Notice in each file and include the License file at
2.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
2.22 +particular file as subject to the "Classpath" exception as provided
2.23 +by Sun in the GPL Version 2 section of the License file that
2.24 +accompanied this code. If applicable, add the following below the
2.25 +License Header, with the fields enclosed by brackets [] replaced by
2.26 +your own identifying information:
2.27 +"Portions Copyrighted [year] [name of copyright owner]"
2.28 +
2.29 +Contributor(s):
2.30 +
2.31 +The Original Software is NetBeans. The Initial Developer of the Original
2.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
2.33 +Microsystems, Inc. All Rights Reserved.
2.34 +
2.35 +If you wish your version of this file to be governed by only the CDDL
2.36 +or only the GPL Version 2, indicate your decision by adding
2.37 +"[Contributor] elects to include this software in this distribution
2.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
2.39 +single choice of license, a recipient has the option to distribute
2.40 +your version of this file under either the CDDL, the GPL Version 2 or
2.41 +to extend the choice of license to its licensees as provided above.
2.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
2.43 +Version 2 license, then the option applies only if the new code is
2.44 +made subject to such option by the copyright holder.
2.45 +-->
2.46 +<project xmlns="http://www.netbeans.org/ns/project/1">
2.47 + <type>org.netbeans.modules.ant.freeform</type>
2.48 + <configuration>
2.49 + <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
2.50 + <!-- Do not use Project Properties customizer when editing this file manually. -->
2.51 + <name>Visual Web Pack Build</name>
2.52 + <properties/>
2.53 + <ide-actions>
2.54 + <action name="build">
2.55 + <target>build</target>
2.56 + </action>
2.57 + <action name="clean">
2.58 + <target>clean</target>
2.59 + </action>
2.60 + <action name="rebuild">
2.61 + <target>clean</target>
2.62 + <target>build</target>
2.63 + </action>
2.64 + </ide-actions>
2.65 + <view>
2.66 + <items>
2.67 + <source-file>
2.68 + <location>build.xml</location>
2.69 + </source-file>
2.70 + </items>
2.71 + <context-menu>
2.72 + <ide-action name="build"/>
2.73 + <ide-action name="clean"/>
2.74 + <ide-action name="rebuild"/>
2.75 + </context-menu>
2.76 + </view>
2.77 + </general-data>
2.78 + <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1"/>
2.79 + </configuration>
2.80 +</project>
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/misc/project/jsfportlet/build.xml Wed Feb 23 20:12:58 2011 -0500
3.3 @@ -0,0 +1,50 @@
3.4 +<?xml version="1.0" encoding="UTF-8"?>
3.5 +<!--
3.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3.7 +
3.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
3.9 +
3.10 +
3.11 +The contents of this file are subject to the terms of either the GNU
3.12 +General Public License Version 2 only ("GPL") or the Common
3.13 +Development and Distribution License("CDDL") (collectively, the
3.14 +"License"). You may not use this file except in compliance with the
3.15 +License. You can obtain a copy of the License at
3.16 +http://www.netbeans.org/cddl-gplv2.html
3.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
3.18 +specific language governing permissions and limitations under the
3.19 +License. When distributing the software, include this License Header
3.20 +Notice in each file and include the License file at
3.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
3.22 +particular file as subject to the "Classpath" exception as provided
3.23 +by Sun in the GPL Version 2 section of the License file that
3.24 +accompanied this code. If applicable, add the following below the
3.25 +License Header, with the fields enclosed by brackets [] replaced by
3.26 +your own identifying information:
3.27 +"Portions Copyrighted [year] [name of copyright owner]"
3.28 +
3.29 +Contributor(s):
3.30 +
3.31 +The Original Software is NetBeans. The Initial Developer of the Original
3.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
3.33 +Microsystems, Inc. All Rights Reserved.
3.34 +
3.35 +If you wish your version of this file to be governed by only the CDDL
3.36 +or only the GPL Version 2, indicate your decision by adding
3.37 +"[Contributor] elects to include this software in this distribution
3.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
3.39 +single choice of license, a recipient has the option to distribute
3.40 +your version of this file under either the CDDL, the GPL Version 2 or
3.41 +to extend the choice of license to its licensees as provided above.
3.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
3.43 +Version 2 license, then the option applies only if the new code is
3.44 +made subject to such option by the copyright holder.
3.45 +-->
3.46 +
3.47 +<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
3.48 +<!-- for some information on what you could do (e.g. targets to override). -->
3.49 +<!-- If you delete this file and reopen the project it will be recreated. -->
3.50 +<project name="org.netbeans.modules.visualweb.project.jsfportlet" default="netbeans" basedir=".">
3.51 + <description>Builds, tests, and runs the project org.netbeans.modules.visualweb.project.jsfportlet.</description>
3.52 + <import file="nbproject/build-impl.xml"/>
3.53 +</project>
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/misc/project/jsfportlet/manifest.mf Wed Feb 23 20:12:58 2011 -0500
4.3 @@ -0,0 +1,8 @@
4.4 +Manifest-Version: 1.0
4.5 +OpenIDE-Module: org.netbeans.modules.visualweb.project.jsfportlet/1
4.6 +OpenIDE-Module-Specification-Version: 2.0
4.7 +X-Comment: Portlet Project Support.
4.8 +OpenIDE-Module-Implementation-Version: 1
4.9 +OpenIDE-Module-Layer: org/netbeans/modules/visualweb/project/jsfportlet/resources/layer.xml
4.10 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/visualweb/project/jsfportlet/resources/Bundle.properties
4.11 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/misc/project/jsfportlet/nbproject/build-impl.xml Wed Feb 23 20:12:58 2011 -0500
5.3 @@ -0,0 +1,30 @@
5.4 +<?xml version="1.0" encoding="UTF-8"?>
5.5 +<!--
5.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
5.7 +*** EDIT ../build.xml INSTEAD ***
5.8 +-->
5.9 +<project name="org.netbeans.modules.visualweb.project.jsfportlet-impl" basedir=".." xmlns:nbmproject="http://www.netbeans.org/ns/nb-module-project/2">
5.10 + <property file="nbproject/private/suite-private.properties"/>
5.11 + <property file="nbproject/suite.properties"/>
5.12 + <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
5.13 + <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
5.14 + <property file="${suite.dir}/nbproject/platform.properties"/>
5.15 + <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
5.16 + <attribute name="name"/>
5.17 + <attribute name="value"/>
5.18 + <sequential>
5.19 + <property name="@{name}" value="${@{value}}"/>
5.20 + </sequential>
5.21 + </macrodef>
5.22 + <property file="${user.properties.file}"/>
5.23 + <nbmproject:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir"/>
5.24 + <nbmproject:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir"/>
5.25 + <fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'">
5.26 + <condition>
5.27 + <not>
5.28 + <available file="${harness.dir}" type="dir"/>
5.29 + </not>
5.30 + </condition>
5.31 + </fail>
5.32 + <import file="${harness.dir}/build.xml"/>
5.33 +</project>
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/misc/project/jsfportlet/nbproject/genfiles.properties Wed Feb 23 20:12:58 2011 -0500
6.3 @@ -0,0 +1,8 @@
6.4 +build.xml.data.CRC32=54fe5d68
6.5 +build.xml.script.CRC32=029f884c
6.6 +build.xml.stylesheet.CRC32=1101b4cf
6.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
6.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6.9 +nbproject/build-impl.xml.data.CRC32=54fe5d68
6.10 +nbproject/build-impl.xml.script.CRC32=8edb7f10
6.11 +nbproject/build-impl.xml.stylesheet.CRC32=d126b16b
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/misc/project/jsfportlet/nbproject/project.properties Wed Feb 23 20:12:58 2011 -0500
7.3 @@ -0,0 +1,39 @@
7.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
7.5 +#
7.6 +# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
7.7 +#
7.8 +# The contents of this file are subject to the terms of either the GNU
7.9 +# General Public License Version 2 only ("GPL") or the Common
7.10 +# Development and Distribution License("CDDL") (collectively, the
7.11 +# "License"). You may not use this file except in compliance with the
7.12 +# License. You can obtain a copy of the License at
7.13 +# http://www.netbeans.org/cddl-gplv2.html
7.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
7.15 +# specific language governing permissions and limitations under the
7.16 +# License. When distributing the software, include this License Header
7.17 +# Notice in each file and include the License file at
7.18 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
7.19 +# particular file as subject to the "Classpath" exception as provided
7.20 +# by Sun in the GPL Version 2 section of the License file that
7.21 +# accompanied this code. If applicable, add the following below the
7.22 +# License Header, with the fields enclosed by brackets [] replaced by
7.23 +# your own identifying information:
7.24 +# "Portions Copyrighted [year] [name of copyright owner]"
7.25 +#
7.26 +# Contributor(s):
7.27 +#
7.28 +# The Original Software is NetBeans. The Initial Developer of the Original
7.29 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
7.30 +# Microsystems, Inc. All Rights Reserved.
7.31 +#
7.32 +# If you wish your version of this file to be governed by only the CDDL
7.33 +# or only the GPL Version 2, indicate your decision by adding
7.34 +# "[Contributor] elects to include this software in this distribution
7.35 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
7.36 +# single choice of license, a recipient has the option to distribute
7.37 +# your version of this file under either the CDDL, the GPL Version 2 or
7.38 +# to extend the choice of license to its licensees as provided above.
7.39 +# However, if you add GPL Version 2 code and therefore, elected the GPL
7.40 +# Version 2 license, then the option applies only if the new code is
7.41 +# made subject to such option by the copyright holder.
7.42 +
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/misc/project/jsfportlet/nbproject/project.xml Wed Feb 23 20:12:58 2011 -0500
8.3 @@ -0,0 +1,155 @@
8.4 +<?xml version="1.0" encoding="UTF-8"?>
8.5 +<!--
8.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8.7 +
8.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
8.9 +
8.10 +
8.11 +The contents of this file are subject to the terms of either the GNU
8.12 +General Public License Version 2 only ("GPL") or the Common
8.13 +Development and Distribution License("CDDL") (collectively, the
8.14 +"License"). You may not use this file except in compliance with the
8.15 +License. You can obtain a copy of the License at
8.16 +http://www.netbeans.org/cddl-gplv2.html
8.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
8.18 +specific language governing permissions and limitations under the
8.19 +License. When distributing the software, include this License Header
8.20 +Notice in each file and include the License file at
8.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
8.22 +particular file as subject to the "Classpath" exception as provided
8.23 +by Sun in the GPL Version 2 section of the License file that
8.24 +accompanied this code. If applicable, add the following below the
8.25 +License Header, with the fields enclosed by brackets [] replaced by
8.26 +your own identifying information:
8.27 +"Portions Copyrighted [year] [name of copyright owner]"
8.28 +
8.29 +Contributor(s):
8.30 +
8.31 +The Original Software is NetBeans. The Initial Developer of the Original
8.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
8.33 +Microsystems, Inc. All Rights Reserved.
8.34 +
8.35 +If you wish your version of this file to be governed by only the CDDL
8.36 +or only the GPL Version 2, indicate your decision by adding
8.37 +"[Contributor] elects to include this software in this distribution
8.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
8.39 +single choice of license, a recipient has the option to distribute
8.40 +your version of this file under either the CDDL, the GPL Version 2 or
8.41 +to extend the choice of license to its licensees as provided above.
8.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
8.43 +Version 2 license, then the option applies only if the new code is
8.44 +made subject to such option by the copyright holder.
8.45 +-->
8.46 +
8.47 +<project xmlns="http://www.netbeans.org/ns/project/1">
8.48 + <type>org.netbeans.modules.apisupport.project</type>
8.49 + <configuration>
8.50 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/2">
8.51 + <code-name-base>org.netbeans.modules.visualweb.project.jsfportlet</code-name-base>
8.52 + <suite-component/>
8.53 + <module-dependencies>
8.54 + <dependency>
8.55 + <code-name-base>org.netbeans.modules.visualweb.project.jsf</code-name-base>
8.56 + <build-prerequisite/>
8.57 + <compile-dependency/>
8.58 + <run-dependency>
8.59 + <release-version>1</release-version>
8.60 + <specification-version>1.0</specification-version>
8.61 + </run-dependency>
8.62 + </dependency>
8.63 + <dependency>
8.64 + <code-name-base>org.netbeans.modules.visualweb.api.portlet.dd</code-name-base>
8.65 + <build-prerequisite/>
8.66 + <compile-dependency/>
8.67 + <run-dependency>
8.68 + <release-version>1</release-version>
8.69 + <specification-version>1.0</specification-version>
8.70 + </run-dependency>
8.71 + </dependency>
8.72 + <dependency>
8.73 + <code-name-base>org.netbeans.modules.j2eeserver</code-name-base>
8.74 + <build-prerequisite/>
8.75 + <compile-dependency/>
8.76 + <run-dependency>
8.77 + <release-version>4</release-version>
8.78 + <specification-version>1.13</specification-version>
8.79 + </run-dependency>
8.80 + </dependency>
8.81 + <dependency>
8.82 + <code-name-base>org.netbeans.modules.project.ant</code-name-base>
8.83 + <build-prerequisite/>
8.84 + <compile-dependency/>
8.85 + <run-dependency>
8.86 + <release-version>1</release-version>
8.87 + <specification-version>1.12</specification-version>
8.88 + </run-dependency>
8.89 + </dependency>
8.90 + <dependency>
8.91 + <code-name-base>org.netbeans.modules.project.libraries</code-name-base>
8.92 + <build-prerequisite/>
8.93 + <compile-dependency/>
8.94 + <run-dependency>
8.95 + <release-version>1</release-version>
8.96 + <specification-version>1.13</specification-version>
8.97 + </run-dependency>
8.98 + </dependency>
8.99 + <dependency>
8.100 + <code-name-base>org.netbeans.modules.projectapi</code-name-base>
8.101 + <build-prerequisite/>
8.102 + <compile-dependency/>
8.103 + <run-dependency>
8.104 + <release-version>1</release-version>
8.105 + <specification-version>1.9</specification-version>
8.106 + </run-dependency>
8.107 + </dependency>
8.108 + <dependency>
8.109 + <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
8.110 + <build-prerequisite/>
8.111 + <compile-dependency/>
8.112 + <run-dependency>
8.113 + <release-version>1</release-version>
8.114 + <specification-version>1.13.0.5</specification-version>
8.115 + </run-dependency>
8.116 + </dependency>
8.117 + <dependency>
8.118 + <code-name-base>org.openide.dialogs</code-name-base>
8.119 + <build-prerequisite/>
8.120 + <compile-dependency/>
8.121 + <run-dependency>
8.122 + <specification-version>6.4</specification-version>
8.123 + </run-dependency>
8.124 + </dependency>
8.125 + <dependency>
8.126 + <code-name-base>org.openide.filesystems</code-name-base>
8.127 + <build-prerequisite/>
8.128 + <compile-dependency/>
8.129 + <run-dependency>
8.130 + <specification-version>6.4</specification-version>
8.131 + </run-dependency>
8.132 + </dependency>
8.133 + <dependency>
8.134 + <code-name-base>org.openide.options</code-name-base>
8.135 + <build-prerequisite/>
8.136 + <compile-dependency/>
8.137 + <run-dependency>
8.138 + <specification-version>6.4</specification-version>
8.139 + </run-dependency>
8.140 + </dependency>
8.141 + <dependency>
8.142 + <code-name-base>org.openide.util</code-name-base>
8.143 + <build-prerequisite/>
8.144 + <compile-dependency/>
8.145 + <run-dependency>
8.146 + <specification-version>6.8</specification-version>
8.147 + </run-dependency>
8.148 + </dependency>
8.149 + </module-dependencies>
8.150 + <public-packages/>
8.151 + <!--
8.152 + <friend-packages>
8.153 + <package>org.netbeans.modules.visualweb.project.jsfportlet</package>
8.154 + </friend-packages>
8.155 + -->
8.156 + </data>
8.157 + </configuration>
8.158 +</project>
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/misc/project/jsfportlet/nbproject/suite.properties Wed Feb 23 20:12:58 2011 -0500
9.3 @@ -0,0 +1,1 @@
9.4 +suite.dir=${basedir}/../../idesuite
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/Bundle.properties Wed Feb 23 20:12:58 2011 -0500
10.3 @@ -0,0 +1,48 @@
10.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
10.5 +#
10.6 +# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
10.7 +#
10.8 +# The contents of this file are subject to the terms of either the GNU
10.9 +# General Public License Version 2 only ("GPL") or the Common
10.10 +# Development and Distribution License("CDDL") (collectively, the
10.11 +# "License"). You may not use this file except in compliance with the
10.12 +# License. You can obtain a copy of the License at
10.13 +# http://www.netbeans.org/cddl-gplv2.html
10.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
10.15 +# specific language governing permissions and limitations under the
10.16 +# License. When distributing the software, include this License Header
10.17 +# Notice in each file and include the License file at
10.18 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
10.19 +# particular file as subject to the "Classpath" exception as provided
10.20 +# by Sun in the GPL Version 2 section of the License file that
10.21 +# accompanied this code. If applicable, add the following below the
10.22 +# License Header, with the fields enclosed by brackets [] replaced by
10.23 +# your own identifying information:
10.24 +# "Portions Copyrighted [year] [name of copyright owner]"
10.25 +#
10.26 +# Contributor(s):
10.27 +#
10.28 +# The Original Software is NetBeans. The Initial Developer of the Original
10.29 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
10.30 +# Microsystems, Inc. All Rights Reserved.
10.31 +#
10.32 +# If you wish your version of this file to be governed by only the CDDL
10.33 +# or only the GPL Version 2, indicate your decision by adding
10.34 +# "[Contributor] elects to include this software in this distribution
10.35 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
10.36 +# single choice of license, a recipient has the option to distribute
10.37 +# your version of this file under either the CDDL, the GPL Version 2 or
10.38 +# to extend the choice of license to its licensees as provided above.
10.39 +# However, if you add GPL Version 2 code and therefore, elected the GPL
10.40 +# Version 2 license, then the option applies only if the new code is
10.41 +# made subject to such option by the copyright holder.
10.42 +
10.43 +# manifest.mf
10.44 +OpenIDE-Module-Name=JSF Portlet
10.45 +OpenIDE-Module-Display-Category=Visual Web
10.46 +OpenIDE-Module-Short-Description=TODO.
10.47 +OpenIDE-Module-Long-Description=TODO.
10.48 +
10.49 +
10.50 +MSG_JsfPortletSupportImpl_DATAOBJECT_NULL=The DataObject of the Initial Page is Null!
10.51 +MSG_JsfPortletSupportImpl_PORTLETDDNOTFOUND=The porlet.xml File could not be found for project\: {0}!
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/JsfPortletProjectTemplate.java Wed Feb 23 20:12:58 2011 -0500
11.3 @@ -0,0 +1,139 @@
11.4 +/*
11.5 + * {START_JAVA_COPYRIGHT_NOTICE
11.6 + * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
11.7 + * Use is subject to license terms.
11.8 + * END_COPYRIGHT_NOTICE}
11.9 + */
11.10 +
11.11 +package org.netbeans.modules.visualweb.project.jsfportlet;
11.12 +
11.13 +import org.netbeans.modules.visualweb.project.jsf.api.JsfProjectConstants;
11.14 +import org.netbeans.modules.visualweb.project.jsf.api.ProjectTemplate;
11.15 +import org.netbeans.modules.visualweb.project.jsf.api.JsfProjectClassPathExtender;
11.16 +import org.netbeans.modules.visualweb.project.jsf.api.JsfProjectUtils;
11.17 +
11.18 +import java.io.IOException;
11.19 +import java.io.InputStream;
11.20 +import javax.xml.parsers.DocumentBuilder;
11.21 +import javax.xml.parsers.DocumentBuilderFactory;
11.22 +import org.netbeans.api.project.Project;
11.23 +import org.netbeans.api.project.libraries.Library;
11.24 +import org.netbeans.api.project.libraries.LibraryManager;
11.25 +import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
11.26 +import org.openide.ErrorManager;
11.27 +import org.openide.filesystems.FileObject;
11.28 +import org.openide.filesystems.FileUtil;
11.29 +import org.w3c.dom.Document;
11.30 +import org.w3c.dom.Node;
11.31 +import org.w3c.dom.NodeList;
11.32 +
11.33 +
11.34 +/**
11.35 + *
11.36 + * @author David Botterill
11.37 + */
11.38 +public class JsfPortletProjectTemplate extends ProjectTemplate {
11.39 + private static final String DEFAULT_THEME = "theme-default";
11.40 +
11.41 + /** Creates a new instance of JsfProjectTemplate */
11.42 + public JsfPortletProjectTemplate() {
11.43 + }
11.44 +
11.45 + public void addLibrary(Project project) throws IOException {
11.46 + // Add the Creator libraries to the project
11.47 + LibraryManager libMgr = LibraryManager.getDefault();
11.48 + Library[] designLibs = {
11.49 + libMgr.getLibrary("jsfsupport-designtime"),
11.50 + libMgr.getLibrary("webui-designtime"),
11.51 + libMgr.getLibrary("jdbcsupport-designtime"),
11.52 + libMgr.getLibrary(DEFAULT_THEME),
11.53 + };
11.54 +
11.55 + Library[] runLibs = {
11.56 + libMgr.getLibrary("jsfsupport-runtime"),
11.57 + libMgr.getLibrary("portlet-runtime"),
11.58 + libMgr.getLibrary("jsf-portlet-runtime"),
11.59 + libMgr.getLibrary("jdbcsupport-runtime"),
11.60 + libMgr.getLibrary("exceptionhandler-runtime"),
11.61 + libMgr.getLibrary(DEFAULT_THEME),
11.62 + };
11.63 +
11.64 + if (JsfProjectUtils.isJsfProject(project)) { // XXX Thresher project
11.65 + JsfProjectUtils.addLibraryReferences(project, designLibs, JsfProjectClassPathExtender.LIBRARY_ROLE_DESIGN);
11.66 + JsfProjectUtils.addLibraryReferences(project, runLibs, JsfProjectClassPathExtender.LIBRARY_ROLE_DEPLOY);
11.67 + JsfProjectUtils.addLocalizedThemeArchive(project, DEFAULT_THEME);
11.68 + } else {
11.69 + JsfProjectUtils.addLibraryReferences(project, designLibs, JsfProjectClassPathExtender.LIBRARY_ROLE_DESIGN);
11.70 + JsfProjectUtils.addLibraryReferences(project, runLibs, JsfProjectClassPathExtender.LIBRARY_ROLE_DEPLOY);
11.71 + JsfProjectUtils.addLocalizedThemeArchive(project, DEFAULT_THEME);
11.72 + }
11.73 + JsfProjectUtils.putProjectProperty(project, JsfProjectConstants.PROP_CURRENT_THEME, DEFAULT_THEME); // NOI18N
11.74 + }
11.75 +
11.76 + public void create(Project project, String j2eeLevel) throws IOException {
11.77 + // Extract the project template file for this project type
11.78 + // TODO: support BluePrints source structure as well...
11.79 + InputStream is = JsfPortletProjectTemplate.class.getResourceAsStream("/org/netbeans/modules/visualweb/project/jsfportlet/JsfPortletProjectTemplateJakarta.xml"); // NOI18N
11.80 + Document document = null;
11.81 + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
11.82 + Node node;
11.83 +
11.84 + try {
11.85 + DocumentBuilder builder = factory.newDocumentBuilder();
11.86 + document = builder.parse(is);
11.87 + FileObject projDir = project.getProjectDirectory();
11.88 + instantiateFile(project, document.getDocumentElement(), project.getProjectDirectory(), j2eeLevel);
11.89 + } catch (IOException e) {
11.90 + throw e;
11.91 + } catch (Exception e) {
11.92 + ErrorManager.getDefault().notify(e);
11.93 + }
11.94 + }
11.95 +
11.96 + public void instantiateFile(Project project, Node node, FileObject folder, String j2eeLevel) throws IOException {
11.97 + if (folder.equals(project.getProjectDirectory())) {
11.98 + JsfProjectUtils.putProjectProperty(project, JsfProjectConstants.PROP_JSF_PROJECT_LIBRARIES_DIR, JsfProjectConstants.PATH_LIBRARIES);
11.99 + }
11.100 +
11.101 + if (j2eeLevel == null) {
11.102 + j2eeLevel = J2eeModule.JAVA_EE_5;
11.103 + }
11.104 +
11.105 + String nodeName = node.getNodeName();
11.106 + String fileName = getAttr(node, "name"); // NOI18N
11.107 + String templateJ2eeLevel = getAttr(node, "j2eeLevel"); // NOI18N
11.108 +
11.109 + if (templateJ2eeLevel.length() != 0 && !j2eeLevel.equals(templateJ2eeLevel)) {
11.110 + // Wrong Java EE level
11.111 + return;
11.112 + }
11.113 +
11.114 + if (nodeName.equals("file") && folder.getFileObject(fileName) == null) {
11.115 + instantiateFileTemplate(folder, fileName, getAttr(node, "template")); // NOI18N
11.116 + } else {
11.117 + FileObject newFolder = null;
11.118 + if (nodeName.equals("folder")) { // NOI18N
11.119 + if (fileName.equals("${" + JsfProjectConstants.PROP_JSF_PAGEBEAN_PACKAGE + "}")) {
11.120 + fileName = getBeanPackage();
11.121 + if (fileName == null) {
11.122 + fileName = deriveSafeName(project.getProjectDirectory().getName());
11.123 + }
11.124 + JsfProjectUtils.putProjectProperty(project, JsfProjectConstants.PROP_JSF_PAGEBEAN_PACKAGE, fileName);
11.125 + }
11.126 + fileName = fileName.replace('.', '/');
11.127 + if ((newFolder = folder.getFileObject(fileName)) == null) {
11.128 + // <RAVE> folder.createFolder does NOT deal with nested folders being created
11.129 + newFolder = FileUtil.createFolder(folder, fileName);
11.130 +// newFolder = folder.createFolder(fileName); // NOI18N
11.131 + // </RAVE>
11.132 + }
11.133 + } else {
11.134 + newFolder = folder;
11.135 + }
11.136 + NodeList nodes = node.getChildNodes();
11.137 + for (int i = 0; i < nodes.getLength(); i++) {
11.138 + instantiateFile(project, nodes.item(i), newFolder, j2eeLevel);
11.139 + }
11.140 + }
11.141 + }
11.142 +}
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/JsfPortletProjectTemplateJakarta.xml Wed Feb 23 20:12:58 2011 -0500
12.3 @@ -0,0 +1,77 @@
12.4 +<?xml version="1.0" encoding="UTF-8"?>
12.5 +<!--
12.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
12.7 +
12.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
12.9 +
12.10 +
12.11 +The contents of this file are subject to the terms of either the GNU
12.12 +General Public License Version 2 only ("GPL") or the Common
12.13 +Development and Distribution License("CDDL") (collectively, the
12.14 +"License"). You may not use this file except in compliance with the
12.15 +License. You can obtain a copy of the License at
12.16 +http://www.netbeans.org/cddl-gplv2.html
12.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
12.18 +specific language governing permissions and limitations under the
12.19 +License. When distributing the software, include this License Header
12.20 +Notice in each file and include the License file at
12.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
12.22 +particular file as subject to the "Classpath" exception as provided
12.23 +by Sun in the GPL Version 2 section of the License file that
12.24 +accompanied this code. If applicable, add the following below the
12.25 +License Header, with the fields enclosed by brackets [] replaced by
12.26 +your own identifying information:
12.27 +"Portions Copyrighted [year] [name of copyright owner]"
12.28 +
12.29 +Contributor(s):
12.30 +
12.31 +The Original Software is NetBeans. The Initial Developer of the Original
12.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
12.33 +Microsystems, Inc. All Rights Reserved.
12.34 +
12.35 +If you wish your version of this file to be governed by only the CDDL
12.36 +or only the GPL Version 2, indicate your decision by adding
12.37 +"[Contributor] elects to include this software in this distribution
12.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
12.39 +single choice of license, a recipient has the option to distribute
12.40 +your version of this file under either the CDDL, the GPL Version 2 or
12.41 +to extend the choice of license to its licensees as provided above.
12.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
12.43 +Version 2 license, then the option applies only if the new code is
12.44 +made subject to such option by the copyright holder.
12.45 +-->
12.46 +
12.47 +<project>
12.48 + <folder name="nbproject">
12.49 + <file name="j2ee13-web-xml.xsl" template="Templates/JsfApps/j2ee13-web-xml.xsl"/>
12.50 + <file name="export-web-xml.xsl" template="Templates/JsfApps/export-web-xml.xsl"/>
12.51 + </folder>
12.52 + <folder name="src">
12.53 + <folder name="${jsf.pagebean.package}">
12.54 + <file name="ApplicationBean1.java" template="Templates/JsfBeans/ApplicationBean.java"/>
12.55 + <file name="SessionBean1.java" template="Templates/JsfBeans/SessionBean.java"/>
12.56 + <file name="RequestBean1.java" template="Templates/JsfBeans/RequestBean.java"/>
12.57 + <file name="Bundle.properties" template="Templates/Classes/properties.properties"/>
12.58 + </folder>
12.59 + </folder>
12.60 + <folder name="web">
12.61 + <file name="PortletPage1.jsp" template="Templates/JsfPortlet/PortletPage.jsp"/>
12.62 +<!-- I'm guessing portlets shouldn't have their own stylesheets.... correct?
12.63 + <folder name="resources">
12.64 + <file name="stylesheet.css" template="Templates/JsfOther/stylesheet.css"/>
12.65 + </folder>
12.66 +-->
12.67 + <folder name="WEB-INF">
12.68 + <file name="web.xml" template="Templates/JsfAdvanced/web.xml"/>
12.69 + <file name="portlet.xml" template="Templates/JsfPortlet/portlet.xml"/>
12.70 + <file name="navigation.xml" template="Templates/JsfAdvanced/navigation.xml"/>
12.71 + <file name="managed-beans.xml" template="Templates/JsfAdvanced/managed-beans.xml"/>
12.72 + <file name="faces-config.xml" template="Templates/JsfAdvanced/faces-config.xml"/>
12.73 + <folder name="classes"/>
12.74 + <folder name="lib"/>
12.75 + <folder name="tld">
12.76 + <file name="portlet.tld" template="Templates/JsfPortlet/portlet.tld"/>
12.77 + </folder>
12.78 + </folder>
12.79 + </folder>
12.80 +</project>
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/libraries/Bundle.properties Wed Feb 23 20:12:58 2011 -0500
13.3 @@ -0,0 +1,41 @@
13.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
13.5 +#
13.6 +# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
13.7 +#
13.8 +# The contents of this file are subject to the terms of either the GNU
13.9 +# General Public License Version 2 only ("GPL") or the Common
13.10 +# Development and Distribution License("CDDL") (collectively, the
13.11 +# "License"). You may not use this file except in compliance with the
13.12 +# License. You can obtain a copy of the License at
13.13 +# http://www.netbeans.org/cddl-gplv2.html
13.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13.15 +# specific language governing permissions and limitations under the
13.16 +# License. When distributing the software, include this License Header
13.17 +# Notice in each file and include the License file at
13.18 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
13.19 +# particular file as subject to the "Classpath" exception as provided
13.20 +# by Sun in the GPL Version 2 section of the License file that
13.21 +# accompanied this code. If applicable, add the following below the
13.22 +# License Header, with the fields enclosed by brackets [] replaced by
13.23 +# your own identifying information:
13.24 +# "Portions Copyrighted [year] [name of copyright owner]"
13.25 +#
13.26 +# Contributor(s):
13.27 +#
13.28 +# The Original Software is NetBeans. The Initial Developer of the Original
13.29 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
13.30 +# Microsystems, Inc. All Rights Reserved.
13.31 +#
13.32 +# If you wish your version of this file to be governed by only the CDDL
13.33 +# or only the GPL Version 2, indicate your decision by adding
13.34 +# "[Contributor] elects to include this software in this distribution
13.35 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
13.36 +# single choice of license, a recipient has the option to distribute
13.37 +# your version of this file under either the CDDL, the GPL Version 2 or
13.38 +# to extend the choice of license to its licensees as provided above.
13.39 +# However, if you add GPL Version 2 code and therefore, elected the GPL
13.40 +# Version 2 license, then the option applies only if the new code is
13.41 +# made subject to such option by the copyright holder.
13.42 +
13.43 +jsf-portlet-runtime=JSR-168 Portlet to JSF Bridge Support
13.44 +portlet-runtime=Sun Web Portlet
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/libraries/jsf-portlet-runtime.xml Wed Feb 23 20:12:58 2011 -0500
14.3 @@ -0,0 +1,53 @@
14.4 +<?xml version="1.0" encoding="UTF-8"?>
14.5 +<!--
14.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
14.7 +
14.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
14.9 +
14.10 +
14.11 +The contents of this file are subject to the terms of either the GNU
14.12 +General Public License Version 2 only ("GPL") or the Common
14.13 +Development and Distribution License("CDDL") (collectively, the
14.14 +"License"). You may not use this file except in compliance with the
14.15 +License. You can obtain a copy of the License at
14.16 +http://www.netbeans.org/cddl-gplv2.html
14.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
14.18 +specific language governing permissions and limitations under the
14.19 +License. When distributing the software, include this License Header
14.20 +Notice in each file and include the License file at
14.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
14.22 +particular file as subject to the "Classpath" exception as provided
14.23 +by Sun in the GPL Version 2 section of the License file that
14.24 +accompanied this code. If applicable, add the following below the
14.25 +License Header, with the fields enclosed by brackets [] replaced by
14.26 +your own identifying information:
14.27 +"Portions Copyrighted [year] [name of copyright owner]"
14.28 +
14.29 +Contributor(s):
14.30 +
14.31 +The Original Software is NetBeans. The Initial Developer of the Original
14.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
14.33 +Microsystems, Inc. All Rights Reserved.
14.34 +
14.35 +If you wish your version of this file to be governed by only the CDDL
14.36 +or only the GPL Version 2, indicate your decision by adding
14.37 +"[Contributor] elects to include this software in this distribution
14.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
14.39 +single choice of license, a recipient has the option to distribute
14.40 +your version of this file under either the CDDL, the GPL Version 2 or
14.41 +to extend the choice of license to its licensees as provided above.
14.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
14.43 +Version 2 license, then the option applies only if the new code is
14.44 +made subject to such option by the copyright holder.
14.45 +-->
14.46 +
14.47 +<!DOCTYPE library PUBLIC "-//NetBeans//DTD Library Declaration 1.0//EN" "http://www.netbeans.org/dtds/library-declaration-1_0.dtd">
14.48 +<library version="1.0">
14.49 + <name>jsf-portlet-runtime</name>
14.50 + <type>j2se</type>
14.51 + <localizing-bundle>org.netbeans.modules.visualweb.project.jsfportlet.libraries.Bundle</localizing-bundle>
14.52 + <volume>
14.53 + <type>classpath</type>
14.54 + <resource>jar:nbinst:///modules/ext/jsf-portlet.jar!/</resource>
14.55 + </volume>
14.56 +</library>
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/libraries/portlet-runtime.xml Wed Feb 23 20:12:58 2011 -0500
15.3 @@ -0,0 +1,56 @@
15.4 +<?xml version="1.0" encoding="UTF-8"?>
15.5 +<!--
15.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
15.7 +
15.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
15.9 +
15.10 +
15.11 +The contents of this file are subject to the terms of either the GNU
15.12 +General Public License Version 2 only ("GPL") or the Common
15.13 +Development and Distribution License("CDDL") (collectively, the
15.14 +"License"). You may not use this file except in compliance with the
15.15 +License. You can obtain a copy of the License at
15.16 +http://www.netbeans.org/cddl-gplv2.html
15.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
15.18 +specific language governing permissions and limitations under the
15.19 +License. When distributing the software, include this License Header
15.20 +Notice in each file and include the License file at
15.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
15.22 +particular file as subject to the "Classpath" exception as provided
15.23 +by Sun in the GPL Version 2 section of the License file that
15.24 +accompanied this code. If applicable, add the following below the
15.25 +License Header, with the fields enclosed by brackets [] replaced by
15.26 +your own identifying information:
15.27 +"Portions Copyrighted [year] [name of copyright owner]"
15.28 +
15.29 +Contributor(s):
15.30 +
15.31 +The Original Software is NetBeans. The Initial Developer of the Original
15.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
15.33 +Microsystems, Inc. All Rights Reserved.
15.34 +
15.35 +If you wish your version of this file to be governed by only the CDDL
15.36 +or only the GPL Version 2, indicate your decision by adding
15.37 +"[Contributor] elects to include this software in this distribution
15.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
15.39 +single choice of license, a recipient has the option to distribute
15.40 +your version of this file under either the CDDL, the GPL Version 2 or
15.41 +to extend the choice of license to its licensees as provided above.
15.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
15.43 +Version 2 license, then the option applies only if the new code is
15.44 +made subject to such option by the copyright holder.
15.45 +-->
15.46 +
15.47 +<!DOCTYPE library PUBLIC "-//NetBeans//DTD Library Declaration 1.0//EN" "http://www.netbeans.org/dtds/library-declaration-1_0.dtd">
15.48 +<library version="1.0">
15.49 + <name>portlet-runtime</name>
15.50 + <type>j2se</type>
15.51 + <localizing-bundle>org.netbeans.modules.visualweb.project.jsfportlet.libraries.Bundle</localizing-bundle>
15.52 + <volume>
15.53 + <type>classpath</type>
15.54 + <resource>jar:nbinst:///modules/ext/webui.jar!/</resource>
15.55 + <resource>jar:nbinst:///modules/ext/jstl.jar!/</resource>
15.56 + <resource>jar:nbinst:///modules/ext/commons-fileupload-1.0.jar!/</resource>
15.57 + <resource>jar:nbinst:///modules/ext/standard.jar!/</resource>
15.58 + </volume>
15.59 +</library>
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/Bundle.properties Wed Feb 23 20:12:58 2011 -0500
16.3 @@ -0,0 +1,44 @@
16.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
16.5 +#
16.6 +# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
16.7 +#
16.8 +# The contents of this file are subject to the terms of either the GNU
16.9 +# General Public License Version 2 only ("GPL") or the Common
16.10 +# Development and Distribution License("CDDL") (collectively, the
16.11 +# "License"). You may not use this file except in compliance with the
16.12 +# License. You can obtain a copy of the License at
16.13 +# http://www.netbeans.org/cddl-gplv2.html
16.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16.15 +# specific language governing permissions and limitations under the
16.16 +# License. When distributing the software, include this License Header
16.17 +# Notice in each file and include the License file at
16.18 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
16.19 +# particular file as subject to the "Classpath" exception as provided
16.20 +# by Sun in the GPL Version 2 section of the License file that
16.21 +# accompanied this code. If applicable, add the following below the
16.22 +# License Header, with the fields enclosed by brackets [] replaced by
16.23 +# your own identifying information:
16.24 +# "Portions Copyrighted [year] [name of copyright owner]"
16.25 +#
16.26 +# Contributor(s):
16.27 +#
16.28 +# The Original Software is NetBeans. The Initial Developer of the Original
16.29 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
16.30 +# Microsystems, Inc. All Rights Reserved.
16.31 +#
16.32 +# If you wish your version of this file to be governed by only the CDDL
16.33 +# or only the GPL Version 2, indicate your decision by adding
16.34 +# "[Contributor] elects to include this software in this distribution
16.35 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
16.36 +# single choice of license, a recipient has the option to distribute
16.37 +# your version of this file under either the CDDL, the GPL Version 2 or
16.38 +# to extend the choice of license to its licensees as provided above.
16.39 +# However, if you add GPL Version 2 code and therefore, elected the GPL
16.40 +# Version 2 license, then the option applies only if the new code is
16.41 +# made subject to such option by the copyright holder.
16.42 +
16.43 +OpenIDE-Module-Name=Portlet Project Support
16.44 +OpenIDE-Module-Display-Category=Visual Web
16.45 +OpenIDE-Module-Short-Description=Supports creating Portlet Web Projects
16.46 +OpenIDE-Module-Long-Description=Supports creating Portlet Web Projects
16.47 +Templates/JsfPortlet=Portlet Pages
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/layer.xml Wed Feb 23 20:12:58 2011 -0500
17.3 @@ -0,0 +1,131 @@
17.4 +<?xml version="1.0" encoding="UTF-8"?>
17.5 +<!--
17.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
17.7 +
17.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
17.9 +
17.10 +
17.11 +The contents of this file are subject to the terms of either the GNU
17.12 +General Public License Version 2 only ("GPL") or the Common
17.13 +Development and Distribution License("CDDL") (collectively, the
17.14 +"License"). You may not use this file except in compliance with the
17.15 +License. You can obtain a copy of the License at
17.16 +http://www.netbeans.org/cddl-gplv2.html
17.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
17.18 +specific language governing permissions and limitations under the
17.19 +License. When distributing the software, include this License Header
17.20 +Notice in each file and include the License file at
17.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
17.22 +particular file as subject to the "Classpath" exception as provided
17.23 +by Sun in the GPL Version 2 section of the License file that
17.24 +accompanied this code. If applicable, add the following below the
17.25 +License Header, with the fields enclosed by brackets [] replaced by
17.26 +your own identifying information:
17.27 +"Portions Copyrighted [year] [name of copyright owner]"
17.28 +
17.29 +Contributor(s):
17.30 +
17.31 +The Original Software is NetBeans. The Initial Developer of the Original
17.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17.33 +Microsystems, Inc. All Rights Reserved.
17.34 +
17.35 +If you wish your version of this file to be governed by only the CDDL
17.36 +or only the GPL Version 2, indicate your decision by adding
17.37 +"[Contributor] elects to include this software in this distribution
17.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
17.39 +single choice of license, a recipient has the option to distribute
17.40 +your version of this file under either the CDDL, the GPL Version 2 or
17.41 +to extend the choice of license to its licensees as provided above.
17.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
17.43 +Version 2 license, then the option applies only if the new code is
17.44 +made subject to such option by the copyright holder.
17.45 +-->
17.46 +
17.47 +<?xml-stylesheet type="text/xml" href="http://openide.netbeans.org/fs/filesystem.xsl"?>
17.48 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
17.49 +<filesystem>
17.50 + <folder name="Templates">
17.51 + <!-- XXX Portlet is not available for ShortFin
17.52 + <folder name="Project">
17.53 + <attr name="Web" boolvalue="true"/>
17.54 +
17.55 + <folder name="Web">
17.56 + <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsf/ui/resources/web.html"/>
17.57 + <attr name="emptyWeb.xml/portletProject.xml" boolvalue="true"/>
17.58 + <file name="portletProject.xml">
17.59 + <attr name="template" boolvalue="true"/>
17.60 + <attr name="templateWizardIterator" newvalue="org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard.PortletProjectWizardIterator"/>
17.61 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard.resources.Bundle"/>
17.62 + <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/resources/PortletProjectIcon.gif"/>
17.63 + <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/resources/PortletProject.html"/>
17.64 + <attr name="templateCategory" stringvalue="rave-portlet"/>
17.65 + </file>
17.66 + </folder>
17.67 + </folder>
17.68 + -->
17.69 + <attr name="JsfAdvanced/JsfPortlet" boolvalue="true"/>
17.70 + <folder name="JsfPortlet">
17.71 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsfportlet.resources.Bundle"/>
17.72 + <file name="portletWeb.xml" url="/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/portlet-web.xml.template">
17.73 + <attr name="template" boolvalue="true" />
17.74 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsfportlet.resources.templates.resources.Bundle"/>
17.75 + <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/portletWebTemplateHelp.html" />
17.76 + <attr name="templateCategory" stringvalue="rave-portlet"/>
17.77 + </file>
17.78 + <file name="portlet.xml" url="/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/portlet.xml.template">
17.79 + <attr name="template" boolvalue="true" />
17.80 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsfportlet.resources.templates.resources.Bundle"/>
17.81 + <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/portletTemplateHelp.html" />
17.82 + <attr name="templateCategory" stringvalue="rave-portlet"/>
17.83 + </file>
17.84 + <file name="portlet.tld" url="/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/portlet.tld.template">
17.85 + <attr name="template" boolvalue="true" />
17.86 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsfportlet.resources.templates.resources.Bundle"/>
17.87 + <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/portletTLDTemplateHelp.html" />
17.88 + <attr name="templateCategory" stringvalue="rave-portlet"/>
17.89 + </file>
17.90 +
17.91 + <file name="PortletPage.jsp" url="/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPage.jsp.template">
17.92 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsfportlet.resources.templates.resources.Bundle"/>
17.93 + <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org.netbeans.modules.html.htmlObject.gif"/>
17.94 + <attr name="template" boolvalue="true" />
17.95 + <attr name="templateWizardIterator" newvalue="org.netbeans.modules.visualweb.project.jsf.ui.WebFormIterator"/>
17.96 + <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/PortletPageTemplateHelp.html" />
17.97 + <attr name="templateCategory" stringvalue="rave-portlet"/>
17.98 + </file>
17.99 + <attr name="PortletPage.jsp/PortletPage.java" boolvalue="true"/>
17.100 + <file name="PortletPage.java" url="/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPage.java.template">
17.101 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsfportlet.resources.templates.resources.Bundle"/>
17.102 + <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/PortletJavaPageTemplateHelp.html" />
17.103 + <attr name="templateCategory" stringvalue="rave-portlet"/>
17.104 + </file>
17.105 + <file name="PortletPageFragment.jspf" url="/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPageFragment.jspf.template">
17.106 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsfportlet.resources.templates.resources.Bundle"/>
17.107 + <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org.netbeans.modules.html.htmlObject.gif"/>
17.108 + <attr name="template" boolvalue="true" />
17.109 + <attr name="templateWizardIterator" newvalue="org.netbeans.modules.visualweb.project.jsf.ui.WebFormIterator"/>
17.110 + <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/PortletPageFragmentTemplateHelp.html" />
17.111 + <attr name="templateCategory" stringvalue="rave-portlet"/>
17.112 + </file>
17.113 + <attr name="PortletPageFragment.jspf/PortletPageFragment.java" boolvalue="true"/>
17.114 + <file name="PortletPageFragment.java" url="/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPageFragment.java.template">
17.115 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.visualweb.project.jsf.resources.Bundle"/>
17.116 + <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/visualweb/project/jsf/resources/templates/descriptions/pageJavaTemplateHelp.html" />
17.117 + </file>
17.118 + <attr name="PageFragment.java/html.html" boolvalue="true"/>
17.119 +
17.120 +
17.121 +
17.122 + </folder> <!--JsfPortlet-->
17.123 +
17.124 + </folder> <!-- Templates-->
17.125 + <folder name="org-netbeans-api-project-libraries">
17.126 + <folder name="Libraries">
17.127 + <file name="portlet-runtime.xml" url="/org/netbeans/modules/visualweb/project/jsfportlet/libraries/portlet-runtime.xml"/>
17.128 + <file name="jsf-portlet-runtime.xml" url="/org/netbeans/modules/visualweb/project/jsfportlet/libraries/jsf-portlet-runtime.xml"/>
17.129 + </folder>
17.130 + </folder>
17.131 +
17.132 +
17.133 +
17.134 +</filesystem>
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
18.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPage.java.template Wed Feb 23 20:12:58 2011 -0500
18.3 @@ -0,0 +1,51 @@
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 +import javax.faces.FacesException;
18.14 +import com.sun.rave.web.ui.component.Form;
18.15 +import com.sun.rave.web.ui.component.ThemeLinks;
18.16 +
18.17 +
18.18 +public class __NAME__ extends AbstractPageBean {
18.19 + // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
18.20 +
18.21 + private int __placeholder;
18.22 +
18.23 + private ThemeLinks themeLinks1 = new ThemeLinks();
18.24 +
18.25 + public ThemeLinks getThemeLinks1() {
18.26 + return themeLinks1;
18.27 + }
18.28 +
18.29 + public void setThemeLinks1(ThemeLinks t) {
18.30 + this.themeLinks1 = t;
18.31 + }
18.32 +
18.33 + private Form form1 = new Form();
18.34 +
18.35 + public Form getForm1() {
18.36 + return form1;
18.37 + }
18.38 +
18.39 + public void setForm1(Form f) {
18.40 + this.form1 = f;
18.41 + }
18.42 +
18.43 + // </editor-fold>
18.44 + public __NAME__() {
18.45 + // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
18.46 + try {
18.47 + } catch (Exception e) {
18.48 + log("Page1 Initialization Failure", e);
18.49 + throw e instanceof javax.faces.FacesException ? (FacesException) e: new FacesException(e);
18.50 + }
18.51 + // </editor-fold>
18.52 + // TODO: Add your own initialization code here (optional)
18.53 + }
18.54 +}
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
19.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPage.jsp.template Wed Feb 23 20:12:58 2011 -0500
19.3 @@ -0,0 +1,11 @@
19.4 +<?xml version="1.0" encoding="UTF-8"?>
19.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">
19.6 + <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
19.7 + <f:view>
19.8 + <div style="-rave-layout: grid; position: relative; left: 0px; top: 0px; width: 400px; height: 400px">
19.9 + <ui:themeLinks binding="#{__NAME__.themeLinks1}" id="themeLinks1" />
19.10 + <ui:form binding="#{__NAME__.form1}" id="form1"/>
19.11 + </div>
19.12 + </f:view>
19.13 +</jsp:root>
19.14 +
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
20.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPageFragment.java.template Wed Feb 23 20:12:58 2011 -0500
20.3 @@ -0,0 +1,14 @@
20.4 +/*
20.5 + * __NAME__.java
20.6 + *
20.7 + * Created on __DATE__, __TIME__
20.8 + * Copyright __USER__
20.9 + */
20.10 +package untitled;
20.11 +
20.12 +import com.sun.rave.web.ui.appbase.AbstractPageBean;
20.13 +
20.14 +public class __NAME__ extends AbstractPageBean {
20.15 + public __NAME__() {
20.16 + }
20.17 +}
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
21.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/PortletPageFragment.jspf.template Wed Feb 23 20:12:58 2011 -0500
21.3 @@ -0,0 +1,5 @@
21.4 +<?xml version="1.0"?>
21.5 +<div style="-rave-layout: grid; width: 400px; height: 200px" xmlns:f="http://java.sun.com/jsf/core" >
21.6 + <f:subview id="__NAME__">
21.7 + </f:subview>
21.8 +</div>
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
22.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/PortletJavaPageTemplateHelp.html Wed Feb 23 20:12:58 2011 -0500
22.3 @@ -0,0 +1,49 @@
22.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
22.5 +<!--
22.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
22.7 +
22.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
22.9 +
22.10 +
22.11 +The contents of this file are subject to the terms of either the GNU
22.12 +General Public License Version 2 only ("GPL") or the Common
22.13 +Development and Distribution License("CDDL") (collectively, the
22.14 +"License"). You may not use this file except in compliance with the
22.15 +License. You can obtain a copy of the License at
22.16 +http://www.netbeans.org/cddl-gplv2.html
22.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
22.18 +specific language governing permissions and limitations under the
22.19 +License. When distributing the software, include this License Header
22.20 +Notice in each file and include the License file at
22.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
22.22 +particular file as subject to the "Classpath" exception as provided
22.23 +by Sun in the GPL Version 2 section of the License file that
22.24 +accompanied this code. If applicable, add the following below the
22.25 +License Header, with the fields enclosed by brackets [] replaced by
22.26 +your own identifying information:
22.27 +"Portions Copyrighted [year] [name of copyright owner]"
22.28 +
22.29 +Contributor(s):
22.30 +
22.31 +The Original Software is NetBeans. The Initial Developer of the Original
22.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
22.33 +Microsystems, Inc. All Rights Reserved.
22.34 +
22.35 +If you wish your version of this file to be governed by only the CDDL
22.36 +or only the GPL Version 2, indicate your decision by adding
22.37 +"[Contributor] elects to include this software in this distribution
22.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
22.39 +single choice of license, a recipient has the option to distribute
22.40 +your version of this file under either the CDDL, the GPL Version 2 or
22.41 +to extend the choice of license to its licensees as provided above.
22.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
22.43 +Version 2 license, then the option applies only if the new code is
22.44 +made subject to such option by the copyright holder.
22.45 +-->
22.46 +
22.47 +
22.48 +<HTML>
22.49 +<BODY>
22.50 + This template creates a a portlet page bean for a portlet page.
22.51 +</BODY>
22.52 +</HTML>
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
23.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/PortletPageFragmentTemplateHelp.html Wed Feb 23 20:12:58 2011 -0500
23.3 @@ -0,0 +1,49 @@
23.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
23.5 +<!--
23.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
23.7 +
23.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
23.9 +
23.10 +
23.11 +The contents of this file are subject to the terms of either the GNU
23.12 +General Public License Version 2 only ("GPL") or the Common
23.13 +Development and Distribution License("CDDL") (collectively, the
23.14 +"License"). You may not use this file except in compliance with the
23.15 +License. You can obtain a copy of the License at
23.16 +http://www.netbeans.org/cddl-gplv2.html
23.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
23.18 +specific language governing permissions and limitations under the
23.19 +License. When distributing the software, include this License Header
23.20 +Notice in each file and include the License file at
23.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
23.22 +particular file as subject to the "Classpath" exception as provided
23.23 +by Sun in the GPL Version 2 section of the License file that
23.24 +accompanied this code. If applicable, add the following below the
23.25 +License Header, with the fields enclosed by brackets [] replaced by
23.26 +your own identifying information:
23.27 +"Portions Copyrighted [year] [name of copyright owner]"
23.28 +
23.29 +Contributor(s):
23.30 +
23.31 +The Original Software is NetBeans. The Initial Developer of the Original
23.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
23.33 +Microsystems, Inc. All Rights Reserved.
23.34 +
23.35 +If you wish your version of this file to be governed by only the CDDL
23.36 +or only the GPL Version 2, indicate your decision by adding
23.37 +"[Contributor] elects to include this software in this distribution
23.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
23.39 +single choice of license, a recipient has the option to distribute
23.40 +your version of this file under either the CDDL, the GPL Version 2 or
23.41 +to extend the choice of license to its licensees as provided above.
23.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
23.43 +Version 2 license, then the option applies only if the new code is
23.44 +made subject to such option by the copyright holder.
23.45 +-->
23.46 +
23.47 +
23.48 +<HTML>
23.49 +<BODY>
23.50 + 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.
23.51 +</BODY>
23.52 +</HTML>
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
24.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/PortletPageTemplateHelp.html Wed Feb 23 20:12:58 2011 -0500
24.3 @@ -0,0 +1,49 @@
24.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
24.5 +<!--
24.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
24.7 +
24.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
24.9 +
24.10 +
24.11 +The contents of this file are subject to the terms of either the GNU
24.12 +General Public License Version 2 only ("GPL") or the Common
24.13 +Development and Distribution License("CDDL") (collectively, the
24.14 +"License"). You may not use this file except in compliance with the
24.15 +License. You can obtain a copy of the License at
24.16 +http://www.netbeans.org/cddl-gplv2.html
24.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
24.18 +specific language governing permissions and limitations under the
24.19 +License. When distributing the software, include this License Header
24.20 +Notice in each file and include the License file at
24.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
24.22 +particular file as subject to the "Classpath" exception as provided
24.23 +by Sun in the GPL Version 2 section of the License file that
24.24 +accompanied this code. If applicable, add the following below the
24.25 +License Header, with the fields enclosed by brackets [] replaced by
24.26 +your own identifying information:
24.27 +"Portions Copyrighted [year] [name of copyright owner]"
24.28 +
24.29 +Contributor(s):
24.30 +
24.31 +The Original Software is NetBeans. The Initial Developer of the Original
24.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
24.33 +Microsystems, Inc. All Rights Reserved.
24.34 +
24.35 +If you wish your version of this file to be governed by only the CDDL
24.36 +or only the GPL Version 2, indicate your decision by adding
24.37 +"[Contributor] elects to include this software in this distribution
24.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
24.39 +single choice of license, a recipient has the option to distribute
24.40 +your version of this file under either the CDDL, the GPL Version 2 or
24.41 +to extend the choice of license to its licensees as provided above.
24.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
24.43 +Version 2 license, then the option applies only if the new code is
24.44 +made subject to such option by the copyright holder.
24.45 +-->
24.46 +
24.47 +
24.48 +<HTML>
24.49 +<BODY>
24.50 + This template will create a new blank portlet page. Design the portlet page by dragging components from the Palette.
24.51 +</BODY>
24.52 +</HTML>
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
25.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/facesConfigTemplateHelp.html Wed Feb 23 20:12:58 2011 -0500
25.3 @@ -0,0 +1,51 @@
25.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
25.5 +<!--
25.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
25.7 +
25.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
25.9 +
25.10 +
25.11 +The contents of this file are subject to the terms of either the GNU
25.12 +General Public License Version 2 only ("GPL") or the Common
25.13 +Development and Distribution License("CDDL") (collectively, the
25.14 +"License"). You may not use this file except in compliance with the
25.15 +License. You can obtain a copy of the License at
25.16 +http://www.netbeans.org/cddl-gplv2.html
25.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
25.18 +specific language governing permissions and limitations under the
25.19 +License. When distributing the software, include this License Header
25.20 +Notice in each file and include the License file at
25.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
25.22 +particular file as subject to the "Classpath" exception as provided
25.23 +by Sun in the GPL Version 2 section of the License file that
25.24 +accompanied this code. If applicable, add the following below the
25.25 +License Header, with the fields enclosed by brackets [] replaced by
25.26 +your own identifying information:
25.27 +"Portions Copyrighted [year] [name of copyright owner]"
25.28 +
25.29 +Contributor(s):
25.30 +
25.31 +The Original Software is NetBeans. The Initial Developer of the Original
25.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
25.33 +Microsystems, Inc. All Rights Reserved.
25.34 +
25.35 +If you wish your version of this file to be governed by only the CDDL
25.36 +or only the GPL Version 2, indicate your decision by adding
25.37 +"[Contributor] elects to include this software in this distribution
25.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
25.39 +single choice of license, a recipient has the option to distribute
25.40 +your version of this file under either the CDDL, the GPL Version 2 or
25.41 +to extend the choice of license to its licensees as provided above.
25.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
25.43 +Version 2 license, then the option applies only if the new code is
25.44 +made subject to such option by the copyright holder.
25.45 +-->
25.46 +
25.47 +
25.48 +<HTML>
25.49 +<BODY>
25.50 + This template creates a new Faces Configuration XML file that is used
25.51 + by a Java Studio Creator project.
25.52 + It is also known as faces-config.xml.
25.53 +</BODY>
25.54 +</HTML>
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
26.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/portletTLDTemplateHelp.html Wed Feb 23 20:12:58 2011 -0500
26.3 @@ -0,0 +1,51 @@
26.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
26.5 +<!--
26.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
26.7 +
26.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
26.9 +
26.10 +
26.11 +The contents of this file are subject to the terms of either the GNU
26.12 +General Public License Version 2 only ("GPL") or the Common
26.13 +Development and Distribution License("CDDL") (collectively, the
26.14 +"License"). You may not use this file except in compliance with the
26.15 +License. You can obtain a copy of the License at
26.16 +http://www.netbeans.org/cddl-gplv2.html
26.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
26.18 +specific language governing permissions and limitations under the
26.19 +License. When distributing the software, include this License Header
26.20 +Notice in each file and include the License file at
26.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
26.22 +particular file as subject to the "Classpath" exception as provided
26.23 +by Sun in the GPL Version 2 section of the License file that
26.24 +accompanied this code. If applicable, add the following below the
26.25 +License Header, with the fields enclosed by brackets [] replaced by
26.26 +your own identifying information:
26.27 +"Portions Copyrighted [year] [name of copyright owner]"
26.28 +
26.29 +Contributor(s):
26.30 +
26.31 +The Original Software is NetBeans. The Initial Developer of the Original
26.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
26.33 +Microsystems, Inc. All Rights Reserved.
26.34 +
26.35 +If you wish your version of this file to be governed by only the CDDL
26.36 +or only the GPL Version 2, indicate your decision by adding
26.37 +"[Contributor] elects to include this software in this distribution
26.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
26.39 +single choice of license, a recipient has the option to distribute
26.40 +your version of this file under either the CDDL, the GPL Version 2 or
26.41 +to extend the choice of license to its licensees as provided above.
26.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
26.43 +Version 2 license, then the option applies only if the new code is
26.44 +made subject to such option by the copyright holder.
26.45 +-->
26.46 +
26.47 +
26.48 +<HTML>
26.49 +<BODY>
26.50 + This template creates a new Portlet TLD file that is used
26.51 + by a Java Studio Creator project.
26.52 + It is also known as portlet.tld.
26.53 +</BODY>
26.54 +</HTML>
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
27.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/portletTemplateHelp.html Wed Feb 23 20:12:58 2011 -0500
27.3 @@ -0,0 +1,51 @@
27.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
27.5 +<!--
27.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
27.7 +
27.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
27.9 +
27.10 +
27.11 +The contents of this file are subject to the terms of either the GNU
27.12 +General Public License Version 2 only ("GPL") or the Common
27.13 +Development and Distribution License("CDDL") (collectively, the
27.14 +"License"). You may not use this file except in compliance with the
27.15 +License. You can obtain a copy of the License at
27.16 +http://www.netbeans.org/cddl-gplv2.html
27.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
27.18 +specific language governing permissions and limitations under the
27.19 +License. When distributing the software, include this License Header
27.20 +Notice in each file and include the License file at
27.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
27.22 +particular file as subject to the "Classpath" exception as provided
27.23 +by Sun in the GPL Version 2 section of the License file that
27.24 +accompanied this code. If applicable, add the following below the
27.25 +License Header, with the fields enclosed by brackets [] replaced by
27.26 +your own identifying information:
27.27 +"Portions Copyrighted [year] [name of copyright owner]"
27.28 +
27.29 +Contributor(s):
27.30 +
27.31 +The Original Software is NetBeans. The Initial Developer of the Original
27.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
27.33 +Microsystems, Inc. All Rights Reserved.
27.34 +
27.35 +If you wish your version of this file to be governed by only the CDDL
27.36 +or only the GPL Version 2, indicate your decision by adding
27.37 +"[Contributor] elects to include this software in this distribution
27.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
27.39 +single choice of license, a recipient has the option to distribute
27.40 +your version of this file under either the CDDL, the GPL Version 2 or
27.41 +to extend the choice of license to its licensees as provided above.
27.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
27.43 +Version 2 license, then the option applies only if the new code is
27.44 +made subject to such option by the copyright holder.
27.45 +-->
27.46 +
27.47 +
27.48 +<HTML>
27.49 +<BODY>
27.50 + This template creates a new Portlet deployment descriptor XML file that is used
27.51 + by a Java Studio Creator project.
27.52 + It is also known as portlet.xml.
27.53 +</BODY>
27.54 +</HTML>
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
28.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/descriptions/portletWebTemplateHelp.html Wed Feb 23 20:12:58 2011 -0500
28.3 @@ -0,0 +1,50 @@
28.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
28.5 +<!--
28.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
28.7 +
28.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
28.9 +
28.10 +
28.11 +The contents of this file are subject to the terms of either the GNU
28.12 +General Public License Version 2 only ("GPL") or the Common
28.13 +Development and Distribution License("CDDL") (collectively, the
28.14 +"License"). You may not use this file except in compliance with the
28.15 +License. You can obtain a copy of the License at
28.16 +http://www.netbeans.org/cddl-gplv2.html
28.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
28.18 +specific language governing permissions and limitations under the
28.19 +License. When distributing the software, include this License Header
28.20 +Notice in each file and include the License file at
28.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
28.22 +particular file as subject to the "Classpath" exception as provided
28.23 +by Sun in the GPL Version 2 section of the License file that
28.24 +accompanied this code. If applicable, add the following below the
28.25 +License Header, with the fields enclosed by brackets [] replaced by
28.26 +your own identifying information:
28.27 +"Portions Copyrighted [year] [name of copyright owner]"
28.28 +
28.29 +Contributor(s):
28.30 +
28.31 +The Original Software is NetBeans. The Initial Developer of the Original
28.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
28.33 +Microsystems, Inc. All Rights Reserved.
28.34 +
28.35 +If you wish your version of this file to be governed by only the CDDL
28.36 +or only the GPL Version 2, indicate your decision by adding
28.37 +"[Contributor] elects to include this software in this distribution
28.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
28.39 +single choice of license, a recipient has the option to distribute
28.40 +your version of this file under either the CDDL, the GPL Version 2 or
28.41 +to extend the choice of license to its licensees as provided above.
28.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
28.43 +Version 2 license, then the option applies only if the new code is
28.44 +made subject to such option by the copyright holder.
28.45 +-->
28.46 +
28.47 +
28.48 +<HTML>
28.49 +<BODY>
28.50 + This template creates a new Portlet Web Application Configuration XML file that
28.51 + is used by a Java Studio Creator project. Also known as web.xml.
28.52 +</BODY>
28.53 +</HTML>
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
29.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/faces-config.xml.template Wed Feb 23 20:12:58 2011 -0500
29.3 @@ -0,0 +1,33 @@
29.4 +<?xml version='1.0' encoding='UTF-8'?>
29.5 +
29.6 +<!--
29.7 + Copyright 2005 Sun Microsystems, Inc. All rights reserved.
29.8 + SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
29.9 +-->
29.10 +
29.11 +<!DOCTYPE faces-config PUBLIC
29.12 + "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
29.13 + "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
29.14 +
29.15 +
29.16 +<faces-config>
29.17 +
29.18 +
29.19 + <!-- Install Replacement Factory Objects -->
29.20 + <factory>
29.21 + <faces-context-factory>
29.22 + com.sun.faces.portlet.FacesContextFactoryImpl
29.23 + </faces-context-factory>
29.24 + <lifecycle-factory>
29.25 + com.sun.faces.portlet.LifecycleFactoryImpl
29.26 + </lifecycle-factory>
29.27 + </factory>
29.28 +
29.29 + <!-- Install Replacement Application Objects -->
29.30 + <application>
29.31 + <view-handler>
29.32 + com.sun.faces.portlet.ViewHandlerImpl
29.33 + </view-handler>
29.34 + </application>
29.35 +
29.36 +</faces-config>
29.37 \ No newline at end of file
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
30.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/portlet-web.xml.template Wed Feb 23 20:12:58 2011 -0500
30.3 @@ -0,0 +1,114 @@
30.4 +<?xml version="1.0" encoding="UTF-8"?>
30.5 +<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
30.6 + "http://java.sun.com/dtd/web-app_2_3.dtd">
30.7 +<web-app>
30.8 + <context-param>
30.9 + <param-name>com.sun.faces.portlet.INIT_VIEW</param-name>
30.10 + <param-value>/Page1.jsp</param-value>
30.11 + </context-param>
30.12 + <context-param>
30.13 + <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
30.14 + <param-value>client</param-value>
30.15 + </context-param>
30.16 + <context-param>
30.17 + <param-name>javax.faces.CONFIG_FILES</param-name>
30.18 + <param-value>/WEB-INF/navigation.xml,/WEB-INF/managed-beans.xml,/WEB-INF/faces-config.xml</param-value>
30.19 + </context-param>
30.20 + <context-param>
30.21 + <param-name>com.sun.faces.verifyObjects</param-name>
30.22 + <!-- TODO Turn on again once webui doesn't have abstract objects in their config -->
30.23 + <param-value>false</param-value>
30.24 + </context-param>
30.25 + <context-param>
30.26 + <param-name>com.sun.faces.validateXml</param-name>
30.27 + <param-value>true</param-value>
30.28 + </context-param>
30.29 + <servlet>
30.30 + <servlet-name>Faces Servlet</servlet-name>
30.31 + <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
30.32 + <load-on-startup> 1 </load-on-startup>
30.33 + </servlet>
30.34 + <!-- Portlet servlet declaration -->
30.35 + <servlet>
30.36 + <servlet-name>CreatorPortlet</servlet-name>
30.37 + <display-name>CreatorPortlet Wrapper</display-name>
30.38 + <description>Automated generated Portlet Wrapper</description>
30.39 + <servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
30.40 + <init-param>
30.41 + <param-name>portlet-class</param-name>
30.42 + <param-value>com.sun.faces.portlet.FacesPortlet</param-value>
30.43 + </init-param>
30.44 + <init-param>
30.45 + <param-name>portlet-guid</param-name>
30.46 + <param-value>CreatorPortlet.CreatorPortlet</param-value>
30.47 + </init-param>
30.48 + </servlet>
30.49 +
30.50 + <!-- Error Handler Servlet -->
30.51 + <servlet>
30.52 + <servlet-name>ExceptionHandlerServlet</servlet-name>
30.53 + <servlet-class>com.sun.errorhandler.ExceptionHandler</servlet-class>
30.54 + <init-param>
30.55 + <param-name>errorHost</param-name>
30.56 + <param-value>localhost</param-value>
30.57 + </init-param>
30.58 + <init-param>
30.59 + <param-name>errorPort</param-name>
30.60 + <param-value>4444</param-value>
30.61 + </init-param>
30.62 + </servlet>
30.63 +
30.64 + <!-- Sun Web UI Components Themes -->
30.65 + <servlet>
30.66 + <servlet-name>ThemeServlet</servlet-name>
30.67 + <servlet-class>com.sun.rave.web.ui.theme.ThemeServlet</servlet-class>
30.68 + </servlet>
30.69 +
30.70 + <servlet-mapping>
30.71 + <servlet-name>CreatorPortlet</servlet-name>
30.72 + <url-pattern>/CreatorPortlet/*</url-pattern>
30.73 + </servlet-mapping>
30.74 + <!-- Error Handler Servlet Mapping -->
30.75 + <servlet-mapping>
30.76 + <servlet-name>ExceptionHandlerServlet</servlet-name>
30.77 + <url-pattern>/error/ExceptionHandler</url-pattern>
30.78 + </servlet-mapping>
30.79 +
30.80 + <!-- Sun Web UI Components Servlet Mapping -->
30.81 + <servlet-mapping>
30.82 + <servlet-name>ThemeServlet</servlet-name>
30.83 + <url-pattern>/suntheme/*</url-pattern>
30.84 + </servlet-mapping>
30.85 +
30.86 + <!-- Welcome File List -->
30.87 + <welcome-file-list>
30.88 + <welcome-file>faces/Page1.jsp</welcome-file>
30.89 + </welcome-file-list>
30.90 +
30.91 + <!-- Catch ServletException -->
30.92 + <error-page>
30.93 + <exception-type>javax.servlet.ServletException</exception-type>
30.94 + <location>/error/ExceptionHandler</location>
30.95 + </error-page>
30.96 +
30.97 + <!-- Catch IOException -->
30.98 + <!-- //TODO This breaks Pluto
30.99 + <error-page>
30.100 + <exception-type>java.io.IOException</exception-type>
30.101 + <location>/error/ExceptionHandler</location>
30.102 + </error-page>
30.103 + -->
30.104 +
30.105 + <!-- Catch FacesException -->
30.106 + <!-- //TODO This breaks Pluto
30.107 + <error-page>
30.108 + <exception-type>javax.faces.FacesException</exception-type>
30.109 + <location>/error/ExceptionHandler</location>
30.110 + </error-page>
30.111 + -->
30.112 +
30.113 + <taglib>
30.114 + <taglib-uri>http://java.sun.com/portlet</taglib-uri>
30.115 + <taglib-location>/WEB-INF/tld/portlet.tld</taglib-location>
30.116 + </taglib>
30.117 +</web-app>
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
31.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/portlet.tld.template Wed Feb 23 20:12:58 2011 -0500
31.3 @@ -0,0 +1,104 @@
31.4 +<?xml version="1.0" encoding="ISO-8859-1" ?>
31.5 +<!DOCTYPE taglib PUBLIC
31.6 + "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
31.7 + "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
31.8 +<!--
31.9 +Copyright 2004 The Apache Software Foundation
31.10 +Licensed under the Apache License, Version 2.0 (the "License");
31.11 +you may not use this file except in compliance with the License.
31.12 +You may obtain a copy of the License at
31.13 +
31.14 +http://www.apache.org/licenses/LICENSE-2.0
31.15 +
31.16 +Unless required by applicable law or agreed to in writing, software
31.17 +distributed under the License is distributed on an "AS IS" BASIS,
31.18 +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
31.19 +implied.
31.20 +
31.21 +See the License for the specific language governing permissions and
31.22 +limitations under the License.
31.23 +-->
31.24 +<taglib>
31.25 + <tlibversion>1.0</tlibversion>
31.26 + <jspversion>1.1</jspversion>
31.27 + <shortname>portlet</shortname>
31.28 + <uri>http://java.sun.com/portlet</uri>
31.29 + <tag>
31.30 + <name>defineObjects</name>
31.31 + <tagclass>org.apache.pluto.tags.DefineObjectsTag</tagclass>
31.32 + <teiclass>org.apache.pluto.tags.DefineObjectsTag$TEI</teiclass>
31.33 + <bodycontent>empty</bodycontent>
31.34 + </tag>
31.35 + <tag>
31.36 + <name>param</name>
31.37 + <tagclass>org.apache.pluto.tags.ParamTag</tagclass>
31.38 + <bodycontent>empty</bodycontent>
31.39 + <attribute>
31.40 + <name>name</name>
31.41 + <required>true</required>
31.42 + <rtexprvalue>true</rtexprvalue>
31.43 + </attribute>
31.44 + <attribute>
31.45 + <name>value</name>
31.46 + <required>true</required>
31.47 + <rtexprvalue>true</rtexprvalue>
31.48 + </attribute>
31.49 + </tag>
31.50 + <tag>
31.51 + <name>actionURL</name>
31.52 + <tagclass>org.apache.pluto.tags.ActionURLTag</tagclass>
31.53 + <teiclass>org.apache.pluto.tags.BasicURLTag$TEI</teiclass>
31.54 + <bodycontent>JSP</bodycontent>
31.55 + <attribute>
31.56 + <name>windowState</name>
31.57 + <required>false</required>
31.58 + <rtexprvalue>true</rtexprvalue>
31.59 + </attribute>
31.60 + <attribute>
31.61 + <name>portletMode</name>
31.62 + <required>false</required>
31.63 + <rtexprvalue>true</rtexprvalue>
31.64 + </attribute>
31.65 + <attribute>
31.66 + <name>secure</name>
31.67 + <required>false</required>
31.68 + <rtexprvalue>true</rtexprvalue>
31.69 + </attribute>
31.70 + <attribute>
31.71 + <name>var</name>
31.72 + <required>false</required>
31.73 + <rtexprvalue>true</rtexprvalue>
31.74 + </attribute>
31.75 + </tag>
31.76 + <tag>
31.77 + <name>renderURL</name>
31.78 + <tagclass>org.apache.pluto.tags.RenderURLTag</tagclass>
31.79 + <teiclass>org.apache.pluto.tags.BasicURLTag$TEI</teiclass>
31.80 + <bodycontent>JSP</bodycontent>
31.81 + <attribute>
31.82 + <name>windowState</name>
31.83 + <required>false</required>
31.84 + <rtexprvalue>true</rtexprvalue>
31.85 + </attribute>
31.86 + <attribute>
31.87 + <name>portletMode</name>
31.88 + <required>false</required>
31.89 + <rtexprvalue>true</rtexprvalue>
31.90 + </attribute>
31.91 + <attribute>
31.92 + <name>secure</name>
31.93 + <required>false</required>
31.94 + <rtexprvalue>true</rtexprvalue>
31.95 + </attribute>
31.96 + <attribute>
31.97 + <name>var</name>
31.98 + <required>false</required>
31.99 + <rtexprvalue>true</rtexprvalue>
31.100 + </attribute>
31.101 + </tag>
31.102 + <tag>
31.103 + <name>namespace</name>
31.104 + <tagclass>org.apache.pluto.tags.NamespaceTag</tagclass>
31.105 + <bodycontent>empty</bodycontent>
31.106 + </tag>
31.107 +</taglib>
31.108 \ No newline at end of file
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
32.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/portlet.xml.template Wed Feb 23 20:12:58 2011 -0500
32.3 @@ -0,0 +1,28 @@
32.4 +<?xml version="1.0" encoding="UTF-8"?>
32.5 +<!--The portlet-app element is the root of the deployment descriptor
32.6 +for a portlet application. -->
32.7 +<portlet-app
32.8 + xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
32.9 + version="1.0"
32.10 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
32.11 + xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
32.12 + http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
32.13 +
32.14 + <portlet>
32.15 + <description>Creator Portlet</description>
32.16 + <portlet-name>CreatorPortlet</portlet-name>
32.17 + <display-name>Creator Portlet</display-name>
32.18 + <portlet-class>com.sun.faces.portlet.FacesPortlet</portlet-class>
32.19 + <supports>
32.20 + <mime-type>text/html</mime-type>
32.21 + <portlet-mode>VIEW</portlet-mode>
32.22 + </supports>
32.23 + <supported-locale>en</supported-locale>
32.24 +
32.25 + <portlet-info>
32.26 + <title>Creator Portlet</title>
32.27 + <short-title>Creator Portlet</short-title>
32.28 + <keywords>Creator</keywords>
32.29 + </portlet-info>
32.30 + </portlet>
32.31 + </portlet-app>
32.32 \ No newline at end of file
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
33.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/resources/templates/resources/Bundle.properties Wed Feb 23 20:12:58 2011 -0500
33.3 @@ -0,0 +1,45 @@
33.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33.5 +#
33.6 +# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
33.7 +#
33.8 +# The contents of this file are subject to the terms of either the GNU
33.9 +# General Public License Version 2 only ("GPL") or the Common
33.10 +# Development and Distribution License("CDDL") (collectively, the
33.11 +# "License"). You may not use this file except in compliance with the
33.12 +# License. You can obtain a copy of the License at
33.13 +# http://www.netbeans.org/cddl-gplv2.html
33.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
33.15 +# specific language governing permissions and limitations under the
33.16 +# License. When distributing the software, include this License Header
33.17 +# Notice in each file and include the License file at
33.18 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
33.19 +# particular file as subject to the "Classpath" exception as provided
33.20 +# by Sun in the GPL Version 2 section of the License file that
33.21 +# accompanied this code. If applicable, add the following below the
33.22 +# License Header, with the fields enclosed by brackets [] replaced by
33.23 +# your own identifying information:
33.24 +# "Portions Copyrighted [year] [name of copyright owner]"
33.25 +#
33.26 +# Contributor(s):
33.27 +#
33.28 +# The Original Software is NetBeans. The Initial Developer of the Original
33.29 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
33.30 +# Microsystems, Inc. All Rights Reserved.
33.31 +#
33.32 +# If you wish your version of this file to be governed by only the CDDL
33.33 +# or only the GPL Version 2, indicate your decision by adding
33.34 +# "[Contributor] elects to include this software in this distribution
33.35 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
33.36 +# single choice of license, a recipient has the option to distribute
33.37 +# your version of this file under either the CDDL, the GPL Version 2 or
33.38 +# to extend the choice of license to its licensees as provided above.
33.39 +# However, if you add GPL Version 2 code and therefore, elected the GPL
33.40 +# Version 2 license, then the option applies only if the new code is
33.41 +# made subject to such option by the copyright holder.
33.42 +#
33.43 +Templates/JsfPortlet/portletWeb.xml=Portlet Web Application Configuration
33.44 +Templates/JsfPortlet/portlet.xml=Portlet Deployment Descriptor
33.45 +Templates/JsfPortlet/faces.config.xml=Java Server Faces Configuration for JSF-Portlet Bridge
33.46 +Templates/JsfPortlet/portlet.tld=JSR-168 Portlet Tag Library
33.47 +Templates/JsfPortlet/PortletPage.jsp=Portlet Page
33.48 +Templates/JsfPortlet/PortletPageFragment.jspf=Portlet Page Fragment
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
34.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties Wed Feb 23 20:12:58 2011 -0500
34.3 @@ -0,0 +1,117 @@
34.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
34.5 +#
34.6 +# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
34.7 +#
34.8 +# The contents of this file are subject to the terms of either the GNU
34.9 +# General Public License Version 2 only ("GPL") or the Common
34.10 +# Development and Distribution License("CDDL") (collectively, the
34.11 +# "License"). You may not use this file except in compliance with the
34.12 +# License. You can obtain a copy of the License at
34.13 +# http://www.netbeans.org/cddl-gplv2.html
34.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
34.15 +# specific language governing permissions and limitations under the
34.16 +# License. When distributing the software, include this License Header
34.17 +# Notice in each file and include the License file at
34.18 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
34.19 +# particular file as subject to the "Classpath" exception as provided
34.20 +# by Sun in the GPL Version 2 section of the License file that
34.21 +# accompanied this code. If applicable, add the following below the
34.22 +# License Header, with the fields enclosed by brackets [] replaced by
34.23 +# your own identifying information:
34.24 +# "Portions Copyrighted [year] [name of copyright owner]"
34.25 +#
34.26 +# Contributor(s):
34.27 +#
34.28 +# The Original Software is NetBeans. The Initial Developer of the Original
34.29 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
34.30 +# Microsystems, Inc. All Rights Reserved.
34.31 +#
34.32 +# If you wish your version of this file to be governed by only the CDDL
34.33 +# or only the GPL Version 2, indicate your decision by adding
34.34 +# "[Contributor] elects to include this software in this distribution
34.35 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
34.36 +# single choice of license, a recipient has the option to distribute
34.37 +# your version of this file under either the CDDL, the GPL Version 2 or
34.38 +# to extend the choice of license to its licensees as provided above.
34.39 +# However, if you add GPL Version 2 code and therefore, elected the GPL
34.40 +# Version 2 license, then the option applies only if the new code is
34.41 +# made subject to such option by the copyright holder.
34.42 +
34.43 +#PanelProjectLocationVisual
34.44 +TXT_NewWebApp=Portlet
34.45 +LBL_NWP1_ProjectTitleName=Name and Location
34.46 +LBL_NWP1_ProjectName_Label=Project Name
34.47 +LBL_NPW1_DefaultProjectName=Portlet{0}
34.48 +LBL_NWP1_ProjectLocation_Label=Project Location
34.49 +LBL_NWP1_BrowseLocation_Button=Browse...
34.50 +LBL_NWP1_CreatedProjectFolder_Lablel=Project Folder
34.51 +
34.52 +LBL_NWP1_ProjectName_LabelMnemonic=N
34.53 +LBL_NWP1_ProjectLocation_LabelMnemonic=L
34.54 +LBL_NWP1_CreatedProjectFolder_LablelMnemonic=D
34.55 +LBL_NWP1_BrowseLocation_ButtonMnemonic=s
34.56 +
34.57 +# A11Y Panels
34.58 +ACS_NWP1_NamePanel_A11YDesc=Project Name and Location Panel
34.59 +ACS_IW_SourcesPanel_A11YDesc=Add Existing Sources Panel
34.60 +
34.61 +ACS_LBL_NWP1_ProjectName_A11YDesc=Project Name
34.62 +ACS_LBL_NPW1_ProjectLocation_A11YDesc=Project Location
34.63 +ACS_LBL_NWP1_BrowseLocation_A11YDesc=Browse Project Location
34.64 +ACS_LBL_NWP1_CreatedProjectFolder_A11YDesc=Project Folder
34.65 +
34.66 +LBL_NWP1_SelectProjectLocation=Select Project Location
34.67 +MSG_IllegalProjectName=Project Name is not a valid folder name.
34.68 +MSG_InvalidProjectName=Project Name can only contain characters in [a-zA-Z_0-9.-].
34.69 +MSG_ProjectFolderExists=Project Folder already exists and is not empty.
34.70 +MSG_ProjectLocationRO=Project Location is read only.
34.71 +MSG_IllegalProjectLocation=Project Location is not valid path.
34.72 +MSG_IllegalDisk=At least disk roots must be mounted!
34.73 +MSG_CreateDir=Directory does not exist. Do you want to create it?
34.74 +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.
34.75 +MSG_ProjectFolderReadOnly=Project Folder is read-only.
34.76 +
34.77 +#Portlet wizard
34.78 +LBL_Portlet_Step1=Project Name and Location
34.79 +LBL_Portlet_Step2=Portlet Deployment Descriptor
34.80 +LBL_WizardStepsCount={0} of {1}
34.81 +LAB_ConfigureSourceRoots=Existing Sources and Libraries
34.82 +
34.83 +#PortletProjectDeployDescriptorVisual
34.84 +ACS_LBL_PPOV_PORTLETNAME_A11YDesc=Portlet Name
34.85 +ACS_LBL_PPOV_PORTLETNAME_A11YName=Portlet Name
34.86 +LBL_PPOV_PORTLETNAME=Portlet Name\:
34.87 +LBL_PPOV_PORTLETDESC=Portlet Description\:
34.88 +ACS_LBL_PPOV_PORTLETDESC_A11YName=
34.89 +ACS_LBL_PPOV_PORTLETDESC_A11YDesc=Portlet Description
34.90 +ACS_TXT_PPOV_PORTLETNAME_A11YName=Portlet Name
34.91 +ACS_TXT_PPOV_PORTLETNAME_A11YDesc=Portlet Name Textfield
34.92 +LBL_PPOV_PORTLETDISPLAYNAME=Portlet Display Name\:
34.93 +ACS_TXT_PPOV_PORTLETDISPLAYNAME_A11YName=Portlet Display Name
34.94 +ACS_TXT_PPOV_PORTLETDISPLAYNAME_A11YDesc=Portlet Display Name Textfield
34.95 +LBL_PPOV_PORTLETTITLE=Portlet Title\:
34.96 +ACS_TXT_PPOV_PORTLETTITLE_A11YName=Portlet Title
34.97 +ACS_TXT_PPOV_PORTLETTITLE_A11YDesc=Portlet Title Textfield
34.98 +ACS_LBL_PPOV_PORTLETTITLE_A11YName=Portlet Title
34.99 +ACS_LBL_PPOV_PORTLETTITLE_A11YDesc=Portlet Title Label
34.100 +LBL_PPOV_PORTLETSHORTTITLE=Portlet Short Title\:
34.101 +ACS_LBL_PPOV_PORTLETSHORTTITLE_A11YName=Portlet Short Title
34.102 +ACS_LBL_PPOV_PORTLETSHORTTITLE_A11YDesc=Portlet Short Title Label
34.103 +ACS_TXT_PPOV_PORTLETSHORTTITLE_A11YName=Portlet Short Title
34.104 +ACS_TXT_PPOV_PORTLETSHORTTITLE_A11YDesc=Portlet Short Title Textfield
34.105 +TXT_PORTLET_DIPSLAYNAME_SUFFIX_DEFAULT=Portlet
34.106 +TXT_PORTLET_DESC_DEFAULT=Created By Visual Web Pack
34.107 +
34.108 +ACS_TXT_PPOV_PORTLETDESC_A11YDesc=Portlet Description Textfield
34.109 +
34.110 +ACS_TXT_PPOV_PORTLETDESC_A11YName=Portlet Description
34.111 +
34.112 +LBL_PPOV_PORTLETNAMEMnemonic=N
34.113 +
34.114 +LBL_PPOV_PORTLETDISPLAYNAMEMnemonic=D
34.115 +
34.116 +LBL_PPOV_PORTLETDESCMnemonic=c
34.117 +
34.118 +LBL_PPOV_PORTLETTITLEMnemonic=i
34.119 +
34.120 +LBL_PPOV_PORTLETSHORTTITLEMnemonic=S
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
35.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/FileChooser.java Wed Feb 23 20:12:58 2011 -0500
35.3 @@ -0,0 +1,186 @@
35.4 +/*
35.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
35.6 + *
35.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
35.8 + *
35.9 + * The contents of this file are subject to the terms of either the GNU
35.10 + * General Public License Version 2 only ("GPL") or the Common
35.11 + * Development and Distribution License("CDDL") (collectively, the
35.12 + * "License"). You may not use this file except in compliance with the
35.13 + * License. You can obtain a copy of the License at
35.14 + * http://www.netbeans.org/cddl-gplv2.html
35.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
35.16 + * specific language governing permissions and limitations under the
35.17 + * License. When distributing the software, include this License Header
35.18 + * Notice in each file and include the License file at
35.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
35.20 + * particular file as subject to the "Classpath" exception as provided
35.21 + * by Sun in the GPL Version 2 section of the License file that
35.22 + * accompanied this code. If applicable, add the following below the
35.23 + * License Header, with the fields enclosed by brackets [] replaced by
35.24 + * your own identifying information:
35.25 + * "Portions Copyrighted [year] [name of copyright owner]"
35.26 + *
35.27 + * Contributor(s):
35.28 + *
35.29 + * The Original Software is NetBeans. The Initial Developer of the Original
35.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
35.31 + * Microsystems, Inc. All Rights Reserved.
35.32 + *
35.33 + * If you wish your version of this file to be governed by only the CDDL
35.34 + * or only the GPL Version 2, indicate your decision by adding
35.35 + * "[Contributor] elects to include this software in this distribution
35.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
35.37 + * single choice of license, a recipient has the option to distribute
35.38 + * your version of this file under either the CDDL, the GPL Version 2 or
35.39 + * to extend the choice of license to its licensees as provided above.
35.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
35.41 + * Version 2 license, then the option applies only if the new code is
35.42 + * made subject to such option by the copyright holder.
35.43 + */
35.44 +
35.45 +
35.46 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
35.47 +
35.48 +import org.openide.filesystems.FileUtil;
35.49 +
35.50 +import javax.swing.*;
35.51 +import javax.swing.filechooser.FileSystemView;
35.52 +import javax.swing.filechooser.FileFilter;
35.53 +import java.io.File;
35.54 +import java.io.IOException;
35.55 +import java.awt.*;
35.56 +import java.util.Map;
35.57 +import java.util.HashMap;
35.58 +
35.59 +public class FileChooser extends JFileChooser {
35.60 +
35.61 + private String key;
35.62 + protected String initialPath;
35.63 +
35.64 + public FileChooser(String key, String currentDirectoryPath) {
35.65 + super(getInitialDirectory(key, currentDirectoryPath));
35.66 + this.key = key;
35.67 + }
35.68 +
35.69 + public FileChooser(String key) {
35.70 + this(key, null);
35.71 + this.key = key;
35.72 + }
35.73 +
35.74 + private static File getInitialDirectory(String key, String currentDirectoryPath) {
35.75 + return getInitialDirectory(key, currentDirectoryPath == null ? null : new File(currentDirectoryPath));
35.76 + }
35.77 +
35.78 + private static File getInitialDirectory(String key, File f) {
35.79 + while (f != null) {
35.80 + if (f.exists() && f.isDirectory()) {
35.81 + return f;
35.82 + }
35.83 + f = f.getParentFile();
35.84 + }
35.85 + File lastChooserLocation = getLastChooserLocation(key);
35.86 + if (lastChooserLocation != null && lastChooserLocation.exists()) {
35.87 + return lastChooserLocation;
35.88 + } else {
35.89 + String pathname = System.getProperty("user.home"); //NOI18N
35.90 + if(pathname != null) {
35.91 + File file = new File(pathname).getAbsoluteFile();
35.92 + if(file.exists()) {
35.93 + return file;
35.94 + }
35.95 + }
35.96 + File file = new File("").getAbsoluteFile(); //NOI18N
35.97 + assert file.exists() : "Default directory '" + file.getAbsolutePath() + "' does not exist"; //NOI18N
35.98 + return f;
35.99 + }
35.100 + }
35.101 +
35.102 + public int showDialog(Component parent, String approveButtonText) throws HeadlessException {
35.103 + FileUtil.preventFileChooserSymlinkTraversal(this, getInitialDirectory(key, getCurrentDirectory()));
35.104 + return super.showDialog(parent, approveButtonText);
35.105 + }
35.106 +
35.107 + protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
35.108 + if (SELECTED_FILE_CHANGED_PROPERTY.equals(propertyName)) {
35.109 + newValue = correctFile((File) newValue);
35.110 + }
35.111 + super.firePropertyChange(propertyName, oldValue, newValue);
35.112 + }
35.113 +
35.114 + public void approveSelection() {
35.115 + saveCurrentLocation();
35.116 + super.approveSelection();
35.117 + }
35.118 +
35.119 + public void cancelSelection() {
35.120 + super.cancelSelection();
35.121 + }
35.122 +
35.123 + private static File correctFile(File f) {
35.124 + while(f != null && ".".equals(f.getName())) { //NOI18N
35.125 + f = f.getParentFile();
35.126 + }
35.127 + return f;
35.128 + }
35.129 +
35.130 + private void saveCurrentLocation() {
35.131 + if (!isMultiSelectionEnabled() && isDirectorySelectionEnabled()) {
35.132 + // Try to save selected file (if it is an existing single directory
35.133 + if (saveLocation(getSelectedFile())) {
35.134 + return;
35.135 + }
35.136 + }
35.137 + saveLocation(getCurrentDirectory());
35.138 + }
35.139 +
35.140 + private boolean saveLocation(File f) {
35.141 + if (f != null && f.isDirectory()) {
35.142 + setLastChooserLocation(key, f);
35.143 + return true;
35.144 + } else {
35.145 + return false;
35.146 + }
35.147 + }
35.148 +
35.149 + public static File getLastChooserLocation(String key) {
35.150 + Map map = FoldersListSettings.getDefault().getLastUsedChooserLocations();
35.151 + if (map != null) {
35.152 + return (File) map.get(key);
35.153 + } else {
35.154 + return null;
35.155 + }
35.156 + }
35.157 +
35.158 + public static void setLastChooserLocation(String key, File folder) {
35.159 + FoldersListSettings foldersListSettings = FoldersListSettings.getDefault();
35.160 + Map map = foldersListSettings.getLastUsedChooserLocations();
35.161 + // we should get a different instance of the map to be sure
35.162 + // that modification of settings will be detected
35.163 + map = map == null ? new HashMap() : new HashMap(map);
35.164 + map.put(key, folder);
35.165 + foldersListSettings.setLastUsedChooserLocations(map);
35.166 + }
35.167 +
35.168 + public static FileChooser createDirectoryChooser(String key) {
35.169 + return createDirectoryChooser(key, null);
35.170 + }
35.171 +
35.172 + public static FileChooser createDirectoryChooser(String key, String initialPath) {
35.173 + FileChooser chooser = new FileChooser(key, initialPath);
35.174 + chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
35.175 + chooser.setMultiSelectionEnabled(false);
35.176 + chooser.setAcceptAllFileFilterUsed(false);
35.177 + return chooser;
35.178 + }
35.179 +
35.180 + public static FileChooser createFileChooser(String key, String dialogTitle, FileFilter fileFilter) {
35.181 + FileChooser chooser = new FileChooser(key);
35.182 + chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
35.183 + chooser.setMultiSelectionEnabled(true);
35.184 + chooser.setDialogTitle(dialogTitle);
35.185 + chooser.setFileFilter(fileFilter);
35.186 + chooser.setAcceptAllFileFilterUsed(false);
35.187 + return chooser;
35.188 + }
35.189 +}
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
36.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/FoldersListSettings.java Wed Feb 23 20:12:58 2011 -0500
36.3 @@ -0,0 +1,178 @@
36.4 +/*
36.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
36.6 + *
36.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
36.8 + *
36.9 + * The contents of this file are subject to the terms of either the GNU
36.10 + * General Public License Version 2 only ("GPL") or the Common
36.11 + * Development and Distribution License("CDDL") (collectively, the
36.12 + * "License"). You may not use this file except in compliance with the
36.13 + * License. You can obtain a copy of the License at
36.14 + * http://www.netbeans.org/cddl-gplv2.html
36.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
36.16 + * specific language governing permissions and limitations under the
36.17 + * License. When distributing the software, include this License Header
36.18 + * Notice in each file and include the License file at
36.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
36.20 + * particular file as subject to the "Classpath" exception as provided
36.21 + * by Sun in the GPL Version 2 section of the License file that
36.22 + * accompanied this code. If applicable, add the following below the
36.23 + * License Header, with the fields enclosed by brackets [] replaced by
36.24 + * your own identifying information:
36.25 + * "Portions Copyrighted [year] [name of copyright owner]"
36.26 + *
36.27 + * Contributor(s):
36.28 + *
36.29 + * The Original Software is NetBeans. The Initial Developer of the Original
36.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
36.31 + * Microsystems, Inc. All Rights Reserved.
36.32 + *
36.33 + * If you wish your version of this file to be governed by only the CDDL
36.34 + * or only the GPL Version 2, indicate your decision by adding
36.35 + * "[Contributor] elects to include this software in this distribution
36.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
36.37 + * single choice of license, a recipient has the option to distribute
36.38 + * your version of this file under either the CDDL, the GPL Version 2 or
36.39 + * to extend the choice of license to its licensees as provided above.
36.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
36.41 + * Version 2 license, then the option applies only if the new code is
36.42 + * made subject to such option by the copyright holder.
36.43 + */
36.44 +
36.45 +
36.46 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
36.47 +
36.48 +import java.io.File;
36.49 +import java.util.Map;
36.50 +import javax.swing.SwingUtilities;
36.51 +import org.openide.ErrorManager;
36.52 +
36.53 +import org.openide.options.SystemOption;
36.54 +import org.openide.util.NbBundle;
36.55 +
36.56 +/**
36.57 + * Misnamed storage of information application to the new webproject wizard.
36.58 + */
36.59 +public class FoldersListSettings extends SystemOption {
36.60 +
36.61 + static final long serialVersionUID = -4905094097265543014L;
36.62 +
36.63 + private static final String NEW_PROJECT_COUNT = "newProjectCount"; //NOI18N
36.64 +
36.65 + private static final String NEW_APP_COUNT = "newApplicationCount"; //NOI18N
36.66 +
36.67 + private static final String LAST_USED_CP_FOLDER = "lastUsedClassPathFolder"; //NOI18N
36.68 +
36.69 + private static final String LAST_USED_ARTIFACT_FOLDER = "lastUsedArtifactFolder"; //NOI18N
36.70 +
36.71 + private static final String SHOW_AGAIN_BROKEN_REF_ALERT = "showAgainBrokenRefAlert"; //NOI18N
36.72 +
36.73 + private static final String SHOW_AGAIN_BROKEN_SERVER_ALERT = "showAgainBrokenServerAlert"; //NOI18N
36.74 +
36.75 + private static final String LAST_USED_CHOOSER_LOCATIONS = "lastUsedChooserLocations"; //NOI18N
36.76 +
36.77 + private static final String AGREED_SET_JDK_14 = "agreeSetJdk14"; // NOI18N
36.78 +
36.79 + private static final String AGREED_SET_SOURCE_LEVEL_14 = "agreeSetSourceLevel14"; // NOI18N
36.80 +
36.81 + public static String defaultProjectDir = null;
36.82 +
36.83 +
36.84 + public static FoldersListSettings getDefault () {
36.85 + return (FoldersListSettings) SystemOption.findObject (FoldersListSettings.class, true);
36.86 + }
36.87 +
36.88 + public String displayName() {
36.89 + return NbBundle.getMessage(FoldersListSettings.class, "TXT_WebProjectFolderList");
36.90 + }
36.91 +
36.92 + public int getNewProjectCount () {
36.93 + Integer value = (Integer) getProperty (NEW_PROJECT_COUNT);
36.94 + return value == null ? 0 : value.intValue();
36.95 + }
36.96 +
36.97 + public void setNewProjectCount (int count) {
36.98 + this.putProperty(NEW_PROJECT_COUNT, new Integer(count),true);
36.99 + }
36.100 +
36.101 + public int getNewApplicationCount () {
36.102 + Integer value = (Integer) getProperty (NEW_APP_COUNT);
36.103 + return value == null ? 0 : value.intValue();
36.104 + }
36.105 +
36.106 + public void setNewApplicationCount (int count) {
36.107 + this.putProperty(NEW_APP_COUNT, new Integer(count),true);
36.108 + }
36.109 +
36.110 + public File getLastUsedClassPathFolder () {
36.111 + String lucpr = (String) this.getProperty (LAST_USED_CP_FOLDER);
36.112 + if (lucpr == null) {
36.113 + lucpr = System.getProperty("user.home"); //NOI18N
36.114 + }
36.115 + return new File (lucpr);
36.116 + }
36.117 +
36.118 + public void setLastUsedClassPathFolder (File folder) {
36.119 + assert folder != null : "ClassPath root can not be null";
36.120 + String path = folder.getAbsolutePath();
36.121 + this.putProperty(LAST_USED_CP_FOLDER, path, true);
36.122 + }
36.123 +
36.124 + public File getLastUsedArtifactFolder () {
36.125 + String folder = (String) this.getProperty (LAST_USED_ARTIFACT_FOLDER);
36.126 + if (folder == null) {
36.127 + folder = System.getProperty("user.home"); //NOI18N
36.128 + }
36.129 + return new File (folder);
36.130 + }
36.131 +
36.132 + public void setLastUsedArtifactFolder (File folder) {
36.133 + assert folder != null : "Folder can not be null";
36.134 + String path = folder.getAbsolutePath();
36.135 + this.putProperty (LAST_USED_ARTIFACT_FOLDER, path, true);
36.136 + }
36.137 +
36.138 + public boolean isShowAgainBrokenRefAlert() {
36.139 + Boolean b = (Boolean)getProperty(SHOW_AGAIN_BROKEN_REF_ALERT);
36.140 + return b == null ? true : b.booleanValue();
36.141 + }
36.142 +
36.143 + public void setShowAgainBrokenRefAlert(boolean again) {
36.144 + this.putProperty(SHOW_AGAIN_BROKEN_REF_ALERT, Boolean.valueOf(again), true);
36.145 + }
36.146 +
36.147 + public boolean isShowAgainBrokenServerAlert() {
36.148 + Boolean b = (Boolean)getProperty(SHOW_AGAIN_BROKEN_SERVER_ALERT);
36.149 + return b == null ? true : b.booleanValue();
36.150 + }
36.151 +
36.152 + public void setShowAgainBrokenServerAlert(boolean again) {
36.153 + this.putProperty(SHOW_AGAIN_BROKEN_SERVER_ALERT, Boolean.valueOf(again), true);
36.154 + }
36.155 +
36.156 + public Map getLastUsedChooserLocations() {
36.157 + return (Map) this.getProperty(LAST_USED_CHOOSER_LOCATIONS);
36.158 + }
36.159 +
36.160 + public void setLastUsedChooserLocations(Map map) {
36.161 + this.putProperty(LAST_USED_CHOOSER_LOCATIONS, map, true);
36.162 + }
36.163 +
36.164 + public boolean isAgreedSetJdk14() {
36.165 + Boolean b = (Boolean)getProperty(AGREED_SET_JDK_14);
36.166 + return b == null ? true : b.booleanValue();
36.167 + }
36.168 +
36.169 + public void setAgreedSetJdk14(boolean agreed) {
36.170 + this.putProperty(AGREED_SET_JDK_14, Boolean.valueOf(agreed), true);
36.171 + }
36.172 +
36.173 + public boolean isAgreedSetSourceLevel14() {
36.174 + Boolean b = (Boolean)getProperty(AGREED_SET_SOURCE_LEVEL_14);
36.175 + return b == null ? true : b.booleanValue();
36.176 + }
36.177 +
36.178 + public void setAgreedSetSourceLevel14(boolean agreed) {
36.179 + this.putProperty(AGREED_SET_SOURCE_LEVEL_14, Boolean.valueOf(agreed), true);
36.180 + }
36.181 +}
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
37.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PanelConfigureProject.java Wed Feb 23 20:12:58 2011 -0500
37.3 @@ -0,0 +1,137 @@
37.4 +/*
37.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
37.6 + *
37.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
37.8 + *
37.9 + * The contents of this file are subject to the terms of either the GNU
37.10 + * General Public License Version 2 only ("GPL") or the Common
37.11 + * Development and Distribution License("CDDL") (collectively, the
37.12 + * "License"). You may not use this file except in compliance with the
37.13 + * License. You can obtain a copy of the License at
37.14 + * http://www.netbeans.org/cddl-gplv2.html
37.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
37.16 + * specific language governing permissions and limitations under the
37.17 + * License. When distributing the software, include this License Header
37.18 + * Notice in each file and include the License file at
37.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
37.20 + * particular file as subject to the "Classpath" exception as provided
37.21 + * by Sun in the GPL Version 2 section of the License file that
37.22 + * accompanied this code. If applicable, add the following below the
37.23 + * License Header, with the fields enclosed by brackets [] replaced by
37.24 + * your own identifying information:
37.25 + * "Portions Copyrighted [year] [name of copyright owner]"
37.26 + *
37.27 + * Contributor(s):
37.28 + *
37.29 + * The Original Software is NetBeans. The Initial Developer of the Original
37.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
37.31 + * Microsystems, Inc. All Rights Reserved.
37.32 + *
37.33 + * If you wish your version of this file to be governed by only the CDDL
37.34 + * or only the GPL Version 2, indicate your decision by adding
37.35 + * "[Contributor] elects to include this software in this distribution
37.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
37.37 + * single choice of license, a recipient has the option to distribute
37.38 + * your version of this file under either the CDDL, the GPL Version 2 or
37.39 + * to extend the choice of license to its licensees as provided above.
37.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
37.41 + * Version 2 license, then the option applies only if the new code is
37.42 + * made subject to such option by the copyright holder.
37.43 + */
37.44 +
37.45 +
37.46 +
37.47 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
37.48 +
37.49 +import java.awt.Component;
37.50 +import java.util.HashSet;
37.51 +import java.util.Iterator;
37.52 +import java.util.Set;
37.53 +
37.54 +import javax.swing.JComponent;
37.55 +import javax.swing.event.ChangeEvent;
37.56 +import javax.swing.event.ChangeListener;
37.57 +
37.58 +import org.openide.WizardDescriptor;
37.59 +import org.openide.WizardValidationException;
37.60 +import org.openide.util.HelpCtx;
37.61 +
37.62 +/**
37.63 + * Panel just asking for basic info.
37.64 + * @author Jesse Glick
37.65 + */
37.66 +final class PanelConfigureProject implements WizardDescriptor.Panel, WizardDescriptor.FinishablePanel,
37.67 + WizardDescriptor.ValidatingPanel {
37.68 +
37.69 + protected WizardDescriptor wizardDescriptor;
37.70 + private PanelConfigureProjectVisual component;
37.71 +
37.72 + /** Create the wizard panel descriptor. */
37.73 + public PanelConfigureProject(WizardDescriptor inWizardDescriptor) {
37.74 + wizardDescriptor = inWizardDescriptor;
37.75 + }
37.76 +
37.77 + public boolean isFinishPanel() {
37.78 + return false;
37.79 + }
37.80 +
37.81 + public Component getComponent() {
37.82 + if (component == null) {
37.83 + component = new PanelConfigureProjectVisual(this);
37.84 + }
37.85 + return component;
37.86 + }
37.87 +
37.88 + public HelpCtx getHelp() {
37.89 + return new HelpCtx(PanelConfigureProject.class);
37.90 + }
37.91 +
37.92 + public boolean isValid() {
37.93 + getComponent();
37.94 + return component.valid(wizardDescriptor);
37.95 + }
37.96 +
37.97 + private final Set/*<ChangeListener>*/ listeners = new HashSet(1);
37.98 + public final void addChangeListener(ChangeListener l) {
37.99 + synchronized (listeners) {
37.100 + listeners.add(l);
37.101 + }
37.102 + }
37.103 + public final void removeChangeListener(ChangeListener l) {
37.104 + synchronized (listeners) {
37.105 + listeners.remove(l);
37.106 + }
37.107 + }
37.108 + protected final void fireChangeEvent() {
37.109 + Iterator it;
37.110 + synchronized (listeners) {
37.111 + it = new HashSet(listeners).iterator();
37.112 + }
37.113 + ChangeEvent ev = new ChangeEvent(this);
37.114 + while (it.hasNext()) {
37.115 + ((ChangeListener)it.next()).stateChanged(ev);
37.116 + }
37.117 + }
37.118 +
37.119 + public void readSettings(Object settings) {
37.120 + wizardDescriptor = (WizardDescriptor) settings;
37.121 + component.read (wizardDescriptor);
37.122 +
37.123 + // XXX hack, TemplateWizard in final setTemplateImpl() forces new wizard's title
37.124 + // this name is used in NewProjectWizard to modify the title
37.125 + Object substitute = ((JComponent) component).getClientProperty("NewProjectWizard_Title"); // NOI18N
37.126 + if (substitute != null)
37.127 + wizardDescriptor.putProperty("NewProjectWizard_Title", substitute); // NOI18N
37.128 + }
37.129 +
37.130 + public void storeSettings(Object settings) {
37.131 + WizardDescriptor d = (WizardDescriptor) settings;
37.132 + component.store(d);
37.133 + ((WizardDescriptor) d).putProperty("NewProjectWizard_Title", null); // NOI18N
37.134 + }
37.135 +
37.136 + public void validate() throws WizardValidationException {
37.137 + getComponent();
37.138 + component.valid(wizardDescriptor);
37.139 + }
37.140 +}
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
38.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PanelConfigureProjectVisual.form Wed Feb 23 20:12:58 2011 -0500
38.3 @@ -0,0 +1,45 @@
38.4 +<?xml version="1.0" encoding="UTF-8" ?>
38.5 +
38.6 +<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
38.7 + <Properties>
38.8 + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
38.9 + <Dimension value="[500, 340]"/>
38.10 + </Property>
38.11 + <Property name="requestFocusEnabled" type="boolean" value="false"/>
38.12 + </Properties>
38.13 + <AuxValues>
38.14 + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
38.15 + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
38.16 + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
38.17 + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
38.18 + </AuxValues>
38.19 +
38.20 + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
38.21 + <SubComponents>
38.22 + <Container class="javax.swing.JPanel" name="locationContainer">
38.23 + <Constraints>
38.24 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
38.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"/>
38.26 + </Constraint>
38.27 + </Constraints>
38.28 +
38.29 + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
38.30 + </Container>
38.31 + <Component class="javax.swing.JSeparator" name="jSeparator1">
38.32 + <Constraints>
38.33 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
38.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"/>
38.35 + </Constraint>
38.36 + </Constraints>
38.37 + </Component>
38.38 + <Container class="javax.swing.JPanel" name="optionsContainer">
38.39 + <Constraints>
38.40 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
38.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"/>
38.42 + </Constraint>
38.43 + </Constraints>
38.44 +
38.45 + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
38.46 + </Container>
38.47 + </SubComponents>
38.48 +</Form>
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
39.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PanelConfigureProjectVisual.java Wed Feb 23 20:12:58 2011 -0500
39.3 @@ -0,0 +1,158 @@
39.4 +/*
39.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
39.6 + *
39.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
39.8 + *
39.9 + * The contents of this file are subject to the terms of either the GNU
39.10 + * General Public License Version 2 only ("GPL") or the Common
39.11 + * Development and Distribution License("CDDL") (collectively, the
39.12 + * "License"). You may not use this file except in compliance with the
39.13 + * License. You can obtain a copy of the License at
39.14 + * http://www.netbeans.org/cddl-gplv2.html
39.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
39.16 + * specific language governing permissions and limitations under the
39.17 + * License. When distributing the software, include this License Header
39.18 + * Notice in each file and include the License file at
39.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
39.20 + * particular file as subject to the "Classpath" exception as provided
39.21 + * by Sun in the GPL Version 2 section of the License file that
39.22 + * accompanied this code. If applicable, add the following below the
39.23 + * License Header, with the fields enclosed by brackets [] replaced by
39.24 + * your own identifying information:
39.25 + * "Portions Copyrighted [year] [name of copyright owner]"
39.26 + *
39.27 + * Contributor(s):
39.28 + *
39.29 + * The Original Software is NetBeans. The Initial Developer of the Original
39.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
39.31 + * Microsystems, Inc. All Rights Reserved.
39.32 + *
39.33 + * If you wish your version of this file to be governed by only the CDDL
39.34 + * or only the GPL Version 2, indicate your decision by adding
39.35 + * "[Contributor] elects to include this software in this distribution
39.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
39.37 + * single choice of license, a recipient has the option to distribute
39.38 + * your version of this file under either the CDDL, the GPL Version 2 or
39.39 + * to extend the choice of license to its licensees as provided above.
39.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
39.41 + * Version 2 license, then the option applies only if the new code is
39.42 + * made subject to such option by the copyright holder.
39.43 + */
39.44 +
39.45 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
39.46 +
39.47 +import org.netbeans.modules.visualweb.project.jsf.api.JsfProjectConstants;
39.48 +
39.49 +import javax.swing.JPanel;
39.50 +
39.51 +import org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment;
39.52 +import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
39.53 +
39.54 +import org.openide.WizardDescriptor;
39.55 +import org.openide.WizardValidationException;
39.56 +import org.openide.util.HelpCtx;
39.57 +import org.openide.util.NbBundle;
39.58 +
39.59 +public class PanelConfigureProjectVisual extends JPanel implements HelpCtx.Provider {
39.60 +
39.61 + private PanelConfigureProject panel;
39.62 +
39.63 + private PanelProjectLocationVisual projectLocationPanel;
39.64 +
39.65 + /** Creates new form PanelInitProject */
39.66 + public PanelConfigureProjectVisual(PanelConfigureProject panel) {
39.67 + this.panel = panel;
39.68 + initComponents();
39.69 + this.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PanelConfigureProjectVisual.class, "ACS_NWP1_NamePanel_A11YDesc")); // NOI18N
39.70 +
39.71 + projectLocationPanel = new PanelProjectLocationVisual(panel);
39.72 + locationContainer.add(projectLocationPanel, java.awt.BorderLayout.NORTH);
39.73 +
39.74 + // Provide a name in the title bar.
39.75 + setName(NbBundle.getMessage(PanelConfigureProjectVisual.class, "LBL_NWP1_ProjectTitleName")); //NOI18N
39.76 + putClientProperty("NewProjectWizard_Title", NbBundle.getMessage(PanelConfigureProjectVisual.class, "TXT_NewWebApp")); //NOI18N
39.77 + }
39.78 +
39.79 + boolean valid(WizardDescriptor wizardDescriptor) {
39.80 + return projectLocationPanel.valid(wizardDescriptor);
39.81 + }
39.82 +
39.83 + void read(WizardDescriptor d) {
39.84 + projectLocationPanel.read(d);
39.85 + }
39.86 +
39.87 + void store(WizardDescriptor d) {
39.88 + projectLocationPanel.store(d);
39.89 +
39.90 + // Mostly hard coded for now!
39.91 + d.putProperty(WizardProperties.SET_AS_MAIN, Boolean.TRUE);
39.92 + d.putProperty(WizardProperties.SERVER_INSTANCE_ID,
39.93 + Deployment.getDefault().getDefaultServerInstanceID());
39.94 + d.putProperty(WizardProperties.SOURCE_STRUCTURE,
39.95 + JsfProjectConstants.SRC_STRUCT_JAKARTA);
39.96 + d.putProperty(WizardProperties.J2EE_LEVEL,
39.97 + J2eeModule.J2EE_14);
39.98 + d.putProperty(WizardProperties.CONTEXT_PATH,
39.99 + "/" + projectLocationPanel.projectNameTextField. // NOI18N
39.100 + getText().trim().replace(' ', '_')); // NOI18N
39.101 + d.putProperty(WizardProperties.EAR_APPLICATION, null);
39.102 + d.putProperty(WizardProperties.SOURCE_LEVEL, "1.4"); // NOI18N
39.103 +
39.104 + }
39.105 +
39.106 + /** This method is called from within the constructor to
39.107 + * initialize the form.
39.108 + * WARNING: Do NOT modify this code. The content of this method is
39.109 + * always regenerated by the Form Editor.
39.110 + */
39.111 + private void initComponents() {//GEN-BEGIN:initComponents
39.112 + java.awt.GridBagConstraints gridBagConstraints;
39.113 +
39.114 + locationContainer = new javax.swing.JPanel();
39.115 + jSeparator1 = new javax.swing.JSeparator();
39.116 + optionsContainer = new javax.swing.JPanel();
39.117 +
39.118 + setLayout(new java.awt.GridBagLayout());
39.119 +
39.120 + setPreferredSize(new java.awt.Dimension(500, 340));
39.121 + setRequestFocusEnabled(false);
39.122 + locationContainer.setLayout(new java.awt.BorderLayout());
39.123 +
39.124 + gridBagConstraints = new java.awt.GridBagConstraints();
39.125 + gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
39.126 + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
39.127 + gridBagConstraints.weightx = 1.0;
39.128 + add(locationContainer, gridBagConstraints);
39.129 +
39.130 + gridBagConstraints = new java.awt.GridBagConstraints();
39.131 + gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
39.132 + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
39.133 + gridBagConstraints.weightx = 1.0;
39.134 + gridBagConstraints.insets = new java.awt.Insets(12, 0, 12, 0);
39.135 + add(jSeparator1, gridBagConstraints);
39.136 +
39.137 + optionsContainer.setLayout(new java.awt.BorderLayout());
39.138 +
39.139 + gridBagConstraints = new java.awt.GridBagConstraints();
39.140 + gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
39.141 + gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
39.142 + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
39.143 + gridBagConstraints.weightx = 1.0;
39.144 + gridBagConstraints.weighty = 1.0;
39.145 + add(optionsContainer, gridBagConstraints);
39.146 +
39.147 + }//GEN-END:initComponents
39.148 +
39.149 + // Variables declaration - do not modify//GEN-BEGIN:variables
39.150 + private javax.swing.JSeparator jSeparator1;
39.151 + private javax.swing.JPanel locationContainer;
39.152 + private javax.swing.JPanel optionsContainer;
39.153 + // End of variables declaration//GEN-END:variables
39.154 +
39.155 + /** Help context where to find more about the paste type action.
39.156 + * @return the help context for this action
39.157 + */
39.158 + public HelpCtx getHelpCtx() {
39.159 + return new HelpCtx(PanelConfigureProjectVisual.class);
39.160 + }
39.161 +}
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
40.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PanelProjectLocationVisual.form Wed Feb 23 20:12:58 2011 -0500
40.3 @@ -0,0 +1,161 @@
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="projectNameLabel">
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_NWP1_ProjectName_LabelMnemonic" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
40.20 + </Property>
40.21 + <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
40.22 + <ComponentRef name="projectNameTextField"/>
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_NWP1_ProjectName_Label" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
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="LBL_NWP1_ProjectName_Label" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
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_NWP1_ProjectName_A11YDesc" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
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="0" insetsLeft="0" insetsBottom="12" 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="projectNameTextField">
40.43 + <AccessibilityProperties>
40.44 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
40.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, "{key}")"/>
40.46 + </Property>
40.47 + </AccessibilityProperties>
40.48 + <AuxValues>
40.49 + <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="4"/>
40.50 + </AuxValues>
40.51 + <Constraints>
40.52 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
40.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"/>
40.54 + </Constraint>
40.55 + </Constraints>
40.56 + </Component>
40.57 + <Component class="javax.swing.JLabel" name="projectLocationLabel">
40.58 + <Properties>
40.59 + <Property name="displayedMnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
40.60 + <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_ProjectLocation_LabelMnemonic" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
40.61 + </Property>
40.62 + <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
40.63 + <ComponentRef name="projectLocationTextField"/>
40.64 + </Property>
40.65 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
40.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, "{key}")"/>
40.67 + </Property>
40.68 + </Properties>
40.69 + <AccessibilityProperties>
40.70 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
40.71 + <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_ProjectLocation_Label" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
40.72 + </Property>
40.73 + <Property name="AccessibleContext.accessibleDescription" 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_NPW1_ProjectLocation_A11YDesc" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
40.75 + </Property>
40.76 + </AccessibilityProperties>
40.77 + <Constraints>
40.78 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
40.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"/>
40.80 + </Constraint>
40.81 + </Constraints>
40.82 + </Component>
40.83 + <Component class="javax.swing.JTextField" name="projectLocationTextField">
40.84 + <AccessibilityProperties>
40.85 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
40.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, "{key}")"/>
40.87 + </Property>
40.88 + </AccessibilityProperties>
40.89 + <Constraints>
40.90 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
40.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"/>
40.92 + </Constraint>
40.93 + </Constraints>
40.94 + </Component>
40.95 + <Component class="javax.swing.JButton" name="Button">
40.96 + <Properties>
40.97 + <Property name="mnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
40.98 + <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_BrowseLocation_ButtonMnemonic" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
40.99 + </Property>
40.100 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
40.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, "{key}")"/>
40.102 + </Property>
40.103 + <Property name="actionCommand" type="java.lang.String" value="BROWSE"/>
40.104 + </Properties>
40.105 + <AccessibilityProperties>
40.106 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
40.107 + <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_BrowseLocation_Button" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
40.108 + </Property>
40.109 + <Property name="AccessibleContext.accessibleDescription" 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="ACS_LBL_NWP1_BrowseLocation_A11YDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
40.111 + </Property>
40.112 + </AccessibilityProperties>
40.113 + <Events>
40.114 + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseLocationAction"/>
40.115 + </Events>
40.116 + <Constraints>
40.117 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
40.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"/>
40.119 + </Constraint>
40.120 + </Constraints>
40.121 + </Component>
40.122 + <Component class="javax.swing.JLabel" name="createdFolderLabel">
40.123 + <Properties>
40.124 + <Property name="displayedMnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
40.125 + <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_CreatedProjectFolder_LablelMnemonic" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
40.126 + </Property>
40.127 + <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
40.128 + <ComponentRef name="createdFolderTextField"/>
40.129 + </Property>
40.130 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
40.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, "{key}")"/>
40.132 + </Property>
40.133 + </Properties>
40.134 + <AccessibilityProperties>
40.135 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
40.136 + <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_NWP1_CreatedProjectFolder_Lablel" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
40.137 + </Property>
40.138 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
40.139 + <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="ACS_LBL_NWP1_CreatedProjectFolder_A11YDesc" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
40.140 + </Property>
40.141 + </AccessibilityProperties>
40.142 + <Constraints>
40.143 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
40.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"/>
40.145 + </Constraint>
40.146 + </Constraints>
40.147 + </Component>
40.148 + <Component class="javax.swing.JTextField" name="createdFolderTextField">
40.149 + <Properties>
40.150 + <Property name="editable" type="boolean" value="false"/>
40.151 + </Properties>
40.152 + <AccessibilityProperties>
40.153 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
40.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, "{key}")"/>
40.155 + </Property>
40.156 + </AccessibilityProperties>
40.157 + <Constraints>
40.158 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
40.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"/>
40.160 + </Constraint>
40.161 + </Constraints>
40.162 + </Component>
40.163 + </SubComponents>
40.164 +</Form>
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
41.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PanelProjectLocationVisual.java Wed Feb 23 20:12:58 2011 -0500
41.3 @@ -0,0 +1,363 @@
41.4 +/*
41.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
41.6 + *
41.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
41.8 + *
41.9 + * The contents of this file are subject to the terms of either the GNU
41.10 + * General Public License Version 2 only ("GPL") or the Common
41.11 + * Development and Distribution License("CDDL") (collectively, the
41.12 + * "License"). You may not use this file except in compliance with the
41.13 + * License. You can obtain a copy of the License at
41.14 + * http://www.netbeans.org/cddl-gplv2.html
41.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
41.16 + * specific language governing permissions and limitations under the
41.17 + * License. When distributing the software, include this License Header
41.18 + * Notice in each file and include the License file at
41.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
41.20 + * particular file as subject to the "Classpath" exception as provided
41.21 + * by Sun in the GPL Version 2 section of the License file that
41.22 + * accompanied this code. If applicable, add the following below the
41.23 + * License Header, with the fields enclosed by brackets [] replaced by
41.24 + * your own identifying information:
41.25 + * "Portions Copyrighted [year] [name of copyright owner]"
41.26 + *
41.27 + * Contributor(s):
41.28 + *
41.29 + * The Original Software is NetBeans. The Initial Developer of the Original
41.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
41.31 + * Microsystems, Inc. All Rights Reserved.
41.32 + *
41.33 + * If you wish your version of this file to be governed by only the CDDL
41.34 + * or only the GPL Version 2, indicate your decision by adding
41.35 + * "[Contributor] elects to include this software in this distribution
41.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
41.37 + * single choice of license, a recipient has the option to distribute
41.38 + * your version of this file under either the CDDL, the GPL Version 2 or
41.39 + * to extend the choice of license to its licensees as provided above.
41.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
41.41 + * Version 2 license, then the option applies only if the new code is
41.42 + * made subject to such option by the copyright holder.
41.43 + */
41.44 +
41.45 +
41.46 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
41.47 +
41.48 +
41.49 +import java.io.File;
41.50 +import java.io.IOException;
41.51 +import java.text.MessageFormat;
41.52 +
41.53 +import javax.swing.JFileChooser;
41.54 +import javax.swing.event.DocumentEvent;
41.55 +import javax.swing.event.DocumentListener;
41.56 +import javax.swing.text.Document;
41.57 +
41.58 +import org.netbeans.spi.project.ui.support.ProjectChooser;
41.59 +
41.60 +import org.openide.WizardDescriptor;
41.61 +import org.openide.filesystems.FileUtil;
41.62 +import org.openide.util.NbBundle;
41.63 +
41.64 +
41.65 +public class PanelProjectLocationVisual extends SettingsPanel implements DocumentListener {
41.66 + public static final String PROP_PROJECT_NAME = "projectName"; //NOI18N
41.67 + private static final String PROJECT_NAME_FORMATER = getBundleResource("LBL_NPW1_DefaultProjectName"); //NOI18N
41.68 +
41.69 + private String generatedProjectName = "";
41.70 + private int generatedProjectNameIndex = 0;
41.71 +
41.72 + private PanelConfigureProject panel;
41.73 +
41.74 + /** Creates new form PanelProjectLocationVisual */
41.75 + public PanelProjectLocationVisual(PanelConfigureProject panel) {
41.76 + initComponents();
41.77 + this.panel = panel;
41.78 +
41.79 +
41.80 + // Register listener on the textFields to make the automatic updates
41.81 + projectNameTextField.getDocument().addDocumentListener(this);
41.82 + projectLocationTextField.getDocument().addDocumentListener(this);
41.83 + }
41.84 +
41.85 + /** This method is called from within the constructor to
41.86 + * initialize the form.
41.87 + * WARNING: Do NOT modify this code. The content of this method is
41.88 + * always regenerated by the Form Editor.
41.89 + */
41.90 + // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
41.91 + private void initComponents() {
41.92 + java.awt.GridBagConstraints gridBagConstraints;
41.93 +
41.94 + projectNameLabel = new javax.swing.JLabel();
41.95 + projectNameTextField = new javax.swing.JTextField();
41.96 + projectLocationLabel = new javax.swing.JLabel();
41.97 + projectLocationTextField = new javax.swing.JTextField();
41.98 + Button = new javax.swing.JButton();
41.99 + createdFolderLabel = new javax.swing.JLabel();
41.100 + createdFolderTextField = new javax.swing.JTextField();
41.101 +
41.102 + setLayout(new java.awt.GridBagLayout());
41.103 +
41.104 + projectNameLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_NWP1_ProjectName_LabelMnemonic").charAt(0));
41.105 + projectNameLabel.setLabelFor(projectNameTextField);
41.106 + projectNameLabel.setText(org.openide.util.NbBundle.getMessage(PanelProjectLocationVisual.class, "LBL_NWP1_ProjectName_Label"));
41.107 + gridBagConstraints = new java.awt.GridBagConstraints();
41.108 + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
41.109 + gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0);
41.110 + add(projectNameLabel, gridBagConstraints);
41.111 + projectNameLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_NWP1_ProjectName_Label"));
41.112 + projectNameLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("ACS_LBL_NWP1_ProjectName_A11YDesc"));
41.113 +
41.114 + gridBagConstraints = new java.awt.GridBagConstraints();
41.115 + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
41.116 + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
41.117 + gridBagConstraints.weightx = 1.0;
41.118 + gridBagConstraints.insets = new java.awt.Insets(0, 12, 12, 0);
41.119 + add(projectNameTextField, gridBagConstraints);
41.120 + projectNameTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PanelProjectLocationVisual.class, "ACS_LBL_NWP1_ProjectName_A11YDesc"));
41.121 +
41.122 + projectLocationLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_NWP1_ProjectLocation_LabelMnemonic").charAt(0));
41.123 + projectLocationLabel.setLabelFor(projectLocationTextField);
41.124 + projectLocationLabel.setText(org.openide.util.NbBundle.getMessage(PanelProjectLocationVisual.class, "LBL_NWP1_ProjectLocation_Label"));
41.125 + gridBagConstraints = new java.awt.GridBagConstraints();
41.126 + gridBagConstraints.gridy = 1;
41.127 + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
41.128 + gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
41.129 + add(projectLocationLabel, gridBagConstraints);
41.130 + projectLocationLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_NWP1_ProjectLocation_Label"));
41.131 + projectLocationLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("ACS_LBL_NPW1_ProjectLocation_A11YDesc"));
41.132 +
41.133 + gridBagConstraints = new java.awt.GridBagConstraints();
41.134 + gridBagConstraints.gridy = 1;
41.135 + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
41.136 + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
41.137 + gridBagConstraints.weightx = 1.0;
41.138 + gridBagConstraints.insets = new java.awt.Insets(0, 12, 5, 0);
41.139 + add(projectLocationTextField, gridBagConstraints);
41.140 + projectLocationTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PanelProjectLocationVisual.class, "ACS_LBL_NPW1_ProjectLocation_A11YDesc"));
41.141 +
41.142 + Button.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_NWP1_BrowseLocation_ButtonMnemonic").charAt(0));
41.143 + Button.setText(org.openide.util.NbBundle.getMessage(PanelProjectLocationVisual.class, "LBL_NWP1_BrowseLocation_Button"));
41.144 + Button.setActionCommand("BROWSE");
41.145 + Button.addActionListener(new java.awt.event.ActionListener() {
41.146 + public void actionPerformed(java.awt.event.ActionEvent evt) {
41.147 + browseLocationAction(evt);
41.148 + }
41.149 + });
41.150 +
41.151 + gridBagConstraints = new java.awt.GridBagConstraints();
41.152 + gridBagConstraints.gridy = 1;
41.153 + gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
41.154 + gridBagConstraints.insets = new java.awt.Insets(0, 6, 5, 0);
41.155 + add(Button, gridBagConstraints);
41.156 + Button.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_NWP1_BrowseLocation_Button"));
41.157 + Button.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PanelProjectLocationVisual.class, "ACS_LBL_NWP1_BrowseLocation_A11YDesc"));
41.158 +
41.159 + createdFolderLabel.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_NWP1_CreatedProjectFolder_LablelMnemonic").charAt(0));
41.160 + createdFolderLabel.setLabelFor(createdFolderTextField);
41.161 + createdFolderLabel.setText(org.openide.util.NbBundle.getMessage(PanelProjectLocationVisual.class, "LBL_NWP1_CreatedProjectFolder_Lablel"));
41.162 + gridBagConstraints = new java.awt.GridBagConstraints();
41.163 + gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
41.164 + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
41.165 + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
41.166 + add(createdFolderLabel, gridBagConstraints);
41.167 + createdFolderLabel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_NWP1_CreatedProjectFolder_Lablel"));
41.168 + createdFolderLabel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("ACS_LBL_NWP1_CreatedProjectFolder_A11YDesc"));
41.169 +
41.170 + createdFolderTextField.setEditable(false);
41.171 + gridBagConstraints = new java.awt.GridBagConstraints();
41.172 + gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
41.173 + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
41.174 + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
41.175 + gridBagConstraints.weightx = 1.0;
41.176 + gridBagConstraints.weighty = 1.0;
41.177 + gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
41.178 + add(createdFolderTextField, gridBagConstraints);
41.179 + createdFolderTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PanelProjectLocationVisual.class, "ACS_LBL_NWP1_CreatedProjectFolder_A11YDesc"));
41.180 +
41.181 + }
41.182 + // </editor-fold>//GEN-END:initComponents
41.183 +
41.184 + private static String getBundleResource(final String resourceName) {
41.185 + return NbBundle.getMessage(PanelProjectLocationVisual.class, resourceName);
41.186 + }
41.187 +
41.188 + private void browseLocationAction(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseLocationAction
41.189 + String command = evt.getActionCommand();
41.190 +
41.191 + if ("BROWSE".equals(command)) { //NOI18N
41.192 + JFileChooser chooser = FileChooser.createDirectoryChooser(
41.193 + "PanelProjectLocationVisual.browseLocationAction", projectLocationTextField.getText()); //NOI18N
41.194 + chooser.setDialogTitle(getBundleResource("LBL_NWP1_SelectProjectLocation")); //NOI18N
41.195 + if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
41.196 + File projectDir = chooser.getSelectedFile();
41.197 + projectLocationTextField.setText(projectDir.getAbsolutePath());
41.198 + }
41.199 + panel.fireChangeEvent();
41.200 + }
41.201 + }//GEN-LAST:event_browseLocationAction
41.202 +
41.203 + public void addNotify() {
41.204 + super.addNotify();
41.205 + //same problem as in 31086, initial focus on Cancel button
41.206 + projectNameTextField.requestFocus();
41.207 + }
41.208 +
41.209 + boolean valid(WizardDescriptor wizardDescriptor) {
41.210 + String projectName = projectNameTextField.getText();
41.211 + if ( projectName.length() == 0 ) {
41.212 + wizardDescriptor.putProperty( "WizardPanel_errorMessage", // NOI18N
41.213 + NbBundle.getMessage(PanelProjectLocationVisual.class,"MSG_IllegalProjectName"));
41.214 + return false; // Display name not specified
41.215 + }
41.216 + if ( !projectName.matches("[\\w.-]+") ) {
41.217 + String message = NbBundle.getMessage(PanelProjectLocationVisual.class,"MSG_InvalidProjectName");
41.218 + wizardDescriptor.putProperty("WizardPanel_errorMessage", message);
41.219 + return false;
41.220 + }
41.221 + File f = new File(projectLocationTextField.getText()).getAbsoluteFile();
41.222 + if (getCanonicalFile(f)==null) {
41.223 + String message = NbBundle.getMessage(PanelProjectLocationVisual.class,"MSG_IllegalProjectLocation");
41.224 + wizardDescriptor.putProperty("WizardPanel_errorMessage", message);
41.225 + return false;
41.226 + }
41.227 + final File destFolder = getCanonicalFile(new File( createdFolderTextField.getText() ).getAbsoluteFile());
41.228 + if (destFolder == null) {
41.229 + String message = NbBundle.getMessage(PanelProjectLocationVisual.class,"MSG_IllegalProjectName");
41.230 + wizardDescriptor.putProperty("WizardPanel_errorMessage", message);
41.231 + return false;
41.232 + }
41.233 +
41.234 + // Do not allow a project name that degenerates to a reference to the parent folder
41.235 + if (destFolder.equals(f)) {
41.236 + String message = NbBundle.getMessage(PanelProjectLocationVisual.class,"MSG_IllegalProjectName");
41.237 + wizardDescriptor.putProperty("WizardPanel_errorMessage", message);
41.238 + return false;
41.239 + }
41.240 +
41.241 + File projLoc = destFolder;
41.242 + while (projLoc != null && !projLoc.exists()) {
41.243 + projLoc = projLoc.getParentFile();
41.244 + }
41.245 + if (projLoc == null || !projLoc.canWrite()) {
41.246 + wizardDescriptor.putProperty( "WizardPanel_errorMessage", // NOI18N
41.247 + NbBundle.getMessage(PanelProjectLocationVisual.class,"MSG_ProjectFolderReadOnly"));
41.248 + return false;
41.249 + }
41.250 +
41.251 + if (FileUtil.toFileObject(projLoc) == null) {
41.252 + String message = NbBundle.getMessage(PanelProjectLocationVisual.class,"MSG_IllegalProjectLocation");
41.253 + wizardDescriptor.putProperty("WizardPanel_errorMessage", message);
41.254 + return false;
41.255 + }
41.256 +
41.257 + File[] kids = destFolder.listFiles();
41.258 + if ( destFolder.exists() && kids != null && kids.length > 0) {
41.259 + // Folder exists and is not empty
41.260 + wizardDescriptor.putProperty( "WizardPanel_errorMessage", // NOI18N
41.261 + NbBundle.getMessage(PanelProjectLocationVisual.class,"MSG_ProjectFolderExists"));
41.262 + return false;
41.263 + }
41.264 +
41.265 + wizardDescriptor.putProperty( "WizardPanel_errorMessage", "");
41.266 + return true;
41.267 + }
41.268 +
41.269 + public static File getCanonicalFile(File f) {
41.270 + File f1;
41.271 + try {
41.272 + f1 = f.getCanonicalFile();
41.273 + } catch (IOException e) {
41.274 + f1 = null;
41.275 + }
41.276 + return f1;
41.277 + }
41.278 +
41.279 + void store(WizardDescriptor d) {
41.280 + d.putProperty(WizardProperties.PROJECT_DIR, new File(createdFolderTextField.getText().trim()));
41.281 + d.putProperty(WizardProperties.NAME, projectNameTextField.getText().trim());
41.282 + final Integer nameIndex = projectNameTextField.getText().equals(generatedProjectName) ?
41.283 + new Integer(generatedProjectNameIndex) : null;
41.284 + d.putProperty(PortletProjectWizardIterator.PROP_NAME_INDEX, nameIndex);
41.285 + }
41.286 +
41.287 + void read(WizardDescriptor settings) {
41.288 + if (projectLocationTextField.getText().trim().length() == 0) {
41.289 + projectLocationTextField.setText(ProjectChooser.getProjectsFolder().getAbsolutePath());
41.290 + }
41.291 + }
41.292 +
41.293 + // Variables declaration - do not modify//GEN-BEGIN:variables
41.294 + private javax.swing.JButton Button;
41.295 + private javax.swing.JLabel createdFolderLabel;
41.296 + private javax.swing.JTextField createdFolderTextField;
41.297 + private javax.swing.JLabel projectLocationLabel;
41.298 + private javax.swing.JTextField projectLocationTextField;
41.299 + private javax.swing.JLabel projectNameLabel;
41.300 + protected javax.swing.JTextField projectNameTextField;
41.301 + // End of variables declaration//GEN-END:variables
41.302 +
41.303 + public static String getProjectName(int index) {
41.304 + return MessageFormat.format(PROJECT_NAME_FORMATER, new Object[]{String.valueOf(index)});
41.305 + }
41.306 +
41.307 + private static int getValidProjectNameIndex(int currentIndex, File projectLocation) {
41.308 + int index = currentIndex > 0 ? currentIndex : FoldersListSettings.getDefault().getNewProjectCount() + 1;
41.309 + if(projectLocation != null) {
41.310 + while (new File(projectLocation, getProjectName(index)).exists()) {
41.311 + index++;
41.312 + }
41.313 + }
41.314 + return index;
41.315 + }
41.316 + // Implementation of DocumentListener --------------------------------------
41.317 +
41.318 + public void changedUpdate( DocumentEvent e ) {
41.319 + updateTexts( e );
41.320 + if (this.projectNameTextField.getDocument() == e.getDocument()) {
41.321 + firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
41.322 + }
41.323 + }
41.324 +
41.325 + public void insertUpdate( DocumentEvent e ) {
41.326 + updateTexts( e );
41.327 + if (this.projectNameTextField.getDocument() == e.getDocument()) {
41.328 + firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
41.329 + }
41.330 + }
41.331 +
41.332 + public void removeUpdate( DocumentEvent e ) {
41.333 + updateTexts( e );
41.334 + if (this.projectNameTextField.getDocument() == e.getDocument()) {
41.335 + firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
41.336 + }
41.337 + }
41.338 +
41.339 + /** Handles changes in the Project name and project directory
41.340 + */
41.341 + private void updateTexts( DocumentEvent e ) {
41.342 + Document doc = e.getDocument();
41.343 + if (doc == projectNameTextField.getDocument() || doc == projectLocationTextField.getDocument()) {
41.344 + String projectName = projectNameTextField.getText();
41.345 +
41.346 + if (doc == projectLocationTextField.getDocument()) {
41.347 + if (projectName.equals(generatedProjectName)) {
41.348 + File f = new File(projectLocationTextField.getText().trim());
41.349 + generatedProjectNameIndex = getValidProjectNameIndex(generatedProjectNameIndex, f);
41.350 + } else {
41.351 + generatedProjectNameIndex = 0;
41.352 + }
41.353 + generatedProjectName = generatedProjectNameIndex > 0 ? getProjectName(generatedProjectNameIndex) : null;
41.354 + if(generatedProjectNameIndex > 0) {
41.355 + projectName = generatedProjectName;
41.356 + projectNameTextField.setText(generatedProjectName);
41.357 + projectNameTextField.selectAll();
41.358 + }
41.359 + }
41.360 +
41.361 + String projectFolder = projectLocationTextField.getText();
41.362 + createdFolderTextField.setText(projectFolder + File.separatorChar + projectName);
41.363 + }
41.364 + panel.fireChangeEvent(); // Notify that the panel changed
41.365 + }
41.366 +}
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
42.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PortletProjectDeployDescriptorVisual.form Wed Feb 23 20:12:58 2011 -0500
42.3 @@ -0,0 +1,222 @@
42.4 +<?xml version="1.0" encoding="UTF-8" ?>
42.5 +
42.6 +<Form version="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
42.7 + <AuxValues>
42.8 + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
42.9 + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
42.10 + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
42.11 + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
42.12 + </AuxValues>
42.13 +
42.14 + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
42.15 + <SubComponents>
42.16 + <Component class="javax.swing.JLabel" name="lblPortletName">
42.17 + <Properties>
42.18 + <Property name="displayedMnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
42.19 + <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_PPOV_PORTLETNAMEMnemonic" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
42.20 + </Property>
42.21 + <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
42.22 + <ComponentRef name="txtPortletName"/>
42.23 + </Property>
42.24 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.26 + </Property>
42.27 + </Properties>
42.28 + <AccessibilityProperties>
42.29 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.31 + </Property>
42.32 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.34 + </Property>
42.35 + </AccessibilityProperties>
42.36 + <Constraints>
42.37 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
42.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"/>
42.39 + </Constraint>
42.40 + </Constraints>
42.41 + </Component>
42.42 + <Component class="javax.swing.JTextField" name="txtPortletName">
42.43 + <Properties>
42.44 + <Property name="editable" type="boolean" value="false"/>
42.45 + </Properties>
42.46 + <AccessibilityProperties>
42.47 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.49 + </Property>
42.50 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.52 + </Property>
42.53 + </AccessibilityProperties>
42.54 + <Constraints>
42.55 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
42.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"/>
42.57 + </Constraint>
42.58 + </Constraints>
42.59 + </Component>
42.60 + <Component class="javax.swing.JLabel" name="lblPortletDescription">
42.61 + <Properties>
42.62 + <Property name="displayedMnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
42.63 + <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_PPOV_PORTLETDESCMnemonic" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
42.64 + </Property>
42.65 + <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
42.66 + <ComponentRef name="txtPortletDescription"/>
42.67 + </Property>
42.68 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.70 + </Property>
42.71 + </Properties>
42.72 + <AccessibilityProperties>
42.73 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.75 + </Property>
42.76 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.78 + </Property>
42.79 + </AccessibilityProperties>
42.80 + <Constraints>
42.81 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
42.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"/>
42.83 + </Constraint>
42.84 + </Constraints>
42.85 + </Component>
42.86 + <Component class="javax.swing.JTextField" name="txtPortletDescription">
42.87 + <AccessibilityProperties>
42.88 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.90 + </Property>
42.91 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.93 + </Property>
42.94 + </AccessibilityProperties>
42.95 + <Constraints>
42.96 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
42.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"/>
42.98 + </Constraint>
42.99 + </Constraints>
42.100 + </Component>
42.101 + <Component class="javax.swing.JLabel" name="lblPortletDisplayName">
42.102 + <Properties>
42.103 + <Property name="displayedMnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
42.104 + <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_PPOV_PORTLETDISPLAYNAMEMnemonic" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
42.105 + </Property>
42.106 + <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
42.107 + <ComponentRef name="txtPortletDisplayName"/>
42.108 + </Property>
42.109 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.111 + </Property>
42.112 + </Properties>
42.113 + <AccessibilityProperties>
42.114 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.116 + </Property>
42.117 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.119 + </Property>
42.120 + </AccessibilityProperties>
42.121 + <Constraints>
42.122 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
42.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"/>
42.124 + </Constraint>
42.125 + </Constraints>
42.126 + </Component>
42.127 + <Component class="javax.swing.JTextField" name="txtPortletDisplayName">
42.128 + <AccessibilityProperties>
42.129 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.131 + </Property>
42.132 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.134 + </Property>
42.135 + </AccessibilityProperties>
42.136 + <Constraints>
42.137 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
42.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"/>
42.139 + </Constraint>
42.140 + </Constraints>
42.141 + </Component>
42.142 + <Component class="javax.swing.JLabel" name="lblPortletDescription1">
42.143 + <Properties>
42.144 + <Property name="displayedMnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
42.145 + <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_PPOV_PORTLETTITLEMnemonic" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
42.146 + </Property>
42.147 + <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
42.148 + <ComponentRef name="txtPortletTitle"/>
42.149 + </Property>
42.150 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.152 + </Property>
42.153 + </Properties>
42.154 + <AccessibilityProperties>
42.155 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.157 + </Property>
42.158 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.160 + </Property>
42.161 + </AccessibilityProperties>
42.162 + <Constraints>
42.163 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
42.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"/>
42.165 + </Constraint>
42.166 + </Constraints>
42.167 + </Component>
42.168 + <Component class="javax.swing.JTextField" name="txtPortletTitle">
42.169 + <AccessibilityProperties>
42.170 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.172 + </Property>
42.173 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.175 + </Property>
42.176 + </AccessibilityProperties>
42.177 + <Constraints>
42.178 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
42.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"/>
42.180 + </Constraint>
42.181 + </Constraints>
42.182 + </Component>
42.183 + <Component class="javax.swing.JLabel" name="lblPortletDescription2">
42.184 + <Properties>
42.185 + <Property name="displayedMnemonic" type="int" editor="org.netbeans.modules.i18n.form.FormI18nMnemonicEditor">
42.186 + <ResourceString bundle="org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle.properties" key="LBL_PPOV_PORTLETSHORTTITLEMnemonic" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
42.187 + </Property>
42.188 + <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
42.189 + <ComponentRef name="txtPortletShortTitle"/>
42.190 + </Property>
42.191 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.193 + </Property>
42.194 + </Properties>
42.195 + <AccessibilityProperties>
42.196 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.198 + </Property>
42.199 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.201 + </Property>
42.202 + </AccessibilityProperties>
42.203 + <Constraints>
42.204 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
42.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"/>
42.206 + </Constraint>
42.207 + </Constraints>
42.208 + </Component>
42.209 + <Component class="javax.swing.JTextField" name="txtPortletShortTitle">
42.210 + <AccessibilityProperties>
42.211 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.213 + </Property>
42.214 + <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
42.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, "{key}")"/>
42.216 + </Property>
42.217 + </AccessibilityProperties>
42.218 + <Constraints>
42.219 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
42.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"/>
42.221 + </Constraint>
42.222 + </Constraints>
42.223 + </Component>
42.224 + </SubComponents>
42.225 +</Form>
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
43.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PortletProjectDeployDescriptorVisual.java Wed Feb 23 20:12:58 2011 -0500
43.3 @@ -0,0 +1,258 @@
43.4 +/*
43.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
43.6 + *
43.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
43.8 + *
43.9 + * The contents of this file are subject to the terms of either the GNU
43.10 + * General Public License Version 2 only ("GPL") or the Common
43.11 + * Development and Distribution License("CDDL") (collectively, the
43.12 + * "License"). You may not use this file except in compliance with the
43.13 + * License. You can obtain a copy of the License at
43.14 + * http://www.netbeans.org/cddl-gplv2.html
43.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
43.16 + * specific language governing permissions and limitations under the
43.17 + * License. When distributing the software, include this License Header
43.18 + * Notice in each file and include the License file at
43.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
43.20 + * particular file as subject to the "Classpath" exception as provided
43.21 + * by Sun in the GPL Version 2 section of the License file that
43.22 + * accompanied this code. If applicable, add the following below the
43.23 + * License Header, with the fields enclosed by brackets [] replaced by
43.24 + * your own identifying information:
43.25 + * "Portions Copyrighted [year] [name of copyright owner]"
43.26 + *
43.27 + * Contributor(s):
43.28 + *
43.29 + * The Original Software is NetBeans. The Initial Developer of the Original
43.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
43.31 + * Microsystems, Inc. All Rights Reserved.
43.32 + *
43.33 + * If you wish your version of this file to be governed by only the CDDL
43.34 + * or only the GPL Version 2, indicate your decision by adding
43.35 + * "[Contributor] elects to include this software in this distribution
43.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
43.37 + * single choice of license, a recipient has the option to distribute
43.38 + * your version of this file under either the CDDL, the GPL Version 2 or
43.39 + * to extend the choice of license to its licensees as provided above.
43.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
43.41 + * Version 2 license, then the option applies only if the new code is
43.42 + * made subject to such option by the copyright holder.
43.43 + */
43.44 +
43.45 +/*
43.46 + * PortletProjectDeployDescriptorVisual.java
43.47 + *
43.48 + * Created on April 27, 2005, 11:51 PM
43.49 + *
43.50 + * To change this template, choose Tools | Options and locate the template under
43.51 + * the Source Creation and Management node. Right-click the template and choose
43.52 + * Open. You can then make changes to the template in the Source Editor.
43.53 + */
43.54 +
43.55 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
43.56 +import org.openide.WizardDescriptor;
43.57 +import org.openide.util.NbBundle;
43.58 +
43.59 +
43.60 +/**
43.61 + * This class acts as one of the panels shown in the WizardIterator to create
43.62 + * a portlet project. This panel represents the portlet specific options that a
43.63 + * user can specify.
43.64 + *
43.65 + * @author David Botterill
43.66 + */
43.67 +public class PortletProjectDeployDescriptorVisual extends javax.swing.JPanel {
43.68 +
43.69 + private WizardDescriptor wizardDescriptor;
43.70 +
43.71 + /**
43.72 + * Creates new form PortletProjectOptionsVisual
43.73 + */
43.74 + public PortletProjectDeployDescriptorVisual(WizardDescriptor inWizardDescriptor) {
43.75 + wizardDescriptor = inWizardDescriptor;
43.76 + initComponents();
43.77 + /**
43.78 + * Set the inital portlet name based on the project name.
43.79 + */
43.80 + Object projectName = wizardDescriptor.getProperty(WizardProperties.NAME);
43.81 + if(null != projectName && projectName instanceof String) {
43.82 + this.txtPortletName.setText((String)projectName);
43.83 + }
43.84 +
43.85 +
43.86 + }
43.87 +
43.88 + /** This method is called from within the constructor to
43.89 + * initialize the form.
43.90 + * WARNING: Do NOT modify this code. The content of this method is
43.91 + * always regenerated by the Form Editor.
43.92 + */
43.93 + // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
43.94 + private void initComponents() {
43.95 + java.awt.GridBagConstraints gridBagConstraints;
43.96 +
43.97 + lblPortletName = new javax.swing.JLabel();
43.98 + txtPortletName = new javax.swing.JTextField();
43.99 + lblPortletDescription = new javax.swing.JLabel();
43.100 + txtPortletDescription = new javax.swing.JTextField();
43.101 + lblPortletDisplayName = new javax.swing.JLabel();
43.102 + txtPortletDisplayName = new javax.swing.JTextField();
43.103 + lblPortletDescription1 = new javax.swing.JLabel();
43.104 + txtPortletTitle = new javax.swing.JTextField();
43.105 + lblPortletDescription2 = new javax.swing.JLabel();
43.106 + txtPortletShortTitle = new javax.swing.JTextField();
43.107 +
43.108 + setLayout(new java.awt.GridBagLayout());
43.109 +
43.110 + lblPortletName.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_PPOV_PORTLETNAMEMnemonic").charAt(0));
43.111 + lblPortletName.setLabelFor(txtPortletName);
43.112 + lblPortletName.setText(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "LBL_PPOV_PORTLETNAME"));
43.113 + gridBagConstraints = new java.awt.GridBagConstraints();
43.114 + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
43.115 + gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
43.116 + add(lblPortletName, gridBagConstraints);
43.117 + lblPortletName.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_LBL_PPOV_PORTLETNAME_A11YName"));
43.118 + lblPortletName.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_LBL_PPOV_PORTLETNAME_A11YDesc"));
43.119 +
43.120 + txtPortletName.setEditable(false);
43.121 + gridBagConstraints = new java.awt.GridBagConstraints();
43.122 + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
43.123 + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
43.124 + gridBagConstraints.weightx = 1.0;
43.125 + gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 12);
43.126 + add(txtPortletName, gridBagConstraints);
43.127 + txtPortletName.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETNAME_A11YName"));
43.128 + txtPortletName.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETNAME_A11YDesc"));
43.129 +
43.130 + lblPortletDescription.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_PPOV_PORTLETDESCMnemonic").charAt(0));
43.131 + lblPortletDescription.setLabelFor(txtPortletDescription);
43.132 + lblPortletDescription.setText(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "LBL_PPOV_PORTLETDESC"));
43.133 + gridBagConstraints = new java.awt.GridBagConstraints();
43.134 + gridBagConstraints.gridx = 0;
43.135 + gridBagConstraints.gridy = 2;
43.136 + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
43.137 + gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
43.138 + add(lblPortletDescription, gridBagConstraints);
43.139 + lblPortletDescription.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_LBL_PPOV_PORTLETDESC_A11YName"));
43.140 + lblPortletDescription.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_LBL_PPOV_PORTLETDESC_A11YDesc"));
43.141 +
43.142 + gridBagConstraints = new java.awt.GridBagConstraints();
43.143 + gridBagConstraints.gridx = 1;
43.144 + gridBagConstraints.gridy = 2;
43.145 + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
43.146 + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
43.147 + gridBagConstraints.weightx = 1.0;
43.148 + gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 12);
43.149 + add(txtPortletDescription, gridBagConstraints);
43.150 + txtPortletDescription.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETDESC_A11YName"));
43.151 + txtPortletDescription.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETDESC_A11YDesc"));
43.152 +
43.153 + lblPortletDisplayName.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_PPOV_PORTLETDISPLAYNAMEMnemonic").charAt(0));
43.154 + lblPortletDisplayName.setLabelFor(txtPortletDisplayName);
43.155 + lblPortletDisplayName.setText(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "LBL_PPOV_PORTLETDISPLAYNAME"));
43.156 + gridBagConstraints = new java.awt.GridBagConstraints();
43.157 + gridBagConstraints.gridx = 0;
43.158 + gridBagConstraints.gridy = 1;
43.159 + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
43.160 + gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
43.161 + add(lblPortletDisplayName, gridBagConstraints);
43.162 + lblPortletDisplayName.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETDISPLAYNAME_A11YName"));
43.163 + lblPortletDisplayName.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETDISPLAYNAME_A11YDesc"));
43.164 +
43.165 + gridBagConstraints = new java.awt.GridBagConstraints();
43.166 + gridBagConstraints.gridx = 1;
43.167 + gridBagConstraints.gridy = 1;
43.168 + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
43.169 + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
43.170 + gridBagConstraints.weightx = 1.0;
43.171 + gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 12);
43.172 + add(txtPortletDisplayName, gridBagConstraints);
43.173 + txtPortletDisplayName.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETDISPLAYNAME_A11YName"));
43.174 + txtPortletDisplayName.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETDISPLAYNAME_A11YDesc"));
43.175 +
43.176 + lblPortletDescription1.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_PPOV_PORTLETTITLEMnemonic").charAt(0));
43.177 + lblPortletDescription1.setLabelFor(txtPortletTitle);
43.178 + lblPortletDescription1.setText(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "LBL_PPOV_PORTLETTITLE"));
43.179 + gridBagConstraints = new java.awt.GridBagConstraints();
43.180 + gridBagConstraints.gridx = 0;
43.181 + gridBagConstraints.gridy = 3;
43.182 + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
43.183 + gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
43.184 + add(lblPortletDescription1, gridBagConstraints);
43.185 + lblPortletDescription1.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_LBL_PPOV_PORTLETTITLE_A11YName"));
43.186 + lblPortletDescription1.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_LBL_PPOV_PORTLETTITLE_A11YDesc"));
43.187 +
43.188 + gridBagConstraints = new java.awt.GridBagConstraints();
43.189 + gridBagConstraints.gridx = 1;
43.190 + gridBagConstraints.gridy = 3;
43.191 + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
43.192 + gridBagConstraints.weightx = 1.0;
43.193 + gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 12);
43.194 + add(txtPortletTitle, gridBagConstraints);
43.195 + txtPortletTitle.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETTITLE_A11YName"));
43.196 + txtPortletTitle.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETTITLE_A11YDesc"));
43.197 +
43.198 + lblPortletDescription2.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Bundle").getString("LBL_PPOV_PORTLETSHORTTITLEMnemonic").charAt(0));
43.199 + lblPortletDescription2.setLabelFor(txtPortletShortTitle);
43.200 + lblPortletDescription2.setText(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "LBL_PPOV_PORTLETSHORTTITLE"));
43.201 + gridBagConstraints = new java.awt.GridBagConstraints();
43.202 + gridBagConstraints.gridx = 0;
43.203 + gridBagConstraints.gridy = 4;
43.204 + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
43.205 + gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
43.206 + add(lblPortletDescription2, gridBagConstraints);
43.207 + lblPortletDescription2.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_LBL_PPOV_PORTLETSHORTTITLE_A11YName"));
43.208 + lblPortletDescription2.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_LBL_PPOV_PORTLETSHORTTITLE_A11YDesc"));
43.209 +
43.210 + gridBagConstraints = new java.awt.GridBagConstraints();
43.211 + gridBagConstraints.gridx = 1;
43.212 + gridBagConstraints.gridy = 4;
43.213 + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
43.214 + gridBagConstraints.weightx = 1.0;
43.215 + gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 12);
43.216 + add(txtPortletShortTitle, gridBagConstraints);
43.217 + txtPortletShortTitle.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETSHORTTITLE_A11YName"));
43.218 + txtPortletShortTitle.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PortletProjectDeployDescriptorVisual.class, "ACS_TXT_PPOV_PORTLETSHORTTITLE_A11YDesc"));
43.219 +
43.220 + }
43.221 + // </editor-fold>//GEN-END:initComponents
43.222 +
43.223 +
43.224 + // Variables declaration - do not modify//GEN-BEGIN:variables
43.225 + private javax.swing.JLabel lblPortletDescription;
43.226 + private javax.swing.JLabel lblPortletDescription1;
43.227 + private javax.swing.JLabel lblPortletDescription2;
43.228 + private javax.swing.JLabel lblPortletDisplayName;
43.229 + private javax.swing.JLabel lblPortletName;
43.230 + private javax.swing.JTextField txtPortletDescription;
43.231 + private javax.swing.JTextField txtPortletDisplayName;
43.232 + private javax.swing.JTextField txtPortletName;
43.233 + private javax.swing.JTextField txtPortletShortTitle;
43.234 + private javax.swing.JTextField txtPortletTitle;
43.235 + // End of variables declaration//GEN-END:variables
43.236 +
43.237 + boolean valid(WizardDescriptor wizardDescriptor) {
43.238 + return true;
43.239 + }
43.240 +
43.241 + void store(WizardDescriptor inDescriptor) {
43.242 + inDescriptor.putProperty(PortletWizardProperties.PORTLET_NAME,this.txtPortletName.getText());
43.243 + inDescriptor.putProperty(PortletWizardProperties.PORTLET_DISPLAYNAME,this.txtPortletDisplayName.getText());
43.244 + inDescriptor.putProperty(PortletWizardProperties.PORTLET_DESC,this.txtPortletDescription.getText());
43.245 + inDescriptor.putProperty(PortletWizardProperties.PORTLET_TITLE,this.txtPortletTitle.getText());
43.246 + inDescriptor.putProperty(PortletWizardProperties.PORTLET_SHORTTITLE,this.txtPortletShortTitle.getText());
43.247 + }
43.248 +
43.249 + void read(WizardDescriptor inDescriptor) {
43.250 + this.txtPortletName.setText((String)inDescriptor.getProperty(WizardProperties.NAME));
43.251 + this.txtPortletDisplayName.setText((String)inDescriptor.getProperty(WizardProperties.NAME) + " " +
43.252 + NbBundle.getMessage(PortletProjectWizardIterator.class, "TXT_PORTLET_DIPSLAYNAME_SUFFIX_DEFAULT"));
43.253 + this.txtPortletDescription.setText(NbBundle.getMessage(PortletProjectWizardIterator.class, "TXT_PORTLET_DESC_DEFAULT"));
43.254 + this.txtPortletTitle.setText((String)inDescriptor.getProperty(WizardProperties.NAME));
43.255 + this.txtPortletShortTitle.setText((String)inDescriptor.getProperty(WizardProperties.NAME));
43.256 +
43.257 +
43.258 + }
43.259 +
43.260 +
43.261 +}
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
44.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PortletProjectDeploymentDescriptor.java Wed Feb 23 20:12:58 2011 -0500
44.3 @@ -0,0 +1,140 @@
44.4 +/*
44.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
44.6 + *
44.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
44.8 + *
44.9 + * The contents of this file are subject to the terms of either the GNU
44.10 + * General Public License Version 2 only ("GPL") or the Common
44.11 + * Development and Distribution License("CDDL") (collectively, the
44.12 + * "License"). You may not use this file except in compliance with the
44.13 + * License. You can obtain a copy of the License at
44.14 + * http://www.netbeans.org/cddl-gplv2.html
44.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
44.16 + * specific language governing permissions and limitations under the
44.17 + * License. When distributing the software, include this License Header
44.18 + * Notice in each file and include the License file at
44.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
44.20 + * particular file as subject to the "Classpath" exception as provided
44.21 + * by Sun in the GPL Version 2 section of the License file that
44.22 + * accompanied this code. If applicable, add the following below the
44.23 + * License Header, with the fields enclosed by brackets [] replaced by
44.24 + * your own identifying information:
44.25 + * "Portions Copyrighted [year] [name of copyright owner]"
44.26 + *
44.27 + * Contributor(s):
44.28 + *
44.29 + * The Original Software is NetBeans. The Initial Developer of the Original
44.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
44.31 + * Microsystems, Inc. All Rights Reserved.
44.32 + *
44.33 + * If you wish your version of this file to be governed by only the CDDL
44.34 + * or only the GPL Version 2, indicate your decision by adding
44.35 + * "[Contributor] elects to include this software in this distribution
44.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
44.37 + * single choice of license, a recipient has the option to distribute
44.38 + * your version of this file under either the CDDL, the GPL Version 2 or
44.39 + * to extend the choice of license to its licensees as provided above.
44.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
44.41 + * Version 2 license, then the option applies only if the new code is
44.42 + * made subject to such option by the copyright holder.
44.43 + */
44.44 +
44.45 +/*
44.46 + * PortletProjectDeploymentDescriptor.java
44.47 + *
44.48 + * Created on April 27, 2005, 11:49 PM
44.49 + *
44.50 + * To change this template, choose Tools | Options and locate the template under
44.51 + * the Source Creation and Management node. Right-click the template and choose
44.52 + * Open. You can then make changes to the template in the Source Editor.
44.53 + */
44.54 +
44.55 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
44.56 +
44.57 +import java.awt.Component;
44.58 +import java.util.HashSet;
44.59 +import java.util.Iterator;
44.60 +import java.util.Set;
44.61 +import javax.swing.event.ChangeEvent;
44.62 +import javax.swing.event.ChangeListener;
44.63 +import org.openide.WizardDescriptor;
44.64 +import org.openide.WizardValidationException;
44.65 +import org.openide.util.HelpCtx;
44.66 +
44.67 +
44.68 +
44.69 +/**
44.70 + * This class acts as the WizardDescriptor.Panel wrapper for PortletProjectOptionsVisual
44.71 + * @author David Botterill
44.72 + * @see PortletProjectOptionsVisual
44.73 + */
44.74 +public class PortletProjectDeploymentDescriptor implements WizardDescriptor.Panel, WizardDescriptor.FinishablePanel,
44.75 + WizardDescriptor.ValidatingPanel{
44.76 +
44.77 + private WizardDescriptor wizardDescriptor;
44.78 + private PortletProjectDeployDescriptorVisual component;
44.79 +
44.80 +
44.81 + /** Creates a new instance of PortletProjectOptions */
44.82 + public PortletProjectDeploymentDescriptor(WizardDescriptor inWizardDescriptor) {
44.83 + wizardDescriptor = inWizardDescriptor;
44.84 + }
44.85 +
44.86 + public boolean isFinishPanel() {
44.87 + return true;
44.88 + }
44.89 +
44.90 + public Component getComponent() {
44.91 + if (component == null) {
44.92 + component = new PortletProjectDeployDescriptorVisual(wizardDescriptor);
44.93 + }
44.94 + return component;
44.95 + }
44.96 +
44.97 + public HelpCtx getHelp() {
44.98 + return new HelpCtx(PortletProjectDeploymentDescriptor.class);
44.99 + }
44.100 +
44.101 + public boolean isValid() {
44.102 + getComponent();
44.103 + return component.valid(wizardDescriptor);
44.104 + }
44.105 +
44.106 + private final Set/*<ChangeListener>*/ listeners = new HashSet(1);
44.107 + public final void addChangeListener(ChangeListener l) {
44.108 + synchronized (listeners) {
44.109 + listeners.add(l);
44.110 + }
44.111 + }
44.112 + public final void removeChangeListener(ChangeListener l) {
44.113 + synchronized (listeners) {
44.114 + listeners.remove(l);
44.115 + }
44.116 + }
44.117 + protected final void fireChangeEvent() {
44.118 + Iterator it;
44.119 + synchronized (listeners) {
44.120 + it = new HashSet(listeners).iterator();
44.121 + }
44.122 + ChangeEvent ev = new ChangeEvent(this);
44.123 + while (it.hasNext()) {
44.124 + ((ChangeListener)it.next()).stateChanged(ev);
44.125 + }
44.126 + }
44.127 +
44.128 + public void readSettings(Object settings) {
44.129 + wizardDescriptor = (WizardDescriptor) settings;
44.130 + component.read(wizardDescriptor);
44.131 +
44.132 + }
44.133 +
44.134 + public void storeSettings(Object settings) {
44.135 + WizardDescriptor d = (WizardDescriptor) settings;
44.136 + component.store(d);
44.137 + }
44.138 +
44.139 + public void validate() throws WizardValidationException {
44.140 +
44.141 + }
44.142 +
44.143 +}
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
45.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PortletProjectWizardIterator.java Wed Feb 23 20:12:58 2011 -0500
45.3 @@ -0,0 +1,408 @@
45.4 +/*
45.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
45.6 + *
45.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
45.8 + *
45.9 + * The contents of this file are subject to the terms of either the GNU
45.10 + * General Public License Version 2 only ("GPL") or the Common
45.11 + * Development and Distribution License("CDDL") (collectively, the
45.12 + * "License"). You may not use this file except in compliance with the
45.13 + * License. You can obtain a copy of the License at
45.14 + * http://www.netbeans.org/cddl-gplv2.html
45.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
45.16 + * specific language governing permissions and limitations under the
45.17 + * License. When distributing the software, include this License Header
45.18 + * Notice in each file and include the License file at
45.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
45.20 + * particular file as subject to the "Classpath" exception as provided
45.21 + * by Sun in the GPL Version 2 section of the License file that
45.22 + * accompanied this code. If applicable, add the following below the
45.23 + * License Header, with the fields enclosed by brackets [] replaced by
45.24 + * your own identifying information:
45.25 + * "Portions Copyrighted [year] [name of copyright owner]"
45.26 + *
45.27 + * Contributor(s):
45.28 + *
45.29 + * The Original Software is NetBeans. The Initial Developer of the Original
45.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
45.31 + * Microsystems, Inc. All Rights Reserved.
45.32 + *
45.33 + * If you wish your version of this file to be governed by only the CDDL
45.34 + * or only the GPL Version 2, indicate your decision by adding
45.35 + * "[Contributor] elects to include this software in this distribution
45.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
45.37 + * single choice of license, a recipient has the option to distribute
45.38 + * your version of this file under either the CDDL, the GPL Version 2 or
45.39 + * to extend the choice of license to its licensees as provided above.
45.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
45.41 + * Version 2 license, then the option applies only if the new code is
45.42 + * made subject to such option by the copyright holder.
45.43 + */
45.44 +
45.45 +
45.46 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
45.47 +
45.48 +import org.netbeans.modules.visualweb.project.jsf.api.JsfProjectConstants;
45.49 +import org.netbeans.modules.visualweb.project.jsf.api.ProjectTemplate;
45.50 +import org.netbeans.modules.visualweb.project.jsf.api.JsfProjectUtils;
45.51 +import com.sun.rave.api.portlet.dd.InitParamType;
45.52 +import com.sun.rave.api.portlet.dd.JsfPortletDDProperties;
45.53 +import com.sun.rave.api.portlet.dd.PortletApp;
45.54 +import com.sun.rave.api.portlet.dd.PortletInfoType;
45.55 +import com.sun.rave.api.portlet.dd.PortletType;
45.56 +import org.netbeans.modules.visualweb.project.jsfportlet.JsfPortletProjectTemplate;
45.57 +import java.awt.Component;
45.58 +import java.io.File;
45.59 +import java.io.IOException;
45.60 +import java.text.MessageFormat;
45.61 +import java.util.HashSet;
45.62 +import java.util.NoSuchElementException;
45.63 +import java.util.Set;
45.64 +import javax.swing.JComponent;
45.65 +import javax.swing.event.ChangeListener;
45.66 +import javax.xml.parsers.ParserConfigurationException;
45.67 +import org.netbeans.api.project.Project;
45.68 +import org.netbeans.api.project.ProjectManager;
45.69 +import org.netbeans.spi.project.support.ant.AntProjectHelper;
45.70 +import org.netbeans.spi.project.ui.support.ProjectChooser;
45.71 +import org.openide.ErrorManager;
45.72 +import org.openide.WizardDescriptor;
45.73 +import org.openide.filesystems.FileObject;
45.74 +import org.openide.filesystems.FileUtil;
45.75 +import org.openide.util.NbBundle;
45.76 +import org.xml.sax.SAXException;
45.77 +
45.78 +/**
45.79 + * This class is a modification of com.sun.rave.project.jsf.ui.wizards.NewJsfProjectWizardIterator.
45.80 + * The "initiate" method should be almost IDENTICAL to NewJsfProjectWizardIterator's.
45.81 + * @author David Botterill
45.82 + */
45.83 +//TODO refactor NewJsfProjectWizardIterator so it can be extended
45.84 +public class PortletProjectWizardIterator implements WizardDescriptor.InstantiatingIterator {
45.85 +
45.86 + static final String PROP_NAME_INDEX = "nameIndex"; //NOI18N
45.87 + static File defaultProjectFolder = null;
45.88 + private transient int index;
45.89 + private transient WizardDescriptor.Panel[] panels;
45.90 + private transient WizardDescriptor wiz;
45.91 + PanelConfigureProject panelConfigureProject;
45.92 + PortletProjectDeploymentDescriptor portletProjectDeploymentDescriptor;
45.93 +
45.94 +
45.95 + /** Creates a new instance of PortletProjectWizardIterator */
45.96 + public PortletProjectWizardIterator() {
45.97 + }
45.98 +
45.99 + protected WizardDescriptor.Panel[] createPanels(WizardDescriptor inWiz) {
45.100 + panelConfigureProject = new PanelConfigureProject(inWiz);
45.101 + portletProjectDeploymentDescriptor = new PortletProjectDeploymentDescriptor(inWiz);
45.102 +
45.103 + return new WizardDescriptor.Panel [] {panelConfigureProject,portletProjectDeploymentDescriptor};
45.104 + }
45.105 +
45.106 + protected String[] createSteps() {
45.107 + return new String[] {
45.108 + NbBundle.getMessage(PortletProjectWizardIterator.class, "LBL_Portlet_Step1"), //NOI18N
45.109 + NbBundle.getMessage(PortletProjectWizardIterator.class, "LBL_Portlet_Step2")
45.110 +
45.111 + };
45.112 + }
45.113 +
45.114 + public Set instantiate() throws IOException {
45.115 + Set resultSet = new HashSet();
45.116 + File dirF = (File) wiz.getProperty(WizardProperties.PROJECT_DIR);
45.117 + String name = (String) wiz.getProperty(WizardProperties.NAME);
45.118 + String servInstID = (String) wiz.getProperty(WizardProperties.SERVER_INSTANCE_ID);
45.119 + String sourceStructure = (String)wiz.getProperty(WizardProperties.SOURCE_STRUCTURE);
45.120 + String j2eeLevel = (String) wiz.getProperty(WizardProperties.J2EE_LEVEL);
45.121 + String contextPath = (String) wiz.getProperty(WizardProperties.CONTEXT_PATH);
45.122 + String platformName = (String)wiz.getProperty(WizardProperties.JAVA_PLATFORM);
45.123 + String sourceLevel = (String) wiz.getProperty(WizardProperties.SOURCE_LEVEL);
45.124 +
45.125 + // AntProjectHelper h = WebProjectGenerator.createProject(dirF, name, servInstID, sourceStructure, j2eeLevel, contextPath);
45.126 + // XXX Should move this to project/jsfproject
45.127 + // AntProjectHelper h = JsfProjectUtils.createWebProject(dirF, name, servInstID, sourceStructure, j2eeLevel, contextPath, platformName, sourceLevel, getTemplate());
45.128 + AntProjectHelper h = null;
45.129 + FileObject dir = FileUtil.toFileObject(dirF);
45.130 + Project project = ProjectManager.getDefault().findProject(dir);
45.131 + try {
45.132 + FileObject webRoot = project.getProjectDirectory().getFileObject("web");//NOI18N
45.133 + // <RAVE> substitute index.jsp with PortletPage1.jsp
45.134 + // FileObject indexJSPFo = getIndexJSPFFO(webRoot, "index"); //NOI18N
45.135 + // assert indexJSPFo != null : "webRoot: " + webRoot + ", defaultJSP: index";//NOI18N
45.136 + FileObject indexJSPFo = getIndexJSPFFO(webRoot, "PortletPage1"); //NOI18N
45.137 + JsfProjectUtils.putProjectProperty(project,
45.138 + JsfProjectConstants.PROJECT_SUPPORTS_PORTLETS, "true"); // NOI18N
45.139 + Object wizardPortletNameObj = wiz.getProperty(PortletWizardProperties.PORTLET_NAME);
45.140 + /**
45.141 + * Add name and context path to the project properties.
45.142 + */
45.143 + if(null != wizardPortletNameObj && wizardPortletNameObj instanceof String) {
45.144 + JsfProjectUtils.putProjectProperty(project,
45.145 + JsfProjectConstants.PORTLET_NAME,(String)wizardPortletNameObj); // NOI18N
45.146 + }
45.147 +
45.148 + if(null != contextPath) {
45.149 + JsfProjectUtils.putProjectProperty(project,
45.150 + JsfProjectConstants.PORTLET_CONTEXTPATH,contextPath); // NOI18N
45.151 + }
45.152 +
45.153 + assert indexJSPFo != null : "webRoot: " + webRoot + ", defaultJSP: PortletPage1";//NOI18N
45.154 + // </RAVE>
45.155 + // Returning FileObject of main class, will be called its preferred action
45.156 + resultSet.add(indexJSPFo);
45.157 + } catch (Exception e) {
45.158 + ErrorManager.getDefault().notify(e);
45.159 + }
45.160 +
45.161 + Integer index = (Integer) wiz.getProperty(PROP_NAME_INDEX);
45.162 + if(index != null) {
45.163 + FoldersListSettings.getDefault().setNewProjectCount(index.intValue());
45.164 + }
45.165 +
45.166 + setPortletDDValues(project,wiz);
45.167 +
45.168 +
45.169 + wiz.putProperty(WizardProperties.NAME, null); // reset project name
45.170 +
45.171 +// Project earProject = (Project) wiz.getProperty(WizardProperties.EAR_APPLICATION);
45.172 +// WebProject createdWebProject = (WebProject) ProjectManager.getDefault().findProject(dir);
45.173 +// if (earProject != null && createdWebProject != null) {
45.174 +// Ear ear = Ear.getEar(earProject.getProjectDirectory());
45.175 +// if (ear != null) {
45.176 +// ear.addWebModule(createdWebProject.getAPIWebModule());
45.177 +// }
45.178 +// }
45.179 +
45.180 + // save last project location
45.181 + dirF = (dirF != null) ? dirF.getParentFile() : null;
45.182 + if (dirF != null && dirF.exists()) {
45.183 + ProjectChooser.setProjectsFolder(dirF);
45.184 + }
45.185 +
45.186 + resultSet.add(dir);
45.187 +
45.188 + // Returning set of FileObject of project diretory.
45.189 + // Project will be open and set as main
45.190 + return resultSet;
45.191 + }
45.192 +
45.193 + private void setPortletDDValues(Project inProject,WizardDescriptor inWiz) {
45.194 + PortletApp portletApp = null;
45.195 +
45.196 + /**
45.197 + * First get the portlet.xml file from the project directory
45.198 + */
45.199 + FileObject webRootFO = inProject.getProjectDirectory().getFileObject("web/WEB-INF");//NOI18N
45.200 + if(null == webRootFO) {
45.201 + // TODO write some log message
45.202 + return;
45.203 + }
45.204 + FileObject portletXMLFO = webRootFO.getFileObject("portlet.xml"); //NOI18N
45.205 + File portletXMLFile = FileUtil.toFile(portletXMLFO);
45.206 +
45.207 + try {
45.208 + /**
45.209 + * Create the portlet application
45.210 + */
45.211 + portletApp = PortletApp.read(portletXMLFile);
45.212 +
45.213 + if(null!=portletApp) {
45.214 + /**
45.215 + * Now get the Portlets in the portlet application.
45.216 + * NOTE- we only expect there to be one portlet per project so
45.217 + * we will only deal with the first portlet.
45.218 + */
45.219 + PortletType [] portletType = portletApp.getPortlet();
45.220 + if(null != portletType) {
45.221 + /**
45.222 + * NAME
45.223 + *
45.224 + * Set the portlet Name
45.225 + */
45.226 +
45.227 + Object wizardPortletNameObj = inWiz.getProperty(PortletWizardProperties.PORTLET_NAME);
45.228 + if(null != wizardPortletNameObj && wizardPortletNameObj instanceof String) {
45.229 + portletType[0].setPortletName((String)wizardPortletNameObj);
45.230 + }
45.231 +
45.232 + /**
45.233 + * DISPLAYNAME
45.234 + *
45.235 + * Set the portlet display name. This is two parts. The DD
45.236 + * can have multiple locale specific display names each with a
45.237 + * display name and a locale.
45.238 + *
45.239 + * Note-IF and WHEN we support multiple locales to be input in Creator,
45.240 + * we'll need to change this code to handle all the locales.
45.241 + *
45.242 + * First we remove all the display names then add our own.
45.243 + */
45.244 + //TODO support multiple locales
45.245 +
45.246 + String [] displayNames = portletType[0].getDisplayName();
45.247 + for(int ii=0; null != displayNames && ii < displayNames.length;ii++) {
45.248 + portletType[0].removeDisplayName(displayNames[ii]);
45.249 + }
45.250 +
45.251 + Object wizardPortletDisplayNameObj = inWiz.getProperty(PortletWizardProperties.PORTLET_DISPLAYNAME);
45.252 + if(null != wizardPortletDisplayNameObj && wizardPortletDisplayNameObj instanceof String) {
45.253 + portletType[0].addDisplayName((String)wizardPortletDisplayNameObj);
45.254 + }
45.255 +
45.256 + /**
45.257 + * DESCRIPTION
45.258 + *
45.259 + * We need to do the same with descriptions as with the display name.
45.260 + */
45.261 + //TODO support multiple locales
45.262 + String [] descriptions = portletType[0].getDescription();
45.263 + for(int ii=0; null != descriptions && ii < descriptions.length;ii++) {
45.264 + portletType[0].removeDescription(descriptions[ii]);
45.265 + }
45.266 +
45.267 + Object wizardPortletDescObj = inWiz.getProperty(PortletWizardProperties.PORTLET_DESC);
45.268 + if(null != wizardPortletDescObj && wizardPortletDescObj instanceof String) {
45.269 + portletType[0].addDescription((String)wizardPortletDescObj);
45.270 + }
45.271 +
45.272 + /**
45.273 + * TITLE
45.274 + * SHORTTITLE
45.275 + *
45.276 + * remove the PortletInfo and add a new one.
45.277 + *
45.278 + */
45.279 +
45.280 + PortletInfoType portletInfoType = portletType[0].getPortletInfo();
45.281 + if(null != portletInfoType) {
45.282 + Object wizardPortletTitleObj = inWiz.getProperty(PortletWizardProperties.PORTLET_TITLE);
45.283 + if(null != wizardPortletTitleObj && wizardPortletTitleObj instanceof String) {
45.284 + portletInfoType.setTitle((String)wizardPortletTitleObj);
45.285 + }
45.286 + Object wizardPortletShortTitleObj = inWiz.getProperty(PortletWizardProperties.PORTLET_SHORTTITLE);
45.287 + if(null != wizardPortletShortTitleObj && wizardPortletShortTitleObj instanceof String) {
45.288 + portletInfoType.setShortTitle((String)wizardPortletShortTitleObj);
45.289 + }
45.290 +
45.291 + }
45.292 +
45.293 +
45.294 + /**
45.295 + * INITIAL_VIEW
45.296 + *
45.297 + * Set the initial view page for the JSF-Portlet bridge. We can have
45.298 + * multiple "init_param"s so remove all of them and then add ours.
45.299 + *
45.300 + */
45.301 + //TODO handle user init_params
45.302 + InitParamType [] initParams = portletType[0].getInitParam();
45.303 + for(int ii=0; null != initParams && ii < initParams.length;ii++) {
45.304 + portletType[0].removeInitParam(initParams[ii]);
45.305 + }
45.306 +
45.307 + InitParamType initialViewInitParam = new InitParamType(JsfPortletDDProperties.INIT_VIEW,"/PortletPage1.jsp"); //NOI18N
45.308 + //TODO There should be a better way to get the name of the default first page, "PortletPage1.jsp".
45.309 + portletType[0].addInitParam(initialViewInitParam);
45.310 +
45.311 +
45.312 +
45.313 +
45.314 + }
45.315 +
45.316 + portletApp.write(portletXMLFile);
45.317 +
45.318 +
45.319 + }
45.320 +
45.321 + } catch(IOException ioe) {
45.322 + ErrorManager.getDefault().notify(ioe);
45.323 + } catch(ParserConfigurationException pce) {
45.324 + ErrorManager.getDefault().notify(pce);
45.325 + } catch(SAXException se) {
45.326 + ErrorManager.getDefault().notify(se);
45.327 + }
45.328 + }
45.329 +
45.330 +
45.331 + public void initialize(WizardDescriptor wiz) {
45.332 + this.wiz = wiz;
45.333 + index = 0;
45.334 + panels = createPanels(wiz);
45.335 + // Make sure list of steps is accurate.
45.336 + String[] steps = createSteps();
45.337 + wiz.putProperty("WizardPanel_contentData", steps); // NOI18N
45.338 +
45.339 + for (int i = 0; i < panels.length; i++) {
45.340 + Component c = panels[i].getComponent();
45.341 + if (steps[i] == null) {
45.342 + // Default step name to component name of panel.
45.343 + // Mainly useful for getting the name of the target
45.344 + // chooser to appear in the list of steps.
45.345 + steps[i] = c.getName();
45.346 + }
45.347 + if (c instanceof JComponent) { // assume Swing components
45.348 + JComponent jc = (JComponent)c;
45.349 + // Step #.
45.350 + jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i)); // NOI18N
45.351 + // Step name (actually the whole list for reference).
45.352 + jc.putClientProperty("WizardPanel_contentData", steps); // NOI18N
45.353 + }
45.354 + }
45.355 + }
45.356 + public void uninitialize(WizardDescriptor wiz) {
45.357 + this.wiz.putProperty(WizardProperties.PROJECT_DIR,null);
45.358 + this.wiz.putProperty(WizardProperties.NAME,null);
45.359 + this.wiz = null;
45.360 + panels = null;
45.361 + }
45.362 +
45.363 + public String name() {
45.364 + return MessageFormat.format(NbBundle.getMessage(PortletProjectWizardIterator.class, "LBL_WizardStepsCount"), new String[] {(new Integer(index + 1)).toString(), (new Integer(panels.length)).toString()}); //NOI18N
45.365 + }
45.366 +
45.367 + public boolean hasNext() {
45.368 + return index < panels.length - 1;
45.369 + }
45.370 + public boolean hasPrevious() {
45.371 + return index > 0;
45.372 + }
45.373 + public void nextPanel() {
45.374 + if (!hasNext()) throw new NoSuchElementException();
45.375 + index++;
45.376 + panelConfigureProject.readSettings(wiz);
45.377 + portletProjectDeploymentDescriptor.readSettings(wiz);
45.378 +
45.379 + }
45.380 + public void previousPanel() {
45.381 + if (!hasPrevious()) throw new NoSuchElementException();
45.382 + index--;
45.383 + }
45.384 + public WizardDescriptor.Panel current() {
45.385 + return panels[index];
45.386 + }
45.387 +
45.388 + // If nothing unusual changes in the middle of the wizard, simply:
45.389 + public final void addChangeListener(ChangeListener l) {}
45.390 + public final void removeChangeListener(ChangeListener l) {}
45.391 +
45.392 + // helper methods, finds indexJSPF's FileObject
45.393 + private FileObject getIndexJSPFFO(FileObject webRoot, String indexJSP) {
45.394 + // replace '.' with '/'
45.395 + indexJSP = indexJSP.replace('.', '/'); // NOI18N
45.396 +
45.397 + // ignore unvalid mainClass ???
45.398 +
45.399 + return webRoot.getFileObject(indexJSP, "jsp"); // NOI18N
45.400 + }
45.401 +
45.402 + /**
45.403 + * Provides the project template to be used to instantiate the project contents
45.404 + * May be overridden by subclasses to produce project variants
45.405 + * @return The project template class that will perform the instantiation of project contents
45.406 + */
45.407 + protected ProjectTemplate getTemplate() {
45.408 + return new JsfPortletProjectTemplate();
45.409 + }
45.410 +
45.411 +}
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
46.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/PortletWizardProperties.java Wed Feb 23 20:12:58 2011 -0500
46.3 @@ -0,0 +1,58 @@
46.4 +/*
46.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
46.6 + *
46.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
46.8 + *
46.9 + * The contents of this file are subject to the terms of either the GNU
46.10 + * General Public License Version 2 only ("GPL") or the Common
46.11 + * Development and Distribution License("CDDL") (collectively, the
46.12 + * "License"). You may not use this file except in compliance with the
46.13 + * License. You can obtain a copy of the License at
46.14 + * http://www.netbeans.org/cddl-gplv2.html
46.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
46.16 + * specific language governing permissions and limitations under the
46.17 + * License. When distributing the software, include this License Header
46.18 + * Notice in each file and include the License file at
46.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
46.20 + * particular file as subject to the "Classpath" exception as provided
46.21 + * by Sun in the GPL Version 2 section of the License file that
46.22 + * accompanied this code. If applicable, add the following below the
46.23 + * License Header, with the fields enclosed by brackets [] replaced by
46.24 + * your own identifying information:
46.25 + * "Portions Copyrighted [year] [name of copyright owner]"
46.26 + *
46.27 + * Contributor(s):
46.28 + *
46.29 + * The Original Software is NetBeans. The Initial Developer of the Original
46.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
46.31 + * Microsystems, Inc. All Rights Reserved.
46.32 + *
46.33 + * If you wish your version of this file to be governed by only the CDDL
46.34 + * or only the GPL Version 2, indicate your decision by adding
46.35 + * "[Contributor] elects to include this software in this distribution
46.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
46.37 + * single choice of license, a recipient has the option to distribute
46.38 + * your version of this file under either the CDDL, the GPL Version 2 or
46.39 + * to extend the choice of license to its licensees as provided above.
46.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
46.41 + * Version 2 license, then the option applies only if the new code is
46.42 + * made subject to such option by the copyright holder.
46.43 + */
46.44 +
46.45 +
46.46 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
46.47 +
46.48 +/**
46.49 + * This class encapsulates the properties appropriate for the Portlet project wizard.
46.50 + * @author David Botterill
46.51 + */
46.52 +public class PortletWizardProperties {
46.53 +
46.54 + public static String PORTLET_NAME="portlet.name";
46.55 + public static String PORTLET_DISPLAYNAME="portlet.displayname";
46.56 + public static String PORTLET_DESC="portlet.description";
46.57 + public static String PORTLET_TITLE="portlet.title";
46.58 + public static String PORTLET_SHORTTITLE="portlet.shorttitle";
46.59 +
46.60 +
46.61 +}
47.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
47.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/SettingsPanel.java Wed Feb 23 20:12:58 2011 -0500
47.3 @@ -0,0 +1,57 @@
47.4 +/*
47.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
47.6 + *
47.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
47.8 + *
47.9 + * The contents of this file are subject to the terms of either the GNU
47.10 + * General Public License Version 2 only ("GPL") or the Common
47.11 + * Development and Distribution License("CDDL") (collectively, the
47.12 + * "License"). You may not use this file except in compliance with the
47.13 + * License. You can obtain a copy of the License at
47.14 + * http://www.netbeans.org/cddl-gplv2.html
47.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
47.16 + * specific language governing permissions and limitations under the
47.17 + * License. When distributing the software, include this License Header
47.18 + * Notice in each file and include the License file at
47.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
47.20 + * particular file as subject to the "Classpath" exception as provided
47.21 + * by Sun in the GPL Version 2 section of the License file that
47.22 + * accompanied this code. If applicable, add the following below the
47.23 + * License Header, with the fields enclosed by brackets [] replaced by
47.24 + * your own identifying information:
47.25 + * "Portions Copyrighted [year] [name of copyright owner]"
47.26 + *
47.27 + * Contributor(s):
47.28 + *
47.29 + * The Original Software is NetBeans. The Initial Developer of the Original
47.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
47.31 + * Microsystems, Inc. All Rights Reserved.
47.32 + *
47.33 + * If you wish your version of this file to be governed by only the CDDL
47.34 + * or only the GPL Version 2, indicate your decision by adding
47.35 + * "[Contributor] elects to include this software in this distribution
47.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
47.37 + * single choice of license, a recipient has the option to distribute
47.38 + * your version of this file under either the CDDL, the GPL Version 2 or
47.39 + * to extend the choice of license to its licensees as provided above.
47.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
47.41 + * Version 2 license, then the option applies only if the new code is
47.42 + * made subject to such option by the copyright holder.
47.43 + */
47.44 +
47.45 +
47.46 +
47.47 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
47.48 +
47.49 +import javax.swing.JPanel;
47.50 +import org.openide.WizardDescriptor;
47.51 +
47.52 +
47.53 +abstract class SettingsPanel extends JPanel {
47.54 +
47.55 + abstract void store (WizardDescriptor settings);
47.56 +
47.57 + abstract void read (WizardDescriptor settings);
47.58 +
47.59 + abstract boolean valid (WizardDescriptor settings);
47.60 +}
48.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
48.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/Utils.java Wed Feb 23 20:12:58 2011 -0500
48.3 @@ -0,0 +1,300 @@
48.4 +/*
48.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
48.6 + *
48.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
48.8 + *
48.9 + * The contents of this file are subject to the terms of either the GNU
48.10 + * General Public License Version 2 only ("GPL") or the Common
48.11 + * Development and Distribution License("CDDL") (collectively, the
48.12 + * "License"). You may not use this file except in compliance with the
48.13 + * License. You can obtain a copy of the License at
48.14 + * http://www.netbeans.org/cddl-gplv2.html
48.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
48.16 + * specific language governing permissions and limitations under the
48.17 + * License. When distributing the software, include this License Header
48.18 + * Notice in each file and include the License file at
48.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
48.20 + * particular file as subject to the "Classpath" exception as provided
48.21 + * by Sun in the GPL Version 2 section of the License file that
48.22 + * accompanied this code. If applicable, add the following below the
48.23 + * License Header, with the fields enclosed by brackets [] replaced by
48.24 + * your own identifying information:
48.25 + * "Portions Copyrighted [year] [name of copyright owner]"
48.26 + *
48.27 + * Contributor(s):
48.28 + *
48.29 + * The Original Software is NetBeans. The Initial Developer of the Original
48.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
48.31 + * Microsystems, Inc. All Rights Reserved.
48.32 + *
48.33 + * If you wish your version of this file to be governed by only the CDDL
48.34 + * or only the GPL Version 2, indicate your decision by adding
48.35 + * "[Contributor] elects to include this software in this distribution
48.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
48.37 + * single choice of license, a recipient has the option to distribute
48.38 + * your version of this file under either the CDDL, the GPL Version 2 or
48.39 + * to extend the choice of license to its licensees as provided above.
48.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
48.41 + * Version 2 license, then the option applies only if the new code is
48.42 + * made subject to such option by the copyright holder.
48.43 + */
48.44 +
48.45 +
48.46 +
48.47 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
48.48 +
48.49 +import java.util.Vector;
48.50 +import org.openide.filesystems.FileObject;
48.51 +import org.openide.filesystems.FileUtil;
48.52 +import org.netbeans.spi.project.support.ant.AntProjectHelper;
48.53 +import org.netbeans.spi.project.support.ant.EditableProperties;
48.54 +
48.55 +import javax.swing.*;
48.56 +import java.awt.*;
48.57 +import java.beans.PropertyChangeEvent;
48.58 +import java.beans.PropertyChangeListener;
48.59 +import java.io.File;
48.60 +import java.io.IOException;
48.61 +import org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment;
48.62 +
48.63 +import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
48.64 +import org.openide.DialogDescriptor;
48.65 +import org.openide.DialogDisplayer;
48.66 +import org.openide.util.NbBundle;
48.67 +
48.68 +
48.69 +public class Utils {
48.70 +
48.71 + // COPIED FROM TOMCAT
48.72 + private static final String javaKeywords[] = {
48.73 + "abstract", "assert", "boolean", "break", "byte", "case",
48.74 + "catch", "char", "class", "const", "continue",
48.75 + "default", "do", "double", "else", "enum", "extends",
48.76 + "final", "finally", "float", "for", "goto",
48.77 + "if", "implements", "import", "instanceof", "int",
48.78 + "interface", "long", "native", "new", "package",
48.79 + "private", "protected", "public", "return", "short",
48.80 + "static", "strictfp", "super", "switch", "synchronized",
48.81 + "this", "throws", "transient", "try", "void",
48.82 + "volatile", "while" };
48.83 +
48.84 + private static final String JSP_PACKAGE_NAME = "org.apache.jsp";
48.85 +
48.86 + private static final String PLATFORM_ANT_NAME = "platform.ant.name"; //NOI18N
48.87 + public static final String SPECIFICATION_J2SE = "j2se"; //NOI18N
48.88 +
48.89 + public static File getRoot(File f) {
48.90 + File rootF = f;
48.91 + while (rootF.getParentFile() != null) {
48.92 + rootF = rootF.getParentFile();
48.93 + }
48.94 + return rootF;
48.95 + }
48.96 +
48.97 + public static FileObject getValidDir(File dir) throws IOException {
48.98 + final File f = dir.getCanonicalFile();
48.99 + f.mkdirs();
48.100 + if (!f.exists()) {
48.101 + throw new IOException("No such dir on disk: " + f);
48.102 + }
48.103 + if (!f.isDirectory()) {
48.104 + throw new IOException("Not really a dir" + ": " + f);
48.105 + }
48.106 + return FileUtil.toFileObject(f);
48.107 + }
48.108 +
48.109 + public static FileObject getValidEmptyDir(File dir) throws IOException {
48.110 + final FileObject fo = getValidDir(dir);
48.111 + if (fo.getChildren().length != 0) {
48.112 + throw new IOException("Dir has to be empty: " + dir);
48.113 + }
48.114 + return fo;
48.115 + }
48.116 +
48.117 + /**
48.118 + * Updates property file at given location of ant based project
48.119 + * @param h helper of the project
48.120 + * @param path a relative URI in the project directory
48.121 + * @param ep new or updated properties
48.122 + */
48.123 + public static void updateProperties(AntProjectHelper h, String path, EditableProperties ep) {
48.124 + EditableProperties properties = h.getProperties(path);
48.125 + properties.putAll(ep);
48.126 + h.putProperties(path, properties);
48.127 + }
48.128 +
48.129 + /**
48.130 + * Recursively checks whether the file lies underneath or equals the folder
48.131 + * @param folder the root of folders hierarchy to search in
48.132 + * @param file the file to search for
48.133 + * @return <code>true</code>, if <code>file</code> lies somewhere underneath or equals the <code>folder</code>,
48.134 + * <code>false</code> otherwise
48.135 + */
48.136 + public static boolean isParentOrEqual(File folder, File file) {
48.137 + if(folder != null || file != null) {
48.138 + folder = FileUtil.normalizeFile(folder);
48.139 + file = FileUtil.normalizeFile(file);
48.140 + while(file != null) {
48.141 + if(file.equals(folder)) {
48.142 + return true;
48.143 + }
48.144 + file = file.getParentFile();
48.145 + }
48.146 + }
48.147 + return false;
48.148 + }
48.149 +
48.150 +
48.151 + // COPIED FROM TOMCAT
48.152 + /** Returns a slash-delimited resource path for the servlet generated from
48.153 + * JSP, given a resource path of the original JSP. Uses code copied from Tomcat.
48.154 + * Note: does not handle tag files yet, only JSP files.
48.155 + */
48.156 + static String getGeneratedJavaResource(String jspUri) {
48.157 + int iSep = jspUri.lastIndexOf('/');
48.158 + String packageName = (iSep > 0) ? makeJavaPackage(jspUri.substring(0,iSep)) : ""; // NOI18N
48.159 + if (packageName.length() == 0) {
48.160 + packageName = JSP_PACKAGE_NAME;
48.161 + }
48.162 + else {
48.163 + packageName = JSP_PACKAGE_NAME + "." + packageName; // NOI18N
48.164 + }
48.165 + String className = makeJavaIdentifier(jspUri.substring(iSep + 1));
48.166 + return packageName.replace('.', '/') + "/" + className + ".java"; // NOI18N
48.167 + }
48.168 +
48.169 + // COPIED FROM TOMCAT
48.170 + /**
48.171 + * Converts the given path to a Java package or fully-qualified class name
48.172 + *
48.173 + * @param path Path to convert
48.174 + *
48.175 + * @return Java package corresponding to the given path
48.176 + */
48.177 + private static final String makeJavaPackage(String path) {
48.178 + String classNameComponents[] = split(path,"/");
48.179 + StringBuffer legalClassNames = new StringBuffer();
48.180 + for (int i = 0; i < classNameComponents.length; i++) {
48.181 + legalClassNames.append(makeJavaIdentifier(classNameComponents[i]));
48.182 + if (i < classNameComponents.length - 1) {
48.183 + legalClassNames.append('.');
48.184 + }
48.185 + }
48.186 + return legalClassNames.toString();
48.187 + }
48.188 +
48.189 + // COPIED FROM TOMCAT
48.190 + /**
48.191 + * Splits a string into it's components.
48.192 + * @param path String to split
48.193 + * @param pat Pattern to split at
48.194 + * @return the components of the path
48.195 + */
48.196 + private static final String [] split(String path, String pat) {
48.197 + Vector comps = new Vector();
48.198 + int pos = path.indexOf(pat);
48.199 + int start = 0;
48.200 + while( pos >= 0 ) {
48.201 + if(pos > start ) {
48.202 + String comp = path.substring(start,pos);
48.203 + comps.add(comp);
48.204 + }
48.205 + start = pos + pat.length();
48.206 + pos = path.indexOf(pat,start);
48.207 + }
48.208 + if( start < path.length()) {
48.209 + comps.add(path.substring(start));
48.210 + }
48.211 + String [] result = new String[comps.size()];
48.212 + for(int i=0; i < comps.size(); i++) {
48.213 + result[i] = (String)comps.elementAt(i);
48.214 + }
48.215 + return result;
48.216 + }
48.217 +
48.218 + // COPIED FROM TOMCAT
48.219 + /**
48.220 + * Converts the given identifier to a legal Java identifier
48.221 + *
48.222 + * @param identifier Identifier to convert
48.223 + *
48.224 + * @return Legal Java identifier corresponding to the given identifier
48.225 + */
48.226 + private static final String makeJavaIdentifier(String identifier) {
48.227 + StringBuffer modifiedIdentifier =
48.228 + new StringBuffer(identifier.length());
48.229 + if (!Character.isJavaIdentifierStart(identifier.charAt(0))) {
48.230 + modifiedIdentifier.append('_');
48.231 + }
48.232 + for (int i = 0; i < identifier.length(); i++) {
48.233 + char ch = identifier.charAt(i);
48.234 + if (Character.isJavaIdentifierPart(ch) && ch != '_') {
48.235 + modifiedIdentifier.append(ch);
48.236 + } else if (ch == '.') {
48.237 + modifiedIdentifier.append('_');
48.238 + } else {
48.239 + modifiedIdentifier.append(mangleChar(ch));
48.240 + }
48.241 + }
48.242 + if (isJavaKeyword(modifiedIdentifier.toString())) {
48.243 + modifiedIdentifier.append('_');
48.244 + }
48.245 + return modifiedIdentifier.toString();
48.246 + }
48.247 +
48.248 + // COPIED FROM TOMCAT
48.249 + /**
48.250 + * Mangle the specified character to create a legal Java class name.
48.251 + */
48.252 + private static final String mangleChar(char ch) {
48.253 + char[] result = new char[5];
48.254 + result[0] = '_';
48.255 + result[1] = Character.forDigit((ch >> 12) & 0xf, 16);
48.256 + result[2] = Character.forDigit((ch >> 8) & 0xf, 16);
48.257 + result[3] = Character.forDigit((ch >> 4) & 0xf, 16);
48.258 + result[4] = Character.forDigit(ch & 0xf, 16);
48.259 + return new String(result);
48.260 + }
48.261 +
48.262 + // COPIED FROM TOMCAT
48.263 + /**
48.264 + * Test whether the argument is a Java keyword
48.265 + */
48.266 + private static boolean isJavaKeyword(String key) {
48.267 + int i = 0;
48.268 + int j = javaKeywords.length;
48.269 + while (i < j) {
48.270 + int k = (i+j)/2;
48.271 + int result = javaKeywords[k].compareTo(key);
48.272 + if (result == 0) {
48.273 + return true;
48.274 + }
48.275 + if (result < 0) {
48.276 + i = k+1;
48.277 + } else {
48.278 + j = k;
48.279 + }
48.280 + }
48.281 + return false;
48.282 + }
48.283 +
48.284 + public static Color getErrorColor() {
48.285 + // inspired by org.openide.WizardDescriptor
48.286 + Color c = UIManager.getColor("nb.errorForeground"); //NOI18N
48.287 + return c == null ? new Color(89,79,191) : c;
48.288 + }
48.289 +
48.290 + public static String toClasspathString(File[] classpathEntries) {
48.291 + if (classpathEntries == null) {
48.292 + return "";
48.293 + }
48.294 + StringBuffer classpath = new StringBuffer();
48.295 + for (int i = 0; i < classpathEntries.length; i++) {
48.296 + classpath.append(classpathEntries[i].getAbsolutePath());
48.297 + if (i + 1 < classpathEntries.length) {
48.298 + classpath.append(":"); // NOI18N
48.299 + }
48.300 + }
48.301 + return classpath.toString();
48.302 + }
48.303 +}
49.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
49.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/WizardProperties.java Wed Feb 23 20:12:58 2011 -0500
49.3 @@ -0,0 +1,67 @@
49.4 +/*
49.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
49.6 + *
49.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
49.8 + *
49.9 + * The contents of this file are subject to the terms of either the GNU
49.10 + * General Public License Version 2 only ("GPL") or the Common
49.11 + * Development and Distribution License("CDDL") (collectively, the
49.12 + * "License"). You may not use this file except in compliance with the
49.13 + * License. You can obtain a copy of the License at
49.14 + * http://www.netbeans.org/cddl-gplv2.html
49.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
49.16 + * specific language governing permissions and limitations under the
49.17 + * License. When distributing the software, include this License Header
49.18 + * Notice in each file and include the License file at
49.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
49.20 + * particular file as subject to the "Classpath" exception as provided
49.21 + * by Sun in the GPL Version 2 section of the License file that
49.22 + * accompanied this code. If applicable, add the following below the
49.23 + * License Header, with the fields enclosed by brackets [] replaced by
49.24 + * your own identifying information:
49.25 + * "Portions Copyrighted [year] [name of copyright owner]"
49.26 + *
49.27 + * Contributor(s):
49.28 + *
49.29 + * The Original Software is NetBeans. The Initial Developer of the Original
49.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
49.31 + * Microsystems, Inc. All Rights Reserved.
49.32 + *
49.33 + * If you wish your version of this file to be governed by only the CDDL
49.34 + * or only the GPL Version 2, indicate your decision by adding
49.35 + * "[Contributor] elects to include this software in this distribution
49.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
49.37 + * single choice of license, a recipient has the option to distribute
49.38 + * your version of this file under either the CDDL, the GPL Version 2 or
49.39 + * to extend the choice of license to its licensees as provided above.
49.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
49.41 + * Version 2 license, then the option applies only if the new code is
49.42 + * made subject to such option by the copyright holder.
49.43 + */
49.44 +
49.45 +
49.46 +package org.netbeans.modules.visualweb.project.jsfportlet.ui.wizard;
49.47 +
49.48 +public class WizardProperties {
49.49 + public static final String PROJECT_DIR = "projdir"; //NOI18N
49.50 + public static final String NAME = "name"; //NOI18N
49.51 + public static final String SOURCE_ROOT = "sourceRoot"; //NOI18N
49.52 +
49.53 + public static final String SET_AS_MAIN = "setAsMain"; //NOI18N
49.54 + public static final String SERVER_INSTANCE_ID = "serverInstanceID"; //NOI18N
49.55 + public static final String J2EE_LEVEL = "j2eeLevel"; //NOI18N
49.56 + public static final String SOURCE_STRUCTURE = "sourceStructure"; //NOI18N
49.57 + public static final String CONTEXT_PATH = "contextPath"; //NOI18N
49.58 +
49.59 + public static final String DOC_BASE = "docBase"; //NOI18N
49.60 + public static final String JAVA_ROOT = "javaRoot"; //NOI18N
49.61 + public static final String LIB_FOLDER = "libFolder"; //NOI18N
49.62 + public static final String TEST_ROOT = "testRoot"; //NOI18N
49.63 +
49.64 + public static final String EAR_APPLICATION = "earApplication"; //NOI18N
49.65 +
49.66 + public static final String JAVA_PLATFORM = "setJavaPlatform"; // NOI18N
49.67 + public static final String SOURCE_LEVEL = "setSourceLevel"; // NOI18N
49.68 +
49.69 + public static final String FRAMEWORKS = "frameworks"; // NOI18N
49.70 +}
50.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
50.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/resources/Bundle.properties Wed Feb 23 20:12:58 2011 -0500
50.3 @@ -0,0 +1,42 @@
50.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
50.5 +#
50.6 +# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
50.7 +#
50.8 +# The contents of this file are subject to the terms of either the GNU
50.9 +# General Public License Version 2 only ("GPL") or the Common
50.10 +# Development and Distribution License("CDDL") (collectively, the
50.11 +# "License"). You may not use this file except in compliance with the
50.12 +# License. You can obtain a copy of the License at
50.13 +# http://www.netbeans.org/cddl-gplv2.html
50.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
50.15 +# specific language governing permissions and limitations under the
50.16 +# License. When distributing the software, include this License Header
50.17 +# Notice in each file and include the License file at
50.18 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
50.19 +# particular file as subject to the "Classpath" exception as provided
50.20 +# by Sun in the GPL Version 2 section of the License file that
50.21 +# accompanied this code. If applicable, add the following below the
50.22 +# License Header, with the fields enclosed by brackets [] replaced by
50.23 +# your own identifying information:
50.24 +# "Portions Copyrighted [year] [name of copyright owner]"
50.25 +#
50.26 +# Contributor(s):
50.27 +#
50.28 +# The Original Software is NetBeans. The Initial Developer of the Original
50.29 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
50.30 +# Microsystems, Inc. All Rights Reserved.
50.31 +#
50.32 +# If you wish your version of this file to be governed by only the CDDL
50.33 +# or only the GPL Version 2, indicate your decision by adding
50.34 +# "[Contributor] elects to include this software in this distribution
50.35 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
50.36 +# single choice of license, a recipient has the option to distribute
50.37 +# your version of this file under either the CDDL, the GPL Version 2 or
50.38 +# to extend the choice of license to its licensees as provided above.
50.39 +# However, if you add GPL Version 2 code and therefore, elected the GPL
50.40 +# Version 2 license, then the option applies only if the new code is
50.41 +# made subject to such option by the copyright holder.
50.42 +
50.43 +#System file system
50.44 +Templates/Project/Web/portletProject.xml=JSR-168 JSF Portlet Project
50.45 +
51.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
51.2 +++ b/misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/resources/PortletProject.html Wed Feb 23 20:12:58 2011 -0500
51.3 @@ -0,0 +1,49 @@
51.4 +<!--
51.5 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
51.6 +
51.7 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
51.8 +
51.9 +
51.10 +The contents of this file are subject to the terms of either the GNU
51.11 +General Public License Version 2 only ("GPL") or the Common
51.12 +Development and Distribution License("CDDL") (collectively, the
51.13 +"License"). You may not use this file except in compliance with the
51.14 +License. You can obtain a copy of the License at
51.15 +http://www.netbeans.org/cddl-gplv2.html
51.16 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
51.17 +specific language governing permissions and limitations under the
51.18 +License. When distributing the software, include this License Header
51.19 +Notice in each file and include the License file at
51.20 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
51.21 +particular file as subject to the "Classpath" exception as provided
51.22 +by Sun in the GPL Version 2 section of the License file that
51.23 +accompanied this code. If applicable, add the following below the
51.24 +License Header, with the fields enclosed by brackets [] replaced by
51.25 +your own identifying information:
51.26 +"Portions Copyrighted [year] [name of copyright owner]"
51.27 +
51.28 +Contributor(s):
51.29 +
51.30 +The Original Software is NetBeans. The Initial Developer of the Original
51.31 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
51.32 +Microsystems, Inc. All Rights Reserved.
51.33 +
51.34 +If you wish your version of this file to be governed by only the CDDL
51.35 +or only the GPL Version 2, indicate your decision by adding
51.36 +"[Contributor] elects to include this software in this distribution
51.37 +under the [CDDL or GPL Version 2] license." If you do not indicate a
51.38 +single choice of license, a recipient has the option to distribute
51.39 +your version of this file under either the CDDL, the GPL Version 2 or
51.40 +to extend the choice of license to its licensees as provided above.
51.41 +However, if you add GPL Version 2 code and therefore, elected the GPL
51.42 +Version 2 license, then the option applies only if the new code is
51.43 +made subject to such option by the copyright holder.
51.44 +-->
51.45 +
51.46 +
51.47 +
51.48 +<HTML>
51.49 + <BODY>
51.50 + Select JSR-168 JSF Portlet Project to build a JSR-168 compliant portlet application containing one portlet.
51.51 + </BODY>
51.52 +</HTML>
52.1 Binary file misc/project/jsfportlet/src/org/netbeans/modules/visualweb/project/jsfportlet/ui/wizard/resources/PortletProjectIcon.gif has changed
53.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
53.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/CheckLicense.java Wed Feb 23 20:12:58 2011 -0500
53.3 @@ -0,0 +1,514 @@
53.4 +/*
53.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
53.6 + *
53.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
53.8 + *
53.9 + * The contents of this file are subject to the terms of either the GNU
53.10 + * General Public License Version 2 only ("GPL") or the Common
53.11 + * Development and Distribution License("CDDL") (collectively, the
53.12 + * "License"). You may not use this file except in compliance with the
53.13 + * License. You can obtain a copy of the License at
53.14 + * http://www.netbeans.org/cddl-gplv2.html
53.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
53.16 + * specific language governing permissions and limitations under the
53.17 + * License. When distributing the software, include this License Header
53.18 + * Notice in each file and include the License file at
53.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
53.20 + * particular file as subject to the "Classpath" exception as provided
53.21 + * by Sun in the GPL Version 2 section of the License file that
53.22 + * accompanied this code. If applicable, add the following below the
53.23 + * License Header, with the fields enclosed by brackets [] replaced by
53.24 + * your own identifying information:
53.25 + * "Portions Copyrighted [year] [name of copyright owner]"
53.26 + *
53.27 + * Contributor(s):
53.28 + *
53.29 + * The Original Software is NetBeans. The Initial Developer of the Original
53.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
53.31 + * Microsystems, Inc. All Rights Reserved.
53.32 + *
53.33 + * If you wish your version of this file to be governed by only the CDDL
53.34 + * or only the GPL Version 2, indicate your decision by adding
53.35 + * "[Contributor] elects to include this software in this distribution
53.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
53.37 + * single choice of license, a recipient has the option to distribute
53.38 + * your version of this file under either the CDDL, the GPL Version 2 or
53.39 + * to extend the choice of license to its licensees as provided above.
53.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
53.41 + * Version 2 license, then the option applies only if the new code is
53.42 + * made subject to such option by the copyright holder.
53.43 + */
53.44 +
53.45 +package org.netbeans.modules.visualweb.ravebuild;
53.46 +
53.47 +
53.48 +import java.io.BufferedReader;
53.49 +import java.io.BufferedWriter;
53.50 +import java.io.File;
53.51 +import java.io.FileInputStream;
53.52 +import java.io.FileOutputStream;
53.53 +import java.io.FileReader;
53.54 +import java.io.FileWriter;
53.55 +import java.io.IOException;
53.56 +import java.io.Reader;
53.57 +import java.util.ArrayList;
53.58 +import java.util.Iterator;
53.59 +import java.util.List;
53.60 +import java.util.Vector;
53.61 +import java.util.regex.Matcher;
53.62 +import java.util.regex.Pattern;
53.63 +
53.64 +import org.apache.tools.ant.BuildException;
53.65 +import org.apache.tools.ant.FileScanner;
53.66 +import org.apache.tools.ant.Project;
53.67 +import org.apache.tools.ant.Task;
53.68 +import org.apache.tools.ant.types.FileSet;
53.69 +
53.70 +/** Check source files for a license notice.
53.71 + * @author Jesse Glick
53.72 + */
53.73 +public class CheckLicense extends Task {
53.74 +
53.75 + private final List filesets = new ArrayList (1); // List<FileSet>
53.76 + private String fragment;
53.77 + private List fragments; // List<Fragment>
53.78 + private License license;
53.79 + private ArrayList delimiters;
53.80 + private boolean replaceonly = false;
53.81 +
53.82 + /** Add a file set of source files to check.
53.83 + * @param fs set of files to check licenses of
53.84 + */
53.85 + public void addFileSet (FileSet fs) {
53.86 + filesets.add (fs);
53.87 + }
53.88 +
53.89 + /** Add a file set of CVS-controlled source files to check.
53.90 + * @param fs set of files to check licenses of
53.91 + */
53.92 + public void addCvsFileSet(CvsFileSet fs) {
53.93 + filesets.add(fs);
53.94 + }
53.95 +
53.96 + /** Set the fragment of license notice which is expected
53.97 + * to be found in each source file.
53.98 + * @param f the fragment
53.99 + */
53.100 + public void setFragment (String f) {
53.101 + fragment = f;
53.102 + }
53.103 +
53.104 + public Convert createConvert() {
53.105 + Convert f = new Convert();
53.106 + if (fragments == null) {
53.107 + fragments = new ArrayList();
53.108 + }
53.109 +
53.110 + fragments.add(f);
53.111 + return f;
53.112 + }
53.113 +
53.114 + public void setReplaceonly(boolean b) {
53.115 + replaceonly = b;
53.116 + }
53.117 +
53.118 + public Delimiters createDelimiters() {
53.119 + Delimiters d = new Delimiters();
53.120 + if (delimiters == null) {
53.121 + delimiters = new ArrayList();
53.122 + }
53.123 +
53.124 + delimiters.add(d);
53.125 + return d;
53.126 + }
53.127 +
53.128 + public void addLicense(License license) {
53.129 + this.license = license;
53.130 + }
53.131 +
53.132 +
53.133 + public void execute() throws BuildException {
53.134 + if (replaceonly == false) {
53.135 + if (fragment == null) {
53.136 + throw new BuildException("You must supply a fragment", getLocation());
53.137 + }
53.138 +
53.139 + if (filesets.isEmpty()) throw new BuildException("You must supply at least one fileset", getLocation());
53.140 +
53.141 + if (license == null) {
53.142 + throw new BuildException("The 'license' subelement must be defined",getLocation());
53.143 + }
53.144 +
53.145 + if (delimiters == null) {
53.146 + throw new BuildException("You must supply at least one delimiters element");
53.147 + }
53.148 + }
53.149 + Iterator it = filesets.iterator();
53.150 + String failMsg = null;
53.151 + try {
53.152 + while (it.hasNext()) {
53.153 + FileScanner scanner = ((FileSet) it.next()).getDirectoryScanner(getProject());
53.154 + File baseDir = scanner.getBasedir();
53.155 + String[] files = scanner.getIncludedFiles();
53.156 + log("Looking for " + fragment + " in " + files.length + " files in " + baseDir.getAbsolutePath());
53.157 + for (int i = 0; i < files.length; i++) {
53.158 + File f = new File(baseDir, files[i]);
53.159 +
53.160 + if (replaceonly == false) {
53.161 + //log("Scanning " + f, Project.MSG_VERBOSE);
53.162 + BufferedReader br = new BufferedReader(new FileReader(f));
53.163 + String line = null;
53.164 + try {
53.165 + while ((line = br.readLine()) != null) {
53.166 + if (line.indexOf(fragment) != -1) {
53.167 + // Found it.
53.168 + break;
53.169 + }
53.170 + }
53.171 + } finally {
53.172 + br.close();
53.173 + }
53.174 +
53.175 + if (line == null) {
53.176 + removeOldLicense(f);
53.177 + prependLicense(f);
53.178 + }else {
53.179 + updateLicense(f);
53.180 + }
53.181 + }else {
53.182 + updateLicense(f);
53.183 + }
53.184 + }
53.185 + }
53.186 +
53.187 + if (failMsg != null) {
53.188 + throw new BuildException(failMsg);
53.189 + }
53.190 +
53.191 + } catch (IOException ioe) {
53.192 + throw new BuildException("Could not open files to check licenses", ioe, getLocation());
53.193 + }
53.194 + }
53.195 +
53.196 + private void removeOldLicense(File f) throws BuildException {
53.197 + try {
53.198 + BufferedReader reader = new BufferedReader(new FileReader(f));
53.199 + Vector lines = new Vector();
53.200 +
53.201 + while (reader.ready()) {
53.202 + lines.add(reader.readLine());
53.203 + }
53.204 + reader.close();
53.205 +
53.206 + Pattern[] patterns = new Pattern[delimiters.size()];
53.207 + for (int i = 0; i < delimiters.size(); i++) {
53.208 + String middle = ((Delimiters)delimiters.get(i)).middle;
53.209 + patterns[i] = Pattern.compile("(\\s)*" + regex(middle) + ".*[Cc][Oo][Pp][Yy][Rr][Ii][Gg][Hh][Tt].*");
53.210 + }
53.211 +
53.212 +
53.213 + boolean changed = false;
53.214 + for (int i = 0; i < lines.size() && changed == false; i++) {
53.215 + String nextLine = (String)lines.get(i);
53.216 +
53.217 + // match a line that contains (start-string)...Copyright...
53.218 + for (int j = 0; j < patterns.length; j++) {
53.219 + if (patterns[j].matcher(nextLine).matches()) {
53.220 + log("Removing existing copyright from " + f.getAbsolutePath(), Project.MSG_INFO);
53.221 + log("Matched line..." + nextLine);
53.222 + deleteCopyright(lines, i, (Delimiters)delimiters.get(j));
53.223 + changed = true;
53.224 + break;
53.225 + }
53.226 +
53.227 + }
53.228 + }
53.229 + if (changed) {
53.230 + BufferedWriter writer = new BufferedWriter(new FileWriter(f));
53.231 +
53.232 + for (int i = 0; i < lines.size(); i++) {
53.233 + Object next = lines.get(i);
53.234 + if (next != null) {
53.235 + writer.write((String)next);
53.236 + writer.newLine();
53.237 + }
53.238 + }
53.239 + writer.close();
53.240 + }
53.241 +
53.242 + }catch (IOException ex) {
53.243 + throw new BuildException("Could not read/write files to delete old license", ex, getLocation());
53.244 + }
53.245 + }
53.246 +
53.247 + private String regex(String str) {
53.248 + StringBuffer buffer = new StringBuffer();
53.249 + for (int i = 0; i < str.length(); i++) {
53.250 + String hex = Integer.toHexString((int)str.charAt(i));
53.251 + buffer.append("\\x"+hex);
53.252 + }
53.253 + return buffer.toString();
53.254 + }
53.255 +
53.256 + private void deleteCopyright(Vector lines, int i, Delimiters delim) {
53.257 + String start = delim.start;
53.258 + String end = delim.end;
53.259 +
53.260 + // find the first line of the copyright comment block
53.261 + for (int j = i; j >= 0; j--) {
53.262 + String curLine = (String)lines.get(j);
53.263 + int index = (end == null) ? curLine.indexOf(start) : curLine.lastIndexOf(start);
53.264 +
53.265 + if (end == null) {
53.266 + if (index > 0) {
53.267 + lines.set(j, curLine.substring(0,index));
53.268 + }else if (index == 0) {
53.269 + lines.set(j, null);
53.270 + }else {
53.271 + break;
53.272 + }
53.273 + }else {
53.274 + if (index > 0) {
53.275 + lines.set(j, curLine.substring(0,index));
53.276 + break;
53.277 + }else if (index == 0) {
53.278 + lines.set(j,null);
53.279 + break;
53.280 + }else {
53.281 + lines.set(j,null);
53.282 + }
53.283 + }
53.284 + }
53.285 +
53.286 +
53.287 + // find the last line of the copyright comment block
53.288 + for (int j = i ; j < lines.size(); j++) {
53.289 + String curLine = (String)lines.get(j);
53.290 +
53.291 + if (curLine == null) {
53.292 + continue;
53.293 + }else if (end == null) {
53.294 + int index = curLine.indexOf(start);
53.295 +
53.296 + if (index > 0) {
53.297 + lines.set(j, curLine.substring(0,index));
53.298 + }else if (index == 0) {
53.299 + lines.set(j, null);
53.300 + }else {
53.301 + break;
53.302 + }
53.303 + }else {
53.304 + int index = curLine.indexOf(end);
53.305 + int size = end.length();
53.306 +
53.307 + if (index == -1) {
53.308 + lines.set(j, null);
53.309 + }else if (index == curLine.length() - size) {
53.310 + lines.set(j, null);
53.311 + break;
53.312 + }else {
53.313 + lines.set(j, curLine.substring(index + size));
53.314 + break;
53.315 + }
53.316 + }
53.317 + }
53.318 + }
53.319 +
53.320 + private void prependLicense(File f) throws BuildException {
53.321 + try {
53.322 + log("Inserting license notice in " + f.getAbsolutePath(), Project.MSG_INFO);
53.323 + FileInputStream is = new FileInputStream(f);
53.324 + StringBuffer sb = new StringBuffer(1024);
53.325 + byte[] buffer = new byte[1024];
53.326 + int bufferLength;
53.327 +
53.328 + while ( (bufferLength = is.read(buffer)) != -1) {
53.329 + sb.append(new String(buffer, 0, bufferLength));
53.330 + }
53.331 + is.close();
53.332 +
53.333 + FileOutputStream os = new FileOutputStream(f);
53.334 + os.write(license.repl.getBytes());
53.335 + os.write(sb.toString().getBytes());
53.336 + os.close();
53.337 +
53.338 +
53.339 + }catch (IOException ex) {
53.340 + throw new BuildException("Could not read/write files to insert license", ex, getLocation());
53.341 + }
53.342 +
53.343 +
53.344 + }
53.345 +
53.346 + private void updateLicense(File file) throws BuildException {
53.347 + try {
53.348 + byte[] workingArray = new byte[4096];
53.349 + log("Processing " + file, Project.MSG_VERBOSE);
53.350 +
53.351 + FileInputStream is = new FileInputStream(file);
53.352 + int workingLength = is.read(workingArray);
53.353 + if (workingLength == -1) {
53.354 + log("Could not update license in " + file.getAbsoluteFile(), Project.MSG_WARN);
53.355 + return;
53.356 + }
53.357 + String workingString = new String(workingArray, 0, workingLength);
53.358 + boolean changed = false;
53.359 + String prefix = null;
53.360 +
53.361 + Iterator frags = fragments.iterator();
53.362 + while (frags.hasNext()) {
53.363 + Convert f = (Convert)frags.next();
53.364 +
53.365 + Matcher matcher = f.orig.matcher(workingString);
53.366 +
53.367 + while (matcher.find()) {
53.368 + if (f.prefix) {
53.369 + if (prefix != null) {
53.370 + throw new BuildException("Only one convert element can be prefix!");
53.371 + }
53.372 + if (matcher.groupCount() != 1) {
53.373 + throw new BuildException("There should be one group for the prefix element. Was: " + matcher.groupCount());
53.374 + }
53.375 + prefix = matcher.group(1);
53.376 + }
53.377 +
53.378 + String before = workingString.substring(0, matcher.start());
53.379 + String after = workingString.substring(matcher.end());
53.380 + String middle = wrapWithPrefix(f.repl, prefix, before.length() == 0 || before.endsWith("\n"));
53.381 +
53.382 + if (!middle.equals(matcher.group(0))) {
53.383 + workingString = before + middle + after;
53.384 + log("Matched " + middle, Project.MSG_VERBOSE);
53.385 + changed = true;
53.386 + } else {
53.387 + log("Matched, but no change: " + middle, Project.MSG_VERBOSE);
53.388 + }
53.389 +
53.390 + if (!f.all) {
53.391 + break;
53.392 + } else {
53.393 + matcher = f.orig.matcher(workingString);
53.394 + }
53.395 + }
53.396 +
53.397 + }
53.398 +
53.399 + byte[] rest = null;
53.400 + if (is.available() > 0 && changed) {
53.401 + rest = new byte[is.available()];
53.402 + int read = is.read(rest);
53.403 + assert read == rest.length;
53.404 + }
53.405 +
53.406 + is.close();
53.407 +
53.408 +
53.409 + if (changed) {
53.410 + log("Rewriting " + file, Project.MSG_INFO);
53.411 + FileOutputStream os = new FileOutputStream(file);
53.412 + workingString = Pattern.compile(" +$", Pattern.MULTILINE).matcher(workingString+"X").replaceAll("");
53.413 + os.write(workingString.substring(0, workingString.length() - 1).getBytes());
53.414 + if (rest != null) {
53.415 + os.write(rest);
53.416 + }
53.417 + os.close();
53.418 + }
53.419 + } catch (IOException ioe) {
53.420 + throw new BuildException("Could not open files to check license", ioe, getLocation());
53.421 + }
53.422 + }
53.423 +
53.424 + private String wrapWithPrefix(String repl, String prefix, boolean startWithPrefix) {
53.425 + if (prefix == null) {
53.426 + return repl;
53.427 + }
53.428 +
53.429 + String[] all = repl.split("\n");
53.430 + StringBuffer sb = new StringBuffer();
53.431 + for (int i = 0; i < all.length; i++) {
53.432 + if (all[i].length() > 0) {
53.433 + if (startWithPrefix) {
53.434 + sb.append(prefix);
53.435 + }
53.436 + sb.append(all[i]);
53.437 + }
53.438 + if (i < all.length - 1) {
53.439 + sb.append('\n');
53.440 + }
53.441 + startWithPrefix = true;
53.442 + }
53.443 +
53.444 + return sb.toString();
53.445 + }
53.446 +
53.447 +
53.448 + public static final class Convert {
53.449 + Pattern orig;
53.450 + String repl;
53.451 + boolean prefix;
53.452 + boolean all;
53.453 +
53.454 + public void setToken(String orig) {
53.455 + this.orig = Pattern.compile(orig, Pattern.DOTALL | Pattern.MULTILINE);
53.456 + }
53.457 + public void setReplace(String repl) {
53.458 + this.repl = repl.replace("\\n", "\n").replace("\\t", "\t");
53.459 + }
53.460 + public void setPrefix(boolean b) {
53.461 + prefix = b;
53.462 + }
53.463 + public void setReplaceAll(boolean b) {
53.464 + all = b;
53.465 + }
53.466 + public Line createLine() {
53.467 + return new Line();
53.468 + }
53.469 +
53.470 + public final class Line {
53.471 + public void setText(String t) {
53.472 + if (repl == null) {
53.473 + repl = t;
53.474 + } else {
53.475 + repl = repl + "\n" + t;
53.476 + }
53.477 + }
53.478 + }
53.479 + }
53.480 +
53.481 + public static final class Delimiters {
53.482 + String start;
53.483 + String middle;
53.484 + String end;
53.485 +
53.486 + public void setStart(String start) {
53.487 + this.start = start;
53.488 + }
53.489 +
53.490 + public void setMiddle(String middle) {
53.491 + this.middle = middle;
53.492 + }
53.493 +
53.494 + public void setEnd(String end) {
53.495 + this.end = end;
53.496 + }
53.497 + }
53.498 +
53.499 + public static final class License {
53.500 + String repl;
53.501 +
53.502 + public Line createLine() {
53.503 + return new Line();
53.504 + }
53.505 +
53.506 + public final class Line {
53.507 + public void setText(String t) {
53.508 + if (repl == null) {
53.509 + repl = t;
53.510 + } else {
53.511 + repl = repl + "\n" + t;
53.512 + }
53.513 + }
53.514 + }
53.515 +
53.516 + }
53.517 +}
54.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
54.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/CvsFileSet.java Wed Feb 23 20:12:58 2011 -0500
54.3 @@ -0,0 +1,192 @@
54.4 +/*
54.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
54.6 + *
54.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
54.8 + *
54.9 + * The contents of this file are subject to the terms of either the GNU
54.10 + * General Public License Version 2 only ("GPL") or the Common
54.11 + * Development and Distribution License("CDDL") (collectively, the
54.12 + * "License"). You may not use this file except in compliance with the
54.13 + * License. You can obtain a copy of the License at
54.14 + * http://www.netbeans.org/cddl-gplv2.html
54.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
54.16 + * specific language governing permissions and limitations under the
54.17 + * License. When distributing the software, include this License Header
54.18 + * Notice in each file and include the License file at
54.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
54.20 + * particular file as subject to the "Classpath" exception as provided
54.21 + * by Sun in the GPL Version 2 section of the License file that
54.22 + * accompanied this code. If applicable, add the following below the
54.23 + * License Header, with the fields enclosed by brackets [] replaced by
54.24 + * your own identifying information:
54.25 + * "Portions Copyrighted [year] [name of copyright owner]"
54.26 + *
54.27 + * Contributor(s):
54.28 + *
54.29 + * The Original Software is NetBeans. The Initial Developer of the Original
54.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
54.31 + * Microsystems, Inc. All Rights Reserved.
54.32 + *
54.33 + * If you wish your version of this file to be governed by only the CDDL
54.34 + * or only the GPL Version 2, indicate your decision by adding
54.35 + * "[Contributor] elects to include this software in this distribution
54.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
54.37 + * single choice of license, a recipient has the option to distribute
54.38 + * your version of this file under either the CDDL, the GPL Version 2 or
54.39 + * to extend the choice of license to its licensees as provided above.
54.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
54.41 + * Version 2 license, then the option applies only if the new code is
54.42 + * made subject to such option by the copyright holder.
54.43 + */
54.44 +
54.45 +package org.netbeans.modules.visualweb.ravebuild;
54.46 +
54.47 +import java.io.BufferedReader;
54.48 +import java.io.File;
54.49 +import java.io.FileReader;
54.50 +import java.io.IOException;
54.51 +import java.io.Reader;
54.52 +import java.util.Collections;
54.53 +import java.util.HashMap;
54.54 +import java.util.HashSet;
54.55 +import java.util.Map;
54.56 +import java.util.Set;
54.57 +import org.apache.tools.ant.BuildException;
54.58 +import org.apache.tools.ant.DirectoryScanner;
54.59 +import org.apache.tools.ant.Project;
54.60 +import org.apache.tools.ant.types.EnumeratedAttribute;
54.61 +import org.apache.tools.ant.types.FileSet;
54.62 +
54.63 +/** A special fileset permitting exclusions based on CVS characteristics.
54.64 + * @author Jesse Glick
54.65 + */
54.66 +public class CvsFileSet extends FileSet {
54.67 +
54.68 + /** Filtering mode for CVS filesets.
54.69 + */
54.70 + public static final class Mode extends EnumeratedAttribute {
54.71 + public String[] getValues() {
54.72 + return new String[] {
54.73 + "controlled",
54.74 + "uncontrolled",
54.75 + "text",
54.76 + "binary",
54.77 + };
54.78 + }
54.79 + }
54.80 +
54.81 + private String mode = "controlled";
54.82 +
54.83 + /** Set filtering mode.
54.84 + * @param m The mode to use:
54.85 + * <dl>
54.86 + * <dt><code>controlled</code> (default)
54.87 + * <dd>Only files under CVS control are matched.
54.88 + * <dt><code>uncontrolled</code>
54.89 + * <dd>Only files not under CVS control are matched.
54.90 + * <dt><code>text</code>
54.91 + * <dd>Only files under CVS control and marked as textual are matched.
54.92 + * <dt><code>binary</code>
54.93 + * <dd>Only files under CVS control and marked as binary are matched.
54.94 + * </dl>
54.95 + */
54.96 + public void setMode(Mode m) {
54.97 + mode = m.getValue();
54.98 + }
54.99 +
54.100 + public DirectoryScanner getDirectoryScanner(Project proj) throws BuildException {
54.101 + DirectoryScanner scan = new CvsDirectoryScanner();
54.102 + setupDirectoryScanner(scan, proj);
54.103 + scan.scan();
54.104 + return scan;
54.105 + }
54.106 +
54.107 + private static final Set[] NO_ENTRIES = new Set[] {Collections.EMPTY_SET, Collections.EMPTY_SET};
54.108 +
54.109 + private class CvsDirectoryScanner extends DirectoryScanner {
54.110 +
54.111 + // Map from dirs to parsed CVS/Entries, being set of text and binary filenames
54.112 + private final Map entries = new HashMap(100); // Map<File,Set<String>[2]>
54.113 +
54.114 + protected boolean isIncluded(String name) throws BuildException {
54.115 + if (! super.isIncluded(name)) return false;
54.116 + File f = new File(getBasedir(), name);
54.117 + if (! f.exists()) throw new IllegalStateException();
54.118 + if (! f.isFile()) return false;
54.119 + Set[] entries = loadEntries(f.getParentFile());
54.120 + Set text = entries[0];
54.121 + Set binary = entries[1];
54.122 + String bname = f.getName();
54.123 + if (mode.equals("controlled")) {
54.124 + return text.contains(bname) || binary.contains(bname);
54.125 + } else if (mode.equals("uncontrolled")) {
54.126 + return ! text.contains(bname) && ! binary.contains(bname);
54.127 + } else if (mode.equals("text")) {
54.128 + return text.contains(bname);
54.129 + } else if (mode.equals("binary")) {
54.130 + return binary.contains(bname);
54.131 + } else {
54.132 + throw new IllegalStateException(mode);
54.133 + }
54.134 + }
54.135 +
54.136 + private Set[] loadEntries(File dir) throws BuildException {
54.137 + Set[] tb = (Set[])entries.get(dir);
54.138 + if (tb == null) {
54.139 + File efile = new File(new File(dir, "CVS"), "Entries");
54.140 + if (efile.exists()) {
54.141 + tb = new Set[] {new HashSet(10), new HashSet(10)};
54.142 + try {
54.143 + Reader r = new FileReader(efile);
54.144 + try {
54.145 + BufferedReader buf = new BufferedReader(r);
54.146 + String line;
54.147 + int lineNumber = 0;
54.148 + while ((line = buf.readLine()) != null) {
54.149 + lineNumber++;
54.150 + if (line.startsWith("/")) {
54.151 + line = line.substring(1);
54.152 + int idx = line.indexOf('/');
54.153 + String name = line.substring(0, idx);
54.154 + idx = line.lastIndexOf('/');
54.155 + line = line.substring(0, idx);
54.156 + idx = line.lastIndexOf('/');
54.157 + String subst = line.substring(idx + 1);
54.158 + if (subst.equals("")) {
54.159 + tb[0].add(name);
54.160 + } else if (subst.equals("-kb")) {
54.161 + tb[1].add(name);
54.162 + } else {
54.163 + /* Don't know why, but getProject() stoped working, returns null :-(
54.164 + getProject().log(efile + ":" + lineNumber + ": warning: strange key subst mode: " + subst, Project.MSG_WARN);
54.165 + */
54.166 + if (subst.equals("-ko")) {
54.167 + // Treat it like -kkv.
54.168 + tb[0].add(name);
54.169 + }
54.170 + }
54.171 + }
54.172 + }
54.173 + } finally {
54.174 + r.close();
54.175 + }
54.176 + } catch (IOException ioe) {
54.177 + throw new BuildException("While reading " + efile, ioe);
54.178 + }
54.179 + } else {
54.180 + tb = NO_ENTRIES;
54.181 + }
54.182 + entries.put(dir, tb);
54.183 + }
54.184 + return tb;
54.185 + }
54.186 +
54.187 + protected boolean couldHoldIncluded(String name) {
54.188 + if (! super.couldHoldIncluded(name)) return false;
54.189 + // Do not look into CVS meta directories.
54.190 + return ! name.endsWith(File.separatorChar + "CVS");
54.191 + }
54.192 +
54.193 + }
54.194 +
54.195 +}
55.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
55.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/ForEach.java Wed Feb 23 20:12:58 2011 -0500
55.3 @@ -0,0 +1,225 @@
55.4 +/*
55.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
55.6 + *
55.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
55.8 + *
55.9 + * The contents of this file are subject to the terms of either the GNU
55.10 + * General Public License Version 2 only ("GPL") or the Common
55.11 + * Development and Distribution License("CDDL") (collectively, the
55.12 + * "License"). You may not use this file except in compliance with the
55.13 + * License. You can obtain a copy of the License at
55.14 + * http://www.netbeans.org/cddl-gplv2.html
55.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
55.16 + * specific language governing permissions and limitations under the
55.17 + * License. When distributing the software, include this License Header
55.18 + * Notice in each file and include the License file at
55.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
55.20 + * particular file as subject to the "Classpath" exception as provided
55.21 + * by Sun in the GPL Version 2 section of the License file that
55.22 + * accompanied this code. If applicable, add the following below the
55.23 + * License Header, with the fields enclosed by brackets [] replaced by
55.24 + * your own identifying information:
55.25 + * "Portions Copyrighted [year] [name of copyright owner]"
55.26 + *
55.27 + * Contributor(s):
55.28 + *
55.29 + * The Original Software is NetBeans. The Initial Developer of the Original
55.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
55.31 + * Microsystems, Inc. All Rights Reserved.
55.32 + *
55.33 + * If you wish your version of this file to be governed by only the CDDL
55.34 + * or only the GPL Version 2, indicate your decision by adding
55.35 + * "[Contributor] elects to include this software in this distribution
55.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
55.37 + * single choice of license, a recipient has the option to distribute
55.38 + * your version of this file under either the CDDL, the GPL Version 2 or
55.39 + * to extend the choice of license to its licensees as provided above.
55.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
55.41 + * Version 2 license, then the option applies only if the new code is
55.42 + * made subject to such option by the copyright holder.
55.43 + */
55.44 +// This file was copied from daning.sfbay:/cvs/darkhorse/nbbuild/antsrc and modified
55.45 +
55.46 +package org.netbeans.modules.visualweb.ravebuild;
55.47 +
55.48 +import java.io.File;
55.49 +import java.util.*;
55.50 +
55.51 +import org.apache.tools.ant.BuildException;
55.52 +import org.apache.tools.ant.taskdefs.Ant;
55.53 +import org.apache.tools.ant.taskdefs.Property;
55.54 +
55.55 +/**
55.56 + * For each specified location call ant task with specified target name.
55.57 + * If target name is not specified than name of current target is used.
55.58 + *
55.59 + * @author Libor Kramolis
55.60 + */
55.61 +public class ForEach extends Ant {
55.62 + private static final boolean DEBUG = false;
55.63 + private static final boolean ECHO = true;
55.64 +
55.65 + private List locations; // List<String>
55.66 + private String startdir;
55.67 + private boolean skipNonExistentDir = false;
55.68 + private Vector properties = new Vector();
55.69 + private String suffix;
55.70 +
55.71 + //
55.72 + // init
55.73 + //
55.74 +
55.75 + public ForEach () {
55.76 + locations = new Vector();
55.77 + }
55.78 +
55.79 + //
55.80 + // itself
55.81 + //
55.82 +
55.83 + /** Comma separated list of locations. */
55.84 + public void setLocations (String s) {
55.85 + if ( DEBUG ) log ("SET locations = " + s);
55.86 +
55.87 + StringTokenizer tok = new StringTokenizer (s, ",:");
55.88 + locations = new Vector ();
55.89 + while ( tok.hasMoreTokens() ) {
55.90 + locations.add (tok.nextToken().trim());
55.91 + }
55.92 + }
55.93 +
55.94 + //override setDir() to noop
55.95 + public void setDir() {}
55.96 +
55.97 + private String target;
55.98 + public String getTarget() {
55.99 + return target;
55.100 + }
55.101 + public void setTarget(String v) {
55.102 + target = v;
55.103 + }
55.104 +
55.105 + private boolean inheritAll;
55.106 + public boolean getInheritAll() {
55.107 + return inheritAll;
55.108 + }
55.109 + public void setInheritAll(boolean v) {
55.110 + inheritAll = v;
55.111 + }
55.112 +
55.113 + /**
55.114 + * Support nested property elements
55.115 + */
55.116 + public void addProperty (Property p) {
55.117 + properties.add(p);
55.118 + }
55.119 +
55.120 + /** Where cd first
55.121 + */
55.122 + public void setStartdir (String s) {
55.123 + if ( DEBUG ) log ("SET startdir = " + s);
55.124 +
55.125 + startdir = s;
55.126 + }
55.127 +
55.128 + public void setSuffix(String s) {
55.129 + suffix = s;
55.130 + }
55.131 +
55.132 + public void setSkipNonExistentDir(boolean v) {
55.133 + skipNonExistentDir = v;
55.134 + }
55.135 + public boolean getSkipNonExistentDir() {
55.136 + return skipNonExistentDir;
55.137 + }
55.138 +
55.139 + /** Execute this task. */
55.140 + public void execute () throws BuildException {
55.141 + if (locations.isEmpty()) {
55.142 + if (skipNonExistentDir) {
55.143 + if ( DEBUG ) {
55.144 + log ("for-each: No locations no loops!");
55.145 + }
55.146 + return;
55.147 + } else {
55.148 + throw new BuildException("You must set at least one location!", getLocation());
55.149 + }
55.150 + }
55.151 +
55.152 + if ( getTarget() == null ) {
55.153 + setTarget(this.getOwningTarget().getName());
55.154 +
55.155 + if ( DEBUG ) log ("EXECUTE owningTarget = " + this.getOwningTarget());
55.156 + }
55.157 + File baseDir;
55.158 + if ( startdir == null ) {
55.159 + baseDir = getProject().getBaseDir();
55.160 + } else {
55.161 + baseDir = new File(getProject().getBaseDir(), startdir);
55.162 + }
55.163 +
55.164 + Iterator it = locations.iterator();
55.165 + while ( it.hasNext() ) {
55.166 + String dirName = (String) it.next();
55.167 +
55.168 + if ( ECHO ) log ("Process '" + dirName + "' location with '" + target + "' target ...");
55.169 +
55.170 + File dir = new File (baseDir, dirName);
55.171 +
55.172 + if (suffix != null) {
55.173 + dir = new File(dir, suffix);
55.174 + }
55.175 +
55.176 + File buildXml = new File(dir, "build.xml");
55.177 + if (! buildXml.exists() && skipNonExistentDir) {
55.178 + if ( DEBUG ) log ("Skipped non-existent " + dir.getAbsolutePath());
55.179 + continue;
55.180 + }
55.181 +
55.182 + String location = (new File(dir, "build.xml")).getAbsolutePath();
55.183 + Ant ant = (Ant) getProject().createTask("ant");
55.184 + ant.init();
55.185 + ant.setLocation(getLocation());
55.186 + ant.setAntfile(location);
55.187 + ant.setTarget (getTarget());
55.188 + ant.setInheritAll(getInheritAll());
55.189 + if (getPropertyName() != null && getPropertyValue() != null) {
55.190 + org.apache.tools.ant.taskdefs.Property p = ant.createProperty();
55.191 + p.setName(getPropertyName());
55.192 + p.setValue(getPropertyValue());
55.193 + }
55.194 +
55.195 + for (int i = 0; i < properties.size(); i++) {
55.196 + Property p = (Property) properties.get(i);
55.197 + Property antProp = ant.createProperty();
55.198 + antProp.setName(p.getName());
55.199 + antProp.setValue(p.getValue());
55.200 + }
55.201 +
55.202 + if ( DEBUG ) log ("--> next [ " + target + " ] " + dir.getAbsolutePath());
55.203 +
55.204 + ant.execute();
55.205 + }
55.206 +
55.207 + }
55.208 + public void handleErrorOutput(String output) {
55.209 + log(output);
55.210 + }
55.211 +
55.212 + private String propertyName;
55.213 + private String propertyValue;
55.214 +
55.215 + public String getPropertyName() {
55.216 + return propertyName;
55.217 + }
55.218 + public void setPropertyName(String name) {
55.219 + propertyName = name;
55.220 + }
55.221 + public String getPropertyValue() {
55.222 + return propertyValue;
55.223 + }
55.224 + public void setPropertyValue(String v) {
55.225 + propertyValue = v;
55.226 + }
55.227 +
55.228 +}
56.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
56.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/ForEachXsl.java Wed Feb 23 20:12:58 2011 -0500
56.3 @@ -0,0 +1,169 @@
56.4 +/*
56.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
56.6 + *
56.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
56.8 + *
56.9 + * The contents of this file are subject to the terms of either the GNU
56.10 + * General Public License Version 2 only ("GPL") or the Common
56.11 + * Development and Distribution License("CDDL") (collectively, the
56.12 + * "License"). You may not use this file except in compliance with the
56.13 + * License. You can obtain a copy of the License at
56.14 + * http://www.netbeans.org/cddl-gplv2.html
56.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
56.16 + * specific language governing permissions and limitations under the
56.17 + * License. When distributing the software, include this License Header
56.18 + * Notice in each file and include the License file at
56.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
56.20 + * particular file as subject to the "Classpath" exception as provided
56.21 + * by Sun in the GPL Version 2 section of the License file that
56.22 + * accompanied this code. If applicable, add the following below the
56.23 + * License Header, with the fields enclosed by brackets [] replaced by
56.24 + * your own identifying information:
56.25 + * "Portions Copyrighted [year] [name of copyright owner]"
56.26 + *
56.27 + * Contributor(s):
56.28 + *
56.29 + * The Original Software is NetBeans. The Initial Developer of the Original
56.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
56.31 + * Microsystems, Inc. All Rights Reserved.
56.32 + *
56.33 + * If you wish your version of this file to be governed by only the CDDL
56.34 + * or only the GPL Version 2, indicate your decision by adding
56.35 + * "[Contributor] elects to include this software in this distribution
56.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
56.37 + * single choice of license, a recipient has the option to distribute
56.38 + * your version of this file under either the CDDL, the GPL Version 2 or
56.39 + * to extend the choice of license to its licensees as provided above.
56.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
56.41 + * Version 2 license, then the option applies only if the new code is
56.42 + * made subject to such option by the copyright holder.
56.43 + */
56.44 +
56.45 +/*
56.46 + * ForEachXsl.java
56.47 + *
56.48 + * Created on November 14, 2006, 4:56 PM
56.49 + *
56.50 + * To change this template, choose Tools | Template Manager
56.51 + * and open the template in the editor.
56.52 + */
56.53 +
56.54 +package org.netbeans.modules.visualweb.ravebuild;
56.55 +
56.56 +import java.io.BufferedReader;
56.57 +import java.io.BufferedWriter;
56.58 +import java.io.File;
56.59 +import java.io.FileReader;
56.60 +import java.io.FileWriter;
56.61 +import java.io.IOException;
56.62 +import java.util.Iterator;
56.63 +import java.util.StringTokenizer;
56.64 +import java.util.Vector;
56.65 +import org.apache.tools.ant.BuildException;
56.66 +import org.apache.tools.ant.Project;
56.67 +import org.apache.tools.ant.taskdefs.Ant;
56.68 +
56.69 +/**
56.70 + *
56.71 + * @author qn145415
56.72 + */
56.73 +public class ForEachXsl extends Ant {
56.74 + private Vector locations;
56.75 + private String startdir;
56.76 + private String suffix;
56.77 +
56.78 + /** Creates a new instance of ForEachXsl */
56.79 + public ForEachXsl() {
56.80 + locations = new Vector();
56.81 + }
56.82 +
56.83 + /** Comma separated list of locations. */
56.84 + public void setLocations (String s) {
56.85 + StringTokenizer tok = new StringTokenizer (s, ",:");
56.86 + locations = new Vector ();
56.87 + while ( tok.hasMoreTokens() ) {
56.88 + locations.add (tok.nextToken().trim());
56.89 + }
56.90 + }
56.91 +
56.92 + public void setSuffix(String s) {
56.93 + suffix = s;
56.94 + }
56.95 +
56.96 + public void setStartdir (String s) {
56.97 + startdir = s;
56.98 + }
56.99 +
56.100 + /** Execute this task. */
56.101 + public void execute () throws BuildException {
56.102 + if (locations.isEmpty()) {
56.103 + throw new BuildException("You must set at least one location!", getLocation());
56.104 + }
56.105 +
56.106 + File baseDir;
56.107 + if ( startdir == null ) {
56.108 + baseDir = getProject().getBaseDir();
56.109 + } else {
56.110 + baseDir = new File(getProject().getBaseDir(), startdir);
56.111 + }
56.112 +
56.113 + Iterator it = locations.iterator();
56.114 + String construct = " <import file=\"${suite.dir}/templates/common.xml\"/>";
56.115 + while ( it.hasNext() ) {
56.116 + String dirName = (String) it.next();
56.117 +
56.118 + File dir = new File (baseDir, dirName);
56.119 +
56.120 + if (suffix != null) {
56.121 + dir = new File(dir, suffix);
56.122 + }
56.123 +
56.124 + File buildXml = new File(dir, "build.xml");
56.125 + if (! buildXml.exists()) {
56.126 + log("Build file not found - " + buildXml.getAbsolutePath(), Project.MSG_ERR);
56.127 + continue;
56.128 + }
56.129 +
56.130 + try {
56.131 + BufferedReader br = new BufferedReader(new FileReader(buildXml));
56.132 + Vector lines = new Vector();
56.133 + boolean next = false;
56.134 + boolean found = false;
56.135 + boolean dirty = true;
56.136 + while (br.ready()) {
56.137 + String nextline = br.readLine();
56.138 +
56.139 + if (next == true) {
56.140 + next = false;
56.141 + if (nextline.indexOf(construct.trim()) == -1) {
56.142 + lines.add(construct);
56.143 + }
56.144 + }
56.145 +
56.146 + lines.add(nextline);
56.147 + if (found == false && nextline.indexOf("<import file=\"nbproject/build-impl.xml\"/>") != -1) {
56.148 + next = true;
56.149 + found = true;
56.150 + }else if (nextline.indexOf(construct.trim()) != -1) {
56.151 + dirty = false;
56.152 + break;
56.153 + }
56.154 + }
56.155 + br.close();
56.156 + if (dirty) {
56.157 + BufferedWriter writer = new BufferedWriter(new FileWriter(buildXml));
56.158 + for (int i = 0; i < lines.size(); i++) {
56.159 + writer.write((String)lines.get(i));
56.160 + writer.newLine();
56.161 + }
56.162 + writer.close();
56.163 + }
56.164 + }catch (IOException ex) {
56.165 + throw new BuildException("Unable to modify build.xml files", ex);
56.166 + }
56.167 +
56.168 + }
56.169 +
56.170 + }
56.171 +
56.172 +}
57.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
57.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/GetLocalizableFiles.java Wed Feb 23 20:12:58 2011 -0500
57.3 @@ -0,0 +1,254 @@
57.4 +/*
57.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
57.6 + *
57.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
57.8 + *
57.9 + * The contents of this file are subject to the terms of either the GNU
57.10 + * General Public License Version 2 only ("GPL") or the Common
57.11 + * Development and Distribution License("CDDL") (collectively, the
57.12 + * "License"). You may not use this file except in compliance with the
57.13 + * License. You can obtain a copy of the License at
57.14 + * http://www.netbeans.org/cddl-gplv2.html
57.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
57.16 + * specific language governing permissions and limitations under the
57.17 + * License. When distributing the software, include this License Header
57.18 + * Notice in each file and include the License file at
57.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
57.20 + * particular file as subject to the "Classpath" exception as provided
57.21 + * by Sun in the GPL Version 2 section of the License file that
57.22 + * accompanied this code. If applicable, add the following below the
57.23 + * License Header, with the fields enclosed by brackets [] replaced by
57.24 + * your own identifying information:
57.25 + * "Portions Copyrighted [year] [name of copyright owner]"
57.26 + *
57.27 + * Contributor(s):
57.28 + *
57.29 + * The Original Software is NetBeans. The Initial Developer of the Original
57.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
57.31 + * Microsystems, Inc. All Rights Reserved.
57.32 + *
57.33 + * If you wish your version of this file to be governed by only the CDDL
57.34 + * or only the GPL Version 2, indicate your decision by adding
57.35 + * "[Contributor] elects to include this software in this distribution
57.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
57.37 + * single choice of license, a recipient has the option to distribute
57.38 + * your version of this file under either the CDDL, the GPL Version 2 or
57.39 + * to extend the choice of license to its licensees as provided above.
57.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
57.41 + * Version 2 license, then the option applies only if the new code is
57.42 + * made subject to such option by the copyright holder.
57.43 + */
57.44 +
57.45 +package org.netbeans.modules.visualweb.ravebuild;
57.46 +
57.47 +import org.apache.tools.ant.*;
57.48 +import org.apache.tools.ant.util.*;
57.49 +import org.apache.tools.ant.taskdefs.*;
57.50 +import org.apache.tools.ant.types.FileSet;
57.51 +import java.io.*;
57.52 +import java.util.*;
57.53 +
57.54 +/** This task copies the localizable files to a directory.
57.55 + * This task uses the L10nTask's getLocalizableFiles() function
57.56 + * to get the list of localizable files for each module.
57.57 + */
57.58 +public class GetLocalizableFiles extends Task {
57.59 +
57.60 + /** The name of file that contains the localizable file
57.61 + * regular expressions.
57.62 + * <p>Default: <samp>l10n.list</samp>
57.63 + */
57.64 + protected String listFile = "l10n.list";
57.65 +
57.66 + /** The grandparent directory of the l10n.list files.
57.67 + * <p>Default: <samp>..</samp>
57.68 + */
57.69 + protected String baseDir = "..";
57.70 + protected File grandParent = null ;
57.71 +
57.72 + /** The target directory to copy all translatable files to.
57.73 + * <p>Default: <samp>src-todo</samp>
57.74 + */
57.75 + protected File targetDir = null ;
57.76 +
57.77 + /** List of exclude patterns that override the listFiles.
57.78 + * <p>Default: Ja localized files
57.79 + */
57.80 + protected String excludes = "**/ja/,**/*_ja.*" ;
57.81 +
57.82 + /** Used internally. */
57.83 + protected FileUtils fileUtils = null ;
57.84 +
57.85 + protected boolean moduleList = true ;
57.86 + protected String localizable_modules = "";
57.87 +
57.88 + public void setBaseDir(String s) {
57.89 + File f ;
57.90 +
57.91 + baseDir = s;
57.92 + f = new File( antBaseDir() + baseDir) ;
57.93 + try {
57.94 + grandParent = new File( f.getCanonicalPath()) ;
57.95 + }
57.96 + catch( Exception e) {
57.97 + e.printStackTrace();
57.98 + throw new BuildException() ;
57.99 + }
57.100 + }
57.101 + public void setListFile( String s) {
57.102 + listFile = s ;
57.103 + }
57.104 + public void setTargetDir( File f) {
57.105 + targetDir = f ;
57.106 + }
57.107 + public void setExcludes( String s) {
57.108 + excludes = s ;
57.109 + }
57.110 + public void setModuleList( boolean doit) {
57.111 + moduleList = doit ;
57.112 + }
57.113 +
57.114 + /** A file filter that accepts only directories
57.115 + */
57.116 + class DirectoryFilter implements FileFilter {
57.117 + public boolean accept(File f) {
57.118 + return( f.isDirectory()) ;
57.119 + }
57.120 + }
57.121 +
57.122 + class TarFileFilter implements FileFilter {
57.123 + public boolean accept(File f) {
57.124 + return( f.getName().endsWith( ".tar")) ;
57.125 + }
57.126 + }
57.127 +
57.128 + public void execute() throws BuildException {
57.129 + File module ;
57.130 + LinkedList modules ;
57.131 + ListIterator iter ;
57.132 +
57.133 + if( targetDir == null) {
57.134 + targetDir = new File( antBaseDir() + "src-todo") ;
57.135 + }
57.136 +
57.137 + // If needed, setup the grandParent variable. //
57.138 + if( grandParent == null) {
57.139 + setBaseDir( baseDir) ;
57.140 + }
57.141 +
57.142 + // For each module with a list file. //
57.143 + modules = getModulesWithListFiles() ;
57.144 + iter = modules.listIterator() ;
57.145 + while( iter.hasNext()) {
57.146 + module = (File) iter.next() ;
57.147 +
57.148 + // Copy the module's localizable files. //
57.149 + copyL9eFiles( module) ;
57.150 +
57.151 + if (moduleList) {
57.152 + localizable_modules = module.getName() + "," + localizable_modules;
57.153 + }
57.154 + }
57.155 + getProject().setNewProperty("allmodules", localizable_modules);
57.156 + }
57.157 +
57.158 + protected void copyL9eFiles( File module) {
57.159 + String[] l9eFiles, changedFiles ;
57.160 + int i ;
57.161 + File fromFile, toFile ;
57.162 + L10nTask l10nTask ;
57.163 +
57.164 + // Setup the file utils. //
57.165 + if( fileUtils == null) {
57.166 + fileUtils = FileUtils.newFileUtils() ;
57.167 + }
57.168 +
57.169 + // Use the l10n task to read the list file and get a list of the //
57.170 + // localizable files. //
57.171 + getProject().addTaskDefinition("l10nTask", L10nTask.class);
57.172 + l10nTask = (L10nTask) getProject().createTask("l10nTask");
57.173 + l10nTask.init() ;
57.174 + l10nTask.setLocalizableFile( listFile) ;
57.175 + l10nTask.setExcludePattern( excludes) ;
57.176 + l9eFiles = l10nTask.getLocalizableFiles( grandParent, module.getName()) ;
57.177 + if( l9eFiles != null) {
57.178 +
57.179 + // Get a list of the files that have changed. //
57.180 + changedFiles = getChangedFiles( l9eFiles) ;
57.181 +
57.182 + // Copy the localizable files that have changed. //
57.183 + if( changedFiles != null && changedFiles.length > 0) {
57.184 + log( "Copying " + changedFiles.length + " files to " + targetDir.getPath()) ;
57.185 + for( i = 0; i < changedFiles.length; i++) {
57.186 + fromFile = new File( changedFiles[i]) ;
57.187 + toFile = new File( mapL9eFile( changedFiles[i],
57.188 + targetDir.getPath(),
57.189 + grandParent.getPath())) ;
57.190 + try {
57.191 + //log("Copying " + fromFile.getPath() + " to " + toFile.getPath()) ;
57.192 + fileUtils.copyFile( fromFile, toFile) ;
57.193 + } catch (IOException ioe) {
57.194 + String msg = "Failed to copy " + fromFile.getPath() + " to " +
57.195 + toFile.getPath() + " due to " + ioe.getMessage();
57.196 + throw new BuildException(msg, ioe, getLocation());
57.197 + }
57.198 + }
57.199 + }
57.200 + }
57.201 + }
57.202 +
57.203 + protected String[] getChangedFiles( String[] files) {
57.204 + L9eMapper mapper = new L9eMapper() ;
57.205 + mapper.setFrom( grandParent.getPath()) ;
57.206 + mapper.setTo( targetDir.getPath()) ;
57.207 +
57.208 + SourceFileScanner ds = new SourceFileScanner( this);
57.209 + return( ds.restrict( files, null, null, mapper)) ;
57.210 + }
57.211 +
57.212 + protected class L9eMapper implements FileNameMapper {
57.213 +
57.214 + protected String m_grandParent ;
57.215 + protected String m_toDir ;
57.216 +
57.217 + public void setFrom(String from) {
57.218 + m_grandParent = from ;
57.219 + }
57.220 +
57.221 + public void setTo(String to) {
57.222 + m_toDir = to ;
57.223 + }
57.224 +
57.225 + // Returns an one-element array containing the destination file //
57.226 + // name. //
57.227 + public String[] mapFileName(String file) {
57.228 + return new String[] { GetLocalizableFiles.mapL9eFile( file, m_toDir, m_grandParent) } ;
57.229 + }
57.230 + }
57.231 +
57.232 + protected static String mapL9eFile( String file, String toDir,
57.233 + String grandParentName) {
57.234 + return toDir + file.substring( grandParentName.length()) ;
57.235 + }
57.236 +
57.237 + protected LinkedList getModulesWithListFiles() {
57.238 + File module, list ;
57.239 + File[] parents ;
57.240 + LinkedList modules = new LinkedList() ;
57.241 + int i ;
57.242 +
57.243 + parents = grandParent.listFiles( new DirectoryFilter()) ;
57.244 + for( i = 0; i < parents.length; i++) {
57.245 + module = parents[ i] ;
57.246 + list = new File( module.getPath() + File.separator + listFile) ;
57.247 + if( list.exists()) {
57.248 + modules.add( module) ;
57.249 + }
57.250 + }
57.251 + return( modules) ;
57.252 + }
57.253 +
57.254 + protected String antBaseDir() {
57.255 + return( getProject().getBaseDir().getAbsolutePath() + File.separator) ;
57.256 + }
57.257 +}
58.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
58.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/JHIndexer.java Wed Feb 23 20:12:58 2011 -0500
58.3 @@ -0,0 +1,408 @@
58.4 +/*
58.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
58.6 + *
58.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
58.8 + *
58.9 + * The contents of this file are subject to the terms of either the GNU
58.10 + * General Public License Version 2 only ("GPL") or the Common
58.11 + * Development and Distribution License("CDDL") (collectively, the
58.12 + * "License"). You may not use this file except in compliance with the
58.13 + * License. You can obtain a copy of the License at
58.14 + * http://www.netbeans.org/cddl-gplv2.html
58.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
58.16 + * specific language governing permissions and limitations under the
58.17 + * License. When distributing the software, include this License Header
58.18 + * Notice in each file and include the License file at
58.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
58.20 + * particular file as subject to the "Classpath" exception as provided
58.21 + * by Sun in the GPL Version 2 section of the License file that
58.22 + * accompanied this code. If applicable, add the following below the
58.23 + * License Header, with the fields enclosed by brackets [] replaced by
58.24 + * your own identifying information:
58.25 + * "Portions Copyrighted [year] [name of copyright owner]"
58.26 + *
58.27 + * Contributor(s):
58.28 + *
58.29 + * The Original Software is NetBeans. The Initial Developer of the Original
58.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
58.31 + * Microsystems, Inc. All Rights Reserved.
58.32 + *
58.33 + * If you wish your version of this file to be governed by only the CDDL
58.34 + * or only the GPL Version 2, indicate your decision by adding
58.35 + * "[Contributor] elects to include this software in this distribution
58.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
58.37 + * single choice of license, a recipient has the option to distribute
58.38 + * your version of this file under either the CDDL, the GPL Version 2 or
58.39 + * to extend the choice of license to its licensees as provided above.
58.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
58.41 + * Version 2 license, then the option applies only if the new code is
58.42 + * made subject to such option by the copyright holder.
58.43 + */
58.44 +
58.45 +package org.netbeans.modules.visualweb.ravebuild;
58.46 +
58.47 +import java.io.*;
58.48 +import java.lang.reflect.*;
58.49 +import java.util.*;
58.50 +
58.51 +import org.apache.tools.ant.AntClassLoader;
58.52 +import org.apache.tools.ant.BuildException;
58.53 +import org.apache.tools.ant.DirectoryScanner;
58.54 +import org.apache.tools.ant.FileScanner;
58.55 +import org.apache.tools.ant.Project;
58.56 +import org.apache.tools.ant.taskdefs.Copy;
58.57 +import org.apache.tools.ant.taskdefs.Delete;
58.58 +import org.apache.tools.ant.taskdefs.Java;
58.59 +import org.apache.tools.ant.taskdefs.MatchingTask;
58.60 +import org.apache.tools.ant.taskdefs.Mkdir;
58.61 +import org.apache.tools.ant.taskdefs.Move;
58.62 +import org.apache.tools.ant.types.FileSet;
58.63 +import org.apache.tools.ant.types.Mapper;
58.64 +import org.apache.tools.ant.types.Path;
58.65 +
58.66 +// ToDo:
58.67 +// stopwords configuration
58.68 +// verbose mode
58.69 +
58.70 +/** Task to run JavaHelp search indexer.
58.71 + * Creates the proper binary search database from source HTML.
58.72 + * @author Jesse Glick
58.73 + * @see <a href="http://java.sun.com/products/javahelp/">JavaHelp home page</a>
58.74 + */
58.75 +public class JHIndexer extends MatchingTask {
58.76 +
58.77 + private Path classpath;
58.78 + private File db;
58.79 + private File basedir;
58.80 + private String locale;
58.81 + private List brandings = new LinkedList(); // List<BrandedFileSet>
58.82 +
58.83 + /** Set the location of <samp>jhall.jar</samp> or <samp>jsearch.jar</samp> (JavaHelp tools library). */
58.84 + public Path createClasspath() {
58.85 + // JavaHelp release notes say jhtools.jar is enough, but class NoClassDefFoundError
58.86 + // on javax.help.search.IndexBuilder when I tried it...
58.87 + if (classpath == null) {
58.88 + classpath = new Path(getProject());
58.89 + }
58.90 + return classpath.createPath();
58.91 + }
58.92 +
58.93 + /** Set the location of the output database.
58.94 + * E.g. <samp>JavaHelpSearch</samp>).
58.95 + * <strong>Warning:</strong> the directory will be deleted and recreated.
58.96 + */
58.97 + public void setDb (File db) {
58.98 + this.db = db;
58.99 + }
58.100 +
58.101 + /** Set the base directory from which to scan files.
58.102 + * This should be the directory containing the helpset for the database to work correctly.
58.103 + */
58.104 + public void setBasedir (File basedir) {
58.105 + this.basedir = basedir;
58.106 + }
58.107 + public void setLocale (String locale) {
58.108 + this.locale = locale;
58.109 + }
58.110 +
58.111 + /**
58.112 + * A set of additional files forming a branding variant.
58.113 + * @see #addBrandedFileSet
58.114 + */
58.115 + public static final class BrandedFileSet extends FileSet {
58.116 + String branding;
58.117 + public void setBranding(String b) {
58.118 + this.branding = b;
58.119 + }
58.120 + }
58.121 +
58.122 + /**
58.123 + * Add a set of branded files to be indexed.
58.124 + * For example, you may have in <samp>/the/base/dir</samp>
58.125 + * <ul>
58.126 + * <li><samp>foo.html</samp>
58.127 + * <li><samp>bar.html</samp>
58.128 + * <li><samp>baz.html</samp>
58.129 + * </ul>
58.130 + * Now create a new directory <samp>/the/new/dir</samp>:
58.131 + * <ul>
58.132 + * <li><samp>foo_brand.html</samp>
58.133 + * <li><samp>baz_brand.html</samp>
58.134 + * </ul>
58.135 + * If you include this with:
58.136 + * <pre>
58.137 +<jhindexer basedir="/the/base/dir">
58.138 + <include name="**/*.html"/>
58.139 + <brandedfileset dir="/the/new/dir" branding="brand">
58.140 + <include name="**/*.html"/>
58.141 + </brandedfileset>
58.142 +</jhindexer>
58.143 + * </pre>
58.144 + * then the search database will contain entries:
58.145 + * <table border="1">
58.146 + * <tr><th>JH name</th><th>From file</th></tr>
58.147 + * <tr><td><samp>foo.html</samp></td><td><samp>/the/new/dir/foo_brand.html</samp></td></tr>
58.148 + * <tr><td><samp>bar.html</samp></td><td><samp>/the/base/dir/bar.html</samp></td></tr>
58.149 + * <tr><td><samp>baz.html</samp></td><td><samp>/the/new/dir/baz_brand.html</samp></td></tr>
58.150 + * </table>
58.151 + * and every file in the database (<samp>TMAP</samp> etc.)
58.152 + * will receive the special suffix <samp>_brand</samp>.
58.153 + * <p>You may give multiple branding filesets, so long as the branding
58.154 + * tokens supplied are nested: i.e. for every pair of tokens among the supplied
58.155 + * filesets, one is a prefix of the other (with <samp>_</samp> being the
58.156 + * separator between the prefix and suffix). The search database suffix is then
58.157 + * an underscore followed by the longest branding token.
58.158 + * <p>Such a database is suitable for branding NetBeans: consider a module
58.159 + * with documentation entries such as the following:
58.160 + * <ul>
58.161 + * <li><samp>modules/docs/foo.jar!/some/pkg/foo/foo.html</samp>
58.162 + * <li><samp>modules/docs/foo.jar!/some/pkg/foo/bar.html</samp>
58.163 + * <li><samp>modules/docs/foo.jar!/some/pkg/foo/baz.html</samp>
58.164 + * <li><samp>modules/docs/foo.jar!/some/pkg/foo/JavaHelpSearch/TMAP</samp> (etc.)
58.165 + * <li><samp>modules/docs/locale/foo_brand.jar!/some/pkg/foo/foo_brand.html</samp>
58.166 + * <li><samp>modules/docs/locale/foo_brand.jar!/some/pkg/foo/baz_brand.html</samp>
58.167 + * <li><samp>modules/docs/locale/foo_brand.jar!/some/pkg/foo/JavaHelpSearch/TMAP_brand</samp> (etc.)
58.168 + * </ul>
58.169 + * where the files in <samp>modules/docs/foo.jar!/some/pkg/foo/JavaHelpSearch/</samp>
58.170 + * were generated by a regular invocation of this task and the files in
58.171 + * <samp>modules/docs/locale/foo_brand.jar!/some/pkg/foo/JavaHelpSearch/</samp>
58.172 + * were generated by the variant above. Then a help set reference using a URL such as
58.173 + * <samp>nbdocs:/some/pkg/foo/helpset.xml</samp> will, when running with branding
58.174 + * <samp>brand</samp>, not only display the expected variants of <samp>foo.html</samp>
58.175 + * and <samp>baz.html</samp>, but be able to search for strings specifically in them
58.176 + * (including correct offsets).
58.177 + * @see <a href="http://www.netbeans.org/issues/show_bug.cgi?id=31044">Issue #31044</a>
58.178 + */
58.179 + public void addBrandedFileSet(BrandedFileSet s) {
58.180 + brandings.add(s);
58.181 + }
58.182 +
58.183 + /** @deprecated Use {@link #createClasspath} instead. */
58.184 + public void setJhall(File f) {
58.185 + log("The 'jhall' attribute to <jhindexer> is deprecated. Use a nested <classpath> instead.", Project.MSG_WARN);
58.186 + createClasspath().setLocation(f);
58.187 + }
58.188 +
58.189 + /**
58.190 + *
58.191 + */
58.192 + public void setClassPath(Path cp) {
58.193 + classpath = cp;
58.194 + }
58.195 +
58.196 + public void execute () throws BuildException {
58.197 + if (classpath == null) throw new BuildException ("Must specify the classpath attribute to find jhall.jar or jsearch.jar");
58.198 + if (db == null) throw new BuildException ("Must specify the db attribute");
58.199 + if (basedir == null) throw new BuildException ("Must specify the basedir attribute");
58.200 + FileScanner scanner = getDirectoryScanner (basedir);
58.201 + scanner.scan ();
58.202 + String[] files = scanner.getIncludedFiles ();
58.203 + // First, an up-to-date check. ;-)
58.204 + if (basedir.exists () && db.exists ()) {
58.205 + long lastModified = Long.MIN_VALUE;
58.206 + // First scan output dir for any files.
58.207 + FileScanner output = new DirectoryScanner ();
58.208 + output.setBasedir (db);
58.209 + output.scan ();
58.210 + String[] outfiles = output.getIncludedFiles ();
58.211 + if (outfiles.length > 0) {
58.212 + for (int i = 0; i < outfiles.length; i++) {
58.213 + long mod = new File (db, outfiles[i]).lastModified ();
58.214 + if (mod > lastModified) {
58.215 + lastModified = mod;
58.216 + }
58.217 + }
58.218 + // Now check to see if any source files are newer.
58.219 + boolean ok = true;
58.220 + for (int i = 0; i < files.length; i++) {
58.221 + long mod = new File (basedir, files[i]).lastModified ();
58.222 + if (mod > lastModified) {
58.223 + ok = false;
58.224 + break;
58.225 + }
58.226 + }
58.227 + if (!brandings.isEmpty()) {
58.228 + // Check these too!
58.229 + Iterator it = brandings.iterator();
58.230 + while (it.hasNext()) {
58.231 + FileSet fs = (FileSet)it.next();
58.232 + FileScanner scanner2 = fs.getDirectoryScanner(getProject());
58.233 + String[] files2 = scanner2.getIncludedFiles();
58.234 + for (int i = 0; i < files2.length; i++) {
58.235 + long mod = new File (basedir, files2[i]).lastModified ();
58.236 + if (mod > lastModified) {
58.237 + ok = false;
58.238 + break;
58.239 + }
58.240 + }
58.241 + }
58.242 + }
58.243 + if (ok) {
58.244 + // No need to rebuild.
58.245 + return;
58.246 + }
58.247 + }
58.248 + }
58.249 + Delete delete = (Delete) getProject().createTask("delete");
58.250 + delete.setDir (db);
58.251 + delete.init ();
58.252 + delete.setLocation(getLocation());
58.253 + delete.execute ();
58.254 + Mkdir mkdir = (Mkdir) getProject().createTask("mkdir");
58.255 + mkdir.setDir (db);
58.256 + mkdir.init ();
58.257 + mkdir.setLocation(getLocation());
58.258 + mkdir.execute ();
58.259 + String maxbranding = null;
58.260 + if (!brandings.isEmpty()) {
58.261 + // Copy all files, overriding by branding, to a fresh dir somewhere.
58.262 + // Does not suffice to simply use IndexRemove to strip off the basedirs
58.263 + // of files in branded filesets, since their filenames will also include
58.264 + // the branding token, and this will mess up the search database: it needs
58.265 + // to store just the simple file name with no branding infix.
58.266 + File tmp = new File(System.getProperty("java.io.tmpdir"), "jhindexer-branding-merge");
58.267 + delete = (Delete) getProject().createTask("delete");
58.268 + delete.setDir(tmp);
58.269 + delete.init();
58.270 + delete.setLocation(getLocation());
58.271 + delete.execute();
58.272 + tmp.mkdir();
58.273 + // Start with the base files.
58.274 + Copy copy = (Copy) getProject().createTask("copy");
58.275 + copy.setTodir(tmp);
58.276 + copy.addFileset(fileset);
58.277 + copy.init();
58.278 + copy.setLocation(getLocation());
58.279 + copy.execute();
58.280 + // Now branded filesets. Must be done in order of branding, so that
58.281 + // more specific files override generic ones.
58.282 + class BrandingLengthComparator implements Comparator {
58.283 + public int compare(Object a, Object b) {
58.284 + return ((BrandedFileSet)a).branding.length() - ((BrandedFileSet)b).branding.length();
58.285 + }
58.286 + }
58.287 + Collections.sort(brandings, new BrandingLengthComparator());
58.288 + Iterator it = brandings.iterator();
58.289 + while (it.hasNext()) {
58.290 + BrandedFileSet s = (BrandedFileSet)it.next();
58.291 + if (maxbranding != null && !s.branding.startsWith(maxbranding + "_")) {
58.292 + throw new BuildException("Illegal branding: " + s.branding, getLocation());
58.293 + }
58.294 + maxbranding = s.branding; // only last one will be kept
58.295 + String[] suffixes = {
58.296 + ".html",
58.297 + ".htm",
58.298 + ".xhtml",
58.299 + // XXX any others? unpleasant to hardcode but this is easiest,
58.300 + // since glob mappers do not permit *_x* -> ** syntax.
58.301 + };
58.302 + for (int i = 0; i < suffixes.length; i++) {
58.303 + String suffix = suffixes[i];
58.304 + copy = (Copy) getProject().createTask("copy");
58.305 + copy.setTodir(tmp);
58.306 + copy.setOverwrite(true);
58.307 + copy.addFileset(s);
58.308 + Mapper m = copy.createMapper();
58.309 + Mapper.MapperType mt = new Mapper.MapperType();
58.310 + mt.setValue("glob");
58.311 + m.setType(mt);
58.312 + m.setFrom("*_" + s.branding + suffix);
58.313 + m.setTo("*" + suffix);
58.314 + copy.init();
58.315 + copy.setLocation(getLocation());
58.316 + copy.execute();
58.317 + if (locale != null) {
58.318 + // Possibly have e.g. x_f4j_ja.html.
58.319 + suffix = "_" + locale + suffix;
58.320 + copy = (Copy) getProject().createTask("copy");
58.321 + copy.setTodir(tmp);
58.322 + copy.setOverwrite(true);
58.323 + copy.addFileset(s);
58.324 + m = copy.createMapper();
58.325 + mt = new Mapper.MapperType();
58.326 + mt.setValue("glob");
58.327 + m.setType(mt);
58.328 + m.setFrom("*_" + s.branding + suffix);
58.329 + m.setTo("*" + suffix);
58.330 + copy.init();
58.331 + copy.setLocation(getLocation());
58.332 + copy.execute();
58.333 + }
58.334 + }
58.335 + }
58.336 + // Now replace basedir & files with this temp dir.
58.337 + basedir = tmp;
58.338 + FileSet tmpf = new FileSet();
58.339 + tmpf.setProject(getProject());
58.340 + tmpf.setDir(tmp);
58.341 + files = tmpf.getDirectoryScanner(getProject()).getIncludedFiles();
58.342 + }
58.343 + log ("Running JavaHelp search database indexer...");
58.344 + try {
58.345 + File config = File.createTempFile ("jhindexer-config", ".txt");
58.346 + try {
58.347 + OutputStream os = new FileOutputStream (config);
58.348 + try {
58.349 + PrintWriter pw = new PrintWriter (os);
58.350 + pw.println ("IndexRemove " + basedir + File.separator);
58.351 + String message = "Files to be indexed:";
58.352 + for (int i = 0; i < files.length; i++) {
58.353 + // [PENDING] JavaHelp docs say to use / as file sep for File directives;
58.354 + // so what should the complete path be? Someone should test this on Windoze...
58.355 + String path = basedir + File.separator + files[i];
58.356 + pw.println ("File " + path);
58.357 + message += "\n\t" + path;
58.358 + }
58.359 + log (message, Project.MSG_VERBOSE);
58.360 + pw.flush ();
58.361 + } finally {
58.362 + os.close ();
58.363 + }
58.364 + AntClassLoader loader = new AntClassLoader(getProject(), classpath);
58.365 + try {
58.366 + Class clazz = loader.loadClass ("com.sun.java.help.search.Indexer");
58.367 + Method main = clazz.getMethod ("main", new Class[] { String[].class });
58.368 + List args = Arrays.asList(new String[] {
58.369 + "-c", config.getAbsolutePath(),
58.370 + "-db", db.getAbsolutePath()
58.371 + });
58.372 + if (locale != null) {
58.373 + args = new ArrayList(args); // #35244
58.374 + args.add("-locale");
58.375 + args.add(locale);
58.376 + }
58.377 + main.invoke(null, new Object[] {args.toArray(new String[args.size()])});
58.378 + } catch (InvocationTargetException ite) {
58.379 + throw new BuildException("Could not run indexer", ite.getTargetException(), getLocation());
58.380 + } catch (Exception e) { // ClassNotFoundException, NoSuchMethodException, ...
58.381 + throw new BuildException("Could not run indexer", e, getLocation());
58.382 + }
58.383 + } finally {
58.384 + config.delete ();
58.385 + }
58.386 + } catch (IOException ioe) {
58.387 + throw new BuildException("Could not make temporary config file", ioe, getLocation());
58.388 + }
58.389 + if (maxbranding != null) {
58.390 + // Now rename search DB files to include branding suffix.
58.391 + // Note that DOCS.TAB -> DOCS_brand.TAB to work with nbdocs: protocol.
58.392 + String[] dbfiles = db.list();
58.393 + for (int i = 0; i < dbfiles.length; i++) {
58.394 + String basename, ext;
58.395 + int idx = dbfiles[i].lastIndexOf('.');
58.396 + if (idx != -1) {
58.397 + basename = dbfiles[i].substring(0, idx);
58.398 + ext = dbfiles[i].substring(idx);
58.399 + } else {
58.400 + basename = dbfiles[i];
58.401 + ext = "";
58.402 + }
58.403 + File old = new File(db, dbfiles[i]);
58.404 + File nue = new File(db, basename + "_" + maxbranding + ext);
58.405 + log("Moving " + old + " to " + nue, Project.MSG_VERBOSE);
58.406 + old.renameTo(nue);
58.407 + }
58.408 + }
58.409 + }
58.410 +
58.411 +}
59.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
59.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/L10nTask.java Wed Feb 23 20:12:58 2011 -0500
59.3 @@ -0,0 +1,817 @@
59.4 +/*
59.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
59.6 + *
59.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
59.8 + *
59.9 + * The contents of this file are subject to the terms of either the GNU
59.10 + * General Public License Version 2 only ("GPL") or the Common
59.11 + * Development and Distribution License("CDDL") (collectively, the
59.12 + * "License"). You may not use this file except in compliance with the
59.13 + * License. You can obtain a copy of the License at
59.14 + * http://www.netbeans.org/cddl-gplv2.html
59.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
59.16 + * specific language governing permissions and limitations under the
59.17 + * License. When distributing the software, include this License Header
59.18 + * Notice in each file and include the License file at
59.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
59.20 + * particular file as subject to the "Classpath" exception as provided
59.21 + * by Sun in the GPL Version 2 section of the License file that
59.22 + * accompanied this code. If applicable, add the following below the
59.23 + * License Header, with the fields enclosed by brackets [] replaced by
59.24 + * your own identifying information:
59.25 + * "Portions Copyrighted [year] [name of copyright owner]"
59.26 + *
59.27 + * Contributor(s):
59.28 + *
59.29 + * The Original Software is NetBeans. The Initial Developer of the Original
59.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
59.31 + * Microsystems, Inc. All Rights Reserved.
59.32 + *
59.33 + * If you wish your version of this file to be governed by only the CDDL
59.34 + * or only the GPL Version 2, indicate your decision by adding
59.35 + * "[Contributor] elects to include this software in this distribution
59.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
59.37 + * single choice of license, a recipient has the option to distribute
59.38 + * your version of this file under either the CDDL, the GPL Version 2 or
59.39 + * to extend the choice of license to its licensees as provided above.
59.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
59.41 + * Version 2 license, then the option applies only if the new code is
59.42 + * made subject to such option by the copyright holder.
59.43 + */
59.44 +
59.45 +/************************************************************************
59.46 +
59.47 + FILENAME: L10nTask.java
59.48 +
59.49 + AUTHOR: Erica Grevemeyer DATE: Jan 30 11:21:09 PST 2002
59.50 +
59.51 +************************************************************************/
59.52 +package org.netbeans.modules.visualweb.ravebuild;
59.53 +
59.54 +import org.apache.tools.ant.*;
59.55 +import org.apache.tools.ant.taskdefs.*;
59.56 +import org.apache.tools.ant.types.FileSet;
59.57 +import java.io.*;
59.58 +import java.util.*;
59.59 +import org.netbeans.modules.visualweb.ravebuild.utils.cvsutils.CvsEntries;
59.60 +
59.61 +/**
59.62 + * This task was created to create L10N kits.
59.63 + * The xml to call this task might look like:
59.64 + * <l10nTask topdirs="${f4jroot} ${nbroot}" modules="${all_modules}" localizableFile="${localizableF}" generatedFile="${genFile}" changedFile="${changedFile}" buildDir="${l10n-build}" distDir="${l10n-dist}" buildNumber="${buildnumber}"/>
59.65 + *
59.66 + *
59.67 + * Each resulting kit will be a tar file containing one directory
59.68 + * for each repository examined.
59.69 + * Each repository_directory will contain one tar-file
59.70 + * for each module with changed localizable files.
59.71 + * The structure of the tar file is as follows:
59.72 + * repository_dir/
59.73 + * module_tar/
59.74 + * generatedFile
59.75 + * contentFile
59.76 + * localizableFile1.html
59.77 + * localizableFile2.gif...
59.78 + *
59.79 + * 1. All localizable files (as defined in "localizableFile")
59.80 + * "localizableFile" is a list of file patterns difining all localizable source files.
59.81 + * "localizableFile" itself is not included in the kit.
59.82 + * 2. A content file (as named in "contentFile")
59.83 + * This is a list of the names of all localizable files which need to be (re)localized.
59.84 + * 3. A generated file (as named in "generatedFile")
59.85 + * This is a list of the names of all localizable files with the most recent
59.86 + * CVS revision number.
59.87 + *
59.88 + * The generated file need not be committed to cvs until the files come back
59.89 + * localized. (This is a change from the procedure followed in late 2001).
59.90 + *
59.91 + * As of version 1.1.2, converted Gzip methods to use ant 1.4.1, and added ability to
59.92 + * 1) embed exclude patterns in the l10n.list file
59.93 + * (must use keyword "exclude " followed by the pattern.)
59.94 + * 2) add ability to embed reading of additional files
59.95 + * (must use the keyword "read " followed by the path to the file)
59.96 + * The special case "read global" will read the file set by the property globalFile
59.97 + * 3) add the ability to embed properties in the patterns. i
59.98 + * The special case "l10n-module" property will be set from within L10nTask
59.99 + *
59.100 + * @author Erica Grevemeyer
59.101 + * @version 1.1, Feb 4 11:21:09 PST 2002
59.102 + * @version 1.1.2 Aug 29 15:23:51 PDT 2002
59.103 + */
59.104 +public class L10nTask extends MatchingTask {
59.105 + private String[] modules;
59.106 + private String[] topdirs;
59.107 + private String localizableFile, generatedFile, changedFile,globalFile;
59.108 + private String allFile = "l10n.list.all";
59.109 + private String excludePattern = "";
59.110 + private String includePattern = "";
59.111 + // Sets the set of exclude patterns.
59.112 + // Patterns may be separated by a comma or a space.
59.113 + // The first instance which necessitated this addition was
59.114 + // "**/ja/**"
59.115 + private String buildDir;
59.116 + private String distDir;
59.117 + private Vector error = new Vector();
59.118 + private Hashtable cvsEntriesCache=new Hashtable();
59.119 + private Hashtable changed = new Hashtable();
59.120 + private Hashtable generatedFileHash = new Hashtable();
59.121 + private Hashtable fullPropHash = null ;
59.122 +
59.123 + private Project p;
59.124 + private boolean readGlobalFile=false; //have we already read globalFile?
59.125 + private StringBuffer[] globalsbholder= new StringBuffer[2];
59.126 + static boolean DEBUG = false;
59.127 + boolean cont=false;
59.128 + private String buildNumber;
59.129 + String[] localizableFiles;
59.130 +
59.131 + public void execute() throws BuildException {
59.132 + // 1. Check that settable variables have been set.
59.133 + // If they have not been, abandon ship!
59.134 +
59.135 + if (modules == null ) {
59.136 + throw new BuildException("Required variable not set. Set 'modules' in the calling .xml file");
59.137 + }
59.138 + if (topdirs == null ) {
59.139 + throw new BuildException("Required variable not set. Set 'topdirs' in the calling .xml file");
59.140 + }
59.141 + if (distDir == null ) {
59.142 + throw new BuildException("Required variable not set. Set 'distDir' in the calling .xml file");
59.143 + }
59.144 +
59.145 + if (buildDir == null ) {
59.146 + throw new BuildException("Required variable not set. Set 'buildDir' in the calling .xml file");
59.147 + }
59.148 + if (localizableFile == null ) {
59.149 + throw new BuildException("Required variable not set. Set 'localizableFile' in the calling .xml file");
59.150 + }
59.151 + if (generatedFile == null ) {
59.152 + throw new BuildException("Required variable not set. Set 'generatedFile' in the calling .xml file");
59.153 + }
59.154 + if (changedFile == null ) {
59.155 + throw new BuildException("Required variable not set. Set 'changedFile' in the calling .xml file");
59.156 + }
59.157 + if (buildNumber == null ) {
59.158 + throw new BuildException("Required variable not set. Set 'buildNumber' in the calling .xml file");
59.159 + }
59.160 +
59.161 + //if the dir doesn't exist, make it.
59.162 + // if the dir still doesn't exist, fail.
59.163 + File dd = new File(distDir);
59.164 + if ( ! dd.exists() ) {
59.165 + dd.mkdirs();
59.166 + }
59.167 +
59.168 + System.out.print("topdirs:\t");
59.169 + for (int j=0; j<topdirs.length; j++) {
59.170 + System.out.print(topdirs[j]+"\t");
59.171 + }
59.172 +
59.173 + System.out.print("\nmodules:\t");
59.174 + for (int i=0; i<modules.length; i++) {
59.175 + System.out.print(modules[i]+"\t");
59.176 + }
59.177 +
59.178 + System.out.println("\ndistDir:\t"+distDir);
59.179 + System.out.println("buildDir:\t"+buildDir);
59.180 + System.out.println("localizableFile:\t"+localizableFile);
59.181 + System.out.println("generatedFile:\t"+generatedFile);
59.182 + System.out.println("changedFile:\t"+changedFile);
59.183 + System.out.println("globalFile:\t"+globalFile);
59.184 + System.out.println("buildNumber:\t"+buildNumber);
59.185 +
59.186 +
59.187 + CvsEntries ce;
59.188 +
59.189 + p=this.getProject();
59.190 +
59.191 + for (int i=0; i<topdirs.length; i++) {
59.192 + // if (DEBUG) System.out.println("STARTING TOPDIR "+topdirs[i]);
59.193 + for(int j=0; j<modules.length; j++) {
59.194 + if (modules[j] != null && ! modules[j].equals("")) {
59.195 + fullPropHash = p.getProperties();
59.196 +
59.197 + // System.out.println("IN FOR MODULES "+modules[j]);
59.198 + // System.out.println("\tSTARTING MODULE "+modules[j]);
59.199 +
59.200 + File f = new File(topdirs[i]+File.separator+modules[j]+File.separator+localizableFile);
59.201 + // System.out.println("Localizable file is: "+f.getAbsolutePath());
59.202 +
59.203 + if ( f.exists() ) {
59.204 + System.out.println("\t\tFILE exists"+topdirs[i]+File.separator+modules[j]+File.separator+localizableFile);
59.205 + File topDir = new File(topdirs[i]);
59.206 + File modDir = new File(topdirs[i]+File.separator+modules[j]);
59.207 +
59.208 + // moved getGeneratedFiles from here to only getGeneratedFiles
59.209 + // if there are localizableFiles.
59.210 +
59.211 + localizableFiles = getLocalizableFiles(topDir, modules[j]);
59.212 + if (localizableFiles == null ) {
59.213 + if (DEBUG) {
59.214 + System.out.println("\t\tNo Localizable Files for this module."+topDir+File.separator+modules[j]);
59.215 + }
59.216 + } else {
59.217 +
59.218 + //don't look for the generated Files if there are no localizableFiles
59.219 + generatedFileHash = getGeneratedFiles(topDir, modules[j]);
59.220 + //if ( generatedFileHash == null ) { System. out.println("\t\tGENFILEHASH is null"); }
59.221 +
59.222 + /* DO PRE PROCESSING
59.223 + int lastSlashIndex;
59.224 + String parentDirFullPath;
59.225 + String cacheDirFullPath;
59.226 + */
59.227 +
59.228 + for (int k=0; k<localizableFiles.length; k++) {
59.229 +
59.230 + // DO SOME PRE-PROCESSING HERE. CACHE DIR REACTION (don't check for existance of same dir over & over again).
59.231 +
59.232 +
59.233 + int lastSlashIndex = localizableFiles[k].lastIndexOf(File.separator);
59.234 + String parentDirFullPath = localizableFiles[k].substring(0, lastSlashIndex);
59.235 +
59.236 + // Check that the CVS/ dir exists.
59.237 + // If it does not, assume we are dealing with a generated dir
59.238 + // which does not need to be examined by me.
59.239 + if ( ! new File(parentDirFullPath+"/CVS").exists() ) {
59.240 + //System.out.println("CVSDIR doesn't exist ["+parentDirFullPath+"/CVS ]");
59.241 + // skip to the end of this loop
59.242 + //HEY! there must be a cleaner way!!
59.243 + System.out.println("This dir is a generated dir with no CVS dir "+parentDirFullPath);
59.244 +
59.245 + } else {
59.246 +
59.247 + // PRINT TO "allfiles" list.
59.248 + boolean success = printToAllFile(topdirs[i], modules[j], localizableFiles);
59.249 + if (! success) {
59.250 + System.out.println("ERROR: Print to All File in "+topdirs[i]+", "+modules[j]+"failed.");
59.251 +
59.252 + }
59.253 +
59.254 + ce = (CvsEntries)cvsEntriesCache.get(parentDirFullPath);
59.255 +
59.256 + if ( ce == null ) {
59.257 + ce = new CvsEntries(parentDirFullPath); //passing parentDirFullPath
59.258 + cvsEntriesCache.put(parentDirFullPath, ce);
59.259 + }
59.260 +
59.261 + if ( generatedFileHash == null ) {
59.262 + generatedFileHash=new Hashtable();
59.263 + }
59.264 +
59.265 +
59.266 + String localizableFileOnly = localizableFiles[k].substring(localizableFiles[k].lastIndexOf(File.separator)+1);
59.267 + if (localizableFileOnly == null) { System.out.println("NULL LOCALIZABLE FILE"); }
59.268 +
59.269 + String ceRev = ce.getRevnoByFileName(localizableFileOnly);
59.270 +
59.271 + if ( ceRev == null ) {
59.272 + // If this file is NOT in ce (doesn't exist in CVS/Entries)
59.273 + // there is something wrong with the build working directory.
59.274 + // We will collect these file names & report at the end.
59.275 +
59.276 + //Maybe we don't want to add them. THe build generates lots of files which aren't in CVS.
59.277 + // error.add(localizableFiles[k]);
59.278 +
59.279 + } else {
59.280 + // System.out.println("CEREV: "+ceRev);
59.281 + // compare revnos
59.282 +
59.283 + String genRev = (String)generatedFileHash.get(localizableFiles[k]);
59.284 + // if (DEBUG) System.out.println("GENREV "+genRev + "\tFN: "+localizableFiles[k]);
59.285 +
59.286 + if ( genRev == null || ! ceRev.equals(genRev)) {
59.287 + //Update changed fileHash
59.288 + changed.put(localizableFiles[k], ceRev);
59.289 +
59.290 +
59.291 + //Update generatedFileHash
59.292 + generatedFileHash.put(localizableFiles[k], ceRev);
59.293 +
59.294 +
59.295 + //if (DEBUG) System.out.println("I got this far, but there was nothing CHANGED: "+localizableFiles[k]);
59.296 + }
59.297 + }
59.298 + }
59.299 +
59.300 + } //for localizable files
59.301 +
59.302 + // IN HERE PRINT TO GENERATED FILE.
59.303 + boolean success = printToFile(topdirs[i], modules[j]);
59.304 +
59.305 +
59.306 + if (! success) {
59.307 + System.out.println("ERROR: Print to File in "+topdirs[i]+", "+modules[j]+"failed.");
59.308 + }
59.309 +
59.310 + // toDir should be build/topDir
59.311 + // baseDir should be fullpathtoTopDir
59.312 + // if (DEBUG) System.out.println("BUILDDIR "+buildDir);
59.313 + File tDir = new File(buildDir+File.separator+topdirs[i]);
59.314 + int lio = topdirs[i].lastIndexOf(File.separator);
59.315 + String shortTopdir = topdirs[i].substring(lio+1);
59.316 +
59.317 +
59.318 + // make a tar no matter what.
59.319 + // At a minimum it will have
59.320 + // file module.l10n.list.all.
59.321 + // THEN delete files.
59.322 +
59.323 + 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]);
59.324 + // if (! changed.isEmpty() ) {
59.325 + Delete delete = (Delete)p.createTask("delete");
59.326 + delete.setDir(new File(topdirs[i]+File.separator+modules[j]));
59.327 + FileSet fs = new FileSet();
59.328 + fs.setDir(new File(topdirs[i]+File.separator+modules[j]));
59.329 + String includes = modules[j]+"."+generatedFile+","+ modules[j]+"."+changedFile+","+ modules[j]+"."+allFile;
59.330 + fs.setIncludes(includes);
59.331 + delete.addFileset(fs);
59.332 +
59.333 + delete.setIncludes(includes);
59.334 + delete.setVerbose(true);
59.335 + delete.execute();
59.336 + //}
59.337 +
59.338 +
59.339 + // Clean up before moving on.
59.340 +
59.341 + // if (DEBUG) System.out.println("CLEARING "+topdirs[i] + " " + modules[j]);
59.342 + generatedFileHash.clear();
59.343 + changed.clear();
59.344 + error.clear();
59.345 +
59.346 + } // if File: topDirs[i]/modules[j]/localizableFile exists
59.347 + } // if localizableFiles is not null
59.348 + } // if module isn't null
59.349 + } //for module
59.350 + } //for topdirs
59.351 +
59.352 + // Tar everything
59.353 + if (DEBUG) System.out.println("ABOUT TO MAKE THE BIG TAR: "+distDir+"/l10n-"+buildNumber+".tar.gz");
59.354 +
59.355 + // Check to make sure that the build dir exists,
59.356 + // & that there are little tars to tar... or we get a "basedir dne"
59.357 + // exception.
59.358 +
59.359 + File bd = new File(buildDir);
59.360 + if (bd.exists()) {
59.361 + File tarFile = new File(buildDir+"/l10n-"+buildNumber+".tar");
59.362 +
59.363 + Tar tar = (Tar)p.createTask("tar");
59.364 + tar.setBasedir(bd);
59.365 + tar.setTarfile(tarFile);
59.366 + tar.setLongfile("gnu");
59.367 + ////// automatically includes all in the basedir
59.368 + tar.execute();
59.369 +
59.370 + if ( tarFile.exists() ) {
59.371 + GZip gzip = (GZip)p.createTask("gzip");
59.372 + gzip.setSrc(new File(buildDir+"/l10n-"+buildNumber+".tar"));
59.373 + gzip.setZipfile(new File(distDir+"/l10n-"+buildNumber+".tar.gz"));
59.374 + gzip.execute();
59.375 + } else {
59.376 + System.out.println("NO tar file, can't gzip"+buildDir+"/l10n-"+buildNumber+".tar");
59.377 + }
59.378 + } else {
59.379 + System.out.println("No files in builddir. No kit to build");
59.380 + }
59.381 +
59.382 +
59.383 +
59.384 +
59.385 + } // execute()
59.386 +
59.387 + public void mkTars(String srcDir, String fullTarfilePath, String fullIncludesFilePath, String module) {
59.388 + //String td = srcDir.substring(srcDir.lastIndexOf(File.separator)+1);
59.389 + if (DEBUG) {
59.390 + // System.out.println("SRCDIR = "+srcDir);
59.391 + //System.out.println("FULL TARFILE PATH = "+fullTarfilePath);
59.392 + }
59.393 +
59.394 + File incBaseDir = new File(srcDir);
59.395 + Tar tar = (Tar)p.createTask("tar");
59.396 + tar.setBasedir(new File(srcDir));
59.397 + tar.setTarfile(new File(fullTarfilePath));
59.398 +
59.399 + File incFile = new File(fullIncludesFilePath);
59.400 +
59.401 + if (incFile.exists() ) {
59.402 + tar.setIncludes(module+File.separator+module+"."+allFile);
59.403 + tar.setIncludes(module+File.separator+module+"."+generatedFile);
59.404 + tar.setIncludes(module+File.separator+module+"."+changedFile);
59.405 + tar.setIncludesfile(incFile);
59.406 + tar.setLongfile("gnu");
59.407 + tar.execute();
59.408 + }
59.409 +
59.410 + }
59.411 +
59.412 + public boolean printToAllFile(String fullTopDir, String module, String[] localizableFiles) {
59.413 + try {
59.414 + int lastSlashIndex = fullTopDir.lastIndexOf(File.separator);
59.415 + String topDir= fullTopDir.substring(lastSlashIndex+1);
59.416 +
59.417 + File f = new File(buildDir+ File.separator +topDir );
59.418 + f.mkdirs();
59.419 +
59.420 + FileWriter allWrite = new FileWriter(fullTopDir+File.separator+module+File.separator+module+"."+allFile);
59.421 +
59.422 + if ( localizableFiles != null ) {
59.423 + for (int i=0; i<localizableFiles.length; i++) {
59.424 + int lio = localizableFiles[i].lastIndexOf(fullTopDir);
59.425 + if (lio >= 0) {
59.426 + String moduleFileName= localizableFiles[i].substring(lio+fullTopDir.length()+1);
59.427 + allWrite.write(moduleFileName+"\n");
59.428 + } else {
59.429 + System.out.println("Error: NO TOPDIR HERE: "+ localizableFiles[i]+ " FTD: "+fullTopDir+" LIO "+lio);
59.430 + }
59.431 +
59.432 + }
59.433 + }
59.434 + allWrite.close();
59.435 +
59.436 + } catch (IOException ioe) {
59.437 + System.out.println("IOException"+ioe);
59.438 + return false;
59.439 + }
59.440 + return true;
59.441 +
59.442 + }
59.443 + public boolean printToFile(String fullTopDir, String module) {
59.444 +
59.445 + // if (DEBUG) System.out.println("IN printToFile FULLTOPDIR"+fullTopDir+ " MODULE" + module);
59.446 +
59.447 + try {
59.448 +
59.449 + int lastSlashIndex = fullTopDir.lastIndexOf(File.separator);
59.450 + String topDir= fullTopDir.substring(lastSlashIndex+1);
59.451 +
59.452 + /* No need to mkdirs now - printToAllFile is making them.
59.453 + File f = new File(buildDir+ File.separator +topDir );
59.454 + f.mkdirs();
59.455 + */
59.456 +
59.457 + FileWriter genWrite = new FileWriter(fullTopDir+File.separator+module+File.separator+module+"."+generatedFile);
59.458 + FileWriter changedWrite = new FileWriter(fullTopDir+File.separator+module+File.separator+module+"."+changedFile);
59.459 +
59.460 +
59.461 + if ( generatedFileHash == null ) {
59.462 + generatedFileHash = new Hashtable();
59.463 + } else {
59.464 +
59.465 + for (Enumeration g = generatedFileHash.keys() ; g.hasMoreElements() ;) {
59.466 + String genFileKey = (String)g.nextElement();
59.467 + int lioTopDir = genFileKey.lastIndexOf(topDir);
59.468 + String moduleFileName = genFileKey.substring(lioTopDir+topDir.length()+1) ;
59.469 +
59.470 + genWrite.write(moduleFileName+"\t"+(String)generatedFileHash.get(genFileKey)+"\n");
59.471 + }
59.472 +
59.473 + // To make sure the changeFile & generatedFile appear in the tar,
59.474 + // make them the first lines in the file.
59.475 + for (Enumeration c = changed.keys() ; c.hasMoreElements() ;) {
59.476 + String changedFileKey = (String)c.nextElement();
59.477 +
59.478 + int lio = changedFileKey.lastIndexOf(topDir+File.separator+module);
59.479 + String moduleFileName;
59.480 + if (lio >= 0) {
59.481 +
59.482 + moduleFileName=changedFileKey.substring(changedFileKey.lastIndexOf(topDir+File.separator+module)+topDir.length()+1);
59.483 + changedWrite.write(moduleFileName+"\n");
59.484 + } else {
59.485 + // If we get here, the cache is probobly not really being cleared.
59.486 +
59.487 + //The cache is not being cleared
59.488 + // OR we have wild-card characters
59.489 + 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+".");
59.490 + // Contact program administrator.\r\t"+ changedFileKey+ "\r\tTD "+topDir+File.separator+module +" LIO "+lio);
59.491 + }
59.492 +
59.493 + //changedWrite.write(changedFileKey+"\n");
59.494 + //Changed should have a list of fullpath in order to do copy
59.495 + }
59.496 + }
59.497 +
59.498 + if (! error.isEmpty() ) {
59.499 + FileWriter errorWrite = new FileWriter(buildDir+File.separator+"l10n-errors.txt", true);
59.500 + for (Enumeration e = error.elements(); e.hasMoreElements();) {
59.501 + String ee = (String)e.nextElement();
59.502 + errorWrite.write(ee+"\n");
59.503 + System.out.println("Error: "+ee);
59.504 + }
59.505 + errorWrite.close();
59.506 + }
59.507 +
59.508 +
59.509 + genWrite.close();
59.510 + changedWrite.close();
59.511 +
59.512 +
59.513 + } catch (IOException ioe) {
59.514 + System.out.println("IOException printToFile()"+ioe);
59.515 + return false;
59.516 + }
59.517 + return true;
59.518 + }
59.519 +
59.520 + /** You can use this function independently of "execute()", but
59.521 + * you have to set these attributes: localizableFile,
59.522 + * globalFile (if "read global" is used in any l10n.list
59.523 + * files), excludePattern (if desired), includePattern (if
59.524 + * desired)
59.525 + */
59.526 + public String[] getLocalizableFiles(File topRoot, String module) {
59.527 + String[] lfs = null;
59.528 + StringBuffer[] sbholder=new StringBuffer[2];
59.529 + StringBuffer sbi= new StringBuffer();
59.530 + StringBuffer sbe = new StringBuffer();
59.531 + String includeS="";
59.532 + String excludeS="";
59.533 + // if (DEBUG) System.out.println("\t\tIN getLocalizableFiles(File "+topRoot.getName()+", " + module+")");
59.534 +
59.535 + if( fullPropHash == null) {
59.536 + p = getProject() ;
59.537 + fullPropHash = p.getProperties();
59.538 + }
59.539 + fullPropHash.put("l10n-module", module);
59.540 +
59.541 + try {
59.542 + File includes = new File(topRoot.getCanonicalPath() + File.separator + module + File.separator + localizableFile);
59.543 + if ( ! includes.exists() || includes.length() <= 0 ) {
59.544 + //if (DEBUG) System.out.println("FILE IS too short to mess with "+ module);
59.545 + return lfs;
59.546 + }
59.547 +
59.548 + try {
59.549 + sbholder = processListFile(includes,module);
59.550 + } catch (java.io.IOException ioe) {
59.551 + System.out.println("Error processing file. "+ioe);
59.552 + }
59.553 +
59.554 + if (sbholder != null) {
59.555 + sbi = sbholder[0];
59.556 + sbe = sbholder[1];
59.557 +
59.558 + sbe.append(" "+excludePattern);
59.559 + sbi.append(" "+includePattern);
59.560 +
59.561 + if (DEBUG) {
59.562 + System.out.println("INC "+sbi.toString());
59.563 + System.out.println("EXC "+sbe.toString());
59.564 + }
59.565 + }
59.566 +
59.567 + this.fileset = new FileSet();
59.568 +
59.569 + // this.setIncludesfile(includes);
59.570 + if ( sbi !=null) {
59.571 + this.setIncludes(sbi.toString());
59.572 + //changed to accomodate excludes in file
59.573 +
59.574 + if ( sbi.toString().equals(" ") ) {
59.575 + this.setIncludes(module+"/src");
59.576 + }
59.577 + }
59.578 +
59.579 + if (sbe != null ) {
59.580 + this.setExcludes(sbe.toString());
59.581 + // Sets the set of exclude patterns.
59.582 + // Patterns may be separated by a comma or a space.
59.583 + }
59.584 +
59.585 + DirectoryScanner ds = this.getDirectoryScanner(topRoot);
59.586 +
59.587 + ds.scan();
59.588 + lfs = ds.getIncludedFiles();
59.589 +
59.590 + for (int k=0; k<lfs.length; k++) {
59.591 + // if (DEBUG) System.out.println("\t\t\tLFS "+lfs[k]);
59.592 + lfs[k] = topRoot+File.separator+lfs[k].trim();
59.593 + //lfs[k] = topRoot+File.separator+lfs[k];
59.594 + }
59.595 +
59.596 + // if (DEBUG) System.out.println("THERE ARE "+lfs.length + " FILES in INCL FILES");
59.597 + } catch(java.io.IOException e) {
59.598 + System.out.println(e.getMessage());
59.599 + }
59.600 + return lfs;
59.601 + }
59.602 +
59.603 + public Hashtable getGeneratedFiles(File topDir, String mod) {
59.604 + // NOTE: This method will return 'null' 100% of the time if there
59.605 + // are no l10n.list.generated files.
59.606 + // At this writing, this functionality is not used.
59.607 + // EG 1/03
59.608 +
59.609 + Hashtable h=new Hashtable();
59.610 + // Read generated File
59.611 + try {
59.612 +
59.613 + String topDirFullPath = topDir.getCanonicalPath();
59.614 + // if (DEBUG) System.out.println("\t\ttopDirFullPath: "+topDirFullPath);
59.615 +
59.616 + BufferedReader inBuff = new BufferedReader(new FileReader(new File(topDir+File.separator+mod,generatedFile)));
59.617 + boolean eof = false;
59.618 + while (! eof) {
59.619 + String line = inBuff.readLine();
59.620 + if (line==null) {
59.621 + eof = true;
59.622 + } else {
59.623 + //System.out.println("LL "+ line);
59.624 +
59.625 + int tabIndex = line.indexOf("\t");
59.626 + if (tabIndex > 0) {
59.627 + String filename = line.substring(0,tabIndex);
59.628 + String revision = line.substring(tabIndex+1);
59.629 + h.put(topDirFullPath+File.separator+filename, revision);
59.630 + } else {
59.631 + System.out.println("There's no tab in this line"+"["+line+"]");
59.632 +
59.633 + }
59.634 +
59.635 + }
59.636 +
59.637 + } //while
59.638 + } catch(java.io.FileNotFoundException e) {
59.639 + // Warning: Generated File: "+generatedFile+" in "+
59.640 + // topDir+File.separator+mod+" not found.
59.641 + // Adding all files to changed list."
59.642 + return(null);
59.643 + } catch(java.io.IOException e) {
59.644 + System.out.println("IOException "+ e);
59.645 + }
59.646 +
59.647 + return h;
59.648 + }
59.649 +
59.650 + // Accessor Methods
59.651 +
59.652 + public void setTopdirs(String s) {
59.653 + StringTokenizer st = new StringTokenizer(s);
59.654 + String[] tops = new String[st.countTokens()];
59.655 + int i=0;
59.656 + while (st.hasMoreTokens()) {
59.657 + tops[i++]=st.nextToken();
59.658 + }
59.659 +
59.660 + if (false) {
59.661 + for (int j=0; j<tops.length; j++) {
59.662 + System.out.println("TOPS "+tops[j]);
59.663 + }
59.664 + }
59.665 +
59.666 + this.topdirs = tops;
59.667 +
59.668 + }
59.669 + public void setModules(String s) {
59.670 + StringTokenizer st = new StringTokenizer(s,",");
59.671 + String[] mods = new String[st.countTokens()];
59.672 + HashSet modSet = new HashSet(); //This will guarantee that there will be no duplications
59.673 + String fullMod = null;
59.674 +
59.675 + while (st.hasMoreTokens()) {
59.676 + fullMod=st.nextToken().trim();;
59.677 +
59.678 + // if (DEBUG) System.out.println("ITEM IN MODLIST: "+fullMod);
59.679 +
59.680 + int index = fullMod.indexOf(File.separator);
59.681 + if (index >= 0) {
59.682 + //Check that the mod doesn't have a slash
59.683 + // (if it does, keep only what is to the left of the slash)
59.684 + fullMod=fullMod.substring(0,index);
59.685 +
59.686 + // if (DEBUG) System.out.println("CHANGED FULLMOD & it's NOW "+fullMod);
59.687 + }
59.688 + modSet.add( fullMod );
59.689 + }
59.690 + this.modules = new String[ modSet.size() ];
59.691 + Iterator it = modSet.iterator();
59.692 +
59.693 + int i=0;
59.694 + while( it.hasNext() )
59.695 + this.modules[i++] = (String) it.next();
59.696 +
59.697 + }
59.698 +
59.699 + public StringBuffer[] processListFile(File inc,String module) throws java.io.IOException {
59.700 + System.out.println("Reading list file: "+inc.toString());
59.701 + StringBuffer[] sbholder=new StringBuffer[2];
59.702 + StringBuffer sbi = new StringBuffer();
59.703 + StringBuffer sbe = new StringBuffer();
59.704 +
59.705 +
59.706 + if(inc.exists() && inc.length() >0) {
59.707 + //Read Includes File.
59.708 + try {
59.709 + BufferedReader br = new BufferedReader(new FileReader(inc));
59.710 + String line;
59.711 + while((line=br.readLine()) != null && line.indexOf("#") <0) {
59.712 + boolean skipit=false;
59.713 + // For each line check if there are any properties which
59.714 + // should be interpreted first.
59.715 + while (line.indexOf("${") >= 0 && skipit == false) {
59.716 +
59.717 + String propertyName;
59.718 + String value="";
59.719 + String res="";
59.720 + String pre="";
59.721 +
59.722 + propertyName=line.substring(line.indexOf("${")+2,line.indexOf("}"));
59.723 +
59.724 + if (fullPropHash.containsKey(propertyName)) {
59.725 +
59.726 + value=(String)fullPropHash.get(propertyName);
59.727 + res = line.substring(line.indexOf("}")+1);
59.728 + pre= line.substring(0,line.indexOf("{")-1);
59.729 + line=pre+value+res;
59.730 + // System.out.println("LINE is now "+line);
59.731 + } else {
59.732 + System.out.println("Uninterpretable property in l10n file:"+inc.toString()+". "+propertyName+" Interpreting the entire line literally.");
59.733 + skipit=true;
59.734 + }
59.735 + }
59.736 +
59.737 + if (line.indexOf("exclude") >= 0) {
59.738 + sbe.append(" "+line.substring("exclude".length()+1));
59.739 + } else if (line.indexOf("read global") >= 0) {
59.740 +
59.741 + if (globalFile != null && ! globalFile.equals("")) {
59.742 + if (readGlobalFile==true) {
59.743 + System.out.println("Already read it");
59.744 + //We did it once, don't do it again.
59.745 + // just copy in the values.
59.746 + sbi.append(" "+globalsbholder[0]);
59.747 + sbe.append(" "+globalsbholder[1]);
59.748 + } else {
59.749 + globalsbholder[0]= new StringBuffer();
59.750 + globalsbholder[1]= new StringBuffer();
59.751 + StringBuffer[] globalarray = processListFile(new File(globalFile),module);
59.752 + if (globalarray[0] != null) {
59.753 + sbi.append(" "+globalarray[0]);
59.754 + globalsbholder[0].append(" "+globalarray[0]);
59.755 + //put it where we can get it back.
59.756 + }
59.757 + if (globalarray[1] != null) {
59.758 + sbe.append(" "+globalarray[1]);
59.759 + globalsbholder[1].append(" "+globalarray[1]);
59.760 + //put it where we can get it back.
59.761 + }
59.762 + }
59.763 + readGlobalFile = true ;
59.764 + }
59.765 + } else if( line.trim().startsWith( "read")) {
59.766 + String l = line.trim() ;
59.767 + l = l.substring( 4) ;
59.768 + l = l.trim() ;
59.769 + StringBuffer[] sbarr = processListFile( new File( l),
59.770 + module) ;
59.771 + sbi.append( " " + sbarr[ 0]) ;
59.772 + sbe.append( " " + sbarr[ 1]) ;
59.773 + } else {
59.774 + sbi.append(" "+line);
59.775 + }
59.776 + // System.out.println("GLOBAL"+line.indexOf("read global")+" EXCLUDES "+line.indexOf("exclude")+ "FILE"+inc.toString());
59.777 + } //while
59.778 + br.close();
59.779 + } catch (java.io.IOException ioe) {
59.780 + throw new java.io.IOException(ioe.toString());
59.781 + }
59.782 + }
59.783 + sbholder[0]=sbi;
59.784 + sbholder[1]=sbe;
59.785 + return sbholder;
59.786 + }
59.787 +
59.788 + public void setDistDir(String s) {
59.789 + // if (DEBUG) System.out.println("DIST DIR SHOULD BE: "+s);
59.790 + this.distDir=s;
59.791 + }
59.792 + public void setBuildDir(String s) {
59.793 + this.buildDir=s;
59.794 + }
59.795 + public void setDebug(boolean s) {
59.796 + this.DEBUG=s;
59.797 + }
59.798 + public void setLocalizableFile(String s) {
59.799 + this.localizableFile=s;
59.800 + }
59.801 + public void setExcludePattern(String s) {
59.802 + this.excludePattern=s;
59.803 + }
59.804 + public void setIncludePattern(String s) {
59.805 + this.includePattern=s;
59.806 + }
59.807 +
59.808 + public void setBuildNumber(String s) {
59.809 + this.buildNumber=s;
59.810 + }
59.811 + public void setGeneratedFile(String s) {
59.812 + this.generatedFile=s;
59.813 + }
59.814 + public void setChangedFile(String s) {
59.815 + this.changedFile=s;
59.816 + }
59.817 + public void setGlobalFile(String s) {
59.818 + this.globalFile=s;
59.819 + }
59.820 +}
60.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
60.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/LocJHIndexer.java Wed Feb 23 20:12:58 2011 -0500
60.3 @@ -0,0 +1,259 @@
60.4 +/*
60.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
60.6 + *
60.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
60.8 + *
60.9 + * The contents of this file are subject to the terms of either the GNU
60.10 + * General Public License Version 2 only ("GPL") or the Common
60.11 + * Development and Distribution License("CDDL") (collectively, the
60.12 + * "License"). You may not use this file except in compliance with the
60.13 + * License. You can obtain a copy of the License at
60.14 + * http://www.netbeans.org/cddl-gplv2.html
60.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
60.16 + * specific language governing permissions and limitations under the
60.17 + * License. When distributing the software, include this License Header
60.18 + * Notice in each file and include the License file at
60.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
60.20 + * particular file as subject to the "Classpath" exception as provided
60.21 + * by Sun in the GPL Version 2 section of the License file that
60.22 + * accompanied this code. If applicable, add the following below the
60.23 + * License Header, with the fields enclosed by brackets [] replaced by
60.24 + * your own identifying information:
60.25 + * "Portions Copyrighted [year] [name of copyright owner]"
60.26 + *
60.27 + * Contributor(s):
60.28 + *
60.29 + * The Original Software is NetBeans. The Initial Developer of the Original
60.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
60.31 + * Microsystems, Inc. All Rights Reserved.
60.32 + *
60.33 + * If you wish your version of this file to be governed by only the CDDL
60.34 + * or only the GPL Version 2, indicate your decision by adding
60.35 + * "[Contributor] elects to include this software in this distribution
60.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
60.37 + * single choice of license, a recipient has the option to distribute
60.38 + * your version of this file under either the CDDL, the GPL Version 2 or
60.39 + * to extend the choice of license to its licensees as provided above.
60.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
60.41 + * Version 2 license, then the option applies only if the new code is
60.42 + * made subject to such option by the copyright holder.
60.43 + */
60.44 +
60.45 +package org.netbeans.modules.visualweb.ravebuild;
60.46 +
60.47 +import java.io.*;
60.48 +import java.util.*;
60.49 +
60.50 +import org.apache.tools.ant.* ;
60.51 +import org.apache.tools.ant.taskdefs.* ;
60.52 +import org.apache.tools.ant.types.FileSet;
60.53 +import org.apache.tools.ant.types.Path;
60.54 +
60.55 +/** This task runs the JHIndexer task multiple times, once for each
60.56 + * language, and automatically creates the appropriate regular
60.57 + * expressions to choose the files for each language. This task
60.58 + * greatly reduces the amount of Ant code required to run JHIndexer
60.59 + * especially when there are helpsets for multiple languages in the
60.60 + * same directory tree.
60.61 + *
60.62 + * @author Jerry Huth (email: jerry@solidstep.com)
60.63 + */
60.64 +public class LocJHIndexer extends MatchingTask {
60.65 +
60.66 + protected File basedir = null ;
60.67 + protected String dbdir = null ;
60.68 + protected String locales = null ;
60.69 + protected String jhall = null ;
60.70 +
60.71 + /** Specify a regular expression to find <samp>jhall.jar</samp>
60.72 + * (JavaHelp tools library).
60.73 + */
60.74 + public void setJhall( String jhall) {
60.75 + this.jhall = jhall;
60.76 + }
60.77 +
60.78 + /** Get the jhall jar file to use. */
60.79 + protected String getJhall() {
60.80 + String ret = null ;
60.81 + String prop = null ;
60.82 +
60.83 + // Use the attribute if specified. //
60.84 + if( jhall != null) {
60.85 + ret = jhall ;
60.86 + }
60.87 + else {
60.88 +
60.89 + // Else look for the global property. //
60.90 + prop = getProject().getProperty("locjhindexer.jhall");
60.91 + if( prop != null) {
60.92 + ret = prop ;
60.93 + }
60.94 + }
60.95 +
60.96 + return( ret) ;
60.97 + }
60.98 +
60.99 + /** Set the location of the docs helpsets' base dir. */
60.100 + public void setBasedir( File dir) {
60.101 + basedir = dir ;
60.102 + }
60.103 +
60.104 + /** Set the name of the search database directory (which is under
60.105 + * <samp>basedir/<locale></samp>)
60.106 + */
60.107 + public void setDbdir( String dir) {
60.108 + dbdir = dir ;
60.109 + }
60.110 +
60.111 + /** Set a comma-separated list of locales which have helpsets. */
60.112 + public void setLocales( String s) {
60.113 + locales = s ;
60.114 + }
60.115 +
60.116 + /** Get the locales for which we'll look for helpsets. */
60.117 + protected String getLocales() {
60.118 + if( locales != null) {
60.119 + return( locales) ;
60.120 + }
60.121 + return(getProject().getProperty("locjhindexer.locales"));
60.122 + }
60.123 +
60.124 + public void execute() throws BuildException {
60.125 + String locs = getLocales() ;
60.126 + String helpset_locs = null ;
60.127 + StringTokenizer tokenizer = null ;
60.128 + String loc = null ;
60.129 +
60.130 + if( getJhall() == null)
60.131 + throw new BuildException( "Must specify the jhall attribute") ;
60.132 + if( dbdir == null || dbdir.trim().equals( ""))
60.133 + throw new BuildException( "Must specify the dbdir attribute") ;
60.134 + if( basedir == null)
60.135 + throw new BuildException( "Must specify the basedir attribute") ;
60.136 + if( locs == null || locs.trim().equals( ""))
60.137 + throw new BuildException( "Must specify the locales attribute") ;
60.138 +
60.139 + // I couldn't get it to work unless I explicitly added the task def here. //
60.140 + getProject().addTaskDefinition("jhindexer", JHIndexer.class);
60.141 +
60.142 + // For each locale. //
60.143 + tokenizer = new StringTokenizer( locs, ", ") ;
60.144 + while( tokenizer.hasMoreTokens()) {
60.145 + loc = tokenizer.nextToken() ;
60.146 +
60.147 + // If there's a helpset for this locale. //
60.148 + if( hasHelpset( loc)) {
60.149 +
60.150 + // Add it to the list of locales that have helpsets. //
60.151 + if( helpset_locs == null) {
60.152 + helpset_locs = new String( loc) ;
60.153 + }
60.154 + else {
60.155 + helpset_locs += "," + loc ;
60.156 + }
60.157 + }
60.158 + }
60.159 +
60.160 + // For each locale. //
60.161 + if( helpset_locs != null) {
60.162 + tokenizer = new StringTokenizer( helpset_locs, ", ") ;
60.163 + while( tokenizer.hasMoreTokens()) {
60.164 + loc = tokenizer.nextToken() ;
60.165 +
60.166 + // Run the JHIndexer for this locale. //
60.167 + RunForLocale( loc) ;
60.168 + }
60.169 + }
60.170 + }
60.171 +
60.172 + /** See if there's a helpset for this locale. */
60.173 + protected boolean hasHelpset( String loc) {
60.174 + boolean ret = false ;
60.175 + LocHelpsetFilter filter = new LocHelpsetFilter( loc) ;
60.176 + File files[] ;
60.177 +
60.178 + files = basedir.listFiles( filter) ;
60.179 + if( files != null && files.length > 0) {
60.180 + ret = true ;
60.181 + }
60.182 +
60.183 + return( ret) ;
60.184 + }
60.185 +
60.186 + // Run JHIndexer for the given locale. //
60.187 + protected void RunForLocale( String locale) throws BuildException {
60.188 + JHIndexer jhindexer ;
60.189 +
60.190 + jhindexer = (JHIndexer) getProject().createTask("jhindexer");
60.191 + jhindexer.init() ;
60.192 +
60.193 + jhindexer.setIncludes( locale + "/**/*.htm*") ;
60.194 + jhindexer.setExcludes( locale + "/" + dbdir + "/" + "," +
60.195 + locale + "/credits.htm*") ;
60.196 + jhindexer.setBasedir( new File( basedir + "/")) ;
60.197 + jhindexer.setDb( new File( basedir + "/" + locale + "/" + dbdir)) ;
60.198 + jhindexer.setLocale( locale) ;
60.199 + setJHLib( jhindexer) ;
60.200 +
60.201 + jhindexer.execute() ;
60.202 + }
60.203 +
60.204 + protected void setJHLib( JHIndexer jhindexer) {
60.205 + String jhlib, dir, regexp ;
60.206 + int idx, i ;
60.207 + FileSet fs ;
60.208 + File file ;
60.209 + LinkedList dirs, regexps ;
60.210 + StringTokenizer st ;
60.211 + Path path ;
60.212 +
60.213 + // For each regular expression. //
60.214 + dirs = new LinkedList() ;
60.215 + regexps = new LinkedList() ;
60.216 + jhlib = getJhall() ;
60.217 + st = new StringTokenizer( jhlib, " \n,") ;
60.218 + while( st.hasMoreTokens()) {
60.219 + regexp = st.nextToken() ;
60.220 +
60.221 + // Break the regular expression up into directory and file //
60.222 + // components. //
60.223 + idx = regexp.lastIndexOf( "/") ;
60.224 + dir = regexp.substring( 0, idx) ;
60.225 + file = new File( dir) ;
60.226 + if( file.exists()) {
60.227 + dirs.add( dir) ;
60.228 + regexps.add( regexp.substring( idx+1)) ;
60.229 + }
60.230 + }
60.231 +
60.232 + if( dirs.size() > 0) {
60.233 + path = jhindexer.createClasspath() ;
60.234 + for( i = 0; i < dirs.size(); i++) {
60.235 + dir = (String) dirs.get( i) ;
60.236 + regexp = (String) regexps.get( i) ;
60.237 + fs = new FileSet() ;
60.238 + fs.setDir( new File( dir)) ;
60.239 + fs.setIncludes( regexp) ;
60.240 + path.addFileset( fs) ;
60.241 + }
60.242 + }
60.243 + else {
60.244 + throw new BuildException( "jhall not found.") ;
60.245 + }
60.246 + }
60.247 +
60.248 + protected class LocHelpsetFilter implements FilenameFilter {
60.249 + protected String locale = null ;
60.250 +
60.251 + public LocHelpsetFilter( String loc) {
60.252 + locale = loc ;
60.253 + }
60.254 +
60.255 + public boolean accept(File dir,
60.256 + String name) {
60.257 + return( name.endsWith( "_" + locale + ".hs")) ;
60.258 + }
60.259 + }
60.260 +
60.261 +}
60.262 +
61.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
61.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/LocMakeNBM.java Wed Feb 23 20:12:58 2011 -0500
61.3 @@ -0,0 +1,625 @@
61.4 +/*
61.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
61.6 + *
61.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
61.8 + *
61.9 + * The contents of this file are subject to the terms of either the GNU
61.10 + * General Public License Version 2 only ("GPL") or the Common
61.11 + * Development and Distribution License("CDDL") (collectively, the
61.12 + * "License"). You may not use this file except in compliance with the
61.13 + * License. You can obtain a copy of the License at
61.14 + * http://www.netbeans.org/cddl-gplv2.html
61.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
61.16 + * specific language governing permissions and limitations under the
61.17 + * License. When distributing the software, include this License Header
61.18 + * Notice in each file and include the License file at
61.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
61.20 + * particular file as subject to the "Classpath" exception as provided
61.21 + * by Sun in the GPL Version 2 section of the License file that
61.22 + * accompanied this code. If applicable, add the following below the
61.23 + * License Header, with the fields enclosed by brackets [] replaced by
61.24 + * your own identifying information:
61.25 + * "Portions Copyrighted [year] [name of copyright owner]"
61.26 + *
61.27 + * Contributor(s):
61.28 + *
61.29 + * The Original Software is NetBeans. The Initial Developer of the Original
61.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
61.31 + * Microsystems, Inc. All Rights Reserved.
61.32 + *
61.33 + * If you wish your version of this file to be governed by only the CDDL
61.34 + * or only the GPL Version 2, indicate your decision by adding
61.35 + * "[Contributor] elects to include this software in this distribution
61.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
61.37 + * single choice of license, a recipient has the option to distribute
61.38 + * your version of this file under either the CDDL, the GPL Version 2 or
61.39 + * to extend the choice of license to its licensees as provided above.
61.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
61.41 + * Version 2 license, then the option applies only if the new code is
61.42 + * made subject to such option by the copyright holder.
61.43 + */
61.44 +
61.45 +package org.netbeans.modules.visualweb.ravebuild;
61.46 +
61.47 +import java.io.* ;
61.48 +import java.net.MalformedURLException;
61.49 +import java.util.* ;
61.50 +
61.51 +import org.apache.tools.ant.* ;
61.52 +import org.apache.tools.ant.taskdefs.* ;
61.53 +import org.apache.tools.ant.types.* ;
61.54 +
61.55 +/** Runs the makenbm task for each locale specified in the
61.56 + * global property locmakenbm.locales.
61.57 + * NOTE: Currently this runs makelnbm, since the new
61.58 + * functionality in that hasn't been merged into makenbm
61.59 + * yet.
61.60 + *
61.61 + * @author Jerry Huth (email: jerry@solidstep.com)
61.62 + */
61.63 +public class LocMakeNBM extends Task {
61.64 +
61.65 + protected String locales = null ;
61.66 + protected String mainDir = null ;
61.67 + protected File topDir = null ;
61.68 + protected String fileName = null ;
61.69 + protected String moduleName = null ;
61.70 + protected String baseFileName = null ;
61.71 + protected boolean deleteInfo = false ;
61.72 + protected String nbmIncludes = null ;
61.73 + protected String modInfo = null ;
61.74 + protected String findLocBundle = "." ; // relative to the directory
61.75 + // corresponding to the module's
61.76 + // codename
61.77 + protected File locBundle = null ; // path to localizing bundle - overrides
61.78 + // findLocBundle
61.79 + protected String locIncludes = null ; // comma-separated list of
61.80 + // "<locale>:<pattern>" elements
61.81 + private String global = null;
61.82 +
61.83 + /** Install globally? */
61.84 + public void setGlobal (String isGlobal) {
61.85 + this.global = isGlobal;
61.86 + }
61.87 +
61.88 + public void setLocales( String s) {
61.89 + locales = s ;
61.90 + }
61.91 + public void setMainDir( String s) {
61.92 + mainDir = s ;
61.93 + }
61.94 + public void setTopDir( File f) {
61.95 + topDir = f ;
61.96 + }
61.97 + public void setModule(String module) {
61.98 + this.moduleName = module;
61.99 + log("Setting moduleName = '"+moduleName+"'", Project.MSG_VERBOSE);
61.100 + }
61.101 + public void setFile( String s) {
61.102 + fileName = s ;
61.103 + log("Setting fileName = '"+fileName+"'", Project.MSG_VERBOSE);
61.104 + if( !fileName.substring( fileName.length() - 4).equals( ".nbm")) { //NOI18N
61.105 + throw new BuildException( "Incorrect NBM file name \""+ s+"\". NBM file name must end in '.nbm'") ;
61.106 + }
61.107 + baseFileName = fileName.substring( 0, fileName.length() - 4) ;
61.108 + }
61.109 + public void setDeleteInfo( boolean b) {
61.110 + deleteInfo = b ;
61.111 + }
61.112 + public void setNbmIncludes( String s) {
61.113 + nbmIncludes = s ;
61.114 + }
61.115 + public void setModInfo( String s) {
61.116 + modInfo = s ;
61.117 + }
61.118 + public void setLocBundle( File f) {
61.119 + locBundle = f ;
61.120 + }
61.121 + public void setFindLocBundle( String s) {
61.122 + findLocBundle = s ;
61.123 + }
61.124 + public void setLocIncludes( String s) {
61.125 + locIncludes = s ;
61.126 + }
61.127 +
61.128 + public void execute() throws BuildException {
61.129 + try {
61.130 + really_execute() ;
61.131 +
61.132 + } catch( BuildException be) {
61.133 + be.printStackTrace();
61.134 + throw be ;
61.135 + }
61.136 + }
61.137 +
61.138 + public void really_execute() throws BuildException {
61.139 + String locs, loc ;
61.140 + StringTokenizer stok ;
61.141 + LinkedList build_locales = new LinkedList() ;
61.142 + ListIterator iterator ;
61.143 +
61.144 + // Set default values. //
61.145 + if( mainDir == null) {
61.146 + mainDir = new String( "netbeans") ; //NOI18N
61.147 + }
61.148 + if( topDir == null) {
61.149 + topDir = getProject().getBaseDir() ;
61.150 + }
61.151 +
61.152 + if (( modInfo == null) && (moduleName != null)) {
61.153 + // load module info frommodule jarfile
61.154 + File f = new File (topDir,moduleName.replace('/', File.separatorChar));
61.155 + java.util.jar.JarFile jf;
61.156 + try {
61.157 + jf= new java.util.jar.JarFile(f);
61.158 + } catch (java.io.IOException ioe) {
61.159 + throw new BuildException("I/O error during opening module jarfile", ioe, this.getLocation());
61.160 + }
61.161 + java.util.jar.Manifest mani;
61.162 + try {
61.163 + mani = jf.getManifest();
61.164 + } catch (java.io.IOException ioe) {
61.165 + throw new BuildException("I/O error getting manifest from file '"+f.getAbsolutePath()+"'", ioe, this.getLocation());
61.166 + }
61.167 + if ( mani != null ) {
61.168 + java.util.jar.Attributes attr = mani.getMainAttributes();
61.169 + String cname = attr.getValue("OpenIDE-Module");
61.170 + String sver = attr.getValue("OpenIDE-Module-Specification-Version");
61.171 + if ((cname != null) && (!(cname.equals(""))) && (sver != null) && (!(sver.equals("")))) {
61.172 + modInfo = cname + '/' + sver;
61.173 + log("Gathered module information from module jarfile. Codename = '"+cname+"' and specification version = '"+sver+"'",Project.MSG_VERBOSE);
61.174 + } else {
61.175 + 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());
61.176 + }
61.177 + }
61.178 + }
61.179 +
61.180 + // Print a warning and stop if the topDir doesn't exist. //
61.181 + if( printMissingDirWarning()) {
61.182 + return ;
61.183 + }
61.184 +
61.185 + locs = getLocales() ;
61.186 + if( locs == null || locs.trim().equals( "")) { //NOI18N
61.187 + throw new BuildException( "Must specify 1 or more locales.") ;
61.188 + }
61.189 + if( fileName == null) {
61.190 + throw new BuildException( "Must specify the file attribute.") ;
61.191 + }
61.192 +
61.193 + // I couldn't get it to work unless I explicitly added the task def here. //
61.194 + getProject().addTaskDefinition("makelnbm", MakeLNBM.class); //NOI18N
61.195 +
61.196 + // Get a list of the locales for which localized files exist. //
61.197 + stok = new StringTokenizer( locs, ",") ; //NOI18N
61.198 + while( stok.hasMoreTokens()) {
61.199 + loc = stok.nextToken() ;
61.200 + log("Checking if module has files in locale '"+loc+"'", Project.MSG_VERBOSE);
61.201 + if( hasFilesInLocale( loc)) {
61.202 + build_locales.add( loc) ;
61.203 + log("Module has files in locale '"+loc+"'", Project.MSG_VERBOSE);
61.204 + } else {
61.205 + log("Module has no files in locale '"+loc+"'", Project.MSG_VERBOSE);
61.206 + }
61.207 + }
61.208 +
61.209 + // For each locale that we need to build an NBM for. //
61.210 + iterator = build_locales.listIterator() ;
61.211 + while( iterator.hasNext()) {
61.212 +
61.213 + // Build the NBM for this locale. //
61.214 + buildNbm( (String) iterator.next()) ;
61.215 + }
61.216 + }
61.217 +
61.218 + /** Build the NBM for this locale. */
61.219 + protected void buildNbm( String locale) throws BuildException {
61.220 + MakeLNBM makenbm ;
61.221 + LinkedList list = new LinkedList() ;
61.222 + ListIterator iterator ;
61.223 + String includes = new String() ;
61.224 + String s ;
61.225 + File licenseFile ;
61.226 + boolean first_time ;
61.227 + Delete del ;
61.228 +
61.229 + // Delete the Info directory if desired. //
61.230 + if( deleteInfo) {
61.231 + del = (Delete) getProject().createTask("delete"); //NOI18N
61.232 + del.init() ;
61.233 + del.setDir( new File( topDir.getAbsolutePath() + File.separator + "Info")) ; //NOI18N
61.234 + del.execute() ;
61.235 + del.setDir( new File( topDir.getAbsolutePath() + File.separator + "Info_" + //NOI18N
61.236 + locale)) ;
61.237 + del.execute() ;
61.238 + }
61.239 + else {
61.240 +
61.241 + // Move the Info_<locale> dir to Info. //
61.242 + switchInfo( true, locale) ;
61.243 + }
61.244 +
61.245 + makenbm = (MakeLNBM) getProject().createTask("makelnbm"); //NOI18N
61.246 + makenbm.init() ;
61.247 +
61.248 + makenbm.setModInfo( modInfo) ;
61.249 + makenbm.setLangCode( locale) ;
61.250 + if (this.global != null) {
61.251 + makenbm.setGlobal(this.global);
61.252 + }
61.253 +
61.254 + String fname = getLocalizedFileName( locale);
61.255 + makenbm.setFile( new File( getProject().getBaseDir().getAbsolutePath() +
61.256 + File.separator + fname)) ;
61.257 + makenbm.setTopdir( topDir) ;
61.258 + makenbm.setIsStandardInclude( false) ;
61.259 + String distbase = getProject().getProperty("dist.base"); //NOI18N
61.260 + if (distbase != null) {
61.261 +// try {
61.262 + int idx = fname.lastIndexOf('/');
61.263 + makenbm.setDistribution(distbase + "/" + fname.substring(idx + 1)); //NOI18N
61.264 +// } catch (MalformedURLException e) {
61.265 +// throw new BuildException(e, getLocation());
61.266 +// }
61.267 + }
61.268 + licenseFile = getLicenseFile( locale) ;
61.269 + if( licenseFile != null) {
61.270 + MakeLNBM.Blurb blurb = makenbm.createLicense() ;
61.271 + blurb.setFile( licenseFile) ;
61.272 + }
61.273 +
61.274 + // Set the localizing bundle specified, or look for it. //
61.275 + if( locBundle != null) {
61.276 + setLocBundle( makenbm, getSpecificLocBundleFile( locBundle, locale)) ;
61.277 + }
61.278 + else {
61.279 + setLocBundle( makenbm, findLocBundle( makenbm, locale)) ;
61.280 + }
61.281 +
61.282 + // Set up the signing data if it's specified. //
61.283 + if( getKeystore() != null &&
61.284 + getStorepass() != null &&
61.285 + getAlias() != null) {
61.286 + MakeLNBM.Signature sign = makenbm.createSignature() ;
61.287 + sign.setKeystore( new File( getKeystore())) ;
61.288 + sign.setStorepass( getStorepass()) ;
61.289 + sign.setAlias( getAlias()) ;
61.290 + }
61.291 +
61.292 + // Get the list of include patterns for this locale. //
61.293 + addLocalePatterns( list, locale) ;
61.294 +
61.295 + // Create a comma-separated list of include patterns. //
61.296 + iterator = list.listIterator() ;
61.297 + first_time = true ;
61.298 + while( iterator.hasNext()) {
61.299 + s = (String) iterator.next() ;
61.300 + if( !first_time) {
61.301 + includes += "," ; //NOI18N
61.302 + }
61.303 + includes += s ;
61.304 + first_time = false ;
61.305 + }
61.306 + // Add any extra includes that were specified. //
61.307 + if( nbmIncludes != null && !nbmIncludes.trim().equals( "")) { //NOI18N
61.308 + if( !first_time) {
61.309 + includes += "," ; //NOI18N
61.310 + }
61.311 + includes += nbmIncludes ;
61.312 + }
61.313 + makenbm.setIncludes( includes) ;
61.314 +
61.315 + makenbm.execute() ;
61.316 +
61.317 + // Move the Info dir to Info_<locale>. //
61.318 + switchInfo( false, locale) ;
61.319 + }
61.320 +
61.321 + /** Return the license file associated with this locale if there is
61.322 + * one.
61.323 + */
61.324 + protected File getLicenseFile( String locale) {
61.325 + String license_prop_name = locale + ".license.file" ; //NOI18N
61.326 + String license_prop = getProject().getProperty(license_prop_name);
61.327 + File license = null ;
61.328 + if( license_prop != null) {
61.329 + license = new File( license_prop ) ;
61.330 + }
61.331 + return( license) ;
61.332 + }
61.333 +
61.334 + protected void switchInfo( boolean to_info,
61.335 + String locale) {
61.336 + File dir ;
61.337 +
61.338 + if( to_info) {
61.339 + dir = new File( topDir.getAbsolutePath() + File.separator + "Info_" + locale) ; //NOI18N
61.340 + dir.renameTo( new File( topDir.getAbsolutePath() + File.separator + "Info")) ; //NOI18N
61.341 + }
61.342 + else {
61.343 + dir = new File( topDir.getAbsolutePath() + File.separator + "Info") ; //NOI18N
61.344 + dir.renameTo( new File( topDir.getAbsolutePath() + File.separator + "Info_" + //NOI18N
61.345 + locale)) ;
61.346 + }
61.347 + }
61.348 +
61.349 + /** Get the localized version of the NBM filename. */
61.350 + protected String getLocalizedFileName( String locale) {
61.351 + return( baseFileName + "_" + locale + ".nbm") ; //NOI18N
61.352 + }
61.353 +
61.354 + protected String getLocales() {
61.355 + if( locales != null) {
61.356 + return( locales) ;
61.357 + }
61.358 + return( getGlobalProp( "locmakenbm.locales")) ; //NOI18N
61.359 + }
61.360 +
61.361 + /** See if there are any files for the given locale. */
61.362 + protected boolean hasFilesInLocale( String loc) {
61.363 + FileSet fs ;
61.364 + boolean ret = true ;
61.365 +
61.366 + // Setup a fileset to find files in this locale. //
61.367 + fs = new FileSet() ;
61.368 + fs.setDir( topDir) ;
61.369 + addLocalePatterns( fs, loc) ;
61.370 +
61.371 + // See if there are any localized files for this locale. //
61.372 + String[] inc_files = fs.getDirectoryScanner(getProject()).getIncludedFiles();
61.373 + if( inc_files.length == 0) {
61.374 + ret = false ;
61.375 + }
61.376 +
61.377 + return( ret) ;
61.378 + }
61.379 +
61.380 + /** Add the patterns to include the localized files for the given locale. */
61.381 + protected void addLocalePatterns( FileSet fs,
61.382 + String loc) {
61.383 + LinkedList list = new LinkedList() ;
61.384 + ListIterator iterator ;
61.385 +
61.386 + // Get the list of patterns for this locale. //
61.387 + addLocalePatterns( list, loc) ;
61.388 +
61.389 + // For each pattern for this locale. //
61.390 + iterator = list.listIterator( 0) ;
61.391 + while( iterator.hasNext()) {
61.392 +
61.393 + // Add it to the includes list. //
61.394 + fs.createInclude().setName( (String) iterator.next()) ;
61.395 + }
61.396 +
61.397 + }
61.398 +
61.399 + protected void addLocalePatterns( LinkedList list,
61.400 + String loc) {
61.401 + String dir = new String() ;
61.402 + String re = new String() ;
61.403 +
61.404 +
61.405 + dir = mainDir ; // modified for clusterization
61.406 + re = dir + "/**/*_" + loc + ".*" ; // pattern is: ${dir}/**/*_${locale}.* //NOI18N
61.407 + list.add( new String( re)) ;
61.408 + re = dir + "/**/" + loc + "/" ; // pattern is: ${dir}/${locale}/ //NOI18N
61.409 + list.add( new String( re)) ;
61.410 +
61.411 +// re = "**/*_" + loc + ".*" ; // pattern is: ${dir}/**/*_${locale}.* //NOI18N
61.412 +// list.add( new String( re)) ;
61.413 +// re = "**/" + loc + "/" ; // pattern is: ${dir}/${locale}/ //NOI18N
61.414 +// list.add( new String( re)) ;
61.415 +
61.416 + addLocIncludes( list, loc) ;
61.417 +
61.418 + // For ja locale, include these other variants. //
61.419 + if( loc.equals( "ja")) { //NOI18N
61.420 + addLocalePatterns( list, "ja_JP.PCK") ; //NOI18N
61.421 + addLocalePatterns( list, "ja_JP.eucJP") ; //NOI18N
61.422 + addLocalePatterns( list, "ja_JP.SJIS") ; //NOI18N
61.423 + addLocalePatterns( list, "ja_JP.UTF-8") ; //NOI18N
61.424 + addLocalePatterns( list, "ja_JP.UTF8") ; //NOI18N
61.425 + }
61.426 + }
61.427 +
61.428 + protected void addLocIncludes( LinkedList list,
61.429 + String loc) {
61.430 + StringTokenizer tkzr ;
61.431 + String locInc, incLocale, incPattern ;
61.432 + int idx ;
61.433 +
61.434 + if( locIncludes == null) {
61.435 + return ;
61.436 + }
61.437 +
61.438 + // For each locale-specific include. //
61.439 + tkzr = new StringTokenizer( locIncludes, ",\n\t ") ; //NOI18N
61.440 + while( tkzr.hasMoreTokens()) {
61.441 + locInc = tkzr.nextToken() ;
61.442 + idx = locInc.indexOf( ":") ; //NOI18N
61.443 + if( idx != -1) {
61.444 + incLocale = locInc.substring( 0, idx) ;
61.445 + incPattern = locInc.substring( idx+1) ;
61.446 + if( incLocale.equals( loc)) {
61.447 + list.add( new String( incPattern)) ;
61.448 + }
61.449 + }
61.450 + else {
61.451 + list.add( new String( locInc)) ;
61.452 + }
61.453 + }
61.454 + }
61.455 +
61.456 + protected String getGlobalProp( String name) {
61.457 + String ret ;
61.458 + ret = getProject().getProperty(name);
61.459 +
61.460 + // Don't return empty strings or strings whose value contains a //
61.461 + // property that isn't set. //
61.462 + if( ret != null) {
61.463 + if( ret.trim().equals( "")) { //NOI18N
61.464 + ret = null ;
61.465 + }
61.466 + else if( ret.indexOf( "${") != -1) { //NOI18N
61.467 + ret = null ;
61.468 + }
61.469 + }
61.470 + return( ret) ;
61.471 + }
61.472 +
61.473 + protected String getKeystore() {
61.474 + return( getGlobalProp( "locmakenbm.keystore")) ; //NOI18N
61.475 + }
61.476 +
61.477 + protected String getStorepass() {
61.478 + return( getGlobalProp( "locmakenbm.storepass")) ; //NOI18N
61.479 + }
61.480 +
61.481 + protected String getAlias() {
61.482 + return( getGlobalProp( "locmakenbm.alias")) ; //NOI18N
61.483 + }
61.484 +
61.485 + /** If the topDir doesn't exist, warn the user and return true. */
61.486 + protected boolean printMissingDirWarning() {
61.487 + boolean ret = false ;
61.488 + if( !topDir.exists()) {
61.489 + log( "WARNING: Skipping this task: Directory " + topDir.getPath() +
61.490 + " doesn't exist.") ;
61.491 + ret = true ;
61.492 + }
61.493 + return( ret) ;
61.494 + }
61.495 +
61.496 + /** If the localizing bundle is there, use it. */
61.497 + protected void setLocBundle( MakeLNBM makenbm,
61.498 + File bundle) {
61.499 + if( bundle != null && bundle.exists()) {
61.500 + makenbm.setLocBundle( bundle) ;
61.501 + }
61.502 + else {
61.503 + log( "WARNING: Localizing bundle not found: " +
61.504 + ((bundle==null)?(""):(bundle.getPath())) ) ; //NOI18N
61.505 + }
61.506 + }
61.507 +
61.508 + protected String getSrcDir( File file) {
61.509 + InputStreamReader isr ;
61.510 + FileInputStream fis ;
61.511 + char[] buf = new char[ 200] ;
61.512 + String s = null ;
61.513 + int idx, len ;
61.514 +
61.515 + try {
61.516 +
61.517 + // Read the srcdir from the file that locjar wrote. //
61.518 + fis = new FileInputStream( file) ;
61.519 + isr = new InputStreamReader( fis) ;
61.520 + len = isr.read( buf) ;
61.521 + if( len != -1) {
61.522 + if( buf[ len-1] == '\n') { //NOI18N
61.523 + len-- ;
61.524 + }
61.525 + s = new String( buf, 0, len) ;
61.526 + idx = s.indexOf( "=") ; //NOI18N
61.527 + if( idx != -1) {
61.528 + s = s.substring( idx + 1) ;
61.529 + s.trim() ;
61.530 + }
61.531 + else {
61.532 + s = null ;
61.533 + }
61.534 + }
61.535 + }
61.536 + catch( Exception e) {
61.537 + System.out.println( "ERROR: " + e.getMessage()) ;
61.538 + e.printStackTrace() ;
61.539 + throw new BuildException() ;
61.540 + }
61.541 + return( s) ;
61.542 + }
61.543 +
61.544 + protected File findLocBundle( MakeLNBM makenbm,
61.545 + String locale) {
61.546 + File srcdirfile, locdir ;
61.547 + int index ;
61.548 + String s, srcdir = null ;
61.549 +
61.550 + // See if the file containing the srcdir is there. //
61.551 + srcdirfile = new File( topDir.getAbsolutePath() + File.separator +
61.552 + "srcdir.properties") ; //NOI18N
61.553 + if( srcdirfile.exists()) {
61.554 + srcdir = getSrcDir( srcdirfile) ;
61.555 + }
61.556 +// if( srcdir == null) {
61.557 +// throw new BuildException( "ERROR: Could not get source dir from: " + srcdirfile.getPath()) ;
61.558 +// }
61.559 +
61.560 + // Get the codename of this module. //
61.561 + index = modInfo.indexOf( "/") ; //NOI18N
61.562 + if( index != -1) {
61.563 + s = modInfo.substring( 0, index) ;
61.564 + }
61.565 + else {
61.566 + s = new String( modInfo) ;
61.567 + }
61.568 +
61.569 + // Convert to pathname and set the loc bundle. //
61.570 + s = s.replace( '.', '/') ; //NOI18N
61.571 + locdir = new File( getRelPath( srcdir + "/" + s, findLocBundle). //NOI18N
61.572 + replace( '/', File.separatorChar)) ; //NOI18N
61.573 + return( getDefaultLocBundleFile( locdir, locale)) ;
61.574 + }
61.575 +
61.576 + protected File getDefaultLocBundleFile( File dir,
61.577 + String locale) {
61.578 + return( new File( dir.getPath() + File.separator + "Bundle_" + locale + ".properties")) ; //NOI18N
61.579 + }
61.580 +
61.581 + protected File getSpecificLocBundleFile( File enBundle,
61.582 + String locale) {
61.583 + String path = enBundle.getPath() ;
61.584 + int idx = path.lastIndexOf( '.') ; //NOI18N
61.585 + if( idx != -1) {
61.586 + return( new File( path.substring( 0, idx) + "_" + locale + path.substring( idx))) ; //NOI18N
61.587 + }
61.588 + else {
61.589 + return( new File( path + "_" + locale)) ; //NOI18N
61.590 + }
61.591 + }
61.592 +
61.593 + /** This supports ".." path elements at the start of path2. */
61.594 + protected String getRelPath( String path1,
61.595 + String path2) {
61.596 + int idx1, idx2 ;
61.597 +
61.598 + if( path2.equals( ".")) { //NOI18N
61.599 + return( path1) ;
61.600 + }
61.601 +
61.602 + // For each ".." element in path2. //
61.603 + while( true) {
61.604 + idx2 = path2.indexOf( "..") ; //NOI18N
61.605 + if( idx2 == -1) {
61.606 + break ;
61.607 + }
61.608 +
61.609 + // Strip off the ".." //
61.610 + path2 = path2.substring( 2) ;
61.611 +
61.612 + // Strip off the slash if it starts with slash. //
61.613 + idx2 = path2.indexOf( "/") ; //NOI18N
61.614 + if( idx2 == 0) {
61.615 + path2 = path2.substring( 1) ;
61.616 + }
61.617 +
61.618 + // Strip off the last element of path1. //
61.619 + idx1 = path1.lastIndexOf( "/") ; //NOI18N
61.620 + if( idx1 != -1) {
61.621 + path1 = path1.substring( 0, idx1) ;
61.622 + }
61.623 + }
61.624 +
61.625 + return( path1 + "/" + path2) ; //NOI18N
61.626 + }
61.627 +
61.628 +}
62.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
62.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/LocalizedJar.java Wed Feb 23 20:12:58 2011 -0500
62.3 @@ -0,0 +1,837 @@
62.4 +/*
62.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
62.6 + *
62.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
62.8 + *
62.9 + * The contents of this file are subject to the terms of either the GNU
62.10 + * General Public License Version 2 only ("GPL") or the Common
62.11 + * Development and Distribution License("CDDL") (collectively, the
62.12 + * "License"). You may not use this file except in compliance with the
62.13 + * License. You can obtain a copy of the License at
62.14 + * http://www.netbeans.org/cddl-gplv2.html
62.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
62.16 + * specific language governing permissions and limitations under the
62.17 + * License. When distributing the software, include this License Header
62.18 + * Notice in each file and include the License file at
62.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
62.20 + * particular file as subject to the "Classpath" exception as provided
62.21 + * by Sun in the GPL Version 2 section of the License file that
62.22 + * accompanied this code. If applicable, add the following below the
62.23 + * License Header, with the fields enclosed by brackets [] replaced by
62.24 + * your own identifying information:
62.25 + * "Portions Copyrighted [year] [name of copyright owner]"
62.26 + *
62.27 + * Contributor(s):
62.28 + *
62.29 + * The Original Software is NetBeans. The Initial Developer of the Original
62.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
62.31 + * Microsystems, Inc. All Rights Reserved.
62.32 + *
62.33 + * If you wish your version of this file to be governed by only the CDDL
62.34 + * or only the GPL Version 2, indicate your decision by adding
62.35 + * "[Contributor] elects to include this software in this distribution
62.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
62.37 + * single choice of license, a recipient has the option to distribute
62.38 + * your version of this file under either the CDDL, the GPL Version 2 or
62.39 + * to extend the choice of license to its licensees as provided above.
62.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
62.41 + * Version 2 license, then the option applies only if the new code is
62.42 + * made subject to such option by the copyright holder.
62.43 + */
62.44 +
62.45 +package org.netbeans.modules.visualweb.ravebuild;
62.46 +
62.47 +import java.io.*;
62.48 +import java.util.*;
62.49 +import java.util.Map; // override org.apache.tools.ant.Map
62.50 +import java.util.zip.*;
62.51 +import java.util.jar.*;
62.52 +
62.53 +import org.apache.tools.ant.*;
62.54 +import org.apache.tools.ant.taskdefs.MatchingTask;
62.55 +import org.apache.tools.ant.types.*;
62.56 +
62.57 +/** Create a JAR file with locale variants.
62.58 + * Whenever files are found which should be localized, or are the result
62.59 + * of localization, places them in separate JAR files named according to the locale,
62.60 + * in a <samp>locale/</samp> subdirectory of the directory containing the master JAR.
62.61 + * Each sub-JAR gets a manifest which just has some informational tags
62.62 + * indicating its purpose (locale and branding):
62.63 + * <code>X-Informational-Archive-Locale</code> and/or <code>X-Informational-Archive-Branding</code>.
62.64 + * The values may be e.g. <code>ja</code> or <code>f4j_ce</code>; or <code>-</code>
62.65 + * if there is no suffix for this JAR.
62.66 + * You can control the available locales; brandings; and set of files which should
62.67 + * always be considered part of the localizable base kit.
62.68 + * You can use the "branding" and "locale" subelements to control the branded
62.69 + * and localized .jar files that will be produced. Also, you can set the global
62.70 + * properties "locjar.brands" and "locjar.locales" to comma-separated
62.71 + * lists of branding or locale identifiers so that NetBeans-based projects can
62.72 + * brand or localize NetBeans without having to maintain modified versions of all
62.73 + * the individual Ant scripts
62.74 + * Originally this Ant task didn't recognize files below a directory with the
62.75 + * same name as a locale as being localized. Now it does so by default.
62.76 + * <p>Based on <code><zip></code> and <code><jar></code> tasks in Ant,
62.77 + * but not feasible to simply subclass or compose them.
62.78 + * @see <a href="http://www.netbeans.org/devhome/docs/i18n/index.html">NetBeans I18N documentation</a>
62.79 + * @author Jesse Glick
62.80 + */
62.81 +public class LocalizedJar extends MatchingTask {
62.82 +
62.83 + private List localeKits = new LinkedList (); // List<FileSet>
62.84 + private List locales = new LinkedList (); // List<LocaleOrB>
62.85 + private List brandings = new LinkedList (); // List<LocaleOrB>
62.86 + private File jarFile;
62.87 + private File baseDir;
62.88 + private boolean doCompress = false;
62.89 + private static long emptyCrc = new CRC32 ().getValue ();
62.90 + private List filesets = new LinkedList (); // List<FileSet>
62.91 + private File manifest;
62.92 + private boolean checkPathLocale = true ;
62.93 + private boolean warnMissingDir = false ;
62.94 + private boolean warnMissingDirSet = false ;
62.95 + private boolean preserveModuleJar = true;
62.96 + private boolean alwaysIncludeManifest = false;
62.97 +
62.98 + /** Locale or branding specifier.
62.99 + * Represents a complete locale or branding suffix,
62.100 + * e.g. <code>ja</code> or <code>ja_JP</code>
62.101 + * (but not simply <code>JP</code>).
62.102 + * For branding, e.g. <code>f4j</code> or <code>f4j_ce</code>.
62.103 + * You must include all relevant suffixes if you expect them to match
62.104 + * (but the task will handle a branding suffix combined with a locale
62.105 + * suffix, in that order).
62.106 + */
62.107 + public class LocaleOrB {
62.108 + String n;
62.109 + /** The suffix. */
62.110 + public void setName (String n) {
62.111 + this.n = n;
62.112 + }
62.113 + }
62.114 +
62.115 + /** Distinguish particular files that will be considered localizable.
62.116 + * This nested <samp><localekit></samp> has the same syntax as a FileSet.
62.117 + * So typically you will build a JAR from a fileset containing all build
62.118 + * products within a given directory; the "locale kit" should be a fileset
62.119 + * matching all properties files, for example, and maybe icons which you would
62.120 + * expect someone to try to localize--in general, anything which will be referenced
62.121 + * in code using a localized lookup (<code>NbBundle</code>).
62.122 + * While files with recognized localized (or branded) suffixes automatically go into
62.123 + * marked JARs in the <samp>locale/</samp> subdirectory, files considered part of the
62.124 + * locale kit also always go into this subdirectory; if they have no suffix, they will
62.125 + * be placed in a suffixless locale JAR.
62.126 + * So localizers can simply look at this JAR file and brand/localize it as they see fit.
62.127 + */
62.128 + public void addLocalekit (FileSet fs) {
62.129 + localeKits.add (fs);
62.130 + }
62.131 +
62.132 + /** Add a recognized locale suffix. */
62.133 + public LocaleOrB createLocale () {
62.134 + LocaleOrB l = new LocaleOrB ();
62.135 + locales.add (l);
62.136 + return l;
62.137 + }
62.138 +
62.139 + /** Add a recognized branding suffix. */
62.140 + public LocaleOrB createBranding () {
62.141 + LocaleOrB l = new LocaleOrB ();
62.142 + brandings.add (l);
62.143 + return l;
62.144 + }
62.145 +
62.146 + /** JAR file to create.
62.147 + * In fact this is the location of the "base" JAR;
62.148 + * locale-specific JARs may be created in the <samp>locale/</samp> subdirectory
62.149 + * of the directory containing this JAR, and will be named according to the name
62.150 + * of this JAR.
62.151 + * Compare Ant's <samp><jar></samp> task.
62.152 + */
62.153 + public void setJarfile (File jarFile) {
62.154 + if (! jarFile.getName ().endsWith (".jar")) {
62.155 + throw new BuildException ("jarfile attribute must be a file with *.jar extension");
62.156 + }
62.157 + if (jarFile.getParentFile () == null) {
62.158 + throw new BuildException ("jarfile attribute must have a containing directory");
62.159 + }
62.160 + this.jarFile = jarFile;
62.161 + }
62.162 +
62.163 + /** Base directory to JAR.
62.164 + * Compare Ant's <samp><jar></samp> task.
62.165 + */
62.166 + public void setBasedir (File baseDir) {
62.167 + this.baseDir = baseDir;
62.168 + }
62.169 +
62.170 + /** Turn on or off compression (default off).
62.171 + * Compare Ant's <samp><jar></samp> task.
62.172 + */
62.173 + public void setCompress(boolean compress) {
62.174 + doCompress = compress;
62.175 + }
62.176 +
62.177 + /** Turn on/off preserving original module jars with 'code'
62.178 + * Set it to 'true' to not allow overwriting of module jars
62.179 + * with localization/branding stuff
62.180 + */
62.181 + public void setPreserveModuleJar(boolean pmj) {
62.182 + preserveModuleJar = pmj;
62.183 + }
62.184 +
62.185 + /** Turn on/off inclusion of manifest even for localized and/or branded
62.186 + * jars. Set it to true if you want to add special manifest tags
62.187 + * to all produced jarfiles
62.188 + */
62.189 + public void setAlwaysIncludeManifest(boolean aim) {
62.190 + alwaysIncludeManifest = aim;
62.191 + }
62.192 +
62.193 + /** A set of files to JAR up.
62.194 + * Compare Ant's <samp><jar></samp> task.
62.195 + */
62.196 + public void addFileset (FileSet set) {
62.197 + filesets.add (set);
62.198 + }
62.199 +
62.200 + /** Manifest file for the JAR.
62.201 + * Compare Ant's <samp><jar></samp> task.
62.202 + */
62.203 + public void setManifest (File manifest) {
62.204 + this.manifest = manifest;
62.205 + }
62.206 +
62.207 + /** By default this is true. If set to false, then this task will
62.208 + * not recognize files below a directory with the same name as a
62.209 + * locale as being localized (unless the simple filename also
62.210 + * includes the locale).
62.211 + */
62.212 + public void setCheckPathLocale( boolean doit) {
62.213 + checkPathLocale = doit ;
62.214 + }
62.215 +
62.216 + /** This is false by default, in which case missing dirs in the
62.217 + * filesets cause a BuildException to be thrown. If true, then
62.218 + * a warning is printed but the build will continue.
62.219 + * This task will also look for a global property
62.220 + * "locjar.warnMissingDir" if this attribute isn't set.
62.221 + */
62.222 + public void setWarnMissingDir( boolean b) {
62.223 + warnMissingDir = b ;
62.224 + warnMissingDirSet = true ;
62.225 + }
62.226 +
62.227 + public void execute () throws BuildException {
62.228 +
62.229 + // Sanity checks:
62.230 + if (baseDir == null && filesets.size () == 0) {
62.231 + throw new BuildException ("basedir attribute must be set, or at least one fileset must be given!");
62.232 + }
62.233 + if (jarFile == null) {
62.234 + throw new BuildException ("You must specify the JAR file to create!");
62.235 + }
62.236 + if (manifest != null && ! manifest.isFile ()) {
62.237 + throw new BuildException ("The specified manifest does not actually exist.");
62.238 + }
62.239 +
62.240 + // If needed, warn that directories are missing. //
62.241 + if( shouldWarnMissingDir() && warnIfMissingDir()) {
62.242 +
62.243 + // Stop if dirs were missing. //
62.244 + return ;
62.245 + }
62.246 +
62.247 + // Look for global locales or brandings to use. //
62.248 + addGlobalLocaleAndBranding() ;
62.249 +
62.250 + //System.err.println ("Stage #1");
62.251 + // First find out which files need to be archived.
62.252 + Map allFiles = new HashMap (); // all files to do something with; Map<String,File> from JAR path to actual file
62.253 + // Populate it.
62.254 + {
62.255 + List scanners = new ArrayList (filesets.size () + 1); // List<FileScanner>
62.256 + if (baseDir != null) {
62.257 + scanners.add (getDirectoryScanner (baseDir));
62.258 + }
62.259 + Iterator it = filesets.iterator ();
62.260 + while (it.hasNext ()) {
62.261 + scanners.add(((FileSet) it.next()).getDirectoryScanner(getProject()));
62.262 + }
62.263 + it = scanners.iterator ();
62.264 + while (it.hasNext ()) {
62.265 + FileScanner scanner = (FileScanner) it.next ();
62.266 + File thisBaseDir = scanner.getBasedir ();
62.267 + String[] files = scanner.getIncludedFiles ();
62.268 + for (int i = 0; i < files.length; i++) {
62.269 + String name = files[i].replace (File.separatorChar, '/');
62.270 + if (name.equalsIgnoreCase ("META-INF/MANIFEST.MF")) {
62.271 + log ("Warning: ignoring META-INF/MANIFEST.MF found among scanned files", Project.MSG_WARN);
62.272 + continue;
62.273 + }
62.274 + allFiles.put (name, new File (thisBaseDir, files[i]));
62.275 + }
62.276 + }
62.277 + }
62.278 +
62.279 + //System.err.println ("Stage #2");
62.280 + // Now find all files which should always be put into a locale
62.281 + // kit (e.g. dir/locale/name.jar, no special locale or
62.282 + // branding, but distinguished as localizable/brandable).
62.283 + Set localeKitFiles = new HashSet (); // Set<File>; all locale-kit files
62.284 + // Populate this one.
62.285 + {
62.286 + Iterator it = localeKits.iterator ();
62.287 + while (it.hasNext ()) {
62.288 + FileScanner scanner = ((FileSet) it.next()).getDirectoryScanner(getProject());
62.289 + File thisBaseDir = scanner.getBasedir ();
62.290 + String[] files = scanner.getIncludedFiles ();
62.291 + for (int i = 0; i < files.length; i++) {
62.292 + localeKitFiles.add (new File (thisBaseDir, files[i]));
62.293 + }
62.294 + }
62.295 + }
62.296 +
62.297 + //System.err.println ("Stage #3");
62.298 + // Compute list of supported locales and brandings.
62.299 + List locales2 = new LinkedList (); // List<String>; all locales
62.300 + List brandings2 = new LinkedList (); // List<String>; all brandings
62.301 + // Initialize above two.
62.302 + {
62.303 + Iterator it = locales.iterator ();
62.304 + while (it.hasNext ()) {
62.305 + locales2.add (((LocaleOrB) it.next ()).n);
62.306 + }
62.307 + it = brandings.iterator ();
62.308 + while (it.hasNext ()) {
62.309 + brandings2.add (((LocaleOrB) it.next ()).n);
62.310 + }
62.311 + class InverseLengthComparator implements Comparator {
62.312 + public int compare (Object o1, Object o2) {
62.313 + String s1 = (String) o1;
62.314 + String s2 = (String) o2;
62.315 + return s2.length () - s1.length ();
62.316 + }
62.317 + }
62.318 + Comparator c = new InverseLengthComparator ();
62.319 + Collections.sort (locales2, c);
62.320 + Collections.sort (brandings2, c);
62.321 + }
62.322 +
62.323 + //System.err.println ("Stage #4");
62.324 + // Analyze where everything goes.
62.325 + Set jars = new HashSet (); // Set<File>; JAR files to build
62.326 + Map localeMarks = new HashMap (); // Map<File,String>; JAR files to locale (or null for basic JAR, "-" for blank)
62.327 + Map brandingMarks = new HashMap (); // Map<File,String>; JAR files to branding (or null for basic JAR, "-" for blank)
62.328 + 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)
62.329 + {
62.330 + String localeDir ;
62.331 + Iterator it = allFiles.entrySet ().iterator ();
62.332 + while (it.hasNext ()) {
62.333 + Map.Entry entry = (Map.Entry) it.next ();
62.334 + String path = (String) entry.getKey ();
62.335 +
62.336 +log( "==> Examining file: " + path, Project.MSG_DEBUG) ;
62.337 +
62.338 + File file = (File) entry.getValue ();
62.339 + // First see if it matches a known branding, locale, or pair of one of each.
62.340 + String testpath = path;
62.341 + int idx = testpath.lastIndexOf ('/');
62.342 + if (idx != -1) testpath = testpath.substring (idx + 1);
62.343 + idx = testpath.lastIndexOf ('.');
62.344 + if (idx != -1) testpath = testpath.substring (0, idx);
62.345 + String thisLocale = null;
62.346 + Iterator it2 = locales2.iterator ();
62.347 + while (it2.hasNext ()) {
62.348 + String tryLocale = (String) it2.next ();
62.349 + if (testpath.endsWith ("_" + tryLocale)) {
62.350 + thisLocale = tryLocale;
62.351 + testpath = testpath.substring (0, testpath.length () - 1 - tryLocale.length ());
62.352 + break;
62.353 + }
62.354 + }
62.355 + String thisBranding = null;
62.356 + it2 = brandings2.iterator ();
62.357 + while (it2.hasNext ()) {
62.358 + String tryBranding = (String) it2.next ();
62.359 + if (testpath.endsWith ("_" + tryBranding)) {
62.360 + thisBranding = tryBranding;
62.361 + break;
62.362 + }
62.363 + }
62.364 + File thisjar = null; // JAR to send this file to
62.365 +
62.366 + // Check if this file has a parent directory with the //
62.367 + // same name as one of the locales. //
62.368 + localeDir = checkInLocaleDir( file, locales2) ;
62.369 + if( localeDir != null) {
62.370 + thisLocale = localeDir ;
62.371 + }
62.372 +
62.373 +
62.374 + if( thisLocale != null) {
62.375 + log( " Locale: " + thisLocale, Project.MSG_DEBUG) ;
62.376 + } else {
62.377 + log( " Locale not set", Project.MSG_DEBUG) ;
62.378 + }
62.379 + if( thisBranding != null) {
62.380 + log( " Branding: " + thisBranding, Project.MSG_DEBUG) ;
62.381 + } else {
62.382 + log( " Branding not set", Project.MSG_DEBUG) ;
62.383 + }
62.384 + if( localeKitFiles.contains( file)) {
62.385 + log( " Localizable file.", Project.MSG_DEBUG) ;
62.386 + }
62.387 +
62.388 +
62.389 + if (thisLocale != null || thisBranding != null || localeKitFiles.contains (file)) {
62.390 + String name = jarFile.getName ();
62.391 + // We know jarFile is a *.jar so this is safe:
62.392 + name = name.substring (0, name.length () - 4);
62.393 + if (thisBranding != null) {
62.394 + name += '_' + thisBranding;
62.395 + }
62.396 + if (thisLocale != null) {
62.397 + name += '_' + thisLocale;
62.398 + }
62.399 + name += ".jar";
62.400 + if ((preserveModuleJar) && (thisBranding == null) && (thisLocale == null)) {
62.401 + thisjar = null;
62.402 + log(" Preserving module file (1): " + jarFile.getName(), Project.MSG_DEBUG);
62.403 + } else {
62.404 + thisjar = new File (new File (jarFile.getParentFile (), "locale"), name);
62.405 + localeMarks.put (thisjar, ((thisLocale != null) ? thisLocale : "-"));
62.406 + brandingMarks.put (thisjar, ((thisBranding != null) ? thisBranding : "-"));
62.407 + }
62.408 + } else {
62.409 + if (preserveModuleJar) {
62.410 + thisjar = null;
62.411 + log(" Preserving module file (2): " + jarFile.getName(), Project.MSG_DEBUG);
62.412 + } else {
62.413 + thisjar = jarFile;
62.414 + localeMarks.put (thisjar, null);
62.415 + brandingMarks.put (thisjar, null);
62.416 + }
62.417 + }
62.418 + if (thisjar != null) {
62.419 + log(" Adding file " + thisjar.getName() + " to 'jars' HashSet", Project.MSG_DEBUG);
62.420 + jars.add (thisjar);
62.421 + Map files = (Map) router.get (thisjar);
62.422 + if (files == null) {
62.423 + files = new TreeMap ();
62.424 + router.put (thisjar, files);
62.425 + }
62.426 + files.put (path, file);
62.427 + }
62.428 + }
62.429 + }
62.430 +
62.431 + //System.err.println ("Stage #5");
62.432 + // Go through JARs one by one, and build them (if necessary).
62.433 + {
62.434 + List jars2 = new ArrayList (jars);
62.435 + class FileNameComparator implements Comparator {
62.436 + public int compare (Object o1, Object o2) {
62.437 + File f1 = (File) o1;
62.438 + File f2 = (File) o2;
62.439 + return f1.toString ().compareTo (f2.toString ());
62.440 + }
62.441 + }
62.442 + Comparator c = new FileNameComparator ();
62.443 + Collections.sort (jars2, c);
62.444 + Iterator it = jars2.iterator ();
62.445 + while (it.hasNext ()) {
62.446 + File jar = (File) it.next ();
62.447 + Map files = (Map) router.get (jar); // Map<String,File>
62.448 + if (jar.exists ()) {
62.449 + // Do an up-to-date check first.
62.450 + long time = jar.lastModified ();
62.451 + if (manifest == null || manifest.lastModified () <= time) {
62.452 + boolean upToDate = true;
62.453 + Iterator it2 = files.values ().iterator ();
62.454 + while (it2.hasNext ()) {
62.455 + File f = (File) it2.next ();
62.456 + if (f.lastModified () > time) {
62.457 + upToDate = false;
62.458 + break;
62.459 + }
62.460 + }
62.461 + if (upToDate) {
62.462 + // Skip this JAR.
62.463 + continue;
62.464 + }
62.465 + }
62.466 + }
62.467 + log ("Building localized/branded jar: " + jar);
62.468 + IOException closing = null;
62.469 + try {
62.470 + jar.getParentFile ().mkdirs ();
62.471 + ZipOutputStream out = new ZipOutputStream (new FileOutputStream (jar));
62.472 + try {
62.473 + out.setMethod (doCompress ? ZipOutputStream.DEFLATED : ZipOutputStream.STORED);
62.474 + String localeMark = (String) localeMarks.get (jar);
62.475 + String brandingMark = (String) brandingMarks.get (jar);
62.476 + Set addedDirs = new HashSet (); // Set<String>
62.477 + // Add the manifest.
62.478 + InputStream is;
62.479 + long time;
62.480 + java.util.jar.Manifest mani;
62.481 + if (manifest != null && localeMark == null && brandingMark == null) {
62.482 + // Master JAR, and it has a manifest.
62.483 + is = new FileInputStream (manifest);
62.484 + time = manifest.lastModified ();
62.485 + try {
62.486 + mani = new java.util.jar.Manifest (is);
62.487 + } finally {
62.488 + is.close ();
62.489 + }
62.490 + } else if ((manifest != null) && (alwaysIncludeManifest)) {
62.491 + // always include specified manifest in localized/branded jars
62.492 + // such manifest must not contain attribute OpenIDE-Module
62.493 + // check supplied manifest and if contains key OpenIDE-Module, issue warning
62.494 + // and fallback to default Ant's manifest boilerplate (like no manifest was supplied)
62.495 + is = new FileInputStream (manifest);
62.496 + time = manifest.lastModified ();
62.497 + try {
62.498 + mani = new java.util.jar.Manifest (is);
62.499 + } finally {
62.500 + is.close ();
62.501 + }
62.502 + Attributes attr = mani.getMainAttributes ();
62.503 + //check if it's not module manifest for jarfile with localized/branded resources
62.504 + if ((attr.containsKey ("OpenIDE-Module")) && ((localeMark != null) || (brandingMark != null))){
62.505 + String lbmsg = "";
62.506 + if (localeMark != null) {
62.507 + lbmsg = "locale: '"+localeMark+"' ";
62.508 + }
62.509 + if (brandingMark != null) {
62.510 + lbmsg = "branding: '"+brandingMark+"' ";
62.511 + }
62.512 + log("WARNING: Ignoring supplied NetBeans module manifest for "+lbmsg+"jarfile '"+jar+"'. Using default Ant manifest bolilerplate. "
62.513 + +"Use -verbose option to see more details.", Project.MSG_INFO);
62.514 + log("WARNING(verbose): Supplied manifest file '"+manifest.getAbsolutePath()+"' contains "
62.515 + +"key OpenIDE-Module, which cannot be included in manifest of localized "
62.516 + +"and/or branded jar. Ignoring whole manifest for now. To fix this you have "
62.517 + +"to avoid using NetBeans module manifest file together with attribute "
62.518 + +"'allwaysincludemanifest' set to 'true' and non-empty properties 'locjar.locales' "
62.519 + +"and 'locjar.brands'. You can accomplish that by i.e. using Ant's <jar> task "
62.520 + +"for regular NetBeans module jarfile packaging and use NetBeans' Ant extension "
62.521 + +"task <"+this.getTaskName()+"> for localized and/or branded jars. Using default "
62.522 + +"Ant's manifest boilerplate instead.", Project.MSG_VERBOSE);
62.523 + try {
62.524 + is.close();
62.525 + } finally {
62.526 + is = MatchingTask.class.getResourceAsStream ("/org/apache/tools/ant/defaultManifest.mf");
62.527 + time = System.currentTimeMillis ();
62.528 + try {
62.529 + mani = new java.util.jar.Manifest (is);
62.530 + } finally {
62.531 + is.close ();
62.532 + }
62.533 + }
62.534 + }
62.535 + } else {
62.536 + // Some subsidiary JAR.
62.537 + is = MatchingTask.class.getResourceAsStream ("/org/apache/tools/ant/defaultManifest.mf");
62.538 + time = System.currentTimeMillis ();
62.539 + try {
62.540 + mani = new java.util.jar.Manifest (is);
62.541 + } finally {
62.542 + is.close ();
62.543 + }
62.544 + }
62.545 + Attributes attr = mani.getMainAttributes ();
62.546 + if (! attr.containsKey (Attributes.Name.MANIFEST_VERSION)) {
62.547 + attr.put (Attributes.Name.MANIFEST_VERSION, "1.0");
62.548 + }
62.549 + if (localeMark != null) {
62.550 + attr.putValue ("X-Informational-Archive-Locale", localeMark);
62.551 + }
62.552 + if (brandingMark != null) {
62.553 + attr.putValue ("X-Informational-Archive-Branding", brandingMark);
62.554 + }
62.555 + ByteArrayOutputStream baos = new ByteArrayOutputStream ();
62.556 + mani.write (baos);
62.557 + byte[] bytes = baos.toByteArray ();
62.558 + addToJar (new ByteArrayInputStream (bytes), new ByteArrayInputStream (bytes),
62.559 + out, "META-INF/MANIFEST.MF", time, addedDirs);
62.560 + // Now regular files.
62.561 + Iterator it2 = files.entrySet ().iterator ();
62.562 + while (it2.hasNext ()) {
62.563 + Map.Entry entry = (Map.Entry) it2.next ();
62.564 + String path = (String) entry.getKey ();
62.565 + File file = (File) entry.getValue ();
62.566 + addToJar (new FileInputStream (file), new FileInputStream (file),
62.567 + out, path, file.lastModified (), addedDirs);
62.568 + }
62.569 +
62.570 + // If desired, write the root of the srcDir to a file. //
62.571 + writeSrcDir() ;
62.572 + } finally {
62.573 + try {
62.574 + out.close ();
62.575 + } catch (IOException ex) {
62.576 + closing = ex;
62.577 + }
62.578 + }
62.579 +
62.580 + if (closing != null) {
62.581 + // if there was a closing exception and no other one
62.582 + throw closing;
62.583 + }
62.584 + } catch (IOException ioe) {
62.585 + String msg = "Problem creating JAR: " + ioe.getMessage ();
62.586 + if (! jar.delete ()) {
62.587 + msg += " (and the JAR is probably corrupt but I could not delete it)";
62.588 + }
62.589 + throw new BuildException(msg, ioe, getLocation());
62.590 + }
62.591 + }
62.592 + }
62.593 +
62.594 + } // end execute()
62.595 +
62.596 + private void addToJar (InputStream in1, InputStream in2, ZipOutputStream out,
62.597 + String path, long lastModified, Set addedDirs) throws IOException {
62.598 + try {
62.599 + if (path.endsWith ("/")) {
62.600 + throw new IOException ("Bad path: " + path);
62.601 + }
62.602 + // Add parent dirs as needed:
62.603 + int pos = -1;
62.604 + while ((pos = path.indexOf ('/', pos + 1)) != -1) {
62.605 + String dir = path.substring (0, pos + 1);
62.606 + if (! addedDirs.contains (dir)) {
62.607 + addedDirs.add (dir);
62.608 + ZipEntry ze = new ZipEntry (dir);
62.609 + ze.setSize (0);
62.610 + ze.setMethod (ZipEntry.STORED);
62.611 + ze.setCrc (emptyCrc);
62.612 + ze.setTime (lastModified);
62.613 + out.putNextEntry (ze);
62.614 + }
62.615 + }
62.616 + // Add the file itself:
62.617 + ZipEntry ze = new ZipEntry (path);
62.618 + ze.setMethod (doCompress ? ZipEntry.DEFLATED : ZipEntry.STORED);
62.619 + ze.setTime (lastModified);
62.620 + long size = 0;
62.621 + CRC32 crc = new CRC32 ();
62.622 + byte[] buf = new byte[4096];
62.623 + int read;
62.624 + while ((read = in1.read (buf)) != -1) {
62.625 + crc.update (buf, 0, read);
62.626 + size += read;
62.627 + }
62.628 + in1.close ();
62.629 + ze.setCrc (crc.getValue ());
62.630 + ze.setSize (size);
62.631 + out.putNextEntry (ze);
62.632 + while ((read = in2.read (buf)) != -1) {
62.633 + out.write (buf, 0, read);
62.634 + }
62.635 + } finally {
62.636 + in2.close ();
62.637 + in1.close ();
62.638 + }
62.639 + } // end addToJar()
62.640 +
62.641 +
62.642 + // If the name of any parent directory of this file is the same as //
62.643 + // one of the locales, return the locale. //
62.644 + protected String checkInLocaleDir( File file,
62.645 + List locales) {
62.646 +
62.647 + // See if this functionality is disabled. //
62.648 + if( !checkPathLocale) {
62.649 + return null ;
62.650 + }
62.651 +
62.652 + int idx ;
62.653 + String loc, locale_dir, ret = null ;
62.654 + String path = file.getPath() ;
62.655 + Iterator iter = locales.iterator() ;
62.656 +
62.657 + // For each locale. //
62.658 + while( iter.hasNext()) {
62.659 + loc = (String) iter.next() ;
62.660 +
62.661 + // If the path contains a dir with the same name as the //
62.662 + // locale. //
62.663 + locale_dir = new String( file.separator) ;
62.664 + locale_dir += loc ;
62.665 + locale_dir += file.separator ;
62.666 + idx = path.indexOf( locale_dir) ;
62.667 + if( idx != -1) {
62.668 +
62.669 + // Stop and return this locale. //
62.670 + ret = loc ;
62.671 + break ;
62.672 + }
62.673 + }
62.674 +
62.675 + return( ret) ;
62.676 + }
62.677 +
62.678 + ////////////////////////////////////////////////////////////////////
62.679 + // This section of code supports the feature that this class will //
62.680 + // look for global properties that specify locales and brandings //
62.681 + // that should be used. //
62.682 + protected void addGlobalLocaleAndBranding() {
62.683 + addGlobals( getGlobalLocaleVarName(), locales) ;
62.684 + addGlobals( getOldGlobalLocaleVarName(), locales) ;
62.685 + addGlobals( getGlobalBrandingVarName(), brandings) ;
62.686 + addGlobals( getOldGlobalBrandingVarName(), brandings) ;
62.687 + }
62.688 +
62.689 + protected String getGlobalLocaleVarName() {
62.690 + return( new String( "locjar.locales")) ;
62.691 + }
62.692 +
62.693 + protected String getGlobalBrandingVarName() {
62.694 + return( new String( "locjar.brands")) ;
62.695 + }
62.696 +
62.697 + // For backwards compatibility. //
62.698 + protected String getOldGlobalLocaleVarName() {
62.699 + return( new String( "locjar_global_locales")) ;
62.700 + }
62.701 +
62.702 + // For backwards compatibility. //
62.703 + protected String getOldGlobalBrandingVarName() {
62.704 + return( new String( "locjar_global_brands")) ;
62.705 + }
62.706 +
62.707 + protected void addGlobals( String var_name,
62.708 + List list) {
62.709 + String prop = null ;
62.710 + StringTokenizer tokenizer = null ;
62.711 + String tok = null ;
62.712 + LocaleOrB lorb = null ;
62.713 +
62.714 + // Foreach string in the global list. //
62.715 + prop = getProject().getProperty( var_name) ;
62.716 + if( prop != null && !prop.equals( "")) {
62.717 + tokenizer = new StringTokenizer( prop, ", ") ;
62.718 + while( tokenizer.hasMoreTokens()) {
62.719 + tok = tokenizer.nextToken() ;
62.720 +
62.721 + // Add a new entry in the given list. //
62.722 + lorb = new LocaleOrB() ;
62.723 + lorb.setName( tok) ;
62.724 + list.add( lorb) ;
62.725 + }
62.726 + }
62.727 + }
62.728 + //////////////////////////////////////////////////////////////////////
62.729 +
62.730 + protected boolean shouldWarnMissingDir() {
62.731 + String s ;
62.732 + boolean ret = false ; // Default false. //
62.733 +
62.734 + // If the attribute is set, use its value. //
62.735 + if( warnMissingDirSet) {
62.736 + ret = warnMissingDir ;
62.737 + }
62.738 +
62.739 + // Otherwise use the global property value, if set. //
62.740 + else {
62.741 + s = getProject().getProperty("locjar.warnMissingDir");
62.742 + if( s != null && !s.trim().equals( "")) {
62.743 + ret = getProject().toBoolean(s);
62.744 + }
62.745 + }
62.746 +
62.747 + return( ret) ;
62.748 + }
62.749 +
62.750 + // If any dir's don't exist, warn the user and return true. //
62.751 + protected boolean warnIfMissingDir() {
62.752 + ListIterator iter ;
62.753 + FileSet fileset ;
62.754 + File dir ;
62.755 + boolean ret = false ;
62.756 +
62.757 + // Print warning if the basedir doesn't exist. //
62.758 + if( baseDir != null && !baseDir.exists()) {
62.759 + ret = true ;
62.760 + printMissingDirWarning( baseDir) ;
62.761 + }
62.762 +
62.763 + // For each fileset. //
62.764 + iter = filesets.listIterator() ;
62.765 + if( iter != null) {
62.766 + while( iter.hasNext()) {
62.767 +
62.768 + // Print warning if the dir doesn't exist. //
62.769 + fileset = (FileSet) iter.next() ;
62.770 + dir = fileset.getDir(getProject());
62.771 + if( dir != null && !dir.exists()) {
62.772 + ret = true ;
62.773 + printMissingDirWarning( dir) ;
62.774 + }
62.775 + }
62.776 + }
62.777 + return( ret) ;
62.778 + }
62.779 +
62.780 + // Warn the user that the given dir doesn't exist. //
62.781 + protected void printMissingDirWarning( File dir) {
62.782 + log( "WARNING: Skipping this task: Directory " + dir.getPath() + " doesn't exist.") ;
62.783 + }
62.784 +
62.785 + protected boolean shouldWriteSrcDir() {
62.786 + boolean ret = false ;
62.787 + String s = getProject().getProperty("locjar.writeSrcDir");
62.788 + if( s != null && getProject().toBoolean(s)) {
62.789 + ret = true ;
62.790 + }
62.791 + return( ret) ;
62.792 + }
62.793 +
62.794 + protected void writeSrcDir() {
62.795 + String name ;
62.796 + int idx, fromIdx ;
62.797 + OutputStreamWriter osw ;
62.798 + FileOutputStream fos ;
62.799 + File file ;
62.800 +
62.801 + if( shouldWriteSrcDir() && jarFile != null && baseDir != null) {
62.802 + name = jarFile.getPath() ;
62.803 + fromIdx = getNetbeansStartIdx() ;
62.804 + idx = name.indexOf( File.separator+"netbeans"+File.separator, fromIdx) ;
62.805 + if( idx != -1) {
62.806 + try {
62.807 + file = new File( name.substring( 0, idx) + File.separator + "srcdir.properties") ;
62.808 + fos = new FileOutputStream( file) ;
62.809 + osw = new OutputStreamWriter( fos) ;
62.810 + osw.write( "srcdir=" + baseDir + "\n") ;
62.811 + osw.close() ;
62.812 + fos.close() ;
62.813 + }
62.814 + catch( Exception e) {
62.815 + System.out.println( "ERROR: " + e.getMessage()) ;
62.816 + e.printStackTrace() ;
62.817 + throw new BuildException() ;
62.818 + }
62.819 + }
62.820 + else {
62.821 + throw new BuildException( "ERROR: Couldn't find netbeans dir to write srcdir.properties to.") ;
62.822 + }
62.823 + }
62.824 + }
62.825 +
62.826 + // Return the index to start searching from to find the "netbeans"
62.827 + // directory into which the "srcdir.properties" file will be
62.828 + // written.
62.829 + protected int getNetbeansStartIdx() {
62.830 + int startIdx = 0 ;
62.831 + int idx ;
62.832 +
62.833 + idx = baseDir.getPath().lastIndexOf( File.separator+
62.834 + "netbeans"+File.separator) ;
62.835 + if( idx != -1) {
62.836 + startIdx = idx + 1 ;
62.837 + }
62.838 + return( startIdx) ;
62.839 + }
62.840 +}
63.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
63.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/MakeLNBM.java Wed Feb 23 20:12:58 2011 -0500
63.3 @@ -0,0 +1,894 @@
63.4 +/*
63.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
63.6 + *
63.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
63.8 + *
63.9 + * The contents of this file are subject to the terms of either the GNU
63.10 + * General Public License Version 2 only ("GPL") or the Common
63.11 + * Development and Distribution License("CDDL") (collectively, the
63.12 + * "License"). You may not use this file except in compliance with the
63.13 + * License. You can obtain a copy of the License at
63.14 + * http://www.netbeans.org/cddl-gplv2.html
63.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
63.16 + * specific language governing permissions and limitations under the
63.17 + * License. When distributing the software, include this License Header
63.18 + * Notice in each file and include the License file at
63.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
63.20 + * particular file as subject to the "Classpath" exception as provided
63.21 + * by Sun in the GPL Version 2 section of the License file that
63.22 + * accompanied this code. If applicable, add the following below the
63.23 + * License Header, with the fields enclosed by brackets [] replaced by
63.24 + * your own identifying information:
63.25 + * "Portions Copyrighted [year] [name of copyright owner]"
63.26 + *
63.27 + * Contributor(s):
63.28 + *
63.29 + * The Original Software is NetBeans. The Initial Developer of the Original
63.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
63.31 + * Microsystems, Inc. All Rights Reserved.
63.32 + *
63.33 + * If you wish your version of this file to be governed by only the CDDL
63.34 + * or only the GPL Version 2, indicate your decision by adding
63.35 + * "[Contributor] elects to include this software in this distribution
63.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
63.37 + * single choice of license, a recipient has the option to distribute
63.38 + * your version of this file under either the CDDL, the GPL Version 2 or
63.39 + * to extend the choice of license to its licensees as provided above.
63.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
63.41 + * Version 2 license, then the option applies only if the new code is
63.42 + * made subject to such option by the copyright holder.
63.43 + */
63.44 +
63.45 +package org.netbeans.modules.visualweb.ravebuild;
63.46 +
63.47 +import java.io.*;
63.48 +import java.util.*;
63.49 +import java.util.jar.*;
63.50 +import java.util.zip.*;
63.51 +import java.net.*;
63.52 +
63.53 +import org.apache.tools.ant.BuildException;
63.54 +import org.apache.tools.ant.Location;
63.55 +import org.apache.tools.ant.Project;
63.56 +import org.apache.tools.ant.taskdefs.MatchingTask;
63.57 +import org.apache.tools.ant.taskdefs.Jar;
63.58 +import org.apache.tools.ant.taskdefs.Zip;
63.59 +import org.apache.tools.ant.taskdefs.SignJar;
63.60 +import org.apache.tools.ant.types.FileSet;
63.61 +
63.62 +/** Makes a localized <code>.nbm</code> (<b>N</b>et<b>B</b>eans <b>M</b>odule) file.
63.63 + * This version is temporary, intended to be used only until
63.64 + * the functionality added to this version since rev 1.29
63.65 + * of MakeNBM.java can be added into MakeNBM.java
63.66 + *
63.67 + * @author Jerry Huth (email: jerry@solidstep.com)
63.68 + */
63.69 +public class MakeLNBM extends MatchingTask {
63.70 +
63.71 + /** The same syntax may be used for either <samp><license></samp> or
63.72 + * <samp><description></samp> subelements.
63.73 + * <p>By setting the property <code>makenbm.nocdata</code> to <code>true</code>,
63.74 + * you can avoid using XML <code>CDATA</code> (for compatibility with older versions
63.75 + * of Auto Update which could not handle it).
63.76 + */
63.77 + public class Blurb {
63.78 + /** You may embed a <samp><file></samp> element inside the blurb.
63.79 + * If there is text on either side of it, that will be separated
63.80 + * with a line of dashes automatically.
63.81 + * But use nested <samp><text></samp> for this purpose.
63.82 + */
63.83 + public class FileInsert {
63.84 + /** File location. */
63.85 + public void setLocation (File file) throws BuildException {
63.86 + log("Including contents of " + file, Project.MSG_VERBOSE);
63.87 + long lmod = file.lastModified ();
63.88 + if (lmod > mostRecentInput) mostRecentInput = lmod;
63.89 + addSeparator ();
63.90 + try {
63.91 + InputStream is = new FileInputStream (file);
63.92 + try {
63.93 + Reader r = new InputStreamReader (is, "UTF-8"); //NOI18N
63.94 + char[] buf = new char[4096];
63.95 + int len;
63.96 + while ((len = r.read (buf)) != -1)
63.97 + text.append (buf, 0, len);
63.98 + } finally {
63.99 + is.close ();
63.100 + }
63.101 + } catch (IOException ioe) {
63.102 + throw new BuildException ("Exception reading blurb from " + file, ioe, getLocation ());
63.103 + }
63.104 + }
63.105 + }
63.106 + private StringBuffer text = new StringBuffer ();
63.107 + private String name = null;
63.108 + /** There may be freeform text inside the element. Prefer to use nested elements. */
63.109 + public void addText (String t) {
63.110 + addSeparator ();
63.111 + // Strips indentation. Needed because of common style:
63.112 + // <description>
63.113 + // Some text here.
63.114 + // And another line.
63.115 + // </description>
63.116 + t = getProject().replaceProperties(t.trim());
63.117 + int min = Integer.MAX_VALUE;
63.118 + StringTokenizer tok = new StringTokenizer (t, "\n"); //NOI18N
63.119 + boolean first = true;
63.120 + while (tok.hasMoreTokens ()) {
63.121 + String line = tok.nextToken ();
63.122 + if (first) {
63.123 + first = false;
63.124 + } else {
63.125 + int i;
63.126 + for (i = 0;
63.127 + i < line.length () &&
63.128 + Character.isWhitespace (line.charAt (i));
63.129 + i++)
63.130 + ;
63.131 + if (i < min) min = i;
63.132 + }
63.133 + }
63.134 + if (min == 0) {
63.135 + text.append (t);
63.136 + } else {
63.137 + tok = new StringTokenizer (t, "\n"); //NOI18N
63.138 + first = true;
63.139 + while (tok.hasMoreTokens ()) {
63.140 + String line = tok.nextToken ();
63.141 + if (first) {
63.142 + first = false;
63.143 + } else {
63.144 + text.append ('\n'); //NOI18N
63.145 + line = line.substring (min);
63.146 + }
63.147 + text.append (line);
63.148 + }
63.149 + }
63.150 + }
63.151 + /** Contents of a file to include. */
63.152 + public FileInsert createFile () {
63.153 + return new FileInsert ();
63.154 + }
63.155 + /** Text to include literally. */
63.156 + public class Text {
63.157 + public void addText(String t) {
63.158 + Blurb.this.addText(t);
63.159 + }
63.160 + }
63.161 + // At least on Ant 1.3, mixed content does not work: all the text is added
63.162 + // first, then all the file inserts. Need to use subelements to be sure.
63.163 + /** Include nested literal text. */
63.164 + public Text createText() {
63.165 + return new Text();
63.166 + }
63.167 + private void addSeparator () {
63.168 + if (text.length () > 0) {
63.169 + // some sort of separator
63.170 + if (text.charAt (text.length () - 1) != '\n') //NOI18N
63.171 + text.append ('\n'); //NOI18N
63.172 + text.append ("-----------------------------------------------------\n"); //NOI18N
63.173 + }
63.174 + }
63.175 + public String getText () {
63.176 + String nocdata = getProject().getProperty("makenbm.nocdata"); //NOI18N
63.177 + if (nocdata != null && Project.toBoolean(nocdata)) {
63.178 + return xmlEscape(text.toString());
63.179 + } else {
63.180 + return "<![CDATA[" + text.toString () + "]]>"; //NOI18N
63.181 + }
63.182 + }
63.183 + /** You can either set a name for the blurb, or using the <code>file</code> attribute does this.
63.184 + * The name is mandatory for licenses, as this identifies the license in
63.185 + * an update description.
63.186 + */
63.187 + public void setName (String name) {
63.188 + this.name = name;
63.189 + }
63.190 + public String getName () {
63.191 + return name;
63.192 + }
63.193 + /** Include a file (and set the license name according to its basename). */
63.194 + public void setFile (File file) {
63.195 + // This actually adds the text and so on:
63.196 + new FileInsert ().setLocation (file);
63.197 + // Default for the name too, as a convenience.
63.198 + if (name == null) name = file.getName ();
63.199 + }
63.200 + }
63.201 +
63.202 + public class ExternalPackage {
63.203 + String name = null;
63.204 + String targetName = null;
63.205 + String startUrl = null;
63.206 + String description = null;
63.207 +
63.208 + public void setName(String n) {
63.209 + this.name = n;
63.210 + }
63.211 +
63.212 + public void setTargetName(String t) {
63.213 + this.targetName = t;
63.214 + }
63.215 +
63.216 + public void setStartURL(String u) {
63.217 + this.startUrl = u;
63.218 + }
63.219 +
63.220 + public void setDescription(String d) {
63.221 + this.description = d;
63.222 + }
63.223 +
63.224 + }
63.225 +
63.226 + // Similar to org.openide.xml.XMLUtil methods.
63.227 + private static String xmlEscape(String s) {
63.228 + int max = s.length();
63.229 + StringBuffer s2 = new StringBuffer((int)(max * 1.1 + 1));
63.230 + for (int i = 0; i < max; i++) {
63.231 + char c = s.charAt(i);
63.232 + switch (c) {
63.233 + case '<': //NOI18N
63.234 + s2.append("<"); //NOI18N
63.235 + break;
63.236 + case '>': //NOI18N
63.237 + s2.append(">"); //NOI18N
63.238 + break;
63.239 + case '&': //NOI18N
63.240 + s2.append("&"); //NOI18N
63.241 + break;
63.242 + case '"': //NOI18N
63.243 + s2.append("""); //NOI18N
63.244 + break;
63.245 + default:
63.246 + s2.append(c);
63.247 + break;
63.248 + }
63.249 + }
63.250 + return s2.toString();
63.251 + }
63.252 +
63.253 + /** <samp><signature></samp> subelement for signing the NBM. */
63.254 + public /*static*/ class Signature {
63.255 + public File keystore;
63.256 + public String storepass, alias;
63.257 + /** Path to the keystore (private key). */
63.258 + public void setKeystore (File f) {
63.259 + keystore = f;
63.260 + }
63.261 + /** Password for the keystore.
63.262 + * If a question mark (<samp>?</samp>), the NBM will not be signed
63.263 + * and a warning will be printed.
63.264 + */
63.265 + public void setStorepass (String s) {
63.266 + storepass = s;
63.267 + }
63.268 + /** Alias for the private key. */
63.269 + public void setAlias (String s) {
63.270 + alias = s;
63.271 + }
63.272 + }
63.273 +
63.274 + private File file = null;
63.275 + private File topdir = null;
63.276 + private File manifest = null;
63.277 + /** see #13850 for explanation */
63.278 + private File module = null;
63.279 + private String homepage = null;
63.280 + private String distribution = null;
63.281 + private String needsrestart = null;
63.282 + private Blurb license = null;
63.283 + private Blurb description = null;
63.284 + private Blurb notification = null;
63.285 + private Signature signature = null;
63.286 + private long mostRecentInput = 0L;
63.287 + private boolean isStandardInclude = true;
63.288 + private Vector externalPackages = null;
63.289 + private boolean manOrModReq = true ;
63.290 + private boolean manOrModReqSet = false ;
63.291 + private String langCode = null ;
63.292 + private String brandingCode = null ;
63.293 + private String modInfo = null ;
63.294 + private File locBundle = null ; // Localizing Bundle
63.295 + private String global = null;
63.296 +
63.297 + /** Install globally? */
63.298 + public void setGlobal (String isGlobal) {
63.299 + this.global = isGlobal;
63.300 + }
63.301 +
63.302 + /** Include netbeans directory - default is true */
63.303 + public void setIsStandardInclude(boolean isStandardInclude) {
63.304 + this.isStandardInclude = isStandardInclude;
63.305 + }
63.306 +
63.307 + /** Name of resulting NBM file. */
63.308 + public void setFile (File file) {
63.309 + this.file = file;
63.310 + }
63.311 + /** Top directory.
63.312 + * Expected to contain a subdirectory <samp>netbeans/</samp> with the
63.313 + * desired contents of the NBM.
63.314 + * Will create <samp>Info/info.xml</samp> with metadata.
63.315 + */
63.316 + public void setTopdir (File topdir) {
63.317 + this.topdir = topdir;
63.318 + }
63.319 + /** Module manifest needed for versioning.
63.320 + * @deprecated Use {@link #setModule} instead.
63.321 + */
63.322 + public void setManifest (File manifest) {
63.323 + this.manifest = manifest;
63.324 + long lmod = manifest.lastModified ();
63.325 + if (lmod > mostRecentInput) mostRecentInput = lmod;
63.326 + log(getLocation() + "The 'manifest' attr on <makenbm> is deprecated, please use 'module' instead", Project.MSG_WARN);
63.327 + }
63.328 + /** Module JAR needed for generating the info file.
63.329 + * Information may be gotten either from its manifest,
63.330 + * or if it declares OpenIDE-Module-Localizing-Bundle in its
63.331 + * manifest, from that bundle.
63.332 + * The base locale variant, if any, is also checked if necessary
63.333 + * for the named bundle.
63.334 + * Currently no other locale variants of the module are examined;
63.335 + * the information is available but there is no published specification
63.336 + * of what the resulting variant NBMs (or variant information within
63.337 + * the NBM) should look like.
63.338 + */
63.339 + public void setModule(File module) {
63.340 + this.module = module;
63.341 + // mostRecentInput updated below...
63.342 + }
63.343 + /** URL to a home page describing the module. */
63.344 + public void setHomepage (String homepage) {
63.345 + this.homepage = homepage;
63.346 + }
63.347 + /** Does module need IDE restart to be installed? */
63.348 + public void setNeedsrestart (String needsrestart) {
63.349 + this.needsrestart = needsrestart;
63.350 + }
63.351 + /** URL where this NBM file is expected to be downloadable from. */
63.352 + public void setDistribution (String distribution) throws BuildException {
63.353 + if (distribution.startsWith("http://")) { //NOI18N
63.354 + this.distribution = distribution;
63.355 + } else if (!(distribution.equals(""))) {
63.356 + // workaround for typical bug in build script
63.357 + this.distribution = "http://" + distribution; //NOI18N
63.358 + } else {
63.359 + throw new BuildException("Distribution URL is empty, check build.xml file", getLocation());
63.360 + }
63.361 + // check the URL
63.362 + try {
63.363 + URI uri = java.net.URI.create(this.distribution);
63.364 + } catch (IllegalArgumentException ile) {
63.365 + throw new BuildException("Distribution URL \"" + this.distribution + "\" is not a valid URI", ile, getLocation());
63.366 + }
63.367 + }
63.368 + public Blurb createLicense () {
63.369 + return (license = new Blurb ());
63.370 + }
63.371 + public Blurb createNotification () {
63.372 + return (notification = new Blurb ());
63.373 + }
63.374 + public Blurb createDescription () {
63.375 + 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);
63.376 + return (description = new Blurb ());
63.377 + }
63.378 + public Signature createSignature () {
63.379 + return (signature = new Signature ());
63.380 + }
63.381 +
63.382 + public ExternalPackage createExternalPackage(){
63.383 + ExternalPackage externalPackage = new ExternalPackage ();
63.384 + if (externalPackages == null)
63.385 + externalPackages = new Vector();
63.386 + externalPackages.add( externalPackage );
63.387 + return externalPackage;
63.388 + }
63.389 +
63.390 + public void execute () throws BuildException {
63.391 + if (file == null) {
63.392 + throw new BuildException("must set file for makenbm", getLocation());
63.393 + }
63.394 + if (manifest == null && module == null && reqManOrMod()) {
63.395 + throw new BuildException("must set module for makenbm", getLocation());
63.396 + }
63.397 + if (manifest != null && module != null) {
63.398 + throw new BuildException("cannot set both manifest and module for makenbm", getLocation());
63.399 + }
63.400 + // Will create a file Info/info.xml to be stored alongside netbeans/ contents.
63.401 + File infodir = new File (topdir, "Info"); //NOI18N
63.402 + infodir.mkdirs ();
63.403 + File infofile = new File (infodir, "info.xml"); //NOI18N
63.404 + if (infofile.exists ()) {
63.405 + infofile.delete();
63.406 + }
63.407 + Attributes attr = null;
63.408 + if (module != null) {
63.409 + // The normal case; read attributes from its manifest and maybe bundle.
63.410 + long mMod = module.lastModified();
63.411 + if (mostRecentInput < mMod) mostRecentInput = mMod;
63.412 + try {
63.413 + JarFile modulejar = new JarFile(module);
63.414 + try {
63.415 + attr = modulejar.getManifest().getMainAttributes();
63.416 + String bundlename = attr.getValue("OpenIDE-Module-Localizing-Bundle"); //NOI18N
63.417 + if (bundlename != null) {
63.418 + Properties p = new Properties();
63.419 + ZipEntry bundleentry = modulejar.getEntry(bundlename);
63.420 + if (bundleentry != null) {
63.421 + InputStream is = modulejar.getInputStream(bundleentry);
63.422 + try {
63.423 + p.load(is);
63.424 + } finally {
63.425 + is.close();
63.426 + }
63.427 + } else {
63.428 + // Not found in main JAR, check locale variant JAR.
63.429 + File variant = new File(new File(module.getParentFile(), "locale"), module.getName()); //NOI18N
63.430 + if (!variant.isFile()) throw new BuildException(bundlename + " not found in " + module, getLocation());
63.431 + long vmMod = variant.lastModified();
63.432 + if (mostRecentInput < vmMod) mostRecentInput = vmMod;
63.433 + ZipFile variantjar = new ZipFile(variant);
63.434 + try {
63.435 + bundleentry = variantjar.getEntry(bundlename);
63.436 + if (bundleentry == null) throw new BuildException(bundlename + " not found in " + module + " nor in " + variant, getLocation());
63.437 + InputStream is = variantjar.getInputStream(bundleentry);
63.438 + try {
63.439 + p.load(is);
63.440 + } finally {
63.441 + is.close();
63.442 + }
63.443 + } finally {
63.444 + variantjar.close();
63.445 + }
63.446 + }
63.447 + // Now pick up attributes from the bundle.
63.448 + Iterator it = p.entrySet().iterator();
63.449 + while (it.hasNext()) {
63.450 + Map.Entry entry = (Map.Entry)it.next();
63.451 + String name = (String)entry.getKey();
63.452 + if (! name.startsWith("OpenIDE-Module-")) continue; //NOI18N
63.453 + attr.putValue(name, (String)entry.getValue());
63.454 + }
63.455 + } // else all loc attrs in main manifest, OK
63.456 + } finally {
63.457 + modulejar.close();
63.458 + }
63.459 + } catch (IOException ioe) {
63.460 + throw new BuildException("exception while reading " + module, ioe, getLocation());
63.461 + }
63.462 + } // else we will read attr later if info file is out of date
63.463 + boolean skipInfo = false;
63.464 + if (infofile.exists ()) {
63.465 + // Check for up-to-date w.r.t. manifest and maybe license file.
63.466 + long iMod = infofile.lastModified ();
63.467 + if (mostRecentInput < iMod)
63.468 + skipInfo = true;
63.469 + }
63.470 + if (! skipInfo) {
63.471 + log ("Creating NBM info file " + infofile);
63.472 + if (manifest != null) {
63.473 + // Read module manifest for main attributes.
63.474 + try {
63.475 + InputStream manifestStream = new FileInputStream (manifest);
63.476 + try {
63.477 + attr = new Manifest (manifestStream).getMainAttributes ();
63.478 + } finally {
63.479 + manifestStream.close ();
63.480 + }
63.481 + } catch (IOException e) {
63.482 + throw new BuildException("exception when reading manifest " + manifest, e, getLocation());
63.483 + }
63.484 + } // else we read attr before
63.485 + try {
63.486 + OutputStream infoStream = new FileOutputStream (infofile);
63.487 + try {
63.488 + PrintWriter ps = new PrintWriter(new OutputStreamWriter(infoStream, "UTF-8"));
63.489 + // Begin writing XML.
63.490 + ps.println ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //NOI18N
63.491 + ps.println("<!DOCTYPE module PUBLIC \"-//NetBeans//DTD Autoupdate Module Info 2.3//EN\" \"http://www.netbeans.org/dtds/autoupdate-info-2_3.dtd\">"); //NOI18N
63.492 + if( attr != null) {
63.493 + String codenamebase = attr.getValue ("OpenIDE-Module"); //NOI18N
63.494 + if (codenamebase == null)
63.495 + throw new BuildException("invalid manifest, does not contain OpenIDE-Module", getLocation());
63.496 + // Strip major release number if any.
63.497 + codenamebase = getCodenameBase( codenamebase) ;
63.498 + ps.println ("<module codenamebase=\"" + xmlEscape(codenamebase) + "\""); //NOI18N
63.499 + }
63.500 + else {
63.501 + ps.print( "<module "); //NOI18N
63.502 + if( modInfo != null && !modInfo.trim().equals( "")) {
63.503 + String codenamebase = getCodenameBase( modInfo) ;
63.504 + ps.println( "codenamebase=\"" + xmlEscape(codenamebase) + "\""); //NOI18N
63.505 + }
63.506 + else {
63.507 + ps.println( "") ; //NOI18N
63.508 + }
63.509 + }
63.510 + if (homepage != null)
63.511 + ps.println (" homepage=\"" + xmlEscape(homepage) + "\""); //NOI18N
63.512 + if (distribution != null) {
63.513 + ps.println (" distribution=\"" + xmlEscape(distribution) + "\""); //NOI18N
63.514 + } else {
63.515 + throw new BuildException("NBM distribution URL is not set", getLocation());
63.516 + }
63.517 + // Here we only write a name for the license.
63.518 + if (license != null) {
63.519 + String name = license.getName ();
63.520 + if (name == null)
63.521 + throw new BuildException("Every license must have a name or file attribute", getLocation());
63.522 + ps.println (" license=\"" + xmlEscape(name) + "\""); //NOI18N
63.523 + }
63.524 + ps.println (" downloadsize=\"0\""); //NOI18N
63.525 + if (needsrestart != null)
63.526 + ps.println (" needsrestart=\"" + xmlEscape(needsrestart) + "\""); //NOI18N
63.527 + if ((global != null) && (!global.equals(""))) { //NOI18N
63.528 + ps.println (" global=\"" + xmlEscape(global) + "\""); //NOI18N
63.529 + }
63.530 + ps.println (">"); //NOI18N
63.531 + if (description != null) {
63.532 + ps.print (" <description>"); //NOI18N
63.533 + ps.print (description.getText ());
63.534 + ps.println ("</description>"); //NOI18N
63.535 + }
63.536 +
63.537 + // Write manifest attributes.
63.538 + if( attr != null) {
63.539 + ps.print (" <manifest "); //NOI18N
63.540 + boolean firstline = true;
63.541 + List attrNames = new ArrayList(attr.size()); // List<String>
63.542 + Iterator it = attr.keySet().iterator();
63.543 + while (it.hasNext()) {
63.544 + attrNames.add(((Attributes.Name)it.next()).toString());
63.545 + }
63.546 + Collections.sort(attrNames);
63.547 + it = attrNames.iterator();
63.548 + while (it.hasNext()) {
63.549 + String name = (String)it.next();
63.550 + // Ignore irrelevant attributes (cf. www/www/dtds/autoupdate-catalog-2_0.dtd
63.551 + // and www/www/dtds/autoupdate-info-1_0.dtd):
63.552 + if (! name.startsWith("OpenIDE-Module")) continue; //NOI18N
63.553 + if (name.equals("OpenIDE-Module-Localizing-Bundle")) continue; //NOI18N
63.554 + if (name.equals("OpenIDE-Module-Install")) continue; //NOI18N
63.555 + if (name.equals("OpenIDE-Module-Layer")) continue; //NOI18N
63.556 + if (name.equals("OpenIDE-Module-Description")) continue; //NOI18N
63.557 + if (name.equals("OpenIDE-Module-Package-Dependency-Message")) continue; //NOI18N
63.558 + if (name.equals("OpenIDE-Module-Public-Packages")) continue; //NOI18N
63.559 + if (firstline)
63.560 + firstline = false;
63.561 + else
63.562 + ps.print (" "); //NOI18N
63.563 + ps.println(name + "=\"" + xmlEscape(attr.getValue(name)) + "\""); //NOI18N
63.564 + }
63.565 + ps.println (" />"); //NOI18N
63.566 + }
63.567 + else if( modInfo != null && !modInfo.trim().equals( "")) { //NOI18N
63.568 + String specver, majorver ;
63.569 +
63.570 + // Write the l10n tag and lang/branding codes. //
63.571 + ps.println(" <l10n "); //NOI18N
63.572 + if( langCode != null && !langCode.trim().equals( "")) { //NOI18N
63.573 + ps.println( " langcode=\"" + xmlEscape(langCode) + "\"") ; //NOI18N
63.574 + }
63.575 + if( brandingCode != null && !brandingCode.trim().equals( "")) { //NOI18N
63.576 + ps.println( " brandingcode=\"" + xmlEscape(brandingCode) + "\"") ; //NOI18N
63.577 + }
63.578 +
63.579 + // Write the major version if possible. //
63.580 + majorver = getMajorVer( modInfo) ;
63.581 + if( majorver != null && !majorver.trim().equals( "")) { //NOI18N
63.582 + ps.println( " module_major_version=\"" + xmlEscape(majorver) + "\"") ; //NOI18N
63.583 + }
63.584 +
63.585 + // Write the spec version if possible. //
63.586 + specver = getSpecVer( modInfo) ;
63.587 + if( specver != null && !specver.trim().equals( "")) { //NOI18N
63.588 + ps.println( " module_spec_version=\"" + xmlEscape(specver) + "\"") ; //NOI18N
63.589 + }
63.590 +
63.591 + // Read localizing bundle and write relevant attr's. //
63.592 + if( locBundle != null) {
63.593 + writeLocBundleAttrs( ps) ;
63.594 + }
63.595 +
63.596 + ps.println( " />") ; //NOI18N
63.597 + }
63.598 +
63.599 + // Maybe write out license text.
63.600 + if (license != null) {
63.601 + ps.print (" <license name=\"" + xmlEscape(license.getName ()) + "\">"); //NOI18N
63.602 + ps.print (license.getText ());
63.603 + ps.println ("</license>"); //NOI18N
63.604 + }
63.605 + if (notification != null) {
63.606 + ps.print(" <module_notification>"); //NOI18N
63.607 + ps.print(notification.getText());
63.608 + ps.println("</module_notification>"); //NOI18N
63.609 + }
63.610 + if (externalPackages != null) {
63.611 + Enumeration exp = externalPackages.elements();
63.612 + while (exp.hasMoreElements()) {
63.613 + ExternalPackage externalPackage = (ExternalPackage) exp.nextElement();
63.614 + if (externalPackage.name == null ||
63.615 + externalPackage.targetName == null ||
63.616 + externalPackage.startUrl == null)
63.617 + throw new BuildException("Must define name, targetname, starturl for external package");
63.618 + ps.print(" <external_package "); //NOI18N
63.619 + ps.print("name=\""+xmlEscape(externalPackage.name)+"\" "); //NOI18N
63.620 + ps.print("target_name=\""+xmlEscape(externalPackage.targetName)+"\" "); //NOI18N
63.621 + ps.print("start_url=\""+xmlEscape(externalPackage.startUrl)+"\""); //NOI18N
63.622 + if (externalPackage.description != null)
63.623 + ps.print(" description=\""+xmlEscape(externalPackage.description)+"\""); //NOI18N
63.624 + ps.println("/>"); //NOI18N
63.625 + }
63.626 + }
63.627 + ps.println ("</module>"); //NOI18N
63.628 + ps.flush();
63.629 + } finally {
63.630 + infoStream.close ();
63.631 + }
63.632 + } catch (IOException e) {
63.633 + throw new BuildException("exception when creating Info/info.xml", e, getLocation());
63.634 + }
63.635 + }
63.636 +
63.637 + // JAR it all up together.
63.638 + long jarModified = file.lastModified (); // may be 0
63.639 + //log ("Ensuring existence of NBM file " + file);
63.640 + Jar jar = (Jar) getProject().createTask("jar"); //NOI18N
63.641 + jar.setJarfile (file);
63.642 + //jar.setBasedir (topdir.getAbsolutePath ());
63.643 + jar.setCompress(true);
63.644 + //jar.createInclude ().setName ("netbeans/"); //NOI18N
63.645 + //jar.createInclude ().setName ("Info/info.xml"); //NOI18N
63.646 + jar.addFileset (getFileSet());
63.647 + jar.setLocation(getLocation());
63.648 + jar.init ();
63.649 + jar.execute ();
63.650 + // Maybe sign it.
63.651 + if (signature != null && file.lastModified () != jarModified) {
63.652 + if (signature.keystore == null)
63.653 + throw new BuildException ("must define keystore attribute on <signature/>");
63.654 + if (signature.storepass == null)
63.655 + throw new BuildException ("must define storepass attribute on <signature/>");
63.656 + if (signature.alias == null)
63.657 + throw new BuildException ("must define alias attribute on <signature/>");
63.658 + if (signature.storepass.equals ("?") || !signature.keystore.exists()) {
63.659 + log ("Not signing NBM file " + file + "; no stored-key password provided or keystore ("
63.660 + + signature.keystore.toString() + ") doesn't exist", Project.MSG_WARN);
63.661 + } else {
63.662 + log ("Signing NBM file " + file);
63.663 + SignJar signjar = (SignJar) getProject().createTask("signjar"); //NOI18N
63.664 + //I have to use Reflection API, because there was changed API in ANT1.5
63.665 + try {
63.666 + try {
63.667 + Class[] paramsT = {String.class};
63.668 + Object[] paramsV1 = {signature.keystore.getAbsolutePath()};
63.669 + Object[] paramsV2 = {file.getAbsolutePath()};
63.670 + signjar.getClass().getDeclaredMethod( "setKeystore", paramsT ).invoke( signjar, paramsV1 ); //NOI18N
63.671 + signjar.getClass().getDeclaredMethod( "setJar", paramsT ).invoke( signjar, paramsV2 ); //NOI18N
63.672 + } catch (NoSuchMethodException ex1) {
63.673 + //Probably ANT 1.5
63.674 + try {
63.675 + Class[] paramsT = {File.class};
63.676 + Object[] paramsV1 = {signature.keystore};
63.677 + Object[] paramsV2 = {file};
63.678 + signjar.getClass().getDeclaredMethod( "setKeystore", paramsT ).invoke( signjar, paramsV1 ); //NOI18N
63.679 + signjar.getClass().getDeclaredMethod( "setJar", paramsT ).invoke( signjar, paramsV2 ); //NOI18N
63.680 + } catch (NoSuchMethodException ex2) {
63.681 + //Probably ANT1.5.3
63.682 + try {
63.683 + Class[] paramsT1 = {File.class};
63.684 + Class[] paramsT2 = {String.class};
63.685 + Object[] paramsV1 = {signature.keystore.getAbsolutePath()};
63.686 + Object[] paramsV2 = {file};
63.687 + signjar.getClass().getDeclaredMethod( "setKeystore", paramsT2 ).invoke( signjar, paramsV1 ); //NOI18N
63.688 + signjar.getClass().getDeclaredMethod( "setJar", paramsT1 ).invoke( signjar, paramsV2 ); //NOI18N
63.689 + } catch (NoSuchMethodException ex3) {
63.690 + throw new BuildException("Unknown Ant version, only Ant 1.6.5 is currently supported.");
63.691 + }
63.692 + }
63.693 + }
63.694 + } catch (IllegalAccessException ex4) {
63.695 + throw new BuildException(ex4);
63.696 + } catch (java.lang.reflect.InvocationTargetException ex5) {
63.697 + throw new BuildException(ex5);
63.698 + }
63.699 + signjar.setStorepass (signature.storepass);
63.700 + signjar.setAlias (signature.alias);
63.701 + signjar.setLocation(getLocation());
63.702 + signjar.init ();
63.703 + signjar.execute ();
63.704 + }
63.705 + }
63.706 + }
63.707 +
63.708 + // Reflection access from MakeListOfNBM:
63.709 +
63.710 + public FileSet getFileSet() {
63.711 + FileSet fs = fileset; //makes in apperance to excludes and includes files defined in XML
63.712 + fs.setDir (topdir);
63.713 +
63.714 + if (isStandardInclude) {
63.715 + fs.createInclude ().setName ("netbeans/"); //NOI18N
63.716 + fs.createExclude ().setName ("netbeans/update_tracking/*.xml"); //NOI18N
63.717 + }
63.718 +
63.719 + fs.createInclude ().setName ("Info/info.xml"); //NOI18N
63.720 + return fs;
63.721 + }
63.722 +
63.723 + public Attributes getAttributes() throws IOException {
63.724 + if (manifest != null) {
63.725 + InputStream is = new FileInputStream(manifest);
63.726 + try {
63.727 + return new Manifest(is).getMainAttributes();
63.728 + } finally {
63.729 + is.close();
63.730 + }
63.731 + } else if (module != null) {
63.732 + JarFile jar = new JarFile(module);
63.733 + try {
63.734 + return jar.getManifest().getMainAttributes();
63.735 + } finally {
63.736 + jar.close();
63.737 + }
63.738 + } else {
63.739 + throw new IOException(getLocation() + "must give either 'manifest' or 'module' on <makenbm>");
63.740 + }
63.741 + }
63.742 +
63.743 + protected String getCodenameBase( String openide_module) {
63.744 + String ret = openide_module ;
63.745 + int idx = ret.indexOf ('/'); //NOI18N
63.746 + if (idx != -1) {
63.747 + ret = ret.substring (0, idx);
63.748 + }
63.749 + return( ret) ;
63.750 + }
63.751 +
63.752 + protected String getSpecVer( String mod_info) {
63.753 + String ret = null ;
63.754 + int first_idx, second_idx ;
63.755 +
63.756 + // If there are 2 slashes. //
63.757 + first_idx = mod_info.indexOf( '/') ; //NOI18N
63.758 + if( first_idx != -1) {
63.759 + second_idx = mod_info.indexOf( '/', first_idx+1) ; //NOI18N
63.760 + if( second_idx != -1) {
63.761 +
63.762 + // Return the string after the second slash. //
63.763 + ret = mod_info.substring( second_idx+1, mod_info.length()) ;
63.764 + }
63.765 + }
63.766 +
63.767 + // Return null rather than an empty string. //
63.768 + if( ret != null && ret.trim().equals( "")) { //NOI18N
63.769 + ret = null ;
63.770 + }
63.771 + return( ret) ;
63.772 + }
63.773 +
63.774 + protected String getMajorVer( String mod_info) {
63.775 + String ret = null ;
63.776 + int first_idx, second_idx ;
63.777 +
63.778 + // If there are 2 slashes. //
63.779 + first_idx = mod_info.indexOf( '/') ; //NOI18N
63.780 + if( first_idx != -1) {
63.781 + second_idx = mod_info.indexOf( '/', first_idx+1) ; //NOI18N
63.782 + if( second_idx != -1) {
63.783 +
63.784 + // Return the string between the slashes. //
63.785 + ret = mod_info.substring( first_idx+1, second_idx) ;
63.786 + }
63.787 +
63.788 + // Else return the string after the first slash. //
63.789 + else {
63.790 + ret = mod_info.substring( first_idx+1, mod_info.length()) ;
63.791 + }
63.792 + }
63.793 +
63.794 + // Return null rather than an empty string. //
63.795 + if( ret != null && ret.trim().equals( "")) { //NOI18N
63.796 + ret = null ;
63.797 + }
63.798 + return( ret) ;
63.799 + }
63.800 +
63.801 + /** For l10n NBM's, this is the localizing bundle file
63.802 + * that we'll look in to get module name, description, etc.
63.803 + */
63.804 + public void setLocBundle( File f) {
63.805 + locBundle = f ;
63.806 + }
63.807 +
63.808 + /** See reqManOrMod() */
63.809 + public void setManOrModReq( boolean b) {
63.810 + manOrModReq = b ;
63.811 + manOrModReqSet = true ;
63.812 + }
63.813 +
63.814 + /** If the manifest and module aren't required, use this
63.815 + * to set the module codename, major version and spec version.
63.816 + */
63.817 + public void setModInfo( String s) {
63.818 + modInfo = s ;
63.819 + }
63.820 +
63.821 + /** Set the language code for localized NBM's. */
63.822 + public void setLangCode( String s) {
63.823 + langCode = s ;
63.824 + }
63.825 +
63.826 + /** Set the branding code for branded NBM's. */
63.827 + public void setBrandingCode( String s) {
63.828 + brandingCode = s ;
63.829 + }
63.830 +
63.831 + /** Returns true if either a manifest or a module must be specified.
63.832 + * This is true unless either the global property
63.833 + * makenbm.manOrModReq is false, or the manOrModReq attribute of
63.834 + * this task is false. The attribute, if set, has priority over the
63.835 + * global property.
63.836 + */
63.837 + public boolean reqManOrMod() {
63.838 + String s = null ;
63.839 + boolean req = true ;
63.840 +
63.841 + if( manOrModReqSet) {
63.842 + req = manOrModReq ;
63.843 + }
63.844 + else {
63.845 + s = getProject().getProperty("makenbm.manOrModReq"); //NOI18N
63.846 + if( s != null && !s.equals( "")) { //NOI18N
63.847 + req = getProject().toBoolean(s);
63.848 + }
63.849 + }
63.850 +
63.851 + return( req) ;
63.852 + }
63.853 +
63.854 + protected void writeLocBundleAttrs( PrintWriter ps) {
63.855 + FileInputStream fis ;
63.856 + Properties p = new Properties() ;
63.857 + String s ;
63.858 + boolean hadone = false ;
63.859 +
63.860 + try {
63.861 + fis = new FileInputStream( locBundle) ;
63.862 + p.load( fis);
63.863 + fis.close();
63.864 + }
63.865 + catch( Exception e) {
63.866 + System.out.println( "ERROR: " + e.getMessage()) ;
63.867 + e.printStackTrace() ;
63.868 + throw new BuildException() ;
63.869 + }
63.870 +
63.871 + s = p.getProperty( "OpenIDE-Module-Name") ; //NOI18N
63.872 + if( writeProp( "OpenIDE-Module-Name", s, ps)) { //NOI18N
63.873 + hadone = true ;
63.874 + }
63.875 +
63.876 + s = p.getProperty( "OpenIDE-Module-Long-Description") ; //NOI18N
63.877 + if( writeProp( "OpenIDE-Module-Long-Description", s, ps)) { //NOI18N
63.878 + hadone = true ;
63.879 + }
63.880 +
63.881 + if( !hadone) {
63.882 + log( "WARNING: Localizing bundle had neither property: " + locBundle) ;
63.883 + }
63.884 + }
63.885 +
63.886 + protected boolean writeProp( String name,
63.887 + String val,
63.888 + PrintWriter ps) {
63.889 + boolean ret = false ;
63.890 + if( val != null) {
63.891 + ps.println( name + "=\"" + xmlEscape(val) +"\"") ; //NOI18N
63.892 + ret = true ;
63.893 + }
63.894 + return( ret) ;
63.895 + }
63.896 +
63.897 +}
64.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
64.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/MakeLayer.java Wed Feb 23 20:12:58 2011 -0500
64.3 @@ -0,0 +1,133 @@
64.4 +/*
64.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
64.6 + *
64.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
64.8 + *
64.9 + * The contents of this file are subject to the terms of either the GNU
64.10 + * General Public License Version 2 only ("GPL") or the Common
64.11 + * Development and Distribution License("CDDL") (collectively, the
64.12 + * "License"). You may not use this file except in compliance with the
64.13 + * License. You can obtain a copy of the License at
64.14 + * http://www.netbeans.org/cddl-gplv2.html
64.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
64.16 + * specific language governing permissions and limitations under the
64.17 + * License. When distributing the software, include this License Header
64.18 + * Notice in each file and include the License file at
64.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
64.20 + * particular file as subject to the "Classpath" exception as provided
64.21 + * by Sun in the GPL Version 2 section of the License file that
64.22 + * accompanied this code. If applicable, add the following below the
64.23 + * License Header, with the fields enclosed by brackets [] replaced by
64.24 + * your own identifying information:
64.25 + * "Portions Copyrighted [year] [name of copyright owner]"
64.26 + *
64.27 + * Contributor(s):
64.28 + *
64.29 + * The Original Software is NetBeans. The Initial Developer of the Original
64.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
64.31 + * Microsystems, Inc. All Rights Reserved.
64.32 + *
64.33 + * If you wish your version of this file to be governed by only the CDDL
64.34 + * or only the GPL Version 2, indicate your decision by adding
64.35 + * "[Contributor] elects to include this software in this distribution
64.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
64.37 + * single choice of license, a recipient has the option to distribute
64.38 + * your version of this file under either the CDDL, the GPL Version 2 or
64.39 + * to extend the choice of license to its licensees as provided above.
64.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
64.41 + * Version 2 license, then the option applies only if the new code is
64.42 + * made subject to such option by the copyright holder.
64.43 + */
64.44 +
64.45 +package org.netbeans.modules.visualweb.ravebuild;
64.46 +
64.47 +import java.io.File;
64.48 +import java.io.FileWriter;
64.49 +import java.io.IOException;
64.50 +import java.util.*;
64.51 +
64.52 +import org.apache.tools.ant.FileScanner;
64.53 +import org.apache.tools.ant.types.FileSet;
64.54 +import org.apache.tools.ant.BuildException;
64.55 +import org.apache.tools.ant.taskdefs.MatchingTask;
64.56 +import org.apache.tools.ant.taskdefs.UpToDate;
64.57 +
64.58 +/** Create a fragment of a module's XML layer.
64.59 + *
64.60 + * @author Michal Zlamal
64.61 + */
64.62 +public class MakeLayer extends MatchingTask {
64.63 +
64.64 + private File dest = null;
64.65 + private File topdir = null;
64.66 + private boolean absolutePath = false;
64.67 +
64.68 + /** Target file containing list of all classes. */
64.69 + public void setDestfile(File f) {
64.70 + dest = f;
64.71 + }
64.72 +
64.73 + /** Set the top directory.
64.74 + * There should be subdirectories under this matching pacgages.
64.75 + */
64.76 + public void setTopdir (File t) {
64.77 + topdir = t;
64.78 + }
64.79 +
64.80 + /** Set whether there is absolute path in top dir or not
64.81 + * default value is false
64.82 + */
64.83 + public void setAbsolutePath( boolean absolutePath ) {
64.84 + this.absolutePath = absolutePath;
64.85 + }
64.86 +
64.87 +
64.88 + public void execute() throws BuildException {
64.89 + if (topdir == null) {
64.90 + throw new BuildException("You must set at topdir attribute", getLocation());
64.91 + }
64.92 + if (dest == null) {
64.93 + throw new BuildException("You must specify output file", getLocation());
64.94 + }
64.95 + UpToDate upToDate = (UpToDate) this.getProject().createTask( "uptodate" ); //NOI18N
64.96 + fileset.setDir( topdir );
64.97 + upToDate.addSrcfiles( fileset );
64.98 + upToDate.setTargetFile( dest );
64.99 + upToDate.setProperty(dest.getAbsolutePath() + ".property"); //NOI18N
64.100 + upToDate.execute();
64.101 + if (this.getProject().getProperty(dest.getAbsolutePath() + ".property") != null) //NOI18N
64.102 + return;
64.103 +
64.104 + int lengthAdjust = (absolutePath) ? 0 : 1;
64.105 + FileWriter layerFile;
64.106 + try {
64.107 + layerFile = new FileWriter(dest);
64.108 + }
64.109 + catch (IOException e) {
64.110 + throw new BuildException(e, getLocation());
64.111 + }
64.112 +
64.113 + FileScanner scanner = getDirectoryScanner (topdir);
64.114 + String[] files = scanner.getIncludedFiles ();
64.115 + for (int i=0; i <files.length; i++) {
64.116 + File aFileName = new File(topdir, files[i]);
64.117 + try {
64.118 + layerFile.write(("<file name=\""+aFileName.getName()+"\"\n").replace(File.separatorChar,'/')); //NOI18N
64.119 + layerFile.write((" url=\""+aFileName.getAbsolutePath().substring(topdir.getAbsolutePath().length()+lengthAdjust)+"\"/>\n").replace(File.separatorChar,'/')); //NOI18N
64.120 + }
64.121 + catch(IOException ex) {
64.122 + throw new BuildException("I/O error while writing layer file "+dest.getAbsolutePath(), ex, getLocation());
64.123 + }
64.124 + }
64.125 +
64.126 + try {
64.127 + layerFile.close();
64.128 + }
64.129 + catch (IOException e) {
64.130 + throw new BuildException("I/O error when trying to close layer file "+dest.getAbsolutePath(), e, getLocation());
64.131 + }
64.132 + }
64.133 +}
64.134 +
64.135 +
64.136 +
65.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
65.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/MakeListOfNBM.java Wed Feb 23 20:12:58 2011 -0500
65.3 @@ -0,0 +1,267 @@
65.4 +/*
65.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
65.6 + *
65.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
65.8 + *
65.9 + * The contents of this file are subject to the terms of either the GNU
65.10 + * General Public License Version 2 only ("GPL") or the Common
65.11 + * Development and Distribution License("CDDL") (collectively, the
65.12 + * "License"). You may not use this file except in compliance with the
65.13 + * License. You can obtain a copy of the License at
65.14 + * http://www.netbeans.org/cddl-gplv2.html
65.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
65.16 + * specific language governing permissions and limitations under the
65.17 + * License. When distributing the software, include this License Header
65.18 + * Notice in each file and include the License file at
65.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
65.20 + * particular file as subject to the "Classpath" exception as provided
65.21 + * by Sun in the GPL Version 2 section of the License file that
65.22 + * accompanied this code. If applicable, add the following below the
65.23 + * License Header, with the fields enclosed by brackets [] replaced by
65.24 + * your own identifying information:
65.25 + * "Portions Copyrighted [year] [name of copyright owner]"
65.26 + *
65.27 + * Contributor(s):
65.28 + *
65.29 + * The Original Software is NetBeans. The Initial Developer of the Original
65.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
65.31 + * Microsystems, Inc. All Rights Reserved.
65.32 + *
65.33 + * If you wish your version of this file to be governed by only the CDDL
65.34 + * or only the GPL Version 2, indicate your decision by adding
65.35 + * "[Contributor] elects to include this software in this distribution
65.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
65.37 + * single choice of license, a recipient has the option to distribute
65.38 + * your version of this file under either the CDDL, the GPL Version 2 or
65.39 + * to extend the choice of license to its licensees as provided above.
65.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
65.41 + * Version 2 license, then the option applies only if the new code is
65.42 + * made subject to such option by the copyright holder.
65.43 + */
65.44 +
65.45 +package org.netbeans.modules.visualweb.ravebuild;
65.46 +
65.47 +import java.io.File;
65.48 +import java.io.FileInputStream;
65.49 +import java.io.IOException;
65.50 +import java.util.StringTokenizer;
65.51 +import java.util.jar.Attributes;
65.52 +import java.util.jar.JarFile;
65.53 +import java.util.zip.CRC32;
65.54 +import org.apache.tools.ant.BuildException;
65.55 +import org.apache.tools.ant.DirectoryScanner;
65.56 +import org.apache.tools.ant.Project;
65.57 +import org.apache.tools.ant.Task;
65.58 +import org.apache.tools.ant.types.FileSet;
65.59 +
65.60 +/**
65.61 + * Create an update tracking file automatically.
65.62 + * Requires a build script target containing one (and only one)
65.63 + * occurrence of the <code><makenbm></code> task.
65.64 + * @author Michal Zlamal
65.65 + */
65.66 +public class MakeListOfNBM extends Task {
65.67 + File outputFile = null;
65.68 + String moduleName = null;
65.69 + boolean pok = true;
65.70 + FileSet fs = null;
65.71 +
65.72 + /** Sets the directory used to create the NBM list file */
65.73 + public void setOutputfiledir(File s) {
65.74 + outputFile = s;
65.75 + log("Setting outputfile to " + s, Project.MSG_DEBUG);
65.76 + }
65.77 +
65.78 + public FileSet createFileSet() {
65.79 + return (fs = new FileSet());
65.80 + }
65.81 +
65.82 + /** Sets the module file */
65.83 + public void setModule(String s) {
65.84 + moduleName = s;
65.85 + log("Setting moduleName to " + s, Project.MSG_DEBUG);
65.86 + }
65.87 +
65.88 + public void setTargetName(String t) {
65.89 + pok = false;
65.90 + log("<"+this.getTaskName()+"> attribute targetname has been DEPRECATED");
65.91 + }
65.92 +
65.93 + public void execute () throws BuildException {
65.94 + if (!pok) throw new BuildException("Use the fileset to specify the content of the NBM");
65.95 + if ( outputFile == null ) throw new BuildException( "You have to specify output directoty" );
65.96 + if ( moduleName == null ) throw new BuildException( "You have to specify the main module's file" );
65.97 + if ( fs == null ) throw new BuildException( "You have to specify the fileset of files included in this module" );
65.98 +
65.99 + log ("Generating information for Auto Update...");
65.100 +
65.101 + UpdateTracking track = new UpdateTracking( outputFile.getAbsolutePath() );
65.102 + Attributes attr;
65.103 + JarFile jar = null;
65.104 + File module = new File( outputFile, moduleName );
65.105 + try {
65.106 + jar = new JarFile(module);
65.107 + attr = jar.getManifest().getMainAttributes();
65.108 + } catch (IOException ex) {
65.109 + throw new BuildException("Can't get manifest attributes for module jar file "+module.getAbsolutePath(), ex, getLocation());
65.110 + } finally {
65.111 + try {
65.112 + if (jar != null) jar.close();
65.113 + } catch( IOException ex1 ) {
65.114 + String exmsg = ex1.getMessage();
65.115 + if (exmsg == null) exmsg = "Unknown error";
65.116 + log("Caught I/O Exception (msg:\""+exmsg+"\") when trying to close jar file "+module.getAbsolutePath(),Project.MSG_WARN);
65.117 + }
65.118 + }
65.119 +
65.120 + String codename = attr.getValue("OpenIDE-Module"); //NOI18N
65.121 + if (codename == null) {
65.122 + throw new BuildException("Manifest in jar file "+module.getAbsolutePath()+" does not contain OpenIDE-Module", getLocation());
65.123 + }
65.124 +
65.125 + String versionSpecNum = attr.getValue("OpenIDE-Module-Specification-Version"); //NOI18N
65.126 + if (versionSpecNum == null) {
65.127 + log("Manifest in jar file "+module.getAbsolutePath()+" does not contain tag OpenIDE-Module-Specification-Version");
65.128 + return;
65.129 + }
65.130 +
65.131 + UpdateTracking.Version version = track.addNewModuleVersion( codename, versionSpecNum );
65.132 +
65.133 + fs.createInclude().setName("config" + File.separator + "Modules" + File.separator + track.getTrackingFileName()); //NOI18N
65.134 +
65.135 + // get directory scanner for "default" files
65.136 + DirectoryScanner ds = fs.getDirectoryScanner( this.getProject() );
65.137 + ds.scan();
65.138 +
65.139 + // check if we need also localized and branded files
65.140 + String lmnl = this.getProject().getProperty("locmakenbm.locales"); // NOI18N
65.141 + String lmnb = this.getProject().getProperty("locmakenbm.brands"); // NOI18N
65.142 +
65.143 + if ((!(lmnl == null)) && (!(lmnl.trim().equals("")))) { // NOI18N
65.144 + // property locmakenbm.locales is set, let's update the included fileset for locales
65.145 + // defined in that property
65.146 +
65.147 + java.util.StringTokenizer tokenizer = new StringTokenizer( lmnl, ", ") ; //NOI18N
65.148 + int cntTok = tokenizer.countTokens();
65.149 + String[] lmnLocales = new String[cntTok];
65.150 + for (int j=0; j < cntTok; j++) {
65.151 + String s = tokenizer.nextToken();
65.152 + lmnLocales[j] = s;
65.153 + log(" lmnLocales[j] == "+lmnLocales[j], Project.MSG_DEBUG); // NOI18N
65.154 + }
65.155 +
65.156 + // handle brandings
65.157 + String[] lmnBrands = null;
65.158 + if ((!(lmnb == null)) && (!(lmnb.trim().equals("")))) { // NOI18N
65.159 + tokenizer = new StringTokenizer( lmnb, ", ") ; //NOI18N
65.160 + cntTok = tokenizer.countTokens();
65.161 + lmnBrands = new String[cntTok];
65.162 + for (int j=0; j < cntTok; j++) {
65.163 + String s = tokenizer.nextToken();
65.164 + lmnBrands[j] = s;
65.165 + log(" lmnBrands[j] == "+lmnBrands[j], Project.MSG_DEBUG); // NOI18N
65.166 + }
65.167 + }
65.168 +
65.169 + // update fileset for localized/branded files
65.170 +
65.171 + String[] englishFiles = ds.getIncludedFiles();
65.172 + int sepPos, extPos;
65.173 + String dirName, fname, filename, fext, newinc, ei_codename;
65.174 + String moduleJar = null;
65.175 + boolean skipLocaleDir = false;
65.176 + for (int k=0; k < englishFiles.length; k++) {
65.177 + // skip records for already localized/branded files
65.178 + if ((englishFiles[k].lastIndexOf("/locale/") >= 0) || // NOI18N
65.179 + (englishFiles[k].lastIndexOf(File.separator+"locale"+File.separator) >= 0)) { // NOI18N
65.180 + skipLocaleDir=true;
65.181 + } else {
65.182 + skipLocaleDir=false;
65.183 + }
65.184 + log("Examining file " + englishFiles[k], Project.MSG_DEBUG);
65.185 + sepPos = englishFiles[k].lastIndexOf(File.separator);
65.186 + if (sepPos < 0) {
65.187 + dirName = ""; //NOI18N
65.188 + filename = englishFiles[k];
65.189 + } else {
65.190 + dirName = englishFiles[k].substring(0,sepPos);
65.191 + filename = englishFiles[k].substring(sepPos+File.separator.length());
65.192 + }
65.193 + extPos = filename.lastIndexOf('.'); //NOI18N
65.194 + if (extPos < 0) {
65.195 + fname = filename;
65.196 + fext = ""; //NOI18N
65.197 + } else {
65.198 + fname = filename.substring(0, extPos);
65.199 + fext = filename.substring(extPos);
65.200 + }
65.201 + for (int j=0; j < lmnLocales.length; j++) {
65.202 + // localized files
65.203 + if (skipLocaleDir) {
65.204 + newinc = dirName + File.separator + fname + "_"+lmnLocales[j]+"*" + fext; //NOI18N
65.205 + } else {
65.206 + newinc = dirName + File.separator + "locale" + File.separator + fname + "_"+lmnLocales[j]+"*" + fext; //NOI18N
65.207 + }
65.208 + log(" adding include mask \""+newinc+"\"", Project.MSG_DEBUG);
65.209 + fs.setIncludes( newinc );
65.210 + // localized & branded files
65.211 + if (!(lmnBrands == null)) {
65.212 + for (int i=0; i < lmnBrands.length; i++) {
65.213 + if (skipLocaleDir) {
65.214 + newinc = dirName + File.separator + fname + "_"+lmnBrands[i]+"_"+lmnLocales[j]+"*" + fext; //NOI18N
65.215 + } else {
65.216 + newinc = dirName + File.separator + "locale" + File.separator + fname + "_"+lmnBrands[i]+"_"+lmnLocales[j]+"*" + fext; //NOI18N
65.217 + }
65.218 + log(" adding include mask \""+newinc+"\"", Project.MSG_DEBUG);
65.219 + fs.setIncludes( newinc );
65.220 + }
65.221 + }
65.222 + }
65.223 + }
65.224 + // update directory scanner
65.225 + ds = fs.getDirectoryScanner(this.getProject());
65.226 + ds.scan();
65.227 + }
65.228 +
65.229 + String include[] = ds.getIncludedFiles();
65.230 + for( int j=0; j < include.length; j++ ){
65.231 + try {
65.232 + File inFile = new File( ds.getBasedir(), include[j] );
65.233 + FileInputStream inFileStream = new FileInputStream( inFile );
65.234 + byte array[] = new byte[ (int) inFile.length() ];
65.235 + CRC32 crc = new CRC32();
65.236 + inFileStream.read( array );
65.237 + inFileStream.close();
65.238 + crc.update( array );
65.239 + String abs = inFile.getAbsolutePath();
65.240 + String prefix = ds.getBasedir().getAbsolutePath() + File.separatorChar;
65.241 + if (! abs.startsWith(prefix)) throw new IllegalStateException(abs);
65.242 + version.addFileWithCrc(abs.substring(prefix.length()).replace(File.separatorChar, '/'), Long.toString( crc.getValue() ) );
65.243 + } catch (IOException ex) {
65.244 + log( ex.toString() );
65.245 + }
65.246 + }
65.247 + track.write();
65.248 + String moduleName = this.getProject().getProperty("module.name"); //NOI18N
65.249 + if (moduleName == null) {
65.250 + // external module?
65.251 + return;
65.252 + }
65.253 + String[] inc = new String[include.length+2];
65.254 + for (int i=0; i < include.length; i++)
65.255 + inc[i] = include[i];
65.256 + inc[include.length] = "config" + File.separator + "Modules" + File.separator + track.getTrackingFileName(); // NOI18N
65.257 + inc[include.length+1] = UpdateTracking.TRACKING_DIRECTORY + File.separator + track.getTrackingFileName();
65.258 + // Hack. We assume outputFile is a direct subdir of the dest dir.
65.259 + ModuleTracking moduleTracking = new ModuleTracking(outputFile.getParentFile().getAbsolutePath());
65.260 + String nbmfilename = this.getProject().getProperty("nbm"); // NOI18N
65.261 + String nbmhomepage = this.getProject().getProperty("nbm.homepage"); // NOI18N
65.262 + String nbmneedsrestart = this.getProject().getProperty("nbm.needs.restart"); // NOI18N
65.263 + String nbmreleasedate = this.getProject().getProperty("nbm.release.date"); // NOI18N
65.264 + String nbmmoduleauthor = this.getProject().getProperty("nbm.module.author"); // NOI18N
65.265 + String nbmisglobal = this.getProject().getProperty("nbm.is.global"); // NOI18N
65.266 + // ...and again here.
65.267 + moduleTracking.putModule(moduleName, codename, outputFile.getName(), nbmfilename, nbmhomepage, nbmneedsrestart, nbmreleasedate, nbmmoduleauthor, nbmisglobal, inc);
65.268 + moduleTracking.write();
65.269 + }
65.270 +}
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
66.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/ModuleTracking.java Wed Feb 23 20:12:58 2011 -0500
66.3 @@ -0,0 +1,552 @@
66.4 +/*
66.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
66.6 + *
66.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
66.8 + *
66.9 + * The contents of this file are subject to the terms of either the GNU
66.10 + * General Public License Version 2 only ("GPL") or the Common
66.11 + * Development and Distribution License("CDDL") (collectively, the
66.12 + * "License"). You may not use this file except in compliance with the
66.13 + * License. You can obtain a copy of the License at
66.14 + * http://www.netbeans.org/cddl-gplv2.html
66.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
66.16 + * specific language governing permissions and limitations under the
66.17 + * License. When distributing the software, include this License Header
66.18 + * Notice in each file and include the License file at
66.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
66.20 + * particular file as subject to the "Classpath" exception as provided
66.21 + * by Sun in the GPL Version 2 section of the License file that
66.22 + * accompanied this code. If applicable, add the following below the
66.23 + * License Header, with the fields enclosed by brackets [] replaced by
66.24 + * your own identifying information:
66.25 + * "Portions Copyrighted [year] [name of copyright owner]"
66.26 + *
66.27 + * Contributor(s):
66.28 + *
66.29 + * The Original Software is NetBeans. The Initial Developer of the Original
66.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
66.31 + * Microsystems, Inc. All Rights Reserved.
66.32 + *
66.33 + * If you wish your version of this file to be governed by only the CDDL
66.34 + * or only the GPL Version 2, indicate your decision by adding
66.35 + * "[Contributor] elects to include this software in this distribution
66.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
66.37 + * single choice of license, a recipient has the option to distribute
66.38 + * your version of this file under either the CDDL, the GPL Version 2 or
66.39 + * to extend the choice of license to its licensees as provided above.
66.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
66.41 + * Version 2 license, then the option applies only if the new code is
66.42 + * made subject to such option by the copyright holder.
66.43 + */
66.44 +
66.45 +package org.netbeans.modules.visualweb.ravebuild;
66.46 +
66.47 +import java.io.File;
66.48 +import java.io.FileInputStream;
66.49 +import java.io.FileOutputStream;
66.50 +import java.io.InputStream;
66.51 +import java.io.OutputStream;
66.52 +import java.util.ArrayList;
66.53 +import java.util.HashMap;
66.54 +import java.util.Hashtable;
66.55 +import java.util.Iterator;
66.56 +import java.util.List;
66.57 +import java.util.Map;
66.58 +import org.apache.tools.ant.BuildException;
66.59 +import org.w3c.dom.Document;
66.60 +import org.w3c.dom.Element;
66.61 +import org.xml.sax.InputSource;
66.62 +
66.63 +/** This class represents module updates tracking
66.64 + *
66.65 + * @author akemr
66.66 + */
66.67 +class ModuleTracking {
66.68 + private static final String ELEMENT_MODULE_TRACKING = "tracking"; // NOI18N
66.69 + private static final String ELEMENT_MODULE = "module"; // NOI18N
66.70 + private static final String ATTR_MODULE_NAME = "name"; // NOI18N
66.71 + private static final String ELEMENT_FILE = "file"; // NOI18N
66.72 + private static final String ATTR_FILE_NAME = "name"; // NOI18N
66.73 + private static final String ATTR_CODE_NAME = "codename"; // NOI18N
66.74 + private static final String ATTR_MODULE_PATH = "path"; // NOI18N
66.75 + private static final String ATTR_NBM_HOME_PAGE = "nbmhomepage"; // NOI18N
66.76 + private static final String ATTR_NBM_FILE_NAME = "nbmfilename"; // NOI18N
66.77 + private static final String ATTR_NBM_NEEDS_RESTART = "nbmneedsrestart"; // NOI18N
66.78 + private static final String ATTR_NBM_IS_GLOBAL = "nbmisglobal"; // NOI18N
66.79 + private static final String ATTR_NBM_RELEASE_DATE = "nbmreleasedate"; // NOI18N
66.80 + private static final String ATTR_NBM_MODULE_AUTHOR = "nbmmoduleauthor"; // NOI18N
66.81 +
66.82 + /** Platform dependent file name separator */
66.83 + private static final String FILE_SEPARATOR = System.getProperty ("file.separator"); // NOI18N
66.84 +
66.85 + /** The name of the file */
66.86 + public static final String TRACKING_FILE = "module_tracking.xml"; // NOI18N
66.87 +
66.88 + private boolean pError = false;
66.89 +
66.90 + private File trackingFile = null;
66.91 +
66.92 + private String nbPath = null;
66.93 + private Tracking tracking = null;
66.94 +
66.95 + // for generating xml in build process
66.96 + public ModuleTracking(String nbPath) {
66.97 + this.nbPath = nbPath;
66.98 + File directory = new File( nbPath );
66.99 + if (!directory.exists()) {
66.100 + directory.mkdirs();
66.101 + }
66.102 + trackingFile = new File(directory, TRACKING_FILE);
66.103 + read();
66.104 + }
66.105 +
66.106 +/* public Module addNewModule( String name ) {
66.107 + = new Tracking();
66.108 + module.setName( name );
66.109 + return module;
66.110 + }*/
66.111 +
66.112 + public void putModule(String name, String codename, String path, String nbmfilename, String nbmhomepage, String nbmneedsrestart, String nbmreleasedate, String nbmmoduleauthor, String nbmisglobal, String[] files) {
66.113 + if (name == null) {
66.114 + // #59426: external module, skip.
66.115 + return;
66.116 + }
66.117 + Module modByName = tracking.getModule(name);
66.118 + Module modByCodeName = tracking.getModuleByCodeName(codename);
66.119 + Module module = null;
66.120 + if (modByName != null) {
66.121 + module = modByName;
66.122 + } else if (modByCodeName != null) {
66.123 + module = modByCodeName;
66.124 + }
66.125 + if (module == null) {
66.126 + module = new Module();
66.127 + module.setName(name);
66.128 + module.setCodeName(codename);
66.129 + module.setPath(path);
66.130 + tracking.addModule(module);
66.131 + }
66.132 + if (module.getNbmFileName().equals("")) // NOI18N
66.133 + module.setNbmFileName(nbmfilename);
66.134 + if (module.getNbmHomePage().equals("")) // NOI18N
66.135 + module.setNbmHomePage(nbmhomepage);
66.136 + if (module.getNbmModuleAuthor().equals("")) // NOI18N
66.137 + module.setNbmModuleAuthor(nbmmoduleauthor);
66.138 + if (module.getNbmNeedsRestart().equals("")) // NOI18N
66.139 + module.setNbmNeedsRestart(nbmneedsrestart);
66.140 + if (module.getNbmReleaseDate().equals("")) // NOI18N
66.141 + module.setNbmReleaseDate(nbmreleasedate);
66.142 + if (module.getNbmIsGlobal().equals ("")) { // NOI18N
66.143 + module.setNbmIsGlobal(nbmisglobal);
66.144 + }
66.145 +/*
66.146 + System.out.println(" module == "+name);
66.147 + System.out.println(" path == "+path);
66.148 + System.out.println(" codename == "+ codename);
66.149 + System.out.println(" filename == "+module.getNbmFileName());
66.150 + System.out.println(" homepage == "+module.getNbmHomePage());
66.151 + System.out.println(" author == "+module.getNbmModuleAuthor());
66.152 + System.out.println(" needsrestart == "+module.getNbmNeedsRestart());
66.153 + System.out.println(" global == "+module.getNbmIsGlobal ());
66.154 + System.out.println(" releasedate == "+module.getNbmReleaseDate());
66.155 +*/
66.156 + module.putFiles( files );
66.157 + }
66.158 +
66.159 + public Map/*<String,Module>*/ getModules() {
66.160 + return tracking.getModules();
66.161 + }
66.162 +
66.163 + public Hashtable getModulesByCodeName() {
66.164 + return tracking.getModulesByCodeName();
66.165 + }
66.166 +
66.167 + public Iterator getFilesForModule(String name) {
66.168 + Module module = tracking.getModule(name);
66.169 + if (module == null) return null;
66.170 + String[] files = new String[module.getFiles().size()];
66.171 + return module.getFiles().iterator();
66.172 + }
66.173 +
66.174 + public String getModulePath(String name) {
66.175 + Module module = tracking.getModule(name);
66.176 + if (module == null) return null;
66.177 + return module.getPath();
66.178 + }
66.179 +
66.180 + void write( ) {
66.181 + Document document = XMLUtil.createDocument(ELEMENT_MODULE_TRACKING);
66.182 + Element e_module_tracking = document.getDocumentElement();
66.183 + Iterator it2 = tracking.getModules().values().iterator();
66.184 + while ( it2.hasNext() ) {
66.185 + Module mod = (Module)it2.next();
66.186 + Element e_module = document.createElement(ELEMENT_MODULE);
66.187 + assert mod.getName() != null : mod.getCodeName();
66.188 + e_module.setAttribute(ATTR_MODULE_NAME, mod.getName());
66.189 + e_module.setAttribute(ATTR_CODE_NAME, mod.getCodeName());
66.190 + e_module.setAttribute(ATTR_MODULE_PATH, mod.getPath());
66.191 + e_module.setAttribute(ATTR_NBM_FILE_NAME, mod.getNbmFileName());
66.192 + e_module.setAttribute(ATTR_NBM_HOME_PAGE, mod.getNbmHomePage());
66.193 + e_module.setAttribute(ATTR_NBM_MODULE_AUTHOR, mod.getNbmModuleAuthor());
66.194 + e_module.setAttribute(ATTR_NBM_NEEDS_RESTART, mod.getNbmNeedsRestart());
66.195 + e_module.setAttribute(ATTR_NBM_IS_GLOBAL, mod.getNbmIsGlobal ());
66.196 + e_module.setAttribute(ATTR_NBM_RELEASE_DATE, mod.getNbmReleaseDate());
66.197 + e_module_tracking.appendChild( e_module );
66.198 + Iterator it3 = mod.getFiles().iterator();
66.199 + while ( it3.hasNext() ) {
66.200 + String file = (String)it3.next();
66.201 + Element e_file = document.createElement(ELEMENT_FILE);
66.202 + e_file.setAttribute(ATTR_FILE_NAME, file.replace(File.separatorChar,'/'));
66.203 + e_module.appendChild( e_file );
66.204 + }
66.205 + }
66.206 +
66.207 + //document.getDocumentElement().normalize();
66.208 + try {
66.209 + OutputStream os = new FileOutputStream(trackingFile);
66.210 + XMLUtil.write(document, os);
66.211 + os.close();
66.212 + } catch (Exception e) {
66.213 + e.printStackTrace();
66.214 + trackingFile.delete();
66.215 + throw new BuildException("Could not write update tracking file " + trackingFile.getAbsolutePath(), e);
66.216 + }
66.217 + }
66.218 +
66.219 + /** Scan through org.w3c.dom.Document document. */
66.220 + private void read() {
66.221 + /** org.w3c.dom.Document document */
66.222 + org.w3c.dom.Document document;
66.223 + if (trackingFile.exists()) {
66.224 + InputStream is;
66.225 + try {
66.226 + is = new FileInputStream( trackingFile );
66.227 +
66.228 + InputSource xmlInputSource = new InputSource( is );
66.229 + document = XMLUtil.parse( xmlInputSource, false, false, new ErrorCatcher(), null );
66.230 + if (is != null)
66.231 + is.close();
66.232 + }
66.233 + catch ( org.xml.sax.SAXException e ) {
66.234 + System.out.println("Module tracking file " + trackingFile.getAbsolutePath() + " is not well formatted XML document" );
66.235 + e.printStackTrace();
66.236 + return;
66.237 + }
66.238 + catch ( java.io.IOException e ) {
66.239 + System.out.println("I/O error when accessing module tracking file " + trackingFile.getAbsolutePath() );
66.240 + e.printStackTrace();
66.241 + return;
66.242 + }
66.243 +
66.244 + org.w3c.dom.Element element = document.getDocumentElement();
66.245 + if ((element != null) && element.getTagName().equals(ELEMENT_MODULE_TRACKING)) {
66.246 + scanElement_module_tracking(element);
66.247 + }
66.248 + }
66.249 + if (tracking == null)
66.250 + tracking = new Tracking();
66.251 + }
66.252 +
66.253 + /** Scan through org.w3c.dom.Element named module. */
66.254 + void scanElement_module_tracking(org.w3c.dom.Element element) { // <tracking>
66.255 + tracking = new Tracking();
66.256 + org.w3c.dom.NodeList nodes = element.getChildNodes();
66.257 + for (int i = 0; i < nodes.getLength(); i++) {
66.258 + org.w3c.dom.Node node = nodes.item(i);
66.259 + if ( node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE ) {
66.260 + org.w3c.dom.Element nodeElement = (org.w3c.dom.Element)node;
66.261 + if (nodeElement.getTagName().equals(ELEMENT_MODULE)) {
66.262 + scanElement_module(nodeElement, tracking);
66.263 + }
66.264 + }
66.265 + }
66.266 + }
66.267 +
66.268 + /** Scan through org.w3c.dom.Element named module. */
66.269 + void scanElement_module(org.w3c.dom.Element element, Tracking tracking) { // <module>
66.270 + Module module = new Module();
66.271 + org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
66.272 + for (int i = 0; i < attrs.getLength(); i++) {
66.273 + org.w3c.dom.Attr attr = (org.w3c.dom.Attr)attrs.item(i);
66.274 + if (attr.getName().equals(ATTR_MODULE_NAME)) { // <module name="???">
66.275 + module.setName( attr.getValue() );
66.276 + }
66.277 + if (attr.getName().equals(ATTR_CODE_NAME)) { // <module codename="???">
66.278 + module.setCodeName( attr.getValue() );
66.279 + }
66.280 + if (attr.getName().equals(ATTR_MODULE_PATH)) { // <module path="???">
66.281 + module.setPath( attr.getValue() );
66.282 + }
66.283 + if (attr.getName().equals(ATTR_NBM_HOME_PAGE)) { // <module nbmhomepage="???">
66.284 + module.setNbmHomePage( attr.getValue() );
66.285 + }
66.286 + if (attr.getName().equals(ATTR_NBM_FILE_NAME)) { // <module nbmfilename="???">
66.287 + module.setNbmFileName( attr.getValue() );
66.288 + }
66.289 + if (attr.getName().equals(ATTR_NBM_NEEDS_RESTART)) { // <module nbmneedsrestart="???">
66.290 + module.setNbmNeedsRestart( attr.getValue() );
66.291 + }
66.292 + if (attr.getName().equals(ATTR_NBM_IS_GLOBAL)) { // <module nbmisglobal="???">
66.293 + module.setNbmIsGlobal( attr.getValue() );
66.294 + }
66.295 + if (attr.getName().equals(ATTR_NBM_RELEASE_DATE)) { // <module nbmreleasedate="???">
66.296 + module.setNbmReleaseDate( attr.getValue() );
66.297 + }
66.298 + if (attr.getName().equals(ATTR_NBM_MODULE_AUTHOR)) { // <module nbmmoduleauthor="???">
66.299 + module.setNbmModuleAuthor( attr.getValue() );
66.300 + }
66.301 + }
66.302 + org.w3c.dom.NodeList nodes = element.getChildNodes();
66.303 + for (int i = 0; i < nodes.getLength(); i++) {
66.304 + org.w3c.dom.Node node = nodes.item(i);
66.305 + if ( node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE ) {
66.306 + org.w3c.dom.Element nodeElement = (org.w3c.dom.Element)node;
66.307 + if (nodeElement.getTagName().equals(ELEMENT_FILE)) {
66.308 + scanElement_file(nodeElement, module);
66.309 + }
66.310 + }
66.311 + }
66.312 + tracking.addModule(module);
66.313 + }
66.314 +
66.315 + /** Scan through org.w3c.dom.Element named file. */
66.316 + void scanElement_file(org.w3c.dom.Element element, Module module) { // <file>
66.317 + String file = null;
66.318 + org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
66.319 + for (int i = 0; i < attrs.getLength(); i++) {
66.320 + org.w3c.dom.Attr attr = (org.w3c.dom.Attr)attrs.item(i);
66.321 + if (attr.getName().equals(ATTR_FILE_NAME)) { // <file name="???">
66.322 + file = attr.getValue();
66.323 + }
66.324 + }
66.325 + module.addFile (file.replace(File.separatorChar,'/'));
66.326 + }
66.327 +
66.328 + public class Tracking extends Object {
66.329 + private Map/*<String,Module>*/ modules = new HashMap();
66.330 + private Hashtable modulesByCodeName = new Hashtable();
66.331 +
66.332 + Map/*<String,Module>*/ getModules() {
66.333 + return modules;
66.334 + }
66.335 +
66.336 + /** Getter for property files.
66.337 + * @return Value of property files.
66.338 + */
66.339 + Hashtable getModulesByCodeName() {
66.340 + return modulesByCodeName;
66.341 + }
66.342 +
66.343 + /** Setter for property files.
66.344 + * @param files New value of property files.
66.345 + */
66.346 + void setModulesByCodeName(Hashtable modules) {
66.347 + this.modulesByCodeName = modules;
66.348 + }
66.349 +
66.350 + public void addModule( Module module ) {
66.351 + modules.put( module.getName(), module );
66.352 + modulesByCodeName.put( module.getCodeName(), module );
66.353 + }
66.354 +
66.355 + public Module getModule( String name ) {
66.356 + return (Module) modules.get(name);
66.357 + }
66.358 + public Module getModuleByCodeName( String codename ) {
66.359 + return (Module) modulesByCodeName.get(codename);
66.360 + }
66.361 + }
66.362 +
66.363 + public class Module extends Object {
66.364 + /** Holds value of property name. */
66.365 + private String name;
66.366 +
66.367 + /** Holds value of property codename. */
66.368 + private String codename;
66.369 +
66.370 + /** Holds value of property path. */
66.371 + private String path;
66.372 +
66.373 + /** Holds value of property nbmhomepage. */
66.374 + private String nbmhomepage = ""; // NOI18N
66.375 +
66.376 + /** Holds value of property nbmfilename. */
66.377 + private String nbmfilename = ""; // NOI18N
66.378 +
66.379 + /** Holds value of property nbmneedsrestart. */
66.380 + private String nbmneedsrestart = ""; // NOI18N
66.381 +
66.382 + /** Holds value of property nbmisglobal. */
66.383 + private String nbmisglobal = ""; // NOI18N
66.384 +
66.385 + /** Holds value of property nbmreleasedate. */
66.386 + private String nbmreleasedate = ""; // NOI18N
66.387 +
66.388 + /** Holds value of property nbmmoduleauthor. */
66.389 + private String nbmmoduleauthor = ""; // NOI18N
66.390 +
66.391 + /** Holds value of property files. */
66.392 + private List files = new ArrayList();
66.393 +
66.394 + /** Getter for property name */
66.395 + String getName() {
66.396 + return name;
66.397 + }
66.398 +
66.399 + /** Setter for property name */
66.400 + void setName(String name) {
66.401 + this.name = name;
66.402 + }
66.403 +
66.404 + /** Getter for property codename */
66.405 + String getCodeName() {
66.406 + return codename;
66.407 + }
66.408 +
66.409 + /** Setter for property codename */
66.410 + void setCodeName(String codename) {
66.411 + this.codename = codename;
66.412 + }
66.413 +
66.414 + /** Getter for property path */
66.415 + String getPath() {
66.416 + return path;
66.417 + }
66.418 +
66.419 + /** Setter for property path */
66.420 + void setPath(String path) {
66.421 + this.path = path;
66.422 + }
66.423 +
66.424 + /** Getter for property nbmhomepage */
66.425 + String getNbmHomePage () {
66.426 + if (this.nbmhomepage == null) {
66.427 + return ""; // NOI18N
66.428 + } else {
66.429 + return this.nbmhomepage;
66.430 + }
66.431 + }
66.432 +
66.433 + /** Setter for property nbmhomepage */
66.434 + void setNbmHomePage (String nbmh) {
66.435 + if (!(nbmh == null))
66.436 + this.nbmhomepage = nbmh;
66.437 + }
66.438 +
66.439 + /** Getter for property nbmfilename */
66.440 + String getNbmFileName () {
66.441 + if (this.nbmfilename == null) {
66.442 + return ""; // NOI18N
66.443 + } else {
66.444 + return this.nbmfilename;
66.445 + }
66.446 + }
66.447 +
66.448 + /** Setter for property nbmfilename */
66.449 + void setNbmFileName (String nbmfn) {
66.450 + if (!(nbmfn == null))
66.451 + this.nbmfilename = nbmfn;
66.452 + }
66.453 +
66.454 + /** Getter for property nbmneedsrestart */
66.455 + String getNbmNeedsRestart () {
66.456 + if (this.nbmneedsrestart == null) {
66.457 + return ""; // NOI18N
66.458 + } else {
66.459 + return this.nbmneedsrestart;
66.460 + }
66.461 + }
66.462 +
66.463 + /** Setter for property nbmneedsrestart */
66.464 + void setNbmNeedsRestart (String nbmnr) {
66.465 + if (!(nbmnr == null))
66.466 + this.nbmneedsrestart = nbmnr;
66.467 + }
66.468 +
66.469 + /** Setter for property nbmisglobal */
66.470 + void setNbmIsGlobal (String isGlobal) {
66.471 + if (!(isGlobal == null))
66.472 + this.nbmisglobal = isGlobal;
66.473 + }
66.474 +
66.475 + /** Getter for property nbmisglobal */
66.476 + String getNbmIsGlobal () {
66.477 + return this.nbmisglobal;
66.478 + }
66.479 +
66.480 + /** Getter for property nbmreleasedate */
66.481 + String getNbmReleaseDate () {
66.482 + if (this.nbmreleasedate == null) {
66.483 + return ""; // NOI18N
66.484 + } else {
66.485 + return this.nbmreleasedate;
66.486 + }
66.487 + }
66.488 +
66.489 + /** Setter for property nbmreleasedate */
66.490 + void setNbmReleaseDate (String nbmrd) {
66.491 + if (!(nbmrd == null ))
66.492 + this.nbmreleasedate = nbmrd;
66.493 + }
66.494 +
66.495 + /** Getter for property nbmmoduleauthor */
66.496 + String getNbmModuleAuthor () {
66.497 + if (this.nbmmoduleauthor == null) {
66.498 + return ""; // NOI18N
66.499 + } else {
66.500 + return this.nbmmoduleauthor;
66.501 + }
66.502 + }
66.503 +
66.504 + /** Setter for property nbmmoduleauthor */
66.505 + void setNbmModuleAuthor (String nbmma) {
66.506 + if (!(nbmma == null))
66.507 + this.nbmmoduleauthor = nbmma;
66.508 + }
66.509 + /** Getter for property files.
66.510 + * @return Value of property files.
66.511 + */
66.512 + List getFiles() {
66.513 + return files;
66.514 + }
66.515 +
66.516 + /** Setter for property files.
66.517 + * @param files New value of property files.
66.518 + */
66.519 + void setFiles(List files) {
66.520 + this.files = files;
66.521 + }
66.522 +
66.523 + public void addFile( String filename) {
66.524 + files.add( filename.replace(File.separatorChar, '/') );
66.525 + }
66.526 +
66.527 + public void putFiles( String[] list ) {
66.528 + for (int i=0; i < list.length; i++) {
66.529 + if (!files.contains(list[i].replace(File.separatorChar,'/'))) {
66.530 + files.add(list[i].replace(File.separatorChar,'/'));
66.531 + }
66.532 + }
66.533 + }
66.534 + }
66.535 +
66.536 + class ErrorCatcher implements org.xml.sax.ErrorHandler {
66.537 + private void message (String level, org.xml.sax.SAXParseException e) {
66.538 + pError = true;
66.539 + }
66.540 +
66.541 + public void error (org.xml.sax.SAXParseException e) {
66.542 + // normally a validity error
66.543 + pError = true;
66.544 + }
66.545 +
66.546 + public void warning (org.xml.sax.SAXParseException e) {
66.547 + //parseFailed = true;
66.548 + }
66.549 +
66.550 + public void fatalError (org.xml.sax.SAXParseException e) {
66.551 + pError = true;
66.552 + }
66.553 + }
66.554 +
66.555 +}
67.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
67.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/RaveLocalizedJar.java Wed Feb 23 20:12:58 2011 -0500
67.3 @@ -0,0 +1,792 @@
67.4 +/*
67.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
67.6 + *
67.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
67.8 + *
67.9 + * The contents of this file are subject to the terms of either the GNU
67.10 + * General Public License Version 2 only ("GPL") or the Common
67.11 + * Development and Distribution License("CDDL") (collectively, the
67.12 + * "License"). You may not use this file except in compliance with the
67.13 + * License. You can obtain a copy of the License at
67.14 + * http://www.netbeans.org/cddl-gplv2.html
67.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
67.16 + * specific language governing permissions and limitations under the
67.17 + * License. When distributing the software, include this License Header
67.18 + * Notice in each file and include the License file at
67.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
67.20 + * particular file as subject to the "Classpath" exception as provided
67.21 + * by Sun in the GPL Version 2 section of the License file that
67.22 + * accompanied this code. If applicable, add the following below the
67.23 + * License Header, with the fields enclosed by brackets [] replaced by
67.24 + * your own identifying information:
67.25 + * "Portions Copyrighted [year] [name of copyright owner]"
67.26 + *
67.27 + * Contributor(s):
67.28 + *
67.29 + * The Original Software is NetBeans. The Initial Developer of the Original
67.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
67.31 + * Microsystems, Inc. All Rights Reserved.
67.32 + *
67.33 + * If you wish your version of this file to be governed by only the CDDL
67.34 + * or only the GPL Version 2, indicate your decision by adding
67.35 + * "[Contributor] elects to include this software in this distribution
67.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
67.37 + * single choice of license, a recipient has the option to distribute
67.38 + * your version of this file under either the CDDL, the GPL Version 2 or
67.39 + * to extend the choice of license to its licensees as provided above.
67.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
67.41 + * Version 2 license, then the option applies only if the new code is
67.42 + * made subject to such option by the copyright holder.
67.43 + */
67.44 +
67.45 +/*
67.46 + * Cloned from nbbuild/antsrc/org/netbeans/nbbuild
67.47 + * Modified to accept the 'overrideManifest' parameter
67.48 + *
67.49 + */
67.50 +
67.51 +package org.netbeans.modules.visualweb.ravebuild;
67.52 +
67.53 +import java.io.*;
67.54 +import java.util.*;
67.55 +import java.util.Map; // override org.apache.tools.ant.Map
67.56 +import java.util.zip.*;
67.57 +import java.util.jar.*;
67.58 +
67.59 +import org.apache.tools.ant.*;
67.60 +import org.apache.tools.ant.taskdefs.MatchingTask;
67.61 +import org.apache.tools.ant.types.*;
67.62 +
67.63 +/** Create a JAR file with locale variants.
67.64 + * Whenever files are found which should be localized, or are the result
67.65 + * of localization, places them in separate JAR files named according to the locale,
67.66 + * in a <samp>locale/</samp> subdirectory of the directory containing the master JAR.
67.67 + * Each sub-JAR gets a manifest which just has some informational tags
67.68 + * indicating its purpose (locale and branding):
67.69 + * <code>X-Informational-Archive-Locale</code> and/or <code>X-Informational-Archive-Branding</code>.
67.70 + * The values may be e.g. <code>ja</code> or <code>f4j_ce</code>; or <code>-</code>
67.71 + * if there is no suffix for this JAR.
67.72 + * You can control the available locales; brandings; and set of files which should
67.73 + * always be considered part of the localizable base kit.
67.74 + * You can use the "branding" and "locale" subelements to control the branded
67.75 + * and localized .jar files that will be produced. Also, you can set the global
67.76 + * properties "locjar.brands" and "locjar.locales" to comma-separated
67.77 + * lists of branding or locale identifiers so that NetBeans-based projects can
67.78 + * brand or localize NetBeans without having to maintain modified versions of all
67.79 + * the individual Ant scripts
67.80 + * Originally this Ant task didn't recognize files below a directory with the
67.81 + * same name as a locale as being localized. Now it does so by default.
67.82 + * <p>Based on <code><zip></code> and <code><jar></code> tasks in Ant,
67.83 + * but not feasible to simply subclass or compose them.
67.84 + * @see <a href="http://www.netbeans.org/devhome/docs/i18n/index.html">NetBeans I18N documentation</a>
67.85 + * @author Jesse Glick
67.86 + */
67.87 +public class RaveLocalizedJar extends MatchingTask {
67.88 +
67.89 + private List localeKits = new LinkedList (); // List<FileSet>
67.90 + private List locales = new LinkedList (); // List<LocaleOrB>
67.91 + private List brandings = new LinkedList (); // List<LocaleOrB>
67.92 + private File jarFile;
67.93 + private File baseDir;
67.94 + private boolean doCompress = false;
67.95 + private static long emptyCrc = new CRC32 ().getValue ();
67.96 + private List filesets = new LinkedList (); // List<FileSet>
67.97 + private File manifest;
67.98 + private boolean checkPathLocale = true ;
67.99 + private boolean warnMissingDir = false ;
67.100 + private boolean warnMissingDirSet = false ;
67.101 + private boolean preserveModuleJar = true;
67.102 + private boolean overrideManifest = false;
67.103 +
67.104 + /** Locale or branding specifier.
67.105 + * Represents a complete locale or branding suffix,
67.106 + * e.g. <code>ja</code> or <code>ja_JP</code>
67.107 + * (but not simply <code>JP</code>).
67.108 + * For branding, e.g. <code>f4j</code> or <code>f4j_ce</code>.
67.109 + * You must include all relevant suffixes if you expect them to match
67.110 + * (but the task will handle a branding suffix combined with a locale
67.111 + * suffix, in that order).
67.112 + */
67.113 + public class LocaleOrB {
67.114 + String n;
67.115 + /** The suffix. */
67.116 + public void setName (String n) {
67.117 + this.n = n;
67.118 + }
67.119 + }
67.120 +
67.121 + /** Distinguish particular files that will be considered localizable.
67.122 + * This nested <samp><localekit></samp> has the same syntax as a FileSet.
67.123 + * So typically you will build a JAR from a fileset containing all build
67.124 + * products within a given directory; the "locale kit" should be a fileset
67.125 + * matching all properties files, for example, and maybe icons which you would
67.126 + * expect someone to try to localize--in general, anything which will be referenced
67.127 + * in code using a localized lookup (<code>NbBundle</code>).
67.128 + * While files with recognized localized (or branded) suffixes automatically go into
67.129 + * marked JARs in the <samp>locale/</samp> subdirectory, files considered part of the
67.130 + * locale kit also always go into this subdirectory; if they have no suffix, they will
67.131 + * be placed in a suffixless locale JAR.
67.132 + * So localizers can simply look at this JAR file and brand/localize it as they see fit.
67.133 + */
67.134 + public void addLocalekit (FileSet fs) {
67.135 + localeKits.add (fs);
67.136 + }
67.137 +
67.138 + /** Add a recognized locale suffix. */
67.139 + public LocaleOrB createLocale () {
67.140 + LocaleOrB l = new LocaleOrB ();
67.141 + locales.add (l);
67.142 + return l;
67.143 + }
67.144 +
67.145 + /** Add a recognized branding suffix. */
67.146 + public LocaleOrB createBranding () {
67.147 + LocaleOrB l = new LocaleOrB ();
67.148 + brandings.add (l);
67.149 + return l;
67.150 + }
67.151 +
67.152 + /** JAR file to create.
67.153 + * In fact this is the location of the "base" JAR;
67.154 + * locale-specific JARs may be created in the <samp>locale/</samp> subdirectory
67.155 + * of the directory containing this JAR, and will be named according to the name
67.156 + * of this JAR.
67.157 + * Compare Ant's <samp><jar></samp> task.
67.158 + */
67.159 + public void setJarfile (File jarFile) {
67.160 + if (! jarFile.getName ().endsWith (".jar")) {
67.161 + throw new BuildException ("jarfile attribute must be a file with *.jar extension");
67.162 + }
67.163 + if (jarFile.getParentFile () == null) {
67.164 + throw new BuildException ("jarfile attribute must have a containing directory");
67.165 + }
67.166 + this.jarFile = jarFile;
67.167 + }
67.168 +
67.169 + /** Base directory to JAR.
67.170 + * Compare Ant's <samp><jar></samp> task.
67.171 + */
67.172 + public void setBasedir (File baseDir) {
67.173 + this.baseDir = baseDir;
67.174 + }
67.175 +
67.176 + /** Turn on or off compression (default off).
67.177 + * Compare Ant's <samp><jar></samp> task.
67.178 + */
67.179 + public void setCompress(boolean compress) {
67.180 + doCompress = compress;
67.181 + }
67.182 +
67.183 + /** Turn on/off preserving original module jars with 'code'
67.184 + * Set it to 'true' to not allow overwriting of module jars
67.185 + * with localization/branding stuff
67.186 + */
67.187 + public void setPreserveModuleJar(boolean pmj) {
67.188 + preserveModuleJar = pmj;
67.189 + }
67.190 +
67.191 + /** A set of files to JAR up.
67.192 + * Compare Ant's <samp><jar></samp> task.
67.193 + */
67.194 + public void addFileset (FileSet set) {
67.195 + filesets.add (set);
67.196 + }
67.197 +
67.198 + /** Manifest file for the JAR.
67.199 + * Compare Ant's <samp><jar></samp> task.
67.200 + */
67.201 + public void setManifest (File manifest) {
67.202 + this.manifest = manifest;
67.203 + }
67.204 +
67.205 + /** Override Manifest file for the JAR.
67.206 + * Default behavior is to ignore manifest argument if jar has locale or branding markings
67.207 + */
67.208 + public void setOverrideManifest (boolean overrideManifest) {
67.209 + this.overrideManifest = overrideManifest;
67.210 + }
67.211 +
67.212 + /** By default this is true. If set to false, then this task will
67.213 + * not recognize files below a directory with the same name as a
67.214 + * locale as being localized (unless the simple filename also
67.215 + * includes the locale).
67.216 + */
67.217 + public void setCheckPathLocale( boolean doit) {
67.218 + checkPathLocale = doit ;
67.219 + }
67.220 +
67.221 + /** This is false by default, in which case missing dirs in the
67.222 + * filesets cause a BuildException to be thrown. If true, then
67.223 + * a warning is printed but the build will continue.
67.224 + * This task will also look for a global property
67.225 + * "locjar.warnMissingDir" if this attribute isn't set.
67.226 + */
67.227 + public void setWarnMissingDir( boolean b) {
67.228 + warnMissingDir = b ;
67.229 + warnMissingDirSet = true ;
67.230 + }
67.231 +
67.232 + public void execute () throws BuildException {
67.233 +
67.234 + // Sanity checks:
67.235 + if (baseDir == null && filesets.size () == 0) {
67.236 + throw new BuildException ("basedir attribute must be set, or at least one fileset must be given!");
67.237 + }
67.238 + if (jarFile == null) {
67.239 + throw new BuildException ("You must specify the JAR file to create!");
67.240 + }
67.241 + if (manifest != null && ! manifest.isFile ()) {
67.242 + throw new BuildException ("The specified manifest does not actually exist.");
67.243 + }
67.244 +
67.245 + // If needed, warn that directories are missing. //
67.246 + if( shouldWarnMissingDir() && warnIfMissingDir()) {
67.247 +
67.248 + // Stop if dirs were missing. //
67.249 + return ;
67.250 + }
67.251 +
67.252 + // Look for global locales or brandings to use. //
67.253 + addGlobalLocaleAndBranding() ;
67.254 +
67.255 + //System.err.println ("Stage #1");
67.256 + // First find out which files need to be archived.
67.257 + Map allFiles = new HashMap (); // all files to do something with; Map<String,File> from JAR path to actual file
67.258 + // Populate it.
67.259 + {
67.260 + List scanners = new ArrayList (filesets.size () + 1); // List<FileScanner>
67.261 + if (baseDir != null) {
67.262 + scanners.add (getDirectoryScanner (baseDir));
67.263 + }
67.264 + Iterator it = filesets.iterator ();
67.265 + while (it.hasNext ()) {
67.266 + scanners.add(((FileSet) it.next()).getDirectoryScanner(getProject()));
67.267 + }
67.268 + it = scanners.iterator ();
67.269 + while (it.hasNext ()) {
67.270 + FileScanner scanner = (FileScanner) it.next ();
67.271 + File thisBaseDir = scanner.getBasedir ();
67.272 + String[] files = scanner.getIncludedFiles ();
67.273 + for (int i = 0; i < files.length; i++) {
67.274 + String name = files[i].replace (File.separatorChar, '/');
67.275 + if (name.equalsIgnoreCase ("META-INF/MANIFEST.MF")) {
67.276 + log ("Warning: ignoring META-INF/MANIFEST.MF found among scanned files", Project.MSG_WARN);
67.277 + continue;
67.278 + }
67.279 + allFiles.put (name, new File (thisBaseDir, files[i]));
67.280 + }
67.281 + }
67.282 + }
67.283 +
67.284 + //System.err.println ("Stage #2");
67.285 + // Now find all files which should always be put into a locale
67.286 + // kit (e.g. dir/locale/name.jar, no special locale or
67.287 + // branding, but distinguished as localizable/brandable).
67.288 + Set localeKitFiles = new HashSet (); // Set<File>; all locale-kit files
67.289 + // Populate this one.
67.290 + {
67.291 + Iterator it = localeKits.iterator ();
67.292 + while (it.hasNext ()) {
67.293 + FileScanner scanner = ((FileSet) it.next()).getDirectoryScanner(getProject());
67.294 + File thisBaseDir = scanner.getBasedir ();
67.295 + String[] files = scanner.getIncludedFiles ();
67.296 + for (int i = 0; i < files.length; i++) {
67.297 + localeKitFiles.add (new File (thisBaseDir, files[i]));
67.298 + }
67.299 + }
67.300 + }
67.301 +
67.302 + //System.err.println ("Stage #3");
67.303 + // Compute list of supported locales and brandings.
67.304 + List locales2 = new LinkedList (); // List<String>; all locales
67.305 + List brandings2 = new LinkedList (); // List<String>; all brandings
67.306 + // Initialize above two.
67.307 + {
67.308 + Iterator it = locales.iterator ();
67.309 + while (it.hasNext ()) {
67.310 + locales2.add (((LocaleOrB) it.next ()).n);
67.311 + }
67.312 + it = brandings.iterator ();
67.313 + while (it.hasNext ()) {
67.314 + brandings2.add (((LocaleOrB) it.next ()).n);
67.315 + }
67.316 + class InverseLengthComparator implements Comparator {
67.317 + public int compare (Object o1, Object o2) {
67.318 + String s1 = (String) o1;
67.319 + String s2 = (String) o2;
67.320 + return s2.length () - s1.length ();
67.321 + }
67.322 + }
67.323 + Comparator c = new InverseLengthComparator ();
67.324 + Collections.sort (locales2, c);
67.325 + Collections.sort (brandings2, c);
67.326 + }
67.327 +
67.328 + //System.err.println ("Stage #4");
67.329 + // Analyze where everything goes.
67.330 + Set jars = new HashSet (); // Set<File>; JAR files to build
67.331 + Map localeMarks = new HashMap (); // Map<File,String>; JAR files to locale (or null for basic JAR, "-" for blank)
67.332 + Map brandingMarks = new HashMap (); // Map<File,String>; JAR files to branding (or null for basic JAR, "-" for blank)
67.333 + 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)
67.334 + {
67.335 + String localeDir ;
67.336 + Iterator it = allFiles.entrySet ().iterator ();
67.337 + while (it.hasNext ()) {
67.338 + Map.Entry entry = (Map.Entry) it.next ();
67.339 + String path = (String) entry.getKey ();
67.340 +
67.341 +log( "==> Examining file: " + path, Project.MSG_DEBUG) ;
67.342 +
67.343 + File file = (File) entry.getValue ();
67.344 + // First see if it matches a known branding, locale, or pair of one of each.
67.345 + String testpath = path;
67.346 + int idx = testpath.lastIndexOf ('/');
67.347 + if (idx != -1) testpath = testpath.substring (idx + 1);
67.348 + idx = testpath.lastIndexOf ('.');
67.349 + if (idx != -1) testpath = testpath.substring (0, idx);
67.350 + String thisLocale = null;
67.351 + Iterator it2 = locales2.iterator ();
67.352 + while (it2.hasNext ()) {
67.353 + String tryLocale = (String) it2.next ();
67.354 + if (testpath.endsWith ("_" + tryLocale)) {
67.355 + thisLocale = tryLocale;
67.356 + testpath = testpath.substring (0, testpath.length () - 1 - tryLocale.length ());
67.357 + break;
67.358 + }
67.359 + }
67.360 + String thisBranding = null;
67.361 + it2 = brandings2.iterator ();
67.362 + while (it2.hasNext ()) {
67.363 + String tryBranding = (String) it2.next ();
67.364 + if (testpath.endsWith ("_" + tryBranding)) {
67.365 + thisBranding = tryBranding;
67.366 + break;
67.367 + }
67.368 + }
67.369 + File thisjar = null; // JAR to send this file to
67.370 +
67.371 + // Check if this file has a parent directory with the //
67.372 + // same name as one of the locales. //
67.373 + localeDir = checkInLocaleDir( file, locales2) ;
67.374 + if( localeDir != null) {
67.375 + thisLocale = localeDir ;
67.376 + }
67.377 +
67.378 +
67.379 + if( thisLocale != null) {
67.380 + log( " Locale: " + thisLocale, Project.MSG_DEBUG) ;
67.381 + } else {
67.382 + log( " Locale not set", Project.MSG_DEBUG) ;
67.383 + }
67.384 + if( thisBranding != null) {
67.385 + log( " Branding: " + thisBranding, Project.MSG_DEBUG) ;
67.386 + } else {
67.387 + log( " Branding not set", Project.MSG_DEBUG) ;
67.388 + }
67.389 + if( localeKitFiles.contains( file)) {
67.390 + log( " Localizable file.", Project.MSG_DEBUG) ;
67.391 + }
67.392 +
67.393 +
67.394 + if (thisLocale != null || thisBranding != null || localeKitFiles.contains (file)) {
67.395 + String name = jarFile.getName ();
67.396 + // We know jarFile is a *.jar so this is safe:
67.397 + name = name.substring (0, name.length () - 4);
67.398 + if (thisBranding != null) {
67.399 + name += '_' + thisBranding;
67.400 + }
67.401 + if (thisLocale != null) {
67.402 + name += '_' + thisLocale;
67.403 + }
67.404 + name += ".jar";
67.405 + if ((preserveModuleJar) && (thisBranding == null) && (thisLocale == null)) {
67.406 + thisjar = null;
67.407 + log(" Preserving module file (1): " + jarFile.getName(), Project.MSG_DEBUG);
67.408 + } else {
67.409 + thisjar = new File (new File (jarFile.getParentFile (), "locale"), name);
67.410 + localeMarks.put (thisjar, ((thisLocale != null) ? thisLocale : "-"));
67.411 + brandingMarks.put (thisjar, ((thisBranding != null) ? thisBranding : "-"));
67.412 + }
67.413 + } else {
67.414 + if (preserveModuleJar) {
67.415 + thisjar = null;
67.416 + log(" Preserving module file (2): " + jarFile.getName(), Project.MSG_DEBUG);
67.417 + } else {
67.418 + thisjar = jarFile;
67.419 + localeMarks.put (thisjar, null);
67.420 + brandingMarks.put (thisjar, null);
67.421 + }
67.422 + }
67.423 + if (thisjar != null) {
67.424 + log(" Adding file " + thisjar.getName() + " to 'jars' HashSet", Project.MSG_DEBUG);
67.425 + jars.add (thisjar);
67.426 + Map files = (Map) router.get (thisjar);
67.427 + if (files == null) {
67.428 + files = new TreeMap ();
67.429 + router.put (thisjar, files);
67.430 + }
67.431 + files.put (path, file);
67.432 + }
67.433 + }
67.434 + }
67.435 +
67.436 + //System.err.println ("Stage #5");
67.437 + // Go through JARs one by one, and build them (if necessary).
67.438 + {
67.439 + List jars2 = new ArrayList (jars);
67.440 + class FileNameComparator implements Comparator {
67.441 + public int compare (Object o1, Object o2) {
67.442 + File f1 = (File) o1;
67.443 + File f2 = (File) o2;
67.444 + return f1.toString ().compareTo (f2.toString ());
67.445 + }
67.446 + }
67.447 + Comparator c = new FileNameComparator ();
67.448 + Collections.sort (jars2, c);
67.449 + Iterator it = jars2.iterator ();
67.450 + while (it.hasNext ()) {
67.451 + File jar = (File) it.next ();
67.452 + Map files = (Map) router.get (jar); // Map<String,File>
67.453 + if (jar.exists ()) {
67.454 + // Do an up-to-date check first.
67.455 + long time = jar.lastModified ();
67.456 + if (manifest == null || manifest.lastModified () <= time) {
67.457 + boolean upToDate = true;
67.458 + Iterator it2 = files.values ().iterator ();
67.459 + while (it2.hasNext ()) {
67.460 + File f = (File) it2.next ();
67.461 + if (f.lastModified () > time) {
67.462 + upToDate = false;
67.463 + break;
67.464 + }
67.465 + }
67.466 + if (upToDate) {
67.467 + // Skip this JAR.
67.468 + continue;
67.469 + }
67.470 + }
67.471 + }
67.472 + log ("Building localized jar: " + jar);
67.473 + IOException closing = null;
67.474 + try {
67.475 + jar.getParentFile ().mkdirs ();
67.476 + ZipOutputStream out = new ZipOutputStream (new FileOutputStream (jar));
67.477 + try {
67.478 + out.setMethod (doCompress ? ZipOutputStream.DEFLATED : ZipOutputStream.STORED);
67.479 + String localeMark = (String) localeMarks.get (jar);
67.480 + String brandingMark = (String) brandingMarks.get (jar);
67.481 + Set addedDirs = new HashSet (); // Set<String>
67.482 + // Add the manifest.
67.483 + InputStream is;
67.484 + long time;
67.485 + if ((manifest != null && localeMark == null && brandingMark == null) || overrideManifest) {
67.486 + // Master JAR, and it has a manifest.
67.487 + is = new FileInputStream (manifest);
67.488 + time = manifest.lastModified ();
67.489 + } else {
67.490 + // Some subsidiary JAR.
67.491 + is = MatchingTask.class.getResourceAsStream ("/org/apache/tools/ant/defaultManifest.mf");
67.492 + time = System.currentTimeMillis ();
67.493 + }
67.494 + java.util.jar.Manifest mani;
67.495 + try {
67.496 + mani = new java.util.jar.Manifest (is);
67.497 + } finally {
67.498 + is.close ();
67.499 + }
67.500 + Attributes attr = mani.getMainAttributes ();
67.501 + if (! attr.containsKey (Attributes.Name.MANIFEST_VERSION)) {
67.502 + attr.put (Attributes.Name.MANIFEST_VERSION, "1.0");
67.503 + }
67.504 + if (localeMark != null) {
67.505 + attr.putValue ("X-Informational-Archive-Locale", localeMark);
67.506 + }
67.507 + if (brandingMark != null) {
67.508 + attr.putValue ("X-Informational-Archive-Branding", brandingMark);
67.509 + }
67.510 + ByteArrayOutputStream baos = new ByteArrayOutputStream ();
67.511 + mani.write (baos);
67.512 + byte[] bytes = baos.toByteArray ();
67.513 + addToJar (new ByteArrayInputStream (bytes), new ByteArrayInputStream (bytes),
67.514 + out, "META-INF/MANIFEST.MF", time, addedDirs);
67.515 + // Now regular files.
67.516 + Iterator it2 = files.entrySet ().iterator ();
67.517 + while (it2.hasNext ()) {
67.518 + Map.Entry entry = (Map.Entry) it2.next ();
67.519 + String path = (String) entry.getKey ();
67.520 + File file = (File) entry.getValue ();
67.521 + addToJar (new FileInputStream (file), new FileInputStream (file),
67.522 + out, path, file.lastModified (), addedDirs);
67.523 + }
67.524 +
67.525 + // If desired, write the root of the srcDir to a file. //
67.526 + writeSrcDir() ;
67.527 + } finally {
67.528 + try {
67.529 + out.close ();
67.530 + } catch (IOException ex) {
67.531 + closing = ex;
67.532 + }
67.533 + }
67.534 +
67.535 + if (closing != null) {
67.536 + // if there was a closing exception and no other one
67.537 + throw closing;
67.538 + }
67.539 + } catch (IOException ioe) {
67.540 + String msg = "Problem creating JAR: " + ioe.getMessage ();
67.541 + if (! jar.delete ()) {
67.542 + msg += " (and the JAR is probably corrupt but I could not delete it)";
67.543 + }
67.544 + throw new BuildException(msg, ioe, getLocation());
67.545 + }
67.546 + }
67.547 + }
67.548 +
67.549 + } // end execute()
67.550 +
67.551 + private void addToJar (InputStream in1, InputStream in2, ZipOutputStream out,
67.552 + String path, long lastModified, Set addedDirs) throws IOException {
67.553 + try {
67.554 + if (path.endsWith ("/")) {
67.555 + throw new IOException ("Bad path: " + path);
67.556 + }
67.557 + // Add parent dirs as needed:
67.558 + int pos = -1;
67.559 + while ((pos = path.indexOf ('/', pos + 1)) != -1) {
67.560 + String dir = path.substring (0, pos + 1);
67.561 + if (! addedDirs.contains (dir)) {
67.562 + addedDirs.add (dir);
67.563 + ZipEntry ze = new ZipEntry (dir);
67.564 + ze.setSize (0);
67.565 + ze.setMethod (ZipEntry.STORED);
67.566 + ze.setCrc (emptyCrc);
67.567 + ze.setTime (lastModified);
67.568 + out.putNextEntry (ze);
67.569 + }
67.570 + }
67.571 + // Add the file itself:
67.572 + ZipEntry ze = new ZipEntry (path);
67.573 + ze.setMethod (doCompress ? ZipEntry.DEFLATED : ZipEntry.STORED);
67.574 + ze.setTime (lastModified);
67.575 + long size = 0;
67.576 + CRC32 crc = new CRC32 ();
67.577 + byte[] buf = new byte[4096];
67.578 + int read;
67.579 + while ((read = in1.read (buf)) != -1) {
67.580 + crc.update (buf, 0, read);
67.581 + size += read;
67.582 + }
67.583 + in1.close ();
67.584 + ze.setCrc (crc.getValue ());
67.585 + ze.setSize (size);
67.586 + out.putNextEntry (ze);
67.587 + while ((read = in2.read (buf)) != -1) {
67.588 + out.write (buf, 0, read);
67.589 + }
67.590 + } finally {
67.591 + in2.close ();
67.592 + in1.close ();
67.593 + }
67.594 + } // end addToJar()
67.595 +
67.596 +
67.597 + // If the name of any parent directory of this file is the same as //
67.598 + // one of the locales, return the locale. //
67.599 + protected String checkInLocaleDir( File file,
67.600 + List locales) {
67.601 +
67.602 + // See if this functionality is disabled. //
67.603 + if( !checkPathLocale) {
67.604 + return null ;
67.605 + }
67.606 +
67.607 + int idx ;
67.608 + String loc, locale_dir, ret = null ;
67.609 + String path = file.getPath() ;
67.610 + Iterator iter = locales.iterator() ;
67.611 +
67.612 + // For each locale. //
67.613 + while( iter.hasNext()) {
67.614 + loc = (String) iter.next() ;
67.615 +
67.616 + // If the path contains a dir with the same name as the //
67.617 + // locale. //
67.618 + locale_dir = new String( file.separator) ;
67.619 + locale_dir += loc ;
67.620 + locale_dir += file.separator ;
67.621 + idx = path.indexOf( locale_dir) ;
67.622 + if( idx != -1) {
67.623 +
67.624 + // Stop and return this locale. //
67.625 + ret = loc ;
67.626 + break ;
67.627 + }
67.628 + }
67.629 +
67.630 + return( ret) ;
67.631 + }
67.632 +
67.633 + ////////////////////////////////////////////////////////////////////
67.634 + // This section of code supports the feature that this class will //
67.635 + // look for global properties that specify locales and brandings //
67.636 + // that should be used. //
67.637 + protected void addGlobalLocaleAndBranding() {
67.638 + addGlobals( getGlobalLocaleVarName(), locales) ;
67.639 + addGlobals( getOldGlobalLocaleVarName(), locales) ;
67.640 + addGlobals( getGlobalBrandingVarName(), brandings) ;
67.641 + addGlobals( getOldGlobalBrandingVarName(), brandings) ;
67.642 + }
67.643 +
67.644 + protected String getGlobalLocaleVarName() {
67.645 + return( new String( "locjar.locales")) ;
67.646 + }
67.647 +
67.648 + protected String getGlobalBrandingVarName() {
67.649 + return( new String( "locjar.brands")) ;
67.650 + }
67.651 +
67.652 + // For backwards compatibility. //
67.653 + protected String getOldGlobalLocaleVarName() {
67.654 + return( new String( "locjar_global_locales")) ;
67.655 + }
67.656 +
67.657 + // For backwards compatibility. //
67.658 + protected String getOldGlobalBrandingVarName() {
67.659 + return( new String( "locjar_global_brands")) ;
67.660 + }
67.661 +
67.662 + protected void addGlobals( String var_name,
67.663 + List list) {
67.664 + String prop = null ;
67.665 + StringTokenizer tokenizer = null ;
67.666 + String tok = null ;
67.667 + LocaleOrB lorb = null ;
67.668 +
67.669 + // Foreach string in the global list. //
67.670 + prop = getProject().getProperty( var_name) ;
67.671 + if( prop != null && !prop.equals( "")) {
67.672 + tokenizer = new StringTokenizer( prop, ", ") ;
67.673 + while( tokenizer.hasMoreTokens()) {
67.674 + tok = tokenizer.nextToken() ;
67.675 +
67.676 + // Add a new entry in the given list. //
67.677 + lorb = new LocaleOrB() ;
67.678 + lorb.setName( tok) ;
67.679 + list.add( lorb) ;
67.680 + }
67.681 + }
67.682 + }
67.683 + //////////////////////////////////////////////////////////////////////
67.684 +
67.685 + protected boolean shouldWarnMissingDir() {
67.686 + String s ;
67.687 + boolean ret = false ; // Default false. //
67.688 +
67.689 + // If the attribute is set, use its value. //
67.690 + if( warnMissingDirSet) {
67.691 + ret = warnMissingDir ;
67.692 + }
67.693 +
67.694 + // Otherwise use the global property value, if set. //
67.695 + else {
67.696 + s = getProject().getProperty("locjar.warnMissingDir");
67.697 + if( s != null && !s.trim().equals( "")) {
67.698 + ret = getProject().toBoolean(s);
67.699 + }
67.700 + }
67.701 +
67.702 + return( ret) ;
67.703 + }
67.704 +
67.705 + // If any dir's don't exist, warn the user and return true. //
67.706 + protected boolean warnIfMissingDir() {
67.707 + ListIterator iter ;
67.708 + FileSet fileset ;
67.709 + File dir ;
67.710 + boolean ret = false ;
67.711 +
67.712 + // Print warning if the basedir doesn't exist. //
67.713 + if( baseDir != null && !baseDir.exists()) {
67.714 + ret = true ;
67.715 + printMissingDirWarning( baseDir) ;
67.716 + }
67.717 +
67.718 + // For each fileset. //
67.719 + iter = filesets.listIterator() ;
67.720 + if( iter != null) {
67.721 + while( iter.hasNext()) {
67.722 +
67.723 + // Print warning if the dir doesn't exist. //
67.724 + fileset = (FileSet) iter.next() ;
67.725 + dir = fileset.getDir(getProject());
67.726 + if( dir != null && !dir.exists()) {
67.727 + ret = true ;
67.728 + printMissingDirWarning( dir) ;
67.729 + }
67.730 + }
67.731 + }
67.732 + return( ret) ;
67.733 + }
67.734 +
67.735 + // Warn the user that the given dir doesn't exist. //
67.736 + protected void printMissingDirWarning( File dir) {
67.737 + log( "WARNING: Skipping this task: Directory " + dir.getPath() + " doesn't exist.") ;
67.738 + }
67.739 +
67.740 + protected boolean shouldWriteSrcDir() {
67.741 + boolean ret = false ;
67.742 + String s = getProject().getProperty("locjar.writeSrcDir");
67.743 + if( s != null && getProject().toBoolean(s)) {
67.744 + ret = true ;
67.745 + }
67.746 + return( ret) ;
67.747 + }
67.748 +
67.749 + protected void writeSrcDir() {
67.750 + String name ;
67.751 + int idx, fromIdx ;
67.752 + OutputStreamWriter osw ;
67.753 + FileOutputStream fos ;
67.754 + File file ;
67.755 +
67.756 + if( shouldWriteSrcDir() && jarFile != null && baseDir != null) {
67.757 + name = jarFile.getPath() ;
67.758 + fromIdx = getNetbeansStartIdx() ;
67.759 + idx = name.indexOf( File.separator+"netbeans"+File.separator, fromIdx) ;
67.760 + if( idx != -1) {
67.761 + try {
67.762 + file = new File( name.substring( 0, idx) + File.separator + "srcdir.properties") ;
67.763 + fos = new FileOutputStream( file) ;
67.764 + osw = new OutputStreamWriter( fos) ;
67.765 + osw.write( "srcdir=" + baseDir + "\n") ;
67.766 + osw.close() ;
67.767 + fos.close() ;
67.768 + }
67.769 + catch( Exception e) {
67.770 + System.out.println( "ERROR: " + e.getMessage()) ;
67.771 + e.printStackTrace() ;
67.772 + throw new BuildException() ;
67.773 + }
67.774 + }
67.775 + else {
67.776 + throw new BuildException( "ERROR: Couldn't find netbeans dir to write srcdir.properties to.") ;
67.777 + }
67.778 + }
67.779 + }
67.780 +
67.781 + // Return the index to start searching from to find the "netbeans"
67.782 + // directory into which the "srcdir.properties" file will be
67.783 + // written.
67.784 + protected int getNetbeansStartIdx() {
67.785 + int startIdx = 0 ;
67.786 + int idx ;
67.787 +
67.788 + idx = baseDir.getPath().lastIndexOf( File.separator+
67.789 + "netbeans"+File.separator) ;
67.790 + if( idx != -1) {
67.791 + startIdx = idx + 1 ;
67.792 + }
67.793 + return( startIdx) ;
67.794 + }
67.795 +}
68.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
68.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/Repeat.java Wed Feb 23 20:12:58 2011 -0500
68.3 @@ -0,0 +1,138 @@
68.4 +/*
68.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
68.6 + *
68.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
68.8 + *
68.9 + * The contents of this file are subject to the terms of either the GNU
68.10 + * General Public License Version 2 only ("GPL") or the Common
68.11 + * Development and Distribution License("CDDL") (collectively, the
68.12 + * "License"). You may not use this file except in compliance with the
68.13 + * License. You can obtain a copy of the License at
68.14 + * http://www.netbeans.org/cddl-gplv2.html
68.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
68.16 + * specific language governing permissions and limitations under the
68.17 + * License. When distributing the software, include this License Header
68.18 + * Notice in each file and include the License file at
68.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
68.20 + * particular file as subject to the "Classpath" exception as provided
68.21 + * by Sun in the GPL Version 2 section of the License file that
68.22 + * accompanied this code. If applicable, add the following below the
68.23 + * License Header, with the fields enclosed by brackets [] replaced by
68.24 + * your own identifying information:
68.25 + * "Portions Copyrighted [year] [name of copyright owner]"
68.26 + *
68.27 + * Contributor(s):
68.28 + *
68.29 + * The Original Software is NetBeans. The Initial Developer of the Original
68.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
68.31 + * Microsystems, Inc. All Rights Reserved.
68.32 + *
68.33 + * If you wish your version of this file to be governed by only the CDDL
68.34 + * or only the GPL Version 2, indicate your decision by adding
68.35 + * "[Contributor] elects to include this software in this distribution
68.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
68.37 + * single choice of license, a recipient has the option to distribute
68.38 + * your version of this file under either the CDDL, the GPL Version 2 or
68.39 + * to extend the choice of license to its licensees as provided above.
68.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
68.41 + * Version 2 license, then the option applies only if the new code is
68.42 + * made subject to such option by the copyright holder.
68.43 + */
68.44 +package org.netbeans.modules.visualweb.ravebuild;
68.45 +
68.46 +import java.io.File;
68.47 +import java.util.*;
68.48 +
68.49 +import org.apache.tools.ant.BuildException;
68.50 +import org.apache.tools.ant.taskdefs.Ant;
68.51 +
68.52 +import org.apache.tools.ant.Project;
68.53 +import org.apache.tools.ant.Target;
68.54 +import org.apache.tools.ant.Task;
68.55 +import org.apache.tools.ant.taskdefs.CallTarget;
68.56 +import org.apache.tools.ant.taskdefs.Property;
68.57 +
68.58 +/**
68.59 + * For each of specified property values calls target task of a specified name
68.60 + * with property set to one of these values
68.61 + *
68.62 + * @author Radim Kubacki
68.63 + */
68.64 +public class Repeat extends Task {
68.65 +
68.66 + private List values; // List<String>
68.67 + private String target;
68.68 + private String startdir;
68.69 + private String name;
68.70 +
68.71 + //
68.72 + // init
68.73 + //
68.74 +
68.75 + public Repeat() {
68.76 + values = new Vector();
68.77 + target = null;
68.78 + }
68.79 +
68.80 + //
68.81 + // itself
68.82 + //
68.83 +
68.84 + /** Name of property that will be set for each call. */
68.85 + public void setName (String s) {
68.86 + log ("SET name = " + s, Project.MSG_DEBUG);
68.87 +
68.88 + name = s;
68.89 + }
68.90 +
68.91 + /** Comma separated list of values. */
68.92 + public void setValues (String s) {
68.93 + log ("SET values = " + s, Project.MSG_DEBUG);
68.94 +
68.95 + StringTokenizer tok = new StringTokenizer (s, ", ");
68.96 + values = new Vector ();
68.97 + while ( tok.hasMoreTokens() ) {
68.98 + values.add (tok.nextToken().trim());
68.99 + }
68.100 + }
68.101 +
68.102 + /** Name of target which will be used with ant task. If not specified,
68.103 + * owning target name is used.
68.104 + */
68.105 + public void setTarget (String s) {
68.106 + log ("SET target = " + s, Project.MSG_DEBUG);
68.107 +
68.108 + target = s;
68.109 + }
68.110 +
68.111 + /** Execute this task. */
68.112 + public void execute () throws BuildException {
68.113 + if ( values.isEmpty() ) {
68.114 + throw new BuildException("You must set at least one value!", getLocation());
68.115 + }
68.116 +
68.117 + if ( target == null ) {
68.118 + throw new BuildException("Target must be set!", getLocation());
68.119 + }
68.120 +
68.121 + Iterator it = values.iterator();
68.122 + while ( it.hasNext() ) {
68.123 + String val = (String) it.next();
68.124 +
68.125 + log ("Process '" + val + "' location with '" + target + "' target ...", Project.MSG_VERBOSE);
68.126 +
68.127 + CallTarget antCall = (CallTarget) getProject().createTask("antcall");
68.128 + antCall.init();
68.129 + antCall.setLocation(getLocation());
68.130 +
68.131 + // ant.setDir (dir);
68.132 + antCall.setTarget (target);
68.133 + Property prop = antCall.createParam();
68.134 + prop.setName(name);
68.135 + prop.setValue(val);
68.136 +
68.137 + antCall.execute();
68.138 + }
68.139 + }
68.140 +
68.141 +}
69.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
69.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/UpdateTracking.java Wed Feb 23 20:12:58 2011 -0500
69.3 @@ -0,0 +1,619 @@
69.4 +/*
69.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
69.6 + *
69.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
69.8 + *
69.9 + * The contents of this file are subject to the terms of either the GNU
69.10 + * General Public License Version 2 only ("GPL") or the Common
69.11 + * Development and Distribution License("CDDL") (collectively, the
69.12 + * "License"). You may not use this file except in compliance with the
69.13 + * License. You can obtain a copy of the License at
69.14 + * http://www.netbeans.org/cddl-gplv2.html
69.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
69.16 + * specific language governing permissions and limitations under the
69.17 + * License. When distributing the software, include this License Header
69.18 + * Notice in each file and include the License file at
69.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
69.20 + * particular file as subject to the "Classpath" exception as provided
69.21 + * by Sun in the GPL Version 2 section of the License file that
69.22 + * accompanied this code. If applicable, add the following below the
69.23 + * License Header, with the fields enclosed by brackets [] replaced by
69.24 + * your own identifying information:
69.25 + * "Portions Copyrighted [year] [name of copyright owner]"
69.26 + *
69.27 + * Contributor(s):
69.28 + *
69.29 + * The Original Software is NetBeans. The Initial Developer of the Original
69.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
69.31 + * Microsystems, Inc. All Rights Reserved.
69.32 + *
69.33 + * If you wish your version of this file to be governed by only the CDDL
69.34 + * or only the GPL Version 2, indicate your decision by adding
69.35 + * "[Contributor] elects to include this software in this distribution
69.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
69.37 + * single choice of license, a recipient has the option to distribute
69.38 + * your version of this file under either the CDDL, the GPL Version 2 or
69.39 + * to extend the choice of license to its licensees as provided above.
69.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
69.41 + * Version 2 license, then the option applies only if the new code is
69.42 + * made subject to such option by the copyright holder.
69.43 + */
69.44 +
69.45 +package org.netbeans.modules.visualweb.ravebuild;
69.46 +
69.47 +import java.io.*;
69.48 +import java.util.*;
69.49 +import java.io.FileOutputStream;
69.50 +
69.51 +import org.w3c.dom.*;
69.52 +import org.xml.sax.InputSource;
69.53 +
69.54 +import org.apache.tools.ant.BuildException;
69.55 +
69.56 +/** This class represents module updates tracking
69.57 + *
69.58 + * @author akemr
69.59 + */
69.60 +class UpdateTracking {
69.61 + private static final String ELEMENT_MODULE = "module"; // NOI18N
69.62 + private static final String ATTR_CODENAME = "codename"; // NOI18N
69.63 + private static final String ELEMENT_VERSION = "module_version"; // NOI18N
69.64 + private static final String ATTR_VERSION = "specification_version"; // NOI18N
69.65 + private static final String ATTR_ORIGIN = "origin"; // NOI18N
69.66 + private static final String ATTR_LAST = "last"; // NOI18N
69.67 + private static final String ATTR_INSTALL = "install_time"; // NOI18N
69.68 + private static final String ELEMENT_FILE = "file"; // NOI18N
69.69 + private static final String ATTR_FILE_NAME = "name"; // NOI18N
69.70 + private static final String ATTR_CRC = "crc"; // NOI18N
69.71 +
69.72 + private static final String NBM_ORIGIN = "nbm"; // NOI18N
69.73 + private static final String INST_ORIGIN = "installer"; // NOI18N
69.74 +
69.75 + /** Platform dependent file name separator */
69.76 + private static final String FILE_SEPARATOR = System.getProperty ("file.separator"); // NOI18N
69.77 +
69.78 + /** The name of the install_later file */
69.79 + public static final String TRACKING_DIRECTORY = "update_tracking"; // NOI18N
69.80 +
69.81 + private boolean pError = false;
69.82 +
69.83 + private File trackingFile = null;
69.84 +
69.85 + private String origin = NBM_ORIGIN;
69.86 + private String nbPath = null;
69.87 + private Module module = null;
69.88 + protected InputStream is = null;
69.89 + protected OutputStream os = null;
69.90 +
69.91 + // for generating xml in build process
69.92 + public UpdateTracking( String nbPath ) {
69.93 + this.nbPath = nbPath;
69.94 + origin = INST_ORIGIN;
69.95 + }
69.96 +
69.97 + /**
69.98 + * Use this constructor, only when you want to use I/O Streams
69.99 + */
69.100 + public UpdateTracking () {
69.101 + this.nbPath = null;
69.102 + origin = INST_ORIGIN;
69.103 + }
69.104 +
69.105 + public Version addNewModuleVersion( String codename, String spec_version ) {
69.106 + module = new Module();
69.107 + module.setCodename( codename );
69.108 + Version version = new Version();
69.109 + version.setVersion( spec_version );
69.110 + version.setOrigin( origin );
69.111 + version.setLast( true );
69.112 + version.setInstall_time( System.currentTimeMillis() );
69.113 + module.setVersion( version );
69.114 + return version;
69.115 + }
69.116 +
69.117 + public String getVersionFromFile (File utf) throws BuildException {
69.118 + this.setTrackingFile(utf.getParentFile(), utf.getName());
69.119 + read();
69.120 + if ( module.getVersions().size() != 1 )
69.121 + throw new BuildException ("Module described in update tracking file " + utf.getAbsolutePath() + " has got " + module.getVersions().size() + " specification versions. Correct number is 1.");
69.122 + return ((Version) module.getVersions().get(0)).getVersion();
69.123 + }
69.124 +
69.125 + public String getCodenameFromFile (File utf) throws BuildException {
69.126 + this.setTrackingFile(utf.getParentFile(), utf.getName());
69.127 + read();
69.128 + if ( module.getVersions().size() != 1 )
69.129 + throw new BuildException ("Module described in update tracking file " + utf.getAbsolutePath() + " has got " + module.getVersions().size() + " specification versions. Correct number is 1.");
69.130 + return module.getCodename();
69.131 + }
69.132 +
69.133 + public String getVersionForCodeName( String codeName ) throws BuildException {
69.134 + module = new Module();
69.135 + module.setCodename( codeName );
69.136 +// if (this.is == null) {
69.137 + File directory = new File( nbPath + FILE_SEPARATOR + TRACKING_DIRECTORY );
69.138 + setTrackingFile(directory, getTrackingFileName());
69.139 + if (!trackingFile.exists() || !trackingFile.isFile())
69.140 + throw new BuildException ("Tracking file " + trackingFile.getAbsolutePath() + " cannot be found for module codenamebase " + codeName );
69.141 +// }
69.142 + read();
69.143 + if ( module.getVersions().size() != 1 )
69.144 + throw new BuildException ("Module with codenamebase " + codeName + " has got " + module.getVersions().size() + " specification versions. Correct number is 1.");
69.145 + return ((Version) module.getVersions().get(0)).getVersion();
69.146 + }
69.147 +
69.148 + public String[] getListOfNBM( String codeName ) throws BuildException {
69.149 + module = new Module();
69.150 + module.setCodename( codeName );
69.151 + if (this.is == null) {
69.152 + File directory = new File( nbPath + FILE_SEPARATOR + TRACKING_DIRECTORY );
69.153 + setTrackingFile(directory, getTrackingFileName());
69.154 + if (!trackingFile.exists() || !trackingFile.isFile())
69.155 + throw new BuildException ("Tracking file " + trackingFile.getAbsolutePath() + " cannot be found for module codenamebase " + codeName );
69.156 + }
69.157 +
69.158 + read();
69.159 +
69.160 + if ( module.getVersions().size() != 1 )
69.161 + throw new BuildException ("Module with codenamebase " + codeName + " has got " + module.getVersions().size() + " specification versions. Correct number is 1.");
69.162 +
69.163 + List files = ((Version) module.getVersions().get(0)).getFiles();
69.164 + String [] listFiles = new String[ files.size() ];
69.165 + for (int i=0; i < files.size(); i++) {
69.166 + listFiles[i] = (((ModuleFile) files.get(i)).getName().replace(File.separatorChar,'/'));
69.167 + }
69.168 +
69.169 + return listFiles;
69.170 + }
69.171 +
69.172 + public void removeLocalized( String locale ) {
69.173 + File updateDirectory = new File( nbPath, TRACKING_DIRECTORY );
69.174 + File[] trackingFiles = updateDirectory.listFiles( new FileFilter() { // Get only *.xml files
69.175 + public boolean accept( File file ) {
69.176 + return file.isFile() &&file.getName().endsWith(".xml"); //NOI18N
69.177 + }
69.178 + } );
69.179 + if (trackingFiles != null)
69.180 + for (int i = trackingFiles.length-1; i >= 0; i--) {
69.181 + trackingFile = trackingFiles[i];
69.182 + read();
69.183 + module.removeLocalized( locale );
69.184 + write();
69.185 + }
69.186 + }
69.187 +
69.188 + void write( ) throws BuildException{
69.189 + Document document = XMLUtil.createDocument(ELEMENT_MODULE);
69.190 + Element e_module = document.getDocumentElement();
69.191 + e_module.setAttribute(ATTR_CODENAME, module.getCodename());
69.192 + Iterator it2 = module.getVersions().iterator();
69.193 + while ( it2.hasNext() ) {
69.194 + Version ver = (Version)it2.next();
69.195 + Element e_version = document.createElement(ELEMENT_VERSION);
69.196 + e_version.setAttribute(ATTR_VERSION, ver.getVersion());
69.197 + e_version.setAttribute(ATTR_ORIGIN, ver.getOrigin());
69.198 + e_version.setAttribute(ATTR_LAST, "true"); //NOI18N
69.199 + e_version.setAttribute(ATTR_INSTALL, Long.toString(ver.getInstall_time()));
69.200 + e_module.appendChild( e_version );
69.201 + Iterator it3 = ver.getFiles().iterator();
69.202 + while ( it3.hasNext() ) {
69.203 + ModuleFile file = (ModuleFile)it3.next();
69.204 + Element e_file = document.createElement(ELEMENT_FILE);
69.205 + e_file.setAttribute(ATTR_FILE_NAME, file.getName().replace(File.separatorChar,'/'));
69.206 + e_file.setAttribute(ATTR_CRC, file.getCrc());
69.207 + e_version.appendChild( e_file );
69.208 + }
69.209 + }
69.210 +
69.211 + //document.getDocumentElement().normalize();
69.212 + if (this.os == null) {
69.213 + File directory = new File( nbPath + FILE_SEPARATOR + TRACKING_DIRECTORY );
69.214 + if (!directory.exists()) {
69.215 + directory.mkdirs();
69.216 + }
69.217 + setTrackingFile(directory, this.getTrackingFileName());
69.218 + FileOutputStream fos = null;
69.219 + try {
69.220 + fos = new FileOutputStream(new File(directory,this.getTrackingFileName()));
69.221 + } catch (Exception e) {
69.222 + throw new BuildException("Could not get outputstream to write update tracking", e);
69.223 + }
69.224 + this.setTrackingOutputStream(fos);
69.225 + }
69.226 + try {
69.227 + try {
69.228 + XMLUtil.write(document, this.os);
69.229 + } finally {
69.230 + this.os.close();
69.231 + }
69.232 + } catch (Exception e) {
69.233 + e.printStackTrace();
69.234 + if ((trackingFile != null) && (trackingFile.exists()))
69.235 + trackingFile.delete();
69.236 + throw new BuildException("Could not write update tracking", e);
69.237 + }
69.238 + }
69.239 +
69.240 + protected void setTrackingFile (File dir, String tFname) throws BuildException {
69.241 + this.trackingFile = new File(dir,tFname);
69.242 +// this.trackingFile.mkdirs();
69.243 + try {
69.244 + //setTrackingOutputStream(new FileOutputStream(this.trackingFile));
69.245 + if (this.trackingFile.exists())
69.246 + setTrackingInputStream(new FileInputStream(this.trackingFile));
69.247 + } catch (java.io.FileNotFoundException fnf) {
69.248 + throw new BuildException("Unable to find tracking file "+this.trackingFile.getAbsolutePath(), fnf);
69.249 + }
69.250 + }
69.251 +
69.252 + public void setTrackingOutputStream(OutputStream tos) {
69.253 + this.os = tos;
69.254 + }
69.255 +
69.256 + public OutputStream getTrackingOutputStream() {
69.257 + return this.os;
69.258 + }
69.259 +
69.260 + public void setTrackingInputStream(InputStream tis) {
69.261 + this.is = tis;
69.262 + }
69.263 +
69.264 + public String getTrackingFileName() throws BuildException {
69.265 + String trackingFileName = module.getCodenamebase();
69.266 + if ( ( trackingFileName == null ) || ( trackingFileName.length() == 0 ) )
69.267 + throw new BuildException ("Empty codenamebase, unable to locate tracking file");
69.268 + trackingFileName = trackingFileName.replace('.', '-') + ".xml"; //NOI18N
69.269 + return trackingFileName;
69.270 + }
69.271 +
69.272 + /** Scan through org.w3c.dom.Document document. */
69.273 + private void read() throws BuildException {
69.274 + /** org.w3c.dom.Document document */
69.275 + org.w3c.dom.Document document;
69.276 + if (this.is == null) {
69.277 + File directory = new File( nbPath + FILE_SEPARATOR + TRACKING_DIRECTORY );
69.278 + if (!directory.exists()) {
69.279 + directory.mkdirs();
69.280 + }
69.281 + setTrackingFile(directory,getTrackingFileName());
69.282 + }
69.283 + try {
69.284 + InputSource xmlInputSource = new InputSource( this.is );
69.285 + document = XMLUtil.parse( xmlInputSource, false, false, new ErrorCatcher(), null );
69.286 + if (is != null)
69.287 + is.close();
69.288 + } catch ( org.xml.sax.SAXException e ) {
69.289 + e.printStackTrace();
69.290 + if (trackingFile == null) {
69.291 + throw new BuildException ("Update tracking data in external InputStream is not well formatted XML document.", e);
69.292 + } else {
69.293 + throw new BuildException ("Update tracking file " + trackingFile.getAbsolutePath() + " is not well formatted XML document.", e);
69.294 + }
69.295 + } catch ( java.io.IOException e ) {
69.296 + e.printStackTrace();
69.297 + if (trackingFile == null) {
69.298 + throw new BuildException ("I/O error while accessing tracking data in InputStream", e);
69.299 + } else {
69.300 + throw new BuildException ("I/O error while accessing tracking file " + trackingFile.getAbsolutePath(), e);
69.301 + }
69.302 + }
69.303 +
69.304 + org.w3c.dom.Element element = document.getDocumentElement();
69.305 + if ((element != null) && element.getTagName().equals(ELEMENT_MODULE)) {
69.306 + scanElement_module(element);
69.307 + }
69.308 + }
69.309 +
69.310 + /** Scan through org.w3c.dom.Element named module. */
69.311 + void scanElement_module(org.w3c.dom.Element element) { // <module>
69.312 + module = new Module();
69.313 + org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
69.314 + for (int i = 0; i < attrs.getLength(); i++) {
69.315 + org.w3c.dom.Attr attr = (org.w3c.dom.Attr)attrs.item(i);
69.316 + if (attr.getName().equals(ATTR_CODENAME)) { // <module codename="???">
69.317 + module.setCodename( attr.getValue() );
69.318 + }
69.319 + }
69.320 + org.w3c.dom.NodeList nodes = element.getChildNodes();
69.321 + for (int i = 0; i < nodes.getLength(); i++) {
69.322 + org.w3c.dom.Node node = nodes.item(i);
69.323 + if ( node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE ) {
69.324 + org.w3c.dom.Element nodeElement = (org.w3c.dom.Element)node;
69.325 + if (nodeElement.getTagName().equals(ELEMENT_VERSION)) {
69.326 + scanElement_module_version(nodeElement, module);
69.327 + }
69.328 + }
69.329 + }
69.330 + }
69.331 +
69.332 + /** Scan through org.w3c.dom.Element named module_version. */
69.333 + void scanElement_module_version(org.w3c.dom.Element element, Module module) { // <module_version>
69.334 + Version version = new Version();
69.335 + org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
69.336 + for (int i = 0; i < attrs.getLength(); i++) {
69.337 + org.w3c.dom.Attr attr = (org.w3c.dom.Attr)attrs.item(i);
69.338 + if (attr.getName().equals(ATTR_VERSION)) { // <module_version specification_version="???">
69.339 + version.setVersion( attr.getValue() );
69.340 + }
69.341 + if (attr.getName().equals(ATTR_ORIGIN)) { // <module_version origin="???">
69.342 + version.setOrigin( attr.getValue() );
69.343 + }
69.344 + if (attr.getName().equals(ATTR_LAST)) { // <module_version last="???">
69.345 + version.setLast( Boolean.getBoolean(attr.getValue() ));
69.346 + }
69.347 + if (attr.getName().equals(ATTR_INSTALL)) { // <module_version install_time="???">
69.348 + long li = 0;
69.349 + try {
69.350 + li = Long.parseLong( attr.getValue() );
69.351 + } catch ( NumberFormatException nfe ) {
69.352 + }
69.353 + version.setInstall_time( li );
69.354 + }
69.355 + }
69.356 + org.w3c.dom.NodeList nodes = element.getChildNodes();
69.357 + for (int i = 0; i < nodes.getLength(); i++) {
69.358 + org.w3c.dom.Node node = nodes.item(i);
69.359 + if ( node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE ) {
69.360 + org.w3c.dom.Element nodeElement = (org.w3c.dom.Element)node;
69.361 + if (nodeElement.getTagName().equals(ELEMENT_FILE)) {
69.362 + scanElement_file(nodeElement, version);
69.363 + }
69.364 + }
69.365 + }
69.366 + module.addVersion( version );
69.367 + }
69.368 +
69.369 + /** Scan through org.w3c.dom.Element named file. */
69.370 + void scanElement_file(org.w3c.dom.Element element, Version version) { // <file>
69.371 + ModuleFile file = new ModuleFile();
69.372 + org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
69.373 + for (int i = 0; i < attrs.getLength(); i++) {
69.374 + org.w3c.dom.Attr attr = (org.w3c.dom.Attr)attrs.item(i);
69.375 + if (attr.getName().equals(ATTR_FILE_NAME)) { // <file name="???">
69.376 + file.setName( attr.getValue().replace(File.separatorChar,'/') );
69.377 + }
69.378 + if (attr.getName().equals(ATTR_CRC)) { // <file crc="???">
69.379 + file.setCrc( attr.getValue() );
69.380 + }
69.381 + }
69.382 + version.addFile (file );
69.383 + }
69.384 +
69.385 + class Module extends Object {
69.386 +
69.387 + /** Holds value of property codename. */
69.388 + private String codename;
69.389 +
69.390 + /** Holds value of property versions. */
69.391 + private List versions = new ArrayList();
69.392 +
69.393 + /** Getter for property codenamebase.
69.394 + * @return Value of property codenamebase.
69.395 + */
69.396 + String getCodenamebase() {
69.397 + String codenamebase = new String(codename);
69.398 + int idx = codenamebase.lastIndexOf ('/'); //NOI18N
69.399 + if (idx != -1) codenamebase = codenamebase.substring (0, idx);
69.400 +
69.401 + return codenamebase;
69.402 + }
69.403 +
69.404 + /** Getter for property codename.
69.405 + * @return Value of property codename.
69.406 + */
69.407 + String getCodename() {
69.408 + return codename;
69.409 + }
69.410 +
69.411 + /** Setter for property codename.
69.412 + * @param codename New value of property codename.
69.413 + */
69.414 + void setCodename(String codename) {
69.415 + this.codename = codename;
69.416 + }
69.417 +
69.418 + /** Getter for property versions.
69.419 + * @return Value of property versions.
69.420 + */
69.421 + List getVersions() {
69.422 + return versions;
69.423 + }
69.424 +
69.425 + /** Setter for property versions.
69.426 + * @param versions New value of property versions.
69.427 + */
69.428 + void setVersions(List versions) {
69.429 + this.versions = versions;
69.430 + }
69.431 +
69.432 + void addVersion( Version version ) {
69.433 + versions = new ArrayList();
69.434 + versions.add( version );
69.435 + }
69.436 +
69.437 + void setVersion( Version version ) {
69.438 + versions = new ArrayList();
69.439 + versions.add( version );
69.440 + }
69.441 +
69.442 + void removeLocalized( String locale ) {
69.443 + Iterator it = versions.iterator();
69.444 + while (it.hasNext()) {
69.445 + Version ver = (Version) it.next();
69.446 + ver.removeLocalized( locale );
69.447 + }
69.448 + }
69.449 + }
69.450 +
69.451 + public class Version extends Object {
69.452 +
69.453 + /** Holds value of property version. */
69.454 + private String version;
69.455 +
69.456 + /** Holds value of property origin. */
69.457 + private String origin;
69.458 +
69.459 + /** Holds value of property last. */
69.460 + private boolean last;
69.461 +
69.462 + /** Holds value of property install_time. */
69.463 + private long install_time = 0;
69.464 +
69.465 + /** Holds value of property files. */
69.466 + private List files = new ArrayList();
69.467 +
69.468 + /** Getter for property version.
69.469 + * @return Value of property version.
69.470 + */
69.471 + String getVersion() {
69.472 + return version;
69.473 + }
69.474 +
69.475 + /** Setter for property version.
69.476 + * @param version New value of property version.
69.477 + */
69.478 + void setVersion(String version) {
69.479 + this.version = version;
69.480 + }
69.481 +
69.482 + /** Getter for property origin.
69.483 + * @return Value of property origin.
69.484 + */
69.485 + String getOrigin() {
69.486 + return origin;
69.487 + }
69.488 +
69.489 + /** Setter for property origin.
69.490 + * @param origin New value of property origin.
69.491 + */
69.492 + void setOrigin(String origin) {
69.493 + this.origin = origin;
69.494 + }
69.495 +
69.496 + /** Getter for property last.
69.497 + * @return Value of property last.
69.498 + */
69.499 + boolean isLast() {
69.500 + return last;
69.501 + }
69.502 +
69.503 + /** Setter for property last.
69.504 + * @param last New value of property last.
69.505 + */
69.506 + void setLast(boolean last) {
69.507 + this.last = last;
69.508 + }
69.509 +
69.510 + /** Getter for property install_time.
69.511 + * @return Value of property install_time.
69.512 + */
69.513 + long getInstall_time() {
69.514 + return install_time;
69.515 + }
69.516 +
69.517 + /** Setter for property install_time.
69.518 + * @param install_time New value of property install_time.
69.519 + */
69.520 + void setInstall_time(long install_time) {
69.521 + this.install_time = install_time;
69.522 + }
69.523 +
69.524 + /** Getter for property files.
69.525 + * @return Value of property files.
69.526 + */
69.527 + List getFiles() {
69.528 + return files;
69.529 + }
69.530 +
69.531 + /** Setter for property files.
69.532 + * @param files New value of property files.
69.533 + */
69.534 + void setFiles(List files) {
69.535 + this.files = files;
69.536 + }
69.537 +
69.538 + void addFile( ModuleFile file ) {
69.539 + files.add( file );
69.540 + }
69.541 +
69.542 + public void addFileWithCrc( String filename, String crc ) {
69.543 + ModuleFile file = new ModuleFile();
69.544 + file.setName( filename );
69.545 + file.setCrc( crc);
69.546 + files.add( file );
69.547 + }
69.548 +
69.549 + public void removeLocalized( String locale ) {
69.550 + ArrayList newFiles = new ArrayList();
69.551 + Iterator it = files.iterator();
69.552 + while (it.hasNext()) {
69.553 + ModuleFile file = (ModuleFile) it.next();
69.554 + if (file.getName().indexOf("_" + locale + ".") == -1 // NOI18N
69.555 + && file.getName().indexOf("_" + locale + "/") == -1 // NOI18N
69.556 + && !file.getName().endsWith("_" + locale) ) // NOI18N
69.557 + newFiles.add ( file );
69.558 + }
69.559 + files = newFiles;
69.560 +
69.561 + }
69.562 +
69.563 + }
69.564 +
69.565 + class ModuleFile extends Object {
69.566 +
69.567 + /** Holds value of property name. */
69.568 + private String name;
69.569 +
69.570 + /** Holds value of property crc. */
69.571 + private String crc;
69.572 +
69.573 + /** Getter for property name.
69.574 + * @return Value of property name.
69.575 + */
69.576 + String getName() {
69.577 + return name;
69.578 + }
69.579 +
69.580 + /** Setter for property name.
69.581 + * @param name New value of property name.
69.582 + */
69.583 + void setName(String name) {
69.584 + this.name = name.replace(File.separatorChar,'/');
69.585 + }
69.586 +
69.587 + /** Getter for property crc.
69.588 + * @return Value of property crc.
69.589 + */
69.590 + String getCrc() {
69.591 + return crc;
69.592 + }
69.593 +
69.594 + /** Setter for property crc.
69.595 + * @param crc New value of property crc.
69.596 + */
69.597 + void setCrc(String crc) {
69.598 + this.crc = crc;
69.599 + }
69.600 +
69.601 + }
69.602 +
69.603 + class ErrorCatcher implements org.xml.sax.ErrorHandler {
69.604 + private void message (String level, org.xml.sax.SAXParseException e) {
69.605 + pError = true;
69.606 + }
69.607 +
69.608 + public void error (org.xml.sax.SAXParseException e) {
69.609 + // normally a validity error
69.610 + pError = true;
69.611 + }
69.612 +
69.613 + public void warning (org.xml.sax.SAXParseException e) {
69.614 + //parseFailed = true;
69.615 + }
69.616 +
69.617 + public void fatalError (org.xml.sax.SAXParseException e) {
69.618 + pError = true;
69.619 + }
69.620 + }
69.621 +
69.622 +}
70.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
70.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/XMLUtil.java Wed Feb 23 20:12:58 2011 -0500
70.3 @@ -0,0 +1,245 @@
70.4 +/*
70.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
70.6 + *
70.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
70.8 + *
70.9 + * The contents of this file are subject to the terms of either the GNU
70.10 + * General Public License Version 2 only ("GPL") or the Common
70.11 + * Development and Distribution License("CDDL") (collectively, the
70.12 + * "License"). You may not use this file except in compliance with the
70.13 + * License. You can obtain a copy of the License at
70.14 + * http://www.netbeans.org/cddl-gplv2.html
70.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
70.16 + * specific language governing permissions and limitations under the
70.17 + * License. When distributing the software, include this License Header
70.18 + * Notice in each file and include the License file at
70.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
70.20 + * particular file as subject to the "Classpath" exception as provided
70.21 + * by Sun in the GPL Version 2 section of the License file that
70.22 + * accompanied this code. If applicable, add the following below the
70.23 + * License Header, with the fields enclosed by brackets [] replaced by
70.24 + * your own identifying information:
70.25 + * "Portions Copyrighted [year] [name of copyright owner]"
70.26 + *
70.27 + * Contributor(s):
70.28 + *
70.29 + * The Original Software is NetBeans. The Initial Developer of the Original
70.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
70.31 + * Microsystems, Inc. All Rights Reserved.
70.32 + *
70.33 + * If you wish your version of this file to be governed by only the CDDL
70.34 + * or only the GPL Version 2, indicate your decision by adding
70.35 + * "[Contributor] elects to include this software in this distribution
70.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
70.37 + * single choice of license, a recipient has the option to distribute
70.38 + * your version of this file under either the CDDL, the GPL Version 2 or
70.39 + * to extend the choice of license to its licensees as provided above.
70.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
70.41 + * Version 2 license, then the option applies only if the new code is
70.42 + * made subject to such option by the copyright holder.
70.43 + */
70.44 +
70.45 +package org.netbeans.modules.visualweb.ravebuild;
70.46 +
70.47 +import java.io.IOException;
70.48 +import java.io.OutputStream;
70.49 +import java.util.ArrayList;
70.50 +import java.util.Arrays;
70.51 +import java.util.Collection;
70.52 +import java.util.List;
70.53 +import javax.xml.parsers.DocumentBuilder;
70.54 +import javax.xml.parsers.DocumentBuilderFactory;
70.55 +import javax.xml.parsers.ParserConfigurationException;
70.56 +import javax.xml.transform.OutputKeys;
70.57 +import javax.xml.transform.Result;
70.58 +import javax.xml.transform.Source;
70.59 +import javax.xml.transform.Transformer;
70.60 +import javax.xml.transform.TransformerFactory;
70.61 +import javax.xml.transform.TransformerFactoryConfigurationError;
70.62 +import javax.xml.transform.dom.DOMSource;
70.63 +import javax.xml.transform.stream.StreamResult;
70.64 +import org.w3c.dom.DOMException;
70.65 +import org.w3c.dom.DOMImplementation;
70.66 +import org.w3c.dom.Document;
70.67 +import org.w3c.dom.DocumentType;
70.68 +import org.w3c.dom.Element;
70.69 +import org.w3c.dom.Node;
70.70 +import org.w3c.dom.NodeList;
70.71 +import org.w3c.dom.Text;
70.72 +import org.xml.sax.EntityResolver;
70.73 +import org.xml.sax.ErrorHandler;
70.74 +import org.xml.sax.InputSource;
70.75 +import org.xml.sax.SAXException;
70.76 +
70.77 +/**
70.78 + * Utility class collecting library methods related to XML processing.
70.79 + * @author Petr Kuzel, Jesse Glick
70.80 + */
70.81 +final class XMLUtil extends Object {
70.82 +
70.83 + private static final ThreadLocal/*<DocumentBuilder>*/[] builderTL = new ThreadLocal[4];
70.84 + static {
70.85 + for (int i = 0; i < 4; i++) {
70.86 + builderTL[i] = new ThreadLocal();
70.87 + }
70.88 + }
70.89 + public static Document parse (
70.90 + InputSource input,
70.91 + boolean validate,
70.92 + boolean namespaceAware,
70.93 + ErrorHandler errorHandler,
70.94 + EntityResolver entityResolver
70.95 + ) throws IOException, SAXException {
70.96 +
70.97 + int index = (validate ? 0 : 1) + (namespaceAware ? 0 : 2);
70.98 + DocumentBuilder builder = (DocumentBuilder) builderTL[index].get();
70.99 + if (builder == null) {
70.100 + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
70.101 + factory.setValidating(validate);
70.102 + factory.setNamespaceAware(namespaceAware);
70.103 +
70.104 + try {
70.105 + builder = factory.newDocumentBuilder();
70.106 + } catch (ParserConfigurationException ex) {
70.107 + throw new SAXException(ex);
70.108 + }
70.109 + builderTL[index].set(builder);
70.110 + }
70.111 +
70.112 + if (errorHandler != null) {
70.113 + builder.setErrorHandler(errorHandler);
70.114 + }
70.115 +
70.116 + if (entityResolver != null) {
70.117 + builder.setEntityResolver(entityResolver);
70.118 + }
70.119 +
70.120 + return builder.parse(input);
70.121 + }
70.122 +
70.123 + public static Document createDocument(String rootQName) throws DOMException {
70.124 + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
70.125 + try {
70.126 + return factory.newDocumentBuilder().getDOMImplementation().createDocument(null, rootQName, null);
70.127 + } catch (ParserConfigurationException ex) {
70.128 + throw (DOMException)new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot create parser").initCause(ex); // NOI18N
70.129 + }
70.130 + }
70.131 +
70.132 + private static DOMImplementation getDOMImplementation() throws DOMException { //can be made public
70.133 +
70.134 + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
70.135 +
70.136 + try {
70.137 + return factory.newDocumentBuilder().getDOMImplementation();
70.138 + } catch (ParserConfigurationException ex) {
70.139 + throw (DOMException)new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot create parser").initCause(ex); // NOI18N
70.140 + }
70.141 + }
70.142 +
70.143 + public static void write(Document doc, OutputStream out) throws IOException {
70.144 + // XXX note that this may fail to write out namespaces correctly if the document
70.145 + // is created with namespaces and no explicit prefixes; however no code in
70.146 + // this package is likely to be doing so
70.147 + try {
70.148 + Transformer t = TransformerFactory.newInstance().newTransformer();
70.149 + DocumentType dt = doc.getDoctype();
70.150 + if (dt != null) {
70.151 + String pub = dt.getPublicId();
70.152 + if (pub != null) {
70.153 + t.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, pub);
70.154 + }
70.155 + t.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, dt.getSystemId());
70.156 + }
70.157 + t.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); // NOI18N
70.158 + t.setOutputProperty(OutputKeys.INDENT, "yes"); // NOI18N
70.159 + t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); // NOI18N
70.160 + Source source = new DOMSource(doc);
70.161 + Result result = new StreamResult(out);
70.162 + t.transform(source, result);
70.163 + } catch (Exception e) {
70.164 + throw (IOException)new IOException(e.toString()).initCause(e);
70.165 + } catch (TransformerFactoryConfigurationError e) {
70.166 + throw (IOException)new IOException(e.toString()).initCause(e);
70.167 + }
70.168 + }
70.169 +
70.170 + /**
70.171 + * Search for an XML element in the direct children of a parent.
70.172 + * DOM provides a similar method but it does a recursive search
70.173 + * which we do not want. It also gives a node list and we want
70.174 + * only one result.
70.175 + * @param parent a parent element
70.176 + * @param name the intended local name
70.177 + * @param namespace the intended namespace (or null)
70.178 + * @return the one child element with that name, or null if none or more than one
70.179 + */
70.180 + public static Element findElement(Element parent, String name, String namespace) {
70.181 + Element result = null;
70.182 + NodeList l = parent.getChildNodes();
70.183 + for (int i = 0; i < l.getLength(); i++) {
70.184 + if (l.item(i).getNodeType() == Node.ELEMENT_NODE) {
70.185 + Element el = (Element)l.item(i);
70.186 + if ((namespace == null && name.equals(el.getTagName())) ||
70.187 + (namespace != null && name.equals(el.getLocalName()) &&
70.188 + namespace.equals(el.getNamespaceURI()))) {
70.189 + if (result == null) {
70.190 + result = el;
70.191 + } else {
70.192 + return null;
70.193 + }
70.194 + }
70.195 + }
70.196 + }
70.197 + return result;
70.198 + }
70.199 +
70.200 + /**
70.201 + * Extract nested text from an element.
70.202 + * Currently does not handle coalescing text nodes, CDATA sections, etc.
70.203 + * @param parent a parent element
70.204 + * @return the nested text, or null if none was found
70.205 + */
70.206 + static String findText(Element parent) {
70.207 + NodeList l = parent.getChildNodes();
70.208 + for (int i = 0; i < l.getLength(); i++) {
70.209 + if (l.item(i).getNodeType() == Node.TEXT_NODE) {
70.210 + Text text = (Text)l.item(i);
70.211 + return text.getNodeValue();
70.212 + }
70.213 + }
70.214 + return null;
70.215 + }
70.216 +
70.217 + /**
70.218 + * Find all direct child elements of an element.
70.219 + * More useful than {@link Element#getElementsByTagNameNS} because it does
70.220 + * not recurse into recursive child elements.
70.221 + * Children which are all-whitespace text nodes or comments are ignored; others cause
70.222 + * an exception to be thrown.
70.223 + * @param parent a parent element in a DOM tree
70.224 + * @return a list of direct child elements (may be empty)
70.225 + * @throws IllegalArgumentException if there are non-element children besides whitespace
70.226 + */
70.227 + static List/*<Element>*/ findSubElements(Element parent) throws IllegalArgumentException {
70.228 + NodeList l = parent.getChildNodes();
70.229 + List/*<Element>*/ elements = new ArrayList(l.getLength());
70.230 + for (int i = 0; i < l.getLength(); i++) {
70.231 + Node n = l.item(i);
70.232 + if (n.getNodeType() == Node.ELEMENT_NODE) {
70.233 + elements.add((Element)n);
70.234 + } else if (n.getNodeType() == Node.TEXT_NODE) {
70.235 + String text = ((Text)n).getNodeValue();
70.236 + if (text.trim().length() > 0) {
70.237 + throw new IllegalArgumentException("non-ws text encountered in " + parent + ": " + text); // NOI18N
70.238 + }
70.239 + } else if (n.getNodeType() == Node.COMMENT_NODE) {
70.240 + // OK, ignore
70.241 + } else {
70.242 + throw new IllegalArgumentException("unexpected non-element child of " + parent + ": " + n); // NOI18N
70.243 + }
70.244 + }
70.245 + return elements;
70.246 + }
70.247 +
70.248 +}
71.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
71.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/utils/cvsutils/CvsEntries.java Wed Feb 23 20:12:58 2011 -0500
71.3 @@ -0,0 +1,108 @@
71.4 +/*
71.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
71.6 + *
71.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
71.8 + *
71.9 + * The contents of this file are subject to the terms of either the GNU
71.10 + * General Public License Version 2 only ("GPL") or the Common
71.11 + * Development and Distribution License("CDDL") (collectively, the
71.12 + * "License"). You may not use this file except in compliance with the
71.13 + * License. You can obtain a copy of the License at
71.14 + * http://www.netbeans.org/cddl-gplv2.html
71.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
71.16 + * specific language governing permissions and limitations under the
71.17 + * License. When distributing the software, include this License Header
71.18 + * Notice in each file and include the License file at
71.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
71.20 + * particular file as subject to the "Classpath" exception as provided
71.21 + * by Sun in the GPL Version 2 section of the License file that
71.22 + * accompanied this code. If applicable, add the following below the
71.23 + * License Header, with the fields enclosed by brackets [] replaced by
71.24 + * your own identifying information:
71.25 + * "Portions Copyrighted [year] [name of copyright owner]"
71.26 + *
71.27 + * Contributor(s):
71.28 + *
71.29 + * The Original Software is NetBeans. The Initial Developer of the Original
71.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
71.31 + * Microsystems, Inc. All Rights Reserved.
71.32 + *
71.33 + * If you wish your version of this file to be governed by only the CDDL
71.34 + * or only the GPL Version 2, indicate your decision by adding
71.35 + * "[Contributor] elects to include this software in this distribution
71.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
71.37 + * single choice of license, a recipient has the option to distribute
71.38 + * your version of this file under either the CDDL, the GPL Version 2 or
71.39 + * to extend the choice of license to its licensees as provided above.
71.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
71.41 + * Version 2 license, then the option applies only if the new code is
71.42 + * made subject to such option by the copyright holder.
71.43 + */
71.44 +/**
71.45 + *
71.46 + * CLASS COPIED FROM NETBEANS
71.47 + *
71.48 + */
71.49 +
71.50 +
71.51 +/************************************************************************
71.52 +
71.53 + FILENAME: CvsEntries.java
71.54 +
71.55 + AUTHOR: Erica Grevemeyer DATE: Jan 7 11:21:09 PST 2002
71.56 +
71.57 +************************************************************************/
71.58 +package org.netbeans.modules.visualweb.ravebuild.utils.cvsutils;
71.59 +
71.60 +import java.io.*;
71.61 +import java.util.*;
71.62 +
71.63 +/** Read a specified CVS/Entries style file,
71.64 + * as Entries & store the collection of Entries
71.65 + * in the passed-in Hashtable. If no 'separator' string
71.66 + * is passed then a 'blankspace' separator is assumed.
71.67 + *
71.68 + * @author Erica Grevemeyer
71.69 + * @version 1.1 Jan 7 11:21:09 PST 200
71.70 + */
71.71 +
71.72 +public class CvsEntries {
71.73 +
71.74 + private java.util.HashMap hash = new java.util.HashMap();
71.75 + private static final String DEFAULT_CVS_ENTRIES_FILENAME = "CVS/Entries";
71.76 +
71.77 + // Constructors
71.78 + public CvsEntries(String directoryPath) {
71.79 + this(directoryPath, DEFAULT_CVS_ENTRIES_FILENAME);
71.80 + }
71.81 +
71.82 +
71.83 + public CvsEntries(String directoryPath, String fileName) {
71.84 + try {
71.85 + String entriesFile = directoryPath + "/" + fileName;
71.86 + BufferedReader inBuff = new BufferedReader(new FileReader(new File(entriesFile)));
71.87 + Entry e;
71.88 +
71.89 + String line;
71.90 +
71.91 + while ((line = inBuff.readLine()) != null) {
71.92 + e = new Entry(line);
71.93 + if ( ! e.getFiletype().equals("D") ) {
71.94 + hash.put(e.getFilename(), e);
71.95 + }
71.96 + }
71.97 +
71.98 + } catch(IOException e) {
71.99 + System.out.println("Error: " + e.toString());
71.100 + }
71.101 + }
71.102 +
71.103 + public String getRevnoByFileName(String fileName) {
71.104 + Entry e = (Entry)hash.get(fileName);
71.105 + if (e == null ) {
71.106 + return null;
71.107 + } else {
71.108 + return e.getRevno();
71.109 + }
71.110 + }
71.111 +}
72.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
72.2 +++ b/misc/ravebuild/antsrc/org/netbeans/modules/visualweb/ravebuild/utils/cvsutils/Entry.java Wed Feb 23 20:12:58 2011 -0500
72.3 @@ -0,0 +1,187 @@
72.4 +/*
72.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
72.6 + *
72.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
72.8 + *
72.9 + * The contents of this file are subject to the terms of either the GNU
72.10 + * General Public License Version 2 only ("GPL") or the Common
72.11 + * Development and Distribution License("CDDL") (collectively, the
72.12 + * "License"). You may not use this file except in compliance with the
72.13 + * License. You can obtain a copy of the License at
72.14 + * http://www.netbeans.org/cddl-gplv2.html
72.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
72.16 + * specific language governing permissions and limitations under the
72.17 + * License. When distributing the software, include this License Header
72.18 + * Notice in each file and include the License file at
72.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
72.20 + * particular file as subject to the "Classpath" exception as provided
72.21 + * by Sun in the GPL Version 2 section of the License file that
72.22 + * accompanied this code. If applicable, add the following below the
72.23 + * License Header, with the fields enclosed by brackets [] replaced by
72.24 + * your own identifying information:
72.25 + * "Portions Copyrighted [year] [name of copyright owner]"
72.26 + *
72.27 + * Contributor(s):
72.28 + *
72.29 + * The Original Software is NetBeans. The Initial Developer of the Original
72.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
72.31 + * Microsystems, Inc. All Rights Reserved.
72.32 + *
72.33 + * If you wish your version of this file to be governed by only the CDDL
72.34 + * or only the GPL Version 2, indicate your decision by adding
72.35 + * "[Contributor] elects to include this software in this distribution
72.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
72.37 + * single choice of license, a recipient has the option to distribute
72.38 + * your version of this file under either the CDDL, the GPL Version 2 or
72.39 + * to extend the choice of license to its licensees as provided above.
72.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
72.41 + * Version 2 license, then the option applies only if the new code is
72.42 + * made subject to such option by the copyright holder.
72.43 + */
72.44 +/**
72.45 + *
72.46 + * CLASS COPIED FROM NETBEANS
72.47 + *
72.48 + */
72.49 +
72.50 +/************************************************************************
72.51 +
72.52 + FILENAME: Entry.java
72.53 +
72.54 + AUTHOR: Erica Grevemeyer DATE: Jan 7 11:21:09 PST 2002
72.55 +
72.56 +************************************************************************/
72.57 +package org.netbeans.modules.visualweb.ravebuild.utils.cvsutils;
72.58 +
72.59 +import java.util.*;
72.60 +
72.61 +/**
72.62 + * This CVS utility class will parse a single line in a
72.63 + * CVS/Entries file.
72.64 + *
72.65 + * @author Erica Grevemeyer
72.66 + * @version 1.1 Jan 7 11:21:09 PST 2002
72.67 + */
72.68 +
72.69 +public class Entry {
72.70 + private static final String DEFAULT_SEPARATOR = "/";
72.71 + private String filename, filetype, revno, timestamp;
72.72 +
72.73 + // Constructor Methods
72.74 + /** Create an Entry instance when all information is already available.
72.75 + * @param ft - File type. (Value will be either "F" or "D" indicating file or directory).
72.76 + * @param fn - filename listed in the entry
72.77 + * @param revno - latest revision number listedx.
72.78 + * @param ts - the time stamp string. (ex. Sat Dec 22 00:31:24 2001)
72.79 + * This may have additional information if the file is not up to date.
72.80 + */
72.81 + public Entry(String ft, String fn, String revno, String ts) {
72.82 + setFiletype(ft);
72.83 + setFilename(fn);
72.84 + setRevno(revno);
72.85 + setTimestamp(ts);
72.86 + }
72.87 +
72.88 + /**
72.89 + * @param line - line from the read in file.
72.90 + * @param separator - separator used in this file. CVS generated files will use "/"
72.91 + */
72.92 + public Entry(String line, String separator) {
72.93 + /*
72.94 + We use the separator here instead of always
72.95 + defaulting to CVS's "/" so that we can use
72.96 + this class to parse files which are
72.97 + organized the same way, but don't use the '/'.
72.98 +
72.99 + */
72.100 + StringTokenizer st = new StringTokenizer(line, separator);
72.101 +
72.102 + int index = 0;
72.103 + String[] item=new String[6];
72.104 +
72.105 + while (st.hasMoreTokens()) {
72.106 + String ftstr = "";
72.107 + String tok = st.nextToken();
72.108 +
72.109 + // Typical CVS/Entries file lines:
72.110 + // D/dirname////
72.111 + // /filename/1.3/Sat Dec 22 00:31:24 2001//
72.112 +
72.113 + if (index == 0 ) {
72.114 + if ( ! tok.equals("D") ) {
72.115 + item[index++]="F";
72.116 + }
72.117 + }
72.118 + item[index++]=tok;
72.119 + //item[0] = filetype
72.120 + //item[1] = filename
72.121 + //item[2] = revno
72.122 + //item[3] = timestamp
72.123 + //item[4] = other
72.124 + //item[5] = other1
72.125 +
72.126 + } //while more tokens
72.127 + this.setFiletype(item[0]);
72.128 + this.setFilename(item[1]);
72.129 + this.setRevno(item[2]);
72.130 + this.setTimestamp(item[3]);
72.131 +
72.132 + }
72.133 +
72.134 + public Entry(String line) {
72.135 + this(line, DEFAULT_SEPARATOR);
72.136 + }
72.137 +
72.138 + public boolean hasName(String queryFilename) {
72.139 + return this.getFilename().trim().equals(queryFilename.trim());
72.140 + }
72.141 +
72.142 + //Display Methods
72.143 + public String toString() {
72.144 + String fn, ft, revno, ts;
72.145 +
72.146 + fn=this.getFilename();
72.147 + ft=this.getFiletype();
72.148 + revno=this.getRevno();
72.149 + ts=this.getTimestamp();
72.150 +
72.151 + String fullEntry="FileName:\t"
72.152 + +fn+"\nFileType:\t"+ft +"\nRevno:\t"+revno
72.153 + +"\nTimeStamp:\t" +ts+"\n";
72.154 + return fullEntry;
72.155 + }
72.156 +
72.157 + // Accessor Methods
72.158 + public void setFilename(String str) {
72.159 + this.filename=str;
72.160 + }
72.161 +
72.162 + public String getFilename() {
72.163 + return filename;
72.164 + }
72.165 +
72.166 + public void setFiletype(String str) {
72.167 + this.filetype=str;
72.168 + }
72.169 +
72.170 + public String getFiletype() {
72.171 + return filetype;
72.172 + }
72.173 +
72.174 + public void setRevno(String str) {
72.175 + this.revno=str;
72.176 + }
72.177 +
72.178 + public String getRevno() {
72.179 + return revno;
72.180 + }
72.181 +
72.182 + public void setTimestamp(String str) {
72.183 + this.timestamp=str;
72.184 + }
72.185 +
72.186 + public String getTimestamp() {
72.187 + return timestamp;
72.188 + }
72.189 +
72.190 +}
73.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
73.2 +++ b/misc/ravebuild/build.properties Wed Feb 23 20:12:58 2011 -0500
73.3 @@ -0,0 +1,49 @@
73.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
73.5 +#
73.6 +# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
73.7 +#
73.8 +# The contents of this file are subject to the terms of either the GNU
73.9 +# General Public License Version 2 only ("GPL") or the Common
73.10 +# Development and Distribution License("CDDL") (collectively, the
73.11 +# "License"). You may not use this file except in compliance with the
73.12 +# License. You can obtain a copy of the License at
73.13 +# http://www.netbeans.org/cddl-gplv2.html
73.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
73.15 +# specific language governing permissions and limitations under the
73.16 +# License. When distributing the software, include this License Header
73.17 +# Notice in each file and include the License file at
73.18 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
73.19 +# particular file as subject to the "Classpath" exception as provided
73.20 +# by Sun in the GPL Version 2 section of the License file that
73.21 +# accompanied this code. If applicable, add the following below the
73.22 +# License Header, with the fields enclosed by brackets [] replaced by
73.23 +# your own identifying information:
73.24 +# "Portions Copyrighted [year] [name of copyright owner]"
73.25 +#
73.26 +# Contributor(s):
73.27 +#
73.28 +# The Original Software is NetBeans. The Initial Developer of the Original
73.29 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
73.30 +# Microsystems, Inc. All Rights Reserved.
73.31 +#
73.32 +# If you wish your version of this file to be governed by only the CDDL
73.33 +# or only the GPL Version 2, indicate your decision by adding
73.34 +# "[Contributor] elects to include this software in this distribution
73.35 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
73.36 +# single choice of license, a recipient has the option to distribute
73.37 +# your version of this file under either the CDDL, the GPL Version 2 or
73.38 +# to extend the choice of license to its licensees as provided above.
73.39 +# However, if you add GPL Version 2 code and therefore, elected the GPL
73.40 +# Version 2 license, then the option applies only if the new code is
73.41 +# made subject to such option by the copyright holder.
73.42 +
73.43 +# This property is used when merging the forked module sources to the netbeans
73.44 +# source directory. The list should contain the names of sparse cvs modules.
73.45 +# Only changed files should be contained in our sparse modules! If a file has size == 0,
73.46 +# the corresponding file will be removed from the original NB source!!
73.47 +# Look at the j2ee or j2eeserver modules as examples.
73.48 +#netbeans.forked.modules=libs,xml
73.49 +
73.50 +netbeans.dest.dir=../../nbbuild/netbeans
73.51 +#netbeans.location=../../nbbuild/netbeans
73.52 +nojdkCopy=true
74.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
74.2 +++ b/misc/ravebuild/build.xml Wed Feb 23 20:12:58 2011 -0500
74.3 @@ -0,0 +1,1374 @@
74.4 +<?xml version='1.0' encoding='ISO-8859-1' ?>
74.5 +<!--
74.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
74.7 +
74.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
74.9 +
74.10 +
74.11 +The contents of this file are subject to the terms of either the GNU
74.12 +General Public License Version 2 only ("GPL") or the Common
74.13 +Development and Distribution License("CDDL") (collectively, the
74.14 +"License"). You may not use this file except in compliance with the
74.15 +License. You can obtain a copy of the License at
74.16 +http://www.netbeans.org/cddl-gplv2.html
74.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
74.18 +specific language governing permissions and limitations under the
74.19 +License. When distributing the software, include this License Header
74.20 +Notice in each file and include the License file at
74.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
74.22 +particular file as subject to the "Classpath" exception as provided
74.23 +by Sun in the GPL Version 2 section of the License file that
74.24 +accompanied this code. If applicable, add the following below the
74.25 +License Header, with the fields enclosed by brackets [] replaced by
74.26 +your own identifying information:
74.27 +"Portions Copyrighted [year] [name of copyright owner]"
74.28 +
74.29 +Contributor(s):
74.30 +
74.31 +The Original Software is NetBeans. The Initial Developer of the Original
74.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
74.33 +Microsystems, Inc. All Rights Reserved.
74.34 +
74.35 +If you wish your version of this file to be governed by only the CDDL
74.36 +or only the GPL Version 2, indicate your decision by adding
74.37 +"[Contributor] elects to include this software in this distribution
74.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
74.39 +single choice of license, a recipient has the option to distribute
74.40 +your version of this file under either the CDDL, the GPL Version 2 or
74.41 +to extend the choice of license to its licensees as provided above.
74.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
74.43 +Version 2 license, then the option applies only if the new code is
74.44 +made subject to such option by the copyright holder.
74.45 +=======
74.46 +Visual Web top level build script.
74.47 +-->
74.48 +<project name="ravebuild" default="build" basedir=".">
74.49 +
74.50 + <property environment="env"/>
74.51 + <!-- XXX Also like in nbbuild, allow to specify user properties in ravebuild-->
74.52 + <!-- First things first: read the user's and/or -->
74.53 + <!-- the site's build properties files. -->
74.54 + <property file="${basedir}/user.build.properties"/>
74.55 + <property file="${basedir}/build.properties"/>
74.56 + <import file="${basedir}/default-rave-properties.xml"/>
74.57 +
74.58 + <property name="build.compiler.debug" value="true"/>
74.59 + <property name="build.compiler.deprecation" value="true"/>
74.60 + <!-- Jar options -->
74.61 + <property name="build.package.compress" value="false"/>
74.62 + <property name="build.package.index" value="true"/>
74.63 +
74.64 + <!-- Overriding test.user.dir -->
74.65 + <property name="test.user.dir" location="${basedir}/testuserdir"/>
74.66 +
74.67 + <!-- Used for NBM builds -->
74.68 + <property name="dist.base" value="www.sun.com/download/nbms"/>
74.69 + <property name="homepage.base" value="sun.com"/>
74.70 + <property name="nbm_alias" value="creator_ide"/>
74.71 + <property name="makenbm.override.url" value="http://www.sun.com/software/products/jscreator"/>
74.72 + <property name="nbm.is.global" value="true"/>
74.73 +
74.74 + <!-- Needed to be set this way, otherwise they are not initialized when init is running,
74.75 + which caused sanity-start to fail on unix, investigate -->
74.76 + <property name="sanitystart.args.additional" value=""/>
74.77 + <property name="sanitystart.args" value="-J-Dnetbeans.close=true ${sanitystart.args.additional}"/>
74.78 +
74.79 + <target name="bootstrap">
74.80 + <mkdir dir="${basedir}/build/antclasses"/>
74.81 + <javac srcdir="${basedir}/antsrc" destdir="${basedir}/build/antclasses" deprecation="true" debug="${build.compiler.debug}" source="1.4">
74.82 + <classpath path="${ant.home}/lib/ant.jar"/>
74.83 + </javac>
74.84 + <jar jarfile="${basedir}/raveantext.jar" basedir="${basedir}/build/antclasses">
74.85 + <exclude name="**/*.java"/>
74.86 + <exclude name="package-list"/>
74.87 + </jar>
74.88 +
74.89 + <taskdef name="for-each"
74.90 + classname="org.netbeans.modules.visualweb.ravebuild.ForEach"
74.91 + classpath="${rave_all}/ravebuild/raveantext.jar"/>
74.92 + <taskdef name="for-each-xsl"
74.93 + classname="org.netbeans.modules.visualweb.ravebuild.ForEachXsl"
74.94 + classpath="${rave_all}/ravebuild/raveantext.jar"/>
74.95 + </target>
74.96 +
74.97 + <target name="-check-netbeans-build" depends="merge-forked-modules">
74.98 + <condition property="skip.netbeans.build" value="true">
74.99 + <and>
74.100 + <or>
74.101 + <isset property="no.forked.modules"/>
74.102 + <isset property="no.new.merge"/>
74.103 + </or>
74.104 + <available file="${nb.src.dir}/merge_timestamps/build.ts"/>
74.105 + <available file="${nb.src.dir}/nbbuild/netbeans/platform6/lib/boot.jar"/>
74.106 + </and>
74.107 + </condition>
74.108 + <echo message="skip.netbeans.build= ${skip.netbeans.build}"/>
74.109 +
74.110 + <property name="netbeans.location" location="${nb.src.dir}/nbbuild/netbeans"/>
74.111 + </target>
74.112 +
74.113 + <target name="-check-netbeans-copy" depends="-check-netbeans-build">
74.114 + <condition property="skip.netbeans.copy" value="true">
74.115 + <and>
74.116 + <available file="${netbeans.dest.dir}/bin/netbeans"/>
74.117 + </and>
74.118 + </condition>
74.119 + <echo message="skip.netbeans.copy= ${skip.netbeans.copy}"/>
74.120 + </target>
74.121 +
74.122 + <target name="prepare-netbeans-dest-dir" depends="-check-netbeans-copy, init"
74.123 + unless="skip.netbeans.copy">
74.124 + <!-- mkdir dir="${netbeans.dest.dir}"/>
74.125 + <copy overwrite="true" todir="${netbeans.dest.dir}">
74.126 + <fileset dir="${netbeans.dir}" includes="**"/>
74.127 + </copy>
74.128 + <chmod perm="755" file="${netbeans.dest.dir}/bin/netbeans"/>
74.129 + -->
74.130 + </target>
74.131 +
74.132 + <target name="build-netbeans" depends="-check-netbeans-build,init"
74.133 + unless="skip.netbeans.build">
74.134 + <delete file="${nb.src.dir}/merge_timestamps/build.ts" failonerror="false"/>
74.135 + <ant antfile="${nb.src.dir}/nbbuild/build.xml" target="build-nozip" inheritall="false"/>
74.136 + <touch file="${nb.src.dir}/merge_timestamps/build.ts"/>
74.137 + </target>
74.138 +
74.139 + <target name="build-nbm-pack" depends="init,setup-nbm-signing,load-nbm-password" description="Builds all creator modules into nbms">
74.140 + <delete dir="nbms"/>
74.141 + <mkdir dir="nbms" />
74.142 + <loadproperties srcFile="../visualwebsuite/nbproject/project.properties">
74.143 + <filterchain>
74.144 + <tokenfilter>
74.145 + <!--deletecharacters chars=".."/-->
74.146 + <replacestring from=".." to=""/>
74.147 + </tokenfilter>
74.148 + </filterchain>
74.149 + </loadproperties>
74.150 + <!-- <echo message="Modules = ${modules}"/>-->
74.151 + <for-each startdir=".." target="nbm" locations="${modules}">
74.152 + <property name="nbm.target.dir" value="${basedir}/nbms"/>
74.153 + <property name="license.file" location="${rave_all}/ravebuild/visualweb-nbm-license.txt"/>
74.154 + <property name="nbm.is.global" value="true"/>
74.155 + <property name="homepage.base" value="sun.com"/>
74.156 + <property name="makenbm.override.url" value="http://www.netbeans.org/products/visualweb/index.html"/>
74.157 + <property name="keystore" value="${keystore}"/>
74.158 + <property name="storepass" value="${storepass}"/>
74.159 + <property name="nbm_alias" value="visualweb_ide"/>
74.160 + </for-each>
74.161 + </target>
74.162 + <target name="nbm"/><!-- dummy target -->
74.163 +
74.164 + <target name="fix-all-licenses" depends="init">
74.165 + <loadproperties srcFile="../visualwebsuite/nbproject/project.properties">
74.166 + <filterchain>
74.167 + <tokenfilter>
74.168 + <!--deletecharacters chars=".."/-->
74.169 + <replacestring from=".." to=""/>
74.170 + </tokenfilter>
74.171 + </filterchain>
74.172 + </loadproperties>
74.173 + <for-each-xsl startdir=".." locations="${modules}"/>
74.174 + <for-each startdir=".." target="fix-license" locations="${modules}" inheritall="false"/>
74.175 + <!--
74.176 + <for-each-xsl startdir=".." locations="xhtml"/>
74.177 + <for-each startdir=".." target="fix-license" locations="xhtml" inheritall="false"/>
74.178 + -->
74.179 + </target>
74.180 +
74.181 + <target name="fix-all-library-licenses" depends="init">
74.182 + <loadproperties srcFile="../visualwebsuite/nbproject/project.properties">
74.183 + <filterchain>
74.184 + <tokenfilter>
74.185 + <!--deletecharacters chars=".."/-->
74.186 + <replacestring from=".." to=""/>
74.187 + </tokenfilter>
74.188 + </filterchain>
74.189 + </loadproperties>
74.190 + <for-each-xsl startdir=".." locations="${modules}" suffix="library"/>
74.191 + <for-each startdir=".." target="fix-license" locations="${modules}" suffix="library" inheritall="false" skipnonexistentdir="true">
74.192 + <property name="suite.dir" location="${basedir}/../visualwebsuite"/>
74.193 + </for-each>
74.194 + </target>
74.195 +
74.196 + <target name="-check-forked-modules">
74.197 + <condition property="no.forked.modules">
74.198 + <equals trim="true" arg1="${netbeans.forked.modules}" arg2=""/>
74.199 + </condition>
74.200 + </target>
74.201 +
74.202 + <target name="merge-forked-modules" depends="-check-forked-modules,init"
74.203 + unless="no.forked.modules">
74.204 + <mkdir dir="${nb.src.dir}/merge_timestamps"/>
74.205 + <subant target="merge" genericantfile="${basedir}/merge-forked-modules.xml">
74.206 + <property name="rave_all" value="${rave_all}"/>
74.207 + <property name="nb.src.dir" value="${nb.src.dir}"/>
74.208 + <dirset dir="${rave_all}" includes="${netbeans.forked.modules}"/>
74.209 + </subant>
74.210 + <uptodate property="no.new.merge">
74.211 + <srcfiles dir="${nb.src.dir}/merge_timestamps" includes="module.*.ts"/>
74.212 + <mapper type="merge" to="${nb.src.dir}/nbbuild/netbeans/moduleCluster.properties"/>
74.213 + </uptodate>
74.214 + </target>
74.215 +
74.216 + <target name="unzip-netbeans-bin" depends="init" unless="netbeans.bin.unzipped">
74.217 + <mkdir dir="${basedir}/build"/>
74.218 + <unzip overwrite="true" src="${cache.dir}/${nb.bin.zip}" dest="${basedir}"/>
74.219 + <property name="netbeans.location" location="${basedir}/netbeans"/>
74.220 + <property name="netbeans.bin.unzipped" value="true"/>
74.221 + </target>
74.222 +
74.223 + <!-- Overriding all target.
74.224 + Reason: removing commit-validation, adding sanity-start -->
74.225 + <target name="all" depends="build-zip,sanity-start" description="Build the IDE, run basic validation tests, start the IDE, and create the zip"/>
74.226 +
74.227 + <!-- All target without zipping the IDE -->
74.228 + <target name="all-nozip" depends="build,sanity-start" description="Build the IDE, run basic validation tests, and start the IDE"/>
74.229 +
74.230 + <target name="build" depends="prepare-netbeans-dest-dir, copy-jdk" description="Build the IDE, run basic validation tests, and start the IDE">
74.231 + <ant antfile="../visualwebsuite/build.xml" target="build" inheritall="false"/>
74.232 + <echo file="${netbeans.dest.dir}/visualweb1/build-number">${buildnumber}</echo>
74.233 + <!-- ant antfile="../idesuite/build.xml" target="build" inheritall="false"/ -->
74.234 + <!-- echo file="${basedir}/rave/raveide2.0/build-number">${buildnumber}</echo -->
74.235 + </target>
74.236 +
74.237 + <!--
74.238 + <target name="rebuild-netbeans" description="(Re)builds Netbeans from the source distribution">
74.239 + <antcall target="prepare-netbeans-dest-dir" inheritall="true">
74.240 + <param name="force.netbeans.rebuild" value="true"/>
74.241 + </antcall>
74.242 + </target>
74.243 + -->
74.244 +
74.245 + <target name="-suite-clean">
74.246 + <available file="${netbeans.dest.dir}/harness/suite.xml" property="harness.available"/>
74.247 + </target>
74.248 +
74.249 + <target name="suite-clean" depends="init, -suite-clean" description="Cleans the module suite only" if="harness.available">
74.250 + <!-- ant antfile="../idesuite/build.xml" target="clean" inheritall="false"/ -->
74.251 + <ant antfile="../visualwebsuite/build.xml" target="clean" inheritall="false"/>
74.252 + </target>
74.253 +
74.254 + <target name="ravebuild-clean">
74.255 + <delete dir="${netbeans.dest.dir}/visualweb1"/>
74.256 + <delete dir="build"/>
74.257 + <delete file="raveantext.jar" failonerror="false" deleteonexit="true"/>
74.258 + </target>
74.259 +
74.260 + <target name="nb-platform-clean">
74.261 + <ant antfile="netbeans-src/nbbuild/build.xml" target="clean" inheritall="false"/>
74.262 + <delete file="${nb.src.dir}/merge_timestamps/build.ts"/>
74.263 + </target>
74.264 +
74.265 + <target name="test-clean">
74.266 + <!-- XXX Fix this later
74.267 + <ant antfile="../test/build.xml" target="clean" inheritall="false"/>
74.268 + -->
74.269 + </target>
74.270 +
74.271 + <target name="clean" depends="init, suite-clean, ravebuild-clean, test-clean" description="Cleans build products">
74.272 + <delete dir="rave" deleteonexit="true"/>
74.273 + </target>
74.274 +
74.275 + <!-- Overriding set-buildnumber target.
74.276 + Reason: Different format (property would be better) -->
74.277 + <target name="set-buildnumber" unless="buildnumber">
74.278 + <tstamp>
74.279 + <format property="buildnumber" pattern="yyMMdd-HHmm"/>
74.280 + </tstamp>
74.281 + </target>
74.282 +
74.283 + <target name="-validate-cache">
74.284 +
74.285 + <condition property="netbeans.dir.tmp" value="${netbeans.location}">
74.286 + <available file="${netbeans.location}/bin/netbeans"/>
74.287 + </condition>
74.288 +
74.289 + <condition property="netbeans.dir" value="../../nbbuild/netbeans">
74.290 + <not>
74.291 + <isset property="netbeans.dir.tmp"/>
74.292 + </not>
74.293 + </condition>
74.294 + <property name="netbeans.dir" location="${netbeans.location}"/>
74.295 +
74.296 +
74.297 + <condition property="netbeans.bin.available">
74.298 + <or>
74.299 + <available file="${netbeans.dir}/bin/netbeans"/>
74.300 + <isset property="bypass.cache.validation"/>
74.301 + </or>
74.302 + </condition>
74.303 + <fail unless="netbeans.bin.available">
74.304 + Netbeans binary under ${netbeans.location} OR ${basedir}/../../nbbuildccould not be found. A cache update may be needed.
74.305 + </fail>
74.306 +
74.307 + <condition property="jdk.available">
74.308 + <or>
74.309 + <available file="${env.JAVA_HOME}/COPYRIGHT"/>
74.310 + <os family="mac"/>
74.311 + <isset property="bypass.cache.validation"/>
74.312 + </or>
74.313 + </condition>
74.314 + <fail unless="jdk.available">
74.315 + The bundled version of the JVM under ${env.JAVA_HOME}/bin/java could not be found. A cache update may be needed.
74.316 + </fail>
74.317 +
74.318 + <condition property="jdk.version">
74.319 + <equals arg1="${ant.java.version}" arg2="1.5" />
74.320 + </condition>
74.321 + <fail unless="jdk.version">
74.322 + The bundled version of the JVM under ${env.JAVA_HOME} should be 1.5.0_06.
74.323 + Run the "ant unzip-jdk" target to download and unzip the required jdk.
74.324 + Set JAVA_HOME to this new JDK location
74.325 + </fail>
74.326 + </target>
74.327 +
74.328 + <!-- Overriding init target.
74.329 + Reason: Adding setup-nbm-signing targets
74.330 + and setup of buildnum and nbm.target.dir properties -->
74.331 + <target name="init" depends="-validate-cache, set-buildnumber, bootstrap">
74.332 + <property name="buildnum" value="ide-${buildnumber}"/>
74.333 + <property name="sanitystart.args" value="-J-Dnetbeans.close=true ${sanitystart.args.additional}"/>
74.334 + <!-- Adding new value -->
74.335 + <property name="nbm.target.dir" location="nbms" />
74.336 + <condition property="isMacOSX">
74.337 + <os family="mac"/>
74.338 + </condition>
74.339 + </target>
74.340 +
74.341 + <!-- Overriging sanity-start target.
74.342 + Reason: To match the ravebuild/rave dir (not able to parametrize) -->
74.343 + <target name="sanity-start" depends="init,maybe-build-nozip">
74.344 + <mkdir dir="${test.user.dir}"/>
74.345 + <echo>Starting the IDE as a sanity check...</echo>
74.346 + <!-- XXX better would be to scan start log for stacktraces and just show those; -->
74.347 + <!-- possibly after filtering for duplicates or something like this. -->
74.348 + <!-- Timeout is ten minutes; should be enough for valid start, while preventing -->
74.349 + <!-- a deadlock from hanging an automated build: -->
74.350 + <exec os="Windows NT Windows 95 Windows 98 Windows 2000 Windows XP" executable="${netbeans.dest.dir}/bin/netbeans.exe" failonerror="yes" timeout="600000">
74.351 + <arg value="-jdkhome"/>
74.352 + <arg file="${jdkhome}"/>
74.353 + <arg value="-userdir"/>
74.354 + <arg file="${test.user.dir}"/>
74.355 + <arg line="${sanitystart.args}"/>
74.356 + </exec>
74.357 + <exec os="Linux SunOS Solaris" dir="." executable="sh" failonerror="yes" timeout="600000">
74.358 + <arg value="${netbeans.dest.dir}/bin/netbeans"/>
74.359 + <arg value="-jdkhome"/>
74.360 + <arg file="${jdkhome}"/>
74.361 + <arg value="-userdir"/>
74.362 + <arg file="${test.user.dir}"/>
74.363 + <arg line="${sanitystart.args}"/>
74.364 + </exec>
74.365 + <exec os="Mac OS X" dir="." executable="sh" failonerror="yes" timeout="600000">
74.366 + <arg value="${netbeans.dest.dir}/bin/netbeans"/>
74.367 + <arg value="-userdir"/>
74.368 + <arg file="${test.user.dir}"/>
74.369 + <arg line="${sanitystart.args}"/>
74.370 + </exec>
74.371 + <echo>Finished starting the IDE, pay attention to any reported errors.</echo>
74.372 + </target>
74.373 +
74.374 + <!-- Overriding build target.
74.375 + Reason: to be able customize the destination and prefix (not able now). -->
74.376 + <target name="build-zip" depends="build-nozip,copy-jdk"
74.377 + description="Create a complete build including a ZIP distribution (but do not try it).">
74.378 + <!-- zip task not well suited to making final build, as it does not set +x bits -->
74.379 + <!-- so on Unix try to use native ZIP first -->
74.380 +
74.381 + <!-- package the visualweb cluster into a zip file -->
74.382 + <delete file="${rave.zip.dest}/RAVE-vw-${buildnumber}.zip"/>
74.383 +
74.384 + <zip destfile="${rave.zip.dest}/RAVE-vw-${buildnumber}.zip" update="true" duplicate="preserve">
74.385 + <zipfileset dir="${netbeans.dest.dir}/${rave.zip.prefix}" prefix="${rave.zip.prefix}"/>
74.386 + </zip>
74.387 + <echo>Build created; see RAVE-vw-${buildnumber}.zip (in ravebuild/). </echo>
74.388 +
74.389 + <!-- package the whole IDE + visualweb cluster into a zip file -->
74.390 + <delete file="${rave.zip.dest}/RAVE-ide-${buildnumber}.zip"/>
74.391 +
74.392 + <zip destfile="${rave.zip.dest}/RAVE-ide-${buildnumber}.zip" update="true" duplicate="preserve">
74.393 + <zipfileset file="${netbeans.dest.dir}/bin/netbeans" filemode="755" prefix="${nb.zip.prefix}/bin"/>
74.394 + <zipfileset file="${netbeans.dest.dir}/platform7/lib/nbexec" filemode="755" prefix="${nb.zip.prefix}/platform7/lib"/>
74.395 + <zipfileset file="${netbeans.dest.dir}" filemode="755" prefix="${nb.zip.prefix}">
74.396 + <include name="*.sh"/>
74.397 + </zipfileset>
74.398 + <zipfileset dir="${netbeans.dest.dir}" prefix="${nb.zip.prefix}">
74.399 + <exclude name="*.built" />
74.400 + </zipfileset>
74.401 + <zipfileset dir="${netbeans.dest.dir}/${rave.zip.prefix}" prefix="${nb.zip.prefix}"/>
74.402 + </zip>
74.403 + <echo>Build created; see RAVE-ide-${buildnumber}.zip (in ravebuild/). </echo>
74.404 + </target>
74.405 +
74.406 + <!-- Overriding build-nbms target.
74.407 + Reason: adding deletion of nbms dir -->
74.408 + <target name="build-nbms" depends="init">
74.409 + <delete dir="nbms"/>
74.410 +<!-- <ant antfile="${nb.src.dir}/nbbuild/build.xml" target="build-nbms" inheritall="false"/> -->
74.411 + <!-- Does not work <antcall target="nbbuild.build-nbms"/> -->
74.412 + </target>
74.413 +
74.414 + <!-- Overriding l10n-kit target.
74.415 + Reason: Using diff module list. -->
74.416 +
74.417 + <delete dir="l10n-tmp"/>
74.418 + <target name="grab" depends="init"
74.419 + description="Grabs localizable files into l10n-tmp">
74.420 + <taskdef name="grabLocalizableFiles" classname="com.sun.rave.ravebuild.GetLocalizableFiles" classpath="${basedir}/raveantext.jar"/>
74.421 + <grabLocalizableFiles listfile="l10n.list" basedir=".." targetdir="l10n-tmp" modulelist="true"/>
74.422 + </target>
74.423 +
74.424 + <target name="l10n-kit" depends="init,grab">
74.425 + <taskdef name="l10n" classname="com.sun.rave.ravebuild.L10nTask"
74.426 + classpath="${basedir}/raveantext.jar"/>
74.427 + <delete dir="${l10n.dist.dir}"/>
74.428 + <mkdir dir="${l10n.dist.dir}"/>
74.429 + <delete dir="tmp"/>
74.430 + <mkdir dir="tmp"/>
74.431 + <property name="nbroot" location=".."/>
74.432 + <!-- Make sure you call with the right configuration here to get modules populated correctly -->
74.433 + <property name="l10n-modules" value="installer,${allmodules}"/>
74.434 + <l10n topdirs="${nbroot}" modules="${l10n-modules}"
74.435 + localizablefile="l10n.list" generatedfile="l10n.list.translated"
74.436 + distdir="${l10n.dist.dir}" changedfile="l10n.list.changed"
74.437 + builddir="tmp" buildnumber="${buildnumber}"
74.438 + excludepattern="**/ja/,**/*_ja.*"/>
74.439 + <delete dir="tmp"/>
74.440 + </target>
74.441 +
74.442 + <!-- FIXME Overriding check-for-build target.
74.443 + Reason: To reflect changed target location. -->
74.444 + <target name="check-for-build">
74.445 + <available property="have-build" file="${netbeans.dest.dir}/bin/netbeans"/>
74.446 + </target>
74.447 + <!-- Overriding maybe-build-nozip target.
74.448 + Reason: To launch with correct basedir and target context. -->
74.449 + <target name="maybe-build-nozip" depends="check-for-build" unless="have-build">
74.450 + <ant dir="${basedir}" target="build-nozip"/>
74.451 + </target>
74.452 +
74.453 +
74.454 + <!-- Overriding build-nozip target.
74.455 + Reason: Overriding cluster.properties file, removing netbeans.conf, using creator.conf
74.456 + and adding creator launchers -->
74.457 + <target name="build-nozip" depends="build">
74.458 + </target>
74.459 +
74.460 + <!-- target used by Rave build -->
74.461 + <!-- Zip up the NBMs for release -->
74.462 + <target name="zip-nbms" depends="init">
74.463 + <!-- Zip up all the other nbms and store in dist.dir -->
74.464 +
74.465 + <!-- This is the old way to creating NBM zip. -->
74.466 + <!-- But this does not create NBM zip on Windows -->
74.467 + <!-- <exec os="Solaris SunOS Linux Mac OS X" executable="zip" dir="${nbm.target.dir}" failonerror="false">
74.468 + <arg line="-9"/>
74.469 + <arg line="-r"/>
74.470 + <arg line="RAVE-${buildnum}-nbms.zip"/>
74.471 + <arg line="."/>
74.472 + <arg line="-i"/>
74.473 + <arg line="*"/>
74.474 + </exec>
74.475 + <move file="${nbm.target.dir}/RAVE-${buildnum}-nbms.zip"
74.476 + tofile="${basedir}/RAVE-${buildnum}-nbms-test.zip"/> -->
74.477 +
74.478 + <!-- Using ANT zip to create NBM zips on all platforms -->
74.479 + <zip destfile="${basedir}/RAVE-${buildnum}-nbms.zip">
74.480 + <zipfileset dir="${nbm.target.dir}" includes="*.nbm"/>
74.481 + </zip>
74.482 + <!-- Cleanup the temporary directory. -->
74.483 + </target>
74.484 +
74.485 + <!-- This will read the NBM signing values from the cache if possible. -->
74.486 + <target name="setup-nbm-signing"
74.487 + depends="start-setup-nbm-signing,load-nbm-password,dont-sign-nbms"/>
74.488 +
74.489 + <!-- Set properties for the NBM signing cache, and see if it's there. -->
74.490 + <target name="start-setup-nbm-signing">
74.491 + <property name="re-nbm-key-cache" location="${basedir}/build_env"/>
74.492 + <property name="keystore" location="${re-nbm-key-cache}/ide.ks"/>
74.493 + <property name="re-nbm-passfile" location="${re-nbm-key-cache}/.pswd"/>
74.494 + <available file="${keystore}" property="re-nbm-keystore-available"/>
74.495 + </target>
74.496 +
74.497 + <!-- Read the file that will set re-nbm-storepass to the password. -->
74.498 + <target name="load-nbm-password" if="re-nbm-keystore-available">
74.499 + <property file="${re-nbm-passfile}"/>
74.500 + <property name="storepass" value="${re-nbm-storepass}"/>
74.501 + </target>
74.502 +
74.503 + <!-- If we can't sign the NBM's, set alternate property values. -->
74.504 + <target name="dont-sign-nbms" unless="re-nbm-keystore-available">
74.505 + <property name="keystore" value="junk"/>
74.506 + <property name="storepass" value="?"/>
74.507 + </target>
74.508 +
74.509 + <target name="copy-env1" depends="init">
74.510 + <available property="env-copied" file="${jdkhome}/COPYRIGHT"/>
74.511 + <condition property="noJdkCopy">
74.512 + <or>
74.513 + <isset property="isMacOSX"/>
74.514 + <isset property="env-copied"/>
74.515 + </or>
74.516 + </condition>
74.517 + <available property="shipJdkHome"
74.518 + value="${env.JAVA_HOME}"
74.519 + file="${env.JAVA_HOME}/COPYRIGHT"/>
74.520 + <condition property="shipJdkHome" value="${jdkhome}">
74.521 + <not>
74.522 + <isset property="shipJdkHome"/>
74.523 + </not>
74.524 + </condition>
74.525 + </target>
74.526 +
74.527 + <target name="copy-jdk" depends="copy-env1" unless="noJdkCopy">
74.528 + <!--
74.529 + <copy toDir="${jdkhome}">
74.530 + <fileset dir="${shipJdkHome}">
74.531 + <include name="COPYRIGHT"/>
74.532 + <include name="LICENSE"/>
74.533 + <include name="README"/>
74.534 + <include name="src.zip"/>
74.535 + <include name="README.html"/>
74.536 + <include name="bin/**"/>
74.537 + <include name="include/**"/>
74.538 + <include name="jre/**"/>
74.539 + <include name="lib/**"/>
74.540 + <include name="man/**"/>
74.541 + </fileset>
74.542 + </copy>
74.543 + <chmod perm="ugo+x">
74.544 + <fileset dir="${jdkhome}">
74.545 + <include name="**/bin/*"/>
74.546 + </fileset>
74.547 + </chmod>
74.548 + -->
74.549 + </target>
74.550 +
74.551 + <!-- Helper targets for building individual modules, this replaces the individual scripts -->
74.552 + <!-- Add individual wrapper targets you need -->
74.553 + <property name="target" value="netbeans"/>
74.554 +
74.555 + <!-- Rave modules -->
74.556 + <target name="appbase">
74.557 + <ant dir="../appbase" target="${target}"/>
74.558 + </target>
74.559 + <target name="audit">
74.560 + <ant dir="../audit" target="${target}"/>
74.561 + </target>
74.562 + <target name="branding/autoupdate">
74.563 + <ant dir="../branding/autoupdate" target="${target}"/>
74.564 + </target>
74.565 + <target name="branding/beans">
74.566 + <ant dir="../branding/beans" target="${target}"/>
74.567 + </target>
74.568 + <target name="branding/core">
74.569 + <ant dir="../branding/core" target="${target}"/>
74.570 + </target>
74.571 + <target name="branding/core/windows">
74.572 + <ant dir="../branding/core/windows" target="${target}"/>
74.573 + </target>
74.574 + <target name="branding/editor">
74.575 + <ant dir="../branding/editor" target="${target}"/>
74.576 + </target>
74.577 + <target name="branding/extbrowser">
74.578 + <ant dir="../branding/extbrowser" target="${target}"/>
74.579 + </target>
74.580 + <target name="branding/java">
74.581 + <ant dir="../branding/java" target="${target}"/>
74.582 + </target>
74.583 + <target name="branding/image">
74.584 + <ant dir="../branding/image" target="${target}"/>
74.585 + </target>
74.586 + <target name="branding/html">
74.587 + <ant dir="../branding/html" target="${target}"/>
74.588 + </target>
74.589 + <target name="branding/objectbrowser/navigator">
74.590 + <ant dir="../branding/objectbrowser/navigator" target="${target}"/>
74.591 + </target>
74.592 + <target name="branding/openide">
74.593 + <ant dir="../branding/openide" target="${target}"/>
74.594 + </target>
74.595 + <target name="branding/openidex">
74.596 + <ant dir="../branding/openidex" target="${target}"/>
74.597 + </target>
74.598 + <target name="branding/openide/loaders">
74.599 + <ant dir="../branding/openide/loaders" target="${target}"/>
74.600 + </target>
74.601 + <target name="branding/projects/projectui">
74.602 + <ant dir="../branding/projects/projectui" target="${target}"/>
74.603 + </target>
74.604 + <target name="branding/refactoring">
74.605 + <ant dir="../branding/refactoring" target="${target}"/>
74.606 + </target>
74.607 + <target name="branding/tasklist/docscan">
74.608 + <ant dir="../branding/tasklist/docscan" target="${target}"/>
74.609 + </target>
74.610 + <target name="branding/utilities">
74.611 + <ant dir="../branding/utilities" target="${target}"/>
74.612 + </target>
74.613 + <target name="branding/vcscore">
74.614 + <ant dir="../branding/vcscore" target="${target}"/>
74.615 + </target>
74.616 + <target name="branding/web/jspsyntax">
74.617 + <ant dir="../branding/web/jspsyntax" target="${target}"/>
74.618 + </target>
74.619 + <target name="branding/web/project">
74.620 + <ant dir="../branding/web/project" target="${target}"/>
74.621 + </target>
74.622 + <target name="branding/xml/catalog">
74.623 + <ant dir="../branding/xml/catalog" target="${target}"/>
74.624 + </target>
74.625 + <target name="branding/xml/core">
74.626 + <ant dir="../branding/xml/core" target="${target}"/>
74.627 + </target>
74.628 + <target name="branding/xml/css">
74.629 + <ant dir="../branding/xml/css" target="${target}"/>
74.630 + </target>
74.631 + <target name="branding/xml/text-edit">
74.632 + <ant dir="../branding/xml/text-edit" target="${target}"/>
74.633 + </target>
74.634 + <target name="css">
74.635 + <ant dir="../css" target="${target}"/>
74.636 + </target>
74.637 + <target name="dataconnectivity">
74.638 + <ant dir="../dataconnectivity" target="${target}"/>
74.639 + </target>
74.640 + <target name="designer">
74.641 + <ant dir="../designer" target="${target}"/>
74.642 + </target>
74.643 + <target name="designer/api">
74.644 + <ant dir="../designer/api" target="${target}"/>
74.645 + </target>
74.646 + <target name="designer/markup">
74.647 + <ant dir="../designer/markup" target="${target}"/>
74.648 + </target>
74.649 + <target name="designtime">
74.650 + <ant dir="../designtime" target="${target}"/>
74.651 + </target>
74.652 + <target name="ejb">
74.653 + <ant dir="../ejb" target="${target}"/>
74.654 + </target>
74.655 + <target name="ejb/support">
74.656 + <ant dir="../ejb/support" target="${target}"/>
74.657 + </target>
74.658 + <target name="errorhandler/client">
74.659 + <ant dir="../errorhandler/client" target="${target}"/>
74.660 + </target>
74.661 + <target name="errorhandler/server">
74.662 + <ant dir="../errorhandler/server" target="${target}"/>
74.663 + </target>
74.664 + <target name="extension/apisupport/ant">
74.665 + <ant dir="../extension/apisupport/ant" target="${target}"/>
74.666 + </target>
74.667 + <target name="extension/autoupdate">
74.668 + <ant dir="../extension/autoupdate" target="${target}"/>
74.669 + </target>
74.670 + <target name="extension/beans">
74.671 + <ant dir="../extension/beans" target="${target}"/>
74.672 + </target>
74.673 + <target name="extension/core">
74.674 + <ant dir="../extension/core" target="${target}"/>
74.675 + </target>
74.676 + <target name="extension/core/execution">
74.677 + <ant dir="../extension/core/execution" target="${target}"/>
74.678 + </target>
74.679 + <target name="extension/core/ide">
74.680 + <ant dir="../extension/core/ide" target="${target}"/>
74.681 + </target>
74.682 + <target name="extension/core/javahelp">
74.683 + <ant dir="../extension/core/javahelp" target="${target}"/>
74.684 + </target>
74.685 + <target name="extension/core/multiview">
74.686 + <ant dir="../extension/core/multiview" target="${target}"/>
74.687 + </target>
74.688 + <target name="extension/core/output2">
74.689 + <ant dir="../extension/core/output2" target="${target}"/>
74.690 + </target>
74.691 + <target name="extension/core/ui">
74.692 + <ant dir="../extension/core/ui" target="${target}"/>
74.693 + </target>
74.694 + <target name="extension/core/windows">
74.695 + <ant dir="../extension/core/windows" target="${target}"/>
74.696 + </target>
74.697 + <target name="extension/debuggercore">
74.698 + <ant dir="../extension/debuggercore" target="${target}"/>
74.699 + </target>
74.700 + <target name="extension/debuggerjpda/ui">
74.701 + <ant dir="../extension/debuggerjpda/ui" target="${target}"/>
74.702 + </target>
74.703 + <target name="extension/editor">
74.704 + <ant dir="../extension/editor" target="${target}"/>
74.705 + </target>
74.706 + <target name="extension/html">
74.707 + <ant dir="../extension/html" target="${target}"/>
74.708 + </target>
74.709 + <target name="extension/ide/launcher/upgrade">
74.710 + <ant dir="../extension/ide/launcher/upgrade" target="${target}"/>
74.711 + </target>
74.712 + <target name="extension/java">
74.713 + <ant dir="../extension/java" target="${target}"/>
74.714 + </target>
74.715 + <target name="extension/java/editor">
74.716 + <ant dir="../extension/java/editor" target="${target}"/>
74.717 + </target>
74.718 + <target name="extension/java/freeform">
74.719 + <ant dir="../extension/java/freeform" target="${target}"/>
74.720 + </target>
74.721 + <target name="extension/java/j2seproject">
74.722 + <ant dir="../extension/java/j2seproject" target="${target}"/>
74.723 + </target>
74.724 + <target name="extension/java/platform">
74.725 + <ant dir="../extension/java/platform" target="${target}"/>
74.726 + </target>
74.727 + <target name="extension/javadoc">
74.728 + <ant dir="../extension/javadoc" target="${target}"/>
74.729 + </target>
74.730 + <target name="extension/monitor">
74.731 + <ant dir="../extension/monitor" target="${target}"/>
74.732 + </target>
74.733 + <target name="extension/objectbrowser/navigator">
74.734 + <ant dir="../extension/objectbrowser/navigator" target="${target}"/>
74.735 + </target>
74.736 + <target name="extension/openide">
74.737 + <ant dir="../extension/openide" target="${target}"/>
74.738 + </target>
74.739 + <target name="extension/projects/projectui">
74.740 + <ant dir="../extension/projects/projectui" target="${target}"/>
74.741 + </target>
74.742 + <target name="extension/properties">
74.743 + <ant dir="../extension/properties" target="${target}"/>
74.744 + </target>
74.745 + <target name="extension/refactoring">
74.746 + <ant dir="../extension/refactoring" target="${target}"/>
74.747 + </target>
74.748 + <target name="extension/tasklist/docscan">
74.749 + <ant dir="../extension/tasklist/docscan" target="${target}"/>
74.750 + </target>
74.751 + <target name="extension/utilities">
74.752 + <ant dir="../extension/utilities" target="${target}"/>
74.753 + </target>
74.754 + <target name="extension/utilities/project">
74.755 + <ant dir="../extension/utilities/project" target="${target}"/>
74.756 + </target>
74.757 + <target name="extension/vcscore">
74.758 + <ant dir="../extension/vcscore" target="${target}"/>
74.759 + </target>
74.760 + <target name="extension/vcsgeneric">
74.761 + <ant dir="../extension/vcsgeneric" target="${target}"/>
74.762 + </target>
74.763 + <target name="extension/web/core">
74.764 + <ant dir="../extension/web/core" target="${target}"/>
74.765 + </target>
74.766 + <target name="extension/web/project">
74.767 + <ant dir="../extension/web/project" target="${target}"/>
74.768 + </target>
74.769 + <target name="extension/xml/api">
74.770 + <ant dir="../extension/xml/api" target="${target}"/>
74.771 + </target>
74.772 + <target name="extension/xml/catalog">
74.773 + <ant dir="../extension/xml/catalog" target="${target}"/>
74.774 + </target>
74.775 + <target name="extension/xml/core">
74.776 + <ant dir="../extension/xml/core" target="${target}"/>
74.777 + </target>
74.778 + <target name="extension/xml/css">
74.779 + <ant dir="../extension/xml/css" target="${target}"/>
74.780 + </target>
74.781 + <target name="extension/xml/text-edit">
74.782 + <ant dir="../extension/xml/text-edit" target="${target}"/>
74.783 + </target>
74.784 + <target name="insync">
74.785 + <ant dir="../insync" target="${target}"/>
74.786 + </target>
74.787 + <target name="insync/api">
74.788 + <ant dir="../insync/api" target="${target}"/>
74.789 + </target>
74.790 + <target name="jsfcl">
74.791 + <ant dir="../jsfcl" target="${target}"/>
74.792 + </target>
74.793 + <target name="jsfloader">
74.794 + <ant dir="../project/jsfloader" target="${target}"/>
74.795 + </target>
74.796 + <target name="jsfmetadata">
74.797 + <ant dir="../jsfmetadata" target="${target}"/>
74.798 + </target>
74.799 + <target name="jsfsupport">
74.800 + <ant dir="../jsfsupport" target="${target}"/>
74.801 + </target>
74.802 + <target name="jspsyntaxint">
74.803 + <ant dir="../jspsyntaxint" target="${target}"/>
74.804 + </target>
74.805 + <target name="jwsdpsupport">
74.806 + <ant dir="../jwsdpsupport" target="${target}"/>
74.807 + </target>
74.808 + <!-- XXX Change to ravelibs/ soon -->
74.809 + <target name="ravelibs/jsf">
74.810 + <ant dir="../ravelibs/jsf" target="${target}"/>
74.811 + </target>
74.812 + <target name="ravelibs/rowset">
74.813 + <ant dir="../ravelibs/rowset" target="${target}"/>
74.814 + </target>
74.815 + <target name="licensing">
74.816 + <ant dir="../licensing" target="${target}"/>
74.817 + </target>
74.818 + <target name="navigation">
74.819 + <ant dir="../navigation" target="${target}"/>
74.820 + </target>
74.821 + <target name="opensrc">
74.822 + <ant dir="../opensrc" target="${target}"/>
74.823 + </target>
74.824 + <target name="opensrc/batik">
74.825 + <ant dir="../opensrc/batik" target="${target}"/>
74.826 + </target>
74.827 + <target name="opensrc/batik/script">
74.828 + <ant dir="../opensrc/batik/script" target="${target}"/>
74.829 + </target>
74.830 + <target name="preview/support">
74.831 + <ant dir="../preview/support" target="${target}"/>
74.832 + </target>
74.833 + <target name="project">
74.834 + <ant dir="../project" target="${target}"/>
74.835 + </target>
74.836 + <target name="project/jsfloader">
74.837 + <ant dir="../project/jsfloader" target="${target}"/>
74.838 + </target>
74.839 + <target name="project/jsf">
74.840 + <ant dir="../project/jsf" target="${target}"/>
74.841 + </target>
74.842 + <target name="project/jsfproject">
74.843 + <ant dir="../project/jsfproject" target="${target}"/>
74.844 + </target>
74.845 + <target name="project/jsfprojectapi">
74.846 + <ant dir="../project/jsfprojectapi" target="${target}"/>
74.847 + </target>
74.848 + <target name="project/jsfportlet">
74.849 + <ant dir="../project/jsfportlet" target="${target}"/>
74.850 + </target>
74.851 + <target name="project/navigationloader">
74.852 + <ant dir="../project/navigationloader" target="${target}"/>
74.853 + </target>
74.854 + <target name="clean-project/jsfportlet">
74.855 + <ant dir="../project/jsfportlet" target="clean"/>
74.856 + </target>
74.857 + <target name="portletcontainer">
74.858 + <ant dir="../portletcontainer" target="${target}"/>
74.859 + </target>
74.860 + <target name="clean-portletcontainer">
74.861 + <ant dir="../portletcontainer" target="${target}"/>
74.862 + </target>
74.863 + <target name="project/migration">
74.864 + <ant dir="../project/migration" target="${target}"/>
74.865 + </target>
74.866 + <target name="clean-project/migration">
74.867 + <ant dir="../project/migration" target="clean"/>
74.868 + </target>
74.869 + <target name="propertyeditors">
74.870 + <ant dir="../propertyeditors" target="${target}"/>
74.871 + </target>
74.872 + <target name="ravehelp">
74.873 + <ant dir="../ravehelp" target="${target}"/>
74.874 + </target>
74.875 + <target name="ravelibs/jsf-portlet">
74.876 + <ant dir="../ravelibs/jsf-portlet" target="${target}"/>
74.877 + </target>
74.878 + <target name="ravelibs/portlet-api">
74.879 + <ant dir="../ravelibs/portlet-api" target="${target}"/>
74.880 + </target>
74.881 + <target name="registration">
74.882 + <ant dir="../registration" target="${target}"/>
74.883 + </target>
74.884 + <target name="rowset">
74.885 + <ant dir="../rowset" target="${target}"/>
74.886 + </target>
74.887 + <target name="servernav">
74.888 + <ant dir="../servernav" target="${target}"/>
74.889 + </target>
74.890 + <target name="sql">
74.891 + <ant dir="../sql" target="${target}"/>
74.892 + </target>
74.893 + <target name="sqleditor">
74.894 + <ant dir="../dataconnectivity/sqleditor" target="${target}"/>
74.895 + </target>
74.896 + <target name="sunddapi">
74.897 + <ant dir="../sunddapi" target="${target}"/>
74.898 + </target>
74.899 + <target name="studio-plugin">
74.900 + <ant dir="../studio-plugin" target="${target}"/>
74.901 + </target>
74.902 + <target name="sunappsrvint">
74.903 + <ant dir="../sunappsrvint" target="${target}"/>
74.904 + </target>
74.905 + <target name="toolbox">
74.906 + <ant dir="../toolbox" target="${target}"/>
74.907 + </target>
74.908 + <target name="userdoc">
74.909 + <ant dir="../userdoc" target="${target}"/>
74.910 + </target>
74.911 + <target name="visual">
74.912 + <ant dir="../visual" target="${target}"/>
74.913 + </target>
74.914 + <target name="ravewebsvc">
74.915 + <ant dir="../ravewebsvc" target="${target}"/>
74.916 + </target>
74.917 + <target name="dataprovider/designtime">
74.918 + <ant dir="../dataprovider/designtime" target="${target}"/>
74.919 + </target>
74.920 + <target name="dataprovider/runtime">
74.921 + <ant dir="../dataprovider/runtime" target="${target}"/>
74.922 + </target>
74.923 + <target name="xhtml">
74.924 + <ant dir="../xhtml" target="${target}"/>
74.925 + </target>
74.926 + <target name="webui/designtime">
74.927 + <ant dir="../webui/designtime" target="${target}"/>
74.928 + </target>
74.929 + <target name="webui/runtime">
74.930 + <ant dir="../webui/runtime" target="${target}"/>
74.931 + </target>
74.932 + <target name="webui/themes">
74.933 + <ant dir="../webui/themes" target="${target}"/>
74.934 + </target>
74.935 + <target name="welcome">
74.936 + <ant dir="../welcome" target="${target}"/>
74.937 + </target>
74.938 + <target name="woodstock">
74.939 + <ant dir="../woodstock" target="${target}"/>
74.940 + </target>
74.941 + <target name="ws61-plugin">
74.942 + <ant dir="../ws61-plugin" target="${target}"/>
74.943 + </target>
74.944 + <target name="sampleapps/bundled">
74.945 + <ant dir="../sampleapps/bundled" target="${target}"/>
74.946 + </target>
74.947 +
74.948 +
74.949 + <!-- These targets duplicate the functionality of the RE tools -->
74.950 + <target name="download-jdk" description="Manually downloads the JDK TAR into this directory">
74.951 + <antcall target="-download-jdk" inheritall="false">
74.952 + <param name="bypass.cache.validation" value="true"/>
74.953 + </antcall>
74.954 + </target>
74.955 +
74.956 + <target name="download-jdk-all" description="Downloads All platform specific JDK ZIPS">
74.957 + <antcall target="-download-jdk-all" inheritall="false">
74.958 + <param name="bypass.cache.validation" value="true"/>
74.959 + </antcall>
74.960 + </target>
74.961 +
74.962 + <target name="download-netbeans-src" description="Downloads the Netbeans sources into this directory">
74.963 + <antcall target="-get-netbeans-src" inheritall="false">
74.964 + <param name="bypass.cache.validation" value="true"/>
74.965 + </antcall>
74.966 + </target>
74.967 +
74.968 + <target name="download-netbeans-binary" description="Downloads the Netbeans IDE binary into this directory">
74.969 + <antcall target="-get-netbeans-bin" inheritall="false">
74.970 + <param name="bypass.cache.validation" value="true"/>
74.971 + </antcall>
74.972 + </target>
74.973 +
74.974 + <target name="download-netbeans-platform-binary" description="Downloads Netbeans IDE platform specific ML binaries">
74.975 + <antcall target="-get-netbeans-platform" inheritall="false">
74.976 + <param name="bypass.cache.validation" value="true"/>
74.977 + </antcall>
74.978 + </target>
74.979 +
74.980 + <target name="download-netbeans-platform-binary-ml" description="Downloads Netbeans IDE platform specific ML binaries">
74.981 + <antcall target="-get-netbeans-platform-ml" inheritall="false">
74.982 + <param name="bypass.cache.validation" value="true"/>
74.983 + </antcall>
74.984 + </target>
74.985 +
74.986 + <target name="download-ismp" description="Downloads ISMP">
74.987 + <antcall target="-get-ismp" inheritall="false">
74.988 + </antcall>
74.989 + </target>
74.990 +
74.991 + <target name="download-as-binary" description="Downloads App Server">
74.992 + <antcall target="-get-as-binary" inheritall="false">
74.993 + </antcall>
74.994 + </target>
74.995 +
74.996 + <target name="download-as-binary-platform" description="Downloads Platform Specific App Server">
74.997 + <condition property="as.platform" value="${as.win}">
74.998 + <os family="windows"/>
74.999 + </condition>
74.1000 +
74.1001 + <condition property="as.platform" value="${as.linux}">
74.1002 + <os name="Linux"/>
74.1003 + </condition>
74.1004 +
74.1005 + <condition property="as.platform" value="${as.solsparc}">
74.1006 + <os name="SunOS" arch="sparc"/>
74.1007 + </condition>
74.1008 +
74.1009 + <condition property="as.platform" value="${as.solx86}">
74.1010 + <os name="SunOS" arch="x86"/>
74.1011 + </condition>
74.1012 +
74.1013 + <condition property="as.platform" value="${as.mac}">
74.1014 + <os family="mac"/>
74.1015 + </condition>
74.1016 +
74.1017 + <mkdir dir="${as.cache.dir}"/>
74.1018 + <get src="${as.cache.server.url}/${as.platform}"
74.1019 + dest="${as.cache.dir}/${as.platform}" usetimestamp="true" ignoreerrors="true"/>
74.1020 + </target>
74.1021 +
74.1022 + <target name="unzip-jdk" description="Downloads and unzips the shipping JDK">
74.1023 + <antcall target="-unzip-jdk" inheritall="false">
74.1024 + <param name="bypass.cache.validation" value="true"/>
74.1025 + </antcall>
74.1026 + </target>
74.1027 +
74.1028 + <target name="unzip-netbeans-src" description="Downloads and unzips the Netbeans sources">
74.1029 + <antcall target="-unzip-netbeans-src" inheritall="false">
74.1030 + <param name="bypass.cache.validation" value="true"/>
74.1031 + </antcall>
74.1032 + </target>
74.1033 +
74.1034 + <target name="unzip-netbeans-binary" description="Downloads and unzips the Netbeans IDE binary">
74.1035 + <antcall target="-unzip-netbeans-bin" inheritall="false">
74.1036 + <param name="bypass.cache.validation" value="true"/>
74.1037 + </antcall>
74.1038 + </target>
74.1039 +
74.1040 + <target name="-download-jdk" depends="init">
74.1041 + <condition property="jdk.name" value="${jdk.win}.tar">
74.1042 + <os family="windows"/>
74.1043 + </condition>
74.1044 +
74.1045 + <condition property="jdk.name" value="${jdk.linux}.tar">
74.1046 + <os name="Linux"/>
74.1047 + </condition>
74.1048 +
74.1049 + <condition property="jdk.name" value="${jdk.solsparc}.tar">
74.1050 + <os name="SunOS" arch="sparc"/>
74.1051 + </condition>
74.1052 +
74.1053 + <condition property="jdk.name" value="${jdk.solx86}.tar">
74.1054 + <os name="SunOS" arch="x86"/>
74.1055 + </condition>
74.1056 +
74.1057 + <get src="${jdk.cache.server.url}/tars/${jdk.name}"
74.1058 + dest="${cache.dir}/jdk-zip.tar" usetimestamp="true" ignoreerrors="true"/>
74.1059 + </target>
74.1060 +
74.1061 + <target name="-download-jdk-all" depends="-check-jdk-online, init">
74.1062 + <mkdir dir="${jdk.cache.dir}"/>
74.1063 + <get src="${jdk.cache.server.url}/zips/${jdk.linux}.zip"
74.1064 + dest="${jdk.cache.dir}/${jdk.linux}.zip" usetimestamp="true" ignoreerrors="true"/>
74.1065 +
74.1066 + <get src="${jdk.cache.server.url}/zips/${jdk.solsparc}.zip"
74.1067 + dest="${jdk.cache.dir}/${jdk.solsparc}.zip" usetimestamp="true" ignoreerrors="true"/>
74.1068 +
74.1069 + <get src="${jdk.cache.server.url}/zips/${jdk.solx86}.zip"
74.1070 + dest="${jdk.cache.dir}/${jdk.solx86}.zip" usetimestamp="true" ignoreerrors="true"/>
74.1071 +
74.1072 + <get src="${jdk.cache.server.url}/zips/${jdk.win}.zip"
74.1073 + dest="${jdk.cache.dir}/${jdk.win}.zip" usetimestamp="true" ignoreerrors="true"/>
74.1074 + </target>
74.1075 +
74.1076 + <target name="-unzip-jdk" depends="-download-jdk, init">
74.1077 + <!-- use exec instead of the untar task, since the task does not preserve file permissions -->
74.1078 + <mkdir dir="${basedir}/ship-java"/>
74.1079 + <!-- <exec dir="${basedir}/ship-java" executable="tar" failonerror="true">
74.1080 + <arg line="xvf ${cache.dir}/jdk-zip.tar"/>
74.1081 + </exec> -->
74.1082 + <untar src="${cache.dir}/jdk-zip.tar" dest="${basedir}/ship-java"/>
74.1083 + </target>
74.1084 +
74.1085 + <target name="-unzip-netbeans-src" depends="-get-netbeans-src, init">
74.1086 + <!-- use exec to avoid the file permission preservation issue in ant -->
74.1087 + <delete dir="${nb.src.dir}" failonerror="false"/>
74.1088 + <exec dir="${basedir}" executable="unzip" failonerror="true">
74.1089 + <arg line="${cache.dir}/${nb.src.zip} -d ${nb.src.base}"/>
74.1090 + </exec>
74.1091 + </target>
74.1092 +
74.1093 + <target name="-unzip-netbeans-graph-src" depends="-get-netbeans-graph-src, init">
74.1094 + <exec dir="${basedir}" executable="unzip" failonerror="true">
74.1095 + <arg line="${cache.dir}/${nb.graph.src.zip} -d ${nb.src.base}"/>
74.1096 + </exec>
74.1097 + </target>
74.1098 +
74.1099 + <target name="-unzip-netbeans-bin" depends="-get-netbeans-bin, init">
74.1100 + <echo> nb.bin.base = ${nb.bin.base} </echo>
74.1101 + <echo> nb.bin.dir = ${nb.bin.dir} </echo>
74.1102 + <echo> nb.src.base = ${nb.src.base} </echo>
74.1103 + <echo> nb.src.dir = ${nb.src.dir} </echo>
74.1104 + <mkdir dir="${nb.bin.base}"/>
74.1105 + <!-- use exec to avoid the file permission preservation issue in ant -->
74.1106 + <delete dir="${nb.bin.dir}" failonerror="false"/>
74.1107 + <exec dir="${basedir}" executable="unzip" failonerror="true">
74.1108 + <arg line="${cache.dir}/${nb.bin.zip} -d ${nb.bin.base}"/>
74.1109 + </exec>
74.1110 + </target>
74.1111 +
74.1112 + <target name="-unzip-netbeans-graph-bin" depends="-get-netbeans-graph-bin, init">
74.1113 + <exec dir="${basedir}" executable="unzip" failonerror="true">
74.1114 + <arg line="${cache.dir}/${nb.graph.bin.zip} -d ${nb.bin.base}"/>
74.1115 + </exec>
74.1116 + </target>
74.1117 +
74.1118 + <target name="-check-ravebuild-online" depends="init">
74.1119 + <condition property="is.ravebuild.online">
74.1120 + <http url="${ravebuild.cache.server.url}"/>
74.1121 + </condition>
74.1122 + <echo>Online check: ${is.ravebuild.online}</echo>
74.1123 + </target>
74.1124 +
74.1125 + <target name="-check-ismp-online" depends="init">
74.1126 + <condition property="is.ismp.online">
74.1127 + <http url="${ismp.cache.server.url}"/>
74.1128 + </condition>
74.1129 + <echo>Online check: ${is.ismp.online}</echo>
74.1130 + </target>
74.1131 +
74.1132 + <target name="-check-as-online" depends="init">
74.1133 + <condition property="is.as.online">
74.1134 + <http url="${as.cache.server.url}"/>
74.1135 + </condition>
74.1136 + <echo>Online check: ${is.as.online}</echo>
74.1137 + </target>
74.1138 +
74.1139 + <target name="-check-jdk-online" depends="init">
74.1140 + <condition property="is.jdk.online">
74.1141 + <http url="${jdk.cache.server.url}"/>
74.1142 + </condition>
74.1143 + <echo>Online check: ${is.jdk.online}</echo>
74.1144 + </target>
74.1145 +
74.1146 + <target name="-check-netbeans-src" depends="init">
74.1147 + <available file="${cache.dir}/${nb.src.zip}" property="netbeans.src.zip.available"/>
74.1148 + </target>
74.1149 +
74.1150 + <target name="-check-netbeans-graph-src" depends="init">
74.1151 + <available file="${cache.dir}/${nb.graph.src.zip}" property="netbeans.graph.src.zip.available"/>
74.1152 + </target>
74.1153 +
74.1154 + <target name="-check-netbeans-bin" depends="init">
74.1155 + <available file="${cache.dir}/${nb.bin.zip}" property="netbeans.bin.zip.available"/>
74.1156 + </target>
74.1157 +
74.1158 + <target name="-check-netbeans-graph-bin" depends="init">
74.1159 + <available file="${cache.dir}/${nb.graph.bin.zip}" property="netbeans.graph.bin.zip.available"/>
74.1160 + </target>
74.1161 +
74.1162 + <target name="-get-netbeans-src" depends="-check-ravebuild-online, -check-netbeans-src, init" unless="netbeans.src.zip.available">
74.1163 + <mkdir dir="${nb.cache.dir}"/>
74.1164 + <get src="${ravebuild.cache.server.url}/${nb.src.zip}"
74.1165 + dest="${nb.cache.dir}/${nb.src.zip}" usetimestamp="true" ignoreerrors="true"/>
74.1166 + </target>
74.1167 +
74.1168 + <target name="-get-netbeans-graph-src" depends="-check-ravebuild-online, -check-netbeans-graph-src, init" unless="netbeans.graph.src.zip.available">
74.1169 + <mkdir dir="${nb.cache.dir}"/>
74.1170 + <get src="${ravebuild.cache.server.url}/${nb.graph.src.zip}"
74.1171 + dest="${nb.cache.dir}/${nb.graph.src.zip}" usetimestamp="true" ignoreerrors="true"/>
74.1172 + </target>
74.1173 +
74.1174 + <target name="-get-netbeans-bin" depends="-check-ravebuild-online, -check-netbeans-bin, init" unless="netbeans.bin.zip.available">
74.1175 + <mkdir dir="${nb.cache.dir}"/>
74.1176 + <get src="${ravebuild.cache.server.url}/${nb.bin.zip}"
74.1177 + dest="${nb.cache.dir}/${nb.bin.zip}" usetimestamp="true" ignoreerrors="true"/>
74.1178 + </target>
74.1179 +
74.1180 + <target name="-get-netbeans-graph-bin" depends="-check-ravebuild-online, -check-netbeans-graph-bin, init" unless="netbeans.graph.bin.zip.available">
74.1181 + <mkdir dir="${nb.cache.dir}"/>
74.1182 + <get src="${ravebuild.cache.server.url}/${nb.graph.bin.zip}"
74.1183 + dest="${nb.cache.dir}/${nb.graph.bin.zip}" usetimestamp="true" ignoreerrors="true"/>
74.1184 + </target>
74.1185 +
74.1186 + <target name="-get-netbeans-platform" depends="-check-ravebuild-online, init">
74.1187 + <mkdir dir="${nb.cache.dir}"/>
74.1188 + <get src="${ravebuild.cache.server.url}/${nb.linux}"
74.1189 + dest="${nb.cache.dir}/${nb.linux}" usetimestamp="true" ignoreerrors="true"/>
74.1190 + <get src="${ravebuild.cache.server.url}/${nb.mac}"
74.1191 + dest="${nb.cache.dir}/${nb.mac}" usetimestamp="true" ignoreerrors="true"/>
74.1192 + <get src="${ravebuild.cache.server.url}/${nb.solsparc}"
74.1193 + dest="${nb.cache.dir}/${nb.solsparc}" usetimestamp="true" ignoreerrors="true"/>
74.1194 + <get src="${ravebuild.cache.server.url}/${nb.solx86}"
74.1195 + dest="${nb.cache.dir}/${nb.solx86}" usetimestamp="true" ignoreerrors="true"/>
74.1196 + <get src="${ravebuild.cache.server.url}/${nb.win}"
74.1197 + dest="${nb.cache.dir}/${nb.win}" usetimestamp="true" ignoreerrors="true"/>
74.1198 + </target>
74.1199 +
74.1200 + <target name="-get-netbeans-platform-ml" depends="-check-ravebuild-online, init">
74.1201 + <mkdir dir="${nb.cache.dir}"/>
74.1202 + <get src="${ravebuild.cache.server.url}/${nb.linux.ml}"
74.1203 + dest="${nb.cache.dir}/${nb.linux.ml}" usetimestamp="true" ignoreerrors="true"/>
74.1204 + <get src="${ravebuild.cache.server.url}/${nb.mac.ml}"
74.1205 + dest="${nb.cache.dir}/${nb.mac.ml}" usetimestamp="true" ignoreerrors="true"/>
74.1206 + <get src="${ravebuild.cache.server.url}/${nb.solsparc.ml}"
74.1207 + dest="${nb.cache.dir}/${nb.solsparc.ml}" usetimestamp="true" ignoreerrors="true"/>
74.1208 + <get src="${ravebuild.cache.server.url}/${nb.solx86.ml}"
74.1209 + dest="${nb.cache.dir}/${nb.solx86.ml}" usetimestamp="true" ignoreerrors="true"/>
74.1210 + <get src="${ravebuild.cache.server.url}/${nb.win.ml}"
74.1211 + dest="${nb.cache.dir}/${nb.win.ml}" usetimestamp="true" ignoreerrors="true"/>
74.1212 + </target>
74.1213 +
74.1214 + <target name="-get-ismp" depends="-check-ismp-online, init">
74.1215 + <mkdir dir="${ismp.cache.dir}"/>
74.1216 + <get src="${ismp.cache.server.url}/${ismp.name}"
74.1217 + dest="${ismp.cache.dir}/${ismp.name}" usetimestamp="true" ignoreerrors="true"/>
74.1218 + </target>
74.1219 +
74.1220 + <target name="-get-as-binary" depends="-check-as-online, init">
74.1221 + <mkdir dir="${as.cache.dir}"/>
74.1222 + <get src="${as.cache.server.url}/${as.linux}"
74.1223 + dest="${as.cache.dir}/${as.linux}" usetimestamp="true" ignoreerrors="true"/>
74.1224 + <get src="${as.cache.server.url}/${as.mac}"
74.1225 + dest="${as.cache.dir}/${as.mac}" usetimestamp="true" ignoreerrors="true"/>
74.1226 + <get src="${as.cache.server.url}/${as.solsparc}"
74.1227 + dest="${as.cache.dir}/${as.solsparc}" usetimestamp="true" ignoreerrors="true"/>
74.1228 + <get src="${as.cache.server.url}/${as.solx86}"
74.1229 + dest="${as.cache.dir}/${as.solx86}" usetimestamp="true" ignoreerrors="true"/>
74.1230 + <get src="${as.cache.server.url}/${as.win}"
74.1231 + dest="${as.cache.dir}/${as.win}" usetimestamp="true" ignoreerrors="true"/>
74.1232 + </target>
74.1233 +
74.1234 + <target name="en-pack-installers">
74.1235 +
74.1236 + <!-- Clean up some sample complib modules before building installers -->
74.1237 + <!-- <ant dir="../sampleapps/complibs/ajax" target="clean"/> -->
74.1238 +
74.1239 + <property environment="myenv"/>
74.1240 + <echo> Installer installation dir is: ${myenv.ISMP}</echo>
74.1241 + <!-- ant dir="${nb_all.dir}/installer/profiler" target="build" -->
74.1242 + <ant dir="../../installer/nb_installer/creator" target="build">
74.1243 + <property name="cluster.dir" location="../../nbbuild/netbeans/visualweb1"/>
74.1244 + <property name="ismp.home" location="${myenv.ISMP}"/>
74.1245 + <property name="installer.basename" value="${installer.basename}"/>
74.1246 + <property name="installer.suffix" value="${installer.suffix}"/>
74.1247 + </ant>
74.1248 + </target>
74.1249 +
74.1250 + <target name="ml-pack-installers">
74.1251 + <property environment="myenv"/>
74.1252 + <echo> Installer installation dir is: ${myenv.ISMP}</echo>
74.1253 + <!-- ant dir="${nb_all.dir}/installer/profiler" target="build-ml" -->
74.1254 + <ant dir="../../installer/nb_installer/creator" target="build-ml">
74.1255 + <property name="cluster.dir" location="rave/visualweb1"/>
74.1256 + <property name="ismp.home" location="${myenv.ISMP}"/>
74.1257 + <property name="installer.basename" value="${installer.basename}"/>
74.1258 + <property name="installer.suffix" value="${installer.suffix}"/>
74.1259 + </ant>
74.1260 + </target>
74.1261 +
74.1262 + <target name="en-pack-installers-cn">
74.1263 +
74.1264 + <!-- Clean up some sample complib modules before building installers -->
74.1265 + <!-- <ant dir="../sampleapps/complibs/ajax" target="clean"/> -->
74.1266 +
74.1267 + <property environment="myenv"/>
74.1268 + <echo> Installer installation dir is: ${myenv.ISMP}</echo>
74.1269 + <!-- ant dir="${nb_all.dir}/installer/profiler" target="build" -->
74.1270 + <ant dir="../../installer/nb_installer/creator" target="build-cn">
74.1271 + <property name="cluster.dir" location="netbeans/visualweb1"/>
74.1272 + <property name="ismp.home" location="${myenv.ISMP}"/>
74.1273 + <property name="installer.basename" value="${installer.basename}"/>
74.1274 + <property name="installer.suffix" value="${installer.suffix}"/>
74.1275 + </ant>
74.1276 + </target>
74.1277 +
74.1278 + <target name="ml-pack-installers-cn">
74.1279 + <property environment="myenv"/>
74.1280 + <echo> Installer installation dir is: ${myenv.ISMP}</echo>
74.1281 + <!-- ant dir="${nb_all.dir}/installer/profiler" target="build-ml" -->
74.1282 + <ant dir="../../installer/nb_installer/creator" target="build-ml-cn">
74.1283 + <property name="cluster.dir" location="rave/visualweb1"/>
74.1284 + <property name="ismp.home" location="${myenv.ISMP}"/>
74.1285 + <property name="installer.basename" value="${installer.basename}"/>
74.1286 + <property name="installer.suffix" value="${installer.suffix}"/>
74.1287 + </ant>
74.1288 + </target>
74.1289 +
74.1290 + <target name="set-commit-validation-target">
74.1291 + <property name="commit.validation.target" value="sanitytests"/>
74.1292 + </target>
74.1293 + <target name="set-simple-commit-validation-target">
74.1294 + <property name="commit.validation.target" value="simple-commit-validation"/>
74.1295 + </target>
74.1296 + <target name="commit-validation"
74.1297 + depends="set-commit-validation-target,commitValidation, no-commit-validation, no-test-properties"
74.1298 + description="Runs tests to validate IDE before commit."
74.1299 + />
74.1300 +
74.1301 + <target name="simple-commit-validation"
74.1302 + depends="set-simple-commit-validation-target,commitValidation, no-commit-validation"
74.1303 + description="Runs tests to validate IDE before commit (Simple validation)."
74.1304 + />
74.1305 +
74.1306 + <target name="commitValidation" depends="check-commit-validation" if="run.validation">
74.1307 + <property name="xtest.home" location="../../xtest"/>
74.1308 + <ant dir="../gravy" target="clean"/>
74.1309 + <!--exec dir="${basedir}/../gravy" executable="ant" failonerror="yes"/-->
74.1310 + <ant dir="../../jemmy" target="jar"/>
74.1311 + <ant dir="${basedir}/../gravy" target="jar">
74.1312 + <property name="no.deps" value="true"/>
74.1313 + <property name="java.version.excludes" location="${basedir}/../../jemmy/util/${ant.java.version}.excludes"/>
74.1314 + </ant>
74.1315 + <ant dir="../test" target="${commit.validation.target}">
74.1316 + <property name="jdkhome" value="${env.JAVA_HOME}"/>
74.1317 + <property name="netbeans.dest.dir" location="../../nbbuild/netbeans"/>
74.1318 + </ant>
74.1319 + <delete dir="../../nbbuild/netbeans/extra"/> <!-- #114661 -->
74.1320 + </target>
74.1321 + <target name="check-commit-validation">
74.1322 + <condition property="run.validation">
74.1323 + <and>
74.1324 + <available file="../test/build.xml"/>
74.1325 + <available file="../gravy/build.xml"/>
74.1326 + <available file="../../jemmy/build.xml"/>
74.1327 + <available file="../../jellytools/build.xml"/>
74.1328 + <available file="../../xtest/build.xml"/>
74.1329 + <available file="../../testtools/external/httpunit.jar"/>
74.1330 + </and>
74.1331 + </condition>
74.1332 + </target>
74.1333 +
74.1334 + <target name="check-test-properties">
74.1335 + <condition property="have.properties">
74.1336 + <available file="../test/data/DefaultDeploymentTargets.properties"/>
74.1337 + </condition>
74.1338 + </target>
74.1339 +
74.1340 + <target name="no-test-properties" depends="check-test-properties" unless="have.properties">
74.1341 + <fail>
74.1342 + visualweb/test/data/DefaultDeploymentTargets.properties is absent.
74.1343 + Copy DefaultDeploymentTargets.properties.template to DefaultDeploymeye ntTargets.properties
74.1344 + and edit it manally, set location af Glassfish Application Server
74.1345 + </fail>
74.1346 + </target>
74.1347 +
74.1348 + <target name="no-commit-validation" depends="check-commit-validation" unless="run.validation">
74.1349 + <echo>
74.1350 + *** WARNING ***
74.1351 + You do not seem to have the modules needed to run the commit validation test suite.
74.1352 + You may not commit any changes into the CVS repository without running these tests.
74.1353 + For more information: http://www.netbeans.org/community/guidelines/commit.html
74.1354 +
74.1355 + Run checkout-test-tools target to get necessary modules from cvs repository
74.1356 + </echo>
74.1357 + </target>
74.1358 +
74.1359 + <target name="build-test-tools" depends="checkout-test-tools">
74.1360 + <ant dir="../../xtest" target="makedist-simple">
74.1361 + <property name="netbeans.dest.dir" value="${basedir}/../../nbbuild/netbeans"/>
74.1362 + </ant>
74.1363 + <!--ant dir="${basedir}/../../jellytools">
74.1364 + <property name="netbeans.dest.dir" value="${basedir}/../../nbbuild/netbeans"/>
74.1365 + </ant-->
74.1366 + <ant dir="${basedir}/../../jemmy"/>
74.1367 + </target>
74.1368 +
74.1369 + <target name="checkout-test-tools" depends="check-commit-validation" unless="run.validation">
74.1370 + <!--property name="cvsroot" value=":pserver:anoncvs@cvs.netbeans.org:/cvs"/-->
74.1371 + <property name="cvsroot" value="${env.CVSROOT}"/>
74.1372 + <cvs command="checkout -P" compressionlevel="6" cvsroot="${cvsroot}" dest="../.."
74.1373 + package="testtools/external jemmy jellytools xtest core/javahelp/external nbbuild junit/external"
74.1374 + quiet="true" failonerror="true"/>
74.1375 + </target>
74.1376 +</project>
74.1377 +
75.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
75.2 +++ b/misc/ravebuild/build_env/.pswd Wed Feb 23 20:12:58 2011 -0500
75.3 @@ -0,0 +1,4 @@
75.4 +
75.5 +# This is the storepass property to be used when signing the NBM files #
75.6 +
75.7 +re-nbm-storepass=G0!R4v3
76.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
76.2 +++ b/misc/ravebuild/build_env/README Wed Feb 23 20:12:58 2011 -0500
76.3 @@ -0,0 +1,26 @@
76.4 +
76.5 +HOW TO INSTALL CREATOR PACK - updated 05/09/06
76.6 +
76.7 +0. Make sure that you have jdk 1.5_06 preinstalled on your system.
76.8 +
76.9 +1. Download and unzip NB by extracting the contents of
76.10 + netbeans-5.5-daily-bin-2006...-ide-...zip;
76.11 +
76.12 + Manually modify $installdir/etc/netbeans.conf for the following:
76.13 +
76.14 + Replace the line "#jdkhome=..." with
76.15 + jdkhome=<path to jdk 1.5_06>
76.16 +
76.17 +2. Download and install the latest CreatorPack-... installer. Give NB install
76.18 + location when being asked. Make sure that the build is after this INF:
76.19 + http://inf.central/inf/integrationReport.jsp?id=92439
76.20 + for example, /net/clue.sfbay/kits/rave/main/Build060424_7/pack_installers
76.21 +
76.22 +3. Download and install glassfish and add this server to Netbeans:
76.23 + - Run the installer: java -Xmx256m -jar glassfish-installer-9.0-*.jar
76.24 + - cd glassfish; ant -f setup.xml
76.25 + - Configure netbeans: select Tools>Server Manager(Or from runtime tab, right
76.26 + click at Server and select Add server). Click Add Server button. Follow
76.27 + the wizard and specify the Platform Location to glassfish directory which
76.28 + you just installed.
76.29 +
77.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
77.2 +++ b/misc/ravebuild/build_env/converter.sh Wed Feb 23 20:12:58 2011 -0500
77.3 @@ -0,0 +1,63 @@
77.4 +#!/bin/sh
77.5 +
77.6 +if [ "$#" -lt 4 ]; then
77.7 + echo "\nUsage";
77.8 + echo "-s : source dir including file name to pick up the windows PE installer"
77.9 + echo "-d : destination dir to put the converted windows PE installer"
77.10 + echo "\n"
77.11 + exit 0;
77.12 +fi
77.13 +
77.14 +for i in $* ; do
77.15 + case $i in
77.16 + -s)
77.17 + ORIGINAL_DISTRIBUTION=$2
77.18 + shift 2
77.19 + ;;
77.20 + -d)
77.21 + NEW_DISTRIBUTION_DIR=$2
77.22 + shift 2
77.23 + ;;
77.24 + esac
77.25 +done
77.26 +
77.27 +if [ ! -f ${ORIGINAL_DISTRIBUTION} ] ; then
77.28 + echo "\nSource File ${ORIGINAL_DISTRIBUTION} does not exists\n"
77.29 + exit 9
77.30 +fi
77.31 +
77.32 +if [ ! -d ${NEW_DISTRIBUTION_DIR} ]; then
77.33 + echo "\nDestination Dir ${NEW_DISTRIBUTION_DIR} does not exists\n"
77.34 + exit 9
77.35 +fi
77.36 +
77.37 +FILE_NAME=`basename ${ORIGINAL_DISTRIBUTION}`
77.38 +NEW_DISTRIBUTION=${NEW_DISTRIBUTION_DIR}/${FILE_NAME}
77.39 +
77.40 +mkdir tmp
77.41 +cd tmp
77.42 +
77.43 +#unzip the original distribution file, disregard warning
77.44 +
77.45 +/usr/bin/unzip $ORIGINAL_DISTRIBUTION
77.46 +
77.47 +#create a new zip
77.48 +
77.49 +/usr/bin/zip -r newzip.zip appserv.class setup.exe setup.dos.exe 3RD-PARTY-LICENSE.txt LICENSE.txt package
77.50 +
77.51 +#append new zip to setup.dos.exe
77.52 +
77.53 +cat newzip.zip >> setup.dos.exe
77.54 +
77.55 +#rename setup.dos.exe into new distribution file
77.56 +
77.57 +mv setup.dos.exe $NEW_DISTRIBUTION
77.58 +chmod 755 $NEW_DISTRIBUTION
77.59 +
77.60 +#cleanup of intermediate files
77.61 +
77.62 +rm -rf newzip.zip package appserv.class setup.exe 3RD-PARTY-LICENSE.txt LICENSE.txt
77.63 +
77.64 +cd ../
77.65 +rm -rf tmp
77.66 +
78.1 Binary file misc/ravebuild/build_env/ide.ks has changed
79.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
79.2 +++ b/misc/ravebuild/build_env/make_statefile.sh Wed Feb 23 20:12:58 2011 -0500
79.3 @@ -0,0 +1,210 @@
79.4 +#!/bin/sh
79.5 +#
79.6 +# This script generates a statefile for the Sun App Server (personal edition)
79.7 +# based on existing standards. Fucntionality has now been added to extract
79.8 +# the wizard IDs from the installers themselves
79.9 +
79.10 +ErrorExit()
79.11 +{
79.12 + echo ""
79.13 + echo ${p}: ERROR: $*
79.14 + Usage
79.15 + exit 1
79.16 +}
79.17 +
79.18 +GetOptions()
79.19 +{
79.20 + # Set defaults
79.21 +
79.22 + #JAVA_HOME is expected to be set in environment
79.23 +
79.24 + PLATFORM="$FORTE_PORT"
79.25 + if [ "${PLATFORM}" = "cygwin" ]; then
79.26 + PLATFORM="nt"
79.27 + fi
79.28 + INSTALL_DIR="$SRCROOT/SUNWappserver"
79.29 + STATEFILE="sunappserver_statefile"
79.30 + STOREAUTH="FALSE"
79.31 + ENCRYPT="TRUE"
79.32 + PASSWORD="npoacvubuubealduopqzvanqzva"
79.33 + macarg=""
79.34 +
79.35 + # Parse arguments
79.36 +
79.37 + while [ $# -gt 0 -a "$1" != "" ]
79.38 + do
79.39 + arg=$1; shift
79.40 +
79.41 + case $arg in
79.42 + -platform)
79.43 + if [ $# -eq 0 ]; then
79.44 + ErrorExit "-platform requires an argument (solsparc, nt, linux)"
79.45 + fi
79.46 + PLATFORM="$1"
79.47 + shift
79.48 + ;;
79.49 + -wizard_id)
79.50 + if [ $# -eq 0 ]; then
79.51 + ErrorExit "-wizard_id requires an argument"
79.52 + fi
79.53 + WIZARD_ID="$1"
79.54 + shift
79.55 + ;;
79.56 + -java_home)
79.57 + if [ $# -eq 0 ]; then
79.58 + ErrorExit "-java_home requires an argument"
79.59 + fi
79.60 + JDK_LOC="$1"
79.61 + shift
79.62 + ;;
79.63 + -install_dir)
79.64 + if [ $# -eq 0 ]; then
79.65 + ErrorExit "-install_dir requires an argument"
79.66 + fi
79.67 + INSTALL_DIR="$1"
79.68 + shift
79.69 + ;;
79.70 + -password)
79.71 + if [ $# -eq 0 ]; then
79.72 + ErrorExit "-password requires an argument"
79.73 + fi
79.74 + PASSWORD="$1"
79.75 + shift
79.76 + ;;
79.77 + -statefile)
79.78 + if [ $# -eq 0 ]; then
79.79 + ErrorExit "-statefile requires an argument"
79.80 + fi
79.81 + STATEFILE="$1"
79.82 + shift
79.83 + ;;
79.84 + -storeauth)
79.85 + STOREAUTH=TRUE
79.86 + ;;
79.87 + -no_encrypt)
79.88 + ENCRYPT=FALSE
79.89 + ;;
79.90 + *)
79.91 + ErrorExit "Unknown option: $arg"
79.92 + ;;
79.93 + esac
79.94 + done
79.95 +
79.96 +}
79.97 +
79.98 +GetWizardID()
79.99 +{
79.100 + # This function extracts the WizardID from the installer
79.101 + # If CACHEROOT is set it will use that location, but if not
79.102 + # it will use the APP_SERVER_LOCATION from create_installers
79.103 +
79.104 + if [ "${CACHEROOT}x" != "x" ]; then
79.105 + if [ "${LOCALE_EXT}" = "ml" ]; then
79.106 + APP_SERVER_LOCATION=$CACHEROOT/SunAppServerML
79.107 + else
79.108 + APP_SERVER_LOCATION=$CACHEROOT/SunAppServer
79.109 + fi
79.110 +
79.111 + APP_SERVER_SPARC_NAME=`cd $APP_SERVER_LOCATION; echo *solaris-sparc*`
79.112 + APP_SERVER_X86_NAME=`cd $APP_SERVER_LOCATION; echo *solaris-i586*`
79.113 + APP_SERVER_WINDOWS_NAME=`cd $APP_SERVER_LOCATION; echo *windows*`
79.114 + APP_SERVER_LINUX_NAME=`cd $APP_SERVER_LOCATION; echo *linux*`
79.115 + APP_SERVER_MAC_NAME=`cd $APP_SERVER_LOCATION; echo *mac*`
79.116 + fi
79.117 +
79.118 + case $PLATFORM in
79.119 + solsparc)
79.120 + ASINSTALLER=`echo $APP_SERVER_LOCATION/$APP_SERVER_SPARC_NAME`
79.121 + ;;
79.122 + solx86)
79.123 + ASINSTALLER=`echo $APP_SERVER_LOCATION/$APP_SERVER_X86_NAME`
79.124 + ;;
79.125 + nt)
79.126 + ASINSTALLER=`echo $APP_SERVER_LOCATION/$APP_SERVER_WINDOWS_NAME`
79.127 + ;;
79.128 + linux)
79.129 + ASINSTALLER=`echo $APP_SERVER_LOCATION/$APP_SERVER_LINUX_NAME`
79.130 + ;;
79.131 + macosx)
79.132 + macarg="-Dwizard.NoNativeAbort=true"
79.133 + ASINSTALLER=`echo $APP_SERVER_LOCATION/$APP_SERVER_MAC_NAME`
79.134 + ;;
79.135 + esac
79.136 +
79.137 + if [ "${ASINSTALLER}x" = "x" ]; then
79.138 + ErrorExit "Unable to find PE installer from $APP_SERVER_LOCATION"
79.139 + fi
79.140 +
79.141 + CURRDIR=`pwd`
79.142 + TMPDIR=/tmp/$USER/${p}.$$
79.143 + mkdir -p $TMPDIR
79.144 + cd $TMPDIR
79.145 + unzip -q $ASINSTALLER appserv.class > /dev/null 2>&1
79.146 + # unzip -q $ASINSTALLER appserv.class
79.147 +
79.148 + WIZARD_ID=`$JAVA_HOME/bin/java $macarg -cp . appserv -id`
79.149 + cd $CURRDIR
79.150 + rm -rf $TMPDIR
79.151 +}
79.152 +
79.153 +Usage()
79.154 +{
79.155 +
79.156 + cat <<EOF
79.157 +
79.158 +Usage: sh $p
79.159 +
79.160 +Options: -wizard_id <wizard_id> - Sets the Wizard ID to the specified value
79.161 + -platform <platform> - Sets the desired platform statefile (solsparc, nt, linux)
79.162 + -java_home <java_home> - Sets the JDK_LOCATION to the specified location
79.163 + -install_dir <dir> - Sets the location to install the server
79.164 + -statefile <file> - Sets the filename to use for the statefile
79.165 + -password <pass> - Sets the encrypted ASADMIN password
79.166 + -storeauth - Sets STORE_AUTH_ADMIN to true (defaults to FALSE)
79.167 + -no_encrypt - Sets ADMIN_PASSWORD_ENCRYPTED to false (defaults to TRUE)
79.168 +
79.169 +Description:
79.170 +
79.171 +This script will generate a statefile for use with automated
79.172 +installations of the Sun application server. The hard-coded
79.173 +default values are expected to change relatively frequently
79.174 +as the version of the app server changes.
79.175 +
79.176 +If using the default values, this script assumes that SRCROOT
79.177 +is set. If you override with the -install_dir argument,
79.178 +you do not need to set SRCROOT.
79.179 +
79.180 +EOF
79.181 +}
79.182 +
79.183 +
79.184 +p=`basename $0`
79.185 +
79.186 +GetOptions "$@"
79.187 +
79.188 +# If the wizard_id isn't passed on the ocmmand line, go figure it out
79.189 +if [ "${WIZARD_ID}x" = "x" ]; then
79.190 + GetWizardID
79.191 +fi
79.192 +
79.193 +cat << EOF > $STATEFILE
79.194 +#
79.195 +# Wizard Statefile generatd by ${p}
79.196 +#
79.197 +# Wizard Statefile section for Sun Java System Application Server
79.198 +#
79.199 +[STATE_BEGIN Sun Java System Application Server ${WIZARD_ID}]
79.200 +defaultInstallDirectory = $INSTALL_DIR
79.201 +currentInstallDirectory = $INSTALL_DIR
79.202 +JDK_LOCATION = ${JDK_LOC}
79.203 +INST_ASADMIN_USERNAME = admin
79.204 +INST_ASADMIN_PASSWORD = ${PASSWORD}
79.205 +INST_ASADMIN_PORT = 14848
79.206 +INST_ASWEB_PORT = 18080
79.207 +INST_HTTPS_PORT = 11043
79.208 +STORE_ADMIN_AUTH = ${STOREAUTH}
79.209 +ADMIN_PASSWORD_ENCRYPTED = ${ENCRYPT}
79.210 +CREATE_SAMPLES_DOMAIN = FALSE
79.211 +CREATE_DESKTOP_SHORTCUT = FALSE
79.212 +[STATE_DONE Sun Java System Application Server ${WIZARD_ID}]
79.213 +EOF
80.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
80.2 +++ b/misc/ravebuild/default-rave-properties.xml Wed Feb 23 20:12:58 2011 -0500
80.3 @@ -0,0 +1,119 @@
80.4 +<?xml version="1.0" encoding="UTF-8"?>
80.5 +<!--
80.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
80.7 +
80.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
80.9 +
80.10 +
80.11 +The contents of this file are subject to the terms of either the GNU
80.12 +General Public License Version 2 only ("GPL") or the Common
80.13 +Development and Distribution License("CDDL") (collectively, the
80.14 +"License"). You may not use this file except in compliance with the
80.15 +License. You can obtain a copy of the License at
80.16 +http://www.netbeans.org/cddl-gplv2.html
80.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
80.18 +specific language governing permissions and limitations under the
80.19 +License. When distributing the software, include this License Header
80.20 +Notice in each file and include the License file at
80.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
80.22 +particular file as subject to the "Classpath" exception as provided
80.23 +by Sun in the GPL Version 2 section of the License file that
80.24 +accompanied this code. If applicable, add the following below the
80.25 +License Header, with the fields enclosed by brackets [] replaced by
80.26 +your own identifying information:
80.27 +"Portions Copyrighted [year] [name of copyright owner]"
80.28 +
80.29 +Contributor(s):
80.30 +
80.31 +The Original Software is NetBeans. The Initial Developer of the Original
80.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
80.33 +Microsystems, Inc. All Rights Reserved.
80.34 +
80.35 +If you wish your version of this file to be governed by only the CDDL
80.36 +or only the GPL Version 2, indicate your decision by adding
80.37 +"[Contributor] elects to include this software in this distribution
80.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
80.39 +single choice of license, a recipient has the option to distribute
80.40 +your version of this file under either the CDDL, the GPL Version 2 or
80.41 +to extend the choice of license to its licensees as provided above.
80.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
80.43 +Version 2 license, then the option applies only if the new code is
80.44 +made subject to such option by the copyright holder.
80.45 +-->
80.46 +
80.47 +<project name="default-rave-properties" default="none" basedir=".">
80.48 +
80.49 + <dirname property="rave_all" file="${ant.file.default-rave-properties}/.."/>
80.50 +
80.51 + <property name="netbeans.dest.dir" location="${rave_all}/../nbbuild/netbeans"/>
80.52 + <property name="netbeans.location" location="${netbeans.dest.dir}"/>
80.53 +
80.54 + <!-- setting dest and prefix for zip file -->
80.55 + <property name="rave.zip.dest" location="${rave_all}/ravebuild"/>
80.56 + <property name="rave.zip.prefix" value="visualweb1"/>
80.57 + <property name="nb.zip.prefix" value="netbeans"/>
80.58 + <property name="cache.dir" location="${rave_all}/ravebuild"/>
80.59 +
80.60 + <property name="jdkhome" value="${netbeans.dest.dir}/java"/>
80.61 +
80.62 + <!-- properties related to netbeans -->
80.63 + <property name="nb.cache.dir" location="${cache.dir}"/>
80.64 + <property name="en.nb.name.part1" value="netbeans-6_0-daily"/>
80.65 + <property name="en.nb.name.part2" value="200704191800"/>
80.66 + <property name="en.nb.name.part3" value="19_Apr_2007_1800"/>
80.67 + <property name="ml.nb.name.part1" value="netbeans-5_5-daily"/>
80.68 + <property name="ml.nb.name.part2" value="200611140100"/>
80.69 + <property name="ml.nb.name.part3" value="14_Nov_2006_0100"/>
80.70 + <property name="ml.nb.name.suffix" value="ml_ja_zh_CN_pt_BR"/>
80.71 +
80.72 + <property name="nb.src.zip" value="${en.nb.name.part1}-src-${en.nb.name.part2}-ide_sources-${en.nb.name.part3}.zip"/>
80.73 + <property name="nb.bin.zip" value="${en.nb.name.part1}-bin-${en.nb.name.part2}-ide-${en.nb.name.part3}.zip"/>
80.74 +
80.75 + <property name="nb.graph.src.zip" value="netbeans-graph-src.zip"/>
80.76 + <property name="nb.graph.bin.zip" value="netbeans-graph-lib-binary.zip"/>
80.77 +
80.78 + <property name="nb.linux" value="${en.nb.name.part1}-bin-${en.nb.name.part2}-linux-${en.nb.name.part3}.bin"/>
80.79 + <property name="nb.mac" value="${en.nb.name.part1}-bin-${en.nb.name.part2}-macosx-${en.nb.name.part3}.tar.gz"/>
80.80 + <property name="nb.solsparc" value="${en.nb.name.part1}-bin-${en.nb.name.part2}-solaris-sparc-${en.nb.name.part3}.bin"/>
80.81 + <property name="nb.solx86" value="${en.nb.name.part1}-bin-${en.nb.name.part2}-solaris-x86-${en.nb.name.part3}.bin"/>
80.82 + <property name="nb.win" value="${en.nb.name.part1}-bin-${en.nb.name.part2}-windows-${en.nb.name.part3}.exe"/>
80.83 +
80.84 + <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"/>
80.85 + <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"/>
80.86 + <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"/>
80.87 + <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"/>
80.88 + <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"/>
80.89 +
80.90 + <property name="nb.bin.base" location="${rave_all}/../nbbuild"/>
80.91 + <property name="nb.src.base" location="${rave_all}/../nbbuild"/>
80.92 + <property name="nb.bin.dir" location="${nb.bin.base}/netbeans"/>
80.93 + <property name="nb.src.dir" location="${nb.src.base}/netbeans-src"/>
80.94 + <property name="nb.forked.modules.dir" location="${rave_all}"/>
80.95 + <property name="l10n.dist.dir" location="${rave_all}/ravebuild/l10ndist"/>
80.96 + <property name="ravebuild.cache.server.url" value="http://balui.sfbay.sun.com/cache/CCRproto/netbeans"/>
80.97 +
80.98 + <!-- properties related to ismp -->
80.99 + <property name="ismp.cache.dir" location="${cache.dir}/ISMP"/>
80.100 + <property name="ismp.name" value="is11sab.zip"/>
80.101 + <property name="ismp.cache.server.url" value="http://clue.sfbay.sun.com/kits2/installs/ismp/XI"/>
80.102 +
80.103 + <!-- properties related to glassfish -->
80.104 + <property name="as.version" value="v2-b33"/>
80.105 + <property name="as.relative.path" value="v2/b33"/>
80.106 + <property name="as.cache.dir" location="${cache.dir}/SunAppServer"/>
80.107 + <property name="as.linux" value="glassfish-installer-linux-${as.version}.jar"/>
80.108 + <property name="as.mac" value="glassfish-installer-mac-${as.version}.jar"/>
80.109 + <property name="as.solsparc" value="glassfish-installer-sol-sparc-${as.version}.jar"/>
80.110 + <property name="as.solx86" value="glassfish-installer-sol-x86-${as.version}.jar"/>
80.111 + <property name="as.win" value="glassfish-installer-windows-${as.version}.jar"/>
80.112 + <property name="as.cache.server.url" value="http://balui.sfbay.sun.com/cache/SunAppServer/v9.0/PE/${as.relative.path}"/>
80.113 +
80.114 + <property name="jdk.version" value="1.5.0_06"/>
80.115 + <property name="jdk.cache.dir" location="${cache.dir}/JDKzip"/>
80.116 + <property name="jdk.linux" value="j2sdk-${jdk.version}-linux"/>
80.117 + <property name="jdk.solsparc" value="j2sdk-${jdk.version}-solsparc"/>
80.118 + <property name="jdk.solx86" value="j2sdk-${jdk.version}-solx86"/>
80.119 + <property name="jdk.win" value="j2sdk-${jdk.version}-nt"/>
80.120 + <property name="jdk.cache.server.url" value="http://balui.sfbay.sun.com/cache/j2se/${jdk.version}"/>
80.121 +
80.122 +</project>
81.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
81.2 +++ b/misc/ravebuild/merge-forked-modules.xml Wed Feb 23 20:12:58 2011 -0500
81.3 @@ -0,0 +1,177 @@
81.4 +<?xml version='1.0' encoding='UTF-8' ?>
81.5 +<!--
81.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
81.7 +
81.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
81.9 +
81.10 +
81.11 +The contents of this file are subject to the terms of either the GNU
81.12 +General Public License Version 2 only ("GPL") or the Common
81.13 +Development and Distribution License("CDDL") (collectively, the
81.14 +"License"). You may not use this file except in compliance with the
81.15 +License. You can obtain a copy of the License at
81.16 +http://www.netbeans.org/cddl-gplv2.html
81.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
81.18 +specific language governing permissions and limitations under the
81.19 +License. When distributing the software, include this License Header
81.20 +Notice in each file and include the License file at
81.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
81.22 +particular file as subject to the "Classpath" exception as provided
81.23 +by Sun in the GPL Version 2 section of the License file that
81.24 +accompanied this code. If applicable, add the following below the
81.25 +License Header, with the fields enclosed by brackets [] replaced by
81.26 +your own identifying information:
81.27 +"Portions Copyrighted [year] [name of copyright owner]"
81.28 +
81.29 +Contributor(s):
81.30 +
81.31 +The Original Software is NetBeans. The Initial Developer of the Original
81.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
81.33 +Microsystems, Inc. All Rights Reserved.
81.34 +
81.35 +If you wish your version of this file to be governed by only the CDDL
81.36 +or only the GPL Version 2, indicate your decision by adding
81.37 +"[Contributor] elects to include this software in this distribution
81.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
81.39 +single choice of license, a recipient has the option to distribute
81.40 +your version of this file under either the CDDL, the GPL Version 2 or
81.41 +to extend the choice of license to its licensees as provided above.
81.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
81.43 +Version 2 license, then the option applies only if the new code is
81.44 +made subject to such option by the copyright holder.
81.45 +-->
81.46 +
81.47 +
81.48 +<project name="merge-forked-modules" default="merge" basedir=".">
81.49 +<!-- Should be set -->
81.50 + <property name="rave_all" value="${basedir}/.."/>
81.51 + <property name="nb.src.dir" value="${rave_all}/ravebuild/netbeans-src"/>
81.52 +
81.53 + <basename property="modulename" file="${basedir}"/>
81.54 + <property name="timestamp-dir" value="${nb.src.dir}/merge_timestamps"/>
81.55 + <property name="originals-dir" value="${rave_all}/ravebuild/merge_originals/${modulename}"/>
81.56 + <property name="timestamp-file" value="module.${modulename}.ts"/>
81.57 + <property name="touchstamp-file" value="module.${modulename}.touch"/>
81.58 +
81.59 + <target name="init">
81.60 + <echo message="Start merge of ${modulename}"/>
81.61 +
81.62 + <mkdir dir="${timestamp-dir}"/>
81.63 + <mkdir dir="${originals-dir}"/>
81.64 +
81.65 + <available property="touchfile.exists" file="${timestamp-dir}/${touchstamp-file}"/>
81.66 + </target>
81.67 +
81.68 + <target name="touch-files" depends="init" unless="touchfile.exists">
81.69 + <!-- The touch is needed to keep the no.restore checks working -->
81.70 + <touch>
81.71 + <fileset dir="${basedir}" includes="**/*" defaultexcludes="yes"/>
81.72 + </touch>
81.73 + <touch file="${timestamp-dir}/${touchstamp-file}"/>
81.74 + </target>
81.75 +
81.76 + <target name="check-timestamps" depends="touch-files">
81.77 + <uptodate property="merge.uptodate" targetfile="${timestamp-dir}/${timestamp-file}">
81.78 + <srcfiles dir="." includes="**/*" defaultexcludes="yes"/>
81.79 + </uptodate>
81.80 + <condition property="no.restore.one">
81.81 + <uptodate>
81.82 + <srcfiles dir="${originals-dir}" includes="**/*"
81.83 + excludes="_nbproject/**/*" defaultexcludes="yes"/>
81.84 + <mapper type="glob" from="*" to="${basedir}/*"/>
81.85 + </uptodate>
81.86 + </condition>
81.87 + <condition property="no.restore.two">
81.88 + <uptodate>
81.89 + <srcfiles dir="${originals-dir}" includes="_nbproject/**/*"
81.90 + defaultexcludes="yes"/>
81.91 + <mapper type="glob" from="_nbproject/*" to="${basedir}/nbproject/*"/>
81.92 + </uptodate>
81.93 + </condition>
81.94 + <condition property="no.restore">
81.95 + <and>
81.96 + <isset property="no.restore.one"/>
81.97 + <isset property="no.restore.two"/>
81.98 + </and>
81.99 + </condition>
81.100 +<!--
81.101 + <echo message="mw merge.uptodate= ${merge.uptodate}"/>
81.102 + <echo message="mw no.restore.one= ${no.restore.one}"/>
81.103 + <echo message="mw no.restore.two= ${no.restore.two}"/>
81.104 + <echo message="mw no.restore= ${no.restore}"/>
81.105 +-->
81.106 + </target>
81.107 +
81.108 + <target name="restore-files" depends="check-timestamps" unless="no.restore">
81.109 + <move todir="${nb.src.dir}/${modulename}" overwrite="true">
81.110 + <fileset dir="${originals-dir}" includes="**/*"
81.111 + excludes="_nbproject/**/*" defaultexcludes="yes">
81.112 + <not>
81.113 + <present targetdir="${basedir}"/>
81.114 + </not>
81.115 + </fileset>
81.116 + </move>
81.117 + <move todir="${nb.src.dir}/${modulename}" overwrite="true">
81.118 + <fileset dir="${originals-dir}" includes="_nbproject/**/*"
81.119 + defaultexcludes="yes">
81.120 + <not>
81.121 + <present targetdir="${basedir}">
81.122 + <mapper type="glob" from="_nbproject/*" to="nbproject/*"/>
81.123 + </present>
81.124 + </not>
81.125 + </fileset>
81.126 + <mapper type="glob" from="_nbproject/*" to="nbproject/*"/>
81.127 + </move>
81.128 + <touch file="${timestamp-dir}/${timestamp-file}"/>
81.129 + </target>
81.130 +
81.131 + <target name="remove-files" depends="check-timestamps,restore-files"
81.132 + unless="merge.uptodate">
81.133 + <move todir="${originals-dir}" overwrite="false">
81.134 + <fileset dir="${nb.src.dir}/${modulename}" includes="**/*"
81.135 + excludes="nbproject/**/*" defaultexcludes="yes">
81.136 + <and>
81.137 + <present targetdir="${basedir}"/>
81.138 + <different targetdir="${basedir}"/>
81.139 + <not>
81.140 + <present targetdir="${originals-dir}"/>
81.141 + </not>
81.142 + </and>
81.143 + </fileset>
81.144 + </move>
81.145 + <move todir="${originals-dir}" overwrite="false">
81.146 + <fileset dir="${nb.src.dir}/${modulename}" includes="nbproject/**/*"
81.147 + defaultexcludes="yes">
81.148 + <and>
81.149 + <present targetdir="${basedir}"/>
81.150 + <different targetdir="${basedir}"/>
81.151 + <not>
81.152 + <present targetdir="${originals-dir}">
81.153 + <mapper type="glob" from="nbproject/*" to="_nbproject/*"/>
81.154 + </present>
81.155 + </not>
81.156 + </and>
81.157 + </fileset>
81.158 + <mapper type="glob" from="nbproject/*" to="_nbproject/*"/>
81.159 + </move>
81.160 + <delete includeEmptyDirs="yes">
81.161 + <fileset dir="${nb.src.dir}/${modulename}" includes="**/*" defaultexcludes="yes">
81.162 + <and>
81.163 + <present targetdir="${basedir}"/>
81.164 + <different targetdir="${basedir}"/>
81.165 + </and>
81.166 + </fileset>
81.167 + </delete>
81.168 + </target>
81.169 +
81.170 + <target name="merge" depends="check-timestamps,remove-files" unless="merge.uptodate">
81.171 + <copy todir="${nb.src.dir}/${modulename}">
81.172 + <fileset dir="${basedir}" includes="**/*" defaultexcludes="yes">
81.173 + <size value="0" when="more"/>
81.174 + </fileset>
81.175 + </copy>
81.176 + <touch file="${timestamp-dir}/${timestamp-file}"/>
81.177 +
81.178 + <echo message="Finished merge of ${modulename}"/>
81.179 + </target>
81.180 +</project>
82.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
82.2 +++ b/misc/ravebuild/nbproject/project.xml Wed Feb 23 20:12:58 2011 -0500
82.3 @@ -0,0 +1,120 @@
82.4 +<?xml version="1.0" encoding="UTF-8"?>
82.5 +<!--
82.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
82.7 +
82.8 +Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
82.9 +
82.10 +
82.11 +The contents of this file are subject to the terms of either the GNU
82.12 +General Public License Version 2 only ("GPL") or the Common
82.13 +Development and Distribution License("CDDL") (collectively, the
82.14 +"License"). You may not use this file except in compliance with the
82.15 +License. You can obtain a copy of the License at
82.16 +http://www.netbeans.org/cddl-gplv2.html
82.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
82.18 +specific language governing permissions and limitations under the
82.19 +License. When distributing the software, include this License Header
82.20 +Notice in each file and include the License file at
82.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
82.22 +particular file as subject to the "Classpath" exception as provided
82.23 +by Sun in the GPL Version 2 section of the License file that
82.24 +accompanied this code. If applicable, add the following below the
82.25 +License Header, with the fields enclosed by brackets [] replaced by
82.26 +your own identifying information:
82.27 +"Portions Copyrighted [year] [name of copyright owner]"
82.28 +
82.29 +Contributor(s):
82.30 +
82.31 +The Original Software is NetBeans. The Initial Developer of the Original
82.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
82.33 +Microsystems, Inc. All Rights Reserved.
82.34 +
82.35 +If you wish your version of this file to be governed by only the CDDL
82.36 +or only the GPL Version 2, indicate your decision by adding
82.37 +"[Contributor] elects to include this software in this distribution
82.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
82.39 +single choice of license, a recipient has the option to distribute
82.40 +your version of this file under either the CDDL, the GPL Version 2 or
82.41 +to extend the choice of license to its licensees as provided above.
82.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
82.43 +Version 2 license, then the option applies only if the new code is
82.44 +made subject to such option by the copyright holder.
82.45 +-->
82.46 +
82.47 +<project xmlns="http://www.netbeans.org/ns/project/1">
82.48 + <type>org.netbeans.modules.ant.freeform</type>
82.49 + <configuration>
82.50 + <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
82.51 + <!-- Do not use Project Properties customizer when editing this file manually. -->
82.52 + <name>Rave Build System</name>
82.53 + <properties/>
82.54 + <folders>
82.55 + <source-folder>
82.56 + <label>antsrc</label>
82.57 + <type>java</type>
82.58 + <location>antsrc</location>
82.59 + </source-folder>
82.60 + </folders>
82.61 + <ide-actions>
82.62 + <action name="build">
82.63 + <target>build</target>
82.64 + </action>
82.65 + <action name="clean">
82.66 + <target>clean-portletcontainer</target>
82.67 + </action>
82.68 + <action name="javadoc">
82.69 + <target>all-extension/javadoc</target>
82.70 + </action>
82.71 + <action name="run">
82.72 + <target>all-dataprovider/runtime</target>
82.73 + </action>
82.74 + <action name="test">
82.75 + <target>clean-test</target>
82.76 + </action>
82.77 + <action name="rebuild">
82.78 + <target>clean-portletcontainer</target>
82.79 + <target>build</target>
82.80 + </action>
82.81 + </ide-actions>
82.82 + <export>
82.83 + <type>folder</type>
82.84 + <location>build/antclasses</location>
82.85 + <build-target>all-nozip</build-target>
82.86 + </export>
82.87 + <export>
82.88 + <type>jar</type>
82.89 + <location>raveantext.jar</location>
82.90 + <build-target>all-nozip</build-target>
82.91 + </export>
82.92 + <view>
82.93 + <items>
82.94 + <source-folder style="packages">
82.95 + <label>antsrc</label>
82.96 + <location>antsrc</location>
82.97 + </source-folder>
82.98 + <source-file>
82.99 + <location>build.xml</location>
82.100 + </source-file>
82.101 + </items>
82.102 + <context-menu>
82.103 + <ide-action name="build"/>
82.104 + <ide-action name="clean"/>
82.105 + <ide-action name="javadoc"/>
82.106 + <ide-action name="run"/>
82.107 + <ide-action name="test"/>
82.108 + <ide-action name="rebuild"/>
82.109 + </context-menu>
82.110 + </view>
82.111 + <subprojects/>
82.112 + </general-data>
82.113 + <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
82.114 + <compilation-unit>
82.115 + <package-root>antsrc</package-root>
82.116 + <classpath mode="compile">${ant.home}/lib/ant.jar</classpath>
82.117 + <built-to>build/antclasses</built-to>
82.118 + <built-to>raveantext.jar</built-to>
82.119 + <source-level>1.4</source-level>
82.120 + </compilation-unit>
82.121 + </java-data>
82.122 + </configuration>
82.123 +</project>
83.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
83.2 +++ b/misc/ravebuild/visualweb-nbm-license.txt Wed Feb 23 20:12:58 2011 -0500
83.3 @@ -0,0 +1,118 @@
83.4 +Sun Microsystems, Inc. ("Sun")
83.5 +SOFTWARE LICENSE AGREEMENT and ENTITLEMENT for SOFTWARE
83.6 +
83.7 +ENTITLEMENT for SOFTWARE
83.8 +
83.9 +Licensee/Company: Entity receiving Software.
83.10 +
83.11 +Effective Date: Date Sun delivers the Software to You.
83.12 +
83.13 +Software: The Add-On Module delivered to You.
83.14 +
83.15 +Host Software: The software product(s) described in the Software's documentation for which the Software is intended to be used with.
83.16 +
83.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.
83.18 +
83.19 +License Term: The License Term shall be the same as the License Term set forth in your Host Software's license agreement.
83.20 +
83.21 +Licensed Unit: The Licensed Unit shall be the same as the Licensed Unit set forth in your Host Software's Software License Agreement.
83.22 +
83.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.
83.24 +
83.25 +
83.26 +Sun Microsystems, Inc. ("Sun")
83.27 +SOFTWARE LICENSE AGREEMENT
83.28 +
83.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.
83.30 +
83.31 +1. Definitions.
83.32 +
83.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.
83.34 +
83.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.
83.36 +
83.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.
83.38 +
83.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.
83.40 +
83.41 +(e) "Software" means the Sun software described in your Entitlement. Also, certain software may be included for evaluation use under Section 3.
83.42 +
83.43 +(f) "You" and "Your" means the individual or legal entity specified in the Entitlement, or for evaluation purposes, the entity performing the evaluation.
83.44 +
83.45 +2. License Grant and Entitlement.
83.46 +
83.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.
83.48 +
83.49 +Additionally, if your Entitlement includes Services, then it will also specify the (e) Service and (f) service term.
83.50 +
83.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).
83.52 +
83.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.
83.54 +
83.55 +3. Permitted Use.
83.56 +
83.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.
83.58 +
83.59 +(a) Evaluation Use. You may evaluate Software internally for a period of 90 days from your first use.
83.60 +
83.61 +(b) Research and Instructional Use. You may use Software internally to design, develop and test, and also to provide instruction on such uses.
83.62 +
83.63 +(c) Individual Use. You may use Software internally for personal, individual use.
83.64 +
83.65 +(d) Commercial Use. You may use Software internally for your own commercial purposes.
83.66 +
83.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.
83.68 +
83.69 +4. Licensed Units.
83.70 +
83.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).
83.72 +
83.73 +5. Restrictions.
83.74 +
83.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.
83.76 +
83.77 +6. Term and Termination.
83.78 +
83.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.
83.80 +
83.81 +7. Java Compatibility and Open Source.
83.82 +
83.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.
83.84 +
83.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.
83.86 +
83.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.
83.88 +
83.89 +8. Limited Warranty.
83.90 +
83.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.
83.92 +
83.93 +9. Disclaimer of Warranty.
83.94 +
83.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.
83.96 +
83.97 +10. Limitation of Liability.
83.98 +
83.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.
83.100 +
83.101 +11. Export Regulations.
83.102 +
83.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.
83.104 +
83.105 +12. U.S. Government Restricted Rights.
83.106 +
83.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).
83.108 +
83.109 +13. Governing Law.
83.110 +
83.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.
83.112 +
83.113 +14. Severability.
83.114 +
83.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.
83.116 +
83.117 +15. Integration.
83.118 +
83.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.
83.120 +
83.121 +Please contact Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, California 95054 if you have questions.