Prerequisites
- Install Java JDK
- Download Apache Maven
- Link here: https://maven.apache.org/download.cgi
- Install Eclipse
- Install Maven
- Open Eclipse
- Goto Help -> Eclipse Marketplace
- Search “Maven”
- Click “Install” button on “Maven Integration for Elcipse”
- Follow Instructions
- Goto Window -> Preferences, and you should see Maven listed in the left panel
Creating a Custom Plugin
- Open Eclipse
- Click File -> New and select Maven Project
- Select Default Workspace
- Select quickstart Maven archtype. The Artifact ID is maven-archtype-quickstart.
- Type the Group Id and Artifact Id. The Group Id is the package structure for your project. The Artifact Id will be the name of your project, and the final source folder of your package. More information about the Java specification for package names can be found here: http://docs.oracle.com/javase/specs/.
- Group Id : com.ephesoft.customplugin
- Artifact Id : ephesoft-custom-plugin
- Image may be NSFW.
Clik here to view.
- Your Eclipse Project workspace should now look like this
- Add the Ephesoft Libraries to your Project.
- Right Click on your project folder “ephesoft-custom-plugin”
- Select Build Path -> Configure Build Path
- Click on the Libraries Tab
- Click Add External Jars
- Navigate toEphesoft Installation Path “Application\WEB-INF\lib “
- Select All Jar Files
- Click Open
- Click OK
- Create a New Interface
- Right Click On your Package “com.ephesoft.customplugin.ephesoft.custom_plugin”
- Select -> New Interface
- Name : CustomPlugin
- Image may be NSFW.
Clik here to view.
- Replace the file contes with the below code
package com.ephesoft.customplugin.ephesoft_custom_plugin;
import com.ephesoft.dcma.core.DCMAException;
import com.ephesoft.dcma.da.id.BatchInstanceID;public interface CustomPlugin {
void helloWorld(final BatchInstanceID batchInstanceID, final String pluginWorkflow) throws DCMAException;
}- Create a Java class to Implemaent Interface CustomPlugin
- Right Click On your Package “com.ephesoft.customplugin.ephesoft.custom_plugin”
- Select New -> Class
- Name : CustomPluginImpl
- Image may be NSFW.
Clik here to view. - Replace Code with below
package com.ephesoft.customplugin.ephesoft_custom_plugin;
import org.springframework.util.Assert;
import com.ephesoft.dcma.core.DCMAException;
import com.ephesoft.dcma.core.annotation.PostProcess;
import com.ephesoft.dcma.core.annotation.PreProcess;
import com.ephesoft.dcma.core.component.ICommonConstants;
import com.ephesoft.dcma.da.id.BatchInstanceID;
import com.ephesoft.dcma.da.service.BatchClassPluginConfigService;
import com.ephesoft.dcma.util.BackUpFileService;public class CustomPluginImpl implements CustomPlugin, ICommonConstants {private BatchClassPluginConfigService batchClassPluginConfigService;@PreProcess
public void preProcess(final BatchInstanceID batchInstanceID, String pluginWorkflow)
{
Assert.notNull(batchInstanceID);
BackUpFileService.backUpBatch(batchInstanceID.getID());
}@PostProcess
public void postProcess(final BatchInstanceID batchInstanceID, String pluginWorkflow)
{
Assert.notNull(batchInstanceID);
}public void helloWorld(BatchInstanceID batchInstanceID, String pluginWorkflow) throws DCMAException {
//TODO Auto-generated method stub
String name = "";
String propertyName = "app.name";
name = batchClassPluginConfigService.getPluginPropertiesForBatch(batchInstanceID.getID(), "EPHESOFT_CUSTOM_PLUGIN").get(propertyName);
System.out.println("**** Ephesoft Custom Plugin: Hello " + name + " " + batchInstanceID.getID() + " *****");
}public BatchClassPluginConfigService getBatchClassPluginService()
{
return batchClassPluginConfigService;
}public void setBatchClassPluginConfigService(BatchClassPluginConfigService batchClassPluginConfigService)
{
this.batchClassPluginConfigService = batchClassPluginConfigService;
}
}- Image may be NSFW.
Clik here to view.
- Create Folder Structure for XML Resources
- Right Click on you Project in Project Explorer Window
- Selct New -> Source Folder
- Folder Name : src/main/resources
- Image may be NSFW.
Clik here to view.
- Create a META-INF folder
- Right Click on “src/main/resources” in your Project folder you just created
- Select New -> Folder
- Folder Name : META-INF
- Create Sub Folder under META-INF
- Right Click on META-INF
- Select New -> Folder
- Set Folder name to your Project Name
- Name : ephesoft-custom-plugin
- Set Folder name to your Project Name
- Create the XMLs
- Right Click on “src/main/resources”
- Select New -> XML File
- If XML File is not available Click Other and look for XML File
- Name this XML the same name as your Project
- Name : ephesoft-custom-plugin.xml
- Description of Properties
- <jar-name> – This is the name of the jar file containing your plugin code, when we build the project and get a jar file, we’ll need to rename it to match this value. This should be <name of the project>.jar.
- <plugin-name> – This is the name of the plugin that will show in the workflow. In the CustomPluginImpl.java class, we used the name “EPHESOFT_CUSTOM_PLUGIN”, so we’ll need to put that here.
- <plugin-service-instance> – This is the name of the bean identifier we will reference in the applicationContext.xml. My value is set to “CustomPlugin”.
- <method-name> – This is the name of the method that will be first called when the plugin executes in the workflow.
- <application-context-path> – This should set to the applicationContext-ephesoft-custom-plugin.xml.
- <plugin-properties> – Here is where you indicate the properties of the plugin that will be configured in the UI. In the CustomPlugin.java class, we called on one property, called “app.name”.
- Add Below code to ephesoft-custom-plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<jar-name>ephesoft-custom-plugin.jar</jar-name>
<plugin-name>EPHESOFT_CUSTOM_PLUGIN</plugin-name>
<plugin-desc>Ephesoft Custom Plugin</plugin-desc>
<plugin-workflow-name>CUSTOM_PLUGIN</plugin-workflow-name>
<plugin-service-instance>CustomPlugin</plugin-service-instance>
<method-name>helloWorld</method-name>
<is-scripting>FALSE</is-scripting>
<back-up-file-name>EphesoftCustomPlugin</back-up-file-name>
<script-name>N/A</script-name>
<application-context-path>applicationContext-ephesoft-custom-plugin.xml</application-context-path>
<plugin-properties>
<plugin-property>
<name>app.name</name>
<type>STRING</type>
<description>Name</description>
<is-mandatory>FALSE</is-mandatory>
<is-multivalue>FALSE</is-multivalue>
</plugin-property>
</plugin-properties>
<dependencies>
</dependencies>
</plugin>- Image may be NSFW.
Clik here to view.
- Right Click on the META-INF folder you Created
- Select New -> XML File
- Name this file applicationContext-<NAME OF YOUR PROJECT>
- Name : applicationContext-ephesoft-custom-plugin.xml
- Add below code to applicationContext-ephesoft-custom-plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
default-autowire="byName">
<import resource="classpath:/META-INF/ephesoft-custom-plugin/applicationContext.xml" />
</beans>- Image may be NSFW.
Clik here to view.
- Name this file applicationContext-<NAME OF YOUR PROJECT>
- Right Click on the Sub Folder of META-INF (should be the name of your project “ephesoft-custom-plugin”)
- Select New -> XML File
- Name : applicationContext.xml
- Replace applicationContext.xml with below Code
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
default-autowire="byName">
<import resource="classpath:/META-INF/applicationContext-data-access.xml"/>
<import resource="classpath:/META-INF/applicationContext-batch.xml"/>
<import resource="classpath:/META-INF/applicationContext-core.xml"/>
<bean id="CustomPlugin"
class="com.ephesoft.customplugin.ephesoft_custom_plugin.CustomPluginImpl" >
<property name="batchClassPluginConfigService"
ref="batchClassPluginConfigService"></property>
</bean>
<context:component-scan base-package="com.ephesoft.customplugin.ephesoft_custom_plugin" />
</beans>
- You should have a folder structure that looks like below
- Finishing Up
- We have one more XML File to modify
- Locate the pom.xml under your project. It should already exisit
- Replace contents with below code
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ephesoft.customplugin</groupId>
<artifactId>ephesoft-custom-plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ephesoft-custom-plugin</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.ephesoft.dcma</groupId>
<artifactId>dcma-core</artifactId>
<version>0.0.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/ephesoft.jar</systemPath>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
</dependencies>
</project>
- Image may be NSFW.
Clik here to view.
- We have one more XML File to modify
- Copy and Paste the ephesoft.jar file from Ephesoft\Application\WEB-INF\lib to your project “src/main/resources” Folder
- Compiling the Project
- Right Click on Project Folder
- Click RunAs Maven build
- Golas : clean install
- Click Apply
- Click OK
- Note After Compiling you may need to Right Click and Refresh your project to update the Folder structure
- Import The Plugin Into Ephesoft
- Locate the Created JAR file after compiling under your Project in Eclipse
- Under target folder
- Temporarily copy to Desktop
- Rename Jar from “ephesoft-custom-plugin-0.0.1-SNAPSHOT.jar” To “ephesoft-custom-plugin.jar”
- Locate ephesoft-custom-plugin.xml under your project
- Temporarily copy to Desktop
- Zip these files together
- Highlight both Files
- Right Click
- Send To -> Compressed Zip
- ZIP name must equal same name as JAR file
- Name : ephesoft-custom-plugin.zip
- Image may be NSFW.
Clik here to view.
- Open Ephesoft in Web Browser
- Go to System Configuration
- Select Workflow Management
- Drag and drop your created Zip file into the Import Plugin Section
- Restart Ephesoft so it will reload in your new JAR on startup
- Locate the Created JAR file after compiling under your Project in Eclipse
- You should now have a working custom plugin.