compile method via code

For questions and postings not covered by the other forums
thaban
Posts: 4
Joined: Wed Aug 31, 2011 9:36 am

compile method via code

Postby thaban » Fri Aug 24, 2012 2:08 am

Do anyone know how to compile a Method through coding after modifying it (via vMethod.setPropertyValue('source',vSrc) ). The system does not recongize changes to method source code until it has been compiled. Is there a way to force code compile through code?

User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

Re: compile method via code

Postby ghosttie » Fri Aug 24, 2012 3:00 am

As far as I know this is not possible
I have a catapult. Give me all the money or I will fling an enormous rock at your head.

User avatar
suzuki1100
Posts: 29
Joined: Tue Nov 24, 2009 12:00 pm
Location: Auckland

Re: compile method via code

Postby suzuki1100 » Fri Aug 24, 2012 8:28 am

Have a look at Process :: createTransientMethod to see if that will suit your needs.

You can essentially provide the modified source code to the method for it to execute.
I dont think you can override an existing method i.e. The transient method cant have the same schema and method name as the existing compiled method

torrie
Posts: 92
Joined: Fri Aug 14, 2009 11:24 am

Re: compile method via code

Postby torrie » Fri Aug 24, 2012 9:09 am

If the transient method doesn't meet your needs, you could load a new method from a schema file. The schema file is just a text file containing the method source. Right click a method and choose Extract to create a file. You should be able to copy the format. It can be loaded using the Jadloadb utility (see Jadload.pdf). This can be run as an external process (see Node::createExternalProcess) (Note you will need to be running Jade in MultiUser mode for this to work.)

We use Jadloadb to deploy updated schemas to our client sites. I would be a little concerned if the systems were updating their own code as it would create a number of deployment issues!

alanvl
Posts: 29
Joined: Fri Aug 14, 2009 9:16 pm

Re: compile method via code

Postby alanvl » Fri Aug 24, 2012 10:52 pm

I found the following works

beginTransaction;
lJadeMethod.setPropertyValue('source', lValidatedSource);
lJadeMethod._compile;
commitTransaction;

I made sure that the source is validated as a transient method first (must use a different name if the method already exists). BUT this does not update patch versioning and as Torrie points out you need to carefully consider deployment issues. I have used Torries method with JadLoadb as well - you can work this in to an online solution

thaban
Posts: 4
Joined: Wed Aug 31, 2011 9:36 am

Re: compile method via code

Postby thaban » Wed Sep 05, 2012 3:26 am

thanks guys. i will try it out.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 25 guests