Page 1 of 1

Executing Java application through TM1 process

Posted: Fri Jul 06, 2018 3:20 pm
by fabulousMuch
Firstly, I am developing my Java application using TM1 extension on Java. I got the data I needed, but now I want to share that data with our users by making it accessible through TM1 Web application.
My application runs locally on my PC (works fine), and the TM1 is on the remote server and I don't have capability of transferring my JAR in the file structure on that same remote server, so I am unsure could I bypass it and still get the TM1 to run my JAR from one of his processes? :?:
Other concern is that the remote server doesn't have Java installed (no JRE or JDK) otherwise I would have just run cmd command to run the .jar, so is it still possible to run Java code on it? (maybe through TM1s jvm.dll?)
I would really appreciate any kind of solution of how to run my Java Application from the TM1, I am just so lost at the moment.

Re: Executing Java application through TM1 process

Posted: Mon Jul 09, 2018 10:04 am
by David Usherwood
I would suggest you are out of luck, since you can neither transfer the JAR file to the server nor execute it there. Time to rethink your approach.
If you are willing to recode in Python, I have a good opinion of Marius Wirtz' TM1PY libraries (https://code.cubewise.com/tm1py/)
I'm also going to ask why you are doing reasonably serious development work without consulting your IT people.

Re: Executing Java application through TM1 process

Posted: Mon Jul 09, 2018 12:34 pm
by fabulousMuch
Thank You for the reply!

What I ultimately wanted is to get the list of the users that are logged in to the server and display it in a simple html table and we wanted to add that functionality to the button on our TM1 Web application. :mrgreen:
I was using Java because I believed (never tried before) it could be easy to integrate it with TM1. I still could transfer JAR to the server (if that can be executed over the TI process), but I am unsure would I be able to run it without and JRE or JDK, so it's a bummer. :(
Do you think I could integrate Python code like that, since I have no environment set up on the server for python either :(

To clarify, I was working on a "test" TM1 server, and I use nothing more then query the data back to my Java application (Only GET), so I didn't see the consultation with our IT as something that was a priority. (Also I am the only one doing this, no one have dabbled in the TM1 API, so no one can aid me or give me any tips)

Re: Executing Java application through TM1 process

Posted: Mon Jul 09, 2018 10:01 pm
by lotsaram
This is a pretty good example why it is always a good idea to explain your use case. For this requirement you don’t need any api only the }ClientProperties cube which you could show a null suppressed active form based on the “active” property.

All you need is to set ClientPropertiesSyncInterval in tm1s.cfg

Re: Executing Java application through TM1 process

Posted: Tue Jul 10, 2018 7:52 am
by fabulousMuch
lotsaram wrote: Mon Jul 09, 2018 10:01 pm This is a pretty good example why it is always a good idea to explain your use case. For this requirement you don’t need any api only the }ClientProperties cube which you could show a null suppressed active form based on the “active” property.

All you need is to set ClientPropertiesSyncInterval in tm1s.cfg
lotsaram thank You for the reply!
I just gave it as a first hand example as this was not the only thing we wanted to do, that is why I dabbled with the API, so that we can expand on it. Getting logged clients is just a starting point of our TM1 extension using TM1 API.

Re: Executing Java application through TM1 process

Posted: Tue Jul 10, 2018 10:26 am
by David Usherwood
I just gave it as a first hand example as this was not the only thing we wanted to do, that is why I dabbled with the API, so that we can expand on it. Getting logged clients is just a starting point of our TM1 extension using TM1 API.
Be aware that there are many APIs available. I would recommend the Rest API as it is new, pretty comprehensive, and well supported - and I would recommend TM1PY as the best way to use it. But do consider the implications of what you have in mind so you don't spend time building a routine which you cannot execute, as in this case.

Re: Executing Java application through TM1 process

Posted: Tue Jul 10, 2018 1:55 pm
by fabulousMuch
David Usherwood wrote: Tue Jul 10, 2018 10:26 am But do consider the implications of what you have in mind so you don't spend time building a routine which you cannot execute, as in this case.
Thank You David, that is what I came here to do, I will spend a some time talking to our server admins and our TM1 experts (as I am neither, just have same basic knowledge) on giving me a possible solution, but I will definitely give TM1PY a try
If anyone has tried running Java app through TM1 and have some input it would be really useful, if not I will update the thread myself when I find a plausable solution,

Re: Executing Java application through TM1 process

Posted: Tue Jul 10, 2018 8:23 pm
by macsir
You still can just java with rest api. I am actually developing it now but don't have much time to make it progress ATM. I use Java + Jackson + apache HTTP client to interact with rest api. TM1Py is similar thing as it wraps rest api with python. If you are interested, just have a read on rest api official doco from IBM first. It is good start point.

Re: Executing Java application through TM1 process

Posted: Wed Jul 11, 2018 11:39 am
by fabulousMuch
macsir wrote: Tue Jul 10, 2018 8:23 pm I am actually developing it now but don't have much time to make it progress ATM. I use Java + Jackson + apache HTTP client to interact with rest api.
That is basically what I want, to be clear I don't have any issues developing it and playing with data (all CRUD functionalities) my only issue is how does one connect that to the TM1.
Taking my example I have Java app that gets the list of users from my TM1 server, but how do I create something (like a button, process, or whatever) inside the TM1 (or it's web application) to run that same Java app, so that user can run it and see for himself while inside the application? :geek: :geek:

Re: Executing Java application through TM1 process

Posted: Wed Jul 11, 2018 12:01 pm
by tomok
fabulousMuch wrote: Wed Jul 11, 2018 11:39 am but how do I create something (like a button, process, or whatever) inside the TM1 (or it's web application) to run that same Java app, so that user can run it and see for himself while inside the application? :geek: :geek:
Therein lies the rub. The REST API is all about retrieving data from a TM1 server, period. How you plan on displaying that data to the end user is up to you. There is nothing in the API that links the data retrieval to display functionalities of TM1Web. If you want to display data in TM1Web it's going to have to be a cube view or a websheet, neither of which is going to allow you to manipulate data from an api data retrieval. The only progammable button available in TM1Web is an action button which can either run a TI process or navigate to a websheet. TI processes don't have a user interface for displaying results so you are only left with a websheet and there is no api capabilities there.

It really all boils down to horses for courses. You need to match what you want to do with the tools available. The REST API is for when you want to create your own reporting tool outside of TM1, but use data from TM1 inside it.

Re: Executing Java application through TM1 process

Posted: Thu Jul 12, 2018 9:27 am
by David Usherwood
I would argue that you can do much, much more with the REST API than just retrieving data from a TM1 server. But I agree with you that TM1Web is not customisable in the way that the OP had imagined. That doesn't stop them from using the REST API to populate a TM1 cube which can then be put on a websheet and opened via an action button. Depending on the requirement it may not need the REST API at all.