Panel | ||
---|---|---|
| ||
In order to start developing customs on Welcome to CRM.COM software, you will need to setup the Java projects required. The plugin development! The following guide provides instructions to setup your development environment and create the Java projects in Eclipse IDEplugin projects using CRM.COM Plugin SDK.
What does this section cover?
|
Step-By-Step Guide
- Click here to download the desired version of CRM.COM .ear file from our repository.
Import the .ear file in your workspace.
Expand title Importing .ear file - Click here to download the sample custom projects.
- Import the sample projects in your workspace.
- Rename the custom Java projects to the desired name.
- Create/update the mpconfig.properties file.
Mpconfig Properties File
mpconfig.properties file should be placed in the same directory as your custom project(s). This file is used to define the organisation database each custom project will run on.
To achieve that, you must use the following structure: <organisation_name>=<custom_project_directory_name>
Note that you should use the organisation(data source) name as defined on your Websphere/Wildfly server. Only one custom project per organisation can be defined.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
organisation1=custom1
organisation2=custom2 |
Plugins XML File
From R13 onwards you are advised to use plugins.xml instead of mpconfig.properties file. Just as mpconfig.properties file, plugins.xml file is used to define the organisation database each custom project will run on and should be placed in the same directory as your custom project(s).
This file gives you the ability to define more than one custom project per organisation database.
...
Prerequisites
In order to start developing plugins from CRM.COM, you will need the following:
- Oracle Java SE Development Kit 8 (JDK)
- Eclipse IDE
- Maven
- Wildfly Application Server v10.1 or later
- The CRM.COM Enterprise Archive (.ear file) - Provided by CRM.COM
- The CRM.COM Plugin SDK - Provided by CRM.COM
Step-By-Step Guide
1.Import CRM.COM archive into your IDE
Open Eclipse IDE and import the .ear file into your workspace as shown in the screenshots below.
2.Install CRM.COM plugin SDK
Extract CRM.COM Plugin SDK to a location in your filesystem where Wildfly Application Server has permission.
Set the CRM_HOME system property in Wildfly's configuration file to the location the SDK was extracted.
Info | ||
---|---|---|
| ||
You can also set any Wildfly system properties through the Wildfl management console |
3.Create plugin projects
To create a plugin project, you should run the provided create_plugin script found in the SDK and provide groupid, artifactid, and plugin type as the examples below.
There are 2 plugin types, ejb and web plugins. The ejb plugin projects should be used to implement business logic - the model and controller layers of the plugin and the web plugins should be used to implement the view layer of your plugin - the pages, reports, etc.
Code Block | ||||
---|---|---|---|---|
| ||||
./create_plugin.sh com.example example-ejb-plugin ejb |
Code Block | ||||
---|---|---|---|---|
| ||||
./create_plugin.sh com.example example-web-plugin web |
During the creation of the plugin skeleton, you will be prompted to define a version for your plugin and also confirm your configuration (groupId, artifactId and version).
After creating your plugins, you should also register them by updating the plugins descriptor
The plugins.xml file is used to register your plugins. Using this file, you can define your plugins and the organisations that your plugins will be enabled for.
For a full list of plugins file attributes, go to Plugins Plugin Descriptor File Documentation. .
Info | ||
---|---|---|
| ||
Note that the artifact ids defined in a plugin should match the name of the Java projects - the artifact ids specified when the Java projects were created in the steps above. |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<pluginconfig> <plugins> <plugin> <name>switch<<name>example-plugin</name> <description>Switch<description>Example plugin Provisioningfor Providergetting Plugin<started</description> <enabled>true</enabled> <vendor>CRM.COM</vendor> <version>1.0.0</version> <organisations> <organisationid>SUBSCRIPTIONS_DB</organisationid> <organisationid>ADMIN_DB</organisationid> </organisations> </plugin> <plugin> <name>kounta</name> <description>Kounta Point Of Sale System Plugin</description> <enabled>true</enabled> <vendor>CRM.COM</vendor> <version>1.0.0</version> <artifacts> <artifactid>example-ejb-plugin</artifactid> <artifactid>example-web-plugin</artifactid> </artifacts> <organisations> <organisationid>REWARDS<organisationid>SUBSCRIPTIONS_DB</organisationid> <organisationid>ADMIN_DB</organisationid> </organisations> </plugin> </plugins> </pluginconfig> |
Cache Properties File
From R13 onwards Hibernate second-level caching is used for the most of CRM.COM configuration entities. To enable this functionality you have to create cache.properties file and place it in the same directory as your custom project(s).
4.Import plugin projects into your IDE
The last step before starting development is to import the created plugin projects into your Eclipse workspace.
After adding the plugin projects to your workspace, you should fix the classpath of your web plugin by adding the required crm-ui.jar.
This can be found under /WebContent/WEB-INF/lib directory of the Crm project.
To fix the classpath of the web plugin, right-click on the project → Properties → Java Build Path, select the Libraries tab and click the "Add JARs..." button.
The next step is to add your web plugins to the deployment assembly of the Crm project and your ejb plugins to the deployment assembly of the CrmEAR project as demonstrated below.
5.Deploy CRM.COM with plugins to Wildfly
The last step to run your plugins, is to deploy the application to your application server.
To do that, you should add the CrmEAR project to your Wildfly server by right-click on it and then start it.
That's it! As soon as your server is started, you can go to the login page of CRM.COM by using the following URL.
Info | ||
---|---|---|
| ||
Remember to always use the secure port of the Wildfly application server. CRM.COM works only over HTTPS for maximum security. |
CRM.COM Java Projects
The CRM.COM .ear consists of 3 main Java projects, Crm.war, CrmAPI.war and CrmEJB.jar.
For each one of these projects, there is a corresponding custom Java project available in sample projects.
Depending on the custom to be implemented, the corresponding custom project should be modified.
Crm.war
This project includes all the files and code required to implement the View layer such as:
- Pages
- Reports ( WebContent/WEB-INF/reports )
- Printouts ( WebContent/WEB-INF/printouts )
- Dashboard components ( WebContent/WEB-INF/dashboards )
A detailed explanation of the view layer can be found at Developing the View layer
CrmAPI.war
This project includes all the code required to implement the CRM.COM Web API, that is, all the controller classes and Java classes required to parse the data in Web API requests and construct the data included in Web API response.
CrmEJB.jar
This project includes all files and code required to implement the Model and Controller layer.
More specifically, this project includes the Data object classes, the Business object classes and Service (process) classes.
In addition, this project includes all the metadata required for the application to function correctly.
- Application metadata
- Module metadata
- Menu options metadata
- Entity metadata
- Entity fields metadata
- Variable metadata
- Label translations to specific languages
A detailed explanation of the model layer can be found at Developing the Model layer, and a detailed explanation of the controller layer can be found at Developing the Controller layer
Property Files
Development Properties
The dev.properties file is used by developers to enable/disable specific functionalities of the application in order to help them troubleshoot and debug more easily.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#Enable/disable development mode - if set to true this will enable some useful development features such as displaying Exception stack traces in error messages. The default value is false.
isdevelopment=true
#Enable/disable automatic initialization of the organisations during server startup. If this is disabled, each organisation will be initialized during the first login. The default value is true.
initializeOrganizationsOnStartUp=false
#Enable/disable automatic update of the organisation databases during organisation initialization. This property should be used in combination to the initializeOrganizationsOnStartUp. Default value is true.
autoUpdateOrganisationsDatabase=false
#When set, this property will enable logging of SQL statements slower than the specified time (in milliseconds)
sql_log_duration_threshold=1000
#When set, this property will enable logging of Web API calls slower than the specified time (in milliseconds)
api_call_log_duration_threshold=1000 |
Cache Properties
CRM.COM uses Hibernate second-level caching to cache configuration records for maximum performance.
To enable this caching and set its parameters, you can use cache.properties file located in your CRM_HOME directory.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#enable/disable caching - true/false enabled=true #multicast address | multicast host name multicastGroupAddress=224.0.0.251 #Multicast port multicastGroupPort=4446 #0-255 #0 is restricted to the same host #1 is restricted to the same subnet #32 is restricted to the same site #64 is restricted to the same region #128 is restricted to the same continent #255 is unrestricted #The default value in Java is 1, which propagates to the same subnet. Change the timeToLive property to restrict or expand propagation. timeToLive=1 #the hostname or IP of the interface to be used for sending and receiving multicast packets hostName=cyn1lnx007localhost #Mandatory - the port the listener listens on. port=40001 #Optional - the number of seconds client sockets will wait when sending messages to this listener until they give up. By default this is 2000ms. socketTimeoutMillis=2000 |
CRM.COM Java Projects
...
Quartz Properties
CRM.COM .ear consists of 3 main Java projects, Crm.war, CrmAPI.war and CrmEJB.jar.
For each one of these projects, there is a corresponding custom Java project available in sample projects.
Depending on the custom to be implemented, the corresponding custom project should be modified.
Crm.war
This project includes all the files and code required to implement the View layer such as:
- Summary pages ( WebContent/pages/summary/ )
- Data Entry pages ( WebContent/pages/dataEntry/ )
- Search pages ( WebContent/pages/search/ , WebContent/pages/trees/ for tree-search pages)
- Reports ( WebContent/reports )
- Printouts ( WebContent/printouts )
- Dashboard components ( WebContent/pages/dashboards )
A detailed explanation of the view layer can be found at Developing the View layer.
In addition, this project includes all the metadata required for the application to function correctly.
- Application metadata
- Module metadata
- Menu options metadata
- Entity metadata
- Entity fields metadata
- Variable metadata
- Label translations to specific languages
CrmAPI.war
This project includes all the code required to implement the CRM.COM Web API, that is, all the controller classes and Java classes required to parse the data in Web API requests and construct the data included in Web API response.
CrmEJB.jar
This project includes all files and code required to implement the Model and Controller layer.
More specifically, this project includes the Data object classes, the Business object classes, the UI (User interface) and process flow controllers.
A detailed explanation of the model layer can be found at Developing the Model layer, and a detailed explanation of the controller layer can be found at Developing the Controller layer.uses Quartz Scheduler for process scheduling. Using quartz.properties, you can set it's parameters.
However, we suggest to avoid modifying the default file unless in case you need to.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
org.quartz.scheduler.instanceName = DefaultQuartzScheduler
org.quartz.scheduler.rmi.export = false
org.quartz.scheduler.rmi.proxy = false
org.quartz.scheduler.wrapJobExecutionInUserTransaction = false
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 5
org.quartz.threadPool.threadPriority = 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreCMT
# Comment out the following line for PostgreSQL
#org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
# Uncomment the following line for PostgreSQL
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
org.quartz.jobStore.tablePrefix = QRTZ_
org.quartz.jobStore.dataSource = QUARTZ
org.quartz.jobStore.nonManagedTXDataSource = QUARTZ_NO_TX
org.quartz.dataSource.QUARTZ.jndiURL=defined in ecenter.properties default is jdbc/ecenter
org.quartz.dataSource.QUARTZ.validationQuery=SELECT * FROM ECENTERS WHERE 1=0
org.quartz.dataSource.QUARTZ_NO_TX.jndiURL=defined in ecenter.properties default is jdbc/ecenter
org.quartz.dataSource.QUARTZ_NO_TX.validationQuery=SELECT * FROM ECENTERS WHERE 1=0
# Uncomment the following line for SQLServer 2005:
# org.quartz.jobStore.selectWithLockSQL = SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ? |
ETL Properties
Using the etl.properties file, you can set specific parameters that are used by Pentaho Data Integration to execute the data tranformations.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#External Kettle directory and launch command for Windows
win_dir=C:/data-integration
win_cmd=C:/data-integration/Pan.bat
#External Kettle directory and launch command for Linux
linux_dir=/opt/data-integration
linux_cmd=/opt/data-integration/pan.sh
#The URL to be used by transformations to call the Web API
webservice_URL=http://localhost:9080/crmapi/rest/v2/
#for diagnostic: if set to 1 does not delete temporary transformation files which are created during their execution.
keepTempTransformation=0 |