View Source

{section}
{column}

h1. Definition

There are two ways to create a service assembly for Petals.
You can either create a service-unit project and [export it|Working with Service Unit projects#Export], or create a service assembly project (_SA project_).
A service assembly project only contains a JBI descriptor.
Such a project may reference service-unit projects (_SU projects_).

Here is the typical structure of a SA project.

{noformat}
src
main
java
jbi
jbi.xml
pom.xml
{noformat}

SA projects are associated with a builder in charge of validating the jbi.xml file.

{column}
{column:width=350px}
{panel:title=Table of contents}{toc}{panel}
{column}
{section}

h1. Creation

The creation of a SA project can be achieved by:
* Using the Petals Service Assembly wizard (*File > New > Petals > Service Assembly project*).
* Generating concrete projects from a _croquis_.
* Importing an existing Service-Assembly.

A SA project makes sense in only two situations:
* You want to package SU projects with Maven.
* You want to create complex service assemblies, which embed several service-units.

\\
To create a SA project, select *File > New > Petals > Service Assembly project* and click *Next*.

!PetalsStudio_SA_1.jpg!

\\
This wizard has only one page.

!PetalsStudio_SA_2.jpg!

\\
Fill-in the *name* and *artifact ID*.
Update the *version* and the *group ID* before clicking *Finish*.

A SA project is created and visible under the *Service Assembly projects* category.

h1. Edition and update

A SA project has a specific structure when seen in the Petals Projects view.
{noformat}
SA Project
SU Project 1
...
SU Project n
jbi.xml
pom.xml
{noformat}

\\
Notice the real file structure is:
{noformat}
SA Project
src
main
jbi
jbi.xml
pom.xml
{noformat}

\\
The Petals Projects view simply (and only) presents a different point of view.
*To add or remove SU projects from a SA projects, you must edit the jbi.xml* and (sometimes) [update the *dependencies* in the pom.xml|Preparing Maven Compatibility#SaMavenDependencies].
Once the jbi.xml is saved, a builder validates it and updates the project dependencies. The Petals Projects view is updated right after this build.

h1. {anchor:Export} Export for Petals

{tip}
SU and SA projects are compatible with the Petals Maven plug-in.
The packaging can be done with both the Studio and Maven.
{tip}

h2. {anchor:FastExport} Fast export

The fast export is a shortcut to create a service assembly from a SA project in few seconds.
The created service assembly is saved at the root of the SA project.

To export a SA project quickly, right-click it and select *Petals > Fast Export for Petals*.

!PetalsStudio_ExportSa_5.jpg!

h2. Complete export

The complete export provides numerous options to export one or several SA projects at once.
Select *File > Export > Petals > Service Assembly*.

!PetalsStudio_ExportSa_1.jpg!

\\
A wizard starts.
The top part lists all the SA projects contained in the workspace. Select the ones you want to export and the export mode.

!PetalsStudio_ExportSa_2.jpg!

h3. Distinct export, in the project directories

Every selected SA project will be exported, each one as a service assembly.
Each created service assembly is placed in the SA project. This is equivalent to making a [Fast export|#FastExport] on every selected SA project.

!PetalsStudio_ExportSa_3.jpg!

h3. Distinct export, in a same directory

Every selected SA project will be exported, each one as a service assembly.
All the service assemblies are placed in a same directory. The directory location must be specified.

!PetalsStudio_ExportSa_4.jpg!