Hello,
Thanks for Pyjnius. I am trying to use it to access Java classes. I am looking for info on how to create and populate a HashMap
I have
accessfactory = autoclass('factory.AccessFactory')
options = autoclass('java.util.HashMap')
#AccessFactory.connect(aUser, aRole, aPassword, aDomain, aHost, Integer.parseInt(aPort), new HashMap<String, Object>());
accessfactory.connect('user', 'role', 'password', 'domain', 'host', 8080, options)
which gives
dataaccess.DataException: java.lang.IllegalArgumentException: argument type mismatch
at factory.AccessFactory.connect(AccessFactory.java:721)
Caused by: java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at factory.AccessFactory.connect(AccessFactory.java:713)
Traceback (most recent call last):
File "call_dataaccess.py", line 26, in <module>
accessfactory.connect('user', 'role', 'password', 'domain', 'wiski', 8080, options)
File "jnius_export_class.pxi", line 561, in jnius.JavaMethod.__call__ (jnius\jnius.c:18574)
File "jnius_export_class.pxi", line 727, in jnius.JavaMethod.call_staticmethod (jnius\jnius.c:20416)
File "jnius_utils.pxi", line 43, in jnius.check_exception (jnius\jnius.c:3953)
jnius.JavaException: JVM exception occured
Exception in thread "main"
The method detail is
public static IDataAccess connect(String theUser,
String theRole,
String thePassword,
String theDomain,
String theServer,
int thePort,
HashMap<String,Object> theOptions)
throws DataException
Perform an connect to the data storage.
Parameters:
theUser - the user name
theRole - the role
thePassword - the password
theDomain - the domain
theServer - the server host
thePort - the server port
theOptions - map of options
Returns:
IDataAccess
Throws:
DataException - on error
While some java to achieve the same is
public static void main(String[] args) throws DataException {
// Connect to the server
IDataAccess access =
AccessFactory.connect("user", "role", "password", "domain",
"localhost", 8080, null);
// Get time series object
ITimeSeries ts =
access.getTimeSeries("A7/Ratings/SSS/etc", null);
....