Here are the recommended steps to implement the main operation:
Connect to the authoring tool and extract data
Whenever possible, it is recommended as a first step to extract the necessary data from the authoring tool. You may implement a publisher that retrieves data on-demand from the authoring tool as the publish is being processed, but it is usually simpler to implement and test if the complete set of data is first retrieved locally (e.g. in a temporary XML file).
It is also recommended to use MDAccess components whenever possible, like MDAccess for XML to parse XML files. This notably eases the implementation of the publisher, as you can have an in-memory mapping between the authoring tool model element and its representation in the Publisher model.
If data to publish contains diagrams, make sure you have a mean to extract pictures from the diagrams in the authoring tool. If possible, also make sure you have a mean to identify the locations of areas in the diagram representing resources to publish.
This step is usually realized using a subclass of com.sodius.mdw.clm.client.ReadModelOperation.
Create an empty Publisher model
This step involves creating an empty Publisher model, using the
If an MDAccess component was used on first step,
com.sodius.mdw.core.operations.Mapping instance is created to pair the source model (holding authoring tool data)
and the Publisher model (empty for now, to contain resources to publish).
Create a Design to publish
This step involves analyzing the authoring tool data loaded in the source model and creating corresponding resources in the Publisher model.
This is realized in a dedicated operation (e.g.
and detailed later in this documentation.
An instance of
org.eclipse.emf.ecore.resource.URIConverter is usually registered in the context at this stage.
The recommended implementation to use is
URIConverter is in charge of providing access to the binary stream of a logical URI,
for example for the publisher to access diagram pictures content.
Save the Publisher model
Now that resources are created in memory in the Publisher model,
this steps involves serializing the Publisher model into a file.
This is realized using the com.sodius.mdw.clm.client.SaveModelOperation class.
Depending on the choice made by the end user, the
SaveModelOperation class will save the Publisher model either in a local file,
for a disconnected mode support, or directly sent to the SECollab server for an immediate import.
Before requesting the serialization, the
is set to
true in the context
so that the Publisher model consistency is checked.
This validation for example makes sure a title is set for each resource to publish.
It avoids sending to SECollab server inconsistent data and lets the developer know the publisher is not correctly implemented as soon as possible.