Permalink
Browse files

Merge branch 'master' into ignore-unrecognized

  • Loading branch information...
marscher committed Nov 4, 2018
2 parents 2205ca9 + e4d445e commit 282804613635eb343b558396b0ef6b78dbc59c73
Showing with 23,382 additions and 23,766 deletions.
  1. +1 −1 .bumpversion.cfg
  2. +12 −0 .gitattributes
  3. +4 −4 .travis.yml
  4. +2 −0 AUTHORS.rst
  5. +1 −0 MANIFEST.in
  6. +1 −1 appveyor.yml
  7. +27 −13 doc/CHANGELOG.rst
  8. +10 −3 doc/conf.py
  9. +28 −6 doc/install.rst
  10. +7 −7 doc/userguide.rst
  11. +39 −39 examples/jms/README.TXT
  12. +35 −35 examples/jms/testJpypePublisher.py
  13. +42 −42 examples/jms/testJpypeSubscriber.py
  14. +20 −20 examples/linux/README.TXT
  15. +20 −20 examples/linux/findjvm.py
  16. +22 −22 examples/linux/jpype.sh
  17. +32 −32 examples/rmi.py
  18. +24 −24 jpype/JClassUtil.py
  19. +42 −42 jpype/__init__.py
  20. +6 −3 jpype/_core.py
  21. +91 −0 jpype/_cygwin.py
  22. +72 −72 jpype/_darwin.py
  23. +36 −36 jpype/_gui.py
  24. +207 −204 jpype/_jarray.py
  25. +295 −295 jpype/_jclass.py
  26. +286 −286 jpype/_jcollection.py
  27. +74 −74 jpype/_jexception.py
  28. +31 −31 jpype/_jobject.py
  29. +60 −62 jpype/_jpackage.py
  30. +71 −71 jpype/_jproxy.py
  31. +187 −187 jpype/_jvmfinder.py
  32. +105 −105 jpype/_jwrapper.py
  33. +64 −64 jpype/_linux.py
  34. +89 −89 jpype/_properties.py
  35. +24 −24 jpype/_pykeywords.py
  36. +30 −32 jpype/_refdaemon.py
  37. +119 −119 jpype/_windows.py
  38. +17 −17 jpype/awt/__init__.py
  39. +27 −27 jpype/awt/event/WindowAdapter.py
  40. +17 −17 jpype/awt/event/__init__.py
  41. +67 −43 jpype/imports.py
  42. +39 −39 jpype/nio.py
  43. +48 −46 jpype/reflect.py
  44. +17 −17 jpypex/__init__.py
  45. +62 −62 jpypex/swing/AbstractAction.py
  46. +17 −17 jpypex/swing/__init__.py
  47. +28 −28 jpypex/swing/pyutils.py
  48. +25 −0 native/build.xml
  49. +70 −70 native/common/include/jp_array.h
  50. +46 −46 native/common/include/jp_arrayclass.h
  51. +68 −0 native/common/include/jp_booleantype.h
  52. +74 −0 native/common/include/jp_bytetype.h
  53. +72 −0 native/common/include/jp_chartype.h
  54. +108 −108 native/common/include/jp_class.h
  55. +50 −50 native/common/include/jp_classbase.h
  56. +67 −0 native/common/include/jp_doubletype.h
  57. +87 −119 native/common/include/jp_env.h
  58. +132 −0 native/common/include/jp_exception.h
  59. +74 −74 native/common/include/jp_field.h
  60. +68 −0 native/common/include/jp_floattype.h
  61. +153 −157 native/common/include/jp_hostenv.h
  62. +70 −0 native/common/include/jp_inttype.h
  63. +0 −160 native/common/include/jp_javaenv.h
  64. +0 −468 native/common/include/jp_javaenv_autogen.h
  65. +353 −0 native/common/include/jp_javaframe.h
  66. +40 −23 native/common/include/{jp_invocationhandler.h → jp_jcharstring.h}
  67. +186 −190 native/common/include/jp_jniutil.h
  68. +69 −0 native/common/include/jp_longtype.h
  69. +76 −80 native/common/include/jp_method.h
  70. +88 −88 native/common/include/jp_methodoverload.h
  71. +30 −30 native/common/include/jp_monitor.h
  72. +48 −48 native/common/include/jp_object.h
  73. +27 −27 native/common/include/jp_objectbase.h
  74. +105 −105 native/common/include/jp_objecttypes.h
  75. +70 −70 native/common/include/jp_platform_linux.h
  76. +81 −81 native/common/include/jp_platform_win32.h
  77. +166 −0 native/common/include/jp_primitive_common.h
  78. +62 −0 native/common/include/jp_primitivetype.h
  79. +0 −455 native/common/include/jp_primitivetypes.h
  80. +44 −49 native/common/include/jp_proxy.h
  81. +33 −23 native/common/include/{jp_reference.h → jp_reference_queue.h}
  82. +0 −23 native/common/include/jp_referencequeue.h
  83. +71 −0 native/common/include/jp_shorttype.h
  84. +112 −0 native/common/include/jp_tracer.h
  85. +90 −87 native/common/include/jp_type.h
  86. +52 −52 native/common/include/jp_typemanager.h
  87. +124 −124 native/common/include/jp_typename.h
  88. +0 −168 native/common/include/jp_utility.h
  89. +64 −0 native/common/include/jp_voidtype.h
  90. +136 −163 native/common/include/jpype.h
  91. +153 −145 native/common/jp_array.cpp
  92. +194 −194 native/common/jp_arrayclass.cpp
  93. +199 −0 native/common/jp_booleantype.cpp
  94. +234 −0 native/common/jp_bytetype.cpp
  95. +220 −0 native/common/jp_chartype.cpp
  96. +677 −650 native/common/jp_class.cpp
  97. +30 −29 native/common/jp_classbase.cpp
  98. +74 −0 native/common/jp_cleaner.cpp
  99. +208 −0 native/common/jp_doubletype.cpp
  100. +1,482 −366 native/common/jp_env.cpp
  101. +153 −147 native/common/jp_field.cpp
  102. +220 −0 native/common/jp_floattype.cpp
  103. +71 −0 native/common/jp_hostref.cpp
  104. +215 −0 native/common/jp_inttype.cpp
  105. +0 −54 native/common/jp_invocationhandler.cpp
  106. +0 −370 native/common/jp_javaenv.cpp
  107. +0 −1,760 native/common/jp_javaenv_autogen.cpp
  108. +69 −0 native/common/jp_jcharstring.cpp
  109. +731 −818 native/common/jp_jniutil.cpp
  110. +209 −0 native/common/jp_longtype.cpp
  111. +300 −286 native/common/jp_method.cpp
  112. +458 −456 native/common/jp_methodoverload.cpp
  113. +37 −30 native/common/jp_monitor.cpp
  114. +110 −108 native/common/jp_object.cpp
  115. +209 −0 native/common/jp_objecttype.cpp
  116. +0 −348 native/common/jp_objecttypes.cpp
  117. +26 −26 native/common/jp_platform_linux.cpp
  118. +25 −25 native/common/jp_platform_win32.cpp
  119. +0 −662 native/common/jp_primitivetypes.cpp
  120. +0 −1,369 native/common/jp_primitivetypes_autogen.cpp
  121. +231 −258 native/common/jp_proxy.cpp
  122. +0 −50 native/common/jp_reference.cpp
  123. +156 −0 native/common/jp_reference_queue.cpp
  124. +0 −99 native/common/jp_referencequeue.cpp
  125. +209 −0 native/common/jp_shorttype.cpp
  126. +144 −0 native/common/jp_stringtype.cpp
  127. +75 −0 native/common/jp_tracer.cpp
  128. +173 −172 native/common/jp_typemanager.cpp
  129. +159 −159 native/common/jp_typename.cpp
  130. +101 −101 native/common/jp_voidtype.cpp
  131. +14 −0 native/java/jpype/JPypeInvocationHandler.java
  132. +39 −0 native/java/jpype/ref/JPypeReference.java
  133. +99 −0 native/java/jpype/ref/JPypeReferenceQueue.java
  134. +2 −2 native/python/include/jp_cocoatools.h
  135. +18 −18 native/python/include/jp_runloopstopper.h
  136. +50 −7 native/python/include/jpype_memory_view.h
  137. +104 −104 native/python/include/jpype_python.h
  138. +58 −58 native/python/include/py_class.h
  139. +41 −41 native/python/include/py_field.h
  140. +245 −248 native/python/include/py_hostenv.h
  141. +56 −56 native/python/include/py_method.h
  142. +35 −35 native/python/include/py_monitor.h
  143. +261 −317 native/python/include/pythonenv.h
  144. +246 −231 native/python/jpype_javaarray.cpp
  145. +51 −58 native/python/jpype_javaclass.cpp
  146. +59 −60 native/python/jpype_javanio.cpp
  147. +10 −3 native/python/{jpype_memory_view.c → jpype_memory_view.cpp}
  148. +359 −452 native/python/jpype_module.cpp
  149. +230 −236 native/python/jpype_python.cpp
  150. +397 −568 native/python/py_class.cpp
  151. +222 −234 native/python/py_field.cpp
  152. +654 −666 native/python/py_hostenv.cpp
  153. +405 −391 native/python/py_method.cpp
  154. +103 −98 native/python/py_monitor.cpp
  155. +562 −519 native/python/pythonenv.cpp
  156. +15 −180 setup.py
  157. +7 −0 setupext/__init__.py
  158. +87 −0 setupext/build_ext.py
  159. +34 −0 setupext/build_java.py
  160. +146 −0 setupext/build_thunk.py
  161. +15 −0 setupext/dist.py
  162. +89 −0 setupext/platform.py
  163. +28 −0 setupext/test_java.py
  164. +16 −0 setupext/utils.py
  165. +24 −24 test/buf_leak_test.py
  166. +54 −54 test/buf_leak_test3.py
  167. +26 −25 test/build.xml
  168. +117 −117 test/convtest.py
  169. +20 −20 test/findjvm.py
  170. +12 −12 test/harness/jpype/array/Test2.java
  171. +47 −47 test/harness/jpype/array/TestArray.java
  172. +12 −12 test/harness/jpype/attr/ClassWithBuffer.java
  173. +21 −21 test/harness/jpype/attr/Holder.java
  174. +20 −20 test/harness/jpype/attr/SubHolder.java
  175. +132 −132 test/harness/jpype/attr/Test1.java
  176. +40 −40 test/harness/jpype/attr/Test2.java
  177. +51 −51 test/harness/jpype/exc/ExceptionTest.java
  178. +21 −21 test/harness/jpype/exc/ExceptionThrower.java
  179. +21 −21 test/harness/jpype/mro/A.java
  180. +20 −20 test/harness/jpype/mro/B.java
  181. +22 −22 test/harness/jpype/mro/C.java
  182. +20 −20 test/harness/jpype/mro/D.java
  183. +20 −20 test/harness/jpype/mro/E.java
  184. +20 −20 test/harness/jpype/mro/F.java
  185. +37 −37 test/harness/jpype/nio/NioReceive.java
  186. +24 −24 test/harness/jpype/numeric/NumericTest.java
  187. +49 −49 test/harness/jpype/objectwrapper/Test1.java
  188. +66 −66 test/harness/jpype/proxy/ProxyTriggers.java
  189. +24 −24 test/harness/jpype/proxy/TestInterface2.java
  190. +21 −21 test/harness/jpype/proxy/TestInterface3.java
  191. +44 −44 test/harness/jpype/ref/TestReferenceQeue.java
  192. +23 −23 test/harness/jpype/rmi/IServer.java
  193. +59 −59 test/harness/jpype/rmi/ServerImpl.java
  194. +20 −20 test/harness/jpype/serial/SerializationTest.java
  195. +124 −124 test/harness/jpype/xml/DelegateHandler.java
  196. +57 −57 test/java_dom.py
  197. +74 −74 test/java_sax.py
  198. +55 −55 test/jpypetest/__init__.py
  199. +306 −287 test/jpypetest/array.py
  200. +272 −272 test/jpypetest/attr.py
  201. +48 −48 test/jpypetest/common.py
  202. +83 −83 test/jpypetest/exc.py
  203. +27 −27 test/jpypetest/mro.py
  204. +85 −85 test/jpypetest/numeric.py
  205. +82 −82 test/jpypetest/objectwrapper.py
  206. +166 −166 test/jpypetest/overloads.py
  207. +146 −146 test/jpypetest/proxy.py
  208. +55 −55 test/jpypetest/serial.py
  209. +31 −31 test/lists_and_maps.py
  210. +49 −49 test/python_dom.py
  211. +2,137 −2,137 test/sample/big.xml
  212. +23 −23 test/stub.py
  213. +16 −16 test/test_awt.py
  214. +1 −1 test/test_jarray_fixes.py
  215. +33 −33 test/testlucene.py
  216. +49 −49 test/testsuite.py
  217. +1 −0 thunk/README
  218. +24 −0 thunk/build.xml
  219. +48 −0 thunk/dumpclass.py
  220. +16 −0 thunk/src/jpype/JPypeInvocationHandler.java
  221. +39 −0 thunk/src/jpype/ref/JPypeReference.java
  222. +93 −0 thunk/src/jpype/ref/JPypeReferenceQueue.java
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.6.2
current_version = 0.6.3
commit = True
tag = True
@@ -0,0 +1,12 @@
* test=auto
# Specify lf for all source files
*.py text eol=lf
*.cpp text eol=lf
*.c text eol=lf
*.h text eol=lf
*.xml text eol=lf
*.txt text
.gitignore text eol=lf
.gitattributes text eol=lf
@@ -21,23 +21,23 @@ addons:
env:
# one build with and without numpy support (opt numpy out)
- NUMPY="--install-option=--disable-numpy"
- NUMPY="--global-option=--disable-numpy"
- NUMPY=""
matrix:
allow_failures:
- python: 'pypy'
env: NUMPY="--install-option=--disable-numpy"
env: NUMPY="--global-option=--disable-numpy"
- python: 'pypy3'
env: NUMPY="--install-option=--disable-numpy"
env: NUMPY="--global-option=--disable-numpy"
- python: 'pypy'
env: NUMPY=""
- python: 'pypy3'
env: NUMPY=""
- python: 'nightly'
env: NUMPY=""
- python: 'nightly'
env: NUMPY="--install-option=--disable-numpy"
env: NUMPY="--global-option=--disable-numpy"
install:
- pip install . $NUMPY
@@ -21,3 +21,5 @@ Huge thanks to these CONTRIBUTORS:
* Kristi
* Martin K. Scherer
* Dongwon Shin
* rbprogrammer
* Karl Einar Nelson
@@ -3,5 +3,6 @@ recursive-include examples *
include *.rst doc/* LICENSE
# include everything under test/
graft test
graft setupext
global-exclude *.pyc
prune test/classes
@@ -4,7 +4,7 @@ environment:
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd"
ANT_HOME: "C:\\ProgramData\\chocolatey\\lib\\ant\\apache-ant-1.10.1"
ANT_HOME: "C:\\ProgramData\\chocolatey\\lib\\ant\\apache-ant-1.10.5"
NUMPY_: "numpy x.x"
JAVA_HOME: "C:\\jdk8"
CINST_OPTS:
@@ -8,47 +8,61 @@ This changelog *only* contains changes from the *first* pypi release (0.5.4.3) o
Use `ignoreUnrecognized=True` to get previous behavior.
- Java reference counting has been converted to use JNI
- Added extra verbiage to the to the raised exception when an overloaded
method could not be matched. It now prints a list of all possible method
signatures.
- Harded code to unattached threads and accessing java objects after shutdown.
- The following is now DEPRECATED
- jpype.reflect.* - All class information is available with .class_
- Python thread option for JPypeReferenceQueue. References are always handled with
with the Java cleanup routine. The undocumented setUsePythonThreadForDaemon()
will be removed at a future version.
- promoted --install-option to a --global-option as it applies to the build as well
as install.
- **0.6.3 - 2018-04-03**
- Java reference counting has been converted to use JNI
PushLocalFrame/PopLocalFrame. Several resource leaks
were removed.
- java.lang.Class<>.forName() will now return the java.lang.Class.
- java.lang.Class<>.forName() will now return the java.lang.Class.
Work arounds for requiring the class loader are no longer needed.
Customizers now support customization of static members.
- Support of java.lang.Class<>
- java.lang.Object().getClass() on Java objects returns a java.lang.Class
- Support of java.lang.Class<>
- java.lang.Object().getClass() on Java objects returns a java.lang.Class
rather than the Python class
- java.lang.Object().__class__ on Java objects returns the python class
- java.lang.Object().__class__ on Java objects returns the python class
as do all python objects
- java.lang.Object.class_ maps to the java statement 'java.lang.Object.class' and
returns the java.lang.Class<java.lang.Object>
returns the java.lang.Class<java.lang.Object>
- java.lang.Class supports reflection methods
- private fields and methods can be accessed via reflection
- annotations are avaiable via reflection
- Java objects and arrays will not accept setattr unless the
attribute corresponds to a java method or field whith
the exception of private attributes that begin with
- Java objects and arrays will not accept setattr unless the
attribute corresponds to a java method or field whith
the exception of private attributes that begin with
underscore.
- Added support for automatic conversion of boxed types.
- Added support for automatic conversion of boxed types.
- Boxed types automatically convert to python primitives.
- Boxed types automatically convert to java primitives when resolving functions.
- Functions taking boxed or primitives still resolve based on closest match.
- Python integer primitives will implicitly match java float and double as per
Java specification.
- Added support for try with resources for java.lang.Closeable.
- Added support for try with resources for java.lang.Closeable.
Use python "with MyJavaResource() as resource:" statement
to automatically close a resource at the end of a block.
- **0.6.2 - 2017-01-13**
- Fix JVM location for OSX.
- Fix a method overload bug.
- Add support for synthetic methods
- Add support for synthetic methods
- **0.6.1 - 2015-08-05**
- Fix proxy with arguments issue.
@@ -136,7 +150,7 @@ This changelog *only* contains changes from the *first* pypi release (0.5.4.3) o
- Fix memory leak in array setters
- Fix memory leak in typemanager
- Add userguide from sourceforge project by @baztian
- **0.5.4.5 - 2013-08-25**
- Added support for OSX 10.9 Mavericks by @rmangino (#16)
@@ -18,7 +18,7 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))
# -- General configuration ------------------------------------------------
@@ -44,14 +44,21 @@
# General information about the project.
project = u'JPype'
copyright = u'2014, Steve Menard, Luis Nell and others'
copyright = u'2014-18, Steve Menard, Luis Nell and others'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
import mock
mock_modules = ('_jpype',
)
for m in mock_modules:
sys.modules[m] = mock.MagicMock()
import jpype
print(jpype.__path__)
version = jpype.__version__
# The full version, including alpha/beta/rc tags.
release = jpype.__version__
@@ -138,7 +145,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
#html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
@@ -1,7 +1,7 @@
Installation
============
Get JPype from the `github <https://github.com/originell/jpype>`__ or
Get JPype from the `github <https://github.com/jpype-project/jpype>`__ or
from `PyPi <http://pypi.python.org/pypi/JPype1>`__. If you are using `Anaconda <https://anaconda.org>`_ Python stack,
you can install pre-compiled binaries from conda-forge for Linux, OSX and Windows.
@@ -20,12 +20,12 @@ Either the Sun/Oracle JDK/JRE Variant or OpenJDK. Python 2.6+ (including Python
Debian/Ubuntu
~~~~~~~~~~~~~
Debian/Ubuntu users will have to install ``g++`` and ``python-dev``
Debian/Ubuntu users will have to install ``g++``, ``python-dev``, and ``ant``
first:
::
sudo apt-get install g++ python-dev
sudo apt-get install g++ python-dev python3-dev ant
Windows
~~~~~~~
@@ -35,8 +35,23 @@ Windows users need a Python installation and C++ compilers:
1. Install some version of Python (2.7 or higher), e.g., `Anaconda
<https://www.continuum.io/downloads>`_ is a good choice for users not yet
familiar with the language
2. Install a `Windows C++ Compiler
2. For Python 2 series, Install `Windows C++ Compiler
<http://landinghub.visualstudio.com/visual-cpp-build-tools>`_
3. For Python 3 series, Install `Microsoft Visual Studio 2010 Redistributable Package (x64)
<https://www.microsoft.com/en-us/download/details.aspx?id=14632>`_ and
`Microsoft Build Tools 2015 Update 3
<https://visualstudio.microsoft.com/vs/older-downloads/>`_
4. Install `Apache Ant (tested using 1.9.13)
<https://ant.apache.org/bindownload.cgi>`_
Netbeans ant can be used in place of Apache Ant. Netbeans ant is located in
``${netbeans}/extide/ant/bin/ant.bat``.
The Build Tools 2015 is a pain to find. Microsoft really wants people to download the latest version.
To get to it from the above URL, click on "Redistributables and Build Tools", then select
Microsoft Build Tools 2015 Update 3.
When building for windows you must use the Visual Studio developer command prompt.
Install
-------
@@ -48,6 +63,14 @@ Should be easy as
python setup.py install
For builds with a specific ant, use
::
python setup.py --ant=C:\My\Ant\Path\ant.bat install
If it fails...
~~~~~~~~~~~~~~
@@ -60,7 +83,7 @@ This happens mostly due to the setup not being able to find your
``JAVA\_HOME=/usr/lib/java/jdk1.6.0/ python setup.py install``
2. Please create an Issue `on
github <https://github.com/originell/jpype/issues?state=open>`__ and
github <https://github.com/jpype-project/jpype/issues?state=open>`__ and
post all the information you have.
Tested on
@@ -73,7 +96,6 @@ Tested on
- Debian 7.1 with OpenJDK 1.6.0
- Ubuntu 12.04 with Sun/Oracle JDK 1.6.0
Known Bugs/Limitations
----------------------
@@ -173,7 +173,7 @@ array element but can process all data at once.
If you do not want this optional feature, because eg. it depends on NumPy, you
can opt it out in the installation process by passing *"--disable-numpy"* to
*setup.py*. To opt out with pip you need to append the additional argument
*"--install-option='--disable-numpy'*. This possibility exists since version
*"--global-option='--disable-numpy'*. This possibility exists since version
0.5.6.
Creating Java arrays from Python
@@ -408,26 +408,26 @@ regular Python classes. This contributes to the fact that it is not possible
to catch Java exceptions in a completely straightforward way.
All Java exceptions thrown end up throwing the jpype.JavaException exception.
You can then use the message(), stackTrace() and javaClass() to access
You can then use the message(), stacktrace() and javaClass() to access
extended information.
Here is an example: ::
try :
# Code that throws a java.lang.RuntimeException
except JavaException, ex :
if JavaException.javaClass() is java.lang.RuntimeException :
print "Caught the runtime exception : ", JavaException.message()
print JavaException.stackTrace()
if ex.javaClass() is java.lang.RuntimeException :
print "Caught the runtime exception : ", ex.message()
print ex.stacktrace()
Alternately, you can catch the REAL Java exception directly by using
the JException wrapper. ::
try :
# Code that throws a java.lang.RuntimeException
except jpype.JException(java.lang.RuntimeException), ex :
print "Caught the runtime exception : ", JavaException.message()
print JavaException.stackTrace()
print "Caught the runtime exception : ", ex.message()
print ex.stacktrace()
Known limitations
@@ -1,40 +1,40 @@
This example of using JPype and JMS contributed by David Morgenthaler
Here is the message that accompanied it when he posted it on comp.lang.python :
=============================================================================
Your question intrigued me, so I gave it a try. And the anwer (at
least for JMS Publish/Subscribe TextMessages) is YES.
It includes:
- Java classes for a publisher (src/messaging/JpypePublisher) and a
subscriber (src/messaging/JpypeSubscriber). These Java classes, which
do most of the dirty work of connecting to the JMS server, are used
from python via jpype.
- Java classes that test the publisher and subscriber
(src/messaging/testJpepePublisher, src/messaging/testJpypeSubscriber)
- A Java interface that is used by python for the JProxy
- python scripts for publishing and subscribing
- An build.xml for ant to build and run the Java classes
The Java and python publishers and subscribers work in any reasonable
combination (J pub/J sub, J pub/p sub, p pub/p sub, p pub/J sub, and
even with multiple subscribers)
Copy conveniently located folder. You'll find a build.xml for
ant to build the Java. You'll have to edit (in the testers and in the
python scripts) the naming and connection factory stuff for your
situation. You'll also have to edit the python scripts to correctly
locate your jvm and other classpath information. Once you're correctly
configured, you can use ant to build and/or execute the Java (type
"ant help"). And once the Java is built, you can try the python
versions.
I can't imagine that this approach wouldn't work for JMS Queues. And
while I haven't tested it, I don't see anything preventing the use of
other message types (BinaryMessage, ObjectMessage,...).
BTW, I don't detect any noticable slowdown in the python versions from
the Java versions (probably because of the strightforward conversion
of python strings to Java Strings).
This example of using JPype and JMS contributed by David Morgenthaler
Here is the message that accompanied it when he posted it on comp.lang.python :
=============================================================================
Your question intrigued me, so I gave it a try. And the anwer (at
least for JMS Publish/Subscribe TextMessages) is YES.
It includes:
- Java classes for a publisher (src/messaging/JpypePublisher) and a
subscriber (src/messaging/JpypeSubscriber). These Java classes, which
do most of the dirty work of connecting to the JMS server, are used
from python via jpype.
- Java classes that test the publisher and subscriber
(src/messaging/testJpepePublisher, src/messaging/testJpypeSubscriber)
- A Java interface that is used by python for the JProxy
- python scripts for publishing and subscribing
- An build.xml for ant to build and run the Java classes
The Java and python publishers and subscribers work in any reasonable
combination (J pub/J sub, J pub/p sub, p pub/p sub, p pub/J sub, and
even with multiple subscribers)
Copy conveniently located folder. You'll find a build.xml for
ant to build the Java. You'll have to edit (in the testers and in the
python scripts) the naming and connection factory stuff for your
situation. You'll also have to edit the python scripts to correctly
locate your jvm and other classpath information. Once you're correctly
configured, you can use ant to build and/or execute the Java (type
"ant help"). And once the Java is built, you can try the python
versions.
I can't imagine that this approach wouldn't work for JMS Queues. And
while I haven't tested it, I don't see anything preventing the use of
other message types (BinaryMessage, ObjectMessage,...).
BTW, I don't detect any noticable slowdown in the python versions from
the Java versions (probably because of the strightforward conversion
of python strings to Java Strings).
=============================================================================
Oops, something went wrong.

0 comments on commit 2828046

Please sign in to comment.