How to integrate java with control M - java

I have few control-M job running on server. I can perform basic operations like to start/stop or pause any JOB from control M Interface.But there is not a development environment available for Control-M.
I have another java application from where I want to start/stop/pause and other basic stuffs of Control-M.
Till now I am totally blank.I don't know which JAVA API, I should use. Do i need to have development environement of Control-M also.
Could some one please help me on this regard?

You should use Web service functionality of Control-M.The details Example is given with API. Run the bat file for configuration.Provide your parameters.Run ClientGui.java.
if you have provided your correct parameters than you should be able to connect with control-M.Please make a comment if you are facing any issue..

Look at Control-M for Web Services, Java and Messaging. They also just came out with a Automation API but you have to have Version 9 Fix Pack 2

Related

Create a simple API in Java with tomcat server

I'm in a tricky situation, I'm mainly a frontend dev working in react but I got into a project where i need to create an API with some endpoints in various languages. I have done Python and dot Net already. Now it's time for Java. I'm totally new to all the backend languages except nodejs so sorry if I'm incorrect on some things.
I've set up a Java project with a Tomcat web server. I can run it locally on port 8080.
I want to create a simple API with 3 endpoints that only returns some text.
What is the simplest way of doing this? Thank you!
You can use Spark (https://sparkjava.com/) for that purposes. Its API is similar to Node JS ones. And you can deploy it to the Tomcat.
BTW, Tomcat is the envirenment for running Java applications. It is like Node JS.

Can Electron apps be integrated with java code?

As node.js still lacks important functionality which exists in Java, I would like to use Java instead of node.js, and create the client using a web language (html, js, css..).
Electron is cross platform and so does java so it seems fit to have a solution getting the best of both worlds.
Does someone know of a way to integrate electron with java or have a different solution to the problem?
I made something similar, Java back-end with Electron GUI.
You can do it in more ways, it depends on what you need.
You can create a jar file and then execute it like terminal:
https://nodejs.org/api/child_process.html
Or you can open a socket communication and talk on a Port. (A lot of documentation:
Java (web)socket - Node.js client.io)
In this second way, you can do everything you want, but you have to create your communication protocol.
Your path is not foolish, I am very satisfied of the communication and usage in my work with Java + Electron .
I've created a small PoC where Java process is integrated with Electron front-end: https://github.com/jreznot/electron-java-app There you will find a simple TODO List application built with Vaadin/Jetty and Electron.
Personally i made my back-end java communicate with the front-end by creating a file with te data then sending it to the main.js to be processed.
DBus and winDbus seems to be an option here.
It creates nice abstraction and separation between "frontend" and backend
https://sourceforge.net/projects/windbus/
I'm going to test it on my own soon

What server platform to choose for periodically running a standalone (Java) program?

I need to develop a game server that will run periodically (e.g., triggered by a CRON job every five minutes or hour as appropriate). Once started up, the server will access all of the current game state (fetched through REST from the game's data servers (Stackmob, Parse or similar), do the processing of player actions, and then POST the results back to the data server. In other words, it will be doing a lot of HTTP requests, but does not itself necessarily need to be a web service.
I've been considering multiple ways of developing this.
I do not feel for setting up a server myself, so I need to find a service to run this on that permits the workflow I would like.
The game engine is Java, so something that works neatly with that.
Will need to GET and POST data files, so access to static files would be needed.
Most of the services that exist which provide something similar to what I require are directed at web services - which generally means that one needs to jump through some hoops to get things to work.
Google App Engine, for instance, would require that I implement this using backends (since the game server could potentially run for more than 60 seconds), and isn't particularly happy with the idea of static files.
Amazon EC2 would seem easier to develop on (again by building a web service frontend, of course), but there seems to be relatively poor support for CRON.
Generally speaking, it feels like I want to shoot some sparrows with a slingshot, but all the services are offering me cannons. Are there any alternative platforms/frameworks beyond the big two mentioned above that would be suitable for something like this?
You could try Heroku. They support Java. If you created a project that used a single worker dyno then the hosting would be free (see link).
The process would be running continuously, so you might want use a Timer for periodic execution. You could also use Quartz, but it might be overkill.
Edit:
Here's some links that might help get started:
Running non-web Java processes on Heroku
Heroku Java quickstart - this is for a web app ('web dyno') rather than a 'worker dyno', but it may help.
java.herokuapp.com has links to some example projects (again web apps rather than workers)
How about using EC2, but rather than putting the scheduler in the instance (which won't work because the instance can go away at any time), putting it in AWS? Like this guy:
http://alestic.com/2011/11/ec2-schedule-instance
Alternatively, if you manage your EC2 instances through Ylastic, it looks even easier:
http://blog.ylastic.com/scheduling-tasks-on-the-aws-cloud
Although you'll have to pay for Ylastic as well as EC2, i imagine.
I found a nifty way of writing something like this in Groovy with Maven. You can write a multithreaded Groovy script to pull the stats, do the updates, etc. and then have maven's assembly plugin assemble the whole thing into a self-contained, executable jar file that can be called by a CRON job. One nice thing about Groovy is that its syntax allows you to do this:
def google = "http://google.com".toURL().text
which will turn the string into a URL and handle all of the details of turning the URL into a HTTPURLConnection and getting the raw text.
You could develop the app as a standalone Java program first and then worry about where to deploy it later.
To develop the app you could write a simple Java program that uses HtmlUnit to talk to the external web services. The job could be internally started via Quartz. If you really wanted to start the job externally via CRON, you could have CRON run the app, passing in args. The app would then run and exit.
Alternatively, you could have the app always running and have cron run a bash script that triggers the job in some way.
Essentially, all you need to deploy is a Unix machine so you could use AWS.

Programmatically adding Java app to startup

We're making a login client in Java for a school project.
It uses SSH to connect a local server to allow for internet connection, for the convinience of our users we would like to be able to make an "open on startup" function.
We know that this could be done by cron/damon jobs in linux, and by service/registry methods in windows... We don't know about OS X.
We would like to CODE the solution in java, each solution doesn't have to be for all 3 OS' but just one, then they can execute when needed.
Any help would be appriciated. :-)
Regards
Martin
YAJSW (Yet Another Java Service Wrapper) could provide this functionality, and is licensed under the LGPL.
http://yajsw.sourceforge.net/
You'd want to create your configuration during installation I suppose, and in install/uninstall the service when the user toggles the checkbox.
You'll also find a feature matrix of other options for achieving the same thing at http://yajsw.sourceforge.net/#mozTocId284533
And for you interest, under the hood on OS X the system this uses is called launchd.
You can try the Java Service Wrapper, which also support launchd on OS X. Furthermore run a Java application as Windows Service or on Linux using init.d/upstart.
http://wrapper.tanukisoftware.com/doc/english/launch-nix.html#boot
http://wrapper.tanukisoftware.com/doc/english/download.jsp
Please let me know if you have any further questions.
Best Regards,
Chrisitan

Job Scheduling in Java

I want to run a Java program on a specific date.
I am developing a J2EE application that allows you to schedule Selenium test launch (JUnit) on a specified date..
Are there any solutions to do this? can you point me to technology that can help me to do this?
any help is appreciated:)
thanks for your help
You provided very little information. You can schedule launch in scheduler of your operating system (like cron in Linux), or you can run a task from within your Java process, if the process is constantly running. For this see Quartz Scheduler.
Not knowing enough details, I would recommend using Quartz. You can see an example of using it here.
You could use crond or Windows Task Manager.
If you have a Java process running from now to the time it needs to start, look at Quartz.
If you need to have a Java process started from nothing, you must ask your operating system to invoke it for you. For Linux check the "at" command.
Cron on Unix, and Cron for NT on WindowsNT platforms (XP-Windows 7, Windows Server 4.0+).
Why reinvent the wheel?
If you want to create and package modular java server-side tasks (that you can then schedule in any particular java scheduler of your choice) check out the open source project called soafaces. Let's you create modular java Tasklets and also give them web based GUI customizer (customizer part is optional and based on google gwt).
Scheduling can be implemented in many ways, it is also bit IO intensive, so if needed u might want to use non-java solutions
However you want to have java solutions may be below links should help you
Spring Way : https://spring.io/guides/gs/scheduling-tasks/ and https://dzone.com/articles/schedulers-in-java-and-spring
Non Spring solution: https://github.com/knowm/Sundial

Categories

Resources