Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorial:dev:conector_-_how_to_implement_connector [2019/01/07 15:35]
hanakp [4. Setup logging for connector]
tutorial:dev:conector_-_how_to_implement_connector [2020/06/10 08:07] (current)
kucerar licence
Line 3: Line 3:
 In this tutorial, we will see how to implement connector. Our example is CSV Connector. In this tutorial, we will see how to implement connector. Our example is CSV Connector.
  
-===== 1. Download and generate connector from archetype =====+===== 1. Generate connector from archetype =====
  
 +==== First option without downloading ====
 +Other option is to use this command to generate skeleton for new connector. You don't need to clone the repository and this should work, because the connector-archetype artifact is available in standard maven repository.
 +<code>mvn archetype:generate '-DarchetypeGroupId=net.tirasa.connid' '-DarchetypeArtifactId=connector-archetype' '-DarchetypeRepository=http://repo1.maven.org/maven2' '-DarchetypeVersion=1.4.3.0'</code> 
 +After this you will be prompted to fill additional information about your connector. See picture in Second option how to create connector
 +
 +==== Second option with downloading the artifact to your machine ====
 We do not have start whole project from scratch. What we need to is: We do not have start whole project from scratch. What we need to is:
   * Download or clone archetype - https://github.com/Tirasa/ConnId   * Download or clone archetype - https://github.com/Tirasa/ConnId
Line 11: Line 17:
 {{ :tutorial:dev:conn1.png?600 |}} {{ :tutorial:dev:conn1.png?600 |}}
   * After we have this setup, we can start to generate the schema. Just type 'mvn archetype:generate' in terminal where you want your connector   * After we have this setup, we can start to generate the schema. Just type 'mvn archetype:generate' in terminal where you want your connector
-  * We have to go through point-to-point creation of our connector as you can see in the picture below+  * We have to go through point-to-point creation of our connector as you can see in the picture under Few other steps to go through in the picture below in Second option how to create connector.
 {{ :tutorial:dev:conn3.png?600 |}} {{ :tutorial:dev:conn3.png?600 |}}
   * Here we have to find number of the 'net.tirasa'   * Here we have to find number of the 'net.tirasa'
Line 25: Line 31:
 </note> </note>
  
-===== 2. Implement generated schema =====+===== 2. Licence for new connector ===== 
 +When you have skeleton for the new connector from artifact, you need to created two files if you have plans to edit any file which was generated. Your new connector will be under CDDL and Apache licence. Requirements are changelog file and licence file. 
 + 
 +In root directory for you connector create: 
 +  * LICENCE - example https://github.com/bcvsolutions/moodle-connector/blob/develop/LICENSE 
 +  * CHANGELOG.md - example https://github.com/bcvsolutions/moodle-connector/blob/develop/CHANGELOG.md 
 + 
 + 
 +===== 3. Implement generated schema =====
  
 Now everything is generated so we can start to implement the connector. First, we need to change the name of our Sample classes. Let's say we change these names to //CSVConnConnector//, //CSVConnConfiguration// and //CSVConnFilter//. Now everything is generated so we can start to implement the connector. First, we need to change the name of our Sample classes. Let's say we change these names to //CSVConnConnector//, //CSVConnConfiguration// and //CSVConnFilter//.
Line 722: Line 736:
 </code> </code>
  
-===== 3. Add connector to IDM =====+===== 4. Add connector to IDM =====
  
 After everything is written we should add our new connector into IDM. It might look like its hard but actually, it is easy. We just add dependency into app module in CzechIdM app. After everything is written we should add our new connector into IDM. It might look like its hard but actually, it is easy. We just add dependency into app module in CzechIdM app.
Line 735: Line 749:
 </code> </code>
  
-===== 4. Setup logging for connector =====+===== 5. Setup logging for connector =====
  
 If you want to log for example INFO messages from connectors you have to add following property to your active profile in logback-spring.xml: If you want to log for example INFO messages from connectors you have to add following property to your active profile in logback-spring.xml:
  • by hanakp