Android Apps using python - java

I found that Android development can be done through Python from the link http://www.linuxplanet.com/linuxplanet/tutorials/7157/1. My question is whether all the libraries that are available in Java are also available in python.
Any of you already started with python on Android if so please indicate links to help get our group up to speed.

No, not all the libraries have been exposed. You can look at the SL4A project on google-code for more information regarding the support it has.
Is this a complete API bridge, or are there restrictions?
BeanShell, JRuby, and Rhino basically give you a complete API bridge (you can invoke Java calls directly). See the documentation for those interpreters for instruction on how to accomplish this. Cross compiled languages like Lua are more restricted. They only have access to the APIs exposed through the RPC layer. See the API reference for a list of currently supported APIs. The RPC layer is easy to extend.

Related

How to create REST API backend using parse.com in Java?

I'm sort of new to http://www.parse.com . And I want to develop backend in Java using REST API. It seems parse.com does not provides direct Java library for REST API development. But I found some third party libraries(un-official) like for Java:
JAVA
Almonds — A Java REST API that mimics the Android API.
mobile-parse-api — This library implements the REST API of parse.com in java with open interfaces for libgdx and playN.
Parse4J — Library for the REST API.
ParseFacade — Parse Android SDK alternative.
But I am not understainding how to get start with these libraries in order to create backend API in Java
#Mahendra
I assume by now you have found your answer. In case you haven't then here is a thought process that might be of interest.
From the little reading I have done on Parse.com it is a sort of like an Object database in itself which provides ready REST style api for all data stored there. See this - https://parse.com/docs/rest/guide
In addition they provide libraries for all popular Front Ends (iOS, Android, JS).
I think they are advocating a paradigm shift for programmers who are used to having a lot of processing on the Backend servers and exposing simpler rest API which provides a processed and targeted response to each http request.
Basically they are suggesting that the whole backend infrastructure (db, app server, server side logic etc) can be replaced by parse.com
If you are considering using Parse.com I assume you have read and understood above mentioned thought process and decided that it makes sense for your project.
I would advise you to consider using a using a common client side Java library that works with the Parse rest api and then use appropriate Client SDK (iOS, Java, JS etc) to work with your library and design the UI. Since you are asking about Java library, I assume your language of choice for storing processing logic is Java.
What I suggest next may be bit of a long shot ... but worth a consideration.
Write code non-ui code in Java and work with the Android API from Parse.com. Use a Java to Objective C. https://github.com/google/j2objc
This will also allow you to use Java code for your web browser (using GWT as a UI framework).
Then write UI code in the framework suited for the platform (obj c for ios, Java for Android, GWT + Java for web browsers) and use the java library to connect to Parse.com.
If you have already tried out such an approach would be good to write back opinions in a comment so the community may benefit.

Use IronPython and Jython as API Tester

We have a server which exposes a set of REST APIs. Those APIs are meant to be exposed for clients on different platform so we want to provide SDKs in Java and .NET
The SDKs are using similiar interface definitions (we keep duplicating interface decration in both languages). Application build on top of Java SDK can be run as a servlet within tomcat container, and application build on top of .NET SDK con be run as an IIS app. It is quite a challenge to maintain multiple language version of SDKs to make sure they all work right. All testing effort becomes doubled.
We are thinking to write 2 'debugger' application, on both SDKs respectively. The applications then can load 'command scripts' which is implemented in Python. The 2 'debugger' application provides very thin API wrappers to make them accessible from Python. So we can use one piece of Python code to test both SDKs.
In detail:
Implement the Java 'debugger' app, and expose its low level API to be accessible from Jython code
Implement the .NET 'debugger' app, and expose its low level API to be accessible from IronPython code.
APIs from Java and .NET 'debugger' should be compatible
Implement all test cases in Python, using the common API.
When Java/.NET app runs, they load those Python scripts, and execute them to make sure functionalities works ok.
So my questions are
is this a feasible way to solve such kind of problem?
Is there any example of solution to similiar problem?
Is there any framework/library that I can leverage?
Thanks in advance for any comments/suggestions!

android use pcap library

I have a general question according an android app, I need to use some pcap functionality in my android app. Because java does not give the possibility in raw packet injections and low layer programming (as far as I know, pls correct me if I'm wrong) so I was looking for an alternative. So far I found the following:
ANDROID NDK
JNETPCAP
Any suggestions which one I should use or does anyone have other suggestions?
The JNI Solution
You need to wrap the calls and the logic you need out of libpcap in C or C++ and expose the underlying functions through JNI (Java Native Interface) so your application can call native code in Java.
The documentation on JNI is pretty complete on internet, a lot of tutorials exists on this subject such as this one.
If you want to easily wrap native code in JNI you can use Swig which allow you to automatically generate JNI code based on your C/C++ native headers.
The obtained JNI code should be compiled using the Android NDK as a dynamic library (.so). This library is to be placed in your application package under libs/. You can then invoke System.loadLibrary(path_to_you_dynamic_library) to load all the symbols contained in the library and use them in Java.
Using a third-party library
If you're afraid of getting headaches while figuring out how to use JNI, you can look at this library which does the hard work for you, and provides an API to manipulate raw sockets in Java.
http://www.savarese.com/software/rocksaw/
You need to wrap the calls and the logic you need out of libpcap in C or C++ and expose the underlying functions through JNI (Java Native Interface) so your application can call native code in Java.
Or you need to get a library that's already done that, such as, err, umm, jNetPcap.
One problem you may have with any attempt to do packet capture on Android - or any other OS using the Linux kernel - is that, by default, the underlying kernel mechanism used by libpcap (PF_PACKET sockets) requires root privileges. If there's a way to run your code as root, or to give it CAP_NET_RAW and possibly CAP_NET_ADMIN privileges, it might be possible to make it work.

How much of Java can I really use with GWT?

I'd like to learn GWT, and I like the fact that it compiles to Javascript. My question is, how much of Java I can really use with GWT? My guess would be that limitations apply mostly for client side, while on the server side I should be able to make use of any existing Java library, right? Or, will I be only able to use a small subset , because of the compilation to Javascript thing?
What are it's limitations? I am interested in what it's not able to do, or things that require too many workarounds to implement. I need to know if learning GWT is a good choice for a possible freelance carrier in web development.
The GWT website has this documentation exactly to answer that question.
See the JRE emulation docs. Those are the supported out of the box emulated classes that you can use.
"Google Web Toolkit includes a library that emulates a subset of the Java runtime library. The list below shows the set of JRE packages, types and methods that GWT can translate automatically. Note that in some cases, only a subset of methods is supported for a given type."
You can also provide your own emulation for other classes using <super-source/> in your gwt.xml to point to a package that will provide replacement Java classes for those that can't be directly compiled to JavaScript.

Java or C++ API for Apache Drill

I want to access Drill through a programming interface. The Apache Drill documentation just mentions about its JAVA and C++ libraries for the client to connect but doesn't provide any documentation or example for the same.
http://drill.apache.org/faq/#what-clients-are-supported?
http://drill.apache.org/docs/architecture-introduction/#drill-clients
The closest thing which I was able to find on the forums/documentations was to connect through the drill-JDBC driver. But it defeats the purpose of what I want to do. Does anyone has any idea where I can find more about these APIs and if they are actually there?
They provide native C++ client.
Check querySubmitter example for more details.

Categories