Ingres Community Forums Login Register Ingres.com  

Ingres Community Forum


Go Back   Ingres Community Forums > Community > The Ingres Community
 

Reply
 
LinkBack Thread Tools Display Modes
Old 2009-11-29   #1 (permalink)
Ingres Community
 
Join Date: Nov 2007
Posts: 20
Default Using Proxygen - for Java

I've downloaded the utility Proxygen to generate Java Classes to interface with O/R application server.
The getting started example is not really helpful as following it did not create the Java Classes. The proxygen displayed an error saying nothing is loaded, but at the same time it also displays a popup showing progress indicator. However, this indicator remains blank.

I've got the VASA up and running with a number of applications. How do I instruct proxygen to look at a particular application to process?
joseg is offline   Reply With Quote
Old 2009-11-30   #2 (permalink)
Junior Member
 
Join Date: Sep 2008
Posts: 6
Default

Hi joseg,

Can you reproduce the error and paste the string here.

To tell proxygen which application to point at you specify the name either by editing the config file directly and changing the sub tag with find="${aka_name}" to have the replace element equal to the name of the application or using proxygen click on globals in the left hand tree view and find "Nameserver connection name" and set the value of the "Replace" column to be the application name.

Make sure you are using the right configuration file for the example and not the generic java one. Its at "%PROXYGEN%\java\examples\example1\ConfigJavaExamp le1.xml"

Cheers,

Tony
siman01 is offline   Reply With Quote
Old 2009-11-30   #3 (permalink)
Ingres Community
 
Join Date: Nov 2007
Posts: 20
Default

Thanks Tony for the quick reply. I have figured out and have done what you said above and I'm getting the generated Java classes.
I'm looking at the example, though simple, makes me ask the following questions:
1. How does the Proxy object work? Somehow I can see that it's able to call the 'exposed' methods without populating a pdo.
2. Even the parameters passed via the proxy is just a HashMap and the keys don't match the parameter names of the methods called.

3. I've created a client for our own application and most of our parameters include structures with arrays of userclasses. If I cannot map an array attribute directly to an array object, how do I know the length of the array? Would that be via the lastRow method?

Thanks in advance.
joseg is offline   Reply With Quote
Old 2009-12-02   #4 (permalink)
Junior Member
 
Join Date: Sep 2008
Posts: 6
Default

1) You don't need to populate PDOs with ProxyGen, it does that for you, if you need to pass user classes you pass the Java class equivelent which ProxyGen generates.

2) With the java version of the templates you must put your parameters in the hash map, because java doesn't support out or byref parameters - the parameter names are mangled to make them conform with Java standards - this is done by find and replace rules in the config file. To make it easier to understand what the original parameter name was you can replace the following block in jproxy2.tpl:
Code:
<<CLASS>>
<<!DV_NULL>>
     * @param *L*${langname} ${class_prefix}*U*${type} default system
<<!DV_NULL>>
<<DV_NULL>>
     * @param *L*${langname} ${class_prefix}*U*${type} default null
<<DV_NULL>>
<<CLASS>>
<<SCALAR>>
<<!DV_NULL>>
     * @param *L*${langname} ${type} default ${default_value}
<<!DV_NULL>>
<<DV_NULL>>
     * @param *L*${langname} ${type} default null
<<DV_NULL>>
<<SCALAR>>
with:
Code:
<<CLASS>>
<<!DV_NULL>>
     * @param *L*${langname}(${name}) ${class_prefix}*U*${type} default system
<<!DV_NULL>>
<<DV_NULL>>
     * @param *L*${langname}(${name}) ${class_prefix}*U*${type} default null
<<DV_NULL>>
<<CLASS>>
<<SCALAR>>
<<!DV_NULL>>
     * @param *L*${langname}(${name}) ${type} default ${default_value}
<<!DV_NULL>>
<<DV_NULL>>
     * @param *L*${langname}(${name}) ${type} default null
<<DV_NULL>>
<<SCALAR>>
N.B. just above this section is a bug in the template - the section should be generating parameter documentation for arrays but is instead outputting array declarations

3) OpenROAD Arrays containing user classes while be converted into java arrays of a type user class, you use the length method in java to find the length of an array. You might need to fix the above bug and I'm not sure if the java templates have been properly tested with arrays as parameters.
siman01 is offline   Reply With Quote
Old 2009-12-02   #5 (permalink)
Ingres Community
 
Join Date: Nov 2007
Posts: 20
Default

Hi Tony,

I've updated the template (jproxy2) as you've described above and ran the generation. I'm still getting a virtually empty Proxy.java class which only contains the code to populate the aso.

From what I can see in the template, there should be a definition of method for each SCP, passing a Hash parameter. This part of code is not being generated.

I've even tried changing the drop down selection from either 'All SCP' or 'For each SCP' but the result remains the same.

I've gone to the VOSA and saved the metagenfile (xml). I've viewed the file from Firefox and I can confirm that there are numerous SCPs. I specified this as the metagenfile and ran the generation which ran for a long time that I have to cancel it.

Please advise if there is any updated version of Proxygen or whether I'm missing a critical step.

Cheers.

Jose
joseg is offline   Reply With Quote
Old 2009-12-02   #6 (permalink)
Ingres Community
 
Join Date: Nov 2007
Posts: 20
Default

Even without the Proxy methods, I'm still able to use the currently-generated java classes. As I'm using it to provide a web service, I attempted to use these Proxygen-generated classes as part of the output attributes. Compilation is okay but when deploying the application, I'm getting a JAXB exception error.
Due to this, I'm writing code to copy the attribute values to a local version of the userclass (ie. same attributes without the methods and references to ASOSession and ParameterData). I then use these 'local' classes as part of the web service output and deployment is okay and results are correct.

Is there any reason why the Proxygen classes cannot be part of a web service output.

Is it possible for proxygen to generate another set of java classes to contain only the attributes.

Could the HashMap object be used as a transport between the two sets of classes?

Thanks in advance.

Jose
joseg is offline   Reply With Quote
Old 2009-12-03   #7 (permalink)
Junior Member
 
Join Date: Sep 2008
Posts: 6
Default

Hi Joseg,

We(Luminary Solutions) did some work on a proof of concept ProxyGen generating Java WebServices (SOAP, Apache Axis), I think that involved modifying the templates and library code to allow the objects to be safely serialized to XML, for what I remember one of the main issues was the OpenROAD DateTime objects used to represent ingres date without time and blank date). From what I remember the end result was really good and cut out a lot of development effort .

If you can send me your metagen file I'll have a look at it to see if I can spot why you are not getting the SCP methods generated, email "anthony #dot# simpson #at# luminary #dot# co #dot# uk".

Quote:
Please advise if there is any updated version of Proxygen or whether I'm missing a critical step.
These is a new release of ProxyGen in the works, but the current version should be able to do what you require.

Quote:
Is there any reason why the Proxygen classes cannot be part of a web service output.
No, but as mentioned above there are some issues with using the current library code and templates.

Quote:
Is it possible for proxygen to generate another set of java classes to contain only the attributes.

Could the HashMap object be used as a transport between the two sets of classes?
Yes its possible, it would also be possible generate mapper methods on the classes(or somewhere else) to map between the two but it would be much simpler to use the OpenROAD User Class Java proxies directly, this is possible as mentioned above.
siman01 is offline   Reply With Quote
Old 2009-12-04   #8 (permalink)
Junior Member
 
Join Date: Sep 2008
Posts: 6
Default

Hi Jose,

I can see that the SCPs you have are generated from user class methods - proxygen is able to generate wrapper code for these but the java templates don't contain any output for them. There is an example of doing this in the csharp templates which you could copy but it has a few issues. We tend to customise the templates for the needs of each proxygen project we work on, each customer tends to design their OpenROAD Server Application differently, I am working on writing some templates which have a common design across client languages and will work with the widest range of OpenROAD Server features but I don't have much time at the moment to work on community projects.

If there's anyone out there who would like to use ProxyGen but can't because of limitations in the current templates or ProxyGen itself please post on the forums about it.

Quote:
What does [For Each/All] [SCP/Class] do?
For Each Class: Generates a file for each User Class in the metagen file using the named template.
All SCPs: Generate a single file from the named template, template can contain the <<FOREACHSCP>> tag which generates its contents for each SCP in the metagen file.

Cheers,

Tony
siman01 is offline   Reply With Quote
Old 2009-12-07   #9 (permalink)
Junior Member
 
Join Date: Dec 2009
Posts: 1
Default

i could never get the hang of this.
Pheobehall85 is offline   Reply With Quote
Old 2009-12-07   #10 (permalink)
Junior Member
 
deniseweisley's Avatar
 
Join Date: Dec 2009
Location: United States
Posts: 1
Default

This is interesting..but still some kind of bemuse about some details here..just new in using Proxygen and still exploring about it..
deniseweisley is offline   Reply With Quote

Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


© 2009 Ingres Corporation. All Rights Reserved