Seample Installation Guidex

tieplantharrasInternet and Web Development

Nov 12, 2013 (4 years ago)

92 views

Project Seample


2011 May

Authors:

Katalin Tasi, Mark Czotter, Miklos Szennai


Budapest, University of Technology and Economics

1


Seample

Installation Guide



Seample is a modeling environment for the JBoss Seam Framework. Provides simple
modeling of Seam based applications (mostly the core components and their methods). Then a
Seam project and the java classes can be generated with

the framework in no time, the
generated code is ready to deploy on your JBoss AS. The program uses the
EMF
-
INCQuery

as
the validation framework (incremental pattern matcher).


The project was created
during a Model
-
driven software development course at
BUTE
-
FTSRG
.
The home page of the course:
MDSD
-
course



Current release:



Features:

o

Seam Framework metamod
el and modeling environment



Seam Components



REST Components



WebService Components



Business, REST, WS methods



Exceptions



Datatypes (handwritten with FQN)



Database Entities (JPA)



Dependencies between Components and Entities



Protected Regions (Xpand
)



GeneratorModel for your project name and packaging

o

Code generation



Generate sources



Generate Seam Web Project and the sources



Generates Components classes



Generates JPA entity classes



Generates dependencies, scopes, fields and methods


If you pla
n to try modeling with Seample
, first you have to set up
an Eclipse based
environment that provides
the necessary tools to use our framework.

This document guides
you through this process step by step.


1.

Obtain Eclipse

To get the newest version of Eclipse

development framework
, you can
visit the official
Eclipse site
:
http://www.eclipse.org/downloads/

We recommend you

to download

Eclipse Modeling Tools


distribution
, which has a few
plug
-
ins
installed prel
iminarily that are required
to

run Seample.

Project Seample


2011 May

Authors:

Katalin Tasi, Mark Czotter, Miklos Szennai


Budapest, University of Technology and Economics

2


When download is completed,
extract the content of the archive file to a folder where you
want your framework to take place
.

To open Eclipse, run
‘eclipse.exe’
. At the first time, it prompts the user to choose a
folder for
the workspace (every source code will be placed in here).


2.

Install additional plug
-
ins

After opening Eclipse, go to “
Help”

menu, and select “
Install New Software…
”:



From here, you can get plug
-
ins to be installed into your Eclipse framework.

Set the “
Work with


field to
Helios
update site:

(‘Helios
-

http://download.eclipse.org/releases/helios
’)

Select the following packages from
Modeling

tab:



EMF


Eclipse Modeling Framework SDK



EMF
Validation Framework SDK



UML2 Extender SDK

These are required for the express purpose of modeling.


Project Seample


2011 May

Authors:

Katalin Tasi, Mark Czotter, Miklos Szennai


Budapest, University of Technology and Economics

3



(Note: If you have downloaded Eclipse Modeling Tools, these plug
-
ins will be already
installed into the framework.)


Select other plug
-
ins (from
Modeling

as well):



XPand SDK

Th
is is

required for the (pattern
-
based) code generator.


And finally, you need to check out the source of the Seample project
,

so go to
Collaboration
tab

and select:



SVN Team Provider


Click
Next
, accept the license agreement and install the softwares.

You will have to restart
Eclipse.


To use validation

function

of
a
created Seam model,
you have to obtain EMF
-
I
nc
Query from
the update site
http://static.inf.mit.bme.hu/viatra/update/nightly/

in the same way.


3.

Get Seam Framework

Seam is a powerful open source development platform for building rich Internet applications
in Java.
You can download Seam 2.2.1 from here:
http://sourceforge.net/projects/jboss/files/JBoss%20Seam/2.2.1.Final/

Again, you have to choose a folder for Seam after extracting

the downloaded file.


To use seam, you have to install JBoss Tools. You can download all Jboss Tools from
http://download.jboss.org/jbosstools/updates/stable/helios/

update site
i
n the same way

we
described in the previous section.


After the successful installation:



Open
Preferences

in the
Window
menu



Navigate to
JBoss Tools

Web

Seam



Add the previously
downloaded Seam Runtime (the folder where you extr
acted it)
under the name
‘seam’


4.

Check out Seample source code

To use SVN, first open the SVN Repository Explorer perspective (you can open a perspective
at the upper
-
right corner of the screen)
.

Project Seample


2011 May

Authors:

Katalin Tasi, Mark Czotter, Miklos Szennai


Budapest, University of Technology and Economics

4




At the first time, you have to select which SVN kit
you

want to use.



Select SVNKit

1.3.5 and install it as described
in section
2
.


After restarting Eclipse again, you can use SVN.



In the Repository Explorer, right click somewhere on the white field, select
New


Repository Location



Type in the following URL:

http://seample.googlecode.com/svn/




Click
Finish


Now you can navigate in the SVN repository.



Open
trunk
, and select the four projects that can be found there



Right click, and select
Check Out



Project Seample


2011 May

Authors:

Katalin Tasi, Mark Czotter, Miklos Szennai


Budapest, University of Technology and Economics

5


This will
download the source projects into your workspace.


From now on, you can open the source
s

of Seample

in the workbench.


5.

Prepare

Seample

To try modeling with Seample
without

checking out the source code, you have to get JAR
files that contain the functionali
ty of this modeling environment.



Download JAR files from
http://code.google.com/p/seample/downloads/detail?name=seample
-
1.0.zip&can=2&
q=#makechanges



Copy these JARs into the
dropins

folder of Eclipse



If you want to try the
environment
, see section 6


If you want to
use

Seample directly from the source code, you will have to generate the
framework that can be used e.g. in a runtime Eclips
e.



In ‘hu.bme.mit.inf.seample.gen’ project, open the
src

folder, select
metamodel

package and open
seample.genmodel



Right click on the root element and select
Generate Model Code, Generate Edit Code,
Generate Editor Code
on
e

by one. This will generate the
Seam modeler.




The validation framework is using EMF
-
I
nc
Query technology.



In ‘hu.bme.mit.inf.seample.incquery’ project, open the
models

folder and select
generator.incquery



Right click and select EMF
-
IncQuery

Generate EMF
-
IncQuery Source Code

Project Seample


2011 May

Authors:

Katalin Tasi, Mark Czotter, Miklos Szennai


Budapest, University of Technology and Economics

6




This
will generate the constraint
-
checker sources.

To try it, see
Appendix A.

(Note: Two constraints will be

generated. One checks whether the Seam model has an
isolated component, the other one
searches

for non
-
referenced entities.)




Create a
run configuration

that contains all workspace projects as a plug
-
in

by clicking
on the white arrow in a green circle on the toolbar, and select
Run Configurations



Run the new launch configuration and it

will start another Eclipse where you can use the
environment, shown

in section 6.


6.

Try Seample

This chapter presents the basic functions of Seample modeling environment.


Project Seample


2011 May

Authors:

Katalin Tasi, Mark Czotter, Miklos Szennai


Budapest, University of Technology and Economics

7




Create a project where you can place a new Seam model.

Select File

New

Other
and create a
Empty EMF Project

(under
Eclipse Modeling Framework
tab)



Right click on the
model

folder, then select
New

Other




Open
Example EMF Model Creation Wizards

and select
Seample Model




Click
Next
, type in a name for the file (watch for the ‘.seample’ extension),
Next



For the ‘model object to create’ select
Seam
System

Project Seample


2011 May

Authors:

Katalin Tasi, Mark Czotter, Miklos Szennai


Budapest, University of Technology and Economics

8





Click
Finish
, then you can start creating a Seam model


To make a Seam model, you have to add components to

be

use
d

in your model.



Right click on the root element (Seam System), and select
New Child

Component
Collection




Add a
Business Component

to this component collection in the same way



Right click on the business component element, and select
Show Properties View



Here you can set the class name and Seam specific properties of this component. For
example set the class name to ‘BusinessClass’ a
nd Seam name to ‘business’

Project Seample


2011 May

Authors:

Katalin Tasi, Mark Czotter, Miklos Szennai


Budapest, University of Technology and Economics

9






Add a new Business Component called ‘WorkerClass’ and ‘worker’





Create a new
Dependency

for the ‘BusinessClass’ component

that refers to
‘WorkerClass’


Project Seample


2011 May

Authors:

Katalin Tasi, Mark Czotter, Miklos Szennai


Budapest, University of Technology and Economics

10




Add a new
Generator Model Collection

Generator Model

element

(beneath
Seam
System
)
, and define the packages’ and project’s name to be generated





To generate simple Java source code, right click on this
Generator Model

element and
select
Generate Application Skeleton




The result will appear in the Project Explorer, you can

open the generated sources


Project Seample


2011 May

Authors:

Katalin Tasi, Mark Czotter, Miklos Szennai


Budapest, University of Technology and Economics

11




If you want to generate a Seam Web Project, then you have to choose
Generate Seam
Web Project

option instead of application skeleton


Seample has an integrated validator

that checks whether you observed the requirements of
Java and Seam languages
(
for example every seam name in
the

model has to be unique
).


(
Note:
To view the full list of check constraints, you can look them up in
CheckComponent.chk

source file in

hu.bme
.mit.inf.seample.gen


project,

under


src/hu.bme.mit.inf.seample.gen


folder.
)




To demonstrate this ability of Seample
, add a flaw to the model


open the properties
of
BusinessClass

component, and
change the seam name

from ‘business’ to
‘worker’






If
you want to generate source,

this time

you will get an error message about the
problem we
’ve

just made

Project Seample


2011 May

Authors:

Katalin Tasi, Mark Czotter, Miklos Szennai


Budapest, University of Technology and Economics

12




Note:
If you want to download this short example, check out the
https://seample.googlecode.com/svn/trunk/hu.bme.mit.inf.seample.exeample

project.


Project Seample


2011 May

Authors:

Katalin Tasi, Mark Czotter, Miklos Szennai


Budapest, University of Technology and Economics

13


Appendix A

To try the validation abilities of EMF
-
IncQuery technology on a Seample mod
el, you have to
do some “tricks” to make this early revision of IncQuery work.




If we see the example model of section 6, we have an isolated component


BusinessClass refers to WorkerClass, but BusinessClass is referred by no one



Create a fake element somewhere in the model (e.g. create a business component with

FakeComponent


and

fake


parameters)



Save the model



Restart Eclipse (if you are using runtime, you have to restart only the runtime)



Open your model



Delete the fake component, but
do not save

the model



Click on the
EMF
-
IncQuery Validation Demo Seam

button on the toolbar




Open
Problems

view (Window

Show View

Problems)



Here you will see the result of the validation


(Note: If you save the model, the val
idation results will disappear. This bug is planned to be
fixed by the developers of IncQuery.)