Merging B-1_9_1 back to head
This commit is contained in:
@@ -8,4 +8,5 @@ RELEASE.txt
|
||||
compilation_tools.properties
|
||||
version.properties
|
||||
release
|
||||
.externalToolBuilders
|
||||
|
||||
|
||||
533
LICENSE.TXT
533
LICENSE.TXT
@@ -1,29 +1,504 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
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 and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, 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 library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete 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 distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
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 Library or any portion
|
||||
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
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 Library, 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 Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you 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.
|
||||
|
||||
If distribution of 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 satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be 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.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library 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.
|
||||
|
||||
9. 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 Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
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 with
|
||||
this License.
|
||||
|
||||
11. 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 Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library 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 Library.
|
||||
|
||||
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.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library 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.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser 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 Library
|
||||
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 Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
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
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "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
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. 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 LIBRARY 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
|
||||
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
|
||||
1
README.txt
Normal file
1
README.txt
Normal file
@@ -0,0 +1 @@
|
||||
Information about what's new in this release can be found in docs/ReleaseNotes.html
|
||||
171
build.xml
171
build.xml
@@ -3,7 +3,7 @@
|
||||
Feb 4, 2005 1:23:05 PM
|
||||
|
||||
Ant build file for JACOB.
|
||||
Tested on Eclipse 3.0.0 and Ant 1.6.1, with MS Visual C++ 6.0
|
||||
Tested on Eclipse 3.0.1 and Ant 1.6.1, with MS Visual C++ 6.0
|
||||
|
||||
Eclipse users are pretty lucky. This works with the version of ANT
|
||||
that comes with Eclipse 3.0.1 (maybe 3.0.0). The whole project
|
||||
@@ -33,18 +33,23 @@
|
||||
=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^ -->
|
||||
|
||||
<property name="application.title" value="JACOB : Java COM Bridge" />
|
||||
<property name="application.vendor" value="http://jacob-project.sourceforge.net, created by Dan Adler (http://danadler.com)" />
|
||||
<property name="install.dir" value="${basedir}/release" />
|
||||
<property name="application.vendor" value="http://jacob-project.sourceforge.net" />
|
||||
<property name="java.src.mainpackage" value="com.jacob" />
|
||||
<property name="java.class.main" value="com.jacob.com.Jacob" />
|
||||
<property name="generated_jar" value="jacob.jar" />
|
||||
<property name="generated_dll" value="jacob.dll" />
|
||||
<property name="generated_zip" value="jacob_${version}" />
|
||||
|
||||
<property name="jacob_java.src" value="${basedir}/src" />
|
||||
<property name="jacob_java.samples" value="${basedir}/samples" />
|
||||
<property name="jacob_java.unittest" value="${basedir}/unittest" />
|
||||
<property name="jacob_java.bin" value="${install.dir}" />
|
||||
<property name="jacob_cpp.src" value="${basedir}/jni" />
|
||||
<property name="jacob_cpp.bin" value="${install.dir}/jni" />
|
||||
|
||||
<property name="jacob.jar" value="${install.dir}/jacob.jar" />
|
||||
<property name="jacob.dll" value="${install.dir}/jacob.dll" />
|
||||
<property name="install.dir" value="${basedir}\release" />
|
||||
<property name="java.src" value="${basedir}/src" />
|
||||
<property name="java.samples" value="${basedir}/samples" />
|
||||
<property name="java.unittest" value="${basedir}/unittest" />
|
||||
<property name="java.bin" value="${install.dir}" />
|
||||
<property name="cpp.src" value="${basedir}/jni" />
|
||||
<property name="cpp.bin" value="${install.dir}/jni" />
|
||||
|
||||
<property name="jarfile_fullpath" value="${install.dir}\${generated_jar}" />
|
||||
<property name="dll_fullpath" value="${install.dir}\${generated_dll}" />
|
||||
|
||||
<property name="compiler" value="${MSDEVDIR}\bin\cl.exe" />
|
||||
<property name="linker" value="${MSDEVDIR}\bin\link.exe" />
|
||||
@@ -52,9 +57,9 @@
|
||||
<!-- =================================
|
||||
target: default
|
||||
================================= -->
|
||||
<target name="default" depends="createDirectoryStructure,jacob_java_jar_bin,jacob_c_dll">
|
||||
<target name="default" depends="createDirectoryStructure,java_jar_bin,c_dll">
|
||||
|
||||
<echo message="Jacob ${version} build ${build.iteration} : finished on ${build.date}" />
|
||||
<echo message="${application.title} ${version} build ${build.iteration} : finished on ${build.date}" />
|
||||
</target>
|
||||
|
||||
<!-- ======================================================================
|
||||
@@ -74,61 +79,61 @@
|
||||
already there)
|
||||
================================================================== -->
|
||||
<target name="createDirectoryStructure">
|
||||
<mkdir dir="${jacob_java.bin}"/>
|
||||
<mkdir dir="${jacob_cpp.bin}"/>
|
||||
<mkdir dir="${java.bin}"/>
|
||||
<mkdir dir="${cpp.bin}"/>
|
||||
<mkdir dir="${install.dir}"/>
|
||||
</target>
|
||||
|
||||
<!-- ======================================================================
|
||||
Compare the date/time of the jacob JAR against that
|
||||
of the jacob java source
|
||||
Compare the date/time of the JAR against that
|
||||
of the java source
|
||||
================================================================== -->
|
||||
<target name="jacob_java_jar_check">
|
||||
<uptodate property="jarUpToDate" targetfile="${jacob.jar}">
|
||||
<srcfiles dir="${jacob_java.src}">
|
||||
<target name="java_jar_check">
|
||||
<uptodate property="jarUpToDate" targetfile="${jarfile_fullpath}">
|
||||
<srcfiles dir="${java.src}">
|
||||
<include name="com/**/*.java" />
|
||||
</srcfiles>
|
||||
<!-- Check the build file itself as well -->
|
||||
<srcfiles file="${basedir}/build.xml" />
|
||||
</uptodate>
|
||||
<echo message="jacob_java_jar_check result: ${jarUpToDate}" />
|
||||
<echo message="java_jar_check result: ${jarUpToDate}" />
|
||||
</target>
|
||||
<!-- ======================================================================
|
||||
Compile the java files
|
||||
Relies on ant recognizing when a file needs to be compiled
|
||||
================================================================== -->
|
||||
<target name="jacob_java_compile" depends="createDirectoryStructure,IncrementBuildNumber">
|
||||
<echo>Building java classes...</echo>
|
||||
<javac srcdir="${jacob_java.src}"
|
||||
destdir="${jacob_java.bin}"
|
||||
<target name="java_compile" depends="createDirectoryStructure,IncrementBuildNumber">
|
||||
<echo>Building java classes in ${java.bin}...</echo>
|
||||
<javac srcdir="${java.src}"
|
||||
destdir="${java.bin}"
|
||||
listfiles="true" debug="on" fork="yes" />
|
||||
<echo>Building java sample classes...</echo>
|
||||
<javac srcdir="${jacob_java.samples}"
|
||||
destdir="${jacob_java.bin}"
|
||||
excludes="com/jacob/samples/servlet/**/*.java"
|
||||
<echo>Building java sample classes ...</echo>
|
||||
<javac srcdir="${java.samples}"
|
||||
destdir="${java.bin}"
|
||||
listfiles="true" debug="on" fork="yes" />
|
||||
<echo>Building java test classes...</echo>
|
||||
<javac srcdir="${jacob_java.unittest}"
|
||||
destdir="${jacob_java.bin}"
|
||||
<javac srcdir="${java.unittest}"
|
||||
destdir="${java.bin}"
|
||||
listfiles="true" debug="on" fork="yes" />
|
||||
</target>
|
||||
<!-- ======================================================================
|
||||
Package the classes into a JAR.
|
||||
Put version.propertes into the jar file so getJacobVersion() can find it
|
||||
Package the classes into a JAR.
|
||||
Put version.propertes into the jar file so version retrieval method can find it
|
||||
================================================================== -->
|
||||
<target name="jacob_java_jar_bin" depends="createDirectoryStructure,jacob_java_compile,jacob_java_jar_check,IncrementBuildNumber" unless="jarUpToDate">
|
||||
<target name="java_jar_bin" depends="createDirectoryStructure,java_compile,java_jar_check,IncrementBuildNumber" unless="jarUpToDate">
|
||||
<echo>Removing old jars</echo>
|
||||
<delete file="${jacob.jar}" />
|
||||
<delete file="${jarfile_fullpath}" />
|
||||
<echo>Packaging java classes...</echo>
|
||||
<jar destfile="${jacob.jar}" basedir="${jacob_java.bin}" update="false">
|
||||
<jar destfile="${jarfile_fullpath}" basedir="${java.bin}" update="false">
|
||||
<exclude name="**/CVS" />
|
||||
<exclude name="com/**/*Test.class"/>
|
||||
<exclude name="com/jacob/samples/**"/>
|
||||
<exclude name="com/**/samples/**"/>
|
||||
<include name="com/**/*.class" />
|
||||
<include name="version.properties" />
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${user.name}" />
|
||||
<section name="com.jacob">
|
||||
<attribute name="Main-Class" value="${java.class.main}"/>
|
||||
<section name="${java.src.mainpackage}">
|
||||
<attribute name="Specification-Title" value="${application.title}" />
|
||||
<attribute name="Specification-Vendor" value="${application.vendor}" />
|
||||
<attribute name="Implementation-Title" value="${application.title} Java libraries" />
|
||||
@@ -138,28 +143,28 @@
|
||||
</jar>
|
||||
</target>
|
||||
<!-- ======================================================================
|
||||
Compare the date/time of the jacob DLL against that
|
||||
of the jacob cpp source
|
||||
Compare the date/time of the DLL against that
|
||||
of the cpp source
|
||||
================================================================== -->
|
||||
<target name="jacob_c_check">
|
||||
<uptodate property="dllUpToDate" targetfile="${jacob.dll}">
|
||||
<srcfiles dir="${jacob_cpp.src}">
|
||||
<target name="c_check">
|
||||
<uptodate property="dllUpToDate" targetfile="${dll_fullpath}">
|
||||
<srcfiles dir="${cpp.src}">
|
||||
<include name="*.cpp" />
|
||||
<include name="*.h" />
|
||||
</srcfiles>
|
||||
<!-- Check the build file itself as well -->
|
||||
<srcfiles file="${basedir}/build.xml" />
|
||||
</uptodate>
|
||||
<echo message="jacob_c_check result: ${dllUpToDate}" />
|
||||
<echo message="c_check result: ${dllUpToDate}" />
|
||||
</target>
|
||||
<!-- ======================================================================
|
||||
Compile the c source files.
|
||||
================================================================== -->
|
||||
<target name="jacob_c_compile" depends="createDirectoryStructure,jacob_c_check,IncrementBuildNumber" unless="dllUpToDate">
|
||||
<target name="c_compile" depends="createDirectoryStructure,c_check,IncrementBuildNumber" unless="dllUpToDate">
|
||||
<echo>Clean up the target folders and file, for safety</echo>
|
||||
<delete file="${jacob_cpp.bin}/**/*.*" />
|
||||
<echo>Compiling C++ classes</echo>
|
||||
<apply executable="${compiler}" dir="${jacob_cpp.bin}" parallel="false" verbose="true" failonerror="true">
|
||||
<delete file="${cpp.bin}/**/*.*" />
|
||||
<echo>Compiling C++ classes with JDK JNI library ${JDK}</echo>
|
||||
<apply executable="${compiler}" dir="${cpp.bin}" parallel="false" verbose="true" failonerror="true">
|
||||
<arg value="-c" />
|
||||
<arg value="/nologo" />
|
||||
<!-- optimize build for speed. (is this VC specific? -->
|
||||
@@ -172,7 +177,7 @@
|
||||
<arg value="${MSDEVDIR}\Include" />
|
||||
<arg value="-I" />
|
||||
<arg value="${MSDEVDIR}\ATL\Include" />
|
||||
<fileset dir="${jacob_cpp.src}">
|
||||
<fileset dir="${cpp.src}">
|
||||
<include name="*.cpp" />
|
||||
</fileset>
|
||||
</apply>
|
||||
@@ -180,15 +185,15 @@
|
||||
<!-- ======================================================================
|
||||
Link the obj files into a DLL.
|
||||
================================================================== -->
|
||||
<target name="jacob_c_dll" depends="createDirectoryStructure,jacob_c_check,jacob_c_compile" unless="dllUpToDate">
|
||||
<target name="c_dll" depends="createDirectoryStructure,c_check,c_compile" unless="dllUpToDate">
|
||||
<echo>Clean up the target folders and file, for safety</echo>
|
||||
<delete file="${jacob.dll}" />
|
||||
<echo>Creating jacob.dll</echo>
|
||||
<apply executable="${linker}" dir="${jacob_cpp.bin}" parallel="true" verbose="true" failonerror="true">
|
||||
<delete file="${dll_fullpath}" />
|
||||
<echo>Creating dll_fullpath</echo>
|
||||
<apply executable="${linker}" dir="${cpp.bin}" parallel="true" verbose="true" failonerror="true">
|
||||
<arg value="/nologo" />
|
||||
<arg value="/dll" />
|
||||
<arg value="/version:${version}" />
|
||||
<arg value="/out:${jacob.dll}" />
|
||||
<arg value="/out:${dll_fullpath}" />
|
||||
<arg value="/libpath:${MSDEVDIR}/lib" />
|
||||
<srcfile />
|
||||
<arg value="${JDK}\lib\jvm.lib" />
|
||||
@@ -198,31 +203,32 @@
|
||||
<arg value="kernel32.lib" />
|
||||
<arg value="shell32.lib" />
|
||||
<arg value="user32.lib" />
|
||||
<fileset dir="${jacob_cpp.bin}">
|
||||
<fileset dir="${cpp.bin}">
|
||||
<include name="*.obj" />
|
||||
</fileset>
|
||||
</apply>
|
||||
</target>
|
||||
|
||||
<!-- ======================================================================
|
||||
Use this target to create javadoc from com.jacob.*
|
||||
Use this target to create javadoc from ${java.src.mainpackage}/*
|
||||
================================================================== -->
|
||||
<target name="javadoc">
|
||||
<defaultexcludes add="**/*Test*"/>
|
||||
<javadoc
|
||||
packagenames="com.jacob/**"
|
||||
sourcepath="${jacob_java.src}"
|
||||
destdir="${jacob_java.bin}/docs/api"
|
||||
packagenames="${java.src.mainpackage}/**"
|
||||
sourcepath="${java.src}"
|
||||
destdir="${java.bin}/docs/api"
|
||||
author="true"
|
||||
version="true"
|
||||
use="true"
|
||||
windowtitle="Jacob API Docs">
|
||||
windowtitle="${application.title} API Docs">
|
||||
|
||||
<doctitle><![CDATA[<h1>Java Com Bridge (Jacob)</h1>]]></doctitle>
|
||||
<bottom><![CDATA[<i>See Jacob-project on Sourceforge for more info</i>]]></bottom>
|
||||
<doctitle><![CDATA[<h1>${application.title}</h1>]]></doctitle>
|
||||
<bottom><![CDATA[<i>${application.vendor}</i>]]></bottom>
|
||||
<tag name="todo" scope="all" description="To do:" />
|
||||
<group title="Jacob COM" packages="com.jacob.com/**"/>
|
||||
<group title="Higher Level Active X" packages="com.jacob.activeX/**"/>
|
||||
<group title="Core COM Communication" packages="${java.src.mainpackage}.com/**"/>
|
||||
<group title="Higher Level Active X" packages="${java.src.mainpackage}.activeX/**"/>
|
||||
<group title="API Stub Generator" packages="${java.src.mainpackage}.jacobgen/**"/>
|
||||
<link offline="true" href="http://java.sun.com/j2se/1.4.2/docs/api/" packagelistLoc="C:\tmp"/>
|
||||
<link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
|
||||
</javadoc>
|
||||
@@ -232,35 +238,38 @@
|
||||
<!-- ======================================================================
|
||||
Use this target to package all the files for a release
|
||||
================================================================== -->
|
||||
<target name="PackageRelease" depends="createDirectoryStructure,jacob_c_dll,jacob_java_jar_bin,javadoc">
|
||||
<target name="PackageRelease" depends="createDirectoryStructure,c_dll,java_jar_bin,javadoc">
|
||||
|
||||
<echo>Packaging release...</echo>
|
||||
<echo>Packaging release... ${jarfile_fullpath}</echo>
|
||||
<zip
|
||||
destfile="${install.dir}/jacob_${version}.zip">
|
||||
destfile="${install.dir}/${generated_zip}.zip">
|
||||
<exclude name="**/CVS" />
|
||||
<exclude name="**/*.obj" />
|
||||
<exclude name="**/*.class" />
|
||||
<zipfileset dir="${basedir}" prefix="jacob_${version}" includes="LICENSE.* version.properties" />
|
||||
<zipfileset dir="${install.dir}" prefix="jacob_${version}" includes="jacob.jar jacob.dll"/>
|
||||
<zipfileset dir="${basedir}" prefix="jacob_${version}" includes="docs/**" />
|
||||
<zipfileset dir="${install.dir}" prefix="jacob_${version}" includes="docs/**"/>
|
||||
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="LICENSE.* version.properties" />
|
||||
<zipfileset dir="${install.dir}" prefix="${generated_zip}" includes="${generated_jar}" />
|
||||
<zipfileset dir="${install.dir}" prefix="${generated_zip}" includes="${generated_dll}" />
|
||||
<zipfileset dir="${basedir}/lib" prefix="${generated_zip}" includes="*.jar" />
|
||||
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="docs/**" />
|
||||
<zipfileset dir="${install.dir}" prefix="${generated_zip}" includes="docs/**"/>
|
||||
</zip>
|
||||
<zip
|
||||
destfile="${install.dir}/jacob_${version}_src.zip">
|
||||
destfile="${install.dir}/${generated_zip}_src.zip">
|
||||
<exclude name="**/CVS" />
|
||||
<exclude name="**/*.obj" />
|
||||
<exclude name="**/*.class" />
|
||||
<exclude name="**/*.dll" />
|
||||
<exclude name="**/*.exp" />
|
||||
<exclude name="**/*.jar" />
|
||||
<zipfileset dir="${basedir}" prefix="jacob_${version}" includes="src/**" />
|
||||
<zipfileset dir="${basedir}" prefix="jacob_${version}" includes="docs/**" />
|
||||
<zipfileset dir="${basedir}" prefix="jacob_${version}" includes="jni/**" />
|
||||
<zipfileset dir="${basedir}" prefix="jacob_${version}" includes="samples/**" />
|
||||
<zipfileset dir="${basedir}" prefix="jacob_${version}" includes="unittest/**" />
|
||||
<zipfileset dir="${basedir}" prefix="jacob_${version}" includes="vstudio/**" />
|
||||
<zipfileset dir="${basedir}" prefix="jacob_${version}" includes="build.xml, RELEASE.txt" />
|
||||
<zipfileset dir="${basedir}" prefix="jacob_${version}" includes="LICENSE.* version.properties" />
|
||||
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="src/**" />
|
||||
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="docs/**" />
|
||||
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="jni/**" />
|
||||
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="samples/**" />
|
||||
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="unittest/**" />
|
||||
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="vstudio/**" />
|
||||
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="lib/**" />
|
||||
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="build.xml, README.txt" />
|
||||
<zipfileset dir="${basedir}" prefix="${generated_zip}" includes="LICENSE.* version.properties" />
|
||||
</zip>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
(2/2005)
|
||||
To build and run:
|
||||
|
||||
Unpack the source archive or check the files out of CVS into d:\jacob
|
||||
|
||||
Install the following tools
|
||||
Microsfot Visual Studio, a stripped down version is available from the MS web site.
|
||||
Microsoft Visual Studio, a stripped down version is available from the MS web site.
|
||||
Eclipse from www.eclipse.org.
|
||||
Java jdk 1.4 (this was built using 1.4.2.06)
|
||||
Java jdk 1.4 (this was built using 1.4.2.09)
|
||||
|
||||
The following configuration was used by most of the development team:
|
||||
JDK = d:\j2sdk1.4.2_06
|
||||
JDK = d:\j2sdk1.4.2_09
|
||||
DEST_DIR = d:\jacob
|
||||
MSDEVDIR = d:\apps\\"Microsoft Visual Studio"\VC98
|
||||
|
||||
@@ -33,37 +32,17 @@ ECLIPSE
|
||||
|
||||
Eclipse users will have to do some minor tweaks to their project if they
|
||||
want to use the integrated build process. This is because the unit
|
||||
tests are com.jacob.com files located in the unittest directory while
|
||||
the jacob files themselves are in com.jacob.com off the root directory.
|
||||
(Eventually the the jacob files will be moved to src)
|
||||
tests are files located in the "unittest" directory while
|
||||
the project source files themselves are in "src" the root directory.
|
||||
Eclipse automatically adds the whole project as a source directory
|
||||
Remove the root of the project from the build path
|
||||
Add folders samples, src and unittest to the build path
|
||||
Exclude *.txt from each of the newly added folders.
|
||||
|
||||
A couple of the samples require a J2EE library in order to compile. This
|
||||
means you'll have to add a J2EE jar file to your classpath. This
|
||||
isn't a problem when using ANT because the Servlet examples are excluded
|
||||
from the build.
|
||||
|
||||
|
||||
|
||||
--- old instructions for makefiles that no longer exist --
|
||||
|
||||
To build:
|
||||
Run VCVARS32 to set up your MS Visual C++ environment
|
||||
cd d:\jacob
|
||||
nmake
|
||||
The Servlet examples that required j2ee libraries to compile have temporarily
|
||||
been removed.
|
||||
|
||||
(from dan)I developed this with the C++ compiler and ATL version
|
||||
that ship with VC++ 6.0, so I'm not sure if different versions will
|
||||
work.
|
||||
|
||||
This is currently designed to compile against JDK 1.4.2. The future
|
||||
of the Microsoft SDK is in doubt so support may be discontinued
|
||||
in the future.
|
||||
|
||||
|
||||
The java code is in com\jacob\*.
|
||||
The java code is in .\src.
|
||||
The C++ code is in .\jni.
|
||||
|
||||
Last Modified 10/2005
|
||||
|
||||
@@ -1,77 +1,141 @@
|
||||
<h1>What's New in JACOB 1.9</H1>
|
||||
<HTML>
|
||||
<BODY>
|
||||
<h2>What's New in JACOB 1.9.1</h2>
|
||||
<ul>
|
||||
<li>
|
||||
<b>License</b>
|
||||
<ul>
|
||||
<li>License standardized on LGPL. See LICENSE.TXT for more information
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<b>Event Callbacks</b>
|
||||
<ul>
|
||||
<li>Event handlers are now wrapped in an InvocationProxy. The COM/JNI event
|
||||
code knows only about InvocationProxies and calls the appropriate methods
|
||||
on the Invocation proxy to get needed Variant instances and to forward
|
||||
events to the Java layer.
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<b>Variants</b>
|
||||
<ul>
|
||||
<li>Automatic conversion between Windows Time and Java Date is now supported
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<b>SafeArray</b>
|
||||
<ul>
|
||||
<li>Multi-dimensional (greater than 2) support
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
<h2>Tracked Changes</h2>
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
|
||||
<tr>
|
||||
<td width="100%" colspan="2"><b>Bugs</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="13%">1335897 </td>
|
||||
<td width="87%">SafeArray() called toString() on objects when debug was turned on</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="13%"> </td>
|
||||
<td width="87%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="100%" colspan="2"><b>Patches</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="13%">1314116 </td>
|
||||
<td width="87%"> putString UNICODE string length not detected</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="13%"> </td>
|
||||
<td width="87%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="100%" colspan="2"><b>Feature Requests</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="13%">1264850</td>
|
||||
<td width="87%">Custom Event Dispatching</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="13%">959382</td>
|
||||
<td width="87%">Time Conversion</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="13%">1313892 </td>
|
||||
<td width="87%">Multi-Dimensional SafeArray</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</ul>
|
||||
|
||||
<!---------------------------------------/>
|
||||
|
||||
<h2>What's New in JACOB 1.9</h2>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<b>Event Callbacks</b>
|
||||
<ul>
|
||||
|
||||
<li>Variant parameters can now be modified by the receiver to be passed
|
||||
back to the COM caller </li>
|
||||
<li>Callbacks now create objects of class VariantViaEvent rather than Variant.
|
||||
This was aided to add debugging and tracing</li>
|
||||
<li>Callbacks can now be received when running in JWS other launchers where
|
||||
JACOB.jar is not in the system classloader's path.</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<b>Dispatch API Clarifications</B>
|
||||
<ul>
|
||||
|
||||
<li>All static method's first parameters have been more strongly typed
|
||||
to the Dispatch class, rather than Object. This may call for code
|
||||
changes in the cases of code that just asigned Dispatch objects
|
||||
to variables of type Object rather than Dispatch or one of its subclasses </li>
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<b>Dispatch subclasses are now supported with pointer modifying constructor</b>
|
||||
<ul>
|
||||
|
||||
<li>Dispatch and ActiveXComponent now includes a constructor to be used by Dispatch subclasses
|
||||
that swaps the pointers around. This eliminates the need for every Dispatch subclass
|
||||
to have a constructor that swapped and nulled out the pointers to the COM layer.
|
||||
All samples have updated to use the new api </li>
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<b>ActiveXComponent has been upgraded</b><ul>
|
||||
|
||||
<li>ActiveXComponent methods return ActiveXComponets </li>
|
||||
<li>Methods have been added to the ActiveXComponents to retrieve
|
||||
parameters as Dispatch objects or ActiveX components. The
|
||||
Script Tests have been updated to show the same programs in Dispatch
|
||||
format or ActiveXComponentFormat </li>
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<b>Memory Management</b>
|
||||
<ul>
|
||||
|
||||
<li>Beta test option that lets an application use automatic object object
|
||||
removal through the use of weak reference hash maps in the ROT class. The
|
||||
default behavior of manual release via the COMThread class has been retained as
|
||||
the default behavior. Developers can test automatic memory collection by
|
||||
using the command line option <i>-Dcom.JACOB.autogc=true</i> </li>
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<b>JNI Changes</b>
|
||||
<ul>
|
||||
|
||||
<li>Erroneous Array dimension checking fixed for certain boolean set and get functions
|
||||
</li>
|
||||
<li>Alternative method for finding Variant class for callbacks in JWS
|
||||
@@ -90,46 +154,33 @@ This fix only applies to Variants created in callbacks. </li>
|
||||
|
||||
<li>
|
||||
<b>Logging Additions</b><ul>
|
||||
|
||||
<li>Debugging logging to standard out for JACOB can be turned on by using the
|
||||
command line option <i>-Dcom.JACOB.debug=true</i></li>
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<b>Visual Studio</b><ul>
|
||||
|
||||
<li>The VisualStudio directory in the CVS repository will be removed in the next
|
||||
release</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<b>Documentation</b><ul>
|
||||
|
||||
<li>API documentation via Javadoc is now being generated for all classes.</li>
|
||||
|
||||
<li>The development team is looking for help in upgrading the quality of the
|
||||
class documentation</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<b>Build Changes</b>
|
||||
<ul>
|
||||
|
||||
<li>A static method has been added to JacobObject that returns the build version</li>
|
||||
|
||||
<li>The project is now being built using ANT. Most of the developers are
|
||||
running this from inside of Eclipse</li>
|
||||
<li>All makefiles have been purged</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h2>Tracked Changes</h2>
|
||||
@@ -229,7 +280,7 @@ running this from inside of Eclipse</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h1>What's New in JACOB 1.8</H1>
|
||||
<h2>What's New in JACOB 1.8</h2>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
@@ -260,7 +311,7 @@ people to start contributing to the project with this version.
|
||||
</ul>
|
||||
|
||||
<li>
|
||||
<h1>What's New in JACOB 1.7</H1>
|
||||
<h2>What's New in JACOB 1.7</h2>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
@@ -313,7 +364,7 @@ native code is replicated there from the jni directory...
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<H1>Related Links</H1>
|
||||
<h2>Related Links</h2>
|
||||
<ul>
|
||||
<li>
|
||||
The JACOB mailing list is hosted at yahoo groups:
|
||||
@@ -341,4 +392,7 @@ and at the bottom of the page is a link that says:
|
||||
Microsoft SDK for Java 4.0 Documentation Only. You should download
|
||||
that file and install it. Then, view sdkdocs.chm and look for
|
||||
"Microsoft Packages Reference". Hopefully, the next release of
|
||||
JACOB will include full javadoc (volunteers?)...</li>
|
||||
JACOB will include full javadoc (volunteers?)...</li>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include <objbase.h>
|
||||
|
||||
@@ -1,4 +1,22 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include <jni.h>
|
||||
/* Header for class com_jacob_com_ComThread */
|
||||
|
||||
|
||||
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include <objbase.h>
|
||||
@@ -53,6 +43,12 @@ IDispatch *extractDispatch(JNIEnv *env, jobject arg)
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method finds an interface rooted on the passed in dispatch object.
|
||||
* This creates a new Dispatch object so it is NOT reliable
|
||||
* in the event callback thread of a JWS client where the root class loader
|
||||
* does not have com.jacob.com.Dispatch in its classpath
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_com_jacob_com_Dispatch_QueryInterface
|
||||
(JNIEnv *env, jobject _this, jstring _iid)
|
||||
{
|
||||
@@ -79,8 +75,7 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Dispatch_QueryInterface
|
||||
}
|
||||
|
||||
jclass autoClass = env->FindClass("com/jacob/com/Dispatch");
|
||||
jmethodID autoCons =
|
||||
env->GetMethodID(autoClass, "<init>", "(I)V");
|
||||
jmethodID autoCons = env->GetMethodID(autoClass, "<init>", "(I)V");
|
||||
// construct a Dispatch object to return
|
||||
// I am copying the pointer to java
|
||||
// jacob-msg 1817 - SF 1053871 : QueryInterface already called AddRef!!
|
||||
|
||||
@@ -1,4 +1,22 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include <jni.h>
|
||||
/* Header for class Dispatch */
|
||||
|
||||
|
||||
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "DispatchEvents.h"
|
||||
#include "EventProxy.h"
|
||||
@@ -74,7 +64,7 @@ void putProxy(JNIEnv *env, jobject arg, EventProxy *ep)
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_init2
|
||||
(JNIEnv *env,
|
||||
jobject _this, jobject src,
|
||||
jobject sink, jobject protoVariant,
|
||||
jobject sink,
|
||||
jstring _progid)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
@@ -111,7 +101,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_init2
|
||||
//DWORD dwEventCookie;
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
EventProxy *ep = new EventProxy(env, sink, protoVariant, pCP, eventIID, mNames, mIDs, n_EventMethods);
|
||||
EventProxy *ep = new EventProxy(env, sink, pCP, eventIID, mNames, mIDs, n_EventMethods);
|
||||
// need to store ep on _this, in case it gets collected
|
||||
putProxy(env, _this, ep);
|
||||
} else {
|
||||
@@ -125,9 +115,9 @@ JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_init2
|
||||
* Signature: (LDispatch;Ljava/lang/Object;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_init
|
||||
(JNIEnv *env, jobject _this, jobject src, jobject sink, jobject protoVariant)
|
||||
(JNIEnv *env, jobject _this, jobject src, jobject sink)
|
||||
{
|
||||
Java_com_jacob_com_DispatchEvents_init2(env,_this,src,sink, protoVariant, NULL);
|
||||
Java_com_jacob_com_DispatchEvents_init2(env,_this,src,sink, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,4 +1,22 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include <jni.h>
|
||||
/* Header for class DispatchEvents */
|
||||
|
||||
@@ -13,7 +31,7 @@ extern "C" {
|
||||
* Signature: (LDispatch;Ljava/lang/Object;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_init
|
||||
(JNIEnv *, jobject, jobject, jobject, jobject);
|
||||
(JNIEnv *, jobject, jobject, jobject);
|
||||
|
||||
/*
|
||||
* Class: DispatchEvents
|
||||
@@ -21,7 +39,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_init
|
||||
* Signature: (LDispatch;Ljava/lang/Object;Ljava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_init2
|
||||
(JNIEnv *, jobject, jobject, jobject, jobject, jstring);
|
||||
(JNIEnv *, jobject, jobject, jobject, jstring);
|
||||
|
||||
/*
|
||||
* Class: DispatchEvents
|
||||
|
||||
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include <objbase.h>
|
||||
|
||||
@@ -1,4 +1,22 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include <jni.h>
|
||||
/* Header for class com_jacob_com_DispatchProxy */
|
||||
|
||||
|
||||
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include <objbase.h>
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
/* Header for class EnumVariant
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#ifndef _Included_EnumVariant
|
||||
#define _Included_EnumVariant
|
||||
|
||||
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "EventProxy.h"
|
||||
#include "Variant.h"
|
||||
@@ -33,7 +23,6 @@
|
||||
// hook myself up as a listener for delegate
|
||||
EventProxy::EventProxy(JNIEnv *env,
|
||||
jobject aSinkObj,
|
||||
jobject aVariantObj,
|
||||
CComPtr<IConnectionPoint> pConn,
|
||||
IID eid,
|
||||
CComBSTR mName[],
|
||||
@@ -42,15 +31,12 @@ EventProxy::EventProxy(JNIEnv *env,
|
||||
// initialize some variables
|
||||
m_cRef(0), pCP(pConn),
|
||||
eventIID(eid), MethNum(mNum), MethName(mName),
|
||||
MethID(mID), JMethID(NULL),
|
||||
javaSinkClass(NULL)
|
||||
MethID(mID)
|
||||
{
|
||||
// don't really need the variant object but we keep a reference
|
||||
// anyway
|
||||
javaSinkObj = env->NewGlobalRef(aSinkObj);
|
||||
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
|
||||
javaVariantObj = env->NewGlobalRef(aVariantObj);
|
||||
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
|
||||
|
||||
// we need this to attach to the event invocation thread
|
||||
env->GetJavaVM(&jvm);
|
||||
@@ -58,28 +44,6 @@ EventProxy::EventProxy(JNIEnv *env,
|
||||
AddRef();
|
||||
HRESULT hr = pCP->Advise(this, &dwEventCookie);
|
||||
if (SUCCEEDED(hr)) {
|
||||
|
||||
// create a mapping from the DISPID's to jmethodID's by using
|
||||
// the method names I extracted from the classinfo
|
||||
JMethID = new jmethodID[MethNum];
|
||||
|
||||
javaSinkClass = env->GetObjectClass(javaSinkObj);
|
||||
if (javaSinkClass == NULL){ printf("can't figure out java sink class"); }
|
||||
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
|
||||
|
||||
const char *method;
|
||||
for(int i=0;i<MethNum;i++)
|
||||
{
|
||||
// look for a method with the specified name, that takes an
|
||||
// array of variants and return void
|
||||
USES_CONVERSION;
|
||||
method = W2A((OLECHAR *)MethName[i]);
|
||||
JMethID[i] = env->GetMethodID(javaSinkClass, method, "([Lcom/jacob/com/Variant;)V");
|
||||
// need to clear exceptions because GetMethodID above may fail
|
||||
// if the user didn't implement all the methods
|
||||
env->ExceptionClear();
|
||||
}
|
||||
|
||||
} else {
|
||||
ThrowComFail(env, "Advise failed", hr);
|
||||
}
|
||||
@@ -92,8 +56,10 @@ EventProxy::~EventProxy()
|
||||
JNIEnv *env;
|
||||
// attach to the current running thread
|
||||
#ifdef JNI_VERSION_1_2
|
||||
printf("using version 1.2 API\n");
|
||||
jvm->AttachCurrentThread((void **)&env, jvm);
|
||||
#else
|
||||
printf("not using version 1.2 API\n");
|
||||
jvm->AttachCurrentThread((void**)&env, NULL);
|
||||
#endif
|
||||
|
||||
@@ -103,7 +69,6 @@ EventProxy::~EventProxy()
|
||||
if (MethNum) {
|
||||
delete [] MethName;
|
||||
delete [] MethID;
|
||||
if (JMethID) delete [] JMethID;
|
||||
}
|
||||
// detach from thread
|
||||
jvm->DetachCurrentThread();
|
||||
@@ -138,22 +103,18 @@ STDMETHODIMP EventProxy::Invoke(DISPID dispID, REFIID riid,
|
||||
{
|
||||
//Visual C++ 6.0 recognized this as an unused variable
|
||||
//HRESULT hr;
|
||||
jmethodID meth = 0;
|
||||
|
||||
const char *eventMethodName;
|
||||
JNIEnv *env = NULL;
|
||||
|
||||
|
||||
// map dispID to jmethodID
|
||||
for(int i=0;i<MethNum;i++)
|
||||
{
|
||||
if (MethID[i] == dispID) { meth = JMethID[i]; break; }
|
||||
if (MethID[i] == dispID) {
|
||||
USES_CONVERSION;
|
||||
eventMethodName = W2A((OLECHAR *)MethName[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!meth)
|
||||
{
|
||||
// user did not implement this method
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (DISPATCH_METHOD & wFlags)
|
||||
{
|
||||
// attach to the current running thread
|
||||
@@ -163,43 +124,41 @@ STDMETHODIMP EventProxy::Invoke(DISPID dispID, REFIID riid,
|
||||
jvm->AttachCurrentThread((void**)&env, NULL);
|
||||
#endif
|
||||
|
||||
if (!eventMethodName)
|
||||
{
|
||||
ThrowComFail(env, "Event method received was not defined as part of callback interface", -1);
|
||||
// user did not implement this method
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// get variant class
|
||||
jclass vClass = NULL;
|
||||
// do this in a JACOB 1.8 backwards compatable way
|
||||
// this succeeds if the class was loaded from the bootstrap class loader
|
||||
//vClass = env->FindClass("com/jacob/com/Variant");
|
||||
// this is guarenteed to work so there really isn't any need for the line above
|
||||
// but I don't want to bust anything so we leave it in
|
||||
// the following code exists to support launchers like JWS where jacob isn't
|
||||
// in the system classloader so we wouldn't be able to create a variant class
|
||||
if (vClass == NULL){
|
||||
// there will be a stored up exception if FindClass failed so lets clear it
|
||||
if (env->ExceptionOccurred()) { env->ExceptionClear(); }
|
||||
//printf("using variant class passed in via constructor\n");
|
||||
jclass javaVariantClass = env->GetObjectClass(javaVariantObj);
|
||||
if (javaVariantClass == NULL){ printf("can't figure out java Variant class"); }
|
||||
|
||||
// find the class of the InvocationHandler
|
||||
jclass javaSinkClass = env->GetObjectClass(javaSinkObj);
|
||||
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
|
||||
vClass = javaVariantClass;
|
||||
if (vClass == NULL){
|
||||
printf("This application is probably running from a launcher where system class loader knows not Jacob\n");
|
||||
printf("And for some reason we couldn't find the variant class from the passed in variant\n");
|
||||
}
|
||||
}
|
||||
|
||||
// how many params
|
||||
int num = pDispParams->cArgs;
|
||||
// and the constructor
|
||||
jmethodID vCons = env->GetMethodID(vClass, "<init>", "()V");
|
||||
jmethodID invokeMethod = env->GetMethodID(javaSinkClass, "invoke",
|
||||
"(Ljava/lang/String;[Lcom/jacob/com/Variant;)V");
|
||||
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
|
||||
jstring eventMethodNameAsString = env->NewStringUTF(eventMethodName);
|
||||
// now do what we need for the variant
|
||||
jmethodID getVariantMethod =
|
||||
env->GetMethodID(javaSinkClass, "getVariant", "()Lcom/jacob/com/Variant;");
|
||||
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
|
||||
jobject aVariantObj = env->CallObjectMethod(javaSinkObj, getVariantMethod);
|
||||
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
|
||||
jclass variantClass = env->GetObjectClass(aVariantObj);
|
||||
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
|
||||
|
||||
// create the variant parameter array
|
||||
// how many params
|
||||
int numVariantParams = pDispParams->cArgs;
|
||||
// make an array of them
|
||||
jobjectArray varr = env->NewObjectArray(num, vClass, 0);
|
||||
jobjectArray varr = env->NewObjectArray(numVariantParams, variantClass, 0);
|
||||
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
|
||||
int i,j;
|
||||
for(i=num-1,j=0;i>=0;i--,j++)
|
||||
for(i=numVariantParams-1,j=0;i>=0;i--,j++)
|
||||
{
|
||||
// construct a java variant holder
|
||||
jobject arg = env->NewObject(vClass, vCons);
|
||||
jobject arg = env->CallObjectMethod(javaSinkObj, getVariantMethod);
|
||||
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
|
||||
// get the empty variant from it
|
||||
VARIANT *va = extractVariant(env, arg);
|
||||
@@ -210,13 +169,15 @@ STDMETHODIMP EventProxy::Invoke(DISPID dispID, REFIID riid,
|
||||
env->DeleteLocalRef(arg);
|
||||
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
|
||||
}
|
||||
// call the method
|
||||
env->CallVoidMethod(javaSinkObj, meth, varr);
|
||||
env->CallVoidMethod(javaSinkObj, invokeMethod,
|
||||
eventMethodNameAsString, varr);
|
||||
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
|
||||
// don't need the first variant we created to get the class
|
||||
env->DeleteLocalRef(aVariantObj);
|
||||
if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();}
|
||||
|
||||
|
||||
// Begin code from Jiffie team that copies parameters back from java to COM
|
||||
for(i=num-1,j=0;i>=0;i--,j++)
|
||||
for(i=numVariantParams-1,j=0;i>=0;i--,j++)
|
||||
{
|
||||
jobject arg = env->GetObjectArrayElement(varr, j);
|
||||
VARIANT *java = extractVariant(env, arg);
|
||||
|
||||
@@ -1,38 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999 Dan Adler, 315 E72 St. NY, NY, 10021, USA.
|
||||
* mailto:danadler@rcn.com. All rights reserved.
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Redistribution of the JACOB software is not permitted as part of any
|
||||
* commercial product that is targeted primarily at Java developers.
|
||||
* Such products include, but are not limited to: Java virtual machines,
|
||||
* integrated development environments, code libraries, and application
|
||||
* server products. Licensing terms for such distribution may be
|
||||
* obtained from the copyright holder.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include <jni.h>
|
||||
#include <windows.h>
|
||||
@@ -54,25 +37,21 @@
|
||||
class EventProxy : public IDispatch
|
||||
{
|
||||
private:
|
||||
LONG m_cRef;
|
||||
LONG m_cRef; // a reference counter
|
||||
CComPtr<IConnectionPoint> pCP; // the connection point
|
||||
DWORD dwEventCookie; // connection point cookie
|
||||
jobject javaSinkObj; // the java object to delegate calls
|
||||
jclass javaSinkClass; // the java class of the object
|
||||
jobject javaVariantObj; // a variant object passed in so we can find Variant later
|
||||
|
||||
IID eventIID; // the interface iid passed in
|
||||
int MethNum;
|
||||
int MethNum; // number of methods in the callback interface
|
||||
CComBSTR *MethName; // Array of method names
|
||||
DISPID *MethID; // Array of method ids
|
||||
jmethodID *JMethID; // Array of java method ids
|
||||
JavaVM *jvm; // The java vm we are running
|
||||
DISPID *MethID; // Array of method ids, used to match invokations to method names
|
||||
JavaVM *jvm; // The java vm we are running
|
||||
public:
|
||||
// constuct with a global JNI ref to a sink object
|
||||
// to which we will delegate event callbacks
|
||||
EventProxy(JNIEnv *jenv,
|
||||
jobject aSinkObj,
|
||||
jobject aVariantObj,
|
||||
CComPtr<IConnectionPoint> pConn,
|
||||
IID eventIID,
|
||||
CComBSTR *mName,
|
||||
@@ -89,8 +68,11 @@ public:
|
||||
STDMETHODIMP_(ULONG) Release(void)
|
||||
{
|
||||
LONG res = InterlockedDecrement(&m_cRef);
|
||||
if (res == 0) delete this;
|
||||
if (res == 0) {
|
||||
delete this;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
STDMETHODIMP QueryInterface(REFIID rid, void **ppv);
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
To build, run:
|
||||
|
||||
nmake -f makefile
|
||||
|
||||
The following are hardcoded into the makefile, so you may have to
|
||||
change it. I developed this with the C++ compiler and ATL version
|
||||
that ship with VC++ 6.0, so I'm not sure if different versions will
|
||||
work.
|
||||
|
||||
I have compiled this against JDK 1.1.6 and 1.2.2 as well as Microsoft
|
||||
SDK for Java 3.2 as the JDK setting.
|
||||
|
||||
DEST_DIR is a destination directory into which to copy the final DLL.
|
||||
|
||||
JDK = d:\j2sdk1.4.2_06
|
||||
DEST_DIR = d:\jacob
|
||||
MSDEVDIR = d:\apps\\"Microsoft Visual Studio"\VC98
|
||||
36
jni/STA.cpp
36
jni/STA.cpp
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include <objbase.h>
|
||||
|
||||
20
jni/STA.h
20
jni/STA.h
@@ -1,4 +1,22 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include <jni.h>
|
||||
/* Header for class STA */
|
||||
|
||||
|
||||
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "SafeArray.h"
|
||||
// Win32 support for Ole Automation
|
||||
@@ -1598,6 +1588,11 @@ JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setDoubles
|
||||
* Class: SafeArray
|
||||
* Method: getString
|
||||
* Signature: (I)Ljava/lang/String;
|
||||
*
|
||||
* There is supposed to be a leak in here, SourceForge 1224219
|
||||
* that should be fixed with a call to
|
||||
* "StrFree, Release or VariantClear to release the memory"
|
||||
* waiting on the actual patch the submitter used before modifying this
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_com_jacob_com_SafeArray_getString__I
|
||||
(JNIEnv *env, jobject _this, jint idx)
|
||||
@@ -2439,4 +2434,506 @@ JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariants
|
||||
}
|
||||
}
|
||||
|
||||
/* PLEASE NOTE THE LINE:
|
||||
jint *jIndices = env->GetIntArrayElements(indices, NULL);
|
||||
which I added to replace "long idx[2] = {i,j};" from the 2D case.
|
||||
Not sure if this is correct. Also, check that I am doing the null test and
|
||||
dimension test correctly.
|
||||
*/
|
||||
|
||||
#define GETNDCODE(varType, varAccess, jtyp) \
|
||||
SAFEARRAY *sa = extractSA(env, _this); \
|
||||
if (!sa) { \
|
||||
ThrowComFail(env, "safearray object corrupted", -1); \
|
||||
return NULL; \
|
||||
} \
|
||||
jint *jIndices = env->GetIntArrayElements(indices, NULL); \
|
||||
if (!jIndices) { \
|
||||
ThrowComFail(env, "null indices array", -1); \
|
||||
return NULL; \
|
||||
} \
|
||||
if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) { \
|
||||
ThrowComFail(env, "safearray and indices array have different dimensions", -1); \
|
||||
return NULL; \
|
||||
} \
|
||||
VARTYPE vt; \
|
||||
SafeArrayGetVartype(sa, &vt); \
|
||||
if (vt == VT_VARIANT) { \
|
||||
VARIANT v; \
|
||||
VariantInit(&v); \
|
||||
SafeArrayGetElement(sa, jIndices, (void*) &v); \
|
||||
if (FAILED(VariantChangeType(&v, &v, 0, varType))) { \
|
||||
ThrowComFail(env, "VariantChangeType failed", -1); \
|
||||
return NULL; \
|
||||
} \
|
||||
return (jtyp)varAccess(&v); \
|
||||
} else if (vt == varType) { \
|
||||
jtyp jc; \
|
||||
SafeArrayGetElement(sa, jIndices, (void*) &jc); \
|
||||
return jc; \
|
||||
} else { \
|
||||
return NULL; \
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------
|
||||
|
||||
/* PLEASE NOTE THE LINE:
|
||||
jint *jIndices = env->GetIntArrayElements(indices, NULL);
|
||||
which I added to replace "long idx[2] = {i,j};" from the 2D case.
|
||||
Not sure if this is correct. Also, check that I am doing the null test and
|
||||
dimension test correctly.
|
||||
*/
|
||||
|
||||
#define SETNDCODE(varType, varAccess) \
|
||||
SAFEARRAY *sa = extractSA(env, _this); \
|
||||
if (!sa) { \
|
||||
ThrowComFail(env, "safearray object corrupted", -1); \
|
||||
return; \
|
||||
} \
|
||||
jint *jIndices = env->GetIntArrayElements(indices, NULL); \
|
||||
if (!jIndices) { \
|
||||
ThrowComFail(env, "null indices array", -1); \
|
||||
return; \
|
||||
} \
|
||||
if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) { \
|
||||
ThrowComFail(env, "safearray and indices array have different dimensions", -1); \
|
||||
return; \
|
||||
} \
|
||||
VARTYPE vt; \
|
||||
SafeArrayGetVartype(sa, &vt); \
|
||||
if (vt == VT_VARIANT) { \
|
||||
VARIANT v; \
|
||||
VariantInit(&v); \
|
||||
V_VT(&v) = varType; \
|
||||
varAccess(&v) = c; \
|
||||
SafeArrayPutElement(sa,jIndices,&v); \
|
||||
} else if (vt == varType) { \
|
||||
SafeArrayPutElement(sa, jIndices,&c); \
|
||||
} else { \
|
||||
ThrowComFail(env, "safearray type mismatch", -1); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getVariant
|
||||
* Signature: ([I)Lcom/jacob/com/Variant;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_getVariant___3I
|
||||
(JNIEnv *env, jobject _this, jintArray indices)
|
||||
{
|
||||
|
||||
SAFEARRAY *psa = extractSA(env, _this);
|
||||
if (!psa) {
|
||||
ThrowComFail(env, "safearray object corrupted", -1);
|
||||
return NULL;
|
||||
}
|
||||
VARTYPE vt;
|
||||
SafeArrayGetVartype(psa, &vt);
|
||||
|
||||
// ??? Not sure if this is correct type for call to SafeArrayGetElement()
|
||||
jint *jIndices = env->GetIntArrayElements(indices, NULL);
|
||||
|
||||
if (!jIndices) {
|
||||
ThrowComFail(env, "null indices array", -1);
|
||||
return NULL;
|
||||
}
|
||||
if (SafeArrayGetDim(psa) != env->GetArrayLength(indices)) {
|
||||
ThrowComFail(env, "safearray and indices array have different dimensions", -1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// prepare a new return value
|
||||
jclass variantClass = env->FindClass("com/jacob/com/Variant");
|
||||
jmethodID variantCons =
|
||||
env->GetMethodID(variantClass, "<init>", "()V");
|
||||
// construct a variant to return
|
||||
jobject newVariant = env->NewObject(variantClass, variantCons);
|
||||
// get the VARIANT from the newVariant
|
||||
VARIANT *v = extractVariant(env, newVariant);
|
||||
if (vt == VT_VARIANT) {
|
||||
SafeArrayGetElement(psa, jIndices, v);
|
||||
} else if (vt == VT_DISPATCH || vt == VT_UNKNOWN) {
|
||||
IDispatch *disp;
|
||||
SafeArrayGetElement(psa, jIndices, (void *)&disp);
|
||||
VariantClear(v); // whatever was there before
|
||||
V_VT(v) = VT_DISPATCH;
|
||||
V_DISPATCH(v) = disp;
|
||||
// I am handing the pointer to COM
|
||||
disp->AddRef();
|
||||
} else {
|
||||
ThrowComFail(env, "safearray type is not variant/dispatch", -1);
|
||||
}
|
||||
return newVariant;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setVariant
|
||||
* Signature: ([ILcom/jacob/com/Variant;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariant___3ILcom_jacob_com_Variant_2
|
||||
(JNIEnv *env, jobject _this, jintArray indices, jobject s)
|
||||
{
|
||||
|
||||
SAFEARRAY *sa = extractSA(env, _this);
|
||||
if (!sa) {
|
||||
ThrowComFail(env, "safearray object corrupted", -1);
|
||||
return;
|
||||
}
|
||||
|
||||
// ??? Not sure if this is correct type for call to SafeArrayGetElement()
|
||||
jint *jIndices = env->GetIntArrayElements(indices, NULL);
|
||||
|
||||
if (!jIndices) {
|
||||
ThrowComFail(env, "null indices array", -1);
|
||||
return;
|
||||
}
|
||||
if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) {
|
||||
ThrowComFail(env, "safearray and indices array have different dimensions", -1);
|
||||
return;
|
||||
}
|
||||
|
||||
VARTYPE vt;
|
||||
SafeArrayGetVartype(sa, &vt);
|
||||
|
||||
if (vt == VT_VARIANT) {
|
||||
VARIANT *v = extractVariant(env, s);
|
||||
SafeArrayPutElement(sa, jIndices, v);
|
||||
} else if (vt == VT_DISPATCH || vt == VT_UNKNOWN) {
|
||||
VARIANT *v = extractVariant(env, s);
|
||||
if (V_VT(v) != VT_DISPATCH) {
|
||||
ThrowComFail(env, "variant is not dispatch", -1);
|
||||
return;
|
||||
}
|
||||
IDispatch *disp = V_DISPATCH(v);
|
||||
SafeArrayPutElement(sa, jIndices, disp);
|
||||
} else {
|
||||
ThrowComFail(env, "safearray type is not variant/dispatch", -1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getChar
|
||||
* Signature: ([I)C
|
||||
*/
|
||||
JNIEXPORT jchar JNICALL Java_com_jacob_com_SafeArray_getChar___3I
|
||||
(JNIEnv *env, jobject _this, jintArray indices)
|
||||
{
|
||||
GETNDCODE(VT_UI2, V_UI2, jchar)
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setChar
|
||||
* Signature: ([IC)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setChar___3IC
|
||||
(JNIEnv *env, jobject _this, jintArray indices, jchar c)
|
||||
{
|
||||
SETNDCODE(VT_UI2, V_UI2);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getInt
|
||||
* Signature: ([I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getInt___3I
|
||||
(JNIEnv *env, jobject _this, jintArray indices)
|
||||
{
|
||||
GETNDCODE(VT_I4, V_I4, jint)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setInt
|
||||
* Signature: ([II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setInt___3II
|
||||
(JNIEnv *env, jobject _this, jintArray indices, jint c)
|
||||
{
|
||||
SETNDCODE(VT_I4, V_I4);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getShort
|
||||
* Signature: ([I)S
|
||||
*/
|
||||
JNIEXPORT jshort JNICALL Java_com_jacob_com_SafeArray_getShort___3I
|
||||
(JNIEnv *env, jobject _this, jintArray indices)
|
||||
{
|
||||
GETNDCODE(VT_I2, V_I2, jshort)
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setShort
|
||||
* Signature: ([IS)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setShort___3IS
|
||||
(JNIEnv *env, jobject _this, jintArray indices, jshort c)
|
||||
{
|
||||
SETNDCODE(VT_I2, V_I2);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getDouble
|
||||
* Signature: ([I)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL Java_com_jacob_com_SafeArray_getDouble___3I
|
||||
(JNIEnv *env, jobject _this, jintArray indices)
|
||||
{
|
||||
GETNDCODE(VT_R8, V_R8, jdouble)
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setDouble
|
||||
* Signature: ([ID)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setDouble___3ID
|
||||
(JNIEnv *env, jobject _this, jintArray indices, jdouble c)
|
||||
{
|
||||
SETNDCODE(VT_R8, V_R8);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getString
|
||||
* Signature: ([I)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_com_jacob_com_SafeArray_getString___3I
|
||||
(JNIEnv *env, jobject _this, jintArray indices)
|
||||
{
|
||||
SAFEARRAY *psa = extractSA(env, _this);
|
||||
if (!psa) {
|
||||
ThrowComFail(env, "safearray object corrupted", -1); \
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// ??? Not sure if this is correct type for call to SafeArrayGetElement()
|
||||
jint *jIndices = env->GetIntArrayElements(indices, NULL);
|
||||
|
||||
if (!jIndices) {
|
||||
ThrowComFail(env, "null indices array", -1);
|
||||
return NULL;
|
||||
}
|
||||
if (SafeArrayGetDim(psa) != env->GetArrayLength(indices)) {
|
||||
ThrowComFail(env, "safearray and indices array have different dimensions", -1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
VARTYPE vt;
|
||||
SafeArrayGetVartype(psa, &vt);
|
||||
if (vt == VT_VARIANT) {
|
||||
VARIANT v;
|
||||
VariantInit(&v);
|
||||
SafeArrayGetElement(psa, jIndices, &v);
|
||||
if (FAILED(VariantChangeType(&v, &v, 0, VT_BSTR))) {
|
||||
return NULL;
|
||||
}
|
||||
BSTR bs = V_BSTR(&v);
|
||||
jstring js = env->NewString(bs, SysStringLen(bs));
|
||||
return js;
|
||||
} else if (vt == VT_BSTR) {
|
||||
BSTR bs = NULL;
|
||||
SafeArrayGetElement(psa, jIndices, &bs);
|
||||
jstring js = env->NewString(bs, SysStringLen(bs));
|
||||
return js;
|
||||
}
|
||||
ThrowComFail(env, "safearray cannot get string", 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setString
|
||||
* Signature: ([ILjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setString___3ILjava_lang_String_2
|
||||
(JNIEnv *env, jobject _this, jintArray indices, jstring s)
|
||||
{
|
||||
SAFEARRAY *sa = extractSA(env, _this);
|
||||
if (!sa) {
|
||||
ThrowComFail(env, "safearray object corrupted", -1);
|
||||
return;
|
||||
}
|
||||
|
||||
// ??? Not sure if this is correct type for call to SafeArrayGetElement()
|
||||
jint *jIndices = env->GetIntArrayElements(indices, NULL);
|
||||
|
||||
if (!jIndices) {
|
||||
ThrowComFail(env, "null indices array", -1);
|
||||
return;
|
||||
}
|
||||
if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) {
|
||||
ThrowComFail(env, "safearray and indices array have different dimensions", -1);
|
||||
return;
|
||||
}
|
||||
|
||||
VARTYPE vt;
|
||||
SafeArrayGetVartype(sa, &vt);
|
||||
if (vt == VT_VARIANT) {
|
||||
VARIANT v;
|
||||
VariantInit(&v);
|
||||
const char *str = env->GetStringUTFChars(s, NULL);
|
||||
CComBSTR bs(str);
|
||||
V_VT(&v) = VT_BSTR;
|
||||
V_BSTR(&v) = bs.Copy();
|
||||
SafeArrayPutElement(sa, jIndices,&v);
|
||||
env->ReleaseStringUTFChars(s, str);
|
||||
VariantClear(&v);
|
||||
} else if (vt == VT_BSTR) {
|
||||
const char *str = env->GetStringUTFChars(s, NULL);
|
||||
CComBSTR bs(str);
|
||||
SafeArrayPutElement(sa, jIndices,bs.Detach());
|
||||
env->ReleaseStringUTFChars(s, str);
|
||||
} else {
|
||||
ThrowComFail(env, "safearray cannot set string", 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getByte
|
||||
* Signature: ([I)B
|
||||
*/
|
||||
JNIEXPORT jbyte JNICALL Java_com_jacob_com_SafeArray_getByte___3I
|
||||
(JNIEnv *env, jobject _this, jintArray indices)
|
||||
{
|
||||
GETNDCODE(VT_UI1, V_UI1, jbyte)
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setByte
|
||||
* Signature: ([IB)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setByte___3IB
|
||||
(JNIEnv *env, jobject _this, jintArray indices, jbyte c)
|
||||
{
|
||||
SETNDCODE(VT_UI1, V_UI1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getFloat
|
||||
* Signature: ([I)F
|
||||
*/
|
||||
JNIEXPORT jfloat JNICALL Java_com_jacob_com_SafeArray_getFloat___3I
|
||||
(JNIEnv *env, jobject _this, jintArray indices)
|
||||
{
|
||||
GETNDCODE(VT_R4, V_R4, jfloat)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setFloat
|
||||
* Signature: ([IF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setFloat___3IF
|
||||
(JNIEnv *env, jobject _this, jintArray indices, jfloat c)
|
||||
{
|
||||
SETNDCODE(VT_R4, V_R4);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getBoolean
|
||||
* Signature: ([I)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_com_jacob_com_SafeArray_getBoolean___3I
|
||||
(JNIEnv *env, jobject _this, jintArray indices)
|
||||
{
|
||||
// code is inline because of size mismatch
|
||||
SAFEARRAY *sa = extractSA(env, _this);
|
||||
if (!sa) {
|
||||
ThrowComFail(env, "safearray object corrupted", -1);
|
||||
return NULL;
|
||||
}
|
||||
// ??? Not sure if this is correct type for call to SafeArrayGetElement()
|
||||
jint *jIndices = env->GetIntArrayElements(indices, NULL);
|
||||
|
||||
if (!jIndices) {
|
||||
ThrowComFail(env, "null indices array", -1);
|
||||
return NULL;
|
||||
}
|
||||
if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) {
|
||||
ThrowComFail(env, "safearray and indices array have different dimensions", -1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
VARTYPE vt;
|
||||
SafeArrayGetVartype(sa, &vt);
|
||||
if (vt == VT_VARIANT) {
|
||||
VARIANT v;
|
||||
VariantInit(&v);
|
||||
SafeArrayGetElement(sa, jIndices, (void*) &v);
|
||||
if (FAILED(VariantChangeType(&v, &v, 0, VT_BOOL))) {
|
||||
ThrowComFail(env, "safearray change type failed", -1);
|
||||
return NULL;
|
||||
}
|
||||
jboolean jb = V_BOOL(&v) == VARIANT_TRUE ? JNI_TRUE: JNI_FALSE;
|
||||
return jb;
|
||||
} else if (vt == VT_BOOL) {
|
||||
VARIANT_BOOL vb;
|
||||
SafeArrayGetElement(sa, jIndices, (void*) &vb);
|
||||
jboolean jb = vb == VARIANT_TRUE ? JNI_TRUE: JNI_FALSE;
|
||||
return jb;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setBoolean
|
||||
* Signature: ([IZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setBoolean___3IZ
|
||||
(JNIEnv *env, jobject _this, jintArray indices, jboolean c)
|
||||
{
|
||||
// code is inline because of size mismatch
|
||||
SAFEARRAY *sa = extractSA(env, _this);
|
||||
if (!sa) {
|
||||
ThrowComFail(env, "safearray object corrupted", -1);
|
||||
return;
|
||||
}
|
||||
// ??? Not sure if this is correct type for call to SafeArrayGetElement()
|
||||
jint *jIndices = env->GetIntArrayElements(indices, NULL);
|
||||
|
||||
if (!jIndices) {
|
||||
ThrowComFail(env, "null indices array", -1);
|
||||
return;
|
||||
}
|
||||
if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) {
|
||||
ThrowComFail(env, "safearray and indices array have different dimensions", -1);
|
||||
return;
|
||||
}
|
||||
|
||||
VARTYPE vt;
|
||||
SafeArrayGetVartype(sa, &vt);
|
||||
if (vt == VT_VARIANT) {
|
||||
VARIANT v;
|
||||
VariantInit(&v);
|
||||
V_VT(&v) = VT_BOOL;
|
||||
V_BOOL(&v) = c == JNI_TRUE ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
SafeArrayPutElement(sa,jIndices,&v);
|
||||
} else if (vt == VT_BOOL) {
|
||||
VARIANT_BOOL vb = c == JNI_TRUE ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
SafeArrayPutElement(sa,jIndices,&vb);
|
||||
} else {
|
||||
ThrowComFail(env, "safearray type mismatch", -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
182
jni/SafeArray.h
182
jni/SafeArray.h
@@ -1,4 +1,22 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include <jni.h>
|
||||
/* Header for class com_jacob_com_SafeArray */
|
||||
|
||||
@@ -7,6 +25,10 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Inaccessible static: buildVersion */
|
||||
/* Inaccessible static: buildDate */
|
||||
/* Inaccessible static: DEBUG */
|
||||
/* Inaccessible static: class_00024com_00024jacob_00024com_00024JacobObject */
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: init
|
||||
@@ -42,7 +64,7 @@ JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getvt
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: reinit
|
||||
* Signature: (Lcom_jacob_com_SafeArray;)V
|
||||
* Signature: (Lcom/jacob/com/SafeArray;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_reinit
|
||||
(JNIEnv *, jobject, jobject);
|
||||
@@ -178,7 +200,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromBooleanArray
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: fromVariantArray
|
||||
* Signature: ([LVariant;)V
|
||||
* Signature: ([Lcom/jacob/com/Variant;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromVariantArray
|
||||
(JNIEnv *, jobject, jobjectArray);
|
||||
@@ -250,7 +272,7 @@ JNIEXPORT jbooleanArray JNICALL Java_com_jacob_com_SafeArray_toBooleanArray
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: toVariantArray
|
||||
* Signature: ()[LVariant;
|
||||
* Signature: ()[Lcom/jacob/com/Variant;
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL Java_com_jacob_com_SafeArray_toVariantArray
|
||||
(JNIEnv *, jobject);
|
||||
@@ -642,7 +664,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setBooleans
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getVariant
|
||||
* Signature: (I)LVariant;
|
||||
* Signature: (I)Lcom/jacob/com/Variant;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_getVariant__I
|
||||
(JNIEnv *, jobject, jint);
|
||||
@@ -650,7 +672,7 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_getVariant__I
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getVariant
|
||||
* Signature: (II)LVariant;
|
||||
* Signature: (II)Lcom/jacob/com/Variant;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_getVariant__II
|
||||
(JNIEnv *, jobject, jint, jint);
|
||||
@@ -674,7 +696,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariant__IILcom_jacob_com
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getVariants
|
||||
* Signature: (II[LVariant;I)V
|
||||
* Signature: (II[Lcom/jacob/com/Variant;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getVariants
|
||||
(JNIEnv *, jobject, jint, jint, jobjectArray, jint);
|
||||
@@ -682,11 +704,155 @@ JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getVariants
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setVariants
|
||||
* Signature: (II[LVariant;I)V
|
||||
* Signature: (II[Lcom/jacob/com/Variant;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariants
|
||||
(JNIEnv *, jobject, jint, jint, jobjectArray, jint);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getVariant
|
||||
* Signature: ([I)Lcom/jacob/com/Variant;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_getVariant___3I
|
||||
(JNIEnv *, jobject, jintArray);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setVariant
|
||||
* Signature: ([ILcom/jacob/com/Variant;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariant___3ILcom_jacob_com_Variant_2
|
||||
(JNIEnv *, jobject, jintArray, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getChar
|
||||
* Signature: ([I)C
|
||||
*/
|
||||
JNIEXPORT jchar JNICALL Java_com_jacob_com_SafeArray_getChar___3I
|
||||
(JNIEnv *, jobject, jintArray);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setChar
|
||||
* Signature: ([IC)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setChar___3IC
|
||||
(JNIEnv *, jobject, jintArray, jchar);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getInt
|
||||
* Signature: ([I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getInt___3I
|
||||
(JNIEnv *, jobject, jintArray);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setInt
|
||||
* Signature: ([II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setInt___3II
|
||||
(JNIEnv *, jobject, jintArray, jint);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getShort
|
||||
* Signature: ([I)S
|
||||
*/
|
||||
JNIEXPORT jshort JNICALL Java_com_jacob_com_SafeArray_getShort___3I
|
||||
(JNIEnv *, jobject, jintArray);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setShort
|
||||
* Signature: ([IS)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setShort___3IS
|
||||
(JNIEnv *, jobject, jintArray, jshort);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getDouble
|
||||
* Signature: ([I)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL Java_com_jacob_com_SafeArray_getDouble___3I
|
||||
(JNIEnv *, jobject, jintArray);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setDouble
|
||||
* Signature: ([ID)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setDouble___3ID
|
||||
(JNIEnv *, jobject, jintArray, jdouble);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getString
|
||||
* Signature: ([I)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_com_jacob_com_SafeArray_getString___3I
|
||||
(JNIEnv *, jobject, jintArray);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setString
|
||||
* Signature: ([ILjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setString___3ILjava_lang_String_2
|
||||
(JNIEnv *, jobject, jintArray, jstring);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getByte
|
||||
* Signature: ([I)B
|
||||
*/
|
||||
JNIEXPORT jbyte JNICALL Java_com_jacob_com_SafeArray_getByte___3I
|
||||
(JNIEnv *, jobject, jintArray);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setByte
|
||||
* Signature: ([IB)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setByte___3IB
|
||||
(JNIEnv *, jobject, jintArray, jbyte);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getFloat
|
||||
* Signature: ([I)F
|
||||
*/
|
||||
JNIEXPORT jfloat JNICALL Java_com_jacob_com_SafeArray_getFloat___3I
|
||||
(JNIEnv *, jobject, jintArray);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setFloat
|
||||
* Signature: ([IF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setFloat___3IF
|
||||
(JNIEnv *, jobject, jintArray, jfloat);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: getBoolean
|
||||
* Signature: ([I)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_com_jacob_com_SafeArray_getBoolean___3I
|
||||
(JNIEnv *, jobject, jintArray);
|
||||
|
||||
/*
|
||||
* Class: com_jacob_com_SafeArray
|
||||
* Method: setBoolean
|
||||
* Signature: ([IZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setBoolean___3IZ
|
||||
(JNIEnv *, jobject, jintArray, jboolean);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// stdafx.pch will be the pre-compiled header
|
||||
|
||||
19
jni/StdAfx.h
19
jni/StdAfx.h
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently,
|
||||
// but are changed infrequently
|
||||
|
||||
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "Variant.h"
|
||||
@@ -379,7 +369,12 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putStringRef
|
||||
VariantClear(v); // whatever was there before
|
||||
|
||||
const jchar *cStr = env->GetStringChars(s,NULL);
|
||||
CComBSTR bs(cStr);
|
||||
// SF 1314116
|
||||
// DBeck: 2005-09-23: changed CComBSTR c-tor to accept
|
||||
// Unicode string (no terminating NULL) provided by GetStringChars
|
||||
const jsize numChars = env->GetStringLength(s);
|
||||
//CComBSTR bs(cStr);
|
||||
CComBSTR bs( numChars, cStr );
|
||||
|
||||
BSTR *pbs = (BSTR *)CoTaskMemAlloc(sizeof(BSTR));
|
||||
bs.CopyTo(pbs);
|
||||
@@ -882,7 +877,12 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putString
|
||||
V_VT(v) = VT_BSTR;
|
||||
|
||||
const jchar *cStr = env->GetStringChars(s,NULL);
|
||||
CComBSTR bs(cStr);
|
||||
// SF 1314116
|
||||
// DBeck: 2005-09-23: changed CComBSTR c-tor to accept
|
||||
// Unicode string (no terminating NULL) provided by GetStringChars
|
||||
const jsize numChars = env->GetStringLength(s);
|
||||
//CComBSTR bs(cStr);
|
||||
CComBSTR bs( numChars, cStr );
|
||||
|
||||
V_VT(v) = VT_BSTR;
|
||||
V_BSTR(v) = bs.Copy();
|
||||
|
||||
@@ -1,4 +1,22 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include <jni.h>
|
||||
/* Header for class com_jacob_com_Variant */
|
||||
|
||||
|
||||
49
jni/makefile
49
jni/makefile
@@ -1,49 +0,0 @@
|
||||
JDK = c:\j2sdk1.4.2_07
|
||||
MSDEVDIR = c:\\"Microsoft Visual Studio"\VC98
|
||||
|
||||
JDK_INC = -I$(JDK)\include -I$(JDK)\include\win32
|
||||
JDK_LIB = $(JDK)\lib\jvm.lib
|
||||
MS_INC = -I$(MSDEVDIR)\Include -I$(MSDEVDIR)\ATL\Include
|
||||
SYS_LIB = oleaut32.lib ole32.lib uuid.lib kernel32.lib shell32.lib user32.lib
|
||||
OPT = /O2
|
||||
CC = $(MSDEVDIR)\bin\cl $(OPT) $(JDK_INC) $(MS_INC)
|
||||
|
||||
OBJFILES = stdafx.obj util.obj EventProxy.obj Variant.obj Dispatch.obj SafeArray.obj DispatchEvents.obj ComThread.obj EnumVariant.obj STA.obj DispatchProxy.obj
|
||||
|
||||
all: jacob.dll
|
||||
|
||||
jacob.dll: $(OBJFILES)
|
||||
$(MSDEVDIR)\bin\link /dll /out:jacob.dll $(OBJFILES) $(JDK_LIB) $(SYS_LIB)
|
||||
|
||||
stdafx.obj: stdafx.cpp *.h
|
||||
$(CC) -c stdafx.cpp
|
||||
|
||||
util.obj: util.cpp *.h
|
||||
$(CC) -c util.cpp
|
||||
|
||||
EventProxy.obj: EventProxy.cpp *.h
|
||||
$(CC) -c EventProxy.cpp
|
||||
|
||||
Variant.obj: Variant.cpp *.h
|
||||
$(CC) -c Variant.cpp
|
||||
|
||||
Dispatch.obj: Dispatch.cpp *.h
|
||||
$(CC) -c Dispatch.cpp
|
||||
|
||||
SafeArray.obj: SafeArray.cpp *.h
|
||||
$(CC) -c SafeArray.cpp
|
||||
|
||||
DispatchEvents.obj: DispatchEvents.cpp *.h
|
||||
$(CC) -c DispatchEvents.cpp
|
||||
|
||||
ComThread.obj: ComThread.cpp *.h
|
||||
$(CC) -c ComThread.cpp
|
||||
|
||||
EnumVariant.obj: EnumVariant.cpp *.h
|
||||
$(CC) -c EnumVariant.cpp
|
||||
|
||||
STA.obj: STA.cpp *.h
|
||||
$(CC) -c STA.cpp
|
||||
|
||||
DispatchProxy.obj: DispatchProxy.cpp *.h
|
||||
$(CC) -c DispatchProxy.cpp
|
||||
36
jni/util.cpp
36
jni/util.cpp
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "Dispatch.h"
|
||||
// Win32 support for Ole Automation
|
||||
|
||||
19
jni/util.h
19
jni/util.h
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include <objbase.h>
|
||||
extern "C" {
|
||||
VARIANT *extractVariant(JNIEnv *env, jobject arg);
|
||||
|
||||
2
lib/README.txt
Normal file
2
lib/README.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Placeholder class to retain directory in CVS so build scripts will work.
|
||||
Part of directory standardization effort with jacobgen
|
||||
@@ -1,8 +1,13 @@
|
||||
package com.jacob.samples.test;
|
||||
package com.jacob.samples.access;
|
||||
|
||||
import com.jacob.com.*;
|
||||
import com.jacob.activeX.*;
|
||||
|
||||
/**
|
||||
* this
|
||||
* @author joe
|
||||
*
|
||||
*/
|
||||
class Access
|
||||
{
|
||||
/**
|
||||
@@ -13,9 +18,15 @@ class Access
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
ComThread.InitSTA();
|
||||
ActiveXComponent ax = new ActiveXComponent("DAO.PrivateDBEngine");
|
||||
// this only works for access files pre-access-2000
|
||||
Dispatch db = open(ax, ".\\sample2.mdb");
|
||||
// original test used this
|
||||
// ActiveXComponent ax = new ActiveXComponent("DAO.PrivateDBEngine");
|
||||
// my xp box with a later release of access needed this
|
||||
ActiveXComponent ax = new ActiveXComponent("DAO.PrivateDBEngine.35");
|
||||
// this only works for access files pre-access-2000
|
||||
// this line doesn't work on my xp box in Eclipse
|
||||
//Dispatch db = open(ax, ".\\sample2.mdb");
|
||||
// this works when running in eclipse because the test cases run pwd project root
|
||||
Dispatch db = open(ax, "samples/com/jacob/samples/access/sample2.mdb");
|
||||
String sql = "select * from MainTable";
|
||||
// make a temporary querydef
|
||||
Dispatch qd = Dispatch.call(db, "CreateQueryDef","").toDispatch();
|
||||
@@ -23,9 +34,10 @@ class Access
|
||||
Dispatch.put(qd, "SQL", sql);
|
||||
Variant result = getByQueryDef(qd);
|
||||
// the 2-d safearray is transposed from what you might expect
|
||||
System.out.println(result.toSafeArray());
|
||||
System.out.println("resulting array is "+result.toSafeArray());
|
||||
close(db);
|
||||
ComThread.Release();
|
||||
System.out.println("about to call ComThread.Release()");
|
||||
ComThread.Release();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -18,10 +18,7 @@ public class Command extends Dispatch
|
||||
*/
|
||||
public Command(Dispatch dispatchTarget)
|
||||
{
|
||||
// take over the IDispatch pointer
|
||||
m_pDispatch = dispatchTarget.m_pDispatch;
|
||||
// null out the input's pointer
|
||||
dispatchTarget.m_pDispatch = 0;
|
||||
super(dispatchTarget);
|
||||
}
|
||||
|
||||
public Variant getProperties()
|
||||
|
||||
@@ -17,10 +17,7 @@ public class Connection extends Dispatch
|
||||
*/
|
||||
public Connection(Dispatch d)
|
||||
{
|
||||
// take over the IDispatch pointer
|
||||
m_pDispatch = d.m_pDispatch;
|
||||
// null out the input's pointer
|
||||
d.m_pDispatch = 0;
|
||||
super(d);
|
||||
}
|
||||
|
||||
// need to wrap Properties
|
||||
|
||||
@@ -11,10 +11,7 @@ public class Field extends Dispatch
|
||||
*/
|
||||
public Field(Dispatch d)
|
||||
{
|
||||
// take over the IDispatch pointer
|
||||
m_pDispatch = d.m_pDispatch;
|
||||
// null out the input's pointer
|
||||
d.m_pDispatch = 0;
|
||||
super(d);
|
||||
}
|
||||
|
||||
public Variant getProperties()
|
||||
|
||||
@@ -11,10 +11,7 @@ public class Fields extends Dispatch
|
||||
*/
|
||||
public Fields(Dispatch d)
|
||||
{
|
||||
// take over the IDispatch pointer
|
||||
m_pDispatch = d.m_pDispatch;
|
||||
// null out the input's pointer
|
||||
d.m_pDispatch = 0;
|
||||
super(d);
|
||||
}
|
||||
|
||||
public int getCount()
|
||||
|
||||
@@ -16,10 +16,7 @@ public class Recordset extends Dispatch
|
||||
*/
|
||||
public Recordset(Dispatch d)
|
||||
{
|
||||
// take over the IDispatch pointer
|
||||
m_pDispatch = d.m_pDispatch;
|
||||
// null out the input's pointer
|
||||
d.m_pDispatch = 0;
|
||||
super(d);
|
||||
}
|
||||
|
||||
public Variant getProperties()
|
||||
|
||||
@@ -10,40 +10,46 @@ import com.jacob.activeX.*;
|
||||
/**
|
||||
* Applet test case
|
||||
*/
|
||||
public class AppTest extends Applet implements ActionListener
|
||||
{
|
||||
TextField in;
|
||||
TextField out;
|
||||
Button calc;
|
||||
ActiveXComponent sC = null;
|
||||
Dispatch sControl = null;
|
||||
public class AppTest extends Applet implements ActionListener {
|
||||
/**
|
||||
* unique identifier added by Eclipse because this class is serializable
|
||||
*/
|
||||
private static final long serialVersionUID = -6676420357823607065L;
|
||||
|
||||
/**
|
||||
* startup method
|
||||
*/
|
||||
public void init()
|
||||
{
|
||||
setLayout(new FlowLayout());
|
||||
add(in = new TextField("1+1", 16));
|
||||
add(out = new TextField("?", 16));
|
||||
add(calc = new Button("Calculate"));
|
||||
calc.addActionListener(this);
|
||||
TextField in;
|
||||
|
||||
}
|
||||
TextField out;
|
||||
|
||||
/**
|
||||
* action method that receives button actions
|
||||
* @param ev the event
|
||||
*/
|
||||
public void actionPerformed(ActionEvent ev)
|
||||
{
|
||||
if (sC == null) {
|
||||
String lang = "VBScript";
|
||||
sC = new ActiveXComponent("ScriptControl");
|
||||
sControl = sC.getObject();
|
||||
Dispatch.put(sControl, "Language", lang);
|
||||
Button calc;
|
||||
|
||||
ActiveXComponent sC = null;
|
||||
|
||||
Dispatch sControl = null;
|
||||
|
||||
/**
|
||||
* startup method
|
||||
*/
|
||||
public void init() {
|
||||
setLayout(new FlowLayout());
|
||||
add(in = new TextField("1+1", 16));
|
||||
add(out = new TextField("?", 16));
|
||||
add(calc = new Button("Calculate"));
|
||||
calc.addActionListener(this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* action method that receives button actions
|
||||
* @param ev the event
|
||||
*/
|
||||
public void actionPerformed(ActionEvent ev) {
|
||||
if (sC == null) {
|
||||
String lang = "VBScript";
|
||||
sC = new ActiveXComponent("ScriptControl");
|
||||
sControl = sC.getObject();
|
||||
Dispatch.put(sControl, "Language", lang);
|
||||
}
|
||||
Variant v = Dispatch.call(sControl, "Eval", in.getText());
|
||||
out.setText(v.toString());
|
||||
}
|
||||
Variant v = Dispatch.call(sControl, "Eval", in.getText());
|
||||
out.setText(v.toString());
|
||||
}
|
||||
}
|
||||
|
||||
47
samples/com/jacob/samples/office/ExcelDispatchTest.java
Normal file
47
samples/com/jacob/samples/office/ExcelDispatchTest.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package com.jacob.samples.office;
|
||||
|
||||
import com.jacob.com.*;
|
||||
import com.jacob.activeX.*;
|
||||
|
||||
/**
|
||||
* Sample test program snagged out of a question on the sun discussion area.
|
||||
* Run options...
|
||||
* -Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=false -Dcom.jacob.debug=true
|
||||
* @author joe
|
||||
*
|
||||
*/
|
||||
public class ExcelDispatchTest {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
ComThread.InitSTA();
|
||||
|
||||
ActiveXComponent xl = new ActiveXComponent("Excel.Application");
|
||||
try {
|
||||
System.out.println("version="+xl.getProperty("Version"));
|
||||
System.out.println("version="+Dispatch.get(xl, "Version"));
|
||||
Dispatch.put(xl, "Visible", new Variant(true));
|
||||
Dispatch workbooks = xl.getProperty("Workbooks").toDispatch();
|
||||
Dispatch workbook = Dispatch.get(workbooks,"Add").toDispatch();
|
||||
Dispatch sheet = Dispatch.get(workbook,"ActiveSheet").toDispatch();
|
||||
Dispatch a1 = Dispatch.invoke(sheet, "Range", Dispatch.Get,
|
||||
new Object[] {"A1"},
|
||||
new int[1]).toDispatch();
|
||||
Dispatch a2 = Dispatch.invoke(sheet, "Range", Dispatch.Get,
|
||||
new Object[] {"A2"},
|
||||
new int[1]).toDispatch();
|
||||
Dispatch.put(a1, "Value", "123.456");
|
||||
Dispatch.put(a2, "Formula", "=A1*2");
|
||||
System.out.println("a1 from excel:"+Dispatch.get(a1, "Value"));
|
||||
System.out.println("a2 from excel:"+Dispatch.get(a2, "Value"));
|
||||
Variant f = new Variant(false);
|
||||
Dispatch.call(workbook, "Close", f);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
xl.invoke("Quit", new Variant[] {});
|
||||
ComThread.Release();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
163
samples/com/jacob/samples/office/WordDocumentProperties.java
Normal file
163
samples/com/jacob/samples/office/WordDocumentProperties.java
Normal file
@@ -0,0 +1,163 @@
|
||||
package com.jacob.samples.office;
|
||||
|
||||
import com.jacob.activeX.ActiveXComponent;
|
||||
import com.jacob.com.ComFailException;
|
||||
import com.jacob.com.Dispatch;
|
||||
import com.jacob.com.Variant;
|
||||
|
||||
/**
|
||||
* Submitted to the Jacob SourceForge web site as a sample 3/2005
|
||||
*
|
||||
* @author Date Created Description Jason Twist 04 Mar 2005 Code opens a locally
|
||||
* stored Word document and extracts the Built In properties and Custom
|
||||
* properties from it. This code just gives an intro to JACOB and there
|
||||
* are sections that could be enhanced
|
||||
*/
|
||||
public class WordDocumentProperties {
|
||||
//Declare word object
|
||||
private ActiveXComponent objWord;
|
||||
|
||||
//Declare Word Properties
|
||||
private Dispatch custDocprops;
|
||||
|
||||
private Dispatch builtInDocProps;
|
||||
|
||||
//the doucments object is important in any real app but this demo doesn't use it
|
||||
//private Dispatch documents;
|
||||
|
||||
private Dispatch document;
|
||||
|
||||
private Dispatch wordObject;
|
||||
|
||||
/**
|
||||
* Empty Constructor
|
||||
*
|
||||
*/
|
||||
public WordDocumentProperties() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a document
|
||||
*
|
||||
* @param filename
|
||||
*/
|
||||
public void open(String filename) {
|
||||
//Instantiate objWord
|
||||
objWord = new ActiveXComponent("Word.Application");
|
||||
|
||||
//Assign a local word object
|
||||
wordObject = objWord.getObject();
|
||||
|
||||
//Create a Dispatch Parameter to hide the document that is opened
|
||||
Dispatch.put((Dispatch) wordObject, "Visible", new Variant(false));
|
||||
|
||||
//Instantiate the Documents Property
|
||||
Dispatch documents = objWord.getProperty("Documents").toDispatch();
|
||||
|
||||
//Open a word document, Current Active Document
|
||||
document = Dispatch.call(documents, "Open", filename).toDispatch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of the VBA CustomDocumentProperties property
|
||||
*
|
||||
*/
|
||||
public void selectCustomDocumentProperitiesMode() {
|
||||
//Create CustomDocumentProperties and BuiltInDocumentProperties
|
||||
// properties
|
||||
custDocprops = Dispatch.get(document, "CustomDocumentProperties")
|
||||
.toDispatch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of the VBA BuiltInDocumentProperties property
|
||||
*
|
||||
*/
|
||||
public void selectBuiltinPropertiesMode() {
|
||||
//Create CustomDocumentProperties and BuiltInDocumentProperties
|
||||
// properties
|
||||
builtInDocProps = Dispatch.get(document, "BuiltInDocumentProperties")
|
||||
.toDispatch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes a document
|
||||
*
|
||||
*/
|
||||
public void close() {
|
||||
//Close object
|
||||
Dispatch.call(document, "Close");
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom Property Name is passed in
|
||||
*
|
||||
* @param cusPropName
|
||||
* @return String - Custom property value
|
||||
*/
|
||||
public String getCustomProperty(String cusPropName) {
|
||||
try {
|
||||
cusPropName = Dispatch.call((Dispatch) custDocprops, "Item",
|
||||
cusPropName).toString();
|
||||
} catch (ComFailException e) {
|
||||
// Do nothing
|
||||
cusPropName = null;
|
||||
}
|
||||
|
||||
return cusPropName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Built In Property Name is passed in
|
||||
*
|
||||
* @param builtInPropName
|
||||
* @return String - Built in property value
|
||||
*/
|
||||
public String getBuiltInProperty(String builtInPropName) {
|
||||
try {
|
||||
builtInPropName = Dispatch.call((Dispatch) builtInDocProps, "Item",
|
||||
builtInPropName).toString();
|
||||
} catch (ComFailException e) {
|
||||
// Do nothing
|
||||
builtInPropName = null;
|
||||
}
|
||||
|
||||
return builtInPropName;
|
||||
}
|
||||
|
||||
/**
|
||||
* simple main program that gets some properties and prints them out
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
//Instantiate the class
|
||||
WordDocumentProperties jacTest = new WordDocumentProperties();
|
||||
|
||||
//Open the word doc
|
||||
jacTest.open("\\\\Saturn\\documentstorage\\s.doc");
|
||||
|
||||
//Set Custom Properties
|
||||
jacTest.selectCustomDocumentProperitiesMode();
|
||||
|
||||
//Set Built In Properties
|
||||
jacTest.selectBuiltinPropertiesMode();
|
||||
|
||||
//Get custom Property Value
|
||||
String custValue = jacTest.getCustomProperty("Information Source");
|
||||
|
||||
//Get built in prroperty Property Value
|
||||
String builtInValue = jacTest.getBuiltInProperty("Author");
|
||||
|
||||
//Close Word Doc
|
||||
jacTest.close();
|
||||
|
||||
//Output data
|
||||
System.out.println("Document Val One: " + custValue);
|
||||
System.out.println("Document Author: " + builtInValue);
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
This sample runs in Weblogic 5.1 as a servlet.
|
||||
|
||||
0. Rename JacobScript.java_nocompile to JacobScript.java
|
||||
1. Compile this file (make sure you have jdk1.2 installed or the
|
||||
javax.servlet.* classes in your classpath).
|
||||
2. Make sure the weblogic policy file allows native access. The easiest
|
||||
|
||||
@@ -2,12 +2,15 @@ package com.jacob.samples.test;
|
||||
|
||||
import com.jacob.com.*;
|
||||
import com.jacob.activeX.*;
|
||||
/*
|
||||
/**
|
||||
* This demonstrates the new event handling code in jacob 1.7
|
||||
* This example will open up IE and print out some of the events
|
||||
* it listens to as it havigates to web sites.
|
||||
* contributed by Niels Olof Bouvin mailto:n.o.bouvin@daimi.au.dk
|
||||
* and Henning Jae jehoej@daimi.au.dk
|
||||
* <P>
|
||||
* You can run this in eclipse with the command line options
|
||||
* <code> -Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=false </code>
|
||||
*/
|
||||
|
||||
class IETest
|
||||
@@ -15,14 +18,14 @@ class IETest
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// this line starts the pump but it runs fine without it
|
||||
//ComThread.startMainSTA();
|
||||
ComThread.startMainSTA();
|
||||
// remove this line and it dies
|
||||
ComThread.InitMTA(true);
|
||||
///ComThread.InitMTA(true);
|
||||
IETestThread aThread = new IETestThread();
|
||||
aThread.run();
|
||||
aThread.start();
|
||||
while (aThread.isAlive()){
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
// doen with the sleep
|
||||
//e.printStackTrace();
|
||||
@@ -37,13 +40,15 @@ class IETest
|
||||
|
||||
class IETestThread extends Thread
|
||||
{
|
||||
public static boolean quitHandled = false;
|
||||
|
||||
public IETestThread(){
|
||||
super();
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
int delay = 5000; // msec
|
||||
int delay = 5000; // msec
|
||||
// paired with statement below that blows up
|
||||
ComThread.InitMTA();
|
||||
ActiveXComponent ie = new ActiveXComponent("InternetExplorer.Application");
|
||||
@@ -54,7 +59,7 @@ class IETestThread extends Thread
|
||||
Dispatch.put(ie, "StatusText", new Variant("My Status Text"));
|
||||
|
||||
IEEvents ieE = new IEEvents();
|
||||
DispatchEvents de = new DispatchEvents((Dispatch) ie, ieE,"InternetExplorer.Application.1");
|
||||
new DispatchEvents((Dispatch) ie, ieE,"InternetExplorer.Application.1");
|
||||
Variant optional = new Variant();
|
||||
optional.noParam();
|
||||
|
||||
@@ -72,82 +77,97 @@ class IETestThread extends Thread
|
||||
// "OnQuit" that will came after we have released the thread pool
|
||||
// this is probably messed up because DispatchEvent object will have been
|
||||
// freed before the callback
|
||||
System.out.println("about to call release in thread");
|
||||
// commenting out ie.invoke(quit...) causes this to work without error
|
||||
// this code tries to wait until the quit has been handled but that doesn't work
|
||||
System.out.println("IETest: Waiting until we've received the quit callback");
|
||||
while (!quitHandled){
|
||||
try { Thread.sleep(delay/5);} catch (InterruptedException e) {}
|
||||
}
|
||||
// wait a little while for it to end
|
||||
try {Thread.sleep(delay); } catch (InterruptedException e) {}
|
||||
System.out.println("IETest: about to call release in thread " +
|
||||
Thread.currentThread().getName());
|
||||
|
||||
ComThread.Release();
|
||||
}
|
||||
}
|
||||
|
||||
class IEEvents
|
||||
/**
|
||||
* the events class must be publicly accessable for reflection to work
|
||||
*/
|
||||
public class IEEvents
|
||||
{
|
||||
public void BeforeNavigate2(Variant[] args) {
|
||||
System.out.println("BeforeNavigate2");
|
||||
System.out.println("IEEvents: BeforeNavigate2");
|
||||
}
|
||||
|
||||
public void CommandStateChanged(Variant[] args) {
|
||||
System.out.println("CommandStateChanged");
|
||||
public void CommandStateChange(Variant[] args) {
|
||||
System.out.println("IEEvents: CommandStateChange");
|
||||
}
|
||||
|
||||
public void DocumentComplete(Variant[] args) {
|
||||
System.out.println("DocumentComplete");
|
||||
System.out.println("IEEvents: DocumentComplete");
|
||||
}
|
||||
|
||||
public void DownloadBegin(Variant[] args) {
|
||||
System.out.println("DownloadBegin");
|
||||
System.out.println("IEEvents: DownloadBegin");
|
||||
}
|
||||
|
||||
public void DownloadComplete(Variant[] args) {
|
||||
System.out.println("DownloadComplete");
|
||||
System.out.println("IEEvents: DownloadComplete");
|
||||
}
|
||||
|
||||
public void NavigateComplete2(Variant[] args) {
|
||||
System.out.println("NavigateComplete2");
|
||||
System.out.println("IEEvents: NavigateComplete2");
|
||||
}
|
||||
|
||||
public void NewWindow2(Variant[] args) {
|
||||
System.out.println("NewWindow2");
|
||||
System.out.println("IEEvents: NewWindow2");
|
||||
}
|
||||
|
||||
public void OnFullScreen(Variant[] args) {
|
||||
System.out.println("OnFullScreen");
|
||||
System.out.println("IEEvents: OnFullScreen");
|
||||
}
|
||||
|
||||
public void OnMenuBar(Variant[] args) {
|
||||
System.out.println("OnMenuBar");
|
||||
System.out.println("IEEvents: OnMenuBar");
|
||||
}
|
||||
|
||||
public void OnQuit(Variant[] args) {
|
||||
System.out.println("OnQuit");
|
||||
System.out.println("IEEvents: OnQuit");
|
||||
IETestThread.quitHandled = true;
|
||||
}
|
||||
|
||||
public void OnStatusBar(Variant[] args) {
|
||||
System.out.println("OnStatusBar");
|
||||
System.out.println("IEEvents: OnStatusBar");
|
||||
}
|
||||
|
||||
public void OnTheaterMode(Variant[] args) {
|
||||
System.out.println("OnTheaterMode");
|
||||
System.out.println("IEEvents: OnTheaterMode");
|
||||
}
|
||||
|
||||
public void OnToolBar(Variant[] args) {
|
||||
System.out.println("OnToolBar");
|
||||
System.out.println("IEEvents: OnToolBar");
|
||||
}
|
||||
|
||||
public void OnVisible(Variant[] args) {
|
||||
System.out.println("OnVisible");
|
||||
System.out.println("IEEvents: OnVisible");
|
||||
}
|
||||
|
||||
public void ProgressChange(Variant[] args) {
|
||||
System.out.println("ProgressChange");
|
||||
System.out.println("IEEvents: ProgressChange");
|
||||
}
|
||||
|
||||
public void PropertyChange(Variant[] args) {
|
||||
System.out.println("PropertyChange");
|
||||
System.out.println("IEEvents: PropertyChange");
|
||||
}
|
||||
|
||||
public void StatusTextChange(Variant[] args) {
|
||||
System.out.println("StatusTextChange");
|
||||
System.out.println("IEEvents: StatusTextChange");
|
||||
}
|
||||
|
||||
public void TitleChange(Variant[] args) {
|
||||
System.out.println("TitleChange");
|
||||
System.out.println("IEEvents: TitleChange");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ class ScriptTest
|
||||
Dispatch.put(sControl, "Language", lang);
|
||||
ScriptTestErrEvents te = new ScriptTestErrEvents();
|
||||
de = new DispatchEvents(sControl, te);
|
||||
if (de == null){
|
||||
System.out.println("Received null when trying to create new DispatchEvents");
|
||||
}
|
||||
Variant result = Dispatch.call(sControl, "Eval", args[0]);
|
||||
// call it twice to see the objects reused
|
||||
result = Dispatch.call(sControl, "Eval", args[0]);
|
||||
|
||||
@@ -20,6 +20,9 @@ class ScriptTestActiveX
|
||||
sC.setProperty("Language",lang);
|
||||
ScriptTestErrEvents te = new ScriptTestErrEvents();
|
||||
de = new DispatchEvents(sC, te);
|
||||
if (de == null){
|
||||
System.out.println("null returned when trying to create DispatchEvents");
|
||||
}
|
||||
Variant result;
|
||||
result = sC.invoke("Eval",args[0]);
|
||||
// call it twice to see the objects reused
|
||||
|
||||
@@ -3,32 +3,35 @@ package com.jacob.samples.test.atl;
|
||||
import com.jacob.com.*;
|
||||
import com.jacob.activeX.*;
|
||||
|
||||
class MultiFaceTest
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.runFinalizersOnExit(true);
|
||||
class MultiFaceTest {
|
||||
public static void main(String[] args) {
|
||||
// this method has been deprecated as being unreliable.
|
||||
// shutdown should be done through other means
|
||||
// whoever wrote this example should explain what this was intended to do
|
||||
//System.runFinalizersOnExit(true);
|
||||
|
||||
ActiveXComponent mf = new ActiveXComponent("MultiFace.Face");
|
||||
try {
|
||||
// I am now dealing with the default interface (IFace1)
|
||||
Dispatch.put(mf, "Face1Name", new Variant("Hello Face1"));
|
||||
System.out.println(Dispatch.get(mf, "Face1Name"));
|
||||
ActiveXComponent mf = new ActiveXComponent("MultiFace.Face");
|
||||
try {
|
||||
// I am now dealing with the default interface (IFace1)
|
||||
Dispatch.put(mf, "Face1Name", new Variant("Hello Face1"));
|
||||
System.out.println(Dispatch.get(mf, "Face1Name"));
|
||||
|
||||
// get to IFace2 through the IID
|
||||
Dispatch f2 = mf.QueryInterface("{9BF24410-B2E0-11D4-A695-00104BFF3241}");
|
||||
// I am now dealing with IFace2
|
||||
Dispatch.put(f2, "Face2Nam", new Variant("Hello Face2"));
|
||||
System.out.println(Dispatch.get(f2, "Face2Nam"));
|
||||
// get to IFace2 through the IID
|
||||
Dispatch f2 = mf
|
||||
.QueryInterface("{9BF24410-B2E0-11D4-A695-00104BFF3241}");
|
||||
// I am now dealing with IFace2
|
||||
Dispatch.put(f2, "Face2Nam", new Variant("Hello Face2"));
|
||||
System.out.println(Dispatch.get(f2, "Face2Nam"));
|
||||
|
||||
// get to IFace3 through the IID
|
||||
Dispatch f3 = mf.QueryInterface("{9BF24411-B2E0-11D4-A695-00104BFF3241}");
|
||||
// I am now dealing with IFace3
|
||||
Dispatch.put(f3, "Face3Name", new Variant("Hello Face3"));
|
||||
System.out.println(Dispatch.get(f3, "Face3Name"));
|
||||
// get to IFace3 through the IID
|
||||
Dispatch f3 = mf
|
||||
.QueryInterface("{9BF24411-B2E0-11D4-A695-00104BFF3241}");
|
||||
// I am now dealing with IFace3
|
||||
Dispatch.put(f3, "Face3Name", new Variant("Hello Face3"));
|
||||
System.out.println(Dispatch.get(f3, "Face3Name"));
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +1,46 @@
|
||||
package com.jacob.samples.test;
|
||||
|
||||
import com.jacob.activeX.ActiveXComponent;
|
||||
import com.jacob.com.*;
|
||||
|
||||
/*
|
||||
/**
|
||||
* This example uses the MathTest sample VB COM DLL under
|
||||
* the MathProj directory
|
||||
* <pre>
|
||||
* -Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=false -Dcom.jacob.debug=true
|
||||
* </pre>
|
||||
*/
|
||||
class math
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.runFinalizersOnExit(true);
|
||||
Dispatch test = new Dispatch("MathTest.Math");
|
||||
testEvents te = new testEvents();
|
||||
DispatchEvents de = new DispatchEvents(test, te);
|
||||
System.out.println(Dispatch.call(test, "Add", new Variant(1), new Variant(2)));
|
||||
System.out.println(Dispatch.call(test, "Mult", new Variant(2), new Variant(2)));
|
||||
Variant v = Dispatch.call(test, "Mult", new Variant(2), new Variant(2));
|
||||
class math {
|
||||
public static void main(String[] args) {
|
||||
// deprecated
|
||||
// System.runFinalizersOnExit(true);
|
||||
Dispatch test = new ActiveXComponent("MathTest.Math");
|
||||
testEvents te = new testEvents();
|
||||
DispatchEvents de = new DispatchEvents(test, te);
|
||||
if (de == null) {
|
||||
System.out
|
||||
.println("null returned when trying to create DispatchEvents");
|
||||
}
|
||||
System.out.println(Dispatch.call(test, "Add", new Variant(1),
|
||||
new Variant(2)));
|
||||
System.out.println(Dispatch.call(test, "Mult", new Variant(2),
|
||||
new Variant(2)));
|
||||
Variant v = Dispatch.call(test, "Mult", new Variant(2), new Variant(2));
|
||||
// this should return false
|
||||
System.out.println("v.isNull="+v.isNull());
|
||||
v = Dispatch.call(test, "getNothing");
|
||||
System.out.println("v.isNull=" + v.isNull());
|
||||
v = Dispatch.call(test, "getNothing");
|
||||
// these should return nothing
|
||||
System.out.println("v.isNull="+v.isNull());
|
||||
System.out.println("v.toDispatch="+v.toDispatch());
|
||||
}
|
||||
System.out.println("v.isNull=" + v.isNull());
|
||||
System.out.println("v.toDispatch=" + v.toDispatch());
|
||||
}
|
||||
}
|
||||
|
||||
class testEvents {
|
||||
public void DoneAdd(Variant[] args)
|
||||
{
|
||||
System.out.println("DoneAdd called in java");
|
||||
}
|
||||
public void DoneMult(Variant[] args)
|
||||
{
|
||||
System.out.println("DoneMult called in java");
|
||||
}
|
||||
public void DoneAdd(Variant[] args) {
|
||||
System.out.println("DoneAdd called in java");
|
||||
}
|
||||
|
||||
public void DoneMult(Variant[] args) {
|
||||
System.out.println("DoneMult called in java");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,10 @@ import com.jacob.activeX.*;
|
||||
|
||||
class sa_dispatch
|
||||
{
|
||||
public static void main(String args[])
|
||||
{
|
||||
System.runFinalizersOnExit(true);
|
||||
public static void main(String args[])
|
||||
{
|
||||
// deprecated
|
||||
//System.runFinalizersOnExit(true);
|
||||
|
||||
try {
|
||||
String lang = "VBScript";
|
||||
|
||||
@@ -2,57 +2,97 @@ package com.jacob.samples.test;
|
||||
|
||||
import com.jacob.com.*;
|
||||
|
||||
class sa_test
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.runFinalizersOnExit(true);
|
||||
SafeArray sa = new SafeArray(Variant.VariantVariant, 3);
|
||||
/**
|
||||
* SafeArrayTest Program
|
||||
*
|
||||
* This is more of an exerciser. It doesn't verify that it gets back
|
||||
* what it expects like a junit test would
|
||||
*
|
||||
*/
|
||||
class sa_test {
|
||||
public static void main(String[] args) {
|
||||
//System.runFinalizersOnExit(true);
|
||||
SafeArray sa = new SafeArray(Variant.VariantVariant, 3);
|
||||
|
||||
sa.fromShortArray(new short[] {1,2,3});
|
||||
System.out.println("sa short="+sa);
|
||||
int[] ai = sa.toIntArray();
|
||||
for(int i=0;i<ai.length;i++) {
|
||||
System.out.println("toInt="+ai[i]);
|
||||
}
|
||||
double[] ad = sa.toDoubleArray();
|
||||
for(int i=0;i<ad.length;i++) {
|
||||
System.out.println("toDouble="+ad[i]);
|
||||
}
|
||||
sa.fromIntArray(new int[] {100000,200000,300000});
|
||||
System.out.println("sa int="+sa);
|
||||
ai = sa.toIntArray();
|
||||
for(int i=0;i<ai.length;i++) {
|
||||
System.out.println("toInt="+ai[i]);
|
||||
}
|
||||
ad = sa.toDoubleArray();
|
||||
for(int i=0;i<ad.length;i++) {
|
||||
System.out.println("toDouble="+ad[i]);
|
||||
}
|
||||
Variant av[] = sa.toVariantArray();
|
||||
for(int i=0;i<av.length;i++) {
|
||||
System.out.println("toVariant="+av[i]);
|
||||
}
|
||||
sa.fromDoubleArray(new double[] {1.5,2.5,3.5});
|
||||
System.out.println("sa double="+sa);
|
||||
sa.fromFloatArray(new float[] {1.5F,2.5F,3.5F});
|
||||
System.out.println("sa float="+sa);
|
||||
sa.fromBooleanArray(new boolean[] {true, false, true, false});
|
||||
System.out.println("sa bool="+sa);
|
||||
av = sa.toVariantArray();
|
||||
for(int i=0;i<av.length;i++) {
|
||||
System.out.println("toVariant="+av[i]);
|
||||
}
|
||||
sa.fromCharArray(new char[] {'a','b','c','d'});
|
||||
System.out.println("sa char="+sa);
|
||||
sa.fromStringArray(new String[] {"hello", "from", "java", "com"});
|
||||
System.out.println("sa string="+sa);
|
||||
av = sa.toVariantArray();
|
||||
for(int i=0;i<av.length;i++) {
|
||||
System.out.println("toVariant="+av[i]);
|
||||
}
|
||||
sa.fromVariantArray(new Variant[] {
|
||||
new Variant(1), new Variant(2.3), new Variant("hi")});
|
||||
System.out.println("sa variant="+sa);
|
||||
}
|
||||
sa.fromShortArray(new short[] { 1, 2, 3 });
|
||||
System.out.println("sa short=" + sa);
|
||||
int[] ai = sa.toIntArray();
|
||||
for (int i = 0; i < ai.length; i++) {
|
||||
System.out.println("toInt=" + ai[i]);
|
||||
}
|
||||
double[] ad = sa.toDoubleArray();
|
||||
for (int i = 0; i < ad.length; i++) {
|
||||
System.out.println("toDouble=" + ad[i]);
|
||||
}
|
||||
sa.fromIntArray(new int[] { 100000, 200000, 300000 });
|
||||
System.out.println("sa int=" + sa);
|
||||
ai = sa.toIntArray();
|
||||
for (int i = 0; i < ai.length; i++) {
|
||||
System.out.println("toInt=" + ai[i]);
|
||||
}
|
||||
ad = sa.toDoubleArray();
|
||||
for (int i = 0; i < ad.length; i++) {
|
||||
System.out.println("toDouble=" + ad[i]);
|
||||
}
|
||||
Variant av[] = sa.toVariantArray();
|
||||
for (int i = 0; i < av.length; i++) {
|
||||
System.out.println("toVariant=" + av[i]);
|
||||
}
|
||||
sa.fromDoubleArray(new double[] { 1.5, 2.5, 3.5 });
|
||||
System.out.println("sa double=" + sa);
|
||||
sa.fromFloatArray(new float[] { 1.5F, 2.5F, 3.5F });
|
||||
System.out.println("sa float=" + sa);
|
||||
sa.fromBooleanArray(new boolean[] { true, false, true, false });
|
||||
System.out.println("sa bool=" + sa);
|
||||
av = sa.toVariantArray();
|
||||
for (int i = 0; i < av.length; i++) {
|
||||
System.out.println("toVariant=" + av[i]);
|
||||
}
|
||||
sa.fromCharArray(new char[] { 'a', 'b', 'c', 'd' });
|
||||
System.out.println("sa char=" + sa);
|
||||
sa.fromStringArray(new String[] { "hello", "from", "java", "com" });
|
||||
System.out.println("sa string=" + sa);
|
||||
av = sa.toVariantArray();
|
||||
for (int i = 0; i < av.length; i++) {
|
||||
System.out.println("toVariant=" + av[i]);
|
||||
}
|
||||
sa.fromVariantArray(new Variant[] {
|
||||
new Variant(1), new Variant(2.3), new Variant("hi") });
|
||||
System.out.println("sa variant=" + sa);
|
||||
|
||||
sa_ND_test();
|
||||
|
||||
}
|
||||
|
||||
public static void sa_ND_test() {
|
||||
int[] lowerBounds = new int[] { 0, 0, 0 };
|
||||
int[] dimensionSizes = new int[] { 3, 3, 3 };
|
||||
|
||||
SafeArray sa3x3 = new SafeArray(Variant.VariantVariant, lowerBounds,
|
||||
dimensionSizes);
|
||||
|
||||
System.out.println("Num Dimensions = " + sa3x3.getNumDim());
|
||||
for (int i = 1; i <= sa3x3.getNumDim(); i++) {
|
||||
System.out.println("Dimension number = " + i);
|
||||
System.out.println("Lower bound = " + sa3x3.getLBound(i));
|
||||
System.out.println("Upper bound = " + sa3x3.getUBound(i));
|
||||
}
|
||||
|
||||
int fill = 0;
|
||||
int[] indices = new int[] { 0, 0, 0 };
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
indices[0] = i;
|
||||
for (int j = 0; j < 3; j++) {
|
||||
indices[1] = j;
|
||||
for (int k = 0; k < 3; k++) {
|
||||
indices[2] = k;
|
||||
fill = i * 100 + j * 10 + k;
|
||||
sa3x3.setInt(indices, fill);
|
||||
System.out.println("sa[" + i + "][" + j + "][" + k + "] = "
|
||||
+ sa3x3.getInt(indices));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,12 @@ public class safearray
|
||||
{
|
||||
public static void main(java.lang.String[] args)
|
||||
{
|
||||
System.runFinalizersOnExit(true);
|
||||
//deprecated
|
||||
//System.runFinalizersOnExit(true);
|
||||
|
||||
ActiveXComponent xl = new ActiveXComponent("Excel.Application");
|
||||
try {
|
||||
Dispatch cell;
|
||||
Dispatch cellstart;
|
||||
Dispatch cellstop;
|
||||
SafeArray sAProdText;
|
||||
Dispatch workbooks = xl.getProperty("Workbooks").toDispatch();
|
||||
System.out.println("have workbooks");
|
||||
@@ -30,7 +29,6 @@ public class safearray
|
||||
System.out.println("sa: end col="+sAProdText.getUBound(2));
|
||||
int i;
|
||||
int lineNumber=1;
|
||||
boolean stringFound = true;
|
||||
int n = 0;
|
||||
for(lineNumber=1; lineNumber < 1000; lineNumber++)
|
||||
{
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
package com.jacob.samples.test;
|
||||
|
||||
import com.jacob.com.*;
|
||||
|
||||
class variant_test
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.runFinalizersOnExit(true);
|
||||
Variant v = new Variant();
|
||||
v.putInt(10);
|
||||
System.out.println("got="+v.toInt());
|
||||
v.putInt(10);
|
||||
System.out.println("got="+v.toDouble());
|
||||
v.putString("1234.567");
|
||||
System.out.println("got="+v.toString());
|
||||
v.putBoolean(true);
|
||||
System.out.println("got="+v.toBoolean());
|
||||
v.putBoolean(false);
|
||||
System.out.println("got="+v.toBoolean());
|
||||
v.putCurrency(123456789123456789L);
|
||||
System.out.println("got="+v.toCurrency());
|
||||
}
|
||||
class variant_test {
|
||||
public static void main(String[] args) {
|
||||
//deprecated
|
||||
//System.runFinalizersOnExit(true);
|
||||
Variant v = new Variant();
|
||||
v.putInt(10);
|
||||
System.out.println("got=" + v.toInt());
|
||||
v.putInt(10);
|
||||
System.out.println("got=" + v.toDouble());
|
||||
v.putString("1234.567");
|
||||
System.out.println("got=" + v.toString());
|
||||
v.putBoolean(true);
|
||||
System.out.println("got=" + v.toBoolean());
|
||||
v.putBoolean(false);
|
||||
System.out.println("got=" + v.toBoolean());
|
||||
v.putCurrency(123456789123456789L);
|
||||
System.out.println("got=" + v.toCurrency());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.jacob.activeX;
|
||||
|
||||
@@ -51,6 +41,11 @@ public class ActiveXComponent extends Dispatch {
|
||||
* Normally used to create a new connection to a microsoft application.
|
||||
* The passed in parameter is the name of the program as registred
|
||||
* in the registry. It can also be the object name.
|
||||
* <p>
|
||||
* This constructor causes a new Windows object of the requested
|
||||
* type to be created. The windows CoCreate() function gets called
|
||||
* to create the underlying windows object.
|
||||
*
|
||||
* <pre>new ActiveXComponent("ScriptControl");</pre>
|
||||
* @param programId
|
||||
*/
|
||||
|
||||
@@ -1,28 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project. All rights reserved.
|
||||
* Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer. 2. Redistributions in
|
||||
* binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution. 3. Redistributions in any form must
|
||||
* be accompanied by information on how to obtain complete source code for the
|
||||
* JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
|
||||
@@ -1,28 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project. All rights reserved.
|
||||
* Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer. 2. Redistributions in
|
||||
* binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution. 3. Redistributions in any form must
|
||||
* be accompanied by information on how to obtain complete source code for the
|
||||
* JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
@@ -31,14 +24,20 @@ package com.jacob.com;
|
||||
*/
|
||||
public class ComFailException extends ComException {
|
||||
/**
|
||||
* eclipse generated to get rid of a wanring
|
||||
*/
|
||||
private static final long serialVersionUID = -266047261992987700L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param hrNew
|
||||
*/
|
||||
// Constructors
|
||||
public ComFailException(int hrNew) {
|
||||
super(hrNew);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param hrNew
|
||||
* @param message
|
||||
*/
|
||||
@@ -58,6 +57,7 @@ public class ComFailException extends ComException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param hrNew
|
||||
* @param description
|
||||
* @param source
|
||||
@@ -70,7 +70,7 @@ public class ComFailException extends ComException {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* No argument Constructor
|
||||
*/
|
||||
public ComFailException() {
|
||||
super();
|
||||
|
||||
@@ -1,33 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project. All rights reserved.
|
||||
* Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer. 2. Redistributions in
|
||||
* binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution. 3. Redistributions in any form must
|
||||
* be accompanied by information on how to obtain complete source code for the
|
||||
* JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
/**
|
||||
* represents a COM level thread
|
||||
* Represents a COM level thread
|
||||
* This is an abstract class because all the methods are static
|
||||
* and no instances are ever created.
|
||||
*/
|
||||
public abstract class ComThread {
|
||||
private static final int MTA = 0x0;
|
||||
@@ -108,22 +103,22 @@ public abstract class ComThread {
|
||||
// to avoid COM creating its own
|
||||
startMainSTA();
|
||||
}
|
||||
//System.out.println("before Init: "+mode);
|
||||
if (JacobObject.isDebugEnabled()){JacobObject.debug("ComThread: before Init: "+mode);}
|
||||
doCoInitialize(mode);
|
||||
//System.out.println("after Init");
|
||||
if (JacobObject.isDebugEnabled()){JacobObject.debug("ComThread: after Init: "+mode);}
|
||||
ROT.addThread();
|
||||
//System.out.println("after ROT.addThread");
|
||||
if (JacobObject.isDebugEnabled()){JacobObject.debug("ComThread: after ROT.addThread: "+mode); }
|
||||
}
|
||||
|
||||
/**
|
||||
* Call CoUninitialize to release this java thread from COM
|
||||
*/
|
||||
public static synchronized void Release() {
|
||||
//System.out.println("before clearObjects");
|
||||
if (JacobObject.isDebugEnabled()){JacobObject.debug("ComThread: before clearObjects"); }
|
||||
ROT.clearObjects();
|
||||
//System.out.println("before UnInit");
|
||||
if (JacobObject.isDebugEnabled()){JacobObject.debug("ComThread: before UnInit"); }
|
||||
doCoUninitialize();
|
||||
//System.out.println("after UnInit");
|
||||
if (JacobObject.isDebugEnabled()){JacobObject.debug("ComThread: after UnInit"); }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
103
src/com/jacob/com/DateUtilities.java
Normal file
103
src/com/jacob/com/DateUtilities.java
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* java / windows date conversion utilities
|
||||
* @author joe
|
||||
*
|
||||
*/
|
||||
public class DateUtilities {
|
||||
|
||||
/**
|
||||
* converts a windows time to a Java Date Object
|
||||
* @param comTime
|
||||
* @return Date object representing the windows time as specified in comTime
|
||||
*/
|
||||
static public Date convertWindowsTimeToDate(double comTime){
|
||||
return new Date(convertWindowsTimeToMilliseconds (comTime));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a COM time from functions Date(), Time(), Now() to a
|
||||
* Java time (milliseconds). Visual Basic time values are based to
|
||||
* 30.12.1899, Java time values are based to 1.1.1970 (= 0
|
||||
* milliseconds). The difference is added to the Visual Basic value to
|
||||
* get the corresponding Java value. The Visual Basic double value
|
||||
* reads: <day count delta since 30.12.1899>.<1 day percentage
|
||||
* fraction>, e.g. "38100.6453" means: 38100 days since 30.12.1899 plus
|
||||
* (24 hours * 0.6453). Example usage:
|
||||
* <code>Date javaDate = new Date(toMilliseconds (vbDate));</code>.
|
||||
*
|
||||
* @param comTime
|
||||
* COM time.
|
||||
* @return Java time.
|
||||
*/
|
||||
static public long convertWindowsTimeToMilliseconds(double comTime) {
|
||||
long result = 0;
|
||||
|
||||
// code from jacobgen:
|
||||
comTime = comTime - 25569D;
|
||||
Calendar cal = Calendar.getInstance();
|
||||
result = Math.round(86400000L * comTime)
|
||||
- cal.get(Calendar.ZONE_OFFSET);
|
||||
cal.setTime(new Date(result));
|
||||
result -= cal.get(Calendar.DST_OFFSET);
|
||||
|
||||
return result;
|
||||
}// convertWindowsTimeToMilliseconds()
|
||||
|
||||
/**
|
||||
* converts a java date to a windows time object
|
||||
* (is this timezone safe?)
|
||||
*
|
||||
* @param javaDate the java date to be converted to windows time
|
||||
* @return the double representing the date in a form windows understands
|
||||
*/
|
||||
static public double convertDateToWindowsTime(Date javaDate){
|
||||
if (javaDate == null){
|
||||
throw new IllegalArgumentException("cannot convert null to windows time");
|
||||
}
|
||||
return convertMillisecondsToWindowsTime(javaDate.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Java time to a COM time.
|
||||
*
|
||||
* @param milliseconds
|
||||
* Java time.
|
||||
* @return COM time.
|
||||
*/
|
||||
static public double convertMillisecondsToWindowsTime(long milliseconds) {
|
||||
double result = 0.0;
|
||||
|
||||
// code from jacobgen:
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(milliseconds);
|
||||
milliseconds += (cal.get(Calendar.ZONE_OFFSET) + cal
|
||||
.get(Calendar.DST_OFFSET)); // add GMT offset
|
||||
result = (milliseconds / 86400000D) + 25569D;
|
||||
|
||||
return result;
|
||||
}//convertMillisecondsToWindowsTime()
|
||||
}
|
||||
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
@@ -152,9 +142,14 @@ public class Dispatch extends JacobObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that calls createInstance with progid. This is the
|
||||
* constructor used by the ActiveXComponent
|
||||
*
|
||||
* This constructor calls createInstance with progid. This is the
|
||||
* constructor used by the ActiveXComponent or by programs that
|
||||
* don't like the activeX interface but wish to create new connections
|
||||
* to windows programs.
|
||||
* <p>
|
||||
* This constructor always creates a new windows/program object
|
||||
* because it is based on the CoCreate() windows function.
|
||||
* <p>
|
||||
* @param requestedProgramId
|
||||
*/
|
||||
public Dispatch(String requestedProgramId) {
|
||||
@@ -163,15 +158,29 @@ public class Dispatch extends JacobObject
|
||||
}
|
||||
|
||||
/**
|
||||
* native call createIstnace only used by the constructor with the same parm
|
||||
* type could this be private?
|
||||
* native call createInstance only used by the constructor with the same parm
|
||||
* type. This probably should be private. It is the wrapper for the
|
||||
* Windows CoCreate() call
|
||||
* <P>
|
||||
* This ends up calling CoCreate down in the JNI layer
|
||||
*
|
||||
* @param progid
|
||||
*/
|
||||
protected native void createInstance(String progid);
|
||||
|
||||
/**
|
||||
* return a different interface by IID string
|
||||
* Return a different interface by IID string.
|
||||
* <p>
|
||||
* Once you have a Dispatch object, you can navigate to the other
|
||||
* interfaces of a COM object by calling QueryInterafce.
|
||||
* The argument is an IID string in the format:
|
||||
* "{9BF24410-B2E0-11D4-A695-00104BFF3241}". You typically get
|
||||
* this string from the idl file (it's called uuid in there).
|
||||
* Any interface you try to use must be derived from IDispatch. T
|
||||
* The atl example uses this.
|
||||
* <p>
|
||||
* The Dispatch instance resulting from this query is instanciated in the
|
||||
* JNI code.
|
||||
*
|
||||
* @param iid
|
||||
* @return Dispatch a disptach that matches ??
|
||||
@@ -180,7 +189,9 @@ public class Dispatch extends JacobObject
|
||||
|
||||
/**
|
||||
* Constructor that only gets called from JNI
|
||||
*
|
||||
* QueryInterface calls JNI code that looks up the object
|
||||
* for the key passed in. The JNI CODE then creates a new dispatch object
|
||||
* using this constructor
|
||||
* @param pDisp
|
||||
*/
|
||||
protected Dispatch(int pDisp) {
|
||||
|
||||
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
@@ -45,17 +35,43 @@ package com.jacob.com;
|
||||
public class DispatchEvents extends JacobObject {
|
||||
|
||||
/**
|
||||
* ponter to an MS data struct.
|
||||
* pointer to an MS data struct.
|
||||
* The COM layer knows the name of this variable and puts the windows
|
||||
* memory pointer here.
|
||||
*/
|
||||
int m_pConnPtProxy = 0;
|
||||
|
||||
/**
|
||||
* create a permanent reference to this Variant so that
|
||||
* it never gets garbage collected. The
|
||||
* Dispatch proxies will keep a handle on this so
|
||||
* we don't really want it released
|
||||
* the wrapper for the event sink.
|
||||
* This object is the one that will be sent a message when an event
|
||||
* occurs in the MS layer. Normally, the InvocationProxy will forward
|
||||
* the messages to a wrapped object that it contains.
|
||||
*/
|
||||
private static Variant prototypicalVariant = new VariantViaEvent();
|
||||
InvocationProxy mInvocationProxy = null;
|
||||
|
||||
|
||||
/**
|
||||
* A constructor for those that want to supply their own InvocationProxy.
|
||||
* or subclass (future implementations may take an interface).
|
||||
* This lets someone distribute their events to other objects
|
||||
* at the single method dispatch point.
|
||||
* <p>
|
||||
* Most users of this class will use the other constructors!
|
||||
*
|
||||
* @param sourceOfEvent the Dispatch object that will send events
|
||||
* @param pInvocationProxy the proxy object that expects to receive the
|
||||
* events for some other object
|
||||
*/
|
||||
public DispatchEvents(Dispatch sourceOfEvent, InvocationProxy pInvocationProxy){
|
||||
mInvocationProxy = pInvocationProxy;
|
||||
if (mInvocationProxy != null){
|
||||
init(sourceOfEvent, mInvocationProxy);
|
||||
} else {
|
||||
if (JacobObject.isDebugEnabled()){
|
||||
JacobObject.debug("Cannot register null invocation proxy for events");
|
||||
}
|
||||
throw new IllegalArgumentException("Cannot register null invocation proxy for events");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the event callback linkage between the the
|
||||
@@ -65,7 +81,19 @@ public class DispatchEvents extends JacobObject {
|
||||
* @param eventSink Java object that wants to receive the events
|
||||
*/
|
||||
public DispatchEvents(Dispatch sourceOfEvent, Object eventSink) {
|
||||
init(sourceOfEvent, eventSink, prototypicalVariant);
|
||||
if (JacobObject.isDebugEnabled()){
|
||||
System.out.println(
|
||||
"DispatchEvents: Registering "+ eventSink + "for events ");
|
||||
}
|
||||
mInvocationProxy = new InvocationProxy(eventSink);
|
||||
if (mInvocationProxy != null){
|
||||
init(sourceOfEvent, mInvocationProxy);
|
||||
} else {
|
||||
if (JacobObject.isDebugEnabled()){
|
||||
JacobObject.debug("Cannot register null event sink for events");
|
||||
}
|
||||
throw new IllegalArgumentException("Cannot register null event sink for events");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,34 +102,42 @@ public class DispatchEvents extends JacobObject {
|
||||
* Java object that will receive the callback.
|
||||
* @param sourceOfEvent Dispatch object who's MS app will generate callbacks
|
||||
* @param eventSink Java object that wants to receive the events
|
||||
* @param progId
|
||||
* @param progId ???
|
||||
*/
|
||||
public DispatchEvents(Dispatch sourceOfEvent, Object eventSink, String progId) {
|
||||
init2(sourceOfEvent, eventSink, prototypicalVariant, progId);
|
||||
if (JacobObject.isDebugEnabled()){
|
||||
System.out.println(
|
||||
"DispatchEvents: Registering "+ eventSink + "for events ");
|
||||
}
|
||||
mInvocationProxy = new InvocationProxy(eventSink);
|
||||
if (mInvocationProxy != null) {
|
||||
init2(sourceOfEvent, mInvocationProxy, progId);
|
||||
} else {
|
||||
if (JacobObject.isDebugEnabled()){
|
||||
JacobObject.debug("Cannot register null event sink for events");
|
||||
}
|
||||
throw new IllegalArgumentException("Cannot register null event sink for events");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* hooks up a connection point proxy by progId
|
||||
* event methods on the sink object will be called
|
||||
* by name with a signature of <name>(Variant[] args)
|
||||
* protoVariant is a sacrificial variant object so we don't have to do findClass in callbacks
|
||||
* @param src
|
||||
* @param sink
|
||||
* @param protoVariant
|
||||
*/
|
||||
protected native void init(Dispatch src, Object sink, Object protoVariant);
|
||||
protected native void init(Dispatch src, Object sink);
|
||||
|
||||
/**
|
||||
* hooks up a connection point proxy by progId
|
||||
* event methods on the sink object will be called
|
||||
* by name with a signature of <name>(Variant[] args)
|
||||
* protoVariant is a sacrificial variant object so we don't have to do findClass in callbacks
|
||||
* @param src
|
||||
* @param sink
|
||||
* @param protoVariant
|
||||
* @param progId
|
||||
*/
|
||||
protected native void init2(Dispatch src, Object sink, Object protoVariant, String progId);
|
||||
protected native void init2(Dispatch src, Object sink, String progId);
|
||||
|
||||
/**
|
||||
* now private so only this object can asccess
|
||||
@@ -123,13 +159,17 @@ public class DispatchEvents extends JacobObject {
|
||||
* @see com.jacob.com.JacobObject#safeRelease()
|
||||
*/
|
||||
public void safeRelease(){
|
||||
if (mInvocationProxy!=null){
|
||||
mInvocationProxy.clearTarget();
|
||||
}
|
||||
mInvocationProxy = null;
|
||||
super.safeRelease();
|
||||
if (m_pConnPtProxy != 0){
|
||||
release();
|
||||
m_pConnPtProxy = 0;
|
||||
} else {
|
||||
// looks like a double release
|
||||
if (isDebugEnabled()){debug(this.getClass().getName()+":"+this.hashCode()+" double release");}
|
||||
if (isDebugEnabled()){debug("DispatchEvents:"+this.hashCode()+" double release");}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
|
||||
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
|
||||
140
src/com/jacob/com/InvocationProxy.java
Normal file
140
src/com/jacob/com/InvocationProxy.java
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @version $Id$
|
||||
* @author joe
|
||||
*
|
||||
* DispatchProxy wraps this class around any event handlers
|
||||
* before making the JNI call that sets up the link with EventProxy.
|
||||
* This means that EventProxy just calls invoke(String,Variant[])
|
||||
* against the instance of this class. Then this class does
|
||||
* reflection against the event listener to call the actual event methods.
|
||||
* All Event methods have the signature
|
||||
*
|
||||
* <code> void eventMethodName(Variant[])</code>
|
||||
*
|
||||
*/
|
||||
public class InvocationProxy {
|
||||
|
||||
/**
|
||||
* the object we will try and forward to.
|
||||
*/
|
||||
Object mTargetObject = null;
|
||||
|
||||
/**
|
||||
* constructs an invocation proxy that fronts for an event listener
|
||||
* @param pTargetObject
|
||||
*/
|
||||
protected InvocationProxy(Object pTargetObject){
|
||||
super();
|
||||
if (JacobObject.isDebugEnabled()){
|
||||
JacobObject.debug(
|
||||
"InvocationProxy: created for object "+pTargetObject);
|
||||
}
|
||||
mTargetObject = pTargetObject;
|
||||
if (mTargetObject == null){
|
||||
throw new IllegalArgumentException("InvocationProxy requires a target");
|
||||
}
|
||||
// JNI code apparently bypasses this check and could operate against
|
||||
// protected classes. This seems like a security issue...
|
||||
// mayb eit was because JNI code isn't in a package?
|
||||
if (!java.lang.reflect.Modifier.isPublic(
|
||||
pTargetObject.getClass().getModifiers())){
|
||||
throw new IllegalArgumentException(
|
||||
"InvocationProxy only public classes can receive event notifications");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* the method actually invoked by EventProxy.cpp
|
||||
* @param methodName name of method in mTargetObject we will invoke
|
||||
* @param targetParameter Variant[] that is the single parameter to the method
|
||||
*/
|
||||
public void invoke(String methodName, Variant targetParameter[]){
|
||||
if (mTargetObject == null){
|
||||
if (JacobObject.isDebugEnabled()){
|
||||
JacobObject.debug(
|
||||
"InvocationProxy: received notification with no target set");
|
||||
}
|
||||
return;
|
||||
}
|
||||
Class targetClass = mTargetObject.getClass();
|
||||
if (methodName == null){
|
||||
throw new IllegalArgumentException("InvocationProxy: missing method name");
|
||||
}
|
||||
if (targetParameter == null){
|
||||
throw new IllegalArgumentException("InvocationProxy: missing Variant parameters");
|
||||
}
|
||||
try {
|
||||
// should wrap in debug flag
|
||||
if (JacobObject.isDebugEnabled()){
|
||||
JacobObject.debug("InvocationProxy: trying to invoke "+methodName
|
||||
+" on "+mTargetObject);
|
||||
}
|
||||
Method targetMethod = targetClass.getMethod(methodName,
|
||||
new Class[] {Variant[].class});
|
||||
if (targetMethod != null){
|
||||
// protected classes can't be invoked against even if they
|
||||
// let you grab the method. you could do targetMethod.setAccessible(true);
|
||||
// but that should be stopped by the security manager
|
||||
targetMethod.invoke(mTargetObject,new Object[] {targetParameter});
|
||||
}
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchMethodException e) {
|
||||
// this happens whenever the listener doesn't implement all the methods
|
||||
if (JacobObject.isDebugEnabled()){
|
||||
JacobObject.debug("InvocationProxy: listener doesn't implement "
|
||||
+ methodName);
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
if (JacobObject.isDebugEnabled()){
|
||||
JacobObject.debug("InvocationProxy: probably tried to access public method on non public class"
|
||||
+ methodName);
|
||||
}
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* used by EventProxy.cpp to create variant objects in the right thread
|
||||
* @return Variant object that will be used by the COM layer
|
||||
*/
|
||||
public Variant getVariant(){
|
||||
return new VariantViaEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* helper method used by DispatchEvents to help clean up and reduce references
|
||||
*
|
||||
*/
|
||||
protected void clearTarget(){
|
||||
mTargetObject = null;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* The superclass of all Jacob objects. It is used to
|
||||
@@ -46,7 +34,19 @@ import java.util.ResourceBundle;
|
||||
* result in a segmentation violation.
|
||||
*/
|
||||
public class JacobObject {
|
||||
/**
|
||||
* holds the build version as retrieved from the version.properties
|
||||
* file that exists in the JAR.
|
||||
* This can be retrived by calling the static method getBuildVersion()
|
||||
* @see getBuildVersion()
|
||||
*/
|
||||
private static String buildVersion = "";
|
||||
/**
|
||||
* holds the build date as retrieved from the version.properties
|
||||
* file that exists in the JAR
|
||||
* This can be retrived by calling the static method getBuildDate()
|
||||
* @see getBuildDate()
|
||||
*/
|
||||
private static String buildDate = "";
|
||||
|
||||
/**
|
||||
@@ -109,7 +109,8 @@ public class JacobObject {
|
||||
public void safeRelease() {
|
||||
// currently does nothing - subclasses may do something
|
||||
if (isDebugEnabled()){
|
||||
debug(this.getClass().getName()+":"+this.hashCode()+" release");
|
||||
// this used to do a toString() but that is bad for SafeArray
|
||||
debug("SafeRelease: "+this.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +133,8 @@ public class JacobObject {
|
||||
{
|
||||
if(isDebugEnabled())
|
||||
{
|
||||
System.out.println(istrMessage);
|
||||
System.out.println(istrMessage
|
||||
+ " in thread "+ Thread.currentThread().getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
|
||||
@@ -1,31 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
@@ -75,7 +65,9 @@ public abstract class ROT {
|
||||
// nothing to do
|
||||
} else {
|
||||
Map tab = null;
|
||||
if (JacobObject.isDebugEnabled()){ JacobObject.debug("Automatic GC flag == "+USE_AUTOMATIC_GARBAGE_COLLECTION);}
|
||||
if (JacobObject.isDebugEnabled()){
|
||||
JacobObject.debug("ROT: Automatic GC flag == "+ USE_AUTOMATIC_GARBAGE_COLLECTION
|
||||
);}
|
||||
if (!USE_AUTOMATIC_GARBAGE_COLLECTION){
|
||||
tab = new HashMap();
|
||||
} else {
|
||||
@@ -112,8 +104,13 @@ public abstract class ROT {
|
||||
*/
|
||||
protected static void clearObjects() {
|
||||
Map tab = getThreadObjects(false);
|
||||
if (JacobObject.isDebugEnabled()){ JacobObject.debug("starting clear objects");}
|
||||
if (JacobObject.isDebugEnabled()){
|
||||
JacobObject.debug("ROT: "+rot.keySet().size()+" thread tables exist");
|
||||
}
|
||||
if (tab != null){
|
||||
if (JacobObject.isDebugEnabled()){
|
||||
JacobObject.debug("ROT: "+tab.keySet().size()+ " objects to clear in this thread " );
|
||||
}
|
||||
// walk the values
|
||||
Iterator it;
|
||||
if (USE_AUTOMATIC_GARBAGE_COLLECTION){
|
||||
@@ -128,7 +125,15 @@ public abstract class ROT {
|
||||
// and we get an exceptin modifying the collection while iterating
|
||||
// && o.toString() != null
|
||||
){
|
||||
if (JacobObject.isDebugEnabled()){ JacobObject.debug(" removing "+o.getClass().getName());}
|
||||
if (JacobObject.isDebugEnabled()){
|
||||
if (o instanceof SafeArray){
|
||||
// SafeArray create more objects when calling toString()
|
||||
// which causes a concurrent modification exception in HashMap
|
||||
JacobObject.debug("ROT: removing "+o.getClass().getName());
|
||||
} else {
|
||||
JacobObject.debug("ROT: removing "+o+"->"+o.getClass().getName());
|
||||
}
|
||||
}
|
||||
o.safeRelease();
|
||||
}
|
||||
// used to be an iterator.remove() but why bother when we're nuking them all anyway?
|
||||
@@ -137,8 +142,11 @@ public abstract class ROT {
|
||||
tab.clear();
|
||||
// remove the collection from rot
|
||||
rot.remove(Thread.currentThread().getName());
|
||||
if (JacobObject.isDebugEnabled()){
|
||||
JacobObject.debug("ROT: thread table cleared and removed");
|
||||
}
|
||||
} else {
|
||||
if (JacobObject.isDebugEnabled()){ JacobObject.debug("nothing to clear!");}
|
||||
if (JacobObject.isDebugEnabled()){ JacobObject.debug("ROT: nothing to clear!");}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,8 +200,6 @@ public abstract class ROT {
|
||||
* @param o
|
||||
*/
|
||||
protected static void addObject(JacobObject o) {
|
||||
String t_name = Thread.currentThread().getName();
|
||||
if (JacobObject.isDebugEnabled()){ JacobObject.debug(" add:"+o+"->"+o.getClass().getName());}
|
||||
Map tab = getThreadObjects(false);
|
||||
if (tab == null) {
|
||||
// this thread has not been initialized as a COM thread
|
||||
@@ -201,9 +207,12 @@ public abstract class ROT {
|
||||
ComThread.InitMTA(false);
|
||||
tab = getThreadObjects(true);
|
||||
}
|
||||
if (JacobObject.isDebugEnabled()){
|
||||
JacobObject.debug(
|
||||
"ROT: adding "+o+"->"+o.getClass().getName() +
|
||||
" table size prior to addition:" +tab.size());}
|
||||
if (tab != null) {
|
||||
tab.put(getMapKey(tab,o),getMapValue(tab,o));
|
||||
if (JacobObject.isDebugEnabled()){ JacobObject.debug(" ROT thread table size after addition is :"+tab.size());}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ package com.jacob.com;
|
||||
*/
|
||||
public class STA extends Thread {
|
||||
/**
|
||||
* TODO: no references exist to this. should it be dropped
|
||||
* referenced by STA.cpp
|
||||
*/
|
||||
public int threadID;
|
||||
|
||||
|
||||
@@ -67,11 +67,19 @@ public class SafeArray extends JacobObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param vt
|
||||
* @param lbounds
|
||||
* @param celems
|
||||
*/
|
||||
* constructor (needs more java doc)
|
||||
*
|
||||
* With the addition of N-dimensional array support
|
||||
*
|
||||
* You create an N-D SafeArray by: SafeArray sa = new
|
||||
* SafeArray(Variant.VariantVariant, new int[] {0,0,0,0}, new int[]
|
||||
* {4,4,4,4}); Where the 1st array is lower bounds and 2nd has the lengths
|
||||
* of each dimension *
|
||||
*
|
||||
* @param vt
|
||||
* @param lbounds
|
||||
* @param celems
|
||||
*/
|
||||
public SafeArray(int vt, int lbounds[], int celems[]) {
|
||||
init(vt, lbounds, celems);
|
||||
}
|
||||
@@ -547,7 +555,7 @@ public class SafeArray extends JacobObject {
|
||||
public native void setByte(int sa_idx1, int sa_idx2, byte c);
|
||||
|
||||
/**
|
||||
* Fills byte array(?) from contents of this array
|
||||
* Fills byte array from contents of this array
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
@@ -753,6 +761,127 @@ public class SafeArray extends JacobObject {
|
||||
return s;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* The beginning of N-dimensional array support
|
||||
*================================================================*/
|
||||
|
||||
/**
|
||||
* get Variant value from N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
*/
|
||||
public native Variant getVariant(int indices[]);
|
||||
|
||||
/**
|
||||
* set Variant value in N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
* @param v
|
||||
*/
|
||||
public native void setVariant(int indices[], Variant v);
|
||||
|
||||
|
||||
/**
|
||||
* get char value from N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
*/
|
||||
public native char getChar(int indices[]);
|
||||
|
||||
/**
|
||||
* set char value in N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
* @param c
|
||||
*/
|
||||
public native void setChar(int indices[], char c);
|
||||
|
||||
/**
|
||||
* get int value from N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
*/
|
||||
public native int getInt(int indices[]);
|
||||
|
||||
/**
|
||||
* set int value in N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
* @param c
|
||||
*/
|
||||
public native void setInt(int indices[], int c);
|
||||
|
||||
/**
|
||||
* get short value from N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
*/
|
||||
public native short getShort(int indices[]);
|
||||
|
||||
/**
|
||||
* set short value in N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
* @param c
|
||||
*/
|
||||
public native void setShort(int indices[], short c);
|
||||
|
||||
/**
|
||||
* get double value from N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
*/
|
||||
public native double getDouble(int indices[]);
|
||||
|
||||
/**
|
||||
* set double value in N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
* @param c
|
||||
*/
|
||||
public native void setDouble(int indices[], double c);
|
||||
|
||||
/**
|
||||
* get String value from N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
*/
|
||||
public native String getString(int indices[]);
|
||||
|
||||
/**
|
||||
* set Stringvalue in N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
* @param c
|
||||
*/
|
||||
public native void setString(int indices[], String c);
|
||||
|
||||
/**
|
||||
* get byte value from N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
*/
|
||||
public native byte getByte(int indices[]);
|
||||
|
||||
/**
|
||||
* set byte value in N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
* @param c
|
||||
*/
|
||||
public native void setByte(int indices[], byte c);
|
||||
|
||||
/**
|
||||
* get float value from N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
*/
|
||||
public native float getFloat(int indices[]);
|
||||
|
||||
/**
|
||||
* set float value in N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
* @param c
|
||||
*/
|
||||
public native void setFloat(int indices[], float c);
|
||||
|
||||
/**
|
||||
* get boolean value from N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
*/
|
||||
public native boolean getBoolean(int indices[]);
|
||||
/**
|
||||
* set boolean value in N-dimensional array
|
||||
* @param indices - length must equal Dimension of SafeArray
|
||||
* @param c
|
||||
*/
|
||||
public native void setBoolean(int indices[], boolean c);
|
||||
|
||||
static {
|
||||
System.loadLibrary("jacob");
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* The multi-format data type used for all call backs and most communications
|
||||
* between Java and COM. It provides a single class that can handle all data
|
||||
@@ -122,13 +124,21 @@ public class Variant extends JacobObject implements java.io.Serializable {
|
||||
/** variant's type is a reference (to IDispatch?) */
|
||||
public static final short VariantByref = 16384;
|
||||
|
||||
/** @return the value of this variant as an int */
|
||||
/**
|
||||
* @return the value of this variant as an int
|
||||
* (after possible conversion)
|
||||
*/
|
||||
public native int toInt();
|
||||
|
||||
/** @return the value of this variant as a date */
|
||||
/**
|
||||
* @return the value of this variant as a date
|
||||
* (after possible conversion)
|
||||
*/
|
||||
public native double toDate();
|
||||
|
||||
/** @return the value of this variant as boolean */
|
||||
/**
|
||||
* @return the value of this variant as boolean (after possible conversion)
|
||||
*/
|
||||
public native boolean toBoolean();
|
||||
|
||||
/** @return the value of this variant as an enumeration (java style) */
|
||||
@@ -208,6 +218,21 @@ public class Variant extends JacobObject implements java.io.Serializable {
|
||||
*/
|
||||
public native void putDateRef(double in);
|
||||
|
||||
/**
|
||||
* converts a java date to a windows time and calls putDateRef(double)
|
||||
* SF 959382
|
||||
* @throws IllegalArgumentException if inDate = null
|
||||
* @param inDate a Java date to be converted
|
||||
*/
|
||||
public void putDateRef(Date inDate){
|
||||
if (inDate == null){
|
||||
throw new IllegalArgumentException("Cannot put null in as windows date");
|
||||
// do nothing
|
||||
} else {
|
||||
putDateRef(DateUtilities.convertDateToWindowsTime(inDate));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* set the content of this variant to a string (VT_BSTR|VT_BYREF)
|
||||
* @param in
|
||||
@@ -250,6 +275,21 @@ public class Variant extends JacobObject implements java.io.Serializable {
|
||||
*/
|
||||
public native double getDateRef();
|
||||
|
||||
/**
|
||||
* returns the windows time contained in this Variant to a Java Date
|
||||
* should return null if this is not a date reference Variant
|
||||
* SF 959382
|
||||
* @return java.util.Date
|
||||
*/
|
||||
public Date getJavaDateRef(){
|
||||
double windowsDate = getDateRef();
|
||||
if (windowsDate == 0){
|
||||
return null;
|
||||
} else {
|
||||
return DateUtilities.convertWindowsTimeToDate(getDate());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the content of this variant as a string
|
||||
* @return String
|
||||
@@ -300,6 +340,21 @@ public class Variant extends JacobObject implements java.io.Serializable {
|
||||
*/
|
||||
public native double getDate();
|
||||
|
||||
/**
|
||||
* returns the windows time contained in this Variant to a Java Date
|
||||
* should return null if this is not a date Variant
|
||||
* SF 959382
|
||||
* @return java.util.Date
|
||||
*/
|
||||
public Date getJavaDate(){
|
||||
double windowsDate = getDate();
|
||||
if (windowsDate == 0){
|
||||
return null;
|
||||
} else {
|
||||
return DateUtilities.convertWindowsTimeToDate(getDate());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* set the value of this variant
|
||||
* @param in
|
||||
@@ -312,8 +367,24 @@ public class Variant extends JacobObject implements java.io.Serializable {
|
||||
*/
|
||||
public native void putDate(double in);
|
||||
|
||||
/**
|
||||
* converts a java date to a windows time and calls putDate(double)
|
||||
* SF 959382
|
||||
* @throws IllegalArgumentException if inDate = null
|
||||
* @param inDate a Java date to be converted
|
||||
*/
|
||||
public void putDate(Date inDate){
|
||||
if (inDate == null){
|
||||
throw new IllegalArgumentException("Cannot put null in as windows date");
|
||||
// do nothing
|
||||
} else {
|
||||
putDate(DateUtilities.convertDateToWindowsTime(inDate));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* attempts to return the content of this variant as a double
|
||||
* (after possible conversion)
|
||||
* @return byte
|
||||
*/
|
||||
public native byte toByte();
|
||||
@@ -334,8 +405,16 @@ public class Variant extends JacobObject implements java.io.Serializable {
|
||||
putObject(in);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the value in this Variant as a boolean, null if not a boolean
|
||||
*/
|
||||
public native boolean getBoolean();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the value in this Variant as a byte, null if not a byte
|
||||
*/
|
||||
public native byte getByte();
|
||||
|
||||
public native void putBoolean(boolean in);
|
||||
@@ -369,6 +448,10 @@ public class Variant extends JacobObject implements java.io.Serializable {
|
||||
|
||||
public native void putDouble(double in);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the value in this Variant as a long, null if not a long
|
||||
*/
|
||||
public native long getCurrency();
|
||||
|
||||
public native void putFloatRef(float in);
|
||||
@@ -401,6 +484,11 @@ public class Variant extends JacobObject implements java.io.Serializable {
|
||||
|
||||
public native byte getByteRef();
|
||||
|
||||
/**
|
||||
* attempts to return the contents of this variant as a float
|
||||
* (after possible conversion)
|
||||
* @return float
|
||||
*/
|
||||
public native float toFloat();
|
||||
|
||||
/**
|
||||
@@ -472,8 +560,7 @@ public class Variant extends JacobObject implements java.io.Serializable {
|
||||
init();
|
||||
putEmpty();
|
||||
if (isDebugEnabled()) {
|
||||
debug("create " + getClass().getName() + " in thread "
|
||||
+ Thread.currentThread().getName());
|
||||
debug("Variant: " + "create " + this );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -626,6 +713,11 @@ public class Variant extends JacobObject implements java.io.Serializable {
|
||||
|
||||
public native short getvt();
|
||||
|
||||
/**
|
||||
* attempts tor return the contents of this Variant as a short
|
||||
* (after possible conversion)
|
||||
* @return short
|
||||
*/
|
||||
public native short toShort();
|
||||
|
||||
/**
|
||||
@@ -662,7 +754,7 @@ public class Variant extends JacobObject implements java.io.Serializable {
|
||||
// this should almost always happen due to gc
|
||||
// after someone has called ComThread.Release
|
||||
if (isDebugEnabled()) {
|
||||
debug(this.getClass().getName() + ":" + this.hashCode()
|
||||
debug("Variant: " + this.hashCode()
|
||||
+ " double release");
|
||||
//Throwable x = new Throwable();
|
||||
//x.printStackTrace();
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at www.sourceforge.net/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,10 +27,15 @@
|
||||
package com.jacob.com;
|
||||
|
||||
/**
|
||||
* TODO: Exception thrown when? No references found
|
||||
* thrown in util.cpp
|
||||
*/
|
||||
public class WrongThreadException extends RuntimeException {
|
||||
/**
|
||||
* identifier generated by Eclipse
|
||||
*/
|
||||
private static final long serialVersionUID = 6308780364980228692L;
|
||||
|
||||
/**
|
||||
* standard 0 arg constructor with no message
|
||||
*
|
||||
*/
|
||||
|
||||
44
unittest/com/jacob/com/DateUtilitiesTest.java
Normal file
44
unittest/com/jacob/com/DateUtilitiesTest.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.jacob.com;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import com.jacob.com.DateUtilities;
|
||||
|
||||
/**
|
||||
* test cases that should exercise the new date conversion code
|
||||
* run this test with options
|
||||
* <code>-Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=true -Dcom.jacob.debug=false</code>
|
||||
* @author joe
|
||||
*
|
||||
*/
|
||||
|
||||
public class DateUtilitiesTest {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Date now = new Date();
|
||||
double comTimeForNow = DateUtilities.convertDateToWindowsTime(now);
|
||||
Date retrievedNow = DateUtilities.convertWindowsTimeToDate(comTimeForNow);
|
||||
if (!now.equals(retrievedNow)){
|
||||
System.out.println("Variant Date Test failed " +now+ " != " +retrievedNow );
|
||||
} else {
|
||||
System.out.println("Variant Date Test passed");
|
||||
}
|
||||
|
||||
// this is a magic time in the windows world
|
||||
Date beginningOfWindowsTime =
|
||||
new GregorianCalendar(1899, Calendar.DECEMBER, 30).getTime();
|
||||
double comTimeForBeginningOfWindowsTime =
|
||||
DateUtilities.convertDateToWindowsTime(beginningOfWindowsTime);
|
||||
if (comTimeForBeginningOfWindowsTime > 0){
|
||||
System.out.println("Beginning of windows time test failed "
|
||||
+comTimeForBeginningOfWindowsTime);
|
||||
} else {
|
||||
System.out.println("Beginning of windows time test passed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -8,7 +8,7 @@ package com.jacob.com;
|
||||
* This will eventually be changed to a unit test.
|
||||
*
|
||||
* Run in Eclipse with command line arguments
|
||||
* -Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=false
|
||||
* -Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=false -Dcom.jacob.debug=false
|
||||
*/
|
||||
public class ROT2Test
|
||||
{
|
||||
@@ -35,8 +35,6 @@ class ROT2TestThread extends Thread
|
||||
{
|
||||
private java.util.List ThreadObjects;
|
||||
|
||||
private boolean DivideMode = true;
|
||||
|
||||
private int initialRunSize = 0;
|
||||
/**
|
||||
* @param arg0
|
||||
|
||||
@@ -35,8 +35,6 @@ class ROT3TestThread extends Thread
|
||||
{
|
||||
private java.util.List ThreadObjects;
|
||||
|
||||
private boolean DivideMode = true;
|
||||
|
||||
private int initialRunSize = 0;
|
||||
/**
|
||||
* @param arg0
|
||||
@@ -74,7 +72,7 @@ class ROT3TestThread extends Thread
|
||||
String message = "";
|
||||
message = getName()+" Workingset=" +ThreadObjects.size()
|
||||
+" ROT: "+ROT.getThreadObjects(true).hashCode();
|
||||
message += "before mods and gc "+ROT.getThreadObjects(true).size()+")";
|
||||
message += " before mods and gc "+ROT.getThreadObjects(true).size()+")";
|
||||
// if there is an odd number of objects greater than 2
|
||||
if (ThreadObjects.size() > 10)
|
||||
{
|
||||
@@ -94,6 +92,8 @@ class ROT3TestThread extends Thread
|
||||
{
|
||||
// remove the reference so gc can get it
|
||||
if (!ROT.USE_AUTOMATIC_GARBAGE_COLLECTION){
|
||||
// uses deprecated API to set up a special situation
|
||||
// because this is an ROT test
|
||||
ROT.removeObject((JacobObject)ThreadObjects.get(i-1));
|
||||
}
|
||||
ThreadObjects.remove(i-1);
|
||||
|
||||
@@ -87,6 +87,9 @@ public class SafeArrayReleaseTest
|
||||
a1.setVariant(1, new Variant("bar"));
|
||||
Variant v = new Variant(a1);
|
||||
SafeArray a2 = v.toSafeArray(true);
|
||||
if (a2 == null){
|
||||
System.out.println("got null back from toSafeArray()");
|
||||
}
|
||||
}
|
||||
ComThread.Release();
|
||||
System.gc();
|
||||
|
||||
29
unittest/com/jacob/com/VariantDateTest.java
Normal file
29
unittest/com/jacob/com/VariantDateTest.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.jacob.com;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.jacob.com.Variant;
|
||||
|
||||
/**
|
||||
* test cases that should exercise the new date conversion code
|
||||
* run this test with options
|
||||
* <code>-Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=true -Dcom.jacob.debug=false</code>
|
||||
* @author joe
|
||||
*
|
||||
*/
|
||||
public class VariantDateTest {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Date now = new Date();
|
||||
Variant holder = new Variant();
|
||||
holder.putDate(now);
|
||||
Date retrievedNow = holder.getJavaDate();
|
||||
if (!now.equals(retrievedNow)){
|
||||
System.out.println("Variant Date Test failed " +now+ " != " +retrievedNow );
|
||||
} else {
|
||||
System.out.println("Variant Date Test passed");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user