Setup of a development environment for Xyna projects - Xyna-Factory/xyna GitHub Wiki
Prerequisites
- JDK 11 installed on your system
- Apache Ant version 1.9.16 or later (check with ant -version)
First, clone the xyna-factory repository:
git clone https://github.com/Xyna-Factory/xyna-factory.git
After that execute the build script to setup the factory, core components and libraries.
cd xyna-factory
./installation/build.sh build
Where to find Xyna projects
The repository of xyna-factory contains projects for different components of the factory. The types of projects that are frequently worked on are described below. We use Ant as our main build tool for Xyna and Maven for external dependencies. Always execute ant build once before you start working on a project. This will copy the necessary libraries into the lib
directory of the project. Note that the builds are not managed by Maven. When you open a project in your IDE you have to import it as an unmanaged project i.e. without any build tools and add the libraries and the source path manually.
Template projects
A template project is probably the easiest way to start developing Xyna. The Xyna Factory can generate template projects for service groups or data types, trigger and filter. The templates are designed to quickly develop coded services, trigger or filter as a java library. See Developing Template Projects for an introduction to Xyna template development.
Modules
The projects located in the sub directories under xyna-factory/modules/
constitute Xyna applications that can be imported into a running Xyna Factory. Some modules are required for basic operation while others implement additional features like network protocols, netconf, Yang, or OAS which can be imported as required. A module typically consists of one or more template projects for service groups, possibly trigger and filter and the modelled XMOM objects. You can recognize module projects by the fact that they must contain an application.xml
file at the top level. This file specifies the name and version of an application, as well as the content and dependencies. See Module Development for more information.
Server
The directory xyna-factory/server
contains the project for the Xyna Factory itself. Building this project creates the xynafactory.jar
, the main executable.
Get a running Xyna system
To get a running Xyna Factory instance for developing and testing, we recommend to run Xyna in a container. Please refer to Xyna with Docker. If you prefer a standard server installation have a look at our installation page.
Tools to support development
There are several Xyna Factory functions and Ant targets to speed up development and deployment. The following list gives an overview of a few important tools.
Ant targets
The Ant targets that interact with the Xyna Factory require two configuration files:
server.properties
server.path=/opt/xyna/xyna_001/server
server.transmitXml=no
server.host=
server.userid=
# set only one
server.keyfile=
server.password=
server.containername=<xyna-factory-container-name>
Put this file in the root directory of the repository xyna-factory
. Downloaded template projects already have this file included. Check and modify the content if necessary. The example given here is for the case that the Xyna Factory runs in a container. Replace the value of server.containername
with the name of your container.
workspace.properties
workspacename=<myworkspacename>
If you are working on a module project, create this file at the top level of the project next to the application.xml
file. Set the workspace name to the workspace that contains the modelled XMOM objects for the application.
Receive new mdm.jar and xynafactory.jar from Xyna Factory:
ant updateMDMandXynaFactoryJar
Receive new serviceDefinitionLibs.jar from Xyna Factory:
ant updateServiceDefinition
Deploy the built JAR file of a template project on the server:
ant deploy
Receive and overwrite XMOM objects from Xyna Factory in a module project:
ant update-xmom
Create the application.xml
on Xyna Factory and overwrite the local file:
ant update-application-xml
Xyna Factory cli tools
Download a template project via cli:
./xynafactory.sh buildserviceprojectjava
./xynafactory.sh buildserviceprojectpython
./xynafactory.sh buildfilterproject
./xynafactory.sh buildtriggerproject
Update mdm.jar from Xyna Factory:
./xynafactory.sh buildmdmjar
Update serviceDefinition.jar from Xyna Factory:
./xynafactory.sh buildservicedefinitionjar
Deploy the built JAR files manually:
./xynafactory.sh deploydatatype
./xynafactory.sh addtrigger
./xynafactory.sh addfilter
This will copy the JAR files to the server into the saved folder of the workspace you are developing in, e.g. for service groups:
$XYNA_HOME/revisions/rev_<id>/saved/services/<servicegroupname>
.
In case the specific revision is unknown, a way get the revision id is described in the Revision article.