提交 4b43819e 编写于 作者: D duke

Initial load

上级 404c6a56

要显示的变更太多。

To preserve performance only 1000 of 1000+ files are displayed.
^build/
^dist/
^nbproject/private/
OPENJDK ASSEMBLY EXCEPTION
The OpenJDK source code made available by Sun at openjdk.java.net and
openjdk.dev.java.net ("OpenJDK Code") is distributed under the terms of the
GNU General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
only ("GPL2"), with the following clarification and special exception.
Linking this OpenJDK Code statically or dynamically with other code
is making a combined work based on this library. Thus, the terms
and conditions of GPL2 cover the whole combination.
As a special exception, Sun gives you permission to link this
OpenJDK Code with certain code licensed by Sun as indicated at
http://openjdk.java.net/legal/exception-modules-2007-05-08.html
("Designated Exception Modules") to produce an executable,
regardless of the license terms of the Designated Exception Modules,
and to copy and distribute the resulting executable under GPL2,
provided that the Designated Exception Modules continue to be
governed by the licenses under which they were offered by Sun.
As such, it allows licensees and sublicensees of Sun's GPL2 OpenJDK Code to
build an executable that includes those portions of necessary code that Sun
could not provide under GPL2 (or that Sun has provided under GPL2 with the
Classpath exception). If you modify or add to the OpenJDK code, that new
GPL2 code may still be combined with Designated Exception Modules if the
new code is made subject to this exception by its copyright holder.
The GNU General Public License (GPL)
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to share
and change it. By contrast, the GNU General Public License is intended to
guarantee your freedom to share and change free software--to make sure the
software is free for all its users. This General Public License applies to
most of the Free Software Foundation's software and to any other program whose
authors commit to using it. (Some other Free Software Foundation software is
covered by the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom to
distribute copies of free software (and charge for this service if you wish),
that you receive source code or can get it if you want it, that you can change
the software or use pieces of it in new free programs; and that you know you
can do these things.
To protect your rights, we need to make restrictions that forbid anyone to deny
you these rights or to ask you to surrender the rights. These restrictions
translate to certain responsibilities for you if you distribute copies of the
software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for
a fee, you must give the recipients all the rights that you have. You must
make sure that they, too, receive or can get the source code. And you must
show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2)
offer you this license which gives you legal permission to copy, distribute
and/or modify the software.
Also, for each author's protection and ours, we want to make certain that
everyone understands that there is no warranty for this free software. If the
software is modified by someone else and passed on, we want its recipients to
know that what they have is not the original, so that any problems introduced
by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We
wish to avoid the danger that redistributors of a free program will
individually obtain patent licenses, in effect making the program proprietary.
To prevent this, we have made it clear that any patent must be licensed for
everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification
follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice
placed by the copyright holder saying it may be distributed under the terms of
this General Public License. The "Program", below, refers to any such program
or work, and a "work based on the Program" means either the Program or any
derivative work under copyright law: that is to say, a work containing the
Program or a portion of it, either verbatim or with modifications and/or
translated into another language. (Hereinafter, translation is included
without limitation in the term "modification".) Each licensee is addressed as
"you".
Activities other than copying, distribution and modification are not covered by
this License; they are outside its scope. The act of running the Program is
not restricted, and the output from the Program is covered only if its contents
constitute a work based on the Program (independent of having been made by
running the Program). Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's source code as
you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this License
and to the absence of any warranty; and give any other recipients of the
Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you may
at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it, thus
forming a work based on the Program, and copy and distribute such modifications
or work under the terms of Section 1 above, provided that you also meet all of
these conditions:
a) You must cause the modified files to carry prominent notices stating
that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or
in part contains or is derived from the Program or any part thereof, to be
licensed as a whole at no charge to all third parties under the terms of
this License.
c) If the modified program normally reads commands interactively when run,
you must cause it, when started running for such interactive use in the
most ordinary way, to print or display an announcement including an
appropriate copyright notice and a notice that there is no warranty (or
else, saying that you provide a warranty) and that users may redistribute
the program under these conditions, and telling the user how to view a copy
of this License. (Exception: if the Program itself is interactive but does
not normally print such an announcement, your work based on the Program is
not required to print an announcement.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Program, and can be reasonably
considered independent and separate works in themselves, then this License, and
its terms, do not apply to those sections when you distribute them as separate
works. But when you distribute the same sections as part of a whole which is a
work based on the Program, the distribution of the whole must be on the terms
of this License, whose permissions for other licensees extend to the entire
whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise the
right to control the distribution of derivative or collective works based on
the Program.
In addition, mere aggregation of another work not based on the Program with the
Program (or with a work based on the Program) on a volume of a storage or
distribution medium does not bring the other work under the scope of this
License.
3. You may copy and distribute the Program (or a work based on it, under
Section 2) in object code or executable form under the terms of Sections 1 and
2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source
code, which must be distributed under the terms of Sections 1 and 2 above
on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to
give any third party, for a charge no more than your cost of physically
performing source distribution, a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of Sections 1
and 2 above on a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to
distribute corresponding source code. (This alternative is allowed only
for noncommercial distribution and only if you received the program in
object code or executable form with such an offer, in accord with
Subsection b above.)
The source code for a work means the preferred form of the work for making
modifications to it. For an executable work, complete source code means all
the source code for all modules it contains, plus any associated interface
definition files, plus the scripts used to control compilation and installation
of the executable. However, as a special exception, the source code
distributed need not include anything that is normally distributed (in either
source or binary form) with the major components (compiler, kernel, and so on)
of the operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the source
code from the same place counts as distribution of the source code, even though
third parties are not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as
expressly provided under this License. Any attempt otherwise to copy, modify,
sublicense or distribute the Program is void, and will automatically terminate
your rights under this License. However, parties who have received copies, or
rights, from you under this License will not have their licenses terminated so
long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed it.
However, nothing else grants you permission to modify or distribute the Program
or its derivative works. These actions are prohibited by law if you do not
accept this License. Therefore, by modifying or distributing the Program (or
any work based on the Program), you indicate your acceptance of this License to
do so, and all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program),
the recipient automatically receives a license from the original licensor to
copy, distribute or modify the Program subject to these terms and conditions.
You may not impose any further restrictions on the recipients' exercise of the
rights granted herein. You are not responsible for enforcing compliance by
third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues), conditions
are imposed on you (whether by court order, agreement or otherwise) that
contradict the conditions of this License, they do not excuse you from the
conditions of this License. If you cannot distribute so as to satisfy
simultaneously your obligations under this License and any other pertinent
obligations, then as a consequence you may not distribute the Program at all.
For example, if a patent license would not permit royalty-free redistribution
of the Program by all those who receive copies directly or indirectly through
you, then the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply and
the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or
other property right claims or to contest validity of any such claims; this
section has the sole purpose of protecting the integrity of the free software
distribution system, which is implemented by public license practices. Many
people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing to
distribute software through any other system and a licensee cannot impose that
choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain
countries either by patents or by copyrighted interfaces, the original
copyright holder who places the Program under this License may add an explicit
geographical distribution limitation excluding those countries, so that
distribution is permitted only in or among countries not thus excluded. In
such case, this License incorporates the limitation as if written in the body
of this License.
9. The Free Software Foundation may publish revised and/or new versions of the
General Public License from time to time. Such new versions will be similar in
spirit to the present version, but may differ in detail to address new problems
or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any later
version", you have the option of following the terms and conditions either of
that version or of any later version published by the Free Software Foundation.
If the Program does not specify a version number of this License, you may
choose any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs
whose distribution conditions are different, write to the author to ask for
permission. For software which is copyrighted by the Free Software Foundation,
write to the Free Software Foundation; we sometimes make exceptions for this.
Our decision will be guided by the two goals of preserving the free status of
all derivatives of our free software and of promoting the sharing and reuse of
software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible
use to the public, the best way to achieve this is to make it free software
which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach
them to the start of each source file to most effectively convey the exclusion
of warranty; and each file should have at least the "copyright" line and a
pointer to where the full notice is found.
One line to give the program's name and a brief idea of what it does.
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc., 59
Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when it
starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free
software, and you are welcome to redistribute it under certain conditions;
type 'show c' for details.
The hypothetical commands 'show w' and 'show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may be
called something other than 'show w' and 'show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school,
if any, to sign a "copyright disclaimer" for the program, if necessary. Here
is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
'Gnomovision' (which makes passes at compilers) written by James Hacker.
signature of Ty Coon, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General Public
License instead of this License.
"CLASSPATH" EXCEPTION TO THE GPL
Certain source files distributed by Sun Microsystems, Inc. are subject to
the following clarification and special exception to the GPL, but only where
Sun has expressly included in the particular source file's header the words
"Sun designates this particular file as subject to the "Classpath" exception
as provided by Sun in the LICENSE file that accompanied this code."
Linking this library statically or dynamically with other modules is making
a combined work based on this library. Thus, the terms and conditions of
the GNU General Public License cover the whole combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent modules,
and to copy and distribute the resulting executable under terms of your
choice, provided that you also meet, for each linked independent module,
the terms and conditions of the license of that module. An independent
module is a module which is not derived from or based on this library. If
you modify this library, you may extend this exception to your version of
the library, but you are not obligated to do so. If you do not wish to do
so, delete this exception statement from your version.
README:
This file should be located at the top of the jaxws Mercurial repository.
See http://openjdk.java.net/ for more information about the OpenJDK.
See ../README-builds.html for complete details on build machine requirements.
Simple Build Instructions:
cd make && gnumake
The files that will be imported into the jdk build will be in the "dist"
directory.
此差异已折叠。
#
# Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# Makefile for jaxws: wrapper around Ant build.xml file
#
# On Solaris, the 'make' utility from Sun will not work with these makefiles.
# This little rule is only understood by Sun's make, and is harmless
# when seen by the GNU make tool. If using Sun's make, this causes the
# make command to fail.
#
SUN_MAKE_TEST:sh = @echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33
ifdef QUIET
ANT_OPTIONS += -quiet
endif
ifdef VERBOSE
ANT_OPTIONS += -verbose
endif
ifdef JDK_VERSION
ANT_OPTIONS += -Djdk.version=$(JDK_VERSION)
endif
ifdef FULL_VERSION
ANT_OPTIONS += -Dfull.version='$(FULL_VERSION)' # will contain spaces
endif
ifdef MILESTONE
ANT_OPTIONS += -Dmilestone=$(MILESTONE)
endif
ifdef BUILD_NUMBER
ANT_OPTIONS += -Dbuild.number=$(BUILD_NUMBER)
else
ifdef JDK_BUILD_NUMBER
ANT_OPTIONS += -Dbuild.number=$(JDK_BUILD_NUMBER)
endif
endif
ifeq ($(VARIANT), DBG)
ANT_OPTIONS += -Djavac.debug=true
else
ifeq ($(VARIANT), OPT)
ANT_OPTIONS += -Djavac.debug=false
endif
endif
# Note: j2se/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
# and the somewhat misnamed CLASS_VERSION (-target NN)
ifdef TARGET_CLASS_VERSION
ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION)
else
ifdef JAVAC_TARGET_ARG
ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG)
endif
endif
ifdef ALT_BOOTDIR
ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR)
endif
ifdef ALT_OUTPUTDIR
OUTPUTDIR = $(ALT_OUTPUTDIR)
ANT_OPTIONS += -Dbuild.dir=$(ALT_OUTPUTDIR)/build
ANT_OPTIONS += -Ddist.dir=$(ALT_OUTPUTDIR)/dist
else
OUTPUTDIR = ..
endif
ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR))
ifdef ALT_LANGTOOLS_DIST
ANT_OPTIONS += -Dbootstrap.dir=$(ALT_LANGTOOLS_DIST)/bootstrap
endif
ifdef FINDBUGS_HOME
ANT_OPTIONS += -Dfindbugs.home=$(FINDBUGS_HOME)
endif
ifdef ANT_HOME
ANT = $(ANT_HOME)/bin/ant
ifneq ($(shell test -x $(ANT); echo $$?), 0)
$(error "$(ANT) not found; please update ANT_HOME")
endif
else
ANT = ant
ifneq ($(shell which $(ANT) > /dev/null; echo $$?), 0)
$(error "\"ant\" not found; please set ANT_HOME or put \"ant\" on your PATH")
endif
endif
# Default target and expected 'do everything' target
all: build
# Standard make clobber target
clobber: clean
# All ant targets of interest
ANT_TARGETS = build clean sanity # for now
# Create a make target for each
$(ANT_TARGETS):
$(ANT_JAVA_HOME) $(ANT) -version
$(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) $@
# Targets for Sun's internal JPRT build system
jprt_build_product jprt_build_debug jprt_build_fastdebug: all
# Declare these phony (not filenames)
.PHONY: $(ANT_TARGETS) all clobber \
jprt_build_product jprt_build_debug jprt_build_fastdebug
README:
This file should be located at the top of the jaxws Mercurial repository.
See http://openjdk.java.net/ for more information about the OpenJDK.
See ../README-builds.html for complete details on build machine requirements.
Simple Build Instructions:
cd make && gnumake
The files that will be imported into the jdk build will be in the "dist"
directory.
#
# Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# This is the JDK used to build and run the bootstrap version of javac.
# The bootstrap javac is used to compile both boostrap versions of the
# other tools, and product versions of all the tools.
# Override this path as needed, either on the command line or in
# one of the standard user build.properties files (see build.xml)
# options for the <javac> tasks used to compile the tools
javac.target = 5
javac.debug = true
javac.debuglevel = source,lines
javac.no.jdk.warnings = -XDignore.symbol.file=true
# set the following to -version to verify the versions of javac being used
javac.version.opt =
# in time, there should be no exceptions to -Xlint:all
javac.lint.opts = -Xlint:all,-unchecked,-deprecation,-fallthrough,-cast,-serial -Werror
# JVM memory size
javac.memoryInitialSize = 128m
javac.memoryMaximumSize = 256m
#------------------------------------------------------------
<?xml version="1.0"?>
<!--
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Sun designates this
particular file as subject to the "Classpath" exception as provided
by Sun in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
CA 95054 USA or visit www.sun.com if you need additional information or
have any questions.
-->
<!--
This is the main build file for the jaxws workspace.
-->
<project name="jaxws" default="all" basedir=".">
<!-- Convenient shorthands for standard locations within the workspace. -->
<property file="build.properties"/>
<property name="topdir" value=".."/>
<property name="build.dir" location="${topdir}/build"/>
<property name="build.classes.dir" location="${build.dir}/classes"/>
<property name="build.gensrc.dir" location="${build.dir}/gensrc"/>
<property name="build.toolclasses.dir" location="${build.dir}/toolclasses"/>
<property name="dist.dir" location="${topdir}/dist"/>
<property name="dist.lib.dir" location="${dist.dir}/lib"/>
<property name="make.dir" location="${topdir}/make"/>
<property name="make.tools.dir" location="${make.dir}/tools"/>
<property name="src.dir" location="${topdir}/src"/>
<property name="src.classes.dir" location="${src.dir}/share/classes"/>
<property environment="env"/>
<target name="build" depends="banner, build-classes, build-tools, build-binaries">
<mkdir dir="${dist.lib.dir}"/>
<jar file="${dist.lib.dir}/classes.jar" basedir="${build.classes.dir}"/>
<zip file="${dist.lib.dir}/src.zip" basedir="${src.classes.dir}"/>
</target>
<!-- Debug information -->
<target name="sanity"
description="display settings of configuration values">
<echo level="info">ant.home = ${ant.home}</echo>
<echo level="info">java.home = ${env.JAVA_HOME}</echo>
<echo level="info">bootstrap.dir = ${bootstrap.dir}</echo>
</target>
<target name="build-tools" depends="-defs-pstrip">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes.dir}"/>
<pstrip srcdir="${src.classes.dir}"
destdir="${build.classes.dir}"
includes="**/*.properties"/>
</target>
<target name="build-binaries">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes.dir}"/>
<copy todir="${build.classes.dir}">
<fileset dir="${src.classes.dir}"
includes="**/*.xsd, **/*.default"
excludes="**/*.java, **/*.package.html, **/*.properties"/>
</copy>
<mkdir dir="${build.classes.dir}/META-INF/services"/>
<copy todir="${build.classes.dir}/META-INF/services"
file="${src.classes.dir}/com/sun/tools/etc/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory"/>
</target>
<target name="-defs-pstrip">
<mkdir dir="${build.toolclasses.dir}"/>
<javac srcdir="${make.tools.dir}/StripProperties"
destdir="${build.toolclasses.dir}/"
classpath="${ant.home}/lib/ant.jar"/>
<taskdef name="pstrip"
classname="StripPropertiesTask"
classpath="${build.toolclasses.dir}/"/>
</target>
<target name="build-classes" depends="sanity">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes.dir}"/>
<javac fork="true"
srcdir="${src.classes.dir}"
destdir="${build.classes.dir}"
memoryInitialSize="${javac.memoryInitialSize}"
memoryMaximumSize="${javac.memoryMaximumSize}"
target="${javac.target}"
excludes="com/sun/tools/internal/txw2/**">
<compilerarg value="-J-Xbootclasspath/p:${bootstrap.dir}/lib/javac.jar"/>
<compilerarg line="${javac.version.opt}"/>
<compilerarg line="${javac.no.jdk.warnings}"/>
</javac>
</target>
<target name="clean" description="Delete all generated files">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="banner">
<echo>+---------------------------------------+</echo>
<echo>+ Building JAX-WS Component +</echo>
<echo>+---------------------------------------+</echo>
</target>
</project>
#!echo "This is not a shell script"
#############################################################################
#
# Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
#############################################################################
#
# JPRT shell configuration for building.
#
# Input environment variables:
# ALT_BOOTDIR
# ALT_SLASH_JAVA
# ALT_JDK_IMPORT_PATH
# Windows Only:
# PATH
# PROCESSOR_IDENTIFIER
# ROOTDIR
#
# Output variable settings:
# make Full path to GNU make
#
# Output environment variables:
# PATH
# Windows Only:
# ALT_DEVTOOLS_PATH (To avoid the C:/UTILS default)
#
# After JDK6, most settings will be found via ALT_SLASH_JAVA or
# by way of other system environment variables. If this was JDK5
# or an older JDK, you might need to export more ALT_* variables.
#
#############################################################################
#############################################################################
# Error
error() # message
{
echo "ERROR: $1"
exit 6
}
# Directory must exist
dirMustExist() # dir name
{
if [ ! -d "$1" ] ; then
error "Directory for $2 does not exist: $1"
fi
}
# File must exist
fileMustExist() # dir name
{
if [ ! -f "$1" ] ; then
error "File for $2 does not exist: $1"
fi
}
#############################################################################
# Should be set by JPRT as the 3 basic inputs
bootdir="${ALT_BOOTDIR}"
slashjava="${ALT_SLASH_JAVA}"
jdk_import="${ALT_JDK_IMPORT_PATH}"
# Check input
dirMustExist "${bootdir}" ALT_BOOTDIR
dirMustExist "${slashjava}" ALT_SLASH_JAVA
dirMustExist "${jdk_import}" ALT_JDK_IMPORT_PATH
# Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise.
osname=`uname -s`
if [ "${osname}" = SunOS ] ; then
# SOLARIS: Sparc or X86
osarch=`uname -p`
if [ "${osarch}" = sparc ] ; then
solaris_arch=sparc
else
solaris_arch=i386
fi
# Add basic solaris system paths
path4sdk=/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin
# Get the previous JDK to be used to bootstrap the build
path4sdk=${bootdir}/bin:${path4sdk}
# Ant
ANT_HOME=${slashjava}/devtools/share/ant/1.7.0
export ANT_HOME
antbindir=${ANT_HOME}/bin
fileMustExist "${antbindir}/ant" ant
path4sdk=${antbindir}:${path4sdk}
# Find GNU make
make=/usr/sfw/bin/gmake
if [ ! -f ${make} ] ; then
make=/opt/sfw/bin/gmake
if [ ! -f ${make} ] ; then
make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
fi
fi
fileMustExist "${make}" make
# File creation mask
umask 002
elif [ "${osname}" = Linux ] ; then
# LINUX: X86, AMD64
osarch=`uname -m`
if [ "${osarch}" = i686 ] ; then
linux_arch=i586
elif [ "${osarch}" = x86_64 ] ; then
linux_arch=amd64
fi
# Add basic paths
path4sdk=/usr/bin:/bin:/usr/sbin:/sbin
# Get the previous JDK to be used to bootstrap the build
path4sdk=${bootdir}/bin:${path4sdk}
# Ant
ANT_HOME=${slashjava}/devtools/share/ant/1.7.0
export ANT_HOME
antbindir=${ANT_HOME}/bin
fileMustExist "${antbindir}/ant" ant
path4sdk=${antbindir}:${path4sdk}
# Find GNU make
make=/usr/bin/make
fileMustExist "${make}" make
umask 002
else
# Windows: Differs on CYGWIN vs. MKS.
# Also, blanks in pathnames gives GNU make headaches, so anything placed
# in any ALT_* variable should be the short windows dosname.
# WINDOWS: Install and use MKS or CYGWIN (should have already been done)
# Assumption here is that you are in a shell window via MKS or cygwin.
# MKS install should have defined the environment variable ROOTDIR.
# We also need to figure out which one we have: X86, AMD64
if [ "`echo ${PROCESSOR_IDENTIFIER} | fgrep AMD64`" != "" ] ; then
windows_arch=amd64
else
windows_arch=i586
fi
# We need to determine if we are running a CYGWIN shell or an MKS shell
# (if uname isn't available, then it will be unix_toolset=unknown)
unix_toolset=unknown
if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then
# We kind of assume ROOTDIR is where MKS is and it's ok
unix_toolset=MKS
mkshome=`dosname -s "${ROOTDIR}"`
# Utility to convert to short pathnames without spaces
dosname="${mkshome}/mksnt/dosname -s"
# Most unix utilities are in the mksnt directory of ROOTDIR
unixcommand_path="${mkshome}/mksnt"
path4sdk="${unixcommand_path}"
dirMustExist "${unixcommand_path}" ALT_UNIXCOMMAND_PATH
devtools_path="${slashjava}/devtools/win32/bin"
path4sdk="${devtools_path};${path4sdk}"
# Normally this need not be set, but on Windows it's default is C:/UTILS
ALT_DEVTOOLS_PATH="${devtools_path}"
export ALT_DEVTOOLS_PATH
dirMustExist "${devtools_path}" ALT_DEVTOOLS_PATH
# Find GNU make
make="${devtools_path}/gnumake.exe"
fileMustExist "${make}" make
elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then
# For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
unix_toolset=CYGWIN
# Utility to convert to short pathnames without spaces
dosname="/usr/bin/cygpath -a -m -s"
# Most unix utilities are in the /usr/bin
unixcommand_path="/usr/bin"
path4sdk="${unixcommand_path}"
dirMustExist "${unixcommand_path}" ALT_UNIXCOMMAND_PATH
# Find GNU make
make="${unixcommand_path}/make.exe"
fileMustExist "${make}" make
else
echo "WARNING: Cannot figure out if this is MKS or CYGWIN"
fi
# WINDOWS: Get the previous JDK to be used to bootstrap the build
path4sdk="${bootdir}/bin;${path4sdk}"
# Ant
ANT_HOME=${slashjava}/devtools/share/ant/1.7.0
export ANT_HOME
antbindir=${ANT_HOME}/bin
fileMustExist "${antbindir}/ant" ant
path4sdk="${antbindir};${path4sdk}"
# Turn all \\ into /, remove duplicates and trailing /
slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`"
# For windows, it's hard to know where the system is, so we just add this
# to PATH.
path4sdk="${slash_path};${PATH}"
# Convert path4sdk to cygwin style
if [ "${unix_toolset}" = CYGWIN ] ; then
path4sdk="`/usr/bin/cygpath -p ${path4sdk}`"
fi
fi
# Export PATH setting
PATH="${path4sdk}"
export PATH
# Things we need to unset
unset LD_LIBRARY_PATH
unset LD_LIBRARY_PATH_32
unset LD_LIBRARY_PATH_64
unset JAVA_HOME
#
# Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# Properties for jprt
jprt.tools.default.release=jdk1.7.0
# Specific platform list
jprt.build.platforms=\
solaris_sparc_5.10,\
solaris_sparcv9_5.10,\
solaris_i586_5.10,\
solaris_x64_5.10,\
linux_i586,\
linux_x64,\
windows_i586,\
windows_x64
# The different build flavors we want
jprt.build.flavors=product
# Explicitly designate what the 32bit match is for the 64bit build
jprt.solaris_sparcv9.build.platform.match32=solaris_sparc_5.10
jprt.solaris_sparcv9_5.10.build.platform.match32=solaris_sparc_5.10
jprt.solaris_x64.build.platform.match32=solaris_i586_5.10
jprt.solaris_x64_5.10.build.platform.match32=solaris_i586_5.10
# Standard list of jprt test targets for this workspace
jprt.test.targets=
# Directories needed to build
jprt.bundle.src.dirs=make src
jprt.bundle.exclude.src.dirs=build dist
/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
import java.io.BufferedInputStream;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Properties;
/**
* Reads a properties file from standard input and writes an equivalent
* properties file without comments to standard output.
*/
public class StripProperties {
public static void main(String[] args) {
StripProperties sp = new StripProperties();
boolean ok = sp.run(args);
if ( !ok ) {
System.exit(1);
}
}
static interface Log {
void info(String msg);
void verbose(String msg);
void error(String msg, Exception e);
}
private String propfiles[];
private String outfiles[] ;
private int stripCount = 0;
private boolean quiet = false;
private Log log;
public void setLog(Log log) {
this.log = log;
}
private boolean parseOptions(String args[]) {
boolean ok = true;
if ( stripCount > 0 ) {
String new_propfiles[] = new String[stripCount + args.length];
String new_outfiles[] = new String[stripCount + args.length];
System.arraycopy(propfiles, 0, new_propfiles, 0, stripCount);
System.arraycopy(outfiles, 0, new_outfiles, 0, stripCount);
propfiles = new_propfiles;
outfiles = new_outfiles;
} else {
propfiles = new String[args.length];
outfiles = new String[args.length];
}
for ( int i = 0; i < args.length ; i++ ) {
if ( "-strip".equals(args[i]) && i+2 < args.length ) {
propfiles[stripCount] = args[++i];
outfiles[stripCount] = args[++i];
stripCount++;
} else if ( "-optionsfile".equals(args[i]) && i+1 < args.length ) {
String filename = args[++i];
FileInputStream finput = null;
byte contents[] = null;
try {
finput = new FileInputStream(filename);
int byteCount = finput.available();
if ( byteCount <= 0 ) {
log.error("The -optionsfile file is empty", null);
ok = false;
} else {
contents = new byte[byteCount];
int bytesRead = finput.read(contents);
if ( byteCount != bytesRead ) {
log.error("Cannot read all of -optionsfile file", null);
ok = false;
}
}
} catch ( IOException e ) {
log.error("cannot open " + filename, e);
ok = false;
}
if ( finput != null ) {
try {
finput.close();
} catch ( IOException e ) {
ok = false;
log.error("cannot close " + filename, e);
}
}
if ( ok = true && contents != null ) {
String tokens[] = (new String(contents)).split("\\s+");
if ( tokens.length > 0 ) {
ok = parseOptions(tokens);
}
}
if ( !ok ) {
break;
}
} else if ( "-quiet".equals(args[i]) ) {
quiet = true;
} else {
log.error("argument error", null);
ok = false;
}
}
return ok;
}
private boolean stripFiles(String propertiesPath, String outputPath) {
boolean ok = true;
Properties prop = new Properties();
InputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(propertiesPath));
prop.load(in);
} catch ( FileNotFoundException e ) {
log.error("Cannot access file " + propertiesPath, e);
ok = false;
} catch ( IOException e ) {
log.error("IO exception processing file " + propertiesPath, e);
ok = false;
}
if ( in != null ) {
try {
in.close();
} catch ( IOException e ) {
log.error("IO exception closing file " + propertiesPath, e);
ok = false;
}
}
OutputStream out = null;
try {
out = new FileOutputStream(outputPath);
storeProperties(prop, out);
out.flush();
} catch ( IOException e ) {
log.error("IO exception processing file " + outputPath, e);
e.printStackTrace();
ok = false;
}
if ( out != null ) {
try {
out.close();
} catch ( IOException e ) {
log.error("IO exception closing file " + outputPath, e);
ok = false;
}
}
return ok;
}
/**
* Strip the properties filenames supplied, replacing their contents.
* @param args Names of properties files to process and replace contents
*/
public boolean run(String args[]) {
if (log == null) {
log = new Log() {
public void error(String msg, Exception e) {
System.err.println("ERROR: StripProperties: " + msg);
if ( e != null ) {
System.err.println("EXCEPTION: " + e.toString());
e.printStackTrace();
}
}
public void info(String msg) {
System.out.println(msg);
}
public void verbose(String msg) {
if (!quiet)
System.out.println(msg);
}
};
}
boolean ok = true;
ok = parseOptions(args);
if ( ok && stripCount == 0 ) {
log.error("options parsed but no files to compile", null);
ok = false;
}
/* Need at least one file. */
if ( !ok ) {
//usage(log);
} else {
/* Process files */
for ( int i = 0; i < stripCount && ok ; i++ ) {
ok = stripFiles(propfiles[i], outfiles[i]);
}
}
return ok;
}
// --- code below here is adapted from java.util.Properties ---
private static final String specialSaveChars = "=: \t\r\n\f#!";
/*
* Converts unicodes to encoded &#92;uxxxx
* and writes out any of the characters in specialSaveChars
* with a preceding slash
*/
private static String saveConvert(String theString, boolean escapeSpace) {
int len = theString.length();
StringBuffer outBuffer = new StringBuffer(len*2);
for(int x=0; x<len; x++) {
char aChar = theString.charAt(x);
switch(aChar) {
case ' ':
if (x == 0 || escapeSpace) {
outBuffer.append('\\');
}
outBuffer.append(' ');
break;
case '\\':
outBuffer.append('\\');
outBuffer.append('\\');
break;
case '\t':
outBuffer.append('\\');
outBuffer.append('t');
break;
case '\n':
outBuffer.append('\\');
outBuffer.append('n');
break;
case '\r':
outBuffer.append('\\');
outBuffer.append('r');
break;
case '\f':
outBuffer.append('\\');
outBuffer.append('f');
break;
default:
if ((aChar < 0x0020) || (aChar == 0x007e) || (aChar > 0x00ff)) {
outBuffer.append('\\');
outBuffer.append('u');
outBuffer.append(toHex((aChar >> 12) & 0xF));
outBuffer.append(toHex((aChar >> 8) & 0xF));
outBuffer.append(toHex((aChar >> 4) & 0xF));
outBuffer.append(toHex( aChar & 0xF));
} else {
if (specialSaveChars.indexOf(aChar) != -1) {
outBuffer.append('\\');
}
outBuffer.append(aChar);
}
}
}
return outBuffer.toString();
}
/**
* Writes the content of <code>properties</code> to <code>out</code>.
* The format is that of Properties.store with the following modifications:
* <ul>
* <li>No header or date is written
* <li>Latin-1 characters are written as single bytes, not escape sequences
* <li>Line breaks are indicated by a single \n independent of platform
* <ul>
*/
private static void storeProperties(Properties properties, OutputStream out)
throws IOException {
BufferedWriter awriter;
awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1"));
for (Enumeration e = properties.keys(); e.hasMoreElements();) {
String key = (String)e.nextElement();
String val = (String)properties.get(key);
key = saveConvert(key, true);
/* No need to escape embedded and trailing spaces for value, hence
* pass false to flag.
*/
val = saveConvert(val, false);
writeln(awriter, key + "=" + val);
}
awriter.flush();
}
private static void writeln(BufferedWriter bw, String s) throws IOException {
bw.write(s);
bw.write("\n");
}
/**
* Convert a nibble to a hex character
* @param nibble the nibble to convert.
*/
private static char toHex(int nibble) {
return hexDigit[(nibble & 0xF)];
}
/** A table of hex digits */
private static final char[] hexDigit = {
'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
};
}
/*
* Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.MatchingTask;
public class StripPropertiesTask extends MatchingTask {
public void setSrcDir(File srcDir) {
this.srcDir = srcDir;
}
public void setDestDir(File destDir) {
this.destDir = destDir;
}
public void execute() {
StripProperties.Log log = new StripProperties.Log() {
public void error(String msg, Exception e) {
log(msg, Project.MSG_ERR);
}
public void info(String msg) {
log(msg, Project.MSG_INFO);
}
public void verbose(String msg) {
log(msg, Project.MSG_VERBOSE);
}
};
List<String> mainOpts = new ArrayList<String>();
int count = 0;
DirectoryScanner s = getDirectoryScanner(srcDir);
for (String path: s.getIncludedFiles()) {
if (path.endsWith(".properties")) {
File srcFile = new File(srcDir, path);
File destFile = new File(destDir, path);
// Arguably, the comparison in the next line should be ">", not ">="
// but that assumes the resolution of the last modified time is fine
// grained enough; in practice, it is better to use ">=".
if (destFile.exists() && destFile.lastModified() >= srcFile.lastModified())
continue;
destFile.getParentFile().mkdirs();
mainOpts.add("-strip");
mainOpts.add(srcFile.getPath());
mainOpts.add(destFile.getPath());
count++;
}
}
if (mainOpts.size() > 0) {
log("Generating " + count + " resource files to " + destDir, Project.MSG_INFO);
StripProperties sp = new StripProperties();
sp.setLog(log);
boolean ok = sp.run((String[])mainOpts.toArray(new String[mainOpts.size()]));
if (!ok)
throw new BuildException("StripProperties failed.");
}
}
private File srcDir;
private File destDir;
}
#
# This is a very simple 'mailcap' file
#
image/gif;; x-java-view=com.sun.activation.viewers.ImageViewer
image/jpeg;; x-java-view=com.sun.activation.viewers.ImageViewer
text/*;; x-java-view=com.sun.activation.viewers.TextViewer
text/*;; x-java-edit=com.sun.activation.viewers.TextEditor
#
# A simple, old format, mime.types file
#
text/html html htm HTML HTM
text/plain txt text TXT TEXT
image/gif gif GIF
image/ief ief
image/jpeg jpeg jpg jpe JPG
image/tiff tiff tif
image/x-xwindowdump xwd
application/postscript ai eps ps
application/rtf rtf
application/x-tex tex
application/x-texinfo texinfo texi
application/x-troff t tr roff
audio/basic au
audio/midi midi mid
audio/x-aifc aifc
audio/x-aiff aif aiff
audio/x-mpeg mpeg mpg
audio/x-wav wav
video/mpeg mpeg mpg mpe
video/quicktime qt mov
video/x-msvideo avi
/*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.activation.registries;
import java.io.*;
import java.util.logging.*;
/**
* Logging related methods.
*/
public class LogSupport {
private static boolean debug = false;
private static Logger logger;
private static final Level level = Level.FINE;
static {
try {
debug = Boolean.getBoolean("javax.activation.debug");
} catch (Throwable t) {
// ignore any errors
}
logger = Logger.getLogger("javax.activation");
}
/**
* Constructor.
*/
private LogSupport() {
// private constructor, can't create instances
}
public static void log(String msg) {
if (debug)
System.out.println(msg);
logger.log(level, msg);
}
public static void log(String msg, Throwable t) {
if (debug)
System.out.println(msg + "; Exception: " + t);
logger.log(level, msg, t);
}
public static boolean isLoggable() {
return debug || logger.isLoggable(level);
}
}
/*
* Copyright 1997 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.activation.registries;
/**
* A class to encapsulate Mailcap parsing related exceptions
*/
public class MailcapParseException extends Exception {
public MailcapParseException() {
super();
}
public MailcapParseException(String inInfo) {
super(inInfo);
}
}
/*
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.activation.registries;
/**
* A tokenizer for strings in the form of "foo/bar; prop1=val1; ... ".
* Useful for parsing MIME content types.
*/
public class MailcapTokenizer {
public static final int UNKNOWN_TOKEN = 0;
public static final int START_TOKEN = 1;
public static final int STRING_TOKEN = 2;
public static final int EOI_TOKEN = 5;
public static final int SLASH_TOKEN = '/';
public static final int SEMICOLON_TOKEN = ';';
public static final int EQUALS_TOKEN = '=';
/**
* Constructor
*
* @parameter inputString the string to tokenize
*/
public MailcapTokenizer(String inputString) {
data = inputString;
dataIndex = 0;
dataLength = inputString.length();
currentToken = START_TOKEN;
currentTokenValue = "";
isAutoquoting = false;
autoquoteChar = ';';
}
/**
* Set whether auto-quoting is on or off.
*
* Auto-quoting means that all characters after the first
* non-whitespace, non-control character up to the auto-quote
* terminator character or EOI (minus any whitespace immediatley
* preceeding it) is considered a token.
*
* This is required for handling command strings in a mailcap entry.
*/
public void setIsAutoquoting(boolean value) {
isAutoquoting = value;
}
/**
* Retrieve current token.
*
* @returns The current token value
*/
public int getCurrentToken() {
return currentToken;
}
/*
* Get a String that describes the given token.
*/
public static String nameForToken(int token) {
String name = "really unknown";
switch(token) {
case UNKNOWN_TOKEN:
name = "unknown";
break;
case START_TOKEN:
name = "start";
break;
case STRING_TOKEN:
name = "string";
break;
case EOI_TOKEN:
name = "EOI";
break;
case SLASH_TOKEN:
name = "'/'";
break;
case SEMICOLON_TOKEN:
name = "';'";
break;
case EQUALS_TOKEN:
name = "'='";
break;
}
return name;
}
/*
* Retrieve current token value.
*
* @returns A String containing the current token value
*/
public String getCurrentTokenValue() {
return currentTokenValue;
}
/*
* Process the next token.
*
* @returns the next token
*/
public int nextToken() {
if (dataIndex < dataLength) {
// skip white space
while ((dataIndex < dataLength) &&
(isWhiteSpaceChar(data.charAt(dataIndex)))) {
++dataIndex;
}
if (dataIndex < dataLength) {
// examine the current character and see what kind of token we have
char c = data.charAt(dataIndex);
if (isAutoquoting) {
if (c == ';' || c == '=') {
currentToken = c;
currentTokenValue = new Character(c).toString();
++dataIndex;
} else {
processAutoquoteToken();
}
} else {
if (isStringTokenChar(c)) {
processStringToken();
} else if ((c == '/') || (c == ';') || (c == '=')) {
currentToken = c;
currentTokenValue = new Character(c).toString();
++dataIndex;
} else {
currentToken = UNKNOWN_TOKEN;
currentTokenValue = new Character(c).toString();
++dataIndex;
}
}
} else {
currentToken = EOI_TOKEN;
currentTokenValue = null;
}
} else {
currentToken = EOI_TOKEN;
currentTokenValue = null;
}
return currentToken;
}
private void processStringToken() {
// capture the initial index
int initialIndex = dataIndex;
// skip to 1st non string token character
while ((dataIndex < dataLength) &&
isStringTokenChar(data.charAt(dataIndex))) {
++dataIndex;
}
currentToken = STRING_TOKEN;
currentTokenValue = data.substring(initialIndex, dataIndex);
}
private void processAutoquoteToken() {
// capture the initial index
int initialIndex = dataIndex;
// now skip to the 1st non-escaped autoquote termination character
// XXX - doesn't actually consider escaping
boolean foundTerminator = false;
while ((dataIndex < dataLength) && !foundTerminator) {
char c = data.charAt(dataIndex);
if (c != autoquoteChar) {
++dataIndex;
} else {
foundTerminator = true;
}
}
currentToken = STRING_TOKEN;
currentTokenValue =
fixEscapeSequences(data.substring(initialIndex, dataIndex));
}
private static boolean isSpecialChar(char c) {
boolean lAnswer = false;
switch(c) {
case '(':
case ')':
case '<':
case '>':
case '@':
case ',':
case ';':
case ':':
case '\\':
case '"':
case '/':
case '[':
case ']':
case '?':
case '=':
lAnswer = true;
break;
}
return lAnswer;
}
private static boolean isControlChar(char c) {
return Character.isISOControl(c);
}
private static boolean isWhiteSpaceChar(char c) {
return Character.isWhitespace(c);
}
private static boolean isStringTokenChar(char c) {
return !isSpecialChar(c) && !isControlChar(c) && !isWhiteSpaceChar(c);
}
private static String fixEscapeSequences(String inputString) {
int inputLength = inputString.length();
StringBuffer buffer = new StringBuffer();
buffer.ensureCapacity(inputLength);
for (int i = 0; i < inputLength; ++i) {
char currentChar = inputString.charAt(i);
if (currentChar != '\\') {
buffer.append(currentChar);
} else {
if (i < inputLength - 1) {
char nextChar = inputString.charAt(i + 1);
buffer.append(nextChar);
// force a skip over the next character too
++i;
} else {
buffer.append(currentChar);
}
}
}
return buffer.toString();
}
private String data;
private int dataIndex;
private int dataLength;
private int currentToken;
private String currentTokenValue;
private boolean isAutoquoting;
private char autoquoteChar;
/*
public static void main(String[] args) {
for (int i = 0; i < args.length; ++i) {
MailcapTokenizer tokenizer = new MailcapTokenizer(args[i]);
System.out.println("Original: |" + args[i] + "|");
int currentToken = tokenizer.nextToken();
while (currentToken != EOI_TOKEN) {
switch(currentToken) {
case UNKNOWN_TOKEN:
System.out.println(" Unknown Token: |" + tokenizer.getCurrentTokenValue() + "|");
break;
case START_TOKEN:
System.out.println(" Start Token: |" + tokenizer.getCurrentTokenValue() + "|");
break;
case STRING_TOKEN:
System.out.println(" String Token: |" + tokenizer.getCurrentTokenValue() + "|");
break;
case EOI_TOKEN:
System.out.println(" EOI Token: |" + tokenizer.getCurrentTokenValue() + "|");
break;
case SLASH_TOKEN:
System.out.println(" Slash Token: |" + tokenizer.getCurrentTokenValue() + "|");
break;
case SEMICOLON_TOKEN:
System.out.println(" Semicolon Token: |" + tokenizer.getCurrentTokenValue() + "|");
break;
case EQUALS_TOKEN:
System.out.println(" Equals Token: |" + tokenizer.getCurrentTokenValue() + "|");
break;
default:
System.out.println(" Really Unknown Token: |" + tokenizer.getCurrentTokenValue() + "|");
break;
}
currentToken = tokenizer.nextToken();
}
System.out.println("");
}
}
*/
}
/*
* Copyright 1997-1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.activation.registries;
import java.lang.*;
public class MimeTypeEntry {
private String type;
private String extension;
public MimeTypeEntry(String mime_type, String file_ext) {
type = mime_type;
extension = file_ext;
}
public String getMIMEType() {
return type;
}
public String getFileExtension() {
return extension;
}
public String toString() {
return "MIMETypeEntry: " + type + ", " + extension;
}
}
/*
* Copyright 1997-2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.activation.registries;
import java.io.*;
import java.util.*;
public class MimeTypeFile {
private String fname = null;
private Hashtable type_hash = new Hashtable();
/**
* The construtor that takes a filename as an argument.
*
* @param new_fname The file name of the mime types file.
*/
public MimeTypeFile(String new_fname) throws IOException {
File mime_file = null;
FileReader fr = null;
fname = new_fname; // remember the file name
mime_file = new File(fname); // get a file object
fr = new FileReader(mime_file);
try {
parse(new BufferedReader(fr));
} finally {
try {
fr.close(); // close it
} catch (IOException e) {
// ignore it
}
}
}
public MimeTypeFile(InputStream is) throws IOException {
parse(new BufferedReader(new InputStreamReader(is, "iso-8859-1")));
}
/**
* Creates an empty DB.
*/
public MimeTypeFile() {
}
/**
* get the MimeTypeEntry based on the file extension
*/
public MimeTypeEntry getMimeTypeEntry(String file_ext) {
return (MimeTypeEntry)type_hash.get((Object)file_ext);
}
/**
* Get the MIME type string corresponding to the file extension.
*/
public String getMIMETypeString(String file_ext) {
MimeTypeEntry entry = this.getMimeTypeEntry(file_ext);
if (entry != null)
return entry.getMIMEType();
else
return null;
}
/**
* Appends string of entries to the types registry, must be valid
* .mime.types format.
* A mime.types entry is one of two forms:
*
* type/subtype ext1 ext2 ...
* or
* type=type/subtype desc="description of type" exts=ext1,ext2,...
*
* Example:
* # this is a test
* audio/basic au
* text/plain txt text
* type=application/postscript exts=ps,eps
*/
public void appendToRegistry(String mime_types) {
try {
parse(new BufferedReader(new StringReader(mime_types)));
} catch (IOException ex) {
// can't happen
}
}
/**
* Parse a stream of mime.types entries.
*/
private void parse(BufferedReader buf_reader) throws IOException {
String line = null, prev = null;
while ((line = buf_reader.readLine()) != null) {
if (prev == null)
prev = line;
else
prev += line;
int end = prev.length();
if (prev.length() > 0 && prev.charAt(end - 1) == '\\') {
prev = prev.substring(0, end - 1);
continue;
}
this.parseEntry(prev);
prev = null;
}
if (prev != null)
this.parseEntry(prev);
}
/**
* Parse single mime.types entry.
*/
private void parseEntry(String line) {
String mime_type = null;
String file_ext = null;
line = line.trim();
if (line.length() == 0) // empty line...
return; // BAIL!
// check to see if this is a comment line?
if (line.charAt(0) == '#')
return; // then we are done!
// is it a new format line or old format?
if (line.indexOf('=') > 0) {
// new format
LineTokenizer lt = new LineTokenizer(line);
while (lt.hasMoreTokens()) {
String name = lt.nextToken();
String value = null;
if (lt.hasMoreTokens() && lt.nextToken().equals("=") &&
lt.hasMoreTokens())
value = lt.nextToken();
if (value == null) {
if (LogSupport.isLoggable())
LogSupport.log("Bad .mime.types entry: " + line);
return;
}
if (name.equals("type"))
mime_type = value;
else if (name.equals("exts")) {
StringTokenizer st = new StringTokenizer(value, ",");
while (st.hasMoreTokens()) {
file_ext = st.nextToken();
MimeTypeEntry entry =
new MimeTypeEntry(mime_type, file_ext);
type_hash.put(file_ext, entry);
if (LogSupport.isLoggable())
LogSupport.log("Added: " + entry.toString());
}
}
}
} else {
// old format
// count the tokens
StringTokenizer strtok = new StringTokenizer(line);
int num_tok = strtok.countTokens();
if (num_tok == 0) // empty line
return;
mime_type = strtok.nextToken(); // get the MIME type
while (strtok.hasMoreTokens()) {
MimeTypeEntry entry = null;
file_ext = strtok.nextToken();
entry = new MimeTypeEntry(mime_type, file_ext);
type_hash.put(file_ext, entry);
if (LogSupport.isLoggable())
LogSupport.log("Added: " + entry.toString());
}
}
}
// for debugging
/*
public static void main(String[] argv) throws Exception {
MimeTypeFile mf = new MimeTypeFile(argv[0]);
System.out.println("ext " + argv[1] + " type " +
mf.getMIMETypeString(argv[1]));
System.exit(0);
}
*/
}
class LineTokenizer {
private int currentPosition;
private int maxPosition;
private String str;
private Vector stack = new Vector();
private static final String singles = "="; // single character tokens
/**
* Constructs a tokenizer for the specified string.
* <p>
*
* @param str a string to be parsed.
*/
public LineTokenizer(String str) {
currentPosition = 0;
this.str = str;
maxPosition = str.length();
}
/**
* Skips white space.
*/
private void skipWhiteSpace() {
while ((currentPosition < maxPosition) &&
Character.isWhitespace(str.charAt(currentPosition))) {
currentPosition++;
}
}
/**
* Tests if there are more tokens available from this tokenizer's string.
*
* @return <code>true</code> if there are more tokens available from this
* tokenizer's string; <code>false</code> otherwise.
*/
public boolean hasMoreTokens() {
if (stack.size() > 0)
return true;
skipWhiteSpace();
return (currentPosition < maxPosition);
}
/**
* Returns the next token from this tokenizer.
*
* @return the next token from this tokenizer.
* @exception NoSuchElementException if there are no more tokens in this
* tokenizer's string.
*/
public String nextToken() {
int size = stack.size();
if (size > 0) {
String t = (String)stack.elementAt(size - 1);
stack.removeElementAt(size - 1);
return t;
}
skipWhiteSpace();
if (currentPosition >= maxPosition) {
throw new NoSuchElementException();
}
int start = currentPosition;
char c = str.charAt(start);
if (c == '"') {
currentPosition++;
boolean filter = false;
while (currentPosition < maxPosition) {
c = str.charAt(currentPosition++);
if (c == '\\') {
currentPosition++;
filter = true;
} else if (c == '"') {
String s;
if (filter) {
StringBuffer sb = new StringBuffer();
for (int i = start + 1; i < currentPosition - 1; i++) {
c = str.charAt(i);
if (c != '\\')
sb.append(c);
}
s = sb.toString();
} else
s = str.substring(start + 1, currentPosition - 1);
return s;
}
}
} else if (singles.indexOf(c) >= 0) {
currentPosition++;
} else {
while ((currentPosition < maxPosition) &&
singles.indexOf(str.charAt(currentPosition)) < 0 &&
!Character.isWhitespace(str.charAt(currentPosition))) {
currentPosition++;
}
}
return str.substring(start, currentPosition);
}
public void pushToken(String token) {
stack.addElement(token);
}
}
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
/**
* This helps enable whether the JDefinedClass is a Class or Interface or
* AnnotationTypeDeclaration or Enum
*
* @author
* Bhakti Mehta (bhakti.mehta@sun.com)
*/
public final class ClassType {
/**
* The keyword used to declare this type.
*/
final String declarationToken;
private ClassType(String token) {
this.declarationToken = token;
}
public static final ClassType CLASS = new ClassType("class");
public static final ClassType INTERFACE = new ClassType("interface");
public static final ClassType ANNOTATION_TYPE_DECL = new ClassType("@interface");
public static final ClassType ENUM = new ClassType("enum");
}
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.CharsetEncoder;
import com.sun.codemodel.internal.util.EncoderFactory;
import com.sun.codemodel.internal.util.UnicodeEscapeWriter;
/**
* Receives generated code and writes to the appropriate storage.
*
* @author
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
*/
public abstract class CodeWriter {
/**
* Called by CodeModel to store the specified file.
* The callee must allocate a storage to store the specified file.
*
* <p>
* The returned stream will be closed before the next file is
* stored. So the callee can assume that only one OutputStream
* is active at any given time.
*
* @param pkg
* The package of the file to be written.
* @param fileName
* File name without the path. Something like
* "Foo.java" or "Bar.properties"
*/
public abstract OutputStream openBinary( JPackage pkg, String fileName ) throws IOException;
/**
* Called by CodeModel to store the specified file.
* The callee must allocate a storage to store the specified file.
*
* <p>
* The returned stream will be closed before the next file is
* stored. So the callee can assume that only one OutputStream
* is active at any given time.
*
* @param pkg
* The package of the file to be written.
* @param fileName
* File name without the path. Something like
* "Foo.java" or "Bar.properties"
*/
public Writer openSource( JPackage pkg, String fileName ) throws IOException {
final OutputStreamWriter bw = new OutputStreamWriter(openBinary(pkg,fileName));
// create writer
try {
return new UnicodeEscapeWriter(bw) {
// can't change this signature to Encoder because
// we can't have Encoder in method signature
private final CharsetEncoder encoder = EncoderFactory.createEncoder(bw.getEncoding());
protected boolean requireEscaping(int ch) {
// control characters
if( ch<0x20 && " \t\r\n".indexOf(ch)==-1 ) return true;
// check ASCII chars, for better performance
if( ch<0x80 ) return false;
return !encoder.canEncode((char)ch);
}
};
} catch( Throwable t ) {
return new UnicodeEscapeWriter(bw);
}
}
/**
* Called by CodeModel at the end of the process.
*/
public abstract void close() throws IOException;
}
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.lang.annotation.Annotation;
/**
* Annotatable program elements.
*
* @author Kohsuke Kawaguchi
*/
public interface JAnnotatable {
/**
* Adds an annotation to this program element.
* @param clazz
* The annotation class to annotate the program element with
*/
JAnnotationUse annotate(JClass clazz);
/**
* Adds an annotation to this program element.
*
* @param clazz
* The annotation class to annotate the program element with
*/
JAnnotationUse annotate(Class <? extends Annotation> clazz);
/**
* Adds an annotation to this program element
* and returns a type-safe writer to fill in the values of such annotations.
*/
<W extends JAnnotationWriter> W annotate2(Class<W> clazz);
}
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;
/**
* Represents an arrays as annotation members
*
* <p>
* This class implements {@link JAnnotatable} to allow
* new annotations to be added as a member of the array.
*
* @author
* Bhakti Mehta (bhakti.mehta@sun.com)
*/
public final class JAnnotationArrayMember extends JAnnotationValue implements JAnnotatable {
private final List<JAnnotationValue> values = new ArrayList<JAnnotationValue>();
private final JCodeModel owner;
JAnnotationArrayMember(JCodeModel owner) {
this.owner = owner;
}
/**
* Adds an array member to this annotation
*
* @param value Adds a string value to the array member
* @return The JAnnotationArrayMember. More elements can be added by calling
* the same method multiple times
*/
public JAnnotationArrayMember param(String value) {
JAnnotationValue annotationValue = new JAnnotationStringValue(JExpr.lit(value));
values.add(annotationValue);
return this;
}
public JAnnotationArrayMember param(boolean value) {
JAnnotationValue annotationValue = new JAnnotationStringValue(JExpr.lit(value));
values.add(annotationValue);
return this;
}
/**
* Adds an array member to this annotation
*
* @param value Adds an int value to the array member
* @return The JAnnotationArrayMember. More elements can be added by calling
* the same method multiple times
*/
public JAnnotationArrayMember param(int value) {
JAnnotationValue annotationValue = new JAnnotationStringValue(JExpr.lit(value));
values.add(annotationValue);
return this;
}
/**
* Adds an array member to this annotation
*
* @param value Adds a float value to the array member
* @return The JAnnotationArrayMember. More elements can be added by calling
* the same method multiple times
*/
public JAnnotationArrayMember param(float value) {
JAnnotationValue annotationValue = new JAnnotationStringValue(JExpr.lit(value));
values.add(annotationValue);
return this;
}
public JAnnotationArrayMember param(Class value){
JAnnotationValue annotationValue = new JAnnotationStringValue(JExpr.lit(value.getName()));
values.add(annotationValue);
return this;
}
public JAnnotationArrayMember param(JType type){
JClass clazz = type.boxify();
JAnnotationValue annotationValue = new JAnnotationStringValue ( clazz.dotclass() );
values.add(annotationValue);
return this;
}
/**
* Adds a new annotation to the array.
*/
public JAnnotationUse annotate(Class<? extends Annotation> clazz){
return annotate(owner.ref(clazz));
}
/**
* Adds a new annotation to the array.
*/
public JAnnotationUse annotate(JClass clazz){
JAnnotationUse a = new JAnnotationUse(clazz);
values.add(a);
return a;
}
public <W extends JAnnotationWriter> W annotate2(Class<W> clazz) {
return TypedAnnotationWriter.create(clazz,this);
}
/**
* Adds an annotation member to this annotation array
* This can be used for e.g &#64;XmlCollection(values= &#64;XmlCollectionItem(type=Foo.class))
* @param value
* Adds a annotation to the array member
* @return
* The JAnnotationArrayMember. More elements can be added by calling
* the same method multiple times
*
* @deprecated
* use {@link #annotate}
*/
public JAnnotationArrayMember param (JAnnotationUse value ){
values.add(value);
return this;
}
public void generate(JFormatter f) {
f.p('{').nl().i();
boolean first = true;
for (JAnnotationValue aValue : values) {
if (!first)
f.p(',').nl();
f.g(aValue);
first = false;
}
f.nl().o().p('}');
}
}
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
/**
* Captures the value of the annotation.
*
* @author
* Bhakti Mehta (bhakti.mehta@sun.com)
*/
final class JAnnotationStringValue extends JAnnotationValue {
/**
* The value of the Annotation member
*/
private final JExpression value;
JAnnotationStringValue(JExpression value) {
this.value = value;
}
public void generate(JFormatter f) {
f.g(value);
}
}
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
/**
* Things that can be values of an annotation element.
*
* @author
* Bhakti Mehta (bhakti.mehta@sun.com)
*/
public abstract class JAnnotationValue implements JGenerable {
}
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
import java.lang.annotation.Annotation;
/**
* Base interface for typed annotation writer.
*
* <p>
* Annotation compiler can generate a strongly typed annotation
* writer to assist applications to write uses of annotations.
* Such typed annotation writer interfaces all derive from
* this common interface.
*
* <p>
* The type parameter 'A' represents the
* @author Kohsuke Kawaguchi
*/
public interface JAnnotationWriter<A extends Annotation> {
/**
* Gets the underlying annotation use object to which we are writing.
*/
JAnnotationUse getAnnotationUse();
/**
* The type of the annotation that this writer is writing.
*/
Class<A> getAnnotationType();
}
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.codemodel.internal;
/**
* Anonymous class quick hack.
*
* @author
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
*/
class JAnonymousClass extends JDefinedClass {
/**
* Base interface/class from which this anonymous class is built.
*/
private final JClass base;
JAnonymousClass( JClass _base) {
super(_base.owner(), 0, null);
this.base = _base;
}
public String fullName() {
return base.fullName();
}
}
<HTML>
<BODY>
Various resource file formats (classes that implement <code>JResourceFile</code>).
</BODY>
</HTML>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册