I'm considering switching from Firebase DB to Realm.io for my Android app.
From what I've read - https://realm.io/docs/java/latest/#getting-started :
We do not support Java outside of Android at the moment.
That seems like an odd limitation for such a (supposedly) mature library.
I'm thinking that this could complicate e.g. automatic testing, requiring tests to be run on device/emulator, slowing things down a lot.
Questions:
Is it really the case that it cannot be used outside of Android?
What is the reason of this limitation?
Is it really as bad as I think?
What if I want to have some auxiliary server app (written in Java) running somewhere in the cloud, e.g. AppEngine, to connect to the realm DB. Is that option excluded?
What workarounds are there, e.g. for testing and server-side Java?
For the latter purpose - is NodeJS server-side app supported?
That seems like an odd limitation for such a (supposedly) mature library.
It's not that odd a limitation if you consider the fact that Realm ships its own native core, and the JNI wrapper written for the Android NDK; and it hasn't been detached from it yet to make it platform-agnostic, and as such for example relies on Android-specific things in certain places - for example, notifications, using the "Looper" as its specific event loop implementation.
Technically, the realm-java binding has plans to support Java outside of Android, but it currently does not. You should think of it more-so as realm-android than realm-java at this time.
Realm-Core at the time did not support UWP and Windows yet, although now realm-dotnet project works for Windows as well. Even so, detaching Realm-Java's implementation from Android is difficult.
I'm thinking that this could complicate e.g. automatic testing, requiring tests to be run on device/emulator, slowing things down a lot.
For testing Realm-specific behavior, yes.
For testing other things in your app with unit tests, no. You just need the right design, and some mocks I guess.
Is it really the case that it cannot be used outside of Android?
It works on iOS and Android as a local database.
It also works on Linux as a local server-side database since this article from Nov 16 2016, using a similar (the same?) API to the React-Native Realm API, via NodeJS.
You can also run a Realm Object Server (ROS) free of charge on whatever Linux or MacOS machine you like.
Then you can use the sync API to connect to said ROS, and automatically synchronize Realm associated with a user to the ROS. That's what you can do with ROS for free.
With the Enterprise Professional Edition and its price, you can also (on the server side) read/write to Sync Realms, and listen to events that alter the Sync Realm via the NodeJS Realm API.
Is it really as bad as I think?
That is up to your own interpretation.
What if I want to have some auxiliary server app (written in Java) running somewhere in the cloud, e.g. AppEngine, to connect to the realm DB. Is that option excluded?
Your Java application will currently not be able to communicate with a Realm on the server-side.
NodeJS only.
Even then, the "synchronized" Realms that auto-update all data between devices through to ROS to reflect whatever is in the ROS is a paid feature.
Basically, Realm-Java currently only supports Android. As it said in the docs.
As for communicating with a local Realm for the server side on a Linux via the NodeJS API, sure, go ahead.
For the latter purpose - is NodeJS server-side app supported?
NodeJS is able to write to Realms on Linux machines. Possibly also Mac OS.
Free version is local Realm only. Paid version is synchronized Realm stuff through the ROS.
Related
For context, I have a Java Web Application running on Tomcat 7 and currently using Genexus 16 U10 in the same knowledge base, I also have an Android offline app.
The application is really extense, so there are a lot of references in almost every procedure. Recently, it has come to the need of using a functionality from Smart Devices which is the ClientStorage external object, and the problem is, it can't be compiled/used in procedures that are going to be used in the Java Environment. Changing every reference (evaluating whether it is a Smart Devices object or a normal object and then creating another procedure just to call for the ClientStorage EO) would take a lot of time.
My question is, Is there any way of using a functionality from Smart Devices in a procedure that's going to be called by the Web Environment? My first thought was to try to find something like the transaction tags (like the image below) but I had no success on it.
Tried to use an External Object available only in Smart Devices application in a procedure that is currently being used by both Smart Devices and Java Web Application. The error in fact is error spc0200: External Object GeneXus\Client\ClientStorage does not implement method 'set(' for Java Web environment.
We are a group of 6 students in the last year of our studies.
We have to add new features on an existing web application. One of the most important feature and in our opinion the hardest one to implement is the following : the web application has to be functional even when offline.
As for, you must be able to consult data, make changes to the data, and when your device will be able to connect again, the app must try and synchronize with the online database. The current application use the following technologies : apache tomcat / mySQL / Hibernate / JavaEE / JavaScript / Ajax / xHTML & HTML5.
Considering that the main devices that will use the application are mainly digital tablet, smartphones (windows and android, not iOS for now), and windows PC ; my main question is the following one :
How can you do this kind of thing ?
I've done some research and it seems like you have to do a 'second' application, which will use mainly HTML5 to consult data while offline and JavaScript to control what the user is doing and what he can do. But we have no idea about the synchronization. It seems like SQLite could be of use as well
I know this is a general question but we are in the phase where we try and make sure everyone understands what the next steps will be. Thanks for your help and explanations.
Solution-1 : custom solution
There are api available to store data locally called indexDb in javascript which may help to store data.
For synchronisation i found that service workers may help.
Solution-2 : ready made tool
You can also try pouchdb but for this i think at server side you have to take apache couchdb database. I have not used it but would like to try this once.
Take a look at the Service-Worker API. Service worker is a programmable network proxy, allowing you to control how network requests from your page are handled. It's the next generation of giving users an offline experience after the App Cache.
The Service worker - in combination with local storage or even better WebSQL or a polyfill like localforage could be a way to realize that kind of application.
Downside: Service-Worker require SSL, no way around that. Second, only latest chrome and firefox support these technologies.
You might lookup PWA Progressive Web Application as a keyword, which describes / and uses exactly that kind of technologies.
I made a GAE-Project with JPA2 for db access. I store some Strings which are more than 500 Characters, so I use com.google.appengine.api.datastore.Text.
I got an interface Script.java which defines the value as String, and an ScriptImpl.java which has internally a Text member, and converts for getting and setting.
Because one requirement of the project is, that it is still able tu run on an simple tomcat with a database behind. So it must be possible to run inside and outside the google environment.
Is there some realistic way to implement my application so I can switch to a normal tomcat environment (e.g. via a spring configuration to use different beans...).
What else do I have to pay attention to to make this work in both environments and how do I take care of the parts that are seamed thight to GAE?
Update: So far I found the following critic issues: Google User Service & Login Process, Text Class in Domain Models, Wicket-GAE-Initializer (since I use Wicket)
GAE has it's own proprietary API. If you wrote application using this API then if you want to move off of the GAE you have two options:
Rewrite your code, obviously.
Use a API wrapper that implements GAE API but runs on other platforms. An example of such wrappers are AppScale and CapeDwarf. AppScale is older and probably more mature and supports both Java and Python. Also it supports more platforms (private servers + clouds). OTOH, CapeDwarf is targeted at JBossAS7, so it's probably better fit if you use that server (or OpenShift cloud). Also I guess you can expect better support from a mature open-source leader such as RedHat.
While in theory it might be possible to wrap GAE functionality and then delegate it to either app engine or your "normal" environment it's probably a lot of effort.
Possibly another approach would be easier. Are you aware of CapeDwarf?
JBoss CapeDwarf
Deploy and run your Java App Engine applications on your own private
JBoss Application Server (AS7) cluster or on RedHat’s OpenShift cloud.
JBoss CapeDwarf is an implementation of the Google App Engine API,
which allows applications to be deployed on JBoss Application Servers
without modification. Behind the scenes, CapeDwarf uses existing JBoss
APIs such as Infinispan, JGroups, PicketLink, HornetQ and others.
If it really needs to be "simple tomcat with a database" then more information or constraints will be helpful to know.
I have a project this year. It is about developing a Java application with a database for sharing and validating documents between the manager, secretary and head of finance.
My question is: How to make the database accessible by all, since the application will be installed on computers that I mentioned above, do I have to install it (the database) on these computers? The constraints of consistency and integrity of the database will be violated. The users will not have the same copy after each update!
Is there a possibility (or technology in Java) to put the database on the web and there will be accessible by all, or make it accessible from a computer that I realize as a server (client-server).
I would be grateful for your help or giving links for Tutorials.
How to make the database accessible by all, since the application will be installed on computers that I mentioned above, do I have to install it (the database) on these computers? The constraints of consistency and integrity of the database will be violated. The users will not have the same copy after each update!
Your question suggests that you will need one database on one computer. Let's call it a DB computer. I'd suggest this be a server, that no one from regular staff, such as secretary, manager, etc... can access.
Having one central database will eliminate your worries about integrity violation.
Now, you have two options. You can make a web application that your users will use to interact with your system. This is a more modern approach, since you'll have a 3 tier system:
users will access your application via a browser
the web application itself is stored on an application server, and it is accessing the database
the database is the backend part
The second option is making a desktop application and deploying it to everybody's computer that will use it; and afterwards making it connect to the database for interacting with it.
The first option is easier when you want to expose your application to a large number of users (and to the web), but know what you're doing when doing stuff like this, since you have to take security very seriously.
If you go the first route, you will need a few things:
First, a database. Use what you can, but if you need free and high quality databases, use PostgreSQL or MySQL.
Second, an application server. I suggest using Tomcat or GlassFish.
Now, you need to develop your application using JavaEE. There is a wealth of information about this, so I hope this will help you in the beginning and point you in the right direction.
Note that Tomcat doesn't support Java EE fully, but a subset of it. And this subset is surely more than enough for what you need to accomplish.
If I understand you correctly, you are looking for ways to implement a client-server system, where several clients on distinct computers each connect to a central server (or cluster of servers) hosting a DB. In Java, usually (but not necessarily) the DB is inside a web application, and the clients are lightweight web clients - in this case it is usually called an enterprise application.
Java has a whole dedicated SDK for this, called Java Enterprise Edition. You may find many questions dealing with this on SO, here are a few which I think may be especially helpful:
Is the offical Sun Java EE tutorial the best way to learn how to make Java web apps?
What to learn for making Java web applications in Java EE 6?
We use a back-office accounting system with an SQL db2 database. Our sales, service and management all have Blackberries. I have started to write some HTML web scripts that go through BES sever so staff can access and update data (sales summaries, late orders, AR approvals).
The next level seems to be using the native blackberry applets to manage data. For instance we could use an application that notifies head of A/R when a substancial order is being prepared for a customer who is behind in payments. This would require a form of push notification (message and/or email) from server, an entry in Blackberry database, a screen to view list of unapproved orders, a way to approve/reject orders that would update local database and backoffice server.
Questions
what language? Java J2ME with blackberry classes seem most obvious, but is there any viable rapid development tools on this platform?
what database on Blackberry? Is there a choice?
what is appropriate technology to push and pull data (sockets, http?)
can we hire a regular Java guy with a year or two exp, or do we need a Blackberry specialist
is synchronizing data an issue. If blackberry is out of range, will missing messages be synchronized automatically or do you have to control this programically?
thank you
Blackberry apps are Java using a proprietary API. It's derived from J2ME but you have to use the BB APIs in order to do anything interesting. A lot of BB developers use the Eclipse plugin. Compared to Android and iPhone BB dev is a bit clunky.
BB's running OS 5 and higher have SQLite on the device. All devices have a "Persistent Store". The store gives you broad support if your users have older devices.
Now of course on your backend you can use whatever database you want :)
BB's can do http, sockets, wifi (depending on the device). Things like carrier-tcp can be unreliable on older devices and with certain carriers. However since you have a BES, you can use the MDS service which tends to be reliable (provided the BES is running).
You can also get notified from push messages which are sent to the BES. This is useful for low-latency.
I guess most people can learn this, but I recommend finding someone with specific BB knowledge. In my experience I've found the platform pretty tricky to do things well. I've had to experiment a lot to get things working.
Push messages are 'fire and forgot' but there is a 'reliable push' mechanism I haven't used. In general wireless apps have to be good about not depending on network reliability.