Java Archetypes
Java developers that use Maven can use the scalout-msg-module or scalout-api-module archetypes to generate a working MSG or API module. The archetypes are available on the ScaleOut repository under the project and artifact id:
com.scaleoutsoftware.archetypes:scaleout-msg-modulecom.scaleoutsoftware.archetypes:scaleout-api-module
Connecting to the ScaleOut Repository
These archetypes are available from the public ScaleOut repository. To allow the Maven archetype:generate command to find the repository, create a profile in your Maven settings or in a local file. For example, you can add the following to your ~/.m2/settings.xml:
<profiles> <profile> <id>archetype-generate</id> <repositories> <repository> <id>scaleout-release</id> <url>https://packages.scaleoutsoftware.com/repository/scaleout-release/</url> </repository> </repositories> </profile> </profiles> <activeProfiles> <activeProfile>archetype-generate</activeProfile> </activeProfiles>
Alternatively, you can create a local settings file and use that settings file when generating the archetype. For example, “archetype-settings.xml”
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> <profiles> <profile> <id>generate-archetype</id> <repositories> <repository> <id>scaleout-release</id> <url>https://packages.scaleoutsoftware.com/repository/scaleout-release/</url> </repository> </repositories> </profile> </profiles> <activeProfiles> <activeProfile>generate-archetype</activeProfile> </activeProfiles> </settings>
Then, when generating the archetype, specify the settings file to the mvn command:
mvn -s /path/to/archetype-settings.xml archetype:generate ...
scaleout-msg-module
mvn archetype:generate \
-DarchetypeGroupId=com.scaleoutsoftware.archetypes \
-DarchetypeArtifactId=scaleout-msg-module \
-DarchetypeVersion=3.1.4 \
-DgroupId=com.mycompany.flighttracking \
-DartifactId=FlightTracker \
-DsossObjectName=Flight \
-DinteractiveMode=false
Note
On Windows, the archetype:generate command may require quotes around each property. i.e. “-DarchetypeGroupId=com.scaleoutsoftware.archetypes”.
What These Options Do
Property |
Description |
|---|---|
|
Your organization or namespace |
|
Name of the generated project directory + artifact id |
|
The class representing each Flight |
This command generates a new folder (FlightTracker) containing:
Java class stubs for your msg module
A sample working unit test demonstrating sending a message
A pre-configured
scaleoutPackage.jsonmetadata fileA Maven project file (
pom.xml) with preconfigured dependenciesA build pipeline for packaging your project for deployment
scaleout-api-module
To create an API module Maven project, run the following command in your terminal:
mvn archetype:generate \
-DarchetypeGroupId=com.scaleoutsoftware.archetypes \
-DarchetypeArtifactId=scaleout-api-module \
-DarchetypeVersion=3.1.4 \
-DgroupId=com.mycompany.shopping \
-DartifactId=ShoppingCart \
-DsossObjectName=ShoppingCart \
-DinteractiveMode=false
Note
On Windows, the archetype:generate command may require quotes around each property. i.e. “-DarchetypeGroupId=com.scaleoutsoftware.archetypes”.
What These Options Do
Property |
Description |
|---|---|
|
Your organization or namespace |
|
Name of the generated project directory + artifact Id |
|
The class representing each ShoppingCart |
This command generates a new folder (ShoppingCart) containing:
Java class stubs for your module classes
A sample client that performs a hashmap operation on the ShoppingCart object
a sample unit test that reads/writes to the hashmap in the ShoppingCart object
A pre-configured
scaleoutPackage.jsonmetadata fileA Maven project file (
pom.xml) with preconfigured dependenciesA build pipeline for packaging your project for deployment