Creating a Custom User Interface in WSO2 Governance Registry
Custom UIs are user preferred way to add their own UI implementations into the registry. It is associated
with Media types. CustomUIServiceClient class is needed to add custom UIs.
Writing a Sample Custom UI
1. Create your own java class to process the JSP form.
2. Create an instance for CustomUIServiceClient in your java class.
3. CustomUIServiceClient mainly has three methods. User can apply these methods to add,edit or update their forms.
getTextContent()
addTextContent()
updateTextContent()
4. Here the user has to specify the Media type of the resource to add or edit the resource details.
for eg.
public static void addStaffDetail(HttpServletRequest request, ServletConfig config, HttpSession session) throws UIException { CustomUIServiceClient customUIServiceClient = new CustomUIServiceClient( config, session);
String parentPath = request.getParameter("parentPath");
String resourceName = request.getParameter("resourceName");
String staffID = request.getParameter("staffID");
String staffTitle=request.getParameter("staffTitle");
OMFactory fac = OMAbstractFactory.getOMFactory();
OMElement SID = fac.createOMElement("staffID"", null);
OMElement ST = fac.createOMElement("staffTitle", null);
SID.addAttribute("RID",staffID, null);
ST.addAttribute("RT", staffTitle, null);
SID.addChild(ST);
String content = SID.toString();
customUIServiceClient.addTextContent(parentPath, resourceName, mediaType, description, content);
}
5. User has to write a component.xml file which should be kept in META-INF directory.
Writing Component.xml file
Component.xml contains the CustomUI configuration. User has to define the
uiType
mediaType
uiPath
for example,
<component xmlns="http://products.wso2.org/carbon"> <customUI> <uiType>view</uiType>
<mediaType>text/staff</mediaType>
<uiPath>../jsp/staff_main_ajaxprocessor.jsp</uiPath>
</customUI><customUI> <uiType>add</uiType>
<mediaType>text/staff</mediaType>
<uiPath>../jsp/staff_add_ajaxprocessor.jsp</uiPath>
</customUI>
</component>
Running the Custom UI with Registry
1. Drop your jars into "GREG_HOME/webapps/ROOT/WEB-INF/plugins".
2. Edit the bundle info detail that is in the "bundles.info" file which is located at "GREG_HOME/webapps/ROOT/WEB-INF/eclipse/configuration/org.eclipse.equinox.simpleconfigurator".