-
PedroRio - 15 Dec 2010
XEO Studio
XEO Studio is a plugin to the popular Java IDE
Eclipse and is the preferred development environment for a XEO Application. The XEO Studio plugin automates several routine tasks when developing a XEO application, such as configuring the database connection, upgrading to a newer version of the XEO Framework, creating Object Models and viewers, as well as providing tools such as visual editors for Object Models and content assist for Viewers.
Installing XEO Studio
XEO Studio requires the
UML2 Plugin, so you must install that one before (use the Eclipse Repositories to search for the UML2 Plugin)
To install the XEO Studio plugin just
copy the XEOStudio.jar to the Eclipse plugins folder and start/restart Eclipse.
A JDK6 must also be installed to create a XEO Application.
Note: The XEO Studio.jar file comes bundled with a release of the XEO Framework, however not every XEO Framework release originates a XEO Studio release, so do download the latest stable release.
Creating a new Project
To create a new XEO Project, go to the "File" menu and select "XEO Project" from the selection menu, as depicted in figure XStudio.1
Figure XStudio.1 - New XEO Project creation in XEO Studio
Next, you'll be presented with the screen to choose the name of the project, as depicted in figure XStudio.2. Write "XEOLibrary" as the project name and press next.
(Project Names cannot have spaces, i.e. "XEO Library" is not a valid name, but "XEO_Library" or "XEOLibrary" are).
Figure XStudio.2 - Project name in new XEO Project Wizard
In the next screen, depicted in figure XStudio.3 you need to choose the version of the XEO Framework to create the project with (XStudio.3 label 1), and for that you can use the default version bundled with your version of XEO Studio, or choose the XEOCore.xar (more information about
.xar files in the following sections) from the file system. (The XEOMeta option in figure does not currently work).
Next, you need to choose the
J2EE Application Server (XStudio.3 label 2), currently only Oracle's
OC4J is supported directly in XEO Studio for development, but XEO is a compliant
J2EE framework and any compliant
J2EE server (such as JBOSS or Glashfish) works.
In label 3 and 4, (Figure XStudio.3) you choose the web context root for your web application and the port for you application. If you write xeo/8888 in the fields, you're application will be accessible at
http://localhost:8888/xeo.
WebApp" src="http://wiki.itds.pt/pub/WebITDS/XeoPrimerStudioIntroduction/NPWWebApp.png" title="XEO Studio
WebApp" height="699" />
Figure XStudio.3 - XEO Framework version and WebApplication/WebServer definition
By pressing the Next button you'll be taken to the Database Configuration screen (depicted in Figure XStudio.4, bellow) The Database configuration screen allows to choose on the supported databases (currently, Oracle 9i+,
MySQL 5.1+ or MS SQL Server 2005+, see label 1 of the figure) and then fill the required connection information as well as user credentials. When connecting the XEO application to a database you can create a new user or reuse an existing one (MS SQL Server is the exception, you can only reuse an existing user), in label 2 of the figure there's the checkbox which allows to create a new database user (if it's unchecked it'll use the credentials of an existing user [fields bellow label 4]). Label 3 in the figure is the area where connection parameters are defined, the host where the database is located, the port and, in Oracle's case, the SID (if it were
MySQL it would be the database name)
The XEO Database User Settings (label 4 in the figure) allows you to input your database user credentials (with Oracle's database you'll also need the Tablepsace and the Temporary Tablespace).
Figure XStudio.4 - Database Definitions
After all values are filled, you need to press the "Test Settings" button (label 5, in figure XStudio.4) to check if everything is correct. If no problems occur the "Finish" button will become active so that the project can be initialized. A small message will appear at the top of the screen if everything is ok (see Figure XStudio.5), if anything is wrong a popup with the error message will appear. Pressing the "Finish" button will create the project in your workspace.
Figure XStudio.5 - Database Connection OK
When the wizard finishes, we can launch/deploy the project directly from Eclipse, because XEO Studio in the process of creating the XEO Project also added a Degug/Run Launch Configuration to Eclipse, as seen in Figure XStudio.5a. Open the "Debug Configurations" menu and select the newly created configuration. Eclipse will deploy the application in the application server (in this case,
OC4J).
Figure XStudio.5a - Debug Configuration Menu after XEO Project creation
When the project is deployed, you should see in Eclipse's console the message: "
Oracle Containers for J2EE 10g (10.1.3.3.0) initialized". As depicted in figure XStudio.5b
Figure XStudio.5b - Console message when a XEO Project is deployed in the application server
After this, launch your web browser and point it to
http://localhost:8888/xeo/Login.xvw. Since it's the first time the project is deployed the XEO Builder will kick-in an make the initial build.
Figure XStudio.5c - XEO Builder after project creation
The Build process is relatively quick in a new project (varies depending on database, Oracle is faster than
MySQL) but depends on the number of XEO Object Models, because each Object Model has to be converted to a Java class, compiled and then the database tables must be created/altered.
This is done only time the project is created, when you add another XEO Object Model to your project only that Object Model will go through these steps. After the XEO Builder is complete, you'll be taken to the Login page (Login.xvw), use the default system username SYSUSER/ABC. It will redirect you to the
Main_admin.xvw Viewer (see figure XStudio.5d bellow) where you can manage your XEO Application (from an Administrator's point of view), it will automatically open a tab with some statistics about your application.
Figure XStudio.5d - XEO Application Admin Viewer
At this point your application is up an running and you could start creating new Object Models and Viewers, but for now let's try to understand a little better how a XEO Project is organized
Understanding the XEO Project Structure
Every XEO Application has the same structure (in terms of files/folders), depicted in figure XStudio.6, to allow XEO Studio to recognize each folder and put objects/viewers and XEO related files in their right places. The structure (following the labels in figure XStudio.6) is as follows:
- Src - Java source code (you're code goes in here, just like a regular Java Project)
- J2EE Libs, Modules, Module Libs - Where all the Jars that are required from XEO Core System and XEO Modules are put
- bodef - The folder where XEO Packages (which will contain XEO Object Models) are placed, includes a packages.xeodesc file with descriptions of each XEO Package
- A XEO Package, each XEO Package can have any number of XEO Object Models, including XEO Sub-Packages
- XEO Lovs (List of values) - XEO Packages can store not only XEO Object Models, but also static lists of values which can be reused by the Object Models to declared the possible values of a given attribute, these are *.xeolov files
- uidef/default - Default Profiles for the Application, which will be discussed further in the documentation. Users in a XEO application can have profiles which may be used to restrict their actions, files in this folder contains definitions of profiles to be created by the XEO Builder.
- Default web app - All your web resources (including *.xvw files [Viewers]) go in here.
Figure XStudio.6 - XEO Project Structure
Inside the bodef folder is where all XEO Object Models are placed (both the XEO Models that are provided by the XEO framework as well as the XEO Models specifically created for the application. XEO's System Packages include the following (details on important Object Models bundled with the framework will be explained as needed throughout the documentation:
- SYSTEM$1.0
- XEODOC$2.0
- XEOUSERINTERFACE$1.0
- XWC$1.0
Why the $1.0/$2.0 in the package name?
Historic reasons: The main purpose of those values is to help developers knowing the version of the package being used. In a long-term XEO application (and with the framework itself) packages undergo changes and maintenance and those changes are significant enough the version of the package may warrant a change.
It's only a convention and does not affect the behavior of the platform.
XEO *.xar files
A XAR (Xeo ARchive) file is basically a container for XEO Projects (including the XEO Framework). The XEO framework is distributed inside a XAR file and you can also export a XEO Project as a XAR file and import that Project in another XEO Studio instance.
XEO Builder Integration with XEO Studio.
As explained in the
XEO Concepts section, At the heart of XEO is the Builder, which deals with the convertion of Object Models to Java classes and Databases tables, their constraints, indexes, etc. XEO Studio has a direct connection to the XEO Builder, which means each time an Object Model is saved in XEO Studio, the Builder is invoked (the Builder knows what Object Models were changed since the last build). The process is depicted in figure XStudio7.a which shows what happens when a given Object Model is saved.
Figure XStudio7.a - XEO Studio invoking the XEO Builder after an Object Model is saved
XEO Studio also registers in the console when the build started and when the build ended, as depicted in figure XStudio7.b.
Figure XStudio7.b - XEO Studio output to the console of the status
a
XEO Builder inside a XEO Application
The XEO Builder is also available.