3.1 Creating CloudTran Projects
Before starting the tutorials, you must have installed CloudTran as described in the previous chapter.
There are two ways to 'create' a CloudTran project. The first is to create a project from scratch.
The three tutorials in the next few sections of this guide assume that you are starting from scratch and take you through the process from a blank canvas to a running system.
Alternatively you can 'create' a CloudTran project simply by importing an existing project.
How to Both methods are explained in the sections below.
3.1.1 CloudTran Examples
|
There are a number of examples in the form of tutorials in the distribution.
Our first example is HelloCloud - the simplest distributed application you can get.
It already exists in the plugin at
eclipse/plugins/com.cloudtran.builder_x.y.z/jeewiz/examples/CloudTran/HelloCloudWS
|
where X, Y and Z represent the product major, minor and release numbers.
At the same level, you will see other examples. For example, the Warehouse example is at
eclipse/plugins/com.cloudtran.builder_x.y.z/jeewiz/examples/CloudTran/Warehouse
|
And the Entities example is at
eclipse/plugins/com.cloudtran.builder_x.y.z/jeewiz/examples/CloudTran/Enities
|
You may wonder why we put the "WS" suffix on HelloCloudWS.
This is an indicator that the HelloCloud example is unusual in that the example directory is also the workspace.
For more complex examples, we prefer to have an extra level of directory structure, so the actual workspace
is a "workspace" directory within the example. For example, the end of the Warehouse workspace directory is
examples/CloudTran/Warehouse/workspace
|
If you look closely at these the HelloCloud example you will see some of the output from the example shows a directory of "C:\HelloCloudWS" -
we used this as the workspace for HelloCloud in our run-through of the examples.
3.1.2 Import a new Project
|
You can use these tutorial sections to read and reference.
To do this for the HelloCloud example,
start Eclipse and set the new directory for the workspace to
eclipse/plugins/com.cloudtran.builder_x.y.z/jeewiz/examples/CloudTran/HelloCloudWS
|
When you start Eclipse (for a new directory, or using the existing example),you will get the welcome screen:
Get rid of the welcome screen. You will now need to import all the projects in that workspace.
This applies to all CloudTran examples. We strip out the meta-data before shipping the examples, so Eclipse has no history of the projects.
To import the projects into the workspace, use the Eclipse import mechanism:
-
File, Import
-
General, Existing projects into Workspace, Next
-
At "Select root directory ..." click 'Browse'. Click 'OK' to accept the default, which is the current directory
-
All the existing projects will selected. Click 'Finish'.
if you start up the distributed example, you will get something like this:
3.1.3 Create a new Project
|
Alternatively you can work through the tutorials and type in the inputs to build the application.
If you want to do this, it is best to start from scratch.
To do this for the HelloCloud example,
start Eclipse with a new directory for the workspace, different from the 'HelloCloudWS' directory in the plugin.
If you give Eclipse a new or non-existent directory for the workspace, it will use that directory as the workspace.
As an example, if you want to create a brand new project use the follow example for the HelloCloud Tutorial
Select:
File -> New -> Project
Now select
CloudTran Development -> CloudTran Project -> Next
This will bring up a 'CloudTran Project Creation Wizard'. Type in the application's project name - HelloCloud - and click 'Finish'.
This creates the HelloCloud project, which you can see in the Package Explorer. Open that out (via 'right-arrow') so we can see what has been created:
The build.xml is the Ant build file used by CloudTran to generate the application.
You don't need to amend this file to do this tutorial.
In fact, any changes to the generation will be done elsewhere as we will see later -
so in real projects, it shouldn't be necessary to change this file.
HelloCloud.osm is the model itself.
(The 'osm' in the extension originally stood for 'Open Spaces Model' and has stuck).
The model defines the architecture and design components in the system, from which CloudTran will build the application framework.
CloudTran uses this to create further Eclipse projects, the code and configuration for the projects, and deployment scripts.
Don't add a second model into the CloudTran Project - it will confuse things horribly.
The readme.txt file currently contains some boilerplate text - you can use this as your own documentation of the project.
|