Tuesday, August 07, 2012

#Openflame from @firejacknet - A means to a robust end

In previous blog posts (here and here) I have documented the process for getting the Openflame platform running on Mac OS X. This can be accomplished because the platform uses industry standard open source components such as:
  • Tomcat
  • Memcached
  • Maven
  • MySQL

But running Openflame on this stack is not an end in itself. It is a means to an end. Openflame provides a rapid development environment that produces web applications that run using robust, open source web technologies. So let's put together a sample application and learn more about how Openflame works.

In order to get to work on the platform I take the following steps:

- Launch MySQLWorkbench and startup the MySQL Server. I could also have gone in to System Preferences and used the MySQL Preference Pane.
- Open the Terminal and check the setting for OPF_ENV_PATH.
- Launch Tomcat using /Developer/Tomcat/bin/startup.sh

You can check the progress of Tomcat and the deployment of Openflame by checking the catalina.out log. In my installation that can be found in:
/Developer/Tomcat/logs/.

Openflame is a complex platform so it may take a few minutes to loa but once Tomcat is loaded pointing your Web Browser to Localhost:8080 should return this:

Apache_tomcat_7

Clicking on the Manager App button should return information that includes the Openflame application:

_manager

With openflame started we can launch the application:

You should see this:

Firejack_technology_-_openflam

Use the Admin userid and password to access the Openflame platform.

When logged in you should see a screen that looks like this:
0firejack_technology_-_openflam

We have a working Openflame installation and we can get to work creating business solutions!

The first step is to secure the application by changing the default admin password. 

Go to the Directory Tab and select the admin user. 
1firejack_technology_-_openflam

Double click the admin user and set and confirm a new password and press "Save"

2firejack_technology_-_openflam

With the admin password changed we can now get to work and create our first application.

Hello World

To create an application we need to construct some basic building blocks. The first is the Root Domain.

Let's add a new Root Domain. 
Click on the Domain Tab.
Click on the Add Root Domain icon.

3firejack_technology_-_openflam

I then fill in the root domain form with: 

Name: helloworld.com (this has to be in lowercase)
and, optionally, a brief description.
Click the blue "Save" button.

The next step is to create a package. The package is the application we will build. 

Select the helloworld.com root domain in the sidebar. Then click on "Add Package"
4firejack_technology_-_openflam

I use the name "hello" and check that the Context Path is set to match as "/hello"
Click the blue "Save" button.

The package context path is the url we will browse to on the server. i.e. localhost:8080/hello

Next step is to add a "Domain." This is different from the root domain. 
Domains are where we start thinking about the data we want to handle in our application. 
For this example I am going to create a very simple address book, which I will call "contacts".

I add a brief description and a naming prefix of "contact".

5firejack_technology_-_openflam

I am also going to create a database called "messages".

I am now going to add an Entity to the Domain. Select "contacts" in the sidebar.
Add "Category". Note the Capitalization.
Click "Save".
I repeated this process for two other Entities: "Organizations" and "People".
6firejack_technology_-_openflam

By now I think you are getting the idea. 

The Openflame 1.3 documentation has the steps for building a sample app documented here:

The example application is a movie database. There have been some changes between version 1.3 and 1.4 but you can still easily follow the process.

I find it easier to think in pictures when I am understanding a system so I prepared this schematic which depicts the major elements of an Openflame solution.

Openflamestructure
When you have built a solution using Openflame the next step is to:

  • Create a system component
  • Create a database within the system component
  • Generate the code for the Solution

You should be aware that the code generation process can take up to 30 minutes. The Openflame platform is busy building a fully documented project, which is deposited in to Maven and building the databases in MySQL and preparing a WAR file and supporting configuration files to allow the application to run on Tomcat.

While the code is being generated you may see an application pop up in your OS X dock. The application is org.apache.catalina.startup.Bootstrap.