-
Notifications
You must be signed in to change notification settings - Fork 1
How do you develop a Magnolia CMS connector for a source?
I develop this app to be more generic source possible. It's general purpose agnostic Object and connector.
So you must implement the connection to source that returns one object representing the connection to source.
/**
* Create a general purpose connection with AWS S3 instance
*/
public class S3Connection implements CustomConnection {
All class implements CustomConnection will be showed in selectbox and you can select one in the first step of choose source.
1. Delegate class could be implemented for retrieving the data from source and search for some keys.
Depending source you could implement some features or not, but basically it's enough extends GenericDelegate that gives you a simple search, create an item, edit item and delete features.
@DelegateImplementation(parameterClass = S3ParameterConnection.class)
public class S3Delegate<T extends GenericItem> extends GenericDelegate{
Actions could be done in Content App Elastic Search
All class extends GenericDelegate will be showed in selectbox and you could select the source you prefer.
When you select a source, all field in connection class will be showed and you can insert data requested and connect.
When you click on connect we execute connect method interface.
The time request for operation depends to the instance you want to connect, network issue and many variables hard to plan in advance.
2. it's necessary to create the DTO containing all fields you retrieved from the source (see 1. point).
For example for AWS S3 source you could create one DTO like this:
**
* It's a item must extends {@link GenericItem}.
*/
@GenericEntity(name = "test-magnolia-connector-s3", fieldId = "id")
public class CustomIndexElasticSearch extends GenericItem {
/** The id. */
private String id;
private String pathFileBucket;
@FileUpload(fieldPath = "pathFileBucket")
private File file;
}