What is RIDC?Remote IntraDoc Client is a Java enabled API that leverages simple transportation protocols like Socket, HTTP and JAX/WS to execute content service operations in WebCenter Content Server. Each operation by design in the Content Server will execute stateless and return a complete result of the request. Each request object simply specifies the in a Map format (key and value pairs) what service to call and what parameters settings to apply. The result responded with will be built on the same Map format (key and value pairs). The possibilities with RIDC is endless since you can consume any available service (even custom made ones), RIDC can be executed from any Java SE application that has any WebCenter Content Services needs.
WebCenter Portal and the example Accelerator RIDC adapter frameworkWebCenter Portal currently integrates and leverages WebCenter Content Services to enable available use cases in the portal today, like Content Presenter and Doc Lib. However the current use cases only covers few of the scenarios that the Content Server has to offer, in addition to the existing use cases it is not rare that the customer requirements requires additional steps and functionality that is provided by WebCenter Content but not part of the use cases from the WebCenter Portal.The good news to this is RIDC, the second good news is that WebCenter Portal already leverages the RIDC and has a connection management framework in place. The million dollar question here is how can I leverage this infrastructure for my custom use cases.
Oracle A-Team has during its interactions produced a accelerator adapter framework that will reuse and leverage the existing connections provisioned in the webcenter portal application (works for WebCenter Spaces as well), as well as a very comprehensive design patter to minimize the work involved when exposing functionality.
Let me introduce the RIDCCommon framework for accelerating WebCenter Content consumption from WebCenter Portal including Spaces.
How do I get started?Through a few easy steps you will be on your way,
Extract the zip file RIDCCommon.zip to the WebCenter Portal Application file structure (PortalApp)
Open you Portal Application in JDeveloper (PS4/PS5) select to open the project in your application - this will add the project as a member of the application
Update the Portal project dependencies to include the new RIDCCommon project
Make sure that you WebCenter Content Server connection is marked as primary (a checkbox at the top of the connection properties form)
You should by this stage have a similar structure in your JDeveloper Application
Project Portal
Project PortalWebAssets
Project RIDCCommon
Since the API is coming with some example operations that has already been exposed as DataControl actions, if you open Data Controls accordion you should see following:
How do I implement my own operation?
Create a new Java Class in for example com.oracle.ateam.portal.ridc.operation call it (GetDocInfoOperation)
Extend the abstract class com.oracle.ateam.portal.ridc.operation.RIDCAbstractOperation and implement the interface com.oracle.ateam.portal.ridc.operation.IRIDCOperation
The only method you actually are required to implement is execute(RIDCManager, IdcClient, IdcContext)
The best practice to set object references for the operation is through the Constructor, example below public GetDocInfoOperation(String dDocName)By leveraging the constructor you can easily force the implementing class to pass right information, you can also overload the Constructor with more or less parameters as required
Implement the execute method, the work you supposed to execute here is creating a new request binder and retrieve a response binder with the information in the request binder.In this case the dDocName for which we want the DocInfo
Secondly you have to process the response binder by extracting the information you need from the request and restore this information in a simple POJO Java BeanIn the example below we do this in private void processResult(DataBinder responseData) - the new SearchDataObject is a Member of the GetDocInfoOperation so we can return this from a access method.
Since the RIDCCommon API leverage template pattern for the operations you are now required to add a method that will enable access to the result after the execution of the operationIn the example below we added the method public SearchDataObject getDataObject() - this method returns the pre processed SearchDataObject from the execute method
This is it, as you can see on the code below you do not need more than 32 lines of very simple code
1: public class GetDocInfoOperation extends RIDCAbstractOperation implements IRIDCOperation {
2: private static final String DOC_INFO_BY_NAME = "DOC_INFO_BY_NAME";
3: private String dDocName = null;
4: private SearchDataObject sdo = null;
5:
6: public GetDocInfoOperation(String dDocName) {
7: super();
8: this.dDocName = dDocName;
9: }
10:
11: public boolean execute(RIDCManager manager, IdcClient client,
12: IdcContext userContext) throws Exception {
13: DataBinder dataBinder = createNewRequestBinder(DOC_INFO_BY_NAME);
14: dataBinder.putLocal(DocumentAttributeDef.NAME.getName(), dDocName);
15:
16: DataBinder responseData = getResponseBinder(dataBinder);
17: processResult(responseData);
18: return true;
19: }
20:
21: private void processResult(DataBinder responseData) {
22: DataResultSet rs = responseData.getResultSet("DOC_INFO");
23: for(DataObject dobj : rs.getRows()) {
24: this.sdo = new SearchDataObject(dobj);
25: }
26: super.setMessage(responseData.getLocal(ATTR_MESSAGE));
27: }
28:
29: public SearchDataObject getDataObject() {
30: return this.sdo;
31: }
32: }
How do I execute my operation?
In the previous section we described how to create a operation, so by now you should be ready to execute the operation
Step one either add a method to the class com.oracle.ateam.portal.datacontrol.ContentServicesDC or a class of your own choiceRemember the RIDCManager is a very light object and can be created where needed
Create a method signature look like this public SearchDataObject getDocInfo(String dDocName) throws Exception
In the method body - create a new instance of GetDocInfoOperation and meet the constructor requirements by passing the dDocNameGetDocInfoOperation docInfo = new GetDocInfoOperation(dDocName)
Execute the operation via the RIDCManager instance rMgr.executeOperation(docInfo)
Return the result by accessing it from the executed operationreturn docInfo.getDataObject()
1: private RIDCManager rMgr = null;
2: private String lastOperationMessage = null;
3:
4: public ContentServicesDC() {
5: super();
6: this.rMgr = new RIDCManager();
7: }
8: ....
9: public SearchDataObject getDocInfo(String dDocName) throws Exception {
10: GetDocInfoOperation docInfo = new GetDocInfoOperation(dDocName);
11: boolean boolVal = rMgr.executeOperation(docInfo);
12: lastOperationMessage = docInfo.getMessage();
13: return docInfo.getDataObject();
14: }
Get the binaries!
The enclosed code in a example that can be used as a reference on how to consume and leverage similar use cases, user has to guarantee appropriate quality and support.
Download link: https://blogs.oracle.com/ATEAM_WEBCENTER/resource/stefan.krantz/RIDCCommon.zip
RIDC API Referencehttp://docs.oracle.com/cd/E23943_01/apirefs.1111/e17274/toc.htm