Now there is a new requirement. I have got some adhoc work at hand. The requirement is to connect a desktop based Java application to read data from Mainframe generated by some CICS Transaction. [Basically I have to read all the records being appended into a file (same way as we do tail-f filename in linux). This is just for FYI my requirement is something different.]
I inquired, and came to know that my employer cannot provide MQ or CICS Transaction Gateway access to me. He suggested some method of screen scraping. I have already done that using VB.Net application and Quick3270 as well as IBM Communicator Emulators. Both these emulators provide functions which can be used to read whatever is there on the screen.
You can refer to EHILLAPI programming details (Language for Emulator programming) - http://publib.boulder.ibm.com/infocenter/pcomhelp/v5r9/index.jsp?topic=/com.ibm.pcomm.doc/books/html/emulator_programming07.htm if you are interested in learning.
But this method is restricting me to the maximum number of bytes that can come on the screen. With this method there is significant network delay as I have to refresh (basically move from one page to another on CICS) everytime to get data which is spanning across multiple pages.
Can you suggest me some method so that the my employer does not need to ask the client to open any port on his Mainframe or install any software (as this is not possible for my employer).
Can I use the 3270 terminal emulation and retrieve all (or at least more data). This way the requirement of my employer is fulfilled and he does not need to ask anything to his client. (In any case from the emulator we are firing CICS Transactions). We want everything to be done at my employer's end itself without disturbing the client's Mainframe even a single bit.
Please do not suggest MQ as the client does not have it.
If you are still suggesting CICS Transaction Gateway, then please let me know how would I connect to the remote machine (I need technical details).
- What information do I need to ask from the client.
- What software do I need to install on my machine.
- Technical details of using that software.
Regards,
Nitin
I have two suggestions for you to look at. I have done both successfully. Your client setup can decide if either is palatable (the question doesn't mention not doing these things).
You can call your CICS code on the mainframe via a DB2 stored procedure. There is a standard one supplied by IBM called EXECCICS that we used for a project. You supply the standard CICS parameters and comm area. The stored procedure executes the program in the mainframe and returns you the comm area. You use JDBC. This solution is simple and easy the execute.
We have also enabled HTTP access to the CICS program on the mainframe. To my understanding (remember I just called it -- not enabled it) it is a pretty standard configuration. The client code just performs an HTTP POST to a specific end point. The resulting document is the comm area plus other goodies.
These solutions were developed independently for the same project and are both in production. The only reason the HTTP method was added to the mix was because of a data size limit in the stored procedure that HTTP removed.
Related
I'm developing an application (Java & JavaFX) that writes/reads data (a file). The problem is I don't want to restrict user to run only one instance (of my app) at a time, as I really can't think of reliable way of doing that so it works on both Windows and Linuxes (e.g. server), heard of sockets and files - both are defective IMO. As user is able to run multiple instances, writing/reading data (from a file) seems really messy, because there's no guarantee that file locking will work reliably on Windows and Linuxes (FileLock documentation - click here).
To sum up: I can't restrict multiple instances of my app, but that leads to problem with writing/reading data (from a file).
Is there anything I missed? Maybe there's some other way to solve my problem I can't think of? How do the "big" popular programs handle that?
Suggested: Use a socket solution
You could follow the techniques outlined in an answer to:
JavaFX Single Instance Application
FAQ
Addressing some additional questions:
heard of sockets and files - both are defective IMO.
You state your opinion that using sockets to set up a single instance application won’t work well enough for you. You are in the best position to decide that.
For some apps which want to achieve a single instance, the socket-based or file-based solution outlined in the answer to the linked question or other comments will work well enough.
"What happens if more than one user try to run the application? Won't they conflict on opening the socket?"
Prevent launching multiple instances of a java application
And:
Also, I can't be sure if chosen port (fixed, since all instances should check for one port) is being used by some other applications/processes
You may be able to address some of these concerns by enhancing the socket-based solutions outlined in the linked questions.
Enhanced Socket Solution Outline
If you want, you can write an enhanced algorithm to deal with some of these issues.
When another app instance startup occurs, you try to connect to a current instance on a well-known socket.
Check the response to the connection.
If it doesn’t respond with the correct protocol response (e.g. matching user and app name) then increment the port by 2 and retry.
Test the response again until either:
You get a match for the app/user combo, then send a signal to that app to display itself.
OR
If you get no match, then create a new instance on the tested open port.
I'm not suggesting you do that, just explaining that it is possible.
Alternative: OS native service
There are also other OS-specific mechanisms for handling this such as Windows or Linux services which you can investigate if you want, those approaches are involved and vary by OS, so I won’t discuss them in detail here.
For the OS-specific solutions, you usually would:
Create a native package for your app (e.g. using jpackage)
Install it.
Have the installer config the app as a service
e.g. on linux, create an init.d script with a pid file configured via chkconfig.
The service launches on boot and stops on shutdown.
The app is then accessed via a tray icon or something similar
The means of interaction is often OS version specific.
Alternative: Allow multiple app instances but use a single database instance
You may also consider using a database rather than files for data storage, as a database system can help solve many of the concurrent access issues which can arise with file based solutions. Multiple clients can connect to the database, and the database and your app code can handle locks and collisions on the data access to ensure data integrity is contained. Using such a solution, there is no need to enforce that a single application instance is running for a user (at least from a data integrity perspective).
During my studies, I have to make a project connected with programming in Java. I learn Java from a few months and I would like to make something interesting (not an application for bank, library, car renting etc). I'm wondering whether it is possible to create real-time web game/application, where you can type something and your friend on another laptop see this message and can send you response? (using internet/Bluetooth) If yes, what I should look for to find information about this type of applications?
Yes, creating something like this is definitely possible. It really will just depend on exactly how you want to implement this (it sounds like you're still not sure EXACTLY what you want, as your description is vague).
What I mean by that, is what do you want as your medium? Would you like the two users to be on their laptops and communicating through their web browsers? Or would you rather have a standalone application that accomplishes this? If so, what Operating Systems will you support? Will it have a graphical user interface, or will it run on the command line?
Let's assume that you want to develop a standalone Windows application that allows the users to exchange messages. Keep in mind that doing this gracefully would involve users logging into your system with authentication, a fairly sophisticated GUI, and lots of encryption for privacy reasons. That being said, a very basic implementation of this could probably be as follows:
You'd have an app that runs locally on the users machine, and also some sort of database backend that your app communicates with. I'd recommend using a mySQL database hosted by Amazons RDS (Here's a tutorial that got me using Javas JDBC library to work with an Amazon RDS database - https://www.youtube.com/watch?v=2i4t-SL1VsU).
Rather than worry about a GUI, I'd suggest trying to get your prototype working on the command line. Your app could preform the following steps when booting up:
Ask user to input the word send followed by a message to send messages ("SEND %MESSAGE%"), or "RECEIVE" to receive messages.
If "SEND %MESSAGE%" is input, add message to database
if "RECEIVE" is input, query the database for all message entries and output them to the user.
You can see that this would accomplish a very crude version of what you asked for, and the devil is in the details. I'd suggest building something very simple like this, and then adding functionality by tweaking and improving features one at a time.
I am trying to learn Vaadin framework and have been going through the resources on Vaadin website.
I have two questions which so far I have not been able to find a precise answer to.
Since all your business logic is sitting on the server the questions are, can Vaadin do the following with the additional constraint of not using any additional frameworks as much as possible.
Can Vaadin be used to create applications that offer limited offline capabilities when there is no internet access, (limited to 'view only' mode) without the use of Touchkit.
Can Vaadin be used to create applications that implement end to end encryption (any data the user enters is encrypted client side before being sent to server)
Can Vaadin be used to create applications that offer limited offline capabilities when there is no internet access, (limited to 'view only' mode) without the use of Touchkit.
Vaadin might be used to create applicaion with limited offline capabilities because it uses HTML5 "cache manifest" that makes it possible. However, as you are asking to without the usage of "Touchkit"; I guess this might not be possible at the moment.
Can Vaadin be used to create applications that implement end to end encryption (any data the user enters is encrypted client side before being sent to server)
I think it might be possible to encrypt client side code before being sent to the server. In an application where users have read access to data and some users have write access, the domain model can be designed to basically in any way possible. However, if there are groups of users that should be given read access to only some parts of the data, things might be complicated.
Although my answers might not be very convincing, I hope you get some idea out of this.
I am trying to set up a webserver on an old machine of mine. I have installed ubuntu server edition and aim to use it for the following:
I want to run a java program on the server. I want to be able to retrieve data from the program from another computer/phone using an internet connection. I also want to be able to give the program data, and get a response saying whether or not the data has been received correctly.
So for example:
A .jar program runs on my server and holds a variable x
I want to be able to query the value of x from another device (over the internet).
I want to be able to set the value of x remotely from another device, and get a response saying it was successful in altering the value.
What are my options here? I would like to try and keep things simple. It is perhaps worth mentioning that I will be the only one using the system. The server will be used exclusively for dealing with the two requests outline above.
Is it simply the case of creating a java program that listens out for incoming requests and running that on the server?
As you mentioned, you can start with custom ServerSocket wrapper which will decode incoming requests and do as it's bid. Currently, whole frameworks are done to encapsulate common code of this task -- see my 3rd point.
Old-school java solution: use RMI. See RMI tutorial.
New-school java solution: devise some simple text-based protocol with 2 commands:
Read()
Set(newVal)
Then implement that protocol over some new trendy Java framework, like Apache MINA, which is created specifically to facilitate quick development of network apps in Java.
I, personally, started with RMI for such kind of tasks. Since RMI is considered Core Java technology, it's wise to learn it.
I have a Java applet that runs on visiting a site, whereupon it receives, parses and displays streamed data. Unfortunately said applet isn't particularly well designed and I would like to extract the streamed data to make it more useful for myself.
In order to do this, I need to get insight into the connections made, data being exchanged, the state of variables in use and so on, so that I can replicate the log in and streaming.
So far I've been using Wireshark for network traffic, Java Debug Console and eyeballing the applet source installed on my system but still without success- primarily because there is a series of connections being made to the remote server and I am unsure the exact nature of the requests (and responses) and the variables contained.
Does a suitable app exist that can provide such insight?
I should add that I have no experience developing with Java, my knowledge is in Python, mainly.