X

Best Practices from Oracle Development's A‑Team

RIDC Accelerator for Portal

Introduction

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 framework

WebCenter 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 next 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.

Main Article

Oracle ATEAM, during it's customer interactions, has produced an accelerator adapter framework.  This framework enables reuse and leverage of the existing connections provisioned in a 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

  1. Extract the zip file RIDCCommon.zip to the WebCenter Portal Application file structure (PortalApp)
  2. 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
  3. Update the Portal project dependencies to include the new RIDCCommon project
  4. 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:

RIDCaccelerator_1

How do I implement my own operation?

  1. Create a new Java Class in for example com.oracle.ateam.portal.ridc.operation call it (GetDocInfoOperation)
  2. Extend the abstract class com.oracle.ateam.portal.ridc.operation.RIDCAbstractOperation and implement the interface com.oracle.ateam.portal.ridc.operation.IRIDCOperation
  3. The only method you actually are required to implement is execute(RIDCManager, IdcClient, IdcContext)
  4. 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
  5. 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
  6. 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 Bean
    In 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.
  7. 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 operation.  In the example below we added the method public SearchDataObject getDataObject() - this method returns the pre processed SearchDataObject from the execute method
  8. This is it, as you can see on the code below you do not need more than 32 lines of very simple code
public class GetDocInfoOperation extends RIDCAbstractOperation implements IRIDCOperation {    private static final String DOC_INFO_BY_NAME = "DOC_INFO_BY_NAME";    private String dDocName = null;    private SearchDataObject sdo = null;    public GetDocInfoOperation(String dDocName) {       super();       this.dDocName = dDocName;    }    public boolean execute(RIDCManager manager, IdcClient client, IdcContext userContext)throws Exception {       DataBinder dataBinder = createNewRequestBinder(DOC_INFO_BY_NAME);       dataBinder.putLocal(DocumentAttributeDef.NAME.getName(), dDocName);       DataBinder responseData = getResponseBinder(dataBinder);       processResult(responseData);       return true;    }    private void processResult(DataBinder responseData) {       DataResultSet rs = responseData.getResultSet("DOC_INFO");       for(DataObject dobj : rs.getRows()) {          this.sdo = new SearchDataObject(dobj);       }       super.setMessage(responseData.getLocal(ATTR_MESSAGE));    }    public SearchDataObject getDataObject() {       return this.sdo;    } }

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:

  1. Step one either add a method to the class  com.oracle.ateam.portal.datacontrol.ContentServicesDC or a class of your own choice
  2. Remember the RIDCManager is a very light object and can be created where needed
  3. Create a method signature look like this public SearchDataObject getDocInfo(String dDocName) throws Exception
  4. In the method body - create a new instance of GetDocInfoOperation and meet the constructor requirements by passing the dDocName
    GetDocInfoOperation docInfo = new GetDocInfoOperation(dDocName)
  5. Execute the operation via the RIDCManager instance rMgr.executeOperation(docInfo)
  6. Return the result by accessing it from the executed operation; return docInfo.getDataObject()

 

private RIDCManager rMgr = null; private String lastOperationMessage = null; public ContentServicesDC() {    super();    this.rMgr = new RIDCManager(); } public SearchDataObject getDocInfo(String dDocName) throws Exception {    GetDocInfoOperation docInfo = new GetDocInfoOperation(dDocName);    boolean boolVal = rMgr.executeOperation(docInfo);    lastOperationMessage = docInfo.getMessage();    return docInfo.getDataObject(); }

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 RIDCCommon

RIDC API Reference: http://docs.oracle.com/cd/E23943_01/apirefs.1111/e17274/toc.htm

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha

Recent Content