Ignite Questions about "qryexe" - java

I figured out "qryfldexe" is able to query cross caches with multiple "join", but couldn't figure out if "qryexe" also has a way to achieve that.
The reason of having desire from question 1 is because "qryexe" returns items in key value fashion, but "qryfldexe" returns items in an array that only has values in each array item. Is there a java lib to load the type of json returned by "qryfldexe" into a json object based on the fields metadata in the end(or beginning) of the json payload?
Many thanks

No, qryexe only works on a single cache (same as its Java counterpart, SqlQuery).
There is no Java client for Ignite REST API as far as I know, but there is also a more efficient Thin Client Protocol and a work-in-progress Java client for it (see this mailing list thread with description and some links).

Related

Is there an API to map a vSphere JSON Result to an appropriate Java Object?

I am trying to use the REST API of vSphere to get information about our virtual machines. I already connected to the server using the provided REST API and
I got a JSON Result from a REST request. The vSphere JSON result looks like this:
{"value":[{
"hot_add_increment_size_MiB": 8,
"size_MiB": 1,
"hot_add_enabled": false,
"hot_add_limit_MiB": 51258
}]
}
Now I want to convert this JSON String to an appropriate Class.
The problem, I am actually facing is, that it can be a very complex JSON result.
My question is: Is there an API from VMWare, I can use to solve my problem?
Every hint is appreciated.
Many thanks in advance.
The answer is no. There is schema published by VMware. It might not exist.
You may be able to get what you want with this API (disclaimer: I am the author):
https://github.com/DoubleCloudInc/vim-rest-api/
The schema is the same as vSphere API, so you can use the vijava data objects as your Java objects. http://vijava.sf.net. Again, I am the author.

Remove a String from a list on a Redis server via a Java client using Jedi

I am pretty sure this is a stupid question, but how do I remove a String from a list on a Redis server via a Java client using Jedis?
I actually googled a little bit about this and my problem was, that the most things I found was about the Jedis from Star Wars. I know I could request the list from Redis, then remove in this local list the String, then delete the key of the list on the Redis server and then set the new list to the delete key, where the String is removed, but I am pretty sure that this is very inefficient and that there is a more efficient way.
You should be able to call Redis' LREM from Jedis to do that. Note that this operation (LREM) is quite expensive in terms of complexity so perhaps you should consider a different data structure for your needs.

Optimizing RMI Service Response

I am writing a server client application, best performance is a must; I am using RMI for server-client communication, the server uses mySQL database.
Now in the client side I have a method called
getLinks()
which invokes the same method on the server, the problem is that this method returns about 700Mb of data, which takes some time to get, and some more time to analyse.
And then I'm setting some values for each Link:
for (Link l : myService.getLinks()) l.setSelected(false);
What I have in mind right now is just getting the Link Ids first (since this would be a smaller data) and then using Asynchronous method to get each Link by Id (each link need one service call); and then setting the Link values.
Is this the best approach, is there another way of getting RMI data one by one (one method call and more than one return)?
Is there something like (yield return) in C#?
you can also make a pagination method, which receive the initial id (or position if the id's are not a consecutive) and the length, in this way you will not send all the id's twice
Are the Link objects remote objects? If not I don't really see the point of the code, as it only sets something locally in the client object which is immediately thrown away.
Assuming they are remote objects, it would be better to ship the entire update to the server and tell it to update the whole collection, something like setLinksSelected(boolean), where the server does the iteration.
But I would also be wary of updating, or even transporting, 700Mb of data via RMI whichever way you do it. That's a lot of data.

Receive JSON list from http://www.autorenlexikon.lu

I want to read a JSON list from a webservice with Java. The webservice returns a list of authors from luxemburg, e.g. sorted by the year. That's the web-site:
http://www.autorenlexikon.lu/page/periods/1919-1945/1/1/DEU/index.html
So far, I know that I can receive a JSON document with a request like this:
http://www.autorenlexikon.lu/mmp/json.document_list/DEU/0?search_since=1919&search_until=1945
But I only get the first 20 entries. How can I get the next 20 entries? I think the solution is in the JavaScript-code of the web-site, but I am pretty new in JavaScript (also in JSON).
EDIT:
There isn't any official API.
I have already tried:
http://www.autorenlexikon.lu/mmp/json.document_list/DEU/0?pageSize=1000&search_since=1919&search_until=1945
http://www.autorenlexikon.lu/mmp/json.document_list/DEU/0?page_Size=1000&search_since=1919&search_until=1945
...and many more. Who does the JavaScript-code receive all entries? Couldn't I copy this mechanism?
You should check their API and look for a parameter that let's you define the page or the range of results you want to get.
Edit Seems like you'd have to make a POST request and add the start index as well as the page size as post parameters. For more information see #matthijs koevoets' answer.
It depends on how the Webservice has been coded. Nothing to do with JSON specifically. From the results you can see it says
"pageSize":20,
You just have to figure out how to call the Web service with a page size. It may not allow you to query it with a different page size. That's up to the Web service API coded by their developers
their service seems to accept POST parameters only: sort=year&dir=asc&startIndex=0&results=100

Where to store the data for a GWT app - GAE data store or XML file

I have a GWT app which is deployed on GAE. One part of my application relies on static data, which is currently stored in an XML file. The application reads this data into a collection of POJOs. The data is sent over to the client using GWT-RPC. Based on the selections made by the user, it applies filters to the collection to get specific objects (the filtering is done on the client side).
The data may contain up to 3000 records, and the total XML file size would be around 1MB. There'll be no updates on this data from the application side (it's read-only), but I may be frequently adding new records or updating/fixing existing records during the initial few months (as the application evolves). The data has no relationship with any other data in the application.
One of my main consideration in fetch performance. I tried using Apache Digester to parse the XML, but noticed that even parsing 600 records and sending them to the client was a bit slow.
Given these requirements which of the following would be better and why - 1. Keep the data in the XML file, or 2. Store the data in the app engine data store?
Thanks.
One alternative would be to load the XML file directly by GWT (without GWT-RPC and server parsing):
Use RequestBUilder to get the data from the server. Example usage: http://www.gwtapps.com/doc/html/com.google.gwt.http.client.html
Then use XMLParser to parse the reply. Example: http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsXML.html#parsing
Here's an example combining both: http://www.roseindia.net/tutorials/gwt/retrieving-xml-data.shtml
The only downside is that you have to manually parse XML via DOM, where GWT-RPC directly produces objects.
Update:
based on the comments I'd recommend this:
Parse XML file with JAXB to create your objects: http://jaxb.java.net/guide/_XmlRootElement_and_unmarshalling.html
Save those to memcache: http://code.google.com/appengine/docs/java/memcache/overview.html
On RPC request, check memcache, if data not there goto 1.
The way I look at things, there are two bottle necks, though interrelated. One is loading the data (reading from XML, parsing). Another is sending it to the client.
Instead of sending the whole bunch, you might consider batch sending, like pagination.
Usually I prefer storing such files under WEB-INF.

Categories

Resources