Thursday, August 27, 2009

GI/GAE Deployment

I recently had a breakthrough in which I got a General Interface client to communicate successfully with a Google App Engine back-end via JSON. Not only was that success using Google's development server running on locally, but it was with the GI client running inside of the GI builder tool. My success tonight was getting the GI application successfully deployed on the GAE development server. Now I can run the application by navigating to a URL. This involved three main steps: tweaking GAE to support static files, copying the right GI files into the right GAE folders, and creating a GI launch page for my application.

Activating support for static files on GAE is fairly well documented. In my case, I decided to add a "static" folder under my GAE application folder ("winenotes"). I then modified my app.yaml file to look like this:

application: winenotes
version: 1
runtime: python
api_version: 1

handlers:
- url: /static
static_dir: static

- url: .*
script: winenotes.py

In this way, static files can be accessed by tacking their path and file name to the end of the URL, starting with the "static" directory.

The second piece is copying the GI files to the GAE server. I created a "gi" directory under "static", and copied both the JSX and JSXAPPS folders there (I removed everything from JSXAPPS except the folder for my application).

The final step is creating a launch page, as described in the GI Developer's Guide. From within the builder, I selected Project > Deployment Utility. I picked the "static" directory and named the file "launch.html". Clicking Create automatically generates a starter file with the specified name and location. The paths in the generated file required a bit of editing; I modified the script section to look like this:

<script type="text/javascript" src="gi/JSX/js/JSX30.js" jsxapppath="gi/JSXAPPS/wineLog/">
</script>

That's it. Once I started the Google App Engine server, I was able to launch my application by opening http://localhost:8080/static/launch.html. The only glitch is an error message that appears as the application is loading:


The application seems to load just fine after clicking OK. I need to investigate the error message further.

Tuesday, August 25, 2009

General Interface: Changing Scripts

Every time I change a script in General Interface it seems like I have to quit the builder and restart it before the change is noticed. Here's an easier way that seems just as reliable: right click on the script file in the Project Files palette and select Load/Reload. I don't understand exactly why it works -- shouldn't GI know to refresh the cached version of a script after it's changed? -- but it does.

Monday, August 24, 2009

Success! General Interface and Google App Engine

It's been painful, but I finally got a General Interface front end to display data from a custom Google App Engine service. I had previously gotten Google App Engine to return data in JSON format via an HTTP Get, and General Interface to read that data from a stub file and display it, but I hadn't been able to get GI to successfully source the data from the service. Until now.

The trick is apparently in the rules file: it needs to have an input/request node. I added the following XML to the rules file right before the output node (I couldn't figure out how to add the node using the XML Mapping Utility):

<record jsxid="x37650" jsxtext="Input (request)" type="I" jsxopen="1"/>

Now when I open the rules file in the XML Mapping Utility it looks like this:


I got the idea for the input node from the the Yahoo Travel demo posted on the TIBCO Community site. The GI documentation is in bad shape to be missing such basic information. I hope developing with GI gets easier.

Note that I haven't deployed the GAE application yet; I'm just going against the local development server.

Friday, August 21, 2009

Google App Engine on Windows

I've been doing General Interface development in Windows under Parallels. I've been doing Google App Engine development directly in OS X. I haven't quite figured out how to get them talking to each other. In the meantime, I decided to install GAE on Windows so that the client and the server would be on the same "machine".

It was a pain figuring out how to start the GAE development server. The official documentation makes it sound simple, but in reality it seems very finicky about paths. Here's what is working:

C:\Python25\python "C:\Program Files\Google\google_appengine\dev_appserver.py" --datastore_path=Z:/Users/john_beretz/temp/datastore Z:\Users\john_beretz\Documents\briefcase\Projects\GoogleAppEngine\winenotes

Another quirk: according to the documentation, I should be able to stop the service with Ctrl-C. While that does seem to stop the service, it doesn't do it gracefully: the whole thing just locks up.

Sunday, August 16, 2009

General Interface: Buttons, Scripts, and Dynamic Properties

I'm now using the latest version of General Interface: 3.8. This is the first version to drop the "TIBCO" moniker, i.e. it is the first version released since General Interface was made open source.

I've been using the example application mentioned in the previous post to become familiar with some of the basics of GI. For instance, indicating which script should run when a button is clicked is simple, if you know where to look. The script is not referenced in a property of the button; instead, it is accessed through the Events Editor palette. While the button object is selected in the Component Hierarchy palette, several events are listed in the Events Editor palette; the value specified for "Execute" is the name of the script to run when the button is clicked.


Another feature that was at first confusing: dynamic properties. General Interface allows you to specify property values in the Properties editor palette either as hard coded literals or as references to name/value pairs stored in an XML file; the latter is referred to as a dynamic property. There's no special syntax to indicate whether the value you enter in the Properties Editor is static or dynamic; apparently GI just figures that it's dynamic if it matches one of the dynamic property names you've defined, and otherwise it's static. Once you've entered a reference to a dynamic property in the Properties Editor, GI displays the reference in gray followed by the current value in brackets.

I haven't tried creating my own dynamic properties file yet, but the one in the example above is named appLabels_ljss.xml and is stored in the project's jss folder (by the way, dynamic properties files are sometimes referred to a "jss" files).

Friday, August 14, 2009

TIBCO GI and JSON Services

Finally found what looks to be an example of how to get TIBCO GI working with a web service that returns JSON (see the May 19th post by Vic Patterson).