Building and Deploying an Institutional Plugin
Address Prerequisites
- mvn repository: settings.xml
- Oracle JDBC Driver
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.1.0.2.0 -Dpackaging=jar -Dfile=C:/JavaLib/Oracle10.2.0.4JDBC/ojdbc14.jar
- Configure Plugin Directory in rice-config.xml
/usr/local/rice/rice-config.xml
<param name="plugin.dir">/usr/local/rice/plugins</param>
Build Project
- File -> New -> Project -> Maven Project
- Create simple project (skip archetype selection)
- Configure Project
- Click Finish
Configure Plugin
- Configure Maven Plugins, Repositories and Dependencies
pom.xml
<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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>edu.ucdavis.iet.mw.kuali.rice</groupId> <artifactId>UCDUserService-institutional-plugin</artifactId> <name>UCDUserService-institutional-plugin</name> <version>1.0</version> <description>A Rice plugin that integrates the User Service with UCD LDAP.</description> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.1</version> <configuration> <descriptors> <descriptor>src/main/assembly/plugin.xml</descriptor> </descriptors> </configuration> </plugin> </plugins> </build> <repositories> <repository> <id>connector</id> <name>Connector</name> <url>http://julien.dubois.free.fr/maven2/</url> </repository> <repository> <id>kuali</id> <name>Kuali Repository</name> <url>https://test.kuali.org/maven</url> </repository> </repositories> <dependencies> <dependency> <groupId>org.kuali.rice</groupId> <artifactId>rice-kew</artifactId> <version>0.9.2</version> </dependency> </dependencies> </project>
- Configure Assembly
- Under /src/main, create a folder named assembly
- In /assembly, create a file named plugin.xml
- Edit plugin.xml:
<assembly> <id>plugin</id> <formats> <format>zip</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <fileSets> <fileSet> <directory>conf/plugin/META-INF</directory> <outputDirectory>META-INF</outputDirectory> </fileSet> <fileSet> <directory>target/classes</directory> <outputDirectory>classes</outputDirectory> </fileSet> <fileSet> <directory>conf/plugin/lib</directory> <outputDirectory>lib</outputDirectory> </fileSet> </fileSets> </assembly>
- Configure Override Resource Loader
- Under the project root, create a directory named conf
- Under /conf, create a directory named plugin
- Under /conf/plugin, create a directory named META-INF
- In /conf/plugin/META-INF, create a file named workflow.xml
- Edit workflow.xml:
<plugin> <resourceLoader class="edu.ucdavis.iet.mw.kuali.rice.UCDUserServiceOverrideResourceLoader"/> </plugin>
This coincides with <directory>conf/plugin/META-INF</directory> in plugin.xml
Override User Service Resource
- Create UCDUserServiceOverrideResourceLoader Class
- Add Constructor and Attributes
UCDUserServiceOverrideResourceLoader.java
package edu.ucdavis.iet.mw.kuali.rice; import org.kuali.rice.resourceloader.BaseResourceLoader; import javax.xml.namespace.QName; import org.apache.xbean.spring.context.ClassPathXmlApplicationContext; public class UCDUserServiceOverrideResourceLoader extends BaseResourceLoader { public UCDUserServiceOverrideResourceLoader(){ super(new QName("IdentityManagementOverrideResourceLoader")); } private static final String SPRING_FILE = "classpath:SpringBeans.xml"; private ClassPathXmlApplicationContext context; }
- Override start(), stop() and getService(QName) Methods
UCDUserServiceOverrideResourceLoader.java
package edu.ucdavis.iet.mw.kuali.rice; import org.kuali.rice.resourceloader.BaseResourceLoader; import javax.xml.namespace.QName; import org.apache.xbean.spring.context.ClassPathXmlApplicationContext; import edu.iu.uis.eden.KEWServiceLocator; public class UCDUserServiceOverrideResourceLoader extends BaseResourceLoader { public UCDUserServiceOverrideResourceLoader(){ super(new QName("IdentityManagementOverrideResourceLoader")); } private static final String SPRING_FILE = "classpath:SpringBeans.xml"; private ClassPathXmlApplicationContext context; public Object getService(QName serviceName) { String springServiceName = serviceName.getLocalPart(); if (KEWServiceLocator.USER_SERVICE.equals(springServiceName)) { return context.getBean(springServiceName); } return super.getService(serviceName); } public void start() throws Exception { context = new ClassPathXmlApplicationContext(SPRING_FILE); super.start(); } public void stop() throws Exception { if (context != null) { context.stop(); context = null; } super.stop(); } }
Implement User Service
- Create UCDUserService Class:
- Implement ??? Methods
UCDUserService.java
package edu.ucdavis.iet.mw.kuali.rice; import java.io.InputStream; import java.util.List; import edu.iu.uis.eden.clientapp.vo.UserIdVO; import edu.iu.uis.eden.exception.EdenUserNotFoundException; import edu.iu.uis.eden.user.UserCapabilities; import edu.iu.uis.eden.user.UserId; import edu.iu.uis.eden.user.UserService; import edu.iu.uis.eden.user.WorkflowUser; public class UCDUserService implements UserService { public WorkflowUser copy(WorkflowUser arg0, boolean arg1) { // TODO Auto-generated method stub return null; } public WorkflowUser getBlankUser() { // TODO Auto-generated method stub return null; } public UserCapabilities getCapabilities() { // TODO Auto-generated method stub return null; } public WorkflowUser getWorkflowUser(UserId arg0) throws EdenUserNotFoundException { // TODO Auto-generated method stub return null; } public WorkflowUser getWorkflowUser(UserIdVO arg0) throws EdenUserNotFoundException { // TODO Auto-generated method stub return null; } public void save(WorkflowUser arg0) { // TODO Auto-generated method stub } public List search(WorkflowUser arg0, boolean arg1) { // TODO Auto-generated method stub return null; } public void loadXml(InputStream arg0, WorkflowUser arg1) { // TODO Auto-generated method stub } }
- Declare UCDUserService in Spring Context
- Under /src/main/resources create a file named SpringBeans.xml
- Edit SpringBeans.xml:
SpringBeans.xml
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="enUserService" class="edu.ucdavis.iet.mw.kuali.rice.UCDUserService"/> </beans>
Reference
https://test.kuali.org/confluence/display/KULRICE/Workflow+Plugin+Guide
https://test.kuali.org/confluence/display/KULRICE/JA-SIG+Spring+2008+-+Building+the+Plug-in